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.
Having stayed home alone, Petya decided to watch forbidden films on the Net in secret. "What ungentlemanly behavior!" β you can say that, of course, but don't be too harsh on the kid. In his country films about the Martians and other extrate... | instruction | 0 | 6,834 | 4 | 13,668 |
Tags: implementation
Correct Solution:
```
from sys import setrecursionlimit, exit, stdin
from math import ceil, floor, acos, pi
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from functools import reduce
import itertools
setrecursionlimit(10**7)
RI=lambda x=' ': list(map(int,inpu... | output | 1 | 6,834 | 4 | 13,669 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Having stayed home alone, Petya decided to watch forbidden films on the Net in secret. "What ungentlemanly behavior!" β you can say that, of course, but don't be too harsh on the kid. In his country films about the Martians and other extrate... | instruction | 0 | 6,835 | 4 | 13,670 |
Tags: implementation
Correct Solution:
```
a,b=input().split(':')
z='0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'
c=[z.find(i) for i in a]
d=[z.find(i) for i in b]
for i in range(len(c)):
if c[i]>0:
break
c=c[i:]
for i in range(len(d)):
if d[i]>0:
break
d=d[i:]
if int(a,base=max(*c+[1])+1)>23 or int(b,... | output | 1 | 6,835 | 4 | 13,671 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Having stayed home alone, Petya decided to watch forbidden films on the Net in secret. "What ungentlemanly behavior!" β you can say that, of course, but don't be too harsh on the kid. In his country films about the Martians and other extrate... | instruction | 0 | 6,836 | 4 | 13,672 |
Tags: implementation
Correct Solution:
```
def f(x, k):
if 1 < k < 37: return int(x, k)
s = 0
for i in x:
s = s * k
s += int(i, 36)
return s
hours, minutes = input().split(':')
i = j = k = max(int(max(hours), 36), int(max(minutes), 36)) + 1
x, y = (f(hours, k) == f(hours, k + 1)), (f(m... | output | 1 | 6,836 | 4 | 13,673 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Having stayed home alone, Petya decided to watch forbidden films on the Net in secret. "What ungentlemanly behavior!" β you can say that, of course, but don't be too harsh on the kid. In his country films about the Martians and other extrate... | instruction | 0 | 6,837 | 4 | 13,674 |
Tags: implementation
Correct Solution:
```
import string
import re
values={str(d): d for d in range(10) }
for ch in string.ascii_uppercase:
values[ch] = ord(ch) - 55
def convert(s, i):
x=0
for ch in s:
d = values[ch]
if d>=i:
return None
x = i*x+d
return x
match=re... | output | 1 | 6,837 | 4 | 13,675 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Having stayed home alone, Petya decided to watch forbidden films on the Net in secret. "What ungentlemanly behavior!" β you can say that, of course, but don't be too harsh on the kid. In his cou... | instruction | 0 | 6,838 | 4 | 13,676 |
Yes | output | 1 | 6,838 | 4 | 13,677 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Having stayed home alone, Petya decided to watch forbidden films on the Net in secret. "What ungentlemanly behavior!" β you can say that, of course, but don't be too harsh on the kid. In his cou... | instruction | 0 | 6,839 | 4 | 13,678 |
Yes | output | 1 | 6,839 | 4 | 13,679 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Having stayed home alone, Petya decided to watch forbidden films on the Net in secret. "What ungentlemanly behavior!" β you can say that, of course, but don't be too harsh on the kid. In his cou... | instruction | 0 | 6,840 | 4 | 13,680 |
Yes | output | 1 | 6,840 | 4 | 13,681 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Having stayed home alone, Petya decided to watch forbidden films on the Net in secret. "What ungentlemanly behavior!" β you can say that, of course, but don't be too harsh on the kid. In his cou... | instruction | 0 | 6,841 | 4 | 13,682 |
Yes | output | 1 | 6,841 | 4 | 13,683 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Having stayed home alone, Petya decided to watch forbidden films on the Net in secret. "What ungentlemanly behavior!" β you can say that, of course, but don't be too harsh on the kid. In his cou... | instruction | 0 | 6,842 | 4 | 13,684 |
No | output | 1 | 6,842 | 4 | 13,685 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Having stayed home alone, Petya decided to watch forbidden films on the Net in secret. "What ungentlemanly behavior!" β you can say that, of course, but don't be too harsh on the kid. In his cou... | instruction | 0 | 6,843 | 4 | 13,686 |
No | output | 1 | 6,843 | 4 | 13,687 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Having stayed home alone, Petya decided to watch forbidden films on the Net in secret. "What ungentlemanly behavior!" β you can say that, of course, but don't be too harsh on the kid. In his cou... | instruction | 0 | 6,844 | 4 | 13,688 |
No | output | 1 | 6,844 | 4 | 13,689 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Having stayed home alone, Petya decided to watch forbidden films on the Net in secret. "What ungentlemanly behavior!" β you can say that, of course, but don't be too harsh on the kid. In his cou... | instruction | 0 | 6,845 | 4 | 13,690 |
No | output | 1 | 6,845 | 4 | 13,691 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Bear Limak likes watching sports on TV. He is going to watch a game today. The game lasts 90 minutes and there are no breaks.
Each minute can be either interesting or boring. If 15 consecutive minutes are boring then Limak immediately turns... | instruction | 0 | 7,127 | 4 | 14,254 |
Tags: implementation
Correct Solution:
```
n = int(input())
BoringTimes = [int(i) for i in input().split(' ')]
flag = 0
if BoringTimes[0] > 15:
flag = 1
print('15')
else:
for i in range(n-1):
if BoringTimes[i+1] - BoringTimes[i] > 15:
flag = 1
print(BoringTimes[i] + 15)
... | output | 1 | 7,127 | 4 | 14,255 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Bear Limak likes watching sports on TV. He is going to watch a game today. The game lasts 90 minutes and there are no breaks.
Each minute can be either interesting or boring. If 15 consecutive minutes are boring then Limak immediately turns... | instruction | 0 | 7,128 | 4 | 14,256 |
Tags: implementation
Correct Solution:
```
n=int(input())
a=[int(i) for i in input().split()]
ch=0
for f in a:
if f-ch>15:
break
else:
ch=f
if ch>=90-15:
ch=90
else:
ch+=15
print(ch)
``` | output | 1 | 7,128 | 4 | 14,257 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Bear Limak likes watching sports on TV. He is going to watch a game today. The game lasts 90 minutes and there are no breaks.
Each minute can be either interesting or boring. If 15 consecutive minutes are boring then Limak immediately turns... | instruction | 0 | 7,129 | 4 | 14,258 |
Tags: implementation
Correct Solution:
```
input()
ts = map(int, input().split())
time = 15
for t in ts:
if t <= time:
time = t + 15
else:
break
print(min(90, time))
``` | output | 1 | 7,129 | 4 | 14,259 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Bear Limak likes watching sports on TV. He is going to watch a game today. The game lasts 90 minutes and there are no breaks.
Each minute can be either interesting or boring. If 15 consecutive minutes are boring then Limak immediately turns... | instruction | 0 | 7,130 | 4 | 14,260 |
Tags: implementation
Correct Solution:
```
n = input()
minutes = list(map(int,input().split()))
total_time = 0
mark = 0
for i in minutes:
watching = min(i-mark,15)
total_time += watching
if i-mark>=16:
break
mark = i
if mark == minutes[-1]:
total_time += min(90-minutes[-1],15)
print(total_... | output | 1 | 7,130 | 4 | 14,261 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Bear Limak likes watching sports on TV. He is going to watch a game today. The game lasts 90 minutes and there are no breaks.
Each minute can be either interesting or boring. If 15 consecutive minutes are boring then Limak immediately turns... | instruction | 0 | 7,131 | 4 | 14,262 |
Tags: implementation
Correct Solution:
```
n = int(input())
arr = list(map(int, input().split(' ')))
last = 0
end = False
for i in arr:
if i - last > 15:
print(last + 15)
end = True
break
last = i
if not end:
if last > 74:
print(90)
else:
print(last + 15)
``` | output | 1 | 7,131 | 4 | 14,263 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Bear Limak likes watching sports on TV. He is going to watch a game today. The game lasts 90 minutes and there are no breaks.
Each minute can be either interesting or boring. If 15 consecutive minutes are boring then Limak immediately turns... | instruction | 0 | 7,132 | 4 | 14,264 |
Tags: implementation
Correct Solution:
```
n = int(input())
t = list(map(int, input().split()))
if(n==1 or t[0]>15):
if(t[0] > 15):
print(15)
else:
print(t[0]+15)
else:
watchtime = 0
for i in range(1,n):
if(t[i]-t[i-1] >15):
watchtime=t[i-1]+15
break
i... | output | 1 | 7,132 | 4 | 14,265 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Bear Limak likes watching sports on TV. He is going to watch a game today. The game lasts 90 minutes and there are no breaks.
Each minute can be either interesting or boring. If 15 consecutive minutes are boring then Limak immediately turns... | instruction | 0 | 7,133 | 4 | 14,266 |
Tags: implementation
Correct Solution:
```
n=int(input())
l=list(map(int,input().split()))
m=0
s=0
for i in range(n):
if(l[i]-m<=15):
m=l[i]
else:
m+=15
s=1
break
if(s==0):
if(90-m<=15):
m=90
else:
m+=15
print(m)
``` | output | 1 | 7,133 | 4 | 14,267 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Bear Limak likes watching sports on TV. He is going to watch a game today. The game lasts 90 minutes and there are no breaks.
Each minute can be either interesting or boring. If 15 consecutive minutes are boring then Limak immediately turns... | instruction | 0 | 7,134 | 4 | 14,268 |
Tags: implementation
Correct Solution:
```
n=int(input())
l=list(map(int,input().split()))
if len(l)==1:
if l[0]>15:
time=15
else:
time=l[0]+15
for i in range(len(l)):
if l[i]<=15 and i==0:
continue
elif l[i]>15 and i==0:
time=15
break
if l[i]-l[i-1]>15:
time=l[i-1]+15
break
elif l[i]-l[i-1]<=15:
... | output | 1 | 7,134 | 4 | 14,269 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Bear Limak likes watching sports on TV. He is going to watch a game today. The game lasts 90 minutes and there are no breaks.
Each minute can be either interesting or boring. If 15 consecutive ... | instruction | 0 | 7,135 | 4 | 14,270 |
Yes | output | 1 | 7,135 | 4 | 14,271 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Bear Limak likes watching sports on TV. He is going to watch a game today. The game lasts 90 minutes and there are no breaks.
Each minute can be either interesting or boring. If 15 consecutive ... | instruction | 0 | 7,136 | 4 | 14,272 |
Yes | output | 1 | 7,136 | 4 | 14,273 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Bear Limak likes watching sports on TV. He is going to watch a game today. The game lasts 90 minutes and there are no breaks.
Each minute can be either interesting or boring. If 15 consecutive ... | instruction | 0 | 7,137 | 4 | 14,274 |
Yes | output | 1 | 7,137 | 4 | 14,275 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Bear Limak likes watching sports on TV. He is going to watch a game today. The game lasts 90 minutes and there are no breaks.
Each minute can be either interesting or boring. If 15 consecutive ... | instruction | 0 | 7,138 | 4 | 14,276 |
Yes | output | 1 | 7,138 | 4 | 14,277 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Bear Limak likes watching sports on TV. He is going to watch a game today. The game lasts 90 minutes and there are no breaks.
Each minute can be either interesting or boring. If 15 consecutive ... | instruction | 0 | 7,139 | 4 | 14,278 |
No | output | 1 | 7,139 | 4 | 14,279 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Bear Limak likes watching sports on TV. He is going to watch a game today. The game lasts 90 minutes and there are no breaks.
Each minute can be either interesting or boring. If 15 consecutive ... | instruction | 0 | 7,140 | 4 | 14,280 |
No | output | 1 | 7,140 | 4 | 14,281 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Bear Limak likes watching sports on TV. He is going to watch a game today. The game lasts 90 minutes and there are no breaks.
Each minute can be either interesting or boring. If 15 consecutive ... | instruction | 0 | 7,141 | 4 | 14,282 |
No | output | 1 | 7,141 | 4 | 14,283 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Bear Limak likes watching sports on TV. He is going to watch a game today. The game lasts 90 minutes and there are no breaks.
Each minute can be either interesting or boring. If 15 consecutive ... | instruction | 0 | 7,142 | 4 | 14,284 |
No | output | 1 | 7,142 | 4 | 14,285 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The girl Taylor has a beautiful calendar for the year y. In the calendar all days are given with their days of week: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday and Sunday.
The calendar is so beautiful that she wants to know what... | instruction | 0 | 8,009 | 4 | 16,018 |
Tags: implementation
Correct Solution:
```
def is_leap(y):
a = y % 400 == 0
b = y % 4 == 0 and not y % 100 == 0
return a or b
year = int(input())
l = is_leap(year)
w = 1
u = w
y = year
while True:
y += 1
incr = int(is_leap(y - 1))
u = (u + 1 + incr) % 7
if u == w and l == is_leap(y):
... | output | 1 | 8,009 | 4 | 16,019 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The girl Taylor has a beautiful calendar for the year y. In the calendar all days are given with their days of week: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday and Sunday.
The calendar is so beautiful that she wants to know what... | instruction | 0 | 8,010 | 4 | 16,020 |
Tags: implementation
Correct Solution:
```
def main():
def leap(y):
return y % 100 and not y % 4 or not y % 400
n = int(input())
a = leap(n)
b, x = not a, 0
while a != b or x % 7:
n += 1
b = leap(n)
x += 365 + b
print(n)
if __name__ == '__main__':
main()
`... | output | 1 | 8,010 | 4 | 16,021 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The girl Taylor has a beautiful calendar for the year y. In the calendar all days are given with their days of week: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday and Sunday.
The calendar is so beautiful that she wants to know what... | instruction | 0 | 8,011 | 4 | 16,022 |
Tags: implementation
Correct Solution:
```
def f(n):
if (n % 400 == 0):
return 2
elif n % 100 != 0 and n % 4 == 0:
return 2
return 1
n = int(input())
x = n
c = f(n)
n += 1
while c % 7 != 0 or f(n) != f(x):
c += f(n)
n += 1
#print(n, f(n), c)
print(n)
``` | output | 1 | 8,011 | 4 | 16,023 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The girl Taylor has a beautiful calendar for the year y. In the calendar all days are given with their days of week: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday and Sunday.
The calendar is so beautiful that she wants to know what... | instruction | 0 | 8,012 | 4 | 16,024 |
Tags: implementation
Correct Solution:
```
y=int(input())
b=0
y0=y
while b or y==y0 or (y0%400==0 or y0%4==0 and y0%100) and not(y%400==0 or y%4==0 and y%100) or not(y0%400==0 or y0%4==0 and y0%100) and (y%400==0 or y%4==0 and y%100):
b+=365%7
if y%400==0 or y%4==0 and y%100:
b+=1
y+=1
b%=7
prin... | output | 1 | 8,012 | 4 | 16,025 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The girl Taylor has a beautiful calendar for the year y. In the calendar all days are given with their days of week: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday and Sunday.
The calendar is so beautiful that she wants to know what... | instruction | 0 | 8,013 | 4 | 16,026 |
Tags: implementation
Correct Solution:
```
def leapyear(y):
return y%400==0 or (y%4==0 and y%100!=0)
a = int(input())
t = int(leapyear(a))
s = int(leapyear(a+1))
d = s+1
y=a+1
while(d%7!=0 or s!=t):
y+=1
s = int(leapyear(y))
d+=s+1
print(y)
``` | output | 1 | 8,013 | 4 | 16,027 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The girl Taylor has a beautiful calendar for the year y. In the calendar all days are given with their days of week: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday and Sunday.
The calendar is so beautiful that she wants to know what... | instruction | 0 | 8,014 | 4 | 16,028 |
Tags: implementation
Correct Solution:
```
def isleap(y):
return y % 400 == 0 or (y % 4 == 0 and y % 100 != 0)
y = int(input())
days = 366 if isleap(y) else 365
nextSameYear = y+1
while True:
if days % 7 == 0 and isleap(nextSameYear) == isleap(y):
break
days += 366 if isleap(nextSameYear) else 36... | output | 1 | 8,014 | 4 | 16,029 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The girl Taylor has a beautiful calendar for the year y. In the calendar all days are given with their days of week: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday and Sunday.
The calendar is so beautiful that she wants to know what... | instruction | 0 | 8,015 | 4 | 16,030 |
Tags: implementation
Correct Solution:
```
n = int(input())
count = 0
flag = True
if (n % 4 == 0 and n % 100 != 0) or n % 400 == 0 :
flag = False
while True:
n += 1
if n % 400 == 0:
count += 2
elif n % 4 == 0 and n % 100 != 0:
count += 2
else:
count += 1
#print(count)
if ... | output | 1 | 8,015 | 4 | 16,031 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The girl Taylor has a beautiful calendar for the year y. In the calendar all days are given with their days of week: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday and Sunday.
The calendar is so beautiful that she wants to know what... | instruction | 0 | 8,016 | 4 | 16,032 |
Tags: implementation
Correct Solution:
```
def is_leap(year):
return year % 400 == 0 or (year % 4 == 0 and year % 100 != 0)
def year_days(year):
return 365 + int(is_leap(year))
y = int(input().strip())
offset = 0
res = y
while 1:
if offset and offset % 7 == 0 and is_leap(y) == is_leap(res):
brea... | output | 1 | 8,016 | 4 | 16,033 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The girl Taylor has a beautiful calendar for the year y. In the calendar all days are given with their days of week: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday and Sunday.
The calen... | instruction | 0 | 8,017 | 4 | 16,034 |
Yes | output | 1 | 8,017 | 4 | 16,035 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The girl Taylor has a beautiful calendar for the year y. In the calendar all days are given with their days of week: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday and Sunday.
The calen... | instruction | 0 | 8,018 | 4 | 16,036 |
Yes | output | 1 | 8,018 | 4 | 16,037 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The girl Taylor has a beautiful calendar for the year y. In the calendar all days are given with their days of week: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday and Sunday.
The calen... | instruction | 0 | 8,019 | 4 | 16,038 |
Yes | output | 1 | 8,019 | 4 | 16,039 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The girl Taylor has a beautiful calendar for the year y. In the calendar all days are given with their days of week: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday and Sunday.
The calen... | instruction | 0 | 8,020 | 4 | 16,040 |
Yes | output | 1 | 8,020 | 4 | 16,041 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The girl Taylor has a beautiful calendar for the year y. In the calendar all days are given with their days of week: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday and Sunday.
The calen... | instruction | 0 | 8,021 | 4 | 16,042 |
No | output | 1 | 8,021 | 4 | 16,043 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The girl Taylor has a beautiful calendar for the year y. In the calendar all days are given with their days of week: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday and Sunday.
The calen... | instruction | 0 | 8,022 | 4 | 16,044 |
No | output | 1 | 8,022 | 4 | 16,045 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The girl Taylor has a beautiful calendar for the year y. In the calendar all days are given with their days of week: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday and Sunday.
The calen... | instruction | 0 | 8,023 | 4 | 16,046 |
No | output | 1 | 8,023 | 4 | 16,047 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The girl Taylor has a beautiful calendar for the year y. In the calendar all days are given with their days of week: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday and Sunday.
The calen... | instruction | 0 | 8,024 | 4 | 16,048 |
No | output | 1 | 8,024 | 4 | 16,049 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Ivan Anatolyevich's agency is starting to become famous in the town.
They have already ordered and made n TV commercial videos. Each video is made in a special way: the colors and the soundtra... | instruction | 0 | 8,667 | 4 | 17,334 |
No | output | 1 | 8,667 | 4 | 17,335 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Unlucky year in Berland is such a year that its number n can be represented as n = xa + yb, where a and b are non-negative integer numbers.
For example, if x = 2 and y = 3 then the years 4 and 17 are unlucky (4 = 20 + 31, 17 = 23 + 32 = 24... | instruction | 0 | 9,577 | 4 | 19,154 |
Tags: brute force, math
Correct Solution:
```
p = range(61)
x,y,l,r = map(int,input().split())
a = [l-1,r+1]
for i in [ x**i for i in p if x**i <= r]:
for j in [ y**i for i in p if y**i <= r-i]:
if i+j >= l and i+j <= r:
a.append(i+j)
a.sort()
ans = 0
for i in range(1,len(a)):
ans = max(an... | output | 1 | 9,577 | 4 | 19,155 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Unlucky year in Berland is such a year that its number n can be represented as n = xa + yb, where a and b are non-negative integer numbers.
For example, if x = 2 and y = 3 then the years 4 and 17 are unlucky (4 = 20 + 31, 17 = 23 + 32 = 24... | instruction | 0 | 9,578 | 4 | 19,156 |
Tags: brute force, math
Correct Solution:
```
from math import log, ceil
x, y, l, r = [int(i) for i in input().split()]
ans = 0
nm = ceil(log(r, x)) + 2
mm = ceil(log(r, y)) + 2
v = [l - 1, r + 1]
for n in range(nm):
for m in range(mm):
cur = x ** n + y ** m
if cur < l or cur > r:
con... | output | 1 | 9,578 | 4 | 19,157 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Unlucky year in Berland is such a year that its number n can be represented as n = xa + yb, where a and b are non-negative integer numbers.
For example, if x = 2 and y = 3 then the years 4 and 17 are unlucky (4 = 20 + 31, 17 = 23 + 32 = 24... | instruction | 0 | 9,579 | 4 | 19,158 |
Tags: brute force, math
Correct Solution:
```
x,y,lo,h = list(map(int,input().strip().split(' ')))
p = 1
q = 1
l = []
l.append(lo-1)
l.append(h+1)
while p<h :
q = 1
while q < h :
if lo<= p+q and p+q<= h :
l.append(p+q)
q*=y
p*=x
max = 0
l.sort()
for i in range(1,len(l)) :
if ... | output | 1 | 9,579 | 4 | 19,159 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Unlucky year in Berland is such a year that its number n can be represented as n = xa + yb, where a and b are non-negative integer numbers.
For example, if x = 2 and y = 3 then the years 4 and 17 are unlucky (4 = 20 + 31, 17 = 23 + 32 = 24... | instruction | 0 | 9,580 | 4 | 19,160 |
Tags: brute force, math
Correct Solution:
```
# Contest: Educational Codeforces Round 22 (https://codeforces.com/contest/813)
# Problem: B: The Golden Age (https://codeforces.com/contest/813/problem/B)
def rint():
return int(input())
def rints():
return list(map(int, input().split()))
x, y, l, r = rints()
... | output | 1 | 9,580 | 4 | 19,161 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Unlucky year in Berland is such a year that its number n can be represented as n = xa + yb, where a and b are non-negative integer numbers.
For example, if x = 2 and y = 3 then the years 4 and 17 are unlucky (4 = 20 + 31, 17 = 23 + 32 = 24... | instruction | 0 | 9,581 | 4 | 19,162 |
Tags: brute force, math
Correct Solution:
```
x, y, l, r = list(map(int, input().strip().split(" ")))
cx = 1
cy = 1
v = []
while True:
if cx > r:
break
cy = 1
while True:
if cx + cy > r:
break
if cx + cy >= l:
v.append(cx + cy)
cy = cy * y
cx = cx... | output | 1 | 9,581 | 4 | 19,163 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.