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 "bits/stdc++.h"
using namespace std;
int main() {
int K, sum;
cin >> K;
sum = 1;
for (int a = 1; a <= K; a++) {
for (int b = 1; b <= K; b++) {
for (int c = 1; c <= K; c++) {
if (a == 1 || b == 1 || c == 1) {
sum += 1;
} else {
sum += __gcd(__gcd(a, b), c);... | #include "bits/stdc++.h"
using namespace std;
int main() {
int K, sum;
cin >> K;
sum = 0;
for (int a = 1; a <= K; a++) {
for (int b = 1; b <= K; b++) {
for (int c = 1; c <= K; c++) {
if (a == 1 || b == 1 || c == 1) {
sum += 1;
} else {
sum += __gcd(__gcd(a, b), c);... | [["-", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13]] | 1 | 116 |
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define mp make_pair
#define sz(x) (int)((x).size())
#define all(x) (x).begin(), (x).end()
#define FO(x) \
{ ... |
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define mp make_pair
#define sz(x) (int)((x).size())
#define all(x) (x).begin(), (x).end()
#define FO(x) \
{ ... | [["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22]] | 1 | 865 |
k = int(input())
ans = 0
import math
for i in range(1,k+1):
for j in range(1,k+1):
for l in range(1,k+1):
f = gcd(i,j)
ff = gcd(f,l)
ans += ff
print(ans) | k = int(input())
ans = 0
import math
for i in range(1,k+1):
for j in range(1,k+1):
for l in range(1,k+1):
f = math.gcd(i,j)
ff = math.gcd(f,l)
ans += ff
print(ans)
| [["+", 0, 1, 0, 662, 12, 652, 63, 319, 500, 22], ["+", 0, 1, 0, 662, 12, 652, 63, 319, 0, 131]] | 5 | 72 |
#include <bits/stdc++.h>
#define pb push_back
#define sz(a) int(a.size())
#define re return
#define all(a) a.begin(), a.end()
#define int long long
using namespace std;
signed main() {
int n, ans = 0;
cin >> n;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n; j++) {
for (int k = 1; k <= n; k++) {
... | #include <bits/stdc++.h>
#define pb push_back
#define sz(a) int(a.size())
#define re return
#define all(a) a.begin(), a.end()
#define int long long
using namespace std;
signed main() {
int n, ans = 0;
cin >> n;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n; j++) {
for (int k = 1; k <= n; k++) {
... | [["+", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 151], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]] | 1 | 109 |
#include <bits/stdc++.h>
using namespace std;
int main() {
long K;
cin >> K;
long ans = 0;
long temp = 0;
for (long i = 1; i < K; i++) {
for (long j = 1; j < K; j++) {
for (long z = 1; z < K; z++) {
temp = gcd(i, j);
temp = gcd(temp, z);
ans += temp;
}
}
}
co... | #include <bits/stdc++.h>
using namespace std;
int main() {
long K;
cin >> K;
long ans = 0;
long temp = 0;
for (long i = 1; i < K + 1; i++) {
for (long j = 1; j < K + 1; j++) {
for (long z = 1; z < K + 1; z++) {
temp = gcd(i, j);
temp = gcd(temp, z);
ans += temp;
}
... | [["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]] | 1 | 108 |
#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
if (a > b)
return gcd(b, a);
if (a == 0)
return b;
return gcd(b % a, a);
}
int main() {
int k;
cin >> k;
int s = 0;
for (int a = 1; a <= k; a++)
for (int b = 1; b <= k; b++)
for (int c = 1; c <= k; c++)
s += gc... | #include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
if (a > b)
return gcd(b, a);
if (a == 0)
return b;
return gcd(b % a, a);
}
int main() {
int k;
cin >> k;
int s = 0;
for (int a = 1; a <= k; a++)
for (int b = 1; b <= k; b++)
for (int c = 1; c <= k; c++)
s += gc... | [["-", 3, 4, 0, 2, 3, 4, 0, 16, 17, 72], ["-", 3, 4, 0, 2, 3, 4, 0, 16, 12, 13], ["-", 0, 11, 12, 2, 3, 4, 0, 16, 17, 72], ["-", 0, 11, 12, 2, 3, 4, 0, 16, 12, 13]] | 1 | 136 |
#include <algorithm>
#include <iostream>
#include <queue>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
ll g(ll a, ll b) {
if (b)
return g(b, b % a);
return 1;
}
int main() {
ll k;
ll ans = 0;
string... | #include <algorithm>
#include <iostream>
#include <queue>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
ll g(ll a, ll b) {
if (b)
return g(b, a % b);
return a;
}
int main() {
ll k;
ll ans = 0;
string... | [["-", 64, 37, 0, 2, 3, 4, 0, 16, 31, 22], ["-", 64, 37, 0, 2, 3, 4, 0, 16, 17, 109], ["+", 64, 37, 0, 2, 3, 4, 0, 16, 17, 109], ["+", 64, 37, 0, 2, 3, 4, 0, 16, 12, 22], ["-", 0, 30, 0, 14, 8, 9, 0, 37, 0, 13], ["+", 0, 30, 0, 14, 8, 9, 0, 37, 0, 22]] | 1 | 149 |
#include <algorithm>
#include <iostream>
#include <numeric>
using namespace std;
typedef long long ll;
int main(void) {
int k;
cin >> k;
ll total_gcd = 0;
for (int a = 1; a <= k; a++) {
for (int b = 1; b <= k; b++) {
for (int c = 0; c < k; c++) {
total_gcd += (ll)gcd(gcd(a, b), c);
}... | #include <algorithm>
#include <iostream>
#include <numeric>
using namespace std;
typedef long long ll;
int main(void) {
int k;
cin >> k;
ll total_gcd = 0;
for (int a = 1; a <= k; a++) {
for (int b = 1; b <= k; b++) {
for (int c = 1; c <= k; c++) {
total_gcd += gcd(gcd(a, b), c);
}
... | [["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19], ["-", 8, 9, 0, 1, 0, 11, 12, 74, 0, 24], ["-", 0, 1, 0, 11, 12, 74, 39, 77, 39, 78], ["-", 8, 9, 0, 1, 0, 11, 12, 74, 0, 25]] | 1 | 105 |
#include <iostream>
using namespace std;
int gcd(int a, int b) {
if (b == 0)
return a;
return gcd(b, a % b);
}
int calcGCD(int a, int b, int c) {
int result1 = gcd(a, b);
int result2 = gcd(result1, c);
return result2;
}
int main() {
int x;
cin >> x;
int result = 0;
for (int i = 0; i < x; i++) {... | #include <iostream>
using namespace std;
int gcd(int a, int b) {
if (b == 0)
return a;
return gcd(b, a % b);
}
int calcGCD(int a, int b, int c) {
int result1 = gcd(a, b);
int result2 = gcd(result1, c);
return result2;
}
int main() {
int x;
cin >> x;
int result = 0;
for (int i = 0; i < x; i++) {... | [["+", 49, 50, 51, 2, 3, 4, 0, 16, 17, 72], ["+", 49, 50, 51, 2, 3, 4, 0, 16, 12, 13]] | 1 | 161 |
/*
* Author: pawanmsr
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
// Macro //
#define X first
#define Y second
#define pii pair<int, int>
#define pll pair<ll, ll>
// Global //
ll k;
ll gcds[202][202];
// Functions //
ll gcd(ll a, ll b) {
if (b == 0)
return a;
return (b, a %... | /*
* Author: pawanmsr
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
// Macro //
#define X first
#define Y second
#define pii pair<int, int>
#define pll pair<ll, ll>
// Global //
ll k;
ll gcds[202][202];
// Functions //
ll gcd(ll a, ll b) {
if (b == 0)
return a;
return gcd(b, ... | [["+", 0, 14, 8, 9, 0, 37, 0, 2, 63, 22]] | 1 | 173 |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
int n;
cin >> n;
ll sm = 0;
int gg[n + 1][n + 1];
rep(i, n + 1) rep(j, n + 1) gg[i][j] = gcd(i, j);
rep(i, n) rep(j, n) rep(k, n) { sm += gg[gg[i][j]][k]; }
cout << sm;
}... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
int n;
cin >> n;
ll sm = 0;
int gg[n + 1][n + 1];
rep(i, n + 1) rep(j, n + 1) gg[i][j] = gcd(i, j);
rep(i, n) rep(j, n) rep(k, n) { sm += gg[gg[i + 1][j + 1]][k + 1]; }
c... | [["+", 0, 69, 28, 69, 341, 342, 0, 16, 17, 72], ["+", 0, 69, 28, 69, 341, 342, 0, 16, 12, 13], ["+", 341, 342, 0, 69, 341, 342, 0, 16, 17, 72], ["+", 341, 342, 0, 69, 341, 342, 0, 16, 12, 13], ["+", 0, 11, 12, 69, 341, 342, 0, 16, 17, 72], ["+", 0, 11, 12, 69, 341, 342, 0, 16, 12, 13]] | 1 | 125 |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int INF = 1e9;
const int MOD = 1e9 + 7;
int gcd(int a, int b) {
if (a % b == 0) {
return (b);
} else {
return (gcd(b, a % b));
}
}
int main() {
int K;
int ans = 0;
cin >> ... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 1; i < (int)(n + 1); i++)
const int INF = 1e9;
const int MOD = 1e9 + 7;
int gcd(int a, int b) {
if (a % b == 0) {
return (b);
} else {
return (gcd(b, a % b));
}
}
int main() {
int K;
int ans = 0;
cin... | [["-", 36, 36, 36, 36, 0, 30, 0, 112, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 112, 51, 59]] | 1 | 137 |
from math import gcd
n = int(input())
sum = 0
for i in range(1, n + 1):
for j in range(1, i):
for k in range(1, j):
sum+=6*gcd(gcd(k,j),i)
sum+=3*gcd(j,i)
sum+=i
print(sum) | from math import gcd
n = int(input())
sum = 0
for i in range(1, n + 1):
for j in range(1, i):
for k in range(1, j):
sum += 6 * gcd(gcd(k, j), i)
sum += 6 * gcd(j, i)
sum += i
print(sum)
| [["-", 8, 196, 0, 1, 0, 677, 12, 657, 31, 612], ["+", 8, 196, 0, 1, 0, 677, 12, 657, 31, 612]] | 5 | 79 |
import math
k=int(input())
A=[[0 for i in range(k+1)] for j in range(k+1)]
s2=0
for i in range(1,k+1):
for j in range(1,k+1):
if i!=j:
s2=s2+math.gcd(i,j)
A[i][j]=math.gcd(i,j)
s1=0
for i in range(1,k-1):
for j in range(i+1,k):
for l in range(i+2,k+1):
s1=s1+A... | import math
k=int(input())
A=[[0 for i in range(k+1)] for j in range(k+1)]
s2=0
for i in range(1,k+1):
for j in range(1,k+1):
if i!=j:
s2=s2+math.gcd(i,j)
A[i][j]=math.gcd(i,j)
s1=0
for i in range(1,k-1):
for j in range(i+1,k):
for l in range(j+1,k+1):
s1=s1+A... | [["-", 0, 7, 12, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 31, 22], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]] | 5 | 175 |
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
unsigned euclidean_gcd(unsigned a, unsigned b) {
while (1) {
if (a < b)
swap(a, b);
if (!b)
break;
a %= b;
}
return a;
}
int main() {
int n;
cin >> n;
vector<int> v(n * n);
int idx = 0;
for (int i = 1; i <= n... |
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
unsigned euclidean_gcd(unsigned a, unsigned b) {
while (1) {
if (a < b)
swap(a, b);
if (!b)
break;
a %= b;
}
return a;
}
int main() {
int n;
cin >> n;
vector<int> v(n * n);
int idx = 0;
for (int i = 1; i <= n... | [["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18]] | 1 | 194 |
def gcd(m, n):
while n:
m, n = n, m % n
return m
K = int(input())
ans = 0
for a in range(1, K + 1):
for b in range(a + 1, K + 1):
for c in range(b + 1, K + 1):
_ans = gcd(gcd(a, b), c)
if a == b and b == c:
ans += _ans
elif a == b or b == ... | def gcd(m, n):
while n:
m, n = n, m % n
return m
K = int(input())
ans = 0
for a in range(1, K + 1):
for b in range(a, K + 1):
for c in range(b, K + 1):
_ans = gcd(gcd(a, b), c)
if a == b and b == c:
ans += _ans
elif a == b or b == c:
... | [["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]] | 5 | 123 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) {
if (a < b) {
swap(a, b);
}
ll r = a % b;
while (r != 0) {
a = b;
b = r;
r = a % b;
}
return b;
}
int main() {
int K;
cin >> K;
ll total = 0;
for (int i = 1; i <= K; i++) {
for (int j = 1; j... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) {
if (a < b) {
swap(a, b);
}
ll r = a % b;
while (r != 0) {
a = b;
b = r;
r = a % b;
}
return b;
}
int main() {
int K;
cin >> K;
ll total = 0;
for (int i = 1; i <= K; i++) {
for (int j = 1; j... | [["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19]] | 1 | 167 |
#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
if (a % b == 0) {
return b;
} else {
return gcd(b, a % b);
}
}
int main() {
int k;
cin >> k;
int sum = 0;
for (int i = 1; i < k + 1; i++) {
for (int j = 1; j < k + 1; j++) {
for (int l = 1; l < k + 1; l++) {
... | #include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
if (a % b == 0) {
return b;
} else {
return gcd(b, a % b);
}
}
int main() {
int k;
cin >> k;
int sum = 0;
for (int i = 1; i < k + 1; i++) {
for (int j = 1; j < k + 1; j++) {
for (int l = 1; l < k + 1; l++) {
... | [["-", 0, 7, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 107]] | 1 | 135 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
ll gcd(double x, double y) {
ll m = (int)floor(x);
ll n = (int)floor(y);
ll r;
do {
r = m % n;
m = n;
n = r;
} while (r != 0);
return m;
}
int main() {
int k;
ll sum = ... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
ll gcd(double x, double y) {
ll m = (int)floor(x);
ll n = (int)floor(y);
ll r;
do {
r = m % n;
m = n;
n = r;
} while (r != 0);
return m;
}
int main() {
int k;
ll sum = ... | [["+", 0, 11, 12, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 11, 12, 2, 3, 4, 0, 16, 12, 13]] | 1 | 152 |
from math import gcd
k = int(input())
gcdl = [[0 for i in range(k + 1)]for i in range(k+1)]
for i in range(1, k + 1):
for j in range(1, k + 1):
gcdl[i][j] = gcd(i, j)
s = 0
for i in range(1, k + 1):
for j in range(1, k + 1):
for l in range(1, k + 1):
s += gcdl[i][gcdl[j][k]]
print(s... | from math import gcd
k = int(input())
gcdl = [[0 for i in range(k + 1)] for i in range(k + 1)]
for i in range(1, k + 1):
for j in range(1, k + 1):
gcdl[i][j] = gcd(i, j)
s = 0
for i in range(1, k + 1):
for j in range(1, k + 1):
for l in range(1, k + 1):
s += gcdl[i][gcdl[j][l]]
prin... | [["-", 0, 1, 0, 677, 12, 206, 206, 206, 206, 22], ["+", 0, 1, 0, 677, 12, 206, 206, 206, 206, 22]] | 5 | 133 |
import math
n = int(input())
ans = 0
for i in range(1,n+1):
for j in range(1,n+1):
for k in range(1,n+1):
ans += math.gcd(i, gcd(j,k))
print(ans) | import math
n = int(input())
ans = 0
for i in range(1,n+1):
for j in range(1,n+1):
for k in range(1,n+1):
ans += math.gcd(i, math.gcd(j,k))
print(ans)
| [["+", 12, 652, 3, 4, 0, 652, 63, 319, 500, 22], ["+", 12, 652, 3, 4, 0, 652, 63, 319, 0, 131]] | 5 | 68 |
#include <iostream>
using namespace std;
int gcd(int x, int y) { return (x % y) ? gcd(y, x % y) : y; }
int main(void) {
int K, a, b, c;
int64_t sum = 0;
cin >> K;
for (int i = 1; i <= K; i++) {
for (int j = 1; j <= K; j++) {
for (int k = 2; k <= K; k++) {
a = i;
b = j;
c = k;... | #include <iostream>
using namespace std;
int gcd(int x, int y) { return (x % y) ? gcd(y, x % y) : y; }
int main(void) {
int K, a, b, c;
int64_t sum = 0;
cin >> K;
for (int i = 1; i <= K; i++) {
for (int j = 1; j <= K; j++) {
for (int k = 1; k <= K; k++) {
a = i;
b = j;
c = k;... | [["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]] | 1 | 148 |
#include <algorithm>
#include <iostream>
#include <random>
#include <string>
#include <unordered_set>
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define vll vector<vector<long long>>
#define vl vector<long long>
#define vi vector<int>
#define... | #include <algorithm>
#include <iostream>
#include <random>
#include <string>
#include <unordered_set>
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define vll vector<vector<long long>>
#define vl vector<long long>
#define vi vector<int>
#define... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13], ["-", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 7, 10, 43, 39, 78], ["-", 0, 7, 8, 9, 0, 7, 10, 43, 39, 40], ["+", 0, 7, 8, 9, 0, 7, ... | 1 | 687 |
import math
K=200
ans=0
for a in range(1,K+1):
for b in range(a,K+1):
for c in range(b,K+1):
tempgcd=math.gcd(a,b)
if a==b or b==c or a==c:
if a==b and b==c:
ans=ans+math.gcd(tempgcd,c)
else:
ans=ans+3*math.gcd(tempgcd,c)
... | import math
K=int(input())
ans=0
for a in range(1,K+1):
for b in range(a,K+1):
for c in range(b,K+1):
tempgcd=math.gcd(a,b)
if a==b or b==c or a==c:
if a==b and b==c:
ans=ans+math.gcd(tempgcd,c)
else:
ans=ans+3*math.gcd(temp... | [["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 662, 12, 652, 3, 4, 0, 652, 63, 22], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]] | 5 | 124 |
import math
from functools import reduce
#K = int(input())
K = 200
def gcd(*numbers):
return reduce(math.gcd, numbers)
sum = 0
for a in range(1, K+1):
for b in range(1, K+1):
for c in range(1, K+1):
sum += gcd(a, b, c)
print(sum) | import math
from functools import reduce
K = int(input())
def gcd(*numbers):
return reduce(math.gcd, numbers)
sum = 0
for a in range(1, K+1):
for b in range(1, K+1):
for c in range(1, K+1):
sum += gcd(a, b, c)
print(sum) | [["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 662, 12, 652, 3, 4, 0, 652, 63, 22], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]] | 5 | 79 |
#include <bits/stdc++.h>
using namespace std;
int gcd(int x, int y, int z) {
vector<int> temp = {x, y, z};
sort(temp.begin(), temp.end());
if (temp[0] == 0) {
temp[2] %= temp[1];
if (temp[2] == 0) {
return temp[1];
}
} else {
temp[1] %= temp[0];
temp[2] %= temp[0];
if (temp[1] ==... | #include <bits/stdc++.h>
using namespace std;
// C
int gcd(int x, int y, int z) {
vector<int> temp = {x, y, z};
sort(temp.begin(), temp.end());
if (temp[0] == 0) {
temp[2] %= temp[1];
if (temp[2] == 0) {
return temp[1];
}
} else {
temp[1] %= temp[0];
temp[2] %= temp[0];
if (temp... | [["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22]] | 1 | 292 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, c) for (int i = 0; i < (int)c; i++)
#define ll long long
#define upd_max(maxer, updater) \
if (maxer < updater) \
maxer = updater;
#define upd_min(min... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, c) for (int i = 1; i <= (int)c; i++)
#define ll long long
#define upd_max(maxer, updater) \
if (maxer < updater) \
maxer = updater;
#define upd_min(mi... | [["-", 36, 36, 36, 36, 0, 30, 0, 112, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 112, 51, 59], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["-", 0, 14, 8, 9, 0, 1, 0, 27, 28, 22], ["-", 0, 14, 8, 9, 0, 1, 0, 27, 17, 29]] | 1 | 145 |
import math
from functools import reduce
k=int(input())
def gcd(*numbers):
return reduce(math.gcd, numbers)
ans=0
for i in range(1,k+1):
for j in range(i,k+1):
for l in range(j,k+1):
if l==i:
ans+=gcd(i,j,l)
elif i==j or j==l:
ans+=2*gcd(i,j,l)
else:
ans+=gcd(i,j,l)
p... | import math
from functools import reduce
k=int(input())
def gcd(*numbers):
return reduce(math.gcd, numbers)
ans=0
for i in range(1,k+1):
for j in range(i,k+1):
for l in range(j,k+1):
if l==i:
ans+=gcd(i,j,l)
elif i==j or j==l:
ans+=3*gcd(i,j,l)
else:
ans+=6*gcd(i,j,l)... | [["-", 64, 196, 0, 1, 0, 677, 12, 657, 31, 612], ["+", 64, 196, 0, 1, 0, 677, 12, 657, 31, 612], ["+", 8, 196, 0, 1, 0, 677, 12, 657, 31, 612], ["+", 8, 196, 0, 1, 0, 677, 12, 657, 17, 48]] | 5 | 121 |
#include <iostream>
using namespace std;
using ll = long long;
int gcd(int a, int b, int c) {
int x = min(a, min(b, c)), ans;
for (int i = x; i > 0; i--) {
if (a % i == 0 && b % i == 0 && c % i == 0) {
ans = i;
}
}
return ans;
}
int main() {
ll k, ans = 0;
cin >> k;
k++;
for (int i = 1... | #include <iostream>
using namespace std;
using ll = long long;
int gcd(int a, int b, int c) {
int x = min(a, min(b, c)), ans;
for (int i = x; i > 0; i--) {
if (a % i == 0 && b % i == 0 && c % i == 0) {
ans = i;
break;
}
}
return ans;
}
int main() {
ll k, ans = 0;
cin >> k;
k++;
f... | [["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 35]] | 1 | 173 |
import math
import itertools
# a = 6
# b = 4
#
# print(math.gcd(a, b))
k = int(input())
kk = k + 1
ans = 0
for i in range(1, kk):
# print(i)
for ii in rangea(1, kk):
# print(ii)
for iii in range(1, kk):
# print((i,ii,iii))
gcd2 = math.gcd(ii, iii)
gcd3 = math... | import math
import itertools
# a = 6
# b = 4
#
# print(math.gcd(a, b))
k = int(input())
kk = k + 1
ans = 0
for i in range(1, kk):
# print(i)
for ii in range(1, kk):
# print(ii)
for iii in range(1, kk):
# print((i,ii,iii))
gcd2 = math.gcd(ii, iii)
gcd3 = math.... | [["-", 0, 7, 8, 196, 0, 7, 12, 652, 63, 22], ["+", 0, 7, 8, 196, 0, 7, 12, 652, 63, 22]] | 5 | 84 |
k=int(input())+1
l=[]
for a in range(1,k):
for b in range(1,k):
for c in range(1,k):
l.append(math.gcd(a,math.gcd(b,c)))
print (sum(l)) | import math
k=int(input())+1
l=[]
for a in range(1,k):
for b in range(1,k):
for c in range(1,k):
l.append(math.gcd(a,math.gcd(b,c)))
print (sum(l)) | [["+", 36, 36, 36, 36, 0, 656, 0, 596, 0, 487], ["+", 36, 36, 0, 656, 0, 596, 141, 673, 0, 22]] | 5 | 71 |
def gcd_base(a, b):
while b!=0:
a, b = b, a%b
return a
def gcd(num_list):
ans = 0
for i in num_list:
ans = gcd_base(ans, i)
return ans
k = int(input())
ans = 0
for i in range(1, k-1):
for j in range(i+1, k):
for l in range(j+1, k+1):
ans += 6*gcd([i,j,k])
fo... | def gcd_base(a, b):
while b!=0:
a, b = b, a%b
return a
def gcd(num_list):
ans = 0
for i in num_list:
ans = gcd_base(ans, i)
return ans
k = int(input())
ans = 0
for i in range(1, k-1):
for j in range(i+1, k):
for l in range(j+1, k+1):
ans += 6*gcd([i,j,l])
fo... | [["-", 12, 657, 12, 652, 3, 4, 0, 634, 0, 22], ["+", 12, 657, 12, 652, 3, 4, 0, 634, 0, 22], ["-", 8, 196, 0, 1, 0, 677, 12, 657, 31, 612], ["+", 8, 196, 0, 1, 0, 677, 12, 657, 31, 612]] | 5 | 164 |
#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b, int c) {
int result;
int init = a < b ? (a < c ? a : c) : (b < c ? b : c);
for (int i = init; i >= 1; i--) {
if (a % i == 0 && b % i == 0 && c % i == 0)
result = i;
break;
}
return result;
}
int main() {
ios_base::sync_with_... | #include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b, int c) {
int result;
int init = a < b ? (a < c ? a : c) : (b < c ? b : c);
for (int i = init; i >= 1; i--) {
if (a % i == 0 && b % i == 0 && c % i == 0) {
result = i;
break;
}
}
return result;
}
int main() {
ios_base::... | [["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46]] | 1 | 199 |
from functools import reduce
from itertools import product
def gcd(a, b):
while b: a, b = b, a % b
return a
def gcd_list(A): return reduce(gcd, A)
K = int(input())
S = K * (K + 1) // 2
for a, b in combinations(range(1, K+1), 2):
S += 6 * gcd(a, b)
for a, b, c in combinations(range(1, K+1), 3):
S += 6... | from functools import reduce
from itertools import combinations
def gcd(a, b):
while b: a, b = b, a % b
return a
def gcd_list(A): return reduce(gcd, A)
K = int(input())
S = K * (K + 1) // 2
for a, b in combinations(range(1, K+1), 2):
S += 6 * gcd(a, b)
for a, b, c in combinations(range(1, K+1), 3):
S... | [["-", 36, 36, 0, 656, 0, 686, 141, 673, 0, 22], ["+", 36, 36, 0, 656, 0, 686, 141, 673, 0, 22]] | 5 | 130 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int k;
cin >> k;
long long int out = 0;
for (int i = 1; i <= k; i++)
out += i;
for (int i = 1; i < k; i++) {
for (int j = i + 1; j <= k; j++) {
int ti = i, tj = j;
while (tj % ti != 0) {
int tmp = tj;
tj = ti;
... | #include <bits/stdc++.h>
using namespace std;
int main() {
int k;
cin >> k;
long long int out = 0;
for (int i = 1; i <= k; i++)
out += i;
for (int i = 1; i < k; i++) {
for (int j = i + 1; j <= k; j++) {
int ti = i, tj = j;
while (tj % ti != 0) {
int tmp = tj;
tj = ti;
... | [["-", 8, 9, 0, 1, 0, 11, 12, 16, 31, 13], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 31, 13]] | 1 | 266 |
def main(): #startline-------------------------------------------
k = int(input())
ans = 0
for i in range(1,k+1):
for j in range(1,k+1):
for l in range(1,k+1):
ans += gcd(gcd(i,j),l)
print(ans)
if __name__ == "__main__":
main() #endline===========================... | from math import gcd
def main(): #startline-------------------------------------------
k = int(input())
ans = 0
for i in range(1,k+1):
for j in range(1,k+1):
for l in range(1,k+1):
ans += gcd(gcd(i,j),l)
print(ans)
if __name__ == "__main__":
main() #endline======... | [["+", 36, 36, 36, 36, 0, 656, 0, 686, 0, 314], ["+", 36, 36, 0, 656, 0, 686, 687, 673, 0, 22], ["+", 36, 36, 36, 36, 0, 656, 0, 686, 0, 487], ["+", 36, 36, 0, 656, 0, 686, 141, 673, 0, 22]] | 5 | 81 |
#include <bits/stdc++.h>
using namespace std;
int gcd(int x, int y) {
if (x < y) {
swap(x, y);
}
if (x % y == 0) {
return y;
} else {
return gcd(x, x % y);
}
}
int main() {
int k;
cin >> k;
int gcd_sum = 0;
for (int a = 1; a < k + 1; a++) {
for (int b = 1; b < k + 1; b++) {
f... | #include <bits/stdc++.h>
using namespace std;
int gcd(int x, int y) {
if (x < y) {
swap(x, y);
}
if (x % y == 0) {
return y;
} else {
return gcd(y, x % y);
}
}
int main() {
int k;
cin >> k;
int gcd_sum = 0;
for (int a = 1; a < k + 1; a++) {
for (int b = 1; b < k + 1; b++) {
f... | [["-", 0, 9, 0, 37, 0, 2, 3, 4, 0, 22], ["+", 0, 9, 0, 37, 0, 2, 3, 4, 0, 22]] | 1 | 150 |
from math import gcd
k = int(input())
ans = 0
for a in range(1,k+1):
for b in range(a,k+1):
ab = gcd(a,b)
for c in range(c,k+1):
g = gcd(ab,c)
if a == b == c:
ans += g
elif a!=b!=c!=a:
ans += g*6
else:
ans += g*3
print(ans)
| from math import gcd
k = int(input())
ans = 0
for a in range(1,k+1):
for b in range(a,k+1):
ab = gcd(a,b)
for c in range(b,k+1):
g = gcd(ab,c)
if a == b == c:
ans += g
elif a != b !=c != a:
ans += g*6
else:
ans += g*3
print(ans)
| [["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 22]] | 5 | 102 |
from math import gcd
k=int(input())
ans=0
for i in range(1,k+1):
for j in range(1,k+1):
for g in range(1,k+1):
ans += math.gcd(math.gcd(i,j), g)
print(ans) | from math import gcd
k=int(input())
ans=0
for i in range(1,k+1):
for j in range(1,k+1):
for g in range(1,k+1):
ans += gcd(gcd(i,j), g)
print(ans) | [["-", 0, 1, 0, 677, 12, 652, 63, 319, 500, 22], ["-", 0, 1, 0, 677, 12, 652, 63, 319, 0, 131], ["-", 12, 652, 3, 4, 0, 652, 63, 319, 500, 22], ["-", 12, 652, 3, 4, 0, 652, 63, 319, 0, 131]] | 5 | 72 |
import math
K = int(input())
ans = 0
for a in range(1, K + 1):
for b in range(a, K + 1):
d = math.gcd(a, b)
for c in range(b, K + 1):
d = math.gcd(d, c)
if a == b == c:
m = 1
elif a == b or b == c or c == a:
m = 3
else... | import math
K = int(input())
ans = 0
for a in range(1, K + 1):
for b in range(a, K + 1):
ab = math.gcd(a, b)
for c in range(b, K + 1):
abc = math.gcd(ab, c)
if a == b == c:
m = 1
elif a == b or b == c or c == a:
m = 3
... | [["-", 0, 7, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 31, 22], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 677, 12, 657, 12, 22], ["+", 8, 196, 0, 1, 0, 677, 12, 657, 12, 22]] | 5 | 109 |
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
using namespace std;
int gcd(int a, int b) {
if (a % b == 0) {
return (b);
} else {
return (gcd(b, a % b));
}
}
int main() {
int k;
cin >> k;
long long sum = 0;
for (int i = 1; i < k; i++) {
for (int j = 1; j < k; j... | #include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
using namespace std;
int gcd(int a, int b) {
if (a % b == 0) {
return (b);
} else {
return (gcd(b, a % b));
}
}
int main() {
int k;
cin >> k;
long long sum = 0;
for (int i = 1; i <= k; i++) {
for (int j = 1; j <= k;... | [["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19]] | 1 | 140 |
import math
from functools import reduce
def gcd(*numbers):
return reduce(math.gcd, numbers)
K = int(input())
for i in range(1,K+1):
for j in range(1,K+1):
for k in range(1,K+1):
total += gcd(i,j,k)
print(total) | import math
from functools import reduce
def gcd(*numbers):
return reduce(math.gcd, numbers)
K = int(input())
total = K*K
for i in range(2,K+1):
for j in range(1,K+1):
for k in range(1,K+1):
total += gcd(i,j,k)
print(total) | [["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 31, 22], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 17, 48], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 12, 22], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612]] | 5 | 80 |
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long int li;
const ll mod = 1000000007;
const ll inf = 1000000000000000000;
typedef vector<int> vi;
typedef vector<li> vli;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef vector<vli> vvli;
typedef vect... | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long int li;
const ll mod = 1000000007;
const ll inf = 1000000000000000000;
typedef vector<int> vi;
typedef vector<li> vli;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef vector<vli> vvli;
typedef vect... | [["+", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]] | 1 | 285 |
from functools import reduce
import math
import sys
K = int(input())
def gcd(*args):
return reduce(math.gcd, args)
if K==1:
print("1")
elif K==2:
print("9")
sys.exit()
ans = K * (K+1)//2
for i in range(1,K):
for j in range(i+1,K+1):
ans += 6*math.gcd(i,j)
for i in range(1,K-1):
for j in range... | from functools import reduce
import math
import sys
K = int(input())
def gcd(*args):
return reduce(math.gcd, args)
if K==1:
print("1")
sys.exit()
elif K==2:
print("9")
sys.exit()
ans = K * (K+1)//2
for i in range(1,K):
for j in range(i+1,K+1):
ans += 6*math.gcd(i,j)
for i in range(1,K-1):
f... | [["+", 64, 196, 0, 1, 0, 652, 63, 319, 500, 22], ["+", 64, 196, 0, 1, 0, 652, 63, 319, 0, 131], ["+", 64, 196, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 160 |
#include <iostream>
using namespace std;
int gcd(int b, int c) {
while (b % c == 0) {
int a = b % c;
b = c;
c = a;
}
return c;
}
int main() {
int n;
cin >> n;
long long int ans = 0;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n; j++) {
for (int k = 1; k <= n; k++) {
a... | #include <iostream>
using namespace std;
int gcd(int b, int c) {
while (b % c != 0) {
int a = b % c;
b = c;
c = a;
}
return c;
}
int main() {
int n;
cin >> n;
long long int ans = 0;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n; j++) {
for (int k = 1; k <= n; k++) {
a... | [["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 79]] | 1 | 133 |
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
int gcd(int a, int b) {
if (b == 0)
return a;
else
return gcd(b, a % b);
}
int main() {
int N;
int sum = 0;
cin >> N;
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
for (int k = 0; k < N; k++) {... | #include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
int gcd(int a, int b) {
if (b == 0)
return a;
else
return gcd(b, a % b);
}
int main() {
int N;
int sum = 0;
cin >> N;
for (int i = 1; i <= N; i++) {
for (int j = 1; j <= N; j++) {
for (int k = 1; k <= N; k++... | [["-", 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, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19]] | 1 | 137 |
from collections import defaultdict
import math
# N, K = map(int, input().split(' '))
N = int(input())
wa = 0
d = defaultdict(set)
d[1].add(1)
for i in range(2, 201):
for j in range(i-1, 0, -1):
if i % j == 0:
d[i].add(j)
for i in range(1, N+1):
for j in range(1, N+1):
for k in ran... | from collections import defaultdict
import math
# N, K = map(int, input().split(' '))
N = int(input())
wa = 0
d = defaultdict(set)
d[1].add(1)
for i in range(2, 201):
for j in range(i, 0, -1):
if i % j == 0:
d[i].add(j)
for i in range(1, N+1):
for j in range(1, N+1):
for k in range... | [["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 33], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]] | 5 | 140 |
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
typedef long long ll;
using namespace std;
int main() {
int n;
ll ans;
cin >> n;
rep(i, n) {
rep(j, n) {
rep(k, n) { ans += gcd(i, gcd(j, k)); }
}
}
cout << ans << endl;
return 0;
}
| #include <bits/stdc++.h>
#define rep(i, n) for (int i = 1; i <= (n); ++i)
typedef long long ll;
using namespace std;
int main() {
int n;
ll ans = 0;
cin >> n;
rep(i, n) {
rep(j, n) {
rep(k, n) { ans += gcd(i, gcd(j, k)); }
}
}
cout << ans << endl;
return 0;
}
| [["-", 36, 36, 36, 36, 0, 30, 0, 112, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 112, 51, 59], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]] | 1 | 82 |
import math
K=int(input())
r=0
for i in range(1,K+1):
for j in range(1,K+1):
a=math.gcd(i,j)
for k in range(K+1):
b=math.gcd(a,k)
r+=b
print(r) | import math
K=int(input())
r=0
for i in range(1,K+1):
for j in range(1,K+1):
a=math.gcd(i,j)
for k in range(1,K+1):
b=math.gcd(a,k)
r+=b
print(r) | [["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 21]] | 5 | 74 |
def gcd(a, b):
while b:
a, b = b, a % b
return a
K = int(input())
ans = 0
for a in range(1, K+1):
for b in range(1, K+1):
gcd = gcd(a, b)
for c in range(1, K+1):
ans += gcd(gcd, c)
print(ans) | def gcd(a, b):
while b:
a, b = b, a % b
return a
K = int(input())
ans = 0
for a in range(1, K+1):
for b in range(1, K+1):
d = gcd(a, b)
for c in range(1, K+1):
ans += gcd(d, c)
print(ans) | [["-", 0, 7, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 31, 22], ["-", 0, 1, 0, 677, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 677, 12, 652, 3, 4, 0, 22]] | 5 | 89 |
import math
K = int(input())
sum = 0
for a in range(1, K+1) :
for b in range(1 , K+1) :
tmp = math.gcd(a, b)
for c in range(1 , K+1) :
sum = sum + math.gcd(a, tmp)
print(sum)
| import math
K = int(input())
sum = 0
for a in range(1, K+1) :
for b in range(1 , K+1) :
tmp = math.gcd(a, b)
for c in range(1 , K+1) :
sum = sum + math.gcd(tmp, c)
print(sum)
| [["-", 0, 662, 12, 657, 12, 652, 3, 4, 0, 22], ["-", 0, 662, 12, 657, 12, 652, 3, 4, 0, 21], ["+", 0, 662, 12, 657, 12, 652, 3, 4, 0, 21], ["+", 0, 662, 12, 657, 12, 652, 3, 4, 0, 22]] | 5 | 75 |
import math
gcd = math.gcd()
ans = 0
k = int(input())
for i in range(1,k+1):
for j in range(1,k+1):
for l in range(1,k+1):
ans += gcd(i,gcd(j,l))
print(ans)
| import math
gcd = math.gcd
ans = 0
k = int(input())
for i in range(1,k+1):
for j in range(1,k+1):
for l in range(1,k+1):
ans += gcd(i,gcd(j,l))
print(ans)
| [["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]] | 5 | 73 |
import math
from functools import reduce
def gcd(*numbers):
return reduce(math.gcd, numbers)
N = int(input())
cnt = 0
for i in range(1, N+1):
for j in range(i, N + 1):
for k in range(j, N + 1):
cnt += gcd(i, j, k)
print(cnt) | import math
from functools import reduce
def gcd(*numbers):
return reduce(math.gcd, numbers)
N = int(input())
cnt = 0
for i in range(1, N+1):
for j in range(1, N + 1):
for k in range(1, N + 1):
cnt += gcd(i, j, k)
print(cnt) | [["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612]] | 5 | 83 |
import math
N = int(input())
sum_ = 1+N
#sum_ = 0
for i in range(1, 1+N):
for j in range(1, 1+N):
a = math.gcd(i, j)
for k in range(1, 1+N):
sum_ += math.gcd(a, k)
print(sum_) | import math
N = int(input())
#sum_ = 1+N
sum_ = 0
for i in range(1, 1+N):
for j in range(1, 1+N):
a = math.gcd(i, j)
for k in range(1, 1+N):
sum_ += math.gcd(a, k)
print(sum_) | [["-", 0, 656, 0, 1, 0, 662, 12, 657, 31, 612], ["-", 0, 656, 0, 1, 0, 662, 12, 657, 17, 72], ["-", 0, 656, 0, 1, 0, 662, 12, 657, 12, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]] | 5 | 76 |
k = int(input())
s = 0
for a in range(1, k+1):
for b in range(1, k+1):
ab = math.gcd(a, b)
for c in range(1, k+1):
s += math.gcd(ab, c)
print(s)
| import math
k = int(input())
s = 0
for a in range(1, k+1):
for b in range(1, k+1):
ab = math.gcd(a, b)
for c in range(1, k+1):
s += math.gcd(ab, c)
print(s)
| [["+", 36, 36, 36, 36, 0, 656, 0, 596, 0, 487], ["+", 36, 36, 0, 656, 0, 596, 141, 673, 0, 22]] | 5 | 71 |
class Array
def gcd
self.inject{|a,b| a.gcd(b)}
end
end
n = gets.to_i
renban = [*1..n]
kumiawase = renban.repeated_combination(3).to_a
result = 0
kumiawase.each do |a|
size = a.uniq.size
if size == 1
result += a.gcd
elsif size == 2
result += (a.gcd * 3)
else
result += (a.gcd * 9)
end
en... | class Array
def gcd
self.inject{|a,b| a.gcd(b)}
end
end
n = gets.to_i
renban = [*1..n]
kumiawase = renban.repeated_combination(3).to_a
result = 0
kumiawase.each do |a|
size = a.uniq.size
if size == 1
result += a.gcd
elsif size == 2
result += (a.gcd * 3)
else
result += (a.gcd * 6)
end
en... | [["-", 75, 95, 0, 755, 12, 739, 0, 738, 12, 612], ["+", 75, 95, 0, 755, 12, 739, 0, 738, 12, 612]] | 4 | 98 |
#include <iostream>
using namespace std;
long long _min(long long a, long long b, long long c) {
long long t = a < b ? a : b;
return t < c ? t : c;
}
long long sec(long long a, long long b, long long c) {
if (a < b)
return a < c ? (b < c ? b : c) : a;
else
return b < c ? (a < c ? a : c) : b;
}
long lon... | #include <iostream>
using namespace std;
long long _min(long long a, long long b, long long c) {
long long t = a < b ? a : b;
return t < c ? t : c;
}
long long sec(long long a, long long b, long long c) {
if (a < b)
return a < c ? (b < c ? b : c) : a;
else
return b < c ? (a < c ? a : c) : b;
}
long lon... | [["-", 0, 14, 8, 9, 0, 57, 64, 37, 0, 22], ["+", 0, 14, 8, 9, 0, 57, 64, 37, 0, 22]] | 1 | 484 |
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <complex>
#include <cstddef>
#include <deque>
#include <functional>
#include <initializer_list>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <que... | #include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <complex>
#include <cstddef>
#include <deque>
#include <functional>
#include <initializer_list>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <que... | [["-", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 8, 9, 0, 7, 8, 9, 0, 43, 39, 78], ["+", 0, 7, 8, 9, 0, 43, 49, 50, 49, 22], ["-", 0, 7, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 12, 22]] | 1 | 766 |
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define _USE_MATH_DEFINES
#include <math.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define NIL = -1;
#define all(x) x.begin(), x.end()
const ll INF = 1e9;
const ll mod = 1e9 + 7;
int digit(ll x) {
if (x / 10 == 0)
return 1;
return digit... | #include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define _USE_MATH_DEFINES
#include <math.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define NIL = -1;
#define all(x) x.begin(), x.end()
const ll INF = 1e9;
const ll mod = 1e9 + 7;
int digit(ll x) {
if (x / 10 == 0)
return 1;
return digit... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 456 |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define INF 999999999
#define rep(i, n) for (int i = 0; i < n; i++)
const ll MOD = 1000000007;
ll cnt = 0, ans = 0;
const int MAX = 510000;
int main() {
int n;
cin >> n;
string s;
cin >> s;
int r = 0, g = 0, b = 0;
for (int i = 0; i < n;... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define INF 999999999
#define rep(i, n) for (int i = 0; i < n; i++)
const ll MOD = 1000000007;
ll cnt = 0, ans = 0;
const int MAX = 510000;
int main() {
ll n;
cin >> n;
string s;
cin >> s;
ll r = 0, g = 0, b = 0;
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], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]] | 1 | 253 |
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[] ch = new int[n];
int r = 0;
int g = 0;
int b = 0;
for (int i = 0; i < n; i++) {
ch[i] = s.charAt(i);
... | 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[] ch = new int[n];
long r = 0;
long g = 0;
long b = 0;
for (int i = 0; i < n; i++) {
ch[i] = s.charAt(i);
... | [["-", 0, 195, 8, 196, 0, 503, 39, 506, 0, 507], ["+", 0, 195, 8, 196, 0, 503, 39, 506, 0, 96]] | 3 | 244 |
#include <bits/stdc++.h>
using namespace std;
/* エイリアス */
#define ll long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vpi vector<pii>
#define vpll vector<pll>
#define endl '\n'
#define fi first
#define se second
#define pb push_... | #include <bits/stdc++.h>
using namespace std;
/* エイリアス */
#define ll long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vpi vector<pii>
#define vpll vector<pll>
#define endl '\n'
#define fi first
#define se second
#define pb push_... | [["-", 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 | 426 |
#pragma warning(disable : 4996)
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <fstream>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (n); ... | #pragma warning(disable : 4996)
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <fstream>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (n); ... | [["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]] | 1 | 291 |
#include <bits/stdc++.h>
using namespace std;
int convert(char c) {
if (c == 'R')
return 0;
if (c == 'G')
return 1;
return 2;
}
int remain(char c1, char c2) {
if ((c1 == 'R' && c2 == 'G') || (c1 == 'G' && c2 == 'R'))
return 2;
if ((c1 == 'R' && c2 == 'B') || (c1 == 'B' && c2 == 'R'))
return 1... | #include <bits/stdc++.h>
using namespace std;
int convert(char c) {
if (c == 'R')
return 0;
if (c == 'G')
return 1;
return 2;
}
int remain(char c1, char c2) {
if ((c1 == 'R' && c2 == 'G') || (c1 == 'G' && c2 == 'R'))
return 2;
if ((c1 == 'R' && c2 == 'B') || (c1 == 'B' && c2 == 'R'))
return 1... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 361 |
#include <cmath>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using P = pair<int, int>;
long mod = (long)1e9 + 7;
int main() {
int n, cnt = 0, r = 0, g = 0, b = 0;
cin >> n;
string s;
cin >> s;
ve... | #include <cmath>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using P = pair<int, int>;
long mod = (long)1e9 + 7;
int main() {
int n;
long cnt = 0, r = 0, g = 0, b = 0;
cin >> n;
string s;
cin >> s... | [["-", 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, 30, 0, 14, 8, 9, 0, 43, 39, 40]] | 1 | 283 |
#include <cstdio>
#include <iostream>
using namespace std;
int main() {
int N;
cin >> N;
char S[4000];
scanf("%s", S);
int count_r = 0, count_g = 0, count_b = 0;
for (int i = 0; i < N; i++) {
if (S[i] == 'R') {
count_r++;
} else if (S[i] == 'G') {
count_g++;
} else if (S[i] == 'B')... | #include <cstdio>
#include <iostream>
using namespace std;
int main() {
int N;
cin >> N;
char S[4000];
scanf("%s", S);
long long count_r = 0, count_g = 0, count_b = 0;
for (int i = 0; i < N; i++) {
if (S[i] == 'R') {
count_r++;
} else if (S[i] == 'G') {
count_g++;
} 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, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 1 | 230 |
#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, r = 0, g = 0, b = 0;
cin >> N;
string S;
cin >> S;
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;
ll r = 0, g = 0, b = 0;
cin >> N;
string S;
cin >> S;
rep(i, N) {
if (S[i] == 'R') {
r++;
} else if (S[i] == 'G') {
g++;
} ... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 232 |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
// freopen("output.txt", "w", stdout);
int main() {
int n, i, j, R = 0, G = 0, B = 0, sum = 0;
string x;
cin >> n >> x;
for (i = 0; i < n; i++) {
if (x[i] == 'R') {
sum = G * B;
R++;
} else if (x[i] == 'G') {
sum = R * ... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
// freopen("output.txt", "w", stdout);
int main() {
int n, i, j, R = 0, G = 0, B = 0;
ll sum = 0;
string x;
cin >> n >> x;
for (i = 0; i < n; i++) {
if (x[i] == 'R') {
sum += G * B;
R++;
} else if (x[i] == 'G') {
sum ... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 107]] | 1 | 233 |
#include <iostream>
using namespace std;
#include <string>
int main() {
int n;
cin >> n;
string str;
cin >> str;
int r = 0, g = 0, b = 0;
for (int i = 0; i < n; i++) {
switch (str.at(i)) {
case 'R':
r++;
break;
case 'G':
g++;
break;
default:
b++;
break;
... | #include <iostream>
using namespace std;
#include <string>
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++) {
switch (str.at(i)) {
case 'R':
r++;
break;
case 'G':
g++;
break;
default:
b++;
br... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 33], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]] | 1 | 203 |
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i, c) \
for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++... | #include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i, c) \
for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++... | [["-", 0, 16, 31, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 16, 31, 2, 3, 4, 0, 16, 12, 13]] | 1 | 348 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
string S;
cin >> S;
int r = 0;
int g = 0;
int b = 0;
int counter = 0;
for (int i = 0; i < N; i++) {
if (S[i] == 'R')
r++;
if (S[i] == 'G')
g++;
if (S[i] == 'B')
b++;
}
long long a = r * g * b;... | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
string S;
cin >> S;
long long r = 0;
long long g = 0;
long long b = 0;
int counter = 0;
for (int i = 0; i < N; i++) {
if (S[i] == 'R')
r++;
if (S[i] == 'G')
g++;
if (S[i] == 'B')
b++;
}
long l... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 229 |
#include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef long long ll;
int main() {
int n;
string s;
cin >> n >> s;
int r(0), g(0), b(0);
for (int i = 0; i < n; ++i) {
... | #include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef long long ll;
int main() {
int n;
string s;
cin >> n >> s;
ll r(0), g(0), b(0);
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]] | 1 | 234 |
#include <cmath>
#include <iostream>
#include <vector>
using namespace std;
int main() {
int N;
string S;
cin >> N;
cin >> S;
int r = 0, g = 0, b = 0;
int i, j;
int mi = 0;
for (i = 0; i < N; ++i) {
if (S[i] == 'R') {
++r;
}
if (S[i] == 'G') {
++g;
}
if (S[i] == 'B'... | #include <cmath>
#include <iostream>
#include <vector>
using namespace std;
int main() {
int N;
string S;
cin >> N;
cin >> S;
long long r = 0, g = 0, b = 0;
int i, j;
int mi = 0;
for (i = 0; i < N; ++i) {
if (S[i] == 'R') {
++r;
}
if (S[i] == 'G') {
++g;
}
if (S[i] ... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 220 |
n = int(input())
s = list(input())
Rcount = 0
Gcount = 0
Bcount = 0
cnt = 0
for i in range(len(s)):
if s[i] == "R":
Rcount += 1
elif s[i] == "G":
Gcount += 1
elif s[i] == "B":
Bcount += 1
RGB = Rcount * Gcount * Bcount
for i in range(1,len... | n = int(input())
s = list(input())
Rcount = 0
Gcount = 0
Bcount = 0
cnt = 0
for i in range(len(s)):
if s[i] == "R":
Rcount += 1
elif s[i] == "G":
Gcount += 1
elif s[i] == "B":
Bcount += 1
RGB = Rcount * Gcount * Bcount
for i in range(1,(le... | [["+", 12, 652, 3, 4, 0, 657, 31, 23, 0, 24], ["+", 3, 4, 0, 657, 31, 23, 0, 657, 12, 612], ["+", 12, 652, 3, 4, 0, 657, 31, 23, 0, 25], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72]] | 5 | 178 |
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using ll = long long;
using namespace std;
int main() {
int n;
cin >> n;
string s;
cin >> s;
vector<int> cnt(3);
rep(i, n) {
if (s[i] == 'R')
cnt[0]++;
else if (s[i] == 'G')
cnt[1]++;
else
cnt[2]++;
}
... | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using ll = long long;
using namespace std;
int main() {
int n;
cin >> n;
string s;
cin >> s;
vector<ll> cnt(3);
rep(i, n) {
if (s[i] == 'R')
cnt[0]++;
else if (s[i] == 'G')
cnt[1]++;
else
cnt[2]++;
}
... | [["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78]] | 1 | 204 |
#include <algorithm>
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <string>
using namespace std;
int cr, cg, cb;
int cnt;
string s;
int n;
int main() {
cin >> n >> s;
for (int i = 0; i < s.size(); i++) {
if (s[i] == 'R')
cr++;
else if (s[i] == 'G')
cg++;
else
... | #include <algorithm>
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <string>
using namespace std;
int cr, cg, cb;
int cnt;
string s;
int n;
int main() {
cin >> n >> s;
for (int i = 0; i < s.size(); i++) {
if (s[i] == 'R')
cr++;
else if (s[i] == 'G')
cg++;
else
... | [["+", 12, 16, 31, 16, 31, 16, 31, 16, 12, 13], ["+", 31, 16, 12, 16, 31, 16, 31, 16, 17, 48]] | 1 | 186 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string s;
cin >> s;
int a = 0, b = 0, c = 0;
for (int i = 0; i < n; i++) {
if (s[i] == 'R')
a++;
if (s[i] == 'G')
b++;
if (s[i] == 'B')
c++;
}
long long ans = a * b * c;
for (int i = 0; i < n; i... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string s;
cin >> s;
int a = 0, b = 0, c = 0;
for (int i = 0; i < n; i++) {
if (s[i] == 'R')
a++;
if (s[i] == 'G')
b++;
if (s[i] == 'B')
c++;
}
long long ans = a * 1ll * b * c;
for (int i = 0; i ... | [["+", 49, 50, 51, 16, 31, 16, 31, 16, 12, 13], ["+", 0, 43, 49, 50, 51, 16, 31, 16, 17, 48]] | 1 | 195 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n = 0;
string s;
cin >> n >> s;
int r, g, b;
long ans = 0;
r = g = b = 0;
for (int i = 0; i < n; i++) {
if (s[i] == 'R')
r++;
if (s[i] == 'G')
g++;
if (s[i] == 'B')
b++;
}
ans = r * g * b;
for (int i = 0... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n = 0;
string s;
cin >> n >> s;
long long r, g, b;
long long ans = 0;
r = g = b = 0;
for (int i = 0; i < n; i++) {
if (s[i] == 'R')
r++;
if (s[i] == 'G')
g++;
if (s[i] == 'B')
b++;
}
ans = r * g * b;
for... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 208 |
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <math.h>
#include <string>
//#include <ctype.h>
#include <bitset>
#include <deque>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
#define ll long long int
#define rep(i, a, n) for (int i = a; ... | #include <algorithm>
#include <iomanip>
#include <iostream>
#include <math.h>
#include <string>
//#include <ctype.h>
#include <bitset>
#include <deque>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
#define ll long long int
#define rep(i, a, n) for (int i = a; ... | [["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78]] | 1 | 520 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, c, n) for (int i = c; i < n; i++)
int main() {
int n, r = 0, g = 0, b = 0;
cin >> n;
string s;
cin >> s;
vector<int> rgb(4001, 0);
rep(i, 0, n) {
string tmp;
tmp = s.substr(i, 1);
if (tmp == "R") {
rgb[i] = 1;
r++;
}
... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, c, n) for (int i = c; i < n; i++)
int main() {
int n;
long long int r = 0, g = 0, b = 0;
cin >> n;
string s;
cin >> s;
vector<int> rgb(4001, 0);
rep(i, 0, n) {
string tmp;
tmp = s.substr(i, 1);
if (tmp == "R") {
rgb[i] = 1;
... | [["-", 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]] | 1 | 295 |
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
#define INF 10000000000000
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
#define repN_1(i, n) for (int i = 0; i < (int)(n - 1); i++)
#define repM(i, n) ... | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
#define INF 10000000000000
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
#define repN_1(i, n) for (int i = 0; i < (int)(n - 1); i++)
#define repM(i, n) ... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 313 |
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
using i64 = int64_t;
int32_t main() {
int n;
string s;
cin >> n >> s;
int cnt[3] = {0};
for (auto &&c : s) {
cnt[c % 3]++;
}
i64 res = cnt[0] * cnt[1] * cnt[2];
for (int j = 0; j < n; j++) {
for (int i = 0; i... | #include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
using i64 = int64_t;
int32_t main() {
int n;
string s;
cin >> n >> s;
i64 cnt[3] = {0};
for (auto &&c : s) {
cnt[c % 3]++;
}
i64 res = cnt[0] * cnt[1] * cnt[2];
for (int j = 0; j < n; j++) {
for (int i = 0; i... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 173 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
string s;
cin >> n;
cin >> s;
int cnt1 = 0, cnt2 = 0, cnt3 = 0;
for (int i = 0; i < n; i++) {
if (s[i] == 'R')
cnt1++;
else if (s[i] == 'G')
cnt2++;
else
cnt3++;
}
int ans = cnt1 * cnt2 * cnt3;
for (int i =... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
string s;
cin >> n;
cin >> s;
long long int cnt1 = 0, cnt2 = 0, cnt3 = 0;
for (int i = 0; i < n; i++) {
if (s[i] == 'R')
cnt1++;
else if (s[i] == 'G')
cnt2++;
else
cnt3++;
}
long long int ans = cnt1 * cnt2 * ... | [["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 191 |
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define DEBUG(x) cout << #x << "=" << x << endl
#define DEBUG2(x, y) cout << #x << ... | #include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define DEBUG(x) cout << #x << "=" << x << endl
#define DEBUG2(x, y) cout << #x << ... | [["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 78], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 581 |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
String[] sArray = sc.next().split("");
int[] rList = new int[n + 1];
int[] gList = new int[n + 1];
int[] bList = new int[n + 1];
int redCount... | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
String[] sArray = sc.next().split("");
int[] rList = new int[n + 1];
int[] gList = new int[n + 1];
int[] bList = new int[n + 1];
long redCoun... | [["-", 0, 195, 8, 196, 0, 503, 39, 506, 0, 507], ["+", 0, 195, 8, 196, 0, 503, 39, 506, 0, 96]] | 3 | 500 |
#include <iostream>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
string s;
cin >> s;
vector<int> r, g, b;
for (int i = 0; i < n; i++) {
switch (s[i]) {
case 'R':
r.push_back(i);
break;
case 'G':
g.push_back(i);
break;
case 'B':
b.push_bac... | #include <iostream>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
string s;
cin >> s;
vector<int> r, g, b;
for (int i = 0; i < n; i++) {
switch (s[i]) {
case 'R':
r.push_back(i);
break;
case 'G':
g.push_back(i);
break;
case 'B':
b.push_bac... | [["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 309 |
N = gets.to_i
S = gets.chomp
counter = S.chars.tally
ans = counter['R'] * counter['G'] * counter['B']
1.upto(N) do |i|
j = 0
while j + 2 * i < N
ans -= 1 if S[j] != S[j + i] && S[j + i] != S[j + 2 * i] && S[j] != S[j + 2 * i]
j += 1
end
end
puts ans
| N = gets.to_i
S = gets.chomp
counter = S.chars.tally
counter.default = 0
ans = counter['R'] * counter['G'] * counter['B']
1.upto(N) do |i|
j = 0
while j + 2 * i < N
ans -= 1 if S[j] != S[j + i] && S[j + i] != S[j + 2 * i] && S[j] != S[j + 2 * i]
j += 1
end
end
puts ans
| [["+", 36, 36, 0, 493, 0, 662, 31, 652, 486, 22], ["+", 36, 36, 0, 493, 0, 662, 31, 652, 17, 131], ["+", 36, 36, 0, 493, 0, 662, 31, 652, 735, 22], ["+", 36, 36, 36, 36, 0, 493, 0, 662, 0, 32], ["+", 36, 36, 36, 36, 0, 493, 0, 662, 12, 612]] | 4 | 112 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
const int MOD = 1000000007;
int main() {
int n;
string s;
cin >> n >> s;
ll all = 0, r = 0, g = 0, b = 0;
for (auto c : s) {
/* code */
if (c == 'R') {
/* code */
r++;
... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
const int MOD = 1000000007;
int main() {
int n;
string s;
cin >> n >> s;
ll all = 0, r = 0, g = 0, b = 0;
for (auto c : s) {
/* code */
if (c == 'R') {
/* code */
r++;
... | [["-", 15, 339, 51, 16, 31, 16, 31, 16, 17, 47], ["+", 15, 339, 51, 16, 31, 16, 31, 16, 17, 20]] | 1 | 215 |
#include <cstring>
#include <iostream>
using namespace std;
int n;
string s;
int r, g, b;
long long ans;
int main() {
ios_base::sync_with_stdio(false);
cin >> n >> s;
for (int i = 0; i < n; i++) {
if (s[i] == 'R')
r++;
if (s[i] == 'G')
g++;
if (s[i] == 'B')
b++;
}
ans = r * g * ... | #include <cstring>
#include <iostream>
using namespace std;
int n;
string s;
int r, g, b;
unsigned long long ans;
int main() {
ios_base::sync_with_stdio(false);
cin >> n >> s;
for (int i = 0; i < n; i++) {
if (s[i] == 'R')
r++;
if (s[i] == 'G')
g++;
if (s[i] == 'B')
b++;
}
ans =... | [["+", 36, 36, 0, 30, 0, 43, 39, 86, 0, 87], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 17, 48], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 108]] | 1 | 219 |
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
const int INF = 1001001001;
const int MOD = 1000000007;
typedef long long ll;
int main() {
int N;
string S;
cin >> N >> S;
int rc = 0, gc = 0, bc = 0;
for (char c :... | #include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
const int INF = 1001001001;
const int MOD = 1000000007;
typedef long long ll;
int main() {
int N;
string S;
cin >> N >> S;
ll rc = 0, gc = 0, bc = 0;
for (char c : ... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 215 |
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
string s;
int n;
cin >> n;
cin >> s;
vector<int> a(n);
rep(i, n) {
if (s[i] == 'R')
a[i] = 0;
if (s[i] == 'G')
... | using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
string s;
int n;
cin >> n;
cin >> s;
vector<int> a(n);
rep(i, n) {
if (s[i] == 'R')
a[i] = 0;
if (s[i] == 'G')
... | [["-", 49, 50, 51, 16, 31, 16, 31, 69, 28, 22], ["+", 49, 50, 51, 16, 31, 16, 31, 69, 28, 22], ["-", 49, 50, 51, 16, 31, 16, 12, 69, 28, 22], ["+", 49, 50, 51, 16, 31, 16, 12, 69, 28, 22], ["-", 0, 43, 49, 50, 51, 16, 12, 69, 28, 22], ["+", 0, 43, 49, 50, 51, 16, 12, 69, 28, 22]] | 1 | 263 |
#include <algorithm>
#include <iostream>
using namespace std;
int n;
const int maxn = 4005;
char s[maxn];
int a[maxn];
int r[3][maxn];
long long ans = 0;
int main() {
scanf("%d", &n);
scanf("%s", s);
for (int i = 1; i <= n; i++) {
if (s[i - 1] == 'R')
a[i] = 0;
if (s[i - 1] == 'G')
a[i] = 1;
... | #include <algorithm>
#include <iostream>
using namespace std;
int n;
const int maxn = 4005;
char s[maxn];
int a[maxn];
int r[3][maxn];
long long ans = 0;
int main() {
scanf("%d", &n);
scanf("%s", s);
for (int i = 1; i <= n; i++) {
if (s[i - 1] == 'R')
a[i] = 0;
if (s[i - 1] == 'G')
a[i] = 1;
... | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 1 | 356 |
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <limits>
#include <map>
#include <numeric> // 最大公約数が使える
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <vector>
#define rep(i, s, g) for (i = s; i < g; i++)
using namespace std;
using ll... | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <limits>
#include <map>
#include <numeric> // 最大公約数が使える
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <vector>
#define rep(i, s, g) for (i = s; i < g; i++)
using namespace std;
using ll... | [["-", 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 ll long long
#define ull unsigned long long
#define dl double long
const int INF = 0x3fffffff;
const ll MOD = 1000000007;
const ll MODD = 998244353;
#define rrep(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
#define REP(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i++)
#d... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define dl double long
const int INF = 0x3fffffff;
const ll MOD = 1000000007;
const ll MODD = 998244353;
#define rrep(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
#define REP(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i++)
#d... | [["+", 8, 9, 0, 7, 15, 16, 31, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 31, 16, 12, 13]] | 1 | 336 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, n) for (int i = a; i < n; i++)
#define per(i, a, n) for (int i = n - 1; i >= a; i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, a, n) for (int i = a; i < n; i++)
#define per(i, a, n) for (int i = n - 1; i >= a; i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
... | [["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 78], ["-", 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 | 671 |
/*
Name:
Author: xiaruize
Date:
*/
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cerrno>
#include <clocale>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cwchar>
#include <cwctype>
#include <deque>
#in... | /*
Name:
Author: xiaruize
Date:
*/
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cerrno>
#include <clocale>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cwchar>
#include <cwctype>
#include <deque>
#in... | [["+", 36, 36, 36, 36, 0, 30, 0, 58, 0, 148], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 0, 30, 0, 14, 39, 86, 0, 156]] | 1 | 396 |
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string.h>
#include <string>
#include <tuple>
#include <vector>
#define rep(i, n) for (int i = 0; i < n; i++)
#define _GLIBCXX_DEBUG
using ll = long long... | #include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string.h>
#include <string>
#include <tuple>
#include <vector>
#define rep(i, n) for (int i = 0; i < n; i++)
#define _GLIBCXX_DEBUG
using ll = long long... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 0, 43, 49, 50, 51, 16, 31, 16, 31, 13], ["-", 0, 43, 49, 50, 51, 16, 31, 16, 17, 48], ["+", 0, 43, 49, 50, 51, 16, 31, 16, 31, 22], ["+", 0, 43, 49, 50, 51, 16, 31, 16, 17, 72]] | 1 | 333 |
#include <algorithm>
#include <cstring>
#include <fstream>
#include <iostream>
#include <queue>
#include <vector>
#define INF 0x3f3f3f3f
#define LL long long
using namespace std;
int N;
string S;
int ans = 0;
int main() {
scanf("%d", &N);
cin >> S;
int c1, c2, c3;
c1 = c2 = c3 = 0;
int rgb = 0;
for (int... | #include <algorithm>
#include <cstring>
#include <fstream>
#include <iostream>
#include <queue>
#include <vector>
#define INF 0x3f3f3f3f
#define LL long long
using namespace std;
int N;
string S;
LL ans = 0;
int main() {
scanf("%d", &N);
cin >> S;
LL c1, c2, c3;
c1 = c2 = c3 = 0;
LL rgb = 0;
for (int i ... | [["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 78], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 245 |
#include <bits/stdc++.h>
using namespace std;
int ctoi(const char c) {
switch (c) {
case '0':
return 0;
case '1':
return 1;
case '2':
return 2;
case '3':
return 3;
case '4':
return 4;
case '5':
return 5;
case '6':
return 6;
case '7':
return 7;
case '8':
return 8... |
#include <bits/stdc++.h>
using namespace std;
int ctoi(const char c) {
switch (c) {
case '0':
return 0;
case '1':
return 1;
case '2':
return 2;
case '3':
return 3;
case '4':
return 4;
case '5':
return 5;
case '6':
return 6;
case '7':
return 7;
case '8':
return 8... | [["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 408 |
#include <algorithm>
#include <array>
#include <cmath>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <string>
typedef long long int ll;
using namespace std;
#define maxN 1000005
#define mod 1000000007
// ll all[maxN]= {};
int n;
string s;
void solve() {
ll ans = 0;
... | #include <algorithm>
#include <array>
#include <cmath>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <string>
typedef long long int ll;
using namespace std;
#define maxN 1000005
#define mod 1000000007
// ll all[maxN]= {};
int n;
string s;
void solve() {
ll ans = 0;
... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 283 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.