Problem:


National Budget

A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647.

Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers.

If given integers or the sum have more than 80 digits, print "overflow".

Input

Input consists of several datasets. In the first line, the number of datasets N (1 ≤ N ≤ 50) is given. Each dataset consists of 2 lines:

The first integer
The second integer

The integer has at most 100 digits.

Output

For each dataset, print the sum of given integers in a line.

Sample Input

6
1000
800
9999999999999999999999999999999999999999
1
99999999999999999999999999999999999999999999999999999999999999999999999999999999
1
99999999999999999999999999999999999999999999999999999999999999999999999999999999
0
100000000000000000000000000000000000000000000000000000000000000000000000000000000
1
100000000000000000000000000000000000000000000000000000000000000000000000000000000
100000000000000000000000000000000000000000000000000000000000000000000000000000000

Output for the Sample Input

1800
10000000000000000000000000000000000000000
overflow
99999999999999999999999999999999999999999999999999999999999999999999999999999999
overflow
overflow



Sample input:
6
1000
800
9999999999999999999999999999999999999999
1
99999999999999999999999999999999999999999999999999999999999999999999999999999999
1
99999999999999999999999999999999999999999999999999999999999999999999999999999999
0
100000000000000000000000000000000000000000000000000000000000000000000000000000000
1
100000000000000000000000000000000000000000000000000000000000000000000000000000000
100000000000000000000000000000000000000000000000000000000000000000000000000000000


Sample output:
1800
10000000000000000000000000000000000000000
overflow
99999999999999999999999999999999999999999999999999999999999999999999999999999999
overflow
overflow

Submission status: Accepted

Solution code:
# 国家予算

def main():
    N = int(input())
    for _ in range(N):
        n1 = input().strip()
        n2 = input().strip()

        #print(f"n1: {n1}\nn2: {n2}")
        if len(n1) > 80 or len(n2) > 80:
            print("overflow")
            continue

        print(add(n1, n2))
    return

def add(n1, n2):
    """n1, n2: str"""
    kotae = ""
    n1 = n1[::-1] # reversed
    n2 = n2[::-1]

    if len(n1) < len(n2): # 長い方がn1
        n1, n2 = n2, n1
    shorter = min(len(n1), len(n2))
    longer = max(len(n1), len(n2))

    idx, kuriagari = 0, 0
    while idx < longer:
        if idx >= shorter:
            tmp = int(n1[idx]) + kuriagari
            #print(f"idx: {idx}, tmp: {tmp}")
            kuriagari = 1 if tmp >= 10 else 0
            kotae += str(tmp)[-1]
            idx += 1

        while idx < shorter:
            tmp = int(n1[idx]) + int(n2[idx]) + kuriagari
            #print(f"idx: {idx}, tmp: {tmp}")
            kuriagari = 1 if tmp >= 10 else 0

            kotae += str(tmp)[-1]
            idx += 1

    if kuriagari:
        kotae += "1"

    if len(kotae) > 80:
        return "overflow"
    else:
        return kotae[::-1]

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n=int(input())
for i in range(n):
    a=int(input())
    b=int(input())
    if a+b>=10**80:print("overflow")
    else:print(a+b)

Submission status: Accepted

Solution code:
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

n = int(input())
ans = []
for _ in range(n):
    a = int(input())
    b = int(input())
    s = a+b
    if s > 10**80-1:
        ans.append("overflow")
    else:
        ans.append(str(s))
print("\n".join(ans))

Submission status: Accepted

Solution code:
r=raw_input
for a in range(int(r())):
    s=sum([int(r()),int(r())])
    print s>=10**80 and "overflow" or s

Submission status: Accepted

Solution code:
#! -*- coding: utf-8-unix -*-
import sys

# if __name__=='__main__':
#   lines = [int(x.strip()) for x in sys.stdin.readlines()]
#   print lines
#   n = lines[0]
# for i in xrange(n):
#     # a, b  = int(lines[i+1]), int(lines[i+2])
#     a, b  = lines[2*i+1], lines[2*i+2]
#     if len(str(a+b)) > 80:
#       print 'overflow'
#     else:
#       print a+b

if __name__=='__main__':
  # lines = [int(x.strip()) for x in sys.stdin.readlines()]
  # n = lines[0]
  n = input()
for i in xrange(n):
    # a, b  = int(lines[i+1]), int(lines[i+2])
    # a, b  = lines[2*i+1], lines[2*i+2]
    a, b  = input(), input()
    if len(str(a+b)) > 80:
      print 'overflow'
    else:
      print a+b

Submission status: Accepted

Solution code:
import sys

if __name__=='__main__':
  lines = [int(x.strip()) for x in sys.stdin.readlines() if x != '' and x != '\n']
  n = lines[0]
for i in xrange(n):
  a, b  = lines[2*i+1], lines[2*i+2]
  if len(str(a+b)) > 80:
    print 'overflow'
  else:
    print a+b

Submission status: Accepted

Solution code:
N = 10 ** 80
for i in range(int(input())):
    n = int(input()) + int(input())
    print(n if n < N else 'overflow')

Submission status: Accepted

Solution code:
if __name__ == "__main__":
    nset = int(input())

    for i in range(0, nset):
        sa = input()
        sb = input()
        a = int(sa)
        b = int(sb)
        c = a + b

        if len(sa) > 80 or len(sb) > 80 or len(str(c)) > 80:
            print("overflow")
        else:
            print(c)

Submission status: Accepted

Solution code:
while(True):
    try:
        n = input()
        for i in range(n):
            a = input()
            b = input()
            c = str(a + b)
            if(len(c) > 80):
                print("overflow")
            else:
                print(c)
    except Exception:
        break

Submission status: Accepted

Solution code:
n=int(input())
for i in range(n):
	a=int(input())
	b=int(input())
	c=a+b
	c=str(c)
	if len(c)>80:
		print("overflow")
	else:
		print(c)

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-


import sys

num = input()
for i in range(num):
  s = long(input())
  t = long(input())
  u = s+t
  if len(str(u)) > 80 :
    print "overflow"
  else:
    print u

Submission status: Accepted

Solution code:
n = int(raw_input())

for i in range(n):
    a = raw_input()
    b = raw_input()

    if len(a) > 80 or len(b) > 80:
        print 'overflow'
    else:
        a, b = int(a), int(b)
        c = a + b
        if len(str(c)) > 80:
            print 'overflow'
        else:
            print c

Submission status: Accepted

Solution code:
N = 10**80
for i in range(int(input())):
	n = int(input()) + int(input())
	print(n if n < N else "overflow")

Submission status: Accepted

Solution code:
n = int(input())
for _ in range(n):
    a = sum([int(input()) for _ in range(2)])
    print(a if a < 10**80 else 'overflow')

Submission status: Accepted

Solution code:
for _ in range(int(input())):
    a=int(input())+int(input())
    print(a if a < 10**80 else 'overflow')

Submission status: Accepted

Solution code:
n = int(raw_input())
for _ in [0]*n:
  a = int(raw_input())
  b = int(raw_input())
  c = a+b
  print [c,"overflow"][len(str(c))>80]

Submission status: Accepted

Solution code:
n = input()
for _ in [0]*n:
  a = input()
  b = input()
  c = a+b
  print [c,"overflow"][len(str(c))>80]

Submission status: Accepted

Solution code:
import sys

n = int(input())
for i in range(n):
    a = int(input())
    b = int(input())
    if a + b >= 10**80:
        print ("overflow")
    else:
        print(a + b)

Submission status: Accepted

Solution code:
import math

n=input()
for i in range(n):
	a=input()
	b=input()
	ans=a+b
	if len(str(ans))>80:
		print "overflow"
	else:
		print ans

Submission status: Accepted

Solution code:
def f(): return int(raw_input())
n = f()
for _ in [0]*n:
  a = f()
  b = f()
  c = a+b
  print [c, "overflow"][len(str(c))>80]

Submission status: Accepted

Solution code:
n=int(input())

for i in range(n):
    a=int(input())
    b=int(input())
    c=a+b
    if len(str(c))>80:
        print("overflow")
    else:
        print(c)

Submission status: Accepted

Solution code:
import sys
f = sys.stdin
n = int(f.readline())
for _ in range(n):
    a = f.readline().strip()
    b = f.readline().strip()
    c = int(a) + int(b)
    c = '{}'.format(c)
    print(c if len(c) <= 80 else 'overflow')

Submission status: Accepted

Solution code:
from sys import stdin
n = int(stdin.readline())
for i in range(n):
    c = str(int(stdin.readline().strip()) + int(stdin.readline().strip()))
    if (len(c) > 80):
        print("overflow")
    else:
        print(c)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# Copyright  : @Huki_Hara
# Created    : 2015-03-05

n=int(input())

for _ in range(n):
    a=int(input())
    b=int(input())
    sum=a+b
    if len(str(sum)) > 80:
        print("overflow")
    else:
        print(sum)

Submission status: Accepted

Solution code:
for x in range(input()):
    x=raw_input()
    x=x[::-1]
    y=raw_input()
    y=y[::-1]
    z=[0]*81
    if len(x)>80 or len(y) >80:
        print 'overflow'
    else:
        for i in xrange(len(x)):
            z[i]=int(x[i])
        for j in xrange(len(y)):
            z[j]=z[j]+int(y[j])
        for k in xrange(max(len(x),len(y))):
            sum=z[k]
            z[k]=sum%10
            z[k+1]+=sum/10
        z.reverse()
        if z[0]!=0:
            print 'overflow'
        else:
            for j in xrange(len(z)):
                if z[0]==0:
                    z.pop(0)
                else:
                    break
            if len(z)==0:
                print 0
            else:
                print ''.join(map(str,z))

Submission status: Accepted

Solution code:
N=int(raw_input())
for i in range(N):
    a=raw_input()
    b=raw_input()
    if len(a)<len(b):
        (a,b)=(b,a)
    b=''.join(['0' for x in range(len(a)-len(b))])+b
    c=[]
    o=0
    for p in range(len(a)):
        d=(int(a[-p-1])+int(b[-p-1])+o)%10
        o=(int(a[-p-1])+int(b[-p-1])+o)/10
        c.append(d)
    if o:
        c.append(o)
    c.reverse()
    if len(c)<81:
        print ''.join([str(x) for x in c])
    else:
        print 'overflow'

Submission status: Accepted

Solution code:
a=input()
for i in range(a):
	x=input()
	y=input()
	if len(str(x+y))>80:
		print "overflow"
	else:
		print x+y

Submission status: Accepted

Solution code:
n = int(raw_input())

while n:
	n -= 1
	a = long(raw_input())
	b = long(raw_input())
	c = a + b

	if 80 < len(str(c)):
		print "overflow"
	else:
		print c

Submission status: Accepted

Solution code:
n = input()

for i in range(n):
    a = input()
    b = input()
    c = int(a) + int(b)
    if len(str(c)) > 80:
        print 'overflow'
    else:
        print a + b

Submission status: Accepted

Solution code:
for x in[sum([input(),input()])for i in range(input())]:print"overflow"if len(str(x))>80 else x

Submission status: Accepted

Solution code:
def main():
    n = int(input())

    for i in range(n):
        result = str(int(input()) + int(input()))

        if len(result) > 80:
            print("overflow")
        else:
            print(result)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#!/usr/bin/env python
#-*- coding:utf-8 -*-

import sys
import math

n = int(input())
result = 0

for i in range(n):
    result = 0
    x = int(input())
    y = int(input())

    result = x + y
    length = len(str(result))
    if length > 80:
        print("overflow")
    else:
        print(result)

Submission status: Accepted

Solution code:
for _ in range(int(input())) :
    n = int(input()) + int(input())
    if (n >= 10 ** 80) :
        print("overflow")
    else :
        print(n)

Submission status: Accepted

Solution code:
n = int(input())
over = 10 ** 80
for i in range(n):
    a = int(input())
    b = int(input())

    if (a + b < over):
        print (a + b)
    else:
        print "overflow"

Submission status: Accepted

Solution code:
max = 10 ** 80
for i in range(int(input())):
    total = int(input()) + int(input())
    print(total if total < max else "overflow")

Submission status: Accepted

Solution code:
#!/usr/bin/python
# AOJ
# 0015

for i in range(int(input())):
    n1 = list(input())
    n2 = list(input())
    if len(n2) > len(n1):
        n1, n2 = n2, n1

    ans = []
    for i in range(len(n1)):
        a = int(ans.pop(0)) if len(ans) == i + 1 else 0
        c1 = int(n1.pop(-1))
        c2 = int(n2.pop(-1)) if len(n2) != 0 else 0
        ans = list(str(a + c1 + c2)) + ans
    if len(ans) > 80:
        print('overflow')
    else:
        print(''.join(ans))

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import math
n = int(raw_input());
over = 10 ** 80;
for i in range(0, n):
    a = int(raw_input());
    b = int(raw_input());
    if a + b >= over:
        print "overflow"
    else:
        print a + b;

Submission status: Accepted

Solution code:
# -*- coding:utf-8 -*-

def main():
    for i in range(int(input())):
        a=int(input())+int(input())
        if a>=10**80:
            print("overflow")
        else:
            print(a)
            
    
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())

for i in range(n):
    a = int(input())
    b = int(input())

    if (a + b) < (10 ** 80):
        print(a + b)
    else:
        print("overflow")

Submission status: Accepted

Solution code:
while True:
	try:
		n = input()
		for i in range(n):
			a = input()
			b = input()
			s = a+b
			if len(str(s)) > 80:
				print "overflow"
			else:
				print s
	except EOFError:
		break

Submission status: Accepted

Solution code:
n = int(input())
 
for i in range(n):
    a = int(input())
    b = int(input())
 
    if (a + b) < (10 ** 80):
        print(a + b)
    else:
        print("overflow")

Submission status: Accepted

Solution code:
n = int(input())
for i in range(n):
    x = int(input())
    y = int(input())
    if x + y >= 10 ** 80:
        print("overflow")
    else:
        print(x + y)

Submission status: Accepted

Solution code:
import math
n=int(input())
for i in range(n):
    fint=int(input())
    sint=int(input())
    sum=fint+sint
    if(sum<pow(10,80)):
        print (sum)
    else:
        print("overflow")

Submission status: Accepted

Solution code:
n=int(input())

for i in range(n):
    a=int(input())
    b=int(input())
    c=a+b
    ss=str(c)
    if len(ss)>80:
        print("overflow")
    else:
        print(ss)

Submission status: Accepted

Solution code:
n = int(input())
for _ in range(n):
    s = int(input()) + int(input())
    print('overflow' if len(str(s)) > 80 else s)

Submission status: Accepted

Solution code:
from functools import reduce
from operator import add
num = int(input())
for _ in range(num):
    budget = reduce(add, [int(input()) for _ in range(2)])
    if len(str(budget)) > 80:
        print('overflow')
    else:
        print(budget)

Submission status: Accepted

Solution code:
n = input()
for i in xrange(n):
    num1 = input()
    num2 = input()
    if  len(str(num1))>80 or len(str(num2))>80:
        print "overflow"
        continue
    ans = num1+num2
    if len(str(ans)) > 80:
        print "overflow"
    else:
        print ans

Submission status: Accepted

Solution code:
l = int(input())
for i in range(l):
    a = int(input()) + int(input())
    if(len(str(a)) > 80):
        print('overflow')
    else:
        print(a)

Submission status: Accepted

Solution code:
n=int(input())
for _ in range(n):
	s=int(input())+int(input())
	print('overflow' if len(str(s))>80 else s)

Submission status: Accepted

Solution code:
num_inputs = int(raw_input())
 
limit = 100000000000000000000000000000000000000000000000000000000000000000000000000000000
 
count = 0
while count < num_inputs:
    num1 = int(raw_input())
    num2 = int(raw_input())
 
    if num1 >= limit or num2 >= limit:
        print "overflow"
    else:
        num = num1 + num2
        if num >= limit:
            print "overflow"
        else:
            print num
    count += 1

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

n = int(raw_input())
ans = []
for i in range(n):
    a = str(raw_input())
    b = str(raw_input())
    if len(a) < len(b):
        a, b = b, a
    l = len(a)
    for j in range(len(b), len(a)):
        b = '0'+b
    sum = ""
    nextdigit = 0
    for j in range(l):
        digit = int(a[l-1-j]) + int(b[l-1-j]) + nextdigit
        nextdigit = 0
        if (nextdigit+digit) >= 10:
            nextdigit = 1
            digit %= 10
        sum = str(digit) + sum
    if nextdigit:
        sum = '1'+sum
    ans.append(sum)
for i in ans:
    print i if len(i) <= 80 else "overflow"

Submission status: Accepted

Solution code:
n = int(input())
for i in range(n):
    a = int(input())
    b = int(input())
    s = a + b
    if s >= 10**80:
        print('overflow')
    else:
        print(s)

Submission status: Accepted

Solution code:
import math

N = int(input())
for i in range(N):
    a = int(input())
    b = int(input())
    if a >= 10 ** 80 or b >= 10 ** 80 or a + b >= 10 ** 80:
        print("overflow")
    else:
        print(a + b)

Submission status: Accepted

Solution code:
n=input()
for i in xrange(n):
    a=0
    for j in xrange(2):
        a+=input()
    if len(str(a))>80:
        print('overflow')
    else:
        print(a)

Submission status: Accepted

Solution code:
import sys
import itertools

dataset_num = int(input())

class Overflow(Exception):
    pass

for _ in range(dataset_num):
    try:
        k1 = input()
        k2 = input()
        k1_val = [0] * 100
        k2_val = [0] * 100

        if len(k1) > 80 or len(k2) > 80:
            raise Overflow()
        
        for i, x in enumerate(reversed(k1)):
            k1_val[i] = int(x)

        for i, x in enumerate(reversed(k2)):
            k2_val[i] = int(x)
        
        res = [0] * 100 
        for i in range(0, 100):
            res[i] += k1_val[i] + k2_val[i]
            if res[i] >= 10:
                res[i+1] += 1
                res[i] -= 10
        sumstr = "".join([str(x) for x in itertools.dropwhile(lambda x: x == 0, reversed(res))])
        if len(sumstr) > 80:
            raise Overflow()
        if len(sumstr) == 0:
            sumstr = "0"

        print(sumstr)
    except Overflow:
        print("overflow")

Submission status: Accepted

Solution code:
for i in range(int(input())):
    a = int(input())
    b = int(input())
    if a+b >= 10**80:
        print("overflow")
    else:
        print(a+b)

Submission status: Accepted

Solution code:
for i in range(int(input())):
    x = int(input())
    y = int(input())
    res = x + y
    if len(str(res)) > 80:
        print("overflow")
    else:
        print(res)

Submission status: Accepted

Solution code:
n=int(input())
ans_list=[]

for i in range(n):
	a=int(input())
	b=int(input())
	if max(a,b,a+b)>=10**80:
		ans_list.append("overflow")
	else:
		ans_list.append(a+b)

for i in ans_list:
	print(i)

Submission status: Accepted

Solution code:
n=int(input())
ans_list=[]

for i in range(n):
	a=int(input())
	b=int(input())
	c=a+b
	if max(a,b,c)>=10**80:
		ans_list.append("overflow")
	else:
		ans_list.append(c)

for i in ans_list:
	print(i)

Submission status: Accepted

Solution code:
import sys
import re
def line():return sys.stdin.readline().strip()

N = input()
while True:
    try:
        a = int(line())
        b = int(line())
        if a + b >= 10 ** 80:
            print("overflow")
        else:
            print(a + b)
    except:
        break

Submission status: Accepted

Solution code:
n = int(input())

for i in range(0, n):
    a = int(input())
    b = int(input())
    if a + b >= 10 ** 80:
        print("overflow")
    elif a >= 10 ** 80:
        print("overflow")
    elif b >= 10 ** 80:
        print("overflow")
    else :
        print(a + b)

Submission status: Accepted

Solution code:
n = int(input())

for i in range(0, n):
    a = int(input())
    b = int(input())
    if len(str(a + b)) > 80:
        print("overflow")
    elif len(str(a)) > 80:
        print("overflow")
    elif len(str(b)) > 80:
        print("overflow")
    else :
        print(a + b)

Submission status: Accepted

Solution code:
n = int(input())
for i in range(n):
  a = int(input())
  b = int(input())
  res = a + b
  if res >= 10**80:
    print("overflow")
  else :
    print (res)

Submission status: Accepted

Solution code:
a = int(input())
for i in range(a):
    x = int(input())
    y = int(input())
    if x + y >= 10 ** 80:
        print("overflow")
    else:
        print(x + y)

Submission status: Accepted

Solution code:
n = int(input())
for i in range(n):
    a = int(input())
    b = int(input())
    if a + b < 10**80 : print(a + b)
    else : print("overflow")

Submission status: Accepted

Solution code:
N = int(input())
for _ in range(N):
	a = int(input())
	b = int(input())
	if len(str(a+b)) > 80:
		print("overflow")
	else:
		print(a+b)

Submission status: Accepted

Solution code:
n = int(input())

for i in range(n):
    a = int(input())
    b = int(input())
    c = str(a+b)
    if len(c) > 80:
        print("overflow")
    else:
        print(c)

Submission status: Accepted

Solution code:
def Add(numa, numb):
	longer = (numa if len(numa) >= len(numb) else numb)
	shorter = (numa if len(numa) < len(numb) else numb)
	carry = 0
	result = ''
	for s in range(-1, -len(shorter) - 1, -1):
		ans = int(longer[s]) + int(shorter[s]) + carry
		if ans >= 10:
			result = str(ans % 10) + result
			carry = 1
		else:
			result = str(ans) + result
			carry = 0
	for l in range(-len(shorter) - 1, -len(longer) - 1, -1):
		ans = int(longer[l]) + carry
		if ans >= 10:
			result = str(ans % 10) + result
			carry = 1
		else:
			result = str(ans) + result
			carry = 0
	return (result if carry == 0 else '1' + result)

N = eval(input())
for _ in range(N):
	a = input()
	b = input()
	ans = Add(a, b)
	print('overflow' if len(ans) > 80 else ans)

Submission status: Accepted

Solution code:
n = int(input())

for i in range(n):
    a = input()
    b = input()
    c = int(a) + int(b)
    if len(a) > 80 or len(b) > 80 or len(str(c)) > 80:
        print('overflow')
    else:
        print(c)

Submission status: Accepted

Solution code:
for _ in range(int(input())):
    a = int(input())
    b = int(input())
    s = a + b
    if s >= 10 ** 80:
        print('overflow')
    else:
        print(s)

Submission status: Accepted

Solution code:
N = int(raw_input())

for i in range(N):
  a , b = int(raw_input()), int(raw_input())

  if a + b > 10 ** 80 - 1:
    print "overflow"

  else:
    print a + b

Submission status: Accepted

Solution code:
n = int(input())
for i in range(n):
	s = int(input())+int(input())
	if len(str(s))>80:
		print("overflow")
	else:
		print(s)

Submission status: Accepted

Solution code:
n = input()
limit = 10 ** 80
for i in xrange(n):
    result = input() + input()
    if result >= limit: print "overflow"
    else: print result

Submission status: Accepted

Solution code:
n=int(input())
for i in range(n):
	a=int(input())
	b=int(input())
	if len(str(a+b))>80:print("overflow")
	else:print(a+b)

Submission status: Accepted

Solution code:
# ?????¶??????????±???????????????°??????
import sys

def main():
    n = int(sys.stdin.readline().strip())

    for _ in range(n):
        x = sys.stdin.readline().strip()
        y = sys.stdin.readline().strip()

        if len(x) > 80 or len(y) > 80:
            print('overflow')
        else:
            ans = int(x) + int(y)
            if len(str(ans)) > 80:
                print('overflow')
            else:
                print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = input()
for k in range(n):
    a = input()
    b = input()
    c = int(a) + int(b)
    if len(str(c)) > 80:
        c = "overflow"
    print c

Submission status: Accepted

Solution code:
n = int(input())
for i in range(n):
    x = input()
    y = input()
    if len(x) > 80 or len(y) > 80:
        print("overflow")
        continue
    s = ""
    rx = x[::-1]
    ry = y[::-1]
    lx = len(x)
    ly = len(y)
    if lx > ly:
        ml = lx
    else:
        ml = ly
    c = 0
    for j in range(ml + 1):
        x1 = 0
        y1 = 0
        if j < lx:
            x1 = int(rx[j])
        if j < ly:
            y1 = int(ry[j])
        c1 = x1 + y1 + c
        s += str(c1 % 10)
        c = c1 // 10

    rs = s[::-1]
    result = ""
    for j in range(len(rs)):
        if rs[j] != "0":
            result = rs[j:]
            break

    if len(result) > 80:
        print("overflow")
    elif result == "":
        print(0)
    else:
        print(result)

Submission status: Accepted

Solution code:
times=int(input())
for i in range(times):
    a=int(input())
    b=int(input())
    if len(str(a))<=80 and len(str(b))<=80 and len(str(a+b))<=80:
        print(a+b)
    else: print("overflow")

Submission status: Accepted

Solution code:
for i in xrange(input()):
    a = int(raw_input())
    b = int(raw_input())
    print a+b if len(str(a+b)) <= 80 else 'overflow'

Submission status: Accepted

Solution code:
for i in range(int(input())):
    a, b = int(input()), int(input())
    result = a+b if len(str(a+b))<=80 else 'overflow'
    print(result)

Submission status: Accepted

Solution code:
import math

n = input()
for _ in xrange(n):
  x = input()
  y = input()
  z = x + y
  if any(map(lambda t: len(str(t)) > 80, [x, y, z])):
    print "overflow"
  else:
    print z

Submission status: Accepted

Solution code:
def overflow(s):
    if len(s) > 80:
        print('overflow')
    else: 
        print(s)

def string_sum(la, lb):
    d = abs(len(la) - len(lb))
    if len(la) > len(lb):
        lb = "0" * d + lb
    else:
        la = "0" * d + la
    ls = []
    carry = 0
    for a, b in zip(la[::-1], lb[::-1]):
        s = int(a) + int(b) + carry
        ls.append(str(s % 10))
        carry = s // 10
    if carry == 1:
        ls.append('1')
    return ''.join(ls[::-1])

n = int(input()) 
while n > 0:
    one = input()
    two = input()
    overflow(string_sum(one, two))
    n -= 1

Submission status: Accepted

Solution code:
import sys
import math

n = int(sys.stdin.readline())

for i in range(n):
    n1 = int(sys.stdin.readline())
    n2 = int(sys.stdin.readline())
    if n1+n2<100000000000000000000000000000000000000000000000000000000000000000000000000000000 :
        print(n1+n2)
    else:
        print("overflow")

Submission status: Accepted

Solution code:
n = int(input())
for i in range(n):
    a = int(input())
    b = int(input())
    if len(str(a + b)) > 80:
        print("overflow")
    else:
        print(a+b)

Submission status: Accepted

Solution code:
upper = 10**80
n = int(input())
for i in range(n):
    n1 = int(input())
    n2 = int(input())
    if n1 >= upper or n2 >= upper:
        print("overflow")
        continue
    print( n1 + n2 if n1+n2 < upper else "overflow")

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    # ??????????????\???
    loop = int(input())
    for i in range(loop):
        num1 = int(input())
        num2 = int(input())

        # ???????????????
        result = num1 + num2

        # ???????????????
        if len(str(result)) > 80:
            print('overflow')
        else:
            print(result)

Submission status: Accepted

Solution code:
N=int(input())
a=[None]*N
b=[None]*N
for i in range(0,N):
  a[i]=int(input())
  b[i]=int(input())
for i in range(0,N):
  if len(str(a[i]))>80:
    print("overflow")
  elif len(str(b[i]))>80:
    print("overflow")
  elif len(str(a[i]+b[i]))>80:
    print("overflow")
  else:
    print(a[i]+b[i])

Submission status: Accepted

Solution code:
n=int(input())
for _ in range(n):
    a=int(input())
    b=int(input())
    ab=a+b
    print(ab if ab<10**80 else "overflow")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N = int(input())

for _ in range(N):
    a = int(input())
    b = int(input())
    s = str(a + b)
    if len(s) <= 80:
        print(s)
    else:
        print('overflow')

Submission status: Accepted

Solution code:
# -*- coding:utf-8 -*-
N = int(input())
data1 = []
data2 = []
for i in range(N):
    data1.append(int(input()))
    data2.append(int(input()))

for i in range(N):
    if data1[i] > 10**80-1 or data2[i] > 10**80-1 or data1[i]+data2[i] > 10**80-1:
        print('overflow')
    else:
        print(data1[i]+data2[i])

Submission status: Accepted

Solution code:

#
n = int(raw_input())
for i in xrange(n):
    x = int(raw_input())
    y = int(raw_input())
    ans = x + y
    if len(str(ans)) > 80 :
        print 'overflow'
    else:
        print ans

Submission status: Accepted

Solution code:
for _ in range(int(input())):
    a=int(input())
    b=int(input())
    print([a+b,'overflow'][len(str(a+b))>80])

Submission status: Accepted

Solution code:
for _ in range(int(input())):
    a=int(input())+int(input())
    print(['overflow',a][a<10**80])

Submission status: Accepted

Solution code:
n = int(input())
for i in range(n):
    a = int(input())
    b = int(input())
    if len(str(a+b)) > 80 :
        print("overflow")
    else:
        print(a+b)

Submission status: Accepted

Solution code:
n = int(input())

for i in range(n):
    x = input()
    y = input()
    ans = int(x) + int(y)
    if len(x) > 80 or len(y) > 80 or len(str(ans)) > 80:
        print("overflow")
    else:
        print(ans)

Submission status: Accepted

Solution code:
import sys
import math as mas

n=int(input())
for t in range(n):
	i=int(t)
	a=int(input())
	b=int(input())
	a+=b
	if a<10**80:print(a)
	else:print("overflow")
	
#for i in sys.stdin:
#	a,b=map(int,i.split())
#	print(gcd(a,b),lcm(a,b))

Submission status: Accepted

Solution code:
n = int(input())
for _ in range(n):
    a, b = int(input()), int(input())
    x = str(a+b)
    print('overflow' if len(x) > 80 else a+b)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

import sys
import os
import math

def is_overflow(v):
    s = str(v)
    if len(s) > 80:
        return True
    else:
        return False

N = int(input())
for i in range(N):
    v0 = int(input())
    v1 = int(input())
    if is_overflow(v0) or is_overflow(v1):
        print('overflow')
    elif is_overflow(v0 + v1):
        print('overflow')
    else:
        print(v0 + v1)

Submission status: Accepted

Solution code:
import sys
N=int(input())
for i in range(N):
    a=input()
    b=input()
    len_a=len(a)
    len_b=len(b)
    c=[]
    kuriage=0
    if(len_a>=len_b):
        for i in range(len_b):
            c.append((kuriage+int(a[len_a-1-i])+int(b[len_b-1-i]))%10)
            kuriage=(kuriage+int(a[len_a-1-i])+int(b[len_b-1-i]))//10
        for i in range(len_b,len_a):
            c.append((kuriage+int(a[len_a-1-i]))%10)
            kuriage=(kuriage+int(a[len_a-1-i]))//10



    else :
        for i in range(len_a):
            c.append((kuriage+int(a[len_a-1-i])+int(b[len_b-1-i]))%10)
            kuriage=(kuriage+int(a[len_a-1-i])+int(b[len_b-1-i]))//10
        for i in range(len_a,len_b):
            c.append((kuriage+int(b[len_b-1-i]))%10)
            kuriage=(kuriage+int(b[len_b-1-i]))//10

    if(kuriage==1):
        c.append(1)

    if(len(c)>=81):
        print('overflow')

    else:
        for i in c[::-1]:
            print(i,end='')
        print('')

Submission status: Accepted

Solution code:
for _ in range(int(input())):
    a, b = input(), input()
    if len(a) < 81 and len(b) < 81 :
        c = int(a) + int(b)
        if len(str(c)) < 81 : print(c)
        else : print('overflow')
    else : print('overflow')