message stringlengths 2 44.5k | message_type stringclasses 2
values | message_id int64 0 1 | conversation_id int64 42 109k | cluster float64 5 5 | __index_level_0__ int64 84 217k |
|---|---|---|---|---|---|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given N real values A_1, A_2, \ldots, A_N. Compute the number of pairs of indices (i, j) such that i < j and the product A_i \cdot A_j is integer.
Constraints
* 2 \leq N \leq 200\,000
* 0 < A_i < 10^4
* A_i is given with at most 9 digits after the decimal.
Input
Input is given from Standard Input in the following format.
N
A_1
A_2
\vdots
A_N
Output
Print the number of pairs with integer product A_i \cdot A_j (and i < j).
Examples
Input
5
7.5
2.4
17.000000001
17
16.000000000
Output
3
Input
11
0.9
1
1
1.25
2.30000
5
70
0.000000001
9999.999999999
0.999999999
1.000000001
Output
8
Submitted Solution:
```
n = int(input())
a = []
howmany = [[0] * (19) for _ in range(19)]
for i in range(n):
x = input()
len_x = len(x)
if '.' in x:
idx = x.index('.')
x = int(x.replace('.', '') + '0' * (9 - len_x + idx + 1))
else:
x = int(x)
x = x * 10 ** 9
#print(x)
cnt_2, cnt_5 = 0, 0
while x % 2 == 0:
x //= 2
cnt_2 += 1
while x % 5 == 0:
x //= 5
cnt_5 += 1
cnt_2 = min(cnt_2, 18)
cnt_5 = min(cnt_5, 18)
howmany[cnt_2][cnt_5] += 1
a.append((cnt_2, cnt_5))
for i in range(18, -1, -1):
for j in range(18, 0, -1):
howmany[i][j-1] += howmany[i][j]
for j in range(18, -1, -1):
for i in range(18, 0, -1):
howmany[i-1][j] += howmany[i][j]
#print(*howmany, sep='\n')
cnt = 0
for i in range(n):
l, r = a[i]
if l >= 9 and r >= 9:
cnt += howmany[18-l][18-r] - 1
else:
cnt += howmany[18-l][18-r]
print(cnt // 2)
``` | instruction | 0 | 53,666 | 5 | 107,332 |
Yes | output | 1 | 53,666 | 5 | 107,333 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given N real values A_1, A_2, \ldots, A_N. Compute the number of pairs of indices (i, j) such that i < j and the product A_i \cdot A_j is integer.
Constraints
* 2 \leq N \leq 200\,000
* 0 < A_i < 10^4
* A_i is given with at most 9 digits after the decimal.
Input
Input is given from Standard Input in the following format.
N
A_1
A_2
\vdots
A_N
Output
Print the number of pairs with integer product A_i \cdot A_j (and i < j).
Examples
Input
5
7.5
2.4
17.000000001
17
16.000000000
Output
3
Input
11
0.9
1
1
1.25
2.30000
5
70
0.000000001
9999.999999999
0.999999999
1.000000001
Output
8
Submitted Solution:
```
n = int(input())
a = []
for i in range(n):
a.append(float(input()))
count = 0
for i in range(n):
for j in range(n):
if i != j and i < j:
temp = (a[i] * 10 ** 3) * (a[j] * 10 ** 3) / 10 ** 6
#print(temp, int(temp))
if temp - int(temp) == 0:
count += 1
print(count)
``` | instruction | 0 | 53,667 | 5 | 107,334 |
No | output | 1 | 53,667 | 5 | 107,335 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given N real values A_1, A_2, \ldots, A_N. Compute the number of pairs of indices (i, j) such that i < j and the product A_i \cdot A_j is integer.
Constraints
* 2 \leq N \leq 200\,000
* 0 < A_i < 10^4
* A_i is given with at most 9 digits after the decimal.
Input
Input is given from Standard Input in the following format.
N
A_1
A_2
\vdots
A_N
Output
Print the number of pairs with integer product A_i \cdot A_j (and i < j).
Examples
Input
5
7.5
2.4
17.000000001
17
16.000000000
Output
3
Input
11
0.9
1
1
1.25
2.30000
5
70
0.000000001
9999.999999999
0.999999999
1.000000001
Output
8
Submitted Solution:
```
import sys
N = int(input())
#整数と整数
#有限整数は、「2^t × 5^f」で表せる。
#A = sys.stdin.readlines()
MN = [[0 for i in range(35)] for j in range(35)]
#MN[i][j] = プラスi-9,マイナスi-9
for _ in range(N):
a = input()
two = 0
five = 0
ten = 0
if "." in a:
shosuten = a.index(".")
ten = len(a) - shosuten - 1
a = int("".join([hoge for hoge in a if hoge != "."]))
two = ten
five = ten
else:
a = int(a)
two = 0
five = 0
while a%5 == 0:
a //= 5
five -= 1
while a%2 == 0:
a //= 2
two -= 1
MN[two+5][five+5] += 1
ans = 0
selfu = 0
for two1 in range(35):
for two2 in range(35):
if two1 + two2 > 10:
break
for five1 in range(35):
for five2 in range(35):
abe = MN[two1][five1]
nana = MN[two2][five2]
if two1 + two2 <=10 and five1 + five2 <= 10:
if two1 == two2 and five1 == five2:
if abe:
ans += abe*(nana-1)
else:
ans += abe*nana
print(ans//2)
``` | instruction | 0 | 53,668 | 5 | 107,336 |
No | output | 1 | 53,668 | 5 | 107,337 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given N real values A_1, A_2, \ldots, A_N. Compute the number of pairs of indices (i, j) such that i < j and the product A_i \cdot A_j is integer.
Constraints
* 2 \leq N \leq 200\,000
* 0 < A_i < 10^4
* A_i is given with at most 9 digits after the decimal.
Input
Input is given from Standard Input in the following format.
N
A_1
A_2
\vdots
A_N
Output
Print the number of pairs with integer product A_i \cdot A_j (and i < j).
Examples
Input
5
7.5
2.4
17.000000001
17
16.000000000
Output
3
Input
11
0.9
1
1
1.25
2.30000
5
70
0.000000001
9999.999999999
0.999999999
1.000000001
Output
8
Submitted Solution:
```
import decimal
N = int(input())
int_A = []
float_A = []
float_even_A = [] # 末尾が偶数か5のやつ
float_5_A = []
for n in range(N):
a = input()
a_number = float(a)
if a_number % 1.0 > 0:
if a[-1] == '5':
float_5_A.append(a_number)
elif a[-1] in ['2', '4', '6', '8']:
float_even_A.append(a_number)
elif a[-1] in ['1', '3', '5', '7', '9']:
float_A.append(a_number)
else:
for _a in a[::-1]:
if _a == '0':
continue
elif _a in ['2', '4', '6', '8']:
float_even_A.append(a_number)
elif _a == '5':
float_5_A.append(a_number)
else:
int_A.append(int(a_number))
cnt = 0
cnt += len(int_A) * (len(int_A) - 1) // 2
for int_a in int_A:
for float_a in float_A:
product = int_a * float_a
if product % 1.0 == 0:
cnt += 1
for float_even_a in float_even_A:
product = int_a * float_even_a
if product % 1.0 == 0:
cnt += 1
for float_5_a in float_5_A:
product = int_a * float_5_a
if product % 1.0 == 0:
cnt += 1
for float_5_a in float_5_A:
for float_even_a in float_even_A:
product = float_5_a * float_even_a
if product % 1.0 == 0:
cnt += 1
# print(f"int_A: {int_A}")
# print(f"float_A: {float_A}")
# print(f"float_even_A: {float_even_A}")
# print(f"float_5_A: {float_5_A}")
print(cnt)
``` | instruction | 0 | 53,669 | 5 | 107,338 |
No | output | 1 | 53,669 | 5 | 107,339 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given N real values A_1, A_2, \ldots, A_N. Compute the number of pairs of indices (i, j) such that i < j and the product A_i \cdot A_j is integer.
Constraints
* 2 \leq N \leq 200\,000
* 0 < A_i < 10^4
* A_i is given with at most 9 digits after the decimal.
Input
Input is given from Standard Input in the following format.
N
A_1
A_2
\vdots
A_N
Output
Print the number of pairs with integer product A_i \cdot A_j (and i < j).
Examples
Input
5
7.5
2.4
17.000000001
17
16.000000000
Output
3
Input
11
0.9
1
1
1.25
2.30000
5
70
0.000000001
9999.999999999
0.999999999
1.000000001
Output
8
Submitted Solution:
```
n = int(input())
alis = []
ans = 0
for _ in range(0,n):
a = float(input())
alis.append(a)
for i in range(0,n):
for j in range(0,i):
if int(alis[i]) * int(alis[j]) == alis[i] * alis[j]:
ans += 1
print(ans)
``` | instruction | 0 | 53,670 | 5 | 107,340 |
No | output | 1 | 53,670 | 5 | 107,341 |
Provide a correct Python 3 solution for this coding contest problem.
Given any integer x, Aoki can do the operation below.
Operation: Replace x with the absolute difference of x and K.
You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.
Constraints
* 0 ≤ N ≤ 10^{18}
* 1 ≤ K ≤ 10^{18}
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
N K
Output
Print the minimum possible value taken by N after Aoki does the operation zero or more times.
Examples
Input
7 4
Output
1
Input
2 6
Output
2
Input
1000000000000000000 1
Output
0 | instruction | 0 | 53,671 | 5 | 107,342 |
"Correct Solution:
```
N,K=map(int,input().split())
l=N%K
print(min(l,abs(K-l)))
``` | output | 1 | 53,671 | 5 | 107,343 |
Provide a correct Python 3 solution for this coding contest problem.
Given any integer x, Aoki can do the operation below.
Operation: Replace x with the absolute difference of x and K.
You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.
Constraints
* 0 ≤ N ≤ 10^{18}
* 1 ≤ K ≤ 10^{18}
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
N K
Output
Print the minimum possible value taken by N after Aoki does the operation zero or more times.
Examples
Input
7 4
Output
1
Input
2 6
Output
2
Input
1000000000000000000 1
Output
0 | instruction | 0 | 53,672 | 5 | 107,344 |
"Correct Solution:
```
n,k=map(int,input().split())
print(min(n,n%k,k-n%k))
``` | output | 1 | 53,672 | 5 | 107,345 |
Provide a correct Python 3 solution for this coding contest problem.
Given any integer x, Aoki can do the operation below.
Operation: Replace x with the absolute difference of x and K.
You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.
Constraints
* 0 ≤ N ≤ 10^{18}
* 1 ≤ K ≤ 10^{18}
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
N K
Output
Print the minimum possible value taken by N after Aoki does the operation zero or more times.
Examples
Input
7 4
Output
1
Input
2 6
Output
2
Input
1000000000000000000 1
Output
0 | instruction | 0 | 53,673 | 5 | 107,346 |
"Correct Solution:
```
a,b=map(int,input().split())
print(min(b-(a%b),a%b))
``` | output | 1 | 53,673 | 5 | 107,347 |
Provide a correct Python 3 solution for this coding contest problem.
Given any integer x, Aoki can do the operation below.
Operation: Replace x with the absolute difference of x and K.
You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.
Constraints
* 0 ≤ N ≤ 10^{18}
* 1 ≤ K ≤ 10^{18}
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
N K
Output
Print the minimum possible value taken by N after Aoki does the operation zero or more times.
Examples
Input
7 4
Output
1
Input
2 6
Output
2
Input
1000000000000000000 1
Output
0 | instruction | 0 | 53,674 | 5 | 107,348 |
"Correct Solution:
```
a,b = list(map(int,input().split()))
print(min(a%b,b-a%b))
``` | output | 1 | 53,674 | 5 | 107,349 |
Provide a correct Python 3 solution for this coding contest problem.
Given any integer x, Aoki can do the operation below.
Operation: Replace x with the absolute difference of x and K.
You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.
Constraints
* 0 ≤ N ≤ 10^{18}
* 1 ≤ K ≤ 10^{18}
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
N K
Output
Print the minimum possible value taken by N after Aoki does the operation zero or more times.
Examples
Input
7 4
Output
1
Input
2 6
Output
2
Input
1000000000000000000 1
Output
0 | instruction | 0 | 53,675 | 5 | 107,350 |
"Correct Solution:
```
N, K = map(int, input().split())
print(min(N % K, -(N%K) + K))
``` | output | 1 | 53,675 | 5 | 107,351 |
Provide a correct Python 3 solution for this coding contest problem.
Given any integer x, Aoki can do the operation below.
Operation: Replace x with the absolute difference of x and K.
You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.
Constraints
* 0 ≤ N ≤ 10^{18}
* 1 ≤ K ≤ 10^{18}
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
N K
Output
Print the minimum possible value taken by N after Aoki does the operation zero or more times.
Examples
Input
7 4
Output
1
Input
2 6
Output
2
Input
1000000000000000000 1
Output
0 | instruction | 0 | 53,676 | 5 | 107,352 |
"Correct Solution:
```
n,k = map(int,input().split())
c = n%k
m = min(c,k-c)
print(m)
``` | output | 1 | 53,676 | 5 | 107,353 |
Provide a correct Python 3 solution for this coding contest problem.
Given any integer x, Aoki can do the operation below.
Operation: Replace x with the absolute difference of x and K.
You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.
Constraints
* 0 ≤ N ≤ 10^{18}
* 1 ≤ K ≤ 10^{18}
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
N K
Output
Print the minimum possible value taken by N after Aoki does the operation zero or more times.
Examples
Input
7 4
Output
1
Input
2 6
Output
2
Input
1000000000000000000 1
Output
0 | instruction | 0 | 53,677 | 5 | 107,354 |
"Correct Solution:
```
N,K = map(int,input().split())
i = N%K
j = -i+K
print(min(i,j))
``` | output | 1 | 53,677 | 5 | 107,355 |
Provide a correct Python 3 solution for this coding contest problem.
Given any integer x, Aoki can do the operation below.
Operation: Replace x with the absolute difference of x and K.
You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.
Constraints
* 0 ≤ N ≤ 10^{18}
* 1 ≤ K ≤ 10^{18}
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
N K
Output
Print the minimum possible value taken by N after Aoki does the operation zero or more times.
Examples
Input
7 4
Output
1
Input
2 6
Output
2
Input
1000000000000000000 1
Output
0 | instruction | 0 | 53,678 | 5 | 107,356 |
"Correct Solution:
```
N,K=map(int,input().split())
print(min(N%K,abs(K-(N%K))))
``` | output | 1 | 53,678 | 5 | 107,357 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Given any integer x, Aoki can do the operation below.
Operation: Replace x with the absolute difference of x and K.
You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.
Constraints
* 0 ≤ N ≤ 10^{18}
* 1 ≤ K ≤ 10^{18}
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
N K
Output
Print the minimum possible value taken by N after Aoki does the operation zero or more times.
Examples
Input
7 4
Output
1
Input
2 6
Output
2
Input
1000000000000000000 1
Output
0
Submitted Solution:
```
n,k=map(int,input().split());print(min(n%k,k-n%k))
``` | instruction | 0 | 53,679 | 5 | 107,358 |
Yes | output | 1 | 53,679 | 5 | 107,359 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Given any integer x, Aoki can do the operation below.
Operation: Replace x with the absolute difference of x and K.
You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.
Constraints
* 0 ≤ N ≤ 10^{18}
* 1 ≤ K ≤ 10^{18}
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
N K
Output
Print the minimum possible value taken by N after Aoki does the operation zero or more times.
Examples
Input
7 4
Output
1
Input
2 6
Output
2
Input
1000000000000000000 1
Output
0
Submitted Solution:
```
a,b = map(int, input().split())
print(min(a%b, abs((a%b)-b)))
``` | instruction | 0 | 53,680 | 5 | 107,360 |
Yes | output | 1 | 53,680 | 5 | 107,361 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Given any integer x, Aoki can do the operation below.
Operation: Replace x with the absolute difference of x and K.
You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.
Constraints
* 0 ≤ N ≤ 10^{18}
* 1 ≤ K ≤ 10^{18}
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
N K
Output
Print the minimum possible value taken by N after Aoki does the operation zero or more times.
Examples
Input
7 4
Output
1
Input
2 6
Output
2
Input
1000000000000000000 1
Output
0
Submitted Solution:
```
n,k=map(int,input().split());t=n%k;print(min(t,k-t))
``` | instruction | 0 | 53,681 | 5 | 107,362 |
Yes | output | 1 | 53,681 | 5 | 107,363 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Given any integer x, Aoki can do the operation below.
Operation: Replace x with the absolute difference of x and K.
You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.
Constraints
* 0 ≤ N ≤ 10^{18}
* 1 ≤ K ≤ 10^{18}
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
N K
Output
Print the minimum possible value taken by N after Aoki does the operation zero or more times.
Examples
Input
7 4
Output
1
Input
2 6
Output
2
Input
1000000000000000000 1
Output
0
Submitted Solution:
```
n,m=map(int,input().split())
n%=m
A=[n,m-n]
print(min(A))
``` | instruction | 0 | 53,682 | 5 | 107,364 |
Yes | output | 1 | 53,682 | 5 | 107,365 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Given any integer x, Aoki can do the operation below.
Operation: Replace x with the absolute difference of x and K.
You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.
Constraints
* 0 ≤ N ≤ 10^{18}
* 1 ≤ K ≤ 10^{18}
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
N K
Output
Print the minimum possible value taken by N after Aoki does the operation zero or more times.
Examples
Input
7 4
Output
1
Input
2 6
Output
2
Input
1000000000000000000 1
Output
0
Submitted Solution:
```
#!/usr/bin/env python3
import sys
def solve(N: int, K: int):
l=abs(N//K)
p=K*l
if N//K==2:
print(0)
exit()
for i in range(1,10000):
if abs(N-(K*(l+1)))<abs(N-p):
p=p+1
print(abs(N-p))
return
# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template)
def main():
def iterate_tokens():
for line in sys.stdin:
for word in line.split():
yield word
tokens = iterate_tokens()
N = int(next(tokens)) # type: int
K = int(next(tokens)) # type: int
solve(N, K)
if __name__ == '__main__':
main()
``` | instruction | 0 | 53,683 | 5 | 107,366 |
No | output | 1 | 53,683 | 5 | 107,367 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Given any integer x, Aoki can do the operation below.
Operation: Replace x with the absolute difference of x and K.
You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.
Constraints
* 0 ≤ N ≤ 10^{18}
* 1 ≤ K ≤ 10^{18}
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
N K
Output
Print the minimum possible value taken by N after Aoki does the operation zero or more times.
Examples
Input
7 4
Output
1
Input
2 6
Output
2
Input
1000000000000000000 1
Output
0
Submitted Solution:
```
import sys
input = sys.stdin.readline
N ,K = map(int,input().split())
intlist = [ (N % K) ,abs (( N % K ) - N )]
print ( min(intlist) )
``` | instruction | 0 | 53,684 | 5 | 107,368 |
No | output | 1 | 53,684 | 5 | 107,369 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Given any integer x, Aoki can do the operation below.
Operation: Replace x with the absolute difference of x and K.
You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.
Constraints
* 0 ≤ N ≤ 10^{18}
* 1 ≤ K ≤ 10^{18}
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
N K
Output
Print the minimum possible value taken by N after Aoki does the operation zero or more times.
Examples
Input
7 4
Output
1
Input
2 6
Output
2
Input
1000000000000000000 1
Output
0
Submitted Solution:
```
import math
n_and_k = list(map(int, input().split()))
n = n_and_k[0]
k = n_and_k[1]
quotient = n // k
remainder = n % k
if n > k:
print(min([quotient, remainder]))
else:
print(max([quotient, remainder]))
``` | instruction | 0 | 53,685 | 5 | 107,370 |
No | output | 1 | 53,685 | 5 | 107,371 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Given any integer x, Aoki can do the operation below.
Operation: Replace x with the absolute difference of x and K.
You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.
Constraints
* 0 ≤ N ≤ 10^{18}
* 1 ≤ K ≤ 10^{18}
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
N K
Output
Print the minimum possible value taken by N after Aoki does the operation zero or more times.
Examples
Input
7 4
Output
1
Input
2 6
Output
2
Input
1000000000000000000 1
Output
0
Submitted Solution:
```
N, K = input().split()
n = int(N)
k = int(K)
t = n
if n % k == 0:
print(0)
else:
while True:
n = abs(n - k)
if n >= t:
break
t = n
print(t)
``` | instruction | 0 | 53,686 | 5 | 107,372 |
No | output | 1 | 53,686 | 5 | 107,373 |
Provide a correct Python 3 solution for this coding contest problem.
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
Constraints
* 1\leq N \leq 10^{16}
* N is an integer.
Input
Input is given from Standard Input in the following format:
N
Output
Print the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
Examples
Input
100
Output
18
Input
9995
Output
35
Input
3141592653589793
Output
137 | instruction | 0 | 53,751 | 5 | 107,502 |
"Correct Solution:
```
n=input()
keta=len(n)
a=0
for i in n:
a+=int(i)
print(max(a,9*(keta-1)+int(n[0])-1))
``` | output | 1 | 53,751 | 5 | 107,503 |
Provide a correct Python 3 solution for this coding contest problem.
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
Constraints
* 1\leq N \leq 10^{16}
* N is an integer.
Input
Input is given from Standard Input in the following format:
N
Output
Print the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
Examples
Input
100
Output
18
Input
9995
Output
35
Input
3141592653589793
Output
137 | instruction | 0 | 53,752 | 5 | 107,504 |
"Correct Solution:
```
n = input()
if (all([i == '9' for i in n[1:]])):
print(int(n[0])+9*(len(n)-1))
else:
print(int(n[0])-1+9*(len(n)-1))
``` | output | 1 | 53,752 | 5 | 107,505 |
Provide a correct Python 3 solution for this coding contest problem.
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
Constraints
* 1\leq N \leq 10^{16}
* N is an integer.
Input
Input is given from Standard Input in the following format:
N
Output
Print the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
Examples
Input
100
Output
18
Input
9995
Output
35
Input
3141592653589793
Output
137 | instruction | 0 | 53,753 | 5 | 107,506 |
"Correct Solution:
```
n = int(input())
s = str(n)
a = 0
for i in range(len(s)):
a += int(s[i])
b = int(s[0])-1+(len(s)-1)*9
print(max(a, b))
``` | output | 1 | 53,753 | 5 | 107,507 |
Provide a correct Python 3 solution for this coding contest problem.
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
Constraints
* 1\leq N \leq 10^{16}
* N is an integer.
Input
Input is given from Standard Input in the following format:
N
Output
Print the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
Examples
Input
100
Output
18
Input
9995
Output
35
Input
3141592653589793
Output
137 | instruction | 0 | 53,754 | 5 | 107,508 |
"Correct Solution:
```
n=input();print(int(n[0])-1*(len(n)>1)*(n[1:]!="9"*(len(n)-1))+9*(len(n)-1))
``` | output | 1 | 53,754 | 5 | 107,509 |
Provide a correct Python 3 solution for this coding contest problem.
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
Constraints
* 1\leq N \leq 10^{16}
* N is an integer.
Input
Input is given from Standard Input in the following format:
N
Output
Print the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
Examples
Input
100
Output
18
Input
9995
Output
35
Input
3141592653589793
Output
137 | instruction | 0 | 53,755 | 5 | 107,510 |
"Correct Solution:
```
N = input()
print(max((len(N) - 1) * 9 + int(N[0]) - 1, sum(int(n) for n in N)))
``` | output | 1 | 53,755 | 5 | 107,511 |
Provide a correct Python 3 solution for this coding contest problem.
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
Constraints
* 1\leq N \leq 10^{16}
* N is an integer.
Input
Input is given from Standard Input in the following format:
N
Output
Print the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
Examples
Input
100
Output
18
Input
9995
Output
35
Input
3141592653589793
Output
137 | instruction | 0 | 53,756 | 5 | 107,512 |
"Correct Solution:
```
a=list(input())
p=print
x=len(a)-1
y=int(a[0])
print(9*x+y if all(i=='9' for i in a[1:]) else y-1+9*x)
``` | output | 1 | 53,756 | 5 | 107,513 |
Provide a correct Python 3 solution for this coding contest problem.
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
Constraints
* 1\leq N \leq 10^{16}
* N is an integer.
Input
Input is given from Standard Input in the following format:
N
Output
Print the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
Examples
Input
100
Output
18
Input
9995
Output
35
Input
3141592653589793
Output
137 | instruction | 0 | 53,757 | 5 | 107,514 |
"Correct Solution:
```
n=input()
k=len(n)
if k==1:
print(n);exit()
nn=int(n)
ans= nn//(10**(k-1))-1+9*(k-1)
print(max(ans, sum([int(i) for i in n]) ))
``` | output | 1 | 53,757 | 5 | 107,515 |
Provide a correct Python 3 solution for this coding contest problem.
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
Constraints
* 1\leq N \leq 10^{16}
* N is an integer.
Input
Input is given from Standard Input in the following format:
N
Output
Print the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
Examples
Input
100
Output
18
Input
9995
Output
35
Input
3141592653589793
Output
137 | instruction | 0 | 53,758 | 5 | 107,516 |
"Correct Solution:
```
n=input()
print(max(int(n[0])-1+(9*(len(n)-1)),sum([int(i) for i in n])))
``` | output | 1 | 53,758 | 5 | 107,517 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
Constraints
* 1\leq N \leq 10^{16}
* N is an integer.
Input
Input is given from Standard Input in the following format:
N
Output
Print the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
Examples
Input
100
Output
18
Input
9995
Output
35
Input
3141592653589793
Output
137
Submitted Solution:
```
n = input()
s = 0
for each in n:
s += int(each)
l = int(n[0]) -1 + 9*(len(n)-1)
print(max(s, l))
``` | instruction | 0 | 53,759 | 5 | 107,518 |
Yes | output | 1 | 53,759 | 5 | 107,519 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
Constraints
* 1\leq N \leq 10^{16}
* N is an integer.
Input
Input is given from Standard Input in the following format:
N
Output
Print the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
Examples
Input
100
Output
18
Input
9995
Output
35
Input
3141592653589793
Output
137
Submitted Solution:
```
N=input()
n=N[0]
if n+"9"*(len(N)-1)==N:
print(int(n)+9*(len(N)-1))
else:
print(int(n)+9*(len(N)-1)-1)
``` | instruction | 0 | 53,760 | 5 | 107,520 |
Yes | output | 1 | 53,760 | 5 | 107,521 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
Constraints
* 1\leq N \leq 10^{16}
* N is an integer.
Input
Input is given from Standard Input in the following format:
N
Output
Print the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
Examples
Input
100
Output
18
Input
9995
Output
35
Input
3141592653589793
Output
137
Submitted Solution:
```
N=input()
l=len(N)-1
h=int(N[0])
N=int(N)
if N==(h+1)*10**l-1:
print(h+9*l)
else:
print(h+9*l-1)
``` | instruction | 0 | 53,761 | 5 | 107,522 |
Yes | output | 1 | 53,761 | 5 | 107,523 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
Constraints
* 1\leq N \leq 10^{16}
* N is an integer.
Input
Input is given from Standard Input in the following format:
N
Output
Print the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
Examples
Input
100
Output
18
Input
9995
Output
35
Input
3141592653589793
Output
137
Submitted Solution:
```
N = input()
k = int(N[0]) + 9*(len(N) - 1)
if N[1:] != '9' * (len(N) - 1):
k -= 1
print(k)
``` | instruction | 0 | 53,762 | 5 | 107,524 |
Yes | output | 1 | 53,762 | 5 | 107,525 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
Constraints
* 1\leq N \leq 10^{16}
* N is an integer.
Input
Input is given from Standard Input in the following format:
N
Output
Print the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
Examples
Input
100
Output
18
Input
9995
Output
35
Input
3141592653589793
Output
137
Submitted Solution:
```
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)
N = [int(i) for i in list(input())]
length = len(N)
for l in N[:1]:
if not l==9:
ans = (length-1)*9+(N[0]-1)
print(ans)
break
else:
print(sum(N))
``` | instruction | 0 | 53,763 | 5 | 107,526 |
No | output | 1 | 53,763 | 5 | 107,527 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
Constraints
* 1\leq N \leq 10^{16}
* N is an integer.
Input
Input is given from Standard Input in the following format:
N
Output
Print the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
Examples
Input
100
Output
18
Input
9995
Output
35
Input
3141592653589793
Output
137
Submitted Solution:
```
n = list(map(int,input()))
cnt = 0
ans = []
for i in n:
cnt += 1
if n == 9:
continue
else:
n[cnt-1] -= 1
break
for i in range(cnt,len(n)):
n[i] = 9
print(sum(n))
``` | instruction | 0 | 53,764 | 5 | 107,528 |
No | output | 1 | 53,764 | 5 | 107,529 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
Constraints
* 1\leq N \leq 10^{16}
* N is an integer.
Input
Input is given from Standard Input in the following format:
N
Output
Print the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
Examples
Input
100
Output
18
Input
9995
Output
35
Input
3141592653589793
Output
137
Submitted Solution:
```
n_=input()
n=int(n_)
l=len(n_)
for i in range(1,17):
if n+1==int(n_[0])*10**(l-1):
ans=0
while n>0:
ans+=n%10
n//=10
exit()
n = int(n_[0])*10**(l-1)-1
ans=0
while n>0:
ans+=n%10
n//=10
print(ans)
``` | instruction | 0 | 53,765 | 5 | 107,530 |
No | output | 1 | 53,765 | 5 | 107,531 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
Constraints
* 1\leq N \leq 10^{16}
* N is an integer.
Input
Input is given from Standard Input in the following format:
N
Output
Print the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
Examples
Input
100
Output
18
Input
9995
Output
35
Input
3141592653589793
Output
137
Submitted Solution:
```
n=list(input())
if ''.join(n)=='100':
exit()
sb=n[1:]
setsb=list(set(sb))
if len(setsb)==1 and setsb[0]=='9':
if n[0]=='9':
print(9*len(n))
else:
print(int(n[0])-1+9*len(sb))
else:
print(int(n[0])-1+9*len(sb))
``` | instruction | 0 | 53,766 | 5 | 107,532 |
No | output | 1 | 53,766 | 5 | 107,533 |
Provide a correct Python 3 solution for this coding contest problem.
Example
Input
4 2 1 1
1 1 1 2
2 2 2 1
2 2 1 2
1 1 2 1
9 N
Output
1 1
2 2 | instruction | 0 | 53,867 | 5 | 107,734 |
"Correct Solution:
```
# coding: utf-8
import sys
sys.setrecursionlimit(50000000)
max_c=101
vec=[(0,2),(2,0),(0,-2),(-2,0)]
try:
while True:
log=[-1 for i in range(10001)]
n,x0,y0,t=map(int,input().split())
field=[[0 for i in range(max_c)]for i in range(max_c)]
for i in range(n):
a,b,c,d=map(lambda x:int(x)*2,input().split())
if b==d:
field[b][min(a,c):max(a,c)+1]=[1 for i in range(max(a,c)+1-min(a,c))]
else:
for p in field[min(b,d):max(b,d)+1]:
p[a]=1
a,b=-1,-1
pt=0
for i in range(t):
a,b=input().split()
a=int(a)+pt
pt=a
b='NESW'.find(b)
log[a]=b
end_t=pt
end_v=b
ans=[]
memo=set({})
def check(t,x,y,v):
if t>end_t or (log[t]!=-1 and not((v+2)%4!=log[t])) or ((t,x,y,v) in memo):
return
memo.add((t,x,y,v))
if t==end_t:
ex,ey=vec[end_v]
if v==end_v or 0<=y+ey//2<=100 and 0<=x+ex//2<=100 and field[y+ey//2][x+ex//2]==1 and (v+2)%4!=end_v:
ans.append((x,y))
return
if log[t]!=-1 and v==log[t] or log[t]==-1:
i=0
for mx,my in vec:
if i==(v+2)%4:
i+=1
continue
nx,ny=x+mx,y+my
if 0<=nx<=100 and 0<=ny<=100 and field[ny-my//2][nx-mx//2]==1:
check(t+1,nx,ny,i)
i+=1
elif log[t]!=-1:
i=0
for mx,my in vec:
if i!=log[t]:
i+=1
continue
nx,ny=x+mx,y+my
if 0<=nx<=100 and 0<=ny<=100 and field[ny-my//2][nx-mx//2]==1:
check(t+1,nx,ny,i)
i+=1
for i in range(4):
check(0,x0*2,y0*2,i)
for q in sorted(set(ans)):
print(q[0]//2,q[1]//2)
except:
pass
``` | output | 1 | 53,867 | 5 | 107,735 |
Provide a correct Python 3 solution for this coding contest problem.
Write a program which prints $n$-th fibonacci number for a given integer $n$. The $n$-th fibonacci number is defined by the following recursive formula:
\begin{equation*} fib(n)= \left \\{ \begin{array}{ll} 1 & (n = 0) \\\ 1 & (n = 1) \\\ fib(n - 1) + fib(n - 2) & \\\ \end{array} \right. \end{equation*}
Constraints
* $0 \leq n \leq 44$
Input
An integer $n$ is given.
Example
Input
3
Output
3 | instruction | 0 | 53,896 | 5 | 107,792 |
"Correct Solution:
```
x = [1,1]
n = int(input())
for i in range(n):
a=[x[i]+x[i+1]]
x = x+a
print(x[n])
``` | output | 1 | 53,896 | 5 | 107,793 |
Provide a correct Python 3 solution for this coding contest problem.
Write a program which prints $n$-th fibonacci number for a given integer $n$. The $n$-th fibonacci number is defined by the following recursive formula:
\begin{equation*} fib(n)= \left \\{ \begin{array}{ll} 1 & (n = 0) \\\ 1 & (n = 1) \\\ fib(n - 1) + fib(n - 2) & \\\ \end{array} \right. \end{equation*}
Constraints
* $0 \leq n \leq 44$
Input
An integer $n$ is given.
Example
Input
3
Output
3 | instruction | 0 | 53,897 | 5 | 107,794 |
"Correct Solution:
```
n = int(input())
f = [0]*45
f[0] = f[1] = 1
for i in range(2, 45):
f[i] = f[i-2] + f[i-1]
print(f[n])
``` | output | 1 | 53,897 | 5 | 107,795 |
Provide a correct Python 3 solution for this coding contest problem.
Write a program which prints $n$-th fibonacci number for a given integer $n$. The $n$-th fibonacci number is defined by the following recursive formula:
\begin{equation*} fib(n)= \left \\{ \begin{array}{ll} 1 & (n = 0) \\\ 1 & (n = 1) \\\ fib(n - 1) + fib(n - 2) & \\\ \end{array} \right. \end{equation*}
Constraints
* $0 \leq n \leq 44$
Input
An integer $n$ is given.
Example
Input
3
Output
3 | instruction | 0 | 53,898 | 5 | 107,796 |
"Correct Solution:
```
#(40)フィボナッチ数列
n=int(input())
def fib(n):
a=1
b=1
for _ in range(n):
a,b=b,a+b
return a
print(fib(n))
``` | output | 1 | 53,898 | 5 | 107,797 |
Provide a correct Python 3 solution for this coding contest problem.
Write a program which prints $n$-th fibonacci number for a given integer $n$. The $n$-th fibonacci number is defined by the following recursive formula:
\begin{equation*} fib(n)= \left \\{ \begin{array}{ll} 1 & (n = 0) \\\ 1 & (n = 1) \\\ fib(n - 1) + fib(n - 2) & \\\ \end{array} \right. \end{equation*}
Constraints
* $0 \leq n \leq 44$
Input
An integer $n$ is given.
Example
Input
3
Output
3 | instruction | 0 | 53,899 | 5 | 107,798 |
"Correct Solution:
```
n = int(input())
DP = [0 for _ in range(n+1)]
DP[0] = 1
DP[1] = 1
for i in range(2, n+1):
DP[i] = DP[i-1]+DP[i-2]
print(DP[n])
``` | output | 1 | 53,899 | 5 | 107,799 |
Provide a correct Python 3 solution for this coding contest problem.
Write a program which prints $n$-th fibonacci number for a given integer $n$. The $n$-th fibonacci number is defined by the following recursive formula:
\begin{equation*} fib(n)= \left \\{ \begin{array}{ll} 1 & (n = 0) \\\ 1 & (n = 1) \\\ fib(n - 1) + fib(n - 2) & \\\ \end{array} \right. \end{equation*}
Constraints
* $0 \leq n \leq 44$
Input
An integer $n$ is given.
Example
Input
3
Output
3 | instruction | 0 | 53,900 | 5 | 107,800 |
"Correct Solution:
```
n=int(input())
fib=[0 for i in range(n+1)]
fib[0]=1
fib[1]=1
for i in range(2,n+1):
fib[i]=fib[i-1]+fib[i-2]
print(fib[n])
``` | output | 1 | 53,900 | 5 | 107,801 |
Provide a correct Python 3 solution for this coding contest problem.
Write a program which prints $n$-th fibonacci number for a given integer $n$. The $n$-th fibonacci number is defined by the following recursive formula:
\begin{equation*} fib(n)= \left \\{ \begin{array}{ll} 1 & (n = 0) \\\ 1 & (n = 1) \\\ fib(n - 1) + fib(n - 2) & \\\ \end{array} \right. \end{equation*}
Constraints
* $0 \leq n \leq 44$
Input
An integer $n$ is given.
Example
Input
3
Output
3 | instruction | 0 | 53,901 | 5 | 107,802 |
"Correct Solution:
```
n = int(input())
fib = [0]*(n+1)
fib[0],fib[1] = 1, 1
for i in range(2, n+1):
fib[i] = fib[i-1] + fib[i-2]
print(fib[n])
``` | output | 1 | 53,901 | 5 | 107,803 |
Provide a correct Python 3 solution for this coding contest problem.
Write a program which prints $n$-th fibonacci number for a given integer $n$. The $n$-th fibonacci number is defined by the following recursive formula:
\begin{equation*} fib(n)= \left \\{ \begin{array}{ll} 1 & (n = 0) \\\ 1 & (n = 1) \\\ fib(n - 1) + fib(n - 2) & \\\ \end{array} \right. \end{equation*}
Constraints
* $0 \leq n \leq 44$
Input
An integer $n$ is given.
Example
Input
3
Output
3 | instruction | 0 | 53,902 | 5 | 107,804 |
"Correct Solution:
```
n = int(input())
fib = [1]*45
for i in range(2,n+1):
fib[i] = fib[i-1]+fib[i-2]
print(fib[n])
``` | output | 1 | 53,902 | 5 | 107,805 |
Provide a correct Python 3 solution for this coding contest problem.
Write a program which prints $n$-th fibonacci number for a given integer $n$. The $n$-th fibonacci number is defined by the following recursive formula:
\begin{equation*} fib(n)= \left \\{ \begin{array}{ll} 1 & (n = 0) \\\ 1 & (n = 1) \\\ fib(n - 1) + fib(n - 2) & \\\ \end{array} \right. \end{equation*}
Constraints
* $0 \leq n \leq 44$
Input
An integer $n$ is given.
Example
Input
3
Output
3 | instruction | 0 | 53,903 | 5 | 107,806 |
"Correct Solution:
```
N = int(input())
dp = [0] * (N+1)
dp[0], dp[1] = 1,1
for i in range(2,N+1):
dp[i] = dp[i-1] + dp[i-2]
print(dp[N])
``` | output | 1 | 53,903 | 5 | 107,807 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Write a program which prints $n$-th fibonacci number for a given integer $n$. The $n$-th fibonacci number is defined by the following recursive formula:
\begin{equation*} fib(n)= \left \\{ \begin{array}{ll} 1 & (n = 0) \\\ 1 & (n = 1) \\\ fib(n - 1) + fib(n - 2) & \\\ \end{array} \right. \end{equation*}
Constraints
* $0 \leq n \leq 44$
Input
An integer $n$ is given.
Example
Input
3
Output
3
Submitted Solution:
```
a=1
b=1
list=[]
n=int(input())
list.append(a)
list.append(b)
for i in range(n):
list.append(a+b)
d=b
b+=a
a=d
print(list[n])
``` | instruction | 0 | 53,904 | 5 | 107,808 |
Yes | output | 1 | 53,904 | 5 | 107,809 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Write a program which prints $n$-th fibonacci number for a given integer $n$. The $n$-th fibonacci number is defined by the following recursive formula:
\begin{equation*} fib(n)= \left \\{ \begin{array}{ll} 1 & (n = 0) \\\ 1 & (n = 1) \\\ fib(n - 1) + fib(n - 2) & \\\ \end{array} \right. \end{equation*}
Constraints
* $0 \leq n \leq 44$
Input
An integer $n$ is given.
Example
Input
3
Output
3
Submitted Solution:
```
n = int(input())
x, y = 1, 1
for i in range(n):
x, y = y, x + y
print(x)
``` | instruction | 0 | 53,905 | 5 | 107,810 |
Yes | output | 1 | 53,905 | 5 | 107,811 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Write a program which prints $n$-th fibonacci number for a given integer $n$. The $n$-th fibonacci number is defined by the following recursive formula:
\begin{equation*} fib(n)= \left \\{ \begin{array}{ll} 1 & (n = 0) \\\ 1 & (n = 1) \\\ fib(n - 1) + fib(n - 2) & \\\ \end{array} \right. \end{equation*}
Constraints
* $0 \leq n \leq 44$
Input
An integer $n$ is given.
Example
Input
3
Output
3
Submitted Solution:
```
n=int(input())
a1=1
a=1
i=1
while i<n:
a1,a=a,a1+a
i+=1
print(a)
``` | instruction | 0 | 53,906 | 5 | 107,812 |
Yes | output | 1 | 53,906 | 5 | 107,813 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Write a program which prints $n$-th fibonacci number for a given integer $n$. The $n$-th fibonacci number is defined by the following recursive formula:
\begin{equation*} fib(n)= \left \\{ \begin{array}{ll} 1 & (n = 0) \\\ 1 & (n = 1) \\\ fib(n - 1) + fib(n - 2) & \\\ \end{array} \right. \end{equation*}
Constraints
* $0 \leq n \leq 44$
Input
An integer $n$ is given.
Example
Input
3
Output
3
Submitted Solution:
```
n = int(input())
f = [1,1]
for i in range(2,n+1):
f.append(f[i-2] + f[i-1])
print(f[n])
``` | instruction | 0 | 53,907 | 5 | 107,814 |
Yes | output | 1 | 53,907 | 5 | 107,815 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.