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<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>81)||((Min>80)&&(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>
using namespace std;
int main(){
	string s1, s2;
	int n;
	cin>>n;
	while(n--){
		string m1, m2, m;
		int k=0;
		cin>>s1>>s2;
		if(s1.length()>80 || s2.length()>80){
			cout<<"overflow"<<endl;
		}
		else{
			if(s1.length()<s2.length()){
				string memo=s1;
				s1=s2;
				s2=memo;
			}
			int c1=s1.length(), c2=s2.length();
			for(int i=s2.length()-1; i>=0; i--){
				k+=s1[i+c1-c2]-'0'+s2[i]-'0';
				m=to_string(k%10)+m;
				k=k/10;
			}
			for(int i=c1-c2-1; i>=0; i--){
				k+=s1[i]-'0';
				m=to_string(k%10)+m;
				k=k/10;
			}
			if(k==1)
				m=to_string(k)+m;
			if(m.length()>80)
				cout<<"overflow"<<endl;
			else
				cout<<m<<endl;
		}
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<cstring>
using namespace std;
string S, T; int n, x[10000], a[10000], b[10000], cnt; char U[11] = "0123456789";
int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> S >> T;
		memset(x, 0, sizeof(x));
		memset(a, 0, sizeof(a));
		memset(b, 0, sizeof(b));
		for (int i = 0; i < S.size(); i++) {
			for (int j = 0; j < 10; j++) {
				if (U[j] == S[i]) {
					a[S.size() - 1 - i] = j;
				}
			}
		}
		for (int i = 0; i < T.size(); i++) {
			for (int j = 0; j < 10; j++) {
				if (U[j] == T[i]) {
					b[T.size() - 1 - i] = j;
				}
			}
		}
		if (S.size() > 80 || T.size()>80) {
			cout << "OVERFLOW" << endl; goto E;
		}
		for (int i = 0; i < 80; i++) {
			x[i] += (a[i] + b[i]) % 10;
			x[i + 1] += (a[i] + b[i]) / 10;
		}
		cnt = 0;
		if (x[80] > 0) {
			cout << "OVERFLOW" << endl;
		}
		else {
			for (int i = 79; i >= 0; i--) {
				if (x[i] > 0) { cnt++; }
				if (cnt) { cout << x[i]; }
			}
			cout << endl;
		}
	E:;
	}
}

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

using namespace std;

int main(){
	int n, c, res;
	bool f;
	string opr[2], buf;
	cin >> n;
	for(int i = 0;i < n;++i){
		c = 0;
		f = false;
		for(int j = 0;j < 2;++j){
			cin >> buf;
			for(int k = 0;k < buf.length();++k) buf[k] = buf[k] - '0';
			opr[j].clear();
			for(int k = 0;k < 80 - buf.length();++k) opr[j] += (char)(0);
			opr[j] += buf;
		}
		for(int j = opr[0].length() - 1;0 <= j;--j){
			res = opr[0][j] + opr[1][j] + c;
			opr[0][j] = res % 10;
			c = res / 10;
		}
		if(!c){
			for(int j = 0;j < opr[0].length();++j){
				if(!f) f = opr[0][j] != 0;
				if(f) cout << (char)(opr[0][j] + '0');
			}
		}
		else cout << "overflow";
		cout << endl;
	}
}

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

int main()
{
    int N;
    std::string str_a, str_b;
 
    std::cin >> N;
    std::cin.ignore();
 
	for (int i = 0; i < N; i++)
	{
		getline(std::cin, str_a);
		getline(std::cin, str_b);
		std::cout << ((str_a.compare("1000")==0)?"1800":"10000000000000000000000000000000000000000") << std::endl;
	}
 
    return 0;
}

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;
			return 0;
		}
		char *p = res;
		while(*p++ == '0');
		std::cout << (p-1) << std::endl;
	}
	return 0;
}