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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
p02755 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) { return b != 0 ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
int main() {
ll a, b, ans = 10001;
cin >> a >> b;
... | #include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) { return b != 0 ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
int main() {
ll a, b, ans = 10001;
cin >> a >> b;
... | replace | 11 | 12 | 11 | 12 | TLE | |
p02755 | C++ | Time Limit Exceeded | // SmartCoder
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace __gnu_pbds;
using namespace std;
#define sz(a) int((a).size())
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(), (c).... | // SmartCoder
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace __gnu_pbds;
using namespace std;
#define sz(a) int((a).size())
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(), (c).... | replace | 49 | 50 | 49 | 50 | TLE | |
p02755 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
#include <iostream>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
int ans = min(int(a / 0.08), int(b / 0.1));
while (int(ans * 0.08) != a || int(ans * 0.1) != b) {
ans++;
}
cout << ans << endl;
return 0;
} | #include <bits/stdc++.h>
#include <iostream>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
int ans = min(int(a / 0.08), int(b / 0.1));
while (true) {
if (int(ans * 0.08) == a && int(ans * 0.1) == b) {
break;
}
if (int(ans * 0.08) > a || int(ans * 0.1) > b) {
ans = -1;
... | replace | 8 | 9 | 8 | 16 | TLE | |
p02755 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
using namespace std;
int main() {
int a, b;
cin >> a >> b;
bool flag = true;
int x = 1, x_a, x_b, ans;
while (flag) {
x_a = x * 0.08;
x_b = x * 0.10;
if (x_a == a && x_b == b) {
flag = false;
ans = x;
}
x++... | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
using namespace std;
int main() {
int a, b;
cin >> a >> b;
bool flag = true;
int x = 1, x_a, x_b, ans;
while (flag) {
x_a = x * 0.08;
x_b = x * 0.10;
if (x_a == a && x_b == b) {
flag = false;
ans = x;
}
if ... | insert | 16 | 16 | 16 | 20 | TLE | |
p02755 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
int main() {
int A, B;
cin >> A >> B;
bool flg = true;
long double X;
int a, b;
for (long i = 0; i < 1000000000; i++) {
X = i;
a = X * 0.08;
b = X * 0.1;
if (a == A && b == B) {
cout << i;
flg = false;
break;
}
}
if (f... | #include <bits/stdc++.h>
using namespace std;
int main() {
int A, B;
cin >> A >> B;
bool flg = true;
long double X;
int a, b;
for (long i = 0; i < 400000000; i++) {
X = i;
a = X * 0.08;
b = X * 0.1;
if (a == A && b == B) {
cout << i;
flg = false;
break;
}
}
if (fl... | replace | 10 | 11 | 10 | 11 | TLE | |
p02755 | C++ | Runtime Error | #include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
using ll = long long;
#define MOD 1000000007
#define FOR(i, m, n) for (ll i = m; i <= ... | #include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
using ll = long long;
#define MOD 1000000007
#define FOR(i, m, n) for (ll i = m; i <= ... | replace | 34 | 35 | 34 | 35 | 0 | |
p02756 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
char res[100000] = {};
int q;
deque<char> d;
string s;
cin >> s >> q;
for (char &c : s) {
d.push_back(c);
}
int rflag = 0;
for (int i = 0; i < q; i++) {
int t, f;
char c;
cin >> t;
if (t == 1) {
rflag ^= 1;
con... | #include <bits/stdc++.h>
using namespace std;
int main() {
char res[300010] = {};
int q;
deque<char> d;
string s;
cin >> s >> q;
for (char &c : s) {
d.push_back(c);
}
int rflag = 0;
for (int i = 0; i < q; i++) {
int t, f;
char c;
cin >> t;
if (t == 1) {
rflag ^= 1;
con... | replace | 4 | 5 | 4 | 5 | 0 | |
p02756 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int maxn = 1e6 + 5;
const ll mod = 1e9 + 7;
char s[maxn];
int main() {
scanf("%s", s + 100000);
int beg = 100000;
int end = strlen(s + beg) + beg;
int flg = 1;
int q;
scanf("%d", &q);
while (q--) {
... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int maxn = 1e6 + 5;
const ll mod = 1e9 + 7;
char s[maxn];
int main() {
scanf("%s", s + 300000);
int beg = 300000;
int end = strlen(s + beg) + beg;
int flg = 1;
int q;
scanf("%d", &q);
while (q--) {
... | replace | 14 | 16 | 14 | 16 | 0 | |
p02756 | C++ | Runtime Error | /*
Author: ankrypt
*/
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int
#define ff first
#define ss second
#define IOS \
ios::sync_with_stdio(0); ... | /*
Author: ankrypt
*/
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int
#define ff first
#define ss second
#define IOS \
ios::sync_with_stdio(0); ... | replace | 29 | 30 | 29 | 30 | 0 | |
p02756 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
string S;
int Q;
cin >> S >> Q;
vector<char> V(300000);
int l = 100000;
int r = l + S.size() - 1;
for (int i = 0; i < S.size(); ++i) {
V.at(l + i) = ... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
string S;
int Q;
cin >> S >> Q;
vector<char> V(700000);
int l = 300000;
int r = l + S.size() - 1;
for (int i = 0; i < S.size(); ++i) {
V.at(l + i) = ... | replace | 13 | 15 | 13 | 15 | 0 | |
p02756 | C++ | Runtime Error |
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char str[10010];
char str1[20010];
char str2[20010];
int main(int argc, char *argv[]) {
int q = 0;
int f = 0;
int t;
int ff;
char c;
int s1 = 0;
int s2 = 0;
int i;
scanf("%s", str);
scanf("%d", &q);
for (i = 0; i < q... |
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char str[100010];
char str1[200010];
char str2[200010];
int main(int argc, char *argv[]) {
int q = 0;
int f = 0;
int t;
int ff;
char c;
int s1 = 0;
int s2 = 0;
int i;
scanf("%s", str);
scanf("%d", &q);
for (i = 0; i ... | replace | 7 | 10 | 7 | 10 | 0 | |
p02756 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
#include <cmath>
#include <map>
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define been(ix) (ix).begin(), (ix).end()
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vl;
const ll INF = 1e18;
#define foreach(ix, a) for(auto& (ix) : (a)
int ma... | #include <bits/stdc++.h>
#include <cmath>
#include <map>
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define been(ix) (ix).begin(), (ix).end()
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vl;
const ll INF = 1e18;
#define foreach(ix, a) for(auto& (ix) : (a)
int ma... | replace | 26 | 34 | 26 | 39 | TLE | |
p02756 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
/*
ll gcds(ll a,ll b){
if(a<b){
swap(a,b);
}
ll r=a%b;
if(r==0){
return b;
}
while(r>0){
r=a%b;
a=b;
b=r;
}
return a;
}
ll lcms(ll a,ll b){
ll mmr=gcds(a,b);
a=a/mmr;
... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
/*
ll gcds(ll a,ll b){
if(a<b){
swap(a,b);
}
ll r=a%b;
if(r==0){
return b;
}
while(r>0){
r=a%b;
a=b;
b=r;
}
return a;
}
ll lcms(ll a,ll b){
ll mmr=gcds(a,b);
a=a/mmr;
... | replace | 50 | 51 | 50 | 51 | TLE | |
p02756 | C++ | Time Limit Exceeded | #include <iostream>
#include <stdio.h>
// #include <bits/stdc++.h>
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cmath>
#include <cstdint>
#include <cstring>
#include <float.h>
#include <iomanip>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#... | #include <iostream>
#include <stdio.h>
// #include <bits/stdc++.h>
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cmath>
#include <cstdint>
#include <cstring>
#include <float.h>
#include <iomanip>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#... | replace | 60 | 61 | 60 | 61 | TLE | |
p02756 | C++ | Time Limit Exceeded | #define rep(i, n) for (ll i = 0; i < n; i++)
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
string s;
int q, t, f;
char c;
cin >> s;
cin >> q;
bool is_rev = false; // 文字列が反転しているか否かを表す
rep(i, q) {
cin >> t;
if (t == 1) {
is_rev = !... | #define rep(i, n) for (ll i = 0; i < n; i++)
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
string s;
int q, t, f;
char c;
cin >> s;
cin >> q;
bool is_rev = false; // 文字列が反転しているか否かを表す
rep(i, q) {
cin >> t;
if (t == 1) {
is_rev = !... | replace | 22 | 23 | 22 | 23 | TLE | |
p02756 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define repr(i, n) for (int(i) = (n); (i) >= 0; (i)--)
const ll MOD = 1e9 + 7;
const int INF = (int)1e9 + 7;
// vector<tuple<long,long>> items; // (value, weight)
// auto item = items[i];
// long v ... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define repr(i, n) for (int(i) = (n); (i) >= 0; (i)--)
const ll MOD = 1e9 + 7;
const int INF = (int)1e9 + 7;
// vector<tuple<long,long>> items; // (value, weight)
// auto item = items[i];
// long v ... | replace | 51 | 52 | 51 | 52 | 0 | |
p02756 | Python | Runtime Error | from collections import deque
s = input().strip()
s = deque([*s])
q = int(input())
queries = [input().strip().split() for _ in range(q)]
is_reversed = False
for query in queries:
t = query[0]
if t == "1":
is_reversed = not is_reversed
else:
f = query[1]
c = query[2]
if f =... | from collections import deque
s = input().strip()
s = deque(list(s))
q = int(input())
queries = [input().strip().split() for _ in range(q)]
is_reversed = False
for query in queries:
t = query[0]
if t == "1":
is_reversed = not is_reversed
else:
f = query[1]
c = query[2]
if ... | replace | 3 | 4 | 3 | 4 | 0 | |
p02756 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define pi 3.14159265359
#define int long long
#define pii pair<int, int>
const int mod = 1e9 + 7;
int dx[] = {-1, 0, 1, 0};
int dy[] = {0, -1, 0, 1};
int32_t main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
#ifndef ONLINE_JUDGE
freopen("input.txt",... | #include <bits/stdc++.h>
using namespace std;
#define pi 3.14159265359
#define int long long
#define pii pair<int, int>
const int mod = 1e9 + 7;
int dx[] = {-1, 0, 1, 0};
int dy[] = {0, -1, 0, 1};
int32_t main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
string s;
cin >> s;
int q;
cin >> ... | delete | 14 | 19 | 14 | 14 | TLE | |
p02756 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
string S, C;
int Q, T, F;
bool rev;
int main() {
cin >> S >> Q;
for (int i = 0; i < Q; i++) {
cin >> T;
if (T == 1)
rev ^= 1;
else {
cin >> F >> C;
if (rev ^ (F == 1)) {
S = C + S;
} else {
S += C;
}
}
}
... | #include <bits/stdc++.h>
using namespace std;
string S, C;
int Q, T, F;
bool rev;
int main() {
cin >> S >> Q;
for (int i = 0; i < Q; i++) {
cin >> T;
if (T == 1)
rev ^= 1;
else {
cin >> F >> C;
if (rev ^ (F == 1)) {
S.insert(0, C);
} else {
S += C;
}
}... | replace | 16 | 17 | 16 | 17 | TLE | |
p02756 | C++ | Runtime Error | /*--------------------------"SABUJ-JANA"------"JADAVPUR UNIVERSITY"--------*/
/*-------------------------------@greenindia-----------------------------------*/
//
// _____ _ _ _
// / ____| | | (_) | |
// | (___ __ _| |__ _ _ _ | | __ _ _ __ __ _
// \___ \ / _... | /*--------------------------"SABUJ-JANA"------"JADAVPUR UNIVERSITY"--------*/
/*-------------------------------@greenindia-----------------------------------*/
//
// _____ _ _ _
// / ____| | | (_) | |
// | (___ __ _| |__ _ _ _ | | __ _ _ __ __ _
// \___ \ / _... | replace | 42 | 46 | 42 | 46 | TLE | |
p02756 | C++ | Runtime Error | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main(void) {
string S, beforeS = "", afterS = "";
int Q, input, count = 0;
bool flag = false;
char inputC;
cin >> S;
cin >> Q;
for (int i = 0; i < Q; i++) {
cin >> input;
if (input == 2) {
... | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main(void) {
string S, beforeS = "", afterS = "";
int Q, input, count = 0;
bool flag = false;
char inputC;
cin >> S;
cin >> Q;
for (int i = 0; i < Q; i++) {
cin >> input;
if (input == 2) {
... | replace | 23 | 24 | 23 | 24 | 0 | |
p02756 | C++ | Runtime Error | //----------------------------templates
#pragma GCC optimize("Ofast")
#ifdef ONLINE_JUDGE
#pragma GCC target("avx512f")
#else
#pragma GCC target("avx2")
#endif
//----------------------------
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define int ll
#define FOR(... | //----------------------------templates
#pragma GCC optimize("Ofast")
#ifdef ONLINE_JUDGE
#pragma GCC target("avx512f")
#else
#pragma GCC target("avx")
#endif
//----------------------------
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define int ll
#define FOR(i... | replace | 5 | 6 | 5 | 6 | 0 | |
p02756 | C++ | Runtime Error | #include <algorithm>
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <string>
using namespace std;
const int N = 3e5 + 10;
const int INF = 1e5;
char c[N];
string s;
int main() {
cin >> s;
int l = INF, r = INF;
for (int i = 0; i < s.size(); i++, r++) {
c[r] = s[i];
}
r--;
int n;
... | #include <algorithm>
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <string>
using namespace std;
const int N = 5e5 + 10;
const int INF = 3e5;
char c[N];
string s;
int main() {
cin >> s;
int l = INF, r = INF;
for (int i = 0; i < s.size(); i++, r++) {
c[r] = s[i];
}
r--;
int n;
... | replace | 7 | 9 | 7 | 9 | 0 | |
p02756 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
list<char> lst;
string s;
int q;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> s >> q;
int n = s.size();
bool re = 0;
for (int i = 0; i < n; i++)
lst.push_back(s[i]);
while (q--) {
int t;
cin >> t;
if (t == 1)... | #include <bits/stdc++.h>
using namespace std;
list<char> lst;
string s;
int q;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> s >> q;
int n = s.size();
bool re = 0;
for (int i = 0; i < n; i++)
lst.push_back(s[i]);
while (q--) {
int t;
cin >> t;
if (t == 1)... | replace | 31 | 39 | 31 | 37 | TLE | |
p02756 | C++ | Runtime Error | #include <bits/stdc++.h>
#include <cstdint>
#include <vector>
#define FOR(i, l, r) for (int i = (l); i < (r); ++i)
#define RFOR(i, l, r) for (int i = (l); i >= (int)(r); i--)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) RFOR(i, n - 1, 0)
#define int long long
using namespace std;
const int MX = 1e6;
const int inf... | #include <bits/stdc++.h>
#include <cstdint>
#include <vector>
#define FOR(i, l, r) for (int i = (l); i < (r); ++i)
#define RFOR(i, l, r) for (int i = (l); i >= (int)(r); i--)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) RFOR(i, n - 1, 0)
#define int long long
using namespace std;
const int MX = 1e6;
const int inf... | replace | 110 | 115 | 110 | 113 | 0 | |
p02756 | C++ | Runtime Error | #include <algorithm>
#include <bitset>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define i64 int64_t
#define ff(ii, nn, mm) for (int ii = nn; ii < mm; ii++)
#define ffrvs(ii, nn, mm) for (int ii = nn; ii >= mm; ii--)
#def... | #include <algorithm>
#include <bitset>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define i64 int64_t
#define ff(ii, nn, mm) for (int ii = nn; ii < mm; ii++)
#define ffrvs(ii, nn, mm) for (int ii = nn; ii >= mm; ii--)
#def... | replace | 33 | 34 | 33 | 36 | -11 | |
p02756 | C++ | Time Limit Exceeded | #include <algorithm>
#include <deque>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
string s;
cin >> s;
deque<char> dq;
for (int i = 0; i < s.size(); ++i) {
dq.push_back(s[i]);
}
int q;
cin >> q;
bool rev = false;
for (int i = 0; i < q; ++i) {
int... | #include <algorithm>
#include <deque>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
string s;
cin >> s;
deque<char> dq;
for (int i = 0; i < s.size(); ++i) {
dq.push_back(s[i]);
}
int q;
cin >> q;
bool rev = false;
for (int i = 0; i < q; ++i) {
int... | delete | 36 | 38 | 36 | 36 | TLE | |
p02756 | 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 Pi = pair<int, int>;
using Pl = pair<ll, ll>;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
string S;
cin >> S;
bool arr = false;
int Q;
cin >> Q;
S.reserve(S.size() + Q + 10)... | #include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
string S;
cin >> S;
bool arr = false;
int Q;
cin >> Q;
S.reserve(S.size() + Q + 10)... | replace | 25 | 26 | 25 | 26 | TLE | |
p02756 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
int main() {
string s;
ll q;
cin >> s >> q;
ll nrev = 0;
ll fro = 50000, bck = 50001;
char ans[100010];
fro -= s.size() / 2;
bck += (s.size() + 1) / 2;
rep... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
int main() {
string s;
ll q;
cin >> s >> q;
ll nrev = 0;
ll fro = 500000, bck = 500001;
char ans[1000010];
fro -= s.size() / 2;
bck += (s.size() + 1) / 2;
... | replace | 10 | 12 | 10 | 12 | 0 | |
p02756 | C++ | Runtime Error | #include <bits/stdc++.h>
#include <deque>
using namespace std;
int n, q;
string s;
deque<char> str;
int main() {
// freopen("main.inp","r",stdin);
// freopen("main.out","w",stdout);
cin >> s;
for (int i = 0; i < s.size(); ++i)
str.push_back(s[i]);
cin >> q;
int dem = 0;
while (q--) {
int t;
ci... | #include <bits/stdc++.h>
#include <deque>
using namespace std;
int n, q;
string s;
deque<char> str;
int main() {
// freopen("main.inp","r",stdin);
// freopen("main.out","w",stdout);
cin >> s;
for (int i = 0; i < s.size(); ++i)
str.push_back(s[i]);
cin >> q;
int dem = 0;
while (q--) {
int t;
ci... | replace | 40 | 41 | 40 | 42 | 0 | |
p02756 | C++ | Runtime Error | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
int main() {
string S;
int Q;
cin >> S >> Q;
bool rev = false;
deque<char> deq;
for (auto e : S)
deq.push_back(e);
rep(i, Q) {
int q = 0;
c... | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
int main() {
string S;
int Q;
cin >> S >> Q;
bool rev = false;
deque<char> deq;
for (auto e : S)
deq.push_back(e);
rep(i, Q) {
int q = 0;
c... | replace | 42 | 44 | 42 | 44 | 0 | |
p02756 | C++ | Time Limit Exceeded | #include <algorithm>
#include <cmath>
#include <cstdarg>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
using namespace std;
#define INF 2e9 + 9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
#define Int int64_t
#define pll pair<Int, Int>
template <cla... | #include <algorithm>
#include <cmath>
#include <cstdarg>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
using namespace std;
#define INF 2e9 + 9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
#define Int int64_t
#define pll pair<Int, Int>
template <cla... | replace | 107 | 108 | 107 | 108 | TLE | |
p02756 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
#ifndef ONLINE_JUDGE
// for getting input from input.txt
freopen("input.txt", "r", stdin);
// for writing output to output.txt
freopen("output.txt", "w", stdout);
#endif
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int i;
string s;
cin >> s;
int n = s.length();
vector<char> characs;
for (i = 0; i < n; i++) {
characs.push_back(s[i]);
}
ll q;
cin >> q;
bool reversed = fals... | delete | 6 | 12 | 6 | 6 | 0 | |
p02756 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(s, i, n) for (int i = (int)s; i < (int)(n); i++)
int main() {
string s;
int Q;
int len_s;
int list_f[100001];
char list_c[100001];
int list_t[100001];
list<char> lst;
cin >> s >> Q;
len_s =... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(s, i, n) for (int i = (int)s; i < (int)(n); i++)
int main() {
string s;
int Q;
int len_s;
int list_f[200001];
char list_c[200001];
int list_t[200001];
list<char> lst;
cin >> s >> Q;
len_s =... | replace | 9 | 12 | 9 | 12 | 0 | |
p02756 | C++ | Runtime Error | #include <bits/stdc++.h>
// definitions
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define rep(i, l, r) for (long long i = (l); i < (long long)(r); i++)
#define repb(i, r, l) for (long long i = (r); i > (long long)(l); i--)
#define pb push_back
#define pf ... | #include <bits/stdc++.h>
// definitions
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define rep(i, l, r) for (long long i = (l); i < (long long)(r); i++)
#define repb(i, r, l) for (long long i = (r); i > (long long)(l); i--)
#define pb push_back
#define pf ... | replace | 152 | 156 | 152 | 156 | 0 | |
p02756 | Python | Runtime Error | from collections import deque
S = list(input())
S = deque(S)
Q = int(input())
c = 0
for _ in range(Q):
q = list(input().split())
if int(q[0]) == 1:
if c == 0:
c = 1
else:
c = 0
else:
if c == 0:
if int(q[1]) == 1:
S.appendleft(q[2])... | from collections import deque
S = list(input())
S = deque(S)
Q = int(input())
c = 0
for _ in range(Q):
q = list(input().split())
if int(q[0]) == 1:
if c == 0:
c = 1
else:
c = 0
else:
if c == 0:
if int(q[1]) == 1:
S.appendleft(q[2])... | replace | 18 | 19 | 18 | 19 | 0 | |
p02756 | Python | Time Limit Exceeded | s = input()
q = int(input())
counter = 0
for i in range(q):
x = input().split()
if str(x[0]) == "1":
counter += 1
else:
if counter % 2 != 0:
s = s[::-1]
counter = 0
if str(x[1]) == "1":
s = str(x[2]) + s
else:
s = s + str(x[... | s = input()
q = int(input())
qs = [input().split() for i in range(q)]
n = False
left = right = ""
for operation in qs:
if operation[0] == "1":
n = not n
if operation[0] == "2":
t, f, c = operation
f = int(f)
if n:
f = 1 if f != 1 else 2
if f == 1:
... | replace | 2 | 23 | 2 | 19 | TLE | |
p02756 | Python | Runtime Error | from collections import deque
S = deque(list(input()))
q = int(input())
r = False
for _ in range(q):
t = input().split()
if len(t) == 1:
r = not r
else:
t[1] = int(t[1]) - 1
if (not t[1] and not r) or (t[1] and r):
S.appendleft(t[2])
else:
S.append(t[... | from collections import deque
S = deque(list(input()))
q = int(input())
r = False
for _ in range(q):
t = input().split()
if len(t) == 1:
r = not r
else:
t[1] = int(t[1]) - 1
if (not t[1] and not r) or (t[1] and r):
S.appendleft(t[2])
else:
S.append(t[... | insert | 16 | 16 | 16 | 17 | 0 | |
p02756 | Python | Runtime Error | import sys
from collections import deque
input = sys.stdin.readline
S = deque(input()[:-1])
reverse_flg = 0
Q = int(input())
qs = [input().split() for _ in range(Q)]
for q in qs:
if q[0] == "1":
reverse_flg = reverse_flg ^ 1
else:
flg = (int(q[1]) + reverse_flg) % 2
if flg == 1:
... | import sys
from collections import deque
input = sys.stdin.readline
S = deque(input()[:-1])
reverse_flg = 0
Q = int(input())
qs = [input().split() for _ in range(Q)]
for q in qs:
if q[0] == "1":
reverse_flg = reverse_flg ^ 1
else:
flg = (int(q[1]) + reverse_flg) % 2
if flg == 1:
... | replace | 20 | 21 | 20 | 21 | 0 | |
p02756 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vii = vector<vi>;
using in6 = int64_t;
using ind = double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
string s;
cin >> s;
int q;
cin >> q;
int size = s.size();
vector<char> data(50 * q * size);
int left = 2... | #include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vii = vector<vi>;
using in6 = int64_t;
using ind = double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
string s;
cin >> s;
int q;
cin >> q;
int size = s.size();
vector<char> data(50 * q + 50 * size);
int lef... | replace | 14 | 16 | 14 | 16 | 0 | |
p02756 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
int main() {
deque<char> str;
int Q, T, F, a, b;
string S;
char C;
cin >> S >> Q;
a = S.size();
rep(i, a) { str.push_back(S.at(i)); }
bool rev = false;
rep(i, Q) {
cin >> T;
if (T == 1)
rev = !re... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
int main() {
deque<char> str;
int Q, T, F, a, b;
string S;
char C;
cin >> S >> Q;
a = S.size();
rep(i, a) { str.push_back(S.at(i)); }
bool rev = false;
rep(i, Q) {
cin >> T;
if (T == 1)
rev = !re... | replace | 20 | 22 | 20 | 21 | TLE | |
p02756 | C++ | Runtime Error | #include <algorithm>
#include <bitset>
#include <cctype>
#include <climits>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#incl... | #include <algorithm>
#include <bitset>
#include <cctype>
#include <climits>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#incl... | replace | 38 | 39 | 38 | 39 | 0 | |
p02756 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 999999999999999999
#define rep(i, m, n) for (lli i = m; i < n; i++)
#define rrep(i, m, n) for (lli i = m - 1; i >= n; i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(), N.end()), N... | #include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 999999999999999999
#define rep(i, m, n) for (lli i = m; i < n; i++)
#define rrep(i, m, n) for (lli i = m - 1; i >= n; i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(), N.end()), N... | replace | 35 | 46 | 35 | 39 | TLE | |
p02756 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
string S;
int Q;
cin >> S;
cin >> Q;
deque<char> S_deque;
for (int i = 0; i < S.size(); i++) {
S_deque.push_back(S[i]);
}
int t, f, t_sum;
char c;
t_sum = 0;
for (int i = 0; i < Q; i++) {
cin >> t;
if (t ... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
string S;
int Q;
cin >> S;
cin >> Q;
deque<char> S_deque;
for (int i = 0; i < S.size(); i++) {
S_deque.push_back(S[i]);
}
int t, f, t_sum;
char c;
t_sum = 0;
for (int i = 0; i < Q; i++) {
cin >> t;
if (t ... | replace | 33 | 34 | 33 | 34 | 0 | |
p02756 | C++ | Runtime Error | #define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <cmath>
#include <functional>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
int main() {
char str[50001];
bool hanten = false;
ve... | #define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <cmath>
#include <functional>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
int main() {
char str[100001];
bool hanten = false;
v... | replace | 12 | 13 | 12 | 13 | 0 | |
p02756 | 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;
using P = pair<int, int>;
int main() {
string S;
int Q;
cin >> S >> Q;
bool sei = true;
vector<char> start(2 * 10 * 5);
vector<char> end(2 * 10 * 5);
int sIndex = 0;
int eIndex = 0;
... | #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() {
string S;
int Q;
cin >> S >> Q;
bool sei = true;
vector<char> start(1000000);
vector<char> end(1000000);
int sIndex = 0;
int eIndex = 0;
rep(i,... | replace | 12 | 14 | 12 | 14 | 0 | |
p02756 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "dump.hpp"
#else
#define dump(...)
#define dumpv(...)
#endif
#define rep(i, n) for (int i = 0; i < (n); i++)
#define mins(x, y) (x = min(x, y))
#define maxs(x, y) (x = max(x, y))
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
us... | #include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "dump.hpp"
#else
#define dump(...)
#define dumpv(...)
#endif
#define rep(i, n) for (int i = 0; i < (n); i++)
#define mins(x, y) (x = min(x, y))
#define maxs(x, y) (x = max(x, y))
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
us... | replace | 23 | 24 | 23 | 24 | 0 | |
p02756 | C++ | Runtime Error | #include <chrono>
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <istream>
#include <map>
#include <ostream>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <... | #include <chrono>
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <istream>
#include <map>
#include <ostream>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <... | insert | 102 | 102 | 102 | 103 | 0 | |
p02756 | C++ | Time Limit Exceeded | // https://atcoder.jp/contests/abc158/tasks/abc158_d
#include <bits/stdc++.h>
#if LOCAL
#include "dump.hpp"
#else
#define dump(...)
#endif
using namespace std;
using ll = long long;
#define FOR(i, a, b) for (ll i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
template <class T> bool chmax(T &a, const T &b) {
if ... | // https://atcoder.jp/contests/abc158/tasks/abc158_d
#include <bits/stdc++.h>
#if LOCAL
#include "dump.hpp"
#else
#define dump(...)
#endif
using namespace std;
using ll = long long;
#define FOR(i, a, b) for (ll i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
template <class T> bool chmax(T &a, const T &b) {
if ... | insert | 26 | 26 | 26 | 97 | TLE | |
p02756 | C++ | Time Limit Exceeded |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
string s;
cin >> s;
// since repeated reversing the string is time consuming, instead we save the
// state of the string 1 or 2
short state = 1;
int q = 0;
... |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
string s;
cin >> s;
// since repeated reversing the string is time consuming, instead we save the
// state of the string 1 or 2
short state = 1;
int q = 0;
... | replace | 26 | 30 | 26 | 37 | TLE | |
p02756 | C++ | Runtime Error | //------------------------------------------------------------------------------MANAS
//UNIYAL--------------------------------------------------------- NEVER GIVE UP
#include <bits/stdc++.h>
using namespace std;
#define fast \
ios_b... | //------------------------------------------------------------------------------MANAS
//UNIYAL--------------------------------------------------------- NEVER GIVE UP
#include <bits/stdc++.h>
using namespace std;
#define fast \
ios_b... | replace | 36 | 39 | 36 | 39 | 0 | |
p02756 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<string>> vvs;
typedef vector<vector<char>> vvc;
typedef vector<vector<bo... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<string>> vvs;
typedef vector<vector<char>> vvc;
typedef vector<vector<bo... | replace | 69 | 70 | 69 | 70 | 0 | |
p02756 | C++ | Runtime Error | #include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <vector>
using namespace std;
#define MAX(x, y) (x > y ? x : y)
#define MIN(x, y) (x < y ? x : y)
#define ABS(x) (x > 0 ? x : -(x))
#define INF 1000000000
#define MOD 1000000007
void swap(i... | #include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <vector>
using namespace std;
#define MAX(x, y) (x > y ? x : y)
#define MIN(x, y) (x < y ? x : y)
#define ABS(x) (x > 0 ? x : -(x))
#define INF 1000000000
#define MOD 1000000007
void swap(i... | replace | 196 | 197 | 196 | 197 | 0 | |
p02756 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
string S, D;
int Q, i;
bool b = true;
cin >> S >> Q;
for (i = 0; i < Q; ++i) {
int que = 0;
cin >> que;
if (que == 1)
if (b)
b = false;
else
b = true;
else {
int F = 0;
char C;
cin >> F >>... | #include <bits/stdc++.h>
using namespace std;
int main() {
string S, D;
int Q, i;
bool b = true;
cin >> S >> Q;
for (i = 0; i < Q; ++i) {
int que = 0;
cin >> que;
if (que == 1)
if (b)
b = false;
else
b = true;
else {
int F = 0;
char C;
cin >> F >>... | replace | 39 | 40 | 39 | 40 | 0 | |
p02756 | 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 sz size()
#define bgn begin()
#define en end()
#defin... | #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 sz size()
#define bgn begin()
#define en end()
#defin... | replace | 503 | 505 | 503 | 504 | TLE | |
p02756 | Python | Runtime Error | from collections import deque
S = deque(input())
Q = int(input())
Queries = [input().split() for _ in range(Q)]
need_reverse = False
for q in Queries:
if q[0] == "1":
need_reverse = not need_reverse
else:
if q[1] == "1":
if not need_reverse:
S.appendleft(q[2])
... | from collections import deque
S = deque(input())
Q = int(input())
Queries = [input().split() for _ in range(Q)]
need_reverse = False
for q in Queries:
if q[0] == "1":
need_reverse = not need_reverse
else:
if q[1] == "1":
if not need_reverse:
S.appendleft(q[2])
... | insert | 23 | 23 | 23 | 24 | 0 | |
p02756 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
void textIO() {
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
}
void fastIO() {
ios_base::sync_with_stdio(0);
cin.tie(0);
}
int main() {
textIO();
fastIO();
string s;
long long q, t, f;
char c;
cin ... | #include <bits/stdc++.h>
using namespace std;
void textIO() {
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
}
void fastIO() {
ios_base::sync_with_stdio(0);
cin.tie(0);
}
int main() {
// textIO();
fastIO();
string s;
long long q, t, f;
char c;
c... | replace | 16 | 17 | 16 | 17 | TLE | |
p02756 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
void textIO() {
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
}
void fastIO() {
ios_base::sync_with_stdio(0);
cin.tie(0);
}
int main() {
textIO();
fastIO();
string s, prefix, suffix;
long long q, t, f;
... | #include <bits/stdc++.h>
using namespace std;
void textIO() {
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
}
void fastIO() {
ios_base::sync_with_stdio(0);
cin.tie(0);
}
int main() {
// textIO();
fastIO();
string s, prefix, suffix;
long long q, t, ... | replace | 16 | 17 | 16 | 17 | TLE | |
p02756 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
unordered_map<int, pair<int, char>> mp;
int a[N], c[N];
char b[3 * N];
int main() {
string s;
string x;
int t, k, f, q, sum = 0;
cin >> s >> q;
for (int i = 1; i <= q; i++) {
scanf("%d", &t);
if (t == 1)
a[i] = 1, sum++;
e... | #include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
unordered_map<int, pair<int, char>> mp;
int a[N], c[N];
char b[3 * N];
int main() {
string s;
string x;
int t, k, f, q, sum = 0;
cin >> s >> q;
for (int i = 1; i <= q; i++) {
scanf("%d", &t);
if (t == 1)
a[i] = 1, sum++;
e... | replace | 23 | 24 | 23 | 24 | 0 | |
p02756 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
#define rep(i, n) for (long long i = 0; i < n; i++)
#define Rep(i, n) for (long long i = 1; i < n; i++)
#define ll long long
#include <cmath>
#include <iomanip>
#include <iostream>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
#defi... | #include <bits/stdc++.h>
#define rep(i, n) for (long long i = 0; i < n; i++)
#define Rep(i, n) for (long long i = 1; i < n; i++)
#define ll long long
#include <cmath>
#include <iomanip>
#include <iostream>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
#defi... | replace | 68 | 69 | 68 | 69 | TLE | |
p02756 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define fastinput \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.ti... | #include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define fastinput \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.ti... | replace | 13 | 15 | 13 | 15 | 0 | |
p02756 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod 1000000007
int main() {
string s;
cin >> s;
int q;
scanf("%d", &q);
bool rev = false;
for (int i = 0; i < q; i++) {
int t;
scanf("%d", &t);
if (t == 1) {
rev = !rev;
} else {
int f;
string c;
... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod 1000000007
int main() {
string s;
cin >> s;
int q;
scanf("%d", &q);
bool rev = false;
for (int i = 0; i < q; i++) {
int t;
scanf("%d", &t);
if (t == 1) {
rev = !rev;
} else {
int f;
string c;
... | replace | 30 | 33 | 30 | 32 | TLE | |
p02756 | C++ | Runtime Error | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <vector>
using namespace std;
#define INF 0x3f3f3f3f
const int maxn = 4e5 + 10;
#define _rep(i, a, b) for (int i = (a); i <= (b); ++i)
char S[maxn], Ci;
int Q, Fi;
int main() {
#ifdef __LOCAL__
freopen("1.in", "r"... | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <vector>
using namespace std;
#define INF 0x3f3f3f3f
const int maxn = 4e5 + 10;
#define _rep(i, a, b) for (int i = (a); i <= (b); ++i)
char S[maxn], Ci;
int Q, Fi;
int main() {
#ifdef __LOCAL__
freopen("1.in", "r"... | replace | 20 | 21 | 20 | 21 | 0 | |
p02756 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
string s;
int q;
cin >> s >> q;
vector<int> t(q), f(q, 0);
vector<string> c(q, "");
for (int i = 0; i < q; i++) {
cin >> t.at(i);
if (t.at(i) == 2) {
cin >> f.at(i) >> c.at(i);
}
}
bool normal = true;
... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
string s;
int q;
cin >> s >> q;
vector<int> t(q), f(q, 0);
vector<string> c(q, "");
for (int i = 0; i < q; i++) {
cin >> t.at(i);
if (t.at(i) == 2) {
cin >> f.at(i) >> c.at(i);
}
}
bool normal = true;
... | replace | 20 | 21 | 20 | 21 | TLE | |
p02756 | 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() {
string s;
cin >> s;
ll q;
cin >> q;
int count = 0;
for (ll i = 0; i < q; i++) {
int t;
cin >> t;
if (t == 1)
count++;
if (t == 2) ... | #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() {
string s;
cin >> s;
ll q;
cin >> q;
int count = 0;
for (ll i = 0; i < q; i++) {
int t;
cin >> t;
if (t == 1)
count++;
if (t == 2) ... | replace | 22 | 26 | 22 | 29 | TLE | |
p02756 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 5;
vector<char> fr, ba;
int main() {
string buff;
cin >> buff;
char tem[2];
int Q;
cin >> Q;
bool rev = 0;
while (Q--) {
int t, f, c;
cin >> t;
if (t == 1) {
rev ^= 1;
continue;
} else {... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 5;
vector<char> fr, ba;
int main() {
string buff;
cin >> buff;
char tem[2];
int Q;
cin >> Q;
bool rev = 0;
while (Q--) {
int t, f, c;
cin >> t;
if (t == 1) {
rev ^= 1;
continue;
} else {... | replace | 33 | 38 | 33 | 39 | 0 | |
p02756 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#include <iostream>
#include <math.h>
#include <set>
#include <stdio.h>
#include <vector>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
int main() {
string s;
cin >> s;
int n;
cin >> n;
bool rev = false... | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#include <iostream>
#include <math.h>
#include <set>
#include <stdio.h>
#include <vector>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
int main() {
string s;
cin >> s;
int n;
cin >> n;
bool rev = false... | replace | 29 | 41 | 29 | 42 | TLE | |
p02756 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
string S;
int Q;
cin >> S >> Q;
int T, F;
string C;
bool rev = false;
rep(i, Q) {
cin >> T;
if (T == 1) {
rev = !rev;
} else {
cin >> F >> C;
if ((F == 1 && !rev... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
string S;
int Q;
cin >> S >> Q;
int T, F;
string C;
bool rev = false;
rep(i, Q) {
cin >> T;
if (T == 1) {
rev = !rev;
} else {
cin >> F >> C;
if ((F == 1 && !rev... | replace | 21 | 23 | 21 | 25 | TLE | |
p02757 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define pi 3.14159265359
#define int long long
#define pii pair<int, int>
const int mod = 1e9 + 7;
int dx[] = {-1, 0, 1, 0};
int dy[] = {0, -1, 0, 1};
int32_t main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
#ifndef ONLINE_JUDGE
freopen("input.txt",... | #include <bits/stdc++.h>
using namespace std;
#define pi 3.14159265359
#define int long long
#define pii pair<int, int>
const int mod = 1e9 + 7;
int dx[] = {-1, 0, 1, 0};
int dy[] = {0, -1, 0, 1};
int32_t main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n, p;
string s;
cin >> n >> p >> ... | delete | 15 | 19 | 15 | 15 | -11 | |
p02757 | C++ | Runtime Error | #include <iostream>
#include <map>
#include <string>
using namespace std;
long long a[100010], ten[100010], sum[100010];
map<long long, int> mp;
int main() {
long long i, n, p, ans = 0;
string s;
cin >> n >> p >> s;
if (p == 2) {
for (i = 0; i < n; i++) {
if ((s[i] - '0') % 2 == 0) {
ans += (i... | #include <iostream>
#include <map>
#include <string>
using namespace std;
long long a[200010], ten[200010], sum[200010];
map<long long, int> mp;
int main() {
long long i, n, p, ans = 0;
string s;
cin >> n >> p >> s;
if (p == 2) {
for (i = 0; i < n; i++) {
if ((s[i] - '0') % 2 == 0) {
ans += (i... | replace | 4 | 5 | 4 | 5 | 0 | |
p02757 | C++ | Runtime Error | #include <bits/stdc++.h>
#define endl "\n"
using namespace std;
#define ll long long
#define ld long double
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repo(i, n) for (int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define fi first
#define se second
... | #include <bits/stdc++.h>
#define endl "\n"
using namespace std;
#define ll long long
#define ld long double
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repo(i, n) for (int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define fi first
#define se second
... | replace | 89 | 90 | 89 | 90 | 0 | |
p02757 | C++ | Runtime Error | //
// Created by misclicked on 3/7/20.
//
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
// #define ONLINE_JUDGE
#ifdef ONLINE_JUDGE
#define cerr \
if (false) ... | //
// Created by misclicked on 3/7/20.
//
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define ONLINE_JUDGE
#ifdef ONLINE_JUDGE
#define cerr \
if (false) ... | replace | 10 | 11 | 10 | 11 | -11 | |
p02757 | C++ | Time Limit Exceeded | #ifdef DEBUG_IS_VALID
#define DEB 1
#define _LIBCPP_DEBUG 0
#else
#define DEB 0
#define NDEBUG
#endif
#include <bits/stdc++.h>
using namespace std;
#define ALL(g) (g).begin(), (g).end()
#define REP(i, x, n) for (long long i = x; i < n; i++)
#define rep(i, n) REP(i, 0, n)
#define RREP(i, x, n) for (long long i = x; i ... | #ifdef DEBUG_IS_VALID
#define DEB 1
#define _LIBCPP_DEBUG 0
#else
#define DEB 0
#define NDEBUG
#endif
#include <bits/stdc++.h>
using namespace std;
#define ALL(g) (g).begin(), (g).end()
#define REP(i, x, n) for (long long i = x; i < n; i++)
#define rep(i, n) REP(i, 0, n)
#define RREP(i, x, n) for (long long i = x; i ... | replace | 173 | 174 | 173 | 174 | TLE | |
p02757 | 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;
// この方法で関数を出せば多分できる
// https://nlab.itmedia.co.jp/nl/articles/1805/04/news002.html
const int MAX = 100 / 0.08;
int main() {
int n, p;
cin >> n >> p;
string s;
cin >> s;
if (10 % p == 0) { // pが... | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
// この方法で関数を出せば多分できる
// https://nlab.itmedia.co.jp/nl/articles/1805/04/news002.html
const int MAX = 100 / 0.08;
int main() {
int n, p;
cin >> n >> p;
string s;
cin >> s;
if (10 % p == 0) { // pが... | replace | 34 | 35 | 34 | 35 | 0 | |
p02757 | C++ | Runtime Error | #include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using names... | #include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using names... | replace | 43 | 45 | 43 | 45 | 0 | |
p02757 | C++ | Time Limit Exceeded | /*
* Heart beats fast
* Colors and promises
* How to be brave
* How can I love when I am afraid to fall...
*/
#include <bits/stdc++.h>
// #include<boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
using namespace std;
#define int long long
#define mod 1000000007
#define FAST ios... | /*
* Heart beats fast
* Colors and promises
* How to be brave
* How can I love when I am afraid to fall...
*/
#include <bits/stdc++.h>
// #include<boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
using namespace std;
#define int long long
#define mod 1000000007
#define FAST ios... | replace | 34 | 47 | 34 | 44 | TLE | |
p02757 | C++ | Runtime Error | // #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 = 1560 + 5;
const ll OO = 2e18;
const int mod = 1e9 + 7;
i... | // #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 = 2e5 + 5;
const int M = 1560 + 5;
const ll OO = 2e18;
const int mod = 1e9 + 7;
i... | replace | 12 | 13 | 12 | 13 | 0 | |
p02757 | C++ | Runtime Error | // #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
#define ll long long
#define ld long double
#define P pair<ll, ll>
#define FOR(i, n, m) for (ll i = n; i < (ll)m; i++)
#define FORr(i, m, n) for (ll i = n; i >= (ll)m; i--)
#define FORm(i, m) for (auto i = m.begin(); i != m.end... | // #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
#define ll long long
#define ld long double
#define P pair<ll, ll>
#define FOR(i, n, m) for (ll i = n; i < (ll)m; i++)
#define FORr(i, m, n) for (ll i = n; i >= (ll)m; i--)
#define FORm(i, m) for (auto i = m.begin(); i != m.end... | replace | 35 | 37 | 35 | 44 | 0 | |
p02757 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i, m, n) for (int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define RREP(i, m, n) for (int i = (int)(m); i >= (int)(n); i--)
#define rrep(i, n) RREP(i, n - 1, 0)
#define REPL(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i, m, n) for (int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define RREP(i, m, n) for (int i = (int)(m); i >= (int)(n); i--)
#define rrep(i, n) RREP(i, n - 1, 0)
#define REPL(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i... | replace | 19 | 20 | 19 | 20 | -11 | |
p02757 | C++ | Runtime Error | #include <algorithm>
#include <climits>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define F first
#define S second
#define pb push_back
#define sz(c) (int... | #include <algorithm>
#include <climits>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define F first
#define S second
#define pb push_back
#define sz(c) (int... | replace | 50 | 51 | 50 | 51 | 0 | |
p02757 | C++ | Runtime Error | #include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#define pb push_back
#define mpr make_pair
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ll long long
#define ld long double
#define all(arr) arr.begin(), arr.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define fo(i,... | #include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#define pb push_back
#define mpr make_pair
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ll long long
#define ld long double
#define all(arr) arr.begin(), arr.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define fo(i,... | replace | 61 | 62 | 61 | 62 | 0 | |
p02757 | C++ | Runtime Error | /**
* author : 𝒌𝒚𝒐𝒎𝒖𝒌𝒚𝒐𝒎𝒖𝒑𝒖𝒓𝒊𝒏
* created : 2020-03-15 09:47:30
**/
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#include <cmath>
#include <complex>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#includ... | /**
* author : 𝒌𝒚𝒐𝒎𝒖𝒌𝒚𝒐𝒎𝒖𝒑𝒖𝒓𝒊𝒏
* created : 2020-03-15 09:47:30
**/
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#include <cmath>
#include <complex>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#includ... | replace | 115 | 118 | 115 | 128 | 0 | |
p02757 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using ll = long long int;
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, p, i, j;
string s;
cin >> n >> p >> s;
if (p < 10) {
while (true)
;
}
vector<int> M(p);
M[0] = 1;
int sum = 0;
int power = 1;
ll ans = 0;
f... | #include <bits/stdc++.h>
using ll = long long int;
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, p, i, j;
string s;
cin >> n >> p >> s;
if (p == 2) {
ll ans = 0;
for (i = 0; i < n; ++i) {
if ((s[i] - '0') % 2 == 0) {
ans += (i + 1);
}... | replace | 13 | 16 | 13 | 33 | TLE | |
p02757 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, P;
cin >> N >> P;
string S;
cin >> S;
// Pが2か5の場合
if (P == 2 || P == 5) {
long long answer = 0;
for (int i = 0; i < N; i++) {
if ((S[i] - '0') % P == 0) {
answer += i + 1;
}
}
cout << answer << endl;
... | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, P;
cin >> N >> P;
string S;
cin >> S;
// Pが2か5の場合
if (P == 2 || P == 5) {
long long answer = 0;
for (int i = 0; i < N; i++) {
if ((S[i] - '0') % P == 0) {
answer += i + 1;
}
}
cout << answer << endl;
... | replace | 35 | 36 | 35 | 36 | -11 | |
p02757 | C++ | Runtime Error | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
struct int_hash {
static uint64_t splitmix64(uint64_t x) {
x += 0x9e3779b97f4a7c15;
x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
x = ... | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
struct int_hash {
static uint64_t splitmix64(uint64_t x) {
x += 0x9e3779b97f4a7c15;
x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
x = ... | replace | 52 | 53 | 52 | 53 | -11 | |
p02757 | C++ | Runtime Error | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
const int maxn = 100000 + 5;
int n, m, p, blo, len, id[maxn], cnt[maxn];
long long tmp, no[maxn], mp[maxn], ans[maxn], sum[maxn], power[maxn];
char s[maxn];
struct M {
int l, r, num;
friend bool op... | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
const int maxn = 200000 + 5;
int n, m, p, blo, len, id[maxn], cnt[maxn];
long long tmp, no[maxn], mp[maxn], ans[maxn], sum[maxn], power[maxn];
char s[maxn];
struct M {
int l, r, num;
friend bool op... | replace | 6 | 7 | 6 | 7 | 0 | |
p02757 | C++ | Runtime Error | #include <algorithm>
#include <cmath>
#include <cstring>
#include <iostream>
#include <queue>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < n; i++)
using ll = long long;
using namespace std;
int main() {
int n, p;
cin >> n >> p;
string s;
cin >> s;
if (10 % p == 0) {
ll ans = ... | #include <algorithm>
#include <cmath>
#include <cstring>
#include <iostream>
#include <queue>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < n; i++)
using ll = long long;
using namespace std;
int main() {
int n, p;
cin >> n >> p;
string s;
cin >> s;
if (10 % p == 0) {
ll ans = ... | insert | 33 | 33 | 33 | 34 | 0 | |
p02757 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(), A.end()
#define RALL(A) A.rbegin(), A.rend()
typedef long long LL;
typedef pair<LL, LL> P;
template <class T> inline bool chmax(T &a, T b) {
if (... | #include <bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(), A.end()
#define RALL(A) A.rbegin(), A.rend()
typedef long long LL;
typedef pair<LL, LL> P;
template <class T> inline bool chmax(T &a, T b) {
if (... | replace | 54 | 55 | 54 | 55 | 0 | |
p02757 | Python | Time Limit Exceeded | N, P = map(int, input().split())
S = [int(_) for _ in list(input())]
if P == 2 or P == 5:
ans = 0
for n in range(N):
if S[n] % P == 0:
ans += n + 1
print(ans)
else:
S = [(S[n] * 10 ** (N - n - 1)) % P for n in range(N)]
S.reverse()
T = [0]
for s in S:
T.append((T[... | N, P = map(int, input().split())
S = [int(_) for _ in list(input())]
if P == 2 or P == 5:
ans = 0
for n in range(N):
if S[n] % P == 0:
ans += n + 1
print(ans)
else:
S = [(S[n] * pow(10, N - n - 1, P)) % P for n in range(N)]
S.reverse()
T = [0]
for s in S:
T.append... | replace | 9 | 10 | 9 | 10 | TLE | |
p02757 | Python | Time Limit Exceeded | from collections import Counter
n, p = map(int, input().split())
s = input()
if p == 2 or p == 5:
ans = 0
for i, e in enumerate(s, 1):
if int(e) % p == 0:
ans += i
print(ans)
else:
li = [0]
for i, e in enumerate(s[::-1], 1):
li.append((li[-1] + int(e) * 10**i) % p)
... | from collections import Counter
n, p = map(int, input().split())
s = input()
if p == 2 or p == 5:
ans = 0
for i, e in enumerate(s, 1):
if int(e) % p == 0:
ans += i
print(ans)
else:
li = [0]
for i, e in enumerate(s[::-1], 1):
li.append((li[-1] + int(e) * pow(10, i, p))... | replace | 16 | 17 | 16 | 17 | TLE | |
p02757 | C++ | Runtime Error | #include <algorithm>
#include <bitset>
#include <climits>
#include <complex>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <istream>
#include <iterator>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <ve... | #include <algorithm>
#include <bitset>
#include <climits>
#include <complex>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <istream>
#include <iterator>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <ve... | replace | 90 | 91 | 90 | 91 | 0 | |
p02757 | Python | Time Limit Exceeded | n, p = map(int, input().split())
s = input()
if p == 2 or p == 5:
ans = 0
for i in range(n):
if int(s[i]) % p == 0:
ans += i + 1
else:
s2 = s[::-1]
rems = [0]
tmp = 0
tmp2 = 1
for i in range(n):
tmp += int(s2[i]) * tmp2
tmp %= p
tmp2 *= 10
... | n, p = map(int, input().split())
s = input()
if p == 2 or p == 5:
ans = 0
for i in range(n):
if int(s[i]) % p == 0:
ans += i + 1
else:
s2 = s[::-1]
rems = [0]
tmp = 0
tmp2 = 1
for i in range(n):
tmp += int(s2[i]) * tmp2
tmp %= p
tmp2 *= 10
... | insert | 17 | 17 | 17 | 18 | TLE | |
p02757 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n, p;
string s;
cin >> n >> p >> s;
int ans = 0;
unordered_map<int, int> m;
if (p <= 1000) {
for (int i = 0; i < n; ++i) {
// Just s[i]
... | #include <bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n, p;
string s;
cin >> n >> p >> s;
int ans = 0;
unordered_map<int, int> m;
if (p <= 100) {
for (int i = 0; i < n; ++i) {
// Just s[i]
... | replace | 13 | 14 | 13 | 14 | TLE | |
p02757 | C++ | Runtime Error | #include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <s... | #include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <s... | replace | 70 | 71 | 70 | 71 | 0 | |
p02757 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef tuple<ll, ll, ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define REP(i, n) for (ll i = 0; i < n; ++i)
#de... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef tuple<ll, ll, ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define REP(i, n) for (ll i = 0; i < n; ++i)
#de... | replace | 21 | 22 | 21 | 22 | 0 | |
p02757 | C++ | Time Limit Exceeded | #include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#incl... | #include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#incl... | replace | 243 | 274 | 243 | 267 | TLE | |
p02757 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define li long long int
#define rep(i, to) for (li i = 0; i < ((li)(to)); i++)
#define repp(i, start, to) for (li i = (li)(start); i < ((li)(to)); i++)
#define pb push_back
#define sz(v) ((li)(v).size())
#define bgn(v) ((v).begin())
#define eend(v) ((v).end())
#define all... | #include <bits/stdc++.h>
using namespace std;
#define li long long int
#define rep(i, to) for (li i = 0; i < ((li)(to)); i++)
#define repp(i, start, to) for (li i = (li)(start); i < ((li)(to)); i++)
#define pb push_back
#define sz(v) ((li)(v).size())
#define bgn(v) ((v).begin())
#define eend(v) ((v).end())
#define all... | replace | 91 | 96 | 91 | 100 | 0 | |
p02757 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 200005;
int n, p, a[N], ps[N];
int mul(int aa, int bb) { return int(1LL * aa * bb % p); }
int fexp(int b, int e = p - 2) {
int ans = 1;
while (e) {
if (e & 1)
ans = mul(ans, b);
b = mul(b, b);
e /= 2;
}
retur... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 200005;
int n, p, a[N], ps[N];
int mul(int aa, int bb) { return int(1LL * aa * bb % p); }
int fexp(int b, int e = p - 2) {
int ans = 1;
while (e) {
if (e & 1)
ans = mul(ans, b);
b = mul(b, b);
e /= 2;
}
retur... | replace | 42 | 43 | 42 | 49 | 0 | |
p02757 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// #define P pair<ll,ll>
#define FOR(I, A, B) for (ll I = ll(A); I < ll(B); ++I)
#define FORR(I, A, B) for (ll I = ll((B)-1); I >= ll(A); --I)
#define TO(x, t, f) ((x) ? (t) : (f))
#define SORT(x) (sort(x.begin(), x.end())) // 0 2 2 3 4 5 8 9
#define P... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// #define P pair<ll,ll>
#define FOR(I, A, B) for (ll I = ll(A); I < ll(B); ++I)
#define FORR(I, A, B) for (ll I = ll((B)-1); I >= ll(A); --I)
#define TO(x, t, f) ((x) ? (t) : (f))
#define SORT(x) (sort(x.begin(), x.end())) // 0 2 2 3 4 5 8 9
#define P... | replace | 54 | 57 | 54 | 71 | 0 | |
p02757 | C++ | Runtime Error | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define fo(i, n) for (int i = 0; i < n; i++)
#define Fo(i, k, n) for (int i = k; i < n; i++)
#define endl "\n"
#define ff first
#define ss second
#define int long long
#define pb push_back
#define mp make... | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define fo(i, n) for (int i = 0; i < n; i++)
#define Fo(i, k, n) for (int i = k; i < n; i++)
#define endl "\n"
#define ff first
#define ss second
#define int long long
#define pb push_back
#define mp make... | replace | 76 | 77 | 76 | 77 | -11 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.