message stringlengths 2 59.7k | message_type stringclasses 2
values | message_id int64 0 1 | conversation_id int64 37 108k | cluster float64 20 20 | __index_level_0__ int64 74 217k |
|---|---|---|---|---|---|
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Petya loves inequations. Help him find n positive integers a1, a2, ..., an, such that the following two conditions are satisfied:
* a12 + a22 + ... + an2 ≥ x
* a1 + a2 + ... + an ≤ y
Input
The first line contains three space-se... | instruction | 0 | 106,169 | 20 | 212,338 |
Tags: greedy
Correct Solution:
```
n, x, y = map(int, input().split(' '))
if (y < n):
print(-1)
quit()
ones = n - 1
left = (y-n+1)**2 + ones
if left < x:
print(-1)
else:
for i in range(n-1):
print(1)
print(y-n+1)
``` | output | 1 | 106,169 | 20 | 212,339 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Petya loves inequations. Help him find n positive integers a1, a2, ..., an, such that the following two conditions are satisfied:
* a12 + a22 + ... + an2 ≥ x
* a1 + a2 + ... + an ≤ y
Input
The first line contains three space-se... | instruction | 0 | 106,170 | 20 | 212,340 |
Tags: greedy
Correct Solution:
```
import sys
n,x,y=map(int,sys.stdin.readline().split())
if (y-n+1<1) or (y-n+1)**2+(n-1)<x:
print(-1)
else:
print(y-n+1)
for i in range(n-1):
print(1)
``` | output | 1 | 106,170 | 20 | 212,341 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Petya loves inequations. Help him find n positive integers a1, a2, ..., an, such that the following two conditions are satisfied:
* a12 + a22 + ... + an2 ≥ x
* a1 + a2 + ... + an ≤ y
Input
The first line contains three space-se... | instruction | 0 | 106,171 | 20 | 212,342 |
Tags: greedy
Correct Solution:
```
n, x, y = map(int, input().split(' '))
if(y < n):
print(-1)
else:
val = (y - n + 1)**2 + (n-1)
if(val < x):
print(-1)
else:
for i in range(n-1):
print(1)
print(y - n + 1)
``` | output | 1 | 106,171 | 20 | 212,343 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Petya loves inequations. Help him find n positive integers a1, a2, ..., an, such that the following two conditions are satisfied:
* a12 + a22 + ... + an2 ≥ x
* a1 + a2 + ... + an ≤ y
Input
The first line contains three space-se... | instruction | 0 | 106,172 | 20 | 212,344 |
Tags: greedy
Correct Solution:
```
from math import ceil, sqrt
x,y,z = map(int, input().split())
t = x-1
if x > z:
print(-1)
elif y >= z and t + (ceil(sqrt(y -t)) ** 2) >= y and t + ceil(sqrt(y -t)) <= z:
k = ceil(sqrt(y-t))
for c in range(x-1):
print(1)
print(k)
elif z >= y and t + (ceil(sqrt(z - t)) ** 2) >= y ... | output | 1 | 106,172 | 20 | 212,345 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Petya loves inequations. Help him find n positive integers a1, a2, ..., an, such that the following two conditions are satisfied:
* a12 + a22 + ... + an2 ≥ x
* a1 + a2 + ... + an ≤ y
Input
The first line contains three space-se... | instruction | 0 | 106,173 | 20 | 212,346 |
Tags: greedy
Correct Solution:
```
n, x, y = map(int, input().split())
if n > y:
print(-1)
else:
left = y - n
left += 1
if left ** 2 + n - 1 >= x:
print(left)
for _ in range(n - 1):
print(1)
else:
print(-1)
``` | output | 1 | 106,173 | 20 | 212,347 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Petya loves inequations. Help him find n positive integers a1, a2, ..., an, such that the following two conditions are satisfied:
* a12 + a22 + ... + an2 ≥ x
* a1 + a2 + ... + an ≤ y
Input
The first line contains three space-se... | instruction | 0 | 106,174 | 20 | 212,348 |
Tags: greedy
Correct Solution:
```
n,x,y=map(int,input().split())
n-=1
t=y-n
print(['1\n'*n+str(t),-1][t<1 or t*t+n<x])
# Made By Mostafa_Khaled
``` | output | 1 | 106,174 | 20 | 212,349 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Petya loves inequations. Help him find n positive integers a1, a2, ..., an, such that the following two conditions are satisfied:
* a12 + a22 + ... + an2 ≥ x
* a1 + a2 + ... + an ≤ y
Input
The first line contains three space-se... | instruction | 0 | 106,175 | 20 | 212,350 |
Tags: greedy
Correct Solution:
```
n, x, y = map(int, input().split())
curr = y - n + 1
if curr <= 0:
print(-1)
else:
if curr ** 2 + (n - 1) < x:
print(-1)
else:
for i in range(n-1):
print(1)
print(y - n + 1)
``` | output | 1 | 106,175 | 20 | 212,351 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Input
The only line of the input contains a 7-digit hexadecimal number. The first "digit" of the number is letter A, the rest of the "digits" are decimal digits 0-9.
Output
Output a single integer.
Examples
Input
A278832
Output
... | instruction | 0 | 106,273 | 20 | 212,546 |
Tags: *special, implementation
Correct Solution:
```
k=input().lower()
h=int(k,16)
print(h%2)
``` | output | 1 | 106,273 | 20 | 212,547 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Input
The only line of the input contains a 7-digit hexadecimal number. The first "digit" of the number is letter A, the rest of the "digits" are decimal digits 0-9.
Output
Output a single integer.
Examples
Input
A278832
Output
... | instruction | 0 | 106,274 | 20 | 212,548 |
Tags: *special, implementation
Correct Solution:
```
# d = {'0':0, '1': 1, '2':1, '3':2, '4':1,'5':2, '6':2,'7':3,'8':1,'9':2,'A':2}
s = input()
# count = 0
# for i in s:
# count+=d[i]
count = int(s[-1])
if(count%2==0):
print('0')
else:
print('1')
``` | output | 1 | 106,274 | 20 | 212,549 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Input
The only line of the input contains a 7-digit hexadecimal number. The first "digit" of the number is letter A, the rest of the "digits" are decimal digits 0-9.
Output
Output a single integer.
Examples
Input
A278832
Output
... | instruction | 0 | 106,275 | 20 | 212,550 |
Tags: *special, implementation
Correct Solution:
```
if int(input(),16)%2==0:
print(0)
else:
print(1)
``` | output | 1 | 106,275 | 20 | 212,551 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Input
The only line of the input contains a 7-digit hexadecimal number. The first "digit" of the number is letter A, the rest of the "digits" are decimal digits 0-9.
Output
Output a single integer.
Examples
Input
A278832
Output
... | instruction | 0 | 106,276 | 20 | 212,552 |
Tags: *special, implementation
Correct Solution:
```
n=input()
if(int(n[len(n)-1])%2==0):
print("0")
else:
print("1")
``` | output | 1 | 106,276 | 20 | 212,553 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Input
The only line of the input contains a 7-digit hexadecimal number. The first "digit" of the number is letter A, the rest of the "digits" are decimal digits 0-9.
Output
Output a single integer.
Examples
Input
A278832
Output
... | instruction | 0 | 106,277 | 20 | 212,554 |
Tags: *special, implementation
Correct Solution:
```
N = int(input()[-1])
print(N%2)
``` | output | 1 | 106,277 | 20 | 212,555 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Input
The only line of the input contains a 7-digit hexadecimal number. The first "digit" of the number is letter A, the rest of the "digits" are decimal digits 0-9.
Output
Output a single integer.
Examples
Input
A278832
Output
... | instruction | 0 | 106,278 | 20 | 212,556 |
Tags: *special, implementation
Correct Solution:
```
ans = int(input(), 16)
if ans%2 == 0:
print(0)
else:
print(1)
``` | output | 1 | 106,278 | 20 | 212,557 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Input
The only line of the input contains a 7-digit hexadecimal number. The first "digit" of the number is letter A, the rest of the "digits" are decimal digits 0-9.
Output
Output a single integer.
Examples
Input
A278832
Output
... | instruction | 0 | 106,279 | 20 | 212,558 |
Tags: *special, implementation
Correct Solution:
```
import math
# Initialising hex string
ini_string = input()
# Code to convert hex to binary
n = int(ini_string, 16)
bStr = ''
while n > 0:
bStr = str(n % 2) + bStr
n = n >> 1
res = bStr
# Print the resultant string
print(res[len(res) - 1])
... | output | 1 | 106,279 | 20 | 212,559 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Input
The only line of the input contains a 7-digit hexadecimal number. The first "digit" of the number is letter A, the rest of the "digits" are decimal digits 0-9.
Output
Output a single integer.
Examples
Input
A278832
Output
... | instruction | 0 | 106,280 | 20 | 212,560 |
Tags: *special, implementation
Correct Solution:
```
str = input()
res = int(str, 16)
if res & 1 == 0:
print(0)
else:
print(1)
``` | output | 1 | 106,280 | 20 | 212,561 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Input
The only line of the input contains a 7-digit hexadecimal number. The first "digit" of the number is letter A, the rest of the "digits" are decimal digits 0-9.
Output
Output a single ... | instruction | 0 | 106,281 | 20 | 212,562 |
Yes | output | 1 | 106,281 | 20 | 212,563 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Input
The only line of the input contains a 7-digit hexadecimal number. The first "digit" of the number is letter A, the rest of the "digits" are decimal digits 0-9.
Output
Output a single ... | instruction | 0 | 106,282 | 20 | 212,564 |
Yes | output | 1 | 106,282 | 20 | 212,565 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Input
The only line of the input contains a 7-digit hexadecimal number. The first "digit" of the number is letter A, the rest of the "digits" are decimal digits 0-9.
Output
Output a single ... | instruction | 0 | 106,283 | 20 | 212,566 |
Yes | output | 1 | 106,283 | 20 | 212,567 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Input
The only line of the input contains a 7-digit hexadecimal number. The first "digit" of the number is letter A, the rest of the "digits" are decimal digits 0-9.
Output
Output a single ... | instruction | 0 | 106,284 | 20 | 212,568 |
Yes | output | 1 | 106,284 | 20 | 212,569 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Input
The only line of the input contains a 7-digit hexadecimal number. The first "digit" of the number is letter A, the rest of the "digits" are decimal digits 0-9.
Output
Output a single ... | instruction | 0 | 106,285 | 20 | 212,570 |
No | output | 1 | 106,285 | 20 | 212,571 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Input
The only line of the input contains a 7-digit hexadecimal number. The first "digit" of the number is letter A, the rest of the "digits" are decimal digits 0-9.
Output
Output a single ... | instruction | 0 | 106,286 | 20 | 212,572 |
No | output | 1 | 106,286 | 20 | 212,573 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Input
The only line of the input contains a 7-digit hexadecimal number. The first "digit" of the number is letter A, the rest of the "digits" are decimal digits 0-9.
Output
Output a single ... | instruction | 0 | 106,288 | 20 | 212,576 |
No | output | 1 | 106,288 | 20 | 212,577 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Diana loves playing with numbers. She's got n cards with positive integer numbers a_i written on them. She spends her free time multiplying the numbers on the cards. She picks a non-empty subset of the cards and multiplies all the numbers a_... | instruction | 0 | 106,388 | 20 | 212,776 |
Tags: dp, math, number theory
Correct Solution:
```
# your code goes here
import math
import sys
import argparse
def main():
input = sys.stdin.readline
n, d = list(map(int,input().split()))
a = list(map(float,input().split()))
b = []
for i in range(0,n):
b.append(int(a[i]))
a[i] = ... | output | 1 | 106,388 | 20 | 212,777 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Diana loves playing with numbers. She's got n cards with positive integer numbers a_i written on them. She spends her free time multiplying the numbers on the cards. She picks a non-empty subset of the cards and multiplies all the numbers a_... | instruction | 0 | 106,389 | 20 | 212,778 |
Tags: dp, math, number theory
Correct Solution:
```
import math
n, d = map(int, input().split())
a = [int(_) for _ in input().split()]
dp = [[-1e10] * 10 for _ in range(n + 1)]
come = [[(0, 0, 0) for i in range(10)] for j in range(n + 1)]
dp[0][1] = 0
for i in range(n):
for j in range(10):
val = dp[i][j] + ... | output | 1 | 106,389 | 20 | 212,779 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Diana loves playing with numbers. She's got n cards with positive integer numbers a_i written on them. She spends her free time multiplying the numbers on the cards. She picks a non-empty subset of the cards and multiplies all the numbers a_... | instruction | 0 | 106,390 | 20 | 212,780 |
Tags: dp, math, number theory
Correct Solution:
```
# your code goes here
import math
import sys
import argparse
def main():
input = sys.stdin.readline
n, d = list(map(int,input().split()))
a = list(map(float,input().split()))
b = []
for i in range(0,n):
b.append(int(a[i]))
a[i] = ... | output | 1 | 106,390 | 20 | 212,781 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Diana loves playing with numbers. She's got n cards with positive integer numbers a_i written on them. She spends her free time multiplying the numbers on the cards. She picks a non-empty subset of the cards and multiplies all the numbers a_... | instruction | 0 | 106,391 | 20 | 212,782 |
Tags: dp, math, number theory
Correct Solution:
```
import math
import random
import sys
import time
seed = int(time.time())
random.seed(seed)
def equalsf(a, b): return abs(a - b) < 1e-6
def solve(N, D, A):
lgA = [math.log(a) for a in A]
dp = [[None for _ in range(10)] for _ in range(N)]
parents = [[-1 f... | output | 1 | 106,391 | 20 | 212,783 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Diana loves playing with numbers. She's got n cards with positive integer numbers a_i written on them. She spends her free time multiplying the numbers on the cards. She picks a non-empty subset of the cards and multiplies all the numbers a_... | instruction | 0 | 106,392 | 20 | 212,784 |
Tags: dp, math, number theory
Correct Solution:
```
# by the authority of GOD author: manhar singh sachdev #
import os,sys
from io import BytesIO, IOBase
from math import log10
def main():
log = [0]+[log10(i) for i in range(1,1001)]
unit = [i%10 for i in range(1001)]
n,d = map(int,input().split())
... | output | 1 | 106,392 | 20 | 212,785 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Diana loves playing with numbers. She's got n cards with positive integer numbers a_i written on them. She spends her free time multiplying the numbers on the cards. She picks a non-empty subset of the cards and multiplies all the numbers a_... | instruction | 0 | 106,393 | 20 | 212,786 |
Tags: dp, math, number theory
Correct Solution:
```
import math
def main():
n, d = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
if d!=5 and d!=0:
a = list(filter(lambda x: x%5!=0 ,a))
if d&1:
a = list(filter(lambda x: x%2, a))
n = len(a)
dp = [[-1e... | output | 1 | 106,393 | 20 | 212,787 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Diana loves playing with numbers. She's got n cards with positive integer numbers a_i written on them. She spends her free time multiplying the numbers on the cards. She picks a non-empty subset of the cards and multiplies all the numbers a_... | instruction | 0 | 106,394 | 20 | 212,788 |
Tags: dp, math, number theory
Correct Solution:
```
import collections
import string
import math
import copy
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
self._fd = file.fileno()
self.buffer = BytesIO()
... | output | 1 | 106,394 | 20 | 212,789 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Diana loves playing with numbers. She's got n cards with positive integer numbers a_i written on them. She spends her free time multiplying the numbers on the cards. She picks a non-empty subset of the cards and multiplies all the numbers a_... | instruction | 0 | 106,395 | 20 | 212,790 |
Tags: dp, math, number theory
Correct Solution:
```
#------------------Important Modules------------------#
from sys import stdin,stdout
from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import *
from random import *
input=stdin.readline
prin=stdout.write
from random import sample
fr... | output | 1 | 106,395 | 20 | 212,791 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Diana loves playing with numbers. She's got n cards with positive integer numbers a_i written on them. She spends her free time multiplying the numbers on the cards. She picks a non-empty subset... | instruction | 0 | 106,396 | 20 | 212,792 |
Yes | output | 1 | 106,396 | 20 | 212,793 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Diana loves playing with numbers. She's got n cards with positive integer numbers a_i written on them. She spends her free time multiplying the numbers on the cards. She picks a non-empty subset... | instruction | 0 | 106,397 | 20 | 212,794 |
Yes | output | 1 | 106,397 | 20 | 212,795 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Diana loves playing with numbers. She's got n cards with positive integer numbers a_i written on them. She spends her free time multiplying the numbers on the cards. She picks a non-empty subset... | instruction | 0 | 106,398 | 20 | 212,796 |
Yes | output | 1 | 106,398 | 20 | 212,797 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Diana loves playing with numbers. She's got n cards with positive integer numbers a_i written on them. She spends her free time multiplying the numbers on the cards. She picks a non-empty subset... | instruction | 0 | 106,399 | 20 | 212,798 |
Yes | output | 1 | 106,399 | 20 | 212,799 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Diana loves playing with numbers. She's got n cards with positive integer numbers a_i written on them. She spends her free time multiplying the numbers on the cards. She picks a non-empty subset... | instruction | 0 | 106,400 | 20 | 212,800 |
No | output | 1 | 106,400 | 20 | 212,801 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Diana loves playing with numbers. She's got n cards with positive integer numbers a_i written on them. She spends her free time multiplying the numbers on the cards. She picks a non-empty subset... | instruction | 0 | 106,401 | 20 | 212,802 |
No | output | 1 | 106,401 | 20 | 212,803 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Diana loves playing with numbers. She's got n cards with positive integer numbers a_i written on them. She spends her free time multiplying the numbers on the cards. She picks a non-empty subset... | instruction | 0 | 106,402 | 20 | 212,804 |
No | output | 1 | 106,402 | 20 | 212,805 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Diana loves playing with numbers. She's got n cards with positive integer numbers a_i written on them. She spends her free time multiplying the numbers on the cards. She picks a non-empty subset... | instruction | 0 | 106,403 | 20 | 212,806 |
No | output | 1 | 106,403 | 20 | 212,807 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Limak is a little polar bear. In the snow he found a scroll with the ancient prophecy. Limak doesn't know any ancient languages and thus is unable to understand the prophecy. But he knows digits... | instruction | 0 | 106,622 | 20 | 213,244 |
No | output | 1 | 106,622 | 20 | 213,245 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Limak is a little polar bear. In the snow he found a scroll with the ancient prophecy. Limak doesn't know any ancient languages and thus is unable to understand the prophecy. But he knows digits... | instruction | 0 | 106,623 | 20 | 213,246 |
No | output | 1 | 106,623 | 20 | 213,247 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Limak is a little polar bear. In the snow he found a scroll with the ancient prophecy. Limak doesn't know any ancient languages and thus is unable to understand the prophecy. But he knows digits... | instruction | 0 | 106,624 | 20 | 213,248 |
No | output | 1 | 106,624 | 20 | 213,249 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Limak is a little polar bear. In the snow he found a scroll with the ancient prophecy. Limak doesn't know any ancient languages and thus is unable to understand the prophecy. But he knows digits... | instruction | 0 | 106,625 | 20 | 213,250 |
No | output | 1 | 106,625 | 20 | 213,251 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a function f written in some basic language. The function accepts an integer value, which is immediately written into some variable x. x is an integer variable and can be assigned values from 0 to 2^{32}-1. The function contain... | instruction | 0 | 107,095 | 20 | 214,190 |
Tags: data structures, expression parsing, implementation
Correct Solution:
```
from sys import stdin, stdout
def read():
return stdin.readline().rstrip()
def write(s):
stdout.write(s + "\n")
def solve():
l = int(read())
st = []
lim = 2*2147483647+ 1
cur = 1
x = 0
for i in range(l):... | output | 1 | 107,095 | 20 | 214,191 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a function f written in some basic language. The function accepts an integer value, which is immediately written into some variable x. x is an integer variable and can be assigned values from 0 to 2^{32}-1. The function contain... | instruction | 0 | 107,096 | 20 | 214,192 |
Tags: data structures, expression parsing, implementation
Correct Solution:
```
t = int(input())
r = 0
s = [0] * 10**5
ss = 0
for _ in range(t):
x = input().split()
if x[0] == 'add':
r += 1
elif x[0] == 'for':
s[ss] = (r, int(x[1]))
ss += 1
r = 0
elif x[0] == 'end':
... | output | 1 | 107,096 | 20 | 214,193 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a function f written in some basic language. The function accepts an integer value, which is immediately written into some variable x. x is an integer variable and can be assigned values from 0 to 2^{32}-1. The function contain... | instruction | 0 | 107,097 | 20 | 214,194 |
Tags: data structures, expression parsing, implementation
Correct Solution:
```
def catch_overflow(o):
stack = [1]
output = 0
for i in range(o):
n = input()
if n[:3] == 'for':
stack.append(min(2**32,stack[-1]*int(n[4:])))
elif n == 'end':
stack.pop()
e... | output | 1 | 107,097 | 20 | 214,195 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a function f written in some basic language. The function accepts an integer value, which is immediately written into some variable x. x is an integer variable and can be assigned values from 0 to 2^{32}-1. The function contain... | instruction | 0 | 107,098 | 20 | 214,196 |
Tags: data structures, expression parsing, implementation
Correct Solution:
```
from array import array
n = int(input())
stack = array('Q', list(1 for _ in range(n // 2 + 1)))
stack_top = 1
overflow = 2**32 - 1
s = 0
flag = True
for _ in range(n):
command = input()
if command == "end":
stack_top -= 1
elif comm... | output | 1 | 107,098 | 20 | 214,197 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a function f written in some basic language. The function accepts an integer value, which is immediately written into some variable x. x is an integer variable and can be assigned values from 0 to 2^{32}-1. The function contain... | instruction | 0 | 107,099 | 20 | 214,198 |
Tags: data structures, expression parsing, implementation
Correct Solution:
```
n=int(input())
stack_for = [[1,0]]
overflow=int(0xffffffff)
ans=0
for i in range(n) :
c = input()
if c[0] == 'f' :
f_str=c.split()
stack_for.append([int(f_str[1]),0])
elif c[0] == 'a' :
L=stack_for.pop... | output | 1 | 107,099 | 20 | 214,199 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a function f written in some basic language. The function accepts an integer value, which is immediately written into some variable x. x is an integer variable and can be assigned values from 0 to 2^{32}-1. The function contain... | instruction | 0 | 107,100 | 20 | 214,200 |
Tags: data structures, expression parsing, implementation
Correct Solution:
```
# -*- coding: utf-8 -*-
# @Date : 2019-06-06 09:13:44
# @Author : raj lath (oorja.halt@gmail.com)
# @Link : link
# @Version : 1.0.0
import sys
sys.setrecursionlimit(10**5+1)
inf = int(10 ** 20)
max_val = inf
min_val = -inf
... | output | 1 | 107,100 | 20 | 214,201 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a function f written in some basic language. The function accepts an integer value, which is immediately written into some variable x. x is an integer variable and can be assigned values from 0 to 2^{32}-1. The function contain... | instruction | 0 | 107,101 | 20 | 214,202 |
Tags: data structures, expression parsing, implementation
Correct Solution:
```
inf=10**12
val=2**32
import sys
n=int(input())
m=1
st=[]
st1=[]
st2=[1]
ans=0
for i in range(n):
a=list(map(str,sys.stdin.readline().split()))
if len(a)==2:
m=int(a[1])
st1.append(m)
if st1[-1]*st2[-1]<=val:
... | output | 1 | 107,101 | 20 | 214,203 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a function f written in some basic language. The function accepts an integer value, which is immediately written into some variable x. x is an integer variable and can be assigned values from 0 to 2^{32}-1. The function contain... | instruction | 0 | 107,102 | 20 | 214,204 |
Tags: data structures, expression parsing, implementation
Correct Solution:
```
import sys
L = int(sys.stdin.readline().strip())
x = 0
i = 1
m = []
v = True
l = 0
y = 0
while l < L:
w = sys.stdin.readline().strip()
if v == True and y == 0:
if w == "add":
x = x + i
elif w == "end":
... | output | 1 | 107,102 | 20 | 214,205 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.