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.
You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.
Your task is to determine if it is possible in this case to... | instruction | 0 | 61,100 | 20 | 122,200 |
Yes | output | 1 | 61,100 | 20 | 122,201 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.
Your task is to determine if it is possible in this case to... | instruction | 0 | 61,101 | 20 | 122,202 |
Yes | output | 1 | 61,101 | 20 | 122,203 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.
Your task is to determine if it is possible in this case to... | instruction | 0 | 61,102 | 20 | 122,204 |
Yes | output | 1 | 61,102 | 20 | 122,205 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.
Your task is to determine if it is possible in this case to... | instruction | 0 | 61,103 | 20 | 122,206 |
No | output | 1 | 61,103 | 20 | 122,207 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.
Your task is to determine if it is possible in this case to... | instruction | 0 | 61,104 | 20 | 122,208 |
No | output | 1 | 61,104 | 20 | 122,209 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.
Your task is to determine if it is possible in this case to... | instruction | 0 | 61,105 | 20 | 122,210 |
No | output | 1 | 61,105 | 20 | 122,211 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.
Your task is to determine if it is possible in this case to... | instruction | 0 | 61,106 | 20 | 122,212 |
No | output | 1 | 61,106 | 20 | 122,213 |
Provide a correct Python 3 solution for this coding contest problem.
Takahashi and Aoki love calculating things, so they will play with numbers now.
First, they came up with one positive integer each. Takahashi came up with X, and Aoki came up with Y. Then, they will enjoy themselves by repeating the following operat... | instruction | 0 | 61,321 | 20 | 122,642 |
"Correct Solution:
```
def main():
N, M, K = map(int, input().split())
MAX_N = 2000000
s = [0] * MAX_N
t = [0] * MAX_N
for i, c in zip(range(N - 1, -1, -1), input()):
s[i] = int(c)
for i, c in zip(range(M - 1, -1, -1), input()):
t[i] = int(c)
len_max = max(N, M) - 1
f... | output | 1 | 61,321 | 20 | 122,643 |
Provide a correct Python 3 solution for this coding contest problem.
Takahashi and Aoki love calculating things, so they will play with numbers now.
First, they came up with one positive integer each. Takahashi came up with X, and Aoki came up with Y. Then, they will enjoy themselves by repeating the following operat... | instruction | 0 | 61,322 | 20 | 122,644 |
"Correct Solution:
```
def main():
N, M, K = map(int, input().split())
MAX_N = 2000000
s = [0] * MAX_N
t = [0] * MAX_N
for i, c in zip(range(N - 1, -1, -1), input()):
s[i] = int(c)
for i, c in zip(range(M - 1, -1, -1), input()):
t[i] = int(c)
len_max = max(N, M) - 1
st... | output | 1 | 61,322 | 20 | 122,645 |
Provide a correct Python 3 solution for this coding contest problem.
Takahashi and Aoki love calculating things, so they will play with numbers now.
First, they came up with one positive integer each. Takahashi came up with X, and Aoki came up with Y. Then, they will enjoy themselves by repeating the following operat... | instruction | 0 | 61,323 | 20 | 122,646 |
"Correct Solution:
```
def Z():
m=-1;I=input;N,M,K=map(int,I().split());W=2000000;s=[0]*W;t=[0]*W;L=max(N,M)-1;R=range;p=lambda x:print(*reversed(x),sep='')
for i,c in zip(R(N-1,m,m),I()):s[i]=int(c)
for i,c in zip(R(M-1,m,m),I()):t[i]=int(c)
for i in R(L,m,m):
j=i;z=K
while s[j]and t[j]and z:
s[j]=t[j]=0;s[... | output | 1 | 61,323 | 20 | 122,647 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Takahashi and Aoki love calculating things, so they will play with numbers now.
First, they came up with one positive integer each. Takahashi came up with X, and Aoki came up with Y. Then, they... | instruction | 0 | 61,324 | 20 | 122,648 |
No | output | 1 | 61,324 | 20 | 122,649 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Takahashi and Aoki love calculating things, so they will play with numbers now.
First, they came up with one positive integer each. Takahashi came up with X, and Aoki came up with Y. Then, they... | instruction | 0 | 61,326 | 20 | 122,652 |
No | output | 1 | 61,326 | 20 | 122,653 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Takahashi and Aoki love calculating things, so they will play with numbers now.
First, they came up with one positive integer each. Takahashi came up with X, and Aoki came up with Y. Then, they... | instruction | 0 | 61,327 | 20 | 122,654 |
No | output | 1 | 61,327 | 20 | 122,655 |
Provide a correct Python 3 solution for this coding contest problem.
You are given an integer $N$ and a string consisting of '+' and digits. You are asked to transform the string into a valid formula whose calculation result is smaller than or equal to $N$ by modifying some characters. Here, you replace one character ... | instruction | 0 | 61,442 | 20 | 122,884 |
"Correct Solution:
```
from heapq import heappush, heappop, heapify
import sys
readline = sys.stdin.readline
write = sys.stdout.write
def solve():
N = int(readline())
S = readline().strip()
L = len(S)
S += "+"
if L % 2 == 0 and N < 10:
write("-1\n")
return
pw10 = [1]*11
for i... | output | 1 | 61,442 | 20 | 122,885 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Input
The input contains a single integer a (0 ≤ a ≤ 63).
Output
Output a single number.
Examples
Input
2
Output
2
Input
5
Output
24
Input
35
Output
50 | instruction | 0 | 61,603 | 20 | 123,206 |
Tags: *special, bitmasks
Correct Solution:
```
num = int(input())
pix = [0]*6
for i in range(6):
pix[-i-1] = (num % 2)
num = num // 2
ref = [0]*6
ref[0] = pix[0]
ref[5] = pix[1]
ref[3] = pix[2]
ref[1] = pix[3]
ref[4] = pix[4]
ref[2] = pix[5]
ref[0] = pix[0]
ref[5] = pix[1]
ref[3] = pix[2]
ref[2] = pix[3]
ref[... | output | 1 | 61,603 | 20 | 123,207 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Input
The input contains a single integer a (0 ≤ a ≤ 63).
Output
Output a single number.
Examples
Input
2
Output
2
Input
5
Output
24
Input
35
Output
50 | instruction | 0 | 61,604 | 20 | 123,208 |
Tags: *special, bitmasks
Correct Solution:
```
# coding: utf-8
a = bin(int(input()))[2:].rjust(6, '0')
b = a[0] + a[5] + a[3] + a[2] + a[4] + a[1]
print(int(b, 2))
``` | output | 1 | 61,604 | 20 | 123,209 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Input
The input contains a single integer a (0 ≤ a ≤ 63).
Output
Output a single number.
Examples
Input
2
Output
2
Input
5
Output
24
Input
35
Output
50 | instruction | 0 | 61,605 | 20 | 123,210 |
Tags: *special, bitmasks
Correct Solution:
```
n = int(input())
ls = [bool(n & (1 << i)) for i in range(6)]
p = [16, 2, 8, 4, 1, 32]
print(sum((a * b for a, b in zip(ls, p))))
``` | output | 1 | 61,605 | 20 | 123,211 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Input
The input contains a single integer a (0 ≤ a ≤ 63).
Output
Output a single number.
Examples
Input
2
Output
2
Input
5
Output
24
Input
35
Output
50 | instruction | 0 | 61,606 | 20 | 123,212 |
Tags: *special, bitmasks
Correct Solution:
```
def binaryToDecimal(binary):
binary1 = binary
decimal, i, n = 0, 0, 0
while(binary != 0):
dec = binary % 10
decimal = decimal + dec * pow(2, i)
binary = binary//10
i += 1
print(decimal)
a=int(input())
b=bin(a).r... | output | 1 | 61,606 | 20 | 123,213 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Input
The input contains a single integer a (0 ≤ a ≤ 63).
Output
Output a single number.
Examples
Input
2
Output
2
Input
5
Output
24
Input
35
Output
50 | instruction | 0 | 61,607 | 20 | 123,214 |
Tags: *special, bitmasks
Correct Solution:
```
"""input
5
"""
def digit(n):
return len(str(n))
def convert(a, b):
c = ""
while a>0:
if(a%b>=10):
c+=chr(55+(a%b))
else:
c += str(a%b)
a = a//b
return c[::-1]
def number(a, b):
i = digit(a)
a = str(a)... | output | 1 | 61,607 | 20 | 123,215 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Input
The input contains a single integer a (0 ≤ a ≤ 63).
Output
Output a single number.
Examples
Input
2
Output
2
Input
5
Output
24
Input
35
Output
50 | instruction | 0 | 61,608 | 20 | 123,216 |
Tags: *special, bitmasks
Correct Solution:
```
n = int(input())
n = list(bin(n)[2:])
n = (6-len(n))*["0"]+n
n_t = n.copy()
n[1] = n_t[5]
n[2] = n_t[3]
n[3] = n_t[2]
n[4] = n_t[4]
n[5] = n_t[1]
print(int(''.join(n),2))
``` | output | 1 | 61,608 | 20 | 123,217 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Input
The input contains a single integer a (0 ≤ a ≤ 63).
Output
Output a single number.
Examples
Input
2
Output
2
Input
5
Output
24
Input
35
Output
50 | instruction | 0 | 61,609 | 20 | 123,218 |
Tags: *special, bitmasks
Correct Solution:
```
n = int(input())
b = bin(n).replace("0b", "")
f = "0"*(7-len(b)) + b
mapping = [0,1,6,4,3,5,2]
ans = ["0","0","0","0","0","0","0"]
for i in range(7):
if f[i] == "1":
ans[mapping[i]] = "1"
# print(ans,sep="")
ok = False
s = "0"
for c in ans:
if c ==... | output | 1 | 61,609 | 20 | 123,219 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Input
The input contains a single integer a (0 ≤ a ≤ 63).
Output
Output a single number.
Examples
Input
2
Output
2
Input
5
Output
24
Input
35
Output
50 | instruction | 0 | 61,610 | 20 | 123,220 |
Tags: *special, bitmasks
Correct Solution:
```
x = int(input())
xBin = list(bin(x+64)[3:])
xBin[1], xBin[5] = xBin[5], xBin[1]
xBin[2], xBin[3] = xBin[3], xBin[2]
xBin = "".join(x for x in xBin)
print(int(xBin, 2))
``` | output | 1 | 61,610 | 20 | 123,221 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little X used to play a card game called "24 Game", but recently he has found it too easy. So he invented a new game.
Initially you have a sequence of n integers: 1, 2, ..., n. In a single step, you can pick two of them, let's denote them a... | instruction | 0 | 61,808 | 20 | 123,616 |
Tags: constructive algorithms, greedy, math
Correct Solution:
```
n = int(input())
if n<=3:
print('NO')
exit()
print('YES')
if n%2==0:
print('%s * %s = %s' %(1,2,2))
print('%s * %s = %s' %(2,3,6))
print('%s * %s = %s' %(6,4,24))
for i in range(6,n+1,2):
print('%s - %s = 1' %(i,i-1))
... | output | 1 | 61,808 | 20 | 123,617 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little X used to play a card game called "24 Game", but recently he has found it too easy. So he invented a new game.
Initially you have a sequence of n integers: 1, 2, ..., n. In a single step, you can pick two of them, let's denote them a... | instruction | 0 | 61,809 | 20 | 123,618 |
Tags: constructive algorithms, greedy, math
Correct Solution:
```
entrada = int(input())
if entrada <= 3:
print("NO")
elif entrada%2 == 0:
print("YES")
print("1 * 2 = 2")
print("2 * 3 = 6")
print("6 * 4 = 24")
for i in range(5,entrada,2):
print (str(i+1)+" - "+str(i)+" = 1")
print("24 * 1 = 24")
else:
prin... | output | 1 | 61,809 | 20 | 123,619 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little X used to play a card game called "24 Game", but recently he has found it too easy. So he invented a new game.
Initially you have a sequence of n integers: 1, 2, ..., n. In a single step, you can pick two of them, let's denote them a... | instruction | 0 | 61,810 | 20 | 123,620 |
Tags: constructive algorithms, greedy, math
Correct Solution:
```
n = int(input())
if n < 4:
print('NO')
else:
print('YES')
if (n % 2 == 1):
print('3 * 5 = 15')
print('2 * 4 = 8')
print('1 + 8 = 9')
print('9 + 15 = 24')
for i in range(6,n+1,2):
print(i+1,'... | output | 1 | 61,810 | 20 | 123,621 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little X used to play a card game called "24 Game", but recently he has found it too easy. So he invented a new game.
Initially you have a sequence of n integers: 1, 2, ..., n. In a single step, you can pick two of them, let's denote them a... | instruction | 0 | 61,811 | 20 | 123,622 |
Tags: constructive algorithms, greedy, math
Correct Solution:
```
def logs(n):
if n == 4: return [(1,1,2), (1,2,3), (1,6,4)]
if n == 5: return [(2,5,4), (2,9,3), (1,12,2), (1,24,1)]
ans = [(3,i+1,i) for i in range(n-1, 4, -2)]
ans.extend(logs(4 + n%2))
ans += [(1,24,1) for i in range(n-1-len(ans))]
... | output | 1 | 61,811 | 20 | 123,623 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little X used to play a card game called "24 Game", but recently he has found it too easy. So he invented a new game.
Initially you have a sequence of n integers: 1, 2, ..., n. In a single step, you can pick two of them, let's denote them a... | instruction | 0 | 61,812 | 20 | 123,624 |
Tags: constructive algorithms, greedy, math
Correct Solution:
```
N = int(input())
if N == 1 or N == 2 or N == 3:
print("NO")
elif N%2 == 0:
print("YES")
print("1 * 2 = 2")
print("2 * 3 = 6")
print("6 * 4 = 24")
count = 0
for j in range(5,N,2):
print(str(j+1) + " - " + str(j) + " = 1")
count ... | output | 1 | 61,812 | 20 | 123,625 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little X used to play a card game called "24 Game", but recently he has found it too easy. So he invented a new game.
Initially you have a sequence of n integers: 1, 2, ..., n. In a single step, you can pick two of them, let's denote them a... | instruction | 0 | 61,813 | 20 | 123,626 |
Tags: constructive algorithms, greedy, math
Correct Solution:
```
def main():
n = int(input())
if n <= 3:
print('NO')
return
_4 = ('4 * 3 = 12\n'
'12 * 2 = 24\n'
'1 * 24 = 24')
_5 = ('5 - 3 = 2\n'
'2 + 1 = 3\n'
'3 * 4 = 12\n'
'2 * 12 =... | output | 1 | 61,813 | 20 | 123,627 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little X used to play a card game called "24 Game", but recently he has found it too easy. So he invented a new game.
Initially you have a sequence of n integers: 1, 2, ..., n. In a single step, you can pick two of them, let's denote them a... | instruction | 0 | 61,814 | 20 | 123,628 |
Tags: constructive algorithms, greedy, math
Correct Solution:
```
#------------------------template--------------------------#
import os
import sys
# from math import *
from collections import *
# from fractions import *
# from heapq import*
from bisect import *
from io import BytesIO, IOBase
def vsInput():
sys.std... | output | 1 | 61,814 | 20 | 123,629 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little X used to play a card game called "24 Game", but recently he has found it too easy. So he invented a new game.
Initially you have a sequence of n integers: 1, 2, ..., n. In a single step, you can pick two of them, let's denote them a... | instruction | 0 | 61,815 | 20 | 123,630 |
Tags: constructive algorithms, greedy, math
Correct Solution:
```
n=int(input())
if n<=3:
print("NO")
elif n%2==0:
print("YES")
print("1 * 2 = 2")
print("2 * 3 = 6")
print("4 * 6 = 24")
for x in range(5,n,2):
print(x+1,"-",x,"=","1")
print("24 * 1 = 24")
else:
print("YES")
... | output | 1 | 61,815 | 20 | 123,631 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little X used to play a card game called "24 Game", but recently he has found it too easy. So he invented a new game.
Initially you have a sequence of n integers: 1, 2, ..., n. In a single step... | instruction | 0 | 61,816 | 20 | 123,632 |
Yes | output | 1 | 61,816 | 20 | 123,633 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little X used to play a card game called "24 Game", but recently he has found it too easy. So he invented a new game.
Initially you have a sequence of n integers: 1, 2, ..., n. In a single step... | instruction | 0 | 61,817 | 20 | 123,634 |
Yes | output | 1 | 61,817 | 20 | 123,635 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little X used to play a card game called "24 Game", but recently he has found it too easy. So he invented a new game.
Initially you have a sequence of n integers: 1, 2, ..., n. In a single step... | instruction | 0 | 61,818 | 20 | 123,636 |
Yes | output | 1 | 61,818 | 20 | 123,637 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little X used to play a card game called "24 Game", but recently he has found it too easy. So he invented a new game.
Initially you have a sequence of n integers: 1, 2, ..., n. In a single step... | instruction | 0 | 61,819 | 20 | 123,638 |
Yes | output | 1 | 61,819 | 20 | 123,639 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little X used to play a card game called "24 Game", but recently he has found it too easy. So he invented a new game.
Initially you have a sequence of n integers: 1, 2, ..., n. In a single step... | instruction | 0 | 61,820 | 20 | 123,640 |
No | output | 1 | 61,820 | 20 | 123,641 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little X used to play a card game called "24 Game", but recently he has found it too easy. So he invented a new game.
Initially you have a sequence of n integers: 1, 2, ..., n. In a single step... | instruction | 0 | 61,821 | 20 | 123,642 |
No | output | 1 | 61,821 | 20 | 123,643 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little X used to play a card game called "24 Game", but recently he has found it too easy. So he invented a new game.
Initially you have a sequence of n integers: 1, 2, ..., n. In a single step... | instruction | 0 | 61,822 | 20 | 123,644 |
No | output | 1 | 61,822 | 20 | 123,645 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little X used to play a card game called "24 Game", but recently he has found it too easy. So he invented a new game.
Initially you have a sequence of n integers: 1, 2, ..., n. In a single step... | instruction | 0 | 61,823 | 20 | 123,646 |
No | output | 1 | 61,823 | 20 | 123,647 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Luke Skywalker gave Chewbacca an integer number x. Chewbacca isn't good at numbers but he loves inverting digits in them. Inverting digit t means replacing it with digit 9 - t.
Help Chewbacca to transform the initial number x to the minimu... | instruction | 0 | 61,840 | 20 | 123,680 |
Tags: greedy, implementation
Correct Solution:
```
from sys import stdin
import collections
def bar(s):
ans = ''
f = False
for ss in s.rstrip('\n'):
if int(ss) >= 5:
if int(ss) == 9 and not f:
ans += ss
f = True
else:
ans += str(9 - int(ss))
f = True
else:
ans += ss
f = True
return ... | output | 1 | 61,840 | 20 | 123,681 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Luke Skywalker gave Chewbacca an integer number x. Chewbacca isn't good at numbers but he loves inverting digits in them. Inverting digit t means replacing it with digit 9 - t.
Help Chewbacca to transform the initial number x to the minimu... | instruction | 0 | 61,841 | 20 | 123,682 |
Tags: greedy, implementation
Correct Solution:
```
from sys import stdin
input = stdin.readline
t = input()[:-1]
if t[0] == '9':
total = '9'
else:
ti = int(t[0])
total = str(min(9-ti,ti))
for i in range(1,len(t)):
ti = int(t[i])
check = str(min(9-ti,ti))
if check:
total += check
... | output | 1 | 61,841 | 20 | 123,683 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Luke Skywalker gave Chewbacca an integer number x. Chewbacca isn't good at numbers but he loves inverting digits in them. Inverting digit t means replacing it with digit 9 - t.
Help Chewbacca to transform the initial number x to the minimu... | instruction | 0 | 61,842 | 20 | 123,684 |
Tags: greedy, implementation
Correct Solution:
```
from sys import stdin, stdout, setrecursionlimit
input = stdin.readline
flush = stdout.flush
#setrecursionlimit(1000000)
############################################################
OUT = []
def write(item, sep = " "):
if type(item) is int:
OUT.append(s... | output | 1 | 61,842 | 20 | 123,685 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Luke Skywalker gave Chewbacca an integer number x. Chewbacca isn't good at numbers but he loves inverting digits in them. Inverting digit t means replacing it with digit 9 - t.
Help Chewbacca to transform the initial number x to the minimu... | instruction | 0 | 61,843 | 20 | 123,686 |
Tags: greedy, implementation
Correct Solution:
```
a = input()
b = ""
i = 0
if a[i] == '9':
b += a[i]
i += 1
while i < len(a):
b += str(min(int(a[i]), 9 - int(a[i])))
i += 1
print(b)
``` | output | 1 | 61,843 | 20 | 123,687 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Luke Skywalker gave Chewbacca an integer number x. Chewbacca isn't good at numbers but he loves inverting digits in them. Inverting digit t means replacing it with digit 9 - t.
Help Chewbacca to transform the initial number x to the minimu... | instruction | 0 | 61,844 | 20 | 123,688 |
Tags: greedy, implementation
Correct Solution:
```
s = input()
ans = "0"
b = False
y = len(s)
for i in range(y):
x = s[i]
if int(x) >= 5 and not(i==0 and s[i] == "9"):
x = str(9-int(x))
ans += x
print(int(ans))
``` | output | 1 | 61,844 | 20 | 123,689 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Luke Skywalker gave Chewbacca an integer number x. Chewbacca isn't good at numbers but he loves inverting digits in them. Inverting digit t means replacing it with digit 9 - t.
Help Chewbacca to transform the initial number x to the minimu... | instruction | 0 | 61,845 | 20 | 123,690 |
Tags: greedy, implementation
Correct Solution:
```
a = input()
b = ""
for x in range(len(a)):
digit = int(a[x])
if 9 - digit < digit and digit != 9 or digit == 9 and x != 0:
digit = 9 - digit
b += str(digit)
print(b)
``` | output | 1 | 61,845 | 20 | 123,691 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Luke Skywalker gave Chewbacca an integer number x. Chewbacca isn't good at numbers but he loves inverting digits in them. Inverting digit t means replacing it with digit 9 - t.
Help Chewbacca to transform the initial number x to the minimu... | instruction | 0 | 61,846 | 20 | 123,692 |
Tags: greedy, implementation
Correct Solution:
```
mylist = list(map(int, input()))
if mylist[0] == 9:
for i in range(1, len(mylist)):
if (9-mylist[i] < mylist[i]):
mylist[i] = 9-mylist[i]
else:
for i in range(0, len(mylist)):
if (9-mylist[i] < mylist[i]):
mylist[i] = 9-m... | output | 1 | 61,846 | 20 | 123,693 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Luke Skywalker gave Chewbacca an integer number x. Chewbacca isn't good at numbers but he loves inverting digits in them. Inverting digit t means replacing it with digit 9 - t.
Help Chewbacca to transform the initial number x to the minimu... | instruction | 0 | 61,847 | 20 | 123,694 |
Tags: greedy, implementation
Correct Solution:
```
def main():
n = input()
res = []
for i, c in enumerate(n):
if i == 0:
c = str(9 - int(c)) if 9 > int(c) >= 5 else c
if int(c) >= 5 and 0 < i < len(n):
c = str(9 - int(c))
res.append(c)
res = ''.join(res).... | output | 1 | 61,847 | 20 | 123,695 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Luke Skywalker gave Chewbacca an integer number x. Chewbacca isn't good at numbers but he loves inverting digits in them. Inverting digit t means replacing it with digit 9 - t.
Help Chewbacca ... | instruction | 0 | 61,848 | 20 | 123,696 |
Yes | output | 1 | 61,848 | 20 | 123,697 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Luke Skywalker gave Chewbacca an integer number x. Chewbacca isn't good at numbers but he loves inverting digits in them. Inverting digit t means replacing it with digit 9 - t.
Help Chewbacca ... | instruction | 0 | 61,849 | 20 | 123,698 |
Yes | output | 1 | 61,849 | 20 | 123,699 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Luke Skywalker gave Chewbacca an integer number x. Chewbacca isn't good at numbers but he loves inverting digits in them. Inverting digit t means replacing it with digit 9 - t.
Help Chewbacca ... | instruction | 0 | 61,850 | 20 | 123,700 |
Yes | output | 1 | 61,850 | 20 | 123,701 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Luke Skywalker gave Chewbacca an integer number x. Chewbacca isn't good at numbers but he loves inverting digits in them. Inverting digit t means replacing it with digit 9 - t.
Help Chewbacca ... | instruction | 0 | 61,851 | 20 | 123,702 |
Yes | output | 1 | 61,851 | 20 | 123,703 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.