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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
p02775 | C++ | Runtime Error | #include <iostream>
using namespace std;
const int mxN = 1e5 + 5;
long long dp[mxN][2];
int main() {
string s;
cin >> s;
int n = s.size();
dp[0][1] = 1;
for (int i = 0; i < n; ++i) {
int cur = s[i] - '0';
dp[i + 1][0] = min(dp[i][0] + cur, dp[i][1] + 10 - cur);
dp[i + 1][1] = min(dp[i][0] + cur + 1, dp[i][1] + 10 - cur - 1);
}
cout << dp[n][0];
}
| #include <iostream>
using namespace std;
const int mxN = 1e6 + 5;
long long dp[mxN][2];
int main() {
string s;
cin >> s;
int n = s.size();
dp[0][1] = 1;
for (int i = 0; i < n; ++i) {
int cur = s[i] - '0';
dp[i + 1][0] = min(dp[i][0] + cur, dp[i][1] + 10 - cur);
dp[i + 1][1] = min(dp[i][0] + cur + 1, dp[i][1] + 10 - cur - 1);
}
cout << dp[n][0];
}
| replace | 3 | 4 | 3 | 4 | 0 | |
p02775 | C++ | Runtime Error | #include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <iostream>
#include <string>
#include <unordered_map>
#include <unordered_set>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORR(i, a, b) for (ll i = (a); i <= (b); i++)
#define repR(i, n) for (ll i = n; i >= 0; i--)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout << (x) << "\n"
#define PQ priority_queue<ll>
#define PQR priority_queue<ll, vector<ll>, greater<ll>>
#define YES(n) cout << ((n) ? "YES\n" : "NO\n")
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n")
#define mp make_pair
#define sz(x) (ll)(x).size()
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef tuple<ll, ll, ll> tll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using vc = vector<char>;
using vvc = vector<vc>;
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
ll dx[4] = {0, 1, 0, -1};
ll dy[4] = {1, 0, -1, 0};
int main() {
string s;
cin >> s;
ll n = sz(s);
vvll dp(n + 1, vll(2, INF));
dp[0][0] = 0;
reverse(all(s));
rep(i, n + 1) rep(j, 2) {
if (dp[i][j] == INF)
continue;
ll c = s[i] - '0';
ll no = 10 - c;
if (j == 0) {
chmin(dp[i + 1][0], dp[i][j] + c);
chmin(dp[i + 1][1], dp[i][j] + no);
} else {
chmin(dp[i + 1][0], dp[i][j] + 1 + c);
chmin(dp[i + 1][1], dp[i][j] + no - 1);
}
}
COUT(min(dp[n][0], dp[n][1] + 1LL));
} | #include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <iostream>
#include <string>
#include <unordered_map>
#include <unordered_set>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORR(i, a, b) for (ll i = (a); i <= (b); i++)
#define repR(i, n) for (ll i = n; i >= 0; i--)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout << (x) << "\n"
#define PQ priority_queue<ll>
#define PQR priority_queue<ll, vector<ll>, greater<ll>>
#define YES(n) cout << ((n) ? "YES\n" : "NO\n")
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n")
#define mp make_pair
#define sz(x) (ll)(x).size()
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef tuple<ll, ll, ll> tll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using vc = vector<char>;
using vvc = vector<vc>;
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
ll dx[4] = {0, 1, 0, -1};
ll dy[4] = {1, 0, -1, 0};
int main() {
string s;
cin >> s;
ll n = sz(s);
vvll dp(n + 1, vll(2, INF));
dp[0][0] = 0;
reverse(all(s));
rep(i, n) rep(j, 2) {
if (dp[i][j] == INF)
continue;
ll c = s[i] - '0';
ll no = 10 - c;
if (j == 0) {
chmin(dp[i + 1][0], dp[i][j] + c);
chmin(dp[i + 1][1], dp[i][j] + no);
} else {
chmin(dp[i + 1][0], dp[i][j] + 1 + c);
chmin(dp[i + 1][1], dp[i][j] + no - 1);
}
}
COUT(min(dp[n][0], dp[n][1] + 1LL));
}
| replace | 61 | 62 | 61 | 62 | -11 | |
p02775 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
char c[200009];
int n, m, i, j, k, l, t, x, y, cost[200009], cost1[200009];
int main() {
scanf("%s", &c);
n = strlen(c);
m = 0;
cost[n - 1] = c[n - 1] - '0';
cost1[n - 1] = 10 - cost[n - 1] + 1;
for (i = n - 2; i >= 0; i--) {
l = c[i] - '0';
x = 10 - l + 1;
cost1[i] = min(cost[i + 1] + x, cost1[i + 1] + x - 2);
cost[i] = min(cost1[i + 1], cost[i + 1]) + l;
}
printf("%d\n", min(cost[0], cost1[0]));
}
| #include <bits/stdc++.h>
using namespace std;
char c[2000009];
int n, m, i, j, k, l, t, x, y, cost[2000009], cost1[2000009];
int main() {
scanf("%s", &c);
n = strlen(c);
m = 0;
cost[n - 1] = c[n - 1] - '0';
cost1[n - 1] = 10 - cost[n - 1] + 1;
for (i = n - 2; i >= 0; i--) {
l = c[i] - '0';
x = 10 - l + 1;
cost1[i] = min(cost[i + 1] + x, cost1[i + 1] + x - 2);
cost[i] = min(cost1[i + 1], cost[i + 1]) + l;
}
printf("%d\n", min(cost[0], cost1[0]));
}
| replace | 2 | 4 | 2 | 4 | 0 | |
p02775 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
string s;
const long long SZ = 1000000;
long long dp[SZ + 1][2];
int main() {
cin >> s;
long long ans = 0, N = s.size();
dp[0][1] = 0x3fffffff;
for (long long i = 1; i <= N; i++) {
long long n = s[N - i] - '0';
if (n < 9) {
dp[i][0] = min(dp[i - 1][0] + n, dp[i - 1][1] + n + 1);
dp[i][1] = min(dp[i - 1][0] + 10 - n, dp[i - 1][1] + 10 - (n + 1));
} else {
dp[i][0] = dp[i - 1][0] + n;
dp[i][1] = min(dp[i - 1][0] + 10 - n, dp[i - 1][1] + 10 - (n + 1));
}
}
cout << min(dp[N][0], dp[N][1] + 1);
}
| #include <bits/stdc++.h>
using namespace std;
string s;
const long long SZ = 1000009;
long long dp[SZ + 1][2];
int main() {
cin >> s;
long long ans = 0, N = s.size();
dp[0][1] = 0x3fffffff;
for (long long i = 1; i <= N; i++) {
long long n = s[N - i] - '0';
if (n < 9) {
dp[i][0] = min(dp[i - 1][0] + n, dp[i - 1][1] + n + 1);
dp[i][1] = min(dp[i - 1][0] + 10 - n, dp[i - 1][1] + 10 - (n + 1));
} else {
dp[i][0] = dp[i - 1][0] + n;
dp[i][1] = min(dp[i - 1][0] + 10 - n, dp[i - 1][1] + 10 - (n + 1));
}
}
cout << min(dp[N][0], dp[N][1] + 1);
}
| replace | 4 | 5 | 4 | 5 | 0 | |
p02775 | C++ | Runtime Error | #include <algorithm>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <string>
#include <vector>
const int MOD = 1e9 + 7;
using namespace std;
int ctoi(char c) { return c - '0'; }
int main() {
string s;
long long dp[100000][2];
cin >> s;
reverse(s.begin(), s.end());
dp[0][0] = ctoi(s[0]);
dp[0][1] = 10 - ctoi(s[0]);
for (int i = 1; i < s.length(); i++) {
dp[i][0] = min(dp[i - 1][0] + ctoi(s[i]), dp[i - 1][1] + ctoi(s[i]) + 1);
dp[i][1] =
min(dp[i - 1][0] + 10 - ctoi(s[i]), dp[i - 1][1] + 9 - ctoi(s[i]));
}
cout << min(dp[s.length() - 1][0], dp[s.length() - 1][1] + 1) << endl;
return 0;
} | #include <algorithm>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <string>
#include <vector>
const int MOD = 1e9 + 7;
using namespace std;
int ctoi(char c) { return c - '0'; }
int main() {
string s;
long long dp[1000000][2];
cin >> s;
reverse(s.begin(), s.end());
dp[0][0] = ctoi(s[0]);
dp[0][1] = 10 - ctoi(s[0]);
for (int i = 1; i < s.length(); i++) {
dp[i][0] = min(dp[i - 1][0] + ctoi(s[i]), dp[i - 1][1] + ctoi(s[i]) + 1);
dp[i][1] =
min(dp[i - 1][0] + 10 - ctoi(s[i]), dp[i - 1][1] + 9 - ctoi(s[i]));
}
cout << min(dp[s.length() - 1][0], dp[s.length() - 1][1] + 1) << endl;
return 0;
} | replace | 14 | 15 | 14 | 15 | 0 | |
p02775 | C++ | Runtime Error | #include <algorithm>
#include <cstdio>
#include <iostream>
using namespace std;
const int maxn = 2e5 + 5;
int dp[maxn][2];
int main() {
// freopen("in","r",stdin);
string s;
cin >> s;
reverse(s.begin(), s.end());
dp[0][0] = s[0] - '0';
dp[0][1] = 10 - (s[0] - '0');
for (int i = 1; i < s.size(); i++) {
int num = s[i] - '0';
if (num == 9)
dp[i][0] = dp[i - 1][0] + num;
else
dp[i][0] = min(dp[i - 1][0] + num, dp[i - 1][1] + num + 1);
dp[i][1] = min(dp[i - 1][0] + 10 - num, dp[i - 1][1] + 9 - num);
}
cout << min(dp[s.size() - 1][0], dp[s.size() - 1][1] + 1) << endl;
} | #include <algorithm>
#include <cstdio>
#include <iostream>
using namespace std;
const int maxn = 1e6 + 7;
int dp[maxn][2];
int main() {
// freopen("in","r",stdin);
string s;
cin >> s;
reverse(s.begin(), s.end());
dp[0][0] = s[0] - '0';
dp[0][1] = 10 - (s[0] - '0');
for (int i = 1; i < s.size(); i++) {
int num = s[i] - '0';
if (num == 9)
dp[i][0] = dp[i - 1][0] + num;
else
dp[i][0] = min(dp[i - 1][0] + num, dp[i - 1][1] + num + 1);
dp[i][1] = min(dp[i - 1][0] + 10 - num, dp[i - 1][1] + 9 - num);
}
cout << min(dp[s.size() - 1][0], dp[s.size() - 1][1] + 1) << endl;
} | replace | 6 | 7 | 6 | 7 | 0 | |
p02775 | C++ | Runtime Error | #include <algorithm>
#include <iostream>
using namespace std;
typedef long long ll;
int main() {
string N;
cin >> N;
ll dp[1000001][2];
dp[0][1] = 1;
dp[0][0] = 0;
for (int i = 0; i < (int)N.size(); i++) {
int n = N[i] - '0';
dp[i + 1][0] = min(dp[i][0] + n, dp[i][1] + 10 - n);
dp[i + 1][1] = min(dp[i][0] + n + 1, dp[i][1] + 10 - n - 1);
}
cout << dp[N.size()][0] << endl;
return 0;
} | #include <algorithm>
#include <iostream>
using namespace std;
typedef long long ll;
int main() {
string N;
cin >> N;
ll dp[1000002][2];
dp[0][1] = 1;
dp[0][0] = 0;
for (int i = 0; i < (int)N.size(); i++) {
int n = N[i] - '0';
dp[i + 1][0] = min(dp[i][0] + n, dp[i][1] + 10 - n);
dp[i + 1][1] = min(dp[i][0] + n + 1, dp[i][1] + 10 - n - 1);
}
cout << dp[N.size()][0] << endl;
return 0;
} | replace | 8 | 9 | 8 | 9 | -11 | |
p02775 | C++ | Runtime Error | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define rep1(i, n) for (int i = 1; i <= (n); i++)
#define rrep1(i, n) for (int i = (n); i > 0; i--)
#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>
#define MOD 1000000007
#define INF 1010101010
using namespace std;
int main() {
string s;
cin >> s;
reverse(s.begin(), s.end());
s += '0';
int n = s.size();
int dp[n][2];
rep(i, n) rep(j, 2) dp[i][j] = INF;
dp[0][0] = 0;
rep(i, n) rep(j, 2) {
int x = s[i] - '0' + j;
if (x < 10)
dp[i + 1][0] = min(dp[i + 1][0], dp[i][j] + x);
if (x > 0)
dp[i + 1][1] = min(dp[i + 1][1], dp[i][j] + (10 - x));
}
cout << dp[n][0] << endl;
return 0;
}
| #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define rep1(i, n) for (int i = 1; i <= (n); i++)
#define rrep1(i, n) for (int i = (n); i > 0; i--)
#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>
#define MOD 1000000007
#define INF 1010101010
using namespace std;
int main() {
string s;
cin >> s;
reverse(s.begin(), s.end());
s += '0';
int n = s.size();
int dp[n + 1][2];
rep(i, n + 1) rep(j, 2) dp[i][j] = INF;
dp[0][0] = 0;
rep(i, n) rep(j, 2) {
int x = s[i] - '0' + j;
if (x < 10)
dp[i + 1][0] = min(dp[i + 1][0], dp[i][j] + x);
if (x > 0)
dp[i + 1][1] = min(dp[i + 1][1], dp[i][j] + (10 - x));
}
cout << dp[n][0] << endl;
return 0;
}
| replace | 23 | 25 | 23 | 25 | 0 | |
p02775 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll MOD = 1e9 + 7;
int mx[] = {-1, 1, 0, 0}, my[] = {0, 0, -1, 1};
string s;
int dp[1000001][2];
bool visited[1000001][2];
int dfs(int n, bool m) {
if (n == (int)s.length())
return 0;
if (visited[n][m])
return dp[n][m];
visited[n][m] = 1;
int t = s[n] - '0';
if (m == 0) {
return dp[n][m] = min(dfs(n + 1, 0) + t, dfs(n + 1, 1) + t + 1);
} else {
if (n == (int)s.length() - 1)
t = 10 - t;
else
t = 9 - t;
return dp[n][m] = min(dfs(n + 1, 0) + t + 1, dfs(n + 1, 1) + t);
}
}
int main() {
cin >> s;
s = "0" + s;
cout << dfs(0, 0);
} | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll MOD = 1e9 + 7;
int mx[] = {-1, 1, 0, 0}, my[] = {0, 0, -1, 1};
string s;
int dp[2000001][2];
bool visited[2000000][2];
int dfs(int n, bool m) {
if (n == (int)s.length())
return 0;
if (visited[n][m])
return dp[n][m];
visited[n][m] = 1;
int t = s[n] - '0';
if (m == 0) {
return dp[n][m] = min(dfs(n + 1, 0) + t, dfs(n + 1, 1) + t + 1);
} else {
if (n == (int)s.length() - 1)
t = 10 - t;
else
t = 9 - t;
return dp[n][m] = min(dfs(n + 1, 0) + t + 1, dfs(n + 1, 1) + t);
}
}
int main() {
cin >> s;
s = "0" + s;
cout << dfs(0, 0);
} | replace | 9 | 11 | 9 | 11 | 0 | |
p02775 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
#define int long long
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
typedef pair<int, int> pii;
const int INF = 1l << 60;
int dp[2][1001000];
int f(string n, int k) { return n[n.length() - 1 - k] - '0'; }
signed main() {
string N;
cin >> N;
dp[0][0] = f(N, 0);
dp[1][0] = 10 - f(N, 0);
for (int i = 1; i < N.length(); ++i) {
int fni = f(N, i);
dp[0][i] = min(dp[0][i - 1] + fni, dp[1][i - 1] + fni + 1);
dp[1][i] = min(dp[0][i - 1] + 10 - fni, dp[1][i - 1] + 10 - (fni + 1));
}
cout << min(dp[0][N.length() - 1], dp[1][N.length() - 1] + 1) << endl;
return 0;
}
| #include <bits/stdc++.h>
#define int long long
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
typedef pair<int, int> pii;
const int INF = 1l << 60;
int dp[2][1001000];
int f(string &n, int k) { return n[n.length() - 1 - k] - '0'; }
signed main() {
string N;
cin >> N;
dp[0][0] = f(N, 0);
dp[1][0] = 10 - f(N, 0);
for (int i = 1; i < N.length(); ++i) {
int fni = f(N, i);
dp[0][i] = min(dp[0][i - 1] + fni, dp[1][i - 1] + fni + 1);
dp[1][i] = min(dp[0][i - 1] + 10 - fni, dp[1][i - 1] + 10 - (fni + 1));
}
cout << min(dp[0][N.length() - 1], dp[1][N.length() - 1] + 1) << endl;
return 0;
}
| replace | 10 | 11 | 10 | 11 | TLE | |
p02775 | C++ | Runtime Error | #include <algorithm>
#include <bitset>
#include <climits>
#include <complex>
#include <cstring>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define rep(i, m, n) for (int i = int(m); i < int(n); i++)
#define all(c) begin(c), end(c)
template <typename T1, typename T2> inline void chmin(T1 &a, T2 b) {
if (a > b)
a = b;
}
template <typename T1, typename T2> inline void chmax(T1 &a, T2 b) {
if (a < b)
a = b;
}
typedef long long int ll;
using ll = long long int;
using ull = long long unsigned int;
using Int = long long int;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0
#define dump(x) cerr << #x << " = " << (x) << endl
#define MOD 1000000007
// edit
class Solve {
public:
void fool() {
Int N;
cin >> N;
Int min_v = INFl;
for (int i = N; i < 100000; ++i) {
Int j = i - N;
string si = to_string(i);
string sj = to_string(j);
Int tmp = 0;
for (auto e : si) {
tmp += e - '0';
}
for (auto e : sj) {
tmp += e - '0';
}
chmin(min_v, tmp);
if (tmp == 10) {
cout << i << " " << j << endl;
}
}
cout << min_v << endl;
}
string N;
Int dp[123456][2] = {};
// Int rec(Int n = N.size() - 1, Int b = 0) {
Int rec(Int n, Int b = 0) {
// b : 繰り上がり
Int ret = INFl;
if (n == 0) {
if (b == 1) {
return N[0] - '0' + 1;
} else {
return N[0] - '0';
}
}
if (dp[n][b] != -1) {
return dp[n][b];
}
for (int i = 0; i <= 9; ++i) {
if (N[n] - '0' <= i - b) {
// 繰り下がりなし
// Int tmp = rec(n - 1, 0) + (i) + ((N[n] - '0' - b - i)
// % 10 + 10) % 10;
Int tmp =
rec(n - 1, 0) + (i) + (((i - b) - (N[n] - '0')) % 10 + 10) % 10;
chmin(ret, tmp);
} else {
// Int tmp = rec(n - 1, 1) + (i) + ((N[n] - '0' - b - i)
// % 10 + 10) % 10;
Int tmp =
rec(n - 1, 1) + (i) + (((i - b) - (N[n] - '0')) % 10 + 10) % 10;
// Int tmp = rec(n - 1, 1);
chmin(ret, tmp);
}
}
return dp[n][b] = ret;
}
void solve() {
cin >> N;
string t = "0";
t += N;
N = t;
memset(dp, -1, sizeof(dp));
Int ans = rec(N.size() - 1);
cout << ans << endl;
}
};
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
cout << fixed << setprecision(10);
Solve().solve();
return 0;
}
| #include <algorithm>
#include <bitset>
#include <climits>
#include <complex>
#include <cstring>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define rep(i, m, n) for (int i = int(m); i < int(n); i++)
#define all(c) begin(c), end(c)
template <typename T1, typename T2> inline void chmin(T1 &a, T2 b) {
if (a > b)
a = b;
}
template <typename T1, typename T2> inline void chmax(T1 &a, T2 b) {
if (a < b)
a = b;
}
typedef long long int ll;
using ll = long long int;
using ull = long long unsigned int;
using Int = long long int;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0
#define dump(x) cerr << #x << " = " << (x) << endl
#define MOD 1000000007
// edit
class Solve {
public:
void fool() {
Int N;
cin >> N;
Int min_v = INFl;
for (int i = N; i < 100000; ++i) {
Int j = i - N;
string si = to_string(i);
string sj = to_string(j);
Int tmp = 0;
for (auto e : si) {
tmp += e - '0';
}
for (auto e : sj) {
tmp += e - '0';
}
chmin(min_v, tmp);
if (tmp == 10) {
cout << i << " " << j << endl;
}
}
cout << min_v << endl;
}
string N;
Int dp[1000007][2] = {};
// Int rec(Int n = N.size() - 1, Int b = 0) {
Int rec(Int n, Int b = 0) {
// b : 繰り上がり
Int ret = INFl;
if (n == 0) {
if (b == 1) {
return N[0] - '0' + 1;
} else {
return N[0] - '0';
}
}
if (dp[n][b] != -1) {
return dp[n][b];
}
for (int i = 0; i <= 9; ++i) {
if (N[n] - '0' <= i - b) {
// 繰り下がりなし
// Int tmp = rec(n - 1, 0) + (i) + ((N[n] - '0' - b - i)
// % 10 + 10) % 10;
Int tmp =
rec(n - 1, 0) + (i) + (((i - b) - (N[n] - '0')) % 10 + 10) % 10;
chmin(ret, tmp);
} else {
// Int tmp = rec(n - 1, 1) + (i) + ((N[n] - '0' - b - i)
// % 10 + 10) % 10;
Int tmp =
rec(n - 1, 1) + (i) + (((i - b) - (N[n] - '0')) % 10 + 10) % 10;
// Int tmp = rec(n - 1, 1);
chmin(ret, tmp);
}
}
return dp[n][b] = ret;
}
void solve() {
cin >> N;
string t = "0";
t += N;
N = t;
memset(dp, -1, sizeof(dp));
Int ans = rec(N.size() - 1);
cout << ans << endl;
}
};
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
cout << fixed << setprecision(10);
Solve().solve();
return 0;
}
| replace | 89 | 90 | 89 | 90 | 0 | |
p02775 | C++ | Runtime Error | #define first f
#define second s
#define ll long long
#define mp make_pair
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#include <bits/stdc++.h>
#define pii pair<int, int>
#define mem(a, b) memset(a, b, sizeof(a))
using namespace std;
const int maxn = 2e5 + 5;
const double PI = acos(-1);
const double e = 2.718281828459;
char s[maxn];
int main() {
scanf("%s", s + 1);
int len = strlen(s + 1);
s[0] = '0';
int p = 0, num = 0;
for (int i = len, j; i >= 0; i--) {
j = s[i] - '0';
j += p;
p = 0;
if (j == 5) {
if (i - 1 >= 0 && s[i - 1] >= '5') {
p++;
num += (10 - j);
} else {
num += j;
}
} else if (j < 5) {
num += j;
} else {
p++;
num += (10 - j);
}
}
cout << num << endl;
return 0;
}
| #define first f
#define second s
#define ll long long
#define mp make_pair
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#include <bits/stdc++.h>
#define pii pair<int, int>
#define mem(a, b) memset(a, b, sizeof(a))
using namespace std;
const int maxn = 1e6 + 5;
const double PI = acos(-1);
const double e = 2.718281828459;
char s[maxn];
int main() {
scanf("%s", s + 1);
int len = strlen(s + 1);
s[0] = '0';
int p = 0, num = 0;
for (int i = len, j; i >= 0; i--) {
j = s[i] - '0';
j += p;
p = 0;
if (j == 5) {
if (i - 1 >= 0 && s[i - 1] >= '5') {
p++;
num += (10 - j);
} else {
num += j;
}
} else if (j < 5) {
num += j;
} else {
p++;
num += (10 - j);
}
}
cout << num << endl;
return 0;
}
| replace | 12 | 13 | 12 | 13 | 0 | |
p02776 | C++ | Runtime Error | #include <algorithm>
#include <cstdio>
#include <cstring>
#include <map>
#include <queue>
#include <set>
using namespace std;
typedef long long LL;
const int SIZEN = 100010;
int a[SIZEN], b[SIZEN], c[SIZEN];
int s[SIZEN];
int N, M;
struct Link {
int to, next, id;
} link[SIZEN << 2];
int head[SIZEN] = {0}, tot = 0;
void add(int from, int to, int id) {
link[++tot].to = to;
link[tot].id = id;
link[tot].next = head[from];
head[from] = tot;
}
bool used[SIZEN] = {0};
bool vis[SIZEN] = {0};
bool dfs(int x) {
vis[x] = true;
bool t = c[x];
// printf("c[%d]=%d\n",x,c[x]);
for (int i = head[x]; i; i = link[i].next) {
if (!vis[link[i].to] && dfs(link[i].to)) {
t ^= 1;
used[link[i].id] = true;
}
}
return t;
}
int main() {
scanf("%d%d", &N, &M);
for (int i = 1; i <= N; i++) {
scanf("%d%d", &a[i], &b[i]);
s[i] = a[i];
}
sort(s + 1, s + 1 + N);
for (int i = 1; i <= N; i++) {
a[i] = lower_bound(s + 1, s + 1 + N, a[i]) - s;
c[a[i]] = b[i];
}
for (int i = N + 1; i >= 1; i--)
c[i] ^= c[i - 1];
for (int i = 1; i <= M; i++) {
int l, r;
scanf("%d%d", &l, &r);
l = lower_bound(s + 1, s + 1 + N, l) - s;
r = upper_bound(s + 1, s + 1 + N, r) - s - 1;
if (l > r)
continue;
add(l, r + 1, i);
add(r + 1, l, i);
}
for (int i = 1; i <= N + 1; i++) {
if (!vis[i] && dfs(i)) {
puts("-1");
return 0;
}
}
int ans = 0;
for (int i = 1; i <= M; i++)
ans += used[i];
printf("%d\n", ans);
for (int i = 1; i <= M; i++)
if (used[i])
printf("%d ", i);
printf("\n");
return 0;
} | #include <algorithm>
#include <cstdio>
#include <cstring>
#include <map>
#include <queue>
#include <set>
using namespace std;
typedef long long LL;
const int SIZEN = 200010;
int a[SIZEN], b[SIZEN], c[SIZEN];
int s[SIZEN];
int N, M;
struct Link {
int to, next, id;
} link[SIZEN << 2];
int head[SIZEN] = {0}, tot = 0;
void add(int from, int to, int id) {
link[++tot].to = to;
link[tot].id = id;
link[tot].next = head[from];
head[from] = tot;
}
bool used[SIZEN] = {0};
bool vis[SIZEN] = {0};
bool dfs(int x) {
vis[x] = true;
bool t = c[x];
// printf("c[%d]=%d\n",x,c[x]);
for (int i = head[x]; i; i = link[i].next) {
if (!vis[link[i].to] && dfs(link[i].to)) {
t ^= 1;
used[link[i].id] = true;
}
}
return t;
}
int main() {
scanf("%d%d", &N, &M);
for (int i = 1; i <= N; i++) {
scanf("%d%d", &a[i], &b[i]);
s[i] = a[i];
}
sort(s + 1, s + 1 + N);
for (int i = 1; i <= N; i++) {
a[i] = lower_bound(s + 1, s + 1 + N, a[i]) - s;
c[a[i]] = b[i];
}
for (int i = N + 1; i >= 1; i--)
c[i] ^= c[i - 1];
for (int i = 1; i <= M; i++) {
int l, r;
scanf("%d%d", &l, &r);
l = lower_bound(s + 1, s + 1 + N, l) - s;
r = upper_bound(s + 1, s + 1 + N, r) - s - 1;
if (l > r)
continue;
add(l, r + 1, i);
add(r + 1, l, i);
}
for (int i = 1; i <= N + 1; i++) {
if (!vis[i] && dfs(i)) {
puts("-1");
return 0;
}
}
int ans = 0;
for (int i = 1; i <= M; i++)
ans += used[i];
printf("%d\n", ans);
for (int i = 1; i <= M; i++)
if (used[i])
printf("%d ", i);
printf("\n");
return 0;
} | replace | 8 | 9 | 8 | 9 | 0 | |
p02776 | C++ | Runtime Error | #include <algorithm>
#include <iostream>
#include <map>
#include <utility>
#include <vector>
using namespace std;
bool vis[100010];
int par[100010];
vector<pair<int, int>> G[100010];
vector<int> a, b, c, ans;
int dfs(int s, int p) {
vis[s] = true;
int cnt = 0;
for (auto x : G[s]) {
if (vis[x.first])
continue;
par[x.first] = x.second;
(cnt += dfs(x.first, s)) &= 1;
}
if (c[s] != cnt) {
ans.push_back(par[s]);
return 1;
}
return 0;
}
vector<pair<int, int>> p;
int main() {
int i, n, m;
cin >> n >> m;
for (i = 0; i < n; i++) {
int x, y;
cin >> x >> y;
x--;
p.push_back({x, y});
}
sort(p.begin(), p.end());
for (i = 0; i < n; i++) {
a.push_back(p[i].first);
b.push_back(p[i].second);
}
c.push_back(b[0]);
int s = c[0];
for (i = 1; i < n; i++) {
c.push_back((s + b[i]) & 1);
(s += c[i]) &= 1;
}
c.push_back(s & 1);
for (i = 0; i < m; i++) {
int l, r;
cin >> l >> r;
l--;
auto it1 = lower_bound(a.begin(), a.end(), l);
auto it2 = lower_bound(a.begin(), a.end(), r);
int x = it1 - a.begin(), y = it2 - a.begin();
if (x == y)
continue;
G[x].push_back({y, i});
G[y].push_back({x, i});
}
for (i = 0; i <= n; i++) {
vis[i] = false;
}
for (i = 0; i <= n; i++) {
if (vis[i])
continue;
par[i] = -1;
dfs(i, -1);
}
sort(ans.begin(), ans.end());
if (ans[0] == -1) {
cout << -1 << endl;
return 0;
}
cout << ans.size() << endl;
for (i = 0; i < ans.size(); i++) {
cout << ans[i] + 1 << " ";
}
cout << endl;
} | #include <algorithm>
#include <iostream>
#include <map>
#include <utility>
#include <vector>
using namespace std;
bool vis[100010];
int par[100010];
vector<pair<int, int>> G[100010];
vector<int> a, b, c, ans;
int dfs(int s, int p) {
vis[s] = true;
int cnt = 0;
for (auto x : G[s]) {
if (vis[x.first])
continue;
par[x.first] = x.second;
(cnt += dfs(x.first, s)) &= 1;
}
if (c[s] != cnt) {
ans.push_back(par[s]);
return 1;
}
return 0;
}
vector<pair<int, int>> p;
int main() {
int i, n, m;
cin >> n >> m;
for (i = 0; i < n; i++) {
int x, y;
cin >> x >> y;
x--;
p.push_back({x, y});
}
sort(p.begin(), p.end());
for (i = 0; i < n; i++) {
a.push_back(p[i].first);
b.push_back(p[i].second);
}
c.push_back(b[0]);
int s = c[0];
for (i = 1; i < n; i++) {
c.push_back((s + b[i]) & 1);
(s += c[i]) &= 1;
}
c.push_back(s & 1);
for (i = 0; i < m; i++) {
int l, r;
cin >> l >> r;
l--;
auto it1 = lower_bound(a.begin(), a.end(), l);
auto it2 = lower_bound(a.begin(), a.end(), r);
int x = it1 - a.begin(), y = it2 - a.begin();
if (x == y)
continue;
G[x].push_back({y, i});
G[y].push_back({x, i});
}
for (i = 0; i <= n; i++) {
vis[i] = false;
}
for (i = 0; i <= n; i++) {
if (vis[i])
continue;
par[i] = -1;
dfs(i, -1);
}
if (ans.size() == 0) {
cout << 0 << endl;
return 0;
}
sort(ans.begin(), ans.end());
if (ans[0] == -1) {
cout << -1 << endl;
return 0;
}
cout << ans.size() << endl;
for (i = 0; i < ans.size(); i++) {
cout << ans[i] + 1 << " ";
}
cout << endl;
} | insert | 69 | 69 | 69 | 73 | 0 | |
p02776 | C++ | Runtime Error | #include <bits/stdc++.h>
#define pi pair<int, int>
#define l first
#define r second
#define pb push_back
#define all(x) x.begin(), x.end()
// #define DEBUG
using namespace std;
const int maxn = 2e5 + 1;
bool b[maxn], t[maxn], usd[maxn], hon[maxn];
int rm[maxn], n, m, val[maxn], pal[maxn];
vector<pi> g[maxn], f[maxn];
vector<int> cv, gv[maxn];
pi a[maxn], v[maxn];
int pst(bool x) { return (x ? -1 : 1); }
void dfs0(int x, int pr = -1) {
val[x] = 1;
hon[x] = t[x];
for (auto to : f[x]) {
if (to.l == pr)
continue;
dfs0(to.l, x);
hon[x] ^= hon[to.l];
}
}
void dfs(int x, int pr = -1) {
usd[x] = 1;
for (auto to : f[x]) {
if (to.l == pr) {
if (hon[x])
cv.pb(to.r + 1);
continue;
}
dfs(to.l, x);
}
}
int p[maxn], sz[maxn], cnt[maxn];
int getp(int x) {
if (p[x] == -1)
return x;
return (p[x] = getp(p[x]));
}
void unions(int x, int y) {
x = getp(x);
y = getp(y);
if (x == y)
return;
if (sz[x] < sz[y])
swap(x, y);
if (sz[x] == sz[y])
++sz[x];
p[y] = x;
cnt[x] += cnt[y];
}
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n >> m;
for (int i = 0; i < n; i++)
cin >> a[i].l >> a[i].r;
for (int i = 0; i < m; i++)
cin >> v[i].l >> v[i].r;
sort(a, a + n);
b[n] = 0;
for (int i = 0; i < n; i++) {
rm[i] = a[i].l;
b[i] = a[i].r;
}
for (int i = 0; i < m; i++) {
v[i].l = (int)(lower_bound(rm, rm + n, v[i].l) - rm);
v[i].r = (int)(upper_bound(rm, rm + n, v[i].r) - rm) - 1;
}
for (int i = 0; i <= n; i++) {
if (!b[i])
continue;
t[i] ^= 1;
t[i + 1] ^= 1;
}
for (int i = 0; i <= n; i++)
cnt[i] = t[i];
for (int i = 0; i < m; i++) {
if (v[i].l > v[i].r)
continue;
g[v[i].l].pb({v[i].r + 1, i});
g[v[i].r + 1].pb({v[i].l, i});
}
for (int i = 0; i <= n; i++) {
for (auto to : g[i]) {
if (getp(to.l) == getp(i))
continue;
f[i].pb({to.l, to.r});
f[to.l].pb({i, to.r});
unions(i, to.l);
}
}
for (int i = 0; i <= n; i++) {
if (cnt[getp(i)] % 2) {
cout << -1;
return 0;
}
if (t[i])
gv[getp(i)].pb(i);
}
for (int i = 0; i <= n; i++)
if (!val[i])
dfs0(i);
int ls = -1;
for (int i = 0; i <= n; i++)
if (!usd[i])
dfs(i);
sort(all(cv));
cout << cv.size() << '\n';
for (auto gg : cv)
cout << gg << ' ';
return 0;
}
| #include <bits/stdc++.h>
#define pi pair<int, int>
#define l first
#define r second
#define pb push_back
#define all(x) x.begin(), x.end()
// #define DEBUG
using namespace std;
const int maxn = 2e5 + 1;
bool b[maxn], t[maxn], usd[maxn], hon[maxn];
int rm[maxn], n, m, val[maxn], pal[maxn];
vector<pi> g[maxn], f[maxn];
vector<int> cv, gv[maxn];
pi a[maxn], v[maxn];
int pst(bool x) { return (x ? -1 : 1); }
void dfs0(int x, int pr = -1) {
val[x] = 1;
hon[x] = t[x];
for (auto to : f[x]) {
if (to.l == pr)
continue;
dfs0(to.l, x);
hon[x] ^= hon[to.l];
}
}
void dfs(int x, int pr = -1) {
usd[x] = 1;
for (auto to : f[x]) {
if (to.l == pr) {
if (hon[x])
cv.pb(to.r + 1);
continue;
}
dfs(to.l, x);
}
}
int p[maxn], sz[maxn], cnt[maxn];
int getp(int x) {
if (p[x] == -1)
return x;
return (p[x] = getp(p[x]));
}
void unions(int x, int y) {
x = getp(x);
y = getp(y);
if (x == y)
return;
if (sz[x] < sz[y])
swap(x, y);
if (sz[x] == sz[y])
++sz[x];
p[y] = x;
cnt[x] += cnt[y];
}
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n >> m;
for (int i = 0; i < n; i++)
cin >> a[i].l >> a[i].r;
for (int i = 0; i < m; i++)
cin >> v[i].l >> v[i].r;
sort(a, a + n);
b[n] = 0;
for (int i = 0; i < n; i++) {
rm[i] = a[i].l;
b[i] = a[i].r;
}
for (int i = 0; i < m; i++) {
v[i].l = (int)(lower_bound(rm, rm + n, v[i].l) - rm);
v[i].r = (int)(upper_bound(rm, rm + n, v[i].r) - rm) - 1;
}
for (int i = 0; i <= n; i++) {
p[i] = -1;
sz[i] = 1;
if (!b[i])
continue;
t[i] ^= 1;
t[i + 1] ^= 1;
}
for (int i = 0; i <= n; i++)
cnt[i] = t[i];
for (int i = 0; i < m; i++) {
if (v[i].l > v[i].r)
continue;
g[v[i].l].pb({v[i].r + 1, i});
g[v[i].r + 1].pb({v[i].l, i});
}
for (int i = 0; i <= n; i++) {
for (auto to : g[i]) {
if (getp(to.l) == getp(i))
continue;
f[i].pb({to.l, to.r});
f[to.l].pb({i, to.r});
unions(i, to.l);
}
}
for (int i = 0; i <= n; i++) {
if (cnt[getp(i)] % 2) {
cout << -1;
return 0;
}
if (t[i])
gv[getp(i)].pb(i);
}
for (int i = 0; i <= n; i++)
if (!val[i])
dfs0(i);
int ls = -1;
for (int i = 0; i <= n; i++)
if (!usd[i])
dfs(i);
sort(all(cv));
cout << cv.size() << '\n';
for (auto gg : cv)
cout << gg << ' ';
return 0;
}
| insert | 84 | 84 | 84 | 86 | -11 | |
p02776 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
#define all(x) begin(x), end(x)
#define uniq(x) (x).erase(unique(all(x)), end(x))
#define bit(n) (1LL << (n))
#define cdiv(a, b) (((a)-1) / (b) + 1)
#define dump(x) cerr << #x " = " << (x) << endl
using vint = vector<int>;
using vvint = vector<vint>;
using pint = pair<int, int>;
using vpint = vector<pint>;
template <typename T>
using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>;
constexpr long double PI = 3.1415926535897932384626433832795028L;
constexpr int DY[8] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr int DX[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) {
while (b) {
swap(a %= b, b);
}
return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template <typename T> void fin(T mes) {
cout << mes << endl;
exit(0);
}
template <typename T, typename U> bool chmax(T &a, const U &b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <typename T, typename U> bool chmin(T &a, const U &b) {
if (b < a) {
a = b;
return true;
}
return false;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &rhs) {
os << "(" << rhs.first << ", " << rhs.second << ")";
return os;
}
template <typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
os << "{";
for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
os << *itr << (next(itr) != rhs.end() ? ", " : "");
}
os << "}";
return os;
}
struct setup {
static constexpr int PREC = 20;
setup() {
cout << fixed << setprecision(PREC);
cerr << fixed << setprecision(PREC);
};
} setup;
int N, M;
int A[110000], B[110000];
int L[220000], R[220000];
pint AB[110000];
vpint G[110000];
bool sw[110000], visited[110000];
bool dfs(int cur, bool drop) {
if (visited[cur]) {
return drop;
}
visited[cur] = true;
drop ^= AB[cur].second;
rep(i, G[cur].size()) {
sw[G[cur][i].second] ^= drop;
drop = dfs(G[cur][i].first, drop);
sw[G[cur][i].second] ^= drop;
}
return drop;
}
signed main() {
cin >> N >> M;
rep(i, N) {
cin >> A[i] >> B[i];
AB[i] = {A[i], B[i]};
}
sort(AB, AB + N);
AB[N] = {LLONG_MAX, 0};
for (int i = N; i > 0; i--) {
AB[i].second ^= AB[i - 1].second;
}
rep(i, M) {
cin >> L[i] >> R[i];
int l = lower_bound(AB, AB + N + 1, pint(L[i], 0)) - AB;
int r = upper_bound(AB, AB + N + 1, pint(R[i], LLONG_MAX)) - AB;
if (l < r) {
G[l].push_back({r, i}), G[r].push_back({l, i});
}
}
rep(i, N + 1) {
if (dfs(i, false)) {
fin(-1);
}
}
vint ans;
rep(i, M) {
if (sw[i]) {
ans.push_back(i + 1);
}
}
cout << ans.size() << endl;
rep(i, ans.size()) { cout << ans[i] << " "; }
cout << endl;
} | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
#define all(x) begin(x), end(x)
#define uniq(x) (x).erase(unique(all(x)), end(x))
#define bit(n) (1LL << (n))
#define cdiv(a, b) (((a)-1) / (b) + 1)
#define dump(x) cerr << #x " = " << (x) << endl
using vint = vector<int>;
using vvint = vector<vint>;
using pint = pair<int, int>;
using vpint = vector<pint>;
template <typename T>
using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>;
constexpr long double PI = 3.1415926535897932384626433832795028L;
constexpr int DY[8] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr int DX[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) {
while (b) {
swap(a %= b, b);
}
return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template <typename T> void fin(T mes) {
cout << mes << endl;
exit(0);
}
template <typename T, typename U> bool chmax(T &a, const U &b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <typename T, typename U> bool chmin(T &a, const U &b) {
if (b < a) {
a = b;
return true;
}
return false;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &rhs) {
os << "(" << rhs.first << ", " << rhs.second << ")";
return os;
}
template <typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
os << "{";
for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
os << *itr << (next(itr) != rhs.end() ? ", " : "");
}
os << "}";
return os;
}
struct setup {
static constexpr int PREC = 20;
setup() {
cout << fixed << setprecision(PREC);
cerr << fixed << setprecision(PREC);
};
} setup;
int N, M;
int A[110000], B[110000];
int L[220000], R[220000];
pint AB[110000];
vpint G[110000];
bool sw[220000], visited[110000];
bool dfs(int cur, bool drop) {
if (visited[cur]) {
return drop;
}
visited[cur] = true;
drop ^= AB[cur].second;
rep(i, G[cur].size()) {
sw[G[cur][i].second] ^= drop;
drop = dfs(G[cur][i].first, drop);
sw[G[cur][i].second] ^= drop;
}
return drop;
}
signed main() {
cin >> N >> M;
rep(i, N) {
cin >> A[i] >> B[i];
AB[i] = {A[i], B[i]};
}
sort(AB, AB + N);
AB[N] = {LLONG_MAX, 0};
for (int i = N; i > 0; i--) {
AB[i].second ^= AB[i - 1].second;
}
rep(i, M) {
cin >> L[i] >> R[i];
int l = lower_bound(AB, AB + N + 1, pint(L[i], 0)) - AB;
int r = upper_bound(AB, AB + N + 1, pint(R[i], LLONG_MAX)) - AB;
if (l < r) {
G[l].push_back({r, i}), G[r].push_back({l, i});
}
}
rep(i, N + 1) {
if (dfs(i, false)) {
fin(-1);
}
}
vint ans;
rep(i, M) {
if (sw[i]) {
ans.push_back(i + 1);
}
}
cout << ans.size() << endl;
rep(i, ans.size()) { cout << ans[i] << " "; }
cout << endl;
} | replace | 71 | 72 | 71 | 72 | 0 | |
p02776 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template <class T> bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class T> bool chmin(T &a, const T &b) {
if (b < a) {
a = b;
return true;
}
return false;
}
#define all(x) (x).begin(), (x).end()
#define fi first
#define se second
#define si(x) int(x.size())
const int mod = 1000000007, MAX = 100005, INF = 1 << 30;
typedef pair<int, pair<int, int>> P;
struct dat {
int l;
int r;
int id;
};
bool ans[MAX];
bool need[MAX];
bool visited[MAX];
pair<int, int> edge[MAX];
bool ok = true;
vector<pair<int, int>> G[MAX];
void DFS(int u, int p, int e) {
visited[u] = 1;
for (auto to : G[u]) {
if (to.fi == p)
continue;
if (visited[to.fi])
continue;
DFS(to.fi, u, to.se);
}
if (need[u]) {
if (e == -1)
ok = false;
else {
ans[e] = 1;
need[edge[e].fi] ^= 1;
need[edge[e].se] ^= 1;
}
}
}
int main() {
std::ifstream in("text.txt");
std::cin.rdbuf(in.rdbuf());
cin.tie(0);
ios::sync_with_stdio(false);
int N, M;
cin >> N >> M;
vector<pair<int, int>> S(N);
for (int i = 0; i < N; i++) {
cin >> S[i].fi >> S[i].se;
}
sort(all(S));
S.push_back({INF, INF});
vector<dat> T(M);
for (int i = 0; i < M; i++) {
cin >> T[i].l >> T[i].r;
auto it = lower_bound(all(S), make_pair(T[i].l, -1));
T[i].l = it - S.begin();
it = lower_bound(all(S), make_pair(T[i].r, INF));
T[i].r = it - S.begin();
T[i].id = i;
edge[i] = {T[i].l, T[i].r};
if (T[i].l == T[i].r)
continue;
G[T[i].l].push_back({T[i].r, i});
G[T[i].r].push_back({T[i].l, i});
}
for (int i = 0; i < N; i++) {
if (i == 0)
need[i] = S[i].se;
else {
need[i] = S[i - 1].se ^ S[i].se;
}
if (i == N - 1)
need[N] = S[i].se;
}
sort(all(T), [](auto a, auto b) {
return make_pair(a.l, a.r) < make_pair(b.l, b.r);
});
for (int i = 0; i < N; i++) {
if (!visited[i])
DFS(i, -1, -1);
}
if (!ok)
cout << -1 << endl;
else {
int cnt = 0;
for (int i = 0; i < M; i++)
if (ans[i])
cnt++;
cout << cnt << endl;
for (int i = 0; i < M; i++)
if (ans[i])
cout << i + 1 << " ";
cout << endl;
}
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template <class T> bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class T> bool chmin(T &a, const T &b) {
if (b < a) {
a = b;
return true;
}
return false;
}
#define all(x) (x).begin(), (x).end()
#define fi first
#define se second
#define si(x) int(x.size())
const int mod = 1000000007, MAX = 200005, INF = 1 << 30;
typedef pair<int, pair<int, int>> P;
struct dat {
int l;
int r;
int id;
};
bool ans[MAX];
bool need[MAX];
bool visited[MAX];
pair<int, int> edge[MAX];
bool ok = true;
vector<pair<int, int>> G[MAX];
void DFS(int u, int p, int e) {
visited[u] = 1;
for (auto to : G[u]) {
if (to.fi == p)
continue;
if (visited[to.fi])
continue;
DFS(to.fi, u, to.se);
}
if (need[u]) {
if (e == -1)
ok = false;
else {
ans[e] = 1;
need[edge[e].fi] ^= 1;
need[edge[e].se] ^= 1;
}
}
}
int main() {
std::ifstream in("text.txt");
std::cin.rdbuf(in.rdbuf());
cin.tie(0);
ios::sync_with_stdio(false);
int N, M;
cin >> N >> M;
vector<pair<int, int>> S(N);
for (int i = 0; i < N; i++) {
cin >> S[i].fi >> S[i].se;
}
sort(all(S));
S.push_back({INF, INF});
vector<dat> T(M);
for (int i = 0; i < M; i++) {
cin >> T[i].l >> T[i].r;
auto it = lower_bound(all(S), make_pair(T[i].l, -1));
T[i].l = it - S.begin();
it = lower_bound(all(S), make_pair(T[i].r, INF));
T[i].r = it - S.begin();
T[i].id = i;
edge[i] = {T[i].l, T[i].r};
if (T[i].l == T[i].r)
continue;
G[T[i].l].push_back({T[i].r, i});
G[T[i].r].push_back({T[i].l, i});
}
for (int i = 0; i < N; i++) {
if (i == 0)
need[i] = S[i].se;
else {
need[i] = S[i - 1].se ^ S[i].se;
}
if (i == N - 1)
need[N] = S[i].se;
}
sort(all(T), [](auto a, auto b) {
return make_pair(a.l, a.r) < make_pair(b.l, b.r);
});
for (int i = 0; i < N; i++) {
if (!visited[i])
DFS(i, -1, -1);
}
if (!ok)
cout << -1 << endl;
else {
int cnt = 0;
for (int i = 0; i < M; i++)
if (ans[i])
cnt++;
cout << cnt << endl;
for (int i = 0; i < M; i++)
if (ans[i])
cout << i + 1 << " ";
cout << endl;
}
}
| replace | 21 | 22 | 21 | 22 | 0 | |
p02776 | C++ | Runtime Error | // Words are flowing out like endless rain into a paper cup
// They slither while they pass they slip away across the universe
// Pools of sorrow, waves of joy are drifting through my open mind
// Possessing and caressing me
#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(), x.end()
using LL = long long;
int vis[100005];
vector<int> ans;
namespace _buff {
const size_t BUFF = 1 << 19;
char ibuf[BUFF], *ib = ibuf, *ie = ibuf;
char getc() {
return getchar();
// if (ib == ie) {
// ib = ibuf;
// ie = ibuf + fread(ibuf, 1, BUFF, stdin);
// }
// return ib == ie ? -1 : *ib++;
}
} // namespace _buff
LL read() {
using namespace _buff;
LL ret = 0;
bool pos = true;
char c = getc();
for (; (c < '0' || c > '9') && c != '-'; c = getc()) {
assert(~c);
}
if (c == '-') {
pos = false;
c = getc();
}
for (; c >= '0' && c <= '9'; c = getc()) {
ret = (ret << 3) + (ret << 1) + (c ^ 48);
}
return pos ? ret : -ret;
}
using P = pair<int, int>;
vector<vector<P>> g(100005 + 1);
int b[100005];
#define fi first
#define se second
void dfs(int x) {
vis[x] = 1;
for (auto u : g[x]) {
if (vis[u.first])
continue;
dfs(u.first);
if (b[u.first]) {
ans.push_back(u.second);
b[u.first] ^= 1;
b[x] ^= 1;
}
}
}
int main() {
ios_base::sync_with_stdio(false);
int n, m;
cin >> n >> m;
vector<P> bomb;
vector<int> lsh;
for (int i = 0; i < n; ++i) {
int a = read(), b = read();
bomb.emplace_back(a, b);
lsh.push_back(a);
}
sort(all(lsh));
sort(begin(bomb), end(bomb));
for (int i = 0; i < n; i++) {
b[i] = bomb[i].second;
}
for (int i = n; i >= 0; i--) {
b[i] ^= (i ? b[i - 1] : 0);
}
for (int i = 1; i <= m; ++i) {
int l, r;
cin >> l >> r;
l = lower_bound(all(lsh), l) - lsh.begin();
r = upper_bound(all(lsh), r) - lsh.begin();
g[l].push_back(make_pair(r, i));
g[r].push_back(make_pair(l, i));
}
for (int i = 0; i <= n; i++) {
if (vis[i])
continue;
dfs(i);
if (b[i]) {
cout << -1 << endl;
return 0;
}
}
sort(all(ans));
cout << ans.size() << endl;
for (auto x : ans) {
cout << x << ' ';
}
cout << endl;
return 0;
}
| // Words are flowing out like endless rain into a paper cup
// They slither while they pass they slip away across the universe
// Pools of sorrow, waves of joy are drifting through my open mind
// Possessing and caressing me
#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(), x.end()
using LL = long long;
int vis[100005];
vector<int> ans;
namespace _buff {
const size_t BUFF = 1 << 19;
char ibuf[BUFF], *ib = ibuf, *ie = ibuf;
char getc() {
return getchar();
// if (ib == ie) {
// ib = ibuf;
// ie = ibuf + fread(ibuf, 1, BUFF, stdin);
// }
// return ib == ie ? -1 : *ib++;
}
} // namespace _buff
LL read() {
using namespace _buff;
LL ret = 0;
bool pos = true;
char c = getc();
for (; (c < '0' || c > '9') && c != '-'; c = getc()) {
assert(~c);
}
if (c == '-') {
pos = false;
c = getc();
}
for (; c >= '0' && c <= '9'; c = getc()) {
ret = (ret << 3) + (ret << 1) + (c ^ 48);
}
return pos ? ret : -ret;
}
using P = pair<int, int>;
vector<vector<P>> g(100005 + 1);
int b[100005];
#define fi first
#define se second
void dfs(int x) {
vis[x] = 1;
for (auto u : g[x]) {
if (vis[u.first])
continue;
dfs(u.first);
if (b[u.first]) {
ans.push_back(u.second);
b[u.first] ^= 1;
b[x] ^= 1;
}
}
}
int main() {
ios_base::sync_with_stdio(false);
int n, m;
cin >> n >> m;
vector<P> bomb;
vector<int> lsh;
for (int i = 0; i < n; ++i) {
int a, b;
cin >> a >> b;
bomb.emplace_back(a, b);
lsh.push_back(a);
}
sort(all(lsh));
sort(begin(bomb), end(bomb));
for (int i = 0; i < n; i++) {
b[i] = bomb[i].second;
}
for (int i = n; i >= 0; i--) {
b[i] ^= (i ? b[i - 1] : 0);
}
for (int i = 1; i <= m; ++i) {
int l, r;
cin >> l >> r;
l = lower_bound(all(lsh), l) - lsh.begin();
r = upper_bound(all(lsh), r) - lsh.begin();
g[l].push_back(make_pair(r, i));
g[r].push_back(make_pair(l, i));
}
for (int i = 0; i <= n; i++) {
if (vis[i])
continue;
dfs(i);
if (b[i]) {
cout << -1 << endl;
return 0;
}
}
sort(all(ans));
cout << ans.size() << endl;
for (auto x : ans) {
cout << x << ' ';
}
cout << endl;
return 0;
}
| replace | 73 | 74 | 73 | 75 | -6 | 33d3461d-dfa0-49f0-a075-5efb5fdc4ae3.out: /home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02776/C++/s807146348.cpp:35: LL read(): Assertion `~c' failed.
|
p02776 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n, m) for (int(i) = (n); (i) < (m); (i)++)
#define rrep(i, n, m) for (int(i) = (n); (i) > (m); (i)--)
using ll = long long;
const ll MOD = 1e9 + 7;
int dfs(int p, vector<vector<vector<int>>> &lis, vector<int> &visited,
vector<int> &each, vector<int> &ans) {
visited[p] = 1;
int ret = each[p];
rep(i, 0, lis[p].size()) {
int nex = lis[p][i][0];
int eind = lis[p][i][1];
if (visited[nex] == 0) {
int cat = dfs(nex, lis, visited, each, ans);
if (cat != 0)
ans.push_back(eind + 1);
ret ^= cat;
}
}
return ret;
}
int main() {
int N, M;
cin >> N >> M;
vector<vector<int>> AB(N, vector<int>(2, 0));
vector<int> Alis(N, 0);
rep(i, 0, N) {
cin >> AB[i][0] >> AB[i][1];
Alis[i] = AB[i][0];
}
sort(AB.begin(), AB.end());
sort(Alis.begin(), Alis.end());
AB.push_back({1000000, 0});
Alis.push_back(1000000);
// rep(i,0,N+1){
// cout << AB[i][0] << " " << AB[i][1] << endl;
// }
//[] (vector<int>& x , vector<int>& y) {return x[0] < y[0];}
vector<int> each(1, AB[0][1]);
rep(i, 1, N + 1) { each.push_back(AB[i - 1][1] ^ AB[i][1]); }
vector<vector<vector<int>>> lis(N + 1,
vector<vector<int>>(0, vector<int>(2)));
int L, R;
int lind, rind;
rep(i, 0, M) {
cin >> L >> R;
lind = distance(Alis.begin(), lower_bound(Alis.begin(), Alis.end(), L));
rind = distance(Alis.begin(), lower_bound(Alis.begin(), Alis.end(), R + 1));
if (lind == rind)
continue;
lis[lind].push_back({rind, i});
lis[rind].push_back({lind, i});
}
vector<int> ans(0);
vector<int> visited(N + 1, 0);
rrep(i, N, -1) {
if (visited[i] == 0) {
int st = dfs(i, lis, visited, each, ans);
if ((i != N) && (st != 0)) {
cout << -1 << endl;
return 0;
}
}
}
sort(ans.begin(), ans.end());
cout << ans.size() << endl;
rep(i, 0, ans.size()) { cout << ans[i] << endl; }
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n, m) for (int(i) = (n); (i) < (m); (i)++)
#define rrep(i, n, m) for (int(i) = (n); (i) > (m); (i)--)
using ll = long long;
const ll MOD = 1e9 + 7;
int dfs(int p, vector<vector<vector<int>>> &lis, vector<int> &visited,
vector<int> &each, vector<int> &ans) {
visited[p] = 1;
int ret = each[p];
rep(i, 0, lis[p].size()) {
int nex = lis[p][i][0];
int eind = lis[p][i][1];
if (visited[nex] == 0) {
int cat = dfs(nex, lis, visited, each, ans);
if (cat != 0)
ans.push_back(eind + 1);
ret ^= cat;
}
}
return ret;
}
int main() {
int N, M;
cin >> N >> M;
vector<vector<int>> AB(N, vector<int>(2, 0));
vector<int> Alis(N, 0);
rep(i, 0, N) {
cin >> AB[i][0] >> AB[i][1];
Alis[i] = AB[i][0];
}
sort(AB.begin(), AB.end());
sort(Alis.begin(), Alis.end());
AB.push_back({1000000001, 0});
Alis.push_back(1000000001);
// rep(i,0,N+1){
// cout << AB[i][0] << " " << AB[i][1] << endl;
// }
//[] (vector<int>& x , vector<int>& y) {return x[0] < y[0];}
vector<int> each(1, AB[0][1]);
rep(i, 1, N + 1) { each.push_back(AB[i - 1][1] ^ AB[i][1]); }
vector<vector<vector<int>>> lis(N + 1,
vector<vector<int>>(0, vector<int>(2)));
int L, R;
int lind, rind;
rep(i, 0, M) {
cin >> L >> R;
lind = distance(Alis.begin(), lower_bound(Alis.begin(), Alis.end(), L));
rind = distance(Alis.begin(), lower_bound(Alis.begin(), Alis.end(), R + 1));
if (lind == rind)
continue;
lis[lind].push_back({rind, i});
lis[rind].push_back({lind, i});
}
vector<int> ans(0);
vector<int> visited(N + 1, 0);
rrep(i, N, -1) {
if (visited[i] == 0) {
int st = dfs(i, lis, visited, each, ans);
if ((i != N) && (st != 0)) {
cout << -1 << endl;
return 0;
}
}
}
sort(ans.begin(), ans.end());
cout << ans.size() << endl;
rep(i, 0, ans.size()) { cout << ans[i] << endl; }
return 0;
} | replace | 44 | 46 | 44 | 46 | 0 | |
p02777 | C++ | Runtime Error | #include "bits/stdc++.h"
#define allr(x) x.rbegin(), x.rend()
#define all(x) x.begin(), x.end()
#define sp " "
#define double long double
#define pb push_back
#define ff first
#define int long long
#define ss second
#define vi vector<int>
#define mem(ara, a) memset(ara, a, sizeof(ara))
long long inf = 2e18;
long long minf = -inf;
using namespace std;
signed main() {
freopen("bruh.txt", "r", stdin);
ios::sync_with_stdio(false);
cin.tie(0);
int a, b;
string s, sr, t;
cin >> s >> sr;
if (s == s) {
cin >> a >> b;
} else if (s != s) {
cin >> b >> a;
}
cin >> t;
if (t == s) {
cout << a - 1 << " " << b << endl;
} else if (t != s) {
cout << a << " " << b - 1 << endl;
}
}
| #include "bits/stdc++.h"
#define allr(x) x.rbegin(), x.rend()
#define all(x) x.begin(), x.end()
#define sp " "
#define double long double
#define pb push_back
#define ff first
#define int long long
#define ss second
#define vi vector<int>
#define mem(ara, a) memset(ara, a, sizeof(ara))
long long inf = 2e18;
long long minf = -inf;
using namespace std;
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
int a, b;
string s, sr, t;
cin >> s >> sr;
if (s == s) {
cin >> a >> b;
} else if (s != s) {
cin >> b >> a;
}
cin >> t;
if (t == s) {
cout << a - 1 << " " << b << endl;
} else if (t != s) {
cout << a << " " << b - 1 << endl;
}
}
| replace | 18 | 19 | 18 | 19 | 0 | |
p02777 | Python | Runtime Error | S, T = list(input().split())
A, B = list(map(int, input().split()))
U = input()
dict = {}
dict[S] = A
dict[T] = B
dict[U] -= 1
print(f"{dict[S]} {dict[T]}")
| S, T = list(input().split())
A, B = list(map(int, input().split()))
U = input()
dict = {}
dict[S] = A
dict[T] = B
dict[U] -= 1
print(dict[S], dict[T])
| replace | 7 | 8 | 7 | 8 | 0 | |
p02777 | Python | Runtime Error | def solve():
S, T, A, B, U = map(int, open(0).read().split())
if S == U:
print(A - 1, B)
else:
print(A, B - 1)
if __name__ == "__main__":
solve()
| def solve():
S, T = map(str, input().split())
A, B = map(int, input().split())
U = input()
if S == U:
print(A - 1, B)
else:
print(A, B - 1)
if __name__ == "__main__":
solve()
| replace | 1 | 2 | 1 | 4 | ValueError: invalid literal for int() with base 10: 'red' | Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02777/Python/s660708293.py", line 10, in <module>
solve()
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02777/Python/s660708293.py", line 2, in solve
S, T, A, B, U = map(int, open(0).read().split())
ValueError: invalid literal for int() with base 10: 'red'
|
p02777 | Python | Runtime Error | S, T = [i for i in input().split()]
A, B = map(int, input().split())
U = input()
if U == S:
A -= 1
elif U == T:
B -= 1
print(f"{A} {B}")
| S, T = [i for i in input().split()]
A, B = map(int, input().split())
U = input()
if U == S:
A -= 1
elif U == T:
B -= 1
print(str(A) + " " + str(B))
| replace | 7 | 8 | 7 | 8 | 0 | |
p02777 | Python | Runtime Error | keys = input.split()
values = tuple(map(int, input().split()))
ball = dict(zip(keys, values))
u = input()
ball[u] -= 1
print(ball[keys[0]], ball[keys[1]])
| keys = input().split()
values = tuple(map(int, input().split()))
ball = dict(zip(keys, values))
u = input()
ball[u] -= 1
print(ball[keys[0]], ball[keys[1]])
| replace | 0 | 1 | 0 | 1 | AttributeError: 'builtin_function_or_method' object has no attribute 'split' | Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02777/Python/s850348662.py", line 1, in <module>
keys = input.split()
AttributeError: 'builtin_function_or_method' object has no attribute 'split'
|
p02777 | Python | Runtime Error | S, T = input().split()
A, B = map(int, input().split())
U = input()
if U == S:
A -= 1
else:
B -= 1
print(f"{A} {B}")
| S, T = input().split()
A, B = map(int, input().split())
U = input()
if U == S:
A -= 1
else:
B -= 1
print(A, B)
| replace | 9 | 10 | 9 | 10 | 0 | |
p02777 | Python | Runtime Error | #! env/bin/local python3
s, t = input().split()
a, b = map(int, input().split())
u = input()
balls = {s: a, t: b}
balls[u] -= 1
print(f"{balls[s]} {balls[t]}")
| #! env/bin/local python3
s, t = input().split()
a, b = map(int, input().split())
u = input()
balls = {s: a, t: b}
balls[u] -= 1
print("{} {}".format(balls[s], balls[t]))
| replace | 10 | 11 | 10 | 11 | 0 | |
p02777 | Python | Runtime Error | inputted = input().split()
S = inputted[0]
T = inputted[1]
inputted = list(map(int, input().split()))
A = inputted[0]
B = inputted[1]
U = input()
A2 = A - 1 if U == S else A
B2 = B - 1 if U == T else B
output = A2 + " " + B2
print(output)
| inputted = input().split()
S = inputted[0]
T = inputted[1]
inputted = list(map(int, input().split()))
A = inputted[0]
B = inputted[1]
U = input()
A2 = A - 1 if U == S else A
B2 = B - 1 if U == T else B
output = "{} {}".format(A2, B2)
print(output)
| replace | 11 | 12 | 11 | 12 | TypeError: unsupported operand type(s) for +: 'int' and 'str' | Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02777/Python/s842548748.py", line 12, in <module>
output = A2 + ' ' + B2
TypeError: unsupported operand type(s) for +: 'int' and 'str'
|
p02777 | C++ | Runtime Error | #include <bits/stdc++.h>
#define int long long int
#define pb push_back
#define MAX INT_MAX
#define MIN INT_MIN
#define MOD 1000000007
#define FO \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL);
using namespace std;
set<int> s;
bool ar[100001];
void seive() {
ar[0] = ar[1] = true;
for (int p = 2; p * p <= 100001; p++) {
if (ar[p] == false) {
for (int i = p * p; i <= 100001; i += p)
ar[i] = true;
}
}
for (int p = 2; p <= 100001; p++) {
if (ar[p] == false)
s.insert(p);
}
}
void solve() {
int n, k;
cin >> n >> k;
vector<int> v(n);
vector<double> pre(n);
vector<double> temp;
for (int i = 0; i < n; i++) {
cin >> v[i];
pre[i] = ((v[i] * (v[i] + 1)) / 2.0) / double(v[i]);
// cout << pre[i] << " ";
}
// cout << endl;
double sum = 0.0;
for (int i = 0; i < k; i++)
sum += pre[i];
temp.pb(sum);
// for(double x : temp)
// cout << x << " ";
// cout << endl;
int c = 0;
double cursum = sum;
for (int i = k; i < n; i++) {
double x = cursum - pre[c] + pre[i];
temp.pb(x);
cursum = x;
c++;
}
// for(double x : temp)
// cout << x << " ";
// cout << endl;
double x = *max_element(temp.begin(), temp.end());
cout << setprecision(10) << x << endl;
return;
}
int32_t main() {
FO;
solve();
return 0;
} | #include <bits/stdc++.h>
#define int long long int
#define pb push_back
#define MAX INT_MAX
#define MIN INT_MIN
#define MOD 1000000007
#define FO \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL);
using namespace std;
set<int> s;
bool ar[100001];
void seive() {
ar[0] = ar[1] = true;
for (int p = 2; p * p <= 100001; p++) {
if (ar[p] == false) {
for (int i = p * p; i <= 100001; i += p)
ar[i] = true;
}
}
for (int p = 2; p <= 100001; p++) {
if (ar[p] == false)
s.insert(p);
}
}
void solve() {
string s, t;
cin >> s >> t;
int a, b;
cin >> a >> b;
string r;
cin >> r;
(r == s ? a : b)--;
cout << a << ' ' << b << endl;
return;
}
int32_t main() {
FO;
solve();
return 0;
} | replace | 29 | 61 | 29 | 37 | -11 | |
p02777 | C++ | Runtime Error | #define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
int t;
int main() {
ios::sync_with_stdio(false);
freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
string s, t, u;
int a, b;
while (cin >> s >> t) {
cin >> a >> b;
cin >> u;
if (u == s)
cout << a - 1 << " " << b << endl;
else
cout << a << " " << b - 1 << endl;
}
return 0;
} | #define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
int t;
int main() {
ios::sync_with_stdio(false);
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
string s, t, u;
int a, b;
while (cin >> s >> t) {
cin >> a >> b;
cin >> u;
if (u == s)
cout << a - 1 << " " << b << endl;
else
cout << a << " " << b - 1 << endl;
}
return 0;
} | replace | 32 | 33 | 32 | 33 | 0 | |
p02777 | C++ | Time Limit Exceeded | #include <cstring>
#include <iostream>
using namespace std;
string s, t, x;
int a, b;
int main() {
cin >> s >> t >> a >> b >> x;
cout << (a - (x == s)) << ' ' << (b - (x == t));
while (1)
;
return 0;
} | #include <cstring>
#include <iostream>
using namespace std;
string s, t, x;
int a, b;
int main() {
cin >> s >> t >> a >> b >> x;
cout << (a - (x == s)) << ' ' << (b - (x == t)) << endl;
return 0;
} | replace | 7 | 10 | 7 | 8 | TLE | |
p02777 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
#define MAX 200010
using namespace std;
char str[3][MAX];
int streq() {
int i = 0;
while (str[0][i] || str[2][i]) {
if (str[0][i] != str[2][i])
return 0;
}
return 1;
}
int main(void) {
int N, M;
cin >> str[0] >> str[1] >> N >> M >> str[2];
if (streq())
cout << N - 1 << " " << M << endl;
else
cout << N << " " << M - 1 << endl;
return 0;
}
| #include <bits/stdc++.h>
#define MAX 200010
using namespace std;
char str[3][MAX];
int streq() {
int i = 0;
while (str[0][i] || str[2][i]) {
if (str[0][i] != str[2][i])
return 0;
i++;
}
return 1;
}
int main(void) {
int N, M;
cin >> str[0] >> str[1] >> N >> M >> str[2];
if (streq())
cout << N - 1 << " " << M << endl;
else
cout << N << " " << M - 1 << endl;
return 0;
}
| insert | 11 | 11 | 11 | 12 | TLE | |
p02777 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
void ioThings() {
ios::sync_with_stdio(0);
cin.tie(0);
#ifndef ONLINE_JUDGE
freopen("in.txt", "r", stdin);
freopen("out.txt", "w", stdout);
freopen("err.txt", "w", stderr);
#endif
}
using ll = long long;
#define debug(x) cerr << #x << ": <" << x << ">\n"
#define dotc() \
int tcs; \
if (cin >> tcs) \
for (int tc = 0; tc < tcs; tc++)
#define sz(x) (int)x.size()
#define eb emplace_back
#define pb push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fi first
#define se second
#define mod 1000000007
int main() {
ioThings();
string a, b;
cin >> a >> b;
int ca, cb;
cin >> ca >> cb;
string u;
cin >> u;
if (u == a)
ca--;
else
cb--;
cout << ca << ' ' << cb;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
void ioThings() {
ios::sync_with_stdio(0);
cin.tie(0);
#ifdef LOCAL
freopen("in.txt", "r", stdin);
freopen("out.txt", "w", stdout);
freopen("err.txt", "w", stderr);
#endif
}
using ll = long long;
#define debug(x) cerr << #x << ": <" << x << ">\n"
#define dotc() \
int tcs; \
if (cin >> tcs) \
for (int tc = 0; tc < tcs; tc++)
#define sz(x) (int)x.size()
#define eb emplace_back
#define pb push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fi first
#define se second
#define mod 1000000007
int main() {
ioThings();
string a, b;
cin >> a >> b;
int ca, cb;
cin >> ca >> cb;
string u;
cin >> u;
if (u == a)
ca--;
else
cb--;
cout << ca << ' ' << cb;
return 0;
}
| replace | 6 | 7 | 6 | 7 | 0 | |
p02777 | C++ | Runtime Error | // Created by code_sm
//
#include <bits/stdc++.h>
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
// typedef tree<int,null_type,less<int>,rb_tree_tag,
// tree_order_statistics_node_update> pseudo_set;
#define ll long long
#define vi vector<int>
#define si set<int>
#define mii map<int, int>
#define pb push_back
#define pf push_front
#define pii pair<int, int>
#define extract_word(s) \
stringstream str(s); \
while (str >> word)
#define fastio \
ios_base::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0);
#define SET(s) cout << fixed << setprecision(s)
#define chotu 1000000007
#define set0(a) memset(a, 0, sizeof(a))
#define endl "\n"
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define lower_string(s) transform(all(s), s.begin(), ::tolower())
#define upper_string(s) transform(all(s), s.begin(), ::toupper())
#define size(s) s.size()
template <class T> bool umin(T &a, T b) {
return a > b ? (a = b, true) : false;
}
template <class T> bool umax(T &a, T b) {
return a < b ? (a = b, true) : false;
}
template <typename T, typename U> bool compare(T x, U y) {
return (abs(x - y) <= 1e-9);
}
void solve() {
fastio string s, t;
cin >> s >> t;
int a, b;
cin >> a >> b;
string u;
cin >> u;
if (u == s)
cout << a - 1 << " " << b;
else
cout << a << " " << b - 1;
}
int main() {
// code
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
fastio int t;
t = 1;
while (t--) {
solve();
cout << endl;
}
}
| // Created by code_sm
//
#include <bits/stdc++.h>
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
// typedef tree<int,null_type,less<int>,rb_tree_tag,
// tree_order_statistics_node_update> pseudo_set;
#define ll long long
#define vi vector<int>
#define si set<int>
#define mii map<int, int>
#define pb push_back
#define pf push_front
#define pii pair<int, int>
#define extract_word(s) \
stringstream str(s); \
while (str >> word)
#define fastio \
ios_base::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0);
#define SET(s) cout << fixed << setprecision(s)
#define chotu 1000000007
#define set0(a) memset(a, 0, sizeof(a))
#define endl "\n"
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define lower_string(s) transform(all(s), s.begin(), ::tolower())
#define upper_string(s) transform(all(s), s.begin(), ::toupper())
#define size(s) s.size()
template <class T> bool umin(T &a, T b) {
return a > b ? (a = b, true) : false;
}
template <class T> bool umax(T &a, T b) {
return a < b ? (a = b, true) : false;
}
template <typename T, typename U> bool compare(T x, U y) {
return (abs(x - y) <= 1e-9);
}
void solve() {
fastio string s, t;
cin >> s >> t;
int a, b;
cin >> a >> b;
string u;
cin >> u;
if (u == s)
cout << a - 1 << " " << b;
else
cout << a << " " << b - 1;
}
int main() {
// code
fastio int t;
t = 1;
while (t--) {
solve();
cout << endl;
}
}
| replace | 54 | 58 | 54 | 55 | 0 | |
p02777 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define IOS \
ios::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define endl "\n"
#define int long long
#define rep(i, a, b) for (int i = a; i < b; i++)
#define repd(i, a, b) for (int i = a; i > b; i--)
#define vi vector<int>
#define pii pair<int, int>
#define mii map<int, int>
#define SET(A, VAL) memset(A, VAL, sizeof(A))
#define ff first
#define ss second
#define pb push_back
const int MAX = 1e6 + 8;
const int sz = 1e5 + 5;
void f_io() {
IOS;
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
freopen("error.txt", "w", stderr);
#endif
}
int32_t main() {
f_io();
int t = 1;
// cin>>t;
while (t--) {
string temp1, temp2;
cin >> temp1 >> temp2;
int a, b;
cin >> a >> b;
string temp3;
cin >> temp3;
if (temp3 == temp1)
a--;
else
b--;
cout << a << " " << b;
}
} | #include <bits/stdc++.h>
using namespace std;
#define IOS \
ios::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define endl "\n"
#define int long long
#define rep(i, a, b) for (int i = a; i < b; i++)
#define repd(i, a, b) for (int i = a; i > b; i--)
#define vi vector<int>
#define pii pair<int, int>
#define mii map<int, int>
#define SET(A, VAL) memset(A, VAL, sizeof(A))
#define ff first
#define ss second
#define pb push_back
const int MAX = 1e6 + 8;
const int sz = 1e5 + 5;
void f_io() {
IOS;
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
freopen("error.txt", "w", stderr);
#endif
}
int32_t main() {
// f_io();
int t = 1;
// cin>>t;
while (t--) {
string temp1, temp2;
cin >> temp1 >> temp2;
int a, b;
cin >> a >> b;
string temp3;
cin >> temp3;
if (temp3 == temp1)
a--;
else
b--;
cout << a << " " << b;
}
} | replace | 29 | 30 | 29 | 30 | 0 | |
p02777 | C++ | Runtime Error | /*coderanant*/
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define f1(i, a, b) for (int i = a; i < b; i++)
#define f2(i, a, b) for (int i = a; i >= b; i--)
#define endl '\n'
#define pb push_back
#define gp " "
#define ff first
#define ss second
#define mp make_pair
const int mod = 1000000007;
ll temp;
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
#ifndef ONLINE_JUDGE
freopen("/home/akmittal/Desktop/Competitive Programming/in.txt", "r", stdin);
freopen("/home/akmittal/Desktop/Competitive Programming/out.txt", "w",
stdout);
#endif
string s, t;
cin >> s >> t;
int a, b;
cin >> a >> b;
string y;
cin >> y;
if (y == s)
a--;
else
b--;
cout << a << gp << b << endl;
return 0;
} | /*coderanant*/
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define f1(i, a, b) for (int i = a; i < b; i++)
#define f2(i, a, b) for (int i = a; i >= b; i--)
#define endl '\n'
#define pb push_back
#define gp " "
#define ff first
#define ss second
#define mp make_pair
const int mod = 1000000007;
ll temp;
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
// #ifndef ONLINE_JUDGE
// freopen("/home/akmittal/Desktop/Competitive
// Programming/in.txt","r",stdin); freopen("/home/akmittal/Desktop/Competitive
// Programming/out.txt","w",stdout); #endif
string s, t;
cin >> s >> t;
int a, b;
cin >> a >> b;
string y;
cin >> y;
if (y == s)
a--;
else
b--;
cout << a << gp << b << endl;
return 0;
} | replace | 22 | 27 | 22 | 26 | 0 | |
p02777 | Python | Runtime Error | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)
s, t = read().decode().split()
a, b = map(int, read().split())
u = read().decode()
if u == s:
a -= 1
else:
b -= 1
print(a, b)
| import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)
s, t = readline().decode("utf-8").split()
a, b = map(int, readline().split())
u = read().decode("utf-8").rstrip()
if u == s:
a -= 1
else:
b -= 1
print(a, b)
| replace | 7 | 10 | 7 | 10 | ValueError: too many values to unpack (expected 2) | Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02777/Python/s104568103.py", line 7, in <module>
s, t = read().decode().split()
ValueError: too many values to unpack (expected 2)
|
p02777 | Python | Runtime Error | S, T = input().split()
A, B = input().split()
U = input()
print(f"{int(A) - 1 if S == U else 0} {int(B) - 1 if T == U else 0}")
| S, T = input().split()
A, B = input().split()
U = input()
print("{} {}".format(int(A) - (1 if S == U else 0), int(B) - (1 if T == U else 0)))
| replace | 4 | 5 | 4 | 5 | 0 | |
p02778 | C++ | Time Limit Exceeded | #include <iostream>
#include <string>
using namespace std;
int main() {
string S;
cin >> S;
int i = 0;
while (1) {
if (i == S.length()) {
break;
}
S[i] = 'x';
}
cout << S << endl;
return 0;
}
| #include <iostream>
#include <string>
using namespace std;
int main() {
string S;
cin >> S;
int i = 0;
while (1) {
if (i == S.length()) {
break;
}
S[i] = 'x';
i++;
}
cout << S << endl;
return 0;
}
| insert | 13 | 13 | 13 | 14 | TLE | |
p02778 | C++ | Time Limit Exceeded |
#include <iomanip>
#include <iostream>
#include <string>
using namespace std;
void Main() {
// input
string S;
cin >> S;
// process
// output
for (int i = 0; S.length(); i++) {
cout << "x";
}
cout << endl;
}
int main() {
std::cout << std::fixed << std::setprecision(15);
Main();
return 0;
}
|
#include <iomanip>
#include <iostream>
#include <string>
using namespace std;
void Main() {
// input
string S;
cin >> S;
// process
// output
for (int i = 0; i < S.length(); i++) {
cout << "x";
}
cout << endl;
}
int main() {
std::cout << std::fixed << std::setprecision(15);
Main();
return 0;
}
| replace | 14 | 15 | 14 | 15 | TLE | |
p02778 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define rep(i, a, b) for (int i = a; i <= b; i++)
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
string s;
cin >> s;
for (int i = 0; i < s.length(); i++) {
s[i] = 'x';
}
cout << s;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define rep(i, a, b) for (int i = a; i <= b; i++)
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
string s;
cin >> s;
for (int i = 0; i < s.length(); i++) {
s[i] = 'x';
}
cout << s;
return 0;
} | delete | 16 | 21 | 16 | 16 | 0 | |
p02778 | C++ | Runtime Error | #include <iostream>
using namespace std;
int main() {
string s;
cin >> s;
for (int i = 0; i < 19; i++)
s[i] = 'x';
cout << s << endl;
return 0;
} | #include <iostream>
using namespace std;
int main() {
string s;
cin >> s;
for (int i = 0; i < s.length(); i++) {
cout << "x";
}
return 0;
} | replace | 5 | 9 | 5 | 8 | 0 | |
p02778 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
string S;
cin >> S;
for (int i = 0; S.at(i) != '\0'; i++) {
cout << 'x';
}
cout << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
string S;
cin >> S;
for (int i = 0; S.size() > i; i++) {
cout << 'x';
}
cout << endl;
return 0;
} | replace | 7 | 8 | 7 | 8 | -6 | terminate called after throwing an instance of 'std::out_of_range'
what(): basic_string::at: __n (which is 7) >= this->size() (which is 7)
|
p02778 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
char s1[10];
cin >> s1;
for (int i = 0; i < strlen(s1); i++) {
s1[i] = 'x';
cout << s1[i];
}
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
char s1[101];
cin >> s1;
for (int i = 0; i < strlen(s1); i++) {
s1[i] = 'x';
cout << s1[i];
}
return 0;
}
| replace | 3 | 4 | 3 | 4 | 0 | |
p02778 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
string s;
int main() {
cin >> s;
for (int i = 0; (int)s.size(); i++)
cout << "x";
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
string s;
int main() {
cin >> s;
for (int i = 0; i < (int)s.size(); i++)
cout << "x";
return 0;
}
| replace | 5 | 6 | 5 | 6 | TLE | |
p02778 | C++ | Runtime Error | #include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
char a[105];
int main() {
cin >> a;
int i;
for (i = 0; i <= strlen(a); i++) {
a[i] = 'x';
}
for (i = 0; i <= strlen(a); i++) {
printf("%c", a[i]);
}
return 0;
} | #include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
char a[105];
int main() {
cin >> a;
int i;
for (i = 0; i <= strlen(a) - 1; i++) {
printf("x");
}
return 0;
} | replace | 8 | 13 | 8 | 10 | -11 | |
p02778 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
string str;
cin >> str;
for (char x : str) {
str.at(x) = x;
}
cout << str << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
string str;
cin >> str;
for (int i = 0; i < str.size(); i++) {
str.at(i) = 'x';
}
cout << str << endl;
}
| replace | 7 | 9 | 7 | 9 | -6 | terminate called after throwing an instance of 'std::out_of_range'
what(): basic_string::at: __n (which is 115) >= this->size() (which is 7)
|
p02778 | C++ | Runtime Error | #include <bits/stdc++.h>
#define fastcin() \
cin.tie(0); \
ios::sync_with_stdio(false)
#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rep1(i, n) for (int i = 1; i <= int(n); i++)
#define per(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define per1(i, n) for (int i = int(n); i > 0; i--)
#define foreach(i, n) for (auto &&i : n)
#define all(x) (x).begin(), (x).end()
#define SORT(x) sort(all(x))
#define REV(x) reverse(all(x))
#define MAX(x) *max_element(all(x))
#define MIN(x) *min_element(all(x))
#define LOWitr(x, n) lower_bound(all(x), n)
#define UPRitr(x, n) upper_bound(all(x), n)
#define cii(x) \
int x; \
cin >> x
#define cill(x) \
LL x; \
cin >> x
#define cis(x) \
string x; \
cin >> x
#define co(x) cout << x << endl
#define dump(x) cout << #x << " = " << (x) << endl
#define truecheck assert
#define pb push_back
#define mp make_pair
#define F first
#define S second
using namespace std;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef long long int64;
template <class T, class U> bool chmax(T &a, const U &b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class T, class U> bool chmin(T &a, const U &b) {
if (b < a) {
a = b;
return true;
}
return false;
}
const int INF = 1e9, MOD = 1e9 + 7;
const LL LLINF = 1e16;
int main() {
fastcin();
cout << fixed << setprecision(10);
cis(s);
auto ans = "";
rep(i, s.length()) { ans += 'x'; }
co(ans);
return 0;
} | #include <bits/stdc++.h>
#define fastcin() \
cin.tie(0); \
ios::sync_with_stdio(false)
#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rep1(i, n) for (int i = 1; i <= int(n); i++)
#define per(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define per1(i, n) for (int i = int(n); i > 0; i--)
#define foreach(i, n) for (auto &&i : n)
#define all(x) (x).begin(), (x).end()
#define SORT(x) sort(all(x))
#define REV(x) reverse(all(x))
#define MAX(x) *max_element(all(x))
#define MIN(x) *min_element(all(x))
#define LOWitr(x, n) lower_bound(all(x), n)
#define UPRitr(x, n) upper_bound(all(x), n)
#define cii(x) \
int x; \
cin >> x
#define cill(x) \
LL x; \
cin >> x
#define cis(x) \
string x; \
cin >> x
#define co(x) cout << x << endl
#define dump(x) cout << #x << " = " << (x) << endl
#define truecheck assert
#define pb push_back
#define mp make_pair
#define F first
#define S second
using namespace std;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef long long int64;
template <class T, class U> bool chmax(T &a, const U &b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class T, class U> bool chmin(T &a, const U &b) {
if (b < a) {
a = b;
return true;
}
return false;
}
const int INF = 1e9, MOD = 1e9 + 7;
const LL LLINF = 1e16;
int main() {
fastcin();
cout << fixed << setprecision(10);
cis(s);
string ans = "";
rep(i, s.length()) { ans += "x"; }
co(ans);
return 0;
} | replace | 60 | 62 | 60 | 62 | 0 | |
p02778 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
string s, n;
cin >> s;
for (int i = 0; i < s.size(); i++)
n.at(i) = 'x';
cout << n << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
string s, n;
cin >> s;
for (int i = 0; i < s.size(); i++)
n += 'x';
cout << n << endl;
} | replace | 7 | 8 | 7 | 8 | -6 | terminate called after throwing an instance of 'std::out_of_range'
what(): basic_string::at: __n (which is 0) >= this->size() (which is 0)
|
p02778 | C++ | Runtime Error | #include <stdio.h>
#include <string.h>
int main(void) {
// Your code here!
char s[20], t[20], u[20];
int a, b;
scanf("%s", s);
int x = strlen(s);
while (x-- > 0)
printf("x");
printf("\n");
}
| #include <stdio.h>
#include <string.h>
int main(void) {
// Your code here!
char s[100];
scanf("%s", s);
int x = strlen(s);
while (x-- > 0)
printf("x");
printf("\n");
}
| replace | 4 | 6 | 4 | 5 | 0 | |
p02778 | C++ | Runtime Error | #include <stdio.h>
#include <string.h>
int main() {
char s[100];
char t[100];
scanf("%s", &s);
int j = strlen(s);
sprintf(t, "x");
for (int i = 1; i != j; i++) {
sprintf(t, "%sx", t);
}
printf("%s", t);
return 0;
} | #include <stdio.h>
#include <string.h>
int main() {
char s[101];
char t[101];
scanf("%s", &s);
int j = strlen(s);
sprintf(t, "x");
for (int i = 1; i != j; i++) {
sprintf(t, "%sx", t);
}
printf("%s", t);
return 0;
}
| replace | 4 | 6 | 4 | 6 | 0 | |
p02778 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
string S;
cin >> S;
for (int i = 0; i < sizeof(S) - 1; i++) {
S.at(i) = 'x';
}
cout << S << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
string S;
cin >> S;
for (int i = 0; i < S.size(); i++) {
S.at(i) = 'x';
}
cout << S << endl;
} | replace | 6 | 7 | 6 | 7 | -6 | terminate called after throwing an instance of 'std::out_of_range'
what(): basic_string::at: __n (which is 7) >= this->size() (which is 7)
|
p02778 | C++ | Runtime Error | #include <climits>
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
int main() {
char s[10];
cin >> s;
int n = strlen(s);
for (int i = 0; i < n; i++)
cout << 'x';
} | #include <climits>
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
int main() {
char s[101];
cin >> s;
int n = strlen(s);
for (int i = 0; i < n; i++)
cout << 'x';
} | replace | 7 | 8 | 7 | 8 | 0 | |
p02778 | C++ | Runtime Error | /*coderanant*/
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define f1(i, a, b) for (int i = a; i < b; i++)
#define f2(i, a, b) for (int i = a; i >= b; i--)
#define endl '\n'
#define pb push_back
#define gp " "
#define ff first
#define ss second
#define mp make_pair
const int mod = 1000000007;
ll temp;
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
#ifndef ONLINE_JUDGE
freopen("/home/akmittal/Desktop/Competitive Programming/in.txt", "r", stdin);
freopen("/home/akmittal/Desktop/Competitive Programming/out.txt", "w",
stdout);
#endif
string s;
cin >> s;
int n = s.size();
string t;
f1(i, 0, n) t.pb('x');
cout << t << endl;
return 0;
} | /*coderanant*/
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define f1(i, a, b) for (int i = a; i < b; i++)
#define f2(i, a, b) for (int i = a; i >= b; i--)
#define endl '\n'
#define pb push_back
#define gp " "
#define ff first
#define ss second
#define mp make_pair
const int mod = 1000000007;
ll temp;
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
// #ifndef ONLINE_JUDGE
// freopen("/home/akmittal/Desktop/Competitive
// Programming/in.txt","r",stdin); freopen("/home/akmittal/Desktop/Competitive
// Programming/out.txt","w",stdout); #endif
string s;
cin >> s;
int n = s.size();
string t;
f1(i, 0, n) t.pb('x');
cout << t << endl;
return 0;
} | replace | 22 | 27 | 22 | 26 | 0 | |
p02778 | C++ | Runtime Error | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define popcnt(x) __builtin_popcount(x)
#define inf 0x3f3f3f3f
#define watch(x) cout << (#x) << " is " << (x) << endl
#define rand() (rand() << 15 | rand())
using namespace std;
using namespace __gnu_pbds;
template <typename T>
using ordered_set =
tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef long long ll;
#define EPS 1e-9
#define PI acos(-1.0)
int main() {
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
#endif
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
string s;
cin >> s;
int n = (int)s.size();
cout << string(n, 'x') << "\n";
} | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define popcnt(x) __builtin_popcount(x)
#define inf 0x3f3f3f3f
#define watch(x) cout << (#x) << " is " << (x) << endl
#define rand() (rand() << 15 | rand())
using namespace std;
using namespace __gnu_pbds;
template <typename T>
using ordered_set =
tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef long long ll;
#define EPS 1e-9
#define PI acos(-1.0)
int main() {
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
string s;
cin >> s;
int n = (int)s.size();
cout << string(n, 'x') << "\n";
} | delete | 21 | 24 | 21 | 21 | 0 | |
p02778 | C++ | Runtime Error | #include <stdio.h>
#include <string.h>
using namespace std;
int main() {
char s[10];
scanf("%s", s);
int num = strlen(s);
for (int i = 0; i < num; i++) {
printf("x");
}
printf("\n");
return 0;
} | #include <stdio.h>
#include <string.h>
using namespace std;
int main() {
char s[100];
scanf("%s", s);
int num = strlen(s);
for (int i = 0; i < num; i++) {
printf("x");
}
printf("\n");
return 0;
} | replace | 6 | 7 | 6 | 7 | 0 | |
p02779 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
long long arr[3000000], cnt[3000000];
int main() {
long long n, i, j, k;
cin >> n;
for (i = 0; i < n; i++) {
cin >> arr[i];
cnt[arr[i]]++;
}
sort(arr, arr + n);
for (i = 0; i < n - 1; i++) {
if (arr[i + 1] == arr[i]) {
cout << "NO" << endl;
return 0;
}
}
cout << "YES" << endl;
} | #include <bits/stdc++.h>
using namespace std;
long long arr[3000000], cnt[3000000];
int main() {
long long n, i, j, k;
cin >> n;
for (i = 0; i < n; i++) {
cin >> arr[i];
// cnt[arr[i]]++;
}
sort(arr, arr + n);
for (i = 0; i < n - 1; i++) {
if (arr[i + 1] == arr[i]) {
cout << "NO" << endl;
return 0;
}
}
cout << "YES" << endl;
} | replace | 8 | 9 | 8 | 9 | 0 | |
p02779 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
typedef double D;
typedef long long int LL;
typedef long double LD;
#define ll long long int
#define OR ||
#define AND &&
#define nl '\n'
#define S string
#define inf INT_MAX
#define SQR(a) (a) * (a)
#define pb push_back
#define GCD(a, b) __gcd(a, b)
#define MOD 1000000007
#define PI 2.0 * acos(0.0)
#define COSI(x) acos(x)
#define LCM(a, b) (a * b) / GCD(a, b)
#define mem(a, b) memset(a, b, sizeof(a))
#define srtv(v) sort(v.begin(), v.end())
#define T \
int t; \
cin >> t; \
while (t--)
#define Rep(i, a, b) for (int i = a; i <= b; i++)
#define rep(i, a, b) for (int i = a; i >= b; i--)
#define boost \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL)
#define inout \
freopen("input.txt", "r", stdin); \
freopen("output.txt", "w", stdout)
#define si(x) scanf("%d", &x)
#define pi(x) printf("%d", x)
#define ss(str) scanf("%s", str)
#define pl(x) printf("%lld", x)
#define sl(x) scanf("%lld", &x)
#define sii(x, y) scanf("%d %d", &x, &y)
#define sll(x, y) scanf("%lld %lld", &x, &y)
#define siii(x, y, z) scanf("%d %d %d", &x, &y, &z)
#define slll(x, y, z) scanf("%lld %lld %lld", &x, &y, &z)
#define M 10005
using namespace std;
//===========================================================
int fact(int n) {
if (n == 0)
return 1;
else
return n * fact(n - 1);
}
//===========================================================
void divisor(int n) {
vector<LL> a(n + 1);
for (int i = 1; i <= n; i++) {
for (int j = i; j <= n; j += i) {
a[j]++;
}
cout << a[i] << " ";
}
}
//===========================================================
void divisor2(int n) {
int cnt = 0;
for (int i = 1; i <= sqrt(n); i++) {
if (n % i == 0)
cnt++;
if (n / i != i)
cnt++;
}
cout << cnt;
}
//===========================================================
void isPrime_sieve(int n) {
bool marked[M];
memset(marked, true, sizeof(marked));
for (int i = 2; i * i <= n; i++) {
if (marked[i] == true) { // isPrime number
for (int j = i * i; j <= n; j += i) {
marked[j] = false;
}
}
}
for (int i = 2; i <= n; i++) {
if (marked[i]) {
cout << i << " ";
}
}
}
//===========================================================
bool isPrime(ll n) {
if (n == 2 || n == 3) {
return true;
}
if (n < 2 || n % 2 == 0) {
return false;
}
for (ll i = 3; i <= sqrt(n); i += 2) {
if (n % i == 0) {
return false;
}
}
return true;
}
//===========================================================
void move_brackets(int n, string s) {
int op = 0, len = 0;
for (int i = 0; i < n; i++) {
if (s[i] == '(') {
op++;
} else {
if (op) {
op--;
len += 2;
}
}
}
cout << (n - len) / 2 << nl;
}
//===========================================================
ll DigitSum(ll num) {
ll sum{0};
while (num != 0) {
sum += (num % 10);
num /= 10;
}
return sum;
}
//===========================================================
const LL mx = 1e9 + 123;
int main(void) {
// boost;
ll t, b, r, d, n, m, mx;
cin >> n;
vector<ll> a(n);
for (ll i = 0; i < n; i++)
cin >> a[i];
for (ll i = 0; i < n; i++) {
for (ll j = i + 1; j < n; j++) {
if (a[i] == a[j]) {
cout << "NO\n";
return 0;
}
}
}
cout << "YES\n";
}
| #include <bits/stdc++.h>
typedef double D;
typedef long long int LL;
typedef long double LD;
#define ll long long int
#define OR ||
#define AND &&
#define nl '\n'
#define S string
#define inf INT_MAX
#define SQR(a) (a) * (a)
#define pb push_back
#define GCD(a, b) __gcd(a, b)
#define MOD 1000000007
#define PI 2.0 * acos(0.0)
#define COSI(x) acos(x)
#define LCM(a, b) (a * b) / GCD(a, b)
#define mem(a, b) memset(a, b, sizeof(a))
#define srtv(v) sort(v.begin(), v.end())
#define T \
int t; \
cin >> t; \
while (t--)
#define Rep(i, a, b) for (int i = a; i <= b; i++)
#define rep(i, a, b) for (int i = a; i >= b; i--)
#define boost \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL)
#define inout \
freopen("input.txt", "r", stdin); \
freopen("output.txt", "w", stdout)
#define si(x) scanf("%d", &x)
#define pi(x) printf("%d", x)
#define ss(str) scanf("%s", str)
#define pl(x) printf("%lld", x)
#define sl(x) scanf("%lld", &x)
#define sii(x, y) scanf("%d %d", &x, &y)
#define sll(x, y) scanf("%lld %lld", &x, &y)
#define siii(x, y, z) scanf("%d %d %d", &x, &y, &z)
#define slll(x, y, z) scanf("%lld %lld %lld", &x, &y, &z)
#define M 10005
using namespace std;
//===========================================================
int fact(int n) {
if (n == 0)
return 1;
else
return n * fact(n - 1);
}
//===========================================================
void divisor(int n) {
vector<LL> a(n + 1);
for (int i = 1; i <= n; i++) {
for (int j = i; j <= n; j += i) {
a[j]++;
}
cout << a[i] << " ";
}
}
//===========================================================
void divisor2(int n) {
int cnt = 0;
for (int i = 1; i <= sqrt(n); i++) {
if (n % i == 0)
cnt++;
if (n / i != i)
cnt++;
}
cout << cnt;
}
//===========================================================
void isPrime_sieve(int n) {
bool marked[M];
memset(marked, true, sizeof(marked));
for (int i = 2; i * i <= n; i++) {
if (marked[i] == true) { // isPrime number
for (int j = i * i; j <= n; j += i) {
marked[j] = false;
}
}
}
for (int i = 2; i <= n; i++) {
if (marked[i]) {
cout << i << " ";
}
}
}
//===========================================================
bool isPrime(ll n) {
if (n == 2 || n == 3) {
return true;
}
if (n < 2 || n % 2 == 0) {
return false;
}
for (ll i = 3; i <= sqrt(n); i += 2) {
if (n % i == 0) {
return false;
}
}
return true;
}
//===========================================================
void move_brackets(int n, string s) {
int op = 0, len = 0;
for (int i = 0; i < n; i++) {
if (s[i] == '(') {
op++;
} else {
if (op) {
op--;
len += 2;
}
}
}
cout << (n - len) / 2 << nl;
}
//===========================================================
ll DigitSum(ll num) {
ll sum{0};
while (num != 0) {
sum += (num % 10);
num /= 10;
}
return sum;
}
//===========================================================
const LL mx = 1e9 + 123;
int main(void) {
// boost;
ll t, b, r, d, n, m, mx;
cin >> n;
vector<ll> a(n);
for (ll i = 0; i < n; i++)
cin >> a[i];
sort(a.begin(), a.end());
for (ll i = 0; i < n - 1; i++) {
if (a[i] == a[i + 1]) {
cout << "NO\n";
return 0;
}
}
cout << "YES\n";
}
| replace | 168 | 174 | 168 | 174 | TLE | |
p02779 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
long long n, x;
bool cek[30000000], ceks;
int main() {
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> x;
if (cek[x])
ceks = true;
cek[x] = true;
}
if (ceks)
cout << "NO" << endl;
else
cout << "YES" << endl;
} | #include <bits/stdc++.h>
using namespace std;
long long n, x;
bool cek[1000000005], ceks;
int main() {
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> x;
if (cek[x])
ceks = true;
cek[x] = true;
}
if (ceks)
cout << "NO" << endl;
else
cout << "YES" << endl;
} | replace | 3 | 4 | 3 | 4 | 0 | |
p02779 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> vec(N);
string ans = "NO";
int count = 0;
for (int i = 0; i < N; i++) {
cin >> vec.at(i);
}
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
if (i != j && vec.at(i) == vec.at(j)) {
count++;
}
}
}
if (count == 0) {
ans = "YES";
}
cout << ans << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> vec(N);
string ans = "NO";
int count = 0;
for (int i = 0; i < N; i++) {
cin >> vec.at(i);
}
sort(vec.begin(), vec.end());
for (int i = 0; i < N - 1; i++) {
if (vec.at(i) == vec.at(i + 1)) {
count++;
}
}
if (count == 0) {
ans = "YES";
}
cout << ans << endl;
return 0;
} | replace | 11 | 16 | 11 | 15 | TLE | |
p02779 | 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 dump(x) cerr << #x << "=" << x << endl
int main() {
int n;
cin >> n;
vector<ll> a(n);
rep(i, n) cin >> a.at(i);
vector<bool> used(100000001, false);
rep(i, n) {
if (!used.at(a.at(i))) {
used.at(a.at(i)) = true;
} else {
cout << "NO" << endl;
return 0;
}
}
cout << "YES" << endl;
} | #include <bits/stdc++.h>
using namespace std;
#define rep(i, N) for (int i = 0; i < N; i++)
typedef long long ll;
#define dump(x) cerr << #x << "=" << x << endl
int main() {
int n;
cin >> n;
vector<ll> a(n);
rep(i, n) cin >> a.at(i);
vector<bool> used(1000000010, false);
rep(i, n) {
if (!used.at(a.at(i))) {
used.at(a.at(i)) = true;
} else {
cout << "NO" << endl;
return 0;
}
}
cout << "YES" << endl;
} | replace | 12 | 13 | 12 | 13 | 0 | |
p02779 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> A(N);
for (int i = 0; i < N; i++) {
cin >> A.at(i);
}
sort(A.begin(), A.end());
for (int i = 1; i <= N - 1; i++) {
if (A.at(i) == A.at(i - 1) or A.at(i) == A.at(i + 1)) {
cout << "NO" << endl;
return 0;
}
}
cout << "YES" << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> A(N);
for (int i = 0; i < N; i++) {
cin >> A.at(i);
}
sort(A.begin(), A.end());
for (int i = 1; i <= N - 1; i++) {
if (A.at(i) == A.at(i - 1)) {
cout << "NO" << endl;
return 0;
}
}
cout << "YES" << endl;
} | replace | 15 | 16 | 15 | 16 | -6 | terminate called after throwing an instance of 'std::out_of_range'
what(): vector::_M_range_check: __n (which is 5) >= this->size() (which is 5)
|
p02779 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
long long int a[100000], n, i, s1 = 0;
cin >> n;
for (i = 0; i < n; i++)
cin >> a[i];
sort(a, a + n);
for (i = 0; i < (n - 1); i++) {
if (a[i] == a[i + 1]) {
s1 = 1;
break;
}
}
if (s1 == 1)
cout << "NO" << endl;
else
cout << "YES" << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
long long int a[200000], n, i, s1 = 0;
cin >> n;
for (i = 0; i < n; i++)
cin >> a[i];
sort(a, a + n);
for (i = 0; i < (n - 1); i++) {
if (a[i] == a[i + 1]) {
s1 = 1;
break;
}
}
if (s1 == 1)
cout << "NO" << endl;
else
cout << "YES" << endl;
return 0;
}
| replace | 4 | 5 | 4 | 5 | 0 | |
p02779 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {
int v;
istringstream sin(s);
sin >> v;
return v;
}
template <class T> inline string toString(T x) {
ostringstream sout;
sout << x;
return sout.str();
}
template <class T> inline T sqr(T x) { return x * x; }
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<string> VS;
typedef pair<int, int> PII;
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i, c) \
for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(v, n) sort(v, v + n)
#define VSORT(v) sort(v.begin(), v.end())
#define REP(i, n) for (ll i = 0; i < n; i++)
#define REPR(i, n) for (ll i = n; i >= 0; i--)
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define FORR(i, m, n) for (ll i = m; i >= n; i--)
#define INF 999999999
const double EPS = 1e-10;
const double PI = acos(-1.0);
#define CLR(a) memset((a), 0, sizeof(a))
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) \
cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
<< " " << __FILE__ << endl;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
VI a(pow(10, 9) + 1);
REP(i, n) {
int tmp;
cin >> tmp;
if (a[tmp] == 0) {
a[tmp] = 1;
} else {
cout << "NO" << endl;
return 0;
}
}
cout << "YES" << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {
int v;
istringstream sin(s);
sin >> v;
return v;
}
template <class T> inline string toString(T x) {
ostringstream sout;
sout << x;
return sout.str();
}
template <class T> inline T sqr(T x) { return x * x; }
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<string> VS;
typedef pair<int, int> PII;
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i, c) \
for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(v, n) sort(v, v + n)
#define VSORT(v) sort(v.begin(), v.end())
#define REP(i, n) for (ll i = 0; i < n; i++)
#define REPR(i, n) for (ll i = n; i >= 0; i--)
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define FORR(i, m, n) for (ll i = m; i >= n; i--)
#define INF 999999999
const double EPS = 1e-10;
const double PI = acos(-1.0);
#define CLR(a) memset((a), 0, sizeof(a))
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) \
cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
<< " " << __FILE__ << endl;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
VI a(n);
REP(i, n) cin >> a[i];
VSORT(a);
REP(i, n - 1) {
if (a[i] == a[i + 1]) {
cout << "NO" << endl;
return 0;
}
}
cout << "YES" << endl;
return 0;
} | replace | 48 | 55 | 48 | 53 | -6 | terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
|
p02779 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
int main() {
int size;
cin >> size;
vector<int> nums(size);
for (int i = 0; i < size; i++)
cin >> nums.at(i);
// sort
int tmp;
for (int j = 0; j < size; j++) {
for (int i = 1; i < size; i++) {
if (nums.at(j) < nums.at(i)) {
tmp = nums.at(j);
nums.at(j) = nums.at(i);
nums.at(i) = tmp;
}
}
}
// check if same
int flg;
flg = 0;
for (int i = 0; i < size - 1; i++) {
if (nums.at(i) == nums.at(i + 1)) {
flg = 1;
}
}
if (flg == 0)
cout << "YES" << endl;
else
cout << "NO" << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int size;
cin >> size;
vector<int> nums(size);
for (int i = 0; i < size; i++)
cin >> nums.at(i);
// sort
sort(nums.begin(), nums.end());
// check if same
int flg;
flg = 0;
for (int i = 0; i < size - 1; i++) {
if (nums.at(i) == nums.at(i + 1)) {
flg = 1;
}
}
if (flg == 0)
cout << "YES" << endl;
else
cout << "NO" << endl;
} | replace | 11 | 21 | 11 | 12 | TLE | |
p02779 | C++ | Runtime Error | ///******* In the name of Allah *******///
#include <bits/stdc++.h>
using namespace std;
long int gcd(long int a, long int b) {
if (b == 0)
return a;
return gcd(b, a % b);
}
void Ok() {
long long int a[30013], b[10013], c, d, e, f, g, h, t, s, i, j, k, l1, l2, m,
n, r, sum = 0, ans_1, ans_2, ans_3, cnt = 0, Max, Min, flag, div, temp;
double aa, bb, cc, dd, ee, tot;
char aaa[3013], bbb[1013], ccc[1013], num;
cin >> n;
for (i = 1; i <= n; i++) {
cin >> a[i];
}
sort(a + 1, a + n + 1);
for (i = 1; i < n; i++) {
if (a[i] != a[i + 1]) {
cnt++;
}
}
if (cnt == (n - 1)) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
}
int main() {
Ok();
return 0;
}
| ///******* In the name of Allah *******///
#include <bits/stdc++.h>
using namespace std;
long int gcd(long int a, long int b) {
if (b == 0)
return a;
return gcd(b, a % b);
}
void Ok() {
long long int a[300013], b[10013], c, d, e, f, g, h, t, s, i, j, k, l1, l2, m,
n, r, sum = 0, ans_1, ans_2, ans_3, cnt = 0, Max, Min, flag, div, temp;
double aa, bb, cc, dd, ee, tot;
char aaa[3013], bbb[1013], ccc[1013], num;
cin >> n;
for (i = 1; i <= n; i++) {
cin >> a[i];
}
sort(a + 1, a + n + 1);
for (i = 1; i < n; i++) {
if (a[i] != a[i + 1]) {
cnt++;
}
}
if (cnt == (n - 1)) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
}
int main() {
Ok();
return 0;
}
| replace | 12 | 13 | 12 | 13 | 0 | |
p02779 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int MOD = 1e9 + 7;
#define rep(i, b) for (i = 0; i < b; ++i)
#define repp(i, a, b) for (i = a; i < b; ++i)
int main() {
ll num;
bool flag = false;
cin >> num;
std::vector<bool> v(10010001, false);
for (int i = 0; i < num; i++) {
ll x;
cin >> x;
if (v[x]) {
cout << "NO";
flag = true;
break;
} else
v[x] = true;
}
if (!flag)
cout << "YES";
return 0;
}
/*
,--"""",--.__,---[],-------._
," __,' \ \--""""""==;-
," _,-" "/---.___ \ ___\ ,-'',"
/,-' / ;. ,.--'-.__\ _,-"" ,| `,' /
/``""""-._/,-|:\ []\,' ```-/:;-. `. /
` ;::: || /:,; `-.\
=.,'__,---||-.____',.=
=(:\_ ||__ ):)=
,"::::`----||::`--':::"._
,':::::::::::||::::::::::::'.
.__ ;:::.-.:::::__||___:::::.-.:::\ __,
"""-;:::( O )::::>_|| _<::::( O )::::-"""
=======;:::::`-`:::::::||':::::::`-`:::::\=======
,--"";:::_____________||______________::::""----. , ,
; ::`._( | ||| | )_,'::::\_,,,,,,,,,,____/,'_,
,; :::`--._|____[]|_____|_.-'::::::::::::::::::::::::);_
;/ / :::::::::,||,:::::::::::::::::::::::::::::::::::/
/; ``''''----------/,'/,__,,,,,____:::::::::::::::::::::,"
;/ :);/|_;| ,--.. . ```-.:::::::::::::_,"
/; :::):__,'//""\\. ,--.. \:::,:::::_,"
;/ :::::/ . . . . . . //""\\. \::":__,"
;/ :::::::,' . . . . . . . . . . .:`::\
'; :::::::__,'. ,--.. . .,--. . . . . .:`::`
'; __,..--'''-. . //""\\. .//""\\ . ,--.. :`:::`
; / \\ .//""\\ . . . . . . . . . //""\\. :`::`
; / . . . . . . . . . . . . . . . . .:`::`
; ( . . . . . . . . . . . . . . . ;:::`
,: ;, . . . . . . . . . . . . . ;':::`
,: ;, . . . . . . . . . . . . .;`:::
,: ;, . . . . . . . . . . . . ;`::;`
,: ; . . . . . . . . . . . . ;':::;`
: ; . . . . . . . . . . . ,':::;
: '. . . . . . . . .. . . .,':::;`
: `. . . . . . . . . . . . ;::::;`
'. `-. . . . . . . . . . . ,-'::::;
`:_ ``--..___________..--'':::::;'`
`._::,.:,.:,:_ctr_:,:,.::,.:_;'`
________________`"\/"\/\/'""""`\/"\/""\/"____________________________
*/
| #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int MOD = 1e9 + 7;
#define rep(i, b) for (i = 0; i < b; ++i)
#define repp(i, a, b) for (i = a; i < b; ++i)
int main() {
ll num;
bool flag = false;
cin >> num;
std::vector<bool> v(1001001001, false);
for (int i = 0; i < num; i++) {
ll x;
cin >> x;
if (v[x]) {
cout << "NO";
flag = true;
break;
} else
v[x] = true;
}
if (!flag)
cout << "YES";
return 0;
}
/*
,--"""",--.__,---[],-------._
," __,' \ \--""""""==;-
," _,-" "/---.___ \ ___\ ,-'',"
/,-' / ;. ,.--'-.__\ _,-"" ,| `,' /
/``""""-._/,-|:\ []\,' ```-/:;-. `. /
` ;::: || /:,; `-.\
=.,'__,---||-.____',.=
=(:\_ ||__ ):)=
,"::::`----||::`--':::"._
,':::::::::::||::::::::::::'.
.__ ;:::.-.:::::__||___:::::.-.:::\ __,
"""-;:::( O )::::>_|| _<::::( O )::::-"""
=======;:::::`-`:::::::||':::::::`-`:::::\=======
,--"";:::_____________||______________::::""----. , ,
; ::`._( | ||| | )_,'::::\_,,,,,,,,,,____/,'_,
,; :::`--._|____[]|_____|_.-'::::::::::::::::::::::::);_
;/ / :::::::::,||,:::::::::::::::::::::::::::::::::::/
/; ``''''----------/,'/,__,,,,,____:::::::::::::::::::::,"
;/ :);/|_;| ,--.. . ```-.:::::::::::::_,"
/; :::):__,'//""\\. ,--.. \:::,:::::_,"
;/ :::::/ . . . . . . //""\\. \::":__,"
;/ :::::::,' . . . . . . . . . . .:`::\
'; :::::::__,'. ,--.. . .,--. . . . . .:`::`
'; __,..--'''-. . //""\\. .//""\\ . ,--.. :`:::`
; / \\ .//""\\ . . . . . . . . . //""\\. :`::`
; / . . . . . . . . . . . . . . . . .:`::`
; ( . . . . . . . . . . . . . . . ;:::`
,: ;, . . . . . . . . . . . . . ;':::`
,: ;, . . . . . . . . . . . . .;`:::
,: ;, . . . . . . . . . . . . ;`::;`
,: ; . . . . . . . . . . . . ;':::;`
: ; . . . . . . . . . . . ,':::;
: '. . . . . . . . .. . . .,':::;`
: `. . . . . . . . . . . . ;::::;`
'. `-. . . . . . . . . . . ,-'::::;
`:_ ``--..___________..--'':::::;'`
`._::,.:,.:,:_ctr_:,:,.::,.:_;'`
________________`"\/"\/\/'""""`\/"\/""\/"____________________________
*/
| replace | 15 | 16 | 15 | 16 | 0 | |
p02779 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> vec(N);
for (int i = 0; i < N; i++) {
cin >> vec.at(i);
}
sort(vec.begin(), vec.end());
bool a = true;
for (int i = 0; i < N; i++) {
if (vec.at(i) == vec.at(i + 1)) {
a = false;
break;
}
}
if (a) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> vec(N);
for (int i = 0; i < N; i++) {
cin >> vec.at(i);
}
sort(vec.begin(), vec.end());
bool a = true;
for (int i = 0; i < N - 1; i++) {
if (vec.at(i) == vec.at(i + 1)) {
a = false;
break;
}
}
if (a) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
}
| replace | 14 | 15 | 14 | 15 | -6 | terminate called after throwing an instance of 'std::out_of_range'
what(): vector::_M_range_check: __n (which is 5) >= this->size() (which is 5)
|
p02779 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> A(N);
for (int i = 0; i < N; i++) {
cin >> A[i];
for (int j = 0; j < i; j++) {
if (A[i] == A[j]) {
cout << "NO" << endl;
return 0;
}
}
}
cout << "YES" << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> A(N);
for (int i = 0; i < N; i++) {
cin >> A[i];
}
sort(A.begin(), A.end());
for (int i = 0; i < N - 1; i++) {
if (A[i] == A[i + 1]) {
cout << "NO" << endl;
return 0;
}
}
cout << "YES" << endl;
} | replace | 9 | 14 | 9 | 15 | TLE | |
p02779 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
int main() {
int i, j, N;
int judge = 1;
cin >> N;
vector<int> vec(N);
for (i = 0; i < N; i++) {
cin >> vec.at(i);
}
for (j = 0; j < N; j++) {
for (i = j + 1; i < N; i++) {
if (vec.at(i) == vec.at(j)) {
judge--;
break;
}
}
}
if (judge) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int i, j, N;
int judge = 1;
cin >> N;
vector<int> vec(N);
for (i = 0; i < N; i++) {
cin >> vec.at(i);
}
sort(vec.begin(), vec.end());
for (j = 0; j < N - 1; j++) {
if (vec.at(j) == vec.at(j + 1)) {
judge--;
break;
}
}
if (judge) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
}
| replace | 11 | 17 | 11 | 16 | TLE | |
p02779 | C++ | Time Limit Exceeded | #include <algorithm>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
using namespace std;
int main() {
long long N;
cin >> N;
vector<long long> S(N);
for (long long i = 0; i < N; i++) {
cin >> S[i];
}
for (long long i = 0; i < N; i++) {
for (long long j = 0; j < N; j++) {
if (S[i] == S[j] && i != j) {
cout << "NO" << endl;
return 0;
}
}
}
cout << "YES" << endl;
}
| #include <algorithm>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
using namespace std;
int main() {
long long N;
cin >> N;
vector<long long> S(N);
for (long long i = 0; i < N; i++) {
cin >> S[i];
}
sort(S.begin(), S.end());
for (long long i = 1; i < N; i++) {
if (S[i] == S[i - 1]) {
cout << "NO" << endl;
return 0;
}
}
cout << "YES" << endl;
} | replace | 16 | 22 | 16 | 22 | TLE | |
p02779 | C++ | Time Limit Exceeded | #include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define ll long long
#include <bits/stdc++.h>
using namespace std;
#define mo 1000000007
#define ull unsigned long long
int main() {
ll n;
cin >> n;
string s = "YES";
vector<ll> p(n);
rep(i, n) cin >> p.at(i);
for (int i = 0; i < n; i++) {
for (int j = i + 1; j < n; j++) {
if (p.at(i) == p.at(j)) {
s = "NO";
}
}
}
cout << s;
}
| #include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define ll long long
#include <bits/stdc++.h>
using namespace std;
#define mo 1000000007
#define ull unsigned long long
int main() {
ll n;
cin >> n;
string s = "YES";
vector<ll> p(n);
rep(i, n) cin >> p.at(i);
sort(p.begin(), p.end());
for (int i = 1; i < n; i++) {
if (p.at(i - 1) == p.at(i))
s = "NO";
}
cout << s;
}
| replace | 17 | 23 | 17 | 21 | TLE | |
p02779 | 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 n;
cin >> n;
vector<ll> a(n);
rep(i, n) cin >> a[i];
for (int i = 0; i < n - 1; ++i) {
for (int j = i + 1; j < n; ++j) {
if (a[i] == a[j]) {
cout << "NO"
<< "\n";
return 0;
}
}
}
cout << "YES"
<< "\n";
return 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() {
int n;
cin >> n;
vector<ll> a(n);
rep(i, n) cin >> a[i];
sort(a.begin(), a.end());
rep(i, n - 1) {
if (a[i] == a[i + 1]) {
cout << "NO"
<< "\n";
return 0;
}
}
cout << "YES"
<< "\n";
return 0;
} | replace | 11 | 18 | 11 | 17 | TLE | |
p02779 | C++ | Time Limit Exceeded | #include <algorithm>
#include <iostream>
#include <math.h>
#include <vector>
using namespace std;
int main() {
int N;
cin >> N;
vector<long long> A(N);
for (int i = 0; i < N; i++)
cin >> A[i];
for (int i = 0; i < N; i++) {
for (int j = i + 1; j < N; j++) {
if (A[i] == A[j]) {
cout << "NO" << endl;
return 0;
}
}
}
cout << "YES" << endl;
}
| #include <algorithm>
#include <iostream>
#include <math.h>
#include <vector>
using namespace std;
int main() {
int N;
cin >> N;
vector<long long> A(N);
for (int i = 0; i < N; i++)
cin >> A[i];
sort(A.begin(), A.end());
A.erase(unique(A.begin(), A.end()), A.end());
if (A.size() == N)
cout << "YES" << endl;
else
cout << "NO" << endl;
}
| replace | 13 | 22 | 13 | 20 | TLE | |
p02779 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
// Define
using ll = long long;
using ull = unsigned long long;
using ld = long double;
template <class T> using pvector = vector<pair<T, T>>;
template <class T>
using rpriority_queue = priority_queue<T, vector<T>, greater<T>>;
constexpr const ll dx[4] = {1, 0, -1, 0};
constexpr const ll dy[4] = {0, 1, 0, -1};
constexpr const ll MOD = 1e9 + 7;
constexpr const ll mod = 998244353;
constexpr const ll INF = 1LL << 60;
constexpr const ll inf = 1 << 30;
constexpr const char rt = '\n';
constexpr const char sp = ' ';
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define elif else if
#define all(a, v, ...) \
([&](decltype((v)) w) { return (a)(begin(w), end(w), ##__VA_ARGS__); })(v)
#define rall(a, v, ...) \
([&](decltype((v)) w) { return (a)(rbegin(w), rend(w), ##__VA_ARGS__); })(v)
#define fi first
#define se second
template <class T> bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> bool chmin(T &a, const T &b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
// Debug
#define debug(...) \
{ \
cerr << __LINE__ << ": " << #__VA_ARGS__ << " = "; \
for (auto &&X : {__VA_ARGS__}) \
cerr << "[" << X << "] "; \
cerr << rt; \
}
#define dump(a, h, w) \
{ \
cerr << __LINE__ << ": " << #a << " = [" << rt; \
rep(i, h) { \
rep(j, w) cerr << a[i][j] << sp; \
cerr << rt; \
} \
cerr << "]" << rt; \
}
#define vdump(a, n) \
{ \
cerr << __LINE__ << ": " << #a << " = ["; \
rep(i, n) if (i) cerr << sp << a[i]; \
else cerr << a[i]; \
cerr << "]" << rt; \
}
// Loop
#define inc(i, a, n) for (ll i = (a), _##i = (n); i <= _##i; ++i)
#define dec(i, a, n) for (ll i = (a), _##i = (n); i >= _##i; --i)
#define rep(i, n) for (ll i = 0, _##i = (n); i < _##i; ++i)
#define each(i, a) for (auto &&i : a)
// Stream
#define fout(n) cout << fixed << setprecision(n)
struct io {
io() { cin.tie(nullptr), ios::sync_with_stdio(false); }
} io;
// Speed
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// Math
inline constexpr ll gcd(const ll a, const ll b) {
return b ? gcd(b, a % b) : a;
}
inline constexpr ll lcm(const ll a, const ll b) { return a / gcd(a, b) * b; }
inline constexpr ll modulo(const ll n, const ll m = MOD) {
ll k = n % m;
return k + m * (k < 0);
}
inline constexpr ll chmod(ll &n, const ll m = MOD) {
n %= m;
return n += m * (n < 0);
}
inline constexpr ll mpow(ll a, ll n, const ll m = MOD) {
ll r = 1;
rep(i, 64) {
if (n & (1LL << i))
r *= a;
chmod(r, m);
a *= a;
chmod(a, m);
}
return r;
}
inline ll inv(const ll n, const ll m = MOD) {
ll a = n, b = m, x = 1, y = 0;
while (b) {
ll t = a / b;
a -= t * b;
swap(a, b);
x -= t * y;
swap(x, y);
}
return modulo(x, m);
}
signed main() {
ll N;
cin >> N;
ll A[N];
rep(i, N) cin >> A[i];
sort(A, A + N);
rep(i, N - 1) if (A[i] == A[i + 1]) return puts("NO");
return puts("YES");
}
// -g -D_GLIBCXX_DEBUG -fsanitize=undefined
| #include <bits/stdc++.h>
using namespace std;
// Define
using ll = long long;
using ull = unsigned long long;
using ld = long double;
template <class T> using pvector = vector<pair<T, T>>;
template <class T>
using rpriority_queue = priority_queue<T, vector<T>, greater<T>>;
constexpr const ll dx[4] = {1, 0, -1, 0};
constexpr const ll dy[4] = {0, 1, 0, -1};
constexpr const ll MOD = 1e9 + 7;
constexpr const ll mod = 998244353;
constexpr const ll INF = 1LL << 60;
constexpr const ll inf = 1 << 30;
constexpr const char rt = '\n';
constexpr const char sp = ' ';
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define elif else if
#define all(a, v, ...) \
([&](decltype((v)) w) { return (a)(begin(w), end(w), ##__VA_ARGS__); })(v)
#define rall(a, v, ...) \
([&](decltype((v)) w) { return (a)(rbegin(w), rend(w), ##__VA_ARGS__); })(v)
#define fi first
#define se second
template <class T> bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> bool chmin(T &a, const T &b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
// Debug
#define debug(...) \
{ \
cerr << __LINE__ << ": " << #__VA_ARGS__ << " = "; \
for (auto &&X : {__VA_ARGS__}) \
cerr << "[" << X << "] "; \
cerr << rt; \
}
#define dump(a, h, w) \
{ \
cerr << __LINE__ << ": " << #a << " = [" << rt; \
rep(i, h) { \
rep(j, w) cerr << a[i][j] << sp; \
cerr << rt; \
} \
cerr << "]" << rt; \
}
#define vdump(a, n) \
{ \
cerr << __LINE__ << ": " << #a << " = ["; \
rep(i, n) if (i) cerr << sp << a[i]; \
else cerr << a[i]; \
cerr << "]" << rt; \
}
// Loop
#define inc(i, a, n) for (ll i = (a), _##i = (n); i <= _##i; ++i)
#define dec(i, a, n) for (ll i = (a), _##i = (n); i >= _##i; --i)
#define rep(i, n) for (ll i = 0, _##i = (n); i < _##i; ++i)
#define each(i, a) for (auto &&i : a)
// Stream
#define fout(n) cout << fixed << setprecision(n)
struct io {
io() { cin.tie(nullptr), ios::sync_with_stdio(false); }
} io;
// Speed
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// Math
inline constexpr ll gcd(const ll a, const ll b) {
return b ? gcd(b, a % b) : a;
}
inline constexpr ll lcm(const ll a, const ll b) { return a / gcd(a, b) * b; }
inline constexpr ll modulo(const ll n, const ll m = MOD) {
ll k = n % m;
return k + m * (k < 0);
}
inline constexpr ll chmod(ll &n, const ll m = MOD) {
n %= m;
return n += m * (n < 0);
}
inline constexpr ll mpow(ll a, ll n, const ll m = MOD) {
ll r = 1;
rep(i, 64) {
if (n & (1LL << i))
r *= a;
chmod(r, m);
a *= a;
chmod(a, m);
}
return r;
}
inline ll inv(const ll n, const ll m = MOD) {
ll a = n, b = m, x = 1, y = 0;
while (b) {
ll t = a / b;
a -= t * b;
swap(a, b);
x -= t * y;
swap(x, y);
}
return modulo(x, m);
}
signed main() {
ll N;
cin >> N;
ll A[N];
rep(i, N) cin >> A[i];
sort(A, A + N);
rep(i, N - 1) if (A[i] == A[i + 1]) return puts("NO") & 0;
return puts("YES") & 0;
}
// -g -D_GLIBCXX_DEBUG -fsanitize=undefined
| replace | 131 | 133 | 131 | 133 | 4 | |
p02779 | C++ | Time Limit Exceeded | #include <algorithm>
#include <cmath>
#include <cstring>
#include <iostream>
#include <string>
using namespace std;
#define ll long long
string s1, s2, s3;
ll n1, n2;
ll a[200005], f;
int main() {
cin >> n1;
for (int i = 1; i <= n1; i++)
cin >> a[i];
sort(a + 1, a + 1 + n1);
for (int i = 1; i <= n1; i++) {
for (int j = i + 1; j <= n1; j++) {
if (a[i] == a[j]) {
f = 1;
break;
}
}
}
if (f == 1)
cout << "NO" << endl;
else
cout << "YES" << endl;
return 0;
} | #include <algorithm>
#include <cmath>
#include <cstring>
#include <iostream>
#include <string>
using namespace std;
#define ll long long
string s1, s2, s3;
ll n1, n2;
ll a[200005], f;
int main() {
cin >> n1;
for (int i = 1; i <= n1; i++)
cin >> a[i];
sort(a + 1, a + 1 + n1);
for (int i = 1; i < n1; i++) {
if (a[i] == a[i + 1]) {
f = 1;
break;
}
}
if (f == 1)
cout << "NO" << endl;
else
cout << "YES" << endl;
return 0;
} | replace | 15 | 21 | 15 | 19 | TLE | |
p02779 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
bool flg = true;
cin >> n;
vector<long long> vec(n);
for (int i = 0; i < n; i++) {
cin >> vec.at(i);
}
sort(vec.begin(), vec.end());
for (int i = 0; i < n; i++) {
if (vec.at(i) == vec.at(i + 1)) {
cout << "NO" << endl;
flg = false;
break;
}
}
if (flg) {
cout << "YES" << endl;
}
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
bool flg = true;
cin >> n;
vector<long long> vec(n);
for (int i = 0; i < n; i++) {
cin >> vec.at(i);
}
sort(vec.begin(), vec.end());
for (int i = 0; i < n - 1; i++) {
if (vec.at(i) == vec.at(i + 1)) {
cout << "NO" << endl;
flg = false;
break;
}
}
if (flg) {
cout << "YES" << endl;
}
return 0;
} | replace | 14 | 15 | 14 | 15 | -6 | terminate called after throwing an instance of 'std::out_of_range'
what(): vector::_M_range_check: __n (which is 5) >= this->size() (which is 5)
|
p02779 | C++ | Runtime Error | #include <algorithm>
#include <array>
#include <bitset>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <valarray>
#include <vector>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <chrono>
#include <random>
#include <thread>
#include <unordered_map>
#include <unordered_set>
using namespace std;
#define all(c) c.begin(), c.end()
#define repeat(i, n) for (int i = 0; i < static_cast<int>(n); i++)
#define debug(x) #x << "=" << (x)
#ifdef DEBUG
#define dump(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define dump(x)
#endif
template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) {
os << "{";
for (auto it = v.begin(); it != v.end(); ++it) {
if (it != v.begin())
os << ",";
os << *it;
}
return os << "}";
}
template <typename A, typename B>
ostream &operator<<(ostream &os, const pair<A, B> &v) {
os << "{";
os << v.first << ", " << v.second;
return os << "}";
}
template <typename T> T input() {
T x;
cin >> x;
return x;
}
template <typename T> vector<T> input_vector(size_t n) {
vector<T> x(n);
for (int i = 0; i < n; i++) {
cin >> x[i];
}
}
// ---------------------------------------------------------------------------
using point = complex<double>;
using ll = long long;
int my_main(int argc, char **argv) {
ios::sync_with_stdio(false);
cin.tie(0);
int n = input<int>();
vector<int> a = input_vector<int>(n);
sort(all(a));
a.erase(unique(all(a)), a.end());
if (a.size() == n) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
return 0;
}
// ----------------------------------------------------------------------------
// Test driver
#ifdef DEBUG
#define MAY_RUN_TESTCASE
#endif
#ifdef MAY_RUN_TESTCASE
#include <fstream>
#if __has_include(<unistd.h>)
// Mac, Linux
#include <unistd.h>
#elif __has_include(<io.h>)
// Windows
#include <io.h>
#else
// Other?
#error "unistd.h or io.h not found"
#endif
bool test_file_exists(const std::string &str) {
std::ifstream fs(str);
return fs.is_open();
}
#endif
int main(int argc, char **argv) {
#ifndef MAY_RUN_TESTCASE
return my_main(argc, argv);
#else
if (argc == 1) {
return my_main(argc, argv);
} else if (argc == 2) {
char *stdin_file = argv[1];
freopen(stdin_file, "r", stdin);
return my_main(argc, argv);
} else if (argc == 5) {
std::string stdin_file = argv[1];
std::string expected_file = argv[2];
std::string stdout_file = argv[3];
std::string stderr_file = argv[4];
if (!test_file_exists(stdin_file)) {
std::cerr << stdin_file << " not found" << std::endl;
return 3;
}
if (!test_file_exists(expected_file)) {
std::cerr << expected_file << " not found" << std::endl;
return 3;
}
int original_stdin = dup(fileno(stdin));
int original_stdout = dup(fileno(stdout));
int original_stderr = dup(fileno(stderr));
freopen(stdin_file.c_str(), "r", stdin);
freopen(stdout_file.c_str(), "w", stdout);
freopen(stderr_file.c_str(), "w", stderr);
int ret = my_main(argc, argv);
fflush(stdout);
fflush(stderr);
dup2(original_stderr, fileno(stderr));
dup2(original_stdout, fileno(stdout));
dup2(original_stdin, fileno(stdin));
if (ret != 0) {
std::cerr << "main returns " << ret << std::endl;
return ret;
}
std::ifstream inp(stdin_file);
std::ifstream out(stdout_file);
std::ifstream err(stderr_file);
std::ifstream exp(expected_file);
// Clear is needed if the file is empty.
std::cout << "----- input -----" << std::endl;
std::cout << inp.rdbuf() << std::endl;
std::cout.clear();
std::cout << "-----------------" << std::endl << std::endl;
std::cout << "----- output ----" << std::endl;
std::cout << out.rdbuf() << std::endl;
std::cout.clear();
std::cout << "-----------------" << std::endl << std::endl;
std::cout << "---- expected ---" << std::endl;
std::cout << exp.rdbuf() << std::endl;
std::cout.clear();
std::cout << "-----------------" << std::endl << std::endl;
std::cout << "----- stderr ----" << std::endl;
std::cout << err.rdbuf() << std::endl;
std::cout.clear();
std::cout << "-----------------" << std::endl;
inp.seekg(0);
out.seekg(0);
exp.seekg(0);
err.seekg(0);
std::string output_str, expected_str;
{
std::stringstream output_ss;
output_ss << out.rdbuf();
output_str = output_ss.str();
std::stringstream expected_ss;
expected_ss << exp.rdbuf();
expected_str = expected_ss.str();
}
// Remove trailing spaces
output_str.erase(output_str.find_last_not_of(" \n\r\t") + 1);
expected_str.erase(expected_str.find_last_not_of(" \n\r\t") + 1);
if (output_str == expected_str)
return 0;
else
return 1;
}
return 1;
#endif
}
| #include <algorithm>
#include <array>
#include <bitset>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <valarray>
#include <vector>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <chrono>
#include <random>
#include <thread>
#include <unordered_map>
#include <unordered_set>
using namespace std;
#define all(c) c.begin(), c.end()
#define repeat(i, n) for (int i = 0; i < static_cast<int>(n); i++)
#define debug(x) #x << "=" << (x)
#ifdef DEBUG
#define dump(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define dump(x)
#endif
template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) {
os << "{";
for (auto it = v.begin(); it != v.end(); ++it) {
if (it != v.begin())
os << ",";
os << *it;
}
return os << "}";
}
template <typename A, typename B>
ostream &operator<<(ostream &os, const pair<A, B> &v) {
os << "{";
os << v.first << ", " << v.second;
return os << "}";
}
template <typename T> T input() {
T x;
cin >> x;
return x;
}
template <typename T> vector<T> input_vector(size_t n) {
vector<T> x(n);
for (int i = 0; i < n; i++) {
cin >> x[i];
}
return x;
}
// ---------------------------------------------------------------------------
using point = complex<double>;
using ll = long long;
int my_main(int argc, char **argv) {
ios::sync_with_stdio(false);
cin.tie(0);
int n = input<int>();
vector<int> a = input_vector<int>(n);
sort(all(a));
a.erase(unique(all(a)), a.end());
if (a.size() == n) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
return 0;
}
// ----------------------------------------------------------------------------
// Test driver
#ifdef DEBUG
#define MAY_RUN_TESTCASE
#endif
#ifdef MAY_RUN_TESTCASE
#include <fstream>
#if __has_include(<unistd.h>)
// Mac, Linux
#include <unistd.h>
#elif __has_include(<io.h>)
// Windows
#include <io.h>
#else
// Other?
#error "unistd.h or io.h not found"
#endif
bool test_file_exists(const std::string &str) {
std::ifstream fs(str);
return fs.is_open();
}
#endif
int main(int argc, char **argv) {
#ifndef MAY_RUN_TESTCASE
return my_main(argc, argv);
#else
if (argc == 1) {
return my_main(argc, argv);
} else if (argc == 2) {
char *stdin_file = argv[1];
freopen(stdin_file, "r", stdin);
return my_main(argc, argv);
} else if (argc == 5) {
std::string stdin_file = argv[1];
std::string expected_file = argv[2];
std::string stdout_file = argv[3];
std::string stderr_file = argv[4];
if (!test_file_exists(stdin_file)) {
std::cerr << stdin_file << " not found" << std::endl;
return 3;
}
if (!test_file_exists(expected_file)) {
std::cerr << expected_file << " not found" << std::endl;
return 3;
}
int original_stdin = dup(fileno(stdin));
int original_stdout = dup(fileno(stdout));
int original_stderr = dup(fileno(stderr));
freopen(stdin_file.c_str(), "r", stdin);
freopen(stdout_file.c_str(), "w", stdout);
freopen(stderr_file.c_str(), "w", stderr);
int ret = my_main(argc, argv);
fflush(stdout);
fflush(stderr);
dup2(original_stderr, fileno(stderr));
dup2(original_stdout, fileno(stdout));
dup2(original_stdin, fileno(stdin));
if (ret != 0) {
std::cerr << "main returns " << ret << std::endl;
return ret;
}
std::ifstream inp(stdin_file);
std::ifstream out(stdout_file);
std::ifstream err(stderr_file);
std::ifstream exp(expected_file);
// Clear is needed if the file is empty.
std::cout << "----- input -----" << std::endl;
std::cout << inp.rdbuf() << std::endl;
std::cout.clear();
std::cout << "-----------------" << std::endl << std::endl;
std::cout << "----- output ----" << std::endl;
std::cout << out.rdbuf() << std::endl;
std::cout.clear();
std::cout << "-----------------" << std::endl << std::endl;
std::cout << "---- expected ---" << std::endl;
std::cout << exp.rdbuf() << std::endl;
std::cout.clear();
std::cout << "-----------------" << std::endl << std::endl;
std::cout << "----- stderr ----" << std::endl;
std::cout << err.rdbuf() << std::endl;
std::cout.clear();
std::cout << "-----------------" << std::endl;
inp.seekg(0);
out.seekg(0);
exp.seekg(0);
err.seekg(0);
std::string output_str, expected_str;
{
std::stringstream output_ss;
output_ss << out.rdbuf();
output_str = output_ss.str();
std::stringstream expected_ss;
expected_ss << exp.rdbuf();
expected_str = expected_ss.str();
}
// Remove trailing spaces
output_str.erase(output_str.find_last_not_of(" \n\r\t") + 1);
expected_str.erase(expected_str.find_last_not_of(" \n\r\t") + 1);
if (output_str == expected_str)
return 0;
else
return 1;
}
return 1;
#endif
}
| insert | 71 | 71 | 71 | 73 | -6 | free(): invalid pointer
|
p02779 | C++ | Runtime Error | #include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <queue>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < n; i++)
#define dup(x, y) (((x) + (y)-1) / (y)) // dup * y >= x なる最小のdup.
using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;
int main() {
ll N;
cin >> N;
// vector<ll> A(N);
ll A;
vector<int> D(1000000000, 0);
string ans = "YES";
rep(i, N) {
cin >> A;
if (D[A] == 0) {
D[A] = 1;
} else {
ans = "NO";
break;
}
}
cout << ans << endl;
return 0;
} | #include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <queue>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < n; i++)
#define dup(x, y) (((x) + (y)-1) / (y)) // dup * y >= x なる最小のdup.
using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;
int main() {
ll N;
cin >> N;
// vector<ll> A(N);
ll A;
map<ll, int> D;
string ans = "YES";
rep(i, N) {
cin >> A;
if (D[A] == 0) {
D[A] = 1;
} else {
ans = "NO";
break;
}
}
cout << ans << endl;
return 0;
} | replace | 21 | 22 | 21 | 22 | -6 | terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
|
p02779 | C++ | Runtime Error | #include <bits/stdc++.h>
#define fo(i, a, b) for (int i = (a); i <= (b); ++i)
#define rv(i, a, b) for (int i = (a); i >= (b); --i)
using namespace std;
const int M = 120000;
typedef long long ll;
int n, m, k;
int a[M];
int main() {
cin >> n;
fo(i, 1, n) cin >> a[i];
sort(a + 1, a + 1 + n);
bool fg = 1;
fo(i, 1, n - 1) {
if (a[i] == a[i + 1])
fg = 0;
}
if (fg)
puts("YES");
else
puts("NO");
return 0;
} | #include <bits/stdc++.h>
#define fo(i, a, b) for (int i = (a); i <= (b); ++i)
#define rv(i, a, b) for (int i = (a); i >= (b); --i)
using namespace std;
const int M = 220000;
typedef long long ll;
int n, m, k;
int a[M];
int main() {
cin >> n;
fo(i, 1, n) cin >> a[i];
sort(a + 1, a + 1 + n);
bool fg = 1;
fo(i, 1, n - 1) {
if (a[i] == a[i + 1])
fg = 0;
}
if (fg)
puts("YES");
else
puts("NO");
return 0;
} | replace | 4 | 5 | 4 | 5 | 0 | |
p02779 | C++ | Time Limit Exceeded | #include <algorithm>
#include <cmath>
#include <iostream>
#include <stdio.h>
#include <vector>
#define rep(i, cc, n) for (int i = cc; i <= n; ++i)
#define drep(i, cc, n) for (int i = cc; i >= n; --i)
typedef long long ll;
using namespace std;
int main() {
int n;
cin >> n;
int a[n];
rep(i, 0, n - 1) cin >> a[i];
bool flag = false;
rep(i, 0, n - 1) {
rep(j, i + 1, n - 1) {
if (a[i] == a[j]) {
flag = true;
break;
}
if (flag)
break;
}
}
if (flag)
cout << "NO" << endl;
else
cout << "YES" << endl;
return 0;
} | #include <algorithm>
#include <cmath>
#include <iostream>
#include <stdio.h>
#include <vector>
#define rep(i, cc, n) for (int i = cc; i <= n; ++i)
#define drep(i, cc, n) for (int i = cc; i >= n; --i)
typedef long long ll;
using namespace std;
int main() {
int n;
cin >> n;
int a[n];
rep(i, 0, n - 1) cin >> a[i];
bool flag = false;
sort(a, a + n);
rep(i, 0, n - 2) {
if (a[i] == a[i + 1])
flag = true;
}
if (flag)
cout << "NO" << endl;
else
cout << "YES" << endl;
return 0;
} | replace | 15 | 24 | 15 | 19 | TLE | |
p02779 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> A(N);
for (int i = 0; i < N; i++) {
cin >> A[i];
}
for (int i = 0; i < N; i++) {
for (int j = i + 1; j < N; j++) {
if (A[i] == A[j]) {
cout << "NO" << endl;
return 0;
}
}
}
cout << "YES" << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> A(N);
for (int i = 0; i < N; i++) {
cin >> A[i];
}
sort(A.begin(), A.end());
for (int i = 0; i < N - 1; i++) {
if (A[i] == A[i + 1]) {
cout << "NO" << endl;
return 0;
}
}
cout << "YES" << endl;
return 0;
} | replace | 12 | 18 | 12 | 18 | TLE | |
p02779 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
#define rep(k, nu) for (int i = k; i < nu; i++)
#define rep2(k, n) for (int j = k; j < n; j++)
#define INF 1000000000000 // 1e+12
#define MOD 10000007 // 1e9+7
#define ll long long
#define pb pop_back
template <typename T> inline void chMin(T *a, T *b) {
if (*a > *b)
*a = *b;
}
template <typename T> inline void chMax(T *a, T *b) {
if (*a < *b)
*a = *b;
}
template <typename T> inline int divUp(T a, T b) { return ((a + b - 1) / b); }
const double PI = acos(-1);
int main() {
int n;
cin >> n;
vector<ll> a(n);
rep(0, n) cin >> a[i];
rep(0, n / 2) {
rep2(i + 1, n) {
if (a[i] == a[j]) {
cout << "NO" << endl;
return 0;
}
}
}
cout << "YES" << endl;
return 0;
}
/*
3 3
1 7
3 2
1 7
*/
| #include <bits/stdc++.h>
using namespace std;
#define rep(k, nu) for (int i = k; i < nu; i++)
#define rep2(k, n) for (int j = k; j < n; j++)
#define INF 1000000000000 // 1e+12
#define MOD 10000007 // 1e9+7
#define ll long long
#define pb pop_back
template <typename T> inline void chMin(T *a, T *b) {
if (*a > *b)
*a = *b;
}
template <typename T> inline void chMax(T *a, T *b) {
if (*a < *b)
*a = *b;
}
template <typename T> inline int divUp(T a, T b) { return ((a + b - 1) / b); }
const double PI = acos(-1);
int main() {
int n;
cin >> n;
vector<ll> a(n);
rep(0, n) cin >> a[i];
sort(a.begin(), a.end());
rep(0, n) {
if (a[i] == a[i + 1]) {
cout << "NO" << endl;
return 0;
}
}
cout << "YES" << endl;
return 0;
}
/*
3 3
1 7
3 2
1 7
*/
| replace | 25 | 31 | 25 | 30 | TLE | |
p02779 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
#define SPEED ios_base ::sync_with_stdio(false), cin.tie(NULL), cout.tie(0)
int main() {
SPEED;
int n, count = 0;
cin >> n;
int a[n];
for (int i = 0; i < n; i++)
cin >> a[i];
for (int j = 0; j < n; j++)
for (int k = j + 1; k < n; k++)
if (a[j] == a[k]) {
count = 1;
break;
}
if (count == 1)
cout << "NO";
else
cout << "YES";
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define SPEED ios_base ::sync_with_stdio(false), cin.tie(NULL), cout.tie(0)
int main() {
SPEED;
int n, count = 0;
cin >> n;
int a[n];
for (int i = 0; i < n; i++)
cin >> a[i];
sort(a, a + n);
for (int j = 0; j < n - 1; j++)
if (a[j] == a[j + 1]) {
count = 1;
break;
}
if (count == 1)
cout << "NO";
else
cout << "YES";
return 0;
} | replace | 10 | 16 | 10 | 16 | TLE | |
p02779 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
ll n;
cin >> n;
vector<ll> a(n);
int judge = 0;
for (ll i = 0; i < n; i++) {
cin >> a[i];
}
for (ll i = 0; i < n - 1; i++) {
for (ll j = i + 1; j < n; j++) {
if (a[i] == a[j]) {
judge = 1;
break;
}
}
}
if (judge == 0) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
ll n;
cin >> n;
vector<ll> a(n);
int judge = 0;
for (ll i = 0; i < n; i++) {
cin >> a[i];
}
sort(a.begin(), a.end());
for (int i = 0; i < n - 1; i++) {
if (a[i] == a[i + 1]) {
judge = 1;
break;
}
}
if (judge == 0) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
} | replace | 13 | 19 | 13 | 18 | TLE | |
p02779 | C++ | Runtime Error | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
const char *solve() {
int n;
cin >> n;
vector<int> a(n);
for (auto &i : a)
cin >> i;
sort(a.begin(), a.end());
for (int i = 1; i < a.size(); i++)
if (a[i] == a[i - 1])
return "NO";
}
int main() { cout << solve() << endl; } | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
const char *solve() {
int n;
cin >> n;
vector<int> a(n);
for (auto &i : a)
cin >> i;
sort(a.begin(), a.end());
for (int i = 1; i < a.size(); i++)
if (a[i] == a[i - 1])
return "NO";
return "YES";
}
int main() { cout << solve() << endl; } | insert | 14 | 14 | 14 | 15 | 0 | |
p02779 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<bool> vec(100000001);
bool ans = true;
for (int i = 0; i < n; ++i) {
int x;
cin >> x;
if (vec.at(x) == false)
vec.at(x) = true;
else
ans = false;
}
if (ans == true)
cout << "YES" << endl;
else
cout << "NO" << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<bool> vec(1000000001);
bool ans = true;
for (int i = 0; i < n; ++i) {
int x;
cin >> x;
if (vec.at(x) == false)
vec.at(x) = true;
else
ans = false;
}
if (ans == true)
cout << "YES" << endl;
else
cout << "NO" << endl;
} | replace | 6 | 7 | 6 | 7 | 0 | |
p02779 | C++ | Time Limit Exceeded | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main() {
unsigned int n;
vector<unsigned long long> a;
cin >> n;
a.resize(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if (a[i] == a[j] && i != j) {
cout << "NO";
return 0;
}
}
}
cout << "YES";
return 0;
} | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main() {
unsigned int n;
vector<unsigned long long> a;
cin >> n;
a.resize(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
sort(a.begin(), a.end());
for (int i = 0; i < n - 1; i++) {
if (a[i] == a[i + 1]) {
cout << "NO";
return 0;
}
}
cout << "YES";
return 0;
} | replace | 17 | 23 | 17 | 23 | TLE | |
p02779 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, x, n) for (int i = x; i < (n); i++)
#define ALL(n) begin(n), end(n)
using namespace std;
using ll = long long;
int main() {
int n;
string ans = "YES";
cin >> n;
vector<int> a(n);
rep(i, n) cin >> a[i];
rep(i, n - 1) {
for (int j = i + 1; j < n; j++) {
if (a[i] == a[j])
ans = "NO";
}
}
cout << ans << endl;
return 0;
} | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, x, n) for (int i = x; i < (n); i++)
#define ALL(n) begin(n), end(n)
using namespace std;
using ll = long long;
int main() {
int n;
string ans = "YES";
cin >> n;
vector<int> a(n);
rep(i, n) cin >> a[i];
sort(a.begin(), a.end());
rep(i, n - 1) if (a[i] == a[i + 1]) ans = "NO";
cout << ans << endl;
return 0;
} | replace | 13 | 19 | 13 | 15 | TLE | |
p02779 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
int main() {
long long n;
cin >> n;
long long a[n];
for (long long i = 0; i < n; i++) {
cin >> a[i];
}
long long ans = 0;
for (long long i = 0; i < n; i++) {
for (long long j = i + 1; j < n; j++) {
if (a[i] == a[j]) {
ans = 1;
break;
}
}
}
if (ans == 1) {
cout << "NO" << endl;
} else {
cout << "YES" << endl;
}
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
long long n;
cin >> n;
long long a[n];
for (long long i = 0; i < n; i++) {
cin >> a[i];
}
long long ans = 0;
sort(a, a + n);
for (long long i = 0; i < n - 1; i++) {
if (a[i] == a[i + 1]) {
ans = 1;
break;
}
}
if (ans == 1) {
cout << "NO" << endl;
} else {
cout << "YES" << endl;
}
return 0;
}
| replace | 10 | 16 | 10 | 15 | TLE | |
p02779 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
int main(void) {
// Your code here!
long long N;
cin >> N;
vector<int> A(N);
for (int i = 0; i < N; i++) {
cin >> A[i];
}
sort(A.begin(), A.end());
for (int i = 0; i < N - 1; i++) {
for (int j = i + 1; j < N; j++) {
if (A[i] == A[j]) {
cout << "NO" << endl;
return 0;
}
}
}
cout << "YES" << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main(void) {
// Your code here!
long long N;
cin >> N;
vector<int> A(N);
for (int i = 0; i < N; i++) {
cin >> A[i];
}
sort(A.begin(), A.end());
for (int i = 0; i < N - 1; i++) {
if (A[i] == A[i + 1]) {
cout << "NO" << endl;
return 0;
}
}
cout << "YES" << endl;
return 0;
}
| replace | 13 | 18 | 13 | 16 | TLE | |
p02779 | C++ | Runtime Error | // #include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
typedef long long int lo;
#define pb push_back
#define mp make_pair
#define st first
#define nd second
#define inf (lo)1e9
#define mod (lo)1e9 + 7
lo k, a, b, c, n;
string s1, s2, s3;
queue<pair<lo, lo>> q;
priority_queue<lo> pq;
map<lo, lo> mp1;
vector<lo> v[100005];
lo oyuncu;
set<lo> stt;
lo a1[100005];
int main() {
// freopen("gir.gir","r",stdin);
// freopen("cik.cik","w",stdout);
cin >> n;
for (lo i = 0; i < n; i++) {
cin >> a1[i];
mp1[a1[i]]++;
}
for (lo i = 0; i < n; i++) {
if (mp1[a1[i]] > 1) {
cout << "NO\n";
return 0;
}
}
cout << "YES\n";
return 0;
} | // #include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
typedef long long int lo;
#define pb push_back
#define mp make_pair
#define st first
#define nd second
#define inf (lo)1e9
#define mod (lo)1e9 + 7
lo k, a, b, c, n;
string s1, s2, s3;
queue<pair<lo, lo>> q;
priority_queue<lo> pq;
map<lo, lo> mp1;
vector<lo> v[100005];
lo oyuncu;
set<lo> stt;
lo a1[500005];
int main() {
// freopen("gir.gir","r",stdin);
// freopen("cik.cik","w",stdout);
cin >> n;
for (lo i = 0; i < n; i++) {
cin >> a1[i];
mp1[a1[i]]++;
}
for (lo i = 0; i < n; i++) {
if (mp1[a1[i]] > 1) {
cout << "NO\n";
return 0;
}
}
cout << "YES\n";
return 0;
} | replace | 25 | 26 | 25 | 26 | 0 | |
p02779 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define mod 1e9 + 7;
#define INF 1e9 + 9;
#define ps(x, y) fixed << setprecision(y) << x
#define PI 3.14159265358979323846264338327950 L
typedef long long ll;
typedef unsigned long long ull;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
int n;
cin >> n;
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
sort(a, a + n);
for (int i = 0; i < n - 1; i++) {
if (a[i] == a[i + 1]) {
cout << "NO\n";
return 0;
}
}
cout << "YES\n";
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define mod 1e9 + 7;
#define INF 1e9 + 9;
#define ps(x, y) fixed << setprecision(y) << x
#define PI 3.14159265358979323846264338327950 L
typedef long long ll;
typedef unsigned long long ull;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
#ifndef ONLINE_JUDGE
// freopen("input.txt","r",stdin);
// freopen("output.txt","w",stdout);
#endif
int n;
cin >> n;
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
sort(a, a + n);
for (int i = 0; i < n - 1; i++) {
if (a[i] == a[i + 1]) {
cout << "NO\n";
return 0;
}
}
cout << "YES\n";
return 0;
}
| replace | 14 | 16 | 14 | 16 | 0 | |
p02779 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> A(N);
for (int i = 0; i < N; i++) {
cin >> A.at(i);
}
bool ans = true;
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
if (A.at(i) == A.at(j) && i != j) {
ans = false;
break;
}
}
}
if (ans) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> A(N);
for (int i = 0; i < N; i++) {
cin >> A.at(i);
}
bool ans = true;
sort(A.begin(), A.end());
for (int i = 0; i < N - 1; i++) {
if (A.at(i) == A.at(i + 1)) {
ans = false;
break;
}
}
if (ans) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
}
| replace | 11 | 17 | 11 | 16 | TLE | |
p02779 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, a[1000];
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i];
}
sort(a, a + n);
for (int i = 0; i < n; i++) {
if (a[i] == a[i + 1]) {
cout << "NO" << endl;
return 0;
}
}
cout << "YES" << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int n, a[210000];
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i];
}
sort(a, a + n);
for (int i = 0; i < n; i++) {
if (a[i] == a[i + 1]) {
cout << "NO" << endl;
return 0;
}
}
cout << "YES" << endl;
}
| replace | 3 | 4 | 3 | 4 | 0 | |
p02779 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define eb emplace_back
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
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;
}
return 0;
}
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int const INF = 1001001001;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
vi a(n);
rep(i, n) cin >> a[i];
rep(i, n - 1) {
for (int j = i + 1; j < n; j++) {
if (a[i] == a[j]) {
cout << "NO" << endl;
return 0;
}
}
}
cout << "YES" << endl;
return 0;
} | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define eb emplace_back
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
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;
}
return 0;
}
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int const INF = 1001001001;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
vi a(n);
rep(i, n) cin >> a[i];
map<int, int> mp;
rep(i, n) mp[a[i]]++;
for (auto x : mp) {
if (x.second >= 2) {
cout << "NO" << endl;
return 0;
}
}
cout << "YES" << endl;
return 0;
} | replace | 43 | 49 | 43 | 51 | TLE | |
p02779 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
using P = pair<string, int>;
using ll = long long;
int main() {
ll n;
cin >> n;
vector<int> v(n);
rep(i, n) { cin >> v.at(i); }
sort(v.begin(), v.end());
bool ok = true;
for (int i = 0; i < n; i++) {
if (v.at(i) == v.at(i + 1)) {
ok = false;
break;
}
}
if (ok) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
} | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
using P = pair<string, int>;
using ll = long long;
int main() {
ll n;
cin >> n;
vector<int> v(n);
rep(i, n) { cin >> v.at(i); }
sort(v.begin(), v.end());
bool ok = true;
for (int i = 0; i < n - 1; i++) {
if (v.at(i) == v.at(i + 1)) {
ok = false;
break;
}
}
if (ok) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
} | replace | 13 | 14 | 13 | 14 | -6 | terminate called after throwing an instance of 'std::out_of_range'
what(): vector::_M_range_check: __n (which is 5) >= this->size() (which is 5)
|
p02779 | C++ | Runtime Error | #include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <stack>
#include <string>
using namespace std;
const int N = 1e4 + 5;
int n;
int a[N];
bool flag = false;
int main() {
int j = 1;
cin >> n;
for (int i = 1; i <= n; i++)
cin >> a[i];
sort(a + 1, a + n + 1);
for (int i = 1; i < n; i++) {
if (a[i] == a[i + 1]) {
puts("NO");
return 0;
}
}
puts("YES");
}
| #include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <stack>
#include <string>
using namespace std;
const int N = 1e8 + 5;
int n;
int a[N];
bool flag = false;
int main() {
int j = 1;
cin >> n;
for (int i = 1; i <= n; i++)
cin >> a[i];
sort(a + 1, a + n + 1);
for (int i = 1; i < n; i++) {
if (a[i] == a[i + 1]) {
puts("NO");
return 0;
}
}
puts("YES");
}
| replace | 7 | 8 | 7 | 8 | 0 | |
p02779 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
#define rep2(i, n) for (int i = 2; i < (int)(n); i++)
#define repk(i, k, n) for (int i = k; i < (int)(n); i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
// const int64 INF = 1LL << 58;
#define dame \
{ \
puts("-1"); \
return 0; \
}
#define YES \
{ \
cout << "YES" << endl; \
return 0; \
}
#define NO \
{ \
cout << "NO" << endl; \
return 0; \
}
#define Yes \
{ \
cout << "Yes" << endl; \
return 0; \
}
#define No \
{ \
cout << "No" << endl; \
return 0; \
}
template <class T> bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> bool chmin(T &a, const T &b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
ll n;
cin >> n;
vl a(n);
rep(i, n) cin >> a[i];
rep(i, n) {
repk(j, i, n) {
if (a[i] == a[j] && i != j) {
NO;
return 0;
}
}
}
YES;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
#define rep2(i, n) for (int i = 2; i < (int)(n); i++)
#define repk(i, k, n) for (int i = k; i < (int)(n); i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
// const int64 INF = 1LL << 58;
#define dame \
{ \
puts("-1"); \
return 0; \
}
#define YES \
{ \
cout << "YES" << endl; \
return 0; \
}
#define NO \
{ \
cout << "NO" << endl; \
return 0; \
}
#define Yes \
{ \
cout << "Yes" << endl; \
return 0; \
}
#define No \
{ \
cout << "No" << endl; \
return 0; \
}
template <class T> bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> bool chmin(T &a, const T &b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
ll n;
cin >> n;
vl a(n);
rep(i, n) cin >> a[i];
sort(all(a));
rep(i, n - 1) {
if (a[i] == a[i + 1]) {
NO;
return 0;
}
}
YES;
return 0;
} | replace | 85 | 91 | 85 | 90 | TLE | |
p02779 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int x[n];
for (int i = 0; i < n; i++) {
cin >> x[i];
}
for (int i = 0; i < n; i++) {
for (int j = i + 1; j < n; j++) {
if (x[i] == x[j]) {
cout << "NO" << endl;
return 0;
}
}
}
cout << "YES" << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int x[n];
for (int i = 0; i < n; i++) {
cin >> x[i];
}
sort(x, x + n);
for (int i = 0; i < n - 1; i++) {
if (x[i + 1] == x[i]) {
cout << "NO" << endl;
return 0;
}
}
cout << "YES" << endl;
} | replace | 11 | 17 | 11 | 16 | TLE | |
p02779 | C++ | Runtime Error | #include <bits/stdc++.h>
// #include<boost/multiprecision/cpp_int.hpp>
#define fl(i, a, n) for (int i = a; i <= n; i++)
#define pb push_back
#define pob pop_back
#define int long long int
#define ff first
#define ss second
#define pi 3.1415926535898
#define vi vector<int>
#define mi map<int, int>
#define umi unordered_map<int, int>
#define endl "\n"
#define w(x) \
int x; \
cin >> x; \
while (x--)
#define db(x) cout << (#x) << " " << (x) << "\n";
#define ios \
ios_base::sync_with_stdio(0); \
cin.tie(NULL); \
cout.tie(NULL);
using namespace std;
// using namespace boost::multiprecision;
int mod = 1000000007;
int gcd(int a, int b) { return (b == 0) ? a : gcd(b, a % b); }
int lcm(int a, int b) { return (a * b) / gcd(a, b); }
void c_p_c() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
}
bool ispalindrome(string s) {
for (int i = 0; i <= s.length() / 2; i++) {
if (s[i] != s[s.length() - 1 - i]) {
return 0;
}
}
return 1;
}
class cust {
public:
int t;
int l;
int h;
};
int32_t main() {
ios c_p_c();
// w(t)
{
int n;
cin >> n;
vi v(n);
mi mp;
fl(i, 0, n - 1) {
cin >> v[i];
mp[v[i]]++;
}
if (mp.size() == n) {
cout << "YES\n";
} else {
cout << "NO\n";
}
}
return 0;
}
| #include <bits/stdc++.h>
// #include<boost/multiprecision/cpp_int.hpp>
#define fl(i, a, n) for (int i = a; i <= n; i++)
#define pb push_back
#define pob pop_back
#define int long long int
#define ff first
#define ss second
#define pi 3.1415926535898
#define vi vector<int>
#define mi map<int, int>
#define umi unordered_map<int, int>
#define endl "\n"
#define w(x) \
int x; \
cin >> x; \
while (x--)
#define db(x) cout << (#x) << " " << (x) << "\n";
#define ios \
ios_base::sync_with_stdio(0); \
cin.tie(NULL); \
cout.tie(NULL);
using namespace std;
// using namespace boost::multiprecision;
int mod = 1000000007;
int gcd(int a, int b) { return (b == 0) ? a : gcd(b, a % b); }
int lcm(int a, int b) { return (a * b) / gcd(a, b); }
void c_p_c() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
}
bool ispalindrome(string s) {
for (int i = 0; i <= s.length() / 2; i++) {
if (s[i] != s[s.length() - 1 - i]) {
return 0;
}
}
return 1;
}
class cust {
public:
int t;
int l;
int h;
};
int32_t main() {
ios
// c_p_c();
// w(t)
{
int n;
cin >> n;
vi v(n);
mi mp;
fl(i, 0, n - 1) {
cin >> v[i];
mp[v[i]]++;
}
if (mp.size() == n) {
cout << "YES\n";
} else {
cout << "NO\n";
}
}
return 0;
}
| replace | 52 | 53 | 52 | 54 | -6 | terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.