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 |
|---|---|---|---|---|---|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
After learning about polynomial hashing, Heidi decided to learn about shift-xor hashing. In particular, she came across this interesting problem.
Given a bitstring y β \{0,1\}^n find out the nu... | instruction | 0 | 71,733 | 20 | 143,466 |
No | output | 1 | 71,733 | 20 | 143,467 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
After learning about polynomial hashing, Heidi decided to learn about shift-xor hashing. In particular, she came across this interesting problem.
Given a bitstring y β \{0,1\}^n find out the nu... | instruction | 0 | 71,734 | 20 | 143,468 |
No | output | 1 | 71,734 | 20 | 143,469 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
After learning about polynomial hashing, Heidi decided to learn about shift-xor hashing. In particular, she came across this interesting problem.
Given a bitstring y β \{0,1\}^n find out the nu... | instruction | 0 | 71,735 | 20 | 143,470 |
No | output | 1 | 71,735 | 20 | 143,471 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
After learning about polynomial hashing, Heidi decided to learn about shift-xor hashing. In particular, she came across this interesting problem.
Given a bitstring y β \{0,1\}^n find out the nu... | instruction | 0 | 71,736 | 20 | 143,472 |
No | output | 1 | 71,736 | 20 | 143,473 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of <image> for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum v... | instruction | 0 | 71,957 | 20 | 143,914 |
Tags: bitmasks, dp, greedy, implementation, math
Correct Solution:
```
#Problem A - Little Girl and Maximum XOR
numeros = [int(i) for i in input().split(' ')]
# numeros = [797162752288318119, 908416915938410706]
l = bin(numeros[0])
r = bin(numeros[1])
p = -1
# for i,j in range (len(l),len(r)):
if (len(r) == len(l)):
... | output | 1 | 71,957 | 20 | 143,915 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Input
The input contains a single integer a (0 β€ a β€ 35).
Output
Output a single integer.
Examples
Input
3
Output
8
Input
10
Output
1024 | instruction | 0 | 72,105 | 20 | 144,210 |
Tags: *special
Correct Solution:
```
n = int(input())
print(int(n%2==1))
``` | output | 1 | 72,105 | 20 | 144,211 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Input
The input contains a single integer a (0 β€ a β€ 35).
Output
Output a single integer.
Examples
Input
3
Output
8
Input
10
Output
1024 | instruction | 0 | 72,106 | 20 | 144,212 |
Tags: *special
Correct Solution:
```
a = int(input())
if a%2 == 0:
print(0)
else: print(1)
``` | output | 1 | 72,106 | 20 | 144,213 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Input
The input contains a single integer a (0 β€ a β€ 35).
Output
Output a single integer.
Examples
Input
3
Output
8
Input
10
Output
1024 | instruction | 0 | 72,107 | 20 | 144,214 |
Tags: *special
Correct Solution:
```
li=[1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8092, 16184, 32368, 64736, 129472, 258944, 517888, 1035776, 2071552, 4143104, 8286208, 16572416, 33144832, 66289664, 132579328, 265158656, 530317312, 1060634624, 2121269248, 4242538496, 8485076992, 16970153984, 33940307968... | output | 1 | 72,107 | 20 | 144,215 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Input
The input contains a single integer a (0 β€ a β€ 35).
Output
Output a single integer.
Examples
Input
3
Output
8
Input
10
Output
1024 | instruction | 0 | 72,109 | 20 | 144,218 |
Tags: *special
Correct Solution:
```
# -*- coding: utf - 8 -*-
"""""""""""""""""""""""""""""""""""""""""""""
| author: mr.math - Hakimov Rahimjon |
| e-mail: mr.math0777@gmail.com |
| created: 01.04.2018 16:00 |
"""""""""""""""""""""""""""""""""""""""""""""
# inp = open("input.txt", "... | output | 1 | 72,109 | 20 | 144,219 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Input
The input contains a single integer a (0 β€ a β€ 35).
Output
Output a single integer.
Examples
Input
3
Output
8
Input
10
Output
1024 | instruction | 0 | 72,110 | 20 | 144,220 |
Tags: *special
Correct Solution:
```
n = int(input())
print (n%2)
#asdfasdfasdfasdfasdfadsfasdfadsfasdfa
``` | output | 1 | 72,110 | 20 | 144,221 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Input
The input contains a single integer a (0 β€ a β€ 35).
Output
Output a single integer.
Examples
Input
3
Output
8
Input
10
Output
1024 | instruction | 0 | 72,111 | 20 | 144,222 |
Tags: *special
Correct Solution:
```
powers = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8092, 16184, 32368, 64736, 129472, 258944, 517888, 1035776, 2071552, 4143104, 8286208, 16572416, 33144832, 66289664, 132579328, 265158656, 530317312, 1060634624, 2121269248, 4242538496, 8485076992, 16970153984, 33940... | output | 1 | 72,111 | 20 | 144,223 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Input
The input contains a single integer a (0 β€ a β€ 35).
Output
Output a single integer.
Examples
Input
3
Output
8
Input
10
Output
1024 | instruction | 0 | 72,112 | 20 | 144,224 |
Tags: *special
Correct Solution:
```
a = int(input())
if a%2 == 1:
print(1)
else:
print(0)
``` | output | 1 | 72,112 | 20 | 144,225 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Cengiz recently learned Fibonacci numbers and now he is studying different algorithms to find them. After getting bored of reading them, he came with his own new type of numbers that he named XORinacci numbers. He defined them as follows:
... | instruction | 0 | 72,571 | 20 | 145,142 |
Tags: math
Correct Solution:
```
t = int(input())
for i in range(t):
a, b, n = map(int, input().split())
c = a ^ b
if n == 0:
print(a)
elif n == 1:
print(b)
else:
if n % 3 == 0:
print(a)
elif n % 3 == 1:
print(b)
elif n % 3 == 2:
... | output | 1 | 72,571 | 20 | 145,143 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Cengiz recently learned Fibonacci numbers and now he is studying different algorithms to find them. After getting bored of reading them, he came with his own new type of numbers that he named XORinacci numbers. He defined them as follows:
... | instruction | 0 | 72,572 | 20 | 145,144 |
Tags: math
Correct Solution:
```
tc = int(input())
for i in range(tc):
a,b,n = map(int,input().split())
arr=[]
arr.append(a)
arr.append(b)
arr.append(a^b)
if (n==0 or n%3==0):
print(arr[0])
elif(n==1 or n%3==1):
print(arr[1])
else:
print(arr[2])
``` | output | 1 | 72,572 | 20 | 145,145 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Cengiz recently learned Fibonacci numbers and now he is studying different algorithms to find them. After getting bored of reading them, he came with his own new type of numbers that he named XORinacci numbers. He defined them as follows:
... | instruction | 0 | 72,573 | 20 | 145,146 |
Tags: math
Correct Solution:
```
def findXORInAcci(a, b, n):
n = n % 3
if n == 0:
return a
elif n == 1:
return b
return a ^ b
T = int(input())
for _ in range(T):
ABN = input().split(" ")
a = int(ABN[0])
b = int(ABN[1])
n = int(ABN[2])
print(findXORInAcci(a, b, n))
``` | output | 1 | 72,573 | 20 | 145,147 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Cengiz recently learned Fibonacci numbers and now he is studying different algorithms to find them. After getting bored of reading them, he came with his own new type of numbers that he named XORinacci numbers. He defined them as follows:
... | instruction | 0 | 72,574 | 20 | 145,148 |
Tags: math
Correct Solution:
```
def xor(a, b):
ans = ''
ma = a if len(a) > len(b) else b
mi = a if len(a) < len(b) else b
for d in range(1, len(mi)-1):
ans = '1'+ans if a[-d] != b[-d] else '0'+ans
ans = ma[2:2+len(ma)-len(mi)]+ans
return '0b'+ans
def f(a, b, n):
if n == 0:
... | output | 1 | 72,574 | 20 | 145,149 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Cengiz recently learned Fibonacci numbers and now he is studying different algorithms to find them. After getting bored of reading them, he came with his own new type of numbers that he named XORinacci numbers. He defined them as follows:
... | instruction | 0 | 72,575 | 20 | 145,150 |
Tags: math
Correct Solution:
```
t = int(input())
for i in range(t):
a, b, n = map(int, input().split())
c = a ^ b
if n % 3 == 0:
print(a)
elif n % 3 == 1:
print(b)
else:
print(c)
``` | output | 1 | 72,575 | 20 | 145,151 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Cengiz recently learned Fibonacci numbers and now he is studying different algorithms to find them. After getting bored of reading them, he came with his own new type of numbers that he named XORinacci numbers. He defined them as follows:
... | instruction | 0 | 72,576 | 20 | 145,152 |
Tags: math
Correct Solution:
```
def printXOR(a,b,n):
n= n - 1
x = 0
while(n):
x = a ^ b
a = b
b = x
n-=1
print(x)
x = int(input())
for _ in range(x):
a,b,n = map(int,input().split(" "))
n = n%3
if(n == 0):
print(a)
elif(n == 1):
print(b)... | output | 1 | 72,576 | 20 | 145,153 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Cengiz recently learned Fibonacci numbers and now he is studying different algorithms to find them. After getting bored of reading them, he came with his own new type of numbers that he named XORinacci numbers. He defined them as follows:
... | instruction | 0 | 72,577 | 20 | 145,154 |
Tags: math
Correct Solution:
```
t=int(input())
ass=[]
bs=[]
ns=[]
for i in range(t):
a, b, n = map(int,input().split(' '))
ass.append(a)
bs.append(b)
ns.append(n)
for i in range(t):
if ns[i] % 3 == 0:
print(ass[i])
elif ns[i]%3 == 1:
print(bs[i])
else :
print(ass[i]^bs[i])
``` | output | 1 | 72,577 | 20 | 145,155 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Cengiz recently learned Fibonacci numbers and now he is studying different algorithms to find them. After getting bored of reading them, he came with his own new type of numbers that he named XORinacci numbers. He defined them as follows:
... | instruction | 0 | 72,578 | 20 | 145,156 |
Tags: math
Correct Solution:
```
for _ in range(int(input())):
a,b,n = [*map(int,input().split(" "))]
n = n%3
fn = 0
if n ==0:
fn = a
elif(n==1):
fn = b
elif(n==2):
fn = a^b
print(fn)
``` | output | 1 | 72,578 | 20 | 145,157 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Jzzhu have n non-negative integers a1, a2, ..., an. We will call a sequence of indexes i1, i2, ..., ik (1 β€ i1 < i2 < ... < ik β€ n) a group of size k.
Jzzhu wonders, how many groups exists such that ai1 & ai2 & ... & aik = 0 (1 β€ k β€ n)? H... | instruction | 0 | 72,870 | 20 | 145,740 |
Tags: bitmasks, combinatorics, dp
Correct Solution:
```
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(2*10**5+10)
write = lambda x: sys.stdout.write(x+"\n")
debug = lambda x: sys.stderr.write(x+"\n")
writef = lambda x: print("{:.12f}".format(x))
# zeta mebius
def zeta_super(val, n)... | output | 1 | 72,870 | 20 | 145,741 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is an interactive problem.
Vasya and Petya are going to play the following game: Petya has some positive integer number a. After that Vasya should guess this number using the following questions. He can say a pair of non-negative integ... | instruction | 0 | 73,351 | 20 | 146,702 |
Tags: binary search, constructive algorithms, interactive
Correct Solution:
```
a=input()
while a!="end":
if a=="start":
for i in range(30):
print("?",2**i,2*2**i)
if input()=="x":
break
bot=2**i
top=min(2**(i+1),1000000000)
if bot==1:
... | output | 1 | 73,351 | 20 | 146,703 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is an interactive problem.
Vasya and Petya are going to play the following game: Petya has some positive integer number a. After that Vasya should guess this number using the following questions. He can say a pair of non-negative integ... | instruction | 0 | 73,352 | 20 | 146,704 |
Tags: binary search, constructive algorithms, interactive
Correct Solution:
```
def get_range():
left = 0
right = 1
while True:
print('?', left, right)
in_value = input()
if in_value == 'x':
break
left = right
right *= 2
return left, right
def solv... | output | 1 | 73,352 | 20 | 146,705 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is an interactive problem.
Vasya and Petya are going to play the following game: Petya has some positive integer number a. After that Vasya should guess this number using the following questions. He can say a pair of non-negative integ... | instruction | 0 | 73,353 | 20 | 146,706 |
Tags: binary search, constructive algorithms, interactive
Correct Solution:
```
#!/usr/bin/env python
# coding: utf-8
# In[ ]:
# In[ ]:
# In[ ]:
# In[ ]:
while True:
if input()=='start':
print(*['?',0,1],flush=True)
result=input()
if result=='x':... | output | 1 | 73,353 | 20 | 146,707 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is an interactive problem.
Vasya and Petya are going to play the following game: Petya has some positive integer number a. After that Vasya should guess this number using the following questions. He can say a pair of non-negative integ... | instruction | 0 | 73,354 | 20 | 146,708 |
Tags: binary search, constructive algorithms, interactive
Correct Solution:
```
#!/usr/bin/env python
def main():
s = input()
while s == 'start':
print('?', 0, 1)
v = input()
i = 0
while v != 'x':
print('?', 1 << i, 1 << (i + 1))
v = input()
... | output | 1 | 73,354 | 20 | 146,709 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is an interactive problem.
Vasya and Petya are going to play the following game: Petya has some positive integer number a. After that Vasya should guess this number using the following questions. He can say a pair of non-negative integ... | instruction | 0 | 73,355 | 20 | 146,710 |
Tags: binary search, constructive algorithms, interactive
Correct Solution:
```
from sys import stdout
def ask(x, y):
print('?', x, y)
stdout.flush()
x = input()
return x == 'x'
def show_res(res):
print('!', res)
stdout.flush()
def prepare_game():
gm = input()
if gm[0] != 's':
exit(0)
INF = int(1e9) + 1
... | output | 1 | 73,355 | 20 | 146,711 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is an interactive problem.
Vasya and Petya are going to play the following game: Petya has some positive integer number a. After that Vasya should guess this number using the following questions. He can say a pair of non-negative integ... | instruction | 0 | 73,356 | 20 | 146,712 |
Tags: binary search, constructive algorithms, interactive
Correct Solution:
```
import sys
v = sys.stdin.readline().strip()
while v == "start":
print("? 0 2")
sys.stdout.flush()
ans = sys.stdin.readline().strip()
if ans == "x":
print("? 0 1")
sys.stdout.flush()
ans = sys.stdin.r... | output | 1 | 73,356 | 20 | 146,713 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is an interactive problem.
Vasya and Petya are going to play the following game: Petya has some positive integer number a. After that Vasya should guess this number using the following questions. He can say a pair of non-negative integ... | instruction | 0 | 73,357 | 20 | 146,714 |
Tags: binary search, constructive algorithms, interactive
Correct Solution:
```
import sys
while True:
S = input()
if S=='end':
sys.exit()
if S=='mistake':
sys.exit()
if S=='start':
while True:
i=0
print('?',0,1)
sys.stdout.flush()
... | output | 1 | 73,357 | 20 | 146,715 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is an interactive problem.
Vasya and Petya are going to play the following game: Petya has some positive integer number a. After that Vasya should guess this number using the following questions. He can say a pair of non-negative integ... | instruction | 0 | 73,358 | 20 | 146,716 |
Tags: binary search, constructive algorithms, interactive
Correct Solution:
```
#!/usr/bin/env python
"""
This file is part of https://github.com/cheran-senthil/PyRival
Copyright 2019 Cheran Senthilkumar <hello@cheran.io>
"""
import sys
input = lambda: sys.stdin.readline().rstrip('\r\n')
def main():
s = input()... | output | 1 | 73,358 | 20 | 146,717 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is an interactive problem.
Vasya and Petya are going to play the following game: Petya has some positive integer number a. After that Vasya should guess this number using the following que... | instruction | 0 | 73,359 | 20 | 146,718 |
Yes | output | 1 | 73,359 | 20 | 146,719 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is an interactive problem.
Vasya and Petya are going to play the following game: Petya has some positive integer number a. After that Vasya should guess this number using the following que... | instruction | 0 | 73,360 | 20 | 146,720 |
Yes | output | 1 | 73,360 | 20 | 146,721 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is an interactive problem.
Vasya and Petya are going to play the following game: Petya has some positive integer number a. After that Vasya should guess this number using the following que... | instruction | 0 | 73,361 | 20 | 146,722 |
Yes | output | 1 | 73,361 | 20 | 146,723 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is an interactive problem.
Vasya and Petya are going to play the following game: Petya has some positive integer number a. After that Vasya should guess this number using the following que... | instruction | 0 | 73,362 | 20 | 146,724 |
Yes | output | 1 | 73,362 | 20 | 146,725 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is an interactive problem.
Vasya and Petya are going to play the following game: Petya has some positive integer number a. After that Vasya should guess this number using the following que... | instruction | 0 | 73,363 | 20 | 146,726 |
No | output | 1 | 73,363 | 20 | 146,727 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is an interactive problem.
Vasya and Petya are going to play the following game: Petya has some positive integer number a. After that Vasya should guess this number using the following que... | instruction | 0 | 73,364 | 20 | 146,728 |
No | output | 1 | 73,364 | 20 | 146,729 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is an interactive problem.
Vasya and Petya are going to play the following game: Petya has some positive integer number a. After that Vasya should guess this number using the following que... | instruction | 0 | 73,365 | 20 | 146,730 |
No | output | 1 | 73,365 | 20 | 146,731 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is an interactive problem.
Vasya and Petya are going to play the following game: Petya has some positive integer number a. After that Vasya should guess this number using the following que... | instruction | 0 | 73,366 | 20 | 146,732 |
No | output | 1 | 73,366 | 20 | 146,733 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little Petya likes to play very much. And most of all he likes to play the following game:
He is given a sequence of N integer numbers. At each step it is allowed to increase the value of any n... | instruction | 0 | 73,524 | 20 | 147,048 |
No | output | 1 | 73,524 | 20 | 147,049 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little Petya likes to play very much. And most of all he likes to play the following game:
He is given a sequence of N integer numbers. At each step it is allowed to increase the value of any n... | instruction | 0 | 73,525 | 20 | 147,050 |
No | output | 1 | 73,525 | 20 | 147,051 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little Petya likes to play very much. And most of all he likes to play the following game:
He is given a sequence of N integer numbers. At each step it is allowed to increase the value of any n... | instruction | 0 | 73,526 | 20 | 147,052 |
No | output | 1 | 73,526 | 20 | 147,053 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little Petya likes to play very much. And most of all he likes to play the following game:
He is given a sequence of N integer numbers. At each step it is allowed to increase the value of any n... | instruction | 0 | 73,527 | 20 | 147,054 |
No | output | 1 | 73,527 | 20 | 147,055 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A number is called 2050-number if it is 2050, 20500, ..., (2050 β
10^k for integer k β₯ 0).
Given a number n, you are asked to represent n as the sum of some (not necessarily distinct) 2050-numbers. Compute the minimum number of 2050-numbers... | instruction | 0 | 73,576 | 20 | 147,152 |
Tags: greedy, math
Correct Solution:
```
for _ in range(int(input())):
n=int(input())
ans=0
if((n%2050)!=0):
print(-1)
continue
n=n//2050
rem=0
while(n>0):
rem=n%10
ans+=rem
n//=10
print(ans)
``` | output | 1 | 73,576 | 20 | 147,153 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A number is called 2050-number if it is 2050, 20500, ..., (2050 β
10^k for integer k β₯ 0).
Given a number n, you are asked to represent n as the sum of some (not necessarily distinct) 2050-numbers. Compute the minimum number of 2050-numbers... | instruction | 0 | 73,577 | 20 | 147,154 |
Tags: greedy, math
Correct Solution:
```
for _ in ' '*int(input()):
n = int(input())
c = n%2050==0
print(int(c*(sum(list(map(lambda x: int(x), list(str(n//2050)))))))+ int((not c)*(-1)))
``` | output | 1 | 73,577 | 20 | 147,155 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A number is called 2050-number if it is 2050, 20500, ..., (2050 β
10^k for integer k β₯ 0).
Given a number n, you are asked to represent n as the sum of some (not necessarily distinct) 2050-numbers. Compute the minimum number of 2050-numbers... | instruction | 0 | 73,578 | 20 | 147,156 |
Tags: greedy, math
Correct Solution:
```
def biggestlessthan(a):
if (int("2050"+"0"*(len(str(a))-4))<=a):
return int("2050"+"0"*(len(str(a))-4))
return int("2050"+"0"*(len(str(a))-5))
def solve():
count=0
a=int(input())
while a>=2050:
a-=biggestlessthan(a)
count... | output | 1 | 73,578 | 20 | 147,157 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A number is called 2050-number if it is 2050, 20500, ..., (2050 β
10^k for integer k β₯ 0).
Given a number n, you are asked to represent n as the sum of some (not necessarily distinct) 2050-numbers. Compute the minimum number of 2050-numbers... | instruction | 0 | 73,579 | 20 | 147,158 |
Tags: greedy, math
Correct Solution:
```
for _ in range(int(input())):
n = int(input())
if n%2050==0:
arr = list(map(int, list(str(int(n//2050)))))
print(sum(arr))
else:
print(-1)
``` | output | 1 | 73,579 | 20 | 147,159 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A number is called 2050-number if it is 2050, 20500, ..., (2050 β
10^k for integer k β₯ 0).
Given a number n, you are asked to represent n as the sum of some (not necessarily distinct) 2050-numbers. Compute the minimum number of 2050-numbers... | instruction | 0 | 73,580 | 20 | 147,160 |
Tags: greedy, math
Correct Solution:
```
t=int(input())
while(t!=0):
t=t-1
s="2050"
n=int(input())
if(n%2050!=0):
print(-1)
else:
c=0
while(n!=0):
le=len(str(n))-4
for i in range(le):
s=s+'0'
if(int(s)>n):
s=... | output | 1 | 73,580 | 20 | 147,161 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A number is called 2050-number if it is 2050, 20500, ..., (2050 β
10^k for integer k β₯ 0).
Given a number n, you are asked to represent n as the sum of some (not necessarily distinct) 2050-numbers. Compute the minimum number of 2050-numbers... | instruction | 0 | 73,581 | 20 | 147,162 |
Tags: greedy, math
Correct Solution:
```
t=int(input())
for i in range(t):
a=int(input())
i=16
s=0
while i>=0:
if a-2050*(10**i)>=0:
a-=2050*(10**i)
s+=1
else:
i-=1
if a>0:
print(-1)
else:
print(s)
``` | output | 1 | 73,581 | 20 | 147,163 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A number is called 2050-number if it is 2050, 20500, ..., (2050 β
10^k for integer k β₯ 0).
Given a number n, you are asked to represent n as the sum of some (not necessarily distinct) 2050-numbers. Compute the minimum number of 2050-numbers... | instruction | 0 | 73,582 | 20 | 147,164 |
Tags: greedy, math
Correct Solution:
```
import sys
r = sys.stdin.readline
for _ in range(int(r())):
N = int(r())
ans = 0
while 1:
s = 2050
if N == 0:
print(ans)
break
if N < 2050:
print(-1)
break
while N >= 10*s:
... | output | 1 | 73,582 | 20 | 147,165 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A number is called 2050-number if it is 2050, 20500, ..., (2050 β
10^k for integer k β₯ 0).
Given a number n, you are asked to represent n as the sum of some (not necessarily distinct) 2050-numbers. Compute the minimum number of 2050-numbers... | instruction | 0 | 73,583 | 20 | 147,166 |
Tags: greedy, math
Correct Solution:
```
import functools
tests = int(input())
m=2050
for case in range(tests):
n=int(input())
if n%m!=0:print(-1)
else: print(functools.reduce(lambda a,b:int(a)+int(b),str(int(n/m))))
``` | output | 1 | 73,583 | 20 | 147,167 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A number is called 2050-number if it is 2050, 20500, ..., (2050 β
10^k for integer k β₯ 0).
Given a number n, you are asked to represent n as the sum of some (not necessarily distinct) 2050-numb... | instruction | 0 | 73,584 | 20 | 147,168 |
Yes | output | 1 | 73,584 | 20 | 147,169 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.