description stringlengths 35 9.39k | solution stringlengths 7 465k |
|---|---|
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import math
from collections import defaultdict, Counter, deque
INF = float('inf')
def gcd(a, b):
while b:
a, b = b, a%b
return a
def primeFactor(n):
if n % 2 == 0:
return 2
i = 3
while (i ** 2) <= n:
if n % i == 0:
return i
i += 1
return n
def main():
n = int(input())
num1 = 2
l = math.ceil... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import math
def pf(n):
l =[]
while n % 2 == 0:
l.append(2)
n = n / 2
for i in range(3,int(math.sqrt(n))+1,2):
while n % i== 0:
l.append(i)
n = n / i
if n > 2:
l.append(n)
return l
for _ in range(input()):
n = input()
a = pf(n)
... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | for tin in range(int(input())):
n=int(input())
f=n; k=0;
for i in range(2,int(n**0.5)+1):
if f%i==0 and f//i!=i:
a=i; f=f//i;
for j in range(i+1,int(f**0.5)+1):
if f%j==0 and f//j!=j:
b=j; c=f//j; k=1; print("YES"); print(a,b,c); break;
... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | """
1294C
"""
def inp():
"""
For taking integer inputs.
"""
return(int(input()))
def get_n_ints(n):
"""
For taking List inputs.
"""
result = []
i = 0
while i < n:
val = input().rstrip("\n")
result.append(int(val))
i += 1
return result
def problem(nu... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import math
def prime(n) :
if (n <= 1) :
return False
if (n <= 3) :
return True
if (n % 2 == 0 or n % 3 == 0) :
return False
i = 5
while(i * i <= n) :
if (n % i == 0 or n % (i + 2) == 0) :
return False
i = i + 6
return True
t=int(input... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | t = int(input())
for _ in range(t):
n = int(input())
ans = [-1,-1,-1]
i = 2
now = 0
while i**2 <= n:
if n%i == 0:
ans[now] = i
n//=i
if now == 1:break
now += 1
i += 1
if n >= 2:
ans[2] = n
if ans[1] != -1 and ans[2] == n... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import sys
import bisect as bi
import math
from collections import defaultdict as dd
import heapq
import itertools
input=sys.stdin.readline
from random import randint
##import numpy as np
##sys.setrecursionlimit(10**7)
mo=10**9+7
def cin():
return map(int,sin().split())
def ain():
return list(map(in... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | # cook your dish here
def factor(n):
a=[]
for x in range(2,int(n**.5)+1):
if n%x==0 and (x!=n//x):
a.append([x,n//x])
return a
t=int(input())
while(t):
t=t-1
found=False
n=int(input())
for f in range(2,int(n**.5)+1):
if n%f==0:
j=factor(n//f)
... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import math
t=int(input())
while(t!=0):
t-=1
a=[]
c=0
n=int(input())
j=0
for i in range(2,int(math.sqrt(n))+1):
if(n%i==0):
a.append(i)
n/=i
j=i
break
for i in range(j+1,int(math.sqrt(n))+1):
if(n%i==0):
a.append(i)
... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | from sys import stdin,stdout
def main():
t = int(input())
for z in range(t):
n = int( input() )
i = 2
sw = 1
while i*i<n and sw:
if n%i==0:
j = 2
tmp = n // i
while j*j < tmp and sw:
if tmp%j=... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | t = int(input())
for i in range(t):
n = int(input())
a = 1
for i in range(2,1001):
if n % i == 0:
a = i
break
if a == 1:
print("NO")
continue
n //= a
b = 1
c = 1
for i in range(a+1,int(n**0.5)+1):
if n % i == 0 and i ** 2 != n:
... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import math
t = int(input())
for i in range(t):
n = int(input())
ans = []
for j in range(2, int(math.sqrt(n)) + 1):
if n % j == 0:
ans.append(j)
n //= j
if len(ans) == 2:
ans.append(n)
break
if len(ans) != 3:
print("NO")... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | from sys import stdin
inp = stdin.readline
t = int(inp())
for i in range(t):
n = int(inp())
a = b = 0
for j in range(2, int(n**0.5) + 1):
if n % j == 0:
if a == 0:
a = j
n //= j
elif b == 0:
b = j
n//=j
... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | def else1(N):
for a in range(2, int(N ** (1. / 3)) + 1):
for b in range(a + 1, int((N // a) ** 0.5) + 1):
c = N // a // b
if a * b * c == N and c != a and c != b:
print('YES')
print(a, b, c)
return
else:
print('NO')
def mai... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | def dividened(number,dict1):
for i in range(2,int((number)**(1/2))+1):
if number%i==0 and dict1.get(i)==None:
dict1[i] = 1
return number//i,i,dict1
return 1,number,dict1
for _ in range(int(input())):
number = int(input())
d = []
case= ... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import math
def primeFactors(n):
mm=n+1
d=dict()
count=0
while n % 2 == 0:
count+=1
n = n // 2
if count!=0:
d[2]=count
# print("Intermediate n",n)
for i in range(3,int(math.sqrt(n))+1,2):
icount=0
while n % i== 0:
# print i,
... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | ''' ===============================
-- @uthor : Kaleab Asfaw
-- Handle : kaleabasfaw2010
-- Bio : High-School Student
==============================='''
# Fast IO
import sys
import os
from io import BytesIO, IOBase
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file): s... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | from math import sqrt
def factorize3(n):
f, s = 1, 1
for i in range(2, int(sqrt(n)) + 1):
if n % i == 0:
f = i
n = n // i
break
for i in range(f + 1, int(sqrt(n)) + 1):
if n % i == 0:
s = i
n = n // i
break
if s != n... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | from math import sqrt
t = int(input())
for ti in range(t):
n = int(input())
try:
a = 0
b = 0
c = 0
for i in range(2,int(sqrt(n))+1):
if n % i == 0:
a = i
break
# a is 1st factor
for i in range(2,int(sqrt(n/a))+1):
if int(n/a) % i == 0 and i != a:
b = i
c = int(n/(a*b))
if c ... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | """
NTC here
"""
import sys
inp= sys.stdin.readline
input = lambda : inp().strip()
flush= sys.stdout.flush
# import threading
# sys.setrecursionlimit(10**6)
# threading.stack_size(2**25)
def iin(): return int(input())
def lin(): return list(map(int, input().split()))
# range = xrange
# input = raw_input
def factors(a... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | # A Better (than Naive) Solution to find all divisiors
import math
# method to print the divisors
def printDivisors(n) :
fact = []
# Note that this loop runs till square root
i = 1
while i <= math.sqrt(n):
if (n % i == 0) :
# If divisors are equal, print only one
... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import math
def func(N,x):
val = N**0.5
val = int(val)+1
tem = 0
for i in range(x+1,val):
if(N%i==0):
if(N//i>1 and N//i!=i):
print("YES")
print(x,i,N//i)
tem = 1
break
if(tem==0):
print("NO")
f... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import math
def divisorGenerator(n):
large_divisors = []
for i in range(1, int(math.sqrt(n) + 1)):
if n % i == 0:
yield i
if i*i != n:
large_divisors.append(n / i)
for divisor in reversed(large_divisors):
yield divisor
def solver(k):
divs... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | #include <bits/stdc++.h>
using namespace std;
template <class T>
using minheap = priority_queue<T, vector<T>, greater<T>>;
template <typename T>
void setmax(T& a, T b) {
a = max(a, b);
};
template <typename T>
void setmin(T& a, T b) {
a = min(a, b);
};
int getPow(int a, int b) {
int p = 1;
for (int i = 0; i < b... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | #code by rb
import math
for tt in range(int(input())):
nvar=int(input())
flag=False
for i in range(2,int(math.sqrt(nvar))+1):
if nvar%i==0:
x=i
yy=nvar//i
for j in range(i+1,int(math.sqrt(yy))+1):
if yy%j==0:
y=j
... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | def findprimefactors(n):
l=[]
while(n%2==0):
l.append(2)
n//=2
for i in range(3,int(n**.5)+1,2):
while(n%i==0):
n//=i
l.append(i)
if n>2:
l.append(n)
return l
for _ in range(int(input())):
n=int(input())
k=findprimefactors(n)
... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | for _ in range(int(input())):
n = int(input())
ok = False
c = 2
while not ok and c*c*c <= n:
if n % c != 0:
c += 1
continue
# a * b = n / c
# a > b > c
b = c+1
while not ok and b*b <= (n // c):
if (n // c) % b != 0:
... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | #include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int N = 1000002;
const double PI = 4 * atan(1);
const double eps = 1e-7;
const long long oo = 1e18;
vector<pair<long long, long long> > v;
long long t;
long long n;
int main() {
ios::sync_with_stdio(0);
cin >> t;
while (t--) {
cin... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import math
for _ in range(int(input())):
n = int(input())
d = set()
for i in range(2, int(math.sqrt(n)) + 1):
if len(d) >= 2:
break
if n % i == 0:
d.add(i)
n = n // i
if len(d) < 2 or n == 1 or n in d:
print("NO")
else:
print("YES")
for t in d:
print(t, end = ' ')
print(n) |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | #C. Product of Three Numbers
from math import sqrt,ceil
for _ in range(int(input())):
n = int(input())
uniq = set()
for i in range(2,ceil(sqrt(n))):
if n%i == 0 :
uniq.add(i)
n /= i
break
#print(uniq,sqrt(n))
for i in range(2,ceil(sqrt(n))):
if n%i... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import math
def factors(n):
ret = []
while n % 2 == 0:
ret.append(2)
n = n // 2
for i in range(3, int(math.sqrt(n)) + 1, 2):
while n % i == 0:
ret.append(i)
n = n // i
if n > 2:
ret.append(n)
return ret
for _ in range(int(input())):
n ... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | def div(n):
s = set()
for i in range(2, int(n**.5)+2):
if n % i == 0:
s.add(i)
s.add(n // i)
return s
t = int(input())
for _ in range(t):
n = int(input())
s = list(div(n))
s.sort()
if len(s) > 2:
found = 0
a = b = c = 0
d = len(s)
for i in range(d):
for j in range(i + 1, d):
if n % (s[i] ... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | from collections import defaultdict as dd
def facts(x):
f=set()
for i in range(2,int(x**0.5)+1):
if x%i==0:
f.add(i)
f.add(x//i)
return list(f)
for _ in range(int(input())):
n=int(input())
fac=facts(n)
if len(fac)<3:
print('NO')
else:
have=dd(... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import math
def getnumbers(n):
divisor=[]
while n % 2 == 0:
divisor.append(2),
n = n / 2
# n must be odd at this point
# so a skip of 2 ( i = i + 2) can be used
for i in range(3,int(math.sqrt(n))+1,2):
# while i divides n , print i ad divide ... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | #include <bits/stdc++.h>
using namespace std;
int main() {
long long t, n;
cin >> t;
for (int p = 0; p < t; p++) {
cin >> n;
vector<int> ans;
for (int i = 2; i <= sqrt(n); i++) {
if (ans.size() == 2) break;
if (n % i == 0) {
ans.push_back(i);
n /= i;
}
}
auto ... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import math as m
def divisor(n):
arr=[]
for i in range(2,int(m.sqrt(n))+1):
if n%i==0:
arr.append(i)
return arr
t=int(input())
for _ in range(t):
n=int(input())
temp=divisor(n)
if temp==[]:
print("NO")
else:
a=temp[0]
n=n//temp[0]
temp=div... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | from math import *
t = int(input())
def check(x):
count = 0
flag = 0
for i in range(2,floor(sqrt(x))+1):
if x%i == 0:
flag = 1
break
if flag!=0:
for j in range(2,floor(sqrt(x/i))+1):
if j!=i and (x/i)%j == 0:
count = 1
break
if count != 0:
if x/(i*j)!=i and x/(i*j)!=1 and x/(i*j)!= ... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | n=int(input())
for i in range(n):
m=int(input())
c=2
p=[]
while len(p)<2 and c*c<m:
if m%c==0:
m=m//c
p.append(c)
c+=1
if len(p)==2 and m not in p:
print("YES")
print(*p,m)
else:
print("NO") |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | from sys import stdin,stdout
for _ in range(int(stdin.readline())):
n=int(stdin.readline())
# a,b,c,n=list(map(int,stdin.readline().split()))
f=2;A=B=C=-1;f1=[]
while f*f<=n:
if n%f==0:
f1+=[f]
f+=1
nn=len(f1)
for i in range(nn):
for j in range(i+1,nn):
... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | #include <bits/stdc++.h>
using namespace std;
int main() {
long long t;
cin >> t;
while (t--) {
long long p = 0;
long long n;
cin >> n;
long long a, b, c;
for (long long i = 2; i < sqrt(n); i++) {
if (n % i == 0) {
a = i;
p = 1;
break;
}
}
if (p == 0... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import math
def prf(x):
a = []
b = 1
n = 2
m = int(math.sqrt(x))
# print(m)
while n <= m:
if x%n == 0:
if not(n in a): a.append(n)
elif not(n*b in a):
a.append(n*b)
b = 1
else: b *= n
x //= n
else:
... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... |
def cal1(n,tmp):
i = 2
while i*i<=n:
if n % i == 0:
if (i != n//i and i != tmp and n//i != tmp):
return (tmp,i,n//i)
i+=1
return (-1,0,0)
def cal(n):
i = 2
while i*i<=n:
if n % i == 0 and n//i != i:
#i, n//i
res ,a,b = cal... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | def STR(): return list(input())
def INT(): return int(input())
def MAP(): return map(int, input().split())
def MAP2():return map(float,input().split())
def LIST(): return list(map(int, input().split()))
def STRING(): return input()
import string
import sys
from heapq import heappop , heappush
from bisect import *
from ... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import math
t=int(input())
for i in range(t):
f=False
a=-1
b=-1
c=-1
n=int(input())
primes=set()
st=math.ceil(n**0.5)+1
p=[True]*(st)
for i in range(2,st):
if p[i]:
primes.add(i)
for j in range(i,st,i):
p[j]=False
#print(primes)
... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import sys
input = sys.stdin.readline
t=int(input())
import math
def f(x):
xr=math.ceil(math.sqrt(x))
LIST=[]
for i in range(1,xr+1):
if x%i==0:
LIST.append(i)
LIST.append(x//i)
return sorted(set(LIST))[1:]
for test in range(t):
n=int(input())
L=f(n)
... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | from collections import defaultdict as dc
from heapq import *
import math
import bisect
from collections import deque as dq
def inp():
p=int(input())
return p
def line():
p=list(map(int,input().split()))
return p
def check(n,d,x):
if x<0:
return 0
return n>=(x+math.ceil(d/(x+1)))
def uni... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | #1294C
t = int(input())
for i in range(t):
n = int(input())
ans = []
for i in range(2,int(n**(2/3))+1):
if len(ans) == 2:
break
if n%i == 0:
ans.append(i)
n = n//i
if len(ans) == 2 and ans[1] < n:
print('YES')
print(*ans, n)
else:... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | for _ in range(int(input())):
n=int(input())
m=n
l=[]
t=1
f=0
g=0
if n<8:
print("NO")
else:
for i in range(2,int(n**0.5)+1):
if n%i==0:
if not l:
l.append(i)
f=1
break
# ... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import java.util.*;
public class C {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
//make(T);;
while (T-->0)
{
int N = sc.nextInt();
HashSet<Long> values = new HashSet<>();
values.ad... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import sys
import math
from functools import reduce
def getN():
return int(input())
def getNM():
return map(int, input().split())
def getList():
return list(map(int, input().split()))
def getArray(intn):
return [int(input()) for i in range(intn)]
def input():
return sys.stdin.readline().rs... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
BufferedReader buf=new BufferedReader(new InputStreamReader(System.in... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | #include <bits/stdc++.h>
using namespace std;
int main() {
long long int t;
cin >> t;
while (t--) {
long long int n, cp = 0;
cin >> n;
vector<long long int> v1;
long long int i;
for (i = 2; i <= sqrt(n); i++) {
if (n % i == 0 && n / i != i) {
v1.push_back(i);
cp++;
... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import sys
from math import *
input=sys.stdin.readline
from math import *
t=int(input())
while t>0:
t-=1
n=int(input())
d={}
for i in range(2,int(ceil(sqrt(n)))+1):
if n%i==0:
d[i]=0
while n%i==0:
n//=i
d[i]+=1
if n>2:
d[n]=1
... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | t = int(input())
import math
while t:
n = int(input())
s = int(math.sqrt(n) + 10)
ans = []
for i in range(s)[2:]:
if n % i == 0 and len(ans) < 2:
ans.append(i)
n //= i
if len(ans) == 2 and ans[1] < n:
ans.append(n)
if len(ans) == 3:
print("YES")
... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import math
def primeFactors(n):
output=[]
while n % 2 == 0:
output.append(2)
n = n / 2
for i in range(3,int(math.sqrt(n))+1,2):
while n%i==0:
output.append(i)
n = n / i
if n > 2:
output.append(int(n))
return output
t=int(input())
for ... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | from __future__ import division, print_function
import os
import sys, math
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
from __builtin__ import xrange as range
from future_builtins import ascii, filter, hex, map, oct, zip
prime = []
def pp(n):
while n%2 == 0:
n /= 2
prime... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | #!/usr/bin/python3
import math
di = dict()
def couns(x,n):
z = int(math.sqrt(n))
for i in range(x, z+2):
if n%i == 0:
return i
return 1
def countofmul(n):
#if n in di:
# return di[n]
li = list()
i = 2
val = 0
while n >= 2:
i = couns(i, n)
... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | #include <bits/stdc++.h>
using namespace std;
int main() {
long long t;
cin >> t;
while (t--) {
long long n, i;
cin >> n;
vector<long long> v;
map<long long, long long> mp;
while (n % 2 == 0) {
v.push_back(2);
mp[2]++;
n = n / 2;
}
for (i = 3; i <= sqrt(n); i = i + 2)... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import sys
import math
input = sys.stdin.readline
ins = lambda: input().rstrip()
ini = lambda: int(input().rstrip())
inm = lambda: map(int, input().split())
inl = lambda: list(map(int, input().split()))
t = ini()
for _ in range(t):
n = ini()
i = 2
tmp = []
while n >= i * i:
if i == 5 and n % 5 ... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | #include <bits/stdc++.h>
using namespace std;
template <class T>
void printArray(vector<T> arr) {
for (T a : arr) cout << a << " ";
cout << '\n';
}
void printVerdict(bool verdict) { cout << (verdict ? "YES" : "NO") << '\n'; }
vector<long long> findPrime(long long n) {
vector<long long> ret;
for (int i = 2; i * ... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | #include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
set<int> used;
for (int i = 2; i * i < n; i++) {
if (n % i == 0 && !used.count(i)) {
used.insert(i);
n /= i;
break;
}
}
for (int i = 2; i * i < n; ... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t;
cin >> t;
for (int tt = 0; tt < t; tt++) {
int n;
cin >> n;
set<int> used;
for (int i = 2; i * i <= n; i++) {
if (n % i == 0 && !used.count(i)) {
used.insert(i);
... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import static java.lang.Math.sqrt;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
//int n = 100;
List<Long> set = new Ar... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | # Product of three numbers
from math import *
for i in range(int(input())):
num = int(input())
if 2*3*4 > num:
print("NO")
else:
a,b = 0,0
for i in range(2, int(sqrt(num))+1):
if num % i == 0:
a = i
num //= i
break
... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import java.io.*;
import java.util.*;
import java.lang.*;
import java.awt.*;
import java.awt.geom.*;
import java.math.*;
import java.text.*;
import java.math.BigInteger.*;
import java.util.Arrays;
public class getbackintoit
{
BufferedReader in;
StringTokenizer as;
int nums[],nums2[];
Map<Integer,Integer > ... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | t = int(input())
for _ in range(t):
n = int(input())
a = 2
tr = False
cnt=0
ans=[]
while (a*a<=n) and (cnt<2):
if n%a==0:
n=n//a
ans.append(a)
cnt+=1
a+=1
ans.append(n)
if (len(ans)==3) and (ans[1] < ans[2]):
print ('YES')
... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | for i in range(int(input())):
from math import sqrt
# Function to find the required triplets
def findTriplets(x):
# To store the factors
fact = [];
factors = set();
# Find factors in sqrt(x) time
for i in range(2, int(sqrt(x))):
if (x % i == 0):
... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | def petit(a,k):
for i in range(a+1,int(k**0.5)+1):
if k%i==0:
return i, k//i
return -1, -1
n = int(input())
for i in range(n):
k = int(input())
a1, k2 = petit(1, k)
if a1==-1:
print('NO')
else:
a2, a3 = petit(a1,k2)
if a2==-1:
print('NO')
... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import math as mt
def func(n):
a=[]
while(n%2==0):
a.append(2)
n=n//2
for i in range(3,mt.ceil(mt.sqrt(n))+1,2):
#print(i)
while(n%i==0):
n=n//i
a.append(i)
if(n>2):
a.append(n)
return a
t=int(input())
for i in range(t):
n=int(inpu... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class App{
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int t = in.nextInt();
while(t-- > 0){
int n = in.nextInt();
boolean... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import java.io.*;
import java.util.*;
public class Task {
public static void main(String[] args) throws Exception {
new Task().go();
}
PrintWriter out;
Reader in;
BufferedReader br;
Task() throws IOException {
try {
//br = new BufferedReader( new FileReader("in... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | #include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
inline long long read() {
long long X = 0, w = 0;
char ch = 0;
while (!isdigit(ch)) {
w |= ch == '-';
ch = getchar();
}
while (isdigit(ch)) X = (X << 3) + (X << 1) + (ch ^ 48), ch = getchar();
return w ? -X : X;
}
inline char pow... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | from itertools import combinations
from math import sqrt
for _ in range(int(input())):
l=[]
n=int(input())
for i in range(2,int(sqrt(n))+1):
if n%i==0:
if n//i!=i:
l.append(i)
l.append(n//i)
else:
l.append(i)
if len(l)<3:
... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import math
test_cases = int(input())
def process():
n = int(input())
for a in range(2, int(math.sqrt(n)) + 1):
for b in range(a + 1, int(math.sqrt(n // a)) + 1):
c = n // (a * b)
if a * b * c == n and c != b and c != a:
print('YES')
print(a, b,... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | // Working program using Reader Class
// Probably fastest
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.In... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... |
import java.util.*;
public class C {
public static void main(String[] args) {
Scanner in=new Scanner(System.in);
int t=in.nextInt();
for(int i=0;i<t;i++){
int n=in.nextInt();
int lasttemp=1;
List<Integer> res=new ArrayList<>();
for(int temp=2... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import math
t=int(input())
ans=[]
for _ in range(t):
n=int(input())
fac=[]
count=0
i=2
p=0
z=math.sqrt(n)
while count!=2 and i<z:
if n%i==0:
p=1
fac.append(str(i))
n=n//i
count+=1
i+=1
if str(n) not in fac and len(fac)==2:
... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import math
def isPrime(n) :
# Corner cases
if (n <= 1) :
return False
if (n <= 3) :
return True
# This is checked so that we can skip
# middle five numbers in below loop
if (n % 2 == 0 or n % 3 == 0) :
return False
i = 5
while(i * i <= n) :
... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import math
def isPrime(n):
for i in range(2,n):
if n % i:
return False
return True
t = int(input())
for _ in range(t):
n = int(input())
if isPrime(n):
print("NO")
else:
ip = False
i = 0
for i in range(2,int(math.sqrt(n)) + 1):
if n % i... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import java.util.*;
import java.lang.*;
import java.io.*;
public class d {
public static void main (String[] args) {
PrintWriter pw=new PrintWriter(System.out);
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
for(int i=0;i<t;i++){
int n=sc.nextInt();
... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | from sys import stdin
inp = (s.rstrip() for s in stdin).__next__
def mpint():
return map(int, inp().split())
# sieve
N = int(1e5)
is_prime = [True] * (N + 1) # have 0
is_prime[0] = is_prime[1] = False
prime = []
for n in range(2, N + 1):
if is_prime[n]:
prime.append(n)
for p in prime:
if n * p > N: # Index... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import java.math.*;
import java.io.*;
import java.util.*;
import java.awt.*;
public class CP {
public static void main(String[] args) throws Exception {
new Solver().solve();
}
}
class Solver {
final Helper hp;
final int MAXN = 1000_006;
final long MOD = (long) 1e9 + 7;
Solver() {
... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | from functools import reduce
def is_prime(n):
if n == 1:
return False
i = 2
while i*i <= n:
if n % i == 0:
return False
i += 1
return True
def factors(n):
return set(reduce(list.__add__,
([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i =... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | n = int(input())
def f(a):
q = a
x = 0
y = 0
z = 0
for i in range(2, a):
if i * i > a:
break
if a % i == 0:
x = i
break
if x == 0:
return 'NO'
else:
a = a // x
... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | for _ in range(int(input())):
n=int(input())
y=0
for i in range(2,int(n**0.5)+1):
if n%i==0:
x=n//i
for j in range(i+1,int(n**0.5)+1):
if x%j==0:
if x//j!=i and (x//j)>1 and (x//j)!=j:
print("YES")
... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import math
for _ in range(int(input())):
t = n = int(input())
dels = []
sq = int(math.sqrt(n))
d = 2
while d <= sq:
if n % d != 0:
d += 1
else:
dels.append(d)
n //= d
sq = int(math.sqrt(n))
dels.append(n)
a = dels[0]
b = ... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import math
test=int(input())
for i in range(test):
n=int(input())
count=0
j=2
temp=n
ans=[]
r=math.ceil(math.sqrt(n))
while count<2 and j<r:
if n%j==0:
count+=1
n//=j
ans.append(j)
j+=1
if count==0 or count<2:
print('NO')
els... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | #https://codeforces.com/problemset/problem/1294/C
from math import sqrt
for _ in range(int(input())):
n=int(input())
f=0
for i in range(2,int(sqrt(n))+1):
if n%i==0:
if n//i != i:
t=n//i
for j in range(2,int(sqrt(t))+1):
if t%j==0:
if t//j !=j:
if i!=j and i!=t//j:
print('YES')... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import sys
# inf = open('input.txt', 'r')
# reader = (line.rstrip() for line in inf)
reader = (line.rstrip() for line in sys.stdin)
input = reader.__next__
t = int(input())
for _ in range(t):
n = int(input())
primes = {}
if not n & 1:
primes[2] = 0
while not n & 1:
n >>= 1
... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | rr= lambda: input().strip()
rri= lambda: int(rr())
rrm= lambda: [int(x) for x in rr().split()]
def fact(n):
res=[]
for i in range(2, int(n**.5)+1):
if n%i==0:
res.append(i)
res.append(n//i)
if (int(n**.5)**2==n):
res.pop()
return res
def sol():
n=rri()
f... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import sys
input=sys.stdin.readline
t=int(input())
import math
from functools import reduce
def factors(n):
return set(reduce(list.__add__,
([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0)))
for i in range(t):
n=int(input())
ffactor=(factors(n))
#print(ffactor)
ffa... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import math
def primeFactors(n):
ar = []
while n % 2 == 0:
ar.append(2)
n = n / 2
for i in range(3, int(math.sqrt(n))+1, 2):
while n % i == 0:
ar.append(i)
n = n / i
if n > 2:
ar.append(n)
return ar
for _ in ... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public class Main
{
public static void main(String[] args)
{
InputStream inputStream = Syste... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | t=int(input())
li=[]
def p2(m,a):
for i in range(2,int(m**(0.5))+1):
if (int(m/i)==m/i)and(i!=m/i!=a)and(i!=a):
return [int(i),int(m/i)]
return "no"
for i in range(t):
li=li+[int(input())]
for k in li:
if p2(k,1)!="no":
l=p2(k,1)
if p2(l[0],l[1])!="no":
print("YES")
print(l[1],p2(l[0],l[1])[0],(p2(l[... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import math
t=int(input())
for _ in range(0,t):
n=int(input())
z=int(math.sqrt(n))+10
a=[]
for i in range(2,z+1):
if n%i==0:
n=n//i
a.append(i)
if len(a)==2:
break
if len(a)==2 and n!=1:
if n not in a:
print("YES")
p... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import math
def solve(n):
root=int(math.sqrt(n))
a=-1
b=-1
c=0
i=2
while(i<=root):
if(n%i==0):
a=i
n=n/i
break
i=i+1
root=int(math.sqrt(n))
i=2
while(i<=root):
if(n%i==0 and i!=a and n/i!=a and i!=n/i):
b=i
... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | for i in range(int(input())):
n = int(input())
abc = []
x = 2
while len(abc) < 2 and x*x < n:
if n % x == 0:
abc.append(x)
n //= x
x += 1
if len(abc) == 2 and n not in abc:
print('YES')
print(*abc, n)
else:
print... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.util.*;
import java.io.*;
public class Main {
public static void main(String args[]) {
InputReader obj = new InputReader(System.in);
int t = o... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... |
import java.io.*;
import java.util.*;
public class Main
{
public static void main(String[] args) throws IOException
{
BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));
String[] line = sc.readLine().split(" ");
int cases = Integer.parseInt(line[0]);
top... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | #include <bits/stdc++.h>
using namespace std;
const int ma1 = 3e5 + 5;
string no = "NO", yes = "YES";
const unsigned int MAX1 = 1000000007;
void f(int n) {
for (int i = 2; i <= sqrt(n); i++) {
if (n % i == 0) {
int d = n / i;
for (int j = i + 1; j < sqrt(d); j++) {
if (d % j == 0) {
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.