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 <stdio.h>
#include <math.h>

using namespace std;


int main(){
	char buf1[101],buf2[101];
	bool FLG1,FLG2;
	int n,length1,length2,S1,S2,num1_index,num2_index,kuriagari=0,check1,check2;
	int output[9],num1[9],num2[9];
	scanf("%d",&n);

	for(int loop=0;loop<n;loop++){
		length1 = length2 = 0;
		scanf("%s",buf1);
		scanf("%s",buf2);
		for(int i=0; buf1[i] !='\0';i++)length1++;
		for(int i=0; buf2[i] !='\0';i++)length2++;

		if(length1 >=81 || length2 >= 81)printf("overflow\n");
		else{
			FLG1=FLG2=false;
			num1_index = num2_index = 0;
			for(int k=0;k<9;k++){
				num1[k] = num2[k] = output[k]=-1;//????????¨??????????????????
			}

			for(int k=0;k<81&&(FLG1==false||FLG2==false);){
				S1=S2=0;
				check1=check2=0;
				for(int p=0;p<9&&k<81;p++,k++){
					if(k <= length1-1){
						S1 = 10*S1 + (buf1[k] - '0');
						check1++;
					}else{
						FLG1=true; //??????
					}

					if(k <= length2-1){
						S2 = 10*S2+(buf2[k] - '0');
						check2++;
					}else{
						FLG2=true; //??????
					}
				}
				if(check1>0){
					num1[num1_index++] = S1;
				}
				if(check2>0){
					num2[num2_index++] = S2;
				}
			}

			for(int calc=0;calc<=8;calc++){
				if(num1[calc] == -1 && num2[calc] == -1){
					break;
				}else{
					output[calc] = kuriagari;
					if(num1[calc] != -1){
						output[calc] += num1[calc];
					}
					if(num2[calc] != -1){
						output[calc] += num2[calc];
					}
					if(output[calc]/1000000000 >= 1){
						kuriagari = output[calc]/1000000000;
						output[calc] %= 1000000000;
					}else{
						kuriagari = 0;
					}
				}
			}

			if(output[8]/100000000 >= 1){
				printf("overflow\n");
			}else{
				bool firstFLG=true;
				for(int show=8;show>=0;show--){
					if(output[show] != -1){
						if(firstFLG == false && output[show] < 100000000){
							printf("%09d",output[show]);
						}else{
							printf("%d",output[show]);
							firstFLG = false;
						}
					}
				}
				printf("\n");
			}
		}
	}

    return 0;
}

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

using namespace std;

void add(string &a, string &b) {
	if (a.size() > 80 || b.size() > 80) {
		cout << "overflow" << endl;
		return;
	}

	string aa = a;
	string bb = b;
	reverse(aa.begin(), aa.end());
	reverse(bb.begin(), bb.end());
	string cc;
	int carry = 0;
	int sa = a.size();
	int sb = b.size();
	int ss = sa>sb ? sa : sb;
	for (int i = 0; i < ss; i++) {
		char ca = i < sa ? aa[i] : '0';
		char cb = i < sb ? bb[i] : '0';
		char code = ca + cb + carry - '0';
		if (code > '9') {
			code -= 10;
			carry = 1;
		} else
			carry = 0;
		cc += code;
	}

	if (carry)
		cc += '1';

	if (cc.size() > 80)
		cout << "overflow" << endl;
	else {
		reverse(cc.begin(), cc.end());
		cout << cc << endl;
	}
}

int main() {
	int n;
	string a, b;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a >> b;
		add(a, b);
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;++i){
		string a,b,c;
		int d=0,st;
		cin>>a>>b;
		for(int j=a.size();j<80;++j) a="0"+a;
		for(int j=b.size();j<80;++j) b="0"+b;
		reverse(a.begin(), a.end());
		reverse(b.begin(), b.end());
		for(int j=0;j<80;++j){
			c+=((a[j]-'0')+(b[j]-'0')+d)%10+'0';
			d=((a[j]-'0')+(b[j]-'0')+d)/10;
		}
		if(d) cout<<"overflow\n";
		else{
			reverse(c.begin(), c.end());
			for(st=0;;++st)if(c[st]!='0')break;
			cout<<c.substr(st,c.size()-st)<<"\n";
		}
	}
	return 0;
}

C++: n = int(input())

for i in range(n):
    a = int(input())
    b = int(input())

    print(a + b)

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

using namespace std;

int main() {
    int N;
    cin >> N;
    while(N--) {
        string s1, s2;
        cin >> s1 >> s2;

        if(s1.size() > 80 || s2.size() > 80) {
            cout << "overflow" << endl;
            continue;
        }
        char buf[81] = {0};
        int p1 = s1.size()-1, p2 = s2.size()-1, pb = 79;
        int carry = 0;
        while(p2 >= 0) buf[pb--] = s2[p2--];
        pb = 79;
        while(pb >= 0 && (p1 >= 0 || carry > 0)) {
            int bd = buf[pb];
            if(bd > 0) bd -= '0';
            int bp = 0;
            if(p1 >= 0) bp = s1[p1--]-'0';
            int d = bp + bd + carry;
            carry = d / 10;
            d %= 10;
            buf[pb--] = d+'0';
        }
        if(pb == -1 && carry > 0) cout << "overflow" << endl;
        else {
            if(carry > 0) buf[pb--] = carry+'0';
            cout << (char*)(buf+(pb+1)) << endl;
        }
    }
    return 0;
}