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. Print all the integers that satisfies the following in ascending order: * Among the integers between A and B (inclusive), it is either within the K smallest integers or within the K largest int...
instruction
0
37,582
5
75,164
Yes
output
1
37,582
5
75,165
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Print all the integers that satisfies the following in ascending order: * Among the integers between A and B (inclusive), it is either within the K smallest integers or within the K largest int...
instruction
0
37,583
5
75,166
Yes
output
1
37,583
5
75,167
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Print all the integers that satisfies the following in ascending order: * Among the integers between A and B (inclusive), it is either within the K smallest integers or within the K largest int...
instruction
0
37,584
5
75,168
No
output
1
37,584
5
75,169
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Print all the integers that satisfies the following in ascending order: * Among the integers between A and B (inclusive), it is either within the K smallest integers or within the K largest int...
instruction
0
37,585
5
75,170
No
output
1
37,585
5
75,171
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Print all the integers that satisfies the following in ascending order: * Among the integers between A and B (inclusive), it is either within the K smallest integers or within the K largest int...
instruction
0
37,586
5
75,172
No
output
1
37,586
5
75,173
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Print all the integers that satisfies the following in ascending order: * Among the integers between A and B (inclusive), it is either within the K smallest integers or within the K largest int...
instruction
0
37,587
5
75,174
No
output
1
37,587
5
75,175
Provide a correct Python 3 solution for this coding contest problem. Example Input 4 1 1 2 Output 6
instruction
0
37,709
5
75,418
"Correct Solution: ``` import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools sys.setrecursionlimit(10**7) inf = 10**20 eps = 1.0 / 10**13 mod = 10**9+7 dd = [(-1,0),(0,1),(1,0),(0,-1)] ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)] def LI(): return [int...
output
1
37,709
5
75,419
Provide a correct Python 3 solution for this coding contest problem. Write a program which manipulates a sequence A = {a1, a2, . . . , an} with the following operations: * add(s, t, x): add x to as, as+1, ..., at. * get(i): output the value of ai. Note that the initial values of ai (i = 1, 2, . . . , n) are 0. Co...
instruction
0
37,719
5
75,438
"Correct Solution: ``` import sys input = sys.stdin.readline class Bit: def __init__(self, n): self.n = n self.tree = [0]*(n+1) self.el = [0]*(n+1) self.depth = n.bit_length() def sum(self, i): """ 区間[0,i) の総和を求める """ s = 0 i -= 1 while i >= 0: ...
output
1
37,719
5
75,439
Provide a correct Python 3 solution for this coding contest problem. Write a program which manipulates a sequence A = {a1, a2, . . . , an} with the following operations: * add(s, t, x): add x to as, as+1, ..., at. * get(i): output the value of ai. Note that the initial values of ai (i = 1, 2, . . . , n) are 0. Co...
instruction
0
37,720
5
75,440
"Correct Solution: ``` class SegmentTree: seg_len = 1 node = [] def __init__(self, n): while self.seg_len < n: self.seg_len <<= 1 self.node = [ 0 for _ in range(self.seg_len*2) ] def add(self, l, r, x): l += self.seg_len r += self.seg_len while l < r:...
output
1
37,720
5
75,441
Provide a correct Python 3 solution for this coding contest problem. Write a program which manipulates a sequence A = {a1, a2, . . . , an} with the following operations: * add(s, t, x): add x to as, as+1, ..., at. * get(i): output the value of ai. Note that the initial values of ai (i = 1, 2, . . . , n) are 0. Co...
instruction
0
37,721
5
75,442
"Correct Solution: ``` import sys input = sys.stdin.readline class BIT(): """区間加算、一点取得クエリをそれぞれO(logN)で答える add: 区間[l, r)にvalを加える get_val: i番目の値を求める i, l, rは0-indexed """ def __init__(self, n): self.n = n self.bit = [0] * (n + 1) def _add(self, i, val): while i > 0: ...
output
1
37,721
5
75,443
Provide a correct Python 3 solution for this coding contest problem. Write a program which manipulates a sequence A = {a1, a2, . . . , an} with the following operations: * add(s, t, x): add x to as, as+1, ..., at. * get(i): output the value of ai. Note that the initial values of ai (i = 1, 2, . . . , n) are 0. Co...
instruction
0
37,722
5
75,444
"Correct Solution: ``` import sys def solve(): n, q = map(int, sys.stdin.readline().split()) ft = FenwickTree(n) for qi in range(q): query = sys.stdin.readline().rstrip() if query[0] == '0': c, s, t, x = map(int, query.split()) ft.add(s, x) ft.add(t + ...
output
1
37,722
5
75,445
Provide a correct Python 3 solution for this coding contest problem. Write a program which manipulates a sequence A = {a1, a2, . . . , an} with the following operations: * add(s, t, x): add x to as, as+1, ..., at. * get(i): output the value of ai. Note that the initial values of ai (i = 1, 2, . . . , n) are 0. Co...
instruction
0
37,723
5
75,446
"Correct Solution: ``` # -*- coding: utf-8 -*- """ Range Add Query (RAQ) http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_E&lang=ja """ import sys def main(args): def add(b, k, x): while k <= n: b[k] += x k += k & -k def get(b, k): s = 0 while k ...
output
1
37,723
5
75,447
Provide a correct Python 3 solution for this coding contest problem. Write a program which manipulates a sequence A = {a1, a2, . . . , an} with the following operations: * add(s, t, x): add x to as, as+1, ..., at. * get(i): output the value of ai. Note that the initial values of ai (i = 1, 2, . . . , n) are 0. Co...
instruction
0
37,724
5
75,448
"Correct Solution: ``` # AOJ DSL_2_E # http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_E line = input() n, q = list(map(int, line.split())) N = 1 while N < n + 1: N *= 2 a = [0 for _ in range(0, 2 * N - 1)] def get(i, k, l, r): z = a[0] while True: m = (l + r) // 2 if i < m:...
output
1
37,724
5
75,449
Provide a correct Python 3 solution for this coding contest problem. Write a program which manipulates a sequence A = {a1, a2, . . . , an} with the following operations: * add(s, t, x): add x to as, as+1, ..., at. * get(i): output the value of ai. Note that the initial values of ai (i = 1, 2, . . . , n) are 0. Co...
instruction
0
37,725
5
75,450
"Correct Solution: ``` class RAQ(object): INIT = 0 def __init__(self, num) -> None: n = 1 while n <= num: n = n * 2 self.n = n self.val = [self.INIT] * (2 * n - 1) def update(self, beg: int, end: int, k: int, l: int, r: int, x: int) -> None: if (l == r o...
output
1
37,725
5
75,451
Provide a correct Python 3 solution for this coding contest problem. Write a program which manipulates a sequence A = {a1, a2, . . . , an} with the following operations: * add(s, t, x): add x to as, as+1, ..., at. * get(i): output the value of ai. Note that the initial values of ai (i = 1, 2, . . . , n) are 0. Co...
instruction
0
37,726
5
75,452
"Correct Solution: ``` # Binary Indexed Tree (Fenwick Tree) class BIT: def __init__(self, n): self.n = n self.data = [0]*(n+1) self.el = [0]*(n+1) def sum(self, i): s = 0 while i > 0: s += self.data[i] i -= i & -i return s def add(self, i, x): # assert i > 0 self.el[i] ...
output
1
37,726
5
75,453
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Write a program which manipulates a sequence A = {a1, a2, . . . , an} with the following operations: * add(s, t, x): add x to as, as+1, ..., at. * get(i): output the value of ai. Note that t...
instruction
0
37,727
5
75,454
Yes
output
1
37,727
5
75,455
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Write a program which manipulates a sequence A = {a1, a2, . . . , an} with the following operations: * add(s, t, x): add x to as, as+1, ..., at. * get(i): output the value of ai. Note that t...
instruction
0
37,728
5
75,456
Yes
output
1
37,728
5
75,457
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Write a program which manipulates a sequence A = {a1, a2, . . . , an} with the following operations: * add(s, t, x): add x to as, as+1, ..., at. * get(i): output the value of ai. Note that t...
instruction
0
37,729
5
75,458
Yes
output
1
37,729
5
75,459
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Write a program which manipulates a sequence A = {a1, a2, . . . , an} with the following operations: * add(s, t, x): add x to as, as+1, ..., at. * get(i): output the value of ai. Note that t...
instruction
0
37,730
5
75,460
Yes
output
1
37,730
5
75,461
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Write a program which manipulates a sequence A = {a1, a2, . . . , an} with the following operations: * add(s, t, x): add x to as, as+1, ..., at. * get(i): output the value of ai. Note that t...
instruction
0
37,731
5
75,462
No
output
1
37,731
5
75,463
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Write a program which manipulates a sequence A = {a1, a2, . . . , an} with the following operations: * add(s, t, x): add x to as, as+1, ..., at. * get(i): output the value of ai. Note that t...
instruction
0
37,732
5
75,464
No
output
1
37,732
5
75,465
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Write a program which manipulates a sequence A = {a1, a2, . . . , an} with the following operations: * add(s, t, x): add x to as, as+1, ..., at. * get(i): output the value of ai. Note that t...
instruction
0
37,733
5
75,466
No
output
1
37,733
5
75,467
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given n integers a_1, a_2, ..., a_n, where n is odd. You are allowed to flip the sign of some (possibly all or none) of them. You wish to perform these flips in such a way that the follo...
instruction
0
37,885
5
75,770
Yes
output
1
37,885
5
75,771
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given n integers a_1, a_2, ..., a_n, where n is odd. You are allowed to flip the sign of some (possibly all or none) of them. You wish to perform these flips in such a way that the follo...
instruction
0
37,886
5
75,772
Yes
output
1
37,886
5
75,773
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given n integers a_1, a_2, ..., a_n, where n is odd. You are allowed to flip the sign of some (possibly all or none) of them. You wish to perform these flips in such a way that the follo...
instruction
0
37,887
5
75,774
Yes
output
1
37,887
5
75,775
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given n integers a_1, a_2, ..., a_n, where n is odd. You are allowed to flip the sign of some (possibly all or none) of them. You wish to perform these flips in such a way that the follo...
instruction
0
37,888
5
75,776
Yes
output
1
37,888
5
75,777
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given n integers a_1, a_2, ..., a_n, where n is odd. You are allowed to flip the sign of some (possibly all or none) of them. You wish to perform these flips in such a way that the follo...
instruction
0
37,889
5
75,778
No
output
1
37,889
5
75,779
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given n integers a_1, a_2, ..., a_n, where n is odd. You are allowed to flip the sign of some (possibly all or none) of them. You wish to perform these flips in such a way that the follo...
instruction
0
37,890
5
75,780
No
output
1
37,890
5
75,781
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given n integers a_1, a_2, ..., a_n, where n is odd. You are allowed to flip the sign of some (possibly all or none) of them. You wish to perform these flips in such a way that the follo...
instruction
0
37,891
5
75,782
No
output
1
37,891
5
75,783
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given n integers a_1, a_2, ..., a_n, where n is odd. You are allowed to flip the sign of some (possibly all or none) of them. You wish to perform these flips in such a way that the follo...
instruction
0
37,892
5
75,784
No
output
1
37,892
5
75,785
Provide a correct Python 3 solution for this coding contest problem. Given are N integers A_1,\ldots,A_N. We will choose exactly K of these elements. Find the maximum possible product of the chosen elements. Then, print the maximum product modulo (10^9+7), using an integer between 0 and 10^9+6 (inclusive). Constrai...
instruction
0
38,328
5
76,656
"Correct Solution: ``` n, k = map(int, input().split()) a = list(map(int, input().split())) mod = 10**9 + 7 res = 1 a.sort(reverse=True) if a[0]<0 and k%2==1: for i in range(k): res = (res*a[i])%mod else: right = n-1 left = 0 while k > 1: if a[right]*a[right-1] < a[left]*a[left+1]: ...
output
1
38,328
5
76,657
Provide a correct Python 3 solution for this coding contest problem. Given are N integers A_1,\ldots,A_N. We will choose exactly K of these elements. Find the maximum possible product of the chosen elements. Then, print the maximum product modulo (10^9+7), using an integer between 0 and 10^9+6 (inclusive). Constrai...
instruction
0
38,329
5
76,658
"Correct Solution: ``` N, K = map(int, input().split()) X = list(map(int, input().split())) MOD = 10 ** 9 + 7 pos = sorted(v for v in X if v >= 0) neg = sorted(-v for v in X if v < 0) if N == K: ans = 1 for x in X: ans *= x ans %= MOD print(ans % MOD) exit() ok = False # True: ans>=0,...
output
1
38,329
5
76,659
Provide a correct Python 3 solution for this coding contest problem. Given are N integers A_1,\ldots,A_N. We will choose exactly K of these elements. Find the maximum possible product of the chosen elements. Then, print the maximum product modulo (10^9+7), using an integer between 0 and 10^9+6 (inclusive). Constrai...
instruction
0
38,330
5
76,660
"Correct Solution: ``` n, k = map(int, input().split()) a = list(map(int, input().split())) mod = 10 ** 9 + 7 mia, pla = [], [] for ai in a: if ai < 0: mia.append(ai) elif ai >= 0: pla.append(ai) mia.sort(reverse=True) pla.sort() cnt = 1 if len(pla) == 0 and k % 2 == 1: for i in mia[:k]: ...
output
1
38,330
5
76,661
Provide a correct Python 3 solution for this coding contest problem. Given are N integers A_1,\ldots,A_N. We will choose exactly K of these elements. Find the maximum possible product of the chosen elements. Then, print the maximum product modulo (10^9+7), using an integer between 0 and 10^9+6 (inclusive). Constrai...
instruction
0
38,331
5
76,662
"Correct Solution: ``` import sys n, k = map(int, input().split()) a = [int(x) for x in input().split()] mod = pow(10, 9)+7 zero = 0 plus = [] minus = [] for i in range(n): if a[i] == 0: zero += 1 elif a[i] > 0: plus.append(a[i]) else: minus.append(a[i]) P, M = len(plus), len(minus) plus.sort(reve...
output
1
38,331
5
76,663
Provide a correct Python 3 solution for this coding contest problem. Given are N integers A_1,\ldots,A_N. We will choose exactly K of these elements. Find the maximum possible product of the chosen elements. Then, print the maximum product modulo (10^9+7), using an integer between 0 and 10^9+6 (inclusive). Constrai...
instruction
0
38,332
5
76,664
"Correct Solution: ``` from collections import deque N, K = map(int, input().split()) A = list(map(int, input().split())) MOD = 10**9 + 7 A.sort(reverse=True) ans = 1 B = deque(A) if K % 2 == 1: ans *= B.popleft() for _ in range(K // 2): l = B[0] * B[1] r = B[-1] * B[-2] if l >= r: ans *= B....
output
1
38,332
5
76,665
Provide a correct Python 3 solution for this coding contest problem. Given are N integers A_1,\ldots,A_N. We will choose exactly K of these elements. Find the maximum possible product of the chosen elements. Then, print the maximum product modulo (10^9+7), using an integer between 0 and 10^9+6 (inclusive). Constrai...
instruction
0
38,333
5
76,666
"Correct Solution: ``` from math import log10 n, k = map(int, input().split()) a = list(map(int, input().split())) MOD = 10**9+7 a.sort() cnt_neg = 0 cnt_pos = 0 for i in a: if i <= 0: cnt_neg += 1 else: cnt_pos += 1 is_minus = False k_tmp = k while k_tmp > 0: if k_tmp >= 2: if cnt_neg >= 2:...
output
1
38,333
5
76,667
Provide a correct Python 3 solution for this coding contest problem. Given are N integers A_1,\ldots,A_N. We will choose exactly K of these elements. Find the maximum possible product of the chosen elements. Then, print the maximum product modulo (10^9+7), using an integer between 0 and 10^9+6 (inclusive). Constrai...
instruction
0
38,334
5
76,668
"Correct Solution: ``` MOD = 10 ** 9 + 7 ans = 1 n, k = map(int, input().split()) a = list(map(int, input().split())) if n == k: for x in a: ans *= x ans %= MOD print(ans % MOD) exit() pos = [] neg = [] for x in a: if x >= 0: pos.append(x) else: neg.append(x) pos...
output
1
38,334
5
76,669
Provide a correct Python 3 solution for this coding contest problem. Given are N integers A_1,\ldots,A_N. We will choose exactly K of these elements. Find the maximum possible product of the chosen elements. Then, print the maximum product modulo (10^9+7), using an integer between 0 and 10^9+6 (inclusive). Constrai...
instruction
0
38,335
5
76,670
"Correct Solution: ``` import sys input = sys.stdin.readline N, K = map(int, input().split()) A = list(map(int, input().split())) MOD = 10**9+7 p, n = [], [] for i in range(N): if A[i]>=0: p.append(A[i]) else: n.append(A[i]) ok = False if len(p)>0: if N==K: if len(n)%2==0: ...
output
1
38,335
5
76,671
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Given are N integers A_1,\ldots,A_N. We will choose exactly K of these elements. Find the maximum possible product of the chosen elements. Then, print the maximum product modulo (10^9+7), usin...
instruction
0
38,336
5
76,672
Yes
output
1
38,336
5
76,673
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Given are N integers A_1,\ldots,A_N. We will choose exactly K of these elements. Find the maximum possible product of the chosen elements. Then, print the maximum product modulo (10^9+7), usin...
instruction
0
38,337
5
76,674
Yes
output
1
38,337
5
76,675
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Given are N integers A_1,\ldots,A_N. We will choose exactly K of these elements. Find the maximum possible product of the chosen elements. Then, print the maximum product modulo (10^9+7), usin...
instruction
0
38,338
5
76,676
Yes
output
1
38,338
5
76,677
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Given are N integers A_1,\ldots,A_N. We will choose exactly K of these elements. Find the maximum possible product of the chosen elements. Then, print the maximum product modulo (10^9+7), usin...
instruction
0
38,339
5
76,678
Yes
output
1
38,339
5
76,679
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Given are N integers A_1,\ldots,A_N. We will choose exactly K of these elements. Find the maximum possible product of the chosen elements. Then, print the maximum product modulo (10^9+7), usin...
instruction
0
38,340
5
76,680
No
output
1
38,340
5
76,681
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Given are N integers A_1,\ldots,A_N. We will choose exactly K of these elements. Find the maximum possible product of the chosen elements. Then, print the maximum product modulo (10^9+7), usin...
instruction
0
38,341
5
76,682
No
output
1
38,341
5
76,683
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Given are N integers A_1,\ldots,A_N. We will choose exactly K of these elements. Find the maximum possible product of the chosen elements. Then, print the maximum product modulo (10^9+7), usin...
instruction
0
38,342
5
76,684
No
output
1
38,342
5
76,685
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Given are N integers A_1,\ldots,A_N. We will choose exactly K of these elements. Find the maximum possible product of the chosen elements. Then, print the maximum product modulo (10^9+7), usin...
instruction
0
38,343
5
76,686
No
output
1
38,343
5
76,687
Provide a correct Python 3 solution for this coding contest problem. Notes Template in C Constraints 2 ≤ the number of operands in the expression ≤ 100 1 ≤ the number of operators in the expression ≤ 99 -1 × 109 ≤ values in the stack ≤ 109 Input An expression is given in a line. Two consequtive symbols (operand o...
instruction
0
38,570
5
77,140
"Correct Solution: ``` s = [] for t in input().split(): try: v = int(t) except ValueError: a = s.pop() b = s.pop() if t == '+': v = b + a elif t == '-': v = b - a elif t == '*': v = b * a s.append(v) print(s.pop()) ```
output
1
38,570
5
77,141
Provide a correct Python 3 solution for this coding contest problem. Notes Template in C Constraints 2 ≤ the number of operands in the expression ≤ 100 1 ≤ the number of operators in the expression ≤ 99 -1 × 109 ≤ values in the stack ≤ 109 Input An expression is given in a line. Two consequtive symbols (operand o...
instruction
0
38,571
5
77,142
"Correct Solution: ``` s = input().split(" ") operand = ["+", "-", "*"] stack = [] for i in s: if i in operand: a = stack.pop() b = stack.pop() stack.append(eval(str(b) + i + str(a))) else : stack.append(i) print(stack[0]) ```
output
1
38,571
5
77,143
Provide a correct Python 3 solution for this coding contest problem. Notes Template in C Constraints 2 ≤ the number of operands in the expression ≤ 100 1 ≤ the number of operators in the expression ≤ 99 -1 × 109 ≤ values in the stack ≤ 109 Input An expression is given in a line. Two consequtive symbols (operand o...
instruction
0
38,572
5
77,144
"Correct Solution: ``` l = input().split() m = [] for i in range(len(l)): if l[i] == "+": m[-2] += m[-1] m.pop() elif l[i] == "-": m[-2] -= m[-1] m.pop() elif l[i] == "*": m[-2] *= m[-1] m.pop() else: m.append(int(l[i])) print(m[0]) ```
output
1
38,572
5
77,145
Provide a correct Python 3 solution for this coding contest problem. Notes Template in C Constraints 2 ≤ the number of operands in the expression ≤ 100 1 ≤ the number of operators in the expression ≤ 99 -1 × 109 ≤ values in the stack ≤ 109 Input An expression is given in a line. Two consequtive symbols (operand o...
instruction
0
38,573
5
77,146
"Correct Solution: ``` # coding: utf-8 s=input().split() d=[] ans=0 for c in s: if c in '+-*': a,b=d.pop(),d.pop() d.append(str(eval(b+c+a))) else: d.append(c) print(d[0]) ```
output
1
38,573
5
77,147