problem_id
stringlengths
6
6
language
stringclasses
2 values
original_status
stringclasses
3 values
original_src
stringlengths
19
243k
changed_src
stringlengths
19
243k
change
stringclasses
3 values
i1
int64
0
8.44k
i2
int64
0
8.44k
j1
int64
0
8.44k
j2
int64
0
8.44k
error
stringclasses
270 values
stderr
stringlengths
0
226k
p02818
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, k; cin >> a >> b >> k; while (k > 0) { if (a > 0) { a -= 1; k -= 1; } else if (b > 0) { b -= 1; k -= 1; } else { k -= 1; break; } } cout << a << " " << b; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, k; cin >> a >> b >> k; if (k > a) { k -= a; a = 0; } else { a -= k; k = 0; } if (k > b) { k -= b; b = 0; } else { b -= k; k = 0; } cout << a << " " << b; return 0; }
replace
5
16
5
18
TLE
p02818
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define _GLIBCXX_DEBUG using namespace std; typedef long long ll; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define REP(a, b, m) for (ll a = (ll)(b); a < (ll)(m); a++) int main() { ll a, b, k; cin >> a >> b >> k; rep(i, k) { if (a >= 1) a--; else if (b >= 1) ...
#include <bits/stdc++.h> #define _GLIBCXX_DEBUG using namespace std; typedef long long ll; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define REP(a, b, m) for (ll a = (ll)(b); a < (ll)(m); a++) int main() { ll a, b, k; cin >> a >> b >> k; if (k <= a) { cout << a - k << ' ' << b << endl; } else if...
replace
12
21
12
18
TLE
p02818
C++
Runtime Error
#define _CRT_SECURE_NO_WARNINGS #include <bits/stdc++.h> #include <unordered_map> #define endl "\n" #define all(v) v.begin(), v.end() #define allr(s) s.rbegin(), s.rend() #define RT(s) return cout << s, 0 #define watch(x) cout << (#x) << " = " << x << endl #define sz(s) (int)(s.size()) #define PI acos(-1) #define EPS 1...
#define _CRT_SECURE_NO_WARNINGS #include <bits/stdc++.h> #include <unordered_map> #define endl "\n" #define all(v) v.begin(), v.end() #define allr(s) s.rbegin(), s.rend() #define RT(s) return cout << s, 0 #define watch(x) cout << (#x) << " = " << x << endl #define sz(s) (int)(s.size()) #define PI acos(-1) #define EPS 1...
replace
35
36
35
36
0
p02818
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, k; cin >> a >> b >> k; while (a > 0) { a--; k--; if (k == 0) break; } while (b > 0) { b--; k--; if (k == 0) break; } cout << a << " " << b; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, k; cin >> a >> b >> k; if (a >= k) cout << a - k << " " << b; else if (a < k && a + b >= k) cout << 0 << " " << b - k + a; else if (a < k && b < k) cout << 0 << " " << 0; return 0; }
replace
6
19
6
12
TLE
p02818
C++
Time Limit Exceeded
#include <iostream> using namespace std; int main() { long long a, b, k; cin >> a >> b >> k; if (a + b <= k) { cout << "0 0" << endl; } else { for (long i = 0; i < k; i++) { if (a > 0) --a; else if (b > 0) --b; } cout << a << " " << b << endl; } return 0; }
#include <iostream> using namespace std; int main() { long long a, b, k; cin >> a >> b >> k; if (a + b <= k) { cout << "0 0" << endl; } else { if (k <= a) cout << a - k << " " << b << endl; else cout << "0 " << b + a - k; } return 0; }
replace
9
16
9
13
TLE
p02818
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { long long A, B, K; cin >> A >> B >> K; if (A > K) { A -= K; } else { B -= K - A; A = 0; } printf("%llf %llf\n", A, max(0LL, B)); }
#include <bits/stdc++.h> using namespace std; int main() { long long A, B, K; cin >> A >> B >> K; if (A > K) { A -= K; } else { B -= K - A; A = 0; } printf("%lld %lld\n", A, max(0LL, B)); }
replace
11
12
11
12
0
p02818
C++
Time Limit Exceeded
#include <iostream> using namespace std; long A, B, K; int main() { cin >> A >> B >> K; for (long i = 0; i < K; i++) { if (A >= 1) { A--; } else if (B >= 1) { B--; } else { break; } } cout << A << ' ' << B; }
#include <iostream> using namespace std; long A, B, K; int main() { cin >> A >> B >> K; if (K < A) { A = A - K; } else { B = B - (K - A); A = 0; } if (B < 0) { B = 0; } cout << A << ' ' << B; }
replace
8
16
8
17
TLE
p02818
Python
Time Limit Exceeded
A, B, K = map(int, input().split()) for _ in range(K): if A > 0: A -= 1 elif B > 0: B -= 1 else: continue print(A, B)
A, B, K = map(int, input().split()) C = max(0, A - K) K -= A - C print(C, max(0, B - K))
replace
2
10
2
5
TLE
p02818
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define int long long #define double long double #define fo(a, b) for (int a = 0; a < b; a++) #define Sort(a) sort(a.begin(), a.end()) #define rev(a) reverse(a.begin(), a.end()) #define fi first #define se second #define co(a) cout << a << endl #define sz size() #define bgn...
#include <bits/stdc++.h> using namespace std; #define int long long #define double long double #define fo(a, b) for (int a = 0; a < b; a++) #define Sort(a) sort(a.begin(), a.end()) #define rev(a) reverse(a.begin(), a.end()) #define fi first #define se second #define co(a) cout << a << endl #define sz size() #define bgn...
replace
246
254
246
253
TLE
p02819
C++
Time Limit Exceeded
#include <bits/stdc++.h> #include <cmath> #include <iostream> #include <vector> using namespace std; const int N = pow(10, 9); vector<bool> isp(N + 1, true); void sieve() { isp[0] = false; isp[1] = false; for (int i = 2; pow(i, 2) <= N; i++) { if (isp[i]) for (int j = 2; i * j <= N; j++) isp[...
#include <bits/stdc++.h> #include <cmath> #include <iostream> #include <vector> using namespace std; const int N = pow(10, 6); vector<bool> isp(N + 1, true); void sieve() { isp[0] = false; isp[1] = false; for (int i = 2; pow(i, 2) <= N; i++) { if (isp[i]) for (int j = 2; i * j <= N; j++) isp[...
replace
6
7
6
7
TLE
p02819
C++
Time Limit Exceeded
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rrep(i, n) for (int i = 1; i < (int)(n); i++) #define dunk(n) cout << n << endl #define all(a) (a).begin(), (a).end() typedef pair<int, int> P; typedef long long ll; bool is_prime(ll num) {...
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rrep(i, n) for (int i = 1; i < (int)(n); i++) #define dunk(n) cout << n << endl #define all(a) (a).begin(), (a).end() typedef pair<int, int> P; typedef long long ll; bool is_prime(ll num) {...
insert
32
32
32
33
TLE
p02819
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int x, s; int a[100009][2]; for (int i = 2; i < 100009; i++) { a[i][0] = i; a[i][1] = 0; } for (int i = 2; i < 400; i++) { if (a[i][1] == 0) { a[i][1] = 2; s = 2; while (i * s < 100009) { a[i * s][1] = 1; ...
#include <bits/stdc++.h> using namespace std; int main() { int x, s; int a[100009][2]; for (int i = 2; i < 100009; i++) { a[i][0] = i; a[i][1] = 0; } for (int i = 2; i < 100009; i++) { if (a[i][1] == 0) { a[i][1] = 2; s = 2; while (i * s < 100009) { a[i * s][1] = 1; ...
replace
10
11
10
11
0
p02819
C++
Runtime Error
/** * @copyright (c) 2020 Daisuke Hashimoto */ #include <bits/stdc++.h> using namespace std; using ll = int64_t; using Pair = pair<int32_t, int32_t>; // std::cout << std::setprecision(20) << 1.1 << endl; int32_t f(const int32_t n) { return (n % 2 == 0) ? n / 2 : 3 * n + 1; } int main() { cin.tie(0); ios::sync...
/** * @copyright (c) 2020 Daisuke Hashimoto */ #include <bits/stdc++.h> using namespace std; using ll = int64_t; using Pair = pair<int32_t, int32_t>; // std::cout << std::setprecision(20) << 1.1 << endl; int32_t f(const int32_t n) { return (n % 2 == 0) ? n / 2 : 3 * n + 1; } int main() { cin.tie(0); ios::sync...
replace
20
21
20
21
0
p02819
C++
Time Limit Exceeded
#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 x; int ans; cin >> x; ans = 0; int x2; x2 = x; while (ans == 0) { rep(i, x2 - 2) { if (x % (i + 2) == 0) { break; } ...
#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 x; int ans; cin >> x; ans = 0; int x2; x2 = x; while (ans == 0) { if (x == 2) { ans = 2; break; } rep(i, x2 - 2) { i...
insert
14
14
14
18
TLE
p02819
Python
Time Limit Exceeded
# ABC149C - Next Prime def is_prime(n: int) -> bool: """ Evaluate whether a number is prime or not. Args: n: a number to evaluate Returns: whether n is prime or not """ if n == 2: return True if n == 1 or n % 2 == 0: return False for i in range(3, int(n**0.5) + ...
# ABC149C - Next Prime def is_prime(n: int) -> bool: """ Evaluate whether a number is prime or not. Args: n: a number to evaluate Returns: whether n is prime or not """ if n == 2: return True if n == 1 or n % 2 == 0: return False for i in range(3, int(n**0.5) + ...
insert
22
22
22
24
TLE
p02819
Python
Time Limit Exceeded
import math x = int(input()) primes = [] for n in range(2, 10000000000, 2): f = True mp = math.ceil(math.sqrt(n)) for p in primes: if p > mp: break if n % p == 0: f = False break if f: primes.append(n) if n >= x: print(n)...
import math x = int(input()) primes = [] if x == 2: print(2) exit(0) for n in range(3, 10000000000, 2): f = True mp = math.ceil(math.sqrt(n)) for p in primes: if p > mp: break if n % p == 0: f = False break if f: primes.append(n) ...
replace
6
7
6
11
TLE
p02819
C++
Runtime Error
#include <cmath> #include <cstdlib> #include <iostream> #include <vector> using namespace std; using lli = long long int; int main() { int x; cin >> x; int m = min(x * x, 100010); vector<bool> p(m, true); p[0] = p[1] = false; for (int i = 2; i < (int)sqrt(m); i++) { if (p[i] == false) { continue;...
#include <cmath> #include <cstdlib> #include <iostream> #include <vector> using namespace std; using lli = long long int; int main() { int x; cin >> x; int m = 100010; vector<bool> p(m, true); p[0] = p[1] = false; for (int i = 2; i < (int)sqrt(m); i++) { if (p[i] == false) { continue; } f...
replace
10
11
10
11
0
p02819
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; bool is_prime(int x) { if (x <= 1) return false; for (int i = 2; i * i <= x; i++) { if (x % i == 0) return false; } return false; } int main() { int n; cin >> n; while (!is_prime(n)) n++; cout << n; }
#include <bits/stdc++.h> using namespace std; bool is_prime(int x) { if (x <= 1) return false; for (int i = 2; i * i <= x; i++) { if (x % i == 0) return false; } return true; } int main() { int n; cin >> n; while (!is_prime(n)) n++; cout << n; }
replace
9
10
9
10
TLE
p02819
C++
Runtime Error
// libraries #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/detail/standard_policies.hpp> #include <ext/pb_ds/tree_policy.hpp> // namespace using namespace std; using namespace __gnu_pbds; // typedef typedef tree<long long, null_type, less<long long>, rb_tree_tag, ...
// libraries #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/detail/standard_policies.hpp> #include <ext/pb_ds/tree_policy.hpp> // namespace using namespace std; using namespace __gnu_pbds; // typedef typedef tree<long long, null_type, less<long long>, rb_tree_tag, ...
replace
75
79
75
80
0
p02819
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; bool isPrime(int x) { bool res = true; for (int i = 1; i * i <= x; i++) { if (x % i == 0) { res = false; break; } } return res; } int main() { int X; cin >> X; while (true) { if (isPrime(X)) { cout << X << endl; return 0;...
#include <bits/stdc++.h> using namespace std; bool isPrime(int x) { bool res = true; for (int i = 2; i * i <= x; i++) { if (x % i == 0) { res = false; break; } } return res; } int main() { int X; cin >> X; while (true) { if (isPrime(X)) { cout << X << endl; return 0;...
replace
5
6
5
6
TLE
p02819
C++
Runtime Error
#include <iostream> using namespace std; int const NMAX = 1e6; bool ciur[1 + NMAX]; int computeCiur() { for (long long i = 2; i * i <= NMAX; i++) { if (ciur[i] == 0) { for (long long j = i * i; j <= NMAX; j += i) { ciur[j] = 1; } } } } int main() { int n; cin >> n; computeCiu...
#include <iostream> using namespace std; int const NMAX = 1e6; bool ciur[1 + NMAX]; void computeCiur() { for (long long i = 2; i * i <= NMAX; i++) { if (ciur[i] == 0) { for (long long j = i * i; j <= NMAX; j += i) { ciur[j] = 1; } } } } int main() { int n; cin >> n; computeCi...
replace
8
9
8
9
0
p02819
C++
Runtime Error
#include <algorithm> #include <bitset> #include <cmath> #include <deque> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <tuple> #include <utility> #include <vector> using namespace st...
#include <algorithm> #include <bitset> #include <cmath> #include <deque> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <tuple> #include <utility> #include <vector> using namespace st...
replace
51
52
51
52
0
p02819
C++
Time Limit Exceeded
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <queue> #include <random> #include <set> #include <stdio.h> #include <string> #include <time.h> #include <vector> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; int main() { int x; cin >> x; while (true) { ...
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <queue> #include <random> #include <set> #include <stdio.h> #include <string> #include <time.h> #include <vector> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; int main() { int x; cin >> x; while (true) { ...
replace
19
20
19
20
TLE
p02819
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define int long long bool isPrime(int n) { if (n <= 1) return false; for (int i = 2; i * i <= n; i++) { if (i % 2 == 0) return false; } return true; } int32_t main() { int n; cin >> n; int p = n; while (!isPrime(p)) { p++; } cout <...
#include <bits/stdc++.h> using namespace std; #define int long long bool isPrime(int n) { if (n <= 1) return false; for (int i = 2; i * i <= n; i++) { if (n % i == 0) return false; } return true; } int32_t main() { int n; cin >> n; int p = n; while (!isPrime(p)) { p++; } cout <...
replace
8
9
8
9
TLE
p02819
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> P; constexpr int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0}; #define rep(i, n) for (int i = 0; i < n; i++) #define repr(i, n) for (int i = n; i >= 0; i--) #define SORT(v) sort((v).begin(), (v).end()) #define SORTR(v) sort((v).rbe...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> P; constexpr int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0}; #define rep(i, n) for (int i = 0; i < n; i++) #define repr(i, n) for (int i = n; i >= 0; i--) #define SORT(v) sort((v).begin(), (v).end()) #define SORTR(v) sort((v).rbe...
replace
129
130
129
130
0
p02819
C++
Time Limit Exceeded
#include <iostream> using namespace std; int main() { int x; cin >> x; while (1) { bool ok = true; for (int i = 2; i < x; ++i) { if (x % 1 == 0) { ok = false; break; } } if (ok) break; ++x; } cout << x << endl; return 0; }
#include <iostream> using namespace std; int main() { int x; cin >> x; while (1) { bool ok = true; for (int i = 2; i < x; ++i) { if (x % i == 0) { ok = false; break; } } if (ok) break; ++x; } cout << x << endl; return 0; }
replace
10
11
10
11
TLE
p02819
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define countof(array) (sizeof(array) / sizeof(array[0])) #define rep(i, n) for (int i = 0; i < (n); ++i) #define rrep(i, n) for (int i = (n)-1; i >= 0; --i) #define rep2(i, n) for (int i = 1; i <= (n); ++i) #define rrep2(i, n) for (int i ...
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define countof(array) (sizeof(array) / sizeof(array[0])) #define rep(i, n) for (int i = 0; i < (n); ++i) #define rrep(i, n) for (int i = (n)-1; i >= 0; --i) #define rep2(i, n) for (int i = 1; i <= (n); ++i) #define rrep2(i, n) for (int i ...
replace
73
74
73
74
-6
double free or corruption (!prev)
p02819
C++
Time Limit Exceeded
#include <algorithm> #include <cmath> #include <cstdio> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <string> #include <vector> #define rep(i, n) for (long long i = 0; (i) < (n); (i)++) using namespace std; using ll = long long; const ll mod = 1000000007; int main() { ll N; cin >...
#include <algorithm> #include <cmath> #include <cstdio> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <string> #include <vector> #define rep(i, n) for (long long i = 0; (i) < (n); (i)++) using namespace std; using ll = long long; const ll mod = 1000000007; int main() { ll N; cin >...
insert
26
26
26
28
TLE
p02819
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for (int i = a; i < (b); ++i) #define trav(a, x) for (auto &a : x) #define sz(x) (int)(x).size() typedef vector<int> vi; // #define ll long long #define int long long #define ld long double #define fi first #define se second #define pb push_back #define...
#include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for (int i = a; i < (b); ++i) #define trav(a, x) for (auto &a : x) #define sz(x) (int)(x).size() typedef vector<int> vi; // #define ll long long #define int long long #define ld long double #define fi first #define se second #define pb push_back #define...
replace
37
41
37
38
0
p02819
C++
Runtime Error
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; ++i) #define rep2(i, s, n) for (int i = s; i < n; ++i) #define all(a) a.begin(), a.end() #define tmax(a, b, c) max(a, max(b, c)) #define tmin(a, b, c) min(a, min(b, c)) #define pb push_back using namespace std; using ll = long long; using P = pair<int, i...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; ++i) #define rep2(i, s, n) for (int i = s; i < n; ++i) #define all(a) a.begin(), a.end() #define tmax(a, b, c) max(a, max(b, c)) #define tmin(a, b, c) min(a, min(b, c)) #define pb push_back using namespace std; using ll = long long; using P = pair<int, i...
replace
65
66
65
66
0
p02819
C++
Runtime Error
#include <bits/stdc++.h> #define PI 3.1415926535897932 #define MOD 1000000007 #define INF 1e9 #define REP(i, n) for (int i = 0; i < (n); i++) #define REP1(i, n) for (int i = 1; i <= (n); i++) #define ALL(v) (v).begin(), (v).end() using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef vector<...
#include <bits/stdc++.h> #define PI 3.1415926535897932 #define MOD 1000000007 #define INF 1e9 #define REP(i, n) for (int i = 0; i < (n); i++) #define REP1(i, n) for (int i = 1; i <= (n); i++) #define ALL(v) (v).begin(), (v).end() using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef vector<...
replace
25
26
25
26
-6
double free or corruption (!prev)
p02819
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; const int MAX_N = 120000; vector<bool> IsPrime(MAX_N, true); void sieve() { IsPrime[0] = false; IsPrime[1] = false; for (int i = 2; i * i <= MAX_N; i++) { if (IsPrime[i]) { for (int j = 2; i * j <= MAX_N; j++) { IsPrime[i * j] = false; } ...
#include <bits/stdc++.h> using namespace std; const int MAX_N = 101010; vector<bool> IsPrime(MAX_N, true); void sieve() { IsPrime[0] = false; IsPrime[1] = false; for (int i = 2; i * i <= MAX_N; i++) { if (IsPrime[i]) { for (int j = 2; i * j <= MAX_N; j++) { IsPrime[i * j] = false; } ...
replace
3
4
3
4
-6
double free or corruption (!prev)
p02819
C++
Time Limit Exceeded
#include <bits/stdc++.h> #include <iostream> #include <string> #define UB upper_bound #define LB lower_bound #define BS binary_search #define IN insert #define PB push_back #define EB emplace_back #define MP make_pair #define NL cout << endl #define ll long long int #define ld long double #define vl vector<ll> #define ...
#include <bits/stdc++.h> #include <iostream> #include <string> #define UB upper_bound #define LB lower_bound #define BS binary_search #define IN insert #define PB push_back #define EB emplace_back #define MP make_pair #define NL cout << endl #define ll long long int #define ld long double #define vl vector<ll> #define ...
replace
58
59
58
59
TLE
p02819
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define INF 1LL << 62 #define inf 1000000007 int main() { ll n; cin >> n; vector<ll> so; for (ll i = 2;; i++) { bool ch = true; for (auto itr = so.begin(); itr != so.end(); itr++) { if (i % *itr == 0) { ch = false; ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define INF 1LL << 62 #define inf 1000000007 int main() { ll n; cin >> n; vector<ll> so; for (ll i = 2;; i++) { bool ch = true; for (auto itr = so.begin(); itr != so.end(); itr++) { if (i % *itr == 0) { ch = false; ...
insert
16
16
16
19
TLE
p02819
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int main() { int X; cin >> X; bool prime = true; int count = 0; // 約数の数 if (X == 2) { cout << 2 << endl; } else { while (prime) { for (int j = 2; j * j <= X; j++) { if (X % j == 0) { count++; break; } } // ...
#include <bits/stdc++.h> using namespace std; int main() { int X; cin >> X; bool prime = true; int count = 0; // 約数の数 if (X == 2) { cout << 2 << endl; } else { while (prime) { count = 0; for (int j = 2; j * j <= X; j++) { if (X % j == 0) { count++; break; ...
insert
11
11
11
12
TLE
p02819
C++
Runtime Error
#include <bits/stdc++.h> #define rep(i, a) for (int i = 0; i < int(a); ++i) using ll = long long; using namespace std; ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; } vector<bool> isprime(2 * 1e5, true); int main() { ll x; cin >> x; isprime[0] = false; isprime[1] = false; for (ll i = 2; pow(i, 2) <= 2 * ...
#include <bits/stdc++.h> #define rep(i, a) for (int i = 0; i < int(a); ++i) using ll = long long; using namespace std; ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; } vector<bool> isprime(1e6, true); int main() { ll x; cin >> x; isprime[0] = false; isprime[1] = false; for (ll i = 2; pow(i, 2) <= 2 * x; i...
replace
5
6
5
6
0
p02819
C++
Runtime Error
// define DEBUG for debug #define DEBUG #include <bits/stdc++.h> using namespace std; #define F first #define S second #define mp make_pair #define pb push_back #define MAX 100000 + 100 #define MOD 1000000007 typedef long long int ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; int asallar[100000], asalsay =...
// define DEBUG for debug // #define DEBUG #include <bits/stdc++.h> using namespace std; #define F first #define S second #define mp make_pair #define pb push_back #define MAX 100000 + 100 #define MOD 1000000007 typedef long long int ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; int asallar[100000], asalsa...
replace
1
2
1
2
0
p02819
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int main() { long long a; cin >> a; if (a == 0) { cout << 1; } else if (a == 1) { cout << 2; } else { for (long long i = 2; i <= a * a; i++) { long long flag = 1; for (long long j = 2; j <= i / 2; ++j) { if (i % j == 0) { ...
#include <bits/stdc++.h> using namespace std; int main() { long long a; cin >> a; if (a == 0) { cout << 1; } else if (a == 1) { cout << 2; } else { for (long long i = a; i <= a * a; i++) { long long flag = 1; for (long long j = 2; j <= i / 2; ++j) { if (i % j == 0) { ...
replace
12
13
12
13
TLE
p02819
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; vector<bool> isp; int N; void sieve() { isp[0] = false; isp[1] = false; for (int i = 2; pow(i, 2) <= N; i++) { if (isp[i]) for (int j = 2; i * j <= N; j++) isp[i * j] = false; } } void solve(long long X) { N = X; isp = vector<bool>(N + 1, tr...
#include <bits/stdc++.h> using namespace std; vector<bool> isp; int N; void sieve() { isp[0] = false; isp[1] = false; for (int i = 2; pow(i, 2) <= N; i++) { if (isp[i]) for (int j = 2; i * j <= N; j++) isp[i * j] = false; } } void solve(long long X) { N = X; isp = vector<bool>(N + 100, ...
replace
18
19
18
19
0
p02819
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int main() { int X; cin >> X; for (;;) { for (int i = X - 1; 1 <= i; i--) { if (X % i == 0) { continue; ; } if (i == 1) { cout << X << endl; return 0; ; } } X++; } }
#include <bits/stdc++.h> using namespace std; int main() { int X; cin >> X; for (;;) { for (int i = X - 1; 1 <= i; i--) { if (X % i == 0 && (!(i == 1))) { break; ; } if (i == 1) { cout << X << endl; return 0; ; } } X++; } }
replace
8
10
8
10
TLE
p02819
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; using ll = long long; using vi = vector<int>; using vc = vector<char>; using vb = vector<bool>; using vd = vector<double>; using vs = vector<string>; using vpii = vector<pair<int, int>>; using vvi = vector<vector<int>>; using vvc = vector<vector<char>>; using vvs = vector<v...
#include <bits/stdc++.h> using namespace std; using ll = long long; using vi = vector<int>; using vc = vector<char>; using vb = vector<bool>; using vd = vector<double>; using vs = vector<string>; using vpii = vector<pair<int, int>>; using vvi = vector<vector<int>>; using vvc = vector<vector<char>>; using vvs = vector<v...
replace
57
63
57
59
TLE
p02819
C++
Runtime Error
#include <bits/stdc++.h> #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define sz(x) (int)((x).size()) #define debug(x) cout << #x << ":" << x << ' '; #define debugg(x) cout << #x << ":" << x << ' ' << "\n"; #define endl "\n" #define L(X) ((X) << 1) #define R(X) (((X) << 1) | 1) #define...
#include <bits/stdc++.h> #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define sz(x) (int)((x).size()) #define debug(x) cout << #x << ":" << x << ' '; #define debugg(x) cout << #x << ":" << x << ' ' << "\n"; #define endl "\n" #define L(X) ((X) << 1) #define R(X) (((X) << 1) | 1) #define...
replace
65
66
65
66
0
p02819
C++
Runtime Error
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <queue> #include <set> #include <stdlib.h> #include <unordered_map> #include <vector> using namespace std; typedef long long ll; const int N = 1000000; vector<bool> isp(N, true); void sieve() { isp[0] = false; isp[1] = false; for ...
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <queue> #include <set> #include <stdlib.h> #include <unordered_map> #include <vector> using namespace std; typedef long long ll; const int N = 100003 + 1; vector<bool> isp(N, true); void sieve() { isp[0] = false; isp[1] = false; f...
replace
13
14
13
14
0
p02819
C++
Runtime Error
#include <bits/stdc++.h> #define ll long long #define pii pair<int, int> #define pb push_back #define f first #define s second #define MOD 1000000007 using namespace std; bool prime[200001]; void solve() { ll x; cin >> x; for (int i = 2; i < 200001; i++) { if (!prime[i]) { for (int j = i; i * j <= 2...
#include <bits/stdc++.h> #define ll long long #define pii pair<int, int> #define pb push_back #define f first #define s second #define MOD 1000000007 using namespace std; bool prime[200001]; void solve() { ll x; cin >> x; for (int i = 2; i < 200001; i++) { if (!prime[i] && (ll)i * i <= 200001) { for...
replace
17
18
17
18
-11
p02820
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define _GLIBCXX_DEBUG #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(v) v.begin(), v.end() #define puts(i) cout << i << endl #define INF INT_MAX #define INFL LLONG_MAX typedef long long ll; using namespace std; ll gcd(ll a, ll b) { if (a % b == 0) return b; else ...
#include <bits/stdc++.h> #define _GLIBCXX_DEBUG #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(v) v.begin(), v.end() #define puts(i) cout << i << endl #define INF INT_MAX #define INFL LLONG_MAX typedef long long ll; using namespace std; ll gcd(ll a, ll b) { if (a % b == 0) return b; else ...
replace
43
48
43
46
TLE
p02820
C++
Runtime Error
#include <bitset> #include <iostream> #define REP(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; typedef long long ll; int main() { int N, K, R, S, P; cin >> N >> K >> R >> S >> P; string T; cin >> T; bitset<11000> win; REP(i, N) if (i < K || T[i - K] != T[i] || !win[i - K]) win[i] = true; ...
#include <bitset> #include <iostream> #define REP(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; typedef long long ll; int main() { int N, K, R, S, P; cin >> N >> K >> R >> S >> P; string T; cin >> T; bitset<110000> win; REP(i, N) if (i < K || T[i - K] != T[i] || !win[i - K]) win[i] = true; ...
replace
11
12
11
12
0
p02820
C++
Runtime Error
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; typedef pair<int, int> P; typedef long long ll; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a =...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; typedef pair<int, int> P; typedef long long ll; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a =...
replace
38
41
38
43
0
p02820
C++
Time Limit Exceeded
#include <bits/stdc++.h> // #undef DEBUG // Uncomment this line to forcefully disable debug print. #if DEBUG template <typename T> void debug(T value) { std::cerr << value; } template <typename T, typename... Ts> void debug(T value, Ts... args) { std::cerr << value << ", "; debug(args...); } #define dbg(...) ...
#include <bits/stdc++.h> // #undef DEBUG // Uncomment this line to forcefully disable debug print. #if DEBUG template <typename T> void debug(T value) { std::cerr << value; } template <typename T, typename... Ts> void debug(T value, Ts... args) { std::cerr << value << ", "; debug(args...); } #define dbg(...) ...
replace
63
64
63
64
TLE
p02820
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; using ll = long long; #define itn int #define rep(i, n) for (int i = 0; i < n; i++) #define P pair<int, int> long long dp[100000][4]; int main(void) { string t; int n, k, r, s, p; cin >> n >> k >> r >> s >> p >> t; // r = 0,s = 1,p = 2 for (int i = 0; i < n; i+...
#include <bits/stdc++.h> using namespace std; using ll = long long; #define itn int #define rep(i, n) for (int i = 0; i < n; i++) #define P pair<int, int> long long dp[200000][4]; int main(void) { string t; int n, k, r, s, p; cin >> n >> k >> r >> s >> p >> t; // r = 0,s = 1,p = 2 for (int i = 0; i < n; i+...
replace
7
8
7
8
0
p02820
C++
Runtime Error
#include "bits/stdc++.h" using namespace std; typedef long long ll; char win(char s) { switch (s) { case 'r': return 'p'; case 's': return 'r'; case 'p': return 's'; default: return 'q'; } } int main(void) { int n, k, r, s, p; char t[10000]; cin >> n >> k >> r >> s >> p; for (int i...
#include "bits/stdc++.h" using namespace std; typedef long long ll; char win(char s) { switch (s) { case 'r': return 'p'; case 's': return 'r'; case 'p': return 's'; default: return 'q'; } } int main(void) { int n, k, r, s, p; char t[100000]; cin >> n >> k >> r >> s >> p; for (int ...
replace
19
20
19
20
0
p02820
C++
Runtime Error
#include <iostream> using namespace std; int main() { int n, k; int r, s, p; cin >> n >> k; cin >> r >> s >> p; char T[n + 1]; cin >> T; int i, ans; ans = 0; for (i = 0; i <= n; i++) { if (i - k + 1 > 0 and T[i] == T[i - k]) { if (T[i] == T[i + k] and T[i + k] == 'r') T[i] = 's';...
#include <iostream> using namespace std; int main() { int n, k; int r, s, p; cin >> n >> k; cin >> r >> s >> p; char T[n + 1 + k]; cin >> T; int i, ans; ans = 0; for (i = 0; i <= n; i++) { if (i - k + 1 > 0 and T[i] == T[i - k]) { if (T[i] == T[i + k] and T[i + k] == 'r') T[i] = ...
replace
9
10
9
10
0
p02820
C++
Time Limit Exceeded
#pragma GCC optimize("O3") #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> pll; typedef long double ld; #define mp make_pair #define f first #define s second #define pb push_back const int N = 1e5 + 5; const int M = 1e6 + 5; const int Q = 2e5 + 5; const int OO = 1e9; const int...
#pragma GCC optimize("O3") #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> pll; typedef long double ld; #define mp make_pair #define f first #define s second #define pb push_back const int N = 1e5 + 5; const int M = 1e6 + 5; const int Q = 2e5 + 5; const int OO = 1e9; const int...
insert
27
27
27
30
TLE
p02820
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define REP(i, b, e) for (int i = (b); i < (e); ++i) #define RREP(i, b, e) for (int i = (b)-1; i >= e; --i) #define rep(i, e) for (int i = 0; i < (e); ++i) constexpr int MOD = 1000000007; constexpr int INF = 1LL << 30; constexpr long long LLINF = 1LL << 62; constexpr doubl...
#include <bits/stdc++.h> using namespace std; #define REP(i, b, e) for (int i = (b); i < (e); ++i) #define RREP(i, b, e) for (int i = (b)-1; i >= e; --i) #define rep(i, e) for (int i = 0; i < (e); ++i) constexpr int MOD = 1000000007; constexpr int INF = 1LL << 30; constexpr long long LLINF = 1LL << 62; constexpr doubl...
replace
117
118
117
118
TLE
p02820
C++
Runtime Error
#include <bits/stdc++.h> #define ll long long #define S second #define F first using namespace std; const int N = 3e3 + 15, M = 2e5 + 5; #define arr(t, n, s, e) t _##n[e - s + 1], *n = _##n + (-s); ll n, k, arr[3]; char str[N], alpha[] = "rspx", opp[] = "sprx"; ll dp[N][5]; ll solve(int ind, int prv) { if (ind >...
#include <bits/stdc++.h> #define ll long long #define S second #define F first using namespace std; const int N = 2e5 + 15, M = 2e5 + 5; #define arr(t, n, s, e) t _##n[e - s + 1], *n = _##n + (-s); ll n, k, arr[3]; char str[N], alpha[] = "rspx", opp[] = "sprx"; ll dp[N][5]; ll solve(int ind, int prv) { if (ind >...
replace
7
8
7
8
0
p02820
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std::literals::string_literals; using i64 = std::int_fast64_t; using std::cerr; using std::cin; using std::cout; using std::endl; template <typename T> std::vector<T> make_v(size_t a) { return std::vector<T>(a); } template <typename T, typename... Ts> auto make_v(size_t a, T...
#include <bits/stdc++.h> using namespace std::literals::string_literals; using i64 = std::int_fast64_t; using std::cerr; using std::cin; using std::cout; using std::endl; template <typename T> std::vector<T> make_v(size_t a) { return std::vector<T>(a); } template <typename T, typename... Ts> auto make_v(size_t a, T...
replace
38
40
38
40
TLE
p02820
C++
Runtime Error
#include <bits/stdc++.h> #define ll long long int using namespace std; int main() { int n, k, r, s, p, i; string a; cin >> n >> k >> r >> s >> p; int dp[10000][3] = {0}; cin >> a; ll ans = 0; for (i = 0; i < k; i++) { if (a[i] == 'r') { ans += p; dp[i][2] = 1; } else if (a[i] == 's') {...
#include <bits/stdc++.h> #define ll long long int using namespace std; int main() { int n, k, r, s, p, i; string a; cin >> n >> k >> r >> s >> p; int dp[100005][3] = {0}; cin >> a; ll ans = 0; for (i = 0; i < k; i++) { if (a[i] == 'r') { ans += p; dp[i][2] = 1; } else if (a[i] == 's') ...
replace
7
8
7
8
0
p02820
C++
Runtime Error
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; using ll = long long; const int INF = 1e9 + 1; int main() { int N, K, R, S, P; cin >> N >> K >> R >> S >> P; string T; cin >> T; vector<bool> flag(N); ll ans = 0; rep(i, T.size()) { if (T[i] != T[i - K]) ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; using ll = long long; const int INF = 1e9 + 1; int main() { int N, K, R, S, P; cin >> N >> K >> R >> S >> P; string T; cin >> T; vector<bool> flag(N); ll ans = 0; rep(i, T.size()) { if (i - K < 0 || T[i] ...
replace
19
20
19
20
0
p02820
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; ++i) typedef long long int ll; typedef pair<int, int> P; const int INF = 1e9 + 7; int main() { int N, K, R, S, P; string T; cin >> N >> K >> R >> S >> P >> T; vector<char> re; ll cnt = 0; rep(i, N) { char c; c = ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; ++i) typedef long long int ll; typedef pair<int, int> P; const int INF = 1e9 + 7; int main() { int N, K, R, S, P; string T; cin >> N >> K >> R >> S >> P >> T; vector<char> re; ll cnt = 0; rep(i, N) { char c; c = ...
replace
27
28
27
28
0
p02820
C++
Runtime Error
#include <algorithm> #include <bitset> #include <cmath> #include <deque> #include <functional> #include <iostream> #include <iterator> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; typedef long long ll; #define a first #define...
#include <algorithm> #include <bitset> #include <cmath> #include <deque> #include <functional> #include <iostream> #include <iterator> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; typedef long long ll; #define a first #define...
replace
86
88
86
87
-6
Fatal glibc error: malloc assertion failure in sysmalloc: (old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)
p02820
C++
Runtime Error
#include <bits/stdc++.h> #define repr(i, from, to) for (int(i) = (from); (i) < (to); (i)++) #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) // const bool debug=true; const bool debug = false; #define DEBUG if (debug == true) #define vprint(x) \ for (au...
#include <bits/stdc++.h> #define repr(i, from, to) for (int(i) = (from); (i) < (to); (i)++) #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) // const bool debug=true; const bool debug = false; #define DEBUG if (debug == true) #define vprint(x) \ for (au...
replace
40
41
40
41
0
p02820
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define int long long #define double long double #define rep(i, n) for (int i = 0; i < n; i++) #define mod 1000000007 // 10^9+7 #define INF 1000000000000 // 10^12 #define P pair<int, int> int n, k; int r, s, p; string t; char c[20000]; int ans = 0; signed main() { cin ...
#include <bits/stdc++.h> using namespace std; #define int long long #define double long double #define rep(i, n) for (int i = 0; i < n; i++) #define mod 1000000007 // 10^9+7 #define INF 1000000000000 // 10^12 #define P pair<int, int> int n, k; int r, s, p; string t; char c[200000]; int ans = 0; signed main() { cin...
replace
11
12
11
12
0
p02820
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int n, k, r, s, p; string t; long long res = 0; long long dp[3][100001]; long long cal(string tmp) { memset(dp, 0, sizeof dp); for (int i = 1; i <= tmp.size(); i++) { // tmp[i-1] // 0,1,2-> R,S,P dp[0][i] = max(dp[1][i - 1], dp[2][i - 1]) + (tmp[i - 1] == '...
#include <bits/stdc++.h> using namespace std; int n, k, r, s, p; string t; long long res = 0; long long dp[3][100001]; long long cal(string tmp) { // memset(dp,0,sizeof dp); dp[0][0] = 0; dp[1][0] = 0; dp[2][0] = 0; for (int i = 1; i <= tmp.size(); i++) { // tmp[i-1] // 0,1,2-> R,S,P dp[0][i] = m...
replace
7
8
7
11
TLE
p02820
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int main() { int dp[3][100010]; int n, k, r, s, p; cin >> n >> k >> r >> s >> p; string t; cin >> t; int ans = 0; for (int i = 0; i < k; ++i) { memset(dp, 0, sizeof(dp)); int pos = 0; for (int j = 0; j * k + i < t.length(); ++j) { if (t[j * k...
#include <bits/stdc++.h> using namespace std; int main() { int dp[3][100010]; int n, k, r, s, p; cin >> n >> k >> r >> s >> p; string t; cin >> t; int ans = 0; for (int i = 0; i < k; ++i) { int pos = 0; for (int j = 0; j * k + i < t.length(); ++j) { if (t[j * k + i] == 'r') { dp[0][j...
delete
10
11
10
10
TLE
p02820
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) typedef long long ll; #define INF 1e9 int main() { int n, k, r, s, p; cin >> n >> k >> r >> s >> p; string t; cin >> t; vector<string> a(k); rep(i, k) { for (int j = i; j < n; j += k) { if (t[j] == ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) typedef long long ll; #define INF 1e9 int main() { int n, k, r, s, p; cin >> n >> k >> r >> s >> p; string t; cin >> t; vector<string> a(k); rep(i, k) { for (int j = i; j < n; j += k) { if (t[j] == ...
replace
29
30
29
30
0
p02820
C++
Runtime Error
#include <bits/stdc++.h> #define rep(i, n) for (int(i) = 0; (i) < (n); ++(i)) using namespace std; int main() { int n, k, r, s, p; string t; vector<string> g(2 * k); cin >> n >> k >> r >> s >> p >> t; rep(i, n) g[i % k] += t[i]; int ans = 0; rep(i, k) { int m = g[i].size(); vector<vector<int>> dp...
#include <bits/stdc++.h> #define rep(i, n) for (int(i) = 0; (i) < (n); ++(i)) using namespace std; int main() { int n, k, r, s, p; string t; vector<string> g(100000); cin >> n >> k >> r >> s >> p >> t; rep(i, n) g[i % k] += t[i]; int ans = 0; rep(i, k) { int m = g[i].size(); vector<vector<int>> d...
replace
7
8
7
8
-11
p02820
C++
Runtime Error
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) #define ALL(obj) obj.begin(), obj.end() template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } ret...
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) #define ALL(obj) obj.begin(), obj.end() template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } ret...
replace
26
27
26
27
0
p02820
C++
Runtime Error
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; typedef long long ll; int main() { int n, k; map<char, int> mp; string t; cin >> n >> k >> mp['s'] >> mp['p'] >> mp['r'] >> t; vector<bool> win(n); int ans = 0; rep(i, n) { if (n >= k && t[i] == t[i - k] && ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; typedef long long ll; int main() { int n, k; map<char, int> mp; string t; cin >> n >> k >> mp['s'] >> mp['p'] >> mp['r'] >> t; vector<bool> win(n); int ans = 0; rep(i, n) { if (i >= k && t[i] == t[i - k] && ...
replace
13
14
13
14
0
p02820
C++
Runtime Error
// Hovalhagh // Ya Aziz & Hakim // AliReza Kaboli #include <bits/stdc++.h> using namespace std; int main() { int n, k, r, s, p, ans = 0; string t, sa; cin >> n >> k >> r >> s >> p >> t; for (int i = 0; i < n; ++i) { if (t[i] == 'r') { ans += p; sa += 'p'; } else if (t[i] == 's') { a...
// Hovalhagh // Ya Aziz & Hakim // AliReza Kaboli #include <bits/stdc++.h> using namespace std; int main() { int n, k, r, s, p, ans = 0; string t, sa; cin >> n >> k >> r >> s >> p >> t; for (int i = 0; i < n; ++i) { if (t[i] == 'r') { ans += p; sa += 'p'; } else if (t[i] == 's') { a...
replace
32
38
32
40
0
p02820
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; // long long using ll = long long; // pair<int, int> using PII = pair<int, int>; // 最大値、mod const int MOD = 1000000007; const int mod = 1000000007; const int INF = 1000000000; const long long LINF = 1e18; const int MAX = 510000; // 出力系 #define print(x) cout << x << endl...
#include <bits/stdc++.h> using namespace std; // long long using ll = long long; // pair<int, int> using PII = pair<int, int>; // 最大値、mod const int MOD = 1000000007; const int mod = 1000000007; const int INF = 1000000000; const long long LINF = 1e18; const int MAX = 510000; // 出力系 #define print(x) cout << x << endl...
replace
265
271
265
273
0
p02820
C++
Runtime Error
#include <algorithm> #include <iostream> using namespace std; const int N = 100010; bool st[N]; int main() { int n, k, r, s, p; cin >> n >> k >> r >> s >> p; char t[N]; cin >> t; int sum = 0; for (int i = 0; i < n; i++) { if (st[i] == false) { if (t[i] == t[i + k]) { st[i + k] = true; ...
#include <algorithm> #include <iostream> using namespace std; const int N = 100010; bool st[N]; int main() { int n, k, r, s, p; cin >> n >> k >> r >> s >> p; char t[N]; cin >> t; int sum = 0; for (int i = 0; i < n; i++) { if (st[i] == false) { if (i + k < n && t[i] == t[i + k]) { st[i + k...
replace
14
15
14
15
0
p02820
C++
Runtime Error
#include <algorithm> #include <cmath> #include <cstdio> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <utility> #include <vector> using namespace std; typedef long long ll; typedef vector<ll> vl; typedef vector<vector<ll>> vvl; typedef vector<vector<...
#include <algorithm> #include <cmath> #include <cstdio> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <utility> #include <vector> using namespace std; typedef long long ll; typedef vector<ll> vl; typedef vector<vector<ll>> vvl; typedef vector<vector<...
replace
47
48
47
48
0
p02820
C++
Runtime Error
#include <algorithm> #include <iostream> #include <queue> #include <vector> using namespace std; long long int gcd(long long int a, long long int b) { if (a % b == 0) { return b; } else { return gcd(b, a % b); } } int main() { long long int n, k, r, s, p, ans = 0; cin >> n >> k >> r >> s >> p; str...
#include <algorithm> #include <iostream> #include <queue> #include <vector> using namespace std; long long int gcd(long long int a, long long int b) { if (a % b == 0) { return b; } else { return gcd(b, a % b); } } int main() { long long int n, k, r, s, p, ans = 0; cin >> n >> k >> r >> s >> p; str...
replace
28
29
28
29
0
p02820
C++
Runtime Error
#include <algorithm> #include <bits/stdc++.h> #include <iostream> using namespace std; /*---------------------DEBUGGING--------------------------------------------*/ void __print(int x) { cerr << x; } void __print(long x) { cerr << x; } void __print(long long x) { cerr << x; } void __print(unsigned x) { cerr << x; } vo...
#include <algorithm> #include <bits/stdc++.h> #include <iostream> using namespace std; /*---------------------DEBUGGING--------------------------------------------*/ void __print(int x) { cerr << x; } void __print(long x) { cerr << x; } void __print(long long x) { cerr << x; } void __print(unsigned x) { cerr << x; } vo...
replace
137
140
137
142
0
p02820
C++
Runtime Error
#include <algorithm> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <queue> #include <stack> #include <string> #include <vector> #define log(x) cout << x << endl #define pb push_back #define rep(i, n) for (int i = 0; i < (int)(...
#include <algorithm> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <queue> #include <stack> #include <string> #include <vector> #define log(x) cout << x << endl #define pb push_back #define rep(i, n) for (int i = 0; i < (int)(...
replace
65
67
65
69
0
p02820
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) typedef long long int64; template <class T> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, const T &b) { if (b < a) { a = b; ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) typedef long long int64; template <class T> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, const T &b) { if (b < a) { a = b; ...
replace
26
27
26
27
0
p02820
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define rep(i, n) for (int i = (0); i < (n); i++) using namespace std; typedef long long ll; int main() { cin.tie(0); ios::sync_with_stdio(false); ll n, k; cin >> n >> k; // r, s, p ll score[3]; cin >> score[0] >> score[1] >> score[2]; string s; cin >> s; string spr =...
#include <bits/stdc++.h> #define rep(i, n) for (int i = (0); i < (n); i++) using namespace std; typedef long long ll; int main() { cin.tie(0); ios::sync_with_stdio(false); ll n, k; cin >> n >> k; // r, s, p ll score[3]; cin >> score[0] >> score[1] >> score[2]; string s; cin >> s; string spr =...
replace
25
27
25
27
TLE
p02820
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; string a; int cnt; int ans; int n, k, r, s, p; int main() { cin >> n >> k; cin >> r >> s >> p; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < n; i++) { if (a[i] == 'r') { cnt = p; } else if (a[i] == 's') { cnt = r; } e...
#include <bits/stdc++.h> using namespace std; string a; int cnt; int ans; int n, k, r, s, p; int main() { cin >> n >> k; cin >> r >> s >> p; cin >> a; for (int i = 0; i < n; i++) { if (a[i] == 'r') { cnt = p; } else if (a[i] == 's') { cnt = r; } else if (a[i] == 'p') { cnt = s; ...
replace
9
12
9
10
0
p02820
C++
Runtime Error
#include <bits/stdc++.h> typedef long long ll; ll gi() { ll x = 0, f = 1; char ch = getchar(); while (!isdigit(ch)) f ^= ch == '-', ch = getchar(); while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar(); return f ? x : -x; } bool isprime(int x) { for (int i = 2; i * i <= x; ++i) if (x % i == ...
#include <bits/stdc++.h> typedef long long ll; ll gi() { ll x = 0, f = 1; char ch = getchar(); while (!isdigit(ch)) f ^= ch == '-', ch = getchar(); while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar(); return f ? x : -x; } bool isprime(int x) { for (int i = 2; i * i <= x; ++i) if (x % i == ...
replace
27
28
27
28
0
p02820
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int val(char ch, int r, int s, int p) { if (ch == 'r') return r; if (ch == 'p') return p; if (ch == 's') return s; } int main() { int n, k, r, s, p, ans = 0; string t; cin >> n >> k >> r >> s >> p >> t; for (int i = 0; i < n; i++) { if (t[i] =...
#include <bits/stdc++.h> using namespace std; int val(char ch, int r, int s, int p) { if (ch == 'r') return r; if (ch == 'p') return p; if (ch == 's') return s; } int main() { int n, k, r, s, p, ans = 0; string t; cin >> n >> k >> r >> s >> p >> t; for (int i = 0; i < n; i++) { if (t[i] =...
replace
25
26
25
26
0
p02820
C++
Runtime Error
#include <algorithm> #include <bitset> #include <climits> #include <cmath> #include <cstdlib> #include <cstring> #include <iomanip> #include <iostream> #include <list> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string> #include <util...
#include <algorithm> #include <bitset> #include <climits> #include <cmath> #include <cstdlib> #include <cstring> #include <iomanip> #include <iostream> #include <list> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string> #include <util...
replace
157
158
157
158
0
p02820
C++
Runtime Error
#include <bits/stdc++.h> // created [2019/12/29] 20:04:22 #pragma GCC diagnostic ignored "-Wsign-compare" #pragma GCC diagnostic ignored "-Wsign-conversion" using i32 = int32_t; using i64 = int64_t; using u32 = uint32_t; using u64 = uint64_t; using uint = unsigned int; using usize = std::size_t; using ll = long long; ...
#include <bits/stdc++.h> // created [2019/12/29] 20:04:22 #pragma GCC diagnostic ignored "-Wsign-compare" #pragma GCC diagnostic ignored "-Wsign-conversion" using i32 = int32_t; using i64 = int64_t; using u32 = uint32_t; using u64 = uint64_t; using uint = unsigned int; using usize = std::size_t; using ll = long long; ...
replace
173
174
173
174
0
p02820
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) typedef long long ll; typedef pair<ll, ll> P; const int MOD = 1000000007; const int MAX = 5100000; ll gcd(ll a, ll b) { return (b == 0) ? a : gcd(b, a % b); } long long fac[MAX], finv[MAX], inv[MAX]; // テーブルを作る前処理 void COMin...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) typedef long long ll; typedef pair<ll, ll> P; const int MOD = 1000000007; const int MAX = 5100000; ll gcd(ll a, ll b) { return (b == 0) ? a : gcd(b, a % b); } long long fac[MAX], finv[MAX], inv[MAX]; // テーブルを作る前処理 void COMin...
replace
67
69
67
71
-11
p02820
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll INF = 100000000000000005; const int maxn = 1e6 + 5; const int mod = 433494437; ll n, m; char str[maxn]; char cop[maxn]; map<char, ll> mp; int main() { ll r, s, p; // rock s paper scanf("%lld%lld", &n, &m); scanf("%lld%lld%lld%s", &r, &s,...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll INF = 100000000000000005; const int maxn = 1e6 + 5; const int mod = 433494437; ll n, m; char str[maxn]; char cop[maxn]; map<char, ll> mp; int main() { ll r, s, p; // rock s paper scanf("%lld%lld", &n, &m); scanf("%lld%lld%lld%s", &r, &s,...
replace
27
28
27
29
0
p02820
C++
Runtime Error
#include <algorithm> #include <bits/stdc++.h> #include <string> #include <vector> using namespace std; vector<string> split(const string &s, char delim) { vector<string> elems; string item; for (char ch : s) { if (ch == delim) { if (!item.empty()) { elems.push_back(item); } item.cl...
#include <algorithm> #include <bits/stdc++.h> #include <string> #include <vector> using namespace std; vector<string> split(const string &s, char delim) { vector<string> elems; string item; for (char ch : s) { if (ch == delim) { if (!item.empty()) { elems.push_back(item); } item.cl...
replace
178
179
178
179
0
p02820
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define REP(i, init, n) for (int i = (int)(init); i < (int)(n); i++) int Point(char T, int R, int S, int P) { switch (T) { case 'r': return P; case 's': return R; case 'p': return S; } } int main() { int N, K, R, S, P, sum; string T; cin >> N >...
#include <bits/stdc++.h> using namespace std; #define REP(i, init, n) for (int i = (int)(init); i < (int)(n); i++) int Point(char T, int R, int S, int P) { switch (T) { case 'r': return P; case 's': return R; case 'p': return S; } } int main() { int N, K, R, S, P, sum; string T; cin >> N >...
replace
21
22
21
23
0
p02820
C++
Time Limit Exceeded
// atcoder/abc149/D/main.cpp // author: @___Johniel // github: https://github.com/johniel/ #include <bits/stdc++.h> #define each(i, c) for (auto &i : c) #define unless(cond) if (!(cond)) using namespace std; typedef long long int lli; typedef unsigned long long ull; typedef complex<double> point; template <typenam...
// atcoder/abc149/D/main.cpp // author: @___Johniel // github: https://github.com/johniel/ #include <bits/stdc++.h> #define each(i, c) for (auto &i : c) #define unless(cond) if (!(cond)) using namespace std; typedef long long int lli; typedef unsigned long long ull; typedef complex<double> point; template <typenam...
replace
121
122
121
128
TLE
p02820
C++
Runtime Error
#include <algorithm> #include <bits/stdc++.h> #include <cmath> #include <cstdlib> #include <iomanip> #include <iostream> #include <limits> #include <math.h> #include <stdio.h> #include <string> #include <vector> using namespace std; const long long INF = 1LL << 60; // 各桁の和を出力 long long Sum(long long n) { long long...
#include <algorithm> #include <bits/stdc++.h> #include <cmath> #include <cstdlib> #include <iomanip> #include <iostream> #include <limits> #include <math.h> #include <stdio.h> #include <string> #include <vector> using namespace std; const long long INF = 1LL << 60; // 各桁の和を出力 long long Sum(long long n) { long long...
replace
125
126
125
126
0
p02820
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int n, k, r, s, p; string t; cin >> n >> k >> r >> s >> p >> t; long long sum = 0; for (int i = 0; i < t.size(); i++) { if (t[i] == 'r') sum += p; else if (t[i] == 's') sum += r; else sum += s; } for (int i = 0; i < ...
#include <bits/stdc++.h> using namespace std; int main() { int n, k, r, s, p; string t; cin >> n >> k >> r >> s >> p >> t; long long sum = 0; for (int i = 0; i < t.size(); i++) { if (t[i] == 'r') sum += p; else if (t[i] == 's') sum += r; else sum += s; } for (int i = 0; i < ...
replace
16
17
16
17
0
p02820
C++
Runtime Error
#include <algorithm> #include <iomanip> #include <iostream> #include <math.h> #include <stdio.h> #include <string> using namespace std; int main(void) { long long N, K, R, S, P, i, i2, count, ans = 0, Rdec = 0, Sdec = 0, Pdec = 0, check[100000]; char T[100000], U; cin >...
#include <algorithm> #include <iomanip> #include <iostream> #include <math.h> #include <stdio.h> #include <string> using namespace std; int main(void) { long long N, K, R, S, P, i, i2, count, ans = 0, Rdec = 0, Sdec = 0, Pdec = 0, check[1000000]; char T[1000000], U; cin...
replace
11
13
11
13
0
p02820
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i) #define all(x) (x).begin(), (x).end() using ll = long long; string char_to_string(char val) { return string(1, val); } int main() { int N, K; cin >> N >> K; int R, S, P; cin >> R >> S >> P; strin...
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i) #define all(x) (x).begin(), (x).end() using ll = long long; string char_to_string(char val) { return string(1, val); } int main() { int N, K; cin >> N >> K; int R, S, P; cin >> R >> S >> P; strin...
replace
31
34
31
37
0
p02820
C++
Runtime Error
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; typedef long long ll; typedef pair<int, int> P; typedef pair<int, P> P1; typedef pair<P, P> P2; #define pu push #define pb push_back #define ...
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; typedef long long ll; typedef pair<int, int> P; typedef pair<int, P> P1; typedef pair<P, P> P2; #define pu push #define pb push_back #define ...
replace
45
46
45
46
0
p02820
C++
Time Limit Exceeded
#include <algorithm> #include <cmath> #include <cstdlib> #include <cstring> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; #define REP(i, n) for (ll i = 0; i < n; i++)...
#include <algorithm> #include <cmath> #include <cstdlib> #include <cstring> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; #define REP(i, n) for (ll i = 0; i < n; i++)...
replace
45
46
45
46
TLE
p02820
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; using ll = int64_t; ll N, K, R, S, P; string T; array<vector<ll>, 3> memo = {vector<ll>(100000, -1), vector<ll>(100000, -1), vector<ll>(100000, -1)}; array<char, 256> c2i; ll dfs(char hand, int index, int a) { if (index * K >= N) { retu...
#include <bits/stdc++.h> using namespace std; using ll = int64_t; ll N, K, R, S, P; string T; array<vector<ll>, 3> memo = {vector<ll>(100000, -1), vector<ll>(100000, -1), vector<ll>(100000, -1)}; array<char, 256> c2i; ll dfs(char hand, int index, int a) { if (index * K + a >= N) { ...
replace
12
13
12
13
0
p02820
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; using ll = long long; const int MAX_N = 100005; // ll dp[MAX_N][3]={0}; ll subans[MAX_N]; int main(void) { int N, K; cin >> N >> K; int R, S, P; cin >> R >> S >> P; vector<string> machine(K, ""); for (int i = 0, j = 0; i < N; i++, j++) { char c; cin >...
#include <bits/stdc++.h> using namespace std; using ll = long long; const int MAX_N = 100005; // ll dp[MAX_N][3]={0}; ll subans[MAX_N]; int main(void) { int N, K; cin >> N >> K; int R, S, P; cin >> R >> S >> P; vector<string> machine(K, ""); for (int i = 0, j = 0; i < N; i++, j++) { char c; cin >...
replace
24
25
24
25
-11
p02820
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define INF 1LL << 62 #define inf 1000000007 ll cnt[100010]; int main() { ll n, k; cin >> n >> k; ll r, s, p; cin >> r >> s >> p; string t; cin >> t; for (ll i = 0; i < n; i++) { char now = t[i]; if (cnt[i - k] != 0 && i - k >= 0...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define INF 1LL << 62 #define inf 1000000007 ll cnt[100010]; int main() { ll n, k; cin >> n >> k; ll r, s, p; cin >> r >> s >> p; string t; cin >> t; for (ll i = 0; i < n; i++) { char now = t[i]; if (i - k >= 0) { if (cnt[i...
replace
16
18
16
18
0
p02820
C++
Runtime Error
#ifndef LOCAL #pragma GCC optimize("O3") #endif #include "bits/stdc++.h" #include <ext/pb_ds/assoc_container.hpp> // Common file #include <ext/pb_ds/detail/standard_policies.hpp> #include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update using namespace std; using namespace __gnu_pbds; #define ...
#ifndef LOCAL #pragma GCC optimize("O3") #endif #include "bits/stdc++.h" #include <ext/pb_ds/assoc_container.hpp> // Common file #include <ext/pb_ds/detail/standard_policies.hpp> #include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update using namespace std; using namespace __gnu_pbds; #define ...
replace
91
92
91
92
0
p02820
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define repi(i, a, b) for (int i = int(a); i < int(b); ++i) typedef long long ll; long long MOD = 1e9 + 7; const long long INF = 1LL << 60; using namespace std; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define repi(i, a, b) for (int i = int(a); i < int(b); ++i) typedef long long ll; long long MOD = 1e9 + 7; const long long INF = 1LL << 60; using namespace std; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; ...
replace
44
45
44
48
TLE
p02820
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; using P = pair<ll, ll>; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define rep1(i, n) for (ll i = 1; i <= (ll)(n); i++) #define rep2(i, m, n) for (ll i = m; i < (ll)(n); i++) #define rrep(i, n, m) for (ll i = n...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; using P = pair<ll, ll>; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define rep1(i, n) for (ll i = 1; i <= (ll)(n); i++) #define rep2(i, m, n) for (ll i = m; i < (ll)(n); i++) #define rrep(i, n, m) for (ll i = n...
replace
28
29
28
29
0
p02820
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; const int MAXN = 501; const int MAXM = 3; int n, k, r, s, p; int dp[MAXM][MAXN], cost[MAXM]; char arr[MAXN]; int getCost(int a, int b) { if ((a + 1) % MAXM == b) return cost[a]; else return 0; } int getNum(char c) { if (c == 'r') return 0; else if (c...
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e5 + 1; const int MAXM = 3; int n, k, r, s, p; int dp[MAXM][MAXN], cost[MAXM]; char arr[MAXN]; int getCost(int a, int b) { if ((a + 1) % MAXM == b) return cost[a]; else return 0; } int getNum(char c) { if (c == 'r') return 0; else i...
replace
4
5
4
5
0
p02820
C++
Runtime Error
// Give me My Shotgun #include <bits/stdc++.h> using namespace std; #define all(x) x.begin(), x.end() #define PB push_back #define F first #define S second #define _sz(x) (int)x.size() #define debug(x) cerr << #x << " = " << x << endl typedef long long ll; typedef pair<int, int> pii; const int MAX_N = -1; const i...
// Give me My Shotgun #include <bits/stdc++.h> using namespace std; #define all(x) x.begin(), x.end() #define PB push_back #define F first #define S second #define _sz(x) (int)x.size() #define debug(x) cerr << #x << " = " << x << endl typedef long long ll; typedef pair<int, int> pii; const int MAX_N = -1; const i...
insert
29
29
29
32
0