buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
#include <stdio.h> int n, i, j, r = 0, g = 0, b = 0; long q; char s[4001]; int main() { scanf("%d%s", &n, s); for (i = 0; i < n; i++) s[i] == 'R' ? r++ : s[i] == 'G' ? g++ : b++; q = r * g * b; for (i = 0; i < n; i++) { for (j = 0; i + 2 * j < n; j++) { if (s[i] != s[i + j] && s[i] != s[i + 2 * j]...
#include <stdio.h> int n, i, j; long r = 0, g = 0, b = 0, q; char s[4001]; int main() { scanf("%d%s", &n, s); for (i = 0; i < n; i++) s[i] == 'R' ? r++ : s[i] == 'G' ? g++ : b++; q = r * g * b; for (i = 0; i < n; i++) { for (j = 1; i + 2 * j < n; j++) { if (s[i] != s[i + j] && s[i] != s[i + 2 * j]...
[["-", 36, 36, 36, 36, 0, 30, 0, 43, 0, 21], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 0, 35], ["+", 36, 36, 0, 30, 0, 43, 39, 86, 0, 96], ["-", 36, 36, 36, 36, 0, 30, 0, 43, 0, 35], ["-", 36, 36, 0, 30, 0, 43, 39, 86, 0, 96], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 0, 21], ["-", 0, 7, 8, 9, 0, 7, 10, 11, 12, 13], ["+", 0, 7, 8,...
0
189
#include <stdio.h> int main() { int n; scanf("%d", &n); char s[4010]; scanf("%s", s); int n_r = 0, n_g = 0, n_b = 0; for (int i = 0; i < n; i++) if (s[i] == 'R') n_r++; else if (s[i] == 'G') n_g++; else if (s[i] == 'B') n_b++; int ans = n_r * n_g * n_b; for (int i = 0; i...
#include <stdio.h> int main() { int n; scanf("%d", &n); char s[4010]; scanf("%s", s); long long int n_r = 0, n_g = 0, n_b = 0; for (int i = 0; i < n; i++) if (s[i] == 'R') n_r++; else if (s[i] == 'G') n_g++; else if (s[i] == 'B') n_b++; long long int ans = n_r * n_g * n_b; ...
[["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
223
#include <iostream> #include <string> using namespace std; int main() { int n; string str; cin >> n; cin >> str; int r, g, b; r = g = b = 0; for (int i = 0; i < n; i++) { if (str[i] == 'R') { r++; } else if (str[i] == 'G') { g++; } else { b++; } } int cnt = 0; for...
#include <iostream> #include <string> using namespace std; int main() { int n; string str; cin >> n; cin >> str; long long r, g, b; r = g = b = 0; for (int i = 0; i < n; i++) { if (str[i] == 'R') { r++; } else if (str[i] == 'G') { g++; } else { b++; } } long long cn...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]]
1
206
#include <math.h> #include <stdio.h> #include <stdlib.h> int main(void) { int K, i, j, k; int r = 0; int g = 0; int b = 0; long int ans = 0; char S[4001]; scanf("%d", &K); scanf("%s", S); for (i = 0; i < K; i++) { if (S[i] == 'R') { r++; } if (S[i] == 'G') { g++; } i...
#include <math.h> #include <stdio.h> #include <stdlib.h> int main(void) { long int K, i, j, k; long int r = 0; long int g = 0; long int b = 0; long int ans = 0; char S[4001]; scanf("%ld", &K); scanf("%s", S); for (i = 0; i < K; i++) { if (S[i] == 'R') { r++; } if (S[i] == 'G') { ...
[["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
233
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <utility> #include <vector> using namespace std; typedef long long ll; #define rep(i, n) for (int i = 0; i < n; i++) #define per(i, n) for (int i = n - 1; i >= 0; i--) #define reps(i, n) ...
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <utility> #include <vector> using namespace std; typedef long long ll; #define rep(i, n) for (int i = 0; i < n; i++) #define per(i, n) for (int i = n - 1; i >= 0; i--) #define reps(i, n) ...
[["-", 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
265
import java.util.Scanner; public class Main { public static void main(String[] args) { var sc = new Scanner(System.in); var n = sc.nextInt(); var s = sc.next().toCharArray(); int[] counts = new int[3]; for (int i = 0; i < n; i++) { if (s[i] == 'R') counts[0]++; if (s[i] == '...
import java.util.Scanner; public class Main { public static void main(String[] args) { var sc = new Scanner(System.in); var n = sc.nextInt(); var s = sc.next().toCharArray(); long[] counts = new long[3]; for (int i = 0; i < n; i++) { if (s[i] == 'R') counts[0]++; if (s[i] ==...
[["-", 8, 196, 0, 503, 39, 224, 468, 506, 0, 507], ["+", 8, 196, 0, 503, 39, 224, 468, 506, 0, 96], ["-", 0, 503, 49, 200, 51, 227, 39, 506, 0, 507], ["+", 0, 503, 49, 200, 51, 227, 39, 506, 0, 96]]
3
260
#include <bits/stdc++.h> using namespace std; using ll = long long; const int mod = 1e9 + 7; int main() { ios::sync_with_stdio(false); cin.tie(0); int N; cin >> N; string S; cin >> S; int ans = 0; for (int i = 0; i < N; i++) { int L[3] = {}, R[3] = {}; for (int j = 0; j < i; j++) { if (S...
#include <bits/stdc++.h> using namespace std; using ll = long long; const int mod = 1e9 + 7; int main() { ios::sync_with_stdio(false); cin.tie(0); int N; cin >> N; string S; cin >> S; ll ans = 0; for (int i = 0; i < N; i++) { int L[3] = {}, R[3] = {}; for (int j = 0; j < i; j++) { if (S[...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
377
#include <bits/stdc++.h> #define cout16 cout << setprecision(16) #define rep(i, n) for (int i = 0; i < n; i++) #define rep2(i, f, n) for (int i = f; i < n; i++) #define SORT(A) sort(A.begin(), A.end()) #define REV(A) reverse(A.begin(), A.end()) typedef long long int ll; using vi = std::vector<int>; using vvi = std::vec...
#include <bits/stdc++.h> #define cout16 cout << setprecision(16) #define rep(i, n) for (int i = 0; i < n; i++) #define rep2(i, f, n) for (int i = f; i < n; i++) #define SORT(A) sort(A.begin(), A.end()) #define REV(A) reverse(A.begin(), A.end()) typedef long long int ll; using vi = std::vector<int>; using vvi = std::vec...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
478
import java.util.*; class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); String s = scanner.next(); int r = 0; int g = 0; int b = 0; for (int i = 0; i < n; i++) { if (s.charAt(i) == 'R') { r++; } else...
import java.util.*; class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); String s = scanner.next(); long r = 0; long g = 0; long b = 0; for (int i = 0; i < n; i++) { if (s.charAt(i) == 'R') { r++; } e...
[["-", 0, 195, 8, 196, 0, 503, 39, 506, 0, 507], ["+", 0, 195, 8, 196, 0, 503, 39, 506, 0, 96]]
3
240
#include <bits/stdc++.h> using namespace std; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int n; long long ans; string s; cin >> n; cin >> s; vector<long long> r, g, b; ans = 0; for (int i = 0; i < n; i++) { if (s[i] == 'R') { r.push_back(i); } else if (s[i] == 'G') {...
#include <bits/stdc++.h> using namespace std; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int n; long long ans; string s; cin >> n; cin >> s; vector<long long> r, g, b; ans = 0; for (int i = 0; i < n; i++) { if (s[i] == 'R') { r.push_back(i); } else if (s[i] == 'G') {...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 85], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
260
#include <bits/stdc++.h> using namespace std; #define ll long long const int maxn = 5e3 + 5; char s[maxn]; ll dp[maxn][3]; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; cin >> (s + 1); if (n <= 3) { cout << 0 << '\n'; return 0; } ll tol = n * (n - 1) * (n - 2) / 6; ll ...
#include <bits/stdc++.h> using namespace std; #define ll long long const int maxn = 5e3 + 5; char s[maxn]; ll dp[maxn][3]; int main() { ios::sync_with_stdio(false); cin.tie(0); ll n; cin >> n; cin >> (s + 1); if (n <= 3) { cout << 0 << '\n'; return 0; } ll tol = n * (n - 1) * (n - 2) / 6; ll s...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
522
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; using ll = long long; int main() { int n; string str; cin >> n >> str; vector<int> *v[3]; for (auto &p : v) { p = new vector<int>; } for (auto i = 0; i != n; ++i) { switch (str[i]) { case 'R': ...
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; using ll = long long; int main() { int n; string str; cin >> n >> str; vector<int> *v[3]; for (auto &p : v) { p = new vector<int>(0); } for (auto i = 0; i != n; ++i) { switch (str[i]) { case 'R...
[["+", 0, 1, 0, 11, 12, 350, 3, 4, 0, 24], ["+", 0, 1, 0, 11, 12, 350, 3, 4, 0, 13], ["+", 0, 1, 0, 11, 12, 350, 3, 4, 0, 25], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
351
#include <bits/stdc++.h> #include <unordered_map> using namespace std; #define ll long long #define all(x) (x).begin(), (x).end() #define rep(i, n) for (ll i = 0; i < n; i++) const ll INF = 100100100100100100; // 10^17 const ll MOD = 1000000007; ll combination(ll n, ll r) { if (n < r) return 0; if (r == 0 || r...
#include <bits/stdc++.h> #include <unordered_map> using namespace std; #define ll long long #define all(x) (x).begin(), (x).end() #define rep(i, n) for (ll i = 0; i < n; i++) const ll INF = 100100100100100100; // 10^17 const ll MOD = 1000000007; ll combination(ll n, ll r) { if (n < r) return 0; if (r == 0 || r...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
338
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <iostream> #include <map> #include <queue> #include <regex> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #define inf 2000000000 #define mo...
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <iostream> #include <map> #include <queue> #include <regex> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #define inf 2000000000 #define mo...
[["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 0, 30, 0, 43, 39, 86, 0, 96], ["-", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 8, 9, 0, 7, 8, 9, 0, 43, 39, 40], ["+", 0, 7, 8, 9, 0, 43, 39, 86, 0, 96]]
1
242
#include <iostream> using namespace std; int main() { int n; cin >> n; string s; cin >> s; int count = 0; int r = 0, b = 0, g = 0; for (int i = 0; i < n; i++) { if (s[i] == 'R') r += 1; if (s[i] == 'G') g += 1; if (s[i] == 'B') b += 1; } for (int k = 2; k < n; k++) { ...
#include <iostream> using namespace std; int main() { int n; cin >> n; string s; cin >> s; long long count = 0; long long r = 0, b = 0, g = 0; for (int i = 0; i < n; i++) { if (s[i] == 'R') r += 1; if (s[i] == 'G') g += 1; if (s[i] == 'B') b += 1; } for (int k = 2; k < n...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]]
1
199
#include <bits/stdc++.h> using namespace std; const int N = 4005; char arr[N] = {}; int main() { ios::sync_with_stdio(false), cin.tie(0), cout.tie(0); int len; while (cin >> len) { int cnt = 0, ans = 0; for (int i = 1; i <= len; i++) { cin >> arr[i]; cnt += arr[i] == 'B'; } for (int i ...
#include <bits/stdc++.h> using namespace std; const int N = 4005; char arr[N] = {}; int main() { ios::sync_with_stdio(false), cin.tie(0), cout.tie(0); int len; while (cin >> len) { long long cnt = 0, ans = 0; for (int i = 1; i <= len; i++) { cin >> arr[i]; cnt += arr[i] == 'B'; } for (...
[["-", 8, 9, 0, 52, 8, 9, 0, 43, 39, 40], ["+", 0, 52, 8, 9, 0, 43, 39, 86, 0, 96]]
1
260
#include <bits/stdc++.h> using namespace std; #define MEM(a, b) memset(a, (b), sizeof(a)) #define FORN(i, a, n) for (int i = a; i < n; i++) #define FRON(i, a, n) for (int i = a; i > n; i--) #define FOR(i, n) for (int i = 0; i < n; i++) #define FRO(i, a) for (int i = a; i > -1; i--) #define mp make_pair #define pb push...
#include <bits/stdc++.h> using namespace std; #define MEM(a, b) memset(a, (b), sizeof(a)) #define FORN(i, a, n) for (int i = a; i < n; i++) #define FRON(i, a, n) for (int i = a; i > n; i--) #define FOR(i, n) for (int i = 0; i < n; i++) #define FRO(i, a) for (int i = a; i > -1; i--) #define mp make_pair #define pb push...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
1,084
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define MOD (1000000007) using namespace std; ...
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define MOD (1000000007) using namespace std; ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
259
#include <iostream> using namespace std; int main(void) { int N; string S; int ans = 0; cin >> N; cin >> S; // (1) (#R * #G * B)の場合を列挙 int RGBnum[3] = {0, 0, 0}; // Rは[0], Gは[1], Bは[2] for (int cnt = 0; cnt < S.length(); cnt++) { if (S[cnt] == 'R') { RGBnum[0]++; } else if (S[cnt] == '...
#include <iostream> using namespace std; int main(void) { int N; string S; int64_t ans = 0; cin >> N; cin >> S; // (1) (#R * #G * B)の場合を列挙 int64_t RGBnum[3] = { 0, 0, 0}; // Rは[0], Gは[1], Bは[2] // 右辺もint64_tじゃないと結果がintにキャストされてしまう for (int cnt = 0; cnt < S.length(); cnt++) { ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
1
242
#include <bits/stdc++.h> using namespace std; template <typename T> void debug(string t, T input) { cout << t << "-> " << input << "\n"; } template <typename T> void debug(int i, string t, T input) { cout << "Case#" << i << " " << t << "-> " << input << "\n"; } int main() { ios::sync_with_stdio(0); cin.tie(0)...
#include <bits/stdc++.h> using namespace std; template <typename T> void debug(string t, T input) { cout << t << "-> " << input << "\n"; } template <typename T> void debug(int i, string t, T input) { cout << "Case#" << i << " " << t << "-> " << input << "\n"; } int main() { ios::sync_with_stdio(0); cin.tie(0)...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]]
1
318
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int n; string s; cin >> n >> s; int r, g, b; r = g = b = 0; for (char c : s) { if (c == 'R') r++; else if (c == 'G') g++; else b++; } int ans = r * g * b; for (int i = 0; i < n; i++) for...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int n; string s; cin >> n >> s; int r, g, b; r = g = b = 0; for (char c : s) { if (c == 'R') r++; else if (c == 'G') g++; else b++; } ll ans = (ll)r * g * b; for (int i = 0; i < n; i++) ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 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
178
#include <iostream> #include <vector> using namespace std; int main() { int n; string s; cin >> n >> s; long long r = 0, g = 0, b = 0; for (auto c : s) { if (c == 'R') ++r; else if (c == 'R') ++g; else ++b; } long long all = r * g * b; long long sub = 0; for (int i = 0; i...
#include <iostream> #include <vector> using namespace std; int main() { int n; string s; cin >> n >> s; long long r = 0, g = 0, b = 0; for (auto c : s) { if (c == 'R') ++r; else if (c == 'G') ++g; else ++b; } long long all = r * g * b; long long sub = 0; for (int i = 0; i...
[["-", 0, 57, 15, 339, 51, 16, 12, 103, 0, 125], ["+", 0, 57, 15, 339, 51, 16, 12, 103, 0, 125]]
1
188
#include <bits/stdc++.h> using namespace std; int main() { int N; string S; cin >> N >> S; vector<int> sum_R(N + 1); vector<int> sum_G(N + 1); vector<int> sum_B(N + 1); int i, j, temp, start; // 累積和 for (i = 0; i < N; i++) { if (S.at(i) == 'R') { sum_R.at(i + 1) = 1 + sum_R.at(i); ...
#include <bits/stdc++.h> using namespace std; int main() { int N; string S; cin >> N >> S; vector<int> sum_R(N + 1); vector<int> sum_G(N + 1); vector<int> sum_B(N + 1); int i, j, temp; // 累積和 for (i = 0; i < N; i++) { if (S.at(i) == 'R') { sum_R.at(i + 1) = 1 + sum_R.at(i); sum_G...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
1
681
#include <algorithm> #include <assert.h> #include <cmath> #include <deque> #include <iostream> #include <limits.h> #include <map> #include <math.h> #include <queue> #include <set> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <string> #include <unordered_map> #include <unordered_set> #include <vec...
#include <algorithm> #include <assert.h> #include <cmath> #include <deque> #include <iostream> #include <limits.h> #include <map> #include <math.h> #include <queue> #include <set> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <string> #include <unordered_map> #include <unordered_set> #include <vec...
[["-", 36, 36, 36, 36, 0, 30, 0, 14, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 14, 39, 78], ["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22]]
1
639
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) #define vi vector<int> #define vvi vector<vi> #define pii pair<int, int> #define mod 1000000007 using ll = long long; using namespace std; int main() { int n; cin >> n; string s; cin >> s; int r = 0, g = 0, b = 0; rep(i, n) { if (s[i...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) #define vi vector<int> #define vvi vector<vi> #define pii pair<int, int> #define mod 1000000007 using ll = long long; using namespace std; int main() { int n; cin >> n; string s; cin >> s; ll r = 0, g = 0, b = 0; rep(i, n) { if (s[i]...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
238
N = int(input()) S = list(input()) r , g, b = S.count("R"), S.count("G"), S.count("B") ans = r * g * b for i in range(N-2): for j in range(i+1, N-1): k = 2*(j+1) - (i+1) if k >= N: break if S[i] != S[j] and S[j] != S[k-1] and S[k-1] != S[i]: ans -= 1 print(ans)
N = int(input()) S = input() r , g, b = S.count("R"), S.count("G"), S.count("B") ans = r * g * b for i in range(N-2): for j in range(i+1, N-1): k = 2*(j+1) - (i+1) # j > iより k = 2j - i > j if k <= N: if S[i] != S[j] and S[j] != S[k-1] and S[k-1] != S[i]: ans -= 1 print(...
[["-", 0, 656, 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], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 19], ["-", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
142
#include <bits/stdc++.h> using namespace std; int main(void) { int N; string S; cin >> N >> S; map<char, int> ch; ch.emplace('R', 0); ch.emplace('G', 0); ch.emplace('B', 0); for (int i = 0; i < N; i++) { ch[S[i]]++; } long long total = ch['R'] * ch['G'] * ch['B']; if (total == 0) { c...
#include <bits/stdc++.h> using namespace std; int main(void) { int N; string S; cin >> N >> S; map<char, long long> ch; ch.emplace('R', 0); ch.emplace('G', 0); ch.emplace('B', 0); for (int i = 0; i < N; i++) { ch[S[i]]++; } long long total = ch['R'] * ch['G'] * ch['B']; if (total == 0) {...
[["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 39, 344, 3, 347, 0, 77, 39, 86, 0, 96]]
1
235
""" import random import functools import copy import bisect import array import re import collections import heapq import itertools import string import math from operator import itemgetter as ig from bisect import bisect_left, bisect_right, insort_left, insort_right from itertools import permutations, combinations, p...
""" import random import functools import copy import bisect import array import re import collections import heapq import itertools import string import math from operator import itemgetter as ig from bisect import bisect_left, bisect_right, insort_left, insort_right from itertools import permutations, combinations, p...
[["-", 15, 679, 31, 679, 31, 679, 12, 666, 667, 19], ["-", 15, 679, 31, 679, 31, 679, 12, 666, 0, 22], ["+", 15, 679, 31, 679, 31, 679, 12, 666, 667, 18], ["+", 15, 679, 31, 679, 31, 679, 12, 666, 0, 22], ["-", 12, 666, 0, 206, 206, 657, 31, 657, 17, 72], ["+", 12, 666, 0, 206, 206, 657, 31, 657, 17, 48]]
5
516
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string s; cin >> s; int r = 0, g = 0, b = 0; for (int i = 0; i < n; i++) { if (s.at(i) == 'R') r++; else if (s.at(i) == 'G') g++; else b++; } long long ans = r * g * b; for (int i = 0; i < n; i++...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string s; cin >> s; long long r = 0, g = 0, b = 0; for (int i = 0; i < n; i++) { if (s.at(i) == 'R') r++; else if (s.at(i) == 'G') g++; else b++; } long long ans = r * g * b; for (int i = 0; i < ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]]
1
205
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <stack> #include <stdio.h> #include <string> #include <vector> #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<vector<int>> vvi; typedef vector<i...
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <stack> #include <stdio.h> #include <string> #include <vector> #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<vector<int>> vvi; typedef vector<i...
[["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78]]
1
354
#include <bits/stdc++.h> #define rep(i, a, b) for (int i = a; i < b; i++) #define rrep(i, a, b) for (int i = a; i >= b; i--) // #define fore(i,a) for(auto &i:a) // #define all(x) (x).begin(),(x).end() // #pragma GCC optimize ("-O3") // using namespace std; void _main(); int main() { cin.tie(0); // ios::sync_with_stdio(...
#include <bits/stdc++.h> #define rep(i, a, b) for (int i = a; i < b; i++) #define rrep(i, a, b) for (int i = a; i >= b; i--) // #define fore(i,a) for(auto &i:a) // #define all(x) (x).begin(),(x).end() // #pragma GCC optimize ("-O3") // using namespace std; void _main(); int main() { cin.tie(0); // ios::sync_with_stdio(...
[["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]]
1
228
#include <bits/stdc++.h> using namespace std; int check(int s, int r) { return (3 - (s + r)); } int main() { int n, k, i, j; string s; cin >> n >> s; int ans = 0; int cnt[n + 1][3]; memset(cnt, 0, sizeof(cnt)); for (i = 1; i <= n; ++i) { if (s[i - 1] == 'R') { cnt[i][0] = cnt[i - 1][0] + 1; ...
#include <bits/stdc++.h> using namespace std; int check(int s, int r) { return (3 - (s + r)); } int main() { int n, k, i, j; string s; cin >> n >> s; long long int ans = 0; int cnt[n + 1][3]; memset(cnt, 0, sizeof(cnt)); for (i = 1; i <= n; ++i) { if (s[i - 1] == 'R') { cnt[i][0] = cnt[i - 1][0]...
[["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]]
1
504
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define numrep(i, n) for (int i = 1; i <= n; i++) #define ll int64_t #define all(v) v.begin(), v.end() #define bitrep(n) for (int bit = 0; bit < (1 << n); bit++) //条件が複数ある場合は段階に分けるのも手 int main() { int N; cin >> N; string...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define numrep(i, n) for (int i = 1; i <= n; i++) #define ll int64_t #define all(v) v.begin(), v.end() #define bitrep(n) for (int bit = 0; bit < (1 << n); bit++) //条件が複数ある場合は段階に分けるのも手 int main() { int N; cin >> N; string...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
222
n = int(input()) s = input() ans = s.count('B') * s.coufnt('G') * s.count('R') for i in range(n): for j in range(i, n-1): k = 2*j - i if k >= n: continue if s[i] != s[j] and s[i] != s[k] and s[j] != s[k]: ans -= 1 print(ans)
n = int(input()) s = input() ans = s.count('R') * s.count('G') * s.count('B') for i in range(n): for j in range(i, n-1): k = 2*j - i if k >= n: continue if s[i] != s[j] and s[i] != s[k] and s[j] != s[k]: ans -= 1 print(ans)
[["-", 31, 657, 31, 652, 3, 4, 0, 557, 0, 6], ["+", 31, 657, 31, 652, 3, 4, 0, 557, 0, 6], ["-", 12, 657, 31, 657, 12, 652, 63, 319, 319, 22], ["+", 12, 657, 31, 657, 12, 652, 63, 319, 319, 22], ["-", 12, 657, 12, 652, 3, 4, 0, 557, 0, 6], ["+", 12, 657, 12, 652, 3, 4, 0, 557, 0, 6]]
5
112
import itertools N = int(input()) S = input() #Rc1,Gc1,Bc1 out = S.count('R') * S.count('G') * S.count('B') print(out) RGBs = list(itertools.permutations(['R', 'G', 'B'], 3)) for i in range(1, N): for j in range(N-i*2): #三つ連続であり、RGBで構成されている if (S[j], S[j+i], S[j+i*2]) in RGBs: out -= 1 print(out)
import itertools N = int(input()) S = input() #Rc1,Gc1,Bc1 out = S.count('R') * S.count('G') * S.count('B') RGBs = list(itertools.permutations(['R', 'G', 'B'], 3)) for i in range(1, N): for j in range(N-i*2): #三つ連続であり、RGBで構成されている if (S[j], S[j+i], S[j+i*2]) in RGBs: out -= 1 print(out)
[["-", 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
129
#include <bits/stdc++.h> #define DAU \ ios::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0); #define PLEC return 0; using namespac...
#include <bits/stdc++.h> #define DAU \ ios::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0); #define PLEC return 0; using namespac...
[["+", 0, 11, 12, 16, 31, 16, 31, 16, 31, 13], ["+", 0, 11, 12, 16, 31, 16, 31, 16, 17, 48]]
1
194
#include <iostream> #include <string> using namespace std; using ll = long long; #define loop(i, n) for (int i = 0; i < (int)n; i++) bool check_diff(char a, char b, char c) { if (a != b && b != c && c != a) return true; else return false; } int main() { int n; cin >> n; string s; cin >> s; in...
#include <iostream> #include <string> using namespace std; using ll = long long; #define loop(i, n) for (int i = 0; i < (int)n; i++) bool check_diff(char a, char b, char c) { if (a != b && b != c && c != a) return true; else return false; } int main() { int n; cin >> n; string s; cin >> s; ll...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
219
N = int(input()) S = input() Sr = Sg = Sb = 0 for c in S: if c == 'R': Sr += 1 elif c == 'G': Sg += 1 else: Sb += 1 A = Sr * Sg * Sb for sep in range(1,(N-1)//2): for i in range(N-2*sep): if S[i] != S[i+sep] and S[i+sep] != S[i+2*sep] and S[i] != S[i+2*sep]: A...
N = int(input()) S = input() Sr = Sg = Sb = 0 for c in S: if c == 'R': Sr += 1 elif c == 'G': Sg += 1 else: Sb += 1 A = Sr * Sg * Sb for sep in range(1,(N+1)//2): for i in range(N-2*sep): if S[i] != S[i+sep] and S[i+sep] != S[i+2*sep] and S[i] != S[i+2*sep]: 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; int main() { int N; cin >> N; string S; cin >> S; int r = 0; int g = 0; int b = 0; for (int i = 0; i < S.size(); i++) { if (S[i] == 'R') r += 1; else if (S[i] == 'G') g += 1; else if (S[i] == 'B') b += 1; ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int N; cin >> N; string S; cin >> S; ll r = 0; ll g = 0; ll b = 0; for (int i = 0; i < S.size(); i++) { if (S[i] == 'R') r += 1; else if (S[i] == 'G') g += 1; else if (S[i] == 'B') b += 1; }...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
224
#include <bits/stdc++.h> #define rep(i, x) for (long long i = 0; i < x; i++) #define INF 1000100 typedef long long ll; using namespace std; int main() { int N; string S; cin >> N >> S; int r = 0, g = 0, b = 0; rep(i, N) { if (S[i] == 'R') r++; if (S[i] == 'G') g++; if (S[i] == 'B') ...
#include <bits/stdc++.h> #define rep(i, x) for (long long i = 0; i < x; i++) #define INF 1000100 typedef long long ll; using namespace std; int main() { int N; string S; cin >> N >> S; ll r = 0, g = 0, b = 0; rep(i, N) { if (S[i] == 'R') r++; if (S[i] == 'G') g++; if (S[i] == 'B') ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
210
#include <algorithm> #include <cstdio> #include <cstdlib> #include <iomanip> #include <iostream> #include <math.h> #include <string> #include <vector> using namespace std; int main() { int n; cin >> n; string s; cin >> s; int len = s.size(); vector<int> a(n); vector<int> num(3); num[0] = 0; num[1...
#include <algorithm> #include <cstdio> #include <cstdlib> #include <iomanip> #include <iostream> #include <math.h> #include <string> #include <vector> using namespace std; int main() { int n; cin >> n; string s; cin >> s; int len = s.size(); vector<int> a(n); vector<long long int> num(3); num[0] = ...
[["+", 39, 344, 3, 347, 0, 77, 39, 86, 0, 96], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]]
1
300
#include <algorithm> #include <functional> #include <iostream> #include <map> #include <math.h> #include <queue> #include <stack> #include <string> #include <vector> #define rep(i, n) for (ll i = 0; i < (n); i++) typedef long long ll; using namespace std; int main() { int n; cin >> n; string s; cin >> s; in...
#include <algorithm> #include <functional> #include <iostream> #include <map> #include <math.h> #include <queue> #include <stack> #include <string> #include <vector> #define rep(i, n) for (ll i = 0; i < (n); i++) typedef long long ll; using namespace std; int main() { int n; cin >> n; string s; cin >> s; in...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
221
#include <iostream> #include <map> #include <set> #include <string> int countAligned(std::map<char, std::set<int>> &char2pos, const char a, const char b, const char c) { int ans = 0; for (int i : char2pos[a]) { for (int j : char2pos[b]) { if (((i + j) & 1) != 0) { continue; ...
#include <iostream> #include <map> #include <set> #include <string> int countAligned(std::map<char, std::set<int>> &char2pos, const char a, const char b, const char c) { int ans = 0; for (int i : char2pos[a]) { for (int j : char2pos[b]) { if (((i + j) & 1) != 0) { continue; ...
[["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]]
1
306
#include <bits/stdc++.h> #define fin freopen("input", "r", stdin); #define fout freopen("output", "w", stdout); #define wt(x) cerr << #x << ": " << x << " "; #define whatis(x) \ { cerr << #x << ": " << x << endl; } #define whatis2(x, y) ...
#include <bits/stdc++.h> #define fin freopen("input", "r", stdin); #define fout freopen("output", "w", stdout); #define wt(x) cerr << #x << ": " << x << " "; #define whatis(x) \ { cerr << #x << ": " << x << endl; } #define whatis2(x, y) ...
[["+", 0, 11, 12, 16, 31, 16, 31, 74, 0, 24], ["+", 12, 16, 31, 16, 31, 74, 39, 77, 39, 78], ["+", 0, 11, 12, 16, 31, 16, 31, 74, 0, 25]]
1
400
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define all(a) a.begin(), a.end() #define pb push_back #define mp make_pair typedef long long ll; typedef pair<ll, ll> P; typedef pair<ll, int> pli; typedef pair<int, int> pii; #define rep(i, a, b) for (ll i = a; i < b; i++) #define qrep(q...
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define all(a) a.begin(), a.end() #define pb push_back #define mp make_pair typedef long long ll; typedef pair<ll, ll> P; typedef pair<ll, int> pli; typedef pair<int, int> pii; #define rep(i, a, b) for (ll i = a; i < b; i++) #define qrep(q...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
1,140
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define all(a) a.begin(), a.end() #define pb push_back #define mp make_pair typedef long long ll; typedef pair<ll, ll> P; typedef pair<ll, int> pli; typedef pair<int, int> pii; typedef long double ld; #define rep(i, a, b) for (ll i = a; i ...
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define all(a) a.begin(), a.end() #define pb push_back #define mp make_pair typedef long long ll; typedef pair<ll, ll> P; typedef pair<ll, int> pli; typedef pair<int, int> pii; typedef long double ld; #define rep(i, a, b) for (ll i = a; i ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
577
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; ++i) using namespace std; using ll = long long; int main() { int n; cin >> n; string s; cin >> s; int r = 0; int g = 0; int b = 0; vector<string> color(n); for (int i = 0; i < n; i++) { color.at(i) = s.at(i); if (s.at(i) == 'R'...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; ++i) using namespace std; using ll = long long; int main() { int n; cin >> n; string s; cin >> s; ll r = 0; ll g = 0; ll b = 0; vector<string> color(n); for (int i = 0; i < n; i++) { color.at(i) = s.at(i); if (s.at(i) == 'R') ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 0, 7, 8, 9, 0, 7, 26, 27, 28, 22], ["+", 0, 7, 8, 9, 0, 7, 26, 27, 28, 22]]
1
273
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int main() { int n, i, j, k; char s[4006]; int cnt = 0; int g = 0; int b = 0; int r = 0; scanf("%d", &n); scanf("%s", s); for (i = 0; i < n; i++) { if (s[i] == 'R') r++; if (s[i] == 'B') b++; if (s[...
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int main() { int n, i, j, k; char s[4006]; int cnt = 0; int g = 0; int b = 0; int r = 0; scanf("%d", &n); scanf("%s", s); for (i = 0; i < n; i++) { if (s[i] == 'R') r++; if (s[i] == 'B') b++; if (s[...
[["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
223
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; string str; cin >> str; int r = 0, g = 0, b = 0; for (int i = 0; i < N; i++) { if (str[i] == 'R') r++; if (str[i] == 'G') g++; if (str[i] == 'B') b++; } long long all = r * g * b; long long sub ...
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; string str; cin >> str; long long r = 0, g = 0, b = 0; for (int i = 0; i < N; i++) { if (str[i] == 'R') r++; if (str[i] == 'G') g++; if (str[i] == 'B') b++; } long long all = r * g * b; long lon...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]]
1
222
#include <bits/stdc++.h> using namespace std; int main() { int n; string s; cin >> n >> s; long long ans = 0; int r = 0; int g = 0; int b = 0; for (int i = 0; i < n; i++) { if (s.at(i) == 'R') r++; if (s.at(i) == 'G') g++; if (s.at(i) == 'B') b++; } ans = r * b * g; ...
#include <bits/stdc++.h> using namespace std; int main() { int n; string s; cin >> n >> s; long long ans = 0; long long r = 0; long long g = 0; long long b = 0; for (int i = 0; i < n; i++) { if (s.at(i) == 'R') r++; if (s.at(i) == 'G') g++; if (s.at(i) == 'B') b++; } a...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]]
1
218
#include <bits/stdc++.h> using namespace std; int main() { int l; char s[40500]; long long sum = 0; scanf("%d", &l); scanf("%s", s); int r = 0, g = 0, b = 0; for (int i = 0; i < l; i++) { if (s[i] == 'R') r++; if (s[i] == 'G') g++; if (s[i] == 'B') b++; } int r1 = 0, g1...
#include <bits/stdc++.h> using namespace std; int main() { int l; char s[40500]; long long sum = 0; scanf("%d", &l); scanf("%s", s); int r = 0, g = 0, b = 0; for (int i = 0; i < l; i++) { if (s[i] == 'R') r++; if (s[i] == 'G') g++; if (s[i] == 'B') b++; } int r1 = 0, g1...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
468
S = list(input()) S_len = len(S) ans = 0 i = 0 for _ in range(S_len): if S[0] == 'R': ans += S[1:].count('B') * S[1:].count('G') for j in range(int(len(S)/2+1)): try: if S[j+1] != S[j*2+2] and S[j*2+2] !='R' and S[j+1] !='R': ans-=1 except: pass if S[0] == 'B': ans ...
S = input() S = list(input()) S_len = len(S) ans = 0 i = 0 for _ in range(S_len): if S[0] == 'R': ans += S[1:].count('B') * S[1:].count('G') for j in range(int(len(S)/2+1)): try: if S[j+1] != S[j*2+2] and S[j*2+2] !='R' and S[j+1] !='R': ans-=1 except: pass if S[0] == '...
[["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32]]
5
351
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; typedef long long int llint; llint ans; int N; string S; int rs, gs, bs; int main() { cin >> N; cin >> S; ans = 0; for (int i = 0; i < N; i++) { if (S[i] == 'R') { rs++; } else if (S[i] == 'G')...
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; typedef long long int llint; llint ans; llint N; string S; llint rs, gs, bs; int main() { cin >> N; cin >> S; ans = 0; for (int i = 0; i < N; i++) { if (S[i] == 'R') { rs++; } else if (S[i] == ...
[["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 78]]
1
230
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define pb push_back #define fi first #define se second #define ALL(a) (a.begin(), a.end()) using ull = unsigned long long; template <typename T> void Out(T x) { cout << x << endl; } int nC2(int a) { return (a) * (a - 1) / 2;...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define pb push_back #define fi first #define se second #define ALL(a) (a.begin(), a.end()) using ull = unsigned long long; template <typename T> void Out(T x) { cout << x << endl; } ull nC2(ull a) { return (a) * (a - 1) / 2;...
[["-", 36, 36, 36, 36, 0, 30, 0, 14, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 14, 39, 78], ["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 40], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78]]
1
371
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ULL unsigned long long #define LL long long using namespace std; int sum = 0; int N; string S; int SS[5000]; int mem[5000][3]; // RGB mem[a][1]=a以上の要素に1が含まれる数 void count(int first, int second) { // 3番目 if (first != -1 && secon...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ULL unsigned long long #define LL long long using namespace std; ULL sum = 0; int N; string S; int SS[5000]; int mem[5000][3]; // RGB mem[a][1]=a以上の要素に1が含まれる数 void count(int first, int second) { // 3番目 if (first != -1 && secon...
[["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 78], ["-", 64, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["-", 0, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 12, 22]]
1
489
#include "bits/stdc++.h" using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(v) v.begin(), v.end() int N; string S; vector<int> R, G, B; void solve() { int ans = 0; int l, r, dame1, dame2, dame3; for (int a : R) { for (int b : G) { l = min(a, b); r = max(a, b);...
#include "bits/stdc++.h" using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(v) v.begin(), v.end() int N; string S; vector<int> R, G, B; void solve() { int64_t ans = 0; int l, r, dame1, dame2, dame3; for (int a : R) { for (int b : G) { l = min(a, b); r = max(a,...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
1
310
#include <stdio.h> int main() { int n, m, i, j, k, sum = 0, a = 0, b = 0, c = 0, d = 1; char ch[6002]; scanf("%d", &n); for (m = 0; m <= n; m++) { scanf("%c", &ch[m]); if (ch[m] == 'R') a++; if (ch[m] == 'G') b++; if (ch[m] == 'B') c++; } sum = a * b * c; for (i = 1; i <=...
#include <stdio.h> int main() { long long n, m, i, j, k, sum = 0, a = 0, b = 0, c = 0, d = 1; char ch[6002]; scanf("%lld", &n); for (m = 0; m <= n; m++) { scanf("%c", &ch[m]); if (ch[m] == 'R') a++; if (ch[m] == 'G') b++; if (ch[m] == 'B') c++; } sum = a * b * c; for (i =...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
228
n = int(input()) s = input() def im(l, x): return [i for i, _x in enumerate(l) if _x == x] R = im(s, "R") G = im(s, "G") B = im(s, "B") ext = 0 if n >= 3: for i in range((n-3)//2): for j in range(n-(3+2*i)+1): if s[j] != s[j+i+1] and s[j] != s[j+2*(i+1)] and s[j+i+1] != s[j+2*(i+1)]: ...
n = int(input()) s = input() def im(l, x): return [i for i, _x in enumerate(l) if _x == x] R = im(s, "R") G = im(s, "G") B = im(s, "B") ext = 0 if n >= 3: for i in range((n-3)//2+1): for j in range(n-(3+2*i)+1): if s[j] != s[j+i+1] and s[j] != s[j+2*(i+1)] and s[j+i+1] != s[j+2*(i+1)]: ...
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
188
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; int main() { int n; cin >> n; string s; cin >> s; vector<int> r_cnt(n, 0); vector<int> g_cnt(n, 0); vector<int> b_cnt(n, 0); if (s[n - 1] == 'R') r_cnt[n - ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; int main() { int n; cin >> n; string s; cin >> s; vector<int> r_cnt(n, 0); vector<int> g_cnt(n, 0); vector<int> b_cnt(n, 0); if (s[n - 1] == 'R') r_cnt[n - ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
513
n = int(input()) s = str(input()) R, G, B = [], [], [] for i, c in enumerate(s): if c == 'R': R.append(i) elif c == 'G': G.append(i) else: B.append(i) ans = 0 for r in R: for g in G: if r < g: x, y = r, g else: x, y = g, r ans += len(X3) if x*2 - y >= 0: if s[x*2 - y] == 'B': ans -= 1 ...
n = int(input()) s = str(input()) R, G, B = [], [], [] for i, c in enumerate(s): if c == 'R': R.append(i) elif c == 'G': G.append(i) else: B.append(i) ans = 0 for r in R: for g in G: if r < g: x, y = r, g else: x, y = g, r ans += len(B) if x*2 - y >= 0: if s[x*2 - y] == 'B': ans -= 1 ...
[["-", 0, 1, 0, 677, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 677, 12, 652, 3, 4, 0, 22]]
5
203
/* * FileName: D * CreatedDate: 2020-04-12 22:07:32 +0900 * LastModified: 2020-04-12 22:27:36 +0900 */ #include <stdio.h> int main(void) { int n; scanf("%d", &n); char s[n]; scanf("%s", s); int r_c = 0, g_c = 0, b_c = 0; for (int i = 0; i < n; i++) { if (s[i] == 'R') { r_c++; } else...
/* * FileName: D * CreatedDate: 2020-04-12 22:07:32 +0900 * LastModified: 2020-04-12 22:36:42 +0900 */ #include <stdio.h> int main(void) { int n; scanf("%d", &n); char s[n]; scanf("%s", s); long int r_c = 0, g_c = 0, b_c = 0; for (int i = 0; i < n; i++) { if (s[i] == 'R') { r_c++; }...
[["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
205
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; int main(void) { // Your code here!" int n, sum = 0; string s; cin >> n >> s; vector<int> r, g, b; for (int i = 0; i < n; i++) { if (s[i] == 'R') { r.push_back(i); } else if (s[i] == 'G') { ...
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; int main(void) { // Your code here!" long int n, sum = 0; string s; cin >> n >> s; vector<long int> r, g, b; for (int i = 0; i < n; i++) { if (s[i] == 'R') { r.push_back(i); } else if (s[i] == 'G...
[["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["+", 39, 344, 3, 347, 0, 77, 39, 86, 0, 96]]
1
229
#include <iostream> #include <string> using namespace std; int main() { int N; string S; long long ans = 0; int i, j, k, rc = 0, gc = 0, bc = 0; cin >> N >> S; for (int l = 0; l < N; l++) { if (S[l] == 'R') { rc++; } else if (S[l] == 'G') { gc++; } else if (S[l] == 'B') { bc+...
#include <iostream> #include <string> using namespace std; int main() { int N; string S; long long ans = 0; long long i, j, k, rc = 0, gc = 0, bc = 0; cin >> N >> S; for (int l = 0; l < N; l++) { if (S[l] == 'R') { rc++; } else if (S[l] == 'G') { gc++; } else if (S[l] == 'B') { ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]]
1
231
import java.io.*; import java.math.*; import java.util.*; class Main { public static void main(String[] args) throws Exception { // your code goes here BufferedReader bu = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(bu.readLine()); int i, j, blue = 0; char s[] =...
import java.io.*; import java.math.*; import java.util.*; class Main { public static void main(String[] args) throws Exception { // your code goes here BufferedReader bu = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(bu.readLine()); int i, j, blue = 0; char s[] =...
[["-", 0, 195, 8, 196, 0, 503, 39, 506, 0, 507], ["+", 0, 195, 8, 196, 0, 503, 39, 506, 0, 96], ["-", 8, 7, 8, 196, 0, 1, 0, 11, 17, 107], ["+", 8, 7, 8, 196, 0, 1, 0, 11, 17, 32], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 31, 22], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 17, 72]]
3
415
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int countR_l(int n, char s[]) { int count = 0; int i; for (i = 0; i < n; i++) { if (s[i] == 'R') count++; } return count; } int countG_l(int n, char s[]) { int count = 0; int i; for (i = 0; i < n; i++) { if (s[i...
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int countR_l(int n, char s[]) { int count = 0; int i; for (i = 0; i < n; i++) { if (s[i] == 'R') count++; } return count; } int countG_l(int n, char s[]) { int count = 0; int i; for (i = 0; i < n; i++) { if (s[i...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 39, 40], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
909
#include <bits/stdc++.h> #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; int cR = 0, cG = 0, cB = 0; REP(i, N) { if (S[i] == 'R') cR++; if (S[i] == 'G') cG++; if (S[i] == 'B') cB++; ...
#include <bits/stdc++.h> #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; LL cR = 0, cG = 0, cB = 0; REP(i, N) { if (S[i] == 'R') cR++; if (S[i] == 'G') cG++; if (S[i] == 'B') cB++; }...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
204
#include <iostream> #include <string> using namespace std; int main() { int N; cin >> N; if (N < 3) { cout << 0 << endl; return 0; } string S; cin >> S; int r_cnt = 0; int g_cnt = 0; int b_cnt = 0; int result = 0; for (int i = 0; i < N; i++) { if (S[i] == 'R') { r_cnt++; ...
#include <iostream> #include <string> using namespace std; int main() { int N; cin >> N; if (N < 3) { cout << 0 << endl; return 0; } string S; cin >> S; long r_cnt = 0; long g_cnt = 0; long b_cnt = 0; long result = 0; for (int i = 0; i < N; i++) { if (S[i] == 'R') { r_cnt++; ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]]
1
238
n = int(input().strip()) s = '_' + input().strip() s += ''.join(['_'] * 10 ** 5) r = [] g = [] b = [] for i in range(1, n + 1): if s[i] == 'R': r.append(i) elif s[i] == 'G': g.append(i) elif s[i] == 'B': b.append(i) le = len(b) ans = len(r) * len(g) * le for x in r: for y in g: ...
n = int(input().strip()) s = '_' + input().strip() s += ''.join(['_'] * 10 ** 5) r = [] g = [] b = [] for i in range(1, n + 1): if s[i] == 'R': r.append(i) elif s[i] == 'G': g.append(i) elif s[i] == 'B': b.append(i) le = len(b) ans = len(r) * len(g) * le for x in r: for y in g: ...
[["-", 0, 7, 8, 196, 0, 57, 15, 679, 17, 354], ["+", 8, 196, 0, 7, 8, 196, 0, 57, 0, 102], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 31, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 17, 110], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 12, 612], ["+", 8, 196, 0, 7, 8, 196, 0, 57, 0, 121]]
5
230
#include <algorithm> #include <iostream> #include <string> #include <time.h> #include <vector> #define REP(i, n) for (int i = 0; i < n; i++) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOR(i, m, n) for (int i = m; i < n; i++) #define INF 2e9 #define ALL(v) v.begin(), v.end() using namespace std; typedef lon...
#include <algorithm> #include <iostream> #include <string> #include <time.h> #include <vector> #define REP(i, n) for (int i = 0; i < n; i++) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOR(i, m, n) for (int i = m; i < n; i++) #define INF 2e9 #define ALL(v) v.begin(), v.end() using namespace std; typedef lon...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
318
#include <algorithm> #include <iostream> #include <vector> #define int long long using namespace std; signed main() { int n, sumr = 0, sumb = 0, sumg = 0; vector<char> ch; cin >> n; ch.resize(n); for (int i = 0; i < n; i++) { cin >> ch[i]; if (ch[i] == 'R') sumr++; if (ch[i] == 'B') ...
#include <algorithm> #include <iostream> #include <vector> #define int long long using namespace std; signed main() { int n, sumr = 0, sumb = 0, sumg = 0; vector<char> ch; cin >> n; ch.resize(n); for (int i = 0; i < n; i++) { cin >> ch[i]; if (ch[i] == 'R') sumr++; if (ch[i] == 'B') ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
228
#include <bits/stdc++.h> using namespace std; int main() { int n; scanf("%d", &n); char a[n]; long long sum = 0; scanf("%s", a); int r = 0, g = 0, b = 0; for (int i = 0; i < n; i++) { if (a[i] == 'R') r++; else if (a[i] == 'G') g++; else if (a[i] == 'B') b++; } sum = r * ...
#include <bits/stdc++.h> using namespace std; int main() { int n; scanf("%d", &n); char a[n + 5]; long long sum = 0; scanf("%s", a); int r = 0, g = 0, b = 0; for (int i = 0; i < n; i++) { if (a[i] == 'R') r++; else if (a[i] == 'G') g++; else if (a[i] == 'B') b++; } sum = ...
[["+", 8, 9, 0, 43, 49, 80, 81, 16, 17, 72], ["+", 8, 9, 0, 43, 49, 80, 81, 16, 12, 13], ["+", 0, 11, 12, 16, 31, 16, 31, 74, 0, 24], ["+", 31, 16, 31, 74, 39, 77, 39, 86, 0, 96], ["+", 0, 11, 12, 16, 31, 16, 31, 74, 0, 25]]
1
293
n = int(input()) s = input() rc = s.count('R') gc = s.count('G') bc = s.count('B') ans = rc*gc*bc for i in range(n): if s[i] == 'R': for j in range(1,min(n-i-1, i-1)+1): if s[i-j] != s[i+j] and s[i-j] != 'R' and s[i+j] != 'R': ans -= 1 for j in range(1,int((n-i-1)/2)+1...
n = int(input()) s = input() rc = s.count('R') gc = s.count('G') bc = s.count('B') ans = rc*gc*bc for i in range(n): if s[i] == 'R': for j in range(1,min(n-i-1, i)+1): if s[i-j] != s[i+j] and s[i-j] != 'R' and s[i+j] != 'R': ans -= 1 for j in range(1,int((n-i-1)/2)+1):...
[["-", 0, 657, 31, 652, 3, 4, 0, 657, 17, 33], ["-", 0, 657, 31, 652, 3, 4, 0, 657, 12, 612], ["-", 3, 4, 0, 657, 31, 652, 3, 4, 0, 24], ["-", 3, 4, 0, 657, 31, 23, 0, 657, 17, 33], ["-", 3, 4, 0, 657, 31, 23, 0, 657, 12, 612], ["-", 31, 652, 3, 4, 0, 657, 31, 23, 0, 25]]
5
267
N = int(input()) S = input() rList = [] gList = [] bList = [] for indx in range(N): if S[indx] == 'R': rList.append(indx) elif S[indx] == 'G': gList.append(indx) elif S[indx] == 'B': bList.append(indx) NoSum = 0 fList = rList sList = gList remain = 'B' for fItem in fList: for...
N = int(input()) S = input() rList = [] gList = [] bList = [] for indx in range(N): if S[indx] == 'R': rList.append(indx) elif S[indx] == 'G': gList.append(indx) elif S[indx] == 'B': bList.append(indx) NoSum = 0 fList = rList sList = gList remain = 'B' for fItem in fList: for...
[["-", 0, 7, 8, 196, 0, 1, 0, 677, 31, 22], ["-", 0, 7, 8, 196, 0, 1, 0, 677, 17, 107], ["-", 0, 7, 8, 196, 0, 1, 0, 677, 12, 612]]
5
244
# import numpy as np # import math # import copy # from collections import deque import sys input = sys.stdin.readline # sys.setrecursionlimit(10000) def main(): N = int(input()) S = input().rstrip() R = set([]) G = set([]) B = set([]) for i in range(N): temp = S[i] if temp =...
# import numpy as np # import math # import copy # from collections import deque import sys input = sys.stdin.readline # sys.setrecursionlimit(10000) def main(): N = int(input()) S = input().rstrip() R = set([]) G = set([]) B = set([]) for i in range(N): temp = S[i] if temp =...
[["-", 0, 14, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
276
#include <bits/stdc++.h> using namespace std; const int MOD = 1000000007; const int INF = 1000000000; // long long using ll = long long; //出力系 #define print(x) cout << x << endl #define yes cout << "Yes" << endl #define YES cout << "YES" << endl #define no cout << "No" << endl #define NO cout << "NO" << endl // beg...
#include <bits/stdc++.h> using namespace std; const int MOD = 1000000007; const int INF = 1000000000; // long long using ll = long long; //出力系 #define print(x) cout << x << endl #define yes cout << "Yes" << endl #define YES cout << "YES" << endl #define no cout << "No" << endl #define NO cout << "NO" << endl // beg...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
414
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define INF (INT_MAX / 4) #define REP(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i) #define TIMER_S(start) \ chrono::system_clock::time_point start = chrono::system_clock::now(); #define...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define INF (INT_MAX / 4) #define REP(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i) #define TIMER_S(start) \ chrono::system_clock::time_point start = chrono::system_clock::now(); #define...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
257
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i <= (int)(n); ++i) #define REP(i, n_1, n_2) for (int i = (int)(n_1); i <= (int)(n_2); ++i) #define ll long long #define P pair<int, int> int main() { int n; cin >> n; string s; cin >> s; ll int ans = 0; int r = 0, g = 0, b = 0...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i <= (int)(n); ++i) #define REP(i, n_1, n_2) for (int i = (int)(n_1); i <= (int)(n_2); ++i) #define ll long long #define P pair<int, int> int main() { int n; cin >> n; string s; cin >> s; ll int ans = 0; ll int r = 0, g = 0, b ...
[["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
216
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; int main() { int n; string s; cin >> n >> s; vector<int> r; vector<int> g; vector<int> b; rep(i, n) { if (s.at(i) == 'R') r.push_back(i); else if (s.at(i) == 'G') g.push...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; int main() { int n; string s; cin >> n >> s; vector<int> r; vector<int> g; vector<int> b; rep(i, n) { if (s.at(i) == 'R') r.push_back(i); else if (s.at(i) == 'G') g.push...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 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
272
#include <bits/stdc++.h> #define REP(i, s, n) for (int i = s; i < n; i++) #define ALL(a) a.begin(), a.end() #define MOD 1000000007 using namespace std; typedef long long ll; int main() { int N; string S; cin >> N >> S; int r = 0, g = 0, b = 0; REP(i, 0, N) { if (S[i] == 'R') r++; if (S[i] == 'G...
#include <bits/stdc++.h> #define REP(i, s, n) for (int i = s; i < n; i++) #define ALL(a) a.begin(), a.end() #define MOD 1000000007 using namespace std; typedef long long ll; int main() { int N; string S; cin >> N >> S; int r = 0, g = 0, b = 0; REP(i, 0, N) { if (S[i] == 'R') r++; if (S[i] == 'G...
[["+", 12, 16, 31, 16, 31, 16, 31, 74, 0, 24], ["+", 31, 16, 31, 16, 31, 74, 39, 77, 39, 78], ["+", 12, 16, 31, 16, 31, 16, 31, 74, 0, 25]]
1
212
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define ALL(a) (a).begin(), (a).end() #define RALL(a) (a).rbegin(), (a).rend() #define pb push_back using ll = long long; using P = pair<int, int>; using Graph = vector<vector<int>>; int main() { int n; cin >> n; string...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define ALL(a) (a).begin(), (a).end() #define RALL(a) (a).rbegin(), (a).rend() #define pb push_back using ll = long long; using P = pair<int, int>; using Graph = vector<vector<int>>; int main() { int n; cin >> n; string...
[["+", 0, 7, 8, 9, 0, 57, 64, 116, 0, 117], ["+", 0, 7, 8, 9, 0, 57, 64, 116, 0, 35]]
1
240
#include <iostream> #include <map> #include <math.h> #include <string> #include <vector> using namespace std; int main() { int n; cin >> n; string s; cin >> s; map<char, int> cnt; for (int i = 0; i < n; i++) cnt[s[i]]++; long long ans = cnt['R'] * cnt['G'] * cnt['B']; for (int i = 0; i < n; ++i) {...
#include <iostream> #include <map> #include <math.h> #include <string> #include <vector> using namespace std; int main() { long long n; cin >> n; string s; cin >> s; map<char, long long> cnt; for (int i = 0; i < n; i++) cnt[s[i]]++; long long ans = cnt['R'] * cnt['G'] * cnt['B']; for (int i = 0; i...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 39, 344, 3, 347, 0, 77, 39, 86, 0, 96]]
1
180
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; int main() { int n; cin >> n; string s; cin >> s; int r = 0, g = 0, b = 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) using namespace std; using ll = long long; using P = pair<int, int>; int main() { int n; cin >> n; string s; cin >> s; ll r = 0, g = 0, b = 0; rep(i, n) { if (s[i] == 'R') r++; else if (s[i] == 'G') g++; else ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
206
#include <bits/stdc++.h> using namespace std; #define all(v) v.begin(), v.end() #define rep(i, n) for (int i = 0; i < n; i++) typedef long long ll; int main() { int N; cin >> N; string S; cin >> S; map<char, int> m; for (int i = 0; i < N; i++) { m[S[i]]++; } ll sum = m['R'] * m['G'] * m['B']; ll...
#include <bits/stdc++.h> using namespace std; #define all(v) v.begin(), v.end() #define rep(i, n) for (int i = 0; i < n; i++) typedef long long ll; int main() { int N; cin >> N; string S; cin >> S; map<char, ll> m; for (int i = 0; i < N; i++) { m[S[i]]++; } ll sum = m['R'] * m['G'] * m['B']; ll ...
[["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78]]
1
207
#include <iostream> #include <vector> int main() { int N; std::string str; std::cin >> N; std::cin >> str; int N_R = 0; int N_G = 0; int N_B = 0; for (int i = 0; i < N; i++) { if (str[i] == 'R') N_R++; if (str[i] == 'G') N_G++; if (str[i] == 'B') N_B++; } long long re...
#include <iostream> #include <vector> int main() { int N; std::string str; std::cin >> N; std::cin >> str; long long N_R = 0; long long N_G = 0; long long N_B = 0; for (int i = 0; i < N; i++) { if (str[i] == 'R') N_R++; if (str[i] == 'G') N_G++; if (str[i] == 'B') N_B++; ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]]
1
213
#include "bits/stdc++.h" using namespace std; typedef int64_t ll; typedef vector<int64_t> vll; typedef vector<vll> vvll; typedef vector<bool> vb; typedef vector<vb> vvb; typedef vector<int> vin; typedef vector<vin> vvin; typedef vector<vvin> vvvin; typedef pair<ll, ll> P; typedef vector<P> vp; typedef vector<double> v...
#include "bits/stdc++.h" using namespace std; typedef int64_t ll; typedef vector<int64_t> vll; typedef vector<vll> vvll; typedef vector<bool> vb; typedef vector<vb> vvb; typedef vector<int> vin; typedef vector<vin> vvin; typedef vector<vvin> vvvin; typedef pair<ll, ll> P; typedef vector<P> vp; typedef vector<double> v...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 8, 9, 0, 9, 0, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 9, 0, 9, 0, 43, 39, 78]]
1
404
#include "bits/stdc++.h" using namespace std; typedef int64_t ll; typedef vector<int64_t> vll; typedef vector<vll> vvll; typedef vector<bool> vb; typedef vector<vb> vvb; typedef vector<int> vin; typedef vector<vin> vvin; typedef vector<vvin> vvvin; typedef pair<ll, ll> P; typedef vector<P> vp; typedef vector<double> v...
#include "bits/stdc++.h" using namespace std; typedef int64_t ll; typedef vector<int64_t> vll; typedef vector<vll> vvll; typedef vector<bool> vb; typedef vector<vb> vvb; typedef vector<int> vin; typedef vector<vin> vvin; typedef vector<vvin> vvvin; typedef pair<ll, ll> P; typedef vector<P> vp; typedef vector<double> v...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 8, 9, 0, 9, 0, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 9, 0, 9, 0, 43, 39, 78]]
1
490
#include <bits/stdc++.h> typedef long long ll; using namespace std; #define all(x) (x).begin(), (x).end() #define eb emplace_back #define mp make_pair #define pb push_back #define fi first #define se second #define sz(x) ((int)(x).size()) #define rep(x, y, z) for (int x = y; x < z; x++) #define per(x, z, y) for (int ...
#include <bits/stdc++.h> typedef long long ll; using namespace std; #define all(x) (x).begin(), (x).end() #define eb emplace_back #define mp make_pair #define pb push_back #define fi first #define se second #define sz(x) ((int)(x).size()) #define rep(x, y, z) for (int x = y; x < z; x++) #define per(x, z, y) for (int ...
[["-", 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, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
372
#include <bits/stdc++.h> #define _GLIBCXX_DEBUG #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() using namespace std; using ll = long long; using vpii = vector<pair<int, int>>; using vpll = vector<pair<ll, ll>>; // ceil() 切り上げ, floor() 切り捨て // next_permutation(all(x)) int main(void) { ...
#include <bits/stdc++.h> #define _GLIBCXX_DEBUG #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() using namespace std; using ll = long long; using vpii = vector<pair<int, int>>; using vpll = vector<pair<ll, ll>>; // ceil() 切り上げ, floor() 切り捨て // next_permutation(all(x)) int main(void) { ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 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
296
#include <bits/stdc++.h> typedef long long ll; #define pb push_back #define fi first #define se second #define mod 1000000007 #define pi acos(-1.0) #define FastIO \ ios::sync_with_stdio(0); \ cin.tie(...
#include <bits/stdc++.h> typedef long long ll; #define pb push_back #define fi first #define se second #define mod 1000000007 #define pi acos(-1.0) #define FastIO \ ios::sync_with_stdio(0); \ cin.tie(...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22]]
1
237
#include <algorithm> #include <cmath> #include <iomanip> //doubleの桁数指定 setprecision() #include <iostream> #include <list> //前後に数値を入れれる配列 #include <map> //map #include <string> //文字列 #include <vector> //vecror #define REP(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i++) // forの短縮 #define rep(i, n) REP(i, 0, n) ...
#include <algorithm> #include <cmath> #include <iomanip> //doubleの桁数指定 setprecision() #include <iostream> #include <list> //前後に数値を入れれる配列 #include <map> //map #include <string> //文字列 #include <vector> //vecror #define REP(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i++) // forの短縮 #define rep(i, n) REP(i, 0, n) ...
[["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 85], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
227
#include <bits/stdc++.h> using namespace std; int main() { int n, r = 0, g = 0, b = 0, rgb, unchi = 0; int i, j; string s; cin >> n; cin >> s; for (i = 0; i < n; i++) { if (s[i] == 'R') r++; else if (s[i] == 'G') g++; else if (s[i] == 'B') b++; } rgb = r * g * b; for (i ...
#include <bits/stdc++.h> using namespace std; int main() { long n, r = 0, g = 0, b = 0, rgb, unchi = 0; int i, j; string s; cin >> n; cin >> s; for (i = 0; i < n; i++) { if (s[i] == 'R') r++; else if (s[i] == 'G') g++; else if (s[i] == 'B') b++; } rgb = r * g * b; for (i...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]]
1
217
#include <bits/stdc++.h> using namespace std; int main() { string S; int N; cin >> N; cin >> S; int r = count(S.begin(), S.end(), 'R'); int g = count(S.begin(), S.end(), 'G'); int b = count(S.begin(), S.end(), 'B'); int x = 0; for (int i = 0; i < N; i++) { for (int j = i + 1; j < N; j++) { ...
#include <bits/stdc++.h> using namespace std; int main() { string S; int N; cin >> N; cin >> S; long r = count(S.begin(), S.end(), 'R'); long g = count(S.begin(), S.end(), 'G'); long b = count(S.begin(), S.end(), 'B'); long x = 0; for (int i = 0; i < N; i++) { for (int j = i + 1; j < N; j++) { ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["+", 0, 16, 31, 16, 12, 16, 12, 23, 0, 24], ["+", 0, 16, 31, 16, 12, 16, 12, 23, 0, 25]]
1
200
#include <bits/stdc++.h> #define fi first #define se second #define rep(i, n) for (int i = 0; i < (n); ++i) #define rrep(i, n) for (int i = 1; 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 maxs(x, y) (x = ma...
#include <bits/stdc++.h> #define fi first #define se second #define rep(i, n) for (int i = 0; i < (n); ++i) #define rrep(i, n) for (int i = 1; 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 maxs(x, y) (x = ma...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
732
#include <bits/stdc++.h> #include <numeric> #define rep(i, n) for (int i = 0; i < n; ++i) #define rep1(i, n) for (int i = 1; i <= n; ++i) template <typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } template <typename T> inline bool chmax(T &a, T b) { if (a < b) { ...
#include <bits/stdc++.h> #include <numeric> #define rep(i, n) for (int i = 0; i < n; ++i) #define rep1(i, n) for (int i = 1; i <= n; ++i) template <typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } template <typename T> inline bool chmax(T &a, T b) { if (a < b) { ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
370
#include <bits/stdc++.h> #include <numeric> #define rep(i, n) for (int i = 0; i < n; ++i) #define rep1(i, n) for (int i = 1; i <= n; ++i) template <typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } template <typename T> inline bool chmax(T &a, T b) { if (a < b) { ...
#include <bits/stdc++.h> #include <numeric> #define rep(i, n) for (int i = 0; i < n; ++i) #define rep1(i, n) for (int i = 1; i <= n; ++i) template <typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } template <typename T> inline bool chmax(T &a, T b) { if (a < b) { ...
[["-", 8, 9, 0, 9, 0, 43, 49, 50, 49, 22], ["+", 8, 9, 0, 9, 0, 43, 49, 50, 49, 22]]
1
727
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(); long sum = 0; int r = 0; int g = 0; int b = 0; for (int i = 0; i < n; i++) { if (s.charAt(i) == 'R') { 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(); long sum = 0; long r = 0; long g = 0; long b = 0; for (int i = 0; i < n; i++) { if (s.charAt(i) == 'R') { r+...
[["-", 0, 195, 8, 196, 0, 503, 39, 506, 0, 507], ["+", 0, 195, 8, 196, 0, 503, 39, 506, 0, 96]]
3
267
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define INF 1e9 #define PI 3.14159265359 #define MOD 1000000007 #define ALL(v) v.begin(), v.end() #define ALLR(v) v.rbegin(), v.rend() typedef long long ll; const int dx[4] = {1, 0, -1, 0}; const int dy[4] = {0, 1, 0, -1}...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define INF 1e9 #define PI 3.14159265359 #define MOD 1000000007 #define ALL(v) v.begin(), v.end() #define ALLR(v) v.rbegin(), v.rend() typedef long long ll; const int dx[4] = {1, 0, -1, 0}; const int dy[4] = {0, 1, 0, -1}...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
290
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stdlib.h> #include <string.h> #include <string> #include <tuple> #include <vector> #define rep(i, n) for (int i = 1; i <= (n); ++i) using namespace std; #define PI 3.14159265358979 typedef long long int l...
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stdlib.h> #include <string.h> #include <string> #include <tuple> #include <vector> #define rep(i, n) for (int i = 1; i <= (n); ++i) using namespace std; #define PI 3.14159265358979 typedef long long int l...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
336
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i) typedef long long ll; #define pb push_back void Yes() { cout << "Yes" << endl; } void No() { cout << "No" << endl; } void YES() { cout << "YES" << endl; } void NO() { cout << "NO" << endl; } const double PI ...
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i) typedef long long ll; #define pb push_back void Yes() { cout << "Yes" << endl; } void No() { cout << "No" << endl; } void YES() { cout << "YES" << endl; } void NO() { cout << "NO" << endl; } const double PI ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
297
#include <stdio.h> int main(void) { int n; scanf("%d", &n); char s[4010]; scanf("%s", s); int r, g, b; r = g = b = 0; for (int i = 0; i < n; i++) { switch (s[i]) { case 'R': r++; break; case 'G': g++; break; case 'B': b++; break; } } long lon...
#include <stdio.h> int main(void) { int n; scanf("%d", &n); char s[4010]; scanf("%s", s); long long int r, g, b; r = g = b = 0; for (int i = 0; i < n; i++) { switch (s[i]) { case 'R': r++; break; case 'G': g++; break; case 'B': b++; break; } } ...
[["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]]
0
216