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)... | t=input()
import math
from collections import Counter
# A function to print all prime factors of
# a given number n
def f(n):
l=[]
# Print the number of two's that divide n
while n % 2 == 0:
l.append(2)
n = n / 2
# n must be odd at this point
# so a skip of 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)... | import math
n = int(input())
for i in range(n):
deb = t = int(input())
divs = []
for j in range(2,round(math.sqrt(t)+1)):
if t%j==0 and j not in divs:
divs.append(j)
t //= j
if len(divs) == 2:
divs.append(t)
break
if len(set(divs)) == 3 and deb == divs[0]*divs[1]*divs[2]:
print("YES")
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)... | for _ in[0]*int(input()):
n=int(input());a=['YES'];i=j=2
while j<4and i*i<n:
if n%i<1:a+=i,;n//=i;j+=1
i+=1
print(*(a+[n],['NO'])[j<4]) |
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 MAX = 100002;
long long n, n_0;
bool c[MAX];
vector<int> primes, fact;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int t;
cin >> t;
for (int i = 2; i < MAX; i++) {
if (!c[i]) {
for (int j = i + i; j < MAX; j += i) {
c[j] = tr... |
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 N = 2e5 + 5, MOD = 1e9 + 7;
int t, n, a, b, c;
int main() {
cin >> t;
while (t--) {
cin >> n;
for (int i = 2; i * i <= n; ++i)
if (n % i == 0) {
a = i;
break;
}
if (a)
for (int i = 2; i * i <= n / a; ++i)
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 sys
input=sys.stdin.readline
t=int(input())
import math
def primeFactors(n):
factor=[]
number=[]
while n % 2 == 0:
factor.append(2)
n = n / 2
for i in range(3,int(math.sqrt(n))+1,2):
while n % i== 0:
factor.append(int(i))
n = n / i
if n > 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)... | t=int(input())
while t:
n=int(input())
cnt=0
i=2
ans=[]
while True:
while i*i<n:
if n%i==0:
ans.append(i)
cnt+=1
if cnt==2:
ans.append(int(n/i))
break
n=n/i
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)... | def solve():
ans = []
n = int(input())
for j in range(2 , int(n ** (1 / 2)) + 1):
if(n % j == 0):
ans.append(j)
ans.append(n // j)
ans = list(set(ans))
if(len(ans) < 3):
print("NO")
else:
for j in range(len(ans)):
for g in range(j + 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)... | import sys
input=sys.stdin.readline
t=int(input())
p=[]
for _ in range(t):
n=int(input())
fac=[]
for i in range(2,int(n**0.5)+1):
if(n%i==0):
fac.append(i)
fac.append(n//i)
nn=len(fac)
st=0
# print(fac)
for i in range(nn):
for j in range(i+1,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 t, n, a, b, c;
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> t;
while (t--) {
cin >> n;
a = 0;
b = 0;
c = 0;
int m = n;
for (int i = 2; i <= sqrt(n); i++) {
if (n % i == 0) {
a = 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
t = int(input())
for tt in range(t):
n = int(input())
f = 0
for i in range(2, int(math.sqrt(n)) + 1):
if n % i == 0:
a = i
c = 1
b = 1
for j in range(2, int(math.sqrt(n / a)) + 1):
if (n / a) % j == 0 and j != 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)... | for T in range(int(input())):
N = int(input())
D = set()
for I in range(2, int(N**0.5)+1):
if N % I == 0:
D.add(I)
D.add(N//I)
D = sorted(list(D))
F = 0
if len(D) < 3:
F = 1
print('NO')
else:
for I in range(len(D)):
for J 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 math
for _ in range(int(input())):
n = int(input())
f = []
i = 2
while i <= math.sqrt(n):
if n % i == 0:
if n // i == 0:
f.append(i)
else:
f.append(n//i)
f.append(i)
i = i + 1
f = set(f)
f = list(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)... | #include <bits/stdc++.h>
using namespace std;
int main() {
int t;
long long int n, i, j, k;
vector<long long int> vec;
cin >> t;
while (t--) {
int flag = 0;
vec.clear();
cin >> n;
for (i = 2; i * i <= n; i++) {
if (n % i == 0) {
if (i != (n / i)) {
vec.push_back(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 sys
import math
Z = sys.stdin.readline
def main():
for t in range(int(Z().strip())):
n = int(Z().strip())
c=00
if n>=24:
r=[0]
for i in range(2,roundsqrt(n)):
if n%i==0:
q=n//i
r[0]=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 math import sqrt
n = int(input())
for i in range(n):
q = int(input())
qq = q
for i in range(2, int(sqrt(q)) + 1):
if q % i == 0:
a = i
q //= i
break
else:
print("NO")
continue
for i in range(a + 1, int(sqrt(q)) + 1):
if q % 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.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class Main {
static int mod=(int)1e9+7;
public static void main(String[] args) throws IOException {
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while (t-->... |
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
def f(n):
res=[]
for i in range(2,int(n**0.5)+1):
if n%i==0 and i not in res:
n=n//i
res.append(i)
break
for i in range(2,int(n**0.5)+1):
if n%i==0 and i not in res:
n=n//i
res.append(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 math
t=int(input())
for i in range(t):
n=int(input())
flag=0
for j in range(2,int(pow(n,0.5)+1)):
if n%j==0:
n1=n//j
for k in range(j+1,int(pow(n1,0.5)+1)):
n2=n1//k
if n1%k==0 and n2!=k:
flag=1
n2=n1//k
print("YES")
print(j,end=" ")
print(k,end=" ")
print(n2)
... |
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, n, d, a, b, c, i;
scanf("%d", &t);
while (t--) {
scanf("%d", &n);
d = 2;
vector<int> ord;
while (d * d <= n) {
while (n % d == 0) {
ord.push_back(d);
n /= d;
}
d++;
}
if (n > 1) ord.push_bac... |
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 Main
{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t>0){
int n = sc.nextInt();
int num = n;
final int MAX = 100000;
int[] arr = new int[MAX];
int id = 0;
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)... | #include <bits/stdc++.h>
using namespace std;
int main() {
int q;
cin >> q;
for (int i = 0; i < q; ++i) {
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... |
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(t):
n = int(input())
n_i = n
if n<24:
print("NO")
else:
a, b, c = 2, 2, 2
sq = int(math.sqrt(n)) + 2
for i in range(a,sq):
if n%i==0:
a = i
n = n//a
sq = int(math.sqrt... |
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)... | # Python program to print prime factors
import math
def solution(n):
a = 0
b = 0
for i in range(2, int(math.sqrt(n))+1):
if n % i == 0:
a = i
n //= i
break
if a:
for j in range(a + 1, int(math.sqrt(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)... | import java.util.*;
import java.util.Map.Entry;
import java.lang.*;
import java.math.*;
import java.text.*;
import java.io.*;
public final class Solve {
static PrintWriter out = new PrintWriter(System.out);
static void flush() {
out.flush();
}
static void run(long s, long e) {
NumberFormat formatter = ... |
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())
if n<24:
print("NO")
continue
a=1
b=1
c=1
for i in range(2,int(math.sqrt(n))+1):
if n%i==0:
a=i
break
n//=a
for i in range(2,int(math.sqrt(n))+1):
if i!=a and n%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)... | for t in range(int(input())):
n = int(input())
k = 2
i = k
a = -1
b = -1
c = -1
while i <= n/k:
k+=1
if n%i == 0:
a = i
x = n/a
break
else:
i = k
if a == -1:
print("NO")
else:
# print(x)
k... |
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 case in range (int (input ())) :
n = int (input())
a, b, c = 0, 0, 0
for i in range(2, int (math.sqrt (n)) + 1) :
if n % i == 0 :
a, b = i, n // i
break
if a :
for i in range (a + 1, int (math.sqrt(b)) + 1) :
if b % 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)... | import math
t=int(input())
for tt in range(t):
n=int(input())
m=n
fact=[]
while m%2==0:
fact.append(2)
m = m / 2
for i in range(3,int(math.sqrt(m))+1,2):
while m % i== 0:
fact.append(i)
m = m / i
if m > 2:
fact.append(m)
a,b = 1,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)... | from math import sqrt
t = int(input())
def factor(n):
factors = []
div = int(sqrt(n))
i = 2
count = 1
aux_n = n
while n > 1 and i <= div:
while n%i == 0:
factors.append(i)
n = n//i
count *= i
i += 1
if n > 1:
factors.append(aux_n//count)
return factors
for _ in range(t):
n = int(input())
pr... |
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)... | /******************************************************************************
Online Java Compiler.
Code, Compile, Run and Debug java program online.
Write your code in this editor and press "Run" button to execute it.
*****************************************************... |
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
from math import ceil
def find(fro, n):
if n % fro == 0:
return fro
return find(fro + 1, n)
t = int(input())
answers = []
for ti in range(t):
n = int(input())
first = -1
for i in range(2, ceil(sqrt(n)) + 1):
if n % i == 0:
first = 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 sys
from math import sqrt
def readlines(type=int):
return list(map(type, sys.stdin.readline().split()))
def read(type=int):
return type(sys.stdin.readline().strip())
joint = lambda it, sep=" ": sep.join(
[str(i) if type(i) != list else sep.join(map(str, i)) for i in it])
def solve(num):
d... |
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())
a = []
for i in range(2,int((n**0.5))+1):
if n%i == 0:
n=n//i
a.append(i)
break
if len(a)==1 :
for j in range(a[0]+1,int((n**0.5))+1):
if n%j == 0:
n=n//j
a.appe... |
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 ProductOf3Numbers {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
int arr[] = new int[t];
for(int i=0; i<t; i++) {
arr[i] = sc.nextInt();
}
sc.close();
for(int i=0; i<t; 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())):
a=int(input())
b=[]
i=2
while(len(b)<2 and (i**2)<a):
if(a%i==0):
a=a//i
b.append(i)
i+=1
if(len(b)==2 and a not in b):
print('YES')
b.append(a)
b=' '.join(str(i) for i in b)
print(b)
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)... | t = int(input())
for i in range(t):
n=int(input())
f=False
for i in range(2,2000):
if n%i != 0:
continue
newn = n//i
if(f):
break
for j in range(2,100000):
if newn%j != 0:
continue
k = newn//j
if(k >=... |
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 CodeforcesContest {
private static void sport(int n) {
int r=n;
Set<Integer> used = new HashSet<>();
int a = div(n, used);
if (a < 0) {
System.out.println("NO");
return;
}
n/=a;
used.add(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)... | # cook your dish here
import math
def factors(n):
num = int(math.sqrt(n))+1
fac = []
for i in range(2, num):
if (n%i) == 0:
fac.append(i)
n = n//i
if (len(fac) == 2):
break
if (len(fac) == 2 and n > fac[1]):
print("Y... |
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 n;
vector<int> p;
void solve() {
cin >> n;
p.clear();
int cur = n;
for (int i = 2; i * i <= cur; i++) {
while (cur % i == 0) {
p.push_back(i);
cur /= i;
}
}
if (cur > 1) {
p.push_back(cur);
}
sort(p.begin(), p.end());
if ((int)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)... | def kkk(n):
for i in range(2,min(1000,n-1)):
if n%i==0: return i
return 1
def kkk2(n,p):
for i in range(p,min(1000000,n-1)):
if n%i==0: return i
return 1
for i in range(int(input())):
n=int(input())
r=kkk(n)
if r==1:
print("NO")
else:
n=n//r
rr=k... |
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.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Class1 {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new 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)... | MOD = 1000000007
MOD2 = 998244353
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
for _ in range(ii()):
n=ii()
fg=0
oans=[-1,-1,-1]
for i in range(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>
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
const long long INF = 0x3f3f3f3f3f3f3f3f;
const long long llinf = (1LL << 62);
const int inf = (1 << 30);
const int nmax = 1e3 + 50;
const int mod = 1e9 + 7;
using namespace std;
int n, x, t, i, a, b, c, bl, j;
vector<int> d;
int m... |
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
def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5)+1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n//i)
# divisors.sort()
return divisors
def main():
t = int(input())
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)... | from math import *
sInt = lambda: int(input())
mInt = lambda: map(int, input().split())
lInt = lambda: list(map(int, input().split()))
def isPrime(n,w):
for i in range(w,int(sqrt(n))+1):
if n%i==0:
return False,i
return True,0
t = sInt()
for _ in range(t):
n = sInt()
q,a = isPr... |
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 ' '*int(input()):
n = int(input())
m=n
p = []
d = 2
ln = 0
x = 0
while d * d <= n:
if n % d == 0:
p.append(d)
n //= d
ln += 1
else:
d += 1
if n > 1:
p.append(n)
ln+=1
#print(p)
if 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)... | for _ in range(int(input())):
n=int(input())
f=0
a=0
b=0
c=0
f2=0
for i in range(2,int(n**0.5)+1):
if n%i==0:
a=i
f2=1
break
#print(i,'yo')
#print(int(i**0.5)+1)
if f2==1:
for j in range(2,int((n//i)**0.5)+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)... | import java.util.*;
public class practice {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int T = in.nextInt();
while (T-->0) {
int n = in.nextInt();
int a=0, b=0;
for (int i=2; (i*i)<n; i++) {
if (n%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)... | import java.util.*;
import java.io.*;
public class CodeForces
{
public static void main(String[] args)throws IOException
{
Scanner sc=new Scanner(System.in);
//Scanner sc=new Scanner(new File("ip.txt"));
int tc,n,a,b,i,sq;
boolean flag;
tc=sc.nextInt();
while(tc-->0)
{
n=sc.nextInt();
sq=(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)... | t = int(input())
def isnotprime(n):
for i in range(1, int(n**0.5)+1):
if n%i == 0:
return True
return False
for _ in range(t):
n = int(input())
if n<8:
print('NO')
continue
found = list()
foundmul = 1
done = False
for i in range(2, int(((n//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)... | '''input
5
64
32
97
2
12345
'''
def chay(a,n):
i = a
while i*i <= n:
if n%i == 0:
b = i
c = int(n/i)
if b == c:
return(0,0)
else:
return(b,c)
i+=1
return(0,0)
def ktra(n):
i = 2
while i*i <= n:
if n%i == 0:
a = i
b, c = chay(a+1,int(n/i))
if b != 0:
return (1,a,b,c)
brea... |
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 t in range(int(input())):
n = int(input())
a = -1
b = -1
i = 2
while i * i < n:
if n%i == 0:
a = i
n /= i
break
i += 1
i = 2
while i * i < n:
if n%i == 0 and i != a:
b = i
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 collections, math
local = False
if local:
file = open("inputt.txt", "r")
def inp():
if local:
return file.readline().rstrip()
else:
return input().rstrip()
def ints():
return [int(_) for _ in inp().split()]
t = int(inp())
for _ in range(t):
n = int(inp())
sqrtn = int... |
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())
f=0
a=set()
i=2
while(i*i<=n):
if n%i==0:
a.add(i)
a.add(n//i)
i+=1
a=list(a)
a.sort()
l=len(a)
for i in range(l):
for j in range(i+1,l):
for k in range(j+1,l):
if... |
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
from math import gcd, ceil, sqrt
ii1 = lambda: int(stdin.readline().strip())
is1 = lambda: stdin.readline().strip()
iia = lambda: list(map(int, stdin.readline().strip().split()))
isa = lambda: stdin.readline().strip().split()
mod = 1000000007
n = ii1()
for _ in range(n):
num = ii1()
... |
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 is_prime(n):
if n == 1:
return False
i = 2
while i*i <= n:
if n % i == 0:
return False
i += 1
return True
for _ in range(int(input())):
n = int(input())
a = []
z = int(math.sqrt(n))
if is_prime(n) == True:
print("NO")
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)... | import math
t = int(input())
for zxx in range(t):
n = int(input())
l =[]
k =int(0)
for i in range(2,int(math.sqrt(n))):
if(n%i == 0 ):
n = n//i
l.append(i)
k = i
if len(l) == 2:
break
elif i>n:
break
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)... |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.io.*;
public class Linkedlist
{
static PrintWriter pw;
static class FastReader
{
BufferedReader br;
StringTokenizer st;
public FastReader()
... |
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)... | num = int(input())
mas = [None] * num
for i in range(num):
mas[i] = int(input())
for i in range(num):
n = mas[i]
n0 = n
i = 2
delit = []
while i * i <= n0:
while n % i == 0:
delit.append(i)
n //= i
i += 1
if n != 1:
delit.append(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())
ans = []
count = 0
for i in range(2, int(n**(1/2) + 1)):
if (n % i == 0):
count += 1
ans.append(i)
n = n//i
if(count == 2):
if(n not in ans):
ans.append(n)
brea... |
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 collections import defaultdict,Counter
# input=sys.stdin.readline
# def print(x):
# sys.stdout.write(str(x)+"\n")
# sys.stdout=open("CP1/output.txt",'w')
# sys.stdin=open("CP1/input.txt",'r')
# m=pow(10,9)+7
t=int(input())
for i in range(t):
n=int(input())
a=b=c=-1
d=-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)... | # -*- coding: utf-8 -*-
"""
Created on Sun Jan 19 16:11:01 2020
@author: PC
"""
def product(n):
A = []
L1 = isPrime(n, A)
if len(L1) != 1:
print("NO")
else:
n = n//L1[0]
L2 = isPrime(n, L1)
if len(L2) != 2:
print("NO")
else:
n = 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 sys import stdin, stdout
from collections import defaultdict
import math
rl = lambda: stdin.readline()
rll = lambda: stdin.readline().split()
def main():
cases = rll()
for line in stdin:
n = int(line)
ans = []
f1 = 2
while f1 <= math.sqrt(n):
if n % f1 == 0:
ans.append(f1)
break
f1 += 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)... | import java.util.*;
public class Main
{
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
for(int j=0;j<t;j++)
{
int n=sc.nextInt();
int a=0,b=0,c=0,d=0,x=0,flag=0;
for(int i=2;i<=Math.sqrt(n);i++){
if(n%i==0){
a=i;
b=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)... | #!/usr/bin/env python
import os
import sys
from io import BytesIO, IOBase
#from bisect import bisect_left as bl #c++ lowerbound bl(array,element)
#from bisect import bisect_right as br #c++ upperbound br(array,element)
from collections import defaultdict
import math
def main():
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)... | import java.util.*;
public class Main {
public static void main(String[] args){
Scanner s = new Scanner(System.in);
int t = s.nextInt();
while(t>0){
int a=0;
int b=0;
int c=0;
int n = s.nextInt();
for(int i =2; i*i<=n;i++ ){
a=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)... |
for _ in range(int(input())):
n = int(input())
a, i, d = [], 0, 2
while d * d <= n and i < 2:
if n % d == 0:
a.append(d)
n = n // d
i += 1
d += 1
if n >= d and i == 2:
a.append(n)
print("YES")
print(" ".join(map(str, a)))
e... |
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())
test = 2
out = []
while len(out) < 2 and test * test < n:
if n % test == 0:
out.append(test)
n //= test
test += 1
if len(out) == 2 and n > out[1]:
print('YES')
print(out[0], out[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())
for i in range(t):
n=int(input())
ok=True
if n<24:ok=False
i=1
j=1
for i in range(2,int(n**0.5)+1):
if n%i==0:
n=n//i
break
if i==int(n**0.5):ok=False
if (i+1)>int(n**0.5):ok=False
for j in range(i+1,int(n**0.5)+1):
if n%j==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)... | t = int(input())
for a in range(t):
n = ori = int(input())
num = []
for b in range(2,int(ori**0.5)+1):
# print(n)
if n % b == 0:
num.append(b)
n = n//b
if len(num) == 2:
if n != 1:
num.append(n)
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)... | pr = [1]*40000
primes = []
for i in range(2, 40000):
if pr[i]:
primes.append(i)
for j in range(i*i, 40000, i):
pr[j] = 0
def sl(a,b,kkk):
print("YES")
print(a,b,kkk//(a*b))
n = int(input())
for i in range(n):
k = int(input())
kk = k
f = []
for p in 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 os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
self._fd = file.fileno()
self.buffer = BytesIO()
self.writable = "x" in file.mode or "r" not in file.mode
self.write = self.buffer.write if self.writa... |
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 sqrt
inp = sys.stdin.readline
ans = ""
for i in range(int(inp())):
n = int(inp())
arr = ""
c = 0
flag = 0
for i in range(2, round(sqrt(n))+1):
if n % i == 0:
c += 1
arr += str(i)+" "
n = n//i
if c == 2 and n > i:
flag = 1
arr += str(n)+"\n"
break
if flag:
... |
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 factorize(n):
i = 2
s = int(math.sqrt(n))
f = dict()
while n > 1:
if i > s:
# print(i,s,n,f)
f[i] = 1
return f
if n % i == 0:
f[i] = f.get(i, 0) + 1
n //= i
else:
i += 1
return f
t = int... |
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.HashSet;
import java.util.Scanner;
import java.util.Set;
public class ProductOfThreeNumbers {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner s=new Scanner(System.in);
int t=s.nextInt();
while(t--!=0){
int n=s.nextInt();
int v=n;
Set<Integer> st=... |
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;
long long int hcf(long long int a, long long int b) {
if (b == 0) return a;
return hcf(b, a % b);
}
long long int lcm(long long int a, long long int b) {
return (a * b) / hcf(a, b);
}
bool isprime(long long int n) {
if (n == 1) return false;
for (long long int 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.io.*;
public class Solution {
static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
public static void main(String args[]) throws IOException {
int t = Integer.parseInt(br.r... |
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 Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
boolean[] arr = new boolean[32000];
for(int i=4;i<32000;i+=2) {
arr[i] = true;
}
for(int i=3;i*i<32000;i+=2) {
if(!arr[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 run():
num = int(input())
if num < 24:
print("NO")
return
else:
used = set()
i = 2
while i * i <= num:
if num % i == 0 and i not in used:
used.add(i)
num //= i
break
i += 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())
for i in range(t):
n = int(input())
m = [0, 0, 0]
k = 0
for j in range(2, int(n ** 0.5) + 1):
if n % j == 0 and j not in m:
m[k] = j
k += 1
n //= j
if k == 2 or j > n:
break
if k == 2 and n not in m:
m[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
n = int(input())
def check_prime(n, k):
for i in range(k, int(pow(n, 0.5)) + 1):
if n%i == 0:
return (0, i)
return (1, -1)
e = {}
for j in range(n):
m = int(input())
d = []
k = 2
for _ in range(2):
x = check_prime(m, k)
#print(x)
if... |
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, k = 0;
cin >> t;
while (t > 0) {
k = 0;
long long n, a, b, c;
cin >> n;
for (long long i = 2; i <= sqrt(n); i++) {
if (n % i == 0) {
k = 0;
for (long long j = 2; j <= sqrt(n / i); j++) {
if (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)... | #include <bits/stdc++.h>
using namespace std;
int main() {
int q;
cin >> q;
while (q--) {
long long int n, x;
cin >> n;
x = n;
vector<long long int> result;
int i = 1;
while (i * i <= x) {
if (x % i == 0) {
result.push_back(i);
if (x / i != i) {
result.push_... |
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
t=int(input())
for i in range(t):
n=int(input())
a=0
b=0
c=0
for j in range(2,int(m.sqrt(n))+1):
if n%j==0:
a=j
n=n/j
break
for k in range(a+1,int(m.sqrt(n))+1):
if n%k==0:
b=k
c=n/k
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)... | #include <bits/stdc++.h>
using namespace std;
int main(int argc, char *argv[]) {
std::ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
;
int t;
int n;
cin >> t;
while (t--) {
cin >> n;
set<int> used;
for (int i = 2; i * i <= n; i++) {
if (n % i == 0 && !used.count(i)) {
used.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;
long long fpow(long long x, long long y, long long p = 1000000007) {
x = x % p;
long long sum = 1;
while (y) {
if (y & 1) sum = sum * x;
sum %= p;
y = y >> 1;
x = x * x;
x %= p;
}
return sum;
}
long long fact[3000007] = {0};
void facto() {
fa... |
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 n, a, b, c, d, i, j, k, l, m, x, t;
cin >> t;
while (t--) {
cin >> n;
d = 0;
if (n % 2 == 0) {
d = 0;
a = 2;
n = n / 2;
x = (n / 2) - 1;
if (x > 999999) x = 999999;
for (i = 3; i <= x; 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.io.*;
import java.util.*;
import static java.lang.Double.parseDouble;
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.Math.abs;
import static java.lang.System.exit;
public class Main {
static BufferedReader in;
static PrintWriter out;
... |
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)... | test_cases = int(input())
for z in range(test_cases):
n = int(input())
x=n
l =[]
for i in range(2,int(n**0.5)+2):
if x%i==0:
l.append(i)
x=x/i
if len(l)>=3 :
if l[0]*l[1]*l[2]<=n:
print('YES')
print(l[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 java.util.*;
import static java.lang.Math.*;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.math.BigInteger;
public class Main
{
static int mod = 10000000... |
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.Scanner;
public class cfTaskC1{
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int t = input.nextInt();
int num;
int[] arr = new int[3];
arr[0] = 0;
arr[1] = 0;
arr[2] = 0;
for(int i = 0; i < t; i++){
num = input.nextInt();
int realnum = num;
... |
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, n, fl = 0, fl2;
cin >> t;
while (t--) {
fl = 0, fl2 = 0;
cin >> n;
vector<int> v;
int p = n;
for (int i = 2; i * i <= n; i++) {
if (p % i == 0 && fl <= 1) {
v.push_back(i);
p /= i;
fl++;
}
... |
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 dell(num):
global ans
for i in range(2, 2 + int(math.sqrt(num))):
if num % i == 0:
ans.append(i)
return dell(num // i)
if num >= 2:
ans.append(num)
t = int(input())
for _ in range(t):
num = int(input())
ans = []
dell(num)
ans = sort... |
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 i in range(t):
n = int(input())
sol = {}
j = 2
sqroot = {}
sqroot[n] = int(sqrt(n))
while(j<=sqroot[n]):
if len(sol)==2:
break
if n%j==0:
sol[j] = 1
n = n//j
sqroot[n] = int(sqrt(n))
j += 1
if len(sol)==2 and (n not in sol):
print("YES")
for j in 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)... | import java.io.*;
import java.util.*;
public class R615C {
public static void main(String[] args) {
JS scan = new JS();
int t = scan.nextInt();
PrintWriter out = new PrintWriter(System.out);
loop:while(t-->0) {
int n = scan.nextInt();
int r = n;
ArrayDeque<Integer> factors = new ArrayDeque<>();
wh... |
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())
c1,c2=0,0
arr=[]
for j in range(2,int(math.sqrt(n))+1):
if(n%j==0):
arr.append(j)
c1=1
n=n//j
store=j
break
if(c1==1):
for j in range(store+1,int(math.sqrt(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)... | import math
for _ in range(int(input())):
n=int(input())
flag=0
for i in range(2,math.ceil(math.sqrt(n))+1):
l=[]
if n%i==0:
l.append(i)
a=n//i
for j in range(2,math.ceil(math.sqrt(a))+1):
if a%j==0 and j!=l[-1]:
l.appen... |
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())
flag=0
for i in range(2,int(math.sqrt(n))+1):
if(n%i==0):
t=n//i
for j in range(2,int(math.sqrt(t))+1):
if(t%j==0):
if(j!=i and t//j!=i and j!=t//j):
flag=... |
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())
a=[]
for i in range(2,int(math.sqrt(n))+1):
if n%i==0 and not(i in a):
a.append(i)
n/=i
break
for i in range(2,int(math.sqrt(n))+1):
if n%i==0 and not(i in a):
a.append(i)
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.