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 <iostream>

int main()
{
        char a[1000], b[1000];
        int c[80], ca, cb, set, up = 0;
        std::cin >> set;

        for(int i = 0; i < set; ++i)
        {
                for(int j = 0; j < 80; ++j)
                        c[j] = 0;
                up = ca = cb = 0;
                std::cin >> a >> b;

                for(int j = 0; j < 1000; ++j)
                        if((a[j] - '0' < 0) || (a[j] - '0' > 9))
                        {
                                ca = j - 1;
                                break;
                        }

                if(ca > 79)
                {
                        std::cout << "overflow" << std::endl;
                        continue;
                }

                for(int j = 0; j < 1000; ++j)
                        if((b[j] - '0' < 0) || (b[j] - '0' > 9))
                        {
                                cb = j - 1;
                                break;
                        }

                if(cb > 79)
                {
                        std::cout << "overflow" << std::endl;
                        continue;
                }
                for(int j = 0; j < 80; ++j)
                {
                        if(ca < j && cb < j)
                        {
                                c[j] = up % 10;
                                up = up / 10;
                        }
                        else if(ca < j)
                        {
                                c[j] = (b[cb - j] - '0' + up) % 10;
                                up = (b[cb - j] - '0' +up) / 10;
                        }
                        else if(cb < j)
                        {
                                c[j] = (a[ca - j] - '0' + up) % 10;
                                up = (a[ca - j] - '0' +up) / 10;
                        }
                        else
                        {
                                c[j] = (a[ca - j] - '0' + b[cb - j] - '0' + up) % 10;
                                up = (a[ca -j] - '0' + b[cb - j] - '0' +up) / 10;
                        }
                }

                if(up > 0)
                {
                        std::cout << "overflow" << std::endl;
                        continue;
                }

                int k = 0;
                for(int j = 0; j < 80; ++j)
                        if(c[79 - j])
                        {
                                k = j;
                                break;
                        }

                if(k)
                        for(int j = k; j < 80; ++j)
                                std::cout << c[79 - j];
                else
                        std::cout << 0;
                std::cout << std::endl;
        }
        return 0;
}

C++: #include<iostream>
#include<string>
#include<stdio.h>

char iota(int n){
  switch (n) {
    case 0: return '0';
    case 1: return '1';
    case 2: return '2';
    case 3: return '3';
    case 4: return '4';
    case 5: return '5';
    case 6: return '6';
    case 7: return '7';
    case 8: return '8';
    case 9: return '9';
  }
  return '0';
}

int main(){

  std::string num1;   //("10000");
  std::string num2;   //("990000");
  char sum[100]={};
  int n,i,j,flag=0,temp;

  std::cin >> n;
  //n=1;

  for(i=0;i<n;i++){
    for(j=0;j<100;j++){
      sum[j]='\0';
    }
    std::cin >> num1 >> num2;
    if(num1.size()<num2.size()){
      num1.swap(num2);
    }
    //std::cout << num1 << std::endl;
    //std::cout << num2 << std::endl;
    for(j=0;j<num1.size();j++){
      if(j<num2.size()){
        temp = (num1[num1.size()-j-1]-'0')+(num2[num2.size()-j-1]-'0');
      }
      if(j>=num2.size()){
        temp = num1[num1.size()-j-1]-'0';
      }
      if(flag){
      ++temp;
      flag = 0;
      }
      if(temp>9){
        temp -= 10;
        flag = 1;
      }
      sum[j] = iota(temp);
    }
    if(flag){
      sum[j] = '1';
      flag = 0;
    }
    //printf("%s\n",sum);
    j=0;
    while(sum[j]!='\0'){
      ++j;
    }
    //std::cout << j <<std::endl;
    if(j>80){
      std::cout << "overflow" << std::endl;
    }else{
      while(j>0){
        printf("%c",sum[j-1]);
        --j;
      }
      std::cout << std::endl;
    }
  }
}