message stringlengths 2 57.2k | message_type stringclasses 2
values | message_id int64 0 1 | conversation_id int64 61 108k | cluster float64 22 22 | __index_level_0__ int64 122 217k |
|---|---|---|---|---|---|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Greatest common divisor GCD(a, b) of two positive integers a and b is equal to the biggest integer d such that both integers a and b are divisible by d. There are many efficient algorithms to fi... | instruction | 0 | 74,612 | 22 | 149,224 |
Yes | output | 1 | 74,612 | 22 | 149,225 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Greatest common divisor GCD(a, b) of two positive integers a and b is equal to the biggest integer d such that both integers a and b are divisible by d. There are many efficient algorithms to fi... | instruction | 0 | 74,613 | 22 | 149,226 |
Yes | output | 1 | 74,613 | 22 | 149,227 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Greatest common divisor GCD(a, b) of two positive integers a and b is equal to the biggest integer d such that both integers a and b are divisible by d. There are many efficient algorithms to fi... | instruction | 0 | 74,614 | 22 | 149,228 |
Yes | output | 1 | 74,614 | 22 | 149,229 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Greatest common divisor GCD(a, b) of two positive integers a and b is equal to the biggest integer d such that both integers a and b are divisible by d. There are many efficient algorithms to fi... | instruction | 0 | 74,615 | 22 | 149,230 |
Yes | output | 1 | 74,615 | 22 | 149,231 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Greatest common divisor GCD(a, b) of two positive integers a and b is equal to the biggest integer d such that both integers a and b are divisible by d. There are many efficient algorithms to fi... | instruction | 0 | 74,616 | 22 | 149,232 |
No | output | 1 | 74,616 | 22 | 149,233 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Greatest common divisor GCD(a, b) of two positive integers a and b is equal to the biggest integer d such that both integers a and b are divisible by d. There are many efficient algorithms to fi... | instruction | 0 | 74,617 | 22 | 149,234 |
No | output | 1 | 74,617 | 22 | 149,235 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Greatest common divisor GCD(a, b) of two positive integers a and b is equal to the biggest integer d such that both integers a and b are divisible by d. There are many efficient algorithms to fi... | instruction | 0 | 74,618 | 22 | 149,236 |
No | output | 1 | 74,618 | 22 | 149,237 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Greatest common divisor GCD(a, b) of two positive integers a and b is equal to the biggest integer d such that both integers a and b are divisible by d. There are many efficient algorithms to fi... | instruction | 0 | 74,619 | 22 | 149,238 |
No | output | 1 | 74,619 | 22 | 149,239 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Today Pari and Arya are playing a game called Remainders.
Pari chooses two positive integer x and k, and tells Arya k but not x. Arya have to find the value <image>. There are n ancient numbers c1, c2, ..., cn and Pari has to tell Arya <ima... | instruction | 0 | 74,620 | 22 | 149,240 |
Tags: chinese remainder theorem, math, number theory
Correct Solution:
```
#prime factorize the k
import math
a=input().split(' ')
n=int(a[0])
k=int(a[1])
t=True
def gcd(a, b):
if b==0: return a
else: return gcd(b, a%b)
C=set(map(int, input().split()))
Composite=False
a=math.floor(math.sqrt(k+1))
if k%2==0: Compos... | output | 1 | 74,620 | 22 | 149,241 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Today Pari and Arya are playing a game called Remainders.
Pari chooses two positive integer x and k, and tells Arya k but not x. Arya have to find the value <image>. There are n ancient numbers c1, c2, ..., cn and Pari has to tell Arya <ima... | instruction | 0 | 74,621 | 22 | 149,242 |
Tags: chinese remainder theorem, math, number theory
Correct Solution:
```
from math import *
n,k=map(int,input().split())
arr=list(map(int,input().split()))
flag=0
if(k==1):
print('Yes')
else:
arr1=[]
temp=k
for i in range(2,k+1):
if(temp%i==0):
cnt=0
while(temp%i==0):
... | output | 1 | 74,621 | 22 | 149,243 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Today Pari and Arya are playing a game called Remainders.
Pari chooses two positive integer x and k, and tells Arya k but not x. Arya have to find the value <image>. There are n ancient numbers... | instruction | 0 | 74,622 | 22 | 149,244 |
No | output | 1 | 74,622 | 22 | 149,245 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Today Pari and Arya are playing a game called Remainders.
Pari chooses two positive integer x and k, and tells Arya k but not x. Arya have to find the value <image>. There are n ancient numbers... | instruction | 0 | 74,623 | 22 | 149,246 |
No | output | 1 | 74,623 | 22 | 149,247 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Today Pari and Arya are playing a game called Remainders.
Pari chooses two positive integer x and k, and tells Arya k but not x. Arya have to find the value <image>. There are n ancient numbers... | instruction | 0 | 74,624 | 22 | 149,248 |
No | output | 1 | 74,624 | 22 | 149,249 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Today Pari and Arya are playing a game called Remainders.
Pari chooses two positive integer x and k, and tells Arya k but not x. Arya have to find the value <image>. There are n ancient numbers... | instruction | 0 | 74,625 | 22 | 149,250 |
No | output | 1 | 74,625 | 22 | 149,251 |
Provide tags and a correct Python 3 solution for this coding contest problem.
In a dream Marco met an elderly man with a pair of black glasses. The man told him the key to immortality and then disappeared with the wind of time.
When he woke up, he only remembered that the key was a sequence of positive integers of so... | instruction | 0 | 74,706 | 22 | 149,412 |
Tags: constructive algorithms, math
Correct Solution:
```
from math import gcd
n=int(input())
l=[int(x) for x in input().split()]
for i in range(n):
if l[i]%l[0]:
print("-1")
exit(0)
print(2*n)
for i in range(n):
print(l[0],l[i],end=" ")
``` | output | 1 | 74,706 | 22 | 149,413 |
Provide tags and a correct Python 3 solution for this coding contest problem.
In a dream Marco met an elderly man with a pair of black glasses. The man told him the key to immortality and then disappeared with the wind of time.
When he woke up, he only remembered that the key was a sequence of positive integers of so... | instruction | 0 | 74,707 | 22 | 149,414 |
Tags: constructive algorithms, math
Correct Solution:
```
from collections import defaultdict,deque
import sys
import bisect
input=sys.stdin.readline
n=int(input())
hcf=[int(i) for i in input().split() if i!='\n']
ans=[]
if n==1:
print(1)
print(hcf[0])
else:
for i in range(1,n):
if hcf[i]%hcf[0]!=... | output | 1 | 74,707 | 22 | 149,415 |
Provide tags and a correct Python 3 solution for this coding contest problem.
In a dream Marco met an elderly man with a pair of black glasses. The man told him the key to immortality and then disappeared with the wind of time.
When he woke up, he only remembered that the key was a sequence of positive integers of so... | instruction | 0 | 74,708 | 22 | 149,416 |
Tags: constructive algorithms, math
Correct Solution:
```
def gcd(a,b):
if a < b:
return gcd(b,a)
if a == b:
return a
if b == 0:
return a
return gcd(a%b,b)
def gcd_group(a,s):
if s == 1:
return a[0]
if s == 2:
return gcd(a[0],a[1])
return gcd(gcd_group... | output | 1 | 74,708 | 22 | 149,417 |
Provide tags and a correct Python 3 solution for this coding contest problem.
In a dream Marco met an elderly man with a pair of black glasses. The man told him the key to immortality and then disappeared with the wind of time.
When he woke up, he only remembered that the key was a sequence of positive integers of so... | instruction | 0 | 74,709 | 22 | 149,418 |
Tags: constructive algorithms, math
Correct Solution:
```
m = int(input())
s = list(map(int,input().split(' ')))
fl = True
for i in range(1,m):
if s[i]%s[0]:
fl = False
break
if not fl:
print(-1)
else:
print(m*2)
for i in range(m):
print(s[i],s[0],end=' ')
``` | output | 1 | 74,709 | 22 | 149,419 |
Provide tags and a correct Python 3 solution for this coding contest problem.
In a dream Marco met an elderly man with a pair of black glasses. The man told him the key to immortality and then disappeared with the wind of time.
When he woke up, he only remembered that the key was a sequence of positive integers of so... | instruction | 0 | 74,710 | 22 | 149,420 |
Tags: constructive algorithms, math
Correct Solution:
```
def gcd(a,b):
if(b==0):
return a
else:
return gcd(b,a%b)
n=int(input())
a=list(map(int,input().split()))
gcd1=a[0]
for i in range(1,n):
gcd1=gcd(gcd1,a[i])
if gcd1 not in a:
print(-1)
else:
s=''
for i in range(n):
... | output | 1 | 74,710 | 22 | 149,421 |
Provide tags and a correct Python 3 solution for this coding contest problem.
In a dream Marco met an elderly man with a pair of black glasses. The man told him the key to immortality and then disappeared with the wind of time.
When he woke up, he only remembered that the key was a sequence of positive integers of so... | instruction | 0 | 74,711 | 22 | 149,422 |
Tags: constructive algorithms, math
Correct Solution:
```
def gcd(a, b):
if b==0:
return a
return gcd(b, a%b)
def solve(a):
if len(a) == 1:
return 1, str(a[0])
d = {x: 1 for x in a}
arr = []
g_ = a[0]
for x in a[1:]:
g_ = gcd(g_, x)
if g_ n... | output | 1 | 74,711 | 22 | 149,423 |
Provide tags and a correct Python 3 solution for this coding contest problem.
In a dream Marco met an elderly man with a pair of black glasses. The man told him the key to immortality and then disappeared with the wind of time.
When he woke up, he only remembered that the key was a sequence of positive integers of so... | instruction | 0 | 74,712 | 22 | 149,424 |
Tags: constructive algorithms, math
Correct Solution:
```
from math import gcd
m=int(input())
s=sorted(list(map(int,input().split())))
a=0
for e in s:a=gcd(a,e)
if(a!=s[0]):
print(-1)
else:
print(2*m-1)
v=[0]*(2*m-1)
for i in range(2*m-1):
if(i%2==0):
v[i]=s[i//2]
else: v[i]=... | output | 1 | 74,712 | 22 | 149,425 |
Provide tags and a correct Python 3 solution for this coding contest problem.
In a dream Marco met an elderly man with a pair of black glasses. The man told him the key to immortality and then disappeared with the wind of time.
When he woke up, he only remembered that the key was a sequence of positive integers of so... | instruction | 0 | 74,713 | 22 | 149,426 |
Tags: constructive algorithms, math
Correct Solution:
```
n = int(input())
s = input().split()
i = list(map(int, s))
if all(map(lambda x: x % i[0] == 0, i)):
ans = str(2 * n - 1) + "\n"
ans += (" " + s[0] + " ").join(s)
else:
ans = -1
print(ans)
``` | output | 1 | 74,713 | 22 | 149,427 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In a dream Marco met an elderly man with a pair of black glasses. The man told him the key to immortality and then disappeared with the wind of time.
When he woke up, he only remembered that th... | instruction | 0 | 74,714 | 22 | 149,428 |
Yes | output | 1 | 74,714 | 22 | 149,429 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In a dream Marco met an elderly man with a pair of black glasses. The man told him the key to immortality and then disappeared with the wind of time.
When he woke up, he only remembered that th... | instruction | 0 | 74,715 | 22 | 149,430 |
Yes | output | 1 | 74,715 | 22 | 149,431 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In a dream Marco met an elderly man with a pair of black glasses. The man told him the key to immortality and then disappeared with the wind of time.
When he woke up, he only remembered that th... | instruction | 0 | 74,716 | 22 | 149,432 |
Yes | output | 1 | 74,716 | 22 | 149,433 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In a dream Marco met an elderly man with a pair of black glasses. The man told him the key to immortality and then disappeared with the wind of time.
When he woke up, he only remembered that th... | instruction | 0 | 74,717 | 22 | 149,434 |
Yes | output | 1 | 74,717 | 22 | 149,435 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In a dream Marco met an elderly man with a pair of black glasses. The man told him the key to immortality and then disappeared with the wind of time.
When he woke up, he only remembered that th... | instruction | 0 | 74,718 | 22 | 149,436 |
No | output | 1 | 74,718 | 22 | 149,437 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In a dream Marco met an elderly man with a pair of black glasses. The man told him the key to immortality and then disappeared with the wind of time.
When he woke up, he only remembered that th... | instruction | 0 | 74,719 | 22 | 149,438 |
No | output | 1 | 74,719 | 22 | 149,439 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In a dream Marco met an elderly man with a pair of black glasses. The man told him the key to immortality and then disappeared with the wind of time.
When he woke up, he only remembered that th... | instruction | 0 | 74,720 | 22 | 149,440 |
No | output | 1 | 74,720 | 22 | 149,441 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In a dream Marco met an elderly man with a pair of black glasses. The man told him the key to immortality and then disappeared with the wind of time.
When he woke up, he only remembered that th... | instruction | 0 | 74,721 | 22 | 149,442 |
No | output | 1 | 74,721 | 22 | 149,443 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Nastia has 2 positive integers A and B. She defines that:
* The integer is good if it is divisible by A β
B;
* Otherwise, the integer is nearly good, if it is divisible by A.
For example, if A = 6 and B = 4, the integers 24 and 72 ... | instruction | 0 | 75,271 | 22 | 150,542 |
Tags: constructive algorithms, math, number theory
Correct Solution:
```
"""
inp_start
3
5 3
13 2
7 11
inp_end
"""
tcs = int(input())
for tc in range(tcs):
x, y = list(map(int, input().split()))
if y==1:
print("NO")
continue
print("YES")
a, b, c = 1, y-1, 1
if y==2:
a, b, c = 1, 3, 2
print(x*a, x*b, x*y*c... | output | 1 | 75,271 | 22 | 150,543 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Nastia has 2 positive integers A and B. She defines that:
* The integer is good if it is divisible by A β
B;
* Otherwise, the integer is nearly good, if it is divisible by A.
For example, if A = 6 and B = 4, the integers 24 and 72 ... | instruction | 0 | 75,272 | 22 | 150,544 |
Tags: constructive algorithms, math, number theory
Correct Solution:
```
t = int(input())
for _ in range(t):
a,b = map(int,input().split())
if b == 1:
print("NO")
continue
if b==2:
b = 4
tmp = a*b
print("YES")
tmp1 = a
tmp2 = a*(b-1)
print(tmp1,tmp2,tmp)
``` | output | 1 | 75,272 | 22 | 150,545 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Nastia has 2 positive integers A and B. She defines that:
* The integer is good if it is divisible by A β
B;
* Otherwise, the integer is nearly good, if it is divisible by A.
For example, if A = 6 and B = 4, the integers 24 and 72 ... | instruction | 0 | 75,273 | 22 | 150,546 |
Tags: constructive algorithms, math, number theory
Correct Solution:
```
t=int(input())
for i in range(t):
a,b=map(int,input().split())
x=0
y=0
z=0
if b==1:
print('NO')
else:
x=a
y=a*b
z=x+y
print("YES")
print(x,y,z)
``` | output | 1 | 75,273 | 22 | 150,547 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Nastia has 2 positive integers A and B. She defines that:
* The integer is good if it is divisible by A β
B;
* Otherwise, the integer is nearly good, if it is divisible by A.
For example, if A = 6 and B = 4, the integers 24 and 72 ... | instruction | 0 | 75,274 | 22 | 150,548 |
Tags: constructive algorithms, math, number theory
Correct Solution:
```
import sys
import time
import itertools
import math
def inp():
ln = input().split()
return int(ln[0]) if len(ln) == 1 else [int(i) for i in ln]
def prl(x):
print(' '.join([str(i) for i in x]))
# Problem A
testcases = inp()
for tes... | output | 1 | 75,274 | 22 | 150,549 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Nastia has 2 positive integers A and B. She defines that:
* The integer is good if it is divisible by A β
B;
* Otherwise, the integer is nearly good, if it is divisible by A.
For example, if A = 6 and B = 4, the integers 24 and 72 ... | instruction | 0 | 75,275 | 22 | 150,550 |
Tags: constructive algorithms, math, number theory
Correct Solution:
```
import math
for _ in range(int(input())):
n,m=map(int,input().split())
ans=n*m
ans1=n*(m-1)
ans2=n*1
if ans1+ans2==ans and ans1>0 and ans2>0 and ans>0:
if ans1==ans2:
print("YES")
... | output | 1 | 75,275 | 22 | 150,551 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Nastia has 2 positive integers A and B. She defines that:
* The integer is good if it is divisible by A β
B;
* Otherwise, the integer is nearly good, if it is divisible by A.
For example, if A = 6 and B = 4, the integers 24 and 72 ... | instruction | 0 | 75,276 | 22 | 150,552 |
Tags: constructive algorithms, math, number theory
Correct Solution:
```
for _ in range(int(input())):
A, B = map(int, input().split())
if B == 1:
print('NO')
else:
print('YES')
print(A, A*B, A*(B+1))
``` | output | 1 | 75,276 | 22 | 150,553 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Nastia has 2 positive integers A and B. She defines that:
* The integer is good if it is divisible by A β
B;
* Otherwise, the integer is nearly good, if it is divisible by A.
For example, if A = 6 and B = 4, the integers 24 and 72 ... | instruction | 0 | 75,277 | 22 | 150,554 |
Tags: constructive algorithms, math, number theory
Correct Solution:
```
import heapq,math
from collections import defaultdict,deque
import sys, os.path
#sys.setrecursionlimit(1000000)
if(os.path.exists('C:/Users/Dhanush/Desktop/cp/input.txt')):
sys.stdout = open('C:/Users/Dhanush/Desktop/cp/output.txt', 'w')
... | output | 1 | 75,277 | 22 | 150,555 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Nastia has 2 positive integers A and B. She defines that:
* The integer is good if it is divisible by A β
B;
* Otherwise, the integer is nearly good, if it is divisible by A.
For example, if A = 6 and B = 4, the integers 24 and 72 ... | instruction | 0 | 75,278 | 22 | 150,556 |
Tags: constructive algorithms, math, number theory
Correct Solution:
```
for nt in range(int(input())):
A,B = map(int,input().split())
if B == 1:
print("NO")
continue
print("YES")
print(A*(B-1),A*(B+1),2*A*B)
``` | output | 1 | 75,278 | 22 | 150,557 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Nastia has 2 positive integers A and B. She defines that:
* The integer is good if it is divisible by A β
B;
* Otherwise, the integer is nearly good, if it is divisible by A.
For examp... | instruction | 0 | 75,279 | 22 | 150,558 |
Yes | output | 1 | 75,279 | 22 | 150,559 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Nastia has 2 positive integers A and B. She defines that:
* The integer is good if it is divisible by A β
B;
* Otherwise, the integer is nearly good, if it is divisible by A.
For examp... | instruction | 0 | 75,280 | 22 | 150,560 |
Yes | output | 1 | 75,280 | 22 | 150,561 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Nastia has 2 positive integers A and B. She defines that:
* The integer is good if it is divisible by A β
B;
* Otherwise, the integer is nearly good, if it is divisible by A.
For examp... | instruction | 0 | 75,281 | 22 | 150,562 |
Yes | output | 1 | 75,281 | 22 | 150,563 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Nastia has 2 positive integers A and B. She defines that:
* The integer is good if it is divisible by A β
B;
* Otherwise, the integer is nearly good, if it is divisible by A.
For examp... | instruction | 0 | 75,282 | 22 | 150,564 |
Yes | output | 1 | 75,282 | 22 | 150,565 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Nastia has 2 positive integers A and B. She defines that:
* The integer is good if it is divisible by A β
B;
* Otherwise, the integer is nearly good, if it is divisible by A.
For examp... | instruction | 0 | 75,283 | 22 | 150,566 |
No | output | 1 | 75,283 | 22 | 150,567 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Nastia has 2 positive integers A and B. She defines that:
* The integer is good if it is divisible by A β
B;
* Otherwise, the integer is nearly good, if it is divisible by A.
For examp... | instruction | 0 | 75,284 | 22 | 150,568 |
No | output | 1 | 75,284 | 22 | 150,569 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Nastia has 2 positive integers A and B. She defines that:
* The integer is good if it is divisible by A β
B;
* Otherwise, the integer is nearly good, if it is divisible by A.
For examp... | instruction | 0 | 75,285 | 22 | 150,570 |
No | output | 1 | 75,285 | 22 | 150,571 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Nastia has 2 positive integers A and B. She defines that:
* The integer is good if it is divisible by A β
B;
* Otherwise, the integer is nearly good, if it is divisible by A.
For examp... | instruction | 0 | 75,286 | 22 | 150,572 |
No | output | 1 | 75,286 | 22 | 150,573 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A number is called almost prime if it has exactly two distinct prime divisors. For example, numbers 6, 18, 24 are almost prime, while 4, 8, 9, 42 are not. Find the amount of almost prime numbers which are between 1 and n, inclusive.
Input
... | instruction | 0 | 75,337 | 22 | 150,674 |
Tags: number theory
Correct Solution:
```
"""
https://codeforces.com/problemset/problem/26/A
"""
def prime_factors(n):
i = 2
factors = []
while i * i <= n:
if n % i:
i += 1
else:
n //= i
factors.append(i)
if n > 1:
factors.append(n)
return... | output | 1 | 75,337 | 22 | 150,675 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A number is called almost prime if it has exactly two distinct prime divisors. For example, numbers 6, 18, 24 are almost prime, while 4, 8, 9, 42 are not. Find the amount of almost prime numbers which are between 1 and n, inclusive.
Input
... | instruction | 0 | 75,338 | 22 | 150,676 |
Tags: number theory
Correct Solution:
```
PRIMES = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107,
109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229,
233, 239, 241, 251, 257, 26... | output | 1 | 75,338 | 22 | 150,677 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A number is called almost prime if it has exactly two distinct prime divisors. For example, numbers 6, 18, 24 are almost prime, while 4, 8, 9, 42 are not. Find the amount of almost prime numbers which are between 1 and n, inclusive.
Input
... | instruction | 0 | 75,339 | 22 | 150,678 |
Tags: number theory
Correct Solution:
```
def isprime(num):
p=True
for i in range(1, num):
if num%i==0 and i!=1:
p=False
return p
def dprime(a):
c=0
b=False
for i in range(2, a):
if a%i==0 and isprime(i)==True :
c+=1
if c==2:
b=True
return... | output | 1 | 75,339 | 22 | 150,679 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A number is called almost prime if it has exactly two distinct prime divisors. For example, numbers 6, 18, 24 are almost prime, while 4, 8, 9, 42 are not. Find the amount of almost prime numbers which are between 1 and n, inclusive.
Input
... | instruction | 0 | 75,340 | 22 | 150,680 |
Tags: number theory
Correct Solution:
```
def is_prime(n) :
if n == 1:
return False
if n in [2,3,5,7]:
return True
if n% 2 == 0 :
return False
r = 3
while r * r <= n:
if n % r == 0:
return False
r += 2
return True
limit = int(input())
def lowerDivisors(num) :
return [i for i ... | output | 1 | 75,340 | 22 | 150,681 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.