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 <stdlib.h>
#include <string.h>

int main(void) {

  int n;

  char buf[1000];
  char outbuf[1000];

  char c;

  int a[1000],b[1000];
  int result[1000];
  
  int sum,carry;
  int idx1,idx2;
  int maxlen;

  int i,j;

  scanf("%d",&n);

  c=getchar();

  for(i=0;i<n;i++) {

    fgets(buf,sizeof(buf),stdin);

    idx1=0;

    while(buf[idx1]!='\n') {

      a[idx1]=buf[idx1]-48;

      idx1++;

    }

    //for(j=0;j<idx1;j++) printf("%d",a[j]);

    fgets(buf,sizeof(buf),stdin);

    idx2=0;

    while(buf[idx2]!='\n') {

      b[idx2]=buf[idx2]-48;

      idx2++;

    }

    if(idx1>idx2) maxlen=idx1;
    
    else maxlen=idx2;

    carry=0;

    for(j=0;j<maxlen;j++) {

      if(j<idx1 && j<idx2) sum=a[idx1-j-1]+b[idx2-j-1]+carry;

      else if(j>=idx1) sum=b[idx2-j-1]+carry;

      else sum=a[idx1-j-1]+carry;


      if(sum>=10) carry=1;

      else carry=0;

      result[j]=sum%10;

    }
    //printf("%d\n",carry);
    if(carry==1) {

      if(maxlen>=80) printf("overflow\n");

      else {

	outbuf[0]='1';

	for(j=0;j<maxlen;j++) {

	  outbuf[j+1]=result[maxlen-j-1]+48;

	}

	outbuf[maxlen+1]='\0';

	printf("%s",outbuf);

	puts("");

      }

    }

    else {

      for(j=0;j<maxlen;j++) {

	outbuf[j]=result[maxlen-j-1]+48;

      }

      outbuf[maxlen]='\0';

      printf("%s",outbuf);

      puts("");

    }

  }

  return 0;

}

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

using namespace std;

int main (void) {
    int N;
    cin >> N;
    while (N--) {
        string s1, s2;
        cin >> s1;
        cin >> s2;
        vector<int> n1, n2, res;
        for (int i = s1.size(); i--;) {
            n1.push_back((int)(s1[i] - '0'));
        }
        for (int i = s2.size(); i--;) {
            n2.push_back((int)(s2[i] - '0'));
        }
        if (n1.size() < n2.size()) {
            for (int i = n1.size(); i < n2.size(); i++) {
                n1.push_back(0);
            }
        } else if (n2.size() < n1.size()) {
            for (int i = n2.size(); i < n1.size(); i++) {
                n2.push_back(0);
            }
        }
        int s, c = 0;
        for (int i = 0; i < n1.size(); i++) {
            s = n1[i] + n2[i] + c;
            res.push_back(s % 10);
            c = s / 10;
        }
        while (c != 0) {
            res.push_back(c % 10);
        }
        int size = res.size();
        while (size > 0 && res[size - 1] == 0) {
            size--;
        }
        if (size > 80) {
            cout << "overflow" << endl;
        } else {
            int i = size;
            while (i--) {
                cout << res[i];
            }
            cout << endl;
        }
    }
    return 0;
}

C++: #include<stdio.h>
#include<iostream>
#include<string>
using namespace std;
int main(){

int n;
cin>>n;
for(int iii=0;iii<n;iii++){
string st1,st2;
int n1[83]={},n2[83]={};
cin>>st1>>st2;

int r=st1.size();
int N[83]={};int y=0;
if(r<st2.size())r=st2.size();
if(st1.size()>80||st2.size()>80)r=81;
else{
for(int i=0;i<st1.size();i++)
n1[i]=st1[st1.size()-i-1]-'0';
for(int i=0;i<st2.size();i++)
n2[i]=st2[st2.size()-i-1]-'0';



for(int i=0;i<r;i++){
N[i]=(n1[i]+n2[i]+y)%10;
y=(n1[i]+n2[i]+y)/10;
if(i==r-1&&y>0)r++;
}}
if(r>80)cout<<"overflow"<<endl;
else{
for(int i=0;i<r;i++)
cout<<N[r-i-1];
cout<<endl;
}}
return 0;
}

C++: #include "bits/stdc++.h"
using namespace std;
int main() {
	cin.tie(0); ios::sync_with_stdio(false);
	int N; cin >> N;
	for (int i = 0; i < N;i++) {
		string str1, str2;
		cin >> str1 >> str2;
		int c = 0;	//????????°?????????
		if (str1.length() > str2.length()) {
			string temp(str1.length() - str2.length() + 1,'0');
			str1 = '0' + str1;
			str2 = temp + str2;
		}
		else if (str1.length() < str2.length()) {
			string temp(str2.length() - str1.length() + 1, '0');
			str1 = temp + str1;
			str2 = '0' + str2;
		}
		string ans((int)str1.length(),'0');
		for (int i = str1.length()-1 ; i >= 0;i--) {
			int dig1 = str1[i] - '0', dig2 = str2[i] - '0';
			if (c + dig1 + dig2 >= 10) {
				ans[i] = (c + dig1 + dig2) % 10 +'0';
				c = (c + dig1 + dig2)/10;
			}
			else {
				ans[i] = (c + dig1 + dig2) + '0';
				c = (c + dig1 + dig2) / 10;
			}
		}
		int size = ans.length();
		if (ans[0] == '0') size--;
		if (size > 80)cout << "overflow" << endl;
		else {
			if (ans[0] == '0') {
				cout << ans.substr(1) << endl;
			}
			else {
				cout << ans << endl;
			}
		}
	}
}