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 <bits/stdc++.h>
using namespace std;

#define times(n, i) uptil(0, n, i)
#define upto(f, t, i) for(auto _##i = (t), i = decltype(_##i)(f) poi  i <= _##i poi  i++)
#define uptil(f, t, i) for(auto _##i = (t), i = decltype(_##i)(f) poi  i < _##i poi  i++)
#define downto(f, t, i) for(auto i = (f), _##i = decltype(i)(t) poi  i >= _##i poi  i--)
#define downtil(f, t, i) for(auto i = (f), _##i = decltype(i)(t) poi  i > _##i poi  i--)

#define unless(c) if(!(c))
#define until(c) while(!(c))
#define loop while(true)

#define poi ;
#define poipoi << "\n"

#define fuwafuwa(n, c) dokidoki((n) + (c) - 1, c)
#define dokidoki(n, c) ((n) / (c) * (c))

template<class T> bool read(T& t){
    return cin >> t poi
}
template<class T, class...U> bool read(T& t, U&... u){
    unless(cin >> t) return false poi
    return read(u...) poi
}

const int PYON = 80 poi

int main(){
    int N poi
    cin >> N poi
    times(N, i){
        string A, B poi
        cin >> A >> B poi
        if(A.size() > PYON || B.size() > PYON){
            cout << "overflow" poipoi poi continue poi
        }
        vector<int> a(PYON, 0), b(PYON, 0) poi
        upto(1, A.size(), i) a[PYON - i] = A[A.size() - i] - '0' poi
        upto(1, B.size(), i) b[PYON - i] = B[B.size() - i] - '0' poi
        int pyon = 0 poi
        vector<int> sum(PYON) poi
        downto(PYON - 1, 0, i){
            sum[i] = a[i] + b[i] + pyon poi
            pyon = sum[i] / 10 poi
            sum[i] %= 10 poi
        }
        if(pyon) cout << "overflow" poi
        else times(PYON, i) if((pyon = pyon || sum[i])) cout << sum[i] poi
        cout poipoi poi
    }
    return 0 poi
}

C++: #include <iostream>
#include <cstdio>
#include <cstdlib>
using namespace std;

int main(){
	int n;
	cin >> n;
	for(int j=0;j<n;j++){
		char a[81],b[81],c[81];
		int ka = 0;
		int kb = 0;
		int kc = 0;
		bool ovf = false;
		cin >> a[ka];
		ka++;
		while(1){
			scanf("%c",&a[ka]);
			if(ka==80 and a[ka]!='\n') ovf = true;
			if(a[ka]=='\n' or ovf) break;
			ka++;
		}
		while(1){
			scanf("%c",&b[kb]);
			if(kb==80 and b[kb]!='\n') ovf = true;
			if(b[kb]=='\n' or ovf) break;
			kb++;
		}
		int k = 0;
		char t;
		for(int i=0;i<81;i++){
			if(i==80 and k==1) ovf = true;
			if((ka<=i and kb<=i) or ovf) break;
			int ia = 0;
			t = a[ka-i-1];
			if(ka>=i) ia = atoi(&t);
			int ib = 0;
			t = b[kb-i-1];
			if(kb>=i) ib = atoi(&t);
			int s = ia + ib + k;
			k = 0;
			if(s>9){ k = 1; s = s%10;}
			sprintf(&c[i],"%d",s);
			kc++;
		}
		if(ovf) cout << "overflow" << endl;
		else{
			for(int i=kc-1;i>=0;i--) cout << c[i];
			cout << endl;
		}
	}
}

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

using namespace std;

void solve()
{
	int n;
	cin >> n;
	while(n--)
	{
		string l, s;
		cin >> l >> s;
		if(l.size() < s.size())
		{
			swap(l, s);
		}
		reverse(l.begin(), l.end());
		reverse(s.begin(), s.end());
		string sum;
		
		int sizel = l.size();
		int sizes = s.size();
		int buf = 0;
		for(int i = 0; i < sizes; ++i)
		{
			sum += (l[i] + s[i] - '0' - '0' + buf) % 10 + '0';
			buf = (l[i] + s[i] - 2 * '0' + buf) / 10;
		}
		for(int i = sizes; i < sizel; ++i)
		{
			sum += (l[i] - '0' + buf) % 10 + '0';
			buf = (l[i] - '0' + buf) / 10;
		}
		if(buf > 0)
		{
			sum += buf + '0';
		}
		int size = sum.size();
		if(size > 80)
		{
			cout << "overflow" << endl;
			continue;
		}
		for(int i = size - 1; i >= 0; --i)
		{
			cout << sum[i];
		}
		cout << endl;
	}
}

int main()
{
	solve();
	return(0);
}

C++: #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(){

	int sn;
	int i;
	int j,k;
	int flg;
	char in_a[82];
	char in_b[82];
	char str_a[82];
	char str_b[82];
	char str_sum[82];
	char c;
	char cs[3];
	char *p;
	int a,b,carry;

	scanf("%d",&sn);

	for(i=1;i<=sn;i++){

		scanf("%81s%*[^\n]",in_a);
		scanf("%81s%*[^\n]",in_b);

		flg=0;
		//chk a
		if(strlen(in_a)>80)flg=1;
		if(strlen(in_b)>80)flg=1;


		if(!flg){
			sprintf(str_a,"%81s",in_a);
			sprintf(str_b,"%81s",in_b);
//printf("in_a  %s\nstr_a  %s\nin_b  %s\nstr_b  %s\n",in_a,str_a,in_b,str_b);
//printf("in_a  %d\nstr_a  %d\nin_b  %d\nstr_b  %d\n",strlen(in_a),strlen(str_a),strlen(in_b),strlen(str_b));
			carry=0;
			for(j=80;j>0;j--){
				cs[0]=str_a[j];
				cs[1]='\0';
				a=atoi(cs);
				cs[0]=str_b[j];
				cs[1]='\0';
				b=atoi(cs);
				sprintf(cs,"%02d",a+b+carry);
				if(cs[0]=='0')carry=0;
				if(cs[0]=='1')carry=1;
				str_sum[j]=cs[1];
			}
			str_sum[0]='0';
			str_sum[81]='\0';
			if(carry){
				flg=1;
				str_sum[0]='1';
			}
			p=str_sum;
			while(*p=='0'&&p!=&str_sum[80])p++;
			//printf("%81s\n%81s\n%81s\n",str_a,str_b,str_sum);
		}
		flg?printf("overflow\n"):printf("%s\n",p);
	}

	return 0;
}