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 <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <vector> typedef long long ll; typedef unsigned long long ull; using namespace std; #define FAL...
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <vector> typedef long long ll; typedef unsigned long long ull; using namespace std; #define FAL...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
787
#include <bits/stdc++.h> using namespace std; int main() { int N; string S; cin >> N >> S; long long c = count(S.begin(), S.end(), 'R') * count(S.begin(), S.end(), 'G') * count(S.begin(), S.end(), 'B'); for (int i = 0; i < N - 3; i++) { char I = S[i]; for (int d = 1; i + d + d < N; d+...
#include <bits/stdc++.h> using namespace std; int main() { int N; string S; cin >> N >> S; long long c = count(S.begin(), S.end(), 'R') * count(S.begin(), S.end(), 'G') * count(S.begin(), S.end(), 'B'); for (int i = 0; i < N - 2; i++) { char I = S[i]; for (int d = 1; i + d + d < N; d+...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
179
n = int(input()) s = input() r = [] g = [] b = [] for i in range(len(s)): t = s[i] if t == 'R': r.append(i+1) elif t == 'G': g.append(i+1) else: b.append(i+1) ans = len(r) * len(g) * len(b) for i in range(1, int((n-1)/2)): for j in range(n-i-i, 0, -1): if s[j-1] !=...
n = int(input()) s = input() r = [] g = [] b = [] for i in range(len(s)): t = s[i] if t == 'R': r.append(i+1) elif t == 'G': g.append(i+1) else: b.append(i+1) ans = len(r) * len(g) * len(b) for i in range(1, int((n-1)/2)+1): for j in range(n-i-i, 0, -1): if s[j-1] ...
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
196
#include <algorithm> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <vector> using namespace std; void __print(int x) { cer...
#include <algorithm> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <vector> using namespace std; void __print(int x) { cer...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
833
#include <bits/stdc++.h> #include <math.h> #define rep(i, n) for (int i = 0; (int)(i) < n; i++) using namespace std; int main() { int N; string S; cin >> N >> S; int r = 0; int g = 0; int b = 0; for (char c : S) { if (c == 'R') r++; else if (c == 'G') g++; else b++; } ...
#include <bits/stdc++.h> #include <math.h> #define rep(i, n) for (int i = 0; (int)(i) < n; i++) using namespace std; int main() { int N; string S; cin >> N >> S; long long r = 0, g = 0, b = 0; for (char c : S) { if (c == 'R') r++; else if (c == 'G') g++; else b++; } long ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21]]
1
197
#include <stdio.h> #include <stdlib.h> int main() { int N = 0; scanf("%d", &N); char str[N + 1]; scanf("%s", str); int count = 0; int b = 0; for (int i = 0; i < N; i++) if (str[i] == 'B') b++; for (int i = 0; i < N; i++) { for (int k = i + 1; k < N; k++) { if ((str[i] == 'R' && str[...
#include <stdio.h> #include <stdlib.h> int main() { int N = 0; scanf("%d", &N); char str[N + 1]; scanf("%s", str); long count = 0; long b = 0; for (int i = 0; i < N; i++) if (str[i] == 'B') b++; for (int i = 0; i < N; i++) { for (int k = i + 1; k < N; k++) { if ((str[i] == 'R' && st...
[["-", 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
266
#include <bits/stdc++.h> using namespace std; #define ll long long int #define pb push_back #define mp make_pair #define ios \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); ...
#include <bits/stdc++.h> using namespace std; #define ll long long int #define pb push_back #define mp make_pair #define ios \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); ...
[["-", 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, 0, 35], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
448
/* ****mittal**** */ #include <bits/stdc++.h> #define ll long long int #define pb push_back #define endl '\n' #define pii pair<ll int, ll int> #define vi vector<ll int> #define all(a) (a).begin(), (a).end() #define F first #define S second #define sz(x) (ll int)x.size() #define hell 1000000007 #define jell 998244353 #d...
/* ****mittal**** */ #include <bits/stdc++.h> #define ll long long int #define pb push_back #define endl '\n' #define pii pair<ll int, ll int> #define vi vector<ll int> #define all(a) (a).begin(), (a).end() #define F first #define S second #define sz(x) (ll int)x.size() #define hell 1000000007 #define jell 998244353 #d...
[["-", 15, 16, 12, 16, 31, 23, 0, 16, 12, 13], ["+", 15, 16, 12, 16, 31, 23, 0, 16, 12, 13]]
1
418
#include <iostream> using namespace std; char getThird(char a, char b) { return ('R' + 'G' + 'B' - (a + b)); } int rgb(string inp) { const int len = inp.length(); if (len <= 3) return 0; int *r_count = new int[len + 1]; int *g_count = new int[len + 1]; int *b_count = new int[len + 1]; int *arrToUse = ...
#include <iostream> using namespace std; char getThird(char a, char b) { return ('R' + 'G' + 'B' - (a + b)); } long long rgb(string inp) { const int len = inp.length(); if (len <= 3) return 0; int *r_count = new int[len + 1]; int *g_count = new int[len + 1]; int *b_count = new int[len + 1]; int *arrTo...
[["-", 36, 36, 36, 36, 0, 30, 0, 14, 39, 40], ["+", 36, 36, 0, 30, 0, 14, 39, 86, 0, 96], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]]
1
453
#include <algorithm> #include <bitset> #include <cassert> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <sstream> #include <string> #include <vector> using namespace std; typedef long long ll; int main() { int N; ...
#include <algorithm> #include <bitset> #include <cassert> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <sstream> #include <string> #include <vector> using namespace std; typedef long long ll; int main() { int N; ...
[["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
464
#include <bits/stdc++.h> using namespace std; typedef long long int ll; int main() { // your code goes here int n; cin >> n; string s; cin >> s; ll sum = 0; int a = 0, b = 0, c = 0; for (int i = 0; i < n; i++) { if (s[i] == 'R') a++; else if (s[i] == 'G') b++; else c++; ...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; int main() { // your code goes here int n; cin >> n; string s; cin >> s; ll sum = 0; ll a = 0, b = 0, c = 0; for (int i = 0; i < n; i++) { if (s[i] == 'R') a++; else if (s[i] == 'G') b++; else c++; ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
202
#include <bits/stdc++.h> using namespace std; int main() { long long int i, j, k, t = 0; long long int n; string s; cin >> n >> s; int r = 0, g = 0, b = 0; for (i = 0; i < n; i++) { if (s[i] == 'R') r++; else if (s[i] == 'G') g++; else b++; } for (i = 1; i * 2 < n; i++) { ...
#include <bits/stdc++.h> using namespace std; int main() { long long int i, j, k, t = 0; long long int n; string s; cin >> n >> s; long long int r = 0, g = 0, b = 0; for (i = 0; i < n; i++) { if (s[i] == 'R') r++; else if (s[i] == 'G') g++; else b++; } for (i = 1; i * 2 < n...
[["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46]]
1
198
#include <bits/stdc++.h> using namespace std; int main() { int n; char s[4001]; scanf("%d%s", &n, s); int num[3] = {0}; for (int i = 0; i < n; i++) { if (s[i] == 'R') num[0]++; if (s[i] == 'G') num[1]++; if (s[i] == 'B') num[2]++; } long ans = num[0] * num[1] * num[2]; for...
#include <bits/stdc++.h> using namespace std; int main() { int n; char s[4001]; scanf("%d%s", &n, s); long num[3] = {0}; for (int i = 0; i < n; i++) { if (s[i] == 'R') num[0]++; if (s[i] == 'G') num[1]++; if (s[i] == 'B') num[2]++; } long ans = num[0] * num[1] * num[2]; fo...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]]
1
221
#include "bits/stdc++.h" using namespace std; using ll = long long; using pii = pair<int, int>; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; string s; cin >> n >> s; assert(n == (int)s.length()); for (char &c : s) { if (c == 'R') c = '0'; else if (c == 'G...
#include "bits/stdc++.h" using namespace std; using ll = long long; using pii = pair<int, int>; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; string s; cin >> n >> s; assert(n == (int)s.length()); for (char &c : s) { if (c == 'R') c = '0'; else if (c == 'G...
[["-", 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, 74, 0, 24], ["+", 0, 11, 12, 16, 31, 74, 39, 77, 39, 78], ["+", 0, 1, 0, 11, 12, 16, 31, 74, 0, 25]]
1
397
#include <iostream> using namespace std; static const int MAX_N = 4000; char S[MAX_N + 1]; int N; int main() { long long cnt = 0; cin >> N; for (int i = 1; i <= N; i++) cin >> S[i]; int cnt_r = 0; int cnt_b = 0; int cnt_g = 0; for (int i = 1; i <= N; i++) { switch (S[i]) { case 'R': ...
#include <iostream> using namespace std; static const int MAX_N = 4000; char S[MAX_N + 1]; int N; int main() { long long cnt = 0; cin >> N; for (int i = 1; i <= N; i++) cin >> S[i]; long long cnt_r = 0; long long cnt_b = 0; long long cnt_g = 0; for (int i = 1; i <= N; i++) { switch (S[i]) {...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]]
1
238
#include <bits/stdc++.h> using namespace std; #define ff first #define ss second #define int ll #define pb push_back #define setbits(x) __builtin_popcountll(x) #define endl "\n" typedef long long ll; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; string str; cin >> str; ...
#include <bits/stdc++.h> using namespace std; #define ff first #define ss second #define int ll #define pb push_back #define setbits(x) __builtin_popcountll(x) #define endl "\n" typedef long long ll; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; string str; cin >> str; ...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 17, 107], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 107], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
1
666
import java.util.*; class Main { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int r = 0, g = 0, b = 0; String text = sc.next(); char str[] = text.toCharArray(); for (int i = 0; i < n; i++) { switch (str[i]) { case 'R': ...
import java.util.*; class Main { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); long r = 0, g = 0, b = 0; String text = sc.next(); char str[] = text.toCharArray(); for (int i = 0; i < n; i++) { switch (str[i]) { case 'R': ...
[["-", 0, 195, 8, 196, 0, 503, 39, 506, 0, 507], ["+", 0, 195, 8, 196, 0, 503, 39, 506, 0, 96]]
3
236
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string s; cin >> s; int a = 0; int b = 0; int c = 0; for (int i = 0; i < n; i++) { if (s[i] == 'R') a++; else if (s[i] == 'G') b++; else c++; } long long sum = a * b * c; for (int i = 0; i < n...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string s; cin >> s; long long a = 0; long long b = 0; long long c = 0; for (int i = 0; i < n; i++) { if (s[i] == 'R') a++; else if (s[i] == 'G') b++; else c++; } long long sum = a * b * c; for...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]]
1
190
#include <bits/stdc++.h> #define ll long long int #define ss second #define ff first #define Mem(x, val) memset(x, val, sizeof x) #define pb push_back #define all(v) v.begin(), v.end() #define unik(v) v.erase(unique(v.begin(), v.end()), v.end()) #define cerr(x) cerr << __LINE__ << " th Line : " << #x << " = " << x << "...
#include <bits/stdc++.h> #define ll long long int #define ss second #define ff first #define Mem(x, val) memset(x, val, sizeof x) #define pb push_back #define all(v) v.begin(), v.end() #define unik(v) v.erase(unique(v.begin(), v.end()), v.end()) #define cerr(x) cerr << __LINE__ << " th Line : " << #x << " = " << x << "...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
265
import java.util.*; public class Main { Scanner sc = new Scanner(System.in); public static void main(String[] args) { new Main().run(); } void run() { int n = sc.nextInt(); char[] arr = sc.next().toCharArray(); long ans = 0; int cntR = 0; int cntG = 0; int cntB = 0; for (int i...
import java.util.*; public class Main { Scanner sc = new Scanner(System.in); public static void main(String[] args) { new Main().run(); } void run() { int n = sc.nextInt(); char[] arr = sc.next().toCharArray(); long ans = 0; long cntR = 0; long cntG = 0; long cntB = 0; for (in...
[["-", 0, 195, 8, 196, 0, 503, 39, 506, 0, 507], ["+", 0, 195, 8, 196, 0, 503, 39, 506, 0, 96]]
3
258
#include <algorithm> #include <cmath> #include <iostream> #include <stdio.h> #include <vector> #define rep(i, cc, n) for (int i = cc; i <= n; ++i) #define drep(i, cc, n) for (int i = cc; i >= n; --i) typedef long long ll; using namespace std; int main() { int n; string s; cin >> n; cin >> s; int r = 0; int...
#include <algorithm> #include <cmath> #include <iostream> #include <stdio.h> #include <vector> #define rep(i, cc, n) for (int i = cc; i <= n; ++i) #define drep(i, cc, n) for (int i = cc; i >= n; --i) typedef long long ll; using namespace std; int main() { int n; string s; cin >> n; cin >> s; int r = 0; int...
[["+", 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
229
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int n; string s; ll ans = 0; cin >> n >> s; int cnt_r = 0; int cnt_g = 0; int cnt_b = 0; for (int i = 0; i < n; i++) { if (s[i] == 'R') { cnt_r++; } else if (s[i] == 'G') { cnt_g++; } else { c...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll n; string s; ll ans = 0; cin >> n >> s; ll cnt_r = 0; ll cnt_g = 0; ll cnt_b = 0; for (int i = 0; i < n; i++) { if (s[i] == 'R') { cnt_r++; } else if (s[i] == 'G') { cnt_g++; } else { cnt_b...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
203
N = int(input()) S = input() result = 0 ''' for i in range(N): print(result) for j in range(i+1,N): if S[i] != S[j]: for k in range(j ,N): if k- j == j - i: continue if S[j] != S[k] and S[i] != S[k]: result +=1 print(res...
N = int(input()) S = input() result = 0 ''' for i in range(N): print(result) for j in range(i+1,N): if S[i] != S[j]: for k in range(j ,N): if k- j == j - i: continue if S[j] != S[k] and S[i] != S[k]: result +=1 print(res...
[["-", 31, 652, 3, 4, 0, 23, 0, 657, 17, 72], ["+", 31, 652, 3, 4, 0, 23, 0, 657, 17, 33]]
5
127
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; typedef long long ll; const int MOD = 1E9 + 7; const int INF = 1 << 29; int main() { int N; cin >> N; char S[N]; int CountR = 0; int CountG = 0; int CountB = 0; rep(i, N) { cin >> S[i]; if (S[i] == ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; typedef long long ll; const int MOD = 1E9 + 7; const int INF = 1 << 29; int main() { int N; cin >> N; char S[N]; ll CountR = 0; ll CountG = 0; ll CountB = 0; rep(i, N) { cin >> S[i]; if (S[i] == 'R'...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 8, 9, 0, 57, 64, 1, 0, 27, 17, 68], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 17, 110], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 12, 13]]
1
215
#include <algorithm> #include <array> #include <bitset> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <unordered_map> #include <un...
#include <algorithm> #include <array> #include <bitset> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <unordered_map> #include <un...
[["-", 36, 36, 36, 36, 0, 30, 0, 14, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 14, 39, 78]]
1
302
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int mod = 1000000007; int main() { int n; string s; cin >> n >> s; int r = 0, g = 0, b = 0; for (int i = 0; i < n; i++) { if (s[i] == 'R') r++; else if (s[i] == 'G') g++; else b++; } ll all = r * g *...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int mod = 1000000007; int main() { int n; string s; cin >> n >> s; ll r = 0, g = 0, b = 0; for (int i = 0; i < n; i++) { if (s[i] == 'R') r++; else if (s[i] == 'G') g++; else b++; } ll all = r * g * ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 8, 9, 0, 7, 8, 9, 0, 43, 39, 78], ["+", 8, 9, 0, 7, 8, 9, 0, 43, 39, 40]]
1
205
N=int(input()) S=input() s=0 s+=S.count('R')*S.count('G')*S.count('B') for i in range(N): for j in range(i+1,j): k=2*j-i if k<n and S[i]!=S[j] and S[j]!=S[k] and S[k]!=S[i]: s-=1 print(s)
N=int(input()) S=input() s=0 s+=S.count('R')*S.count('G')*S.count('B') for i in range(N): for j in range(i+1,N): k=2*j-i if k<N and S[i]!=S[j] and S[j]!=S[k] and S[k]!=S[i]: s-=1 print(s)
[["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 22], ["-", 15, 679, 31, 679, 31, 679, 31, 666, 0, 22], ["+", 15, 679, 31, 679, 31, 679, 31, 666, 0, 22]]
5
113
#include <iostream> #include <math.h> #include <queue> #include <stdio.h> #include <string> using namespace std; ///これでは解けない int main(int argc, char *argv[]) { int N; scanf("%d", &N); char S[N]; scanf("%s", S); int S_num[N]; long long len_RGB[3] = {0, 0, 0}; for (int i = 0; i < N; i++) { if (S[i] ...
#include <iostream> #include <math.h> #include <queue> #include <stdio.h> #include <string> using namespace std; ///これでは解けない int main(int argc, char *argv[]) { int N; scanf("%d", &N); char S[N]; scanf("%s", S); int S_num[N]; long long len_RGB[3] = {0, 0, 0}; for (int i = 0; i < N; i++) { if (S[i] ...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
301
#include "bits/stdc++.h" using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { map<char, int> mp; string S; int N, ans = 0, a, b, c; cin >> N >> S; for (auto s : S) { mp[s]++; } ans = mp['R'] * mp['G'] * mp['B']; for (int i = 0; i < N; i++) { for (int j = 1; j ...
#include "bits/stdc++.h" using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { map<char, long long> mp; string S; long long N, ans = 0, a, b, c; cin >> N >> S; for (auto s : S) { mp[s]++; } ans = mp['R'] * mp['G'] * mp['B']; for (int i = 0; i < N; i++) { for (i...
[["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 39, 344, 3, 347, 0, 77, 39, 86, 0, 96], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 31, 16, 12, 16, 31, 69, 341, 342, 0, 22], ["+", 31, 16, 12, 16, 31, 69, 341, 342, 0, 22], ["-", 51, 16, 12, 16, 31, 69, 341, 342, 0, 22],...
1
187
N = int(input()) S = input() nR = 0 nG = 0 nB = 0 cnt = 0 for i in range(N-1): if S[i] == 'R': nR += 1 elif S[i] == 'G': nG += 1 else: nB += 1 for j in range(i+1, N): k = j - i + j if k < N: L = [S[i], S[j], S[k]] if 'R' in L and 'G' in L and 'B' in L: cnt += 1 else: ...
N = int(input()) S = input() nR = 0 nG = 0 nB = 0 cnt = 0 for i in range(N): if S[i] == 'R': nR += 1 elif S[i] == 'G': nG += 1 else: nB += 1 for j in range(i+1, N): k = j - i + j if k < N: L = [S[i], S[j], S[k]] if 'R' in L and 'G' in L and 'B' in L: cnt += 1 else: ...
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 33], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
143
#include <algorithm> #include <iostream> #include <set> #include <vector> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define INF 1000000; #include <map> 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 <algorithm> #include <iostream> #include <set> #include <vector> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define INF 1000000; #include <map> 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
210
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(x) (x).begin(), (x).end() typedef long long ll; int main() { int N; string S; cin >> N >> S; int R = 0, G = 0, B = 0; rep(i, N) { if (S.at(i) == 'R') R++; else if (S.at(i) == 'G') ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(x) (x).begin(), (x).end() typedef long long ll; int main() { int N; string S; cin >> N >> S; ll R = 0, G = 0, B = 0; rep(i, N) { if (S.at(i) == 'R') R++; else if (S.at(i) == 'G') ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
213
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; string S; cin >> S; int B_sum = 0; for (int i = 0; i < N; ++i) if (S[i] == 'B') B_sum++; int ans = 0; for (int i = 0; i < N; ++i) { for (int j = i + 1; j < N; ++j) { if (S[i] == 'R' && S[j] == 'G') ...
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; string S; cin >> S; int B_sum = 0; for (int i = 0; i < N; ++i) if (S[i] == 'B') B_sum++; long long ans = 0; for (int i = 0; i < N; ++i) { for (int j = i + 1; j < N; ++j) { if (S[i] == 'R' && S[j] == 'G') ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]]
1
267
ースコード Copy Copy N=int(input()) S=list(input()) m=0 a=S.count("R") b=S.count("G") c=S.count("B") num=a*b*c for i in range(N-2): for j in range(i+1,N-1): k=2*j-i #削る条件 if k>N-1: break elif S[i]!=S[j] and S[j]!=S[k] and S[k]!=S[i]: m+=1 print(num-m)
N=int(input()) S=list(input()) m=0 a=S.count("R") b=S.count("G") c=S.count("B") num=a*b*c for i in range(N-2): for j in range(i+1,N-1): k=2*j-i #削る条件 if k>N-1: break elif S[i]!=S[j] and S[j]!=S[k] and S[k]!=S[i]: m+=1 print(num-m)
[["-", 36, 36, 36, 36, 0, 656, 0, 1, 0, 22]]
5
139
#include <bits/stdc++.h> using namespace std; typedef int64_t ll; typedef long double ld; const ll MOD = 1000000007; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) long long gcd(long long a, long long b) { ll gcdmax = max(a, b); ll gcdmin = min(a, b); while (true) { if (gcdmax % gcdmin == 0) break; ...
#include <bits/stdc++.h> using namespace std; typedef int64_t ll; typedef long double ld; const ll MOD = 1000000007; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) long long gcd(long long a, long long b) { ll gcdmax = max(a, b); ll gcdmin = min(a, b); while (true) { if (gcdmax % gcdmin == 0) break; ...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13]]
1
502
#include <iostream> using namespace std; void Main() { int n; string s; cin >> n >> s; int r = 0, g = 0, b = 0; for (int i = 0; i < n; i++) { if (s[i] == 'R') ++r; if (s[i] == 'G') ++g; if (s[i] == 'B') ++b; } int c = r * g * b; for (int i = 0; i < n - 2; i++) { for (...
#include <iostream> using namespace std; void Main() { int n; string s; cin >> n >> s; long r = 0, g = 0, b = 0; for (int i = 0; i < n; i++) { if (s[i] == 'R') ++r; if (s[i] == 'G') ++g; if (s[i] == 'B') ++b; } long c = r * g * b; for (int i = 0; i < n - 2; i++) { for...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]]
1
217
#include <iostream> #include <map> #include <math.h> #include <string> #include <vector> using namespace std; int main() { int N; unsigned long long int ans = 0; string s; map<char, int> mp; cin >> N >> s; for (int i = 0; i < s.size(); i++) { mp[s[i]]++; } ans = mp['R'] * mp['G'] * mp['B']; if (a...
#include <iostream> #include <map> #include <math.h> #include <string> #include <vector> using namespace std; int main() { int N; unsigned long long int ans = 0; string s; map<char, unsigned long long int> mp; cin >> N >> s; for (int i = 0; i < s.size(); i++) { mp[s[i]]++; } ans = mp['R'] * mp['G']...
[["+", 39, 344, 3, 347, 0, 77, 39, 86, 0, 87], ["+", 39, 344, 3, 347, 0, 77, 39, 86, 0, 96]]
1
239
#include <algorithm> #include <cmath> #include <iostream> #include <string> using namespace std; int main() { int n; cin >> n; string s; cin >> s; int r_num = 0; int g_num = 0; int b_num = 0; for (int i = 0; i < n; i++) { if (s[i] == 'R') { r_num += 1; } else if (s[i] == 'G') { g_n...
#include <algorithm> #include <cmath> #include <iostream> #include <string> using namespace std; int main() { int n; cin >> n; string s; cin >> s; long r_num = 0; long g_num = 0; long b_num = 0; for (int i = 0; i < n; i++) { if (s[i] == 'R') { r_num += 1; } else if (s[i] == 'G') { ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]]
1
240
#include <bits/stdc++.h> using namespace std; int N; string S; typedef unsigned long long ll; int main() { cin >> N >> S; int r = 0; int g = 0; int b = 0; for (int i = 0; i < N; i++) { char s = S[i]; if (s == 'R') r++; else if (s == 'G') g++; else b++; } ll res = r * g...
#include <bits/stdc++.h> using namespace std; int N; string S; typedef long long ll; int main() { cin >> N >> S; ll r = 0; ll g = 0; ll b = 0; for (int i = 0; i < N; i++) { char s = S[i]; if (s == 'R') r++; else if (s == 'G') g++; else b++; } ll res = r * g * b; for...
[["-", 36, 36, 0, 30, 0, 134, 39, 86, 0, 87], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
197
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define all(v) (v).begin(), (v).end() using ll = long long; using P = pair<int, int>; using T = tuple<int, int, int>; int N; string S; int main() { cin >> N >> S; vector<int> rc(N + 5, 0), gc(N + 5, 0), bc(N + 5, 0); v...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define all(v) (v).begin(), (v).end() using ll = long long; using P = pair<int, int>; using T = tuple<int, int, int>; int N; string S; int main() { cin >> N >> S; vector<int> rc(N + 5, 0), gc(N + 5, 0), bc(N + 5, 0); v...
[["+", 31, 16, 31, 16, 12, 16, 31, 16, 17, 33], ["+", 31, 16, 31, 16, 12, 16, 31, 16, 12, 13]]
1
463
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; #define REP(i, s, n) for (int i = s; i < (n); ++i) #define ALL(n) begin(n), end(n) using ll = long long; const ll INF = numeric_limits<ll>::max(); int main() { int N; string S; cin >> N >> S; int R_cnt = 0, G_cnt = 0, B_cnt = 0; REP(i, 0, ...
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; #define REP(i, s, n) for (int i = s; i < (n); ++i) #define ALL(n) begin(n), end(n) using ll = long long; const ll INF = numeric_limits<ll>::max(); int main() { int N; string S; cin >> N >> S; ll R_cnt = 0, G_cnt = 0, B_cnt = 0; REP(i, 0, N...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
212
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define rep1(i, n) for (int i = 1; i <= (n); ++i) using namespace std; using ll = long long; int main() { int n, ans = 0; string s; cin >> n >> s; vector<int> r, g, b; rep(i, n) { if (s[i] == 'R') r.push_back(i); else if ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define rep1(i, n) for (int i = 1; i <= (n); ++i) using namespace std; using ll = long long; int main() { ll n, ans = 0; string s; cin >> n >> s; vector<int> r, g, b; rep(i, n) { if (s[i] == 'R') r.push_back(i); else if (...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
233
#include <bits/stdc++.h> using namespace std; int main() { int N; string S; cin >> N >> S; int64_t sum = 0; 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++; } sum += r * g * b; for (int i = 0; i < N; ...
#include <bits/stdc++.h> using namespace std; int main() { int N; string S; cin >> N >> S; int64_t sum = 0; int64_t 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++; } sum += r * g * b; for (int i = 0; i <...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
1
209
import java.util.*; public class Main { // public static void main(String[] args) { // Scanner sc = new Scanner(System.in); // int N = sc.nextInt(); // int[] arr = new int[N]; // // for (int i = 0; i <N ; i++) { // arr[i] = sc.nextInt(); // } // // ...
import java.util.*; public class Main { // public static void main(String[] args) { // Scanner sc = new Scanner(System.in); // int N = sc.nextInt(); // int[] arr = new int[N]; // // for (int i = 0; i <N ; i++) { // arr[i] = sc.nextInt(); // } // /...
[["-", 0, 195, 8, 196, 0, 503, 39, 506, 0, 507], ["+", 0, 195, 8, 196, 0, 503, 39, 506, 0, 96]]
3
314
N = int(input()) S = str(input()) R,G,B = 0,0,0 for i in range(N): if S[i] == 'R': R += 1 elif S[i] == 'B': B += 1 else: G += 1 exc = 0 for j in range(2,N-1): num = 1 while 0 <= j-num and j+num < N: if S[j-num] != S[j+num] and S[j-num] != S[j] and S[j] != S[j+num]:...
N = int(input()) S = str(input()) R,G,B = 0,0,0 for i in range(N): if S[i] == 'R': R += 1 elif S[i] == 'B': B += 1 else: G += 1 exc = 0 for j in range(1,N-1): num = 1 while 0 <= j-num and j+num < N: if S[j-num] != S[j+num] and S[j-num] != S[j] and S[j] != S[j+num]:...
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612]]
5
155
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); String S = sc.next(); int nR = 0; int nG = 0; int nB = 0; for (int i = 0; i < N; i++) { switch (S.charAt(i)) { case 'R': n...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); String S = sc.next(); long nR = 0; long nG = 0; long nB = 0; for (int i = 0; i < N; i++) { switch (S.charAt(i)) { case 'R': ...
[["-", 0, 195, 8, 196, 0, 503, 39, 506, 0, 507], ["+", 0, 195, 8, 196, 0, 503, 39, 506, 0, 96]]
3
243
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <vector> using namespace std; void solve() { int n, ans = 0; cin >> n; string s; cin >> s; vector<map<char, int>> v(n, map<char, int>{{'R', 0}, {'G', 0}, {'B', 0}}); vector<int> r(n, 0), g(n, 0), b(n, 0); v[n - 1][s[n - 1]]...
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <vector> using namespace std; void solve() { int n, ans = 0; cin >> n; string s; cin >> s; vector<map<char, int>> v(n, map<char, int>{{'R', 0}, {'G', 0}, {'B', 0}}); vector<int> r(n, 0), g(n, 0), b(n, 0); v[n - 1][s[n - 1]]...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]]
1
439
#include <iostream> #include <math.h> #include <stdio.h> using namespace std; int main() { int n = 0, r = 0, g = 0, b = 0, sum = 0, dis = 0; string s; cin >> n >> s; for (int i = 0; i < n; i++) { switch ((int)s[i]) { case 82: r++; break; case 71: g++; break; case 66: ...
#include <iostream> #include <math.h> #include <stdio.h> using namespace std; int main() { long int n = 0, r = 0, g = 0, b = 0, sum = 0, dis = 0; string s; cin >> n >> s; for (int i = 0; i < n; i++) { switch ((int)s[i]) { case 82: r++; break; case 71: g++; break; case 66...
[["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["+", 8, 9, 0, 7, 15, 16, 31, 16, 31, 22], ["+", 8, 9, 0, 7, 15, 16, 31, 16, 17, 72], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 12, 22]]
1
194
#include <iostream> #include <math.h> #include <stdio.h> using namespace std; int main() { int n = 0, r = 0, g = 0, b = 0, sum = 0, dis = 0; string s; cin >> n >> s; /*for ( int i = 0; i < n; i++) { switch ((int)s[i]) { case 82: r++; break; case 71: g++; break...
#include <iostream> #include <math.h> #include <stdio.h> using namespace std; int main() { long int n = 0, r = 0, g = 0, b = 0, sum = 0, dis = 0; string s; cin >> n >> s; /*for ( int i = 0; i < n; i++) { switch ((int)s[i]) { case 82: r++; break; case 71: g++; ...
[["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 12, 22]]
1
200
#include <algorithm> #include <cstdlib> #include <iostream> using namespace std; int main() { int N; string S; std::cin >> N; std::cin >> S; long long a = 0; long long b = 0; long long c = 0; for (int i = 0; i < N; i++) { if (S[i] == 'R') a++; if (S[i] == 'G') b++; if (S[i] == ...
#include <algorithm> #include <cstdlib> #include <iostream> using namespace std; int main() { int N; string S; std::cin >> N; std::cin >> S; long long a = 0; long long b = 0; long long c = 0; for (int i = 0; i < N; i++) { if (S[i] == 'R') a++; if (S[i] == 'G') b++; if (S[i] == ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]]
1
214
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using vi = vector<int>; using vvi = vector<vi>; using vl = vector<ll>; using vvl = vector<vl>; using pii = pair<int, int>; using pll = pair<ll, ll>; const ll LINF = 0x1fffffffffffffff; const int INF = 0x3fffffff; const int MOD =...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using vi = vector<int>; using vvi = vector<vi>; using vl = vector<ll>; using vvl = vector<vl>; using pii = pair<int, int>; using pll = pair<ll, ll>; const ll LINF = 0x1fffffffffffffff; const int INF = 0x3fffffff; const int MOD =...
[["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
424
#include <bits/stdc++.h> using namespace std; int r[4002], g[4002], b[4002]; int main() { int n; string s; cin >> n >> s; int sum = 0; for (int i = n - 1; i >= 0; i--) { r[i] = r[i + 1]; g[i] = g[i + 1]; b[i] = b[i + 1]; if (s[i] == 'R') r[i] = r[i] + 1; if (s[i] == 'G') g[i] =...
#include <bits/stdc++.h> using namespace std; long long r[4002], g[4002], b[4002]; int main() { int n; string s; cin >> n >> s; long long sum = 0; for (int i = n - 1; i >= 0; i--) { r[i] = r[i + 1]; g[i] = g[i + 1]; b[i] = b[i + 1]; if (s[i] == 'R') r[i] = r[i] + 1; if (s[i] == 'G') ...
[["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 0, 30, 0, 43, 39, 86, 0, 96], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]]
1
430
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <sstream> #include <string> #include <vector> using namespace std; typedef unsigned long long ull; typedef long long ll; const int N = 4005; const int inf = 0x3f3f3f3f; vector<int> VR, VG, VB; char a[N...
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <sstream> #include <string> #include <vector> using namespace std; typedef unsigned long long ull; typedef long long ll; const int N = 4005; const int inf = 0x3f3f3f3f; vector<int> VR, VG, VB; char a[N...
[["+", 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
244
#include <bits/stdc++.h> #define ll long long 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[i] == 'R') r++; if (s[i] == 'G') g++; if (s[i] == 'B') b++; } int ans = r * g * b, sub = 0; f...
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { int n; cin >> n; string s; cin >> s; ll r = 0, g = 0, b = 0; for (int i = 0; i < n; i++) { if (s[i] == 'R') r++; if (s[i] == 'G') g++; if (s[i] == 'B') b++; } ll ans = r * g * b, sub = 0; for...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
216
#include <bits/stdc++.h> using namespace std; int main() { int n; string s; cin >> n; cin >> s; int rt = 0; int gt = 0; int bt = 0; for (int i = 0; i < n; i++) { if (s[i] == 'R') { rt += 1; } if (s[i] == 'G') { gt += 1; } if (s[i] == 'B') { bt += 1; } } ...
#include <bits/stdc++.h> using namespace std; int main() { int n; string s; cin >> n; cin >> s; long long rt = 0; long long gt = 0; long long bt = 0; for (int i = 0; i < n; i++) { if (s[i] == 'R') { rt += 1; } if (s[i] == 'G') { gt += 1; } if (s[i] == 'B') { bt ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]]
1
215
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int n; cin >> n; string s; cin >> s; int size = s.size(); int r = 0, g = 0, b = 0; for (int i = 0; i < size; i++) { if (s[i] == 'R') r++; else if (s[i] == 'G') g++; else if (s[i] == 'B') b++; ...
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ll n; cin >> n; string s; cin >> s; ll size = s.size(); ll r = 0, g = 0, b = 0; for (int i = 0; i < size; i++) { if (s[i] == 'R') r++; else if (s[i] == 'G') g++; else if (s[i] == 'B') b++; } ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
258
// ABC 162 D #include <bits/stdc++.h> using namespace std; int main() { int n; string s; cin >> n; cin >> s; int r[n + 1], g[n + 1], b[n + 1]; for (int i = 0; i <= n; i++) { r[i] = g[i] = b[i] = 0; } for (int i = n - 1; i >= 0; i--) { if (s[i] == 'R') r[i] = r[i + 1] + 1; else ...
// ABC 162 D #include <bits/stdc++.h> using namespace std; int main() { int n; string s; cin >> n; cin >> s; int r[n + 1], g[n + 1], b[n + 1]; for (int i = 0; i <= n; i++) { r[i] = g[i] = b[i] = 0; } for (int i = n - 1; i >= 0; i--) { if (s[i] == 'R') r[i] = r[i + 1] + 1; else ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]]
1
444
#include <algorithm> #include <cmath> #include <deque> #include <iostream> #include <numeric> #include <queue> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> using namespace std; typedef long long LL; const int MOD = 1e9 + 7; void solve() { int n; cin >> n; string s; cin...
#include <algorithm> #include <cmath> #include <deque> #include <iostream> #include <numeric> #include <queue> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> using namespace std; typedef long long LL; const int MOD = 1e9 + 7; void solve() { int n; cin >> n; string s; cin...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
384
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(); int rc = 0; int gc = 0; int bc = 0; for (int i = 0; i < s.length(); i++) { if (s.charAt(i) == 'R') { rc++; ...
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 rc = 0; long gc = 0; long bc = 0; for (int i = 0; i < s.length(); i++) { if (s.charAt(i) == 'R') { rc++; ...
[["-", 0, 195, 8, 196, 0, 503, 39, 506, 0, 507], ["+", 0, 195, 8, 196, 0, 503, 39, 506, 0, 96]]
3
256
#include <math.h> #include <stdio.h> int main() { int n, count = 0; int a = 0, b = 0, c = 0; scanf("%d", &n); char s[n]; int r[n], g[n], d[n]; scanf("%s", &s); for (int i = 0; i < n; i++) { if (s[i] == 'R') { r[a++] = i; } if (s[i] == 'G') { g[b++] = i; } if (s[i] == 'B') {...
#include <math.h> #include <stdio.h> int main() { int n, count = 0; int a = 0, b = 0, c = 0; scanf("%d", &n); char s[n]; int r[n], g[n], d[n]; scanf("%s", &s); for (int i = 0; i < n; i++) { if (s[i] == 'R') { r[a++] = i; } if (s[i] == 'G') { g[b++] = i; } if (s[i] == 'B') {...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
275
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, 656, 0, 1, 0, 662, 12, 680, 0, 45], ["-", 0, 656, 0, 1, 0, 662, 12, 680, 0, 46], ["+", 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, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]]
5
367
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); try { int N = Integer.parseInt(br.readLine()); String S = br.readLine(); int r = 0, g = 0, b = 0; ...
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); try { int N = Integer.parseInt(br.readLine()); String S = br.readLine(); long r = 0, g = 0, b = 0; ...
[["-", 0, 246, 8, 196, 0, 503, 39, 506, 0, 507], ["+", 0, 246, 8, 196, 0, 503, 39, 506, 0, 96], ["-", 8, 196, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 196, 0, 7, 15, 16, 12, 16, 12, 499]]
3
287
#include <algorithm> #include <cmath> #include <cstdlib> #include <iostream> #include <string> #include <vector> using namespace std; int main() { int N; cin >> N; string S; cin >> S; int Rnum = 0, Gnum = 0, Bnum = 0; for (int i = 0; i < N; ++i) { if (S[i] == 'R') ++Rnum; else if (S[i] == 'G'...
#include <algorithm> #include <cmath> #include <cstdlib> #include <iostream> #include <string> #include <vector> using namespace std; int main() { int N; cin >> N; string S; cin >> S; long long Rnum = 0, Gnum = 0, Bnum = 0; for (int i = 0; i < N; ++i) { if (S[i] == 'R') ++Rnum; else if (S[i] ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18]]
1
221
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <vector> using namespace std; typedef long long ll; const int N = 4007; int cnt[N][3]; char s[N]; int main() { int n; scanf("%d%s", &n, s + 1); for (int i = 1; i <...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <vector> using namespace std; typedef long long ll; const int N = 4007; int cnt[N][3]; char s[N]; int main() { int n; scanf("%d%s", &n, s + 1); for (int i = 1; i <...
[["-", 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
315
#include <bits/stdc++.h> using namespace std; #define rep(i, a, n) for (int i = a; i < n; i++) #define ll long long #define all(x) begin(x), end(x) #define toInt(x) (x - '0') #define pll pair<ll, ll> #define MAXN 200 + 5 const long long INF = 1LL << 60; const int inf = 1 << 30; void printVec(std::vector<ll> &vec) { ...
#include <bits/stdc++.h> using namespace std; #define rep(i, a, n) for (int i = a; i < n; i++) #define ll long long #define all(x) begin(x), end(x) #define toInt(x) (x - '0') #define pll pair<ll, ll> #define MAXN 200 + 5 const long long INF = 1LL << 60; const int inf = 1 << 30; void printVec(std::vector<ll> &vec) { ...
[["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 39, 344, 3, 347, 0, 77, 39, 86, 0, 96]]
1
359
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define REP(i, b, n) for (int i = b; i < (int)n; i++) #define rep(i, n) REP(i, 0, n) #define all(obj) (obj).begin(), (obj).end() int main() { cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; int tot = 0; vector<int> a[3]; string...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define REP(i, b, n) for (int i = b; i < (int)n; i++) #define rep(i, n) REP(i, 0, n) #define all(obj) (obj).begin(), (obj).end() int main() { cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; ll tot = 0; vector<int> a[3]; string ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 8, 9, 0, 7, 15, 16, 12, 74, 0, 24], ["+", 0, 7, 15, 16, 12, 74, 39, 77, 39, 40], ["+", 8, 9, 0, 7, 15, 16, 12, 74, 0, 25]]
1
589
#include <bits/stdc++.h> #define REP(i, x) REPI(i, 0, x) #define REPI(i, a, b) for (int i = int(a); i < int(b); ++i) #define ALL(x) (x).begin(), (x).end() typedef long long ll; using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); int N; string S; cin >> N >> S; int r = 0; int g ...
#include <bits/stdc++.h> #define REP(i, x) REPI(i, 0, x) #define REPI(i, a, b) for (int i = int(a); i < int(b); ++i) #define ALL(x) (x).begin(), (x).end() typedef long long ll; using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); int N; string S; cin >> N >> S; ll r = 0; ll g = ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
240
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define rrep(i, n) for (int i = 1; i <= (int)(n); i++) #define pb push_back #define all(v) v.begin(), v.end() #define fi first #define se second #define bigger (char)toupper #define smaller (char)tolower using namespace std; typedef pair<int, int>...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define rrep(i, n) for (int i = 1; i <= (int)(n); i++) #define pb push_back #define all(v) v.begin(), v.end() #define fi first #define se second #define bigger (char)toupper #define smaller (char)tolower using namespace std; typedef pair<int, int>...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 8, 9, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 14, 8, 9, 0, 43, 39, 78]]
1
251
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int INF = 1e9; int main() { ios::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; string s; cin >> s; ll r, g, b; r = g = b = 0; for (char c : s) { switch (c) { case 'R': r++; break; case 'G': ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int INF = 1e9; int main() { ios::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; string s; cin >> s; ll r, g, b; r = g = b = 0; for (char c : s) { switch (c) { case 'R': r++; break; case 'G': ...
[["+", 8, 9, 0, 7, 15, 16, 31, 16, 17, 48], ["+", 8, 9, 0, 7, 15, 16, 31, 16, 12, 13], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 85], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
218
// Problem Code: abc162_d #include <iostream> #include <string> #include <unordered_map> using namespace std; long long triplets(int N, string &S) { long long cnt = 1; unordered_map<char, int> freq; for (char &c : S) freq[c]++; cnt *= freq['R'] * freq['G'] * freq['B']; for (int i = 0; i < N; i++) ...
// Problem Code: abc162_d #include <iostream> #include <string> #include <unordered_map> using namespace std; long long triplets(int N, string &S) { long long cnt = 1; unordered_map<char, int> freq; for (char &c : S) freq[c]++; cnt *= 1LL * freq['R'] * freq['G'] * freq['B']; 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]]
1
189
#include <algorithm> #include <climits> #include <cmath> #include <iomanip> #include <iostream> #include <queue> #include <set> #include <string> #include <vector> using namespace std; typedef long long ll; int main() { int n = 0; string s; cin >> n >> s; vector<int> r(n); vector<int> g(n); vector<int> b(n)...
#include <algorithm> #include <climits> #include <cmath> #include <iomanip> #include <iostream> #include <queue> #include <set> #include <string> #include <vector> using namespace std; typedef long long ll; int main() { int n = 0; string s; cin >> n >> s; vector<int> r(n); vector<int> g(n); vector<int> b(n)...
[["+", 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], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 17, 72], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 12, 13]]
1
316
#include <bits/stdc++.h> using namespace std; #define LL long long typedef pair<int, int> pii; template <typename T> inline void read(T &x) { static char _c; static bool _f; x = 0; _f = 0; _c = getchar(); while (_c < '0' || '9' < _c) { if (_c == '-') _f = true; _c = getchar(); } while ...
#include <bits/stdc++.h> using namespace std; #define LL long long typedef pair<int, int> pii; template <typename T> inline void read(T &x) { static char _c; static bool _f; x = 0; _f = 0; _c = getchar(); while (_c < '0' || '9' < _c) { if (_c == '-') _f = true; _c = getchar(); } while ...
[["+", 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
991
#include <bits/stdc++.h> using namespace std; #pragma GCC target("avx") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define REP(i, n) for (int i = 1; i <= (int)(n); i++) #define repi(i, s, n) for (int i = (s); i < (int)(n); i++) #define all(x) (...
#include <bits/stdc++.h> using namespace std; #pragma GCC target("avx") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define REP(i, n) for (int i = 1; i <= (int)(n); i++) #define repi(i, s, n) for (int i = (s); i < (int)(n); i++) #define all(x) (...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 0, 9, 0, 57, 64, 9, 0, 43, 39, 40], ["+", 0, 9, 0, 57, 64, 9, 0, 43, 39, 78]]
1
298
#include <bits/stdc++.h> using ll = long long; using namespace std; int main() { int n; cin >> n; string s; cin >> s; int cnt[3] = {}; for (char c : s) { if (c == 'R') ++cnt[0]; else if (c == 'G') ++cnt[1]; else ++cnt[2]; } ll ans = 1; for (int i : cnt) ans *= i; fo...
#include <bits/stdc++.h> using ll = long long; using namespace std; int main() { int n; cin >> n; string s; cin >> s; int cnt[3] = {}; for (char c : s) { if (c == 'R') ++cnt[0]; else if (c == 'G') ++cnt[1]; else ++cnt[2]; } ll ans = 1; for (int i : cnt) ans *= i; fo...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18]]
1
193
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int n, i, j, k, d, r = 0, g = 0, b = 0; ll ans; string s; cin >> n; cin >> s; for (i = 0; i < (int)s.size(); i++) { if (s[i] == 'R') r++; else if (s[i] == 'G') g++; else b++; } ans = r * g * b;...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int n, i, j, k, d; ll ans, r = 0, g = 0, b = 0; string s; cin >> n; cin >> s; for (i = 0; i < (int)s.size(); i++) { if (s[i] == 'R') r++; else if (s[i] == 'G') g++; else b++; } ans = r * g * b;...
[["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22]]
1
211
#include <bits/stdc++.h> #define speed \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0); #define int long long using namespac...
#include <bits/stdc++.h> #define speed \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0); #define int long long using namespac...
[["-", 0, 30, 0, 43, 49, 50, 51, 16, 31, 13], ["+", 0, 30, 0, 43, 49, 50, 51, 16, 31, 13]]
1
558
length = int(input()) text = input() r_count = text.count("R") g_count = text.count("G") b_count = text.count("B") answer = r_count * g_count * b_count for i in range(length-2): for j in range(i+1, length-1): k = i + (i-j)*2 if k < length and text[i]!=text[j] and text[i]!=text[k] and text[j]!=tex...
length = int(input()) text = input() r_count = text.count("R") g_count = text.count("G") b_count = text.count("B") answer = r_count * g_count * b_count for i in range(length-2): for j in range(i+1, length-1): k = i + (j-i)*2 if k < length and text[i]!=text[j] and text[i]!=text[k] and text[j]!=tex...
[["-", 12, 657, 12, 657, 31, 23, 0, 657, 31, 22], ["-", 12, 657, 12, 657, 31, 23, 0, 657, 17, 33], ["+", 12, 657, 12, 657, 31, 23, 0, 657, 17, 33], ["+", 12, 657, 12, 657, 31, 23, 0, 657, 12, 22]]
5
127
#include <bits/stdc++.h> using namespace std; int main() { int N; string s; cin >> N >> s; int r, g, b; r = 0, g = 0, b = 0; for (char ch : s) { if (ch == 'R') r++; else if (ch == 'G') g++; else if (ch == 'B') b++; } long long int sum = r * g * b; for (int i = 0; i < N; i...
#include <bits/stdc++.h> using namespace std; int main() { int N; string s; cin >> N >> s; long long int r, g, b; r = 0, g = 0, b = 0; for (char ch : s) { if (ch == 'R') r++; else if (ch == 'G') g++; else if (ch == 'B') b++; } long long int sum = r * g * b; for (int i = 0...
[["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]]
1
190
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for (int i = 0; i < (n); i++) #define REP2(i, x, n) for (int i = x; i < (n); i++) #define ALL(n) begin(n), end(n) #define sz(x) int(x.size()) using ll = long long; const ll LLINF = numeric_limits<long long>::max(); const int mod = 1000000007; const int INF...
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for (int i = 0; i < (n); i++) #define REP2(i, x, n) for (int i = x; i < (n); i++) #define ALL(n) begin(n), end(n) #define sz(x) int(x.size()) using ll = long long; const ll LLINF = numeric_limits<long long>::max(); const int mod = 1000000007; const int INF...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
324
#include <algorithm> #include <iostream> #include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <vector> using namespace std; #define MAX(x, y) (x > y ? x : y) #define MIN(x, y) (x < y ? x : y) #define ABS(x) (x > 0 ? x : -(x)) #define INF 2147483647 #define LLINF 9223372036854775807 #d...
#include <algorithm> #include <iostream> #include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <vector> using namespace std; #define MAX(x, y) (x > y ? x : y) #define MIN(x, y) (x < y ? x : y) #define ABS(x) (x > 0 ? x : -(x)) #define INF 2147483647 #define LLINF 9223372036854775807 #d...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
617
#include <bits/stdc++.h> using namespace std; int main(void) { int n; long sum = 0; string s; int r = 0; int g = 0; int b = 0; // nt sum = 0; cin >> n >> s; for (int i = 0; i < n; i++) { if (s[i] == 'R') { r += 1; } else if (s[i] == 'G') { g += 1; } else { b += 1; ...
#include <bits/stdc++.h> using namespace std; int main(void) { int n; long sum = 0; string s; int r = 0; int g = 0; int b = 0; // nt sum = 0; cin >> n >> s; for (int i = 0; i < n; i++) { if (s[i] == 'R') { r += 1; } else if (s[i] == 'G') { g += 1; } else { b += 1; ...
[["+", 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
214
#include <algorithm> #include <cmath> #include <iostream> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long LL; typedef long double LD; int main(void) { ios::sync_with_stdio(false); cin.tie(nullptr); int n; string s; cin >> n >> s; i...
#include <algorithm> #include <cmath> #include <iostream> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long LL; typedef long double LD; int main(void) { ios::sync_with_stdio(false); cin.tie(nullptr); int n; string s; cin >> n >> s; L...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
242
#include <bits/stdc++.h> using namespace std; #define ll long long int #define vi vector<int> #define prec fixed << setprecision(10) #define mod 1000000007 #define set(x) __builtin_popcount(x) #define ffs(x) __builtin_ffs(x) #define clz(x) __builtin_clz(x) #define inf 1000000007 #define linf 1000000000000000007 int ...
#include <bits/stdc++.h> using namespace std; #define ll long long int #define vi vector<int> #define prec fixed << setprecision(10) #define mod 1000000007 #define set(x) __builtin_popcount(x) #define ffs(x) __builtin_ffs(x) #define clz(x) __builtin_clz(x) #define inf 1000000007 #define linf 1000000000000000007 int ...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["+", 15, 339, 51, 16, 31, 16, 31, 16, 31, 13], ["+", 15, 339, 51, 16, 31, 16, 31, 16, 17, 48]]
1
271
#include <iostream> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; int main() { int n; int r = 0; int g = 0; int b = 0; long long sum = 0; string s; cin >> n >> s; rep(i, n) { if (s.at(i) == 'R') { r++; } if (s.at(i) == 'G') ...
#include <iostream> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; int main() { int n; long long r = 0; long long g = 0; long long b = 0; long long sum = 0; string s; cin >> n >> s; rep(i, n) { if (s.at(i) == 'R') { r++; } if...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]]
1
232
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (long long i = 0; i < (long long)(n); i++) #define REP(i, k, n) for (long long i = k; i < (long long)(n); i++) #define all(a) a.begin(), a.end() #define eb emplace_back #define lb(v, k) (lower_bound(all(v), k) - v.begin()) #define ub(v, k) (upper_bound...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (long long i = 0; i < (long long)(n); i++) #define REP(i, k, n) for (long long i = k; i < (long long)(n); i++) #define all(a) a.begin(), a.end() #define eb emplace_back #define lb(v, k) (lower_bound(all(v), k) - v.begin()) #define ub(v, k) (upper_bound...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 0, 9, 0, 57, 15, 339, 51, 91, 17, 111]]
1
843
#include <bits/stdc++.h> using namespace std; #define For(i, m, n) for (int i = m; i < n; i++) #define FOR(i, n) for (int i = 0; i < n; i++) #define ll long long #define ull unsigned long long #define lli long long int #define pb push_back ll mob = 1000000007; using namespace std; int main() { int n; cin >> n; in...
#include <bits/stdc++.h> using namespace std; #define For(i, m, n) for (int i = m; i < n; i++) #define FOR(i, n) for (int i = 0; i < n; i++) #define ll long long #define ull unsigned long long #define lli long long int #define pb push_back ll mob = 1000000007; using namespace std; int main() { int n; cin >> n; in...
[["-", 64, 9, 0, 1, 0, 11, 12, 69, 28, 22], ["+", 64, 9, 0, 1, 0, 11, 12, 69, 28, 22]]
1
493
import java.util.*; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); char[] let = sc.next().toCharArray(); int a = 0, b = 0, c = 0; for (int i = 0; i < n; i++) { if (let[i] == 'R') a++; if (let[i] == 'B') ...
import java.util.*; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); char[] let = sc.next().toCharArray(); int a = 0, b = 0, c = 0; for (int i = 0; i < n; i++) { if (let[i] == 'R') a++; if (let[i] == 'B') ...
[["+", 49, 200, 51, 16, 31, 16, 31, 74, 0, 24], ["+", 51, 16, 31, 16, 31, 74, 39, 506, 0, 96], ["+", 49, 200, 51, 16, 31, 16, 31, 74, 0, 25]]
3
237
#ifndef _GLIBCXX_NO_ASSERT #include <cassert> #endif #include <cctype> #include <cerrno> #include <cfloat> #include <ciso646> #include <climits> #include <clocale> #include <cmath> #include <csetjmp> #include <csignal> #include <cstdarg> #include <cstddef> #include <cstdio> #include <cstdlib> #include <cstring> #includ...
#ifndef _GLIBCXX_NO_ASSERT #include <cassert> #endif #include <cctype> #include <cerrno> #include <cfloat> #include <ciso646> #include <climits> #include <clocale> #include <cmath> #include <csetjmp> #include <csignal> #include <cstdarg> #include <cstddef> #include <cstdio> #include <cstdlib> #include <cstring> #includ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
801
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string S; cin >> S; vector<int> C(3); for (const auto &s : S) C[s % 3]++; int64_t ans = C[0] * C[1] * C[2]; for (int i = 0; i < n; i++) { for (int j = i + 1; j < n; j++) { if (S[i] == S[j]) continue; ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string S; cin >> S; vector<int64_t> C(3); for (const auto &s : S) C[s % 3]++; int64_t ans = C[0] * C[1] * C[2]; for (int i = 0; i < n; i++) { for (int j = i + 1; j < n; j++) { if (S[i] == S[j]) continu...
[["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40]]
1
168
#include <bits/stdc++.h> using namespace std; int main() { int n; string s; cin >> n >> s; int r = 0, g = 0, b = 0; for (int i = 0; i < n; i++) { if (s[i] == 'R') { r++; } else if (s[i] == 'G') { g++; } else { b++; } } long long int ans = r * g * b; for (int i = 0; i ...
#include <bits/stdc++.h> using namespace std; int main() { int n; string s; cin >> n >> s; long long int r = 0, g = 0, b = 0; for (int i = 0; i < n; i++) { if (s[i] == 'R') { r++; } else if (s[i] == 'G') { g++; } else { b++; } } long long int ans = r * g * b; for (int...
[["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]]
1
200
#include <stdio.h> #define rep(i, r) for (int i = 0; i < r; i++) int main() { int N; scanf("%d", &N); char S[N]; scanf("%s", &S); int rgb[3] = {0}; rep(i, N) rgb[S[i] == 'R' ? 0 : (S[i] == 'G' ? 1 : 2)]++; long count = rgb[0] * rgb[1] * rgb[2]; for (int i = 0; i < N - 2; i++) { for (int j = 1; i ...
#include <stdio.h> #define rep(i, r) for (int i = 0; i < r; i++) int main() { int N; scanf("%d", &N); char S[N]; scanf("%s", &S); int rgb[3] = {0}; rep(i, N) rgb[S[i] == 'R' ? 0 : (S[i] == 'G' ? 1 : 2)]++; long count = (long)rgb[0] * rgb[1] * rgb[2]; for (int i = 0; i < N - 2; i++) { for (int j =...
[["+", 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]]
0
206
#include <bits/stdc++.h> #include <iostream> #include <vector> using namespace std; int main() { int N; string S; cin >> N >> S; int r = 0, g = 0, b = 0; for (auto c : S) { if (c == 'R') { r++; } else if (c == 'G') { g++; } else { b++; } } int64_t all = r * g * b; int6...
#include <bits/stdc++.h> #include <iostream> #include <vector> using namespace std; int main() { int N; string S; cin >> N >> S; int64_t r = 0, g = 0, b = 0; for (auto c : S) { if (c == 'R') { r++; } else if (c == 'G') { g++; } else { b++; } } int64_t all = r * g * b; ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
1
200
#include <bits/stdc++.h> #define ll long long #define fi first #define se second #define pb push_back #define endl '\n' #define fastio \ ios::sync_with_stdio(0); \ cin.tie(0); ...
#include <bits/stdc++.h> #define ll long long #define fi first #define se second #define pb push_back #define endl '\n' #define fastio \ ios::sync_with_stdio(0); \ cin.tie(0); ...
[["+", 49, 50, 51, 16, 31, 16, 31, 16, 31, 13], ["+", 49, 50, 51, 16, 31, 16, 31, 16, 17, 48]]
1
300
#include <bits/stdc++.h> using namespace std; // Type alias using ll = long long; using ld = double; using pi = pair<int, int>; using pll = pair<ll, ll>; using pld = pair<ld, ld>; using ti3 = tuple<int, int, int>; using vi = vector<int>; using vll = vector<ll>; using vld = vector<ld>; using vpi = vector<pi>; using v...
#include <bits/stdc++.h> using namespace std; // Type alias using ll = long long; using ld = double; using pi = pair<int, int>; using pll = pair<ll, ll>; using pld = pair<ld, ld>; using ti3 = tuple<int, int, int>; using vi = vector<int>; using vll = vector<ll>; using vld = vector<ld>; using vpi = vector<pi>; using v...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
510
#include <bits/stdc++.h> using namespace std; /*解法 * s[i] != s[j] != s[k]を満たし、j-i != k-jを満たす組の数は、 * R,G,Bそれぞれの個数をr,g,bとしたときの積rgbから、1つめの条件を満たして2詰めの条件を満たさない(2*j * == k+i)要素数を引けば求められる。 */ int main(void) { int n; string s; cin >> n >> s; long long R = 0, G = 0, B = 0; for (int i = 0; i < n; i++) { if ...
#include <bits/stdc++.h> using namespace std; /*解法 * s[i] != s[j] != s[k]を満たし、j-i != k-jを満たす組の数は、 * R,G,Bそれぞれの個数をr,g,bとしたときの積rgbから、1つめの条件を満たして2詰めの条件を満たさない(2*j * == k+i)要素数を引けば求められる。 */ int main(void) { int n; string s; cin >> n >> s; long long R = 0, G = 0, B = 0; for (int i = 0; i < n; i++) { if ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]]
1
210
#include <bits/stdc++.h> #define IOS \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); #define endl "\n" #define rep(i, n) ...
#include <bits/stdc++.h> #define IOS \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); #define endl "\n" #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
374
#include <bits/stdc++.h> #define IOS \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); #define endl "\n" #define rep(i, n) ...
#include <bits/stdc++.h> #define IOS \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); #define endl "\n" #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
701
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(); int r = 0; int g = 0; int b = 0; for (int i = 0; i < n; i++) { if (s.charAt(i) == 'R') { r++; } else if (s.c...
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 r = 0; long g = 0; long b = 0; for (int i = 0; i < n; i++) { if (s.charAt(i) == 'R') { r++; } else if (...
[["-", 0, 195, 8, 196, 0, 503, 39, 506, 0, 507], ["+", 0, 195, 8, 196, 0, 503, 39, 506, 0, 96]]
3
258
#include <bits/stdc++.h> using namespace std; int red[4001], blue[4001], green[4001]; signed main() { int n; cin >> n; string s; cin >> s; int ans = 0; for (int i = 0; i < n; i++) { red[i + 1] = red[i] + (s[i] == 'R'); blue[i + 1] = blue[i] + (s[i] == 'B'); green[i + 1] = green[i] + (s[i] == '...
#include <bits/stdc++.h> using namespace std; #define int long long int red[4001], blue[4001], green[4001]; signed main() { int n; cin >> n; string s; cin >> s; int ans = 0; for (int i = 0; i < n; i++) { red[i + 1] = red[i] + (s[i] == 'R'); blue[i + 1] = blue[i] + (s[i] == 'B'); green[i + 1] =...
[["+", 36, 36, 36, 36, 0, 30, 0, 58, 0, 148], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40]]
1
377
#include <bits/stdc++.h> using namespace std; int main() { int n; string s; cin >> n >> s; int r, g, b; r = count(s.begin(), s.end(), 'R'); g = count(s.begin(), s.end(), 'G'); b = count(s.begin(), s.end(), 'B'); long long ans = r * g * b; for (int i = 0; i < n - 2; ++i) { for (int j = i + 1; j <...
#include <bits/stdc++.h> using namespace std; int main() { int n; string s; cin >> n >> s; long long r, g, b; r = count(s.begin(), s.end(), 'R'); g = count(s.begin(), s.end(), 'G'); b = count(s.begin(), s.end(), 'B'); long long ans = r * g * b; for (int i = 0; i < n - 2; ++i) { for (int j = i + ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 0, 7, 8, 9, 0, 57, 64, 116, 0, 117], ["+", 0, 7, 8, 9, 0, 57, 64, 93, 0, 94]]
1
200