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
import java.io.*; import java.util.*; import java.math.*; public class Main { static long mod = 1000000007l; static int max = Integer.MAX_VALUE, min = Integer.MIN_VALUE; static long maxl = Long.MAX_VALUE, minl = Long.MIN_VALUE; static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)...
import java.io.*; import java.util.*; import java.math.*; public class Main { static long mod = 1000000007l; static int max = Integer.MAX_VALUE, min = Integer.MIN_VALUE; static long maxl = Long.MAX_VALUE, minl = Long.MIN_VALUE; static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)...
[["-", 0, 57, 64, 1, 0, 492, 3, 4, 0, 22], ["+", 0, 57, 64, 1, 0, 492, 3, 4, 0, 22]]
3
2,997
import bisect ans = 0 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(...
import bisect ans = 0 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(...
[["-", 0, 1, 0, 662, 12, 652, 63, 319, 319, 22], ["+", 0, 1, 0, 662, 12, 652, 63, 319, 319, 22], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 60], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612]]
5
216
#include <bits/stdc++.h> using namespace std; #define sws \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0) #define INFINITO...
#include <bits/stdc++.h> using namespace std; #define sws \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0) #define INFINITO...
[["-", 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, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 31, 22], ["+",...
1
318
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <queue> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using ull = unsigned long long; using p = pair<int, int>; map<int, int> primes; int getDigit(ll num) {...
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <queue> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using ull = unsigned long long; using p = pair<int, int>; map<int, int> primes; int getDigit(ll num) {...
[["-", 0, 338, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 338, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 19]]
1
241
#include <bits/stdc++.h> using namespace std; using ll = long long; // int gcd(int a,int b) // { // if(b==0) // return a; // return gcd(b,a%b); // } int power(ll x, ll y) { int res = 1; x = x; while (y > 0) { if (y & 1) res = (res * x); y = y >> 1; x = (x * x); } return res; } int main...
#include <bits/stdc++.h> using namespace std; using ll = long long; // int gcd(int a,int b) // { // if(b==0) // return a; // return gcd(b,a%b); // } ll power(ll x, ll y) { ll res = 1; x = x; while (y > 0) { if (y & 1) res = (res * x); y = y >> 1; x = (x * x); } return res; } int main()...
[["-", 36, 36, 36, 36, 0, 30, 0, 14, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 14, 39, 78], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 17, 107], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 57, 64, 9, 0, 1, 0, 27, 17, 29]]
1
346
N = 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]) ...
N = 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]) ...
[["+", 8, 196, 0, 57, 15, 666, 0, 657, 31, 612], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 17, 48], ["+", 64, 196, 0, 1, 0, 677, 12, 657, 17, 33], ["+", 64, 196, 0, 1, 0, 677, 12, 657, 12, 612]]
5
184
N = int(input()) def prime_factorize(n): ans = 0 while n % 2 == 0: i = 1 j = 0 while n % 2 == 0: n = n//2 j += 1 if i <= j: ans += 1 i += 1 j = 0 f = 3 while f * f <= N: i = 1 j = ...
N = int(input()) def prime_factorize(n): ans = 0 while n % 2 == 0: i = 1 j = 0 while n % 2 == 0: n = n//2 j += 1 if i <= j: ans += 1 i += 1 j = 0 f = 3 while f * f <= n: i = 1 j = ...
[["-", 0, 14, 8, 196, 0, 52, 15, 666, 0, 22], ["+", 0, 14, 8, 196, 0, 52, 15, 666, 0, 22], ["-", 8, 196, 0, 57, 15, 666, 0, 657, 31, 22], ["-", 8, 196, 0, 57, 15, 666, 0, 657, 17, 48], ["-", 0, 14, 8, 196, 0, 57, 15, 666, 667, 20], ["-", 0, 14, 8, 196, 0, 57, 15, 666, 0, 22], ["+", 0, 14, 8, 196, 0, 57, 15, 666, 667, 7...
5
124
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++) #define rep1(i, n) for (int i = 1, i##_len = (int)(n); i <= i##_len; i++) #define rrep(i, n) for (int i = (int)(n)-1; 0 <= i; i--) #define rrep1(i, n) for (int i = (int)(n); 1 <= i; i--) #define each(it, c) ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++) #define rep1(i, n) for (int i = 1, i##_len = (int)(n); i <= i##_len; i++) #define rrep(i, n) for (int i = (int)(n)-1; 0 <= i; i--) #define rrep1(i, n) for (int i = (int)(n); 1 <= i; i--) #define each(it, c) ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["-", 15, 339, 51, 16, 12, 2, 63, 118, 28, 22], ["-", 15, 339, 51, 16, 12, 2, 63, 118, 17, 131], ["-", 15, 339, 51, 16, 12, 2, 63, 118, 119, 120], ["-", 15, 339, 51, 16, 12, 2, 3, 4, 0, 24], ["-", 15, 339, 51, 16, 12, 2, 3, 4, 0, 25]]
1
319
// by adiforluls #pragma GCC optimize("-O2") #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 FAST ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0) #define ll long long #define ld long double #define ...
// by adiforluls #pragma GCC optimize("-O2") #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 FAST ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0) #define ll long long #define ld long double #define ...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 33], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 72], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
483
import collections n=int(input()) ans=0 d=1 m=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 a...
import collections n=int(input()) ans=0 d=1 m=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 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, 25]]
5
196
#include <bits/stdc++.h> using namespace std; template <typename T, typename U> void primeFactorization(map<T, U> &primes, T N) { T n = N; U num = 0; while (n % 2 == 0) { num++; n /= 2; } if (num != 0) { primes.emplace(2, num); } for (T i = 3; i * i <= N && i <= n; i += 2) { num = 0; ...
#include <bits/stdc++.h> using namespace std; template <typename T, typename U> void primeFactorization(map<T, U> &primes, T N) { T n = N; U num = 0; while (n % 2 == 0) { num++; n /= 2; } if (num != 0) { primes.emplace(2, num); } for (T i = 3; i * i <= N && i <= n; i += 2) { num = 0; ...
[["-", 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], ["-", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
1
257
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; using ll = long long; vector<ll> prime_factorize(ll n) { vector<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; } ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; using ll = long long; vector<ll> prime_factorize(ll n) { vector<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; } ...
[["-", 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
174
// ABC169-D #include <bits/stdc++.h> #define endl "\n" #define rep(i, n) for (int i = 0; i < int(n); i++) #define SZ(x) ((int)(x).size()) #define all(x) (x).begin(), (x).end() using namespace std; typedef long long ll; // typedef pair<int, int> pair; template <class T> ostream &operator<<(ostream &o, const vector<T> &v...
// ABC169-D #include <bits/stdc++.h> #define endl "\n" #define rep(i, n) for (int i = 0; i < int(n); i++) #define SZ(x) ((int)(x).size()) #define all(x) (x).begin(), (x).end() using namespace std; typedef long long ll; // typedef pair<int, int> pair; template <class T> ostream &operator<<(ostream &o, const vector<T> &v...
[["-", 8, 9, 0, 7, 8, 9, 0, 57, 0, 121], ["+", 8, 9, 0, 7, 8, 9, 0, 52, 0, 89], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 64, 37, 0, 16, 17, 33], ["+", 8, 9, 0, 57, 64, 37, 0, 16, 12, 13]]
1
394
import math N=int(input()) ans=0 arr=[] tmp=1 #print(int(math.sqrt(N))+5) for i in range(int(math.sqrt(N))+5): tmp=1 while N % ((i+2)**tmp) == 0: N=N / ((i+2)**tmp) #print((i+2)**tmp) ans+=1 tmp+=1 while N % (i+2) == 0: N = N // (i+2) if N > 1 : ans+1 pri...
import math N=int(input()) ans=0 arr=[] tmp=1 #print(int(math.sqrt(N))+5) for i in range(int(math.sqrt(N))+5): tmp=1 while N % ((i+2)**tmp) == 0: N=N / ((i+2)**tmp) #print((i+2)**tmp) ans+=1 tmp+=1 while N % (i+2) == 0: N = N // (i+2) if N > 1 : ans+=1 pr...
[["-", 0, 57, 64, 196, 0, 1, 0, 657, 17, 72], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 17, 107]]
5
109
#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>; vector<pair<ll, int>> prime_factor(ll n) { vector<pair<ll, int>> res; for (ll i = 2; i * i <= n; i++) { int x = 0; while (n % i == 0) { n /= i; x++; ...
#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>; vector<pair<ll, int>> prime_factor(ll n) { vector<pair<ll, int>> res; for (ll i = 2; i * i <= n; i++) { int x = 0; while (n % i == 0) { n /= i; x++; ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
224
// питер паркер эй! люблю мэри джэйн) #include <bits/stdc++.h> typedef long long int lli; typedef unsigned long long int ulli; typedef long double ld; #define rapgame \ ios_base::sync_with_stdio(0); \ cin.t...
// питер паркер эй! люблю мэри джэйн) #include <bits/stdc++.h> typedef long long int lli; typedef unsigned long long int ulli; typedef long double ld; #define rapgame \ ios_base::sync_with_stdio(0); \ cin.t...
[["-", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46]]
1
315
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define repr(i, a, b) for (int i = a; i < (b); ++i) #define reprev(i, n) for (int i = n - 1; i >= 0; --i) #define reprrev(i, a, b) for (int i = b - 1; i >= (a); --i) using namespace std; using ll = long long; using P = pair<int, int>; int main() ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define repr(i, a, b) for (int i = a; i < (b); ++i) #define reprev(i, n) for (int i = n - 1; i >= 0; --i) #define reprrev(i, a, b) for (int i = b - 1; i >= (a); --i) using namespace std; using ll = long long; using P = pair<int, int>; int main() ...
[["-", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 22]]
1
214
#include <algorithm> #include <bits/stdc++.h> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <set> #include <string> #include <utility> #include <vector> typedef long long ll; #define rep(i, n) for (ll i = 0; i < (ll)n; ++i) using namespace std; bool is_prime(int n) { for (int i = 2...
#include <algorithm> #include <bits/stdc++.h> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <set> #include <string> #include <utility> #include <vector> typedef long long ll; #define rep(i, n) for (ll i = 0; i < (ll)n; ++i) using namespace std; bool is_prime(ll n) { for (ll i = 2; ...
[["-", 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], ["-", 0, 52, 8, 9, 0, 57, 64, 9, 0, 45], ["-", 0, 52, 8, 9, 0, 57, 64, 9, 0, 46]]
1
444
# coding: utf-8 import sys import math from collections import Counter import itertools import fractions from decimal import * #import numpy as np #from functools import reduce # 入力を整数に変換して受け取る def II(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) # 入力全てを整数に変換したものの配列を受け取る ...
# coding: utf-8 import sys import math from collections import Counter import itertools import fractions from decimal import * #import numpy as np #from functools import reduce # 入力を整数に変換して受け取る def II(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) # 入力全てを整数に変換したものの配列を受け取る ...
[["-", 0, 57, 64, 196, 0, 1, 0, 677, 12, 612], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 12, 22]]
5
354
#include <iomanip> #include <iostream> #include <map> #include <math.h> #include <string> #include <vector> using namespace std; std::map<unsigned long long, unsigned long long> m; int answer = 0; void cal(unsigned long long n) { int a = 2; while (n >= a * a) { if (n % a == 0) { if (m.count(a) >= 1) { ...
#include <iomanip> #include <iostream> #include <map> #include <math.h> #include <string> #include <vector> using namespace std; std::map<unsigned long long, unsigned long long> m; int answer = 0; void cal(unsigned long long n) { unsigned long long a = 2; while (n >= a * a) { if (n % a == 0) { if (m.cou...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 87], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]]
1
270
#include <algorithm> #include <cmath> #include <iostream> #include <string> #include <vector> int main() { uint64_t N = 0; std::cin >> N; uint64_t remain = N; uint32_t count = 0, e = 0; while (remain % 2 == 0) { remain /= 2; e++; } for (size_t i = 1; e >= i; e -= i, i++, count++) { } for (s...
#include <algorithm> #include <cmath> #include <iostream> #include <string> #include <vector> int main() { uint64_t N = 0; std::cin >> N; uint64_t remain = N; uint32_t count = 0, e = 0; while (remain % 2 == 0) { remain /= 2; e++; } for (size_t i = 1; e >= i; e -= i, i++, count++) { } for (s...
[["+", 0, 14, 8, 9, 0, 7, 10, 43, 0, 21], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 49, 22], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 0, 32], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
166
n = int(input()) t = [] for i in range(2,int(-(-n**0.5//1))+1): if(n%i == 0): cmp = 0 while(n%i == 0): cmp += 1 n //= i t.append([i,cmp]) if(n == 1): break if(n != 1): z = 1 z = -len(t) for i in range(len(t)): j = 1 while(t[i][1] >= 0): ...
n = int(input()) t = [] for i in range(2,int(-(-n**0.5//1))+1): if(n%i == 0): cmp = 0 while(n%i == 0): cmp += 1 n //= i t.append([i,cmp]) if(n == 1): break if(n != 1): z = 1 else: z = 0 z -= len(t) for i in range(len(t)): j = 1 while(t[i][1...
[["+", 36, 36, 0, 656, 0, 57, 75, 76, 0, 95], ["+", 36, 36, 0, 656, 0, 57, 75, 76, 0, 102], ["-", 0, 656, 0, 1, 0, 662, 12, 664, 17, 33], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 677, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 677, 17, 110]]
5
143
import math def factorization(n): r = [] temp = n for i in range(2,int(math.sqrt(n))+1): m = 0 while temp % i == 0: temp /= i m += 1 if m > 0: r.append((i,m)) if temp != 1: r.append((temp,1)) if len(r) == 0: r.append((n,1))...
import math def factorization(n): r = [] temp = n for i in range(2,int(math.sqrt(n))+1): m = 0 while temp % i == 0: temp /= i m += 1 if m > 0: r.append((i,m)) if temp != 1: r.append((temp,1)) if len(r) == 0: r.append((n,1))...
[["-", 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
170
#include <bits/stdc++.h> using namespace std; using ll = long long; using Graph = vector<vector<int>>; const ll LINF = 1e18; const int INF = 1e9; const ll MOD = 1000000007; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline bool...
#include <bits/stdc++.h> using namespace std; using ll = long long; using Graph = vector<vector<int>>; const ll LINF = 1e18; const int INF = 1e9; const ll MOD = 1000000007; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline bool...
[["-", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 7, 10, 43, 39, 78]]
1
289
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; int main() { int n; cin >> n; map<ll, int> mp; while (1) { bool ok = false; for (int i = 2; i <= sqrt(n); ++i) { if (n % i == 0) { ok = true; mp[i]++; n /= i...
#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; map<ll, int> mp; while (1) { bool ok = false; for (int i = 2; i <= sqrt(n); ++i) { if (n % i == 0) { ok = true; mp[i]++; n /= i;...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
169
#include <bits/stdc++.h> using namespace std; #define _GLIBCXX_DEBUG int64_t MOD = 1000000007; int main() { int64_t N, ans = 0; cin >> N; int64_t n = N; if (N == 1) cout << 0; else { for (int64_t i = 2; i * i <= n; i++) { if (N % i == 0) { int temp = 0; while (N % i == 0) { ...
#include <bits/stdc++.h> using namespace std; #define _GLIBCXX_DEBUG int64_t MOD = 1000000007; int main() { int64_t N, ans = 0; cin >> N; int64_t n = N; if (N == 1) cout << 0; else { for (int64_t i = 2; i * i <= n; i++) { if (N % i == 0) { int temp = 0; while (N % i == 0) { ...
[["-", 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, 13], ["+", 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]]
1
134
#include <bits/stdc++.h> using namespace std; typedef long long ll; const static ll INF = 1e15; // __uint128_t //素数判定 bool isPrime(ll x) { ll i; if (x < 2) return 0; else if (x == 2) return 1; if (x % 2 == 0) return 0; for (i = 3; i * i <= x; i += 2) if (x % i == 0) return 0; return 1;...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const static ll INF = 1e15; // __uint128_t //素数判定 bool isPrime(ll x) { ll i; if (x < 2) return 0; else if (x == 2) return 1; if (x % 2 == 0) return 0; for (i = 3; i * i <= x; i += 2) if (x % i == 0) return 0; return 1;...
[["+", 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, 146], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
1
333
require "prime" N = gets.to_i ans = 0 Prime.prime_division(N).each do |_, exponent| i = 0 while exponent >= i exponent -= 1 ans += 1 i += 1 end end puts ans
require "prime" N = gets.to_i ans = 0 Prime.prime_division(N).each do |_, exponent| i = 1 while exponent >= i exponent -= i ans += 1 i += 1 end end puts ans
[["-", 0, 652, 196, 737, 8, 736, 0, 662, 12, 612], ["+", 0, 652, 196, 737, 8, 736, 0, 662, 12, 612], ["-", 8, 736, 0, 89, 8, 170, 0, 755, 12, 612], ["+", 8, 736, 0, 89, 8, 170, 0, 755, 12, 22]]
4
46
N=int(input()) C=[0]*(10**6+1) n=[i for i in range(50)] n[0]=1 for i in range(40): n[i+1]+=(n[i]+1) for i in range(2,int(N**0.5)+1): if N%i==0: while N%i==0: C[i]+=1 N//=i res=0 for c in C: if c>0: for i in range(50): if c<n[i]: res+=i ...
N=int(input()) C=[0]*(10**6+1) n=[i for i in range(50)] n[0]=1 for i in range(40): n[i+1]+=(n[i]+1) for i in range(2,int(N**0.5)+1): if N%i==0: while N%i==0: C[i]+=1 N//=i res=0 for c in C: if c>0: for i in range(50): if c<n[i]: res+=i ...
[["+", 0, 652, 3, 4, 0, 41, 0, 657, 31, 22], ["+", 0, 652, 3, 4, 0, 41, 0, 657, 17, 72]]
5
145
N=int(input()) C=[] n=[i for i in range(50)] n[0]=1 for i in range(49): n[i+1]+=(n[i]+1) for i in range(2,int(N**0.5)+1): if N%i==0: while N%i==0: C.append(i) N//=i D=set(C) E=[] for d in D: E.append(C.count(d)) res=0 for e in E: for i in range(50): if n[i]<=e...
N=int(input()) C=[] n=[i for i in range(50)] n[0]=1 for i in range(49): n[i+1]+=(n[i]+1) for i in range(2,int(N**0.5)+1): if N%i==0: while N%i==0: C.append(i) N//=i D=set(C) E=[] for d in D: E.append(C.count(d)) res=0 for e in E: for i in range(50): if n[i]<=e...
[["+", 0, 652, 3, 4, 0, 41, 0, 657, 31, 22], ["+", 0, 652, 3, 4, 0, 41, 0, 657, 17, 72]]
5
166
#include <bits/stdc++.h> using namespace std; #define int long long int int32_t main() { int n, i, k, j, cnt, ans; cin >> n; vector<int> v; int p[1000001] = {0}; for (i = 2; i <= 1000000; i++) { cnt = 0; if (p[i]) continue; for (j = i; j <= 1000000; j += i) { p[j] = 1; } while ...
#include <bits/stdc++.h> using namespace std; #define int long long int int32_t main() { int n, i, k, j, cnt, ans = 0; cin >> n; vector<int> v; int p[1000001] = {0}; for (i = 2; i <= 1000000; i++) { cnt = 0; if (p[i]) continue; for (j = i; j <= 1000000; j += i) { p[j] = 1; } wh...
[["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22]]
1
254
import java.lang.*; import java.util.*; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int cnt = 0; long N = scan.nextLong(); if (N == 1) { System.out.println(0); System.exit(0); } ArrayList<Integer> a = new ArrayList<>(); ...
import java.lang.*; import java.util.*; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int cnt = 0; long N = scan.nextLong(); if (N == 1) { System.out.println(0); System.exit(0); } ArrayList<Integer> a = new ArrayList<>(); ...
[["-", 8, 196, 0, 57, 15, 15, 0, 16, 31, 22], ["-", 8, 196, 0, 57, 15, 15, 0, 16, 17, 60], ["-", 8, 196, 0, 57, 15, 15, 0, 16, 12, 499], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 31, 22], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 17, 47], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 12, 499], ["+", 0, 1, 0, 492, 3, 4, 0, 16, 31, 22], ["+",...
3
349
#include <bits/stdc++.h> using namespace std; #define MOD 1000000007 #define rep(i, n) for (int i = 0; i < n; ++i) typedef long long ll; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if (a < b) { ...
#include <bits/stdc++.h> using namespace std; #define MOD 1000000007 #define rep(i, n) for (int i = 0; i < n; ++i) typedef long long ll; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if (a < b) { ...
[["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 79], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
328
class Sieve: def __init__(self, n=1): self.f = [0 for _ in range(n+1)] self.f[0] = -1 self.f[1] = -1 self.primes = [] for i in range(2, n+1): if self.f[i]: continue self.primes.append(i) self.f[i] = i for j...
class Sieve: def __init__(self, n=1): self.f = [0 for _ in range(n+1)] self.f[0] = -1 self.f[1] = -1 self.primes = [] for i in range(2, n+1): if self.f[i]: continue self.primes.append(i) self.f[i] = i for j...
[["-", 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]]
5
393
#include <bits/stdc++.h> using namespace std; typedef long long int ll; void decompositPrime(ll n, ll &c) { // 割る数の初期値 ll a = 2; ll A = 0; ll nex = 1; ll now = 1; ll n_pre = n; while (n_pre >= a * a) { if (n % a == 0) { A++; if (A == nex) { now++; nex = nex + now; ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; void decompositPrime(ll n, ll &c) { // 割る数の初期値 ll a = 2; ll A = 0; ll nex = 1; ll now = 1; ll n_pre = n; while (n_pre >= a * a) { if (n % a == 0) { A++; if (A == nex) { now++; nex = nex + now; ...
[["-", 36, 36, 0, 30, 0, 134, 39, 86, 39, 40], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
160
import math from sys import exit n=int(input()) primes = {} i = 2 ans = 0 square = math.floor(math.sqrt(n)) if n == 1: print(0) exit() # while True: # if n == 1 or i > square: # break # if n % i == 0: # if i not in primes.keys(): # primes[i] = 1 # else: # ...
import math from sys import exit n=int(input()) primes = {} i = 2 ans = 0 square = math.floor(math.sqrt(n)) if n == 1: print(0) exit() # while True: # if n == 1 or i > square: # break # if n % i == 0: # if i not in primes.keys(): # primes[i] = 1 # else: # ...
[["-", 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
237
# -*- coding: utf-8 -*- import collections # factrize def factorize(target_number): factor_list = [] while target_number % 2 == 0: factor_list.append(2) n //= 2 factor = 3 while factor * factor <= target_number: while target_number % factor == 0: target_number //= fac...
# -*- coding: utf-8 -*- import collections # factrize def factorize(target_number): factor_list = [] while target_number % 2 == 0: factor_list.append(2) target_number //= 2 factor = 3 while factor * factor <= target_number: while target_number % factor == 0: target_nu...
[["-", 0, 52, 8, 196, 0, 1, 0, 677, 31, 22], ["+", 0, 52, 8, 196, 0, 1, 0, 677, 31, 22]]
5
139
# -*- coding: utf-8 -*- import collections # factrize def factorize(target_number): factor = 2 factor_list = [] while factor * factor <= target_number: while target_number % factor == 0: target_number //= factor factor_list.append(factor) factor = factor + 2 if ta...
# -*- coding: utf-8 -*- import collections # factrize def factorize(target_number): factor = 2 factor_list = [] while factor * factor <= target_number: while target_number % factor == 0: target_number //= factor factor_list.append(factor) factor += 1 if target_num...
[["-", 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], ["+", 0, 52, 8, 196, 0, 1, 0, 677, 17, 107], ["+", 0, 52, 8, 196, 0, 1, 0, 677, 12, 612]]
5
125
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define Rep(i, s, n) for (int i = s; i < n; i++) #define per(i, s, n) for (int i = n - 1; i >= s; i--) #define fi first #define se second #define all(c) c.begin(), c.end() typedef long long int ll; typedef pair<int, int> ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define Rep(i, s, n) for (int i = s; i < n; i++) #define per(i, s, n) for (int i = n - 1; i >= s; i--) #define fi first #define se second #define all(c) c.begin(), c.end() typedef long long int ll; typedef pair<int, int> ...
[["-", 0, 7, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 7, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 19]]
1
307
import numpy as np #from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson #from scipy.sparse import csr_matrix import itertools import copy n = int(input()) def seachPrimeNum(N): max = int(np.sqrt(N)) seachList = [i for i in range(2,N+1)] primeNum = [] while s...
import numpy as np #from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson #from scipy.sparse import csr_matrix import itertools import copy n = int(input()) def seachPrimeNum(N): max = int(np.sqrt(N)) seachList = [i for i in range(2,N+1)] primeNum = [] while s...
[["-", 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
450
import collections as cl #素因数分解 N = int(input()) res = 0 def prime(N): l = [] p = 2 while N % 2 == 0: l.append(p) N //= p p += 1 while p * p <= N: if N % p == 0: l.append(p) N //= p else: p += 2 if N != 1: l.append(N) ...
import collections as cl #素因数分解 N = int(input()) res = 0 def prime(N): l = [] p = 2 while N % 2 == 0: l.append(p) N //= p p += 1 while p * p <= N: if N % p == 0: l.append(p) N //= p else: p += 2 if N != 1: l.append(N) ...
[["-", 0, 52, 8, 196, 0, 1, 0, 677, 12, 612], ["+", 0, 52, 8, 196, 0, 1, 0, 677, 12, 22]]
5
132
#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, 43, 49, 50, 51, 16, 12, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13]]
1
348
from collections import Counter N = 2 def prime(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 = Counter(prim...
from collections import Counter N = int(input()) def prime(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 = C...
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 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], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]]
5
140
#include <iostream> #include <vector> using namespace std; // O(√n)で nを素因数分解して記録 typedef pair<long long int, int> P; vector<P> PF(long long int n) { vector<P> vec; int np = n, count; for (long long int i = 2; i <= np / i; i++) { if (n % i != 0) continue; count = 0; while (n % i == 0) { n /...
#include <iostream> #include <vector> using namespace std; typedef pair<long long int, int> P; vector<P> PF(long long int n) { vector<P> vec; long long int np = n, count; for (long long int i = 2; i <= np / i; i++) { if (n % i != 0) continue; count = 0; while (n % i == 0) { n /= i; c...
[["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]]
1
207
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll N = 1e6 + 5; const ll MOD = 1e9 + 7; #define all(x) x.begin(), x.end() #define pii pair<int, int> #define pis pair<ll, string> #define F first #define S second #define LCM(a, b) ((a * b) / __gcd(a, b)) #define inf 1e15 #define test ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll N = 1e6 + 5; const ll MOD = 1e9 + 7; #define all(x) x.begin(), x.end() #define pii pair<int, int> #define pis pair<ll, string> #define F first #define S second #define LCM(a, b) ((a * b) / __gcd(a, b)) #define inf 1e15 #define test ...
[["+", 8, 9, 0, 1, 0, 11, 12, 23, 0, 24], ["+", 0, 1, 0, 11, 12, 23, 0, 16, 17, 72], ["+", 0, 1, 0, 11, 12, 23, 0, 16, 12, 13], ["+", 8, 9, 0, 1, 0, 11, 12, 23, 0, 25]]
1
542
# 素因数分解 # http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=NTL_1_A&lang=ja import math from collections import Counter n = int(input()) origin = n ans = [] i = 2 while i <= math.sqrt(n): if n % i == 0: n //= i ans.append(str(i)) else: i += 1 if n != 1: ans.append(str(n)) #...
# 素因数分解 # http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=NTL_1_A&lang=ja import math from collections import Counter n = int(input()) origin = n ans = [] i = 2 while i <= math.sqrt(n): if n % i == 0: n //= i ans.append(str(i)) else: i += 1 if n != 1: ans.append(str(n)) #...
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
134
import sys import numpy as np read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N = int(read()) U = 10**6 is_prime = np.zeros(U, np.bool_) is_prime[2] = 1 is_prime[3::2] = 1 for p in range(3, U, 2): if p * p >= U: break if is_prime[p]: is...
import sys import numpy as np read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N = int(read()) U = 10**6 is_prime = np.zeros(U, np.bool_) is_prime[2] = 1 is_prime[3::2] = 1 for p in range(3, U, 2): if p * p >= U: break if is_prime[p]: is...
[["+", 0, 662, 31, 206, 206, 663, 0, 657, 17, 72], ["+", 0, 662, 31, 206, 206, 663, 0, 657, 12, 22]]
5
244
#4問目 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 def has_duplicates2(seq...
#4問目 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 def has_duplicates2(seq...
[["-", 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
263
from functools import lru_cache def PrimeFactorization(m): pf = {} i = 2 while i ** 2 < n: while n % i == 0: pf[i] = pf.get(i, 0) + 1 n //= i i += 1 if n > 1: pf[n] = 1 return pf @lru_cache(maxsize=100000) def f(x): return int((-1 + (1 + 8 * x)...
from functools import lru_cache def PrimeFactorization(n): pf = {} i = 2 while i ** 2 < n: while n % i == 0: pf[i] = pf.get(i, 0) + 1 n //= i i += 1 if n > 1: pf[n] = 1 return pf @lru_cache(maxsize=100000) def f(x): return int((-1 + (1 + 8 * x)...
[["-", 36, 36, 0, 656, 0, 14, 54, 54, 0, 22], ["+", 36, 36, 0, 656, 0, 14, 54, 54, 0, 22]]
5
151
#define __mode_debug__ /* ξ ll _ll_ / ∞ \ │* A *│ │* C *│ │* 祈 *│ │* 願 *│ │* *│  ̄ ̄ ̄ ̄ ̄ */ // C++14 (GCC 5.4.1) #include <bits/stdc++.h> using namespace std; #ifdef __mode_debug__ #define DBG #else #define DBG if (false) #endif #define LLINF (1LL << 60) using ll = long long; #define mod 100...
#define __mode_debug__ /* ξ ll _ll_ / ∞ \ │* A *│ │* C *│ │* 祈 *│ │* 願 *│ │* *│  ̄ ̄ ̄ ̄ ̄ */ // C++14 (GCC 5.4.1) #include <bits/stdc++.h> using namespace std; #ifdef __mode_debug__ #define DBG #else #define DBG if (false) #endif #define LLINF (1LL << 60) using ll = long long; #define mod 100...
[["-", 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
1,165
import sys #2以上の整数nに対して素因数分解 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.ap...
import sys #2以上の整数nに対して素因数分解 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.ap...
[["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612]]
5
189
#include <cmath> #include <iostream> #include <map> #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 a = 2; a * a <= N; ++a) { if (N % a != 0) continue; long long ex = 0; // 指数 // 割れる限り...
#include <cmath> #include <iostream> #include <map> #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 a = 2; a * a <= N; ++a) { if (N % a != 0) continue; long long ex = 0; // 指数 // 割れる限り...
[["-", 12, 2, 3, 4, 0, 16, 31, 16, 12, 13], ["+", 12, 2, 3, 4, 0, 16, 31, 16, 12, 13], ["-", 0, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["-", 0, 9, 0, 1, 0, 11, 12, 16, 12, 13]]
1
407
#include <bits/stdc++.h> using namespace std; #define int long long #define double long double #define fo(a, b) for (int a = 0; a < b; a++) #define Sort(a) sort(a.begin(), a.end()) #define rev(a) reverse(a.begin(), a.end()) #define fi first #define se second #define bgn begin() #define sz size() #define en end() #defin...
#include <bits/stdc++.h> using namespace std; #define int long long #define double long double #define fo(a, b) for (int a = 0; a < b; a++) #define Sort(a) sort(a.begin(), a.end()) #define rev(a) reverse(a.begin(), a.end()) #define fi first #define se second #define bgn begin() #define sz size() #define en end() #defin...
[["-", 0, 57, 64, 9, 0, 1, 0, 27, 28, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 27, 28, 22], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 0, 57, 64, 9, 0, 1, 0, 27, 17, 29]]
1
2,553
// #define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; #define int long long #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define rep(i, n) for (int i = 0; i < n; ++i) #define REP(i, n) for (int i = 0; i < n; ++i) #define range(i, a, b) ((a) <= (i) && (i) < (b)) #defi...
// #define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; #define int long long #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define rep(i, n) for (int i = 0; i < n; ++i) #define REP(i, n) for (int i = 0; i < n; ++i) #define range(i, a, b) ((a) <= (i) && (i) < (b)) #defi...
[["-", 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, 0, 57, 15, 339, 51, 16, 12, 13]]
1
728
// c++ テンプレ #include <bits/stdc++.h> using namespace std; typedef long long llint; typedef unsigned long LInt; typedef long double ld; #define inf 1e18 constexpr long long INFLL = 1e18; #define mod 1000000007 priority_queue<llint, vector<llint>, greater<llint>> que; priority_queue<llint> Que; template <class T> inlin...
// c++ テンプレ #include <bits/stdc++.h> using namespace std; typedef long long llint; typedef unsigned long LInt; typedef long double ld; #define inf 1e18 constexpr long long INFLL = 1e18; #define mod 1000000007 priority_queue<llint, vector<llint>, greater<llint>> que; priority_queue<llint> Que; template <class T> inlin...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
309
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, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 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
180
#include <bits/stdc++.h> using namespace std; #define ll long long #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define _GLIBCXX_DEBUG #define all(a) a.begin(), a.end() #define pb push_back #define mp make_pair #define INF (1 << 31) - 1 int main() { ll N; cin >> N; ll M = N; ll ans = 0; for (ll i = 2...
#include <bits/stdc++.h> using namespace std; #define ll long long #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define _GLIBCXX_DEBUG #define all(a) a.begin(), a.end() #define pb push_back #define mp make_pair #define INF (1 << 31) - 1 int main() { ll N; cin >> N; ll M = N; ll ans = 0; for (ll i = 2...
[["+", 64, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 64, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["-", 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], ["+", ...
1
164
from collections import defaultdict n = int(input()) dd = defaultdict(int) for i in range(2, int(n ** (1 / 3) + 2)): while n % i == 0: dd[i] += 1 n //= i if n != 1: dd[n] += 1 ans = 0 cnt = {} for i in range(20): tmp = i * (i + 1) // 2 cnt[tmp] = i for i, j in dd.items(): for num in...
from collections import defaultdict n = int(input()) dd = defaultdict(int) for i in range(2, int(n ** (1 / 2) + 2)): while n % i == 0: dd[i] += 1 n //= i if n != 1: dd[n] += 1 ans = 0 cnt = {} for i in range(20): tmp = i * (i + 1) // 2 cnt[tmp] = i for i, j in dd.items(): for num in...
[["-", 0, 657, 31, 657, 12, 23, 0, 657, 12, 612], ["+", 0, 657, 31, 657, 12, 23, 0, 657, 12, 612]]
5
133
#define _USE_MATH_DEFINES #include <bits/stdc++.h> using namespace std; #define FOR(i, m, n) for (int i = (m); i < (n); ++i) #define REP(i, n) FOR(i, 0, n) #define ALL(v) (v).begin(), (v).end() using ll = long long; const int INF = 0x3f3f3f3f; const ll LINF = 0x3f3f3f3f3f3f3f3fLL; const double EPS = 1e-8; const int MOD...
#define _USE_MATH_DEFINES #include <bits/stdc++.h> using namespace std; #define FOR(i, m, n) for (int i = (m); i < (n); ++i) #define REP(i, n) FOR(i, 0, n) #define ALL(v) (v).begin(), (v).end() using ll = long long; const int INF = 0x3f3f3f3f; const ll LINF = 0x3f3f3f3f3f3f3f3fLL; const double EPS = 1e-8; const int MOD...
[["-", 0, 7, 8, 9, 0, 1, 0, 27, 17, 68], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 110], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 12, 22]]
1
426
from collections import defaultdict D = defaultdict(int) N = int(input()) a = 2 while a * a <= N: if N % a: a += 1 else: N //= a D[a] += 1 D[N] += 1 ans = 0 for k,v in D.items(): i = 0 while i*(i+1) <= v * 2: i += 1 ans += i-1 print(ans)
from collections import defaultdict D = defaultdict(int) N = int(input()) a = 2 while a * a <= N: if N % a: a += 1 else: N //= a D[a] += 1 if N != 1: D[N] += 1 ans = 0 for k,v in D.items(): i = 0 while i*(i+1) <= v * 2: i += 1 ans += i-1 print(ans)
[["+", 36, 36, 36, 36, 0, 656, 0, 57, 0, 121], ["+", 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, 612], ["+", 36, 36, 36, 36, 0, 656, 0, 57, 0, 102]]
5
95
#include <bits/stdc++.h> using namespace std; typedef long long LL; const int N = 1e6 + 10; #define fi first #define se second #define pb push_back int p[N], a[N], cnt; void P() { for (int i = 2; i < N; i++) { if (!p[i]) a[++cnt] = i; for (int j = 1; j <= cnt && 1ll * i * a[j] < N; j++) { p[i * a[...
#include <bits/stdc++.h> using namespace std; typedef long long LL; const int N = 1e6 + 10; #define fi first #define se second #define pb push_back int p[N], a[N], cnt; void P() { for (int i = 2; i < N; i++) { if (!p[i]) a[++cnt] = i; for (int j = 1; j <= cnt && 1ll * i * a[j] < N; j++) { p[i * a[...
[["-", 0, 57, 64, 37, 0, 34, 31, 16, 12, 13], ["+", 0, 57, 64, 37, 0, 34, 31, 16, 12, 13]]
1
300
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy sys.setrecursionlimit(10**7) inf=10**20 mod=10**9+7 dd=[(-1,0),(0,1),(1,0),(0,-1)] ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)] def LI(): return [int(x) for x in sys.stdin.readline().split()] def LF(): return [float(x) for x in sys...
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy sys.setrecursionlimit(10**7) inf=10**20 mod=10**9+7 dd=[(-1,0),(0,1),(1,0),(0,-1)] ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)] def LI(): return [int(x) for x in sys.stdin.readline().split()] def LF(): return [float(x) for x in sys...
[["-", 0, 52, 8, 196, 0, 1, 0, 677, 17, 108], ["-", 0, 52, 8, 196, 0, 1, 0, 677, 12, 612], ["+", 0, 52, 8, 196, 0, 1, 0, 677, 17, 107], ["+", 0, 52, 8, 196, 0, 1, 0, 677, 12, 612]]
5
443
#include <algorithm> #include <cmath> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <tuple> #include <utility> #include <vector> #define rep(i, n) for (int i = 0; i < (int)(n); ++i) using namespace std; int main() { long long N; ci...
#include <algorithm> #include <cmath> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <tuple> #include <utility> #include <vector> #define rep(i, n) for (int i = 0; i < (int)(n); ++i) using namespace std; int main() { long long N; ci...
[["-", 8, 9, 0, 7, 8, 9, 0, 57, 0, 121], ["+", 8, 9, 0, 7, 8, 9, 0, 52, 0, 89], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 31, 22], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 31, 22]]
1
171
# n = int(input()) n = 16 if n == 1: print(0) exit() 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!=...
n = int(input()) if n == 1: print(0) exit() 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: ...
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 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], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]]
5
177
#include <bits/stdc++.h> using namespace std; typedef long long int lld; typedef pair<int, int> pi; typedef pair<lld, lld> pl; #define x first #define y second #define all(v) v.begin(), v.end() #define sz(x) (int)x.size() #define mk(a, b) make_pair(a, b) vector<int> v; int main(void) { lld n; scanf("%lld", &n); ...
#include <bits/stdc++.h> using namespace std; typedef long long int lld; typedef pair<int, int> pi; typedef pair<lld, lld> pl; #define x first #define y second #define all(v) v.begin(), v.end() #define sz(x) (int)x.size() #define mk(a, b) make_pair(a, b) vector<int> v; int main(void) { lld n; scanf("%lld", &n); ...
[["-", 0, 43, 49, 50, 51, 16, 31, 16, 17, 48], ["-", 0, 43, 49, 50, 51, 16, 31, 16, 12, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
279
from collections import Counter n = int(input()) def prime_factorize(n): # Return list of prime factorized result # O(sqrt(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: ...
from collections import Counter n = int(input()) def prime_factorize(n): # Return list of prime factorized result # O(sqrt(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: ...
[["-", 0, 57, 64, 196, 0, 1, 0, 677, 12, 612], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 12, 22]]
5
141
n = int(input()) p = 2 ans = 0 while n > 1: if p > 10 ** 6: ans = 1 break e = 1 while n % (p ** e) == 0: n = n // (p ** e) e += 1 ans += 1 while n % p == 0: n = n // p p += 1 print(ans)
n = int(input()) p = 2 ans = 0 while n > 1: if p > 10 ** 6: ans += 1 break e = 1 while n % (p ** e) == 0: n = n // (p ** e) e += 1 ans += 1 while n % p == 0: n = n // p p += 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
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]) return ar...
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]) return ar...
[["-", 0, 656, 0, 7, 8, 196, 0, 52, 0, 89], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 656, 0, 7, 8, 196, 0, 52, 0, 89], ["+", 0, 7, 8, 196, 0, 52, 15, 666, 0, 22], ["-", 0, 52, 8, 196, 0, 1, 0, 677, 31, 22], ["+", 0, 52, 8, 196, 0, 1, 0, 677, 31, 22], ["-", 0, 52, 8, ...
5
131
import collections import bisect n = 10 ** 4 fl = [1] * n fl[0] = 0 fl[1] = 0 lprime = [] for i in range(n): if fl[i] == 1: lprime.append(i) ti = i * 2 while ti < n: fl[ti] = 0 ti += i def prime_factorize(n): global lprime a = [] for p in lprime: ...
import collections import bisect n = 10 ** 6 + 10 fl = [1] * n fl[0] = 0 fl[1] = 0 lprime = [] for i in range(n): if fl[i] == 1: lprime.append(i) ti = i * 2 while ti < n: fl[ti] = 0 ti += i def prime_factorize(n): global lprime a = [] for p in lprime: ...
[["-", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 0, 1, 0, 662, 12, 657, 31, 657, 12, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 17, 72], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612]]
5
200
# -*- coding: utf-8 -*- # map(int, input().split()) import math N = int(input()) if N == 1: print(0) exit() 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 ...
# -*- coding: utf-8 -*- # map(int, input().split()) import math N = int(input()) if N == 1: print(0) exit() 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 ...
[["-", 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
173
/*** akshaykumar99 ***/ #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; template <typename T> using id_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; #define f(i, x, n) for (i = x; i < n; i++) #define fr(i, x,...
/*** akshaykumar99 ***/ #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; template <typename T> using id_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; #define f(i, x, n) for (i = x; i < n; i++) #define fr(i, x,...
[["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 38], ["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 35]]
1
432
#include <bits/stdc++.h> #define ll long long int #define loop(i, a, b) for (int i = (int)a; i < (int)b; ++i) #define rloop(i, a, b) for (int i = (int)a; i <= (int)b; ++i) #define loopl(i, a, b) for (ll i = (ll)a; i < (ll)b; ++i) #define loopr(i, a, b) for (int i = (int)a; i >= (int)b; --i) #define count_1(n) __builtin...
#include <bits/stdc++.h> #define ll long long int #define loop(i, a, b) for (int i = (int)a; i < (int)b; ++i) #define rloop(i, a, b) for (int i = (int)a; i <= (int)b; ++i) #define loopl(i, a, b) for (ll i = (ll)a; i < (ll)b; ++i) #define loopr(i, a, b) for (int i = (int)a; i >= (int)b; --i) #define count_1(n) __builtin...
[["+", 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
354
#include <bits/stdc++.h> #define ll long long int #define MOD 1000000007 #define INF 1e18 #define P pair<ll, ll> using namespace std; int main(void) { ll n; cin >> n; ll k = n; if (n == 1) { cout << 0 << endl; return 0; } vector<ll> div(0); for (ll i = 2; i * i <= k; i++) { if (n % i == 0)...
#include <bits/stdc++.h> #define ll long long int #define MOD 1000000007 #define INF 1e18 #define P pair<ll, ll> using namespace std; int main(void) { ll n; cin >> n; ll k = n; if (n == 1) { cout << 0 << endl; return 0; } vector<ll> div(0); for (ll i = 2; i * i <= k; i++) { if (n % i == 0)...
[["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 106], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 79], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
200
#include <algorithm> #include <cstdio> #include <iostream> #include <map> #include <numeric> #include <string> #include <utility> #include <vector> using namespace std; int main() { long long n; cin >> n; map<long long, int> factors; long long i = 2; long long maxi = 1e6; while (n > 1 && i <= maxi) { ...
#include <algorithm> #include <cstdio> #include <iostream> #include <map> #include <numeric> #include <string> #include <utility> #include <vector> using namespace std; int main() { long long n; cin >> n; map<long long, int> factors; long long i = 2; long long maxi = 1e6; while (n > 1 && i <= maxi) { ...
[["+", 0, 52, 8, 9, 0, 57, 75, 76, 0, 95], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 45], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 46]]
1
158
#include <bits/stdc++.h> #define ll long long #define ld long double #define fs first #define sc second #define task "tet" using namespace std; const ll N = 2e5 + 9; const ll inf = 1e18; typedef pair<ll, ll> LL; vector<ll> res; ll n; int main() { ios_base::sync_with_stdio(0); cin.tie(0), cout.tie(0); if (fopen(t...
#include <bits/stdc++.h> #define ll long long #define ld long double #define fs first #define sc second #define task "tet" using namespace std; const ll N = 2e5 + 9; const ll inf = 1e18; typedef pair<ll, ll> LL; vector<ll> res; ll n; int main() { ios_base::sync_with_stdio(0); cin.tie(0), cout.tie(0); if (fopen(t...
[["+", 15, 339, 51, 16, 31, 16, 12, 23, 0, 24], ["+", 51, 16, 31, 16, 12, 23, 0, 16, 17, 72], ["+", 51, 16, 31, 16, 12, 23, 0, 16, 12, 13], ["+", 15, 339, 51, 16, 31, 16, 12, 23, 0, 25]]
1
240
import math l = [] n = int(input()) for i in range(2,int(math.sqrt(n))+1): flg = 0 while n % i == 0: if flg == 0: l.append(1) flg = 1 else: l[-1] += 1 n = n//i if l == [] and n != 1: l.append(1) ans = 0 for i in range(len(l)): c = 1 while l[i] - c >= 0: l[i] -= c c += 1...
import math l = [] n = int(input()) for i in range(2,int(math.sqrt(n))+1): flg = 0 while n % i == 0: if flg == 0: l.append(1) flg = 1 else: l[-1] += 1 n = n//i if n != 1: l.append(1) ans = 0 for i in range(len(l)): c = 1 while l[i] - c >= 0: l[i] -= c c += 1 ans += ...
[["-", 0, 656, 0, 57, 15, 679, 31, 666, 0, 22], ["-", 0, 656, 0, 57, 15, 679, 31, 666, 667, 60], ["-", 0, 57, 15, 679, 31, 666, 0, 634, 0, 70], ["-", 0, 57, 15, 679, 31, 666, 0, 634, 0, 73], ["-", 36, 36, 0, 656, 0, 57, 15, 679, 17, 355]]
5
131
#include <algorithm> #include <bits/stdc++.h> #include <bitset> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <iostream> #include <list> #include <math.h> #include <queue> #include <stack> #include <stdio.h> #include <unordered_map> #include <vector> // #include "boost/algorithm...
#include <algorithm> #include <bits/stdc++.h> #include <bitset> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <iostream> #include <list> #include <math.h> #include <queue> #include <stack> #include <stdio.h> #include <unordered_map> #include <vector> // #include "boost/algorithm...
[["-", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
605
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <vector> using namespace std; using ll = long long; void factorize(map<ll, ll> &fac, ll a) { for (ll i = 2; i < ll(sqrt(a) + 1); i++) { while (a % i == 0) { a /= i; fac[i]++; } } if (a > 1) fac[a]++; } int ...
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <vector> using namespace std; using ll = long long; void factorize(map<ll, ll> &fac, ll a) { for (ll i = 2; i < ll(sqrt(a) + 1); i++) { while (a % i == 0) { a /= i; fac[i]++; } } if (a > 1) fac[a]++; } int ...
[["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22]]
1
364
#include <bits/stdc++.h> using namespace std; using ll = long long; using vb = vector<bool>; using vvb = vector<vb>; using vd = vector<double>; using vvd = vector<vd>; using vi = vector<int>; using vvi = vector<vi>; using vl = vector<ll>; using vvl = vector<vl>; using pll = pair<ll, ll>; using tll = tuple<ll, ll>; usin...
#include <bits/stdc++.h> using namespace std; using ll = long long; using vb = vector<bool>; using vvb = vector<vb>; using vd = vector<double>; using vvd = vector<vd>; using vi = vector<int>; using vvi = vector<vi>; using vl = vector<ll>; using vvl = vector<vl>; using pll = pair<ll, ll>; using tll = tuple<ll, ll>; usin...
[["+", 0, 57, 64, 9, 0, 1, 0, 27, 28, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 27, 17, 68], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35]]
1
1,002
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...
[["-", 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
172
a=int(input()) ans = 0 tmp = 2 while tmp*tmp <=a: ct = 0 while not a % tmp: ct+=1 a/=tmp for i in range(1,ct): if (1+i)*i/2<=ct: ans+=1 else: break tmp+=1 if a != 1: ans+=1 print(ans)
a=int(input()) ans = 0 tmp = 2 while tmp*tmp <=a: ct = 0 while not a % tmp: ct+=1 a/=tmp for i in range(1,ct+1): if (1+i)*i/2<=ct: ans+=1 else: break tmp+=1 if a != 1: ans+=1 print(ans)
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
80
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, 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
164
#include <bits/stdc++.h> #define pb(x) push_back(x) #define mp(x, y) make_pair(x, y) #define sz(A) int(A.size()) #define FIFO \ ios_base::sync_with_stdio(0); \ cin.tie(0); ...
#include <bits/stdc++.h> #define pb(x) push_back(x) #define mp(x, y) make_pair(x, y) #define sz(A) int(A.size()) #define FIFO \ ios_base::sync_with_stdio(0); \ cin.tie(0); ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
269
#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; typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set; mt19937 rng((uint32_t)chrono::steady_clock::now()...
#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; typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set; mt19937 rng((uint32_t)chrono::steady_clock::now()...
[["-", 0, 57, 64, 1, 0, 11, 12, 16, 17, 33], ["-", 0, 57, 64, 1, 0, 11, 12, 16, 12, 13]]
1
251
#include <bits/stdc++.h> #define endl '\n' #define mod 1000000007 typedef long long int ll; using namespace std; #define MAX 100005 int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll n; cin >> n; vector<ll> v; for (ll i = 2; i * i <= n; i++) { if (n % i == 0) { ll cnt = 0; ...
#include <bits/stdc++.h> #define endl '\n' #define mod 1000000007 typedef long long int ll; using namespace std; #define MAX 100005 int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll n; cin >> n; vector<ll> v; for (ll i = 2; i * i <= n; i++) { if (n % i == 0) { ll cnt = 0; ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 72], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
204
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, 7, 8, 196, 0, 57, 15, 666, 667, 19], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 18], ["-", 64, 196, 0, 1, 0, 677, 12, 657, 17, 72], ["-", 64, 196, 0, 1, 0, 677, 12, 657, 12, 612]]
5
167
import math def solve(n): ans = 0 for i in range(2, int(math.sqrt(n) + 2)): if n % i == 0: times = 0 needed = 1 while n % i ==0: times += 1 if times>= needed: times = 0 needed += 1 ...
import math def solve(n): ans = 0 for i in range(2, int(math.sqrt(n) + 2)): if n % i == 0: times = 0 needed = 1 while n % i ==0: times += 1 if times>= needed: times = 0 needed += 1 ...
[["-", 8, 196, 0, 57, 15, 681, 28, 666, 0, 22], ["+", 8, 196, 0, 57, 15, 681, 28, 666, 0, 22], ["-", 8, 196, 0, 57, 15, 681, 28, 666, 0, 612], ["+", 8, 196, 0, 57, 15, 681, 28, 666, 0, 612], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 612], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 612],...
5
100
#include <bits/stdc++.h> using namespace std; #define Fast_IO \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); #define int l...
#include <bits/stdc++.h> using namespace std; #define Fast_IO \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); #define int l...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22]]
1
115
def factorization(n): #素因数分解のプログラム([素因数,指数]のリストのリストで出力→24→[[2, 3], [3, 1]]) 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: ...
def factorization(n): #素因数分解のプログラム([素因数,指数]のリストのリストで出力→24→[[2, 3], [3, 1]]) 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: ...
[["-", 0, 1, 0, 677, 12, 652, 63, 319, 500, 22], ["-", 0, 1, 0, 677, 12, 652, 63, 319, 0, 131], ["-", 0, 1, 0, 677, 12, 652, 63, 319, 319, 22], ["-", 0, 1, 0, 677, 12, 652, 3, 4, 0, 24], ["-", 0, 1, 0, 677, 12, 652, 3, 4, 0, 25]]
5
196
#include <bits/stdc++.h> const int N = 1e7 + 5; bool vis[N]; int main() { long long n, siz, ans = 0; std::cin >> n; siz = std::sqrt(n); for (int i = 2; i <= n / i; ++i) { if (!vis[i]) { for (long long j = i * i; j <= siz; j += i) vis[j] = 1; long long cnt = 0; while (n % i == 0)...
#include <bits/stdc++.h> const int N = 1e7 + 5; bool vis[N]; int main() { long long n, siz, ans = 0; std::cin >> n; siz = std::sqrt(n); for (long long i = 2; i <= n / i; ++i) { if (!vis[i]) { for (long long j = (long long)i * i; j <= siz; j += i) vis[j] = 1; long long cnt = 0; w...
[["-", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["+", 8, 9, 0, 7, 10, 43, 39, 86, 0, 96], ["+", 10, 43, 49, 50, 51, 16, 31, 74, 0, 24], ["+", 51, 16, 31, 74, 39, 77, 39, 86, 0, 96], ["+", 10, 43, 49, 50, 51, 16, 31, 74, 0, 25]]
1
169
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 def judg...
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 def judg...
[["-", 8, 196, 0, 1, 0, 677, 12, 657, 31, 22], ["+", 8, 196, 0, 1, 0, 677, 12, 657, 31, 22]]
5
163
#include <bits/stdc++.h> using namespace std; #define ll long long #define double long double #define f(i, x, y, z) for (int i = x; i < y; i += z) #define fast \ ios_base::sync_with_stdio(false); \ cin.tie(n...
#include <bits/stdc++.h> using namespace std; #define ll long long #define double long double #define f(i, x, y, z) for (int i = x; i < y; i += z) #define fast \ ios_base::sync_with_stdio(false); \ cin.tie(n...
[["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 40], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
442
def f(i,n): ans =0 cnt = i while n%cnt == 0: n//=cnt cnt*=i ans +=1 while n%i ==0: n//=i return n,ans n = int(input()) nn = n i = 2 ans = 0 while i <= int(n**0.5)+1: if n%i ==0: n,a = f(i,n) ans += a i += 1 if n == nn: ans += 1 print(ans)
def f(i,n): ans =0 cnt = i while n%cnt == 0: n//=cnt cnt*=i ans +=1 while n%i ==0: n//=i return n,ans n = int(input()) i = 2 ans = 0 while i <= int(n**0.5)+1: if n%i ==0: n,a = f(i,n) ans += a i += 1 if n >1: ans += 1 print(ans)
[["-", 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, 667, 60], ["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 61...
5
108
#include <bits/stdc++.h> using namespace std; using lnt = long long; using Real = long double; #define ALL(obj) (obj).begin(), (obj).end() #define RALL(obj) (obj).rbegin(), (obj).rend() #define REP(i, n) for (lnt i = 0; i < (n); ++i) #define RANGE(i, a, b) for (lnt i = (a); i < (b); ++i) #define RREP(i, n) for (lnt i...
#include <bits/stdc++.h> using namespace std; using lnt = long long; using Real = long double; #define ALL(obj) (obj).begin(), (obj).end() #define RALL(obj) (obj).rbegin(), (obj).rend() #define REP(i, n) for (lnt i = 0; i < (n); ++i) #define RANGE(i, a, b) for (lnt i = (a); i < (b); ++i) #define RREP(i, n) for (lnt i...
[["-", 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, 355], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22]]
1
566
import java.io.PrintWriter; import java.util.*; public class Main { void run() { Scanner sc = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); long n = sc.nextLong(); Map<Long, Long> map = primeFactorization(n); // debug(map); int ans = 0; for (Map.Entry<...
import java.io.PrintWriter; import java.util.*; public class Main { void run() { Scanner sc = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); long n = sc.nextLong(); Map<Long, Long> map = primeFactorization(n); // debug(map); int ans = 0; for (Map.Entry<...
[["-", 64, 196, 0, 1, 0, 11, 12, 16, 12, 22], ["+", 64, 196, 0, 1, 0, 11, 12, 16, 12, 22]]
3
355
/* Author : DemonStar */ #pragma GCC optimize("Ofast") #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; typedef long long ll; #define ordered_set \ tre...
/* Author : DemonStar */ #pragma GCC optimize("Ofast") #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; typedef long long ll; #define ordered_set \ tre...
[["+", 0, 57, 64, 1, 0, 11, 12, 69, 28, 22], ["+", 64, 1, 0, 11, 12, 69, 341, 342, 0, 70], ["+", 64, 1, 0, 11, 12, 69, 341, 342, 0, 73]]
1
925
#include "bits/stdc++.h" #include <unordered_set> #define rep(i, n) for (int i = 0; i < n; i++) typedef long long ll; typedef unsigned long long ull; using namespace std; #define vll vector<vector<long long>> #define vl vector<long long> #define vi vector<int> #define vii vector<vector<int>> #define pb push_back #defin...
#include "bits/stdc++.h" #include <unordered_set> #define rep(i, n) for (int i = 0; i < n; i++) typedef long long ll; typedef unsigned long long ull; using namespace std; #define vll vector<vector<long long>> #define vl vector<long long> #define vi vector<int> #define vii vector<vector<int>> #define pb push_back #defin...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
1,109
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> P; const ll INF = 1LL << 60; const ll mod = 1000000007; int main(void) { ll n; ll ans = 0; cin >> n; map<ll, ll> m; for (int i = 2; i * i <= 1000000;) { if (n % i == 0) { m[i]++; n /= i; } else { ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> P; const ll INF = 1LL << 60; const ll mod = 1000000007; int main(void) { ll n; ll ans = 0; cin >> n; map<ll, ll> m; for (ll i = 2; i <= 1000000;) { if (n % i == 0) { m[i]++; n /= i; } else { 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
189
n=int(input()) if n==1: print(0) def sosuu(n): if n == 1: return False for i in range(2,int(n**0.5)+1): if n % i == 0: return False return True if sosuu(n): print(1) exit() def factorization(n): arr = [] temp = n for i in range(2, int(-(-n**0.5//1))+1): ...
n=int(input()) if n==1: print(0) exit() def sosuu(n): if n == 1: return False for i in range(2,int(n**0.5)+1): if n % i == 0: return False return True if sosuu(n): print(1) exit() def factorization(n): arr = [] temp = n for i in range(2, int(-(-n**0.5/...
[["+", 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, 25]]
5
220
def main(): n = int(input()) if n == 1: print(0) return def eratos(n): flag = [True] * (n + 1) for i in range(2, int(n**0.5) + 1): if flag[i]: for j in range(2*i, n + 1, i): flag[j] = False return [i for i, x in enumerat...
def main(): n = int(input()) if n == 1: print(0) return def eratos(n): flag = [True] * (n + 1) for i in range(2, int(n**0.5) + 1): if flag[i]: for j in range(2*i, n + 1, i): flag[j] = False return [i for i, x in enumerat...
[["-", 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, 652, 63, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25], ["+", 8, 196, 0, 57, 64, 196, 0, 37, 0, 38]]
5
214