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
// Created by CAD on 2020/4/19. #include <bits/stdc++.h> #define fi first #define se second #define inf 0x3f3f3f3f #define INF 0x7fffffffffffffff #define mst(name, value) memset(name, value, sizeof(name)) #define FOPEN freopen("C:\\Users\\14016\\Desktop\\cad.txt", "r", stdin) #define tst1(a) cout << #a << ":" << a << ...
// Created by CAD on 2020/4/19. #include <bits/stdc++.h> #define fi first #define se second #define inf 0x3f3f3f3f #define INF 0x7fffffffffffffff #define mst(name, value) memset(name, value, sizeof(name)) #define FOPEN freopen("C:\\Users\\14016\\Desktop\\cad.txt", "r", stdin) #define tst1(a) cout << #a << ":" << a << ...
[["+", 0, 16, 31, 16, 12, 16, 31, 23, 0, 24], ["+", 31, 16, 12, 16, 31, 23, 0, 16, 17, 72], ["+", 31, 16, 12, 16, 31, 23, 0, 16, 12, 22], ["+", 0, 16, 31, 16, 12, 16, 31, 23, 0, 25], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 109], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 22]]
1
289
n,k=map(int,input().split()) l=[0]*(k+1) for i in range(k): num=(k-i) if k//num==1: l[num]=1 else: ret=(k//num,n,10**9+7) for j in range(2,k//num+1): ret-=l[num*j] ret%=(10**9+7) l[num]=(ret)%(10**9+7) ans=0 for i in range(k+1): ans+=(l[i]*i)%(10**...
n,k=map(int,input().split()) l=[0]*(k+1) for i in range(k): num=(k-i) if k//num==1: l[num]=1 else: ret=pow(k//num,n,10**9+7) for j in range(2,k//num+1): ret-=l[num*j] ret%=(10**9+7) l[num]=(ret)%(10**9+7) ans=0 for i in range(k+1): ans+=(l[i]*i)%(1...
[["+", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22]]
5
162
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <stack>...
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <stack>...
[["-", 0, 43, 49, 50, 51, 4, 0, 16, 31, 22], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 31, 22]]
1
295
// #include "pch.h" #include <algorithm> #include <bitset> #include <cassert> #include <climits> #include <cmath> #include <complex> #include <ctime> #include <fstream> #include <functional> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include ...
// #include "pch.h" #include <algorithm> #include <bitset> #include <cassert> #include <climits> #include <cmath> #include <complex> #include <ctime> #include <fstream> #include <functional> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include ...
[["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 109], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 22]]
1
610
#include <bits/stdc++.h> #define ll long long using namespace std; const int MOD = 1000000007; ll modpow(ll x, ll n, ll mod) { if (n == 0) return 1; ll res = modpow(x * x % mod, n / 2, mod); if (n & 1) res = res * x % mod; return res; } int main() { int n, k; cin >> n >> k; vector<ll> dp(k + 1)...
#include <bits/stdc++.h> #define ll long long using namespace std; const int MOD = 1000000007; ll modpow(ll x, ll n, ll mod) { if (n == 0) return 1; ll res = modpow(x * x % mod, n / 2, mod); if (n & 1) res = res * x % mod; return res; } int main() { int n, k; cin >> n >> k; vector<ll> dp(k + 1)...
[["+", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 132], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35]]
1
202
Big=10**9+7 _=list(map(int,input().split(" "))) N=_[0] K=_[1] gcd_list=[0 for _ in range(K)] for i in range(K): s=K-i-1 gcd_list[s]=(pow(K//K-i, N, Big)-(sum(gcd_list[2*s+1::s+1]))%Big)%Big answer=[(x+1)*gcd_list[x]%Big for x in range(K)] print(sum(answer)%Big)
Big=10**9+7 _=list(map(int,input().split(" "))) N=_[0] K=_[1] gcd_list=[0 for _ in range(K)] for i in range(K): s=K-i-1 gcd_list[s]=(pow(K//(K-i), N, Big)-(sum(gcd_list[2*s+1::s+1]))%Big)%Big answer=[(x+1)*gcd_list[x]%Big for x in range(K)] print(sum(answer)%Big)
[["+", 31, 652, 3, 4, 0, 657, 12, 23, 0, 24], ["+", 31, 652, 3, 4, 0, 657, 12, 23, 0, 25]]
5
140
#include <bits/stdc++.h> using namespace std; //#define int long long #define all(v) (v).begin(), (v).end() #define rep(i, n) for (int i = 0; i < n; ++i) #define rep1(i, n) for (int i = 1; i < n; ++i) #define exrep(i, a, b) for (ll i = a; i < b; i++) #define out(x) cout << x << endl #define EPS (1e-7) #define gearup ...
#include <bits/stdc++.h> using namespace std; //#define int long long #define all(v) (v).begin(), (v).end() #define rep(i, n) for (int i = 0; i < n; ++i) #define rep1(i, n) for (int i = 1; i < n; ++i) #define exrep(i, a, b) for (ll i = a; i < b; i++) #define out(x) cout << x << endl #define EPS (1e-7) #define gearup ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 25]]
1
573
n, k = map(int, input().split()) mod = 10**9 + 7 s = [0 for i in range(k+1)] ret = 0 for i in range(k, 0, -1): p = int(k/i) f = pow(p, n, mod) for j in range(2, k+1): if i*j <= k: c -= s[i*j] else: break s[i] = c%mod ret = (ret + (c%mod)*i)%mod print(r...
n, k = map(int, input().split()) mod = 10**9 + 7 s = [0 for i in range(k+1)] ret = 0 for i in range(k, 0, -1): p = int(k/i) c = pow(p, n, mod) for j in range(2, k+1): if i*j <= k: c -= s[i*j] else: break s[i] = c%mod ret = (ret + (c%mod)*i)%mod print(r...
[["-", 0, 7, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 31, 22]]
5
128
mod = 10 ** 9 + 7 n, k = map(int, input().split()) otv = 0 D = [0] * (n + 1) for i in range(1, n + 1): D[i] = pow(k // i, n, mod) for i in range(k // 2, 0, -1): for j in range(i * 2, k + 1, i): D[i] -= D[j] for i in range(1, n + 1): otv = (otv + D[i] * i) % mod print(otv)
mod = 10 ** 9 + 7 n, k = map(int, input().split()) otv = 0 D = [0] * (k + 1) for i in range(1, k + 1): D[i] = pow(k // i, n, mod) for i in range(k // 2, 0, -1): for j in range(i * 2, k + 1, i): D[i] -= D[j] for i in range(1, k + 1): otv = (otv + D[i] * i) % mod print(otv)
[["-", 0, 662, 12, 657, 12, 23, 0, 657, 31, 22], ["+", 0, 662, 12, 657, 12, 23, 0, 657, 31, 22], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 31, 22]]
5
134
#include <bits/stdc++.h> #define FAST \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); using namespace std; // long long int...
#include <bits/stdc++.h> #define FAST \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); using namespace std; // long long int...
[["+", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 31, 22], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 109], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 22], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35]]
1
494
#include <bits/stdc++.h> #define RI register int typedef long long LL; #define FILEIO(name) \ freopen(name ".in", "r", stdin), freopen(name ".out", "w", stdout); using namespace std; int const MAXN = 1e5 + 5, mod = 1e9 + 7; int f[MAXN]; inline int qpow(int...
#include <bits/stdc++.h> #define RI register int typedef long long LL; #define int LL #define FILEIO(name) \ freopen(name ".in", "r", stdin), freopen(name ".out", "w", stdout); using namespace std; int const MAXN = 1e5 + 5, mod = 1e9 + 7; int f[MAXN]; inli...
[["+", 36, 36, 36, 36, 0, 30, 0, 58, 141, 22], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 112, 0, 148]]
1
229
M = 1000000007 N, K = [int(s) for s in input().split()] A = [0] + [0 for _ in range(1, K+1)] for k in range(K, 0, -1): if k * 2 > K: A[k] = 1 else: A[k] = pow(K // k, N, M) i = 2 while k * i <= K: A[k] -= A[k * i] i += 1 S = 0 for k in range(1, K+1): ...
M = 1000000007 N, K = [int(s) for s in input().split()] A = [0] + [0 for _ in range(1, K+1)] for k in range(K, 0, -1): if k * 2 > K: A[k] = 1 else: A[k] = pow(K // k, N, M) i = 2 while k * i <= K: A[k] -= A[k * i] i += 1 S = 0 for k in range(1, K+1): ...
[["-", 0, 7, 8, 196, 0, 1, 0, 677, 17, 107], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 662, 12, 657, 31, 23, 0, 657, 31, 22], ["+", 0, 662, 12, 657, 31, 23, 0, 657, 17, 72]]
5
141
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define mp make_pair #define pb push_back #define rep(i, n) for (int i = 0; i < n; i++) #define rep1(i, n) for (int i = 1; i <= (int)(n); i++) const ll mod = 1e9 + 7; ll mu(ll a, ll b) { return (ll)a * b % mod; } ll ad(ll a, ll b) { if ((a += b) >= ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define mp make_pair #define pb push_back #define rep(i, n) for (int i = 0; i < n; i++) #define rep1(i, n) for (int i = 1; i <= (int)(n); i++) const ll mod = 1e9 + 7; ll mu(ll a, ll b) { return (ll)a * b % mod; } ll ad(ll a, ll b) { if ((a += b) >= ...
[["+", 0, 43, 49, 50, 51, 4, 0, 16, 17, 72], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13], ["-", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 7, 10, 43, 39, 78], ["-", 0, 7, 8, 9, 0, 7, 10, 43, 39, 40], ["+", 0, 7, 8, 9, 0, 7, 10, 43, 39, 78], ["-", 0, 11, 12, 2, 3, 4, 0, 16, 31, 22], ["-", 0, 11, 12, 2, 3, ...
1
323
N, K = map(int, input().split()) mod = 10**9+7 kosu_table = [0]*(K+1) i = K while i > 0: kosu_table[i] = pow(K//i, N, mod) j = 2 while i*j <= K: kosu_table[i] -= kosu_table[i*j] j += 1 i -= 1 print(sum([i*kosu_table[i] for i in range(1, K+1)]))
N, K = map(int, input().split()) mod = 10**9+7 kosu_table = [0]*(K+1) i = K while i > 0: kosu_table[i] = pow(K//i, N, mod) j = 2 while i*j <= K: kosu_table[i] -= kosu_table[i*j] j += 1 i -= 1 print(sum([i*kosu_table[i] for i in range(1, K+1)])%mod)
[["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 109], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22]]
5
109
#include <bits/stdc++.h> #define f(i, a, b) for (ll i = a; i < b; i++) #define af(i, a, b) for (ll i = a; i >= b; i--) #define rep(i, a, b, k) for (ll i = a; i < b; i += k) #define arep(i, a, b, k) for (ll i = a; i >= b; i -= k) #define ones(x) (ll) __builtin_popcount(x); #define fs first #define sc second #define pb ...
#include <bits/stdc++.h> #define f(i, a, b) for (ll i = a; i < b; i++) #define af(i, a, b) for (ll i = a; i >= b; i--) #define rep(i, a, b, k) for (ll i = a; i < b; i += k) #define arep(i, a, b, k) for (ll i = a; i >= b; i -= k) #define ones(x) (ll) __builtin_popcount(x); #define fs first #define sc second #define pb ...
[["+", 8, 9, 0, 9, 0, 1, 0, 11, 31, 22], ["+", 8, 9, 0, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 9, 0, 1, 0, 11, 12, 16, 31, 22], ["+", 0, 9, 0, 1, 0, 11, 12, 16, 17, 109], ["+", 0, 9, 0, 1, 0, 11, 12, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 9, 0, 1, 0, 35]]
1
383
#include <bits/stdc++.h> using namespace std; #define int long long const int mod = 1e9 + 7; int pow(int a, int n) { if (n == 0) { return 1; } if (n == 1) { return a; } int ans = pow(a, n / 2); ans *= ans; ans %= mod; if (n % 2) { ans *= a; ans %= mod; } return ans; } const int ...
#include <bits/stdc++.h> using namespace std; #define int long long const int mod = 1e9 + 7; int pow(int a, int n) { if (n == 0) { return 1; } if (n == 1) { return a; } int ans = pow(a, n / 2); ans *= ans; ans %= mod; if (n % 2) { ans *= a; ans %= mod; } return ans; } const int ...
[["+", 0, 16, 31, 16, 12, 16, 31, 23, 0, 24], ["+", 31, 16, 12, 16, 31, 23, 0, 16, 17, 72], ["+", 31, 16, 12, 16, 31, 23, 0, 16, 12, 22], ["+", 0, 16, 31, 16, 12, 16, 31, 23, 0, 25], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 109], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 22]]
1
219
import collections n=int(input()) s=input() c = collections.Counter(s) ans_count = c['R'] * c['G'] * c['B'] for i in range(1, (n-1)//2): for j in range(n): if j+(2*i) >= n: break if s[j] != s[j+i] and s[j+i] != s[j+(2*i)] and s[j] != s[j+(2*i)]: ans_count -= 1 print(a...
import collections n=int(input()) s=input() c = collections.Counter(s) ans_count = c['R'] * c['G'] * c['B'] for i in range(1, (n+1)//2): for j in range(n): if j+(2*i) >= n: break if s[j] != s[j+i] and s[j+i] != s[j+(2*i)] and s[j] != s[j+(2*i)]: ans_count -= 1 print(a...
[["-", 3, 4, 0, 657, 31, 23, 0, 657, 17, 33], ["+", 3, 4, 0, 657, 31, 23, 0, 657, 17, 72]]
5
135
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<long long> vll; typedef vector<pair<int, int>> vp; typedef pair<int, int> pii; #define INF (int)(1e9) #define MAXX 1.1529215e+18 #define inf 999999 #define EPS (1e-7) #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define REP(i, n)...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<long long> vll; typedef vector<pair<int, int>> vp; typedef pair<int, int> pii; #define INF (int)(1e9) #define MAXX 1.1529215e+18 #define inf 999999 #define EPS (1e-7) #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define REP(i, n)...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
448
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; char a[n]; int r = 0, b = 0, g = 0; for (int i = 0; i < n; i++) { char c; cin >> c; a[i] = c; if (c == 'R') r++; if (c == 'B') b++; if (c == 'G') g++; } long long k = 0; for (int i = 0;...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; char a[n]; int r = 0, b = 0, g = 0; for (int i = 0; i < n; i++) { char c; cin >> c; a[i] = c; if (c == 'R') r++; if (c == 'B') b++; if (c == 'G') g++; } long long k = 0; for (int i = 0;...
[["+", 12, 16, 31, 16, 31, 16, 31, 16, 31, 13], ["+", 12, 16, 31, 16, 31, 16, 31, 16, 17, 48]]
1
210
#include <bits/stdc++.h> using namespace std; template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; } template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; } // std::vector Declaration template <typen...
#include <bits/stdc++.h> using namespace std; template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; } template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; } // std::vector Declaration template <typen...
[["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78]]
1
1,291
#include <bits/stdc++.h> #include <iomanip> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; int r[4000], g[4000]; int abs(int a, int b) { return a > b ? a - b : b - a; } int main() { int n; cin >> n; string s; cin >> s; int rnum = 0, gnum...
#include <bits/stdc++.h> #include <iomanip> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; int r[4000], g[4000]; int abs(int a, int b) { return a > b ? a - b : b - a; } int main() { int n; cin >> n; string s; cin >> s; int rnum = 0, gnum...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
405
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> using namespace std; int findloc(char c) { if (c == 'R') return 0; else if (c == 'G') return 1; else return 2; } string s; int n, cnt[3]; int main() { long long sum = 0; cin >> n >> s; for (int i = 0; i < n; i++) { ...
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> using namespace std; int findloc(char c) { if (c == 'R') return 0; else if (c == 'G') return 1; else return 2; } string s; int n, cnt[3]; int main() { long long sum = 0; cin >> n >> s; for (int i = 0; i < n; i++) { ...
[["+", 0, 11, 12, 16, 31, 16, 31, 16, 31, 13], ["+", 0, 11, 12, 16, 31, 16, 31, 16, 17, 48], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 17, 48], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13]]
1
217
#include <iostream> #include <string> #include <vector> #define rep(i, n) for (long long i = 0; i < n; i++) using namespace std; using ll = long long; int main(void) { int n, ans, num = 0; cin >> n; char s[n]; vector<int> r, g, b; rep(i, n) { cin >> s[i]; if (s[i] == 'R') r.push_back(i); i...
#include <iostream> #include <string> #include <vector> #define rep(i, n) for (long long i = 0; i < n; i++) using namespace std; using ll = long long; int main(void) { ll n, ans, num = 0; cin >> n; char s[n]; vector<ll> r, g, b; rep(i, n) { cin >> s[i]; if (s[i] == 'R') r.push_back(i); if ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78], ["-", 0, 57, 64, 9, 0, 7, 10, 43, 39, 40], ["+", 0, 57, 64, 9, 0, 7, 10, 43, 39, 78], ["-", 0, 7, 8, 9, 0, 7, 10, 43, 39, 40], ["+", 0, 7, 8, 9...
1
259
#include <bits/stdc++.h> typedef long long int LL; typedef unsigned long long int ULL; using namespace std; // 插入此處 int main() { std::ios::sync_with_stdio(false); cin.tie(0); int N; cin >> N; string s; cin >> s; int R = 0, G = 0, B = 0; for (int i = 0; i < N; ++i) { switch (s[i]) { case 'R': ...
#include <bits/stdc++.h> typedef long long int LL; typedef unsigned long long int ULL; using namespace std; // 插入此處 int main() { std::ios::sync_with_stdio(false); cin.tie(0); int N; cin >> N; string s; cin >> s; int R = 0, G = 0, B = 0; for (int i = 0; i < N; ++i) { switch (s[i]) { case 'R': ...
[["+", 49, 50, 51, 16, 31, 16, 31, 16, 31, 13], ["+", 49, 50, 51, 16, 31, 16, 31, 16, 17, 48]]
1
230
n = gets.chomp.to_i s = gets.chomp r_sum = [] g_sum = [] b_sum = [] rgb = [] r = g = b = 0 s.each_char do |c| rgb << c r+=1 if c == "R" g+=1 if c == "G" b+=1 if c == "B" r_sum << r g_sum << g b_sum << b end i = 0 sum = 0 s.each_char do if s[i] == "R" sum += (g_sum[-1] - g_sum[i]) * (b_sum[-1] - ...
n = gets.chomp.to_i s = gets.chomp r_sum = [] g_sum = [] b_sum = [] rgb = [] r = g = b = 0 s.each_char do |c| rgb << c r+=1 if c == "R" g+=1 if c == "G" b+=1 if c == "B" r_sum << r g_sum << g b_sum << b end i = 0 sum = 0 s.each_char do if s[i] == "R" sum += (g_sum[-1] - g_sum[i]) * (b_sum[-1] - ...
[["+", 8, 736, 0, 121, 64, 749, 0, 662, 31, 22], ["+", 8, 736, 0, 121, 64, 749, 0, 662, 0, 32], ["+", 8, 736, 0, 121, 64, 749, 0, 662, 12, 612]]
4
398
#include <iostream> #include <map> #include <string> #include <vector> int main() { int N; std::string S; std::cin >> N >> S; std::map<char, std::vector<int>> idx_lists; idx_lists['R'] = std::vector<int>(); idx_lists['G'] = std::vector<int>(); idx_lists['B'] = std::vector<int>(); for (int i = 0; i < N...
#include <iostream> #include <map> #include <string> #include <vector> int main() { int N; std::string S; std::cin >> N >> S; std::map<char, std::vector<int>> idx_lists; idx_lists['R'] = std::vector<int>(); idx_lists['G'] = std::vector<int>(); idx_lists['B'] = std::vector<int>(); for (int i = 0; i < N...
[["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["+", 51, 218, 8, 9, 0, 43, 39, 86, 0, 96]]
1
358
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) typedef long long ll; using namespace std; int main() { int n; string s; cin >> n >> s; int r = 0; int b = 0; int g = 0; int def = 0; rep(i, n) { if (s[i] == 'R') r++; else if (s[i] == 'G') g++; else { ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) typedef long long ll; using namespace std; int main() { int n; string s; cin >> n >> s; int r = 0; int b = 0; int g = 0; int def = 0; rep(i, n) { if (s[i] == 'R') r++; else if (s[i] == 'G') g++; else { ...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 15, 16, 12, 16, 12, 16, 31, 23, 0, 24], ["+", 12, 16, 12, 16, 31, 23, 0, 16, 17, 33], ["+", 12, 16, 12, 16, 31, 23, 0, 16, 12, 22], ["+", 15, 16, 12, 16, 12, 16, 31, 23, 0, 25]]
1
457
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define rep1(i, n) for (int i = 1; i < n + 1; i++) #define sort(A) sort(A.begin(), A.end()) #define reverse(A) reverse(A.begin(), A.end()); #define vecmin(A) *min_element(A.begin(), A.end()); #define vecmax(A) *max_element(A.beg...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define rep1(i, n) for (int i = 1; i < n + 1; i++) #define sort(A) sort(A.begin(), A.end()) #define reverse(A) reverse(A.begin(), A.end()); #define vecmin(A) *min_element(A.begin(), A.end()); #define vecmax(A) *max_element(A.beg...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
241
#include <algorithm> #include <cmath> #include <iostream> #include <numeric> #include <string> #include <unordered_map> #include <vector> using namespace std; using ll = long long; void _cin() {} template <class Head, class... Tail> void _cin(Head &&head, Tail &&...tail) { cin >> head; _cin(forward<Tail>(tail)......
#include <algorithm> #include <cmath> #include <iostream> #include <numeric> #include <string> #include <unordered_map> #include <vector> using namespace std; using ll = long long; void _cin() {} template <class Head, class... Tail> void _cin(Head &&head, Tail &&...tail) { cin >> head; _cin(forward<Tail>(tail)......
[["+", 49, 50, 51, 16, 31, 16, 31, 74, 0, 24], ["+", 51, 16, 31, 16, 31, 74, 39, 77, 39, 78], ["+", 49, 50, 51, 16, 31, 16, 31, 74, 0, 25]]
1
574
#include <array> #include <iostream> #include <string> using namespace std; int main() { int n; string s; cin >> n; cin >> s; array<int, 3> count{}; for (auto &e : s) { if (e == 'R') { ++count[0]; } else if (e == 'G') { ++count[1]; } else if (e == 'B') { ++count[2]; } }...
#include <array> #include <iostream> #include <string> using namespace std; int main() { int n; string s; cin >> n; cin >> s; array<long long, 3> count{}; for (auto &e : s) { if (e == 'R') { ++count[0]; } else if (e == 'G') { ++count[1]; } else if (e == 'B') { ++count[2]; ...
[["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 39, 344, 3, 347, 0, 77, 39, 86, 0, 96]]
1
209
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll INF = 1e18; ll MOD = 1e9 + 7; int main() { int N; cin >> N; string S; cin >> S; map<char, int> M; for (auto ch : S) M[ch]++; ll ans = M['R'] * M['G'] * M['B']; for (int s = 1; s < N; s++) { int i = 0; int j = s; int...
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll INF = 1e18; ll MOD = 1e9 + 7; int main() { ll N; cin >> N; string S; cin >> S; map<char, ll> M; for (auto ch : S) M[ch]++; ll ans = M['R'] * M['G'] * M['B']; for (int s = 1; s < N; s++) { int i = 0; int j = s; int k...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78]]
1
219
import java.util.*; public class Main { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); String S = sc.next(); sc.close(); int R = 0; int G = 0; int B = 0; for (int i = 0; i < N; i++) { char ch = S.charAt(i); if (ch == 'R'...
import java.util.*; public class Main { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); String S = sc.next(); sc.close(); long R = 0; long G = 0; long B = 0; for (int i = 0; i < N; i++) { char ch = S.charAt(i); if (ch == ...
[["-", 0, 195, 8, 196, 0, 503, 39, 506, 0, 507], ["+", 0, 195, 8, 196, 0, 503, 39, 506, 0, 96]]
3
242
#include <cstring> #include <iostream> using namespace std; typedef long long ll; bool red[4005]; bool green[4005]; bool blue[4005]; int rr[10005]; int gg[10005]; int bb[10005]; int main() { int n; cin >> n; string s; cin >> s; for (int i = 0; i < n; i++) { if (s[i] == 'R') red[i] = true; ...
#include <cstring> #include <iostream> using namespace std; typedef long long ll; bool red[10005]; bool green[10005]; bool blue[10005]; int rr[10005]; int gg[10005]; int bb[10005]; int main() { int n; cin >> n; string s; cin >> s; for (int i = 0; i < n; i++) { if (s[i] == 'R') red[i] = true; ...
[["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13]]
1
620
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < (int)(n); i++) #define REP1(i, a, b) for (int i = a; i <= (int)(b); i++) #define ALL(x) begin(x), end(x) #define PB push_back using namespace std; typedef int64_t LL; typedef vector<int> VI; typedef pair<int, int> PII; template <class T> inline bool chmax(...
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < (int)(n); i++) #define REP1(i, a, b) for (int i = a; i <= (int)(b); i++) #define ALL(x) begin(x), end(x) #define PB push_back using namespace std; typedef int64_t LL; typedef vector<int> VI; typedef pair<int, int> PII; template <class T> inline bool chmax(...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
847
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int n; string s; cin >> n >> s; int a[3][n]; a[0][n - 1] = s[n - 1] == 'R'; a[1][n - 1] = s[n - 1] == 'G'; a[2][n - 1] = s[n - 1] == 'B'; for (int i = n - 2; i >= 0; --i) { if (s[i] == 'R') { ...
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { ios::sync_with_stdio(0); cin.tie(0); int n; string s; cin >> n >> s; int a[3][n]; a[0][n - 1] = s[n - 1] == 'R'; a[1][n - 1] = s[n - 1] == 'G'; a[2][n - 1] = s[n - 1] == 'B'; for (int i = n - 2; i >= 0; --i) { if...
[["+", 36, 36, 36, 36, 0, 30, 0, 58, 0, 148], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 141, 22], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
612
/*     ∧_∧ やあ    (´・ω・`)     /     ようこそ、バーボンハウスへ。    /∇y:::::\    [ ̄]     このテキーラはサービスだから、まず飲んで落ち着いて欲しい。    |:⊃:|:::::|   |──|  ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄| うん、「また」なんだ。済まない。  ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄| ̄  仏の顔もって言うしね、謝って許してもらおうとも思っていない。  ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄/|     ∇ ∇ ∇ ∇   /./|   でも、この提出を見たとき、君は、きっと言葉では言い表せない     ┴ ┴ ┴ ┴ / /  |   「ときめき」みたいなものを感じてくれ...
/*     ∧_∧ やあ    (´・ω・`)     /     ようこそ、バーボンハウスへ。    /∇y:::::\    [ ̄]     このテキーラはサービスだから、まず飲んで落ち着いて欲しい。    |:⊃:|:::::|   |──|  ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄| うん、「また」なんだ。済まない。  ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄| ̄  仏の顔もって言うしね、謝って許してもらおうとも思っていない。  ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄/|     ∇ ∇ ∇ ∇   /./|   でも、この提出を見たとき、君は、きっと言葉では言い表せない     ┴ ┴ ┴ ┴ / /  |   「ときめき」みたいなものを感じてくれ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35]]
1
1,087
#include <algorithm> #include <bitset> #include <iomanip> #include <iostream> #include <list> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; using ll = long long; using vll = vector<long lo...
#include <algorithm> #include <bitset> #include <iomanip> #include <iostream> #include <list> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; using ll = long long; using vll = vector<long lo...
[["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22]]
1
595
#include <algorithm> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; int main() { int n; cin >> n; string s; cin >> s; long long...
#include <algorithm> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; int main() { int n; cin >> n; string s; cin >> s; long long...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19]]
1
220
n = int(input()) s = list(input()) r = 0 g = 0 b = 0 if (n==3): print(0) exit() for i in range(n): if (s[i]=="R"): r += 1 elif (s[i]=="G"): g += 1 else: b += 1 da = r*g*b count = 0 if (n%2==1): for i in range (0,n//2-1): for j in range(0,n-2*(i+1)): ...
n = int(input()) s = list(input()) r = 0 g = 0 b = 0 if (n==3): print(0) exit() for i in range(n): if (s[i]=="R"): r += 1 elif (s[i]=="G"): g += 1 else: b += 1 da = r*g*b count = 0 if (n%2==1): for i in range (0,n//2): for j in range(0,n-2*(i+1)): if...
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 33], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
293
#include <algorithm> #include <iostream> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; typedef long long ll; int main() { int n; cin >> n; string s; cin >> s; if (n < 3) { cout << 0 << endl; return 0; } int ans = 1; vector<int> dic(3); ...
#include <algorithm> #include <iostream> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; typedef long long ll; int main() { int n; cin >> n; string s; cin >> s; if (n < 3) { cout << 0 << endl; return 0; } ll ans = 1; vector<int> dic(3); ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
247
x = int(input()) s = list(input()) di = {'R':0, 'G':0, 'B':0} for i in s: di[i] += 1 c = 0 #重複を数える p = (len(s) - 3) // 2 for i in range(len(s)-2): j = 0 while(j < p + 1 and i+(2*j)<=len(s)-1): ss = s[i] + s[i+j] + s[i+(2*j)] j += 1 if ss == 'GBR'or ss == 'GRB' or ss == 'RBG' or ss ...
x = int(input()) s = list(input()) di = {'R':0, 'G':0, 'B':0} for i in s: di[i] += 1 c = 0 #重複を数える p = (len(s) - 3) / 2 for i in range(len(s)-2): j = 1 while(j <= p + 1and i+(2*j)<=len(s)-1): ss = s[i] + s[i+j] + s[i+(2*j)] j += 1 if ss == 'GBR'or ss == 'GRB' or ss == 'RBG' or ss =...
[["-", 0, 656, 0, 1, 0, 662, 12, 657, 17, 676], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 17, 85], ["-", 0, 7, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 12, 612], ["-", 0, 52, 15, 23, 0, 679, 31, 666, 667, 18], ["+", 0, 52, 15, 23, 0, 679, 31, 666, 667, 19]]
5
196
#include <bits/stdc++.h> using namespace std; /* R=0 G=1 B=2 */ int main() { int n; string ss; cin >> n >> ss; long long ans = 0; int f[402][3] = {0}; for (int i = ss.length() - 1; i >= 0; i--) { if (ss[i] == 'R') { f[i][0] = f[i + 1][0] + 1; f[i][1] = f[i + 1][1]; f[i][2] = f[i + 1][...
#include <bits/stdc++.h> using namespace std; /* R=0 G=1 B=2 */ int main() { int n; string ss; cin >> n >> ss; long long ans = 0; int f[4002][3] = {0}; for (int i = ss.length() - 1; i >= 0; i--) { if (ss[i] == 'R') { f[i][0] = f[i + 1][0] + 1; f[i][1] = f[i + 1][1]; f[i][2] = f[i + 1]...
[["-", 0, 43, 49, 50, 49, 80, 49, 80, 81, 13], ["+", 0, 43, 49, 50, 49, 80, 49, 80, 81, 13]]
1
633
#include <iostream> #include <string> #include <vector> using namespace std; int main() { int n; cin >> n; string s; cin >> s; long long answer = 0; vector<int> counter(3, 0); for (int i = 0; i < n; i++) { if (s.substr(i, 1) == "R") counter[0]++; if (s.substr(i, 1) == "G") counter...
#include <iostream> #include <string> #include <vector> using namespace std; int main() { int n; cin >> n; string s; cin >> s; long long answer = 0; vector<long long> counter(3, 0); for (int i = 0; i < n; i++) { if (s.substr(i, 1) == "R") counter[0]++; if (s.substr(i, 1) == "G") c...
[["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 39, 344, 3, 347, 0, 77, 39, 86, 0, 96]]
1
266
#include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iterator> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #pragma warning(disable : 4996) typedef long long l...
#include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iterator> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #pragma warning(disable : 4996) typedef long long l...
[["+", 49, 50, 51, 16, 31, 16, 31, 74, 0, 24], ["+", 51, 16, 31, 16, 31, 74, 39, 77, 39, 78], ["+", 49, 50, 51, 16, 31, 16, 31, 74, 0, 25]]
1
371
#include <bits/stdc++.h> using ll = long long; using namespace std; int main() { int n; string s; cin >> n >> s; /* for (int i = 0; i < n; i++) { if (i % 3 == 0) s.push_back('R'); if (i % 3 == 1) s.push_back('G'); if (i % 3 == 2) s.push...
#include <bits/stdc++.h> using ll = long long; using namespace std; int main() { int n; string s; cin >> n >> s; /* for (int i = 0; i < n; i++) { if (i % 3 == 0) s.push_back('R'); if (i % 3 == 1) s.push_back('G'); if (i % 3 == 2) s.push...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
205
#define _CRT_SECURE_NO_WARNINGS #include <algorithm> #include <cmath> #include <deque> #include <functional> #include <stdio.h> #include <stdlib.h> #include <string> #include <vector> using namespace std; typedef long long ll; #define rep(i, a, b) for (int i = a; i < b; i++) #define all(_x) _x.begin(), _x.end() #defin...
#define _CRT_SECURE_NO_WARNINGS #include <algorithm> #include <cmath> #include <deque> #include <functional> #include <stdio.h> #include <stdlib.h> #include <string> #include <vector> using namespace std; typedef long long ll; #define rep(i, a, b) for (int i = a; i < b; i++) #define all(_x) _x.begin(), _x.end() #defin...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 85], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
516
#include <algorithm> #include <algorithm> #include <array> #include <bitset> #include <cassert> #include <complex> #include <cstdio> #include <cstring> #include <functional> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <limits.h> #include <map> #include <math.h> #include <nu...
#include <algorithm> #include <algorithm> #include <array> #include <bitset> #include <cassert> #include <complex> #include <cstdio> #include <cstring> #include <functional> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <limits.h> #include <map> #include <math.h> #include <nu...
[["+", 36, 36, 0, 30, 0, 43, 39, 86, 0, 96], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
515
N = int(input()) S = input() R = 0 G = 0 B = 0 ans = 0 for i in range(N): if S[i] == 'R': R+= 1 elif S[i] =='G': G+= 1 else: B+= 1 ans = R*G*B for i in range(int(N/2)): for j in range(i,N-i): if S[j-i] != S[j] and S[j] != S[j+i] and S[j+i] != S[j-i]: ans -= 1 ...
N = int(input()) S = input() R = 0 G = 0 B = 0 ans = 0 for i in range(N): if S[i] == 'R': R+= 1 elif S[i] =='G': G+= 1 else: B+= 1 ans = R*G*B for i in range(int((N+1)/2)): for j in range(i,N-i): if S[j-i] != S[j] and S[j] != S[j+i] and S[j+i] != S[j-i]: ans -...
[["+", 0, 652, 3, 4, 0, 657, 31, 23, 0, 24], ["+", 3, 4, 0, 657, 31, 23, 0, 657, 17, 72], ["+", 3, 4, 0, 657, 31, 23, 0, 657, 12, 612], ["+", 0, 652, 3, 4, 0, 657, 31, 23, 0, 25]]
5
142
import java.util.Scanner; public class Main { @SuppressWarnings("resource") public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); String S2 = sc.next(); String S[] = S2.split(""); long ans = 0; if (N <= 3) { System.out.println(0); } el...
import java.util.Scanner; public class Main { @SuppressWarnings("resource") public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); String S2 = sc.next(); String S[] = S2.split(""); long ans = 0; if (N <= 3) { System.out.println(0); } el...
[["-", 0, 57, 75, 196, 0, 503, 39, 506, 0, 507], ["+", 0, 57, 75, 196, 0, 503, 39, 506, 0, 96]]
3
289
#include <iostream> #include <vector> using namespace std; typedef long long ll; vector<int> r, b, g; int n; string s; void getPrefs() { r = vector<int>(n, 0); b = vector<int>(n, 0); g = vector<int>(n, 0); for (int i = 0; i < n; i++) { r[i] = (i == 0) ? 0 : r[i - 1]; b[i] = (i == 0) ? 0 : b[i - 1]; ...
#include <iostream> #include <vector> using namespace std; typedef long long ll; vector<ll> r, b, g; int n; string s; void getPrefs() { r = vector<ll>(n, 0); b = vector<ll>(n, 0); g = vector<ll>(n, 0); for (int i = 0; i < n; i++) { r[i] = (i == 0) ? 0 : r[i - 1]; b[i] = (i == 0) ? 0 : b[i - 1]; g[...
[["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78], ["-", 12, 2, 63, 346, 3, 347, 0, 77, 39, 40], ["+", 12, 2, 63, 346, 3, 347, 0, 77, 39, 78], ["-", 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], ["+...
1
526
// #include <bits/stdc++.h> using namespace std; typedef long long ll; // const int INF = 2147483647; // const ll INF = 9223372036854775807; // const ll MOD = 1e9 + 7; int main() { int N; cin >> N; string S; cin >> S; int cnt_r = 0; int cnt_g = 0; int cnt_b = 0; for (int i = 0; i < N; i++) { i...
// #include <bits/stdc++.h> using namespace std; typedef long long ll; // const int INF = 2147483647; // const ll INF = 9223372036854775807; // const ll MOD = 1e9 + 7; int main() { int N; cin >> N; string S; cin >> S; ll cnt_r = 0; ll cnt_g = 0; ll cnt_b = 0; for (int i = 0; i < N; i++) { if (...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
214
#include <algorithm> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> using namespace std; int main() { int n, i, ans = 0, j, low; cin >> n; string s; cin >> s; vector<int> v[3]; for (i ...
#include <algorithm> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> using namespace std; int main() { long long int n, i, ans = 0, j, low; cin >> n; string s; cin >> s; vector<long long ...
[["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["+", 39, 344, 3, 347, 0, 77, 39, 86, 0, 96]]
1
515
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; string S; cin >> S; vector<int> R_cnt(N + 1, 0); vector<int> G_cnt(N + 1, 0); vector<int> B_cnt(N + 1, 0); for (int i = N - 1; i >= 0; i--) { if (S.at(i) == 'R') { R_cnt.at(i) = R_cnt.at(i + 1) + 1; G_cnt.at(i...
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; string S; cin >> S; vector<int> R_cnt(N + 1, 0); vector<int> G_cnt(N + 1, 0); vector<int> B_cnt(N + 1, 0); for (int i = N - 1; i >= 0; i--) { if (S.at(i) == 'R') { R_cnt.at(i) = R_cnt.at(i + 1) + 1; G_cnt.at(i...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]]
1
605
#include <iostream> #include <vector> using namespace std; int main(void) { int N, numR, numG, numB; char subS; cin >> N; vector<bool> R(N, false), G(N, false), B(N, false); numR = 0; numG = 0; numB = 0; for (int i = 0; i < N; i++) { cin >> subS; if (subS == 'R') { R[i] = true; numR...
#include <iostream> #include <vector> using namespace std; int main(void) { int N, numR, numG, numB; char subS; cin >> N; vector<bool> R(N, false), G(N, false), B(N, false); numR = 0; numG = 0; numB = 0; for (int i = 0; i < N; i++) { cin >> subS; if (subS == 'R') { R[i] = true; numR...
[["+", 49, 50, 51, 16, 31, 16, 31, 74, 0, 24], ["+", 31, 16, 31, 74, 39, 77, 39, 86, 0, 96], ["+", 49, 50, 51, 16, 31, 16, 31, 74, 0, 25]]
1
353
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int N; string S; cin >> N >> S; int res{}; vector<vector<int>> suf(N, vector<int>(3, 0)); int r{}, g{}, b{}; for (int i = N - 1; i >= 0; --i) { if (S[i] == 'R') { ++r; } else if (...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int N; string S; cin >> N >> S; int64_t res{}; vector<vector<int>> suf(N, vector<int>(3, 0)); int r{}, g{}, b{}; for (int i = N - 1; i >= 0; --i) { if (S[i] == 'R') { ++r; } else ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
1
442
n = int(input()) s = input() r_cnt = s.count('R') g_cnt = s.count('G') b_cnt = s.count('B') total = r_cnt * g_cnt * b_cnt for i in range(n // 2): for j in range(n): ptr1 = j ptr2 = j + i ptr3 = j + 2 * i if ptr3 >= n: break else: if s[ptr1] != s[ptr...
n = int(input()) s = input() r_cnt = s.count('R') g_cnt = s.count('G') b_cnt = s.count('B') total = r_cnt * g_cnt * b_cnt for i in range(n): for j in range(n): ptr1 = j ptr2 = j + i ptr3 = j + 2 * i if ptr3 >= n: break else: if s[ptr1] != s[ptr2] an...
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 676], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
129
#include <iostream> #define ll long long #define MOD 10000000007 using namespace std; const int MAXK = 1e5 + 5; ll f[MAXK], n, k; ll pow(ll a, ll n) { ll ans = 1; while (n) { if (n & 1) ans = (ans * a) % MOD; n >>= 1; a = a * a % MOD; } return ans; } int main() { cin >> n >> k; ll ans =...
#include <iostream> #define ll long long #define MOD 1000000007 using namespace std; const int MAXK = 1e5 + 5; ll f[MAXK], n, k; ll pow(ll a, ll n) { ll ans = 1; while (n) { if (n & 1) ans = (ans * a) % MOD; n >>= 1; a = a * a % MOD; } return ans; } int main() { cin >> n >> k; ll ans = ...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59]]
1
203
#include <bits/stdc++.h> using namespace std; long long mpow(long long x, int n) { long long r = 1; while (n > 0) { if (n & 1) r = r * x % 1000000007; x = x * x % 1000000007; n >>= 1; } return r; } int main() { int n, k; cin >> n >> k; long long sumg = 0; vector<long long> cntg(k); ...
#include <bits/stdc++.h> using namespace std; long long mpow(long long x, int n) { long long r = 1; while (n > 0) { if (n & 1) r = r * x % 1000000007; x = x * x % 1000000007; n >>= 1; } return r; } int main() { int n, k; cin >> n >> k; long long sumg = 0; long long cntg[100010]; f...
[["-", 0, 14, 8, 9, 0, 43, 39, 344, 141, 78], ["-", 8, 9, 0, 43, 39, 344, 3, 347, 0, 18], ["-", 8, 9, 0, 43, 39, 344, 3, 347, 0, 47], ["-", 8, 9, 0, 43, 49, 53, 54, 55, 0, 24], ["-", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["-", 8, 9, 0, 43, 49, 53, 54, 55, 0, 25], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 0, 70], ["+", 0, 14, ...
1
204
#include <bits/stdc++.h> /* #include<boost/multiprecision/cpp_int.hpp> namespace mp=boost::multiprecision; */ using namespace std; #define ll long long int #define lo mp::cpp_int #define pb push_back #define pob pop_back #define mp make_pair #define endl "\n" #define ce(x) cout << x << "\n" #define fill(s, v) memset(s,...
#include <bits/stdc++.h> /* #include<boost/multiprecision/cpp_int.hpp> namespace mp=boost::multiprecision; */ using namespace std; #define ll long long int #define lo mp::cpp_int #define pb push_back #define pob pop_back #define mp make_pair #define endl "\n" #define ce(x) cout << x << "\n" #define fill(s, v) memset(s,...
[["-", 0, 43, 49, 50, 51, 4, 0, 16, 31, 22], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 31, 22]]
1
1,879
#include <bits/stdc++.h> using namespace std; using LL = long long; using LD = long double; LL mod = 1e9 + 7; LL binpow(LL x, LL p, LL m) { LL res = 1; while (p) { if (p % 2) { res *= x; res %= m; } p >>= 1; x *= x; x %= m; } return res; } int main() { LL n, k; cin >> n ...
#include <bits/stdc++.h> using namespace std; using LL = long long; using LD = long double; LL mod = 1e9 + 7; LL binpow(LL x, LL p, LL m) { LL res = 1; while (p) { if (p % 2) { res *= x; res %= m; } p >>= 1; x *= x; x %= m; } return res; } int main() { LL n, k; cin >> n ...
[["+", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 132], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35]]
1
283
#include <bits/stdc++.h> using namespace std; const long long int mod = 1e9 + 7; long long int modpow(long long int x, long long int n) { long long int res = 1; for (; n > 0; n >>= 1) { if (n & 1) res = res * x % mod; x = x * x % mod; } return res; } long long int num[100005]; int main() { lon...
#include <bits/stdc++.h> using namespace std; const long long int mod = 1e9 + 7; long long int modpow(long long int x, long long int n) { long long int res = 1; for (; n > 0; n >>= 1) { if (n & 1) res = res * x % mod; x = x * x % mod; } return res; } long long int num[100005]; int main() { lon...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19]]
1
213
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long LL; const LL MOD = 1000000007LL; LL modpow(LL x, LL n) { LL r = 1; while (n != 0) { if (n & 1) r = r * x % MOD; x = x * x % MOD; n >>= 1; } return r; } int main() { int N, K; ...
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long LL; const LL MOD = 1000000007LL; LL modpow(LL x, LL n) { LL r = 1; while (n != 0) { if (n & 1) r = r * x % MOD; x = x * x % MOD; n >>= 1; } return r; } int main() { int N, K; ...
[["-", 0, 43, 49, 50, 51, 4, 0, 16, 31, 22], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 31, 22]]
1
198
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) typedef long long ll; typedef pair<int, int> P; const ll mod = 1000000007; const int inf = 1e9; const long long INF = 1LL << 60; // INFの値は1152921504606846976 ll pow(ll x, ll n) { // xのn乗 (mod m) ll res = 1; if (n >...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) typedef long long ll; typedef pair<int, int> P; const ll mod = 1000000007; const int inf = 1e9; const long long INF = 1LL << 60; // INFの値は1152921504606846976 ll pow(ll x, ll n) { // xのn乗 (mod m) ll res = 1; if (n >...
[["+", 0, 16, 31, 16, 12, 16, 31, 23, 0, 24], ["+", 31, 16, 12, 16, 31, 23, 0, 16, 17, 72], ["+", 31, 16, 12, 16, 31, 23, 0, 16, 12, 22], ["+", 0, 16, 31, 16, 12, 16, 31, 23, 0, 25], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 109], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 22]]
1
276
#include <bits/stdc++.h> using namespace std; #define int long long const int maxm = 1e5 + 5; const int mod = 1e9 + 7; int f[maxm]; int ppow(int a, int b, int mod) { int ans = 1 % mod; a %= mod; while (b) { if (b & 1) ans = ans * a % mod; a = a * a % mod; b >>= 1; } return ans; } signed main...
#include <bits/stdc++.h> using namespace std; #define int long long const int maxm = 1e5 + 5; const int mod = 1e9 + 7; int f[maxm]; int ppow(int a, int b, int mod) { int ans = 1 % mod; a %= mod; while (b) { if (b & 1) ans = ans * a % mod; a = a * a % mod; b >>= 1; } return ans; } signed main...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22]]
1
212
import math def pow(p,n): bin_n=bin(n)[2:][::-1] tmp=p;pn=1 for i in range(len(bin_n)): if bin_n[i]=="1": pn=(pn*tmp)%mod tmp=tmp*tmp%mod return pn mod=10**9+7 n,k=map(int,input().split()) ans=[0]*(k+1) for i in range(k,0,-1): div=set() for x in range(1,int(i**0.5)+1): ...
import math def pow(p,n): bin_n=bin(n)[2:][::-1] tmp=p;pn=1 for i in range(len(bin_n)): if bin_n[i]=="1": pn=(pn*tmp)%mod tmp=tmp*tmp%mod return pn mod=10**9+7 n,k=map(int,input().split()) ans=[0]*(k+1) for i in range(k,0,-1): div=set() for x in range(1,int(i**0.5)+1): ...
[["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 109], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22]]
5
229
#include <bits/stdc++.h> using namespace std; const int MO = 1e9 + 7; const int M = 2e5 + 5; inline int add(int x, int y) { x += y; if (x >= MO) x -= MO; return x; } inline int sub(int x, int y) { x -= y; if (x < 0) x += MO; return x; } inline int mul(int x, int y) { return 1LL * x * y % MO; } inl...
#include <bits/stdc++.h> using namespace std; const int MO = 1e9 + 7; const int M = 2e5 + 5; inline int add(int x, int y) { x += y; if (x >= MO) x -= MO; return x; } inline int sub(int x, int y) { x -= y; if (x < 0) x += MO; return x; } inline int mul(int x, int y) { return 1LL * x * y % MO; } inl...
[["+", 0, 1, 0, 2, 3, 4, 0, 2, 63, 22], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 24], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 48], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 21], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 25]]
1
537
n, k = map(int, input().split()) mod = 10**9+7 # 最大公約数がx(1 <= x <= k)な数列の数 num_gcd_k = [0]*(k+1) num_gcd_k[k] = 1 ans = 0 for i in range(k-1,0,-1): # total = ((k // i)**n)%mod total = pow(k//i,n,mod) m = 2 while i*m <= k: total -= num_gcd_k[i*m] m += 1 num_gcd_k[i] = total ans +=...
n, k = map(int, input().split()) mod = 10**9+7 # 最大公約数がx(1 <= x <= k)な数列の数 num_gcd_k = [0]*(k+1) num_gcd_k[k] = 1 ans = 0 for i in range(k,0,-1): # total = ((k // i)**n)%mod total = pow(k//i,n,mod) m = 2 while i*m <= k: total -= num_gcd_k[i*m] m += 1 num_gcd_k[i] = total ans += i...
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 33], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
111
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; long long gcd(long long a, long long b) { if (a < b) { swap(a, b); } if (a % b == 0) { return b; } return gcd(b, a % b); } long long power(long long a, long long b) { long long ans = 1; while (b) { if (b % 2) { ...
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; long long gcd(long long a, long long b) { if (a < b) { swap(a, b); } if (a % b == 0) { return b; } return gcd(b, a % b); } long long power(long long a, long long b) { long long ans = 1; while (b) { if (b % 2) { ...
[["+", 0, 52, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 52, 15, 339, 51, 16, 31, 16, 17, 48], ["-", 8, 9, 0, 52, 15, 339, 51, 16, 12, 22], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 12, 22]]
1
287
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> pi; const int MAXN = 100005; const int MOD = 1000000007; #define FOR(i, a, b) for (int i = (a); i <= (b); i++) #define DEC(i, a, b) for (int i = (a); i >= (b); i--) #define fst first #define snd second #define pb push_back #define...
#include <bits/stdc++.h> using namespace std; #define int long long typedef long long ll; typedef pair<ll, ll> pi; const int MAXN = 100005; const int MOD = 1000000007; #define FOR(i, a, b) for (int i = (a); i <= (b); i++) #define DEC(i, a, b) for (int i = (a); i >= (b); i--) #define fst first #define snd second #defin...
[["+", 36, 36, 36, 36, 0, 30, 0, 58, 0, 148], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 141, 22], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59]]
1
341
n,k=gets.split(' ').map(&:to_i) #h=gets.split(' ').map(&:to_i) #tajigen = Array.new(4) { Array.new(2,0) } #maze = h.times.map { gets.chomp } wari = Array.new(k+1) kkk=10**9+7 =begin for i in 1..k #puts i wari[i] = (k/i)**n end #puts wari =end ans=0 =begin def power2(a, n) p = 1 n.to_s(2).split('').each{|i| ...
n,k=gets.split(' ').map(&:to_i) #h=gets.split(' ').map(&:to_i) #tajigen = Array.new(4) { Array.new(2,0) } #maze = h.times.map { gets.chomp } wari = Array.new(k+1) kkk=10**9+7 =begin for i in 1..k #puts i wari[i] = (k/i)**n end #puts wari =end ans=0 =begin def power2(a, n) p = 1 n.to_s(2).split('').each{|i| ...
[["-", 0, 751, 8, 38, 0, 4, 0, 738, 17, 109], ["-", 0, 751, 8, 38, 0, 4, 0, 738, 12, 22], ["-", 196, 737, 8, 736, 0, 755, 12, 738, 17, 109], ["-", 196, 737, 8, 736, 0, 755, 12, 738, 12, 22], ["+", 0, 493, 0, 652, 3, 4, 0, 738, 17, 109], ["+", 0, 493, 0, 652, 3, 4, 0, 738, 12, 22]]
4
180
n,k=map(int,input().split()) l=[0]*(k+1) a=0 mod=10**9+7 for i in range(1,k+1): l[i]=i for j in range(i*2,k+1,i): l[j]-=l[i] a+=l[i]*pow(k//i,n,mod) print(a%mod)
n,k=map(int,input().split()) l=[0]*(k+1) a=0 mod=10**9+7 for i in range(1,k+1): l[i]+=i for j in range(i*2,k+1,i): l[j]-=l[i] a+=l[i]*pow(k//i,n,mod) print(a%mod)
[["-", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 7, 8, 196, 0, 1, 0, 677, 17, 107]]
5
103
import java.io.*; import java.util.*; public class Main { static PrintWriter out = new PrintWriter(System.out); static Scanner sc = new Scanner(System.in); static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); long mod = 1000000000 + 7; public static void main(String[] ar...
import java.io.*; import java.util.*; public class Main { static PrintWriter out = new PrintWriter(System.out); static Scanner sc = new Scanner(System.in); static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); long mod = 1000000000 + 7; public static void main(String[] ar...
[["+", 8, 196, 0, 1, 0, 11, 12, 16, 17, 109], ["+", 8, 196, 0, 1, 0, 11, 12, 16, 12, 22]]
3
292
#include <algorithm> #include <cstdio> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <string.h> #include <string> #include <vector> using namespace std; using ll = long long; using pll = pair<ll, ll>; using vl = vector<ll>; using vll = ...
#include <algorithm> #include <cstdio> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <string.h> #include <string> #include <vector> using namespace std; using ll = long long; using pll = pair<ll, ll>; using vl = vector<ll>; using vll = ...
[["+", 51, 16, 31, 23, 0, 16, 31, 23, 0, 24], ["+", 0, 16, 31, 23, 0, 16, 31, 23, 0, 24], ["+", 0, 16, 31, 23, 0, 16, 31, 23, 0, 25], ["+", 31, 23, 0, 16, 31, 23, 0, 16, 17, 109], ["+", 31, 23, 0, 16, 31, 23, 0, 16, 12, 22], ["+", 51, 16, 31, 23, 0, 16, 31, 23, 0, 25]]
1
701
#include <bits/stdc++.h> #define fi first #define se second #define rep(i, n) for (int i = 0; i < (n); ++i) #define drep(i, n) for (int i = (n)-1; i >= 0; --i) #define srep(i, s, t) for (int i = s; i < t; ++i) #define rng(a) a.begin(), a.end() #define sz(x) (int)(x).size() #define uni(x) x.erase(unique(rng(x)), x.end()...
#include <bits/stdc++.h> #define fi first #define se second #define rep(i, n) for (int i = 0; i < (n); ++i) #define drep(i, n) for (int i = (n)-1; i >= 0; --i) #define srep(i, s, t) for (int i = s; i < t; ++i) #define rng(a) a.begin(), a.end() #define sz(x) (int)(x).size() #define uni(x) x.erase(unique(rng(x)), x.end()...
[["+", 0, 43, 49, 50, 51, 4, 0, 16, 17, 72], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13]]
1
646
n,k=map(int,input().split()) dp=[0]*(k+1) mod=int(1e9+7) for i in range(k,0,-1): sm=0 for j in range(2*i,k+1,i): sm=(sm+dp[j])%mod dp[i]=pow(k//i,n,mod)-sm ans=0 for i in range(1,n+1): ans+=(dp[i]%mod*i%mod)%mod print(ans%mod)
n,k=map(int,input().split()) dp=[0]*(k+1) mod=int(1e9+7) for i in range(k,0,-1): sm=0 for j in range(2*i,k+1,i): sm=(sm+dp[j])%mod dp[i]=(pow(k//i,n,mod)-sm)%mod ans=0 for i in range(1,k+1): ans+=(dp[i]%mod*i%mod)%mod print(ans%mod)
[["+", 0, 1, 0, 662, 12, 657, 31, 23, 0, 24], ["+", 0, 1, 0, 662, 12, 657, 31, 23, 0, 25], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 17, 109], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 12, 22], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 31, 22]]
5
133
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import numpy as np MOD = 10**9 + 7 N, K = map(int, read().split()) is_prime = np.zeros(K + 10, np.bool) is_prime[2] = 1 is_prime[3::2] = 1 for p in range(3, K + 10, 2): if p * p >= K: break ...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import numpy as np MOD = 10**9 + 7 N, K = map(int, read().split()) is_prime = np.zeros(K + 10, np.bool) is_prime[2] = 1 is_prime[3::2] = 1 for p in range(3, K + 10, 2): if p * p > K: break ...
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47]]
5
230
import java.util.*; public class Main { static long mod = 1000000007; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); memo = new int[k + 1]; long res = 0; long[] num = new long[k + 1]; for (int i = k; i >= 1; i...
import java.util.*; public class Main { static long mod = 1000000007; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); memo = new int[k + 1]; long res = 0; long[] num = new long[k + 1]; for (int i = k; i >= 1; i...
[["+", 0, 7, 8, 196, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 11, 17, 132], ["+", 0, 7, 8, 196, 0, 1, 0, 11, 12, 22], ["+", 8, 196, 0, 7, 8, 196, 0, 1, 0, 35]]
3
246
#include <algorithm> #include <array> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdint> #include <cstdio> #include <cstring> #include <deque> #include <iostream> #include <iterator> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <tu...
#include <algorithm> #include <array> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdint> #include <cstdio> #include <cstring> #include <deque> #include <iostream> #include <iterator> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <tu...
[["-", 0, 43, 49, 50, 51, 4, 0, 16, 31, 22], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 31, 22]]
1
252
#include <bits/stdc++.h> #define REP(i, x) for (int i = 0, i##_len = (x); i < i##_len; ++i) #define rep(i, a, b) for (int i = (a), i##_len(b); i < i##_len; ++i) #define All(x) begin(x), end(x) #define rAll(x) rbegin(x), rend(x) using namespace std; using ll = long long; constexpr ll mod = 1e9 + 7; ll mpow(ll a, ll n) ...
#include <bits/stdc++.h> #define REP(i, x) for (int i = 0, i##_len = (x); i < i##_len; ++i) #define rep(i, a, b) for (int i = (a), i##_len(b); i < i##_len; ++i) #define All(x) begin(x), end(x) #define rAll(x) rbegin(x), rend(x) using namespace std; using ll = long long; constexpr ll mod = 1e9 + 7; ll mpow(ll a, ll n) ...
[["+", 0, 43, 49, 50, 51, 4, 0, 16, 17, 72], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13]]
1
228
#include <algorithm> #include <array> #include <bitset> #include <cmath> #include <complex> #include <cstdio> #include <deque> #include <fstream> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #define RE...
#include <algorithm> #include <array> #include <bitset> #include <cmath> #include <complex> #include <cstdio> #include <deque> #include <fstream> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #define RE...
[["-", 0, 43, 49, 50, 51, 4, 0, 16, 31, 22], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 31, 22]]
1
704
#include "bits/stdc++.h" using namespace std; long long MOD = 1000000007; long long Calc(long long A, long long B) { if (B == 0) return 1; if (B % 2 == 0) { long long C = Calc(A, B / 2); return (C * C) % MOD; } return (A * Calc(A, B - 1)) % MOD; } int main() { int N, K; cin >> N >> K; vecto...
#include "bits/stdc++.h" using namespace std; long long MOD = 1000000007; long long Calc(long long A, long long B) { if (B == 0) return 1; if (B % 2 == 0) { long long C = Calc(A, B / 2); return (C * C) % MOD; } return (A * Calc(A, B - 1)) % MOD; } int main() { int N, K; cin >> N >> K; vecto...
[["+", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 132], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35]]
1
282
#include <bits/stdc++.h> using namespace std; const int MAXN = 200010; const int64_t INF = 1LL << 62; int64_t dp[MAXN][2][3]; void init() { for (int i = 0; i < MAXN; i++) { for (int j = 0; j < 2; j++) { for (int k = 0; k < 3; k++) { dp[i][j][k] = -INF; } } } dp[0][0][0] = 0; } int ma...
#include <bits/stdc++.h> using namespace std; const int MAXN = 200010; const int64_t INF = 1LL << 62; int64_t dp[MAXN][2][3]; void init() { for (int i = 0; i < MAXN; i++) { for (int j = 0; j < 2; j++) { for (int k = 0; k < 3; k++) { dp[i][j][k] = -INF; } } } dp[0][0][0] = 0; } int ma...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13], ["-", 8, 9, 0, 57, 75, 76, 0, 9, 0, 46], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 46]]
1
675
#include <algorithm> #include <bits/stdc++.h> #include <cmath> #include <iostream> #include <string> #include <unordered_map> #include <unordered_set> using namespace std; #define ll long long #define rep(i, n) for (ll i = 0; i < (n); i++) #define FOR(i, a, b) for (ll i = (a); i < (b); i++) #define FORR(i, a, b) for (l...
#include <algorithm> #include <bits/stdc++.h> #include <cmath> #include <iostream> #include <string> #include <unordered_map> #include <unordered_set> using namespace std; #define ll long long #define rep(i, n) for (ll i = 0; i < (n); i++) #define FOR(i, a, b) for (ll i = (a); i < (b); i++) #define FORR(i, a, b) for (l...
[["-", 49, 50, 51, 4, 0, 2, 3, 4, 0, 13], ["+", 51, 4, 0, 2, 3, 4, 0, 91, 17, 33], ["+", 51, 4, 0, 2, 3, 4, 0, 91, 28, 22], ["-", 0, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 91, 17, 33], ["+", 0, 57, 15, 339, 51, 16, 12, 91, 28, 22]]
1
857
#include <algorithm> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define PI 3.14159265359 using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> pa...
#include <algorithm> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define PI 3.14159265359 using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> pa...
[["-", 12, 2, 3, 4, 0, 69, 341, 342, 0, 13], ["+", 12, 2, 3, 4, 0, 69, 341, 342, 0, 13]]
1
492
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<ll> vll; typedef vector<vll> vvll; typedef pair<ll, ll> pll; typedef vector<pll> vpll; typedef vector<string> vs; typedef vector<bool> vb; #define rep(i, m, n) for (ll i = m; i < n; i++) #define repr(i, m, n) for (ll i = m; i >= n; i-...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<ll> vll; typedef vector<vll> vvll; typedef pair<ll, ll> pll; typedef vector<pll> vpll; typedef vector<string> vs; typedef vector<bool> vb; #define rep(i, m, n) for (ll i = m; i < n; i++) #define repr(i, m, n) for (ll i = m; i >= n; i-...
[["-", 49, 50, 51, 4, 0, 2, 3, 4, 0, 13], ["+", 49, 50, 51, 4, 0, 2, 3, 4, 0, 13]]
1
312
//#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; using ll = long long; #define pp pair<int, int> #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) #define ld long double #define al(a) (a).begin(), (a).end() #define mk make_pair #define check cout << "?" << endl; ll MOD = 1000000007; ll mod = 9...
//#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; using ll = long long; #define pp pair<int, int> #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) #define ld long double #define al(a) (a).begin(), (a).end() #define mk make_pair #define check cout << "?" << endl; ll MOD = 1000000007; ll mod = 9...
[["-", 64, 9, 0, 43, 49, 50, 51, 91, 17, 33], ["-", 64, 9, 0, 43, 49, 50, 51, 91, 28, 22], ["+", 0, 57, 64, 9, 0, 43, 49, 50, 51, 13]]
1
353
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define ll long long #define memset(a, n) memset(a, n, sizeof(a)) #define mp make_pair #define pb push_back u...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define ll long long #define memset(a, n) memset(a, n, sizeof(a)) #define mp make_pair #define pb push_back u...
[["-", 0, 30, 0, 43, 49, 50, 51, 16, 31, 13], ["+", 0, 30, 0, 43, 49, 50, 51, 16, 31, 13], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4...
1
259
#include <bits/stdc++.h> #include <iostream> #include <string> using namespace std; long long int RepeatSquaring(long long int N, long long int P, long long int M) { long long int res = 1; while (P > 0) { if (P & 1) res = res * N % M; N = N * N % M; P >>= 1; } re...
#include <bits/stdc++.h> #include <iostream> #include <string> using namespace std; long long int RepeatSquaring(long long int N, long long int P, long long int M) { long long int res = 1; while (P > 0) { if (P & 1) res = res * N % M; N = N * N % M; P >>= 1; } re...
[["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]]
1
208
// ----------------------------------- // Author : MatsuTaku // Country : Japan // Created : 04/12/20 22:29:53 // ----------------------------------- #include <bits/stdc++.h> using namespace std; using ll = long long; template <typename T, T MOD> class modint { private: T val_; public: constexpr modin...
// ----------------------------------- // Author : MatsuTaku // Country : Japan // Created : 04/12/20 22:29:53 // ----------------------------------- #include <bits/stdc++.h> using namespace std; using ll = long long; template <typename T, T MOD> class modint { private: T val_; public: constexpr modin...
[["-", 0, 7, 8, 9, 0, 7, 26, 11, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 26, 11, 12, 22]]
1
739
#include <algorithm> #include <assert.h> #include <bitset> #include <complex> #include <cstdint> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <stdlib.h> #incl...
#include <algorithm> #include <assert.h> #include <bitset> #include <complex> #include <cstdint> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <stdlib.h> #incl...
[["-", 0, 7, 8, 9, 0, 1, 0, 11, 17, 107], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 31, 22], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 17, 72], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 25]]
1
545
import sys sys.setrecursionlimit(10 ** 6) int1 = lambda x: int(x) - 1 printV = lambda x: print(*x, sep="\n") printH = lambda x: print(" ".join(map(str,x))) def IS(): return sys.stdin.readline()[:-1] def II(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) def LI(): return list...
import sys sys.setrecursionlimit(10 ** 6) int1 = lambda x: int(x) - 1 printV = lambda x: print(*x, sep="\n") printH = lambda x: print(" ".join(map(str,x))) def IS(): return sys.stdin.readline()[:-1] def II(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) def LI(): return list...
[["+", 0, 52, 8, 196, 0, 1, 0, 677, 31, 22], ["+", 0, 52, 8, 196, 0, 1, 0, 677, 17, 132], ["+", 0, 52, 8, 196, 0, 1, 0, 677, 12, 22], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
401
#include <stdlib.h> #include <string.h> #define ll long long #define INF 1 << 31 - 1 #define LNF 9223372036854775807 #define PI 3.14159265358979 #define MIN(x, y) ((x) < (y) ? (x) : (y)) #define MAX(x, y) ((x) < (y) ? (y) : (x)) #define FOR(i, a, n) for (i = a; i < n; i++) #define MOD 1000000007 //#define MOD 99824435...
#include <stdlib.h> #include <string.h> #define ll long long #define INF 1 << 31 - 1 #define LNF 9223372036854775807 #define PI 3.14159265358979 #define MIN(x, y) ((x) < (y) ? (x) : (y)) #define MAX(x, y) ((x) < (y) ? (y) : (x)) #define FOR(i, a, n) for (i = a; i < n; i++) #define MOD 1000000007 //#define MOD 99824435...
[["+", 64, 37, 0, 2, 3, 4, 0, 16, 17, 109], ["+", 64, 37, 0, 2, 3, 4, 0, 16, 12, 22], ["+", 0, 57, 75, 76, 0, 37, 0, 16, 17, 109], ["+", 0, 57, 75, 76, 0, 37, 0, 16, 12, 22]]
0
760
#include <bits/stdc++.h> using namespace std; static const int64_t MOD = 1000000007; int64_t modpow(int64_t base, int64_t k, int64_t mod) { base %= mod; int64_t answer = 1; while (k > 0) { if (k & 1) answer = (answer * base) % mod; base = (base * base) % mod; k >>= 1; } return answer; } ...
#include <bits/stdc++.h> using namespace std; static const int64_t MOD = 1000000007; int64_t modpow(int64_t base, int64_t k, int64_t mod) { base %= mod; int64_t answer = 1; while (k > 0) { if (k & 1) answer = (answer * base) % mod; base = (base * base) % mod; k >>= 1; } return answer; } ...
[["+", 0, 43, 49, 50, 51, 4, 0, 16, 17, 72], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13]]
1
209
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll MOD = 1000000007; ll modpow(ll a, ll n) { ll res = 1; while (n > 0) { if (n & 1) res = res * a % MOD; a = a * a % MOD; n >>= 1; } return res; } int main() { ll N, K; cin >> N >> K; ll ans = 0; ll num[N + 1]...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll MOD = 1000000007; ll modpow(ll a, ll n) { ll res = 1; while (n > 0) { if (n & 1) res = res * a % MOD; a = a * a % MOD; n >>= 1; } return res; } int main() { ll N, K; cin >> N >> K; ll ans = 0; ll num[K + 1]...
[["-", 8, 9, 0, 43, 49, 80, 81, 16, 31, 22], ["+", 8, 9, 0, 43, 49, 80, 81, 16, 31, 22]]
1
190
#include "bits/stdc++.h" using namespace std; typedef long long ll; // #define int long long template <class T> bool INRANGE(T x, T a, T b) { return a <= x && x <= b; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline bool chma...
#include "bits/stdc++.h" using namespace std; typedef long long ll; // #define int long long template <class T> bool INRANGE(T x, T a, T b) { return a <= x && x <= b; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline bool chma...
[["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13]]
1
393
#include <bits/stdc++.h> using namespace std; #define S scanf #define P printf #define G getline #define SZ size() #define C clear() #define B begin() #define F front() #define T top() #define E end() #define EM empty() #define V vector #define Q queue #define DQ deque #define PQ priority_queue #define ST stack #defi...
#include <bits/stdc++.h> using namespace std; #define S scanf #define P printf #define G getline #define SZ size() #define C clear() #define B begin() #define F front() #define T top() #define E end() #define EM empty() #define V vector #define Q queue #define DQ deque #define PQ priority_queue #define ST stack #defi...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
361
#include <bits/stdc++.h> using namespace std; #define each(i, c) for (auto &i : c) #define mkp(a, b) make_pair(a, b) typedef long long ll; typedef unsigned long long ull; typedef pair<ll, ll> Pll; const ll MOD = 1e9 + 7; template <typename P, typename Q> ostream &operator<<(ostream &os, pair<P, Q> p) { os << "(" <...
#include <bits/stdc++.h> using namespace std; #define each(i, c) for (auto &i : c) #define mkp(a, b) make_pair(a, b) typedef long long ll; typedef unsigned long long ull; typedef pair<ll, ll> Pll; const ll MOD = 1e9 + 7; template <typename P, typename Q> ostream &operator<<(ostream &os, pair<P, Q> p) { os << "(" <...
[["-", 0, 43, 49, 50, 51, 4, 0, 16, 31, 22], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 31, 22]]
1
797
#include <bits/stdc++.h> using namespace std; using lli = long long int; template <class T> ostream &operator<<(ostream &o, const vector<T> &v) { o << "{"; for (int i = 0; i < (int)v.size(); i++) o << (i > 0 ? ", " : "") << v[i]; o << "}"; return o; } template <class T> ostream &operator<<(ostream &o, co...
#include <bits/stdc++.h> using namespace std; using lli = long long int; template <class T> ostream &operator<<(ostream &o, const vector<T> &v) { o << "{"; for (int i = 0; i < (int)v.size(); i++) o << (i > 0 ? ", " : "") << v[i]; o << "}"; return o; } template <class T> ostream &operator<<(ostream &o, co...
[["-", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 7, 10, 43, 39, 78], ["+", 0, 1, 0, 11, 31, 23, 0, 2, 63, 22], ["+", 0, 11, 31, 23, 0, 2, 3, 4, 0, 24], ["+", 0, 11, 31, 23, 0, 2, 3, 4, 0, 25]]
1
568
import sys from collections import * import heapq import math from math import gcd import bisect import copy from itertools import permutations,accumulate,combinations,product def input(): return sys.stdin.readline()[:-1] def ruiseki(lst): return [0]+list(accumulate(lst)) mod=pow(10,9)+7 al=[chr(ord('a') + i) f...
import sys from collections import * import heapq import math from math import gcd import bisect import copy from itertools import permutations,accumulate,combinations,product def input(): return sys.stdin.readline()[:-1] def ruiseki(lst): return [0]+list(accumulate(lst)) mod=pow(10,9)+7 al=[chr(ord('a') + i) f...
[["+", 0, 7, 8, 196, 0, 1, 0, 677, 31, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 677, 17, 132], ["+", 0, 7, 8, 196, 0, 1, 0, 677, 12, 22]]
5
245
#include <bits/stdc++.h> using namespace std; template <int mod = (int)(1e9 + 7)> struct ModInt { int x; constexpr ModInt() : x(0) {} constexpr ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {} constexpr ModInt &operator+=(const ModInt &p) noexcept { if ((x += p.x) >= mod) x...
#include <bits/stdc++.h> using namespace std; template <int mod = (int)(1e9 + 7)> struct ModInt { int x; constexpr ModInt() : x(0) {} constexpr ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {} constexpr ModInt &operator+=(const ModInt &p) noexcept { if ((x += p.x) >= mod) x...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22]]
1
703