buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
#include <bits/stdc++.h> using namespace std; long long n, ans; int main() { cin >> n; for (long long i = 2; i <= sqrt(n); i++) { long long x = i; while (n % x == 0) { n /= x; x *= i; ans++; } while (n % i != 0) n /= i; } if (n != 1) ans++; cout << ans; }
#include <bits/stdc++.h> using namespace std; long long n, ans; int main() { cin >> n; for (long long i = 2; i <= sqrt(n); i++) { long long x = i; while (n % x == 0) { n /= x; x *= i; ans++; } while (n % i == 0) n /= i; } if (n != 1) ans++; cout << ans; }
[["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 79], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 60]]
1
94
#include <bits/stdc++.h> using ll = long long; using namespace std; const int maxn = 1e6 + 100; int prime[maxn]; //就是个素数表 bool sf[maxn]; //判断这个数是不是素数,sf[i]中的i是从1到maxn的数 void init() { //核心 欧拉筛代码 int num = 0; // num 用来记筛到第几个质数 memset(sf, true, sizeof(sf)); for (int i = 2; i <= maxn; i++) { //外层枚举1~maxn if (s...
#include <bits/stdc++.h> using ll = long long; using namespace std; const int maxn = 1e6 + 100; int prime[maxn]; //就是个素数表 bool sf[maxn]; //判断这个数是不是素数,sf[i]中的i是从1到maxn的数 void init() { //核心 欧拉筛代码 int num = 0; // num 用来记筛到第几个质数 memset(sf, true, sizeof(sf)); for (int i = 2; i <= maxn; i++) { //外层枚举1~maxn if (s...
[["-", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 7, 10, 43, 39, 78]]
1
297
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; using ll = long long; using P = pair<ll, ll>; const int INF = 1001001001; const int MOD = 1000000007; template <typename T> void print(const T &v); vector<pair<ll, int>> factorization(ll num) { map<ll, int> mp; ll ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; using ll = long long; using P = pair<ll, ll>; const int INF = 1001001001; const int MOD = 1000000007; template <typename T> void print(const T &v); vector<pair<ll, ll>> factorization(ll num) { map<ll, ll> mp; ll tm...
[["-", 0, 77, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 77, 39, 344, 3, 347, 0, 77, 39, 78], ["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["-", 8, 9, 0, 338, 8, 9, 0, 43, 39, 40], ["+...
1
307
from collections import defaultdict N = int(input()) def prime_factorization(N): PC = defaultdict(int) P = 2 while N % P == 0: PC[P] += 1 N //= P P = 3 while P * P <= N: if N % P == 0: PC[P] += 1 N //= P else: P += 2 if N ...
from collections import defaultdict N = int(input()) def prime_factorization(N): PC = defaultdict(int) P = 2 while N % P == 0: PC[P] += 1 N //= P P = 3 while P * P <= N: if N % P == 0: PC[P] += 1 N //= P else: P += 2 if N ...
[["-", 0, 7, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 12, 612], ["-", 0, 7, 8, 196, 0, 52, 15, 666, 667, 47], ["+", 0, 7, 8, 196, 0, 52, 15, 666, 667, 20], ["-", 0, 52, 8, 196, 0, 1, 0, 677, 12, 612], ["+", 0, 52, 8, 196, 0, 1, 0, 677, 12, 22]]
5
126
#include <algorithm> #include <cmath> #include <cstring> #include <iostream> #include <map> #include <math.h> #include <queue> #include <stack> #include <stdlib.h> #include <string> #include <vector> using namespace std; typedef long long ll; int main() { ll N; cin >> N; vector<ll> nums; ll N_tmp = N; for...
#include <algorithm> #include <cmath> #include <cstring> #include <iostream> #include <map> #include <math.h> #include <queue> #include <stack> #include <stdlib.h> #include <string> #include <vector> using namespace std; typedef long long ll; int main() { ll N; cin >> N; vector<ll> nums; ll N_tmp = N; for...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 60], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22]]
1
187
def factorize(n): """ 素因数はたかだか n**0.5 以下 :return: e.g. factorize(24) -> {2: 3, 3: 1} (24 = 2**3 * 3**1) """ res = {} temp = n for i in range(2, int(-(-n**0.5//1))+1): if temp % i == 0: res[i] = 0 while temp % i ==0: res[i] += 1 ...
def factorize(n): """ 素因数はたかだか n**0.5 以下 :return: e.g. factorize(24) -> {2: 3, 3: 1} (24 = 2**3 * 3**1) """ res = {} temp = n for i in range(2, int(-(-n**0.5//1))+1): if temp % i == 0: res[i] = 0 while temp % i ==0: res[i] += 1 ...
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
248
#include <bits/stdc++.h> using namespace std; using ll = long long; map<ll, ll> factorize(ll n) { map<ll, ll> factor; while (n % 2 == 0) { ++factor[2]; n >>= 1; } for (ll i = 3; i * i <= n; i += 2) { while (n % i == 0) { ++factor[i]; n /= i; } } if (n > 2) ++factor[n]; retu...
#include <bits/stdc++.h> using namespace std; using ll = long long; map<ll, ll> factorize(ll n) { map<ll, ll> factor; while (n % 2 == 0) { ++factor[2]; n >>= 1; } for (ll i = 3; i * i <= n; i += 2) { while (n % i == 0) { ++factor[i]; n /= i; } } if (n > 2) ++factor[n]; retu...
[["-", 8, 9, 0, 338, 8, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 338, 8, 9, 0, 43, 39, 78]]
1
178
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int main(int argc, const char *argv[]) { long long n, ans = 0; scanf("%lld", &n); if (n == 1) { printf("0"); return 0; } long long CN = n; for (long long i = 2; i <= sqrt(CN) + 1; i++) { if (n % i == 0) { long lo...
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int main(int argc, const char *argv[]) { long long n, ans = 0; scanf("%lld", &n); if (n == 1) { printf("0"); return 0; } long long CN = n; for (long long i = 2; i <= sqrt(CN) + 1; i++) { if (n % i == 0) { long lo...
[["-", 8, 9, 0, 57, 15, 23, 0, 16, 31, 22], ["-", 8, 9, 0, 57, 15, 23, 0, 16, 17, 60], ["-", 8, 9, 0, 57, 15, 23, 0, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 12, 13]]
0
165
N = int(input()) def factorization(n): 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 arr.append([i, cnt]) if temp != 1: arr.append([temp,...
N = int(input()) def factorization(n): 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 arr.append([i, cnt]) if temp != 1: arr.append(...
[["-", 75, 76, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 12, 612], ["-", 0, 52, 8, 196, 0, 57, 15, 666, 0, 612], ["+", 0, 52, 8, 196, 0, 57, 15, 666, 0, 612], ["+", 8, 196, 0, 1, 0, 677, 12, 657, 17, 33], ["+", 8, 196, 0, 1, 0, 677, 12, 657, 12, 612]]
5
183
#include <bits/stdc++.h> using namespace std; typedef long long ll; void show(vector<ll> &vc) { for (auto it : vc) cout << it << " "; cout << endl; } #define M 1000009 bool p[M + 2]; vector<ll> prime; void seive(void) { memset(p, 0, sizeof p); p[1] = 1; p[0] = 1; for (int i = 4; i <= M; i += 2) { ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; void show(vector<ll> &vc) { for (auto it : vc) cout << it << " "; cout << endl; } #define M 1000009 bool p[M + 2]; vector<ll> prime; void seive(void) { memset(p, 0, sizeof p); p[1] = 1; p[0] = 1; for (int i = 4; i <= M; i += 2) { ...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 20], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 47]]
1
531
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); ++i) using P = pair<int, int>; using ll = long long; static const ll INF = 1000000000000000000; static const ll MOD = 1000000007; int main() { ll n; cin >> n; ll k = n; ll ans = 0; for (ll i = 2; i * i <= n; ++i) {...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); ++i) using P = pair<int, int>; using ll = long long; static const ll INF = 1000000000000000000; static const ll MOD = 1000000007; int main() { ll n; cin >> n; ll k = n; ll ans = 0; for (ll i = 2; i * i <= n; ++i) {...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 57, 64, 9, 0, 1, 0, 27, 17, 29]]
1
151
from math import ceil n = int(input()) pf = [] t = n if n == 1: print(0) exit() for i in range(2, ceil(n ** 0.5) + 1): c = 0 while t % i == 0: c += 1 t //= i if c > 0: pf.append(c) if pf == []: pf.append(1) ans = 0 for i in pf: tmp = i j = 1 while j <= tmp: tmp -...
from math import ceil n = int(input()) pf = [] t = n if n == 1: print(0) exit() for i in range(2, ceil(n ** 0.5) + 1): c = 0 while t % i == 0: c += 1 t //= i if c > 0: pf.append(c) if t != 1: pf.append(1) ans = 0 for i in pf: tmp = i j = 1 while j <= tmp: tmp -= ...
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22], ["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 60], ["-", 0, 656, 0, 57, 15, 666, 0, 634, 0, 70], ["-", 0, 656, 0, 57, 15, 666, 0, 634, 0, 73], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 79], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0...
5
119
from sys import stdin import math def I(): return int(stdin.readline().rstrip()) n = I() m = n l = [] for i in range(2,int(math.sqrt(n))+1): if n==1 or n<i: break if n%i==0: c = 0 while n%i==0: n//=i c += 1 for j in range(1,c+1): l.append(i**j...
from sys import stdin import math def I(): return int(stdin.readline().rstrip()) n = I() m = n l = [] for i in range(2,int(math.sqrt(n))+1): if n==1 or n<i: break if n%i==0: c = 0 while n%i==0: n//=i c += 1 for j in range(1,c+1): l.append(i**j...
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
168
#include <bits/stdc++.h> #include <chrono> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <math.h> using namespace __gnu_pbds; using namespace std::chrono; using namespace std; #define ordered_set \ tree<int, null_type,...
#include <bits/stdc++.h> #include <chrono> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <math.h> using namespace __gnu_pbds; using namespace std::chrono; using namespace std; #define ordered_set \ tree<int, null_type,...
[["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
237
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using ld = long double; using pii = pair<int, int>; using pll = pair<ll, ll>; using pli = pair<ll, int>; using pil = pair<int, ll>; using uint = unsigned int; template <typename T> using Graph = vector<vector<T>>; const ...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using ld = long double; using pii = pair<int, int>; using pll = pair<ll, ll>; using pli = pair<ll, int>; using pil = pair<int, ll>; using uint = unsigned int; template <typename T> using Graph = vector<vector<T>>; const ...
[["-", 0, 7, 8, 9, 0, 52, 8, 9, 0, 45], ["-", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35], ["-", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["-", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32], ["-", 0, 52, 8, 9, 0, 1, 0, 11, 12, 147], ["-", 0, 7, 8, 9, 0, 52, 8, 9, 0, 46]]
1
231
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define ALL(a) (a).begin(), (a).end() #define PI 3.14159265358979 using namespace std; typedef long long ll; typedef pair<int, int> P; const ll mod = 1e9 + 7LL; int f(int a) { int k = 0; while ((k + 1) * (k + 2) / 2 <= a) k++; return k;...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define ALL(a) (a).begin(), (a).end() #define PI 3.14159265358979 using namespace std; typedef long long ll; typedef pair<int, int> P; const ll mod = 1e9 + 7LL; int f(int a) { int k = 0; while ((k + 1) * (k + 2) / 2 <= a) k++; return k;...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 60], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22]]
1
183
def factorization(n): 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 arr.append([i, cnt]) if temp!=1: arr.append([temp, 1]) if arr==[]: arr...
def factorization(n): 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 arr.append([i, cnt]) if temp!=1: arr.append([temp, 1]) if arr==[]: arr...
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
201
#include <bits/stdc++.h> #define endl '\n' #define ll long long using namespace std; ll o = 0; bool isPrime(int 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 || n % 3 == 0) retu...
#include <bits/stdc++.h> #define endl '\n' #define ll long long using namespace std; ll o = 0; bool isPrime(int 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 || n % 3 == 0) retu...
[["-", 8, 9, 0, 57, 15, 339, 51, 2, 63, 22], ["-", 0, 57, 15, 339, 51, 2, 3, 4, 0, 24], ["-", 0, 57, 15, 339, 51, 2, 3, 4, 0, 25], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
289
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); long number = Long.parseLong(in.readLine()); ArrayList<Long> factors = new ArrayList<Long>(); for (long i = 1...
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); long number = Long.parseLong(in.readLine()); ArrayList<Long> factors = new ArrayList<Long>(); for (long i = 1...
[["-", 0, 514, 8, 196, 0, 7, 15, 16, 17, 18], ["+", 0, 514, 8, 196, 0, 7, 15, 16, 17, 19]]
3
277
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int table[1000]; int bisect_right(int x, int a[], int left, int right) { int mid; right++; while (left < right) { mid = (left + right) / 2; if (a[mid] <= x) { left = mid + 1; } else { right = mid; } } ret...
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int table[1000]; int bisect_right(int x, int a[], int left, int right) { int mid; right++; while (left < right) { mid = (left + right) / 2; if (a[mid] <= x) { left = mid + 1; } else { right = mid; } } ret...
[["-", 0, 37, 0, 16, 31, 2, 3, 4, 0, 13], ["+", 0, 37, 0, 16, 31, 2, 3, 4, 0, 13]]
0
310
#include <bits/stdc++.h> using namespace std; const int MOD = (int)1e9 + 7; const long long INF = 1LL << 60; const double PI = 3.14159265358979323846; typedef long long ll; int main(void) { ll n; cin >> n; vector<pair<ll, int>> vp; for (int i = 2; i * i <= n; i++) { int x = 0; while (n % i == 0) { ...
#include <bits/stdc++.h> using namespace std; const int MOD = (int)1e9 + 7; const long long INF = 1LL << 60; const double PI = 3.14159265358979323846; typedef long long ll; int main(void) { ll n; cin >> n; vector<pair<ll, int>> vp; for (ll i = 2; i * i <= n; i++) { int x = 0; while (n % i == 0) { ...
[["-", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 7, 10, 43, 39, 78], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 8, 9, 0, 338, 8, 9, 0, 43, 39, 78], ["+", 8, 9, 0, 338, 8, 9, 0, 43, 39, 40]]
1
179
#include <bits/stdc++.h> using namespace std; #define int long long #define endl '\n' #define SPEED \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); ...
#include <bits/stdc++.h> using namespace std; #define int long long #define endl '\n' #define SPEED \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); ...
[["+", 0, 30, 0, 14, 8, 9, 0, 57, 0, 121], ["+", 0, 14, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 57, 15, 339, 0, 25]]
1
136
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { long long int i, j, k, n, b, ans = 0, po = 0; scanf("%lld", &n); for (i = 2; 1; i++) { po = 0; if (n % i == 0) { while (1) { if (n % i == 0) { n = n / i; po++; } else ...
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { long long int i, j, k, n, b, ans = 0, po = 0; scanf("%lld", &n); for (i = 2; 1; i++) { po = 0; if (n % i == 0) { while (1) { if (n % i == 0) { n = n / i; po++; } else ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
165
import math N = int(input()) def factorization(n): 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 arr.append(cnt) if temp!=1: arr.append(1) if arr=...
import math N = int(input()) def factorization(n): 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 arr.append(cnt) if temp!=1: arr.append(1) if arr=...
[["+", 12, 657, 31, 23, 0, 657, 12, 652, 63, 22], ["+", 31, 23, 0, 657, 12, 652, 3, 4, 0, 24], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25], ["+", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]]
5
182
#include <bits/stdc++.h> using namespace std; typedef long long ll; // const int INF = 2e9; // const ll INF = 9e18; vector<pair<ll, ll>> primeFactorial(ll n) { vector<pair<ll, ll>> res; for (ll i = 2; i * i <= n; i++) { ll r = 0; while (n % i == 0) { r++; n /= i; } res.emplace_back(i, ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; // const int INF = 2e9; // const ll INF = 9e18; vector<pair<ll, ll>> primeFactorial(ll n) { vector<pair<ll, ll>> res; for (ll i = 2; i * i <= n; i++) { ll r = 0; while (n % i == 0) { r++; n /= i; } res.emplace_back(i, ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
267
import itertools import decimal import math import collections 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...
import itertools import decimal import math import collections 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...
[["-", 75, 665, 64, 196, 0, 1, 0, 662, 31, 22], ["+", 75, 665, 64, 196, 0, 1, 0, 662, 31, 22], ["-", 64, 196, 0, 1, 0, 662, 12, 657, 31, 22], ["+", 64, 196, 0, 1, 0, 662, 12, 657, 31, 22]]
5
326
n = int(input()) 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) return a a = prime_factorize(n) b = l...
n = int(input()) 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) return a a = prime_factorize(n) b = l...
[["+", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
159
#include <algorithm> #include <bits/stdc++.h> #include <cmath> #include <complex> #include <cstdio> #include <iostream> #include <map> #include <queue> #include <set> #include <utility> #include <vector> #define fir first #define sec second #define sz(s) (s).size() #define pb push_back #define get(n) scanf("%d", &n); #...
#include <algorithm> #include <bits/stdc++.h> #include <cmath> #include <complex> #include <cstdio> #include <iostream> #include <map> #include <queue> #include <set> #include <utility> #include <vector> #define fir first #define sec second #define sz(s) (s).size() #define pb push_back #define get(n) scanf("%d", &n); #...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["-", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35], ["-", 0, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
2,325
n = int(input()) def prime_factors(n): i = 2 factors = [] while i * i <= n: if n % i: i += 1 else: n //= i factors.append(i) if n > 1: factors.append(n) return factors f = list(set(prime_factors(n))) print(f) ans = 0 for i in f: e = 1 ...
n = int(input()) def prime_factors(n): i = 2 factors = [] while i * i <= n: if n % i: i += 1 else: n //= i factors.append(i) if n > 1: factors.append(n) return factors f = list(set(prime_factors(n))) ans = 0 for i in f: e = 1 while...
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
115
#include <bits/stdc++.h> #define rep2(i, m, n) for (int i = (int)(m); i < (int)(n); i++) #define rep(i, n) rep2(i, 0, n) #define all(x) (x).begin(), (x).end() #define SZ(x) ((int)(x).size()) using namespace std; using ll = long long; template <typename T> T sq(T x) { return x * x; } signed main() { vector<int> cnt(1...
#include <bits/stdc++.h> #define rep2(i, m, n) for (int i = (int)(m); i < (int)(n); i++) #define rep(i, n) rep2(i, 0, n) #define all(x) (x).begin(), (x).end() #define SZ(x) ((int)(x).size()) using namespace std; using ll = long long; template <typename T> T sq(T x) { return x * x; } signed main() { vector<int> cnt(1...
[["+", 0, 9, 0, 1, 0, 11, 12, 16, 17, 72], ["+", 0, 9, 0, 1, 0, 11, 12, 16, 12, 13], ["-", 0, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
340
import math import collections def trial_division(n): factor = [] tmp = int(math.sqrt(n)) + 1 for num in range(2, tmp): while n % num == 0: n //= num if num != 1: factor.append(num) if not factor: return -1 else: factor.append(n) ...
import math import collections def trial_division(n): factor = [] tmp = int(math.sqrt(n)) + 1 for num in range(2, tmp): while n % num == 0: n //= num if num != 1: factor.append(num) if not factor: return -1 else: factor.append(n) ...
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612]]
5
200
import math,sys ans=0 def factorization(n): num=0 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 arr.append([i, cnt]) num=num+1 if temp!=1: ...
import math,sys ans=0 def factorization(n): num=0 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 arr.append([i, cnt]) num=num+1 if temp!=1: ...
[["+", 64, 196, 0, 1, 0, 652, 63, 319, 500, 22], ["+", 64, 196, 0, 1, 0, 652, 63, 319, 0, 131], ["+", 64, 196, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
208
def factorization(n): 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 arr.append([i, cnt]) if temp!=1: arr.append([temp, 1]) if arr==[]: arr...
def factorization(n): 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 arr.append([i, cnt]) if temp!=1: arr.append([temp, 1]) if arr==[]: arr...
[["-", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 654], ["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 655], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25], ["+", 0, 656, 0, 57, 64, 196, 0, 674, 0, 675]]
5
169
import math n=int(input()) def factorization(num): factor = [] flag = True is_Prime= True if num == 1: is_Prime = False while num > 1 and flag: flag = False for i in range(int(math.sqrt(num))+2): k = i + 2 if num % k == 0: factor.append...
import math n=int(input()) def factorization(num): factor = [] flag = True is_Prime= True if num == 1: is_Prime = False while num > 1 and flag: flag = False for i in range(int(math.sqrt(num))+2): k = i + 2 if num % k == 0: factor.append...
[["+", 0, 14, 8, 196, 0, 57, 15, 679, 17, 354], ["+", 8, 196, 0, 57, 15, 679, 12, 666, 0, 22], ["+", 8, 196, 0, 57, 15, 679, 12, 666, 667, 47], ["+", 8, 196, 0, 57, 15, 679, 12, 666, 0, 612]]
5
170
import collections 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) return a if __name__=="__main__": ...
import collections 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) return a if __name__=="__main__": ...
[["-", 0, 52, 8, 196, 0, 57, 15, 666, 0, 22], ["+", 0, 52, 8, 196, 0, 57, 15, 666, 0, 22]]
5
142
n = int(input()) b = n def pf(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) return a l = list(set(pf(n))) cnt = 0 for i in...
n = int(input()) b = n def pf(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) return a l = list(set(pf(n))) cnt = 0 for i in...
[["-", 64, 196, 0, 1, 0, 652, 63, 319, 500, 22], ["-", 64, 196, 0, 1, 0, 652, 63, 319, 0, 131], ["-", 64, 196, 0, 1, 0, 652, 63, 319, 319, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
143
#include <bits/stdc++.h> using namespace std; using ll = long long; template <typename T> using v2 = vector<vector<T>>; template <typename T> inline v2<T> fill(int r, int c, T t) { return v2<T>(r, vector<T>(c, t)); } int bs(int sum) { int lo = 0; int hi = sum; int ans = -1; while (lo <= hi) { int mid = (...
#include <bits/stdc++.h> using namespace std; using ll = long long; template <typename T> using v2 = vector<vector<T>>; template <typename T> inline v2<T> fill(int r, int c, T t) { return v2<T>(r, vector<T>(c, t)); } int bs(int sum) { int lo = 0; int hi = sum; int ans = -1; while (lo <= hi) { int mid = (...
[["-", 0, 30, 0, 14, 8, 9, 0, 338, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 338, 39, 78]]
1
365
import math import sys def factorization(n): 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 arr.append([i, cnt]) if temp!=1: arr.append([temp, 1]) ...
import math import sys def factorization(n): 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 arr.append([i, cnt]) if temp!=1: arr.append([temp, 1]) ...
[["-", 0, 1, 0, 677, 12, 652, 63, 319, 319, 22], ["+", 0, 677, 12, 657, 31, 652, 63, 319, 319, 22], ["+", 8, 196, 0, 1, 0, 677, 12, 657, 17, 33], ["+", 8, 196, 0, 1, 0, 677, 12, 657, 12, 612]]
5
183
#define _USE_MATH_DEFINES #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; // use unique(x) - removec consecutive items, returns vec.begin() + number of // items for vector: sort(all(vec)); vec.erase(unique(all(vec)), vec.end()); use // iota(all(vec), 0) for filling a vector ...
#define _USE_MATH_DEFINES #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; // use unique(x) - removec consecutive items, returns vec.begin() + number of // items for vector: sort(all(vec)); vec.erase(unique(all(vec)), vec.end()); use // iota(all(vec), 0) for filling a vector ...
[["-", 12, 16, 12, 23, 0, 16, 31, 16, 17, 60], ["-", 12, 16, 12, 23, 0, 16, 31, 16, 12, 22], ["+", 12, 16, 12, 23, 0, 16, 31, 16, 17, 79], ["+", 12, 16, 12, 23, 0, 16, 31, 16, 12, 13]]
1
171
def factorization(n): 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 arr.append([i, cnt]) if temp!=1: arr.append([temp, 1]) if arr==[]: a...
def factorization(n): 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 arr.append([i, cnt]) if temp!=1: arr.append([temp, 1]) if arr==[]: a...
[["-", 0, 7, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
193
def divisor(x): ret = [] for i in range(1, int(x ** 0.5) + 1): if x % i == 0: ret.append(i) ret.append(x // i) return sorted(list(set(ret))) def prime_factor(n): ass = [] for i in range(2, int(n ** 0.5) + 1): while n % i == 0: ass.append(i) ...
def divisor(x): ret = [] for i in range(1, int(x ** 0.5) + 1): if x % i == 0: ret.append(i) ret.append(x // i) return sorted(list(set(ret))) def prime_factor(n): ass = [] for i in range(2, int(n ** 0.5) + 1): while n % i == 0: ass.append(i) ...
[["-", 36, 36, 36, 36, 0, 656, 0, 7, 12, 22], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 12, 22]]
5
189
import sys n=int(input()) if n == 1: print(0) sys.exit() orgn=n counter=0 for i in range(2,int((n**0.5) + 1) ): if n % i == 0: counter += 1 n //= i wari=i**2 while n % wari == 0: counter +=1 n //= wari wari *= i while n %...
import sys n=int(input()) if n == 1: print(0) sys.exit() orgn=n counter=0 for i in range(2,int((n**0.5) + 1) ): if n % i == 0: counter += 1 n //= i wari=i**2 while n % wari == 0: counter +=1 n //= wari wari *= i while n %...
[["+", 64, 196, 0, 1, 0, 652, 63, 319, 500, 22], ["+", 64, 196, 0, 1, 0, 652, 63, 319, 0, 131], ["+", 64, 196, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
119
history = set([]) def make_divisors(n): lower_divisors , upper_divisors = [], [] i = 1 while i*i <= n: if n % i == 0: lower_divisors.append(i) if i != n // i: upper_divisors.append(n//i) i += 1 return lower_divisors + upper_divisors[::-1] def fac...
history = set([]) def make_divisors(n): lower_divisors , upper_divisors = [], [] i = 1 while i*i <= n: if n % i == 0: lower_divisors.append(i) if i != n // i: upper_divisors.append(n//i) i += 1 return lower_divisors + upper_divisors[::-1] def fac...
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612]]
5
279
N = int(input()) import heapq def factorization(n): 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 arr.append([i,i, cnt]) if temp!=1: arr.append(...
N = int(input()) import heapq def factorization(n): 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 arr.append([i,i, cnt]) if temp!=1: arr.append(...
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
215
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define FOR(var, begin, end) for (int var = (begin); var <= (end); var++) #define RFOR(var, begin, end) for (int var = (begin); var >= (end); var--) #define REP(var, length) FOR(var, 0, length - 1) #define RREP(var, length) RFOR(var, length - 1, 0) #de...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define FOR(var, begin, end) for (int var = (begin); var <= (end); var++) #define RFOR(var, begin, end) for (int var = (begin); var >= (end); var--) #define REP(var, length) FOR(var, 0, length - 1) #define RREP(var, length) RFOR(var, length - 1, 0) #de...
[["+", 8, 9, 0, 7, 15, 16, 31, 16, 17, 48], ["+", 8, 9, 0, 7, 15, 16, 31, 16, 12, 22], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 79]]
1
298
N = int(input()) ans = 0 # if N % 2 == 0: # i = 1 # while N % 2**i == 0: # N //= 2**i # ans += 1 # i += 1 # if N % 3 == 0: # i = 1 # while N % 3**i == 0: # N //= 3**i # ans += 1 # i += 1 # if N % 5 == 0: # i = 1 # while N % 5**i == 0: # ...
N = int(input()) ans = 0 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) return set(a) prime_list = p...
[["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25], ["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24]]
5
173
#include <bits/stdc++.h> using namespace std; int main() { long n; cin >> n; long num = n; long m = pow(n, 0.5); // cout << m << endl; vector<int> vec(m + 1); for (int i = 2; i <= m; i++) { while (num % i == 0) { num /= i; vec[i]++; } } int ans = 0; if (n == num && n != 1) ...
#include <bits/stdc++.h> using namespace std; int main() { long n; cin >> n; long num = n; long m = pow(n, 0.5); // cout << m << endl; vector<int> vec(m + 1); for (int i = 2; i <= m; i++) { while (num % i == 0) { num /= i; vec[i]++; } } int ans = 0; if (n == num && n != 1) ...
[["-", 8, 9, 0, 57, 75, 76, 0, 9, 0, 46], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 46]]
1
164
#include <algorithm> #include <bits/stdc++.h> #include <functional> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long double ld; #define DEBUG #define PI 3.141592653589793238462643383279 #define _GLIBCXX_DEBUG #ifdef DEBUG #define s(...) show(__VA_ARGS__); #define sl(...) ...
#include <algorithm> #include <bits/stdc++.h> #include <functional> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long double ld; #define DEBUG #define PI 3.141592653589793238462643383279 #define _GLIBCXX_DEBUG #ifdef DEBUG #define s(...) show(__VA_ARGS__); #define sl(...) ...
[["-", 64, 9, 0, 52, 15, 339, 51, 16, 17, 47], ["+", 64, 9, 0, 52, 15, 339, 51, 16, 17, 20]]
1
705
#pragma GCC optimize("Ofast") #include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; using pll = pair<long long, long long>; constexpr char ln = '\n'; constexpr long long MOD = 998244353; constexpr long long INF = 1000000009LL; #define all(x) (x).begin(), (x).end() #define rep(i...
#pragma GCC optimize("Ofast") #include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; using pll = pair<long long, long long>; constexpr char ln = '\n'; constexpr long long MOD = 998244353; constexpr long long INF = 1000000009LL; #define all(x) (x).begin(), (x).end() #define rep(i...
[["-", 0, 52, 8, 9, 0, 43, 49, 50, 51, 22], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13]]
1
437
#include <bits/stdc++.h> using namespace std; int main() { int64_t N; cin >> N; int64_t a = 2; int64_t num = N; int64_t ans = 0; int64_t count = 0; int64_t now = 0; while (num >= a * a) { while (num % a == 0) { num = num / a; count++; if (count > now) { ans++; now ...
#include <bits/stdc++.h> using namespace std; int main() { int64_t N; cin >> N; int64_t a = 2; int64_t num = N; int64_t ans = 0; int64_t count = 0; int64_t now = 0; while (num >= a * a) { while (num % a == 0) { num = num / a; count++; if (count > now) { ans++; now ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
118
#include <bits/stdc++.h> #define ll long long int using namespace std; map<ll, int> num; int main() { ll n; cin >> n; ll ans = 0; ll nn = n; bool isPrime = true; for (ll i = 2; i <= sqrt(n) + 1; i++) { while (nn % i == 0) { if (num[i]) num[i]++; else num[i] = 1; nn...
#include <bits/stdc++.h> #define ll long long int using namespace std; map<ll, int> num; int main() { ll n; cin >> n; ll ans = 0; ll nn = n; bool isPrime = true; for (ll i = 2; i <= sqrt(n) + 1; i++) { while (nn % i == 0) { if (num[i]) num[i]++; else num[i] = 1; nn...
[["-", 0, 14, 8, 9, 0, 57, 15, 339, 51, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 79], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["-", 64, 1, 0, 11, 31, 69, 341, 342, 0, 22], ["+", 64, 1, 0, 11, 31, 69, 341, 342, 0, 22]]
1
164
#!/usr/bin/env python3 import sys import pprint import math sys.setrecursionlimit(10 ** 6) class Logger: def __init__(self, debug): self.debug = debug def print(self, *args): if self.debug: pprint.pprint(args) def prime_fact(n): p = {} for i in range(2, int(-(-n**0.5//1))+1): if n % i == 0: while n ...
#!/usr/bin/env python3 import sys import pprint import math sys.setrecursionlimit(10 ** 6) class Logger: def __init__(self, debug): self.debug = debug def print(self, *args): if self.debug: pprint.pprint(args) def prime_fact(n): p = {} for i in range(2, int(-(-n**0.5//1))+1): if n % i == 0: while n ...
[["-", 0, 52, 8, 196, 0, 1, 0, 677, 12, 612], ["+", 0, 52, 8, 196, 0, 1, 0, 677, 12, 22]]
5
257
x = int(input()) import math from collections import defaultdict res = 0 value = defaultdict(int) def isprime(n): if n <= 1: return 0 m = int(math.sqrt(n)) + 1 for i in range(2, m): if n % i == 0: return 0 return 1 if isprime(x): print(1) else: def bprime(n): ...
x = int(input()) import math from collections import defaultdict res = 0 value = defaultdict(int) def isprime(n): if n <= 1: return 0 m = int(math.sqrt(n)) + 1 for i in range(2, m): if n % i == 0: return 0 return 1 if isprime(x): print(1) else: def bprime(n): ...
[["+", 0, 14, 8, 196, 0, 57, 15, 679, 17, 355], ["+", 8, 196, 0, 57, 15, 679, 12, 666, 0, 22], ["+", 8, 196, 0, 57, 15, 679, 12, 666, 667, 79], ["+", 8, 196, 0, 57, 15, 679, 12, 666, 0, 612]]
5
204
#include <bits/stdc++.h> using namespace std; typedef long long int lli; typedef long int li; lli solve(lli x) { return (sqrt(1 + 8.0 * x) - 1) / 2; } int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); lli n; cin >> n; vector<int> v; lli ans = 0; for (int i = 2; i <= sqrt(n); i++) { i...
#include <bits/stdc++.h> using namespace std; typedef long long int lli; typedef long int li; lli solve(lli x) { return (sqrt(1 + 8.0 * x) - 1) / 2; } int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); lli n; cin >> n; vector<int> v; lli ans = 0; for (int i = 2; i <= sqrt(n); i++) { i...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
178
import collections 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) return a def main(): n = int(in...
import collections 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) return a def main(): n = int(in...
[["-", 0, 7, 8, 196, 0, 52, 15, 666, 667, 47], ["-", 0, 7, 8, 196, 0, 52, 15, 666, 0, 612], ["+", 0, 7, 8, 196, 0, 52, 15, 666, 667, 20], ["+", 0, 7, 8, 196, 0, 52, 15, 666, 0, 22]]
5
154
import random import collections N = int(input()) 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) retur...
import random import collections N = int(input()) 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) retur...
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
174
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll n; ll prime[1000005], cnt; bool vis[1000005]; ll ans = 0; const ll A[64] = {0, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll n; ll prime[1000005], cnt; bool vis[1000005]; ll ans = 0; const ll A[64] = {0, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, ...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
1
381
N = int(input()) if N == 1: print("0") exit() 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) r...
N = int(input()) if N == 1: print("0") exit() 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) r...
[["-", 0, 7, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 12, 612], ["-", 0, 7, 8, 196, 0, 52, 15, 666, 0, 612], ["+", 0, 7, 8, 196, 0, 52, 15, 666, 0, 612]]
5
146
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; typedef long long ll; const int inf = 1001001001; map<ll, ll> prime_factors(ll n) { map<ll, ll> res; if (n == 1) { // n=1 の素因数分解は n^1 res[n] = 1; return res; } for (int i = 2, _n = n; i * i <= _n; ++i) { w...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; typedef long long ll; const int inf = 1001001001; map<ll, ll> prime_factors(ll n) { map<ll, ll> res; if (n == 1) { // n=1 の素因数分解は n^1 res[n] = 1; return res; } for (ll i = 2, _n = n; i * i <= _n; ++i) { wh...
[["-", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 7, 10, 43, 39, 78]]
1
240
n = int(input()) def divisorize(fct): b, e = fct.pop() # base, exponent pre_div = divisorize(fct) if fct else [[]] suf_div = [[(b, k)] for k in range(e + 1)] return [pre + suf for pre in pre_div for suf in suf_div] def factorize(n): fct = [] # prime factor b, e = 2, 0 # base, exponent ...
n = int(input()) def divisorize(fct): b, e = fct.pop() # base, exponent pre_div = divisorize(fct) if fct else [[]] suf_div = [[(b, k)] for k in range(e + 1)] return [pre + suf for pre in pre_div for suf in suf_div] def factorize(n): fct = [] # prime factor b, e = 2, 0 # base, exponent ...
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612]]
5
272
def make_divisors(n): lower_divisors , upper_divisors = [], [] i = 1 while i*i <= n: if n % i == 0: lower_divisors.append(i) if i != n // i: upper_divisors.append(n//i) i += 1 return lower_divisors + upper_divisors[::-1] def factorization(n): ...
def make_divisors(n): lower_divisors , upper_divisors = [], [] i = 1 while i*i <= n: if n % i == 0: lower_divisors.append(i) if i != n // i: upper_divisors.append(n//i) i += 1 return lower_divisors + upper_divisors[::-1] def factorization(n): ...
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
290
// include //------------------------------------------ #include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include...
// include //------------------------------------------ #include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include...
[["-", 8, 9, 0, 1, 0, 11, 12, 2, 63, 22], ["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 24], ["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 13], ["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 21], ["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 25], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 72], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13]]
1
4,535
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <queue> #include <vector> using namespace std; typedef long long ll; vector<pair<ll, int>> factorize(ll n) { vector<pair<ll, int>> ans; for (ll i = 2; i * i <= n; i++) { if (n % i != 0) continue; ans.emplace_back(i, 0)...
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <queue> #include <vector> using namespace std; typedef long long ll; vector<pair<ll, int>> factorize(ll n) { vector<pair<ll, int>> ans; for (ll i = 2; i * i <= n; i++) { if (n % i != 0) continue; ans.emplace_back(i, 0)...
[["+", 75, 76, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 75, 76, 0, 57, 64, 9, 0, 93, 0, 35]]
1
245
def seachPrimeNum(N): max = int(N ** (1/2)) seachList = [i for i in range(2,N+1)] primeNum = [] while seachList[0] <= max: primeNum.append(seachList[0]) tmp = seachList[0] seachList = [i for i in seachList if i % tmp != 0] primeNum.extend(seachList) return primeNum a = s...
def seachPrimeNum(N): max = int(N ** (1/2)) seachList = [i for i in range(2,N+1)] primeNum = [] while seachList[0] <= max: primeNum.append(seachList[0]) tmp = seachList[0] seachList = [i for i in seachList if i % tmp != 0] primeNum.extend(seachList) return primeNum a = s...
[["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22]]
5
263
#include <bits/stdc++.h> using namespace std; int main() { long long N; cin >> N; int lim = pow(N, 0.5) + 1; int temp_count, i, ans = 0; for (int d = 2; d <= lim; d++) { if (N % d == 0) { temp_count = 0, i = 1; while (N % d == 0) { if (N % (long long)(pow(d, i)) == 0) { temp_...
#include <bits/stdc++.h> using namespace std; int main() { long long N; cin >> N; int lim = pow(N, 0.5) + 1; int temp_count, i, ans = 0; for (int d = 2; d <= lim; d++) { if (N % d == 0) { temp_count = 0, i = 1; while (N % d == 0) { if (N % (long long)(pow(d, i)) == 0) { temp_...
[["-", 8, 9, 0, 57, 64, 1, 0, 11, 17, 32], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 17, 107]]
1
166
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <stdio.h> #include <string> #include <vector> //#include <bits/stdc++.h> using namespace std; #define print(x) cout << (x) << endl #define prints(x, y) cout << (x) << " " << (y) << endl #define rep(i, ...
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <stdio.h> #include <string> #include <vector> //#include <bits/stdc++.h> using namespace std; #define print(x) cout << (x) << endl #define prints(x, y) cout << (x) << " " << (y) << endl #define rep(i, ...
[["-", 0, 1, 0, 11, 12, 16, 31, 16, 17, 85], ["-", 0, 1, 0, 11, 12, 16, 31, 16, 12, 13], ["+", 0, 9, 0, 1, 0, 11, 12, 16, 17, 85], ["+", 0, 9, 0, 1, 0, 11, 12, 16, 12, 13]]
1
267
import collections import numpy as np 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) return a N = i...
import collections import numpy as np 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) return a N = i...
[["+", 0, 1, 0, 662, 12, 652, 63, 319, 500, 22], ["+", 0, 1, 0, 662, 12, 652, 63, 319, 0, 131], ["+", 0, 1, 0, 662, 12, 652, 63, 319, 319, 22], ["+", 12, 652, 3, 4, 0, 657, 31, 23, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]]
5
144
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll max1 = 2000000; ll pri[200000]; ll vis[2000000] = {0}; bool isprime(int n) { if (n == 1) return false; for (int i = 2; i <= sqrt(n + 0.5); i++) if (n % i == 0) return false; return true; } int main() { vis[1] = 1; for (in...
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll max1 = 2000000; ll pri[200000]; ll vis[2000000] = {0}; bool isprime(ll n) { if (n == 1) return false; for (ll i = 2; i <= sqrt(n + 0.5); i++) if (n % i == 0) return false; return true; } int main() { vis[1] = 1; for (int ...
[["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 40], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["-", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 7, 10, 43, 39, 78]]
1
369
import math def factorization(n): 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 arr.append([i, cnt]) if temp!=1: arr.append([temp, 1]) if arr==[]:...
import math def factorization(n): 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 arr.append([i, cnt]) if temp!=1: arr.append([temp, 1]) if arr==[]:...
[["-", 0, 1, 0, 662, 12, 652, 63, 319, 319, 22], ["+", 0, 1, 0, 662, 12, 652, 63, 319, 319, 22]]
5
187
import collections N = int(input()) A = list() if N == 1: A.append(1) else: while N%2 == 0: A.append(2) N = N//2 f = 3 while f*f <= N: if N % f == 0: A.append(f) N = N//f else: f += 2 if N != 1: A.append(N) A = collections.Counter(A) del A[1] count = 0 for a in A.values(): n = 1 th = n*(n+...
import collections N = int(input()) A = list() if N == 1: A.append(1) else: while N%2 == 0: A.append(2) N = N//2 f = 3 while f*f <= N: if N % f == 0: A.append(f) N = N//f else: f += 2 if N != 1: A.append(N) A = collections.Counter(A) del A[1] count = 0 for a in A.values(): n = 1 th = n*(n+...
[["-", 0, 7, 8, 196, 0, 52, 15, 666, 667, 47], ["+", 0, 7, 8, 196, 0, 52, 15, 666, 667, 20], ["+", 8, 196, 0, 1, 0, 677, 12, 657, 17, 33], ["+", 8, 196, 0, 1, 0, 677, 12, 657, 12, 612]]
5
155
#include <algorithm> #include <cmath> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <string> #include <vector> using namespace std; typedef unsigned int u32; typedef int i32; typedef unsigned long long int u64; typedef long long int i64; // 9e18 typedef uint16_t u16; type...
#include <algorithm> #include <cmath> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <string> #include <vector> using namespace std; typedef unsigned int u32; typedef int i32; typedef unsigned long long int u64; typedef long long int i64; // 9e18 typedef uint16_t u16; type...
[["-", 64, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["-", 64, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["-", 64, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17, 79], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], [...
1
356
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; #define fi first #define se second #define mp make_pair #define pb push_back #define fbo find_by_order #define ook order_of_key typedef long long ll; typedef pair<ll...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; #define fi first #define se second #define mp make_pair #define pb push_back #define fbo find_by_order #define ook order_of_key typedef long long ll; typedef pair<ll...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
319
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <queue> #include <string> #include <vector> long long int N, total; std::vector<bool> flag; std::vector<long long int> sosu; std::vector<long long int> sosu_num; int main() { std::cin >> N; for (int i = 0; i <= std::sqrt(N); i++...
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <queue> #include <string> #include <vector> long long int N, total; std::vector<bool> flag; std::vector<long long int> sosu; std::vector<long long int> sosu_num; int main() { std::cin >> N; for (int i = 0; i <= std::sqrt(N); i++...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 79], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
285
# coding: utf-8 n = int(input()) def factorization(n): 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 arr.append([i, cnt]) if temp!=1: arr.append([temp,...
# coding: utf-8 n = int(input()) def factorization(n): 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 arr.append([i, cnt]) if temp!=1: arr.append([temp,...
[["+", 0, 57, 75, 665, 64, 196, 0, 93, 0, 94]]
5
191
import collections N = int(input()) 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) return a c = coll...
import collections N = int(input()) 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) return a c = coll...
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
160
require 'prime' N = gets.to_i factors = N.prime_division S = {} S[0] = 0 1.upto(N) do |i| s = S[i] = S[i-1] + i break if s > N end T = S.invert c = 0 factors.each do |(_, n)| j = n while T[j].nil? j += 1 end c += T[j] end p c
require 'prime' N = gets.to_i factors = N.prime_division S = {} S[0] = 0 1.upto(N) do |i| s = S[i] = S[i-1] + i break if s > N end T = S.invert c = 0 factors.each do |(_, n)| j = n while T[j].nil? j -= 1 end c += T[j] end p c
[["-", 8, 736, 0, 89, 8, 170, 0, 755, 17, 107], ["+", 8, 736, 0, 89, 8, 170, 0, 755, 17, 110]]
4
97
import math def factorization(n): 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 arr.append([i, cnt]) if temp!=1: arr.append([temp, 1]) if arr==[...
import math def factorization(n): 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 arr.append([i, cnt]) if temp!=1: arr.append([temp, 1]) if arr==[...
[["-", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
197
import bisect n = int(input()) def factorization(n): 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 arr.append([i, cnt]) if temp!=1: arr.append([temp, ...
import bisect n = int(input()) def factorization(n): 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 arr.append([i, cnt]) if temp!=1: arr.append([temp, ...
[["-", 0, 7, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
205
#include <bits/stdc++.h> #include <cstdint> #include <vector> #define FOR(i, l, r) for (int i = (l); i < (r); ++i) #define RFOR(i, l, r) for (int i = (l); i >= (int)(r); i--) #define rep(i, n) FOR(i, 0, n) #define rrep(i, n) RFOR(i, n - 1, 0) // #define int long long using namespace std; const int MX = 1e6; const int ...
#include <bits/stdc++.h> #include <cstdint> #include <vector> #define FOR(i, l, r) for (int i = (l); i < (r); ++i) #define RFOR(i, l, r) for (int i = (l); i >= (int)(r); i--) #define rep(i, n) FOR(i, 0, n) #define rrep(i, n) RFOR(i, n - 1, 0) // #define int long long using namespace std; const int MX = 1e6; const int ...
[["-", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 7, 10, 43, 39, 78]]
1
356
import numpy as np from functools import * import sys sys.setrecursionlimit(100000) input = sys.stdin.readline import numpy as np def acinput(): return list(map(int, input().split(" "))) def factorize(n): fct = [] # prime factor b, e = 2, 0 # base, exponent while b * b <= n: while n ...
import numpy as np from functools import * import sys sys.setrecursionlimit(100000) input = sys.stdin.readline import numpy as np def acinput(): return list(map(int, input().split(" "))) def factorize(n): fct = [] # prime factor b, e = 2, 0 # base, exponent while b * b <= n: while n ...
[["-", 0, 7, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
198
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int MAXN = 1e5 + 5; ll n; ll pre(int x) { return 1ll * (x + 1) * x / 2; } int work(ll x) { int l = 1, r = x / 2 + 1, mid, res = -1; while (l <= r) { mid = (l + r) >> 1; if (pre(mid) <= x) res = mid, l = mid + 1; else ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int MAXN = 1e5 + 5; ll n; ll pre(int x) { return 1ll * (x + 1) * x / 2; } int work(ll x) { int l = 1, r = x / 2 + 1, mid, res = -1; while (l <= r) { mid = (l + r) >> 1; if (pre(mid) <= x) res = mid, l = mid + 1; else ...
[["-", 0, 57, 64, 1, 0, 2, 3, 4, 0, 22], ["+", 0, 57, 64, 1, 0, 2, 3, 4, 0, 13]]
1
232
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define pb push_back #define sort(s) sort(s.begin(), s.end()) #define reverse(s) reverse(s.begin(), s.end()) #define rep(i, n) for (ll(i) = 0; (i) < (n); (i)++) const ll mod = 1e9 + 7; //最大公約数 ll gcd(ll a, ll b) { return b ?...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define pb push_back #define sort(s) sort(s.begin(), s.end()) #define reverse(s) reverse(s.begin(), s.end()) #define rep(i, n) for (ll(i) = 0; (i) < (n); (i)++) const ll mod = 1e9 + 7; //最大公約数 ll gcd(ll a, ll b) { return b ?...
[["-", 8, 9, 0, 1, 0, 11, 12, 16, 17, 72], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35], ["+", 0, 7, 8, 9, 0, 1, 0, 27, 28, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 27, 17, 29]]
1
698
n = int(input()); 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) b = len(a); if n == 1: count = 0; else: count = 1; x = 1; y = 1; for i in range(1,b): ...
# 取得 nn = int(input()); n = nn; 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) b = len(a); #操作回数 if nn == 1: count = 0; else: count = 1; x = 1; y = 1; for i in...
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 36, 36, 36, 36, 0, 656, 0, 35], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 22], ["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22]]
5
174
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, a, b) for (int i = a; i < b; i++) #define repn(i, a, b) for (int i = a; i >= b; i--) #define MOD 1000000007 int main() { ios::sync_with_stdio(0); cin.tie(0); ll n; cin >> n; map<ll, ll> mp; for (ll i = 2; i * i <= n; i++) {...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, a, b) for (int i = a; i < b; i++) #define repn(i, a, b) for (int i = a; i >= b; i--) #define MOD 1000000007 int main() { ios::sync_with_stdio(0); cin.tie(0); ll n; cin >> n; map<ll, ll> mp; for (ll i = 2; i * i <= n; i++) {...
[["+", 0, 14, 8, 9, 0, 7, 8, 9, 0, 46], ["-", 0, 14, 8, 9, 0, 7, 8, 9, 0, 46]]
1
183
n=int(input()) ans=0 p=2 while p<=10**6 and n!=1: dv=0 wa=1 num=1 while n%p==0: n/=p n=int(n) dv+=1 if dv>0: while dv>=wa: num+=1 wa+=num num-=1 ans+=num p+=1 if n!=1: print("1") exit() print(str(ans))
n=int(input()) ans=0 p=2 while p<=10**6 and n!=1: dv=0 wa=1 num=1 while n%p==0: n/=p n=int(n) dv+=1 if dv>0: while dv>=wa: num+=1 wa+=num num-=1 ans+=num p+=1 if n!=1: print(str(ans+1)) exit() print(str(ans))
[["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 654], ["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 3, 4, 0, 652, 3, 4, 0, 657, 31, 22], ["+", 3, 4, 0, 652, 3, 4, 0, 657, 17, 72], ["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 655], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
99
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) return a import sys inp = int(input()) x=prime_factoriz...
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) return a import sys inp = int(input()) x=prime_factoriz...
[["-", 0, 7, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 12, 612], ["-", 0, 7, 8, 196, 0, 52, 15, 666, 667, 47], ["+", 0, 7, 8, 196, 0, 52, 15, 666, 667, 20]]
5
155
#include <bits/stdc++.h> using namespace std; using ll = long long int; using ld = long double; using pii = pair<int, int>; using pll = pair<ll, ll>; using vi = vector<int>; using vl = vector<ll>; using vb = vector<bool>; using vs = vector<string>; using vvi = vector<vector<int>>; using vvl = vector<vector<ll>>; using...
#include <bits/stdc++.h> using namespace std; using ll = long long int; using ld = long double; using pii = pair<int, int>; using pll = pair<ll, ll>; using vi = vector<int>; using vl = vector<ll>; using vb = vector<bool>; using vs = vector<string>; using vvi = vector<vector<int>>; using vvl = vector<vector<ll>>; using...
[["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 35]]
1
847
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; map<long long, int> mp; long long tmp = n; vector<long long> ans; int flag = 0; for (long long i = 2; i * i <= tmp; i++) { while (n % i == 0) { n /= i; mp[i]++; flag = 1; } } if (flag == 0) ...
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; map<long long, int> mp; long long tmp = n; vector<long long> ans; int flag = 0; for (long long i = 2; i * i <= n; i++) { while (n % i == 0) { n /= i; mp[i]++; flag = 1; } } if (n != 1) mp[n...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 79], ["+", 8, 9...
1
219
def make_divisors(n): lower_divisors, upper_divisors = [], [] i = 1 while i*i <= n: if n % i == 0: lower_divisors.append(i) if i != n // i: upper_divisors.append(n//i) i += 1 return lower_divisors + upper_divisors[::-1] def prime_len(n): a = ...
def make_divisors(n): lower_divisors, upper_divisors = [], [] i = 1 while i*i <= n: if n % i == 0: lower_divisors.append(i) if i != n // i: upper_divisors.append(n//i) i += 1 return lower_divisors + upper_divisors[::-1] def prime_len(n): a = ...
[["-", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 21], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
198
def divisor(n): i = 1 table = [] while i * i <= n: if n%i == 0: table.append(i) table.append(n//i) i += 1 table = list(set(table)) return table def prime_decomposition(n): i = 2 table = [] while i * i <= n: while n % i == 0: n //= i tabl...
def divisor(n): i = 1 table = [] while i * i <= n: if n%i == 0: table.append(i) table.append(n//i) i += 1 table = list(set(table)) return table def prime_decomposition(n): i = 2 table = [] while i * i <= n: while n % i == 0: n //= i tabl...
[["-", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 662, 12, 652, 3, 4, 0, 652, 63, 22], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
183
#include <stdio.h> int main() { long i, n, result, tmp, tmp_w, want; long a[40] = {0}; scanf("%ld", &n); i = 0; result = 0; for (tmp = 2; tmp * tmp < n; tmp++) { if (n % tmp == 0) { a[i] = tmp; i++; n = n / tmp; tmp = 2; } } if (n != 1) a[i] = n; i = 0; tmp = a...
#include <stdio.h> int main() { long i, n, result, tmp, tmp_w, want; long a[40] = {0}; scanf("%ld", &n); i = 0; result = 0; for (tmp = 2; tmp * tmp <= n; tmp++) { if (n % tmp == 0) { a[i] = tmp; i++; n = n / tmp; // printf("+%ld\n",tmp); tmp = 1; } } if (n != 1...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13]]
0
204
#import math N = int(input()) def factorize(n): fct = [] # prime factor b, e = 2, 0 # base, exponent while b * b <= n: while n % b == 0: n = n // b e = e + 1 if e > 0: fct.append((b, e)) b, e = b + 1, 0 if n > 1: fct.append((n, 1)) ...
N = int(input()) def factorize(n): fct = [] # prime factor b, e = 2, 0 # base, exponent while b * b <= n: while n % b == 0: n = n // b e = e + 1 if e > 0: fct.append((b, e)) b, e = b + 1, 0 if n > 1: fct.append((n, 1)) return fct ...
[["-", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
153
import sys, io, os, re import bisect from pprint import pprint from math import sin, cos, pi, radians, sqrt, floor from copy import copy, deepcopy from collections import deque from math import gcd from functools import reduce def array1(n): return [0] * n def array2(n, m): return [[0] * m for x in range(n)] def array...
import sys, io, os, re import bisect from pprint import pprint from math import sin, cos, pi, radians, sqrt, floor from copy import copy, deepcopy from collections import deque from math import gcd from functools import reduce def array1(n): return [0] * n def array2(n, m): return [[0] * m for x in range(n)] def array...
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 612], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 612]]
5
294
#include <bitset> //bitset可按位定义串 #include <cmath> //C中的数学函数 #include <cstdio> //C的输入输出 #include <cstdlib> //定义杂项函数及内存分配函数 #include <cstring> //字符串操作函数 #include <iostream> //数据输入输出流 #include <list> //STL list #include <map> // STL map #include <queue> // STL queue #include <set> #include <stack> //...
#include <bitset> //bitset可按位定义串 #include <cmath> //C中的数学函数 #include <cstdio> //C的输入输出 #include <cstdlib> //定义杂项函数及内存分配函数 #include <cstring> //字符串操作函数 #include <iostream> //数据输入输出流 #include <list> //STL list #include <map> // STL map #include <queue> // STL queue #include <set> #include <stack> //...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 0, 57, 64, 9, 0, 1, 0, 27, 28, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 27, 17, 29]]
1
300
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String temp[] = br.readLine().split(" "); long n = Long.parseLong(temp[0]); int count = 0; int ans = 0...
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String temp[] = br.readLine().split(" "); long n = Long.parseLong(temp[0]); int count = 0; int ans = 0...
[["+", 0, 7, 8, 196, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 11, 17, 32], ["+", 0, 7, 8, 196, 0, 1, 0, 11, 12, 499], ["+", 8, 196, 0, 7, 8, 196, 0, 1, 0, 35]]
3
263
#include <bits/stdc++.h> int main() { long long int N; std::cin >> N; std::map<int, int> prime_counts; long long int max = sqrt(N); for (int i = 2; i <= max; i++) { while (N % i == 0) { if (prime_counts.find(i) == prime_counts.end()) { prime_counts[i] = 0; } prime_counts[i]++; ...
#include <bits/stdc++.h> int main() { long long int N; std::cin >> N; std::map<int, int> prime_counts; long long int max = sqrt(N); for (int i = 2; i <= max; i++) { while (N % i == 0) { if (prime_counts.find(i) == prime_counts.end()) { prime_counts[i] = 0; } prime_counts[i]++; ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
179
// Template // #include <bits/stdc++.h> using namespace std; // マクロ // #define rep(v, times) for (int v = 0; v < (int)(times); v++) #define req(v, first, endplus1) for (int v = first; v < (int)(endplus1); v++) #define all(x) x.begin(), x.end() #define sort(x) sort(all(x)) #define uniq(x) x.erase(unique(all(x)), x.end(...
// Template // #include <bits/stdc++.h> using namespace std; // マクロ // #define rep(v, times) for (int v = 0; v < (int)(times); v++) #define req(v, first, endplus1) for (int v = first; v < (int)(endplus1); v++) #define all(x) x.begin(), x.end() #define sort(x) sort(all(x)) #define uniq(x) x.erase(unique(all(x)), x.end(...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
889
#include <bits/stdc++.h> using namespace std; #define int long long int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int t = 1, i, j; // cin>>t; while (t--) { int n, m, flag = 0, count = 0, sum = 0, maxi = 0, mini = 1e18; cin >> n; while (n % 2 == 0) { count++;...
#include <bits/stdc++.h> using namespace std; #define int long long int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int t = 1, i, j; // cin>>t; while (t--) { int n, m, flag = 0, count = 0, sum = 0, maxi = 0, mini = 1e18; cin >> n; while (n % 2 == 0) { count++;...
[["-", 8, 9, 0, 52, 15, 339, 51, 16, 12, 22], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 12, 22]]
1
228
import math def main(): N = int(input()) primes = [] def isprime(n): if n == 1: return False for i in range(2, int(math.sqrt(n))+1): if n % i == 0: return False return True primes = set() for i in range(1, int(math.sqrt(N))+1): if N % i =...
import math def main(): N = int(input()) primes = [] def isprime(n): if n == 1: return False for i in range(2, int(math.sqrt(n))+1): if n % i == 0: return False return True primes = set() for i in range(1, int(math.sqrt(N))+1): if N % i =...
[["-", 0, 7, 8, 196, 0, 57, 15, 679, 17, 355], ["+", 8, 196, 0, 7, 8, 196, 0, 57, 0, 102], ["+", 8, 196, 0, 57, 64, 196, 0, 57, 0, 121], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 676]]
5
181
a=int(input()) ans =0 def factorization(n): 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 arr.append([i, cnt]) if temp!=1: arr.append([temp, 1]) ...
a=int(input()) ans =0 def factorization(n): 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 arr.append([i, cnt]) if temp!=1: arr.append([temp, 1]) ...
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22]]
5
186