message stringlengths 2 20.2k | message_type stringclasses 2 values | message_id int64 0 1 | conversation_id int64 757 108k | cluster float64 4 4 | __index_level_0__ int64 1.51k 217k |
|---|---|---|---|---|---|
Provide tags and a correct Python 3 solution for this coding contest problem.
Oleg writes down the history of the days he lived. For each day he decides if it was good or bad. Oleg calls a non-empty sequence of days a zebra, if it starts with a bad day, ends with a bad day, and good and bad days are alternating in it. Let us denote bad days as 0 and good days as 1. Then, for example, sequences of days 0, 010, 01010 are zebras, while sequences 1, 0110, 0101 are not.
Oleg tells you the story of days he lived in chronological order in form of string consisting of 0 and 1. Now you are interested if it is possible to divide Oleg's life history into several subsequences, each of which is a zebra, and the way it can be done. Each day must belong to exactly one of the subsequences. For each of the subsequences, days forming it must be ordered chronologically. Note that subsequence does not have to be a group of consecutive days.
Input
In the only line of input data there is a non-empty string s consisting of characters 0 and 1, which describes the history of Oleg's life. Its length (denoted as |s|) does not exceed 200 000 characters.
Output
If there is a way to divide history into zebra subsequences, in the first line of output you should print an integer k (1 ≤ k ≤ |s|), the resulting number of subsequences. In the i-th of following k lines first print the integer li (1 ≤ li ≤ |s|), which is the length of the i-th subsequence, and then li indices of days forming the subsequence. Indices must follow in ascending order. Days are numbered starting from 1. Each index from 1 to n must belong to exactly one subsequence. If there is no way to divide day history into zebra subsequences, print -1.
Subsequences may be printed in any order. If there are several solutions, you may print any of them. You do not have to minimize nor maximize the value of k.
Examples
Input
0010100
Output
3
3 1 3 4
3 2 5 6
1 7
Input
111
Output
-1 | instruction | 0 | 75,611 | 4 | 151,222 |
Tags: greedy
Correct Solution:
```
def solve(s):
lists = [[] for _ in range(len(s))]
cid = 0
waitSet = set()
doneSet = set()
zeros = set()
for i, c in enumerate(s):
i += 1
if c == '1':
if not doneSet and not zeros:
print(-1)
return
elif doneSet:
aid = doneSet.pop()
lists[aid].append(i)
waitSet.add(aid)
else:
aid, idx = zeros.pop()
lists[aid].append(idx) # '0'
lists[aid].append(i) # '1'
waitSet.add(aid)
else:
if waitSet:
aid = waitSet.pop()
lists[aid].append(i)
doneSet.add(aid)
else:
# lists[cid].append(i)
# lists.append([i])
# doneSet.add(cid)
zeros.add((cid, i))
cid += 1
if waitSet:
print(-1)
return
k = len(doneSet) + len(zeros)
print(k)
for i in doneSet:
zebra = lists[i]
print("%d %s" % (len(zebra), " ".join(map(str, zebra))))
for aid, idx in zeros:
print("1 %d" % idx)
s = input()
solve(s)
``` | output | 1 | 75,611 | 4 | 151,223 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Oleg writes down the history of the days he lived. For each day he decides if it was good or bad. Oleg calls a non-empty sequence of days a zebra, if it starts with a bad day, ends with a bad day, and good and bad days are alternating in it. Let us denote bad days as 0 and good days as 1. Then, for example, sequences of days 0, 010, 01010 are zebras, while sequences 1, 0110, 0101 are not.
Oleg tells you the story of days he lived in chronological order in form of string consisting of 0 and 1. Now you are interested if it is possible to divide Oleg's life history into several subsequences, each of which is a zebra, and the way it can be done. Each day must belong to exactly one of the subsequences. For each of the subsequences, days forming it must be ordered chronologically. Note that subsequence does not have to be a group of consecutive days.
Input
In the only line of input data there is a non-empty string s consisting of characters 0 and 1, which describes the history of Oleg's life. Its length (denoted as |s|) does not exceed 200 000 characters.
Output
If there is a way to divide history into zebra subsequences, in the first line of output you should print an integer k (1 ≤ k ≤ |s|), the resulting number of subsequences. In the i-th of following k lines first print the integer li (1 ≤ li ≤ |s|), which is the length of the i-th subsequence, and then li indices of days forming the subsequence. Indices must follow in ascending order. Days are numbered starting from 1. Each index from 1 to n must belong to exactly one subsequence. If there is no way to divide day history into zebra subsequences, print -1.
Subsequences may be printed in any order. If there are several solutions, you may print any of them. You do not have to minimize nor maximize the value of k.
Examples
Input
0010100
Output
3
3 1 3 4
3 2 5 6
1 7
Input
111
Output
-1 | instruction | 0 | 75,612 | 4 | 151,224 |
Tags: greedy
Correct Solution:
```
s = input()
arr, zero, one = [], [], []
for i in range(len(s)):
if s[i] == '0':
if one:
idx = one.pop()
arr[idx].append(i + 1)
zero.append(idx)
else:
zero.append(len(arr))
arr.append([i + 1])
else:
if not zero:break
idx = zero.pop()
one.append(idx)
arr[idx].append(i + 1)
if arr and zero and not one:
print(len(arr))
for x in zero:
print(len(arr[x]), end=' ')
print(*arr[x])
else:print(-1)
``` | output | 1 | 75,612 | 4 | 151,225 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Oleg writes down the history of the days he lived. For each day he decides if it was good or bad. Oleg calls a non-empty sequence of days a zebra, if it starts with a bad day, ends with a bad day, and good and bad days are alternating in it. Let us denote bad days as 0 and good days as 1. Then, for example, sequences of days 0, 010, 01010 are zebras, while sequences 1, 0110, 0101 are not.
Oleg tells you the story of days he lived in chronological order in form of string consisting of 0 and 1. Now you are interested if it is possible to divide Oleg's life history into several subsequences, each of which is a zebra, and the way it can be done. Each day must belong to exactly one of the subsequences. For each of the subsequences, days forming it must be ordered chronologically. Note that subsequence does not have to be a group of consecutive days.
Input
In the only line of input data there is a non-empty string s consisting of characters 0 and 1, which describes the history of Oleg's life. Its length (denoted as |s|) does not exceed 200 000 characters.
Output
If there is a way to divide history into zebra subsequences, in the first line of output you should print an integer k (1 ≤ k ≤ |s|), the resulting number of subsequences. In the i-th of following k lines first print the integer li (1 ≤ li ≤ |s|), which is the length of the i-th subsequence, and then li indices of days forming the subsequence. Indices must follow in ascending order. Days are numbered starting from 1. Each index from 1 to n must belong to exactly one subsequence. If there is no way to divide day history into zebra subsequences, print -1.
Subsequences may be printed in any order. If there are several solutions, you may print any of them. You do not have to minimize nor maximize the value of k.
Examples
Input
0010100
Output
3
3 1 3 4
3 2 5 6
1 7
Input
111
Output
-1 | instruction | 0 | 75,613 | 4 | 151,226 |
Tags: greedy
Correct Solution:
```
#Codeforces Practice
#Zebras (950C)
from sys import stdin, stdout
def main():
life = stdin.readline()
zeroes = [] #A list of indices, each is a zebra ending in 0
ones = [] #A list of indices, each is a zebra ending in 1
zebras = [] #A list of lists, each is a zebra
fail = False
for i in range(1, len(life)+1):
day = life[i-1]
if day == "0":
if len(ones) != 0:
one = ones.pop()
zebras[one].append(i)
zeroes.append(one)
else:
zebras.append([i])
zeroes.append(len(zebras)-1)
elif day == "1":
if len(zeroes) != 0:
zero = zeroes.pop()
zebras[zero].append(i)
ones.append(zero)
else:
fail = True
break
if len(ones) != 0:
fail = True
if fail:
stdout.write(str("-1\n"))
else:
stdout.write(str(len(zebras)) + "\n")
for i in zebras:
stdout.write(str(len(i))+" "+" ".join([str(k) for k in i])+"\n")
main()
``` | output | 1 | 75,613 | 4 | 151,227 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Oleg writes down the history of the days he lived. For each day he decides if it was good or bad. Oleg calls a non-empty sequence of days a zebra, if it starts with a bad day, ends with a bad day, and good and bad days are alternating in it. Let us denote bad days as 0 and good days as 1. Then, for example, sequences of days 0, 010, 01010 are zebras, while sequences 1, 0110, 0101 are not.
Oleg tells you the story of days he lived in chronological order in form of string consisting of 0 and 1. Now you are interested if it is possible to divide Oleg's life history into several subsequences, each of which is a zebra, and the way it can be done. Each day must belong to exactly one of the subsequences. For each of the subsequences, days forming it must be ordered chronologically. Note that subsequence does not have to be a group of consecutive days.
Input
In the only line of input data there is a non-empty string s consisting of characters 0 and 1, which describes the history of Oleg's life. Its length (denoted as |s|) does not exceed 200 000 characters.
Output
If there is a way to divide history into zebra subsequences, in the first line of output you should print an integer k (1 ≤ k ≤ |s|), the resulting number of subsequences. In the i-th of following k lines first print the integer li (1 ≤ li ≤ |s|), which is the length of the i-th subsequence, and then li indices of days forming the subsequence. Indices must follow in ascending order. Days are numbered starting from 1. Each index from 1 to n must belong to exactly one subsequence. If there is no way to divide day history into zebra subsequences, print -1.
Subsequences may be printed in any order. If there are several solutions, you may print any of them. You do not have to minimize nor maximize the value of k.
Examples
Input
0010100
Output
3
3 1 3 4
3 2 5 6
1 7
Input
111
Output
-1 | instruction | 0 | 75,614 | 4 | 151,228 |
Tags: greedy
Correct Solution:
```
import configparser
import math
import sys
input = sys.stdin.readline
def main():
s = input().strip()
one = []
zero = []
adj = [[] for i in range(len(s))]
for i in range(len(s)):
if s[i] == '0':
if len(one) == 0:
zero.append(i)
else:
adj[one.pop()].append(i)
zero.append(i)
else:
if len(zero) == 0:
print(-1)
return
else:
adj[zero.pop()].append(i)
one.append(i)
if len(one) != 0:
print(-1)
return
groups = []
vis = [False for i in range(len(s))]
for i in range(len(vis)):
if not vis[i]:
cur_node = i
cur_g = [cur_node]
vis[cur_node] = True
while True:
if len(adj[cur_node]) == 0:
break
else:
cur_node = adj[cur_node][0]
cur_g.append(cur_node)
vis[cur_node] = True
groups.append(cur_g)
print(len(groups))
for i in groups:
print(len(i), end=' ')
for j in i:
print((j+1), end=' ')
print()
if __name__ == '__main__':
main()
``` | output | 1 | 75,614 | 4 | 151,229 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Oleg writes down the history of the days he lived. For each day he decides if it was good or bad. Oleg calls a non-empty sequence of days a zebra, if it starts with a bad day, ends with a bad day, and good and bad days are alternating in it. Let us denote bad days as 0 and good days as 1. Then, for example, sequences of days 0, 010, 01010 are zebras, while sequences 1, 0110, 0101 are not.
Oleg tells you the story of days he lived in chronological order in form of string consisting of 0 and 1. Now you are interested if it is possible to divide Oleg's life history into several subsequences, each of which is a zebra, and the way it can be done. Each day must belong to exactly one of the subsequences. For each of the subsequences, days forming it must be ordered chronologically. Note that subsequence does not have to be a group of consecutive days.
Input
In the only line of input data there is a non-empty string s consisting of characters 0 and 1, which describes the history of Oleg's life. Its length (denoted as |s|) does not exceed 200 000 characters.
Output
If there is a way to divide history into zebra subsequences, in the first line of output you should print an integer k (1 ≤ k ≤ |s|), the resulting number of subsequences. In the i-th of following k lines first print the integer li (1 ≤ li ≤ |s|), which is the length of the i-th subsequence, and then li indices of days forming the subsequence. Indices must follow in ascending order. Days are numbered starting from 1. Each index from 1 to n must belong to exactly one subsequence. If there is no way to divide day history into zebra subsequences, print -1.
Subsequences may be printed in any order. If there are several solutions, you may print any of them. You do not have to minimize nor maximize the value of k.
Examples
Input
0010100
Output
3
3 1 3 4
3 2 5 6
1 7
Input
111
Output
-1 | instruction | 0 | 75,615 | 4 | 151,230 |
Tags: greedy
Correct Solution:
```
temp = [int(x) for x in list(input())]
#a = [] # ending with 1
b = [] # ending with 0
cnt = -1
skip = False
for i in range(len(temp)):
if temp[i] == 0:
if cnt == -1:
b.append([i+1])
else:
b[cnt] += [i+1]
cnt -= 1
else:
cnt += 1
if cnt == len(b):
skip = True
break
else:
b[cnt].append(i+1)
if skip or cnt != -1:
print(-1)
else:
print(len(b))
for i in b:
print(str(len(i))+' '+' '.join([str(x) for x in i]))
``` | output | 1 | 75,615 | 4 | 151,231 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Oleg writes down the history of the days he lived. For each day he decides if it was good or bad. Oleg calls a non-empty sequence of days a zebra, if it starts with a bad day, ends with a bad day, and good and bad days are alternating in it. Let us denote bad days as 0 and good days as 1. Then, for example, sequences of days 0, 010, 01010 are zebras, while sequences 1, 0110, 0101 are not.
Oleg tells you the story of days he lived in chronological order in form of string consisting of 0 and 1. Now you are interested if it is possible to divide Oleg's life history into several subsequences, each of which is a zebra, and the way it can be done. Each day must belong to exactly one of the subsequences. For each of the subsequences, days forming it must be ordered chronologically. Note that subsequence does not have to be a group of consecutive days.
Input
In the only line of input data there is a non-empty string s consisting of characters 0 and 1, which describes the history of Oleg's life. Its length (denoted as |s|) does not exceed 200 000 characters.
Output
If there is a way to divide history into zebra subsequences, in the first line of output you should print an integer k (1 ≤ k ≤ |s|), the resulting number of subsequences. In the i-th of following k lines first print the integer li (1 ≤ li ≤ |s|), which is the length of the i-th subsequence, and then li indices of days forming the subsequence. Indices must follow in ascending order. Days are numbered starting from 1. Each index from 1 to n must belong to exactly one subsequence. If there is no way to divide day history into zebra subsequences, print -1.
Subsequences may be printed in any order. If there are several solutions, you may print any of them. You do not have to minimize nor maximize the value of k.
Examples
Input
0010100
Output
3
3 1 3 4
3 2 5 6
1 7
Input
111
Output
-1 | instruction | 0 | 75,616 | 4 | 151,232 |
Tags: greedy
Correct Solution:
```
# Codeforces Submission
# User : sudoSieg
# Time : 14:50:08
# Date : 21/10/2020
import io
import os
#input = lambda: io.BytesIO(os.read(0, os.fstat(0).st_size)).readline().strip()
valid = True
s = input()
ze = []
oe = []
for i, j in enumerate(s):
if j == '0':
if len(oe) != 0:
x = oe.pop()
x.append(i + 1)
ze.append(x)
else:
ze.append([i + 1])
else:
if len(ze) != 0:
x = ze.pop()
x.append(i + 1)
oe.append(x)
else:
print("-1")
exit()
if len(oe) != 0:
print(-1)
else:
print(len(ze))
for i in ze:
print(len(i), end=' ')
print(*i)
``` | output | 1 | 75,616 | 4 | 151,233 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Oleg writes down the history of the days he lived. For each day he decides if it was good or bad. Oleg calls a non-empty sequence of days a zebra, if it starts with a bad day, ends with a bad day, and good and bad days are alternating in it. Let us denote bad days as 0 and good days as 1. Then, for example, sequences of days 0, 010, 01010 are zebras, while sequences 1, 0110, 0101 are not.
Oleg tells you the story of days he lived in chronological order in form of string consisting of 0 and 1. Now you are interested if it is possible to divide Oleg's life history into several subsequences, each of which is a zebra, and the way it can be done. Each day must belong to exactly one of the subsequences. For each of the subsequences, days forming it must be ordered chronologically. Note that subsequence does not have to be a group of consecutive days.
Input
In the only line of input data there is a non-empty string s consisting of characters 0 and 1, which describes the history of Oleg's life. Its length (denoted as |s|) does not exceed 200 000 characters.
Output
If there is a way to divide history into zebra subsequences, in the first line of output you should print an integer k (1 ≤ k ≤ |s|), the resulting number of subsequences. In the i-th of following k lines first print the integer li (1 ≤ li ≤ |s|), which is the length of the i-th subsequence, and then li indices of days forming the subsequence. Indices must follow in ascending order. Days are numbered starting from 1. Each index from 1 to n must belong to exactly one subsequence. If there is no way to divide day history into zebra subsequences, print -1.
Subsequences may be printed in any order. If there are several solutions, you may print any of them. You do not have to minimize nor maximize the value of k.
Examples
Input
0010100
Output
3
3 1 3 4
3 2 5 6
1 7
Input
111
Output
-1 | instruction | 0 | 75,617 | 4 | 151,234 |
Tags: greedy
Correct Solution:
```
s = input()
c0 = s.count('0')
c1 = s.count('1')
qs = c0 - c1
if qs <= 0:
print(-1)
exit()
ans = [[] for i in range(qs)]
n1=[]
n0 = [i for i in range(qs)]
p0 = 0
p1 = 0
for i in range(len(s)):
l = s[i]
if l == '0':
if len(n0) <= p0:
print(-1)
exit()
f = n0[p0]
p0+=1
n1.append(f)
ans[f].append(i+1)
else:
if len(n1) <= p1:
print(-1)
exit()
f = n1[p1]
p1+=1
n0.append(f)
ans[f].append(i+1)
for q in ans:
if len(q) % 2 != 1:
print(-1)
exit()
print(qs)
for q in ans:
print(' '.join([str(len(q)), ' '.join([str(i) for i in q])]))
``` | output | 1 | 75,617 | 4 | 151,235 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Oleg writes down the history of the days he lived. For each day he decides if it was good or bad. Oleg calls a non-empty sequence of days a zebra, if it starts with a bad day, ends with a bad day, and good and bad days are alternating in it. Let us denote bad days as 0 and good days as 1. Then, for example, sequences of days 0, 010, 01010 are zebras, while sequences 1, 0110, 0101 are not.
Oleg tells you the story of days he lived in chronological order in form of string consisting of 0 and 1. Now you are interested if it is possible to divide Oleg's life history into several subsequences, each of which is a zebra, and the way it can be done. Each day must belong to exactly one of the subsequences. For each of the subsequences, days forming it must be ordered chronologically. Note that subsequence does not have to be a group of consecutive days.
Input
In the only line of input data there is a non-empty string s consisting of characters 0 and 1, which describes the history of Oleg's life. Its length (denoted as |s|) does not exceed 200 000 characters.
Output
If there is a way to divide history into zebra subsequences, in the first line of output you should print an integer k (1 ≤ k ≤ |s|), the resulting number of subsequences. In the i-th of following k lines first print the integer li (1 ≤ li ≤ |s|), which is the length of the i-th subsequence, and then li indices of days forming the subsequence. Indices must follow in ascending order. Days are numbered starting from 1. Each index from 1 to n must belong to exactly one subsequence. If there is no way to divide day history into zebra subsequences, print -1.
Subsequences may be printed in any order. If there are several solutions, you may print any of them. You do not have to minimize nor maximize the value of k.
Examples
Input
0010100
Output
3
3 1 3 4
3 2 5 6
1 7
Input
111
Output
-1 | instruction | 0 | 75,618 | 4 | 151,236 |
Tags: greedy
Correct Solution:
```
def read_int():
return int(input())
def read_str():
return input()
def read_list(t=int):
return list(map(t, input().split()))
def print_list(x):
print(len(x), ' '.join(map(str, x)))
# ------------------------------
def work(seqs):
ans = [[] for i in range(seqs)]
si = 0
need0 = deque(range(seqs))
need1 = deque([])
for i in range(len(s)):
if s[i] == '0':
if not len(need0):
return False
si = need0.popleft()
need1.append(si)
if s[i] == '1':
if not len(need1):
return False
si = need1.popleft()
need0.append(si)
ans[si].append(i+1)
return ans
# ------------------------------
from collections import deque
s = read_str()
seqs = s.count('0') - s.count('1')
if seqs <= 0:
print(-1)
exit(0)
ans = work(seqs)
if not work(seqs):
print(-1)
else:
print(seqs)
for seq in ans:
print_list(seq)
``` | output | 1 | 75,618 | 4 | 151,237 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Oleg writes down the history of the days he lived. For each day he decides if it was good or bad. Oleg calls a non-empty sequence of days a zebra, if it starts with a bad day, ends with a bad day, and good and bad days are alternating in it. Let us denote bad days as 0 and good days as 1. Then, for example, sequences of days 0, 010, 01010 are zebras, while sequences 1, 0110, 0101 are not.
Oleg tells you the story of days he lived in chronological order in form of string consisting of 0 and 1. Now you are interested if it is possible to divide Oleg's life history into several subsequences, each of which is a zebra, and the way it can be done. Each day must belong to exactly one of the subsequences. For each of the subsequences, days forming it must be ordered chronologically. Note that subsequence does not have to be a group of consecutive days.
Input
In the only line of input data there is a non-empty string s consisting of characters 0 and 1, which describes the history of Oleg's life. Its length (denoted as |s|) does not exceed 200 000 characters.
Output
If there is a way to divide history into zebra subsequences, in the first line of output you should print an integer k (1 ≤ k ≤ |s|), the resulting number of subsequences. In the i-th of following k lines first print the integer li (1 ≤ li ≤ |s|), which is the length of the i-th subsequence, and then li indices of days forming the subsequence. Indices must follow in ascending order. Days are numbered starting from 1. Each index from 1 to n must belong to exactly one subsequence. If there is no way to divide day history into zebra subsequences, print -1.
Subsequences may be printed in any order. If there are several solutions, you may print any of them. You do not have to minimize nor maximize the value of k.
Examples
Input
0010100
Output
3
3 1 3 4
3 2 5 6
1 7
Input
111
Output
-1
Submitted Solution:
```
s = input()
black = set()
white = set()
subs = []
possible = True
for i in range(len(s)):
if s[i] == "1":
if not black:
possible = False
break
k = black.pop()
white.add(k)
subs[k].append(i + 1)
else:
if white:
k = white.pop()
black.add(k)
subs[k].append(i + 1)
else:
black.add(len(subs))
subs.append([i + 1])
if possible and not white:
print(len(subs))
print("\n".join([str(len(sub)) + " " + " ".join(map(str, sub)) for sub in subs]))
else:
print(-1)
``` | instruction | 0 | 75,619 | 4 | 151,238 |
Yes | output | 1 | 75,619 | 4 | 151,239 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Oleg writes down the history of the days he lived. For each day he decides if it was good or bad. Oleg calls a non-empty sequence of days a zebra, if it starts with a bad day, ends with a bad day, and good and bad days are alternating in it. Let us denote bad days as 0 and good days as 1. Then, for example, sequences of days 0, 010, 01010 are zebras, while sequences 1, 0110, 0101 are not.
Oleg tells you the story of days he lived in chronological order in form of string consisting of 0 and 1. Now you are interested if it is possible to divide Oleg's life history into several subsequences, each of which is a zebra, and the way it can be done. Each day must belong to exactly one of the subsequences. For each of the subsequences, days forming it must be ordered chronologically. Note that subsequence does not have to be a group of consecutive days.
Input
In the only line of input data there is a non-empty string s consisting of characters 0 and 1, which describes the history of Oleg's life. Its length (denoted as |s|) does not exceed 200 000 characters.
Output
If there is a way to divide history into zebra subsequences, in the first line of output you should print an integer k (1 ≤ k ≤ |s|), the resulting number of subsequences. In the i-th of following k lines first print the integer li (1 ≤ li ≤ |s|), which is the length of the i-th subsequence, and then li indices of days forming the subsequence. Indices must follow in ascending order. Days are numbered starting from 1. Each index from 1 to n must belong to exactly one subsequence. If there is no way to divide day history into zebra subsequences, print -1.
Subsequences may be printed in any order. If there are several solutions, you may print any of them. You do not have to minimize nor maximize the value of k.
Examples
Input
0010100
Output
3
3 1 3 4
3 2 5 6
1 7
Input
111
Output
-1
Submitted Solution:
```
life_log = input()
result = list()
def possible():
ones = 0
zeros = 0
for k in life_log:
if k == '0':
if ones > 0:
ones -= 1
zeros += 1
else:
zeros -= 1
ones += 1
if zeros < 0:
return False
if ones > 0:
return False
return True
def compute():
ones = 0
for k in range(len(life_log)):
char = life_log[k]
if char == '0':
if ones == 0:
result.append([k + 1])
else:
result[ones - 1].append(k+1)
ones -= 1
else:
result[ones].append(k + 1)
ones += 1
if possible():
compute()
print(len(result))
print("\n".join([str(len(sub)) + " " + " ".join(map(str, sub)) for sub in result]))
else:
print(-1)
``` | instruction | 0 | 75,620 | 4 | 151,240 |
Yes | output | 1 | 75,620 | 4 | 151,241 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Oleg writes down the history of the days he lived. For each day he decides if it was good or bad. Oleg calls a non-empty sequence of days a zebra, if it starts with a bad day, ends with a bad day, and good and bad days are alternating in it. Let us denote bad days as 0 and good days as 1. Then, for example, sequences of days 0, 010, 01010 are zebras, while sequences 1, 0110, 0101 are not.
Oleg tells you the story of days he lived in chronological order in form of string consisting of 0 and 1. Now you are interested if it is possible to divide Oleg's life history into several subsequences, each of which is a zebra, and the way it can be done. Each day must belong to exactly one of the subsequences. For each of the subsequences, days forming it must be ordered chronologically. Note that subsequence does not have to be a group of consecutive days.
Input
In the only line of input data there is a non-empty string s consisting of characters 0 and 1, which describes the history of Oleg's life. Its length (denoted as |s|) does not exceed 200 000 characters.
Output
If there is a way to divide history into zebra subsequences, in the first line of output you should print an integer k (1 ≤ k ≤ |s|), the resulting number of subsequences. In the i-th of following k lines first print the integer li (1 ≤ li ≤ |s|), which is the length of the i-th subsequence, and then li indices of days forming the subsequence. Indices must follow in ascending order. Days are numbered starting from 1. Each index from 1 to n must belong to exactly one subsequence. If there is no way to divide day history into zebra subsequences, print -1.
Subsequences may be printed in any order. If there are several solutions, you may print any of them. You do not have to minimize nor maximize the value of k.
Examples
Input
0010100
Output
3
3 1 3 4
3 2 5 6
1 7
Input
111
Output
-1
Submitted Solution:
```
import sys
import bisect
#input=sys.stdin.readline
#t=int(input())
t=1
mod=10**9+7
for _ in range(t):
#n=int(input())
#n,m=map(int,input().split())
s=input()
#l=list(map(int,input().split()))
#pref=[[0 for j in range(3001)] for i in range(n+2)]
d={}
for i in range(len(s)+1):
d[i]=[]
z=[]
nz=[]
l3=[]
upto=1
for i in range(len(s)):
ch=1
if s[i]=='0':
if len(nz)>0:
index=nz.pop()
d[index].append(i+1)
z.append(index)
else:
z.append(upto)
d[upto].append(i+1)
upto+=1
else:
if len(z)>0:
index=z.pop()
d[index].append(i+1)
nz.append(index)
else:
ch=0
break
if ch==0:
break
#print(d)
if ch==0 or len(nz)>0:
print(-1)
else:
print(upto-1)
for i in range(1,upto):
print(len(d[i]),*d[i])
``` | instruction | 0 | 75,621 | 4 | 151,242 |
Yes | output | 1 | 75,621 | 4 | 151,243 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Oleg writes down the history of the days he lived. For each day he decides if it was good or bad. Oleg calls a non-empty sequence of days a zebra, if it starts with a bad day, ends with a bad day, and good and bad days are alternating in it. Let us denote bad days as 0 and good days as 1. Then, for example, sequences of days 0, 010, 01010 are zebras, while sequences 1, 0110, 0101 are not.
Oleg tells you the story of days he lived in chronological order in form of string consisting of 0 and 1. Now you are interested if it is possible to divide Oleg's life history into several subsequences, each of which is a zebra, and the way it can be done. Each day must belong to exactly one of the subsequences. For each of the subsequences, days forming it must be ordered chronologically. Note that subsequence does not have to be a group of consecutive days.
Input
In the only line of input data there is a non-empty string s consisting of characters 0 and 1, which describes the history of Oleg's life. Its length (denoted as |s|) does not exceed 200 000 characters.
Output
If there is a way to divide history into zebra subsequences, in the first line of output you should print an integer k (1 ≤ k ≤ |s|), the resulting number of subsequences. In the i-th of following k lines first print the integer li (1 ≤ li ≤ |s|), which is the length of the i-th subsequence, and then li indices of days forming the subsequence. Indices must follow in ascending order. Days are numbered starting from 1. Each index from 1 to n must belong to exactly one subsequence. If there is no way to divide day history into zebra subsequences, print -1.
Subsequences may be printed in any order. If there are several solutions, you may print any of them. You do not have to minimize nor maximize the value of k.
Examples
Input
0010100
Output
3
3 1 3 4
3 2 5 6
1 7
Input
111
Output
-1
Submitted Solution:
```
import io,os
# input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
s = input()
n = len(s)
err = 0
f = []
l = [set(), set()]
cnt = 0
par = 0
for i in range(n):
if(s[i] == "0"):
if(len(l[0]) == 0):
l[1].add(cnt)
cnt+=1
f.append([])
f[-1].append(i+1)
else:
a = l[0].pop()
l[1].add(a)
f[a].append(i+1)
elif(s[i] == "1"):
if(len(l[1]) == 0):
err = 1
break
else:
a = l[1].pop()
l[0].add(a)
f[a].append(i+1)
if(err):
print(-1)
else:
if(len(l[0]) == 0):
print(len(f))
for i in f:
print(len(i), *i)
else:
print(-1)
``` | instruction | 0 | 75,622 | 4 | 151,244 |
Yes | output | 1 | 75,622 | 4 | 151,245 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Oleg writes down the history of the days he lived. For each day he decides if it was good or bad. Oleg calls a non-empty sequence of days a zebra, if it starts with a bad day, ends with a bad day, and good and bad days are alternating in it. Let us denote bad days as 0 and good days as 1. Then, for example, sequences of days 0, 010, 01010 are zebras, while sequences 1, 0110, 0101 are not.
Oleg tells you the story of days he lived in chronological order in form of string consisting of 0 and 1. Now you are interested if it is possible to divide Oleg's life history into several subsequences, each of which is a zebra, and the way it can be done. Each day must belong to exactly one of the subsequences. For each of the subsequences, days forming it must be ordered chronologically. Note that subsequence does not have to be a group of consecutive days.
Input
In the only line of input data there is a non-empty string s consisting of characters 0 and 1, which describes the history of Oleg's life. Its length (denoted as |s|) does not exceed 200 000 characters.
Output
If there is a way to divide history into zebra subsequences, in the first line of output you should print an integer k (1 ≤ k ≤ |s|), the resulting number of subsequences. In the i-th of following k lines first print the integer li (1 ≤ li ≤ |s|), which is the length of the i-th subsequence, and then li indices of days forming the subsequence. Indices must follow in ascending order. Days are numbered starting from 1. Each index from 1 to n must belong to exactly one subsequence. If there is no way to divide day history into zebra subsequences, print -1.
Subsequences may be printed in any order. If there are several solutions, you may print any of them. You do not have to minimize nor maximize the value of k.
Examples
Input
0010100
Output
3
3 1 3 4
3 2 5 6
1 7
Input
111
Output
-1
Submitted Solution:
```
import configparser
import math
import sys
input = sys.stdin.readline
def dfs(i, adj, vis, cur_g):
cur_g.append(i)
vis[i] = True
for x in adj[i]:
if not vis[x]:
dfs(x, adj, vis, cur_g)
def main():
s = input().strip()
one = []
zero = []
adj = [[] for i in range(len(s))]
for i in range(len(s)):
if s[i] == '0':
if len(one) == 0:
zero.append(i)
else:
adj[one.pop()].append(i)
zero.append(i)
else:
if len(zero) == 0:
print(-1)
return
else:
adj[zero.pop()].append(i)
one.append(i)
if len(one) != 0:
print(-1)
return
groups = []
vis = [False for i in range(len(s))]
for i in range(len(vis)):
if not vis[i]:
cur_g = []
try:
dfs(i, adj, vis, cur_g)
except Exception as e :
print(e)
groups.append(cur_g)
print(len(groups))
for i in groups:
print(len(i), end=' ')
for j in i:
print((j+1), end=' ')
print()
if __name__ == '__main__':
main()
``` | instruction | 0 | 75,623 | 4 | 151,246 |
No | output | 1 | 75,623 | 4 | 151,247 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Oleg writes down the history of the days he lived. For each day he decides if it was good or bad. Oleg calls a non-empty sequence of days a zebra, if it starts with a bad day, ends with a bad day, and good and bad days are alternating in it. Let us denote bad days as 0 and good days as 1. Then, for example, sequences of days 0, 010, 01010 are zebras, while sequences 1, 0110, 0101 are not.
Oleg tells you the story of days he lived in chronological order in form of string consisting of 0 and 1. Now you are interested if it is possible to divide Oleg's life history into several subsequences, each of which is a zebra, and the way it can be done. Each day must belong to exactly one of the subsequences. For each of the subsequences, days forming it must be ordered chronologically. Note that subsequence does not have to be a group of consecutive days.
Input
In the only line of input data there is a non-empty string s consisting of characters 0 and 1, which describes the history of Oleg's life. Its length (denoted as |s|) does not exceed 200 000 characters.
Output
If there is a way to divide history into zebra subsequences, in the first line of output you should print an integer k (1 ≤ k ≤ |s|), the resulting number of subsequences. In the i-th of following k lines first print the integer li (1 ≤ li ≤ |s|), which is the length of the i-th subsequence, and then li indices of days forming the subsequence. Indices must follow in ascending order. Days are numbered starting from 1. Each index from 1 to n must belong to exactly one subsequence. If there is no way to divide day history into zebra subsequences, print -1.
Subsequences may be printed in any order. If there are several solutions, you may print any of them. You do not have to minimize nor maximize the value of k.
Examples
Input
0010100
Output
3
3 1 3 4
3 2 5 6
1 7
Input
111
Output
-1
Submitted Solution:
```
import io,os
input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
s = input()
n = len(s)
err = 0
f = []
l = [set(), set()]
cnt = 0
par = 0
for i in range(n):
if(s[i] == "0"):
if(len(l[0]) == 0):
l[1].add(cnt)
cnt+=1
f.append([])
f[-1].append(i+1)
else:
a = l[0].pop()
l[1].add(a)
f[a].append(i+1)
elif(s[i] == "1"):
if(len(l[1]) == 0):
err = 1
break
else:
a = l[1].pop()
l[0].add(a)
f[a].append(i+1)
if(err):
print(-1)
else:
if(len(l[0]) == 0):
print(len(f))
for i in f:
print(len(i), *i)
else:
print(-1)
``` | instruction | 0 | 75,624 | 4 | 151,248 |
No | output | 1 | 75,624 | 4 | 151,249 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Oleg writes down the history of the days he lived. For each day he decides if it was good or bad. Oleg calls a non-empty sequence of days a zebra, if it starts with a bad day, ends with a bad day, and good and bad days are alternating in it. Let us denote bad days as 0 and good days as 1. Then, for example, sequences of days 0, 010, 01010 are zebras, while sequences 1, 0110, 0101 are not.
Oleg tells you the story of days he lived in chronological order in form of string consisting of 0 and 1. Now you are interested if it is possible to divide Oleg's life history into several subsequences, each of which is a zebra, and the way it can be done. Each day must belong to exactly one of the subsequences. For each of the subsequences, days forming it must be ordered chronologically. Note that subsequence does not have to be a group of consecutive days.
Input
In the only line of input data there is a non-empty string s consisting of characters 0 and 1, which describes the history of Oleg's life. Its length (denoted as |s|) does not exceed 200 000 characters.
Output
If there is a way to divide history into zebra subsequences, in the first line of output you should print an integer k (1 ≤ k ≤ |s|), the resulting number of subsequences. In the i-th of following k lines first print the integer li (1 ≤ li ≤ |s|), which is the length of the i-th subsequence, and then li indices of days forming the subsequence. Indices must follow in ascending order. Days are numbered starting from 1. Each index from 1 to n must belong to exactly one subsequence. If there is no way to divide day history into zebra subsequences, print -1.
Subsequences may be printed in any order. If there are several solutions, you may print any of them. You do not have to minimize nor maximize the value of k.
Examples
Input
0010100
Output
3
3 1 3 4
3 2 5 6
1 7
Input
111
Output
-1
Submitted Solution:
```
life_log = input()
class Node:
def __init__(self, type=0, value=None, next=None):
if value == None:
self.value = set()
else:
self.value = value
self.next = next
self.type = type
def get_size(self):
return len(self.value)
def add(self, index):
self.value.add(index)
def is_empty(self):
return self.get_size() == 0
linked_list = Node()
tmp_node = linked_list
for index, char in enumerate(life_log):
if tmp_node.type != int(char):
tmp_node.next = Node(int(char))
tmp_node = tmp_node.next
tmp_node.value.add(index)
def possible():
ones_sum = 0
zeros_sum = 0
tmp_node = linked_list
while tmp_node is not None:
if tmp_node.type == 1:
ones_sum += tmp_node.get_size()
if ones_sum > zeros_sum:
return False
else:
zeros_sum += tmp_node.get_size()
if tmp_node.next is None and tmp_node.type == 1:
return False
tmp_node = tmp_node.next
if zeros_sum <= ones_sum:
return False
return True
def clear_linked_list():
global linked_list
n = linked_list
while True:
if n is None or n.next is None:
break
if n.next.is_empty():
n.next = n.next.next
elif n.type == n.next.type:
n.value = set(list(n.value) + list(n.next.value))
n.next = n.next.next
else:
n = n.next
if linked_list.is_empty():
linked_list = linked_list.next
def compute_and_print():
result = list()
while True:
tmp_node = linked_list
tmp_result = list()
while tmp_node is not None:
tmp_index = tmp_node.value.pop()
tmp_result.append(tmp_index)
tmp_node = tmp_node.next
result.append(tmp_result)
clear_linked_list()
if linked_list is None:
break
return result
if possible():
result = compute_and_print()
print(len(result))
for k in result:
print(len(k), " ".join(list(map(str, k))))
else:
print(-1)
``` | instruction | 0 | 75,625 | 4 | 151,250 |
No | output | 1 | 75,625 | 4 | 151,251 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Oleg writes down the history of the days he lived. For each day he decides if it was good or bad. Oleg calls a non-empty sequence of days a zebra, if it starts with a bad day, ends with a bad day, and good and bad days are alternating in it. Let us denote bad days as 0 and good days as 1. Then, for example, sequences of days 0, 010, 01010 are zebras, while sequences 1, 0110, 0101 are not.
Oleg tells you the story of days he lived in chronological order in form of string consisting of 0 and 1. Now you are interested if it is possible to divide Oleg's life history into several subsequences, each of which is a zebra, and the way it can be done. Each day must belong to exactly one of the subsequences. For each of the subsequences, days forming it must be ordered chronologically. Note that subsequence does not have to be a group of consecutive days.
Input
In the only line of input data there is a non-empty string s consisting of characters 0 and 1, which describes the history of Oleg's life. Its length (denoted as |s|) does not exceed 200 000 characters.
Output
If there is a way to divide history into zebra subsequences, in the first line of output you should print an integer k (1 ≤ k ≤ |s|), the resulting number of subsequences. In the i-th of following k lines first print the integer li (1 ≤ li ≤ |s|), which is the length of the i-th subsequence, and then li indices of days forming the subsequence. Indices must follow in ascending order. Days are numbered starting from 1. Each index from 1 to n must belong to exactly one subsequence. If there is no way to divide day history into zebra subsequences, print -1.
Subsequences may be printed in any order. If there are several solutions, you may print any of them. You do not have to minimize nor maximize the value of k.
Examples
Input
0010100
Output
3
3 1 3 4
3 2 5 6
1 7
Input
111
Output
-1
Submitted Solution:
```
import sys
life_log = sys.stdin.read(1)
result = list()
life_length = len(life_log)
def possible():
ones = 0
zeros = 0
for k in life_log:
if int(k) == 1:
zeros -= 1
ones += 1
else:
if ones > 0:
ones -= 1
zeros += 1
if zeros < 0:
return False
if ones > 0:
return False
return True
def compute():
k = 0
ones = 0
depth = 0
cur_type = 0
while k < life_length:
char = int(life_log[k])
if cur_type != char:
if cur_type == 0:
ones = 0
depth = 0
cur_type = char
if char == 0:
if depth < ones:
result[depth].append(k)
depth += 1
else:
result.append([k])
else:
result[depth].append(k)
depth += 1
ones += 1
k += 1
if possible():
compute()
sys.stdout.write(str(len(result)) + '\n')
for r in result:
sys.stdout.write(str(len(r)) + ' ' + ' '.join(map(str, r)) + '\n')
else:
sys.stdout.write('-1\n')
``` | instruction | 0 | 75,626 | 4 | 151,252 |
No | output | 1 | 75,626 | 4 | 151,253 |
Provide a correct Python 3 solution for this coding contest problem.
Today is August 24, one of the five Product Days in a year.
A date m-d (m is the month, d is the date) is called a Product Day when d is a two-digit number, and all of the following conditions are satisfied (here d_{10} is the tens digit of the day and d_1 is the ones digit of the day):
* d_1 \geq 2
* d_{10} \geq 2
* d_1 \times d_{10} = m
Takahashi wants more Product Days, and he made a new calendar called Takahashi Calendar where a year consists of M month from Month 1 to Month M, and each month consists of D days from Day 1 to Day D.
In Takahashi Calendar, how many Product Days does a year have?
Constraints
* All values in input are integers.
* 1 \leq M \leq 100
* 1 \leq D \leq 99
Input
Input is given from Standard Input in the following format:
M D
Output
Print the number of Product Days in a year in Takahashi Calender.
Examples
Input
15 40
Output
10
Input
12 31
Output
5
Input
1 1
Output
0 | instruction | 0 | 75,675 | 4 | 151,350 |
"Correct Solution:
```
m, d = map(int, input().split())
ans = 0
for i in range(1, m+1):
for j in range(21, d+1):
if i == int(str(j)[0]) * int(str(j)[1]) and int(str(j)[1]) >= 2:
ans += 1
print(ans)
``` | output | 1 | 75,675 | 4 | 151,351 |
Provide a correct Python 3 solution for this coding contest problem.
Today is August 24, one of the five Product Days in a year.
A date m-d (m is the month, d is the date) is called a Product Day when d is a two-digit number, and all of the following conditions are satisfied (here d_{10} is the tens digit of the day and d_1 is the ones digit of the day):
* d_1 \geq 2
* d_{10} \geq 2
* d_1 \times d_{10} = m
Takahashi wants more Product Days, and he made a new calendar called Takahashi Calendar where a year consists of M month from Month 1 to Month M, and each month consists of D days from Day 1 to Day D.
In Takahashi Calendar, how many Product Days does a year have?
Constraints
* All values in input are integers.
* 1 \leq M \leq 100
* 1 \leq D \leq 99
Input
Input is given from Standard Input in the following format:
M D
Output
Print the number of Product Days in a year in Takahashi Calender.
Examples
Input
15 40
Output
10
Input
12 31
Output
5
Input
1 1
Output
0 | instruction | 0 | 75,676 | 4 | 151,352 |
"Correct Solution:
```
M,D = map(int,input().split())
ans = 0
for i in range(2,M+1):
for j in range(22,D+1):
if j % 10 == 1:
continue
ans += (i == (j//10) * (j%10))
print(ans)
``` | output | 1 | 75,676 | 4 | 151,353 |
Provide a correct Python 3 solution for this coding contest problem.
Today is August 24, one of the five Product Days in a year.
A date m-d (m is the month, d is the date) is called a Product Day when d is a two-digit number, and all of the following conditions are satisfied (here d_{10} is the tens digit of the day and d_1 is the ones digit of the day):
* d_1 \geq 2
* d_{10} \geq 2
* d_1 \times d_{10} = m
Takahashi wants more Product Days, and he made a new calendar called Takahashi Calendar where a year consists of M month from Month 1 to Month M, and each month consists of D days from Day 1 to Day D.
In Takahashi Calendar, how many Product Days does a year have?
Constraints
* All values in input are integers.
* 1 \leq M \leq 100
* 1 \leq D \leq 99
Input
Input is given from Standard Input in the following format:
M D
Output
Print the number of Product Days in a year in Takahashi Calender.
Examples
Input
15 40
Output
10
Input
12 31
Output
5
Input
1 1
Output
0 | instruction | 0 | 75,677 | 4 | 151,354 |
"Correct Solution:
```
M, D = input().split()
cnt = 0
for i in range(22, int(D)+1):
s = str(i)
if(int(s[0])*int(s[1]) <= int(M)):
cnt += 1
if(int(s[1])<= 1):
cnt -= 1
print(cnt)
``` | output | 1 | 75,677 | 4 | 151,355 |
Provide a correct Python 3 solution for this coding contest problem.
Today is August 24, one of the five Product Days in a year.
A date m-d (m is the month, d is the date) is called a Product Day when d is a two-digit number, and all of the following conditions are satisfied (here d_{10} is the tens digit of the day and d_1 is the ones digit of the day):
* d_1 \geq 2
* d_{10} \geq 2
* d_1 \times d_{10} = m
Takahashi wants more Product Days, and he made a new calendar called Takahashi Calendar where a year consists of M month from Month 1 to Month M, and each month consists of D days from Day 1 to Day D.
In Takahashi Calendar, how many Product Days does a year have?
Constraints
* All values in input are integers.
* 1 \leq M \leq 100
* 1 \leq D \leq 99
Input
Input is given from Standard Input in the following format:
M D
Output
Print the number of Product Days in a year in Takahashi Calender.
Examples
Input
15 40
Output
10
Input
12 31
Output
5
Input
1 1
Output
0 | instruction | 0 | 75,678 | 4 | 151,356 |
"Correct Solution:
```
m, d = map(int,input().split())
cnt = 0
if 20<=d:
for i in range(20,d+1):
if (i%10)*(i//10)<=m and 2<=i%10:
cnt+=1
print(cnt)
``` | output | 1 | 75,678 | 4 | 151,357 |
Provide a correct Python 3 solution for this coding contest problem.
Today is August 24, one of the five Product Days in a year.
A date m-d (m is the month, d is the date) is called a Product Day when d is a two-digit number, and all of the following conditions are satisfied (here d_{10} is the tens digit of the day and d_1 is the ones digit of the day):
* d_1 \geq 2
* d_{10} \geq 2
* d_1 \times d_{10} = m
Takahashi wants more Product Days, and he made a new calendar called Takahashi Calendar where a year consists of M month from Month 1 to Month M, and each month consists of D days from Day 1 to Day D.
In Takahashi Calendar, how many Product Days does a year have?
Constraints
* All values in input are integers.
* 1 \leq M \leq 100
* 1 \leq D \leq 99
Input
Input is given from Standard Input in the following format:
M D
Output
Print the number of Product Days in a year in Takahashi Calender.
Examples
Input
15 40
Output
10
Input
12 31
Output
5
Input
1 1
Output
0 | instruction | 0 | 75,679 | 4 | 151,358 |
"Correct Solution:
```
M,D=map(int,input().split())
cnt = 0
for i in range(11,D+1):
d10=i//10
d1=i%10
if d1*d10 <= M and d10>=2 and d1>=2:
cnt+=1
print(cnt)
``` | output | 1 | 75,679 | 4 | 151,359 |
Provide a correct Python 3 solution for this coding contest problem.
Today is August 24, one of the five Product Days in a year.
A date m-d (m is the month, d is the date) is called a Product Day when d is a two-digit number, and all of the following conditions are satisfied (here d_{10} is the tens digit of the day and d_1 is the ones digit of the day):
* d_1 \geq 2
* d_{10} \geq 2
* d_1 \times d_{10} = m
Takahashi wants more Product Days, and he made a new calendar called Takahashi Calendar where a year consists of M month from Month 1 to Month M, and each month consists of D days from Day 1 to Day D.
In Takahashi Calendar, how many Product Days does a year have?
Constraints
* All values in input are integers.
* 1 \leq M \leq 100
* 1 \leq D \leq 99
Input
Input is given from Standard Input in the following format:
M D
Output
Print the number of Product Days in a year in Takahashi Calender.
Examples
Input
15 40
Output
10
Input
12 31
Output
5
Input
1 1
Output
0 | instruction | 0 | 75,680 | 4 | 151,360 |
"Correct Solution:
```
m,d=input().strip().split(' ')
m,d=[int(m),int(d)]
c=0
for i in range(22,d+1):
d1=str(i)
if int(d1[1])>=2 and int(d1[1])*int(d1[0])<=m:
c+=1
print (c)
``` | output | 1 | 75,680 | 4 | 151,361 |
Provide a correct Python 3 solution for this coding contest problem.
Today is August 24, one of the five Product Days in a year.
A date m-d (m is the month, d is the date) is called a Product Day when d is a two-digit number, and all of the following conditions are satisfied (here d_{10} is the tens digit of the day and d_1 is the ones digit of the day):
* d_1 \geq 2
* d_{10} \geq 2
* d_1 \times d_{10} = m
Takahashi wants more Product Days, and he made a new calendar called Takahashi Calendar where a year consists of M month from Month 1 to Month M, and each month consists of D days from Day 1 to Day D.
In Takahashi Calendar, how many Product Days does a year have?
Constraints
* All values in input are integers.
* 1 \leq M \leq 100
* 1 \leq D \leq 99
Input
Input is given from Standard Input in the following format:
M D
Output
Print the number of Product Days in a year in Takahashi Calender.
Examples
Input
15 40
Output
10
Input
12 31
Output
5
Input
1 1
Output
0 | instruction | 0 | 75,681 | 4 | 151,362 |
"Correct Solution:
```
m,d=map(int,input().split())
ans=0
for i in range(1,m+1):
for j in range(1,d+1):
if j//10>=2 and j%10>=2 and (j//10)*(j%10)==i:
ans+=1
print(ans)
``` | output | 1 | 75,681 | 4 | 151,363 |
Provide a correct Python 3 solution for this coding contest problem.
Today is August 24, one of the five Product Days in a year.
A date m-d (m is the month, d is the date) is called a Product Day when d is a two-digit number, and all of the following conditions are satisfied (here d_{10} is the tens digit of the day and d_1 is the ones digit of the day):
* d_1 \geq 2
* d_{10} \geq 2
* d_1 \times d_{10} = m
Takahashi wants more Product Days, and he made a new calendar called Takahashi Calendar where a year consists of M month from Month 1 to Month M, and each month consists of D days from Day 1 to Day D.
In Takahashi Calendar, how many Product Days does a year have?
Constraints
* All values in input are integers.
* 1 \leq M \leq 100
* 1 \leq D \leq 99
Input
Input is given from Standard Input in the following format:
M D
Output
Print the number of Product Days in a year in Takahashi Calender.
Examples
Input
15 40
Output
10
Input
12 31
Output
5
Input
1 1
Output
0 | instruction | 0 | 75,682 | 4 | 151,364 |
"Correct Solution:
```
M, D = map(int, input().split())
acc=0
for i in range(4,M+1):
for j in range(22,D+1):
if j%10<2: continue
if i == (j//10)*(j%10): acc+=1
print(acc)
``` | output | 1 | 75,682 | 4 | 151,365 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Today is August 24, one of the five Product Days in a year.
A date m-d (m is the month, d is the date) is called a Product Day when d is a two-digit number, and all of the following conditions are satisfied (here d_{10} is the tens digit of the day and d_1 is the ones digit of the day):
* d_1 \geq 2
* d_{10} \geq 2
* d_1 \times d_{10} = m
Takahashi wants more Product Days, and he made a new calendar called Takahashi Calendar where a year consists of M month from Month 1 to Month M, and each month consists of D days from Day 1 to Day D.
In Takahashi Calendar, how many Product Days does a year have?
Constraints
* All values in input are integers.
* 1 \leq M \leq 100
* 1 \leq D \leq 99
Input
Input is given from Standard Input in the following format:
M D
Output
Print the number of Product Days in a year in Takahashi Calender.
Examples
Input
15 40
Output
10
Input
12 31
Output
5
Input
1 1
Output
0
Submitted Solution:
```
m,d = map(int,input().split())
count = 0
for i in range(22,d+1):
d1 = i%10
d2 = i//10
if d1 >= 2 and d2 >= 2:
if d1*d2 <= m:
count += 1
print(count)
``` | instruction | 0 | 75,683 | 4 | 151,366 |
Yes | output | 1 | 75,683 | 4 | 151,367 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Today is August 24, one of the five Product Days in a year.
A date m-d (m is the month, d is the date) is called a Product Day when d is a two-digit number, and all of the following conditions are satisfied (here d_{10} is the tens digit of the day and d_1 is the ones digit of the day):
* d_1 \geq 2
* d_{10} \geq 2
* d_1 \times d_{10} = m
Takahashi wants more Product Days, and he made a new calendar called Takahashi Calendar where a year consists of M month from Month 1 to Month M, and each month consists of D days from Day 1 to Day D.
In Takahashi Calendar, how many Product Days does a year have?
Constraints
* All values in input are integers.
* 1 \leq M \leq 100
* 1 \leq D \leq 99
Input
Input is given from Standard Input in the following format:
M D
Output
Print the number of Product Days in a year in Takahashi Calender.
Examples
Input
15 40
Output
10
Input
12 31
Output
5
Input
1 1
Output
0
Submitted Solution:
```
a,b=map(int,input().split());print(sum(j+1==int(i[0])*int(i[1])for i in map(str,range(22,b+1))for j in range(a)if "0" not in i and "1" not in i))
``` | instruction | 0 | 75,684 | 4 | 151,368 |
Yes | output | 1 | 75,684 | 4 | 151,369 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Today is August 24, one of the five Product Days in a year.
A date m-d (m is the month, d is the date) is called a Product Day when d is a two-digit number, and all of the following conditions are satisfied (here d_{10} is the tens digit of the day and d_1 is the ones digit of the day):
* d_1 \geq 2
* d_{10} \geq 2
* d_1 \times d_{10} = m
Takahashi wants more Product Days, and he made a new calendar called Takahashi Calendar where a year consists of M month from Month 1 to Month M, and each month consists of D days from Day 1 to Day D.
In Takahashi Calendar, how many Product Days does a year have?
Constraints
* All values in input are integers.
* 1 \leq M \leq 100
* 1 \leq D \leq 99
Input
Input is given from Standard Input in the following format:
M D
Output
Print the number of Product Days in a year in Takahashi Calender.
Examples
Input
15 40
Output
10
Input
12 31
Output
5
Input
1 1
Output
0
Submitted Solution:
```
m, d = map(int, input().split())
cnt = 0
for i in range(1, m+1):
for j in range(1, d+1):
if j//10 >= 2 and j%10 >= 2 and (j//10) * (j%10) == i:
cnt += 1
print(cnt)
``` | instruction | 0 | 75,685 | 4 | 151,370 |
Yes | output | 1 | 75,685 | 4 | 151,371 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Today is August 24, one of the five Product Days in a year.
A date m-d (m is the month, d is the date) is called a Product Day when d is a two-digit number, and all of the following conditions are satisfied (here d_{10} is the tens digit of the day and d_1 is the ones digit of the day):
* d_1 \geq 2
* d_{10} \geq 2
* d_1 \times d_{10} = m
Takahashi wants more Product Days, and he made a new calendar called Takahashi Calendar where a year consists of M month from Month 1 to Month M, and each month consists of D days from Day 1 to Day D.
In Takahashi Calendar, how many Product Days does a year have?
Constraints
* All values in input are integers.
* 1 \leq M \leq 100
* 1 \leq D \leq 99
Input
Input is given from Standard Input in the following format:
M D
Output
Print the number of Product Days in a year in Takahashi Calender.
Examples
Input
15 40
Output
10
Input
12 31
Output
5
Input
1 1
Output
0
Submitted Solution:
```
M,D=map(int,input().split())
r=0
for m in range(1,M+1):
for d in range(1,D+1):
if d%10>=2 and d//10>=2 and ((d%10)*(d//10))==m:
r+=1
print(r)
``` | instruction | 0 | 75,686 | 4 | 151,372 |
Yes | output | 1 | 75,686 | 4 | 151,373 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Today is August 24, one of the five Product Days in a year.
A date m-d (m is the month, d is the date) is called a Product Day when d is a two-digit number, and all of the following conditions are satisfied (here d_{10} is the tens digit of the day and d_1 is the ones digit of the day):
* d_1 \geq 2
* d_{10} \geq 2
* d_1 \times d_{10} = m
Takahashi wants more Product Days, and he made a new calendar called Takahashi Calendar where a year consists of M month from Month 1 to Month M, and each month consists of D days from Day 1 to Day D.
In Takahashi Calendar, how many Product Days does a year have?
Constraints
* All values in input are integers.
* 1 \leq M \leq 100
* 1 \leq D \leq 99
Input
Input is given from Standard Input in the following format:
M D
Output
Print the number of Product Days in a year in Takahashi Calender.
Examples
Input
15 40
Output
10
Input
12 31
Output
5
Input
1 1
Output
0
Submitted Solution:
```
M, D = map(int,input().split())
Futaketa_max = D//10
Hitoketa_max_max = D % 10
counter = 0
for t in range(M):
m = t+1
for i in range(Futaketa_max):
if m % (i+1) ==0 and m / (i+1) >=2:
d2 = m / (i+1)
if m/d2 >=2:
if i+1 == Futaketa_max:
if d2 <= Hitoketa_max_max:
#print(m, i+1,d2,'1')
counter += 1
else:
#print(m, i+1,d2,'2')
counter += 1
print(counter)
``` | instruction | 0 | 75,687 | 4 | 151,374 |
No | output | 1 | 75,687 | 4 | 151,375 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Today is August 24, one of the five Product Days in a year.
A date m-d (m is the month, d is the date) is called a Product Day when d is a two-digit number, and all of the following conditions are satisfied (here d_{10} is the tens digit of the day and d_1 is the ones digit of the day):
* d_1 \geq 2
* d_{10} \geq 2
* d_1 \times d_{10} = m
Takahashi wants more Product Days, and he made a new calendar called Takahashi Calendar where a year consists of M month from Month 1 to Month M, and each month consists of D days from Day 1 to Day D.
In Takahashi Calendar, how many Product Days does a year have?
Constraints
* All values in input are integers.
* 1 \leq M \leq 100
* 1 \leq D \leq 99
Input
Input is given from Standard Input in the following format:
M D
Output
Print the number of Product Days in a year in Takahashi Calender.
Examples
Input
15 40
Output
10
Input
12 31
Output
5
Input
1 1
Output
0
Submitted Solution:
```
_, K = map(int, input().split())
a = list(map(int, input().split()))
s = [sum([b > c for c in a]) for b in a]
r = [sum([b > c for c in a[i:]]) for i, b in enumerate(a)]
b = (sum(r) + sum(s)*(K-1)/2)*K + sum(r)
print(int(b%(1e9+7)))
``` | instruction | 0 | 75,688 | 4 | 151,376 |
No | output | 1 | 75,688 | 4 | 151,377 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Today is August 24, one of the five Product Days in a year.
A date m-d (m is the month, d is the date) is called a Product Day when d is a two-digit number, and all of the following conditions are satisfied (here d_{10} is the tens digit of the day and d_1 is the ones digit of the day):
* d_1 \geq 2
* d_{10} \geq 2
* d_1 \times d_{10} = m
Takahashi wants more Product Days, and he made a new calendar called Takahashi Calendar where a year consists of M month from Month 1 to Month M, and each month consists of D days from Day 1 to Day D.
In Takahashi Calendar, how many Product Days does a year have?
Constraints
* All values in input are integers.
* 1 \leq M \leq 100
* 1 \leq D \leq 99
Input
Input is given from Standard Input in the following format:
M D
Output
Print the number of Product Days in a year in Takahashi Calender.
Examples
Input
15 40
Output
10
Input
12 31
Output
5
Input
1 1
Output
0
Submitted Solution:
```
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
N,H,W = map(int,readline().split())
RCA = [tuple(int(x) for x in line.split()) for line in readlines()]
RCA.sort(key = lambda x: -x[2])
RCA
root = list(range(H+W))
size = [0] * (H+W)
no_cycle = [True] * (H+W)
def find_root(x):
y = root[x]
if x == y:
return y
z = find_root(y)
root[x] = z
return z
def merge(x,y):
x,y = find_root(x),find_root(y)
sx,sy = size[x],size[y]
if sx < sy:
sx,sy = sy,sx
x,y = y,x
root[y] = x
no_cycle[x] = no_cycle[x] and no_cycle[y]
answer = 0
for R,C,A in RCA:
x,y = R-1,H+C-1
rx,ry = find_root(x),find_root(y)
if rx == ry:
if not no_cycle[rx]:
continue
no_cycle[rx] = False
else:
if (not no_cycle[rx]) and (not no_cycle[ry]):
continue
merge(rx,ry)
answer += A
print(answer)
``` | instruction | 0 | 75,689 | 4 | 151,378 |
No | output | 1 | 75,689 | 4 | 151,379 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Today is August 24, one of the five Product Days in a year.
A date m-d (m is the month, d is the date) is called a Product Day when d is a two-digit number, and all of the following conditions are satisfied (here d_{10} is the tens digit of the day and d_1 is the ones digit of the day):
* d_1 \geq 2
* d_{10} \geq 2
* d_1 \times d_{10} = m
Takahashi wants more Product Days, and he made a new calendar called Takahashi Calendar where a year consists of M month from Month 1 to Month M, and each month consists of D days from Day 1 to Day D.
In Takahashi Calendar, how many Product Days does a year have?
Constraints
* All values in input are integers.
* 1 \leq M \leq 100
* 1 \leq D \leq 99
Input
Input is given from Standard Input in the following format:
M D
Output
Print the number of Product Days in a year in Takahashi Calender.
Examples
Input
15 40
Output
10
Input
12 31
Output
5
Input
1 1
Output
0
Submitted Solution:
```
m, d = map(int, input().split())
ans = 0
for i in range(d):
d1, d10 = i%10, i//10
if d1 >= 2 and d10 >= 2:
judge = d1 * d10
if judge <= m:
ans += 1
print(ans)
``` | instruction | 0 | 75,690 | 4 | 151,380 |
No | output | 1 | 75,690 | 4 | 151,381 |
Provide a correct Python 3 solution for this coding contest problem.
In some other world, today is December D-th.
Write a program that prints `Christmas` if D = 25, `Christmas Eve` if D = 24, `Christmas Eve Eve` if D = 23 and `Christmas Eve Eve Eve` if D = 22.
Constraints
* 22 \leq D \leq 25
* D is an integer.
Input
Input is given from Standard Input in the following format:
D
Output
Print the specified string (case-sensitive).
Examples
Input
25
Output
Christmas
Input
22
Output
Christmas Eve Eve Eve | instruction | 0 | 75,707 | 4 | 151,414 |
"Correct Solution:
```
d = int(input())
print('Christmas', ' Eve' * (25 - d), sep='')
``` | output | 1 | 75,707 | 4 | 151,415 |
Provide a correct Python 3 solution for this coding contest problem.
In some other world, today is December D-th.
Write a program that prints `Christmas` if D = 25, `Christmas Eve` if D = 24, `Christmas Eve Eve` if D = 23 and `Christmas Eve Eve Eve` if D = 22.
Constraints
* 22 \leq D \leq 25
* D is an integer.
Input
Input is given from Standard Input in the following format:
D
Output
Print the specified string (case-sensitive).
Examples
Input
25
Output
Christmas
Input
22
Output
Christmas Eve Eve Eve | instruction | 0 | 75,708 | 4 | 151,416 |
"Correct Solution:
```
d=int(input())
n=25-d
print("Christmas"+" Eve"*n)
``` | output | 1 | 75,708 | 4 | 151,417 |
Provide a correct Python 3 solution for this coding contest problem.
In some other world, today is December D-th.
Write a program that prints `Christmas` if D = 25, `Christmas Eve` if D = 24, `Christmas Eve Eve` if D = 23 and `Christmas Eve Eve Eve` if D = 22.
Constraints
* 22 \leq D \leq 25
* D is an integer.
Input
Input is given from Standard Input in the following format:
D
Output
Print the specified string (case-sensitive).
Examples
Input
25
Output
Christmas
Input
22
Output
Christmas Eve Eve Eve | instruction | 0 | 75,709 | 4 | 151,418 |
"Correct Solution:
```
eve=25-int(input())
print("Christmas"+" Eve"*eve)
``` | output | 1 | 75,709 | 4 | 151,419 |
Provide a correct Python 3 solution for this coding contest problem.
In some other world, today is December D-th.
Write a program that prints `Christmas` if D = 25, `Christmas Eve` if D = 24, `Christmas Eve Eve` if D = 23 and `Christmas Eve Eve Eve` if D = 22.
Constraints
* 22 \leq D \leq 25
* D is an integer.
Input
Input is given from Standard Input in the following format:
D
Output
Print the specified string (case-sensitive).
Examples
Input
25
Output
Christmas
Input
22
Output
Christmas Eve Eve Eve | instruction | 0 | 75,710 | 4 | 151,420 |
"Correct Solution:
```
D=int(input())
s="Christmas"
i=25-D
print(s+" Eve"*i)
``` | output | 1 | 75,710 | 4 | 151,421 |
Provide a correct Python 3 solution for this coding contest problem.
In some other world, today is December D-th.
Write a program that prints `Christmas` if D = 25, `Christmas Eve` if D = 24, `Christmas Eve Eve` if D = 23 and `Christmas Eve Eve Eve` if D = 22.
Constraints
* 22 \leq D \leq 25
* D is an integer.
Input
Input is given from Standard Input in the following format:
D
Output
Print the specified string (case-sensitive).
Examples
Input
25
Output
Christmas
Input
22
Output
Christmas Eve Eve Eve | instruction | 0 | 75,711 | 4 | 151,422 |
"Correct Solution:
```
d= int(input())
a ='Christmas'+ (25-d)*' Eve'
print(a)
``` | output | 1 | 75,711 | 4 | 151,423 |
Provide a correct Python 3 solution for this coding contest problem.
In some other world, today is December D-th.
Write a program that prints `Christmas` if D = 25, `Christmas Eve` if D = 24, `Christmas Eve Eve` if D = 23 and `Christmas Eve Eve Eve` if D = 22.
Constraints
* 22 \leq D \leq 25
* D is an integer.
Input
Input is given from Standard Input in the following format:
D
Output
Print the specified string (case-sensitive).
Examples
Input
25
Output
Christmas
Input
22
Output
Christmas Eve Eve Eve | instruction | 0 | 75,712 | 4 | 151,424 |
"Correct Solution:
```
d=25-int(input())
print("Christmas"+(" "+"Eve")*d)
``` | output | 1 | 75,712 | 4 | 151,425 |
Provide a correct Python 3 solution for this coding contest problem.
In some other world, today is December D-th.
Write a program that prints `Christmas` if D = 25, `Christmas Eve` if D = 24, `Christmas Eve Eve` if D = 23 and `Christmas Eve Eve Eve` if D = 22.
Constraints
* 22 \leq D \leq 25
* D is an integer.
Input
Input is given from Standard Input in the following format:
D
Output
Print the specified string (case-sensitive).
Examples
Input
25
Output
Christmas
Input
22
Output
Christmas Eve Eve Eve | instruction | 0 | 75,713 | 4 | 151,426 |
"Correct Solution:
```
D = int(input())
print('Christmas' + ' Eve' * abs(D - 25))
``` | output | 1 | 75,713 | 4 | 151,427 |
Provide a correct Python 3 solution for this coding contest problem.
In some other world, today is December D-th.
Write a program that prints `Christmas` if D = 25, `Christmas Eve` if D = 24, `Christmas Eve Eve` if D = 23 and `Christmas Eve Eve Eve` if D = 22.
Constraints
* 22 \leq D \leq 25
* D is an integer.
Input
Input is given from Standard Input in the following format:
D
Output
Print the specified string (case-sensitive).
Examples
Input
25
Output
Christmas
Input
22
Output
Christmas Eve Eve Eve | instruction | 0 | 75,714 | 4 | 151,428 |
"Correct Solution:
```
n = int(input())
print("Christmas" + (25 - n) * " Eve")
``` | output | 1 | 75,714 | 4 | 151,429 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In some other world, today is December D-th.
Write a program that prints `Christmas` if D = 25, `Christmas Eve` if D = 24, `Christmas Eve Eve` if D = 23 and `Christmas Eve Eve Eve` if D = 22.
Constraints
* 22 \leq D \leq 25
* D is an integer.
Input
Input is given from Standard Input in the following format:
D
Output
Print the specified string (case-sensitive).
Examples
Input
25
Output
Christmas
Input
22
Output
Christmas Eve Eve Eve
Submitted Solution:
```
print("Christmas" + (" Eve" * (25 - int(input()))))
``` | instruction | 0 | 75,715 | 4 | 151,430 |
Yes | output | 1 | 75,715 | 4 | 151,431 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In some other world, today is December D-th.
Write a program that prints `Christmas` if D = 25, `Christmas Eve` if D = 24, `Christmas Eve Eve` if D = 23 and `Christmas Eve Eve Eve` if D = 22.
Constraints
* 22 \leq D \leq 25
* D is an integer.
Input
Input is given from Standard Input in the following format:
D
Output
Print the specified string (case-sensitive).
Examples
Input
25
Output
Christmas
Input
22
Output
Christmas Eve Eve Eve
Submitted Solution:
```
print('Christmas'+' Eve'*abs(int(input())-25))
``` | instruction | 0 | 75,716 | 4 | 151,432 |
Yes | output | 1 | 75,716 | 4 | 151,433 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In some other world, today is December D-th.
Write a program that prints `Christmas` if D = 25, `Christmas Eve` if D = 24, `Christmas Eve Eve` if D = 23 and `Christmas Eve Eve Eve` if D = 22.
Constraints
* 22 \leq D \leq 25
* D is an integer.
Input
Input is given from Standard Input in the following format:
D
Output
Print the specified string (case-sensitive).
Examples
Input
25
Output
Christmas
Input
22
Output
Christmas Eve Eve Eve
Submitted Solution:
```
D=int(input())
k=25-D
print('Christmas'+' Eve'*k)
``` | instruction | 0 | 75,717 | 4 | 151,434 |
Yes | output | 1 | 75,717 | 4 | 151,435 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In some other world, today is December D-th.
Write a program that prints `Christmas` if D = 25, `Christmas Eve` if D = 24, `Christmas Eve Eve` if D = 23 and `Christmas Eve Eve Eve` if D = 22.
Constraints
* 22 \leq D \leq 25
* D is an integer.
Input
Input is given from Standard Input in the following format:
D
Output
Print the specified string (case-sensitive).
Examples
Input
25
Output
Christmas
Input
22
Output
Christmas Eve Eve Eve
Submitted Solution:
```
d = int(input())
print("Christmas" + (25 - d) * " Eve")
``` | instruction | 0 | 75,718 | 4 | 151,436 |
Yes | output | 1 | 75,718 | 4 | 151,437 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In some other world, today is December D-th.
Write a program that prints `Christmas` if D = 25, `Christmas Eve` if D = 24, `Christmas Eve Eve` if D = 23 and `Christmas Eve Eve Eve` if D = 22.
Constraints
* 22 \leq D \leq 25
* D is an integer.
Input
Input is given from Standard Input in the following format:
D
Output
Print the specified string (case-sensitive).
Examples
Input
25
Output
Christmas
Input
22
Output
Christmas Eve Eve Eve
Submitted Solution:
```
d = input()
if d==25:
print('Christmas')
elif d==24:
print('Christmas Eve')
elif d==23:
print('Christmas Eve Eve')
elif d==22:
print('Christmas Eve Eve Eve')
``` | instruction | 0 | 75,720 | 4 | 151,440 |
No | output | 1 | 75,720 | 4 | 151,441 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In some other world, today is December D-th.
Write a program that prints `Christmas` if D = 25, `Christmas Eve` if D = 24, `Christmas Eve Eve` if D = 23 and `Christmas Eve Eve Eve` if D = 22.
Constraints
* 22 \leq D \leq 25
* D is an integer.
Input
Input is given from Standard Input in the following format:
D
Output
Print the specified string (case-sensitive).
Examples
Input
25
Output
Christmas
Input
22
Output
Christmas Eve Eve Eve
Submitted Solution:
```
D = int(input())
print("Christmas"+" Eve"*(D-25))
``` | instruction | 0 | 75,721 | 4 | 151,442 |
No | output | 1 | 75,721 | 4 | 151,443 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In some other world, today is December D-th.
Write a program that prints `Christmas` if D = 25, `Christmas Eve` if D = 24, `Christmas Eve Eve` if D = 23 and `Christmas Eve Eve Eve` if D = 22.
Constraints
* 22 \leq D \leq 25
* D is an integer.
Input
Input is given from Standard Input in the following format:
D
Output
Print the specified string (case-sensitive).
Examples
Input
25
Output
Christmas
Input
22
Output
Christmas Eve Eve Eve
Submitted Solution:
```
n = int(input())
if n == 25:
print("Chiristmas")
elif(n == 24):
print("Chiristmas Eve")
elif(n == 23):
print("Chiristmas Eve Eve")
else:
print("Chiristmas Eve Eve Eve")
``` | instruction | 0 | 75,722 | 4 | 151,444 |
No | output | 1 | 75,722 | 4 | 151,445 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Lesha loves listening to music via his smartphone. But the smartphone doesn't have much memory, so Lesha listens to his favorite songs in a well-known social network InTalk.
Unfortunately, internet is not that fast in the city of Ekaterinozavodsk and the song takes a lot of time to download. But Lesha is quite impatient. The song's duration is T seconds. Lesha downloads the first S seconds of the song and plays it. When the playback reaches the point that has not yet been downloaded, Lesha immediately plays the song from the start (the loaded part of the song stays in his phone, and the download is continued from the same place), and it happens until the song is downloaded completely and Lesha listens to it to the end. For q seconds of real time the Internet allows you to download q - 1 seconds of the track.
Tell Lesha, for how many times he will start the song, including the very first start.
Input
The single line contains three integers T, S, q (2 ≤ q ≤ 104, 1 ≤ S < T ≤ 105).
Output
Print a single integer — the number of times the song will be restarted.
Examples
Input
5 2 2
Output
2
Input
5 4 7
Output
1
Input
6 2 3
Output
1
Note
In the first test, the song is played twice faster than it is downloaded, which means that during four first seconds Lesha reaches the moment that has not been downloaded, and starts the song again. After another two seconds, the song is downloaded completely, and thus, Lesha starts the song twice.
In the second test, the song is almost downloaded, and Lesha will start it only once.
In the third sample test the download finishes and Lesha finishes listening at the same moment. Note that song isn't restarted in this case. | instruction | 0 | 76,276 | 4 | 152,552 |
Tags: implementation, math
Correct Solution:
```
from math import ceil,log
a,b,c=map(int,input().split())
print(ceil(log(a/b,c)))
``` | output | 1 | 76,276 | 4 | 152,553 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Lesha loves listening to music via his smartphone. But the smartphone doesn't have much memory, so Lesha listens to his favorite songs in a well-known social network InTalk.
Unfortunately, internet is not that fast in the city of Ekaterinozavodsk and the song takes a lot of time to download. But Lesha is quite impatient. The song's duration is T seconds. Lesha downloads the first S seconds of the song and plays it. When the playback reaches the point that has not yet been downloaded, Lesha immediately plays the song from the start (the loaded part of the song stays in his phone, and the download is continued from the same place), and it happens until the song is downloaded completely and Lesha listens to it to the end. For q seconds of real time the Internet allows you to download q - 1 seconds of the track.
Tell Lesha, for how many times he will start the song, including the very first start.
Input
The single line contains three integers T, S, q (2 ≤ q ≤ 104, 1 ≤ S < T ≤ 105).
Output
Print a single integer — the number of times the song will be restarted.
Examples
Input
5 2 2
Output
2
Input
5 4 7
Output
1
Input
6 2 3
Output
1
Note
In the first test, the song is played twice faster than it is downloaded, which means that during four first seconds Lesha reaches the moment that has not been downloaded, and starts the song again. After another two seconds, the song is downloaded completely, and thus, Lesha starts the song twice.
In the second test, the song is almost downloaded, and Lesha will start it only once.
In the third sample test the download finishes and Lesha finishes listening at the same moment. Note that song isn't restarted in this case. | instruction | 0 | 76,279 | 4 | 152,558 |
Tags: implementation, math
Correct Solution:
```
import io, os, sys
try:
fin = open('in')
input = fin.readline
except:
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
t, s, q = map(int, input().split())
c = 0
while s < t:
c += 1
s *= q
print (c)
``` | output | 1 | 76,279 | 4 | 152,559 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Lesha loves listening to music via his smartphone. But the smartphone doesn't have much memory, so Lesha listens to his favorite songs in a well-known social network InTalk.
Unfortunately, internet is not that fast in the city of Ekaterinozavodsk and the song takes a lot of time to download. But Lesha is quite impatient. The song's duration is T seconds. Lesha downloads the first S seconds of the song and plays it. When the playback reaches the point that has not yet been downloaded, Lesha immediately plays the song from the start (the loaded part of the song stays in his phone, and the download is continued from the same place), and it happens until the song is downloaded completely and Lesha listens to it to the end. For q seconds of real time the Internet allows you to download q - 1 seconds of the track.
Tell Lesha, for how many times he will start the song, including the very first start.
Input
The single line contains three integers T, S, q (2 ≤ q ≤ 104, 1 ≤ S < T ≤ 105).
Output
Print a single integer — the number of times the song will be restarted.
Examples
Input
5 2 2
Output
2
Input
5 4 7
Output
1
Input
6 2 3
Output
1
Note
In the first test, the song is played twice faster than it is downloaded, which means that during four first seconds Lesha reaches the moment that has not been downloaded, and starts the song again. After another two seconds, the song is downloaded completely, and thus, Lesha starts the song twice.
In the second test, the song is almost downloaded, and Lesha will start it only once.
In the third sample test the download finishes and Lesha finishes listening at the same moment. Note that song isn't restarted in this case. | instruction | 0 | 76,280 | 4 | 152,560 |
Tags: implementation, math
Correct Solution:
```
T,S,q=map(int,input().split())
a=0
while T>S:S*=q;a+=1
print(a)
``` | output | 1 | 76,280 | 4 | 152,561 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.