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;
typedef long long int lld;

int main(){
  int n;
  cin >> n;
  while(n--){
    string a,b; cin >> a >> b;
    if(a.size() > 80 || b.size() > 80){
      cout << "overflow" << endl;
      continue;
    }
    if(a.size() < b.size()) swap(a,b);
    for(int i=a.size()-1,j=b.size()-1;i>=0;i--,j--){
      if(j >= 0) a[i] += b[j]-'0';
      if(a[i] > '9'){
	a[i] -= 10;
	if(i == 0) a = "1" + a;
	else a[i-1]++;
      }
    }
    if(a.size() > 80) cout << "overflow" << endl;
    else cout << a << endl;
  }
}

C++: #include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int main(){
  int n;
  string s1,s2,ans;
  cin >> n;
  
  for(int i=0; i<n; i++){
    cin >> s1;
    cin >> s2;
    int m = max(s1.size(),s2.size());
    while(m>s1.size()) '0' + s1;
    while(m>s2.size()) '0' + s2;

    int carry = 0;
    for(int j=m-1; m>=0; m--){
      char ch = ((s1[m]-'0') + (s2[m]-'0') + carry)%10 + '0';
      carry = ((s1[m]-'0') + (s2[m]-'0') + carry)/10;
      ans.append(ch);
    }
    if(carry) ans.append(carry+'0');
    reverse(ans.begin(),ans.end());

    //頭の0を削除していく
    while(ans.size()>1 && ans[0] == '0') ans.erase(ans.begin());
    if(ans.size() > 80) cout << 'overflow' << endl;
    cout << ans << 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[82],suji2[82];
		char ans[82] = {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 < 80;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 >=81) overflow = 1;
		reverse(ans,ans+anss);
		ans[anss] = 0;
		if(overflow >= 1)
		{
			printf("overflow\n");
		}
		else
		{
			printf("%s\n",ans);
		}
		
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<cstdio>
#include<stack>
#include<algorithm>
using namespace std;
string str1;
string str2;
stack<int> sta;

int main()
{
  int n;
  int i,j;
  int exc;//??°?????????
  int sum;

  cin>>n;
  for(i=0;i<n;i++){
    cin>>str1;
    cin>>str2;
    if(str1.size()>80 || str2.size()>80){
      cout<<"overflow"<<endl;
      return 0;
    }
    exc=0;
    for(j=1;j<=min(str1.size(),str2.size());j++){
      sum=str1[str1.size()-j]-'0'+str2[str2.size()-j]-'0'+exc;
      exc=sum/10;
      sta.push(sum%10);
    }
    if( str1.size() < str2.size() ){
      while(j<=str2.size()){
	sum=str2[str2.size()-j]-'0'+exc;
	exc=sum/10;
	sta.push(sum%10);
	j++;
      }
    }else if( str1.size() > str2.size() ){
      while(j<=str1.size()){
	sum=str1[str1.size()-j]-'0'+exc;
	exc=sum/10;
	sta.push(sum%10);
	j++;
      }
    }
    if(max(str1.size(),str2.size())==80 && exc==1){
      cout<<"overflow"<<endl;
      return 0;
    }
    if(exc)
      cout<<exc;
    for(j=0;j<max(str1.size(),str2.size());j++){  
      cout<<sta.top();
      sta.pop();
    }
    cout<<endl;
  }
}

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';
        }
        while(buf[pb]) pb--;
        if(pb == -1 && carry > 0) cout << "overflow" << endl;
        else cout << (char*)(buf+(pb+1)) << endl;
    }
    return 0;
}