s_id
stringlengths
10
10
p_id
stringlengths
6
6
u_id
stringlengths
10
10
date
stringlengths
10
10
language
stringclasses
1 value
original_language
stringclasses
11 values
filename_ext
stringclasses
1 value
status
stringclasses
1 value
cpu_time
int64
0
100
memory
stringlengths
4
6
code_size
int64
15
14.7k
code
stringlengths
15
14.7k
problem_id
stringlengths
6
6
problem_description
stringlengths
358
9.83k
input
stringlengths
2
4.87k
output
stringclasses
807 values
__index_level_0__
int64
1.1k
1.22M
s882422220
p00015
u747479790
1449858048
Python
Python3
py
Accepted
30
7572
167
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")
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,102
s525499679
p00015
u777299405
1450353667
Python
Python3
py
Accepted
20
7536
160
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)
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,103
s510296657
p00015
u560214129
1450431100
Python
Python3
py
Accepted
30
7708
187
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")
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,104
s568743394
p00015
u079870052
1452222074
Python
Python3
py
Accepted
20
7664
169
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)
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,105
s742139484
p00015
u797673668
1452702884
Python
Python3
py
Accepted
20
7576
120
n = int(input()) for _ in range(n): s = int(input()) + int(input()) print('overflow' if len(str(s)) > 80 else s)
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,106
s553144491
p00015
u463990569
1452847725
Python
Python3
py
Accepted
30
8212
240
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)
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,107
s256390157
p00015
u512342660
1455280752
Python
Python
py
Accepted
10
6284
259
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
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,108
s171687918
p00015
u650459696
1458457131
Python
Python3
py
Accepted
50
7572
150
l = int(input()) for i in range(l): a = int(input()) + int(input()) if(len(str(a)) > 80): print('overflow') else: print(a)
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,109
s147590026
p00015
u075836834
1458769352
Python
Python3
py
Accepted
30
7624
106
n=int(input()) for _ in range(n): s=int(input())+int(input()) print('overflow' if len(str(s))>80 else s)
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,110
s298557592
p00015
u148101999
1459387507
Python
Python
py
Accepted
10
6428
422
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
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,111
s664859530
p00015
u130979865
1459926366
Python
Python
py
Accepted
20
6324
605
# -*- 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"
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,112
s443564738
p00015
u572790226
1460294958
Python
Python3
py
Accepted
30
7528
164
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)
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,113
s185890313
p00015
u529386725
1461621789
Python
Python3
py
Accepted
30
7564
207
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)
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,114
s914654238
p00015
u894114233
1461768311
Python
Python
py
Accepted
20
6220
160
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)
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,115
s434659223
p00015
u957021485
1465616450
Python
Python3
py
Accepted
30
7656
937
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")
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,116
s058171298
p00015
u203261375
1466519521
Python
Python3
py
Accepted
20
7636
148
for i in range(int(input())): a = int(input()) b = int(input()) if a+b >= 10**80: print("overflow") else: print(a+b)
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,117
s513004156
p00015
u766477342
1466549481
Python
Python3
py
Accepted
30
7652
169
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)
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,118
s571726172
p00015
u617990214
1467918105
Python
Python3
py
Accepted
20
7568
194
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)
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,119
s547696876
p00015
u617990214
1467918202
Python
Python3
py
Accepted
20
7648
197
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)
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,120
s366557235
p00015
u160041984
1468231748
Python
Python3
py
Accepted
20
7784
274
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
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,121
s176691991
p00015
u881668270
1468286300
Python
Python3
py
Accepted
30
7656
265
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)
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,122
s842481500
p00015
u881668270
1468287639
Python
Python3
py
Accepted
20
7576
274
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)
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,123
s522762879
p00015
u318910474
1468844092
Python
Python3
py
Accepted
40
7512
154
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)
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,124
s142305443
p00015
u811773570
1468844816
Python
Python3
py
Accepted
20
7632
160
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)
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,125
s432352669
p00015
u192770095
1468937135
Python
Python3
py
Accepted
30
7640
143
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")
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,126
s990542341
p00015
u896025703
1469538520
Python
Python3
py
Accepted
30
7488
135
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)
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,127
s285971172
p00015
u648595404
1469710418
Python
Python3
py
Accepted
20
7540
168
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)
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,128
s162504173
p00015
u582608581
1470820162
Python
Python3
py
Accepted
20
7684
737
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)
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,129
s827571168
p00015
u589886885
1471957251
Python
Python3
py
Accepted
20
7612
200
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)
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,130
s344466035
p00015
u358919705
1471975701
Python
Python3
py
Accepted
20
7640
160
for _ in range(int(input())): a = int(input()) b = int(input()) s = a + b if s >= 10 ** 80: print('overflow') else: print(s)
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,131
s281936843
p00015
u146816547
1471992550
Python
Python
py
Accepted
10
6528
159
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
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,132
s567307563
p00015
u364509382
1472282245
Python
Python3
py
Accepted
20
7636
124
n = int(input()) for i in range(n): s = int(input())+int(input()) if len(str(s))>80: print("overflow") else: print(s)
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,133
s484742651
p00015
u379499530
1472795335
Python
Python
py
Accepted
10
6312
143
n = input() limit = 10 ** 80 for i in xrange(n): result = input() + input() if result >= limit: print "overflow" else: print result
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,134
s868595679
p00015
u220324665
1473426750
Python
Python3
py
Accepted
20
7608
121
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)
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,135
s843142556
p00015
u058433718
1474067420
Python
Python3
py
Accepted
20
7660
487
# ?????¶??????????±???????????????°?????? 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()
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,136
s368879060
p00015
u766597310
1477676776
Python
Python
py
Accepted
20
6200
146
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
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,137
s362577877
p00015
u659302741
1477765024
Python
Python3
py
Accepted
20
7620
772
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)
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,138
s898279862
p00015
u252368621
1479005836
Python
Python3
py
Accepted
20
7544
192
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")
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,139
s469364302
p00015
u922871577
1479282072
Python
Python
py
Accepted
10
6464
128
for i in xrange(input()): a = int(raw_input()) b = int(raw_input()) print a+b if len(str(a+b)) <= 80 else 'overflow'
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,140
s338403177
p00015
u660912567
1479891315
Python
Python3
py
Accepted
20
7536
139
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)
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,141
s653190317
p00015
u359169485
1480270812
Python
Python
py
Accepted
10
6348
179
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
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,142
s084318874
p00015
u175111751
1480511986
Python
Python3
py
Accepted
20
7624
577
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
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,143
s458098856
p00015
u921312486
1480597149
Python
Python
py
Accepted
10
6316
297
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")
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,144
s827914623
p00015
u301729341
1481015387
Python
Python3
py
Accepted
20
7512
161
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)
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,145
s596567217
p00015
u123687446
1481110655
Python
Python3
py
Accepted
20
7632
225
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")
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,146
s404523256
p00015
u811733736
1481596836
Python
Python3
py
Accepted
20
7484
344
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)
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,147
s828040444
p00015
u919202930
1481601677
Python
Python3
py
Accepted
30
7576
294
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])
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,148
s190220426
p00015
u661290476
1482209446
Python
Python3
py
Accepted
30
7512
125
n=int(input()) for _ in range(n): a=int(input()) b=int(input()) ab=a+b print(ab if ab<10**80 else "overflow")
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,149
s842562867
p00015
u873482706
1483271021
Python
Python3
py
Accepted
20
7544
195
# -*- 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')
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,150
s113867396
p00015
u711765449
1484412177
Python
Python3
py
Accepted
30
7528
314
# -*- 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])
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,151
s224218822
p00015
u991537731
1484898259
Python
Python
py
Accepted
10
6488
190
# 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
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,152
s716662495
p00015
u078042885
1485265034
Python
Python3
py
Accepted
20
7508
113
for _ in range(int(input())): a=int(input()) b=int(input()) print([a+b,'overflow'][len(str(a+b))>80])
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,153
s506954703
p00015
u078042885
1485265298
Python
Python3
py
Accepted
30
7536
97
for _ in range(int(input())): a=int(input())+int(input()) print(['overflow',a][a<10**80])
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,154
s421067367
p00015
u901080241
1488960680
Python
Python3
py
Accepted
30
7616
160
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)
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,155
s893732444
p00015
u400458488
1489900556
Python
Python3
py
Accepted
20
7556
206
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)
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,156
s743620478
p00015
u728901930
1490786084
Python
Python3
py
Accepted
20
7616
233
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))
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,157
s970048182
p00015
u546285759
1491657872
Python
Python3
py
Accepted
20
7400
136
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)
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,158
s430385922
p00015
u462831976
1492709067
Python
Python3
py
Accepted
20
7668
404
# -*- 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)
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,159
s991448816
p00015
u723913470
1493832562
Python
Python3
py
Accepted
20
7620
964
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('')
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,160
s396645706
p00015
u868716420
1493932563
Python
Python3
py
Accepted
30
7496
223
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')
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,161
s359661664
p00015
u618637847
1494899340
Python
Python3
py
Accepted
20
7512
166
num = int(input()) for i in range(num): total = int(input()) + int(input()) if len(str(total)) > 80: print("overflow") else: print(total)
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,162
s605777703
p00015
u362104929
1496273209
Python
Python3
py
Accepted
30
7672
935
def main(): n = int(input()) answers = [] for _ in range(n): a = input() b = input() la, lb = len(a), len(b) if la > 80 or lb > 80: answers.append("overflow") continue if la > lb: ll = la for _ in range(la-lb): b = "0" + b else: ll = lb for _ in range(lb-la): a = "0" + a ans = "" bl = 0 for i in range(ll): tmp = int(a[ll-i-1]) + int(b[ll-i-1]) + bl if tmp >= 10: bl = 1 tmp = tmp % 10 else: bl = 0 ans = str(tmp) + ans if bl == 1: ans = "1" + ans if len(ans) > 80: answers.append("overflow") continue answers.append(ans) print(*answers, sep="\n") if __name__ == "__main__": main()
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,163
s726110454
p00015
u905313459
1496403431
Python
Python3
py
Accepted
30
7656
134
p = int(input()) for j in range(p): a, b = int(input()), int(input()) x = str(a+b) print("overflow" if len(x)>80 else a+b)
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,164
s121335692
p00015
u957840591
1497342577
Python
Python3
py
Accepted
20
7532
316
N = int(input()) A = [] B = [] for i in range(N): a = int(input()) b = int(input()) A.append(a) B.append(b) for i in range(N): if A[i] >= 10 ** 80 or B[i] >= 10 ** 80: print("overflow") elif A[i] + B[i] >= 10 ** 80: print("overflow") else: print(str(A[i] + B[i]))
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,165
s420947091
p00015
u519227872
1497453510
Python
Python3
py
Accepted
30
7524
154
n = int(input()) for i in range(n): s = int(input()) + int(input()) if(len(str(s)) <= 80): print (s) else: print ('overflow')
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,166
s908259884
p00015
u354053070
1501929521
Python
Python3
py
Accepted
20
7576
207
import sys n = int(input()) for _ in range(n): a = sys.stdin.readline() b = sys.stdin.readline() c = int(a) + int(b) if len(str(c)) > 80: print("overflow") else: print(c)
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,167
s980294826
p00015
u821624310
1502612416
Python
Python3
py
Accepted
20
7492
168
n = int(input()) for i in range(n): a = int(input()) b = int(input()) if len(str(a + b)) > 80: print("overflow") else: print(str(a + b))
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,168
s481051444
p00015
u624454021
1502621877
Python
Python3
py
Accepted
30
7652
236
import math n = int(input()); for i in range(n): num1 = int(input()); num2 = int(input()); total = num1 + num2; if len(str(total)) > 80: print("overflow"); else: print(total);
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,169
s440168473
p00015
u624454021
1502621917
Python
Python3
py
Accepted
20
7584
238
import math n = int(input()); for i in range(0,n): num1 = int(input()); num2 = int(input()); total = num1 + num2; if len(str(total)) > 80: print("overflow"); else: print(total);
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,170
s332511112
p00015
u957021183
1504764807
Python
Python3
py
Accepted
20
7612
330
# Aizu Problem 0015: National Budget # import sys, math, os # read input: PYDEV = os.environ.get('PYDEV') if PYDEV=="True": sys.stdin = open("sample-input.txt", "rt") N = int(input()) for n in range(N): a = int(input()) b = int(input()) budget = a + b print(budget if len(str(budget)) <= 80 else "overflow")
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,171
s726924943
p00015
u374040976
1505311696
Python
Python3
py
Accepted
20
7572
170
t=int(input()) for num in range(t): 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")
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,172
s107341087
p00015
u197615397
1506228178
Python
Python3
py
Accepted
30
7868
410
N = int(input()) import re for _ in [0]*N: a = input().zfill(100) b = input().zfill(100) result = [] prev = 0 for i in range(1, 81): n = int(a[-i]) + int(b[-i]) + prev result.append(n%10) prev = n // 10 if prev > 0 or int(a[:-80]) + int(b[:-80]) > 0: print("overflow") else: result = "".join(map(str, result[::-1])) print(int(result))
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,173
s125620014
p00015
u219286587
1506673454
Python
Python3
py
Accepted
30
7704
219
# coding:utf-8 for i in range(int(input())): a,b =int(input()),int(input()) if a>=pow(10,80) or b>=pow(10,80): print("overflow") else: big = a+b if big >= pow(10,80): print("overflow") else: print(big);
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,174
s920277352
p00015
u546285759
1507451527
Python
Python3
py
Accepted
30
7712
133
N = int(input()) for _ in range(N): f, s = [int(input()) for _ in range(2)] print(f+s if len(str(f+s)) <= 80 else "overflow")
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,175
s397473043
p00015
u299798926
1511584305
Python
Python3
py
Accepted
30
7612
265
import math count=int(input()) for i in range(count): x=int(input()) y=int(input()) ans=x+y dif=100000000000000000000000000000000000000000000000000000000000000000000000000000000 if ans>=dif: print("overflow") else: print(ans)
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,176
s663132432
p00015
u917432951
1511833480
Python
Python3
py
Accepted
20
5584
233
if __name__ == '__main__': n = (int)(input()) for _ in range(n): sNumber = (int)(input()) tNumber = (int)(input()) uNumber = sNumber+tNumber print("overflow" if uNumber >= 10**80 else uNumber)
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,177
s286987591
p00015
u845643816
1512296446
Python
Python3
py
Accepted
20
5588
169
n = int(input()) for _ in range(n): a = input() b = input() c = int(a) + int(b) if len(str(c)) > 80: print("overflow") else: print(c)
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,178
s182780377
p00015
u205327055
1513000948
Python
Python
py
Accepted
10
4692
277
# -*- coding:utf-8 -*- n = input() for i in range(1, n + 1): a = long(raw_input()) b = long(raw_input()) c = a + b d = c digit = 0 while c > 0: c = c / 10 digit += 1 if digit > 80: print 'overflow' else: print d
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,179
s058942764
p00015
u600263347
1514548061
Python
Python3
py
Accepted
20
5588
300
def main(): n = int(input()) Upper = 10**80 for i in range(n): a = int(input()) b = int(input()) if a+b >= Upper: print("overflow") else: print(a+b) if __name__ =='__main__': main()
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,180
s601923873
p00015
u700120734
1514623903
Python
Python3
py
Accepted
20
5588
163
n = int(input()) for i in range(0, n) : a = int(input()) b = int(input()) sum = a + b if len(str(sum)) > 80 : print("overflow") else : print(sum)
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,181
s836054713
p00015
u028347703
1514696647
Python
Python3
py
Accepted
20
5580
117
for i in range(int(input())): ans = int(input()) + int(input()) print(ans if len(str(ans)) <= 80 else "overflow")
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,182
s586665740
p00015
u273843182
1515029943
Python
Python3
py
Accepted
20
5588
137
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")
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,183
s755265421
p00015
u024715419
1515135021
Python
Python3
py
Accepted
20
5588
165
n = int(input()) for i in range(n): x = int(input()) y = int(input()) if len(str(x + y)) > 80: print("overflow") else: print(x + y)
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,184
s365905486
p00015
u568287817
1515256497
Python
Python3
py
Accepted
20
5668
1,077
import math def calc_digit(data1, data2): if(data1 == 0): data_size2 = int(len(str(data2))) data_size1 = 1 elif(data2 == 0): data_size1 = int(len(str(data2))) data_size2 = 1 else: data_size1 = int(len(str(data1))) data_size2 = int(len(str(data2))) return(data_size1, data_size2) def two_number_sum(data1, data2): result = data1 + data2 if int(len(str(result))) > 80: print("overflow") else: print(result) def main(): a = [] N = int(input()) for i in range(N*2): a.append(input()) for i in range(0, N*2): if i % 2 == 0: continue else: data1 = int(a[i-1]) data2 = int(a[i]) if(data1 == None): data1 = 0 elif(data2 == None): data2 = 0 x, y = calc_digit(data1, data2) if(x > 80 or y > 80): print("overflow") continue two_number_sum(data1, data2) if __name__ == '__main__': main()
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,185
s004408983
p00015
u764789069
1515297617
Python
Python
py
Accepted
10
4688
230
n = int(raw_input()) for i in range(0,n): #a,b=map(int,raw_input().splitlines()) a = int(raw_input()) b = int(raw_input()) sum = a+b if len(str(sum)) <= 80: print sum else: print "overflow"
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,186
s331134912
p00015
u846136461
1516239585
Python
Python
py
Accepted
10
4676
203
# coding: utf-8 n = int(raw_input()) for i in range(n): n1 = int(raw_input()) n2 = int(raw_input()) sum = n1 + n2 strsum = str(sum) if len(strsum) > 80: print("overflow") else: print(strsum)
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,187
s370436029
p00015
u546285759
1516335906
Python
Python3
py
Accepted
20
5596
158
N = int(input()) for _ in range(N): a = int(input()) b = int(input()) c = a + b length = len(str(c)) print([c, "overflow"][length > 80])
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,188
s823551454
p00015
u043254318
1516466860
Python
Python3
py
Accepted
20
5584
177
N = int(input()) for i in range(N): a = int(input()) b = int(input()) ans = a + b if len(str(ans)) > 80: print("overflow") else: print(ans)
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,189
s725970731
p00015
u150984829
1516903530
Python
Python3
py
Accepted
20
5592
89
for _ in[0]*int(input()): s=int(input())+int(input()) print([s,'overflow'][s>=10**80])
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,190
s169684516
p00015
u150984829
1516903814
Python
Python3
py
Accepted
20
5592
89
for _ in[0]*int(input()): s=eval(input()+'+'+input()) print([s,'overflow'][s>=10**80])
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,191
s346899812
p00015
u553148578
1523587168
Python
Python3
py
Accepted
20
5592
144
n = int(input()) for i in range(n): x = int(input()) y = int(input()) ans = x + y if(ans < 10**80): print(ans) else: print("overflow")
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,192
s928371017
p00015
u166871988
1523716642
Python
Python3
py
Accepted
30
5592
202
n=int(input()) for _ in range(n): a=input() b=input() s=int(a)+int(b) if len(a)>80 or len(b)>80 or len(str(s))>80: print("overflow") continue else: print(s)
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,193
s541314786
p00015
u352394527
1523861749
Python
Python3
py
Accepted
20
5584
152
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)
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,194
s971832910
p00015
u724548524
1525746703
Python
Python3
py
Accepted
20
5584
115
for _ in range(int(input())): a = int(input()) + int(input()) print(a if len(str(a)) < 81 else "overflow")
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,195
s195979615
p00015
u136916346
1527361733
Python
Python3
py
Accepted
20
5600
140
o=map(str,[sum([int(input()) for j in range(2)]) for i in range(int(input()))]) [print(i) if len(i)<=80 else print("overflow") for i in o]
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,196
s951642034
p00015
u136916346
1527361800
Python
Python3
py
Accepted
20
5604
136
[print(i) if len(i)<=80 else print("overflow") for i in map(str,[sum([int(input()) for j in range(2)]) for i in range(int(input()))])]
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,197
s532685023
p00015
u847467233
1528547975
Python
Python3
py
Accepted
30
5584
323
# AOJ 0015 National Budget # Python3 2018.6.9 bal4u n = int(input()) for i in range(n): a = str(input()) b = str(input()) if len(a) > 80 or len(b) > 80: print('overflow') else: s = str(int(a)+int(b)) if len(s) <= 80: print(s) else: print('overflow')
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,198
s983096256
p00015
u847467233
1528548229
Python
Python3
py
Accepted
20
5592
204
# AOJ 0015 National Budget # Python3 2018.6.9 bal4u n = int(input()) for i in range(n): s = int(input()) + int(input()) if len(str(s)) <= 80: print(s) else: print('overflow')
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,199
s185750519
p00015
u650035614
1530634782
Python
Python3
py
Accepted
20
5588
144
n = int(input()) for _ in range(n): a = int(input())+int(input()) if a >= 10**80: print("overflow") else: print(a)
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,200
s860119313
p00015
u263247628
1344350762
Python
Python
py
Accepted
10
4244
186
n = int(raw_input()) for i in range(0, n): x = int(raw_input()) y = int(raw_input()) sum = str(x+y) if len(sum) > 80: print 'overflow' else: print sum
p00015
<H1>National Budget</H1> <p> 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. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
6,201