message stringlengths 2 48.6k | message_type stringclasses 2
values | message_id int64 0 1 | conversation_id int64 318 108k | cluster float64 8 8 | __index_level_0__ int64 636 217k |
|---|---|---|---|---|---|
Provide tags and a correct Python 3 solution for this coding contest problem.
[Sakuzyo - Imprinting](https://www.youtube.com/watch?v=55Ca6av1kAY)
A.R.C. Markland-N is a tall building with n floors numbered from 1 to n. Between each two adjacent floors in the building, there is a staircase connecting them.
It's lunch... | instruction | 0 | 41,370 | 8 | 82,740 |
Tags: binary search, brute force, implementation
Correct Solution:
```
n = int(input())
for i in range(n):
ans = 0
a, r, c = list(map(int, input().strip().split()))
renewing = set(list(map(int, input().strip().split())))
down = up = r
if r not in renewing:
print(ans)
else:
whi... | output | 1 | 41,370 | 8 | 82,741 |
Provide tags and a correct Python 3 solution for this coding contest problem.
[Sakuzyo - Imprinting](https://www.youtube.com/watch?v=55Ca6av1kAY)
A.R.C. Markland-N is a tall building with n floors numbered from 1 to n. Between each two adjacent floors in the building, there is a staircase connecting them.
It's lunch... | instruction | 0 | 41,371 | 8 | 82,742 |
Tags: binary search, brute force, implementation
Correct Solution:
```
def solve(f, n, s, k):
for i in range(n):
if s - i >= 0 and s - i + 1 not in f:
return i
if s + i < n and s + i + 1 not in f:
return i
for _ in range(int(input())):
n, s, k = map(int, input().split()... | output | 1 | 41,371 | 8 | 82,743 |
Provide tags and a correct Python 3 solution for this coding contest problem.
[Sakuzyo - Imprinting](https://www.youtube.com/watch?v=55Ca6av1kAY)
A.R.C. Markland-N is a tall building with n floors numbered from 1 to n. Between each two adjacent floors in the building, there is a staircase connecting them.
It's lunch... | instruction | 0 | 41,372 | 8 | 82,744 |
Tags: binary search, brute force, implementation
Correct Solution:
```
# cook your dish here
for _ in range(int(input())):
n, s, k = map(int, input().split())
rs = list(map(int, input().split()))
d = {}
for i in range(k):
d[rs[i]] = 1
i = 0
while 1:
if ((s+i <= n an... | output | 1 | 41,372 | 8 | 82,745 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
[Sakuzyo - Imprinting](https://www.youtube.com/watch?v=55Ca6av1kAY)
A.R.C. Markland-N is a tall building with n floors numbered from 1 to n. Between each two adjacent floors in the building, th... | instruction | 0 | 41,373 | 8 | 82,746 |
Yes | output | 1 | 41,373 | 8 | 82,747 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
[Sakuzyo - Imprinting](https://www.youtube.com/watch?v=55Ca6av1kAY)
A.R.C. Markland-N is a tall building with n floors numbered from 1 to n. Between each two adjacent floors in the building, th... | instruction | 0 | 41,374 | 8 | 82,748 |
Yes | output | 1 | 41,374 | 8 | 82,749 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
[Sakuzyo - Imprinting](https://www.youtube.com/watch?v=55Ca6av1kAY)
A.R.C. Markland-N is a tall building with n floors numbered from 1 to n. Between each two adjacent floors in the building, th... | instruction | 0 | 41,375 | 8 | 82,750 |
Yes | output | 1 | 41,375 | 8 | 82,751 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
[Sakuzyo - Imprinting](https://www.youtube.com/watch?v=55Ca6av1kAY)
A.R.C. Markland-N is a tall building with n floors numbered from 1 to n. Between each two adjacent floors in the building, th... | instruction | 0 | 41,376 | 8 | 82,752 |
Yes | output | 1 | 41,376 | 8 | 82,753 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
[Sakuzyo - Imprinting](https://www.youtube.com/watch?v=55Ca6av1kAY)
A.R.C. Markland-N is a tall building with n floors numbered from 1 to n. Between each two adjacent floors in the building, th... | instruction | 0 | 41,377 | 8 | 82,754 |
No | output | 1 | 41,377 | 8 | 82,755 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
[Sakuzyo - Imprinting](https://www.youtube.com/watch?v=55Ca6av1kAY)
A.R.C. Markland-N is a tall building with n floors numbered from 1 to n. Between each two adjacent floors in the building, th... | instruction | 0 | 41,378 | 8 | 82,756 |
No | output | 1 | 41,378 | 8 | 82,757 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
[Sakuzyo - Imprinting](https://www.youtube.com/watch?v=55Ca6av1kAY)
A.R.C. Markland-N is a tall building with n floors numbered from 1 to n. Between each two adjacent floors in the building, th... | instruction | 0 | 41,379 | 8 | 82,758 |
No | output | 1 | 41,379 | 8 | 82,759 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
[Sakuzyo - Imprinting](https://www.youtube.com/watch?v=55Ca6av1kAY)
A.R.C. Markland-N is a tall building with n floors numbered from 1 to n. Between each two adjacent floors in the building, th... | instruction | 0 | 41,380 | 8 | 82,760 |
No | output | 1 | 41,380 | 8 | 82,761 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is an interactive problem.
Baby Ehab loves crawling around his apartment. It has n rooms numbered from 0 to n-1. For every pair of rooms, a and b, there's either a direct passage from room... | instruction | 0 | 41,492 | 8 | 82,984 |
No | output | 1 | 41,492 | 8 | 82,985 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is an interactive problem.
Baby Ehab loves crawling around his apartment. It has n rooms numbered from 0 to n-1. For every pair of rooms, a and b, there's either a direct passage from room... | instruction | 0 | 41,493 | 8 | 82,986 |
No | output | 1 | 41,493 | 8 | 82,987 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is an interactive problem.
Baby Ehab loves crawling around his apartment. It has n rooms numbered from 0 to n-1. For every pair of rooms, a and b, there's either a direct passage from room... | instruction | 0 | 41,494 | 8 | 82,988 |
No | output | 1 | 41,494 | 8 | 82,989 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is an interactive problem.
Baby Ehab loves crawling around his apartment. It has n rooms numbered from 0 to n-1. For every pair of rooms, a and b, there's either a direct passage from room... | instruction | 0 | 41,495 | 8 | 82,990 |
No | output | 1 | 41,495 | 8 | 82,991 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The prison of your city has n prisoners. As the prison can't accommodate all of them, the city mayor has decided to transfer c of the prisoners to a prison located in another city.
For this rea... | instruction | 0 | 41,586 | 8 | 83,172 |
Yes | output | 1 | 41,586 | 8 | 83,173 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The prison of your city has n prisoners. As the prison can't accommodate all of them, the city mayor has decided to transfer c of the prisoners to a prison located in another city.
For this rea... | instruction | 0 | 41,587 | 8 | 83,174 |
Yes | output | 1 | 41,587 | 8 | 83,175 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The prison of your city has n prisoners. As the prison can't accommodate all of them, the city mayor has decided to transfer c of the prisoners to a prison located in another city.
For this rea... | instruction | 0 | 41,588 | 8 | 83,176 |
Yes | output | 1 | 41,588 | 8 | 83,177 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The prison of your city has n prisoners. As the prison can't accommodate all of them, the city mayor has decided to transfer c of the prisoners to a prison located in another city.
For this rea... | instruction | 0 | 41,589 | 8 | 83,178 |
Yes | output | 1 | 41,589 | 8 | 83,179 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The prison of your city has n prisoners. As the prison can't accommodate all of them, the city mayor has decided to transfer c of the prisoners to a prison located in another city.
For this rea... | instruction | 0 | 41,590 | 8 | 83,180 |
No | output | 1 | 41,590 | 8 | 83,181 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The prison of your city has n prisoners. As the prison can't accommodate all of them, the city mayor has decided to transfer c of the prisoners to a prison located in another city.
For this rea... | instruction | 0 | 41,591 | 8 | 83,182 |
No | output | 1 | 41,591 | 8 | 83,183 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The prison of your city has n prisoners. As the prison can't accommodate all of them, the city mayor has decided to transfer c of the prisoners to a prison located in another city.
For this rea... | instruction | 0 | 41,592 | 8 | 83,184 |
No | output | 1 | 41,592 | 8 | 83,185 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The prison of your city has n prisoners. As the prison can't accommodate all of them, the city mayor has decided to transfer c of the prisoners to a prison located in another city.
For this rea... | instruction | 0 | 41,593 | 8 | 83,186 |
No | output | 1 | 41,593 | 8 | 83,187 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Mike has a frog and a flower. His frog is named Xaniar and his flower is named Abol. Initially(at time 0), height of Xaniar is h1 and height of Abol is h2. Each second, Mike waters Abol and Xaniar.
<image>
So, if height of Xaniar is h1 and... | instruction | 0 | 41,626 | 8 | 83,252 |
Tags: brute force, greedy, implementation, math
Correct Solution:
```
mod = int(input())
h1, a1 = map(int, input().split())
x1, y1 = map(int, input().split())
h2, a2 = map(int, input().split())
x2, y2 = map(int, input().split())
q1 = 0
while h1 != a1:
h1 = (h1 * x1 + y1) % mod
q1 += 1
if q1 > 2 * mod:
... | output | 1 | 41,626 | 8 | 83,253 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Mike has a frog and a flower. His frog is named Xaniar and his flower is named Abol. Initially(at time 0), height of Xaniar is h1 and height of Abol is h2. Each second, Mike waters Abol and Xaniar.
<image>
So, if height of Xaniar is h1 and... | instruction | 0 | 41,627 | 8 | 83,254 |
Tags: brute force, greedy, implementation, math
Correct Solution:
```
from fractions import *
f = lambda: map(int, input().split())
m = int(input())
def g(u, v):
h, a = u
x, y = v
s = 0
while h != a:
h = (h * x + y) % m
s += 1
if s > m: break
h = (a * x + y) % m
d = 1
... | output | 1 | 41,627 | 8 | 83,255 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Mike has a frog and a flower. His frog is named Xaniar and his flower is named Abol. Initially(at time 0), height of Xaniar is h1 and height of Abol is h2. Each second, Mike waters Abol and Xaniar.
<image>
So, if height of Xaniar is h1 and... | instruction | 0 | 41,629 | 8 | 83,258 |
Tags: brute force, greedy, implementation, math
Correct Solution:
```
__author__ = 'kitkat'
import sys
def GetNext(h, x, y):
global m
return (x * h + y) % m
try:
while True:
m = int(input())
h1, a1 = map(int, input().split(" "))
x1, y1 = map(int, input().split(" "))
h2, a2... | output | 1 | 41,629 | 8 | 83,259 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Mike has a frog and a flower. His frog is named Xaniar and his flower is named Abol. Initially(at time 0), height of Xaniar is h1 and height of Abol is h2. Each second, Mike waters Abol and Xaniar.
<image>
So, if height of Xaniar is h1 and... | instruction | 0 | 41,630 | 8 | 83,260 |
Tags: brute force, greedy, implementation, math
Correct Solution:
```
f = lambda: map(int, input().split())
m = int(input())
def g():
h, a = f()
x, y = f()
t = lambda: (h * x + y) % m
s, d = 0, 1
while h != a:
h = t()
s += 1
if s > m:
print(-1)
exit... | output | 1 | 41,630 | 8 | 83,261 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Mike has a frog and a flower. His frog is named Xaniar and his flower is named Abol. Initially(at time 0), height of Xaniar is h1 and height of Abol is h2. Each second, Mike waters Abol and Xaniar.
<image>
So, if height of Xaniar is h1 and... | instruction | 0 | 41,631 | 8 | 83,262 |
Tags: brute force, greedy, implementation, math
Correct Solution:
```
mod = int(input())
h1, a1 = map(int, input().split())
x1, y1 = map(int, input().split())
h2, a2 = map(int, input().split())
x2, y2 = map(int, input().split())
q1 = 0
while h1 != a1:
h1 = (h1 * x1 + y1) % mod
q1 += 1
if q1 > 2 * mod:
... | output | 1 | 41,631 | 8 | 83,263 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Mike has a frog and a flower. His frog is named Xaniar and his flower is named Abol. Initially(at time 0), height of Xaniar is h1 and height of Abol is h2. Each second, Mike waters Abol and Xaniar.
<image>
So, if height of Xaniar is h1 and... | instruction | 0 | 41,632 | 8 | 83,264 |
Tags: brute force, greedy, implementation, math
Correct Solution:
```
import fractions
def read_data():
m = int(input())
h1, a1 = map(int, input().split())
x1, y1 = map(int, input().split())
h2, a2 = map(int, input().split())
x2, y2 = map(int, input().split())
return m, h1, a1, x1, y1, h2, a2, ... | output | 1 | 41,632 | 8 | 83,265 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day Vitaly was going home late at night and wondering: how many people aren't sleeping at that moment? To estimate, Vitaly decided to look which windows are lit in the house he was passing by at that moment.
Vitaly sees a building of n ... | instruction | 0 | 41,641 | 8 | 83,282 |
Tags: constructive algorithms, implementation
Correct Solution:
```
#n = int(input())
n, m = map(int, input().split())
#s = input()
#c = list(map(int, input().split()))
l = 0
for j in range(n):
c = list(map(int, input().split()))
for i in range(0, 2 * m, 2):
if c[i] or c[i + 1]:
l += 1
print... | output | 1 | 41,641 | 8 | 83,283 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day Vitaly was going home late at night and wondering: how many people aren't sleeping at that moment? To estimate, Vitaly decided to look which windows are lit in the house he was passing by at that moment.
Vitaly sees a building of n ... | instruction | 0 | 41,642 | 8 | 83,284 |
Tags: constructive algorithms, implementation
Correct Solution:
```
r, c = map(int, input().split())
t = 0
for _ in range(r):
l_w = list(map(int, input().split()))
for i in range(len(l_w) // 2):
if l_w[i * 2] == 1 or l_w[i * 2 + 1] == 1:
t += 1
print(t)
``` | output | 1 | 41,642 | 8 | 83,285 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day Vitaly was going home late at night and wondering: how many people aren't sleeping at that moment? To estimate, Vitaly decided to look which windows are lit in the house he was passing by at that moment.
Vitaly sees a building of n ... | instruction | 0 | 41,643 | 8 | 83,286 |
Tags: constructive algorithms, implementation
Correct Solution:
```
(n, m) = [int(i) for i in input().strip().split(' ')]
count = 0
for i in range(n):
l = [int(j) for j in input().strip().split(' ')]
for k in range(0, 2*m, 2):
if l[k] == 1 or l[k+1] == 1:
count += 1
print(count)
``` | output | 1 | 41,643 | 8 | 83,287 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day Vitaly was going home late at night and wondering: how many people aren't sleeping at that moment? To estimate, Vitaly decided to look which windows are lit in the house he was passing by at that moment.
Vitaly sees a building of n ... | instruction | 0 | 41,644 | 8 | 83,288 |
Tags: constructive algorithms, implementation
Correct Solution:
```
"""
IIIIIIIIII OOOOOOOOOOO IIIIIIIIII
II OO OO II
II OO OO II
II OO OO II
II OO OO II
II OO OO II
II OO OO II
IIIIIIIIII OOOOOOOOOOO IIIIIIIIII
... | output | 1 | 41,644 | 8 | 83,289 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day Vitaly was going home late at night and wondering: how many people aren't sleeping at that moment? To estimate, Vitaly decided to look which windows are lit in the house he was passing by at that moment.
Vitaly sees a building of n ... | instruction | 0 | 41,645 | 8 | 83,290 |
Tags: constructive algorithms, implementation
Correct Solution:
```
n,m = map(int, input().split())
ans=0
for i in range(n):
flat=list(map(int,input().split()))
for j in range(m):
if flat[2*j]+flat[2*j+1]>0:
ans+=1
print(ans)
``` | output | 1 | 41,645 | 8 | 83,291 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day Vitaly was going home late at night and wondering: how many people aren't sleeping at that moment? To estimate, Vitaly decided to look which windows are lit in the house he was passing by at that moment.
Vitaly sees a building of n ... | instruction | 0 | 41,646 | 8 | 83,292 |
Tags: constructive algorithms, implementation
Correct Solution:
```
line1 = (input().split(" "))
floors = int(line1[0])
flats_every_floor = int(line1[1])
all_flats = int(line1[0])*int(line1[1])
awake_flats = 0
counter = 0
for floor in range(floors):
line = (input().split(" "))
for flat in range(flats_every_fl... | output | 1 | 41,646 | 8 | 83,293 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day Vitaly was going home late at night and wondering: how many people aren't sleeping at that moment? To estimate, Vitaly decided to look which windows are lit in the house he was passing by at that moment.
Vitaly sees a building of n ... | instruction | 0 | 41,647 | 8 | 83,294 |
Tags: constructive algorithms, implementation
Correct Solution:
```
n, m = map(int, input().split())
m2 = 2*m
count = 0
for i in range(n):
floor = list(map(int, input().split()))
for j in range(0,m2,2):
if floor[j] == 1 or floor[j+1] == 1:
count += 1
print(count)
``` | output | 1 | 41,647 | 8 | 83,295 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day Vitaly was going home late at night and wondering: how many people aren't sleeping at that moment? To estimate, Vitaly decided to look which windows are lit in the house he was passing by at that moment.
Vitaly sees a building of n ... | instruction | 0 | 41,648 | 8 | 83,296 |
Tags: constructive algorithms, implementation
Correct Solution:
```
'''
Author: Sofen Hoque Anonta
'''
import re
import sys
import math
import itertools
import collections
def inputArray(TYPE= int):
return [TYPE(x) for x in input().split()]
def solve():
n, m = inputArray()
cc = 0
for x in range(n):... | output | 1 | 41,648 | 8 | 83,297 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day Vitaly was going home late at night and wondering: how many people aren't sleeping at that moment? To estimate, Vitaly decided to look which windows are lit in the house he was passing b... | instruction | 0 | 41,649 | 8 | 83,298 |
Yes | output | 1 | 41,649 | 8 | 83,299 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day Vitaly was going home late at night and wondering: how many people aren't sleeping at that moment? To estimate, Vitaly decided to look which windows are lit in the house he was passing b... | instruction | 0 | 41,650 | 8 | 83,300 |
Yes | output | 1 | 41,650 | 8 | 83,301 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day Vitaly was going home late at night and wondering: how many people aren't sleeping at that moment? To estimate, Vitaly decided to look which windows are lit in the house he was passing b... | instruction | 0 | 41,651 | 8 | 83,302 |
Yes | output | 1 | 41,651 | 8 | 83,303 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day Vitaly was going home late at night and wondering: how many people aren't sleeping at that moment? To estimate, Vitaly decided to look which windows are lit in the house he was passing b... | instruction | 0 | 41,652 | 8 | 83,304 |
Yes | output | 1 | 41,652 | 8 | 83,305 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day Vitaly was going home late at night and wondering: how many people aren't sleeping at that moment? To estimate, Vitaly decided to look which windows are lit in the house he was passing b... | instruction | 0 | 41,653 | 8 | 83,306 |
No | output | 1 | 41,653 | 8 | 83,307 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day Vitaly was going home late at night and wondering: how many people aren't sleeping at that moment? To estimate, Vitaly decided to look which windows are lit in the house he was passing b... | instruction | 0 | 41,654 | 8 | 83,308 |
No | output | 1 | 41,654 | 8 | 83,309 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day Vitaly was going home late at night and wondering: how many people aren't sleeping at that moment? To estimate, Vitaly decided to look which windows are lit in the house he was passing b... | instruction | 0 | 41,655 | 8 | 83,310 |
No | output | 1 | 41,655 | 8 | 83,311 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day Vitaly was going home late at night and wondering: how many people aren't sleeping at that moment? To estimate, Vitaly decided to look which windows are lit in the house he was passing b... | instruction | 0 | 41,656 | 8 | 83,312 |
No | output | 1 | 41,656 | 8 | 83,313 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The weather is fine today and hence it's high time to climb the nearby pine and enjoy the landscape.
The pine's trunk includes several branches, located one above another and numbered from 2 to y. Some of them (more precise, from 2 to p) ar... | instruction | 0 | 42,615 | 8 | 85,230 |
Tags: brute force, math, number theory
Correct Solution:
```
def is_prime(n,p):
if n%2==0:
return False
r=int(n**0.5)
f=3
while f<=r and f<=p:
if n%f == 0:
return False
f+=2
return True
p,y=map(int,input().split())
for i in range(y,p,-1):
if is_prime(i,p):
... | output | 1 | 42,615 | 8 | 85,231 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The weather is fine today and hence it's high time to climb the nearby pine and enjoy the landscape.
The pine's trunk includes several branches, located one above another and numbered from 2 to y. Some of them (more precise, from 2 to p) ar... | instruction | 0 | 42,616 | 8 | 85,232 |
Tags: brute force, math, number theory
Correct Solution:
```
p, y = map(int, input().split())
for i in range(y, p, -1):
if all(i % j != 0 for j in range(2, min(p, int(i ** .5)) + 1)):
print(i)
exit()
print(-1)
``` | output | 1 | 42,616 | 8 | 85,233 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The weather is fine today and hence it's high time to climb the nearby pine and enjoy the landscape.
The pine's trunk includes several branches, located one above another and numbered from 2 to y. Some of them (more precise, from 2 to p) ar... | instruction | 0 | 42,617 | 8 | 85,234 |
Tags: brute force, math, number theory
Correct Solution:
```
p,y=list(map(int,input().split()))
t=min(p,int(y**.5)+2)
for i in range(y,p,-1):
while t*t>i:t-=1
if not any(i%x==0 for x in range(2,t+1)):
print(i)
exit(0)
print(-1)
``` | output | 1 | 42,617 | 8 | 85,235 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The weather is fine today and hence it's high time to climb the nearby pine and enjoy the landscape.
The pine's trunk includes several branches, located one above another and numbered from 2 to y. Some of them (more precise, from 2 to p) ar... | instruction | 0 | 42,618 | 8 | 85,236 |
Tags: brute force, math, number theory
Correct Solution:
```
import math
p,y=map(int,input().split())
def check(a):
for i in range(2,min(int(math.sqrt(a)),p)+1):
if a%i==0:
return False
return True
while y>p:
if check(y):
print(y)
exit(0)
y=y-1
print(-1)
``` | output | 1 | 42,618 | 8 | 85,237 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The weather is fine today and hence it's high time to climb the nearby pine and enjoy the landscape.
The pine's trunk includes several branches, located one above another and numbered from 2 to y. Some of them (more precise, from 2 to p) ar... | instruction | 0 | 42,619 | 8 | 85,238 |
Tags: brute force, math, number theory
Correct Solution:
```
import math
import sys
import math
def div(p,n) :
list = []
for i in range(1, int(math.sqrt(n) + 1)) :
if (n % i == 0) :
if (n / i == i) :
list.append(i)
else :
list.append(i)
... | output | 1 | 42,619 | 8 | 85,239 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.