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<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[100000],suji2[100000];
		char ans[100000] = {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 < 81;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++;
		}
		else if(anss = 80)
		{
			ans[80] <= '1';
		}
		if(anss > 80) overflow = 1;
		reverse(ans,ans+anss);
		ans[anss] = 0;
		if(overflow >= 1)
		{
			printf("overflow\n");
		}
		else
		{
			printf("%s",ans);
		}
		printf("\n");
		
	}
	return 0;
}

C++: #include <stdio.h>

void rev_str(char str[128]) {
	int length = 0;
	char str2[128];
	int temp;

	int i;

	for(i = 0; i < 128; i++)
		str2[i] = '\0';

	while(str[length])
		length++;

	temp = length;
	i = 0;
	while(temp) {
		str2[temp - 1] = str[i];
		i++;
		temp--;
	}

	for(i = 0; i < length; i++)
		str[i] = str2[i];
}

int exor(int a, int b) {
	if(a && b)
		return 0;
	else if(a || b)
		return 1;
	else
		return 0;
}

int main() {
	char input_a[128];
	char input_b[128];
	char ans[128];
	char kuriagari;
	int temp;
	int n;

	int i, j;

	scanf("%d", &n);

	for(j = 0; j < n; j++) {
		for(i = 0; i < 128; i++) {
			input_a[i] = '\0';
			input_b[i] = '\0';
			ans[i] = '\0';
		}

		kuriagari = 0;

		scanf("%s", input_a);
		scanf("%s", input_b);

		rev_str(input_a);
		rev_str(input_b);

		i = 0;
		while(input_a[i] && input_b[i]) {
			temp = input_a[i] + input_b[i] - 2 * '0' + kuriagari;
			ans[i] = temp % 10 + '0';
			kuriagari = temp / 10;
			i++;
		}
		
		if(kuriagari && !input_a[i] && !input_b[i]) {
			ans[i] = kuriagari + '0';
		}
		
		else {
			while (kuriagari && exor((int)input_a[i], (int) input_b[i])) {
				temp = input_a[i] + input_b[i] - '0' + kuriagari;
				ans[i] = (char)(temp % 10 + '0');
				kuriagari = temp / 10;
				i++;
			}

			if (kuriagari)
				ans[i] = kuriagari + '0';
		}

		while(input_b[i]) {
			ans[i] = input_b[i];
			i++;
		}

		while(input_a[i]) {
			ans[i] = input_a[i];
			i++;
		}

		rev_str(ans);

		if(ans[81])
			printf("overflow");
		else
			printf("%s", ans);

		putchar('\n');
	}
	return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

string sum(string &a, string &b)
{
    if (a.size() < b.size()) swap(a, b);
    reverse(a.begin(), a.end());
    reverse(b.begin(), b.end());

    int N = a.size();
    
    while ((int)b.size() < N) {
        b.push_back('0');
    }
    
    bool up = 0;
    string res;
    for (int i = 0; i < N; i++) {
        int v = up + (a[i] - '0') + (b[i] - '0');
        if (v >= 10) {
            up = 1;
            v %= 10;
        } else {
            up = 0;
        }
        res += to_string(v);
    }
    if (up) res += "1";
    reverse(res.begin(), res.end());
    return res;
}

int main()
{
    int N;
    string a, b;
    cin >> N;
    while (N--) {
        cin >> a >> b;
        string res = sum(a, b);
        if (res.size() > 80) {
            cout << "overflow" << endl;
        } else {
            cout << res << endl;
        }
    }
    return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;
int main() {
  int N;
  cin >> N;
  for (int i = 0; i < N; i++) {
    char a[1000];
    char b[1000];
    char sum[1000];
    scanf("%s\n", a);
    scanf("%s\n", b);
    if (strlen(a) > 80 || strlen(b) > 80) {
      cout << "overflow" << endl;
      continue;
    }
    int c = 0;
    int al = strlen(a);
    int bl = strlen(b);
    for (int i = 0; i < max(al, bl); i++) {
      int da, db;
      if (al-i-1>=0) da = a[al-i-1] - '0';
      else da = 0;
      if (bl-i-1>=0) db = b[bl-i-1] - '0';
      else db = 0;
      int s = da + db + c;
      if (s >= 10) {
        s -= 10;
        c = 1;
      } else {
        c = 0;
      }
      sum[i] = s + '0';
    }

    if ((al == 80 || bl == 80) && c == 1) {
      cout << "overflow" << endl;
      continue;
    }

    if (c == 1) cout << '1';
    for (int i = max(al, bl) - 1; i >= 0; i--) {
      cout << sum[i];
    }
    cout << endl;
  }
  return 0;
}