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()) cnt = 2 ret = [] for i in range(2, int(N**0.5)+1): if N % i == 0: k = N//i while k % i == 0: k //= i if k % i == 1: cnt += 1 if N // i != i: j = N // i k = i while k % j == 0: k //= j ...
N = int(input()) cnt = 2 if N > 2 else 1 ret = [] for i in range(2, int(N**0.5)+1): if N % i == 0: k = N//i while k % i == 0: k //= i if k % i == 1: cnt += 1 if N // i != i: j = N // i k = i while k % j == 0: ...
[["+", 0, 656, 0, 1, 0, 662, 12, 41, 0, 121], ["+", 0, 1, 0, 662, 12, 41, 0, 666, 0, 22], ["+", 0, 1, 0, 662, 12, 41, 0, 666, 667, 47], ["+", 0, 1, 0, 662, 12, 41, 0, 666, 0, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 41, 0, 95], ["+", 0, 656, 0, 1, 0, 662, 12, 41, 0, 612]]
5
147
/** * code generated by JHelper * More info: https://github.com/AlexeyDmitriev/JHelper * @author champon */ #include <bits/stdc++.h> #include <fstream> #include <iostream> #define se cout << "test ok" << endl; #define sp << " " << #define enl "\n" using namespace std; using ll = long long; using ld = long double; ...
/** * code generated by JHelper * More info: https://github.com/AlexeyDmitriev/JHelper * @author champon */ #include <bits/stdc++.h> #include <fstream> #include <iostream> #define se cout << "test ok" << endl; #define sp << " " << #define enl "\n" using namespace std; using ll = long long; using ld = long double; ...
[["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 109], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
1,382
#!/usr/bin/env python3 import sys, math, itertools, collections, bisect input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') inf = float('inf') ;mod = 10**9+7 mans = inf ;ans = 0 ;count = 0 ;pro = 1 n = int(input()) for i in range(2,min(n-1,int(n**.5)+1)): # for i in range(2,n*+1): if n % i == 0: ...
#!/usr/bin/env python3 import sys, math, itertools, collections, bisect input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') inf = float('inf') ;mod = 10**9+7 mans = inf ;ans = 0 ;count = 0 ;pro = 1 n = int(input()) for i in range(2,min(n-1,int(n**.5)+1)): # for i in range(2,n*+1): if n % i == 0: ...
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 612], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 612]]
5
249
import math N = int(input()) if N == 2: print(2) else: ans = [N-1,N] #N-1 for i in range(2,int(math.sqrt(N-1)+1)): if (N-1) % i == 0: ans.append(i) if i != (N-1)//i: ans.append((N-1)//i) #N for j in range(2,int(math.sqrt(N))+1): if N % j ...
import math N = int(input()) if N == 2: print(1) else: ans = [N-1,N] #N-1 for i in range(2,int(math.sqrt(N-1)+1)): if (N-1) % i == 0: ans.append(i) if i != (N-1)//i: ans.append((N-1)//i) #N for j in range(2,int(math.sqrt(N))+1): if N % j ...
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612]]
5
197
#include <bits/stdc++.h> using namespace std; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } using ll = long long; #define ALL(v) (v).begin(), (v).end...
#include <bits/stdc++.h> using namespace std; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } using ll = long long; #define ALL(v) (v).begin(), (v).end...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22]]
1
449
import java.io.*; import java.math.*; import java.util.*; public class Main { static boolean DEBUG; public static void main(String[] args) { DEBUG = args.length > 0 && args[0].equals("-DEBUG"); Solver solver = new Solver(); solver.solve(); solver.exit(); } static class FastScanner { private...
import java.io.*; import java.math.*; import java.util.*; public class Main { static boolean DEBUG; public static void main(String[] args) { DEBUG = args.length > 0 && args[0].equals("-DEBUG"); Solver solver = new Solver(); solver.solve(); solver.exit(); } static class FastScanner { private...
[["-", 0, 57, 64, 1, 0, 27, 0, 504, 516, 22], ["-", 0, 57, 64, 1, 0, 27, 0, 504, 0, 70], ["-", 0, 57, 64, 1, 0, 27, 0, 504, 71, 22], ["-", 0, 57, 64, 1, 0, 27, 0, 504, 0, 73], ["+", 0, 7, 8, 196, 0, 57, 64, 196, 0, 45], ["+", 0, 57, 64, 196, 0, 1, 0, 27, 0, 22], ["+", 0, 7, 8, 196, 0, 57, 64, 196, 0, 46], ["-", 0, 1, 0...
3
9,320
// I look at my watch // it say nine twenty-five // And I think oh God // I'm still alive #include <bits/stdc++.h> #define ff first #define ss second #define pb push_back #define mp make_pair #define sz(x) int((x).size()) #define all(v) (v).begin(), (v).end() #define trace(x) cerr << #x << " = " << x << endl #define f...
// I look at my watch // it say nine twenty-five // And I think oh God // I'm still alive #include <bits/stdc++.h> #define ff first #define ss second #define pb push_back #define mp make_pair #define sz(x) int((x).size()) #define all(v) (v).begin(), (v).end() #define trace(x) cerr << #x << " = " << x << endl #define f...
[["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 47], ["-", 8, 9, 0, 52, 15, 339, 51, 16, 12, 13], ["+", 0, 52, 15, 339, 51, 16, 31, 16, 17, 109], ["+", 0, 52, 15, 339, 51, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 12, 13]]
1
299
// 52行目から編集 #include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <limits.h> #include <list> #include <map> #include <num...
// 52行目から編集 #include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <limits.h> #include <list> #include <map> #include <num...
[["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 109], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
478
#include <algorithm> #include <chrono> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <map> #include <math.h> #include <numeric> #include <queue> #include <random> #include <sstream> #include <stack> #inc...
#include <algorithm> #include <chrono> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <map> #include <math.h> #include <numeric> #include <queue> #include <random> #include <sstream> #include <stack> #inc...
[["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 72], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
518
#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 fi first #define se second #define all(c) c.begin(), c.end() typedef long long int ll; typedef pair<int, int> P; typedef long double ld; void Ans(bool x) { if (x)...
#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 fi first #define se second #define all(c) c.begin(), c.end() typedef long long int ll; typedef pair<int, int> P; typedef long double ld; void Ans(bool x) { if (x)...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 33], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
314
#include <algorithm> #include <cmath> #include <iostream> #include <map> using namespace std; bool divsub(long N, long k) { while (N % k == 0) N /= k; return (1 == N % k); } void factorize(long N, map<long, long> *m) { long lim = sqrt(N); long div = 2; while (N != 1 && div <= lim) { long cnt = 0; ...
#include <algorithm> #include <cmath> #include <iostream> #include <map> using namespace std; bool divsub(long N, long k) { while (N % k == 0) N /= k; return (1 == N % k); } void factorize(long N, map<long, long> *m) { long lim = sqrt(N); long div = 2; while (N != 1 && div <= lim) { long cnt = 0; ...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13]]
1
284
import sys input = lambda: sys.stdin.readline().rstrip() N = int(input()) div = [] ans = 0 for i in range(1, int(N**0.5)+1): if N % i == 0: div.append(i) if i != N // i: div.append(N//i) for d in div: if d == 1: continue tmp = N while tmp % d == 0: tmp //= d i...
import sys input = lambda: sys.stdin.readline().rstrip() N = int(input()) div = [] ans = 0 for i in range(1, int(N**0.5)+1): if N % i == 0: div.append(i) if i != N // i: div.append(N//i) for d in div: if d == 1: continue tmp = N while tmp % d == 0: tmp //= d i...
[["+", 0, 57, 15, 666, 0, 657, 31, 23, 0, 24], ["+", 15, 666, 0, 657, 31, 23, 0, 657, 17, 33], ["+", 15, 666, 0, 657, 31, 23, 0, 657, 12, 612], ["+", 0, 57, 15, 666, 0, 657, 31, 23, 0, 25]]
5
183
#pragma GCC target("avx") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include <algorithm> #include <assert.h> #include <bitset> #include <cfloat> #include <complex> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <limits.h> #include <list> #...
#pragma GCC target("avx") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include <algorithm> #include <assert.h> #include <bitset> #include <cfloat> #include <complex> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <limits.h> #include <list> #...
[["-", 0, 14, 8, 9, 0, 14, 49, 53, 49, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35]]
1
665
package main import ( "bufio" "fmt" "os" "sort" "strconv" ) func out(x ...interface{}) { fmt.Println(x...) } var sc = bufio.NewScanner(os.Stdin) func getInt() int { sc.Scan() i, e := strconv.Atoi(sc.Text()) if e != nil { panic(e) } return i } func getInts(N int) []int { ret := make([]int, N) for i :...
package main import ( "bufio" "fmt" "os" "sort" "strconv" ) func out(x ...interface{}) { fmt.Println(x...) } var sc = bufio.NewScanner(os.Stdin) func getInt() int { sc.Scan() i, e := strconv.Atoi(sc.Text()) if e != nil { panic(e) } return i } func getInts(N int) []int { ret := make([]int, N) for i :...
[["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 433]]
7
532
#include <bits/stdc++.h> using namespace std; using ll = long long; template <typename T> using v2 = vector<vector<T>>; template <typename T> inline v2<T> fill(int r, int c, const T &t) { return v2<T>(r, vector<T>(c, t)); } #define F first #define S second vector<ll> factor(ll x) { vector<ll> ans; for (ll i = 2;...
#include <bits/stdc++.h> using namespace std; using ll = long long; template <typename T> using v2 = vector<vector<T>>; template <typename T> inline v2<T> fill(int r, int c, const T &t) { return v2<T>(r, vector<T>(c, t)); } #define F first #define S second vector<ll> factor(ll x) { vector<ll> ans; for (ll i = 2;...
[["-", 64, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 64, 9, 0, 1, 0, 16, 12, 5, 0, 6]]
1
302
#include <bits/stdc++.h> #include <set> using namespace std; using pii = pair<int, int>; using pll = pair<long long, long long>; const long long INF = 1 << 29; const int MOD = 998244353; long long ruizyou(long long m, long long n) { if (m == 0) return 0; if (m == 1) return 1; long long ans = 1; long lo...
#include <bits/stdc++.h> #include <set> using namespace std; using pii = pair<int, int>; using pll = pair<long long, long long>; const long long INF = 1 << 29; const int MOD = 998244353; long long ruizyou(long long m, long long n) { if (m == 0) return 0; if (m == 1) return 1; long long ans = 1; long lo...
[["+", 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
857
#include <bits/stdc++.h> using namespace std; #define repd(i, a, b) for (ll i = (a); i < (b); i++) #define rep(i, n) repd(i, 0, n) #define all(x) (x).begin(), (x).end() 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...
#include <bits/stdc++.h> using namespace std; #define repd(i, a, b) for (ll i = (a); i < (b); i++) #define rep(i, n) repd(i, 0, n) #define all(x) (x).begin(), (x).end() 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...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
301
#include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <cstdint> #include <cstdio> #include <ctime> #include <deque> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdlib.h> #include <string> #include <tuple> #include <unordere...
#include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <cstdint> #include <cstdio> #include <ctime> #include <deque> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdlib.h> #include <string> #include <tuple> #include <unordere...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
1,163
N = int(input()) import math ans = [] l = int(math.log2(N)) for i in range(1,l+1): if round(N**(1/i))**i==N: ans.append(round(N**(1/i))) for i in range(2,round((N-1)**0.5)+1): if (N-1)%i == 0: ans.append(i) if (N-1)//i != i: ans.append((N-1)//i) ans.append(N-1) for i in range(2,round(N**0.5)+1)...
N = int(input()) import math ans = [] l = int(math.log2(N)) for i in range(1,l+1): if round(N**(1/i))**i==N: ans.append(round(N**(1/i))) for i in range(2,round((N-1)**0.5)+1): if (N-1)%i == 0: ans.append(i) if (N-1)//i != i: ans.append((N-1)//i) if N>2: ans.append(N-1) for i in range(2,round(...
[["+", 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, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 612], ["+", 36, 36, 36, 36, 0, 656, 0, 57, 0, 102]]
5
198
/* * Author : MaxSally */ /******** All Required Header Files ********/ #include <bits/stdc++.h> using namespace std; /******* All Required define Pre-Processors and typedef Constants *******/ #define SCD(t) scanf("%d", &t) #define SCLD(t) scanf("%ld", &t) #define SCLLD(t) scanf("%lld", &t) #define SCC(t) scanf("%...
/* * Author : MaxSally */ /******** All Required Header Files ********/ #include <bits/stdc++.h> using namespace std; /******* All Required define Pre-Processors and typedef Constants *******/ #define SCD(t) scanf("%d", &t) #define SCLD(t) scanf("%ld", &t) #define SCLLD(t) scanf("%lld", &t) #define SCC(t) scanf("%...
[["+", 0, 57, 15, 339, 51, 16, 12, 23, 0, 24], ["+", 15, 339, 51, 16, 12, 23, 0, 16, 17, 33], ["+", 15, 339, 51, 16, 12, 23, 0, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 23, 0, 25]]
1
546
N = int(input()) divisor = set([N, N - 1]) x = N for i in range(2, int(x ** 0.5) + 1): z = x while z % i == 0: z //= i if z % i == 1: divisor.add(i) if i == x // i: continue z = x while z % (x // i) == 0: z //= (x // i) if z % (x // i) == 1:...
N = int(input()) divisor = set([N, N - 1]) x = N for i in range(2, int(x ** 0.5) + 1): z = x while z % i == 0: z //= i if z % i == 1: divisor.add(i) if i == x // i: continue z = x while z % (x // i) == 0: z //= (x // i) if z % (x // i) == 1:...
[["+", 0, 1, 0, 652, 3, 4, 0, 41, 0, 121], ["+", 0, 652, 3, 4, 0, 41, 0, 666, 0, 22], ["+", 0, 652, 3, 4, 0, 41, 0, 666, 667, 47], ["+", 0, 652, 3, 4, 0, 41, 0, 666, 0, 612], ["+", 0, 1, 0, 652, 3, 4, 0, 41, 0, 95], ["+", 0, 1, 0, 652, 3, 4, 0, 41, 0, 612]]
5
166
N = int(input()) if N == 2: print(0) exit() S = set([N-1]) lst = [N] i = 2 while i*i <= N-1: if (N-1) % i == 0: S.add(i) S.add((N-1)//i) i += 1 i = 2 while i*i < N: if N % i == 0: lst.append(i) lst.append(N//i) i += 1 if i*i == N: lst.append(i) lst.sort() for l in lst: if...
N = int(input()) if N == 2: print(1) exit() S = set([N-1]) lst = [N] i = 2 while i*i <= N-1: if (N-1) % i == 0: S.add(i) S.add((N-1)//i) i += 1 i = 2 while i*i < N: if N % i == 0: lst.append(i) lst.append(N//i) i += 1 if i*i == N: lst.append(i) lst.sort() for l in lst: if...
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612]]
5
175
def getN(): return int(input()) def getNM(): return map(int, input().split()) def getList(): return list(map(int, input().split())) def getArray(intn): return [int(input()) for i in range(intn)] def input(): return sys.stdin.readline().rstrip() def rand_N(ran1, ran2): return random.randint(ran1,...
def getN(): return int(input()) def getNM(): return map(int, input().split()) def getList(): return list(map(int, input().split())) def getArray(intn): return [int(input()) for i in range(intn)] def input(): return sys.stdin.readline().rstrip() def rand_N(ran1, ran2): return random.randint(ran1,...
[["-", 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
616
/** * code generated by JHelper * More info: https://github.com/AlexeyDmitriev/JHelper * @author tatsumack */ #include <fstream> #include <iostream> #include <bits/stdc++.h> #define int long long #define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i) #define FOR(i, a, b) for (int i = (a), i##_len = (...
/** * code generated by JHelper * More info: https://github.com/AlexeyDmitriev/JHelper * @author tatsumack */ #include <fstream> #include <iostream> #include <bits/stdc++.h> #define int long long #define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i) #define FOR(i, a, b) for (int i = (a), i##_len = (...
[["+", 8, 123, 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
386
N = int(input()) if N == 2: print(1) exit() ans = 0 def factorization(n): lis = [] if n % 2 == 0: c = 0 while n%2 == 0: n //= 2 c += 1 lis.append([2, c]) k = 3 while k*k <= n: if n%k == 0: c = 0 while n%k == 0: n //= k c += 1 lis.append([k, c...
N = int(input()) if N == 2: print(1) exit() ans = 0 def factorization(n): lis = [] if n % 2 == 0: c = 0 while n%2 == 0: n //= 2 c += 1 lis.append([2, c]) k = 3 while k*k <= n: if n%k == 0: c = 0 while n%k == 0: n //= k c += 1 lis.append([k, c...
[["-", 0, 656, 0, 14, 8, 196, 0, 52, 0, 89], ["+", 0, 14, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 14, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 656, 0, 14, 8, 196, 0, 52, 0, 89], ["+", 8, 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], ["-", 8, ...
5
305
#include <iostream> using namespace std; int64_t solve(int64_t n, int64_t k) { while (n % k == 0) { n /= k; } return n % k == 1; } int main() { int64_t n, result = 0; cin >> n; for (int64_t d = 2; d * d <= n; ++d) { if (n % d == 0) { if (d > 1) { result += solve(n, d); } ...
#include <iostream> using namespace std; int64_t solve(int64_t n, int64_t k) { while (n % k == 0) { n /= k; } return n % k == 1; } int main() { int64_t n, result = 0; cin >> n; for (int64_t d = 1; d * d <= n; ++d) { if (n % d == 0) { if (d > 1) { result += solve(n, d); } ...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
183
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rrep(ri, n) for (int ri = (int)(n - 1); ri >= 0; ri--) #define rep2(i, x, n) for (int i = (int)(x); i < (int)(n); i++) #define repit(itr, x) for (auto itr = x.begin(); itr != x.end(); itr++) #define rrepit(ritr, x) for (auto ritr = x....
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rrep(ri, n) for (int ri = (int)(n - 1); ri >= 0; ri--) #define rep2(i, x, n) for (int i = (int)(x); i < (int)(n); i++) #define repit(itr, x) for (auto itr = x.begin(); itr != x.end(); itr++) #define rrepit(ritr, x) for (auto ritr = x....
[["+", 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, 60], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22]]
1
260
N = int(input()) A = [] B = [] for i in range(2,int(N**0.5)+1): if N%i==0: A.append(i) A.append(N//i) if (N-1)%i==0: B.append(i) B.append((N-1)//i) A.append(N) B.append(N-1) A = sorted(A) for a in A: m = 1 while True: if a**m==N: B.append(a) ...
N = int(input()) A = [] B = [] for i in range(2,int(N**0.5)+1): if N%i==0: A.append(i) A.append(N//i) if (N-1)%i==0: B.append(i) B.append((N-1)//i) A.append(N) if N>2: B.append(N-1) A = sorted(A) for a in A: m = 1 while True: if a**m==N: B.append(a...
[["+", 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, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 612], ["+", 36, 36, 36, 36, 0, 656, 0, 57, 0, 102]]
5
208
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i) #define rep2(i, x, n) for (ll i = x, i##_len = (n); i < i##_len; ++i) #define all(n) begin(n), end(n) using ll = long long; using P = pair<ll, ll>; using vi = vector<int>; using vl = vector<ll>; using vs = ve...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i) #define rep2(i, x, n) for (ll i = x, i##_len = (n); i < i##_len; ++i) #define all(n) begin(n), end(n) using ll = long long; using P = pair<ll, ll>; using vi = vector<int>; using vl = vector<ll>; using vs = ve...
[["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 20], ["+", 0, 52, 15, 339, 51, 16, 31, 16, 17, 109], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 12, 13]]
1
269
#include <bits/stdc++.h> using namespace std; // type alias typedef long long LL; typedef pair<int, int> II; typedef tuple<int, int, int> III; typedef vector<int> VI; typedef vector<string> VS; typedef unordered_map<int, int> MAPII; typedef unordered_set<int> SETI; template <class T> using VV = vector<vector<T>>; // mi...
#include <bits/stdc++.h> using namespace std; // type alias typedef long long LL; typedef pair<int, int> II; typedef tuple<int, int, int> III; typedef vector<int> VI; typedef vector<string> VS; typedef unordered_map<int, int> MAPII; typedef unordered_set<int> SETI; template <class T> using VV = vector<vector<T>>; // mi...
[["-", 51, 218, 49, 185, 54, 55, 0, 56, 39, 40], ["+", 51, 218, 49, 185, 54, 55, 0, 56, 39, 78]]
1
681
#include <stdio.h> int factorize(long long n, long long p[], int m[]) { int k; long long i; for (i = 2, k = 0; i * i <= n; i++) { if (n % i != 0) continue; p[k] = i; for (m[k] = 0; n % p[k] == 0; m[k]++, n /= p[k]) ; k++; } if (n > 1) { p[k] = n; m[k++] = 1; } return k...
#include <stdio.h> int factorize(long long n, long long p[], int m[]) { int k; long long i; for (i = 2, k = 0; i * i <= n; i++) { if (n % i != 0) continue; p[k] = i; for (m[k] = 0; n % p[k] == 0; m[k]++, n /= p[k]) ; k++; } if (n > 1) { p[k] = n; m[k++] = 1; } return k...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
305
#include <algorithm> #include <deque> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unordered_map> #include <utility> #include <vector> bool can1(long long n, long long k) { if (n % k == 0) ...
#include <algorithm> #include <deque> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unordered_map> #include <utility> #include <vector> bool can1(long long n, long long k) { if (n % k == 0) ...
[["-", 64, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 12, 22]]
1
322
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; // const ll MOD = 1000000007; const ll MOD = 998244353; const ll INF = MOD * MOD; struct mint { ll x; mint(ll x = 0) : x((x % MOD + MOD) % MOD) {} mint operator-() const { return mint(-x); } mint &operator+=(const mint...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; // const ll MOD = 1000000007; const ll MOD = 998244353; const ll INF = MOD * MOD; struct mint { ll x; mint(ll x = 0) : x((x % MOD + MOD) % MOD) {} mint operator-() const { return mint(-x); } mint &operator+=(const mint...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 146], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 147]]
1
10,183
package main import ( "bufio" "fmt" "os" "strconv" ) const ( initialBufSize = 100000 maxBufSize = 10000000 ) var ( sc = bufio.NewScanner(os.Stdin) wt = bufio.NewWriter(os.Stdout) ) func next() string { sc.Scan() return sc.Text() } func nextInt() int { i, _ := strconv.Atoi(next()) return i } func p...
package main import ( "bufio" "fmt" "os" "strconv" ) const ( initialBufSize = 100000 maxBufSize = 10000000 ) var ( sc = bufio.NewScanner(os.Stdin) wt = bufio.NewWriter(os.Stdout) ) func next() string { sc.Scan() return sc.Text() } func nextInt() int { i, _ := strconv.Atoi(next()) return i } func p...
[["+", 0, 434, 0, 435, 8, 196, 0, 57, 0, 121], ["+", 0, 435, 8, 196, 0, 57, 15, 16, 31, 22], ["+", 0, 435, 8, 196, 0, 57, 15, 16, 17, 47], ["+", 0, 435, 8, 196, 0, 57, 15, 16, 12, 433], ["+", 0, 435, 8, 196, 0, 57, 64, 196, 0, 45], ["+", 0, 435, 8, 196, 0, 57, 64, 196, 0, 165], ["+", 0, 435, 8, 196, 0, 57, 64, 196, 0, ...
7
313
package main import ( "bufio" "fmt" "io" "os" "strconv" ) const mod = 2 << 60 const facNum = 300001 const INF = 2 << 60 func main() { sc := newScanner(os.Stdin) N := sc.i() n := N - 1 // answer [n-1, n]の分 ans := 2 if N == 2 { fmt.Println(1) return } for i := 2; i*i <= n; i++ { if n%i == 0 { an...
package main import ( "bufio" "fmt" "io" "os" "strconv" ) const mod = 2 << 60 const facNum = 300001 const INF = 2 << 60 func main() { sc := newScanner(os.Stdin) N := sc.i() n := N - 1 // answer [n-1, n]の分 ans := 2 if N == 2 { fmt.Println(1) return } for i := 2; i*i <= n; i++ { if n%i == 0 { an...
[["-", 0, 465, 8, 196, 0, 431, 12, 432, 0, 22], ["+", 0, 465, 8, 196, 0, 431, 12, 432, 0, 22], ["-", 8, 196, 0, 7, 0, 16, 31, 16, 31, 22], ["+", 8, 196, 0, 7, 0, 16, 31, 16, 31, 22]]
7
684
def resolve(): def make_divisors(n): divisors = [] for i in range(1, int(n ** 0.5) + 1): if n % i == 0: # divisors.append((i, n // i)) # [(1,max), (2, max-1)] divisors += [i,n // i] # [1,2,3,5] divisors.sort() return divisors N = int...
def resolve(): def make_divisors(n): divisors = [] for i in range(1, int(n ** 0.5) + 1): if n % i == 0: # divisors.append((i, n // i)) # [(1,max), (2, max-1)] divisors += [i,n // i] # [1,2,3,5] divisors.sort() return divisors N = int...
[["+", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
140
N = int(input()) def cd(n): ls = [] for i in range(1,int(n**(1/2))+1): if n % i == 0: ls += [i, n//i] return ls ans = len(cd(N-1)) - 1 for j in cd(N): a = N if not j == 1: while a % j == 0: a //= j if a % j == 1: ans += 1 print(ans)
N = int(input()) def cd(n): ls = [] for i in range(1,int(n**(1/2))+1): if n % i == 0: ls += [i, n//i] return ls ans = len(set(cd(N-1))) - 1 for j in set(cd(N)): a = N if not j == 1: while a % j == 0: a //= j if a % j == 1: ans += 1 print(ans)
[["+", 12, 657, 31, 652, 3, 4, 0, 652, 63, 22], ["+", 31, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25], ["+", 36, 36, 0, 656, 0, 7, 12, 652, 63, 22], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 24], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
111
#include <bits/stdc++.h> using namespace std; int main() { long long int n; cin >> n; vector<long long int> div1; for (long long int i = 1; i * i <= n - 1; i++) { if ((n - 1) % i == 0) { div1.push_back(i); long long int j = (n - 1) / i; if (j != i) div1.push_back(j); } } ...
#include <bits/stdc++.h> using namespace std; int main() { long long int n; cin >> n; vector<long long int> div1; for (long long int i = 1; i * i <= n - 1; i++) { if ((n - 1) % i == 0) { div1.push_back(i); long long int j = (n - 1) / i; if (j != i) div1.push_back(j); } } ...
[["+", 0, 7, 8, 9, 0, 43, 39, 86, 0, 96]]
1
243
#include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for (int i = int(a); i < int(b); i++) typedef long long ll; typedef pair<ll, ll> P; int main() { ll n; cin >> n; if (n == 2) { cout << 2 << endl; return 0; } ll an = 2; for (ll i = 2; i * i <= n; i++) { ll N = n; if (N % i !...
#include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for (int i = int(a); i < int(b); i++) typedef long long ll; typedef pair<ll, ll> P; int main() { ll n; cin >> n; if (n == 2) { cout << 1 << endl; return 0; } ll an = 2; for (ll i = 2; i * i <= n; i++) { ll N = n; if (N % i !...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13]]
1
181
// g++ -std=c++11 a.cpp #include <algorithm> #include <assert.h> #include <bitset> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <sstream> #include <stack> #include <string> #include <typeinfo> #incl...
// g++ -std=c++11 a.cpp #include <algorithm> #include <assert.h> #include <bitset> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <sstream> #include <stack> #include <string> #include <typeinfo> #incl...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
531
#include <bits/stdc++.h> using namespace std; /* typedef */ typedef long long ll; typedef pair<int, int> pii; /* constant */ const int INF = 1 << 30; const ll LINF = 1LL << 50; const int NIL = -1; const int MAX = 10000; const int mod = 1000000007; const double pi = 3.141592653589; /* global variables */ vector<ll> div(...
#include <bits/stdc++.h> using namespace std; /* typedef */ typedef long long ll; typedef pair<int, int> pii; /* constant */ const int INF = 1 << 30; const ll LINF = 1LL << 50; const int NIL = -1; const int MAX = 10000; const int mod = 1000000007; const double pi = 3.141592653589; /* global variables */ vector<ll> div(...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
245
import sys def solve(): input = sys.stdin.readline N = int(input()) if N == 2: print(1) else: K = {N, N-1} for i in range(2, N + 1): if i ** 2 > N: break if N % i == 0: k = N while k % i == 0: k //= i ...
import sys def solve(): input = sys.stdin.readline N = int(input()) if N == 2: print(1) else: K = {N, N-1} for i in range(2, N + 1): if i ** 2 > N: break if N % i == 0: k = N while k % i == 0: k //= i ...
[["-", 64, 196, 0, 1, 0, 677, 12, 282, 0, 22], ["+", 64, 196, 0, 1, 0, 677, 12, 282, 0, 22]]
5
149
def make_divisors(n): lower_divisors , upper_divisors = [], [] i = 1 while i*i <= n: if n % i == 0: lower_divisors.append(i) if i != n // i: upper_divisors.append(n//i) i += 1 return lower_divisors + upper_divisors[::-1] n = int(input()) tmp = ...
def make_divisors(n): lower_divisors, upper_divisors = [], [] i = 1 while i*i <= n: if n % i == 0: lower_divisors.append(i) if i != n // i: upper_divisors.append(n//i) i += 1 return lower_divisors + upper_divisors[::-1] n = int(input()) tmp = n ...
[["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22]]
5
142
#include <bits/stdc++.h> #define pb push_back #define mp make_pair #define forn(i, a, b) for (int i = a; i < b; i++) #define fi first #define se second #define fast ios_base::sync_with_stdio(false); using namespace std; typedef long long int ll; typedef vector<ll> vi; typedef pair<int, int> pii; typedef pair<ll, ll> p...
#include <bits/stdc++.h> #define pb push_back #define mp make_pair #define forn(i, a, b) for (int i = a; i < b; i++) #define fi first #define se second #define fast ios_base::sync_with_stdio(false); using namespace std; typedef long long int ll; typedef vector<ll> vi; typedef pair<int, int> pii; typedef pair<ll, ll> p...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22]]
1
307
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll INF = 1e16; const ll mod = 1000000007; #define rep(i, n) for (int i = 0; i < (int)(n); i++) template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a,...
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll INF = 1e16; const ll mod = 1000000007; #define rep(i, n) for (int i = 0; i < (int)(n); i++) template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a,...
[["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 109], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
535
import itertools from collections import deque,defaultdict,Counter from itertools import accumulate import bisect from heapq import heappop,heappush,heapify import math from copy import deepcopy import queue #import numpy as np #import sympy as syp(素因数分解とか) Mod = 1000000007 def sieve_of_eratosthenes(n): if not isin...
import itertools from collections import deque,defaultdict,Counter from itertools import accumulate import bisect from heapq import heappop,heappush,heapify import math from copy import deepcopy import queue import numpy as np # sympy as syp(素因数分解とか) Mod = 1000000007 def sieve_of_eratosthenes(n): if not isinstance(...
[["+", 36, 36, 36, 36, 0, 656, 0, 596, 0, 487], ["+", 0, 656, 0, 596, 141, 704, 141, 673, 0, 22], ["+", 36, 36, 0, 656, 0, 596, 141, 704, 0, 272], ["+", 36, 36, 0, 656, 0, 596, 141, 704, 705, 22]]
5
490
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define zero_pad(num) setfill('0') << std::right << setw(num) using namespace std; using ll = long long; using ld = long double; using P = pair<int, int>; int main() { ll n; cin >> n; set<ll> ans; for (ll k = 2; k * k <= n; k++) { if ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define zero_pad(num) setfill('0') << std::right << setw(num) using namespace std; using ll = long long; using ld = long double; using P = pair<int, int>; int main() { ll n; cin >> n; set<ll> ans; for (ll k = 2; k * k <= n; k++) { if ...
[["+", 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
258
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) typedef long long ll; vector<long long> divisor(long long n) { vector<long long> ret; for (long long i = 1; i * i <= n; i++) { if (n % i == 0) { ret.push_back(i); if (i * i != n) ret.push_back(n / ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) typedef long long ll; vector<long long> divisor(long long n) { vector<long long> ret; for (long long i = 1; i * i <= n; i++) { if (n % i == 0) { ret.push_back(i); if (i * i != n) ret.push_back(n / ...
[["-", 0, 30, 0, 14, 8, 9, 0, 338, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 338, 39, 78], ["+", 0, 338, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 338, 8, 9, 0, 57, 64, 9, 0, 46]]
1
225
#include <bits/stdc++.h> #include <iostream> #include <string> #define ll long long int #define ld long double #define pb push_back #define mp make_pair #define M 1000000007 #define all(v) v.begin(), v.end() #define fr(a, b, c) for (ll i = a; i <= b; i += c) #define inarr(arr, n) ...
#include <bits/stdc++.h> #include <iostream> #include <string> #define ll long long int #define ld long double #define pb push_back #define mp make_pair #define M 1000000007 #define all(v) v.begin(), v.end() #define fr(a, b, c) for (ll i = a; i <= b; i += c) #define inarr(arr, n) ...
[["-", 75, 76, 0, 9, 0, 7, 15, 16, 12, 13], ["+", 75, 76, 0, 9, 0, 7, 15, 16, 12, 22]]
1
453
// Problem : F - Division or Subtraction // Contest : AtCoder - AtCoder Beginner Contest 161 // URL : https://atcoder.jp/contests/abc161/tasks/abc161_f // Memory Limit : 1024 MB // Time Limit : 2000 ms // Powered by CP Editor (https://github.com/cpeditor/cpeditor) #include <bits/stdc++.h> using namespace std; #define...
// Problem : F - Division or Subtraction // Contest : AtCoder - AtCoder Beginner Contest 161 // URL : https://atcoder.jp/contests/abc161/tasks/abc161_f // Memory Limit : 1024 MB // Time Limit : 2000 ms // Powered by CP Editor (https://github.com/cpeditor/cpeditor) #include <bits/stdc++.h> using namespace std; #define...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
297
#include <bits/stdc++.h> using namespace std; using ll = long long; using vi = vector<int>; using vvi = vector<vi>; using vl = vector<ll>; using vvl = vector<vl>; using pii = pair<int, int>; using pll = pair<ll, ll>; using vpii = vector<pii>; using vpll = vector<pll>; #define rep(i, n) for (int i = 0; i < (int)n; i++)...
#include <bits/stdc++.h> using namespace std; using ll = long long; using vi = vector<int>; using vvi = vector<vi>; using vl = vector<ll>; using vvl = vector<vl>; using pii = pair<int, int>; using pll = pair<ll, ll>; using vpii = vector<pii>; using vpll = vector<pll>; #define rep(i, n) for (int i = 0; i < (int)n; i++)...
[["-", 0, 30, 0, 14, 8, 9, 0, 338, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 338, 39, 78], ["-", 8, 9, 0, 338, 8, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 338, 8, 9, 0, 43, 39, 78]]
1
277
require "prime" # n - 1 の約数で、1以外であれば題意を満たす def solve_1(n) Prime.prime_division(n-1).map(&:last).map(&:succ).inject(:*)-1 end # nの約数について、割りきれなくなるまで破った後、mod==1なら題意を満たす # また、n,n-1の両方に含まれる約数は無い def solve_2(n) a = [] 1.upto(n) do |i| break if i*i > n if n % i == 0 a << i a << n/i if i != n/i ...
require "prime" # n - 1 の約数で、1以外であれば題意を満たす def solve_1(n) Prime.prime_division(n-1).map(&:last).map(&:succ).inject(1,:*)-1 end # nの約数について、割りきれなくなるまで破った後、mod==1なら題意を満たす # また、n,n-1の両方に含まれる約数は無い def solve_2(n) a = [] 1.upto(n) do |i| break if i*i > n if n % i == 0 a << i a << n/i if i != n/i ...
[["+", 8, 736, 0, 738, 31, 652, 3, 4, 0, 612], ["+", 8, 736, 0, 738, 31, 652, 3, 4, 0, 21]]
4
148
#include <algorithm> #include <assert.h> #include <climits> #include <cmath> #include <iostream> #include <queue> #include <unordered_map> #include <unordered_set> #include <vector> using namespace std; constexpr int64_t MOD = 1e9 + 7; void update_divs(unordered_set<int64_t> &dividents, int64_t tmp) { vector<int64_t...
#include <algorithm> #include <assert.h> #include <climits> #include <cmath> #include <iostream> #include <queue> #include <unordered_map> #include <unordered_set> #include <vector> using namespace std; constexpr int64_t MOD = 1e9 + 7; void update_divs(unordered_set<int64_t> &dividents, int64_t tmp) { vector<int64_t...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
427
#include <algorithm> #include <bitset> #include <cmath> #include <iomanip> //double精度 setprecision #include <iostream> #include <map> #include <numeric> //lcm #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) #defi...
#include <algorithm> #include <bitset> #include <cmath> #include <iomanip> //double精度 setprecision #include <iostream> #include <map> #include <numeric> //lcm #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) #defi...
[["-", 0, 30, 0, 14, 8, 9, 0, 338, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 338, 39, 78]]
1
426
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for (int i = 1; i < (int)(n); i++) #define all(x) (x).begin(), (x).end() #define m0(x) memset(x, 0, sizeof(x)) ll N, K; int main() { cin >> N; ll ans = 0; K = 2; ll tmp = N; while (K <= sqrt(N)) { N = tmp; while (t...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for (int i = 1; i < (int)(n); i++) #define all(x) (x).begin(), (x).end() #define m0(x) memset(x, 0, sizeof(x)) ll N, K; int main() { cin >> N; ll ans = 0; K = 2; ll tmp = N; while (K <= sqrt(tmp)) { N = tmp; while ...
[["-", 15, 339, 51, 16, 12, 2, 3, 4, 0, 22], ["+", 15, 339, 51, 16, 12, 2, 3, 4, 0, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
177
#include <bits/stdc++.h> using namespace std; int fp; long long n; vector<long long> g(long long a) { vector<long long> dr; for (long long i = 2; i * i <= a; ++i) { if (a % i == 0) { dr.push_back(i); if (a / i != i) dr.push_back(a / i); } } dr.push_back(a); return dr; } int main...
#include <bits/stdc++.h> using namespace std; int fp; long long n; vector<long long> g(long long a) { vector<long long> dr; for (long long i = 2; i * i <= a; ++i) { if (a % i == 0) { dr.push_back(i); if (a / i != i) dr.push_back(a / i); } } if (a > 1) dr.push_back(a); return ...
[["+", 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
195
def divisors(n): divisors = [] for i in range(1, int(n**0.5)+1): if n%i == 0: divisors.append(i) if i != n//i: divisors.append(n//i) return sorted(divisors) n = int(input()) ans = len(divisors(n-1))-1; for k in divisors(N)[1:]: boz = n while (n % k ==...
def divisors(n): divisors = [] for i in range(1, int(n**0.5)+1): if n%i == 0: divisors.append(i) if i != n//i: divisors.append(n//i) return sorted(divisors) n = int(input()) ans = len(divisors(n-1))-1; for k in divisors(n)[1:]: boz = n while (n % k ==...
[["-", 0, 7, 12, 206, 51, 652, 3, 4, 0, 22], ["+", 0, 7, 12, 206, 51, 652, 3, 4, 0, 22]]
5
130
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) #define repn(i, n) for (int i = 1; i <= n; i++) #define LL long long #define pii pair<LL, LL> #define fi first #define se second #define pb push_back #define mpr make_pair using namespace std; const LL MOD = 1e9 + 7; LL n, ans = 0; vector<pii> v...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) #define repn(i, n) for (int i = 1; i <= n; i++) #define LL long long #define pii pair<LL, LL> #define fi first #define se second #define pb push_back #define mpr make_pair using namespace std; const LL MOD = 1e9 + 7; LL n, ans = 0; vector<pii> v...
[["+", 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
525
#include <algorithm> #include <climits> #include <cstring> #include <functional> #include <iostream> #include <utility> #include <vector> using namespace std; typedef long long LL; int main() { // freopen("1.txt", "r", stdin); int N; cin >> N; // N and N - 1 are relatively prime int res = 0; for (LL i = 2...
#include <algorithm> #include <climits> #include <cstring> #include <functional> #include <iostream> #include <utility> #include <vector> using namespace std; typedef long long LL; int main() { // freopen("1.txt", "r", stdin); LL N; cin >> N; // N and N - 1 are relatively prime int res = 0; for (LL i = 2;...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
175
#include <bits/stdc++.h> using namespace std; using LL = long long; constexpr int MAXN = 2e5 + 5; template <typename T> inline void read(T &x) { int f = 1; x = 0; char ch = getchar(); while (!isdigit(ch)) f = (ch == '-') ? -1 : 1, ch = getchar(); while (isdigit(ch)) x = x * 10 + ch - 48, ch = getch...
#include <bits/stdc++.h> using namespace std; using LL = long long; constexpr int MAXN = 2e5 + 5; template <typename T> inline void read(T &x) { int f = 1; x = 0; char ch = getchar(); while (!isdigit(ch)) f = (ch == '-') ? -1 : 1, ch = getchar(); while (isdigit(ch)) x = x * 10 + ch - 48, ch = getch...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 1, 0, 34, 31, 27, 17, 29], ["+", 8, 9, 0, 1, 0, 34, 31, 27, 17, 68]]
1
343
#include <bits/stdc++.h> using namespace std; #ifndef __TOPCYBERFLOWER #define debug(...) 0 #else #define debug(...) cout << " [-] ", _dbg(#__VA_ARGS__, __VA_ARGS__) template <class TH> void _dbg(const char *sdbg, TH h) { cout << sdbg << '=' << h << endl; } template <class TH, class... TA> void _dbg(const char *sdbg...
#include <bits/stdc++.h> using namespace std; #ifndef __TOPCYBERFLOWER #define debug(...) 0 #else #define debug(...) cout << " [-] ", _dbg(#__VA_ARGS__, __VA_ARGS__) template <class TH> void _dbg(const char *sdbg, TH h) { cout << sdbg << '=' << h << endl; } template <class TH, class... TA> void _dbg(const char *sdbg...
[["+", 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
343
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> #include <queue> #include <string> #include <vector> using namespace std; int main() { long long n; cin >> n; long long cnt = 1; if (n > 2) cnt++; for (long long i = 2; i * i < n; i++) { if ((n - 1) % i == 0) { cnt++...
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> #include <queue> #include <string> #include <vector> using namespace std; int main() { long long n; cin >> n; long long cnt = 1; if (n > 2) cnt++; for (long long i = 2; i * i < n; i++) { if ((n - 1) % i == 0) { cnt++...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 109], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 85]]
1
167
n = int(input()) def divisior(n): a = [] i = 1 while (i*i <= n): if n%i == 0: a.append(i) if (i*i != n): a.append(n//i) i += 1 return a ans = 0 a = divisior(n).sort() for x in a[1:]: tmp = n while (tmp%x == 0): tmp = tmp//x if (tmp%x == 1) : ans +=...
n = int(input()) def divisior(n): a = [] i = 1 while (i*i <= n): if n%i == 0: a.append(i) if (i*i != n): a.append(n//i) i += 1 return a ans = 0 a = divisior(n) for x in a[1:]: tmp = n while (tmp%x == 0): tmp = tmp//x if (tmp%x == 1) : ans += 1 b = ...
[["-", 0, 1, 0, 662, 12, 652, 63, 319, 0, 131], ["-", 0, 1, 0, 662, 12, 652, 63, 319, 319, 22], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]]
5
138
#include <cstdio> #include <iostream> using namespace std; typedef long long ll; typedef long double ld; #define res register const int INF = 0x3f3f3f3f; template <typename T> inline T read() { char ch = getchar(); T s = 0; int f = 1; while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getc...
#include <cstdio> #include <iostream> using namespace std; typedef long long ll; typedef long double ld; #define res register const int INF = 0x3f3f3f3f; template <typename T> inline T read() { char ch = getchar(); T s = 0; int f = 1; while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getc...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 109], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 85]]
1
381
/** * code generated by JHelper * More info: https://github.com/AlexeyDmitriev/JHelper * @author zjsdut */ #include <bits/stdc++.h> #include <iomanip> #include <iostream> struct fast_ios { fast_ios() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); std::cout << std::fixed << std::setprecisi...
/** * code generated by JHelper * More info: https://github.com/AlexeyDmitriev/JHelper * @author zjsdut */ #include <bits/stdc++.h> #include <iomanip> #include <iostream> struct fast_ios { fast_ios() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); std::cout << std::fixed << std::setprecisi...
[["-", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
1
1,165
#include <algorithm> #include <cassert> #include <climits> #include <cmath> #include <cstring> #include <functional> #include <iostream> #include <string> #include <map> #include <queue> #include <set> #include <stack> #include <unordered_map> #include <unordered_set> #include <vector> // #include <ext/pb_ds/assoc_con...
#include <algorithm> #include <cassert> #include <climits> #include <cmath> #include <cstring> #include <functional> #include <iostream> #include <string> #include <map> #include <queue> #include <set> #include <stack> #include <unordered_map> #include <unordered_set> #include <vector> // #include <ext/pb_ds/assoc_con...
[["+", 8, 9, 0, 57, 64, 9, 0, 57, 0, 121], ["+", 0, 57, 64, 9, 0, 57, 15, 339, 0, 24], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 0, 57, 64, 9, 0, 57, 15, 339, 0, 25]]
1
318
//#define _GLIBCXX_DEBUG #include "bits/stdc++.h" using namespace std; //------------------------------- Type Names -------------------------------// using i64 = int_fast64_t; using seika = string; //{akari : 1D, yukari : 2D, maki : 3D} vector template <class kizuna> using akari = vector<kizuna>; template <class yu...
//#define _GLIBCXX_DEBUG #include "bits/stdc++.h" using namespace std; //------------------------------- Type Names -------------------------------// using i64 = int_fast64_t; using seika = string; //{akari : 1D, yukari : 2D, maki : 3D} vector template <class kizuna> using akari = vector<kizuna>; template <class yu...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
411
def divisors(n): small = [] large = [] i = 1 while i * i <= n: if not n % i: small.append(i) large.append(n // i) i += 1 if small[-1] == large[-1]: large.pop() return small + large[::-1] n = int(input()) res = set(divisors(n - 1)) res.remove(1) for d in divisors(n): if d == 1: ...
def divisors(n): small = [] large = [] i = 1 while i * i <= n: if not n % i: small.append(i) large.append(n // i) i += 1 if small[-1] == large[-1]: large.pop() return small + large[::-1] n = int(input()) res = set(divisors(n - 1)) res.remove(1) for d in divisors(n): if d == 1: ...
[["-", 0, 52, 8, 196, 0, 1, 0, 677, 12, 22], ["+", 0, 52, 8, 196, 0, 1, 0, 677, 12, 22]]
5
147
def make_divisors(n): divisors = [] for i in range(1, int(n**0.5)+1): if n % i == 0: divisors.append(i) if i != n // i: divisors.append(n//i) return divisors n=int(input()) l1=make_divisors(n-1) l2=make_divisors(n)[2:] for i in l2: j=n/i while j%i==0: ...
def make_divisors(n): divisors = [] for i in range(1, int(n**0.5)+1): if n % i == 0: divisors.append(i) if i != n // i: divisors.append(n//i) return divisors n=int(input()) l1=make_divisors(n-1) l2=make_divisors(n)[2:] for i in l2: j=n/i while j%i==0: ...
[["-", 8, 196, 0, 57, 15, 679, 12, 666, 0, 22], ["+", 0, 57, 15, 679, 12, 666, 0, 657, 31, 22], ["+", 0, 57, 15, 679, 12, 666, 0, 657, 17, 85], ["+", 0, 57, 15, 679, 12, 666, 0, 657, 12, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 85],...
5
128
# 素因数分解 N=int(input()) cand=[] def check(N0,K0): if N0%K0==0: return check(int(N0/K0),K0) elif N0%K0==1: return 1 else: return 0 def check0(N0,K0): while N0%K0==0: N0=int(N0/K0) if N0%K0==1: return 1 else: return 0 # N-1の約数の数 for i in range(2,i...
# 素因数分解 N=int(input()) cand=[] def check(N0,K0): if N0%K0==0: return check(int(N0/K0),K0) elif N0%K0==1: return 1 else: return 0 def check0(N0,K0): while N0%K0==0: N0=int(N0/K0) if N0%K0==1: return 1 else: return 0 # N-1の約数の数 for i in range(2,i...
[["-", 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
266
n = int(input()) a = [n] if n != 2: a.append(n - 1) def div_(N, k): while N % k == 0: N /= k if N % k == 1: a.append(k) for k in range(2, int(n ** 0.5) + 1): if n % k == 0: div_(n,k) if k != n / k: div_(n, n // k) if (n - 1) % k == 0: a.append(k...
n = int(input()) a = [n] if n != 2: a.append(n - 1) def div_(N, k): while N % k == 0: N /= k if N % k == 1: a.append(k) for k in range(2, int(n ** 0.5) + 1): if n % k == 0: div_(n,k) if k != n / k: div_(n, n // k) if (n - 1) % k == 0: a.append(k...
[["-", 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
153
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll n, a; cin >> n; ll ans = 1; for (ll i = 2; i * i < n; i++) { if (n % i == 1) { if (i * i == n - 1) ans++; else ans += 2; } else if (n % i == 0) { a = n; while (a % i == 0) { ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll n, a; cin >> n; ll ans = 1; for (ll i = 2; i * i <= n; i++) { if (n % i == 1) { if (i * i == n - 1) ans++; else ans += 2; } else if (n % i == 0) { a = n; while (a % i == 0) { ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
132
#include <algorithm> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <queue> #include <set> #include <stdio.h> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < (int)n; i++) // n回繰り返す using namespace std; using ll = long long; using P = pair<int, int>; usin...
#include <algorithm> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <queue> #include <set> #include <stdio.h> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < (int)n; i++) // n回繰り返す using namespace std; using ll = long long; using P = pair<int, int>; usin...
[["+", 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, 47], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
270
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int64_t N; cin >> N; int res = 0; if (N == 2) { cout << 2 << '\n'; return 0; } for (int64_t i = 2; i * i < N + 1; i++) { if ((N - 1) % i == 0) { res += (i * i == N - 1 ? 1 : 2); } ...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int64_t N; cin >> N; int res = 0; if (N == 2) { cout << 1 << '\n'; return 0; } for (int64_t i = 2; i * i < N + 1; i++) { if ((N - 1) % i == 0) { res += (i * i == N - 1 ? 1 : 2); } ...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13]]
1
160
N = int(input()) divisor = [N] ans = 0 #Nの約数の列挙 for i in range(2,N+1,1): if i*i < N: if N % i == 0: divisor.append(i) divisor.append(N//i) elif i*i == N: divisor.append(i) else: break #N-1の約数の列挙 yakusuuu = [N-1] for i in range(2,N,1): if i*i < (N-1): ...
N = int(input()) divisor = [N] ans = 0 #Nの約数の列挙 for i in range(2,N+1,1): if i*i < N: if N % i == 0: divisor.append(i) divisor.append(N//i) elif i*i == N: divisor.append(i) else: break #N-1の約数の列挙 yakusuuu = [N-1] for i in range(2,N,1): if i*i < (N-1): ...
[["+", 0, 57, 75, 665, 15, 666, 0, 23, 0, 24], ["+", 75, 665, 15, 666, 0, 23, 0, 657, 17, 33], ["+", 75, 665, 15, 666, 0, 23, 0, 657, 12, 612], ["+", 0, 57, 75, 665, 15, 666, 0, 23, 0, 25]]
5
219
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define all(v) v.begin(), v.end() #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define fs first #define sc second int main(void) { ll n; cin >> n; ll ans = 1 + (n > 2); for (ll i = 2; i * i < n; i++) { if ((n ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define all(v) v.begin(), v.end() #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define fs first #define sc second int main(void) { ll n; cin >> n; ll ans = 1 + (n > 2); for (ll i = 2; i * i < n; i++) { if ((n ...
[["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 33], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
223
#include <bits/stdc++.h> #include <cmath> #include <map> #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) #define rep2(i, a, n) for (int i = a; i < n; i++) #define been(ix) (ix).begin(), (ix).end() using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<long long> vl; const ll INFL = 1e18;...
#include <bits/stdc++.h> #include <cmath> #include <map> #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) #define rep2(i, a, n) for (int i = a; i < n; i++) #define been(ix) (ix).begin(), (ix).end() using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<long long> vl; const ll INFL = 1e18;...
[["-", 8, 9, 0, 57, 64, 1, 0, 11, 17, 32], ["-", 8, 9, 0, 57, 64, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 57, 64, 1, 0, 27, 17, 68]]
1
286
n=int(input()) ans=0 nmcc=0 i=1 d=[] while i*i<n: if n%i==0: d.append(i) if i*i!=n: d.append(n//i) i+=1 for i in d: if i==1: continue tmp=n while tmp%i==0: tmp//=i tmp%=i if tmp==1: ans+=1 i=1 while i*i<(n-1): if (n-1)%i==0: nmcc+=1 if i*i!=n-1: nmcc+=1 i+=1 nm...
n=int(input()) ans=0 nmcc=0 i=1 d=[] while i*i<=n: if n%i==0: d.append(i) if i*i!=n: d.append(n//i) i+=1 for i in d: if i==1: continue tmp=n while tmp%i==0: tmp//=i tmp%=i if tmp==1: ans+=1 i=1 while i*i<=(n-1): if (n-1)%i==0: nmcc+=1 if i*i!=n-1: nmcc+=1 i+=1 ...
[["-", 36, 36, 0, 656, 0, 52, 15, 666, 667, 18], ["+", 36, 36, 0, 656, 0, 52, 15, 666, 667, 19]]
5
146
#include <bits/stdc++.h> #define slowanddetermined \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); #define debug(x) ...
#include <bits/stdc++.h> #define slowanddetermined \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); #define debug(x) ...
[["-", 15, 339, 51, 2, 3, 4, 0, 16, 17, 85], ["-", 15, 339, 51, 2, 3, 4, 0, 16, 12, 22], ["+", 15, 339, 51, 2, 3, 4, 0, 16, 31, 22], ["+", 15, 339, 51, 2, 3, 4, 0, 16, 17, 85]]
1
241
#include <bits/stdc++.h> using namespace std; #define ll long long void solve() { ll n; cin >> n; set<ll> s; s.insert(2); s.insert(n); s.insert(n - 1); for (ll i = 2; i * i <= n - 1; i++) { if ((n - 1) % i == 0) { s.insert(i); s.insert((n - 1) / i); } } for (ll i = 2; i * i <= n; ...
#include <bits/stdc++.h> using namespace std; #define ll long long void solve() { ll n; cin >> n; set<ll> s; s.insert(2); s.insert(n); if (n > 2) s.insert(n - 1); for (ll i = 2; i * i <= n - 1; i++) { if ((n - 1) % i == 0) { s.insert(i); s.insert((n - 1) / i); } } for (ll i = ...
[["+", 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
208
#include <bits/stdc++.h> using namespace std; // vector<bool> prime(1000002,true); typedef long long int ll; // void sieve(){ // for(ll i = 2;i<= 1000000;i++){ // if(prime[i]){ // for(ll j = i * i;j <= 1000000;j+=i) // prime[j] = false; // } // } // } ll no_div(ll n) { ll cnt = 0; for (ll i = 1; i *...
#include <bits/stdc++.h> using namespace std; // vector<bool> prime(1000002,true); typedef long long int ll; // void sieve(){ // for(ll i = 2;i<= 1000000;i++){ // if(prime[i]){ // for(ll j = i * i;j <= 1000000;j+=i) // prime[j] = false; // } // } // } ll no_div(ll n) { ll cnt = 0; for (ll i = 1; i *...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
183
#include <algorithm> // minmax, sort, swap #include <bitset> #include <cassert> #include <cmath> #include <cstdio> // printf, scanf #include <deque> // deque #include <functional> // function<void(int)> #include <iomanip> // cout<<setprecision(n) #include <iostream> // cin, cout, cerr #include <map> ...
#include <algorithm> // minmax, sort, swap #include <bitset> #include <cassert> #include <cmath> #include <cstdio> // printf, scanf #include <deque> // deque #include <functional> // function<void(int)> #include <iomanip> // cout<<setprecision(n) #include <iostream> // cin, cout, cerr #include <map> ...
[["+", 0, 11, 12, 2, 3, 4, 0, 16, 31, 22], ["+", 0, 11, 12, 2, 3, 4, 0, 16, 17, 85]]
1
286
#include <bits/stdc++.h> using namespace std; typedef long long LL; LL n; int check(LL p) { LL m = n; while (m % p == 0) m /= p; return m % p == 1; } int main() { cin >> n; if (n == 2) { cout << 2 << endl; return 0; } int ans = 2; for (LL i = 2; i * i <= n; i++) { if (n % i) co...
#include <bits/stdc++.h> using namespace std; typedef long long LL; LL n; int check(LL p) { LL m = n; while (m % p == 0) m /= p; return m % p == 1; } int main() { cin >> n; if (n == 2) { cout << 1 << endl; return 0; } int ans = 2; for (LL i = 2; i * i <= n; i++) { if (n % i) co...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13]]
1
181
#include <bits/stdc++.h> using namespace std; typedef long long ll; // int/long: -2,147,483,648 - 2,147,483,647 (-2^31 <= int < 2^31) // long/long long: -9,223,372,036,854,775,808 - 9,223,372,036,854,775,807 // (-2^63 <= long < 2^63) #define INF (1 << 30) // 1,073,741,824 //= 536,870,912 *2 #define MOD 1000000007 ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; // int/long: -2,147,483,648 - 2,147,483,647 (-2^31 <= int < 2^31) // long/long long: -9,223,372,036,854,775,808 - 9,223,372,036,854,775,807 // (-2^63 <= long < 2^63) #define INF (1 << 30) // 1,073,741,824 //= 536,870,912 *2 #define MOD 1000000007 ...
[["+", 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
282
#include <bits/stdc++.h> using namespace std; #define int long long signed main() { int n; cin >> n; int ans = 0; //因为k>=2,所以从2开始枚举 for (int i = 2; i * i <= n - 1; i++) { //找n-1的约数 if ((n - 1) % i == 0) { ans++; if ((n - i) / i != i) ans++; } } if (n - 1 >= 2) ans++; ...
#include <bits/stdc++.h> using namespace std; #define int long long signed main() { int n; cin >> n; int ans = 0; //因为k>=2,所以从2开始枚举 for (int i = 2; i * i <= n - 1; i++) { //找n-1的约数 if ((n - 1) % i == 0) { ans++; if ((n - 1) / i != i) ans++; } } if (n - 1 >= 2) ans++; ...
[["-", 51, 16, 31, 16, 31, 23, 0, 16, 12, 22], ["+", 51, 16, 31, 16, 31, 23, 0, 16, 12, 13]]
1
213
#coding:utf-8 import sys,os from collections import defaultdict, deque from math import gcd from math import ceil, floor sys.setrecursionlimit(10**6) write = sys.stdout.write dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in os.environ else lambda *x: 0 def main(given=sys.stdin.readline): input = la...
#coding:utf-8 import sys,os from collections import defaultdict, deque from math import gcd from math import ceil, floor sys.setrecursionlimit(10**6) write = sys.stdout.write dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in os.environ else lambda *x: 0 def main(given=sys.stdin.readline): input = la...
[["-", 0, 7, 12, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 7, 12, 652, 3, 4, 0, 652, 63, 22]]
5
312
#include <bits/stdc++.h> #define rep(i, l, r) for (register int i = l; i < r; i++) #define hrp(i, l, r) for (register int i = l; i <= r; i++) #define rev(i, r, l) for (register int i = r; i >= l; i--) #define ext(x) \ { ...
#include <bits/stdc++.h> #define rep(i, l, r) for (register int i = l; i < r; i++) #define hrp(i, l, r) for (register int i = l; i <= r; i++) #define rev(i, r, l) for (register int i = r; i >= l; i--) #define ext(x) \ { ...
[["-", 0, 57, 64, 1, 0, 2, 3, 4, 0, 13], ["+", 0, 57, 64, 1, 0, 2, 3, 4, 0, 13]]
1
468
#include <iostream> #include <numeric> #include <set> using namespace std; typedef long long ll; set<ll> divisors(ll n) { set<ll> ans; for (ll i = 2; i * i <= n; ++i) if (n % i == 0) ans.insert(i), ans.insert(n / i); ans.insert(n); return ans; } int main() { ios::sync_with_stdio(false); ll n; ...
#include <iostream> #include <numeric> #include <set> using namespace std; typedef long long ll; set<ll> divisors(ll n) { set<ll> ans; for (ll i = 2; i * i <= n; ++i) if (n % i == 0) ans.insert(i), ans.insert(n / i); if (n > 1) ans.insert(n); return ans; } int main() { ios::sync_with_stdio(f...
[["+", 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
188
def make_divisors(n): lsls=[] for i in range(1,int(n**0.5)+1): if n%i==0: lsls.append(i) if i!=n//i: lsls.append(n//i) lsls.sort() return lsls N=int(input()) ans=1 for K in range(2,int(N**0.5)+2): num=N while num%K==0: num//=K if num>...
def make_divisors(n): lsls=[] for i in range(1,int(n**0.5)+1): if n%i==0: lsls.append(i) if i!=n//i: lsls.append(n//i) lsls.sort() return lsls N=int(input()) ans=1 for K in range(2,min(N,int(N**0.5)+2)): num=N while num%K==0: num//=K ...
[["+", 0, 7, 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, 22], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
151
// warm heart, wagging tail,and a smile just for you! // ███████████ // ███╬╬╬╬╬╬╬╬╬╬███ // ███╬╬╬╬╬████╬╬╬╬╬╬███ // ...
// warm heart, wagging tail,and a smile just for you! // ███████████ // ███╬╬╬╬╬╬╬╬╬╬███ // ███╬╬╬╬╬████╬╬╬╬╬╬███ // ...
[["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 109], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
464
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define FAST_IO \ ios_base::sync_with_stdio(0); \ cin.tie(0); //#define cerr if(false)cerr #define PRINT(x) cerr << "\n" << (#x) << " is ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define FAST_IO \ ios_base::sync_with_stdio(0); \ cin.tie(0); //#define cerr if(false)cerr #define PRINT(x) cerr << "\n" << (#x) << " is ...
[["-", 0, 52, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["-", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
1
362
/* Mbak Sana Dong Mbak Chaeyoung Dong */ #include <bits/stdc++.h> #define ll long long int using namespace std; int main() { int n, i, j, k, x, y, ans, temp, curr, m; int tc; ll now; cin >> now; set<ll> s; s.insert(now); if (now == 2) { cout << "1" << endl; return 0; } ll chaeng = now ...
/* Mbak Sana Dong Mbak Chaeyoung Dong */ #include <bits/stdc++.h> #define ll long long int using namespace std; int main() { int n, i, j, k, x, y, ans, temp, curr, m; int tc; ll now; cin >> now; set<ll> s; s.insert(now); if (now == 2) { cout << "1" << endl; return 0; } ll chaeng = now ...
[["-", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
1
222
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <vector> #define ri register #define inf 0x7fffffff #define E (1) #define mk make_pair #define int long long using namespace std; const int N = 3000010;...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <vector> #define ri register #define inf 0x7fffffff #define E (1) #define mk make_pair #define int long long using namespace std; const int N = 3000010;...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 140], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60]]
1
409
// // division_subtraction.cpp // learningCplusplus // // Created by Tran Duc Chinh on 2020/04/04. // Copyright © 2020 Tran Duc Chinh. All rights reserved. // #include <iostream> #include <math.h> #include <string> #include <vector> using namespace std; int countDivisors(const long n) { int cnt = 0; for (int ...
// // division_subtraction.cpp // learningCplusplus // // Created by Tran Duc Chinh on 2020/04/04. // Copyright © 2020 Tran Duc Chinh. All rights reserved. // #include <iostream> #include <math.h> #include <string> #include <vector> using namespace std; int countDivisors(const long n) { int cnt = 0; for (int ...
[["-", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["+", 8, 9, 0, 7, 10, 43, 39, 86, 0, 96], ["-", 8, 9, 0, 57, 64, 9, 0, 43, 39, 40], ["+", 0, 57, 64, 9, 0, 43, 39, 86, 0, 96]]
1
237
#include <algorithm> #include <bits/stdc++.h> #include <functional> #include <iostream> #include <math.h> #include <string> using namespace std; typedef long long ll; #define pb pushback #define fr(i, n) for (int i = 0; i < n; i++) #define fro(i, j, n) for (int i = j; i < n; i++) #define ifr(i, n) for (int i = n - 1; i...
#include <algorithm> #include <bits/stdc++.h> #include <functional> #include <iostream> #include <math.h> #include <string> using namespace std; typedef long long ll; #define pb pushback #define fr(i, n) for (int i = 0; i < n; i++) #define fro(i, j, n) for (int i = j; i < n; i++) #define ifr(i, n) for (int i = n - 1; i...
[["+", 15, 339, 51, 16, 31, 16, 31, 2, 63, 22], ["+", 51, 16, 31, 16, 31, 2, 3, 4, 0, 24], ["+", 31, 2, 3, 4, 0, 2, 3, 4, 0, 25], ["+", 15, 339, 51, 16, 31, 16, 12, 2, 63, 22], ["+", 51, 16, 31, 16, 12, 2, 3, 4, 0, 24], ["+", 12, 2, 3, 4, 0, 2, 3, 4, 0, 25]]
1
212
#include <bits/stdc++.h> using namespace std; #define ll long long int typedef unsigned long long int ull; typedef long double ldb; #define B 1000000007 #define rep(i, a, b) for (ll i = a; i < b; i++) #define repi(i, a, b) for (ll i = b - 1; i >= a; i--) #define MT make_tuple #define G(a, b) get<a>(b) #define VI vector...
#include <bits/stdc++.h> using namespace std; #define ll long long int typedef unsigned long long int ull; typedef long double ldb; #define B 1000000007 #define rep(i, a, b) for (ll i = a; i < b; i++) #define repi(i, a, b) for (ll i = b - 1; i >= a; i--) #define MT make_tuple #define G(a, b) get<a>(b) #define VI vector...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 85], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 109], ["-", 8, 9, 0, 1, 0, 16, 12, 16, 17, 72], ["+", 8, 9, 0, 1, 0, 16, 12, 16, 17, 33]]
1
1,273
#include <bits/stdc++.h> using namespace std; #define sz(x) int(x.size()) #define pii pair<int, int> #define Task "abc" #define For(i, a, b) for (int i = (a), _b = (b); i <= b; ++i) #define Debug(X) cout << #X << " = " << X << '\n' #define All(x) (x).begin(), (x).end() #define mp make_pair typedef unsigned long long ...
#include <bits/stdc++.h> using namespace std; #define sz(x) int(x.size()) #define pii pair<int, int> #define Task "abc" #define For(i, a, b) for (int i = (a), _b = (b); i <= b; ++i) #define Debug(X) cout << #X << " = " << X << '\n' #define All(x) (x).begin(), (x).end() #define mp make_pair typedef unsigned long long ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
324
def make_divisors(n): divisors = [] for i in range(1, int(n ** 0.5) + 1): if n % i == 0: divisors.append(i) if i != n // i: divisors.append(n // i) return divisors def main(): n = int(input()) # 1回も割り算しない場合は n mod k = 1でkは(n-1)の約数 ans = len(make_...
def make_divisors(n): divisors = [] for i in range(1, int(n ** 0.5) + 1): if n % i == 0: divisors.append(i) if i != n // i: divisors.append(n // i) return divisors def main(): n = int(input()) # 1回も割り算しない場合は n mod k = 1でkは(n-1)の約数 ans = len(make_...
[["+", 8, 196, 0, 1, 0, 662, 12, 657, 17, 33], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 12, 612]]
5
136
#include "algorithm" #include "bitset" #include "cstring" #include "ctime" #include "iomanip" #include "iostream" #include "map" #include "math.h" #include "numeric" #include "queue" #include "set" #include "stack" #include "string" #include "vector" #include "ext/pb_ds/assoc_container.hpp" // Common file #include "ex...
#include "algorithm" #include "bitset" #include "cstring" #include "ctime" #include "iomanip" #include "iostream" #include "map" #include "math.h" #include "numeric" #include "queue" #include "set" #include "stack" #include "string" #include "vector" #include "ext/pb_ds/assoc_container.hpp" // Common file #include "ex...
[["+", 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
600
#include <bits/stdc++.h> using namespace std; vector<int64_t> get_divisors(int64_t n) { vector<int64_t> list; for (int64_t i = 1; i * i < n; i++) { if (n % i == 0) { list.push_back(i); if (n / i != i) list.push_back(n / i); } } return list; } int main() { int64_t N; cin >> N; ...
#include <bits/stdc++.h> using namespace std; vector<int64_t> get_divisors(int64_t n) { vector<int64_t> list; for (int64_t i = 1; i * i <= n; i++) { if (n % i == 0) { list.push_back(i); if (n / i != i) list.push_back(n / i); } } return list; } int main() { int64_t N; cin >> N; ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
172