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++: import java.io.BufferedReader;
import java.io.InputStreamReader;

//©Èè¢B[vÉHvÌ]n è
//public class Problem0015_NationalBudget {
public class Main {
	public static void main(String[] args) {
		try {
		//	Problem0015_NationalBudget test = new Problem0015_NationalBudget();
			Main test = new Main();
			
			
			BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
			
			int problemNumber = Integer.parseInt(reader.readLine());
			for(int i = 0; i < problemNumber; i++) {
				String origin = reader.readLine();
				String addition = reader.readLine();
				
				String result = test.getSum(origin, addition);
				if(result == null) {
					System.out.println("overflow");
				} else {
					System.out.println(result);
				}
			}
			
		} catch(Exception e) {
			e.printStackTrace();
		}
	/*	Problem0015_NationalBudget test = new Problem0015_NationalBudget();
		for(int i = 0; i < 11; i++) {
			for(int j = 0; j < 11; j++) {
				String answer = test.getSum(Integer.toString(i), Integer.toString(j));
				if(i+j < 10) {
					if(answer.equals(Integer.toString(i+j))) {
						System.out.println(i + " + " + j + " = " + answer);
					} else {
						System.err.println(i + " + " + j + " = " + answer);
					}
				} else {
					if(answer == null) {
						System.out.println(i + " + " + j + " = " + "overflow");
					} else {
						System.err.println(i + " + " + j + " = " + answer);
					}
				}
			}
		}
	*/
	}
	String getSum(String origin, String addition) {
		final int CEILLING = 79;
		char[] originArray = origin.toCharArray();
		char[] additionArray = addition.toCharArray();
		
		char[] maxCharArray = (originArray.length < additionArray.length ? additionArray : originArray);
		char[] minCharArray = (originArray.length < additionArray.length ? originArray : additionArray);
		
		if(maxCharArray.length > CEILLING) {	//overflow ÌÆ«Í null ðÔ·B
			return null;
		}
		
		int[] resultNumberArray = new int[maxCharArray.length + 1];	//ªPÂãªéÂ\«ª éB
		int position;
		for(position = 1; position < minCharArray.length +1; position++) {
			int originNumber = Integer.parseInt("" + maxCharArray[maxCharArray.length - position]);
			int additionNumber = Integer.parseInt("" +minCharArray[minCharArray.length - position]);
			int sum = originNumber + additionNumber + resultNumberArray[resultNumberArray.length-position];
		//	System.out.println(maxCharArray[maxCharArray.length - position] + " + " + minCharArray[minCharArray.length - position] + " = " + sum);
			if(sum < 10) {
				resultNumberArray[resultNumberArray.length-position] = sum;
			} else {	//0<= sum < 19 æèJèãªèª"1"­¶
				sum = sum - 10;
				resultNumberArray[resultNumberArray.length-position] = sum;
				resultNumberArray[resultNumberArray.length-position -1] += 1;
			}
		}
		for(; position < maxCharArray.length + 1; position++) {
			int maxCharNumber = Integer.parseInt("" + maxCharArray[position - position]);
			int sum = resultNumberArray[resultNumberArray.length-position] + maxCharNumber;
			
			if(sum < 10) {
				resultNumberArray[resultNumberArray.length-position] = sum;
			} else {
				sum = sum - 10;
				resultNumberArray[resultNumberArray.length-position] = sum;
				resultNumberArray[resultNumberArray.length-position -1] += 1;
			}
		}
		if(resultNumberArray.length > CEILLING+1 ||(resultNumberArray.length == CEILLING+1 && resultNumberArray[0] > 0)) {
								//ªãªÁÄ80ð´¦½ê
			return null;
		}
		StringBuilder textBuilder = new StringBuilder();
		for(int number : resultNumberArray) {
			textBuilder.append(Integer.toString(number));
		}
		String result = textBuilder.toString();
		if(result.startsWith("0")) {
			result = result.substring(1);
		}
		return result;
	}
}

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

#define loop(i,a,b) for(int i=(a); i<(int)(b); i++)
#define rep(i,b) loop(i,0,b)
#define all(c) (c).begin(), (c).end()
 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

int main() {
  int n; cin >> n;
  while(n--) {
    string s1, s2; cin >> s1 >> s2;
      int m = max(s1.size(), s2.size());
      while(m != s1.size()) s1 = '0' + s1;
      while(m != s2.size()) s2 = '0' + s2;
      string ans;
      int c = 0;
      for(int i = m-1; i >= 0; i--) {
        int sum = s1[i]-'0' + s2[i]-'0' + c;
        c = sum/10;
        sum %= 10;
        ans += sum + '0';
      }
      if(c == 1) ans += '1';
      reverse(all(ans));
      if(ans.size() <= 80) cout << ans << endl;
      else cout << "overflow" << endl;
  }
}