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
n = int(input()) r = 0 for p in range(2, int(n**0.5)+1): e = 0 while n%p == 0: e += 1 n /= p i = 1 while e >= i: e -= i r += 1 i += 1 if n!=1 and r==0: r = 1 print(r)
n = int(input()) r = 0 for p in range(2, int(n**0.5)+1): e = 0 while n%p == 0: e += 1 n /= p i = 1 while e >= i: e -= i r += 1 i += 1 if n != 1: r += 1 print(r)
[["-", 36, 36, 0, 656, 0, 57, 15, 679, 17, 355], ["-", 0, 656, 0, 57, 15, 679, 12, 666, 0, 22], ["-", 0, 656, 0, 57, 15, 679, 12, 666, 667, 60], ["-", 0, 656, 0, 57, 15, 679, 12, 666, 0, 612], ["-", 0, 57, 64, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 17, 107]]
5
77
#include "bits/stdc++.h" using namespace std; #define sim template <class c #define ris return *this #define dor > debug &operator<< #define eni(x) \ sim > typename enable_if<sizeof dud<c>(0) x 1, debug &>::type operator<<( \ c i) { sim ...
#include "bits/stdc++.h" using namespace std; #define sim template <class c #define ris return *this #define dor > debug &operator<< #define eni(x) \ sim > typename enable_if<sizeof dud<c>(0) x 1, debug &>::type operator<<( \ c i) { sim ...
[["-", 8, 9, 0, 7, 15, 16, 12, 2, 63, 22], ["-", 0, 7, 15, 16, 12, 2, 3, 4, 0, 24], ["-", 0, 7, 15, 16, 12, 2, 3, 4, 0, 25]]
1
699
n=int(input()) import math def factorization(n): #nを素因数分解する arr = [] temp = n for i in range(2, int(math.sqrt(n))+1): if temp%i==0: cnt=0 while temp%i==0: cnt+=1 temp //= i arr.append(cnt) if temp!=1: arr.append(1) #...
n=int(input()) import math def factorization(n): #nを素因数分解する arr = [] temp = n for i in range(2, int(math.sqrt(n))+1): if temp%i==0: cnt=0 while temp%i==0: cnt+=1 temp //= i arr.append(cnt) if temp!=1: arr.append(1) #...
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
149
#include <bits/stdc++.h> using namespace std; #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; #define ordered_set \ tree<int, null_type, less<int>, rb_tree_tag, \ ...
#include <bits/stdc++.h> using namespace std; #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; #define ordered_set \ tree<int, null_type, less<int>, rb_tree_tag, \ ...
[["-", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 22]]
1
532
#include <cmath> #include <iostream> #include <vector> using ll = long long; #define rep(i, n) for (ll i = 0; i < (n); i++) using namespace std; ll prime(ll n, vector<ll> &s, ll num) { ll count = 0; bool flag = false; while (n % num == 0) { flag = true; count++; n /= num; } if (flag) s.push_b...
#include <cmath> #include <iostream> #include <vector> using ll = long long; #define rep(i, n) for (ll i = 0; i < (n); i++) using namespace std; ll prime(ll n, vector<ll> &s, ll num) { ll cnt = 0; bool flag = false; while (n % num == 0) { flag = true; cnt++; n /= num; } if (flag) s.push_back(...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["-", 0, 52, 8, 9, 0, 1, 0, 27, 28, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 27, 28, 22], ["-", 0, 57, 64, 1, 0, 2, 3, 4, 0, 22], ["+", 0, 57, 64, 1, 0, 2, 3, 4, 0, 22], ["-", 0, 338, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 338, 8, 9, 0, 43, ...
1
214
#include <bits/stdc++.h> using namespace std; #define _GLIBCXX_DEBUG // GCC5.4.1で配列の範囲外アクセスをエラーにする // cmdで g++ test.cpp とするとコンパイルできる //制限1秒なら10^6は余裕 10^7は多分間に合う 10^8はよほど単純でないと厳しい #define ALL(x) x.begin(), x.end() typedef long long ll; // long long typedef pair<int, int> pii; // pair<int,int> typedef v...
#include <bits/stdc++.h> using namespace std; #define _GLIBCXX_DEBUG // GCC5.4.1で配列の範囲外アクセスをエラーにする // cmdで g++ test.cpp とするとコンパイルできる //制限1秒なら10^6は余裕 10^7は多分間に合う 10^8はよほど単純でないと厳しい #define ALL(x) x.begin(), x.end() typedef long long ll; // long long typedef pair<int, int> pii; // pair<int,int> typedef v...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
207
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashMap; import java.util.Map; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); long n = Long...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashMap; import java.util.Map; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); long n = Long...
[["-", 8, 196, 0, 57, 15, 15, 0, 16, 12, 499], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 12, 22]]
3
282
n = int(input()) def prime_factorize(n): res = [] for i in range(2, int(n ** 0.5) + 1): while n % i == 0: res.append(i) n //= i if n != 1: res.append(n) return res fac = prime_factorize(n) from collections import Counter ctr = Counter(fac) ans = 0 for val i...
n = int(input()) def prime_factorize(n): res = [] for i in range(2, int(n ** 0.5) + 1): while n % i == 0: res.append(i) n //= i if n != 1: res.append(n) return res fac = prime_factorize(n) from collections import Counter ctr = Counter(fac) ans = 0 for val i...
[["-", 0, 7, 8, 196, 0, 52, 15, 666, 667, 47], ["+", 8, 196, 0, 52, 15, 666, 0, 657, 17, 33], ["+", 8, 196, 0, 52, 15, 666, 0, 657, 12, 22], ["+", 0, 7, 8, 196, 0, 52, 15, 666, 667, 20]]
5
113
import java.util.HashMap; import java.util.Scanner; public class Main { public Main() { Scanner scanner = new Scanner(System.in); Long N = scanner.nextLong(); HashMap<Long, Integer> HM = new HashMap(); for (long i = 2; i * i <= N; i++) { if (N % i != 0) continue; int num = 0; ...
import java.util.HashMap; import java.util.Scanner; public class Main { public Main() { Scanner scanner = new Scanner(System.in); Long N = scanner.nextLong(); HashMap<Long, Integer> HM = new HashMap(); for (long i = 2; i * i <= N; i++) { if (N % i != 0) continue; int num = 0; ...
[["-", 0, 1, 0, 492, 3, 4, 0, 16, 12, 499], ["+", 0, 1, 0, 492, 3, 4, 0, 16, 12, 22]]
3
229
#include <bits/stdc++.h> using namespace std; vector<pair<long long, long long>> prime_factorize(long long N) { vector<pair<long long, long long>> res; for (long long a = 2; a * a <= N; ++a) { if (N % a != 0) continue; long long ex = 0; // 指数 // 割れる限り割り続ける while (N % a == 0) { ++ex; ...
#include <bits/stdc++.h> using namespace std; vector<pair<long long, long long>> prime_factorize(long long N) { vector<pair<long long, long long>> res; for (long long a = 2; a * a <= N; ++a) { if (N % a != 0) continue; long long ex = 0; // 指数 // 割れる限り割り続ける while (N % a == 0) { ++ex; ...
[["-", 8, 9, 0, 57, 64, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 12, 13]]
1
225
#include <cmath> #include <iostream> #include <vector> using namespace std; int vetor[100000100]; vector<int> primos; void crivo(long long int n) { for (int i = 2; i <= floor(sqrt(n)); i++) { if (vetor[i] == 0) { primos.push_back(i); int limite = floor(sqrt(n) / i); if (i >= limite) r...
#include <cmath> #include <iostream> #include <vector> using namespace std; int vetor[100000100]; vector<int> primos; void crivo(long long int n) { for (long long int i = 2; i <= floor(sqrt(n)); i++) { if (vetor[i] == 0) { primos.push_back(i); int limite = floor(sqrt(n) / i); if (i <= limite)...
[["+", 8, 9, 0, 7, 10, 43, 39, 86, 0, 96], ["-", 64, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["-", 0, 57, 64, 9, 0, 57, 64, 37, 0, 38], ["-", 0, 57, 64, 9, 0, 57, 64, 37, 0, 35], ["+", 0, 57, 64, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 57, 64, 9, 0, 57, 64, 9, 0, 46]]
1
249
#include <stdio.h> long long n, i, j, x; int ans = 0; int main(void) { scanf("%lld", &n); for (i = 2; i * i <= n; i++) { // printf("%lld ", i); for (x = 0; n % i == 0; x++) { // 素数がいくつあるか確認 n /= i; } // printf("%lld ", x); for (j = 0; j * (j + 1) / 2 <= x; j++) ; // 1,2,3,....の組を...
#include <stdio.h> long long n, i, j, x; int ans = 0; int main(void) { scanf("%lld", &n); for (i = 2; i * i <= n; i++) { // printf("%lld ", i); for (x = 0; n % i == 0; x++) { // 素数がいくつあるか確認 n /= i; } // printf("%lld ", x); for (j = 0; j * (j + 1) / 2 <= x; j++) ; // 1,2,3,....の組を...
[["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 33], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
122
#include <bits/stdc++.h> using namespace std; using ll = long long; using vi = vector<ll>; using vvi = vector<vi>; using pii = pair<ll, ll>; int main() { ll n; cin >> n; if (n == 1) { cout << 0 << endl; return 0; } ll ntmp = n; ll nsqrt = sqrtl(n); ll ret = 0; for (int i = 2; i <= nsqrt; ++...
#include <bits/stdc++.h> using namespace std; using ll = long long; using vi = vector<ll>; using vvi = vector<vi>; using pii = pair<ll, ll>; int main() { ll n; cin >> n; if (n == 1) { cout << 0 << endl; return 0; } ll ntmp = n; ll nsqrt = sqrtl(n); ll ret = 0; for (int i = 2; i <= nsqrt; ++...
[["-", 31, 16, 12, 16, 12, 23, 0, 16, 17, 79], ["-", 31, 16, 12, 16, 12, 23, 0, 16, 12, 13], ["+", 31, 16, 12, 16, 12, 23, 0, 16, 17, 47], ["+", 31, 16, 12, 16, 12, 23, 0, 16, 12, 13]]
1
202
#include <bits/stdc++.h> using namespace std; int main() { long long N; cin >> N; vector<pair<long long, int>> A; for (int i = 2; i * i < N; i++) { int x = 0; while (N % i == 0) { N /= i; x++; } A.emplace_back(i, x); } if (N != 1) A.emplace_back(N, 1); int count = 0; f...
#include <bits/stdc++.h> using namespace std; int main() { long long N; cin >> N; vector<pair<long long, int>> A; for (long long i = 2; i * i < N; i++) { int x = 0; while (N % i == 0) { N /= i; x++; } A.emplace_back(i, x); } if (N != 1) A.emplace_back(N, 1); int count = ...
[["-", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["+", 8, 9, 0, 7, 10, 43, 39, 86, 0, 96]]
1
146
arr = [] temp = int(input()) su =0 for i in range(2, int(-(-temp**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==[]: arr.append(1) su =1 for t in range(len(arr)): cnt =1 while arr[t...
arr = [] temp = int(input()) su =0 for i in range(2, int(-(-temp**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==[] and temp !=1: arr.append(1) su =1 for t in range(len(arr)): cnt =1 ...
[["+", 36, 36, 0, 656, 0, 57, 15, 679, 17, 355], ["+", 0, 656, 0, 57, 15, 679, 12, 666, 0, 22], ["+", 0, 656, 0, 57, 15, 679, 12, 666, 667, 79], ["+", 0, 656, 0, 57, 15, 679, 12, 666, 0, 612]]
5
133
#include <bits/stdc++.h> typedef long long ll; using namespace std; int main() { // your code goes here ll n, ans = 0, i, j; cin >> n; for (i = 2; i <= sqrt(n); i++) { j = i; while (n % j == 0) ans++, n /= j, j *= i; while (n % i == 0) n /= i; } cout << ans << endl; return 0; }
#include <bits/stdc++.h> typedef long long ll; using namespace std; int main() { // your code goes here ll n, ans = 0, i, j; cin >> n; for (i = 2; i <= sqrt(n); i++) { j = i; while (n % j == 0) ans++, n /= j, j *= i; while (n % i == 0) n /= i; } cout << ans + (n > 1) << endl; retu...
[["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["+", 0, 16, 31, 16, 12, 16, 12, 23, 0, 24], ["+", 31, 16, 12, 16, 12, 23, 0, 16, 31, 22], ["+", 31, 16, 12, 16, 12, 23, 0, 16, 17, 47], ["+", 31, 16, 12, 16, 12, 23, 0, 16, 12, 13], ["+", 0, 16, 31, 16, 12, 16, 12, 23, 0, 25]]
1
95
#include <bits/stdc++.h> typedef long long ll; using namespace std; main() { ll n, ans = 0, i, j; cin >> n; for (i = 2; i <= sqrt(n); i++) { j = i; while (n % j == 0) ans++, n /= j, j *= i; while (n % i == 0) n /= i; } cout << ans; }
#include <bits/stdc++.h> typedef long long ll; using namespace std; main() { ll n, ans = 0, i, j; cin >> n; for (i = 2; i <= sqrt(n); i++) { j = i; while (n % j == 0) ans++, n /= j, j *= i; while (n % i == 0) n /= i; } cout << ans + (n > 1); }
[["+", 8, 9, 0, 1, 0, 16, 12, 16, 17, 72], ["+", 0, 1, 0, 16, 12, 16, 12, 23, 0, 24], ["+", 0, 16, 12, 16, 12, 23, 0, 16, 31, 22], ["+", 0, 16, 12, 16, 12, 23, 0, 16, 17, 47], ["+", 0, 16, 12, 16, 12, 23, 0, 16, 12, 13], ["+", 0, 1, 0, 16, 12, 16, 12, 23, 0, 25]]
1
88
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 n==1: arr.append(0) return arr def kak(n): return ((1+8*n)**(1/2)-1)//2 A=da...
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 n==1: arr.append(0) return arr def kak(n): return ((1+8*n)**(1/2)-1)//2 A=fa...
[["-", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
142
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); long N = scanner.nextLong(); if (N <= 1) { System.out.println(0); return; } long sqrt = (long)Math.sqrt(N); int count = 0; for (long i = 2; i * i ...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); long N = scanner.nextLong(); if (N <= 1) { System.out.println(0); return; } long sqrt = (long)Math.sqrt(N); int count = 0; for (long i = 2; i * i ...
[["-", 0, 52, 8, 196, 0, 1, 0, 11, 17, 107], ["+", 0, 52, 8, 196, 0, 1, 0, 11, 17, 108]]
3
346
#include <cmath> #include <cstdio> #include <iostream> #include <vector> #define ll long long using namespace std; ll n; struct zhw { ll a; int b; }; vector<zhw> a; int main() { scanf("%d", &n); for (ll i = 2; i * i <= n; i++) { if (n % i == 0) { a.push_back((zhw){i, 0}); while (n % i == 0) { ...
#include <cmath> #include <cstdio> #include <iostream> #include <vector> #define ll long long using namespace std; ll n; struct zhw { ll a; int b; }; vector<zhw> a; int main() { scanf("%lld", &n); for (ll i = 2; i * i <= n; i++) { if (n % i == 0) { a.push_back((zhw){i * 1ll, 0}); while (n % i ==...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 3, 4, 0, 191, 51, 83, 0, 16, 17, 48], ["+", 3, 4, 0, 191, 51, 83, 0, 16, 12, 13]]
1
215
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.StringTokenizer; /** * Built using CHelper ...
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.StringTokenizer; /** * Built using CHelper ...
[["-", 51, 227, 497, 505, 0, 16, 31, 74, 51, 515], ["+", 51, 227, 497, 505, 0, 16, 31, 74, 51, 515], ["-", 0, 7, 15, 16, 12, 16, 31, 74, 51, 515], ["+", 0, 7, 15, 16, 12, 16, 31, 74, 51, 515], ["+", 15, 15, 0, 16, 31, 16, 31, 16, 31, 499], ["+", 15, 15, 0, 16, 31, 16, 31, 16, 17, 48]]
3
597
// // main.cpp // ABC169D #include <iostream> #include <vector> using namespace std; using ll = long long; using P = pair<ll, int>; int main(int argc, const char *argv[]) { ll N; cin >> N; int x; vector<P> fs; // Nを因数分解する for (long long i = 2; i * i < N; i++) { x = 0; while (N % i == 0) { ...
// // main.cpp // ABC169D #include <iostream> #include <vector> using namespace std; using ll = long long; using P = pair<ll, int>; int main(int argc, const char *argv[]) { ll N; cin >> N; int x; vector<P> fs; // Nを因数分解する for (long long i = 2; i * i < N; i++) { x = 0; while (N % i == 0) { ...
[["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 20], ["-", 0, 7, 8, 9, 0, 52, 8, 9, 0, 46], ["-", 0, 7, 8, 9, 0, 1, 0, 11, 17, 107], ["-", 0, 7, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 27, 17, 29], ["+", 0, 7, 8, 9, 0, 52, 8, 9, 0, 46]]
1
210
def factorization(n): arr = [] temp = n for i in range(2, int(n**0.5)+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.append([n, 1]) return arr a = factor...
def factorization(n): arr = [] temp = n for i in range(2, int(n**0.5)+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.append([n, 1]) return arr a = factorization(i...
[["-", 0, 52, 8, 196, 0, 1, 0, 677, 17, 691], ["+", 0, 52, 8, 196, 0, 1, 0, 677, 17, 90], ["-", 0, 656, 0, 1, 0, 662, 12, 634, 0, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 634, 0, 612]]
5
191
# -*- coding: utf-8 -*- # 入力を整数に変換して受け取る def input_int(): return int(input()) # マイナス1した値を返却 def int1(x): return int(x) - 1 # 半角スペース区切り入力をIntに変換してMapで受け取る def input_to_int_map(): return map(int, input().split()) # 半角スペース区切り入力をIntに変換して受け取る def input_to_int_tuple(): return tuple(map(int, input().spl...
# -*- coding: utf-8 -*- # 入力を整数に変換して受け取る def input_int(): return int(input()) # マイナス1した値を返却 def int1(x): return int(x) - 1 # 半角スペース区切り入力をIntに変換してMapで受け取る def input_to_int_map(): return map(int, input().split()) # 半角スペース区切り入力をIntに変換して受け取る def input_to_int_tuple(): return tuple(map(int, input().spl...
[["-", 0, 14, 8, 196, 0, 57, 15, 666, 667, 60], ["+", 0, 14, 8, 196, 0, 57, 15, 666, 667, 18], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
243
#include <bits/stdc++.h> #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) #define FILL0(x) memset(x, 0, sizeof(x)) using namespace std; typedef long long ll; typedef pair<int, int> P; template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> b...
#include <bits/stdc++.h> #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) #define FILL0(x) memset(x, 0, sizeof(x)) using namespace std; typedef long long ll; typedef pair<int, int> P; template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> b...
[["-", 0, 338, 8, 9, 0, 1, 0, 11, 31, 22], ["-", 0, 338, 8, 9, 0, 1, 0, 11, 17, 32], ["-", 0, 338, 8, 9, 0, 1, 0, 11, 12, 13], ["-", 8, 9, 0, 338, 8, 9, 0, 1, 0, 35]]
1
287
import sys import math def is_prime(N): if N == 1: return False i = 2 while i * i <= N: if N % i == 0: return False i += 1 return True def prime(N): prime = [] is_prime = [] # 全て素数であると初期化 for i in range(N): if i * i > N: break ...
import sys import math def is_prime(N): if N == 1: return False i = 2 while i * i <= N: if N % i == 0: return False i += 1 return True def prime(N): prime = [] is_prime = [] # 全て素数であると初期化 for i in range(N): if i * i > N: break ...
[["-", 64, 196, 0, 52, 8, 196, 0, 57, 0, 121], ["+", 64, 196, 0, 52, 8, 196, 0, 52, 0, 89]]
5
347
num = int(input()) #prime number counter ans = 0 prime_check = [1]*1000100 count = 2 while num>1: if prime_check[count]==1: #countが素数だった場合 tmp = 0 while num % count == 0: #numの因数にcountが何個含まれているか num/= count tmp += 1 tmp2 =1 while tmp>=tmp2: #ansに加える ...
num = int(input()) #prime number counter ans = 0 prime_check = [1]*1000100 count = 2 while num>1: if prime_check[count]==1: #countが素数だった場合 tmp = 0 while num % count == 0: #numの因数にcountが何個含まれているか num/= count tmp += 1 tmp2 =1 while tmp>=tmp2: #ansに加える ...
[["+", 0, 57, 64, 196, 0, 1, 0, 677, 31, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 17, 107], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 12, 612]]
5
109
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; int z; int a = 0; for (int i = 2; i < 1000; ++i) { int c = 0; while (n % i == 0) { n /= i; c++; } for (int j = 1; c > 0; ++j, c -= j) { a++; } } if (n != 1) a++; cout << a; }
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; int z; int a = 0; for (int i = 2; i < 10000000; ++i) { int c = 0; while (n % i == 0) { n /= i; c++; } for (int j = 1; c > 0; ++j, c -= j) { a++; } } if (n != 1) a++; cout << a; }
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
102
N = int(input()) a = [] count =0 count2 = 0 count3 = 0 X=int(N**0.5) for i in range(X+1): if i ==0 or i == 1: pass elif N % i == 0: while N % i==0: N /= i count2 += 1 j =1 count3 = 0 while count2 - j >=0: count2 -= j j = j+1 count3 += 1 count += count3 count2 = 0 if count...
N = int(input()) a = [] count =0 count2 = 0 count3 = 0 X=int(N**0.5) for i in range(X+1): if i ==0 or i == 1: pass elif N % i == 0: while N % i==0: N /= i count2 += 1 j =1 count3 = 0 while count2 - j >=0: count2 -= j j = j+1 count3 += 1 count += count3 count2 = 0 if N >1...
[["-", 0, 656, 0, 57, 15, 679, 31, 666, 0, 22], ["-", 0, 656, 0, 57, 15, 679, 31, 666, 667, 60], ["-", 0, 656, 0, 57, 15, 679, 31, 666, 0, 612], ["-", 36, 36, 0, 656, 0, 57, 15, 679, 17, 355], ["-", 0, 57, 64, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 17, 107]]
5
115
N = int(input()) N_prime = [] n = N i = 2 while i <= N**0.5: if n%i != 0: i += 1 continue N_prime.append(i) n = n/i if n == 1: break if N_prime == []: N_prime.append(N) elif n != 1: N_prime.append(int(n)) ct = [] for i in N_prime: if i not in ct: ct.ap...
N = int(input()) N_prime = [] n = N i = 2 while i <= N**0.5: if n%i != 0: i += 1 continue N_prime.append(i) n = n/i if n == 1: break if N_prime == [] and N != 1: N_prime.append(N) elif n != 1: N_prime.append(int(n)) ct = [] for i in N_prime: if i not in ct: ...
[["+", 36, 36, 0, 656, 0, 57, 15, 679, 17, 355], ["+", 0, 656, 0, 57, 15, 679, 12, 666, 0, 22], ["+", 0, 656, 0, 57, 15, 679, 12, 666, 667, 79], ["+", 0, 656, 0, 57, 15, 679, 12, 666, 0, 612], ["-", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 612]]
5
130
import java.io.InputStream; import java.io.PrintStream; import java.util.Scanner; import java.util.SortedMap; import java.util.TreeMap; import java.util.concurrent.atomic.AtomicInteger; public class Main { public static void main(String[] args) { resolve(System.in, System.out); } static void resolve(InputStream ...
import java.io.InputStream; import java.io.PrintStream; import java.util.Scanner; import java.util.SortedMap; import java.util.TreeMap; import java.util.concurrent.atomic.AtomicInteger; public class Main { public static void main(String[] args) { resolve(System.in, System.out); } static void resolve(InputStream ...
[["-", 8, 196, 0, 57, 15, 15, 0, 492, 500, 22], ["-", 8, 196, 0, 57, 15, 15, 0, 492, 0, 131], ["-", 8, 196, 0, 57, 15, 15, 0, 492, 141, 22], ["-", 0, 57, 15, 15, 0, 492, 3, 4, 0, 24], ["-", 0, 57, 15, 15, 0, 492, 3, 4, 0, 25], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 31, 22], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 17, 79], ["+...
3
375
/** * author: Dooloper * created: 06.06.2020 00:59:13 **/ #include <algorithm> #include <cassert> #include <cmath> #include <deque> #include <functional> #include <iostream> #include <map> #include <queue> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; typedef u...
/** * author: Dooloper * created: 06.06.2020 00:59:13 **/ #include <algorithm> #include <cassert> #include <cmath> #include <deque> #include <functional> #include <iostream> #include <map> #include <queue> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; typedef u...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 24], ["+", 49, 50, 51, 4, 0, 16, 31, 74, 0, 24], ["+", 51, 4, 0, 16, 31, 74, 39, 77, 39, 40], ["+", 49, 50, 51, 4, 0, 16, 31, 74, 0, 25], ["+", 51, 4, 0, 16, 31, 74, 51, 2, 63, 22], ["+", 0, 16, 31,...
1
273
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int nMax = 1000000; class Sieve { private: int n; vector<int> f, primes; public: Sieve(int v = 1) : n(v), f(n + 1) { f[0] = f[1] = -1; for (int i = 2; i * i <= n; i++) { if (f[i]) continue; primes.push_back(i)...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int nMax = 1000000; class Sieve { private: int n; vector<int> f, primes; public: Sieve(int v = 1) : n(v), f(n + 1) { f[0] = f[1] = -1; for (ll i = 2; i <= n; i++) { if (f[i]) continue; primes.push_back(i); ...
[["-", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 7, 10, 43, 39, 78], ["-", 8, 9, 0, 7, 15, 16, 31, 16, 31, 22], ["-", 8, 9, 0, 7, 15, 16, 31, 16, 17, 48], ["-", 0, 7, 8, 9, 0, 7, 10, 43, 39, 40], ["+", 0, 7, 8, 9, 0, 7, 10, 43, 39, 78]]
1
330
#define _CRT_SECURE_NO_WARNINGS #ifndef _MSC_VER #include <bits/stdc++.h> #else #include <__msvc_all_public_headers.hpp> #endif using namespace std; #define for0(i, n) for (int i = 0; i < (int)(n); ++i) #define for1(i, n) for (int i = 1; i <= (int)(n); ++i) #define forc(i, l, r) for (int i = (int)(l); i <= (int)(r); +...
#define _CRT_SECURE_NO_WARNINGS #ifndef _MSC_VER #include <bits/stdc++.h> #else #include <__msvc_all_public_headers.hpp> #endif using namespace std; #define for0(i, n) for (int i = 0; i < (int)(n); ++i) #define for1(i, n) for (int i = 1; i <= (int)(n); ++i) #define forc(i, l, r) for (int i = (int)(l); i <= (int)(r); +...
[["+", 0, 52, 15, 339, 51, 16, 31, 23, 0, 24], ["+", 0, 52, 15, 339, 51, 16, 31, 23, 0, 25], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13]]
1
286
import numpy as np import sys #import copy def xnxn(n=0): """ args: int n: a number of lows to read example: input 1 retrun 1 input 1 2 3 return [1,2,3] input 1 2 3 4 return [[1,2,3], [4]] """ if n ==...
import numpy as np import sys #import copy def xnxn(n=0): """ args: int n: a number of lows to read example: input 1 retrun 1 input 1 2 3 return [1,2,3] input 1 2 3 4 return [[1,2,3], [4]] """ if n ==...
[["+", 75, 76, 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
441
// #pragma GCC target("avx2") #pragma GCC optimize("O3", "unroll-loops") // #include <bits/extc++.h> // using namespace __gnu_pbds; #include <bits/stdc++.h> using namespace std; #define int long long #define double long double // template <typename T> // using pbds_set = tree<T, null_type, less<T>, rb_tree_tag, // t...
// #pragma GCC target("avx2") #pragma GCC optimize("O3", "unroll-loops") // #include <bits/extc++.h> // using namespace __gnu_pbds; #include <bits/stdc++.h> using namespace std; #define int long long #define double long double // template <typename T> // using pbds_set = tree<T, null_type, less<T>, rb_tree_tag, // t...
[["+", 64, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 12, 13]]
1
251
#include <bits/stdc++.h> #define ll long long #define ull unsigned long long #define pii pair<int, int> #define piii pair<int, pii> #define pll pair<ll, ll> #define plii pair<ll, pii> #define vi vector<int> #define ff first #define ss second #define mp make_pair #define pb push_back #define SORT(x) sort(x.begin(), x.en...
#include <bits/stdc++.h> #define ll long long #define ull unsigned long long #define pii pair<int, int> #define piii pair<int, pii> #define pll pair<ll, ll> #define plii pair<ll, pii> #define vi vector<int> #define ff first #define ss second #define mp make_pair #define pb push_back #define SORT(x) sort(x.begin(), x.en...
[["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 20], ["-", 0, 1, 0, 11, 12, 23, 0, 16, 12, 13], ["+", 0, 1, 0, 11, 12, 23, 0, 16, 12, 13]]
1
263
#include <iostream> #include <vector> using namespace std; vector<pair<long long, long long>> prime(long long n) { vector<pair<long long, long long>> res; for (long long a = 2; a * a <= n; a++) { if (n % a != 0) continue; long long ex = 0; while (n % a == 0) { ex++; n /= a; } r...
#include <iostream> #include <vector> using namespace std; vector<pair<long long, long long>> prime(long long n) { vector<pair<long long, long long>> res; for (long long a = 2; a * a <= n; a++) { if (n % a != 0) continue; long long ex = 0; while (n % a == 0) { ex++; n /= a; } r...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
205
# @oj: atcoder # @id: hitwanyang # @email: 296866643@qq.com # @date: 2020-06-05 15:25 # @url:https://atcoder.jp/contests/abc169/tasks/abc169_d import sys,os from io import BytesIO, IOBase import collections,itertools,bisect,heapq,math,string from decimal import * # region fastio BUFSIZE = 8192 BUFSIZE = 8192 class F...
# @oj: atcoder # @id: hitwanyang # @email: 296866643@qq.com # @date: 2020-06-05 15:25 # @url:https://atcoder.jp/contests/abc169/tasks/abc169_d import sys,os from io import BytesIO, IOBase import collections,itertools,bisect,heapq,math,string from decimal import * # region fastio BUFSIZE = 8192 BUFSIZE = 8192 class F...
[["+", 8, 196, 0, 1, 0, 677, 12, 23, 0, 24], ["+", 0, 1, 0, 677, 12, 23, 0, 657, 31, 22], ["+", 0, 1, 0, 677, 12, 23, 0, 657, 17, 33], ["+", 8, 196, 0, 1, 0, 677, 12, 23, 0, 25]]
5
691
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll x; int main() { cin >> x; vector<ll> v; for (int i = 2; i <= x / i; i++) { ll res = 0; if (x % i == 0) { while (x % i == 0) x /= i, res++; v.push_back(res); } } if (x > 1) v.push_back(1); ll sum = 0; ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll x; int main() { cin >> x; vector<ll> v; for (int i = 2; i <= x / i; i++) { ll res = 0; if (x % i == 0) { while (x % i == 0) x /= i, res++; v.push_back(res); } } if (x > 1) v.push_back(1); ll sum = 0; ...
[["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 19], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 107], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
1
159
def factorization(y): arr = [] temp = y for i in range(2, int(-(-y**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.a...
def factorization(y): arr = [] temp = y for i in range(2, int(-(-y**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.a...
[["-", 0, 52, 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, 21], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
179
package main import ( "fmt" ) func power(a, b int64) int64 { if b == 0 { return int64(1) } ret := power(a, b/2) ret *= ret if b%2 == 1 { ret *= a } return ret } func main() { var n int64 fmt.Scan(&n) var sqn int for sqn = 1; int64(sqn)*int64(sqn) < n; sqn++ { } isnotPrime := make([]bool, sqn+1) ...
package main import ( "fmt" ) func power(a, b int64) int64 { if b == 0 { return int64(1) } ret := power(a, b/2) ret *= ret if b%2 == 1 { ret *= a } return ret } func main() { var n int64 fmt.Scan(&n) var sqn int for sqn = 1; int64(sqn)*int64(sqn) < n; sqn++ { } isnotPrime := make([]bool, sqn+1) ...
[["-", 0, 57, 64, 196, 0, 1, 0, 2, 63, 22], ["+", 64, 196, 0, 1, 0, 2, 63, 438, 439, 22], ["+", 64, 196, 0, 1, 0, 2, 63, 438, 0, 131], ["+", 64, 196, 0, 1, 0, 2, 63, 438, 119, 120], ["-", 0, 435, 8, 196, 0, 1, 0, 2, 63, 22], ["+", 8, 196, 0, 1, 0, 2, 63, 438, 439, 22], ["+", 8, 196, 0, 1, 0, 2, 63, 438, 0, 131], ["+", ...
7
265
def prime_factorize(n): a = {} while n % 2 == 0: if 2 not in a: a[2] = 1 else: a[2] += 1 n //= 2 f = 3 while f * f <= n: if n % f == 0: if f not in a: a[f] = 1 else: a[f] += 1 n //...
def prime_factorize(n): a = {} while n % 2 == 0: if 2 not in a: a[2] = 1 else: a[2] += 1 n //= 2 f = 3 while f * f <= n: while n % f == 0: if f not in a: a[f] = 1 else: a[f] += 1 n...
[["-", 8, 196, 0, 52, 8, 196, 0, 57, 0, 121], ["+", 8, 196, 0, 52, 8, 196, 0, 52, 0, 89], ["-", 0, 52, 8, 196, 0, 57, 75, 76, 0, 95], ["-", 0, 52, 8, 196, 0, 57, 75, 76, 0, 102]]
5
166
def prime_factorize(n): a = {} while n % 2 == 0: if 2 not in a: a[2] = 1 else: a[2] += 1 n //= 2 f = 3 while f * f <= n: if n % f == 0: if f not in a: a[f] = 1 else: a[f] += 1 n //...
def prime_factorize(n): a = {} while n % 2 == 0: if 2 not in a: a[2] = 1 else: a[2] += 1 n //= 2 # print('[A]n:{}, a:{}'.format(n, a)) f = 3 while f * f <= n: while n % f == 0: if f not in a: a[f] = 1 ...
[["-", 8, 196, 0, 52, 8, 196, 0, 57, 0, 121], ["+", 8, 196, 0, 52, 8, 196, 0, 52, 0, 89], ["-", 0, 52, 8, 196, 0, 57, 75, 76, 0, 95], ["-", 0, 52, 8, 196, 0, 57, 75, 76, 0, 102]]
5
166
def resolve(): answer = 0 N = int(input()) if N==1: print(answer) else: # 素因数pを見つける。範囲は2から√Nまででよい。 for p in range(2, int(N**0.5)+1): e = 0 while (N % p == 0): N /= p e += 1 # z=p**eが見つかった if e>0: # eを1, 2, 3, 4...に分けられる回数カウント for i in range(1, e+1): if e >= i: e -= i ...
def resolve(): answer = 0 N = int(input()) if N==1: print(answer) else: # 素因数pを見つける。範囲は2から√Nまででよい。 for p in range(2, int(N**0.5)+2): e = 0 while (N % p == 0): N /= p e += 1 # z=p**eが見つかった if e>0: # eを1, 2, 3, 4...に分けられる回数カウント for i in range(1, e+1): if e >= i: e -= i ...
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["-", 75, 76, 8, 196, 0, 57, 15, 666, 0, 22], ["-", 75, 76, 8, 196, 0, 57, 15, 666, 667, 60], ["-", 75, 76, 8, 196, 0, 57, 15, 666, 0, 612], ["+", 75, 76, 8, 196, 0, 57, 15, 666, 0, 22], ["+", 75, 76, 8, 196, 0, 57, 15, 666, 667,...
5
109
#include <iostream> #include <vector> using ll = long long; using namespace std; vector<pair<ll, ll>> prime_factorize(ll n) { vector<pair<ll, ll>> res; for (ll p = 2; p * p <= n; p++) { if (n % p == 0) { continue; } int num = 0; while (n % p != 0) { num++; n /= p; } res....
#include <iostream> #include <vector> using ll = long long; using namespace std; vector<pair<ll, ll>> prime_factorize(ll n) { vector<pair<ll, ll>> res; for (ll p = 2; p * p <= n; p++) { if (n % p != 0) { continue; } int num = 0; while (n % p == 0) { num++; n /= p; } res....
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 79], ["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 79], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 60]]
1
207
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, 57, 15, 666, 0, 612], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 612]]
5
209
require 'prime' n = gets.to_i a = n.prime_division aa = a.size ans = 0 (0..aa).each do |i| s = a[i][1] x = 1 s -= x while s >= 0 ans += 1 x += 1 s -= x end end puts ans
require 'prime' n = gets.to_i a = n.prime_division aa = a.size ans = 0 (0...aa).each do |i| s = a[i][1] x = 1 s -= x while s >= 0 ans += 1 x += 1 s -= x end end puts ans
[["-", 0, 493, 0, 652, 486, 739, 0, 475, 17, 757], ["+", 0, 493, 0, 652, 486, 739, 0, 475, 17, 389]]
4
65
def factorization(n): arr = [] 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]) return arr N = int(input()) ans = 0 ...
def factorization(n): arr = [] for i in range(2, int(-(-n**0.5//1))+1): if n%i == 0: cnt=0 while n%i == 0: cnt += 1 n //= i arr.append([i, cnt]) if n != 1: arr.append([n, 1]) return arr N = int(input()) ans = 0 if N !=...
[["-", 8, 196, 0, 57, 15, 666, 0, 657, 31, 22], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 31, 22], ["-", 64, 196, 0, 52, 15, 666, 0, 657, 31, 22], ["+", 64, 196, 0, 52, 15, 666, 0, 657, 31, 22], ["-", 0, 52, 8, 196, 0, 1, 0, 677, 31, 22], ["+", 0, 52, 8, 196, 0, 1, 0, 677, 31, 22], ["-", 0, 14, 8, 196, 0, 57, 15, 666, 0, 2...
5
135
import sys import math import itertools import collections import heapq import re import numpy as np rr = lambda: sys.stdin.buffer.readline().rstrip() rs = lambda: sys.stdin.buffer.readline().split() ri = lambda: int(sys.stdin.buffer.readline()) rm = lambda: map(int, sys.stdin.buffer.readline().split()) rl = lambda: l...
import sys import math import itertools import collections import heapq import re import numpy as np rr = lambda: sys.stdin.buffer.readline().rstrip() rs = lambda: sys.stdin.buffer.readline().split() ri = lambda: int(sys.stdin.buffer.readline()) rm = lambda: map(int, sys.stdin.buffer.readline().split()) rl = lambda: l...
[["-", 0, 52, 8, 196, 0, 1, 0, 677, 12, 22], ["+", 0, 52, 8, 196, 0, 1, 0, 677, 12, 22], ["+", 0, 52, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 52, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 31, 22], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 17, 72], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 12, 612]]
5
183
import math def factrization_prime(number): factor = {} div = 2 s = math.sqrt(number) while div < s: div_cnt = 0 while number % div == 0: div_cnt += 1 number //= div if div_cnt != 0: factor[div] = div_cnt div += 1 if number > 1: ...
import math def factrization_prime(number): factor = {} div = 2 s = math.sqrt(number) while div < s: div_cnt = 0 while number % div == 0: div_cnt += 1 number //= div if div_cnt != 0: factor[div] = div_cnt div += 1 if number > 1: ...
[["-", 0, 7, 8, 196, 0, 52, 15, 666, 667, 18], ["+", 0, 7, 8, 196, 0, 52, 15, 666, 667, 19], ["+", 8, 196, 0, 1, 0, 677, 12, 657, 17, 33], ["+", 8, 196, 0, 1, 0, 677, 12, 657, 12, 612]]
5
123
#include "bits/stdc++.h" #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; using ll = long long; int main() { ll n; cin >> n; ll m = n; ll ans = 0; for (ll i = 2; i * i <= m; i++) { if (n % i == 0) { int count = 0; ll j = i; while (n % j == 0) { count++; ...
#include "bits/stdc++.h" #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; using ll = long long; int main() { ll n; cin >> n; ll m = n; ll ans = 0; for (ll i = 2; i * i <= m; i++) { if (n % i == 0) { int count = 0; ll j = i; while (n % j == 0) { count++; ...
[["-", 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, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 107]]
1
147
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) if 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) if arr == []...
[["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 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
157
import math N = int(input()) x = N n = math.floor(math.sqrt(N)) p = {} i = 2 while i <= n: while x % i == 0: p.setdefault(i, 0) p[i] += 1 x //= i i += 1 if x != 1 and x == N: p.setdefault(N, 1) ans = 0 for v in p.values(): i = 1 while v - i >= 0: v -= i ...
import math N = int(input()) x = N n = math.floor(math.sqrt(N)) p = {} i = 2 while i <= n: while x % i == 0: p.setdefault(i, 0) p[i] += 1 x //= i i += 1 if x != 1: p.setdefault(x, 1) ans = 0 for v in p.values(): i = 1 while v - i >= 0: v -= i ans += 1 ...
[["-", 36, 36, 0, 656, 0, 57, 15, 679, 17, 355], ["-", 0, 656, 0, 57, 15, 679, 12, 666, 0, 22], ["-", 0, 656, 0, 57, 15, 679, 12, 666, 667, 60], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
117
N = int(input()) def prime_factorization(N): n = int(N**0.5) numList = [i if i != 1 else 2 for i in range(1, n, 2) ] primeList = [2] ansDict = {} idx = 0 for data in numList: for x in primeList: if (data%x != 0 or x == 2): count = 0 while N%data == 0: count += 1 ...
N = int(input()) def prime_factorization(N): n = int(N**0.5)+1 numList = [i if i != 1 else 2 for i in range(1, n, 2) ] primeList = [2] ansDict = {} idx = 0 for data in numList: for x in primeList: if (data%x != 0 or x == 2): count = 0 while N%data == 0: count += 1 ...
[["+", 8, 196, 0, 1, 0, 662, 12, 657, 17, 72], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 12, 612], ["-", 0, 14, 8, 196, 0, 57, 15, 666, 0, 22], ["-", 0, 14, 8, 196, 0, 57, 15, 666, 667, 60], ["-", 8, 196, 0, 57, 15, 666, 0, 680, 0, 45], ["-", 8, 196, 0, 57, 15, 666, 0, 680, 0, 46], ["+", 0, 14, 8, 196, 0, 57, 15, 666, 0, 22...
5
192
N = int(input()) def prime_factorize(n): prime_list = [] tmp = n if n == 1: return [1] for i in range(2,int(n**0.5)+1): if tmp % i == 0: while tmp % i == 0: tmp = tmp // i prime_list.append(i) if tmp != 1: prime_li...
N = int(input()) def prime_factorize(n): prime_list = [] tmp = n if n == 1: return [] for i in range(2,int(n**0.5)+1): if tmp % i == 0: while tmp % i == 0: tmp = tmp // i prime_list.append(i) if tmp != 1: prime_lis...
[["-", 0, 57, 64, 196, 0, 37, 0, 634, 0, 612]]
5
171
from collections import defaultdict import decimal import sys input = sys.stdin.readline def prime_factor_count(n): def count(n, i): cnt = 0 while n % i == 0: cnt += 1 n //= i return n, cnt d = {} if n == 1: return d n, cnt = count(n, 2) d[...
from collections import defaultdict import decimal import sys input = sys.stdin.readline def prime_factor_count(n): def count(n, i): cnt = 0 while n % i == 0: cnt += 1 n //= i return n, cnt d = {} if n == 1: return d n, cnt = count(n, 2) d[...
[["-", 0, 14, 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, 21], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
269
import sys import math from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN from collections import deque from bisect import bisect_left from itertools import product def I(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readlin...
import sys import math from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN from collections import deque from bisect import bisect_left from itertools import product def I(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readlin...
[["-", 36, 36, 0, 656, 0, 52, 15, 666, 667, 47], ["+", 0, 656, 0, 52, 15, 666, 0, 657, 17, 33], ["+", 0, 656, 0, 52, 15, 666, 0, 657, 12, 22], ["+", 36, 36, 0, 656, 0, 52, 15, 666, 667, 20]]
5
598
""" - Nを素因数分解する - N = p[i]^1*p[i]^2...*p[k]^1*p[k]^2... """ from collections import Counter N = int(input()) factors = [] i = 2 while N > 1: if N < i * i: factors.append(N) break while N % i == 0: factors.append(i) N //= i i += 1 # N == 1 ans = 0 print(factors) for count in Counter(factors).value...
""" - Nを素因数分解する - N = p[i]^1*p[i]^2...*p[k]^1*p[k]^2... """ from collections import Counter N = int(input()) factors = [] i = 2 while N > 1: if N < i * i: factors.append(N) break while N % i == 0: factors.append(i) N //= i i += 1 # N == 1 ans = 0 # print(factors) for count in Counter(factors).val...
[["-", 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
101
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; using ll = long long; using P = pair<int, int>; int main() { ll N; cin >> N; vector<pair<ll, int>> x; ll num = N; int cnt = 0; for (ll i = 2; i * i <= N; i++) { int cnt = 0; while (num % i == 0) { n...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; using ll = long long; using P = pair<int, int>; int main() { ll N; cin >> N; vector<pair<ll, int>> x; ll num = N; int cnt = 0; for (ll i = 2; i * i <= N; i++) { int cnt = 0; while (num % i == 0) { n...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
183
#include <bits/stdc++.h> using namespace std; vector<pair<long long, long long>> pri_check(long long N) { vector<pair<long long, long long>> prime_fac; for (long long A = 2; A * A < N; A++) { if (N % A != 0) continue; long long exp = 0; while (N % A == 0) { exp++; N /= A; } ...
#include <bits/stdc++.h> using namespace std; vector<pair<long long, long long>> pri_check(long long N) { vector<pair<long long, long long>> prime_fac; for (long long A = 2; A * A < N; A++) { if (N % A != 0) continue; long long exp = 0; while (N % A == 0) { exp++; N /= A; } ...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 338, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 338, 8, 9, 0, 7, 15, 16, 17, 19]]
1
229
def factorization(n): m=n counter_map={} i=2 tmp=1 while n!=1: #因数に持つか判定 if n%i==0: n=n//i #素数判定 for j in range(2,int(i**(1/2))+1): if i%j==0: break else: tmp*=i if i n...
def factorization(n): m=n counter_map={} i=2 tmp=1 while n!=1: #因数に持つか判定 if n%i==0: n=n//i #素数判定 for j in range(2,int(i**(1/2))+1): if i%j==0: break else: tmp*=i if i n...
[["+", 0, 57, 64, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 612], ["-", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["-", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]]
5
171
from collections import defaultdict from itertools import accumulate def main(): n = int(input()) prime_counter = defaultdict(int) acc = tuple(accumulate(range(1, 42))) # 10^12 < 2^39 f = 2 while n % f == 0: n //= f prime_counter[f] += 1 f = 3 while f * f <= n: if...
from collections import defaultdict from itertools import accumulate def main(): n = int(input()) prime_counter = defaultdict(int) acc = tuple(accumulate(range(1, 42))) # 10^12 < 2^39 f = 2 while n % f == 0: n //= f prime_counter[f] += 1 f = 3 while f * f <= n: if...
[["-", 64, 196, 0, 1, 0, 677, 31, 206, 206, 22], ["+", 64, 196, 0, 1, 0, 677, 31, 206, 206, 22]]
5
151
import math #nの素因数分解(O(n**0.5) def prime_factor(n): ass = [] for i in range(2,int(n**0.5)+1): while n % i==0: ass.append(i) n = n//i if n != 1: ass.append(n) return ass N = int(input()) ans = 0 howmany = [] nums = sorted(prime_factor(N)) if len(nums)>0: cou...
import math #nの素因数分解(O(n**0.5) def prime_factor(n): ass = [] for i in range(2,int(n**0.5)+1): while n % i==0: ass.append(i) n = n//i if n != 1: ass.append(n) return ass N = int(input()) ans = 0 howmany = [] nums = sorted(prime_factor(N)) if len(nums)>0: cou...
[["-", 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
186
import sys sys.setrecursionlimit(1000000) def I(): return int(sys.stdin.readline().rstrip()) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) def S(): return sys.stdin.readline().rstrip() def LS(): return list(sys.stdin.readline().rstrip().split()) from collections import defaultdict n = I() def p...
import sys sys.setrecursionlimit(1000000) def I(): return int(sys.stdin.readline().rstrip()) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) def S(): return sys.stdin.readline().rstrip() def LS(): return list(sys.stdin.readline().rstrip().split()) from collections import defaultdict n = I() def pr...
[["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
231
n=int(input()) d={2:0} while n%2<1: n//=2; d[2]+=1 for i in range(3,int(n**0.5)+1,2): while n%i<1: n//=i; d[i]=d.get(i,0)+1 if n<2: break if n>1: d[x]=1 a=0 for i in d.values(): t=c=0 while t+c<i: c+=1; t+=c a+=c print(a)
n=int(input()) d={2:0} while n%2<1: n//=2; d[2]+=1 for i in range(3,int(n**0.5)+1,2): while n%i<1: n//=i; d[i]=d.get(i,0)+1 if n<2: break if n>1: d[n]=1 a=0 for i in d.values(): t=c=0 while t+c<i: c+=1; t+=c a+=c print(a)
[["-", 64, 196, 0, 1, 0, 662, 31, 206, 206, 22], ["+", 64, 196, 0, 1, 0, 662, 31, 206, 206, 22]]
5
132
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...
[["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 31, 612], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 578], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
162
N=int(input()) NN = N i = 2 ans = 0 while i*i <= NN: if N%i==0: j = 0 while N%i==0: N /= i j+=1 k = 1 while j>0: if j - k < 0: break ans += 1 # print(i,ans,j,k) j -= k k += 1 i += 1 if NN == N and N != 1: ans += 1 print(ans)
N=int(input()) NN = N i = 2 ans = 0 while i*i <= NN: if N%i==0: j = 0 while N%i==0: N /= i j+=1 k = 1 while j>0: if j - k < 0: break ans += 1 # print(i,ans,j,k) j -= k k += 1 i += 1 if N != 1: ans += 1 print(ans)
[["-", 0, 656, 0, 57, 15, 679, 31, 666, 0, 22], ["-", 0, 656, 0, 57, 15, 679, 31, 666, 667, 60], ["-", 36, 36, 0, 656, 0, 57, 15, 679, 17, 355]]
5
92
N = int(input()) #素因数分解 def factorize_dict(n): b = 2 fct = dict() while b * b <= n: while n % b == 0: n //= b #fct.append(b) if b not in fct: fct[b] = 1 else: fct[b] += 1 b = b + 1 if n > 1: #fct.app...
N = int(input()) #素因数分解 def factorize_dict(n): b = 2 fct = dict() while b * b <= n: while n % b == 0: n //= b #fct.append(b) if b not in fct: fct[b] = 1 else: fct[b] += 1 b = b + 1 if n > 1: #fct.app...
[["-", 0, 57, 64, 196, 0, 57, 15, 666, 0, 22], ["+", 0, 57, 64, 196, 0, 57, 15, 666, 0, 22], ["-", 64, 196, 0, 1, 0, 662, 31, 206, 206, 22], ["+", 64, 196, 0, 1, 0, 662, 31, 206, 206, 22], ["-", 8, 196, 0, 1, 0, 677, 31, 206, 206, 22], ["+", 8, 196, 0, 1, 0, 677, 31, 206, 206, 22]]
5
184
n = int(input()) ans = 0 for i in range(2,int(n**0.5)+1): count = 1 loop = 1 while n % i == 0: n = int(n/i) count -= 1 if count == 0: ans += 1 loop += 1 count = loop if n > 1: ans = 1 print(ans)
n = int(input()) ans = 0 for i in range(2,int(n**0.5)+1): count = 1 loop = 1 while n % i == 0: n = int(n/i) count -= 1 if count == 0: ans += 1 loop += 1 count = loop if n > 1: ans += 1 print(ans)
[["-", 0, 57, 64, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 17, 107]]
5
78
import collections def primes(n): #試し割り法で各素因数とその指数を求める cnt=collections.defaultdict(int) for i in range(2,int(n**0.5)+1): if n%i==0: while n%i==0: cnt[i]+=1 n//=i if n!=1: cnt[n]+=1 return cnt n=int(input()) cnt=primes(n) ans=0 for key in cnt.keys(): val=cnt[key] print(key,val) ...
import collections def primes(n): #試し割り法で各素因数とその指数を求める cnt=collections.defaultdict(int) for i in range(2,int(n**0.5)+1): if n%i==0: while n%i==0: cnt[i]+=1 n//=i if n!=1: cnt[n]+=1 return cnt n=int(input()) cnt=primes(n) ans=0 for key in cnt.keys(): val=cnt[key] for i in range(1...
[["-", 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, 21], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
142
import math N = int(input()) fact = set() counter = 0 for i in range(2, int(math.sqrt(N))+1): if N % i != 0: continue powt = 0 while N % i == 0: powt += 1 N /= i fact.add((i, powt)) if N != 1: fact.add((N, 1)) for base, e in fact: for t in range(1, e+1): if t...
import math N = int(input()) fact = set() counter = 0 for i in range(2, int(math.sqrt(N))+1): if N % i != 0: continue powt = 0 while N % i == 0: powt += 1 N /= i fact.add((i, powt)) if N != 1: fact.add((N, 1)) for base, e in fact: for t in range(1, e+1): if t...
[["-", 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
125
#include <iostream> // #include <bits/stdc++.h> #include <vector> using namespace std; vector<pair<long long, long long>> prime_factorize(long long N) { vector<pair<long long, long long>> res; for (long long i = 2; i * i < N; i++) { if (N % i != 0) { continue; } long long ex = 0; while (N %...
#include <iostream> // #include <bits/stdc++.h> #include <vector> using namespace std; vector<pair<long long, long long>> prime_factorize(long long N) { vector<pair<long long, long long>> res; for (long long i = 2; i * i < N; i++) { if (N % i != 0) { continue; } long long ex = 0; while (N %...
[["+", 0, 338, 8, 9, 0, 7, 15, 16, 31, 22], ["+", 0, 338, 8, 9, 0, 7, 15, 16, 17, 19], ["-", 0, 338, 8, 9, 0, 7, 15, 16, 17, 47], ["-", 0, 338, 8, 9, 0, 7, 15, 16, 12, 13]]
1
222
#include "bits/stdc++.h" using namespace std; typedef long long ll; typedef vector<ll> vl; typedef vector<vector<ll>> vvl; typedef pair<ll, ll> P; #define rep(i, n) for (ll i = 0; i < n; i++) #define REP(i, a, b) for (ll i = a; i < b; i++) #define out(x) std::cout << x << '\n' #define all(a) a.begin(), a.end() #define...
#include "bits/stdc++.h" using namespace std; typedef long long ll; typedef vector<ll> vl; typedef vector<vector<ll>> vvl; typedef pair<ll, ll> P; #define rep(i, n) for (ll i = 0; i < n; i++) #define REP(i, a, b) for (ll i = a; i < b; i++) #define out(x) std::cout << x << '\n' #define all(a) a.begin(), a.end() #define...
[["-", 39, 343, 141, 344, 3, 347, 0, 77, 39, 40], ["+", 39, 343, 141, 344, 3, 347, 0, 77, 39, 78], ["-", 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
407
import java.math.*; import java.util.*; public class Main { public static void main(final String[] args) { final Scanner sc = new Scanner(System.in); long N = sc.nextLong(); int ans = 0; long q = 2; int e = 1; long div; while (true) { div = (long)Math.pow(q, e); if (N % div =...
import java.math.*; import java.util.*; public class Main { public static void main(final String[] args) { final Scanner sc = new Scanner(System.in); long N = sc.nextLong(); int ans = 0; long q = 2; int e = 1; long div; while (true) { div = (long)Math.pow(q, e); if (N % div =...
[["+", 8, 196, 0, 57, 64, 196, 0, 116, 0, 117], ["+", 8, 196, 0, 57, 64, 196, 0, 116, 0, 35], ["-", 8, 196, 0, 52, 8, 196, 0, 57, 0, 95], ["-", 0, 52, 8, 196, 0, 57, 75, 196, 0, 45], ["-", 0, 52, 8, 196, 0, 57, 75, 196, 0, 46]]
3
165
#include <algorithm> #include <iostream> using namespace std; int aa[] = {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}; long long n; int ans; void add(int p) { int k = 0; while (n % p == 0) k++, n /= p; ans += aa[k]; } ...
#include <algorithm> #include <iostream> using namespace std; int aa[] = {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}; long long n; int ans; void add(long long p) { int k = 0; while (n % p == 0) k++, n /= p; ans += aa[...
[["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 40], ["+", 49, 53, 54, 55, 0, 56, 39, 86, 0, 96]]
1
191
#include <bits/stdc++.h> #pragma GCC optimize("Ofast") #pragma GCC target("avx2") #pragma GCC optimization("O3") #pragma GCC optimization("unroll-loops") using namespace std; #define F first #define S second #define int long long /// My functions void sread(string &s) { cin >> s; s = '_' + s; } void sprint(string ...
#include <bits/stdc++.h> #pragma GCC optimize("Ofast") #pragma GCC target("avx2") #pragma GCC optimization("O3") #pragma GCC optimization("unroll-loops") using namespace std; #define F first #define S second #define int long long /// My functions void sread(string &s) { cin >> s; s = '_' + s; } void sprint(string ...
[["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35]]
1
314
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll N; cin >> N; ll buf = N; map<ll, ll> divisor; ll div = 2; ll thr = sqrt(N); bool flg = false; if (buf == 1) { cout << 0 << endl; return 0; } else { for (div = 2; div < thr + 1; div++) { while (buf...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll N; cin >> N; ll buf = N; map<ll, ll> divisor; ll div = 2; ll thr = sqrt(N); bool flg = false; // 素因数分解 if (buf == 1) { cout << 0 << endl; return 0; } else { for (div = 2; div < thr + 1; div++) { ...
[["-", 0, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["-", 0, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["-", 0, 9, 0, 57, 15, 339, 51, 16, 12, 147], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 17, 79], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 18], ["+...
1
185
#include <bits/stdc++.h> using namespace std; int main() { int64_t N; cin >> N; vector<pair<int64_t, int>> table; int y = 0; while (N % 2 == 0) { N /= 2; y++; if (N % 2 != 0) { table.emplace_back(2, y); } } int64_t i = 3; while (i * i < N) { int x = 0; while (N % i == 0)...
#include <bits/stdc++.h> using namespace std; int main() { int64_t N; cin >> N; vector<pair<int64_t, int>> table; int y = 0; while (N % 2 == 0) { N /= 2; y++; if (N % 2 != 0) { table.emplace_back(2, y); } } int64_t i = 3; while (i * i < N) { int x = 0; while (N % i == 0)...
[["-", 0, 30, 0, 14, 8, 9, 0, 37, 0, 38], ["-", 0, 30, 0, 14, 8, 9, 0, 37, 0, 13], ["-", 0, 30, 0, 14, 8, 9, 0, 37, 0, 35]]
1
219
#include <bits/stdc++.h> using ll = long long; using namespace std; int main() { ll n; cin >> n; ll num = n; vector<pair<ll, int>> P; for (ll i = 2; i * i <= n; i++) { int x = 0; while (num % i == 0) { num /= i; x++; } if (x >= 1) P.emplace_back(i, x); } if (num != 1) ...
#include <bits/stdc++.h> using ll = long long; using namespace std; int main() { ll n; cin >> n; ll num = n; vector<pair<ll, int>> P; for (ll i = 2; i * i <= n; i++) { int x = 0; while (num % i == 0) { num /= i; x++; } if (x >= 1) P.emplace_back(i, x); } if (num != 1) ...
[["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 47], ["-", 8, 9, 0, 52, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 12, 22]]
1
165
#include <bits/stdc++.h> using namespace std; int main() { int64_t n; cin >> n; int total = 0; //zの合計 int64_t i = 2; while (n > 1) { if (i > 10000) { total++; break; } int count = 1; //各素因数におけるeのパターン数 for (int j = 1; n % i == 0; j++) { if (j == count * (count + 1) / 2) { ...
#include <bits/stdc++.h> using namespace std; int main() { int64_t n; cin >> n; int total = 0; //zの合計 int64_t i = 2; while (n > 1) { if (i > 1000000) { total++; break; } int count = 1; //各素因数におけるeのパターン数 for (int j = 1; n % i == 0; j++) { if (j == count * (count + 1) / 2) { ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
121
N = int(input()) ans = 0 temp = N fact = [] if N == 1: print(0) exit() for i in range(2, int(N ** 0.5 + 2)): if temp % i == 0: n = 0 while temp % i == 0: temp //= i n += 1 fact.append(n) if temp != 1: fact.append(1) print(fact) ans = 0 for f in fact: ...
N = int(input()) ans = 0 temp = N fact = [] if N == 1: print(0) exit() for i in range(2, int(N ** 0.5 + 2)): if temp % i == 0: n = 0 while temp % i == 0: temp //= i n += 1 fact.append(n) if temp != 1: fact.append(1) ans = 0 for f in fact: n = f ...
[["-", 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
132
n = int(input()) """nを素因数分解""" """2以上の整数n => [[素因数, 指数], ...]の2次元リスト""" 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]) ...
n = int(input()) """nを素因数分解""" """2以上の整数n => [[素因数, 指数], ...]の2次元リスト""" 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]) ...
[["-", 0, 57, 64, 196, 0, 1, 0, 677, 12, 612], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 12, 22]]
5
184
#include <bits/stdc++.h> #define rep(i, a, n) for (int i = a; i < n; i++) using namespace std; using ll = long long; using P = pair<int, int>; int main() { ll n; cin >> n; vector<pair<ll, int>> a; for (int i = 2; i * i <= n; i++) { int x = 0; while (n % i == 0) { n /= i; x++; } a.e...
#include <bits/stdc++.h> #define rep(i, a, n) for (int i = a; i < n; i++) using namespace std; using ll = long long; using P = pair<int, int>; int main() { ll n; cin >> n; vector<pair<ll, int>> a; for (ll i = 2; i * i <= n; i++) { int x = 0; while (n % i == 0) { n /= i; x++; } a.em...
[["-", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 7, 10, 43, 39, 78]]
1
172
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 n = int(input()) c = coll...
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 n = int(input()) c = coll...
[["+", 8, 196, 0, 52, 8, 196, 0, 57, 0, 121], ["+", 0, 52, 8, 196, 0, 57, 15, 666, 0, 22], ["+", 0, 52, 8, 196, 0, 57, 15, 666, 667, 18], ["+", 8, 196, 0, 52, 8, 196, 0, 57, 0, 102], ["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
133
#include <cmath> #include <cstdio> #include <vector> using namespace std; #define INF 1000005 long long N; bool isPrime[INF]; vector<int> primes; int ans; int main() { scanf("%lld", &N); for (int i = 2; i <= INF; i++) isPrime[i] = true; for (long long i = 2; i <= INF; i++) { if (isPrime[i]) { fo...
#include <cmath> #include <cstdio> #include <vector> using namespace std; #define INF 1000005 long long N; bool isPrime[INF]; vector<int> primes; int ans; int main() { scanf("%lld", &N); for (int i = 2; i <= INF; i++) isPrime[i] = true; for (long long i = 2; i <= INF; i++) { if (isPrime[i]) { fo...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 79], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22]]
1
219
# 素因数分解 # O(N**0.5) def p_bunkai(N): ret = [] for i in range(2, int(N ** 0.5) + 1): if N % i == 0: count = 0 while N % i == 0: N //= i count += 1 ret.append((i, count)) if N != 1: ret.append((N, 1)) return ret N = int(i...
# 素因数分解 # O(N**0.5) def p_bunkai(N): ret = [] for i in range(2, int(N ** 0.5) + 1): if N % i == 0: count = 0 while N % i == 0: N //= i count += 1 ret.append((i, count)) if N != 1: ret.append((N, 1)) return ret N = int(i...
[["-", 0, 57, 64, 196, 0, 1, 0, 677, 12, 612], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 12, 22]]
5
127
# import sys # import math #sqrt,gcd,pi # import decimal # import queue # queue # import bisect # import heapq # priolity-queue # import time # from itertools import product,permutations,\ # combinations,combinations_with_replacement # 重複あり順列、順列、組み合わせ、重複あり組み合わせ # import collections # deque # from operator import it...
# import sys # import math #sqrt,gcd,pi # import decimal # import queue # queue # import bisect # import heapq # priolity-queue # import time # from itertools import product,permutations,\ # combinations,combinations_with_replacement # 重複あり順列、順列、組み合わせ、重複あり組み合わせ # import collections # deque # from operator import it...
[["-", 0, 14, 8, 196, 0, 57, 15, 681, 0, 372], ["-", 0, 14, 8, 196, 0, 57, 15, 681, 28, 22], ["+", 0, 14, 8, 196, 0, 57, 15, 666, 0, 22], ["+", 0, 14, 8, 196, 0, 57, 15, 666, 667, 79], ["+", 0, 14, 8, 196, 0, 57, 15, 666, 0, 612]]
5
211
#include <bits/stdc++.h> using namespace std; typedef long long ll; using P = pair<int, int>; /* ちゃんと考えてわかって実装 */ int main(void) { ll n; cin >> n; ll ans = 0; for (ll i = 2; i * i <= n; i++) { if (n % i != 0) continue; ll num = 0; while (n % i == 0) { num++; n /= i; } for ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; using P = pair<int, int>; /* ちゃんと考えてわかって実装 */ int main(void) { ll n; cin >> n; ll ans = 0; // 中で素因数分解を使う。 // for ll にしないとTLEになった。 for (ll i = 2; i * i <= n; i++) { if (n % i != 0) continue; ll num = 0; while (n % i == 0) ...
[["-", 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]]
1
150
#include <bits/stdc++.h> using namespace std; int main() { long long int n; cin >> n; long long int k = n; long long int ans = 0; cout << "w"; for (int i = 2; i <= 1000010; i++) { int curr = 0; while (n % i == 0) { curr++; n /= i; } for (int j = 1; j < 10000; j++) { if (cu...
#include <bits/stdc++.h> using namespace std; int main() { long long int n; cin >> n; long long int k = n; long long int ans = 0; for (int i = 2; i <= 1000010; i++) { int curr = 0; while (n % i == 0) { curr++; n /= i; } for (int j = 1; j < 10000; j++) { if (curr < j) ...
[["-", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 17, 151], ["-", 8, 9, 0, 1, 0, 16, 12, 5, 0, 62], ["-", 8, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
128
def p_facto(n): ret = [] nc = n for i in range(2, nc): if i*i > nc: break if n % i == 0: ex = 0 while n % i == 0: ex += 1 n //= i ret.append([i, ex]) if n != 1: ret.append([n, 1]) return ret def...
def p_facto(n): ret = [] nc = n for i in range(2, nc): if i*i > nc: break if n % i == 0: ex = 0 while n % i == 0: ex += 1 n //= i ret.append([i, ex]) if n != 1: ret.append([n, 1]) return ret def...
[["-", 8, 196, 0, 7, 8, 196, 0, 52, 15, 22], ["+", 8, 196, 0, 7, 8, 196, 0, 52, 15, 146]]
5
156
import math def get_prime(n): if n <= 1: return [] prime = [2] if n > 2: limit = int(math.sqrt(n)) odd = [i for i in range(3, n + 1, 2)] while limit >= odd[0]: prime.append(odd[0]) odd = [j for j in odd if j % odd[0] != 0] prime += odd retu...
import math def get_prime(n): if n <= 1: return [] prime = [2] if n > 2: limit = int(math.sqrt(n)) odd = [i for i in range(3, n + 1, 2)] while limit >= odd[0]: prime.append(odd[0]) odd = [j for j in odd if j % odd[0] != 0] prime += odd retu...
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 18], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 17, 109], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 60], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612]]
5
253
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, 1]) if arr=...
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, 1]) if arr...
[["-", 8, 196, 0, 57, 75, 665, 15, 666, 667, 19], ["+", 8, 196, 0, 57, 75, 665, 15, 666, 667, 18]]
5
236
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define all(v) v.begin(), v.end() vector<pair<long long, long long>> prime_factorize(long long N) { vector<pair<long long, long long>> res; for (long long a = 2; a * a <= N; a++) { // a<=N^0.5まで試す if (N % a != 0) ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define all(v) v.begin(), v.end() vector<pair<long long, long long>> prime_factorize(long long N) { vector<pair<long long, long long>> res; for (long long a = 2; a * a <= N; a++) { // a<=N^0.5まで試す if (N % a != 0) ...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13], ["-", 0, 16, 12, 16, 12, 23, 0, 16, 17, 48], ["+", 0, 16, 12, 16, 12, 23, 0, 16, 17, 72]]
1
261
from math import sqrt from bisect import bisect def main(): N = int(input()) factor = {} max_count = 1 while N > 1: for i in range(2, int(sqrt(N))+1): if N % i == 0: N = N // i if i in factor: factor[i] += 1 if...
from math import sqrt from bisect import bisect def main(): N = int(input()) factor = {} max_count = 1 while N > 1: for i in range(2, int(sqrt(N)) + 1): if N % i == 0: N = N // i if i in factor: factor[i] += 1 ...
[["-", 64, 196, 0, 57, 15, 666, 0, 206, 206, 22], ["+", 64, 196, 0, 57, 15, 666, 0, 206, 206, 22], ["-", 64, 196, 0, 1, 0, 662, 12, 206, 206, 22], ["+", 64, 196, 0, 1, 0, 662, 12, 206, 206, 22]]
5
195
from math import sqrt N = int(input()) rn = int(sqrt(N)) sieve = [0] * (rn + 1) sieve[0] = -1 sieve[1] = -1 t = [0] * (rn + 1) for i in range(2, rn + 1): if sieve[i] != 0: continue sieve[i] = i j = i while j < rn + 1: t[j] = 1 j *= i for j in range(i * i, rn + 1, i): ...
from math import sqrt N = int(input()) rn = int(sqrt(N)) sieve = [0] * (rn + 1) sieve[0] = -1 sieve[1] = -1 t = [0] * (rn + 1) for i in range(2, rn + 1): if sieve[i] != 0: continue sieve[i] = i j = i while j < rn + 1: t[j] = 1 j *= i for j in range(i * i, rn + 1, i): ...
[["-", 0, 656, 0, 57, 15, 679, 12, 666, 0, 22], ["+", 0, 656, 0, 57, 15, 679, 12, 666, 0, 22]]
5
193
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; #define N 1000000 int prime[N + 10], cnt = 0; bool num[N + 10] = {1, 1}; int ans = 0; void pre() { for (int i = 2; i <= N; i++) { if (!num[i]) prime[++cnt] = i; for (int j = 1; (j <= cnt) && (i * prime[j]...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; #define N 1000000 int prime[N + 10], cnt = 0; bool num[N + 10] = {1, 1}; int ans = 0; void pre() { for (int i = 2; i <= N; i++) { if (!num[i]) prime[++cnt] = i; for (int j = 1; (j <= cnt) && (i * prime[j]...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
321
n = int(input()) if n == 1: print(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.app...
n = int(input()) if n == 1: print(0) else: 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.app...
[["+", 36, 36, 0, 656, 0, 57, 75, 76, 0, 95], ["+", 36, 36, 0, 656, 0, 57, 75, 76, 0, 102]]
5
171
#include <bits/stdc++.h> using namespace std; #define int long long #define vi vector<int> #define ff first #define ss second #define file_se_input \ freopen("input.txt", "r", stdin); \ freopen("output.txt", "w", std...
#include <bits/stdc++.h> using namespace std; #define int long long #define vi vector<int> #define ff first #define ss second #define file_se_input \ freopen("input.txt", "r", stdin); \ freopen("output.txt", "w", std...
[["-", 0, 7, 15, 16, 12, 2, 3, 4, 0, 22], ["+", 0, 7, 15, 16, 12, 2, 3, 4, 0, 22], ["-", 0, 57, 15, 339, 51, 2, 3, 4, 0, 22], ["+", 0, 57, 15, 339, 51, 2, 3, 4, 0, 22]]
1
565
n = int(input()) ans = 0 i = 2 while n>1 and i*i<=n: if n % i == 0: c = 0 while n % i == 0: n = n / i c = c + 1 Y=1 U=2 while c>=Y: ans=ans+1 Y=Y+U U=U+1 i = i + 1 if n > 1: ans = 1 print(ans)
n = int(input()) ans = 0 i = 2 while n>1 and i*i<=n: if n % i == 0: c = 0 while n % i == 0: n = n / i c = c + 1 Y=1 U=2 while c>=Y: ans=ans+1 Y=Y+U U=U+1 i += 1 if n > 1: ans = 1 + ans print(ans)
[["-", 0, 52, 8, 196, 0, 1, 0, 662, 0, 32], ["-", 8, 196, 0, 1, 0, 662, 12, 657, 31, 22], ["-", 8, 196, 0, 1, 0, 662, 12, 657, 17, 72], ["+", 0, 52, 8, 196, 0, 1, 0, 677, 17, 107], ["+", 64, 196, 0, 1, 0, 662, 12, 657, 17, 72], ["+", 64, 196, 0, 1, 0, 662, 12, 657, 12, 22]]
5
95