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 = int(input())
for i in range(t):
n = int(input())
divisorarr = []
for divisor in range(2, int(n ** 0.5) + 2):
if n % divisor == 0:
while n % divisor == 0:
n = n // divisor
divisorarr.append(divisor)
if n != 1:
divisorarr.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)... | I = input
for _ in [0]*int(I()):
temp = int(I())
ans = []
for i in range(2,temp,1):
if(temp % i == 0):
ans.append(i)
break
elif i *i > temp:
break
if(len(ans) == 0 or ans[0]*ans[0] >= temp):
print("NO");continue
temp //= ans[0]
for i in range(ans[0],int(temp),1):
if(int(temp) % i == 0 and i != 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)... | #include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
int ans[2], j = -1, i;
long long n;
cin >> n;
for (i = 2; i * i <= n && j != 1; i++) {
if (n % i == 0) {
ans[++j] = i;
n = n / i;
}
}
long long ch = ans[0] * ans[1];
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)... | t = int(input())
for _ in range(t):
n = int(input())
nn = n
fac = []
i = 2
while i * i <= n:
cnt = 0
while n % i == 0:
cnt += 1
n //= i
if cnt:
fac.append((i, cnt))
i += 1
if n > 1:
fac.append((n, 1))
ok = False
... |
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)... | """
Author : Aman Thakur
mantra: chor kya hi kar sakte hai!!
"""
import math
class Solution:
def __init__(self):
self.arr = []
def solution(self):
n = int(input())
for i in range(2, n):
if n % i == 0:
self.arr.append(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)... | from math import *
for i in range(int(input())):
n=int(input())
j=2
count=0
num=[]
while j**2<=n:
if n%j==0:
if len(num)==1:
if n%(j*num[0])!=0:
j+=1
continue
num.append(j)
count+=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)... | """
Author : Aman Thakur
mantra: chor kya hi kar sakte hai!!
"""
import math
class Solution:
def __init__(self):
self.c = 0
self.arr = []
def solution(self):
n = int(input())
for i in range(2, n):
if n % i == 0:
self.arr.append(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)... | for _ in range(int(input())):
n=int(input())
sq=int(n**0.5 +1)
a=[]
d={}
for i in range(2,sq):
if(n%i==0):
x=n//i
a.append(i)
d[i]=x
d[x]=i
ch=1
for i in range(len(a)):
for j in range(i+1,len(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)... | import math
def ans(n):
a, b = -1, -1
for i in range(2, int(math.sqrt(n)) + 1):
if n % i == 0:
a = i
break
if a == -1:
print('NO')
return
for i in range(a + 1, int(math.sqrt(n)) + 1):
if (n % i == 0) & (n % (a * i) == 0):
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)... |
import sys
import math
from math import gcd
from heapq import heappop
from heapq import heappush
from heapq import heapify
from bisect import insort
from bisect import bisect_right
from bisect import bisect_left
from sys import stdin,stdout
from collections import defaultdict, deque
from math import log2, ceil, floor
... |
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())
p = tuple((n, 1))
lt = []
while n % 2 == 0:
lt.append(2)
n = n / 2
for i in range(3,int(math.sqrt(n))+1,2):
while n % i== 0:
lt.append(i),
n = n / i
if n > 2:
lt.append(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)... | from collections import Counter
def min_del(n, mn):
for x in range(max(2, mn), int(n ** .5) + 1):
if n % x == 0:
return x
return n
for _ in range(int(input())):
n = int(input())
a = min_del(n, 1)
ab = n // a
b = min_del(ab, a + 1)
c = n // b // a
if c != a and 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)... | #include <bits/stdc++.h>
using namespace std;
int main() {
long long t;
cin >> t;
while (t--) {
long long n, a = 2, b = 1, c = 1, t, cnt = 0;
cin >> n;
t = n;
while (cnt < 2 && n > 1) {
if (n % a == 0) {
if (cnt == 0) {
b = a;
} else {
c = 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)... | import java.io.*;
import java.util.*;
import java.math.*;
import java.lang.*;
import static java.lang.Math.*;
public class Numbers implements Runnable
{
static class InputReader
{
private InputStream stream;
private byte[] buf = new byte[1024];
private int curChar;
private 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 itertools import combinations as com
from math import sqrt
for _ in range (int (input())):
k=[]
a=int(input())
for i in range (2,int(sqrt(a))+1):
if a%i ==0:
if a//i==i:
k.append(i)
else:
k.append(i)
k.append(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)... | from math import sqrt
n=int(input())
for i in range(n):
m=int(input())
m1=m
c=2
p=[]
while len(p)<3 and c<=sqrt(m1):
if m%c==0:
m=m//c
p.append(c)
else:
if c==2:
c=c+1
else:
c=c+2
if len(p)==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)... | from sys import stdin, stdout
from collections import defaultdict
import math
rl = lambda: stdin.readline()
rll = lambda: stdin.readline().split()
def main():
cases = int(input())
for line in stdin:
n = int(line)
ans = []
f1 = 2
while f1 <= math.sqrt(n):
if n % f1 == 0:
ans.append(f1)
break
f1... |
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)... | /*package whatever //do not write package name here */
import java.util.*;
public class Main {
public static void main (String[] args) {
Scanner s = new Scanner(System.in);
int t = s.nextInt();
for(int tt=0;tt<t;tt++)
{
int n = s.nextInt();
int no = 0;
ArrayList<Integer> x = new ArrayList<>... |
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
from functools import reduce
def solve():
for _ in range(int(stdin.readline())):
n=int(stdin.readline())
#a=list(set(reduce(list.__add__,([i,n//i]for i in range(1,int(n**(.5))+1) if n%i==0))))
flag,a1,a2,a3,tmp=0,0,0,0,0
for i in range(2,int(n**.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)... | #Author: ghoshashis545 -Ashis Ghosh
from __future__ import division, print_function
import os,sys
from io import BytesIO, IOBase
from math import ceil,sqrt
if sys.version_info[0] < 3:
from __builtin__ import xrange as range
from future_builtins import ascii, filter, hex, map, oct, zip
def ii(): return 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)... | t = int(input())
for i in range(t):
count = 0
flag = 0
a = []
n = int(input())
for j in range(2,int(n**0.5)+1):
if (count == 2 and n < j):
print("NO")
flag = 1
break
elif (count == 2 and n>j):
print("YES")
for x in 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)... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
while (n--) {
int flag = 0;
long long int q;
cin >> q;
for (long int i = 2; i <= sqrt(q); i++) {
if (q % i == 0) {
for (long int j = i + 1; j <= sqrt(q / i); j++) {
if ((q / i) % j == 0 && j != ((q ... |
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
input=sys.stdin.readline
f=lambda :list(map(int, input().split()))
for _ in range(int(input())):
n=int(input())
a=0
for i in range(2, int(sqrt(n))+1):
if n%i==0:
a=i
break
b=0
if a:
for i in range(a+1, int(sqrt(n//a))+1):
if (n//a)%i==0:
b=i
break
c=0
if b an... |
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())
ans1 = 1
ans2 = 1
ans3 = 1
p = 2
while n % p == 0:
if ans1 == 1:
ans1 *= p
elif ans2 == 1 or ans2 == ans1:
ans2 *= p
else:
ans3 *= p
n //= p
p = 3
while p <= n ** 0.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)... | from math import sqrt
t = int(input())
for _ in range(t):
n = int(input())
ans = []
for i in range(2, int(sqrt(n))+1):
if len(ans) == 2 and n>ans[-1]:
ans.append(n)
n = 1
break
elif n%i==0:
ans.append(i)
n//=i
if 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)... | #include <bits/stdc++.h>
using namespace std;
vector<int> printDivisors(int n) {
vector<int> v;
for (int i = 2; i <= sqrt(n); i++) {
if (n % i == 0) {
if (n / i == i)
v.push_back(i);
else {
v.push_back(n / i);
v.push_back(i);
}
}
}
return v;
}
int main() {
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)... | rr = raw_input
rri = lambda: int(raw_input())
rrm = lambda: map(int, raw_input().split())
MOD = 10 ** 9 + 7
INF = float('inf')
NINF = float('-inf')
YES, NO = "YES", "NO"
##
def factorize(n):
d = 2
facs = []
while d * d <= n:
e = 0
while n % d == 0:
n //= d
e += 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
from operator import mul
from functools import reduce
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) :
... |
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 math
def primeFactors(n):
temp = []
while n % 2 == 0:
temp.append(2)
n = n / 2
for i in range(3, int(math.sqrt(n))+1,2):
while n % i== 0:
temp.append(i)
n = n / i
if n > 2:
temp.append(int(n))
return temp
t = int(input())
whil... |
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 long long mod = 1e9 + 7;
const long long MX = 2e5 + 5;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int tc;
cin >> tc;
while (tc--) {
int n;
cin >> n;
vector<int> v;
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)... | // package Contest1294;
import java.util.*;
import java.lang.*;
import java.io.*;
public class C {
private static FastReader fr;
private static OutputStream out;
private static int mod = (int)(1e9+7);
private void solve() {
int t = fr.nextInt();
while(t-- > 0) {
long n = fr.nextLong();
ArrayList<Long>... |
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 vc2 {
// public static int[]arr=new int[100001];
public static void main(String[] args) {
Scanner scn=new Scanner(System.in);
int t=scn.nextInt();
// prime();
while(t-- !=0) {
int n=scn.nextInt();
int i=2;
boolean found=false;
int count=0;int[]a=new int[2];
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 math
t=int(input())
for i in range(0,t):
n=int(input())
n1=0
n2=0
n3=0
for j in range(2,int(math.ceil((math.sqrt(n))))):
if n%j==0:
n1=j
n3=n/j
break
else:
continue
z=0
for j in range(n1+1,(int(math.ceil((math.sqrt(n3)))... |
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 myCeil(long long num, long long divider) {
long long result = num / divider;
if ((result * divider) == num) return result;
return result + 1;
}
long long gcd(long long a, long long b) {
if (!b) return a;
return gcd(b, a % b);
}
int main() {
ios_base::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)... | #include <bits/stdc++.h>
int main() {
long long int n, t, m, i, a, b, c, k;
scanf("%lld", &t);
for (m = 1; m <= t; m++) {
k = 0;
scanf("%lld", &n);
for (i = 2; i <= sqrt(n); i++) {
if (n % i == 0) {
a = i;
n = n / i;
k++;
break;
}
}
if (k > 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 y in range(t):
n = int(input())
i = 2
a = n
ans = []
while(i*i <= n):
if(a%i == 0):
ans.append(i)
a //= i
i += 1
if len(ans) == 2: break
if(len(ans) != 2):
print("NO")
elif(a == ans[0] or a == ans[1]):
print("NO")
else:
print("YES")
print(ans[0],ans[1],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)... | import sys
from collections import defaultdict
import math
dic=defaultdict(int)
t=int(sys.stdin.readline())
for _ in range(t):
dic=defaultdict(int)
m=int(sys.stdin.readline())
d=m
l=[]
while m%2==0:
m=m//2
dic[2]+=1
#print(m,'mm')
for i in range(3,int(math.sqrt(d))+1,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 java.util.*;
import java.io.*;
import java.math.*;
import javafx.util.Pair;
public class Fff {
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws IOException {
BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));
Strin... |
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--) {
long long n, i, x = 0, y = 0, j;
cin >> n;
for (i = 2; i <= sqrt(n); i++) {
if (n % i == 0) {
x = i;
n /= i;
for (j = i + 1; j <= sqrt(n); j++) {
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)... | #include <bits/stdc++.h>
const long long int mod = 1e9 + 7;
const long long int INF = 10000000000000;
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
long long int t = 0;
cin >> t;
while (t--) {
long long int n = 0;
cin >> n;
long long int tn = n;
vector<long long 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 collections import defaultdict
from math import sqrt
input=sys.stdin.readline
for _ in range(int(input())):
n=int(input())
nn=n
d=defaultdict(int)
while n%2==0:
d[2]+=1
n//=2
for i in range(3,int(sqrt(n))+1,2):
while n%i==0:
d[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)... | # Why do we fall ? So we can learn to pick ourselves up.
from functools import reduce
def factors(n):
k = sorted(list(set(reduce(list.__add__,
([i,n//i] for i in range(1,int(n**0.5+1)) if n%i == 0)))))
return k[1:]
def solve():
n = int(input())
f = factors(n)
if len(f) < 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)... | from collections import Counter
def prime_factorize(n):
a = []
while n % 2 == 0:
a.append(2)
n //= 2
f = 3
while f * f <= n:
if n % f == 0:
a.append(f)
n //= f
else:
f += 2
if n != 1:
a.append(n)
a = Counter(a)
retur... |
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 printDivisors(n) :
i = 2
factors = {}
while i <= math.sqrt(n):
if (n % i == 0) :
if (n // i == i) :
factors[i] = 1
else :
factors[n//i] = 1
factors[i] = 1
i = i + 1
return factors
for t in range... |
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())
a = []
count = 0
for i in range(2, int(math.sqrt(n))):
if n%i==0:
n = n//i
a.append(i)
count += 1
if count == 2:
break
if count == 2 and a[1]!=n and a[0]!=n and 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
n = int(input())
Resulting_bool_list = []
Resulting_factor_list = []
for i in range(0,n):
factor_list = []
temp = []
num = int(input())
lim = math.floor(math.sqrt(num))
for i in range(2,lim+1):
if num % i == 0:
factor_list.append(i)
len_ = len(factor_list)
... |
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())
a = []
i=2
while(len(a)<2 and i*i <n):
if n%i ==0:
n=n//i
a.append(i)
i+=1
if len(a)==2 and n not in a:print("YES");print(n,*a)
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)... | import sys,math,itertools
from collections import Counter,deque,defaultdict
from bisect import bisect_left,bisect_right
from heapq import heappop,heappush,heapify, nlargest
from copy import deepcopy
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.... |
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
for i in range(int(input())):
a=int(input())
for j in range (2,int(sqrt(a))+1):
if a%j==0:
a=a//j
for k in range(j+1,int(sqrt(a))+1):
if a%k==0:
a=a//k
if a>k:
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 java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
... |
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 = (int)998244353;
const int M = (int)1000000007;
long long int gcd(long long int a, long long int b) {
if (b == 0) return a;
return gcd(b, a % b);
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
long long int t;
cin >> t;
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)... | nn = int(input())
import math
def isprime(n):
if n <= 7:
return False, 1
sqrt = int( math.sqrt(n) ) + 1
for i in range(2, sqrt):
if n % i == 0:
return True, i
return False, 1
def isprime2(n):
if n <= 3:
return False, 1
sqrt = 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)... |
# -*- coding: utf-8 -*-
# @Date : 2020-01-23 16:32:49
# @Author : raj lath (oorja.halt@gmail.com)
# @Link : link
# @Version : 1.0.0
import sys
sys.setrecursionlimit(10**5+1)
inf = int(10 ** 20)
max_val = inf
min_val = -inf
RW = lambda : sys.stdin.readline().strip()
RI = lambda : int(RW())
RMI = lambd... |
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 Counter
# def printDivisors(n) :
# i = 1
# l = []
# while i <= math.sqrt(n):
# if (n % i == 0) :
# if (n / i == i) :
# l.append(i)
# else :
# l.append(i)
# l.append(n//i)
# i = 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)... | import math
def div(n):
y=n
c=0
ans=[]
for i in range(2,int(math.sqrt(n))+1):
if y%i==0:
c+=1
y=y//i
ans.append(i)
if c>=2:
break
print("YES" if c>=2 and y not in ans else "NO")
if c>=2 and y not in ans:
print(*(ans... |
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
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)
break
if flag:
print("YES\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):
s=int(input())
s1=0
d=0
f=0
for j in range(2,int(math.sqrt(s))+1):
if s%j==0:
s1=j
d=s/j
for k in range(2,int(math.sqrt(d))+1):
if d%k==0:
s2=k
s3=d/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)... | for i in range(int(input())):
n = int(input())
m = []
i = 2
while i**2 < n and len(m) != 2:
if n % i == 0:
m.append(i)
n = n / i
i += 1
if len(m) != 2 or n == 1:
print('NO')
continue
m.append(int(n))
print('YES')
for i in 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)... | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
vector<int> divisors;
for (int i = 2; i * i <= n; i++) {
if (n % i == 0) {
divisors.push_back(i);
if (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 dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1, -1, 1, -1, 0, 0, -1, 1};
const double PI = acos(-1.0);
const double EPS = 1e-6;
const int MOD = (int)1e9 + 7;
const int maxn = (int)2e5 + 5;
const int LOGN = 20;
bitset<10000005> isprime;
vector<long long> prime;
vect... |
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 factor(n):
s=set()
for i in range(2,int(n**0.5)+1):
if n%i==0:
s.add(i)
s.add(n//i)
f=list(s)
f.sort()
return f
t=int(input())
while t:
t-=1
n=int(input())
f=factor(n)
# print(f)
b=0
if f:
for i in range(len(f)//2):
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)... | t = int(input())
import math
for i in range(t):
n = int(input())
res = []
c = 0
a = 0
q = int(math.sqrt(n)) + 2
for j in range(2,q):
if n % j == 0:
n = n // j
res.append(j)
a = j + 1
c += 1
break
if c == 1:
q =... |
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)... | /**
* BaZ :D
*/
import java.util.*;
import java.io.*;
import static java.lang.Math.*;
public class Main
{
static MyScanner scan;
static PrintWriter pw;
static long MOD = 1_000_000_007;
static long INF = 1_000_000_000_000_000_000L;
static long inf = 2_000_000_000;
public static void main(Stri... |
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 product(n):
for i in range(2,int(n**(1/2))):
if n%i==0:
for j in range(2,int((n)**(1/2))):
if (n//i)%j==0 and j!=i and (n//i)/j!=i and j!=(n//i)**(1/2):
print("YES")
print(i,j,(n//i)//j)
return
print("NO")
re... |
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)... | # imports
"""Fill in here"""
import math
# Set to False for input from standard in
debug = False
if debug:
f = open('test', 'r')
else:
f = None
def line(file):
if debug:
return file.__next__().strip()
return input()
# Solve
"""Fill in here"""
# array = [int(i) for i in line(f).split(' ')]
... |
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)... | fast=lambda:stdin.readline().strip()
zzz=lambda:[int(i) for i in fast().split()]
z,zz=input,lambda:list(map(int,z().split()))
szz,graph,mod,szzz=lambda:sorted(zz()),{},10**9+7,lambda:sorted(zzz())
from re import *
from sys import *
from math import *
from heapq import *
from queue import *
from bisect import *
from str... |
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_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int i, j, t, n;
cin >> t;
while (t--) {
cin >> n;
if (n == 1) {
cout << "NO" << endl;
continue;
}
int m = n;
map<int, int> mp;
vector<int> v;
fo... |
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
T = int(sys.stdin.readline())
for _ in range(T):
n = int(sys.stdin.readline())
res = set()
start_i = 2
for _ in range(2):
for i in range(start_i, int(n**0.5)+1):
if not n%i:
n//=i
start_i=i+1
res.add(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 sys
import math
import itertools
import functools
import collections
import operator
import fileinput
import copy
ORDA = 97 # a
def ii(): return int(input())
def mi(): return map(int, input().split())
def li(): return [int(i) for i in input().split()]
def lcm(a, b): return abs(a * b) // math.gcd(a, b)
def rev... |
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 p in range(int(input())):
num=int(input())
b=[]
a=num
for i in range(2,int(math.sqrt(num))+1):
if(len(b)<2):
if(a%i==0):
b.append(int(i))
a/=i
else:
break
if((a not in b) and (len(b)==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)... | import math
def pr(a,m):
n=len(a)
d={}
l=[]
for i in range(n):
d[a[i]]=i
c=0
for i in range(n-1):
for j in range(i+1,n):
if ((a[i]*a[j]<=m) and (a[i]*a[j]!=0) and (m%(a[i]*a[j])==0)):
check=m//(a[i]*a[j])
if( check!=1 and check!=a[i] an... |
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())):
num = int(input())
done = False
for i in range(2, int(num ** (1/3)) + 8):
if num % i != 0:
continue
new_num = num // i
for j in range(i + 1, int(num ** .5) + 8):
if new_num % j == 0 and new_num // j not in [i, 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)... | #include <bits/stdc++.h>
using namespace std;
vector<long long> vec;
void primeFactors(long long n) {
while (n % 2 == 0) {
vec.push_back(2);
n = n / 2;
}
for (long long i = 3; i <= sqrt(n); i = i + 2) {
while (n % i == 0) {
vec.push_back(i);
n = n / i;
}
}
if (n > 2) vec.push_back(... |
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())
rt = int(n**.5)
st = set()
flag=0
for i in range(2,rt+1):
if(n%i==0):
k = n//i
v = int(k**.5)
for j in range(2,v+1):
if(k%j==0 and i!=j):
if(k//j!=i and k//j !=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 queries in range(t):
n = int(input())
m = n
r = 2
array = []
while r <= 25000:
if n % r == 0:
array.append(r)
n //= r
r += 1
if len(array) == 2:
break
if len(array) == 2 and n > array[1]:
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 java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
public class Main {
InputStream is;
PrintWriter out;
String INPUT = "";
void solve() {
outer:
for(int T = ni(); T > 0; 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)... | import java.util.Scanner;
public class Main {
/**
* @param args
*/
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t-->0){
int n = sc.nextInt();
doTheTask(n);
}
}
static void doTheTask (int n)
{
for (int i=2; i*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 math
t = int(input())
for _ in range(t):
n = int(input())
ul = math.sqrt(n)
ul = int(ul)
ul += 1
l = []
count = 0
flag = 0
for i in range(2,ul+1):
if count == 2:
break
if n%i==0:
l.append(i)
count += 1
n = n//i
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 math import *
t=int(input())
for _ in range(t):
n=int(input())
c=0
l=[]
r=floor(sqrt(n))+1
for i in range(2,r):
if n%i==0:
l.append(i)
c=c+1
n=n//i
if c==2:
break
if len(l)==2:
if n==l[0] or n==l[1]:
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 x in range(int(input())):
n = int(input())
k=0
a=set()
for i in range(2,int(n**0.5)+1):
if(n%i==0 and k<2):
n//=i
k+=1
a.add(i)
#print(i)
if(k==2 and n>1):
a.add(n)
if(len(a)==3 ):
#a.append(n)
a=sorted(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)... | def solve(n):
a, b, c = None, None, n
i = 2
while c >= 2 and i * i <= c:
if c % i == 0:
c //= i
if a is None:
a = i
elif c >= 2 and len(set((a, i, c))) == 3:
return a, i, c
i += 1
raise ValueError()
for T in range(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.io.IOException;
import java.util.*;
import javax.lang.model.util.ElementScanner6;
import java.lang.*;
import java.io.*;
public class Solution
{
public static void main(String args[])throws IOException
{/*
InputStreamReader isr=new InputStreamReader(System.in);
BufferedReader br=ne... |
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 find(num):
a=0
b=0
i=2
while (i*i)<=num:
if num%i==0:
if a==0:a=i
elif b==0:b=i
num=num//i
if a>0 and b>0:
return [a,b]
i+=1
return None
for i in range(int(input())):
n=int(input())
A=find(n)
if not A or n<=2:print("NO")
else:
a=A[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)... | # -*- coding: utf-8 -*-
import sys
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(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)... | from collections import defaultdict, deque
from itertools import permutations
from sys import stdin,stdout
from bisect import bisect_left, bisect_right
from copy import deepcopy
#from random import randint
int_input=lambda : int(stdin.readline())
string_input=lambda : stdin.readline()
multi_int_input =lambda : map(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)... | #include <bits/stdc++.h>
using namespace std;
int pri[100003], top, n;
bool ntp[100002];
struct node {
int a, b;
bool operator<(const node &rhs) const { return b > rhs.b; }
};
void euler() {
for (int i = 2; i <= 100000; ++i) {
if (!ntp[i]) pri[top++] = i;
for (int j = 0; j < top && pri[j] * i <= 100000; +... |
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)... | /*package whatever //do not write package name here */
import java.io.*;
import java.util.*;
public class GFG {
static String solve(ArrayList<Integer> div,int n)
{
HashSet<Integer> set=new HashSet<>();
int sz=div.size();
for(int i=0;i<sz;i++)
set.add(div.get(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)... | t=int(input())
for _ in range(t):
n=int(input())
a=b=c=-1
for i in range(2,int(n**0.5)+1):
if n%i==0:
a=i
n//=i
break
for i in range(2,int(n**0.5)+1):
if n%i==0 and i!=a:
b=i
n//=i
break
if b!=-1 and n!=a an... |
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 Int = long long;
using namespace std;
vector<pair<Int, Int>> primeFactors(Int n) {
vector<pair<Int, Int>> result;
Int factor = 0;
Int factorCount = 0;
Int q = n;
if (n >= 2) {
for (Int i = 2; i * i <= n;) {
if (q % i == 0) {
if (i != factor) {
factor ... |
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;
void helper(long long int n) {
set<int> nums;
for (int i = 2; i * i <= n; i++) {
if (n % i == 0 && !nums.count(i)) {
nums.insert(i);
n /= i;
break;
}
}
for (int i = 2; i * i <= n; i++) {
if (n % i == 0 && !nums.count(i)) {
nums.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 long long INF = 1e9;
const long long N = 1e3 + 500;
const long long mod = 1e9 + 7;
const long double eps = 1E-7;
long long n, mx, mn, cnt, m, ans;
long long a, b, c;
string s;
long long used[N];
char z;
int main() {
ios_base::sync_with_stdio(0);
long long 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)... | for _ in range(int(input())):
n = int(input())
l = []
til = int(n**0.5)+1
i = 2
while i < til:
if n%i==0:
til = int((n//i)**0.5)+1
n= (n//i)
l.append(i)
if len(l)==2:
break
i+=1
if n > 1 and n not in l and len(l)==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())
for _ in range(t):
n = int(input())
i = 2
arr = [0,0,0]
k = 0
while(i * i <= n):
if (n % i == 0):
arr[k] = i
n = int(n/i)
k+=1
if (k == 2):
break
i+=1
arr[2] = n
if(arr[1] >1 and arr[0] > 1 and arr[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)... | for _ in range(int(input())):
num=int(input())
list1=[]
j=2
while(j*j<num and len(list1)<2):
if(num%j==0):
num=num//j
list1.append(j)
j+=1
if(len(list1)==2 and num not in list1):
print("YES")
for k in list1:
print(k,end=" ")
... |
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
b= int(input())
t=[]
for j in range(b):
t.append(int(input()))
for a in t :
c=3
i = 2
s = ''
while a > 1 and a // i >= 1 and i <=math.pow(a,1/c):
if (a % i == 0):
a = a // i
s = s + i.__str__() + ' '
c=c-1
if (s.split(' ').__len__(... |
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, s = int(input()), []
for i in range(2, int(n**(1/2)+1)):
if n % i == 0:
s.append(i)
n = n // i
if len(s) == 2 and s[0]!=n and s[1]!=n:
break
if len(s) == 2 and s[0]!=n and s[1]!=n:
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
n = int(input())
def sd(n, notin):
i = 2
while i * i < n:
if n % i == 0 and i not in notin:
return i
i += 1
return n
for i in range(n):
a = int(input())
aa = a
sq = int(math.sqrt(a)) + 1
divisor = []
while True:
s = sd(a, divisor)... |
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 product_of_three_numbers():
num_test = int(input())
count = 0
n_list = []
while count < num_test:
n_list += [int(input())]
count += 1
answer_list = []
for idx, n in enumerate(n_list):
if n <= 5:
answer_list += ["NO"]
continue
breakit ... |
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)... | v = int(input())
for i in range(v):
b = list(map(int,input().split()))[:v]
c = 0
a = []
for j in b:
for h in range(2,int(j**(0.5))+1):
if j%h==0:
c+=1
j = j//h
a.append(h)
if len(a)==2:
break
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.