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)...
def solution(n): for first_dis in range(2, int(n**0.5) + 1): if n % first_dis == 0: next_value = n // first_dis for second_dis in range(first_dis + 1, int(next_value**0.5) + 1): if next_value % second_dis == 0: third = next_value // second_dis ...
You are given one integer number n. Find three distinct integers a, b, c such that 2 ≀ a, b, c and a β‹… b β‹… c = n or say that it is impossible to do it. If there are several answers, you can print any. You have to answer t independent test cases. Input The first line of the input contains one integer t (1 ≀ t ≀ 100)...
from math import sqrt def solve(n): if isprime(n,2)==-1:return 'NO' i=2 while i<=sqrt(n): if n%i==0: p=isprime(n//i,i+1) if p!=-1:return i,p i+=1 return 'NO' def isprime(n,b): i=b while i<=sqrt(n): if n%i==0 and i!=n//i:return i,n//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)...
t = int(input()) for _ in range(t): n = int(input()) sqn = int(n**(1/2))+10 ans = [] flag = False for i in range(2,sqn): if n%i==0: ans.append(i) n//=i if len(ans)==2: if n==ans[1] or n==ans[0] or n==1: print("NO") ...
You are given one integer number n. Find three distinct integers a, b, c such that 2 ≀ a, b, c and a β‹… b β‹… c = n or say that it is impossible to do it. If there are several answers, you can print any. You have to answer t independent test cases. Input The first line of the input contains one integer t (1 ≀ t ≀ 100)...
import java.io.*; import java.util.*; import java.lang.*; // A U T H O R : s a n 1 d h y a public class cf1294C { static long Mod1 = 1000000007; static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } 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 d(i,n): if(i==2 and n%2==0): return 2; while(i**2<=n): if(n%i == 0): return i i+=1 return n; t=int(input()) for _ in range(t): n=int(input()) a = d(2,n); b= d(a+1,n/a); c = n//(a*b) if(c>=2 and c!=a and c!=b): print("YES") print(a,b...
You are given one integer number n. Find three distinct integers a, b, c such that 2 ≀ a, b, c and a β‹… b β‹… c = n or say that it is impossible to do it. If there are several answers, you can print any. You have to answer t independent test cases. Input The first line of the input contains one integer t (1 ≀ t ≀ 100)...
# _1294c ########## def productOfThreeNumbers(n, answer=(1, )): lengthOfAnswer = len(answer) if lengthOfAnswer == 3: if n > answer[-1]: return f'YES\n{answer[1]} {answer[2]} {int(n)}' return 'NO' for i in range(answer[-1]+1, int(n**(1/(4-lengthOfAnswer)))+1): if not n%i: return productOfThreeNumber...
You are given one integer number n. Find three distinct integers a, b, c such that 2 ≀ a, b, c and a β‹… b β‹… c = n or say that it is impossible to do it. If there are several answers, you can 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 nt in range(int(input())): n = int(input()) if n<24: print ("NO") continue p = [] curr = 2 while curr*curr<n: if n%curr==0: n=n//curr p.append(curr) if len(p)==2: break curr+=1 if len(p)<=1: print ("NO") continue if n not in p: print ("YES") print (p[0],p[1],n) 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 math def primeFactors(n): prime = [] while n % 2 == 0: prime.append(2) n = n // 2 i = 3 while i <= math.sqrt(n): while n % i == 0: prime.append(i) n = n//i i += 2 if n > 2: prime.append(n) return prime te = int(input()) w...
You are given one integer number n. Find three distinct integers a, b, c such that 2 ≀ a, b, c and a β‹… b β‹… c = n or say that it is impossible to do it. If there are several answers, you can 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); long long t; cin >> t; while (t--) { long long n; cin >> n; long long copy = n; vector<pair<long long, long long>> v; long long count = 0; while (!(n % 2)) { n >>= 1; co...
You are given one integer number n. Find three distinct integers a, b, c such that 2 ≀ a, b, c and a β‹… b β‹… c = n or say that it is impossible to do it. If there are several answers, you can 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,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)...
from __future__ import division import sys input = sys.stdin.readline import math from math import sqrt, floor, ceil from collections import Counter, defaultdict from copy import deepcopy as dc ############ ---- Input Functions ---- ############ def inp(): return(int(input())) def inlt(): return(list(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)...
# Problem C T = int(input()) for _ in range(T): n = int(input()) a = 0 b = 0 c = 0 for i in range(2, int(n**0.5)): if n % i == 0: a = i break else: continue if a != 0: for i in range(a+1, int(n**0.5)): if n/a % 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 for i in range(int(input())): n=int(input()) l=[] count=0 for i in range(2,int(math.sqrt(n))+1): if n%i==0: l.append(i) n=n//i break for i in range(2,int(math.sqrt(n))+1): if n%i==0 and len(l)==1 and l[0]!=i: l.append(i) ...
You are given one integer number n. Find three distinct integers a, b, c such that 2 ≀ a, b, c and a β‹… b β‹… c = n or say that it is impossible to do it. If there are several answers, you can print any. You have to answer t independent test cases. Input The first line of the input contains one integer t (1 ≀ t ≀ 100)...
import java.util.*; import java.io.*; public class Aman { public static void main(String args[]) { Scanner in = new Scanner(System.in); int t = in.nextInt(); for(int i = 0; i < t; i++) { int n = in.nextInt(); int ans[] = new int[3]; int m = 0; ...
You are given one integer number n. Find three distinct integers a, b, c such that 2 ≀ a, b, c and a β‹… b β‹… c = n or say that it is impossible to do it. If there are several answers, you can print any. You have to answer t independent test cases. Input The first line of the input contains one integer t (1 ≀ t ≀ 100)...
#include <bits/stdc++.h> using namespace std; int main() { int t = 1; cin >> t; while (t--) { long long int i, j, k = 0, n, m, s, s1, l, r, x, y, a = 1, b = 1; cin >> n; for (i = 2; i * i <= n; i++) { if (n % i == 0) { a = i; n = n / i; break; } } for (i = 2...
You are given one integer number n. Find three distinct integers a, b, c such that 2 ≀ a, b, c and a β‹… b β‹… c = n or say that it is impossible to do it. If there are several answers, you can print any. You have to answer t independent test cases. Input The first line of the input contains one integer t (1 ≀ t ≀ 100)...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n, ans = 0, i; cin >> n; vector<int> v; for (i = 2; i < pow(n, 0.5); i++) { if (ans == 2) break; if (n % i == 0) { ans++; n = n / i; v.push_back(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)...
prime = [] l = [] for i in range(40000): prime.append(True) for i in range(2,40000): if prime[i] == True: l.append(i) tmp = 2*i while tmp < 40000: prime[tmp] = False tmp += i t = int(input()) for i in range(t): n = int(input()) flag = False for j in 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)...
from math import sqrt t = int(input()) for i in range(t): n = int(input()) l = [] temp = n for j in range(2,int(sqrt(n))+1): if temp%j == 0: l.append(j) temp = temp//j if len(l) == 2: break if len(l) < 2: print("NO") continue l.append(n//(l[0]*l[1])) # print(l) l.sort() a,b,c = l[0],l[1],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)...
from math import sqrt def primes(n): y, count, result = n, 0, list() for i in range(2, int(sqrt(n)) + 1): if y % i == 0: count += 1 y = y // i result.append(i) if count >= 2: break print("YES" if count >= 2 and y not in result else "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 for i in range(int(input())): n=int(input()) r=[] q=2 i=0 while i<2 and q<=math.sqrt(n): if n%q==0: r.append(q) i+=1 n=n//q q+=1 if n!=1: r+=[n] if len(r)<3 or r[1]==r[2] or r[0]==r[2] or r[0]==r[1]: print('NO') ...
You are given one integer number n. Find three distinct integers a, b, c such that 2 ≀ a, b, c and a β‹… b β‹… c = n or say that it is impossible to do it. If there are several answers, you can print any. You have to answer t independent test cases. Input The first line of the input contains one integer t (1 ≀ t ≀ 100)...
#include <bits/stdc++.h> using namespace std; long long int j, pri[100005], i; vector<long long int> prime; int main() { long long int t; cin >> t; while (t--) { long long int n, tmp, cnt = 0, prod = 1; cin >> n; tmp = n; unordered_set<long long int> st; for (i = 2; i <= ceil(sqrt(tmp)); 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)...
''' * Author : Ayushman Chahar # * About : II Year, IT Undergrad # * Insti : VIT, Vellore # ''' import os import sys import math from io import BytesIO, IOBase BUFSIZE = 8192 class FastIO(IOBase): newlines = 0 def __init__(self, file): self._fd = file.fileno() self.buffer = BytesIO() ...
You are given one integer number n. Find three distinct integers a, b, c such that 2 ≀ a, b, c and a β‹… b β‹… c = n or say that it is impossible to do it. If there are several answers, you can print any. You have to answer t independent test cases. Input The first line of the input contains one integer t (1 ≀ t ≀ 100)...
#Ashish Sagar import math q=int(input()) for _ in range(q): n=int(input()) l=[] for i in range(2,int(math.sqrt(n))): if n%i==0: n=n//i l.append(i) break for i in range(2,int(math.sqrt(n))+1): if n%i==0 and len(l)==1 and i!=l[0]: n=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 sys # sys.setrecursionlimit(10**6) from sys import stdin, stdout import bisect #c++ upperbound import math import heapq def modinv(n,p): return pow(n,p-2,p) def cin(): return map(int,sin().split()) def ain(): #takes array as input return list(map(int,sin().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)...
#include <bits/stdc++.h> using namespace std; const long double PI = acos(-1.0L); const long double EPS = 1e-12L; mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count()); namespace task { int t, n, k; vector<int> p; int main() { cin >> t; while (t--) { cin >> n; k = n; 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)...
#include <bits/stdc++.h> using namespace std; void find(vector<long long int>& v, long long int n) { for (long long int i = 2; i <= sqrt(n); i++) { while (n > 0 && n % i == 0) { v.push_back(i); n = n / i; } } } int main() { int t; cin >> t; while (t--) { long long int n, a, b, c; 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)...
# -*- coding: utf-8 -*- """ Created on Wed Feb 12 15:07:02 2020 @author: MilΓ‘n """ import math t = int(input()) L = [] for i in range(t): L += [int(input())] def multiples(n): i = 2 while i <= math.floor(n ** (1./3.)): if n%i == 0: j = i + 1 k = n/i w...
You are given one integer number n. Find three distinct integers a, b, c such that 2 ≀ a, b, c and a β‹… b β‹… c = n or say that it is impossible to do it. If there are several answers, you can 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, a, b, c; bool solve() { cin >> n; int i = 2; for (i = 2; i * i < n; i++) { if (n % i == 0) { n /= i; a = i; break; } } for (int j = 2; j * j < n; j++) { if (j == i) continue; if (n % j == 0) { b = j; c = n / j; ...
You are given one integer number n. Find three distinct integers a, b, c such that 2 ≀ a, b, c and a β‹… b β‹… c = n or say that it is impossible to do it. If there are several answers, you can print any. You have to answer t independent test cases. Input The first line of the input contains one integer t (1 ≀ t ≀ 100)...
from math import sqrt test = int(input()) while test > 0: test -= 1 n = int(input()) first = [] sz = 0 for i in range (2, int(sqrt(n)+1)): if(n % i == 0): first.append(i) sz += 1 found = False for i in range (sz): for j in range (i+1, sz): ...
You are given one integer number n. Find three distinct integers a, b, c such that 2 ≀ a, b, c and a β‹… b β‹… c = n or say that it is impossible to do it. If there are several answers, you can 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 = lambda:sys.stdin.readline() int_arr = lambda: list(map(int,input().split())) str_arr = lambda: list(map(str,input().split())) get_str = lambda: map(str,input().split()) get_int = lambda: map(int,input().split()) get_flo = lambda: map(float,input().split()) mod = 1000000007 def solve(n): 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)...
#include <bits/stdc++.h> int main() { int x, i, j, k, n, c, m[3]; scanf("%d", &x); while (x--) { j = 0; c = 0; scanf("%d", &n); for (i = 2; i * i <= n; i++) { if (n % i == 0) { k = n / i; if (k > i) { for (j = 2; j * j <= k; j++) { if (k % j == 0 && 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)...
import java.util.Scanner; public class task_c { public String answer; public boolean correct; public task_c() { Scanner scanner = new Scanner(System.in); int number = scanner.nextInt(); for (int i = 0; i<number; i++) { int zahl = scanner.nextInt(); answer = ""; correct = false; recursion(zahl, 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)...
#include <bits/stdc++.h> using namespace std; #pragma comment(linker, "/STACK:10240000000,10240000000") char ch; int bo; inline bool blank(char ch) { return ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t'; } inline void rd(int &x) { x = bo = 0; for (ch = getchar(); ch < '0' || ch > '9'; ch = getchar()) 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)...
import java.io.*; import java.math.BigInteger; import java.util.*; public class Main { static class FastReader { final private int BUFFER_SIZE = 1 << 16; private DataInputStream din; private byte[] buffer; private int bufferPointer, bytesRead; public Fast...
You are given one integer number n. Find three distinct integers a, b, c such that 2 ≀ a, b, c and a β‹… b β‹… c = n or say that it is impossible to do it. If there are several answers, you can 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 solve() { long long n; cin >> n; set<long long> s; for (int i = 2; i * i <= n; i++) { if (n % i == 0) { n = n / i; s.insert(i); break; } } for (int i = 2; i * i <= n; i++) { if (n % i == 0 && !s.count(i)) { n = 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)...
t = int(input()) for _ in range(t): n = int(input()) if n < 2*3*4: print("NO") else: r = [] i = 2 j = 3 while j > 1: l = len(r) for k in range(i, int(n**(1/j) + 2)): if n % k == 0: r.append(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 t = int(input()) for i in range(t): n = int(input()) li = [] n_ = math.ceil(n** 0.5) for j in range(2,n_): if n % j == 0: li.append(j) n = n // j if n != 1: li.append(n) if len(li) <= 2: print("NO") else: w1 = li[0] w2 = li[1] w3 = 1 for k in range(2,len(li)): w3 = w3 * ...
You are given one integer number n. Find three distinct integers a, b, c such that 2 ≀ a, b, c and a β‹… b β‹… c = n or say that it is impossible to do it. If there are several answers, you can 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 find_factors(n): l = [] while n % 2 == 0: l.append(2) n //= 2 for i in range(3,int(math.sqrt(n)+1),2): while n % i == 0: l.append(i) n //= i if n > 2: l.append(n) return l for _ in range(int(input())): n = int(input()) ...
You are given one integer number n. Find three distinct integers a, b, c such that 2 ≀ a, b, c and a β‹… b β‹… c = n or say that it is impossible to do it. If there are several answers, you can print any. You have to answer t independent test cases. Input The first line of the input contains one integer t (1 ≀ t ≀ 100)...
import java.util.* ; import java.math.*; import java.io.*; public class javaTemplate { // public static final int M = 1000000007 ; public static final int M = 1000003 ; static FastReader sc = new FastReader(); // static Scanner sc = new Scanner(System.in) ; public static void main(String[] args) { ...
You are given one integer number n. Find three distinct integers a, b, c such that 2 ≀ a, b, c and a β‹… b β‹… c = n or say that it is impossible to do it. If there are several answers, you can 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 sol(n): ans = [] i = 2 cnt = 0 while n > 0 and i*i <= n: if not(n%i): cnt += 1 n //= i ans.append(i) i += 1 if cnt >= 2: break tr = cnt >= 2 and n not in ans print("YES" if tr else "NO") if tr: print(*ans[: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)...
def helper(n): upper = int(n**0.5) + 1 for i in range(2, upper): if n % i == 0: curr = n //i for j in range(i + 1, upper): if curr % j == 0: new_curr = curr //j if i < j < new_curr: return [i, j, new_curr] return [] ...
You are given one integer number n. Find three distinct integers a, b, c such that 2 ≀ a, b, c and a β‹… b β‹… c = n or say that it is impossible to do it. If there are several answers, you can 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=N L=[] while(n%2==0): L.append(2) n=n//2 for i in range(3,int(math.sqrt(n))+1,2): while n % i== 0: L.append(i) n = n // i if(n>2): L.append(n) #print(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)...
from math import ceil t = int(input()) for i in range(t): n = int(input()) ans = [] if n < 24: print('NO') else: for i in range(2, ceil(n**(1/3))+1): if n % i == 0: ans.append(i) break if len(ans)==0: print('NO') el...
You are given one integer number n. Find three distinct integers a, b, c such that 2 ≀ a, b, c and a β‹… b β‹… c = n or say that it is impossible to do it. If there are several answers, you can print any. You have to answer t independent test cases. Input The first line of the input contains one integer t (1 ≀ t ≀ 100)...
#include <bits/stdc++.h> using namespace std; template <typename T, typename TT> ostream& operator<<(ostream& os, const pair<T, TT>& t) { return os << t.first << " " << t.second; } template <typename T> ostream& operator<<(ostream& os, const vector<T>& t) { for (auto& i : t) os << i << " "; return os; } int main(...
You are given one integer number n. Find three distinct integers a, b, c such that 2 ≀ a, b, c and a β‹… b β‹… c = n or say that it is impossible to do it. If there are several answers, you can 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 getFacts(n): facts = [] for i in range(2,int(n**0.5)+1): if n%i == 0: facts.append(i) if i != n//i: facts.append(n//i) return facts def solve(n): facts = getFacts(n) for i in range(len(facts)): a = facts[i] bc = n//a f = g...
You are given one integer number n. Find three distinct integers a, b, c such that 2 ≀ a, b, c and a β‹… b β‹… c = n or say that it is impossible to do it. If there are several answers, you can 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 x = [] while i <= math.sqrt(n): if (n % i == 0) : if (n / i == i) : x.append(i) else : x.append(i) x.append(n//i) i = i + 1 return x t = int(input()) for test 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)...
for _ in range(int(input())): n=int(input()) l=[] i=2 while len(l)<2 and i*i<n: if n%i==0: l.append(i) n=n//i i+=1 if len(l)==2 and n not in l: print("YES") print(*l,n) 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)...
for t in range(int(input())): n=int(input()) p,q=0,0 """ for i in range(2,int(n)): if c==1: break elif n%i==0: for j in range(2,int(pow(n,1/2))+1): if j==i: continue if c==1: break ...
You are given one integer number n. Find three distinct integers a, b, c such that 2 ≀ a, b, c and a β‹… b β‹… c = n or say that it is impossible to do it. If there are several answers, you can print any. You have to answer t independent test cases. Input The first line of the input contains one integer t (1 ≀ t ≀ 100)...
import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; import java.util.ArrayList; import java.util.List; public class ProductofThreeNumbers { static int mod = 1000000007; static class Reader { final private int BUFFER_SIZE = 1 << 16; private DataInputStream din; private 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)...
def compute_problem(n): if n < 24: print("NO") elif n % 10 == 0: a = 2 n_div_10 = int(n/10) b = min(5, n_div_10) c = max(5, n_div_10) if b != c: print("YES") print(a, b, c, sep=" ") else: print("NO") else: 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)...
for _ in range(int(input())): n = int(input()) a = [] d = 2 while len(a) < 2 and d * d <= n: if 0 == n % d: a += d, n //= d d += 1 if a and n > a[-1]: a += n, if len(a) < 3: print('NO') else: print('YES') print(*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; scanf("%d", &t); while (t--) { int n; scanf("%d", &n); int arr[3]; int k = 0; for (int i = 2; i * i <= n && k < 2; i++) { if (n % i == 0) { n /= i; arr[k++] = i; } } if (k == 2 && arr[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)...
def Find(n): for i in range(2,int(n**0.5)+1): if (not n%i): p = int(n/i) if (p >= 2): for j in range(2,int(p**0.5)+1): if (i != j) and (not p%j): k = int(p/j) if (k>=2) and (i != k) and (j != 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)...
t = int(input()) while t: n = int(input()) i = 2 a = 0 while i*i<=n: if n%i==0: a=i n=n/i break i+=1 i =2 b =0 while i*i<=n: if n%i==0 and a!=i: b= i n=n/i c = n break i+=1 if(a>=2 and b>=2 and c>=2 and c!=b and c!=a): print("YES") print(int(a),int(b),int(c)) else: print("N...
You are given one integer number n. Find three distinct integers a, b, c such that 2 ≀ a, b, c and a β‹… b β‹… c = n or say that it is impossible to do it. If there are several answers, you can print any. You have to answer t independent test cases. Input The first line of the input contains one integer t (1 ≀ t ≀ 100)...
import math from collections import Counter def primeFactors(n): a = [] c = 0 while n % 2 == 0: a.append(2) n = n // 2 c+=1 # n must be odd at this point # so a skip of 2 ( i = i + 2) can be used for i in range(3, int(math.sqrt(n)) + 1, 2): # while i divides n , ...
You are given one integer number n. Find three distinct integers a, b, c such that 2 ≀ a, b, c and a β‹… b β‹… c = n or say that it is impossible to do it. If there are several answers, you can print any. You have to answer t independent test cases. Input The first line of the input contains one integer t (1 ≀ t ≀ 100)...
#include <bits/stdc++.h> using namespace std; template <typename T> void print(set<T> v) { for (auto x : v) cout << x << " "; cout << endl; } set<long long int> count_div(long long int m, long long int j) { set<long long int> s; for (long long int i = 1; i <= sqrtl(m); i++) { if (m % i == 0 && 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)...
for _ in range(int(input())): n=int(input()) ans=False for i in range(2,int(n**(0.5))+1): a=i if n%i==0: div=n//i for j in range(2,int(div**0.5)+1): if div%j==0 and j!=a: div2=div//j if div2!=1 and div2!=j and di...
You are given one integer number n. Find three distinct integers a, b, c such that 2 ≀ a, b, c and a β‹… b β‹… c = n or say that it is impossible to do it. If there are several answers, you can 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 res=[1,1,1] def del1(a,k,d): sqrtlam=lambda x : math.sqrt(x) for i in range(d,math.ceil(sqrtlam(a))): if a%i==0: if(k)==1: if(int(a/i)!=res[0]): res[1]=int(i) res[2]=int(a/i) return 1 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 def wa(a): for i in range(2,int(math.sqrt(a)),1): if(a%i==0): return False return True def ans(a): count=0 f=0 l=[] s='' d=int(math.sqrt(a)) for i in range(2,d+1,1): if(a%i==0): l.append(i) count+=1 a=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 def function(num): var = int(math.sqrt(num)) + 1 for i in range(2,var+1): if (num%i == 0) and (num//i != i): return list((i,num//i)) t = int(input()) for _ in range(t): count = 0 n = int(input()) num = int(math.sqrt(n)) + 1 for i in range(2,num): if n%i == 0: func = function(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)...
#include <bits/stdc++.h> using namespace std; void solve() { set<int> s; int n, i, a, l, p = 1, pr = 1; cin >> n; l = n; for (i = 2; i * i <= l; i++) { if (n % i == 0 && p < 3) { s.insert(i); n = n / i; if (p == 2 && n != 1) { s.insert(n); } p++; } } for (set<...
You are given one integer number n. Find three distinct integers a, b, c such that 2 ≀ a, b, c and a β‹… b β‹… c = n or say that it is impossible to do it. If there are several answers, you can 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()) ans = 'NO' p = q = 1 for j in range(2, int(n ** (1 / 3)) + 2): if n % j == 0: p = j n = n // p ans = 'YES' break if ans == 'YES': ans = 'NO' for j in range(p + 1, int(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 def divisorGenerator(n): large_divisors = [] for i in range(1, int(math.sqrt(n) + 1)): if n % i == 0: yield i if i*i != n: large_divisors.append(int(n / i)) for divisor in reversed(large_divisors): yield divisor n = int(input()) for x 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)...
from sys import stdin input=stdin.readline #a=[] import math def com(p,q,r): if p==q or q==r or p==r: return -1 else: return 1 def pd(n) : t=[] i = 1 while i <= math.sqrt(n): if (n % i == 0 and i!=1) : if (n // i == i) : t.append([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 f(n): d={} for i in range(2,int(pow(n,0.5))+1): if n%i==0: d[i]=0 while n%i==0: d[i]=d[i]+1 n=n//i if n!=1: d[n]=1 return(d) final=[] t=int(input()) for i in range(0,t): n=int(input()) d=f(n) values = list(d.values()...
You are given one integer number n. Find three distinct integers a, b, c such that 2 ≀ a, b, c and a β‹… b β‹… c = n or say that it is impossible to do it. If there are several answers, you can 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 sf(s,n): for i in range(s,int(math.sqrt(n)+1)): if n%i==0: n=n//i return i,n return 1,n t=int(input()) #t=1 for _ in range(t): a,b,c=1,1,1 n=int(input()) a,n=sf(2,n) b,n=sf(a+1,n) c=n #print(a,b,c) if a!=b...
You are given one integer number n. Find three distinct integers a, b, c such that 2 ≀ a, b, c and a β‹… b β‹… c = n or say that it is impossible to do it. If there are several answers, you can print any. You have to answer t independent test cases. Input The first line of the input contains one integer t (1 ≀ t ≀ 100)...
t = int(input()) while t: t-=1 n = int(input()) factors = [] for i in range(2,int(n**0.5)+1): if n%i==0: factors.append(i) if n//i!=i: factors.append(n//i) if len(factors)<2: print("NO") continue factors.sort() done = 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)...
t = int(input()) for T in range(t): n = int(input()) ans = [] for i in range(2, int(n ** 0.5) + 1): if n % i == 0: ans.append(i) val = n // i for j in range(2, int(val ** 0.5) + 1): ans = [i] if val % j == 0: 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)...
def factors(n): i = 2 f = [] s = n while i*i <= n: while s % i == 0: s //= i f.append(i) i += 1 else: if s > 1: f.append(s) return f def solve(): f = factors(n) s = set() i = 0 x = 1 for i in f: if i not 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 factorization(n): ind = [] arr = [] temp = n for i in range(2, int(-(-n**0.5//1))+1): if temp%i==0: cnt=0 while temp%i==0: cnt+=1 temp //= i ind.append(cnt) arr.append(i) if temp!=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; int main() { long long t, n; cin >> t; while (t--) { cin >> n; int a[3] = {}, count = 0; for (long long i = 2; i * i < n; i++) { if (n % i == 0) { a[count] = i; count++; n /= i; } if (count >= 2) break; } 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 # file = open('test1') # sys.stdin = file def ii(): a = int(input()) return a def ai(): a = list(map(int, input().split())) return a def mi(): a = map(int, input().split()) return a from math import sqrt def fact(n): lst = [] for i in range(2, int(sqrt(n))+1): if n%i==0: a = i # print(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 isPrime(n : int): if n == 1: return False if n == 2: return True else: for i in range(2, n // 2): if n % i == 0: return False return True t = int(input()) for i in range(t): n = int(input()) y = n res = [] k = 2 for k in ran...
You are given one integer number n. Find three distinct integers a, b, c such that 2 ≀ a, b, c and a β‹… b β‹… c = n or say that it is impossible to do it. If there are several answers, you can 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 main(): n = int(input()) different = [0, 0, 0] k = 0 for i in range(2, int(math.sqrt(n)) + 1): if k == 2: break if n % i == 0 and k < 2: n = n // i different[k] = i k += 1 if n == 1 or n == different[0] or n == differe...
You are given one integer number n. Find three distinct integers a, b, c such that 2 ≀ a, b, c and a β‹… b β‹… c = n or say that it is impossible to do it. If there are several answers, you can 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()) def primefactorize(n): prime_factors_list = [] while n%2 == 0: prime_factors_list.append(2) n = n/2 for i in range(3,int(math.sqrt(n))+1,2): while n%i == 0: prime_factors_list.append(i) n = n/i if n > 2: prime_factors_list.append(n) return prime_factors_list def gen...
You are given one integer number n. Find three distinct integers a, b, c such that 2 ≀ a, b, c and a β‹… b β‹… c = n or say that it is impossible to do it. If there are several answers, you can print any. You have to answer t independent test cases. Input The first line of the input contains one integer t (1 ≀ t ≀ 100)...
import sys import math input = sys.stdin.readline ############ ---- Input Functions ---- ############ def inp(): return(int(input())) def inlt(): return(list(map(int,input().split()))) def insr(): s = input() return(list(s[:len(s) - 1])) def invr(): return(map(int,input().split())) t = inp() for i...
You are given one integer number n. Find three distinct integers a, b, c such that 2 ≀ a, b, c and a β‹… b β‹… c = n or say that it is impossible to do it. If there are several answers, you can print any. You have to answer t independent test cases. Input The first line of the input contains one integer t (1 ≀ t ≀ 100)...
from sys import stdin input=lambda:stdin.readline().strip() from collections import defaultdict def fun(n,dict1): if n%2==0 and (n//2)!=2 and dict1[2]==0: #print(dict1[2]) return [2,n//2] elif n%3==0 and (n//3)!=3 and dict1[n//3]==0 and dict1[3]==0: return [3,n//3] else: i=2 ...
You are given one integer number n. Find three distinct integers a, b, c such that 2 ≀ a, b, c and a β‹… b β‹… c = n or say that it is impossible to do it. If there are several answers, you can print any. You have to answer t independent test cases. Input The first line of the input contains one integer t (1 ≀ t ≀ 100)...
#include <bits/stdc++.h> using namespace std; void solve() { int n; cin >> n; vector<int> factors; for (int i = 2; 1LL * i * i <= (long long int)n; ++i) { if (n % i == 0) { factors.push_back(n / i); if (n / i != i) { factors.push_back(i); } } } if (factors.size() < 2) { ...
You are given one integer number n. Find three distinct integers a, b, c such that 2 ≀ a, b, c and a β‹… b β‹… c = n or say that it is impossible to do it. If there are several answers, you can print any. You have to answer t independent test cases. Input The first line of the input contains one integer t (1 ≀ t ≀ 100)...
import sys import math import bisect from sys import stdin, stdout from math import gcd, floor, sqrt, log2, ceil from collections import defaultdict from bisect import bisect_left as bl, bisect_right as br from collections import Counter from collections import deque ip = lambda : int(stdin.readline()) inp = lambda: ...
You are given one integer number n. Find three distinct integers a, b, c such that 2 ≀ a, b, c and a β‹… b β‹… c = n or say that it is impossible to do it. If there are several answers, you can print any. You have to answer t independent test cases. Input The first line of the input contains one integer t (1 ≀ t ≀ 100)...
/* _oo0oo_ o8888888o 88" . "88 (| -_- |) 0\ = /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 sys sys.setrecursionlimit(10**9) IA =lambda: map(int,input().split()) ans=[0,0,0,0] def solve(n): num=int(0) i=int(2) tmp=1 m=n while i*i<=n: if n%i==0: n=n//i tmp*=i if tmp not in ans: num+=1 ans[num]=tmp ...
You are given one integer number n. Find three distinct integers a, b, c such that 2 ≀ a, b, c and a β‹… b β‹… c = n or say that it is impossible to do it. If there are several answers, you can 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 int cfnum = 1e5 + 5; using namespace std; long long int gcd(long long int a, long long int b) { if (a == 0) return b; return gcd(b % a, a); } int main() { int q; cin >> q; while (q--) { long long int n; cin >> n; vector<long long in...
You are given one integer number n. Find three distinct integers a, b, c such that 2 ≀ a, b, c and a β‹… b β‹… c = n or say that it is impossible to do it. If there are several answers, you can print any. You have to answer t independent test cases. Input The first line of the input contains one integer t (1 ≀ t ≀ 100)...
#include <bits/stdc++.h> using namespace std; int main() { long long n, t, a, b, c, var; cin >> t; vector<long long> fact1, fact2, fact3; while (t--) { cin >> n; var = n; a = b = c = 1; fact1.clear(); fact2.clear(); fact3.clear(); for (int i = 2; i * i <= n; i++) { if (n % i ==...
You are given one integer number n. Find three distinct integers a, b, c such that 2 ≀ a, b, c and a β‹… b β‹… c = n or say that it is impossible to do it. If there are several answers, you can print any. You have to answer t independent test cases. Input The first line of the input contains one integer t (1 ≀ t ≀ 100)...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int q, n; cin >> q; while (q--) { cin >> n; set<int> A; for (int i = 2; i * i < n; i++) { if (n % i == 0) { A.insert(i); n /= 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)...
# β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘ # β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–„β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–„β–‘β–‘β–‘β–‘β–‘β–‘ # β–‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–‘β–‘β–„β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–„β–‘β–‘β–ˆβ–‘β–‘β–‘β–‘β–‘ # β–‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–‘β–ˆβ–‘β–‘β–€β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–€β–‘β–‘β–ˆβ–‘β–ˆβ–‘β–‘β–‘β–‘β–‘ # β–‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–‘β–ˆβ–‘β–‘β–‘β–€β–‘β–‘β–‘β–‘β–‘β–‘β–€β–‘β–‘β–‘β–ˆβ–‘β–ˆβ–‘β–‘β–‘β–‘β–‘ # β–‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–‘β–ˆβ–‘β–‘β–‘β–‘β–€β–‘β–‘β–‘β–‘β–€β–‘β–‘β–‘β–‘β–ˆβ–‘β–ˆβ–‘β–‘β–‘β–‘β–‘ # β–‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–‘β–ˆβ–„β–‘β–‘β–‘β–‘β–€β–‘β–‘β–€β–‘β–‘β–‘β–‘β–„β–ˆβ–‘β–ˆβ–‘β–‘β–‘β–‘β–‘ # β–‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–‘β–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–‘β–ˆβ–‘β–‘β–‘β–‘β–‘ # β–‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–‘β–€β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–€β–‘β–ˆβ–‘β–‘β–‘β–‘β–‘ # β–‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–‘β–‘β–‘β–‘...
You are given one integer number n. Find three distinct integers a, b, c such that 2 ≀ a, b, c and a β‹… b β‹… c = n or say that it is impossible to do it. If there are several answers, you can 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 # sys.setrecursionlimit(400000) def I(): return input().strip() def II(): return int(input().strip()) def LI(): return [*map(int, input().strip().split())] import copy, string, math, time, functools, random, fractions from heapq import heappush, heappop, heapify from bisect import ...
You are given one integer number n. Find three distinct integers a, b, c such that 2 ≀ a, b, c and a β‹… b β‹… c = n or say that it is impossible to do it. If there are several answers, you can 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 x in range(t): n = int(input()) i = 2 rt = int(n**0.5) l = [] dp = [True]*(int(n**0.5)+1) while i <= rt and len(l) < 3: if n%i!=0: i+=1 else: if dp[i]: l.append(i) dp[i] = False if len(l...
You are given one integer number n. Find three distinct integers a, b, c such that 2 ≀ a, b, c and a β‹… b β‹… c = n or say that it is impossible to do it. If there are several answers, you can print any. You have to answer t independent test cases. Input The first line of the input contains one integer t (1 ≀ t ≀ 100)...
import math def mul3(n): original_n = n divisors = set() divisor = 2 sqrt_n = int(math.sqrt(n)) while divisor <= sqrt_n and len(divisors) < 2: if n % divisor == 0: divisors.add(divisor) n //= divisor divisor += 1 if len(divisors) < 2: return Non...
You are given one integer number n. Find three distinct integers a, b, c such that 2 ≀ a, b, c and a β‹… b β‹… c = n or say that it is impossible to do it. If there are several answers, you can 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 import collections import sys import math def primeFactors(n): l = [] count = 0 while n % 2 == 0: count+=1 n = n // 2 if count > 0: l.append([2, count]) count = 0 for i in range(3, int(math.sqrt(n))+1, 2): while n % i == 0: 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)...
import math for _ in range(int(input())) : n=int(input()) s=[] try: for i in range(2,int(math.sqrt(n))+1): if n%i==0: g=(n//i) a=i+0 break for i in range(a+1,int(math.sqrt(g))+1): if g%i==0: b=i break for i in ra...
You are given one integer number n. Find three distinct integers a, b, c such that 2 ≀ a, b, c and a β‹… b β‹… c = n or say that it is impossible to do it. If there are several answers, you can 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 for _ in range(input()): n=input() flag=0 for i in range(2,int(n**(0.5))+1): if n%i==0: a=i s=n/i b=0 c=0 for j in range(2,int(s**(0.5)+1)): if s%j==0 and a!=j: b=j c=s/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)...
import math from bisect import bisect_left, bisect_right from sys import stdin, stdout input = lambda: stdin.readline().strip() print = lambda s: stdout.write(s) primes = [] def SieveOfEratosthenes(n): prime = [True for i in range(n+1)] p = 2 while (p * p <= n): if (prime[p] == True): 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)...
N = int(input()) from math import * for _ in range(N): n = int(input()) sn = int(sqrt(n))+1 cnt = 0 ans = [] for i in range(2, sn): if n % i == 0: ans.append(i) n //= i cnt += 1 if cnt == 2: cnt = i break if n not in ans and len(ans) == 2: print("YES") print(' '.join(map(str, 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)...
for _ in range(int(input())): n=int(input()) d=dict() i=2 while(i*i<=n): if i not in d and n%i==0: d[i]=i n//=i break i+=1 j=2 while(j*j<=n): if j not in d and n%j==0: d[j]=j n//=j break 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 math #2 2 2 3| 2 2 3 def fac(x): i=2 a = [] while i*i<=x: if x%i==0: a.append(i) x//=i else: i+=1 if x>1: a.append(x) return a def res(x): f = fac(x) if len(f)<=2 or len(set(f))==1 and len(f)<6 or len(set(f))==2 and len(f)<=3: 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)...
def prime_divisors(n): res = [] d = 2 while d * d <= n: if n % d == 0: if len(res) > 0 and res[-1][0] == d: res[-1][1] = res[-1][1] + 1 else: res.append([d, 1]) n = n // d else: d = d + 1 if n > 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)...
for _ in range(int(input())): n = int(input()) a = 0 i, arr= 2, [] for i in range(2, int(n**0.5)+1): if len(arr) == 2: break if n%i == 0: n //= i arr.append(i) if len(arr) == 2 and n not in arr and n != 1: print("YES") print(arr[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 _ in range(t): n = int(input()) d = [] temp = n while n % 2 == 0: d.append(2) n //= 2 for i in range(3, (int(math.sqrt(n)) + 1), 2): while n % i == 0: d.append(i) n //= i if n > 2: d.append(n) if len(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)...
import java.io.*; import java.util.*; public class MyClass { public static void main(String args[]) { FastReader sc = new FastReader(); //For Fast IO //func f = new func(); //Call func for swap , permute, upper bound and for sort. int t = sc.nextInt(); while(t-->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.math.*; import java.io.*; import java.util.*; import java.awt.*; public class CP { public static void main(String[] args) throws Exception { new Solver().solve(); } } class Solver { final Helper hp; final int MAXN = 1000_006; final long MOD = (long) 1e9 + 7; Solver() { ...