problem_id stringlengths 6 6 | buggy_code stringlengths 8 526k ⌀ | fixed_code stringlengths 12 526k ⌀ | labels listlengths 0 15 ⌀ | buggy_submission_id int64 1 1.54M ⌀ | fixed_submission_id int64 2 1.54M ⌀ | user_id stringlengths 10 10 ⌀ | language stringclasses 9 values |
|---|---|---|---|---|---|---|---|
p03003 | #include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
// c++11
#include <array>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#define mp make_pair
#define mt make_tuple
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
template <class T> using max_priority_queue = priority_queue<T>;
template <class T>
using min_priority_queue = priority_queue<T, std::vector<T>, std::greater<T>>;
const int INF = 1 << 29;
const ll LL_INF = 1LL << 60;
const double EPS = 1e-9;
const ll MOD = 1000000007;
const int dx[] = {1, 0, -1, 0}, dy[] = {0, -1, 0, 1};
const int MAX_N = 2010;
int N, M;
vector<int> S;
vector<int> T;
int dp[MAX_N][MAX_N];
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
cin >> N >> M;
S.resize(N);
T.resize(M);
for (auto &val : S) {
cin >> val;
}
for (auto &val : T) {
cin >> val;
}
dp[0][0] = 1;
for (int i = 0; i < S.size(); i++) {
dp[i][0] = 1;
}
for (int i = 0; i < T.size(); i++) {
dp[0][i] = 1;
}
for (int i = 0; i < N; i++) {
for (int j = 0; j < M; j++) {
if (S[i] == T[j]) {
dp[i + 1][j + 1] += dp[i][j];
}
dp[i + 1][j + 1] += dp[i][j + 1];
dp[i + 1][j + 1] %= MOD;
dp[i + 1][j + 1] += dp[i + 1][j];
dp[i + 1][j + 1] %= MOD;
dp[i + 1][j + 1] += MOD - dp[i][j];
dp[i + 1][j + 1] %= MOD;
}
}
cout << dp[N][M] + 2 << endl;
return 0;
}
| #include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
// c++11
#include <array>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#define mp make_pair
#define mt make_tuple
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
template <class T> using max_priority_queue = priority_queue<T>;
template <class T>
using min_priority_queue = priority_queue<T, std::vector<T>, std::greater<T>>;
const int INF = 1 << 29;
const ll LL_INF = 1LL << 60;
const double EPS = 1e-9;
const ll MOD = 1000000007;
const int dx[] = {1, 0, -1, 0}, dy[] = {0, -1, 0, 1};
const int MAX_N = 2010;
int N, M;
vector<int> S;
vector<int> T;
int dp[MAX_N][MAX_N];
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
cin >> N >> M;
S.resize(N);
T.resize(M);
for (auto &val : S) {
cin >> val;
}
for (auto &val : T) {
cin >> val;
}
dp[0][0] = 1;
for (int i = 0; i <= S.size(); i++) {
dp[i][0] = 1;
}
for (int i = 0; i <= T.size(); i++) {
dp[0][i] = 1;
}
for (int i = 0; i < N; i++) {
for (int j = 0; j < M; j++) {
if (S[i] == T[j]) {
dp[i + 1][j + 1] += dp[i][j];
}
dp[i + 1][j + 1] += dp[i][j + 1];
dp[i + 1][j + 1] %= MOD;
dp[i + 1][j + 1] += dp[i + 1][j];
dp[i + 1][j + 1] %= MOD;
dp[i + 1][j + 1] += MOD - dp[i][j];
dp[i + 1][j + 1] %= MOD;
}
}
cout << dp[N][M] << endl;
return 0;
}
| [
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change",
"expression.operation.binary.remove"
] | 818,221 | 818,222 | u976162616 | cpp |
p03003 | #include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define FOR(i, s, n) for (int i = (int)(s); i < (int)(n); ++i)
#define ALL(n) (n).begin(), (n).end()
#define pb push_back
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> mat;
// mat dtable(M, vl(N, 0)); M行N列 のサイズで,0で初期化
const ll MAX_V = 100000;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
int main() {
int N, M;
cin >> N >> M;
vl S(N + 1), T(M + 1);
REP(i, N) cin >> S[i];
REP(i, M) cin >> T[i];
mat dp(N + 1, vl(M + 1, 0));
FOR(i, 1, N + 1) {
FOR(j, 1, M + 1) {
if (T[j - 1] == S[i - 1]) {
dp[i][j] = (dp[i][j - 1] + dp[i - 1][j] + 1) % MOD;
} else {
dp[i][j] =
(((dp[i][j - 1] + dp[i - 1][j]) % MOD) - dp[i - 1][j - 1]) % MOD;
}
}
}
cout << ((dp[N][M] + 1) % MOD) << endl;
} | #include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define FOR(i, s, n) for (int i = (int)(s); i < (int)(n); ++i)
#define ALL(n) (n).begin(), (n).end()
#define pb push_back
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> mat;
// mat dtable(M, vl(N, 0)); M行N列 のサイズで,0で初期化
const ll MAX_V = 100000;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
int main() {
int N, M;
cin >> N >> M;
vl S(N + 1), T(M + 1);
REP(i, N) cin >> S[i];
REP(i, M) cin >> T[i];
mat dp(N + 1, vl(M + 1, 0));
FOR(i, 1, N + 1) {
FOR(j, 1, M + 1) {
if (T[j - 1] == S[i - 1]) {
dp[i][j] = ((dp[i][j - 1] + dp[i - 1][j]) + 1) % MOD;
} else {
dp[i][j] =
(((dp[i][j - 1] + dp[i - 1][j]) % MOD) + MOD - dp[i - 1][j - 1]) %
MOD;
}
}
}
cout << ((dp[N][M] + 1) % MOD) << endl;
} | [
"assignment.change"
] | 818,247 | 818,248 | u963682312 | cpp |
p03003 | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep1(i, n) for (int i = 1; i <= n; i++)
#define pb push_back
#define mp make_pair
#define IOS ios_base::sync_with_stdio(false), cin.tie(0);
#define F first
#define S second
using namespace std;
typedef long long ll;
ll a, b, c;
const ll maxn = 200005;
const ll mod = 1e9 + 7;
typedef pair<ll, ll> pii;
ll num[100005];
ll n, k, m;
ll sum[100005];
ll s[2005], t[2005];
ll dp[2005][2005];
int main() {
// IOS
while (cin >> n >> m) {
rep(i, n) cin >> s[i];
rep(i, m) cin >> t[i];
for (int i = 0; i <= n; i++)
for (int j = 0; j <= m; j++)
dp[i][j] = 0;
rep1(i, n) {
rep1(j, m) {
if (s[i - 1] == t[j - 1]) {
dp[i][j] = ((1 + dp[i][j - 1]) % mod + dp[i - 1][j]) % mod;
} else {
dp[i][j] =
((dp[i][j - 1] + dp[i - 1][j]) % mod - dp[i - 1][j - 1]) % mod;
}
// cout<<i<<" "<<j<<" "<<dp[i][j]<<"\n";
}
}
cout << (dp[n][m] + 1) % mod << "\n";
}
}
| #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep1(i, n) for (int i = 1; i <= n; i++)
#define pb push_back
#define mp make_pair
#define IOS ios_base::sync_with_stdio(false), cin.tie(0);
#define F first
#define S second
using namespace std;
typedef long long ll;
ll a, b, c;
const ll maxn = 200005;
const ll mod = 1e9 + 7;
typedef pair<ll, ll> pii;
ll num[100005];
ll n, k, m;
ll sum[100005];
ll s[2005], t[2005];
ll dp[2005][2005];
int main() {
// IOS
// cout<<(-5)%mod<<"\n";
while (cin >> n >> m) {
rep(i, n) cin >> s[i];
rep(i, m) cin >> t[i];
for (int i = 0; i <= n; i++)
for (int j = 0; j <= m; j++)
dp[i][j] = 0;
rep1(i, n) {
rep1(j, m) {
if (s[i - 1] == t[j - 1]) {
dp[i][j] = ((1 + dp[i][j - 1]) % mod + dp[i - 1][j]) % mod;
} else {
dp[i][j] =
((dp[i][j - 1] + dp[i - 1][j]) % mod + mod - dp[i - 1][j - 1]) %
mod;
}
// cout<<i<<" "<<j<<" "<<dp[i][j]<<"\n";
}
}
cout << (dp[n][m] + 1) % mod << "\n";
}
}
| [
"assignment.change"
] | 818,324 | 818,325 | u856205835 | cpp |
p03003 | #include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second
/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 0> { using type = T; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
template <class T> inline void chmin(T &a, const T& b) { if (b < a) a = b; }
template <class T> inline void chmax(T &a, const T& b) { if (b > a) a = b; }
/* clang-format on */
template <std::uint_fast64_t Modulus> class modint {
using u64 = std::uint_fast64_t;
public:
u64 a;
constexpr modint(const u64 x = 0) noexcept : a(x % Modulus) {}
constexpr u64 &value() noexcept { return a; }
constexpr const u64 &value() const noexcept { return a; }
constexpr modint operator+(const modint rhs) const noexcept {
return modint(*this) += rhs;
}
constexpr modint operator-(const modint rhs) const noexcept {
return modint(*this) -= rhs;
}
constexpr modint operator*(const modint rhs) const noexcept {
return modint(*this) *= rhs;
}
constexpr modint operator/(const modint rhs) const noexcept {
return modint(*this) /= rhs;
}
constexpr modint &operator+=(const modint rhs) noexcept {
a += rhs.a;
if (a >= Modulus) {
a -= Modulus;
}
return *this;
}
constexpr modint &operator-=(const modint rhs) noexcept {
if (a < rhs.a) {
a += Modulus;
}
a -= rhs.a;
return *this;
}
constexpr modint &operator*=(const modint rhs) noexcept {
a = a * rhs.a % Modulus;
return *this;
}
constexpr modint &operator/=(const modint rhs) noexcept {
return *this *= ~rhs;
}
constexpr modint operator^(u64 exp) const noexcept {
modint v = 1, x = *this;
while (exp) {
if (exp & 1) {
v *= x;
}
x *= x;
exp >>= 1;
}
return v;
}
constexpr modint operator~() const noexcept { return *this ^ (Modulus - 2); }
};
using mint = modint<1000000007>;
int main() {
#ifdef DEBUG
ifstream ifs("in.txt");
cin.rdbuf(ifs.rdbuf());
#endif
int N, M;
while (cin >> N >> M) {
vector<int> S(N), T(M);
for (int &x : S)
cin >> x;
for (int &x : T)
cin >> x;
vec<mint, 2> dp = make_v(N + 1, M + 1, mint(0));
dp[0][0] = 1;
for (int i = 0; i < N; i++) {
for (int j = 0; j < M; j++) {
dp[i + 1][j + 1] += dp[i][j + 1];
dp[i + 1][j + 1] += dp[i + 1][j];
dp[i + 1][j + 1] -= dp[i][j];
if (S[i] == T[j]) {
dp[i + 1][j + 1] += dp[i][j] + 1;
}
}
}
mint res = dp[N][M] + 1;
cout << res.value() << endl;
}
return 0;
}
| #include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second
/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 0> { using type = T; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
template <class T> inline void chmin(T &a, const T& b) { if (b < a) a = b; }
template <class T> inline void chmax(T &a, const T& b) { if (b > a) a = b; }
/* clang-format on */
template <std::uint_fast64_t Modulus> class modint {
using u64 = std::uint_fast64_t;
public:
u64 a;
constexpr modint(const u64 x = 0) noexcept : a(x % Modulus) {}
constexpr u64 &value() noexcept { return a; }
constexpr const u64 &value() const noexcept { return a; }
constexpr modint operator+(const modint rhs) const noexcept {
return modint(*this) += rhs;
}
constexpr modint operator-(const modint rhs) const noexcept {
return modint(*this) -= rhs;
}
constexpr modint operator*(const modint rhs) const noexcept {
return modint(*this) *= rhs;
}
constexpr modint operator/(const modint rhs) const noexcept {
return modint(*this) /= rhs;
}
constexpr modint &operator+=(const modint rhs) noexcept {
a += rhs.a;
if (a >= Modulus) {
a -= Modulus;
}
return *this;
}
constexpr modint &operator-=(const modint rhs) noexcept {
if (a < rhs.a) {
a += Modulus;
}
a -= rhs.a;
return *this;
}
constexpr modint &operator*=(const modint rhs) noexcept {
a = a * rhs.a % Modulus;
return *this;
}
constexpr modint &operator/=(const modint rhs) noexcept {
return *this *= ~rhs;
}
constexpr modint operator^(u64 exp) const noexcept {
modint v = 1, x = *this;
while (exp) {
if (exp & 1) {
v *= x;
}
x *= x;
exp >>= 1;
}
return v;
}
constexpr modint operator~() const noexcept { return *this ^ (Modulus - 2); }
};
using mint = modint<1000000007>;
int main() {
#ifdef DEBUG
ifstream ifs("in.txt");
cin.rdbuf(ifs.rdbuf());
#endif
int N, M;
while (cin >> N >> M) {
vector<int> S(N), T(M);
for (int &x : S)
cin >> x;
for (int &x : T)
cin >> x;
vec<mint, 2> dp = make_v(N + 1, M + 1, mint(0));
dp[0][0] = 0;
for (int i = 0; i < N; i++) {
for (int j = 0; j < M; j++) {
dp[i + 1][j + 1] += dp[i][j + 1];
dp[i + 1][j + 1] += dp[i + 1][j];
dp[i + 1][j + 1] -= dp[i][j];
if (S[i] == T[j]) {
dp[i + 1][j + 1] += dp[i][j] + 1;
}
}
}
mint res = dp[N][M] + 1;
cout << res.value() << endl;
}
return 0;
}
| [
"literal.number.change",
"assignment.value.change"
] | 818,350 | 818,351 | u107292917 | cpp |
p03003 | /*input
20 20
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
*/
#include <bits/stdc++.h>
using namespace std;
#define TEMPLATE
#ifdef TEMPLATE
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ld, ld> pd;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef vector<pi> vpi;
typedef vector<vpi> vpii;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
typedef vector<pd> vpd;
typedef vector<bool> vb;
typedef vector<vb> vbb;
typedef std::string str;
typedef std::vector<str> vs;
#define x first
#define y second
#define debug(...) cout << "[" << #__VA_ARGS__ << ": " << __VA_ARGS__ << "]\n"
const int MOD = 1000000007;
const ll INF = std::numeric_limits<ll>::max();
const int MX = 100101;
const ld PI =
3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270L;
template <typename T>
pair<T, T> operator+(const pair<T, T> &a, const pair<T, T> &b) {
return pair<T, T>(a.x + b.x, a.y + b.y);
}
template <typename T>
pair<T, T> operator-(const pair<T, T> &a, const pair<T, T> &b) {
return pair<T, T>(a.x - b.x, a.y - b.y);
}
template <typename T> T operator*(const pair<T, T> &a, const pair<T, T> &b) {
return (a.x * b.x + a.y * b.y);
}
template <typename T> T operator^(const pair<T, T> &a, const pair<T, T> &b) {
return (a.x * b.y - a.y * b.x);
}
template <typename T> void print(vector<T> vec, string name = "") {
cout << name;
for (auto u : vec)
cout << u << ' ';
cout << '\n';
}
#endif
struct FENWICK {
// queries [1:N]
vector<ll> A;
int N;
FENWICK(int n) : N(n) { A.resize(n + 1, 0); }
void add(int i, ll x) {
for (; i <= N; i += (i) & (-i))
A[i] = (x + A[i]) % MOD;
}
ll getQ(int i) {
ll get = 1;
for (; i > 0; i -= (i) & (-i))
get = (A[i] + get) % MOD;
return get;
}
};
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int N, M;
cin >> N >> M;
vi pir(N);
vi ant(M);
for (int i = 0; i < N; ++i)
cin >> pir[i];
for (int i = 0; i < M; ++i)
cin >> ant[i];
FENWICK sums(M);
for (int i = 0; i < N; ++i)
for (int j = M - 1; j >= 0; --j)
if (pir[i] == ant[j])
sums.add(j + 1, sums.getQ(j));
printf("%lld\n", sums.getQ(N));
}
/* Look for:
* special cases (n=1?)
* overflow (ll vs int?)
* the exact constraints (multiple sets are too slow for n=10^6 :( )
* array bounds
*/
| /*input
20 20
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
*/
#include <bits/stdc++.h>
using namespace std;
#define TEMPLATE
#ifdef TEMPLATE
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ld, ld> pd;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef vector<pi> vpi;
typedef vector<vpi> vpii;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
typedef vector<pd> vpd;
typedef vector<bool> vb;
typedef vector<vb> vbb;
typedef std::string str;
typedef std::vector<str> vs;
#define x first
#define y second
#define debug(...) cout << "[" << #__VA_ARGS__ << ": " << __VA_ARGS__ << "]\n"
const int MOD = 1000000007;
const ll INF = std::numeric_limits<ll>::max();
const int MX = 100101;
const ld PI =
3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270L;
template <typename T>
pair<T, T> operator+(const pair<T, T> &a, const pair<T, T> &b) {
return pair<T, T>(a.x + b.x, a.y + b.y);
}
template <typename T>
pair<T, T> operator-(const pair<T, T> &a, const pair<T, T> &b) {
return pair<T, T>(a.x - b.x, a.y - b.y);
}
template <typename T> T operator*(const pair<T, T> &a, const pair<T, T> &b) {
return (a.x * b.x + a.y * b.y);
}
template <typename T> T operator^(const pair<T, T> &a, const pair<T, T> &b) {
return (a.x * b.y - a.y * b.x);
}
template <typename T> void print(vector<T> vec, string name = "") {
cout << name;
for (auto u : vec)
cout << u << ' ';
cout << '\n';
}
#endif
struct FENWICK {
// queries [1:N]
vector<ll> A;
int N;
FENWICK(int n) : N(n) { A.resize(n + 1, 0); }
void add(int i, ll x) {
for (; i <= N; i += (i) & (-i))
A[i] = (x + A[i]) % MOD;
}
ll getQ(int i) {
ll get = 1;
for (; i > 0; i -= (i) & (-i))
get = (A[i] + get) % MOD;
return get;
}
};
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int N, M;
cin >> N >> M;
vi pir(N);
vi ant(M);
for (int i = 0; i < N; ++i)
cin >> pir[i];
for (int i = 0; i < M; ++i)
cin >> ant[i];
FENWICK sums(M);
for (int i = 0; i < N; ++i)
for (int j = M - 1; j >= 0; --j)
if (pir[i] == ant[j])
sums.add(j + 1, sums.getQ(j));
printf("%lld\n", sums.getQ(M));
}
/* Look for:
* special cases (n=1?)
* overflow (ll vs int?)
* the exact constraints (multiple sets are too slow for n=10^6 :( )
* array bounds
*/
| [
"identifier.change",
"call.arguments.change",
"io.output.change"
] | 818,396 | 818,397 | u725463576 | cpp |
p03003 | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repf(i, j, n) for (int i = (j); i < (n); i++)
#define repe(i, j, n) for (int i = (j); i <= (n); i++)
#define repr(i, j, n) for (int i = (n)-1; i >= 0; i--)
int mod = 1e9 + 7;
signed main() {
int n, m;
cin >> n >> m;
vector<int> s(n), t(m);
rep(i, n) cin >> s[i];
rep(i, m) cin >> t[i];
vector<vector<int>> dp(n + 1, vector<int>(m + 1, 0));
dp[0][0] = 1;
rep(i, n + 1) rep(j, m + 1) {
if (i > 0)
(dp[i][j] += dp[i - 1][j]) %= mod;
if (j > 0)
(dp[i][j] += dp[i][j - 1]) %= mod;
if (i > 0 && j > 0 && s[i] != t[j])
(dp[i][j] += mod - dp[i - 1][j - 1]) %= mod;
}
cout << dp[n][m] << endl;
}
| #include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repf(i, j, n) for (int i = (j); i < (n); i++)
#define repe(i, j, n) for (int i = (j); i <= (n); i++)
#define repr(i, j, n) for (int i = (n)-1; i >= 0; i--)
int mod = 1e9 + 7;
signed main() {
int n, m;
cin >> n >> m;
vector<int> s(n), t(m);
rep(i, n) cin >> s[i];
rep(i, m) cin >> t[i];
vector<vector<int>> dp(n + 1, vector<int>(m + 1, 0));
dp[0][0] = 1;
rep(i, n + 1) rep(j, m + 1) {
if (i > 0)
(dp[i][j] += dp[i - 1][j]) %= mod;
if (j > 0)
(dp[i][j] += dp[i][j - 1]) %= mod;
if (i > 0 && j > 0 && s[i - 1] != t[j - 1])
(dp[i][j] += mod - dp[i - 1][j - 1]) %= mod;
}
cout << dp[n][m] << endl;
}
| [
"control_flow.branch.if.condition.change"
] | 818,402 | 818,403 | u731175398 | cpp |
p03003 | #include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <vector>
using namespace std;
const int mod = (int)1e9 + 7;
const int N = 2005;
int n, m;
int dp[N][N];
int a[N], b[N];
inline void add(int &a, int b) {
a += b;
if (a >= mod)
a -= mod;
}
inline void sub(int &a, int b) {
a -= b;
if (a < mod)
a += mod;
}
int main() {
cin >> n >> m;
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
for (int i = 1; i <= m; i++) {
cin >> b[i];
}
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
add(dp[i][j], dp[i - 1][j]);
add(dp[i][j], dp[i][j - 1]);
sub(dp[i][j], dp[i - 1][j - 1]);
if (a[i] == b[j]) {
add(dp[i][j], dp[i - 1][j - 1] + 1);
}
}
}
cout << (dp[n][m] + 1) % mod << endl;
return 0;
}
| #include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <vector>
using namespace std;
const int mod = (int)1e9 + 7;
const int N = 2005;
int n, m;
int dp[N][N];
int a[N], b[N];
inline void add(int &a, int b) {
a += b;
if (a >= mod)
a -= mod;
}
inline void sub(int &a, int b) {
a -= b;
if (a < 0)
a += mod;
}
int main() {
cin >> n >> m;
for (int i = 1; i <= n; i++)
cin >> a[i];
for (int i = 1; i <= m; i++)
cin >> b[i];
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
add(dp[i][j], dp[i - 1][j]);
add(dp[i][j], dp[i][j - 1]);
sub(dp[i][j], dp[i - 1][j - 1]);
if (a[i] == b[j]) {
add(dp[i][j], dp[i - 1][j - 1] + 1);
}
}
}
cout << (dp[n][m] + 1) % mod << endl;
return 0;
}
| [
"identifier.replace.remove",
"literal.replace.add",
"control_flow.branch.if.condition.change"
] | 818,412 | 818,413 | u957188497 | cpp |
p03003 | #include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#define mst(a, b) memset(a, b, sizeof(a))
#define repi(a, b) for (int i = a; i < b; i++)
#define repj(a, b) for (int j = a; j < b; j++)
#define pii pair<int, int>
#ifdef LOCAL
#define fre() freopen("in.txt", "r", stdin)
#endif
#ifndef LOCAL
#define fre()
#endif
// static int x = []() {
// std::ios::sync_with_stdio(false);
// std::cin.tie(NULL);
// return 0;
//}();
#define FASTIO
#ifdef FASTIO
#define IOS ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
//#define scanf abcabc
//#define printf abcabc
#endif
//#ifndef FASTIO
//#define cin abcabc
//#define cout abcabc
//#endif
typedef long long ll;
typedef unsigned long long ull;
const int INF = 0x3f3f3f3f;
const ll LLINF = 0x3f3f3f3f3f3f3f3f;
using namespace std;
const int mod = 1e9 + 7;
ll dp[2010][2010], a[2010], b[2010];
int main() {
int n, m;
cin >> n >> m;
repi(0, n) cin >> a[i];
repi(0, n) cin >> b[i];
repi(0, n + 1) dp[i][0] = 1;
repi(0, m + 1) dp[0][i] = 1;
repi(1, n + 1) repj(1, m + 1) {
// dp[i][j] = (dp[i - 1][j] + dp[i][j - 1] - dp[i - 1][j - 1] + mod) % mod;
// if (a[i - 1] == b[j - 1])dp[i][j] = (dp[i - 1][j - 1] + dp[i][j]) % mod;
dp[i][j] = dp[i - 1][j] + dp[i][j - 1];
if (a[i - 1] != b[j - 1])
dp[i][j] -= dp[i - 1][j - 1];
dp[i][j] = (dp[i][j] + 10 * mod) % mod;
}
cout << dp[n][m] << endl;
return 0;
} | #include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#define mst(a, b) memset(a, b, sizeof(a))
#define repi(a, b) for (int i = a; i < b; i++)
#define repj(a, b) for (int j = a; j < b; j++)
#define pii pair<int, int>
#ifdef LOCAL
#define fre() freopen("in.txt", "r", stdin)
#endif
#ifndef LOCAL
#define fre()
#endif
// static int x = []() {
// std::ios::sync_with_stdio(false);
// std::cin.tie(NULL);
// return 0;
//}();
#define FASTIO
#ifdef FASTIO
#define IOS ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
//#define scanf abcabc
//#define printf abcabc
#endif
//#ifndef FASTIO
//#define cin abcabc
//#define cout abcabc
//#endif
typedef long long ll;
typedef unsigned long long ull;
const int INF = 0x3f3f3f3f;
const ll LLINF = 0x3f3f3f3f3f3f3f3f;
using namespace std;
const int mod = 1e9 + 7;
ll dp[2010][2010], a[2010], b[2010];
int main() {
int n, m;
cin >> n >> m;
repi(0, n) cin >> a[i];
repi(0, m) cin >> b[i];
repi(0, n + 1) dp[i][0] = 1;
repi(0, m + 1) dp[0][i] = 1;
repi(1, n + 1) repj(1, m + 1) {
// dp[i][j] = (dp[i - 1][j] + dp[i][j - 1] - dp[i - 1][j - 1] + mod) % mod;
// if (a[i - 1] == b[j - 1])dp[i][j] = (dp[i - 1][j - 1] + dp[i][j]) % mod;
dp[i][j] = dp[i - 1][j] + dp[i][j - 1];
if (a[i - 1] != b[j - 1])
dp[i][j] -= dp[i - 1][j - 1];
dp[i][j] = (dp[i][j] + mod) % mod;
}
cout << dp[n][m] << endl;
return 0;
} | [
"identifier.change",
"call.arguments.change",
"expression.operation.binary.remove"
] | 818,418 | 818,419 | u401146093 | cpp |
p03003 | #include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
using ll = long long;
using pll = pair<ll, ll>;
#define FOR(i, begin, end) \
for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) \
for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FI first
#define SE second
#define endl "\n"
#define ciosup \
cin.tie(0); \
ios::sync_with_stdio(false);
#define eb emplace_back
#define vint vector<int>
constexpr ll INF = 1e9 + 7;
constexpr ll MOD = 1e9 + 7;
int n, m;
vint s(2005), t(2005);
ll dp[2005][2005];
int main() {
ciosup;
cin >> n >> m;
REP(i, n) cin >> s[i];
REP(i, m) cin >> t[i];
REP(i, n + 1) dp[i][0] = 1;
REP(i, m + 1) dp[0][i] = 1;
REP(i, n) {
REP(j, m) {
if (s[i] == t[j]) {
dp[i + 1][j + 1] = (dp[i + 1][j] + dp[i][j + 1]) % MOD;
} else {
dp[i + 1][j + 1] =
(((dp[i + 1][j] + dp[i][j + 1]) % MOD) - dp[i][j]) % MOD;
}
}
}
cout << dp[n][m] << endl;
} | #include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
using ll = long long;
using pll = pair<ll, ll>;
#define FOR(i, begin, end) \
for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) \
for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FI first
#define SE second
#define endl "\n"
#define ciosup \
cin.tie(0); \
ios::sync_with_stdio(false);
#define eb emplace_back
#define vint vector<int>
constexpr ll INF = 1e9 + 7;
constexpr ll MOD = 1e9 + 7;
int n, m;
vint s(2005), t(2005);
ll dp[2005][2005];
int main() {
ciosup;
cin >> n >> m;
REP(i, n) cin >> s[i];
REP(i, m) cin >> t[i];
REP(i, n + 1) dp[i][0] = 1;
REP(i, m + 1) dp[0][i] = 1;
REP(i, n) {
REP(j, m) {
if (s[i] == t[j]) {
dp[i + 1][j + 1] = (dp[i + 1][j] + dp[i][j + 1]) % MOD;
} else {
dp[i + 1][j + 1] =
(((dp[i + 1][j] + dp[i][j + 1]) % MOD) + MOD - dp[i][j]) % MOD;
}
}
}
cout << dp[n][m] << endl;
} | [
"assignment.change"
] | 818,421 | 818,422 | u337054478 | cpp |
p03003 | #include <bits/stdc++.h>
#define REP(i, n) for (ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for (ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
void print(const std::vector<int> &v) {
std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
std::cout << std::endl;
}
long long dp[2020][2020];
long long sum[2020][2020];
long long ret;
int main() {
int N, M;
cin >> N >> M;
vector<long long> S(N);
vector<long long> T(M);
REP(i, N) { cin >> S[i]; }
REP(i, M) { cin >> T[i]; }
// dp(i+1,j+1) 等しい部分列かつS[i] = T[j] が末尾であるような組み合わせ
REP(i, 2020) {
sum[i][0] = 1;
sum[0][i] = 1;
}
long long res = 0;
REP(x, N) {
REP(y, M) {
if (S[x] == T[y]) {
dp[x + 1][y + 1] = sum[x][y] % MOD; // xyまでの累積和
ret += dp[x + 1][y + 1];
}
long long tmp =
sum[x][y + 1] + sum[x + 1][y] + MOD - sum[x][y] + dp[x + 1][y + 1];
sum[x + 1][y + 1] = tmp % MOD;
}
}
cout << ret % MOD << endl;
} | #include <bits/stdc++.h>
#define REP(i, n) for (ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for (ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
void print(const std::vector<int> &v) {
std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
std::cout << std::endl;
}
long long dp[2020][2020];
long long sum[2020][2020];
int main() {
int N, M;
cin >> N >> M;
vector<long long> S(N);
vector<long long> T(M);
REP(i, N) { cin >> S[i]; }
REP(i, M) { cin >> T[i]; }
// dp(i+1,j+1) 等しい部分列かつS[i] = T[j] が末尾であるような組み合わせ
REP(i, 2020) {
sum[i][0] = 1;
sum[0][i] = 1;
}
long long ret = 1;
REP(x, N) {
REP(y, M) {
if (S[x] == T[y]) {
dp[x + 1][y + 1] = sum[x][y] % MOD; // xyまでの累積和
ret += dp[x + 1][y + 1];
}
long long tmp =
sum[x][y + 1] + sum[x + 1][y] + MOD - sum[x][y] + dp[x + 1][y + 1];
sum[x + 1][y + 1] = tmp % MOD;
}
}
cout << ret % MOD << endl;
} | [
"variable_declaration.remove",
"variable_declaration.name.change",
"identifier.change",
"literal.number.change",
"variable_declaration.value.change"
] | 818,460 | 818,461 | u824337972 | cpp |
p03003 | #include <bits/stdc++.h>
#define REP(i, n) for (ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for (ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
void print(const std::vector<int> &v) {
std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
std::cout << std::endl;
}
long long dp[2020][2020];
long long sum[2020][2020];
long long ret;
int main() {
int N, M;
cin >> N >> M;
vector<long long> S(N);
vector<long long> T(M);
REP(i, N) { cin >> S[i]; }
REP(i, M) { cin >> T[i]; }
// dp(i+1,j+1) 等しい部分列かつS[i] = T[j] が末尾であるような組み合わせ
REP(i, 2020) {
sum[i][0] = 1;
sum[0][i] = 1;
}
long long res = 1;
REP(x, N) {
REP(y, M) {
if (S[x] == T[y]) {
dp[x + 1][y + 1] = sum[x][y] % MOD; // xyまでの累積和
ret += dp[x + 1][y + 1];
}
long long tmp =
sum[x][y + 1] + sum[x + 1][y] + MOD - sum[x][y] + dp[x + 1][y + 1];
sum[x + 1][y + 1] = tmp % MOD;
}
}
cout << ret % MOD << endl;
} | #include <bits/stdc++.h>
#define REP(i, n) for (ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for (ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
void print(const std::vector<int> &v) {
std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
std::cout << std::endl;
}
long long dp[2020][2020];
long long sum[2020][2020];
int main() {
int N, M;
cin >> N >> M;
vector<long long> S(N);
vector<long long> T(M);
REP(i, N) { cin >> S[i]; }
REP(i, M) { cin >> T[i]; }
// dp(i+1,j+1) 等しい部分列かつS[i] = T[j] が末尾であるような組み合わせ
REP(i, 2020) {
sum[i][0] = 1;
sum[0][i] = 1;
}
long long ret = 1;
REP(x, N) {
REP(y, M) {
if (S[x] == T[y]) {
dp[x + 1][y + 1] = sum[x][y] % MOD; // xyまでの累積和
ret += dp[x + 1][y + 1];
}
long long tmp =
sum[x][y + 1] + sum[x + 1][y] + MOD - sum[x][y] + dp[x + 1][y + 1];
sum[x + 1][y + 1] = tmp % MOD;
}
}
cout << ret % MOD << endl;
} | [
"variable_declaration.remove",
"variable_declaration.name.change",
"identifier.change"
] | 818,462 | 818,461 | u824337972 | cpp |
p03003 | #include <bits/stdc++.h>
using namespace std;
#define INF 1 << 30
#define endl '\n'
#define maxn 2048
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
typedef long long ll;
typedef long double ld;
const double PI = acos(-1.0);
#define dbg(x) cerr << #x << " = " << x << endl;
#define dbg2(x, y) cerr << #x << " = " << x << ", " << #y << " = " << y << endl;
#define dbg3(x, y, z) \
cerr << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " \
<< z << endl;
// typedef vector<ll> vcL;
// typedef vector<vcL> vvL;
const ll mod = 1e9 + 7;
ll X[maxn], Y[maxn];
ll dp[maxn][maxn];
ll n, m;
void solve() {
// vvL dp( n+1, vcL( m+1, 1 ) );
// vector<vector<ll> > dp(n+1, vector<ll> (m+1, 1));
// for(int i = 0; i <= n; i++){
// for(int j = 0; j <= m; j++) cerr << dp[i][j] << " ";
// cerr << endl;
// }
for (ll i = 1; i <= n; i++) {
for (ll j = 1; j <= m; j++) {
dp[i][j] = dp[i - 1][j] + dp[i][j - 1] - dp[i - 1][j - 1];
if (X[i] == Y[j])
dp[i][j] += dp[i - 1][j - 1];
dp[i][j] = (dp[i][j] + 10 * mod) % mod;
}
}
cout << dp[n][m] << "\n";
}
int main() {
FASTIO
/*
//double start_time = clock();
#ifndef ONLINE_JUDGE
freopen("in.txt", "r", stdin);
freopen("out.txt", "w", stdout);
freopen("error.txt", "w", stderr);
#endif
//*/
cin >> n >> m;
for (ll i = 1; i <= n; i++)
cin >> X[i];
for (ll i = 1; i <= m; i++)
cin >> Y[i];
for (int i = 0; i <= m; i++) {
for (int j = 0; j <= m; j++)
dp[i][j] = 1;
}
solve();
// double end_time = clock();
// prllf( "Time = %lf ms\n", ( (end_time - start_time) /
// CLOCKS_PER_SEC)*1000);
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define INF 1 << 30
#define endl '\n'
#define maxn 2048
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
typedef long long ll;
typedef long double ld;
const double PI = acos(-1.0);
#define dbg(x) cerr << #x << " = " << x << endl;
#define dbg2(x, y) cerr << #x << " = " << x << ", " << #y << " = " << y << endl;
#define dbg3(x, y, z) \
cerr << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " \
<< z << endl;
// typedef vector<ll> vcL;
// typedef vector<vcL> vvL;
const ll mod = 1e9 + 7;
ll X[maxn], Y[maxn];
ll dp[maxn][maxn];
ll n, m;
void solve() {
// vvL dp( n+1, vcL( m+1, 1 ) );
// vector<vector<ll> > dp(n+1, vector<ll> (m+1, 1));
// for(int i = 0; i <= n; i++){
// for(int j = 0; j <= m; j++) cerr << dp[i][j] << " ";
// cerr << endl;
// }
for (ll i = 1; i <= n; i++) {
for (ll j = 1; j <= m; j++) {
dp[i][j] = dp[i - 1][j] + dp[i][j - 1] - dp[i - 1][j - 1];
if (X[i] == Y[j])
dp[i][j] += dp[i - 1][j - 1];
dp[i][j] = (dp[i][j] + 10 * mod) % mod;
}
}
cout << dp[n][m] << "\n";
}
int main() {
FASTIO
/*
//double start_time = clock();
#ifndef ONLINE_JUDGE
freopen("in.txt", "r", stdin);
freopen("out.txt", "w", stdout);
freopen("error.txt", "w", stderr);
#endif
//*/
cin >> n >> m;
for (ll i = 1; i <= n; i++)
cin >> X[i];
for (ll i = 1; i <= m; i++)
cin >> Y[i];
for (int i = 0; i <= n; i++) {
for (int j = 0; j <= m; j++)
dp[i][j] = 1;
}
solve();
// double end_time = clock();
// prllf( "Time = %lf ms\n", ( (end_time - start_time) /
// CLOCKS_PER_SEC)*1000);
return 0;
}
| [
"identifier.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.change"
] | 818,470 | 818,471 | u802237789 | cpp |
p03003 | #include <algorithm>
#include <assert.h>
#include <bitset>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<ll> vec;
typedef vector<vec> vec2;
typedef map<ll, ll> MPll;
typedef set<ll> setl;
const ll INF = 1ll << 60;
const ld EPS = 1e-10;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const ll MOD = 1000000007;
// for文
#define FOR(i, a, b) for (ll i = (ll)a; i < (ll)b; i++)
#define FORE(i, a, b) for (ll i = (ll)a; i <= (ll)b; i++)
#define REP(i, size) for (ll i = (ll)0; i < size; i++)
#define REPE(i, size) for (ll i = (ll)0; i <= size; i++)
#define REPR(i, size) for (ll i = (ll)size; i >= 0; i--)
#define FOREACH(it, vec) for (auto it = vec.begin(); it != vec.end(); it++)
//ソート
#define ALL(vec) (vec).begin(), (vec).end()
#define SORT(vec) sort(ALL(vec))
#define SORTA(arr) sort(arr, arr + (sizeof(arr) / sizeof(ll)))
#define INVSORT(vec) sort((vec).rbegin(), (vec).rend())
#define REV(vec) reverse(ALL(vec))
#define REVA(arr) reverse(arr, arr + (sizeof(arr) / sizeof(ll)))
#define INVSORTA(arr) sort(arr, arr + (sizeof(arr) / sizeof(ll))), REVA(arr)
//最大値最小値
#define MAX(vec) *max_element(ALL(vec))
#define UNIQ(vec) \
SORT(vec); \
vec.erase(unique(ALL(vec)), vec.end())
#define MIN(vec) *min_element(ALL(vec))
//出力
#define printl(a) cout << a << "\n"
#define print(a) cout << a
#define OUT(a) printf("%lld\n", a)
#define OUTA(array) \
REP(i, sizeof(array) / sizeof(ll)) printf("%lld\n", array[i])
#define OUTV(vec) REP(i, vec.size()) printf("%lld\n", vec[i])
#define SP printf(" ")
//入力
#define IN(x) scanf("%lld", &x)
#define INV(vec) REP(i, vec.size()) scanf("%lld", &vec[i])
#define INA(array) REP(i, sizeof(array) / sizeof(ll)) scanf("%lld", array + i)
#define INS(x) cin >> x
#define INCH(x) scanf(" %c", &x)
//型
#define P pair
#define vp vector<P>
#define F first
#define Ssum second
//その他
#define PB push_back
#define MP make_pair
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, -1, sizeof(a))
#define INFI(a) memset(a, INF, sizeof(a))
#define MEM(a, b) memset(a, (b), sizeof(a))
//関数
template <class T> inline void amax(T &a, const T &b) {
if (a < b)
a = b;
}
template <class T> inline void amin(T &a, const T &b) {
if (a > b)
a = b;
}
/*
struct structure{
ll num1,num2,string s;
bool operator<(const rest &another) const{
return this->s < another.s;
}
structure(ll a,ll b,string s){
this->num1 = a,this->num2=b,this->s=s;
}
};a
*/
//特殊
//#define int ll
#define _CRT_SECURE_NO_WARNINGS
/*
template <typename T>
struct UnionFindTree{
vector<T> par;
vector<T> num;
UnionFindTree(T n) : par(n+1),num(n+1,1ll){
for (int i = 1; i <= n; ++i) {
par[i] = i;
num[i] = 1;
}
}
T root(T x){
if(par[x] == x) return x;
else return par[x] = root(par[x]);
}
void unite(T x,T y){
x = root(x);
y = root(y);
if(!same(x,y)) {
if(num[x] < num[y]) swap(x,y);
par[y] = x;
num[x] += num[y];
num[y] = 0;
}
}
T same(T x,T y){
return root(x) == root(y);
}
T maxnodes(){
return MAX(num);
}
};
*/
#define DEBUG
#ifdef DEBUG
#define debugl(x) cerr << #x << ":" << x << "\n"
#define debug(x) cerr << #x << ":" << x << endl;
#define debugV(V) \
REP(iiiii, V.size()) { cerr << iiiii << ":" << V[iiiii] << endl; }
#define debugA(A) \
REP(iiiiiii, sizeof(A) / sizeof(ll)) { \
cerr << iiiiiii << ":" << V[iiiiiii] << endl; \
}
#define debugVV(V) \
REP(i123, V[0].size()) { \
cerr << endl; \
REP(i1234, V.size()) { cerr << V[i1234][i123]; } \
}
#else
#define debug(x)
#define debugV(x)
#define debugA(x)
#define debugl(x)
#endif
#define ZERO(a) memset(a, 0, sizeof(a))
#define ALL(vec) (vec).begin(), (vec).end()
#define SORT(vec) sort(ALL(vec))
ll binary(ll key, vec &a) {
ll ok = a.size();
ll dame = -1;
while (abs(ok - dame) > 1) {
ll mid = (ok + dame) / 2;
if (a[mid] <= key)
ok = mid;
else
dame = mid;
}
return ok;
}
ll n;
ll m;
ll k;
ll l;
ll temp;
ll x, y;
ll H, W;
char c;
ll ddy, ddx;
signed main() {
IN(n);
IN(m);
vec s(n);
vec t(m);
FOR(i, 0, n) IN(s[i]);
FOR(i, 0, m) IN(t[i]);
vec2 dp(n + 5, vec(m + 5, 0));
dp[0][0] = 1;
vec2 sum(n + 5, vec(m + 5, 0));
FOR(i, 0, n + 5) sum[i][0] = 1;
FOR(i, 0, m + 5) sum[0][i] = 1;
ll ans = 1;
FOR(i, 0, n) FOR(j, 0, m) {
if (s[i] == t[j]) {
dp[i + 1][j + 1] = (sum[i][j] + 1) % MOD;
ans = (ans + dp[i + 1][j + 1]) % MOD;
}
sum[i + 1][j + 1] =
(sum[i][j + 1] + sum[i + 1][j] - sum[i][j] + dp[i + 1][j + 1]) % MOD;
}
OUT(ans);
}
| #include <algorithm>
#include <assert.h>
#include <bitset>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<ll> vec;
typedef vector<vec> vec2;
typedef map<ll, ll> MPll;
typedef set<ll> setl;
const ll INF = 1ll << 60;
const ld EPS = 1e-10;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const ll MOD = 1000000007;
// for文
#define FOR(i, a, b) for (ll i = (ll)a; i < (ll)b; i++)
#define FORE(i, a, b) for (ll i = (ll)a; i <= (ll)b; i++)
#define REP(i, size) for (ll i = (ll)0; i < size; i++)
#define REPE(i, size) for (ll i = (ll)0; i <= size; i++)
#define REPR(i, size) for (ll i = (ll)size; i >= 0; i--)
#define FOREACH(it, vec) for (auto it = vec.begin(); it != vec.end(); it++)
//ソート
#define ALL(vec) (vec).begin(), (vec).end()
#define SORT(vec) sort(ALL(vec))
#define SORTA(arr) sort(arr, arr + (sizeof(arr) / sizeof(ll)))
#define INVSORT(vec) sort((vec).rbegin(), (vec).rend())
#define REV(vec) reverse(ALL(vec))
#define REVA(arr) reverse(arr, arr + (sizeof(arr) / sizeof(ll)))
#define INVSORTA(arr) sort(arr, arr + (sizeof(arr) / sizeof(ll))), REVA(arr)
//最大値最小値
#define MAX(vec) *max_element(ALL(vec))
#define UNIQ(vec) \
SORT(vec); \
vec.erase(unique(ALL(vec)), vec.end())
#define MIN(vec) *min_element(ALL(vec))
//出力
#define printl(a) cout << a << "\n"
#define print(a) cout << a
#define OUT(a) printf("%lld\n", a)
#define OUTA(array) \
REP(i, sizeof(array) / sizeof(ll)) printf("%lld\n", array[i])
#define OUTV(vec) REP(i, vec.size()) printf("%lld\n", vec[i])
#define SP printf(" ")
//入力
#define IN(x) scanf("%lld", &x)
#define INV(vec) REP(i, vec.size()) scanf("%lld", &vec[i])
#define INA(array) REP(i, sizeof(array) / sizeof(ll)) scanf("%lld", array + i)
#define INS(x) cin >> x
#define INCH(x) scanf(" %c", &x)
//型
#define P pair
#define vp vector<P>
#define F first
#define Ssum second
//その他
#define PB push_back
#define MP make_pair
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, -1, sizeof(a))
#define INFI(a) memset(a, INF, sizeof(a))
#define MEM(a, b) memset(a, (b), sizeof(a))
//関数
template <class T> inline void amax(T &a, const T &b) {
if (a < b)
a = b;
}
template <class T> inline void amin(T &a, const T &b) {
if (a > b)
a = b;
}
/*
struct structure{
ll num1,num2,string s;
bool operator<(const rest &another) const{
return this->s < another.s;
}
structure(ll a,ll b,string s){
this->num1 = a,this->num2=b,this->s=s;
}
};a
*/
//特殊
//#define int ll
#define _CRT_SECURE_NO_WARNINGS
/*
template <typename T>
struct UnionFindTree{
vector<T> par;
vector<T> num;
UnionFindTree(T n) : par(n+1),num(n+1,1ll){
for (int i = 1; i <= n; ++i) {
par[i] = i;
num[i] = 1;
}
}
T root(T x){
if(par[x] == x) return x;
else return par[x] = root(par[x]);
}
void unite(T x,T y){
x = root(x);
y = root(y);
if(!same(x,y)) {
if(num[x] < num[y]) swap(x,y);
par[y] = x;
num[x] += num[y];
num[y] = 0;
}
}
T same(T x,T y){
return root(x) == root(y);
}
T maxnodes(){
return MAX(num);
}
};
*/
#define DEBUG
#ifdef DEBUG
#define debugl(x) cerr << #x << ":" << x << "\n"
#define debug(x) cerr << #x << ":" << x << endl;
#define debugV(V) \
REP(iiiii, V.size()) { cerr << iiiii << ":" << V[iiiii] << endl; }
#define debugA(A) \
REP(iiiiiii, sizeof(A) / sizeof(ll)) { \
cerr << iiiiiii << ":" << V[iiiiiii] << endl; \
}
#define debugVV(V) \
REP(i123, V[0].size()) { \
cerr << endl; \
REP(i1234, V.size()) { cerr << V[i1234][i123]; } \
}
#else
#define debug(x)
#define debugV(x)
#define debugA(x)
#define debugl(x)
#endif
#define ZERO(a) memset(a, 0, sizeof(a))
#define ALL(vec) (vec).begin(), (vec).end()
#define SORT(vec) sort(ALL(vec))
ll binary(ll key, vec &a) {
ll ok = a.size();
ll dame = -1;
while (abs(ok - dame) > 1) {
ll mid = (ok + dame) / 2;
if (a[mid] <= key)
ok = mid;
else
dame = mid;
}
return ok;
}
ll n;
ll m;
ll k;
ll l;
ll temp;
ll x, y;
ll H, W;
char c;
ll ddy, ddx;
signed main() {
IN(n);
IN(m);
vec s(n);
vec t(m);
FOR(i, 0, n) IN(s[i]);
FOR(i, 0, m) IN(t[i]);
vec2 dp(n + 5, vec(m + 5, 0));
dp[0][0] = 1;
vec2 sum(n + 5, vec(m + 5, 0));
FOR(i, 0, n + 5) sum[i][0] = 1;
FOR(i, 0, m + 5) sum[0][i] = 1;
ll ans = 1;
FOR(i, 0, n) FOR(j, 0, m) {
if (s[i] == t[j]) {
dp[i + 1][j + 1] = (sum[i][j]) % MOD;
ans = (ans + dp[i + 1][j + 1]) % MOD;
}
sum[i + 1][j + 1] =
(sum[i][j + 1] + sum[i + 1][j] - sum[i][j] + dp[i + 1][j + 1] + MOD) %
MOD;
}
OUT(ans % MOD);
}
| [
"expression.operation.binary.remove",
"assignment.change"
] | 818,490 | 818,488 | u502721867 | cpp |
p03003 | #include <bits/stdc++.h>
using namespace std;
#define int long long
const int mod = 1e9 + 7;
signed main() {
int n, m;
cin >> n >> m;
vector<int> a(n);
vector<int> b(m);
for (int i = 0; i < n; ++i)
cin >> a[i];
for (int j = 0; j < m; ++j)
cin >> b[j];
vector<vector<int>> dp(n + 1, vector<int>(m + 1, 0));
for (int i = 1; i <= n; ++i) {
for (int j = 1; j <= m; ++j) {
dp[i][j] = (dp[i - 1][j] + dp[i][j - 1] - dp[i - 1][j - 1] + mod) % mod;
if (a[i - 1] == b[j - 1]) {
dp[i][j] += (1 + dp[i - 1][j - 1]) % mod;
}
}
}
cout << dp[n][m] + 1;
}
| #include <bits/stdc++.h>
using namespace std;
#define int long long
const int mod = 1e9 + 7;
signed main() {
int n, m;
cin >> n >> m;
vector<int> a(n);
vector<int> b(m);
for (int i = 0; i < n; ++i)
cin >> a[i];
for (int j = 0; j < m; ++j)
cin >> b[j];
vector<vector<int>> dp(n + 1, vector<int>(m + 1, 0));
for (int i = 1; i <= n; ++i) {
for (int j = 1; j <= m; ++j) {
dp[i][j] = (dp[i - 1][j] + dp[i][j - 1] - dp[i - 1][j - 1] + mod) % mod;
if (a[i - 1] == b[j - 1]) {
dp[i][j] += (1 + dp[i - 1][j - 1]) % mod;
}
}
}
cout << dp[n][m] % mod + 1;
}
| [
"expression.operation.binary.add"
] | 818,497 | 818,498 | u595786324 | cpp |
p03003 | #include <bits/stdc++.h>
using namespace std;
const int N = 2e3 + 5;
const int mod = 1e9 + 7;
const int inf = 2e9;
int a[N], b[N];
long long dp[N][N];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int n, m;
cin >> n >> m;
for (int i = 1; i <= n; ++i)
cin >> a[i];
for (int i = 1; i <= m; ++i)
cin >> b[i];
for (int i = 1; i <= n; ++i) {
for (int j = 1; j <= m; ++j) {
dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % mod;
dp[i][j] = (dp[i][j] - dp[i - 1][j - 1] + mod) % mod;
if (a[i] == b[i]) {
dp[i][j] = (dp[i][j] + 1 + dp[i - 1][j - 1]) % mod;
}
}
}
cout << (dp[n][m] + 1) % mod << '\n';
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
const int N = 2e3 + 5;
const int mod = 1e9 + 7;
const int inf = 2e9;
int a[N], b[N];
long long dp[N][N];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int n, m;
cin >> n >> m;
for (int i = 1; i <= n; ++i)
cin >> a[i];
for (int i = 1; i <= m; ++i)
cin >> b[i];
for (int i = 1; i <= n; ++i) {
for (int j = 1; j <= m; ++j) {
dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % mod;
dp[i][j] = (dp[i][j] - dp[i - 1][j - 1] + mod) % mod;
if (a[i] == b[j]) {
dp[i][j] = (dp[i][j] + 1 + dp[i - 1][j - 1]) % mod;
}
}
}
cout << (dp[n][m] + 1) % mod << '\n';
return 0;
}
| [
"identifier.change",
"variable_access.subscript.index.change",
"control_flow.branch.if.condition.change"
] | 818,499 | 818,500 | u595786324 | cpp |
p03003 | // Sani buyuk Osman Pasa Plevneden cikmam diyor.
// FatihSultanMehmedHan
// Abdulhamid Han
// Bismillahirrahmanirrahim
//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█▄█
//█─█─█▄─█▄─█─█─█─█
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long int lo;
typedef pair<int, int> PII;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fio() \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL)
#define FOR for (lo i = 0; i < n; i++)
#define mid ((start + end) / 2)
#define ort ((bas + son) / 2)
const lo MAX = -1000000000000000000;
const lo MIN = 1000000000000000000;
const lo inf = 1000000000;
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 4005;
const lo mod = 1000000007;
lo n, m, b[li], a[li], k, flag, dp[li];
lo cev;
string s;
vector<int> v;
inline lo add(lo x, lo y) {
if (x + y >= mod)
return x + y - mod;
return x + y;
}
int main(void) {
scanf("%lld %lld", &n, &m);
FOR { scanf("%lld", &a[i]); }
for (lo i = 0; i < m; i++) {
scanf("%lld", &b[i]);
}
for (lo i = 0; i <= n + m + 1; i++) {
dp[i] = 1;
}
for (lo i = n; i >= 1; i--) {
for (lo j = i; j < m + i; j++) {
if ((i & 7) || (j & 7)) {
if (a[n - i] == b[j - i]) {
dp[j] = (add(dp[j - 1], dp[j + 1])) % mod;
} else {
dp[j] = (add(dp[j - 1], dp[j + 1]) - dp[j]) % mod;
}
} else {
if (a[n - i] == b[j - i]) {
dp[j] = ((dp[j - 1] + dp[j + 1]));
} else {
dp[j] = (dp[j - 1] + dp[j + 1] - dp[j]);
}
}
}
}
printf("%lld\n", dp[m] % mod);
return 0;
}
| // Sani buyuk Osman Pasa Plevneden cikmam diyor.
// FatihSultanMehmedHan
// Abdulhamid Han
// Bismillahirrahmanirrahim
//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█▄█
//█─█─█▄─█▄─█─█─█─█
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long int lo;
typedef pair<int, int> PII;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fio() \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL)
#define FOR for (lo i = 0; i < n; i++)
#define mid ((start + end) / 2)
#define ort ((bas + son) / 2)
const lo MAX = -1000000000000000000;
const lo MIN = 1000000000000000000;
const lo inf = 1000000000;
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 4005;
const lo mod = 1000000007;
lo n, m, b[li], a[li], k, flag, dp[li];
lo cev;
string s;
vector<int> v;
inline lo add(lo x, lo y) {
if (x + y >= mod)
return x + y - mod;
return x + y;
}
int main(void) {
scanf("%lld %lld", &n, &m);
FOR { scanf("%lld", &a[i]); }
for (lo i = 0; i < m; i++) {
scanf("%lld", &b[i]);
}
for (lo i = 0; i <= n + m + 1; i++) {
dp[i] = 1;
}
for (lo i = n; i >= 1; i--) {
for (lo j = i; j < m + i; j++) {
if ((i & 7) || (j & 7)) {
if (a[n - i] == b[j - i]) {
dp[j] = (add(dp[j - 1], dp[j + 1])) % mod;
} else {
dp[j] = (add(dp[j - 1], dp[j + 1]) - dp[j]) % mod;
}
} else {
if (a[n - i] == b[j - i]) {
dp[j] = ((dp[j - 1] + dp[j + 1]));
} else {
dp[j] = (dp[j - 1] + dp[j + 1] - dp[j]);
}
}
}
}
printf("%lld\n", (dp[m] % mod + mod) % mod);
return 0;
}
| [
"call.arguments.change"
] | 818,517 | 818,518 | u050607149 | cpp |
p03003 | #include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for (ll i = 0; i < n; i++)
#define REP1(i, n) for (ll i = 1; i < n; i++)
#define REPR(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
#define ALL(a) (a).begin(), (a).end()
#define pb(a) push_back(a)
#define MOD 1000000007
int main() {
ll n, m;
ll ans = 0LL;
cin >> n >> m;
vector<ll> s(n);
vector<ll> t(m);
REP(i, n) cin >> s[i];
REP(i, m) cin >> t[i];
vector<ll> dp0(n + 1, 0);
vector<ll> dp1(n + 1, 0);
dp0[0] = 1LL;
dp1[0] = 1LL;
REP(i, m) {
for (int j = 0; j < n; j++) {
if (t[i] == s[j]) {
dp0[j + 1] = dp0[j] + dp1[j + 1];
} else {
dp0[j + 1] = dp0[j] + dp1[j + 1] - dp1[j];
}
dp0[j + 1] %= MOD;
}
REP(j, n) dp1[j + 1] = dp0[j + 1];
}
cout << dp0[n] << endl;
return 0;
} | #include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for (ll i = 0; i < n; i++)
#define REP1(i, n) for (ll i = 1; i < n; i++)
#define REPR(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
#define ALL(a) (a).begin(), (a).end()
#define pb(a) push_back(a)
#define MOD 1000000007
int main() {
ll n, m;
ll ans = 0LL;
cin >> n >> m;
vector<ll> s(n);
vector<ll> t(m);
REP(i, n) cin >> s[i];
REP(i, m) cin >> t[i];
vector<ll> dp0(n + 1, 0LL);
vector<ll> dp1(n + 1, 1LL);
dp0[0] = 1LL;
dp1[0] = 1LL;
REP(i, m) {
for (int j = 0; j < n; j++) {
if (t[i] == s[j]) {
dp0[j + 1] = dp0[j] + dp1[j + 1];
} else {
dp0[j + 1] = dp0[j] + dp1[j + 1] - dp1[j] + MOD;
}
dp0[j + 1] %= MOD;
}
REP(j, n) dp1[j + 1] = dp0[j + 1];
}
cout << dp0[n] << endl;
return 0;
} | [
"literal.number.type.widen.change",
"literal.number.change",
"call.arguments.change",
"assignment.change"
] | 818,519 | 818,520 | u837951457 | cpp |
p03003 | #include <iostream>
#include <vector>
using namespace std;
const long long MOD = 1000000007;
int main() {
int n, m;
cin >> n >> m;
vector<int> s(n);
vector<int> t(m);
for (int i = 0; i < n; i++)
cin >> s[i];
for (int i = 0; i < m; i++)
cin >> t[i];
vector<vector<long long>> dp(n + 1, vector<long long>(m + 1, 0));
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
dp[i + 1][j + 1] = (dp[i + 1][j] + dp[i][j + 1] - dp[i][j]) % MOD;
if (s[i] == t[j])
(dp[i + 1][j + 1] += dp[i][j] + 1) % MOD;
}
}
cout << (dp[n][m] + 1) % MOD << endl;
return 0;
} | #include <iostream>
#include <vector>
using namespace std;
const long long MOD = 1000000007;
int main() {
int n, m;
cin >> n >> m;
vector<int> s(n);
vector<int> t(m);
for (int i = 0; i < n; i++)
cin >> s[i];
for (int i = 0; i < m; i++)
cin >> t[i];
vector<vector<long long>> dp(n + 1, vector<long long>(m + 1, 0));
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
dp[i + 1][j + 1] = (dp[i + 1][j] + dp[i][j + 1] - dp[i][j] + MOD) % MOD;
if (s[i] == t[j])
(dp[i + 1][j + 1] += dp[i][j] + 1) % MOD;
}
}
cout << (dp[n][m] + 1) % MOD << endl;
return 0;
} | [
"assignment.change"
] | 818,531 | 818,532 | u513736711 | cpp |
p03003 | #include <bits/stdc++.h>
using namespace std;
//#define %d %lld
//#define int long long
typedef long long ll;
#define sqr(x) ((x) * (x))
#define pb push_back
const int N = 2002, M = 1e9 + 7;
void Max(int &x, int y) {
if (y > x)
x = y;
}
void Min(int &x, int y) {
if (y < x)
x = y;
}
void inc(int &x, int y) {
x += y;
if (x >= M)
x -= M;
}
void dec(int &x, int y) {
x -= y;
if (x < 0)
x += M;
}
int pw(int x, int y) {
int z = 1;
for (; y; y >>= 1, x = 1ll * x * x % M)
if (y & 1)
z = 1ll * z * x % M;
return z;
}
void read(int *a, int n) {
for (int i = 1; i <= n; i++)
scanf("%d", &a[i]);
}
// struct node{int to,ne}e[];
// void add(int x,int y){e[++tot]=(node){y,h[x]},h[x]=tot;}
int n, m, i, j, f[N][N], a[N], b[N];
signed main() {
scanf("%d%d", &n, &m);
read(a, n), read(b, m);
for (i = 0; i <= n; i++)
f[i][0] = 1;
for (i = 0; i <= m; i++)
f[0][i] = 1;
for (i = 1; i <= n; i++)
for (j = 1; j <= m; j++)
inc(f[i][j], 1ll * f[i - 1][j] + f[i][j - 1] -
(a[i] != b[j]) * f[i - 1][j - 1] + M);
printf("%d", f[n][m]);
} | #include <bits/stdc++.h>
using namespace std;
//#define %d %lld
//#define int long long
typedef long long ll;
#define sqr(x) ((x) * (x))
#define pb push_back
const int N = 2002, M = 1e9 + 7;
void Max(int &x, int y) {
if (y > x)
x = y;
}
void Min(int &x, int y) {
if (y < x)
x = y;
}
void inc(int &x, int y) {
x += y;
if (x >= M)
x -= M;
}
void dec(int &x, int y) {
x -= y;
if (x < 0)
x += M;
}
int pw(int x, int y) {
int z = 1;
for (; y; y >>= 1, x = 1ll * x * x % M)
if (y & 1)
z = 1ll * z * x % M;
return z;
}
void read(int *a, int n) {
for (int i = 1; i <= n; i++)
scanf("%d", &a[i]);
}
// struct node{int to,ne}e[];
// void add(int x,int y){e[++tot]=(node){y,h[x]},h[x]=tot;}
int n, m, i, j, f[N][N], a[N], b[N];
signed main() {
scanf("%d%d", &n, &m);
read(a, n), read(b, m);
for (i = 0; i <= n; i++)
f[i][0] = 1;
for (i = 0; i <= m; i++)
f[0][i] = 1;
for (i = 1; i <= n; i++)
for (j = 1; j <= m; j++)
inc(f[i][j], (1ll * f[i - 1][j] + f[i][j - 1] -
(a[i] != b[j]) * f[i - 1][j - 1] + M) %
M);
printf("%d", f[n][m]);
} | [
"call.arguments.change",
"call.arguments.add"
] | 818,555 | 818,556 | u764856393 | cpp |
p03003 | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define int long long int
constexpr int MOD = 1000000007; // 10 ** 9 + 7
constexpr int SIZE = 2010;
int dp[SIZE][SIZE];
int sum[SIZE][SIZE];
void solve() {
int N, M;
cin >> N >> M;
vector<int> s(N);
for (auto &x : s) {
cin >> x;
}
vector<int> t(M);
for (auto &x : t) {
cin >> x;
}
for (int i = 0; i <= N; i++) {
sum[i][0] = 1;
}
for (int i = 0; i <= M; i++) {
sum[0][i] = 1;
}
int ret = 1;
for (int i = 0; i < N; i++) {
for (int j = 0; j < M; j++) {
if (s[i] == t[j]) {
dp[i + 1][j + 1] = sum[i][j] + 1;
ret += dp[i + 1][j + 1];
}
sum[i + 1][j + 1] =
(sum[i + 1][j] + sum[i][j + 1] - sum[i][j] + dp[i + 1][j + 1] + MOD) %
MOD;
}
}
cout << ret % MOD << endl;
}
signed main() {
solve();
return 0;
}
| #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define int long long int
constexpr int MOD = 1000000007; // 10 ** 9 + 7
constexpr int SIZE = 2010;
int dp[SIZE][SIZE];
int sum[SIZE][SIZE];
void solve() {
int N, M;
cin >> N >> M;
vector<int> s(N);
for (auto &x : s) {
cin >> x;
}
vector<int> t(M);
for (auto &x : t) {
cin >> x;
}
for (int i = 0; i <= N; i++) {
sum[i][0] = 1;
}
for (int i = 0; i <= M; i++) {
sum[0][i] = 1;
}
int ret = 1;
for (int i = 0; i < N; i++) {
for (int j = 0; j < M; j++) {
if (s[i] == t[j]) {
dp[i + 1][j + 1] = sum[i][j];
ret += dp[i + 1][j + 1];
}
sum[i + 1][j + 1] =
(sum[i + 1][j] + sum[i][j + 1] - sum[i][j] + dp[i + 1][j + 1] + MOD) %
MOD;
}
}
cout << ret % MOD << endl;
}
signed main() {
solve();
return 0;
}
| [
"expression.operation.binary.remove"
] | 818,573 | 818,574 | u173511648 | cpp |
p03003 | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define int long long int
constexpr int MOD = 1000000007; // 10 ** 9 + 7
constexpr int SIZE = 2010;
int dp[SIZE][SIZE];
int sum[SIZE][SIZE];
void solve() {
int N, M;
cin >> N >> M;
vector<int> s(N);
for (auto &x : s) {
cin >> x;
}
vector<int> t(M);
for (auto &x : t) {
cin >> x;
}
for (int i = 0; i <= N; i++) {
sum[i][0] = 1;
}
for (int i = 0; i <= M; i++) {
sum[0][i] = 1;
}
int ret = 1;
for (int i = 0; i < N; i++) {
for (int j = 0; j < M; j++) {
if (s[i] == t[j]) {
dp[i + 1][j + 1] = sum[i - 1][j - 1] + 1;
ret += dp[i + 1][j + 1];
}
sum[i + 1][j + 1] =
(sum[i + 1][j] + sum[i][j + 1] - sum[i][j] + dp[i + 1][j + 1] + MOD) %
MOD;
}
}
cout << ret % MOD << endl;
}
signed main() {
solve();
return 0;
}
| #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define int long long int
constexpr int MOD = 1000000007; // 10 ** 9 + 7
constexpr int SIZE = 2010;
int dp[SIZE][SIZE];
int sum[SIZE][SIZE];
void solve() {
int N, M;
cin >> N >> M;
vector<int> s(N);
for (auto &x : s) {
cin >> x;
}
vector<int> t(M);
for (auto &x : t) {
cin >> x;
}
for (int i = 0; i <= N; i++) {
sum[i][0] = 1;
}
for (int i = 0; i <= M; i++) {
sum[0][i] = 1;
}
int ret = 1;
for (int i = 0; i < N; i++) {
for (int j = 0; j < M; j++) {
if (s[i] == t[j]) {
dp[i + 1][j + 1] = sum[i][j];
ret += dp[i + 1][j + 1];
}
sum[i + 1][j + 1] =
(sum[i + 1][j] + sum[i][j + 1] - sum[i][j] + dp[i + 1][j + 1] + MOD) %
MOD;
}
}
cout << ret % MOD << endl;
}
signed main() {
solve();
return 0;
}
| [
"expression.operation.binary.remove"
] | 818,575 | 818,574 | u173511648 | cpp |
p03003 | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define FOR(i, a, b) for (int(i) = (a); (i) < (b); (i)++)
#define REP(i, n) FOR(i, 0, n)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(), (c).end())
#define ve vector
#define vi vector<int>
#define vp vector<pair<int, int>>
#define vvi vector<vector<int>>
typedef long long ll;
const ll INF = LLONG_MAX - 100;
const ll mod = 1e9 + 7;
const int MAX_N = 2e5 + 5;
int dx[] = {-1, 0, 1, 0}, dy[] = {0, 1, 0, -1};
vector<ll> prime;
int fac[MAX_N], inv[MAX_N];
template <class T = ll> T in() {
T x;
cin >> x;
return (x);
}
void DEBUG(vector<int> a) {
for (int i = 0; i < a.size(); i++)
cout << a[i] << " ";
cout << endl;
}
ll GCD(ll a, ll b) {
ll c;
while (b != 0) {
c = a % b;
a = b;
b = c;
}
return a;
}
ll LCM(ll a, ll b) { return a * b / GCD(a, b); }
ll POW(ll a, ll b, bool usemod = true) {
ll c = 1LL;
while (b > 0) {
if (b & 1LL) {
if (!usemod)
c *= a;
else
c = a * c % mod;
}
if (!usemod)
a *= a;
else
a = a * a % mod;
b >>= 1LL;
}
return c;
}
void _nCr() {
fac[0] = 1LL;
for (int i = 1LL; i < MAX_N; i++) {
fac[i] = fac[i - 1LL] * i % mod;
}
for (int i = 0; i < MAX_N; i++) {
inv[i] = POW(fac[i], mod - 2);
}
}
ll nCr(ll n, ll r) { return (fac[n] * inv[r] % mod) * inv[n - r] % mod; }
void PRI(ll n) {
bool a[n + 1LL];
for (int i = 0; i < n + 1LL; i++) {
a[i] = 1LL;
}
for (int i = 2; i < n + 1LL; i++) {
if (a[i]) {
prime.pb(i);
ll b = i;
while (b <= n) {
a[b] = 0;
b += i;
}
}
}
}
template <typename T> T chmin(T &a, T b) {
if (a > b)
a = b;
return a;
}
template <typename T> T chmax(T &a, T b) {
if (a < b)
a = b;
return b;
}
int dp[2005][2005];
int sum[2005][2005];
// dpはi,jを同時に採用した時に増えるもの(不一致なら0) dp[i][j] = sum[i-1][j-1]
// sumはi,jまでの総和
bool solve() {
int n, m;
cin >> n >> m;
vi s(n), t(m);
REP(i, n) cin >> s[i];
REP(i, m) cin >> t[i];
REP(i, n) REP(j, m) sum[i][j] = 1;
REP(i, n) {
REP(j, m) {
sum[i + 1][j + 1] = sum[i][j + 1] + sum[i + 1][j] - sum[i][j];
if (s[i] == t[j])
dp[i + 1][j + 1] = sum[i][j];
sum[i + 1][j + 1] += dp[i + 1][j + 1] + mod;
sum[i + 1][j + 1] %= mod;
}
}
cout << sum[n][m] << endl;
}
signed main() {
cin.tie(0);
ios::sync_with_stdio(false);
solve();
} | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define FOR(i, a, b) for (int(i) = (a); (i) < (b); (i)++)
#define REP(i, n) FOR(i, 0, n)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(), (c).end())
#define ve vector
#define vi vector<int>
#define vp vector<pair<int, int>>
#define vvi vector<vector<int>>
typedef long long ll;
const ll INF = LLONG_MAX - 100;
const ll mod = 1e9 + 7;
const int MAX_N = 2e5 + 5;
int dx[] = {-1, 0, 1, 0}, dy[] = {0, 1, 0, -1};
vector<ll> prime;
int fac[MAX_N], inv[MAX_N];
template <class T = ll> T in() {
T x;
cin >> x;
return (x);
}
void DEBUG(vector<int> a) {
for (int i = 0; i < a.size(); i++)
cout << a[i] << " ";
cout << endl;
}
ll GCD(ll a, ll b) {
ll c;
while (b != 0) {
c = a % b;
a = b;
b = c;
}
return a;
}
ll LCM(ll a, ll b) { return a * b / GCD(a, b); }
ll POW(ll a, ll b, bool usemod = true) {
ll c = 1LL;
while (b > 0) {
if (b & 1LL) {
if (!usemod)
c *= a;
else
c = a * c % mod;
}
if (!usemod)
a *= a;
else
a = a * a % mod;
b >>= 1LL;
}
return c;
}
void _nCr() {
fac[0] = 1LL;
for (int i = 1LL; i < MAX_N; i++) {
fac[i] = fac[i - 1LL] * i % mod;
}
for (int i = 0; i < MAX_N; i++) {
inv[i] = POW(fac[i], mod - 2);
}
}
ll nCr(ll n, ll r) { return (fac[n] * inv[r] % mod) * inv[n - r] % mod; }
void PRI(ll n) {
bool a[n + 1LL];
for (int i = 0; i < n + 1LL; i++) {
a[i] = 1LL;
}
for (int i = 2; i < n + 1LL; i++) {
if (a[i]) {
prime.pb(i);
ll b = i;
while (b <= n) {
a[b] = 0;
b += i;
}
}
}
}
template <typename T> T chmin(T &a, T b) {
if (a > b)
a = b;
return a;
}
template <typename T> T chmax(T &a, T b) {
if (a < b)
a = b;
return b;
}
int dp[2005][2005];
int sum[2005][2005];
// dpはi,jを同時に採用した時に増えるもの(不一致なら0) dp[i][j] = sum[i-1][j-1]
// sumはi,jまでの総和
bool solve() {
int n, m;
cin >> n >> m;
vi s(n), t(m);
REP(i, n) cin >> s[i];
REP(i, m) cin >> t[i];
REP(i, n + 1) REP(j, m + 1) sum[i][j] = 1;
REP(i, n) {
REP(j, m) {
sum[i + 1][j + 1] = sum[i][j + 1] + sum[i + 1][j] - sum[i][j];
if (s[i] == t[j])
dp[i + 1][j + 1] = sum[i][j];
sum[i + 1][j + 1] += dp[i + 1][j + 1] + mod;
sum[i + 1][j + 1] %= mod;
}
}
cout << sum[n][m] << endl;
}
signed main() {
cin.tie(0);
ios::sync_with_stdio(false);
solve();
} | [
"assignment.change"
] | 818,585 | 818,586 | u764234894 | cpp |
p03003 | #include <bits/stdc++.h>
using namespace std;
int main(void) {
// Your code here!
int a, b;
long long ans = 1;
cin >> a >> b;
vector<char> s(a), t(b);
vector<long long> q(a), w(b);
for (int i = 0; i < a; i++) {
cin >> s.at(i);
q.at(i) = 0;
}
for (int i = 0; i < b; i++) {
cin >> t.at(i);
w.at(i) = 0;
}
for (int i = a - 1; i > -1; i--) {
int p = 0;
for (int j = b - 1; j > -1; j--) {
int y = w.at(j);
if (s.at(i) == t.at(j)) {
int pp = 0;
if (p == 0)
pp = 1;
else
pp = p + 1;
ans = (ans + pp) % 1000000007;
w.at(j) = (pp + w.at(j)) % 1000000007;
}
p = (p + y) % 1000000007;
}
}
cout << ans << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main(void) {
// Your code here!
int a, b;
long long ans = 1;
cin >> a >> b;
vector<int> s(a), t(b);
vector<long long> q(a), w(b);
for (int i = 0; i < a; i++) {
cin >> s.at(i);
q.at(i) = 0;
}
for (int i = 0; i < b; i++) {
cin >> t.at(i);
w.at(i) = 0;
}
for (int i = a - 1; i > -1; i--) {
int p = 0;
for (int j = b - 1; j > -1; j--) {
int y = w.at(j);
if (s.at(i) == t.at(j)) {
int pp = 0;
if (p == 0)
pp = 1;
else
pp = p + 1;
ans = (ans + pp) % 1000000007;
w.at(j) = (pp + w.at(j)) % 1000000007;
}
p = (p + y) % 1000000007;
}
}
cout << ans << endl;
}
| [
"variable_declaration.type.primitive.change"
] | 818,587 | 818,588 | u112775098 | cpp |
p03003 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;
template <typename T> ostream &operator<<(ostream &os, vector<T> v) {
for (auto &i : v)
os << i << " ";
return os;
}
template <typename T> istream &operator>>(istream &is, vector<T> &v) {
for (auto &i : v)
is >> i;
return is;
}
template <typename K, typename V>
ostream &operator<<(ostream &os, unordered_map<K, V> m) {
for (auto &i : m)
os << i.first << ":" << i.second << endl;
return os;
}
template <typename T> inline bool chmin(T &x, T y) {
if (x > y) {
x = y;
return true;
}
return false;
}
template <typename T> inline bool chmax(T &x, T y) {
if (x < y) {
x = y;
return true;
}
return false;
}
int main() {
int n, m;
cin >> n >> m;
vector<int> s(n), t(m);
cin >> s >> t;
vector<vector<ll>> dp(n + 1, vector<ll>(m + 1));
dp[0][0] = 1;
for (int i = 0; i <= n; i++) {
for (int j = 0; j <= m; j++) {
if (i > 0)
dp[i][j] += dp[i - 1][j];
if (j > 0)
dp[i][j] += dp[i][j - 1];
if (i > 0 && j > 0 && s[i - 1] != t[j - 1]) {
dp[i][j] -= dp[i - 1][j - 1];
dp[i][j] %= mod;
}
}
}
cout << dp[n][m] << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;
template <typename T> ostream &operator<<(ostream &os, vector<T> v) {
for (auto &i : v)
os << i << " ";
return os;
}
template <typename T> istream &operator>>(istream &is, vector<T> &v) {
for (auto &i : v)
is >> i;
return is;
}
template <typename K, typename V>
ostream &operator<<(ostream &os, unordered_map<K, V> m) {
for (auto &i : m)
os << i.first << ":" << i.second << endl;
return os;
}
template <typename T> inline bool chmin(T &x, T y) {
if (x > y) {
x = y;
return true;
}
return false;
}
template <typename T> inline bool chmax(T &x, T y) {
if (x < y) {
x = y;
return true;
}
return false;
}
int main() {
int n, m;
cin >> n >> m;
vector<int> s(n), t(m);
cin >> s >> t;
vector<vector<ll>> dp(n + 1, vector<ll>(m + 1));
dp[0][0] = 1;
for (int i = 0; i <= n; i++) {
for (int j = 0; j <= m; j++) {
if (i > 0)
dp[i][j] += dp[i - 1][j];
if (j > 0)
dp[i][j] += dp[i][j - 1];
if (i > 0 && j > 0 && s[i - 1] != t[j - 1]) {
dp[i][j] += mod - dp[i - 1][j - 1];
}
dp[i][j] %= mod;
}
}
cout << dp[n][m] << endl;
return 0;
}
| [
"expression.operator.change",
"assignment.change"
] | 818,601 | 818,602 | u171804186 | cpp |
p03003 | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const int mod = 1000000007;
struct mint {
ll x;
mint(ll x = 0) : x(x % mod) {}
mint &operator+=(const mint a) {
if (x += a.x >= mod)
x -= mod;
return *this;
}
mint &operator-=(const mint a) {
if (x += mod - a.x >= mod)
x -= mod;
return *this;
}
mint &operator*=(const mint a) {
(x *= a.x) %= mod;
return *this;
}
mint operator+(const mint a) const {
mint res(*this);
return res += a;
}
mint operator-(const mint a) const {
mint res(*this);
return res -= a;
}
mint operator*(const mint a) const {
mint res(*this);
return res *= a;
}
};
mint dp0[2005][2005];
mint dp1[2005][2005];
int main() {
int n, m;
cin >> n >> m;
vector<int> s(n + 1), t(m + 1);
rep(i, n) scanf("%d", &s[i]);
rep(i, m) scanf("%d", &t[i]);
dp0[0][0] = 1;
rep(i, n + 1) rep(j, m + 1) {
dp0[i + 1][j] += dp0[i][j];
dp1[i][j] += dp0[i][j];
dp1[i][j + 1] += dp1[i][j];
if (s[i] == t[j]) {
dp0[i + 1][j + 1] += dp1[i][j];
}
}
mint ans = dp1[n][m];
cout << ans.x << endl;
return 0;
} | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const int mod = 1000000007;
struct mint {
ll x;
mint(ll x = 0) : x(x % mod) {}
mint &operator+=(const mint a) {
if ((x += a.x) >= mod)
x -= mod;
return *this;
}
mint &operator-=(const mint a) {
if ((x += mod - a.x) >= mod)
x -= mod;
return *this;
}
mint &operator*=(const mint a) {
(x *= a.x) %= mod;
return *this;
}
mint operator+(const mint a) const {
mint res(*this);
return res += a;
}
mint operator-(const mint a) const {
mint res(*this);
return res -= a;
}
mint operator*(const mint a) const {
mint res(*this);
return res *= a;
}
};
mint dp0[2005][2005];
mint dp1[2005][2005];
int main() {
int n, m;
cin >> n >> m;
vector<int> s(n + 1), t(m + 1);
rep(i, n) scanf("%d", &s[i]);
rep(i, m) scanf("%d", &t[i]);
dp0[0][0] = 1;
rep(i, n + 1) rep(j, m + 1) {
// printf("%d %d : %lld %lld\n", i,j,dp0[i][j].x,dp1[i][j].x);
dp0[i + 1][j] += dp0[i][j];
dp1[i][j] += dp0[i][j];
dp1[i][j + 1] += dp1[i][j];
if (s[i] == t[j]) {
dp0[i + 1][j + 1] += dp1[i][j];
}
}
mint ans = dp1[n][m];
cout << ans.x << endl;
return 0;
} | [
"control_flow.branch.if.condition.change"
] | 818,612 | 818,613 | u457283867 | cpp |
p03003 | #include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define debug(x) cerr << #x << " " << x << '\n'
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pli = pair<ll, int>;
const int INF = 0x3f3f3f3f, N = 2e3 + 5;
const ll LINF = 1e18 + 5;
const int mod = 1e9 + 7;
char s[N], t[N];
int n, m;
ll dp[N][N], sum[N][N];
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cin >> n >> m;
for (int i = 1; i <= n; i++)
cin >> s[i];
for (int i = 1; i <= m; i++)
cin >> t[i];
dp[0][0] = 1;
for (int i = 0; i <= n; i++)
sum[i][0] = 1;
for (int i = 0; i <= m; i++)
sum[0][i] = 1;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
if (s[i] == t[j])
(dp[i][j] += sum[i - 1][j - 1]) %= mod;
(sum[i][j] +=
(sum[i][j - 1] + sum[i - 1][j] - sum[i - 1][j - 1] + dp[i][j]) % mod) %=
mod;
}
}
ll ans = sum[n][m];
ans = (ans + mod) % mod;
cout << ans;
return 0;
}
| #include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define debug(x) cerr << #x << " " << x << '\n'
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pli = pair<ll, int>;
const int INF = 0x3f3f3f3f, N = 2e3 + 5;
const ll LINF = 1e18 + 5;
const int mod = 1e9 + 7;
int s[N], t[N];
int n, m;
ll dp[N][N], sum[N][N];
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cin >> n >> m;
for (int i = 1; i <= n; i++)
cin >> s[i];
for (int i = 1; i <= m; i++)
cin >> t[i];
dp[0][0] = 1;
for (int i = 0; i <= n; i++)
sum[i][0] = 1;
for (int i = 0; i <= m; i++)
sum[0][i] = 1;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
if (s[i] == t[j])
(dp[i][j] += sum[i - 1][j - 1]) %= mod;
(sum[i][j] +=
(sum[i][j - 1] + sum[i - 1][j] - sum[i - 1][j - 1] + dp[i][j]) % mod) %=
mod;
}
}
ll ans = sum[n][m];
ans = (ans + mod) % mod;
cout << ans;
return 0;
} | [
"variable_declaration.type.primitive.change"
] | 818,620 | 818,621 | u047655753 | cpp |
p03003 | #include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define ll long long
using namespace std;
// typedef vector<unsigned int>vec;
// typedef vector<ll>vec;
// typedef vector<vec> mat;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000; // 1e18
const ll MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-10;
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;
}
// template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};
template <int MOD> struct Fp {
long long val;
constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
if (val < 0)
val += MOD;
}
constexpr int getmod() { return MOD; }
constexpr Fp operator-() const noexcept { return val ? MOD - val : 0; }
constexpr Fp operator+(const Fp &r) const noexcept { return Fp(*this) += r; }
constexpr Fp operator-(const Fp &r) const noexcept { return Fp(*this) -= r; }
constexpr Fp operator*(const Fp &r) const noexcept { return Fp(*this) *= r; }
constexpr Fp operator/(const Fp &r) const noexcept { return Fp(*this) /= r; }
constexpr Fp &operator+=(const Fp &r) noexcept {
val += r.val;
if (val >= MOD)
val -= MOD;
return *this;
}
constexpr Fp &operator-=(const Fp &r) noexcept {
val -= r.val;
if (val < 0)
val += MOD;
return *this;
}
constexpr Fp &operator*=(const Fp &r) noexcept {
val = val * r.val % MOD;
return *this;
}
constexpr Fp &operator/=(const Fp &r) noexcept {
long long a = r.val, b = MOD, u = 1, v = 0;
while (b) {
long long t = a / b;
a -= t * b;
swap(a, b);
u -= t * v;
swap(u, v);
}
val = val * u % MOD;
if (val < 0)
val += MOD;
return *this;
}
constexpr bool operator==(const Fp &r) const noexcept {
return this->val == r.val;
}
constexpr bool operator!=(const Fp &r) const noexcept {
return this->val != r.val;
}
friend constexpr ostream &operator<<(ostream &os, const Fp<MOD> &x) noexcept {
return os << x.val;
}
friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
if (n == 0)
return 1;
auto t = modpow(a, n / 2);
t = t * t;
if (n & 1)
t = t * a;
return t;
}
};
using mint = Fp<MOD>;
mint sum[2020][2020];
mint dp[2020][2020];
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int N, M;
cin >> N >> M;
vector<int> S(N), T(M);
REP(i, N) cin >> S[i];
REP(i, M) cin >> T[i];
REP(i, 2020) sum[i][0] = sum[0][i] = 1;
mint ans = 1;
REP(i, N) REP(j, M) {
if (S[i] == T[j]) {
dp[i + 1][j + 1] = sum[i][j];
ans += dp[i + 1][j + 1];
}
sum[i + 1][j + 1] = sum[i][j + 1] + sum[i + 1][j] - sum[i][j];
sum[i + 1][j + 1] = dp[i + 1][j + 1];
}
cout << ans << endl;
} | #include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define ll long long
using namespace std;
// typedef vector<unsigned int>vec;
// typedef vector<ll>vec;
// typedef vector<vec> mat;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000; // 1e18
const ll MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-10;
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;
}
// template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};
template <int MOD> struct Fp {
long long val;
constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
if (val < 0)
val += MOD;
}
constexpr int getmod() { return MOD; }
constexpr Fp operator-() const noexcept { return val ? MOD - val : 0; }
constexpr Fp operator+(const Fp &r) const noexcept { return Fp(*this) += r; }
constexpr Fp operator-(const Fp &r) const noexcept { return Fp(*this) -= r; }
constexpr Fp operator*(const Fp &r) const noexcept { return Fp(*this) *= r; }
constexpr Fp operator/(const Fp &r) const noexcept { return Fp(*this) /= r; }
constexpr Fp &operator+=(const Fp &r) noexcept {
val += r.val;
if (val >= MOD)
val -= MOD;
return *this;
}
constexpr Fp &operator-=(const Fp &r) noexcept {
val -= r.val;
if (val < 0)
val += MOD;
return *this;
}
constexpr Fp &operator*=(const Fp &r) noexcept {
val = val * r.val % MOD;
return *this;
}
constexpr Fp &operator/=(const Fp &r) noexcept {
long long a = r.val, b = MOD, u = 1, v = 0;
while (b) {
long long t = a / b;
a -= t * b;
swap(a, b);
u -= t * v;
swap(u, v);
}
val = val * u % MOD;
if (val < 0)
val += MOD;
return *this;
}
constexpr bool operator==(const Fp &r) const noexcept {
return this->val == r.val;
}
constexpr bool operator!=(const Fp &r) const noexcept {
return this->val != r.val;
}
friend constexpr ostream &operator<<(ostream &os, const Fp<MOD> &x) noexcept {
return os << x.val;
}
friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
if (n == 0)
return 1;
auto t = modpow(a, n / 2);
t = t * t;
if (n & 1)
t = t * a;
return t;
}
};
using mint = Fp<MOD>;
mint sum[2020][2020];
mint dp[2020][2020];
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int N, M;
cin >> N >> M;
vector<int> S(N), T(M);
REP(i, N) cin >> S[i];
REP(i, M) cin >> T[i];
REP(i, 2020) sum[i][0] = sum[0][i] = 1;
mint ans = 1;
REP(i, N) REP(j, M) {
if (S[i] == T[j]) {
dp[i + 1][j + 1] = sum[i][j];
ans += dp[i + 1][j + 1];
}
sum[i + 1][j + 1] = sum[i][j + 1] + sum[i + 1][j] - sum[i][j];
sum[i + 1][j + 1] += dp[i + 1][j + 1];
}
cout << ans << endl;
} | [
"assignment.value.change"
] | 818,622 | 818,623 | u493750228 | cpp |
p03003 | #include <bits/stdc++.h>
#define ll long long
#define F first
#define S second
#define P pair
#define FOR(i, a, b) for (int i = a; i <= b; i++)
#define V vector
#define RE return
#define ALL(a) a.begin(), a.end()
#define MP make_pair
#define PB push_back
#define PF push_front
#define FILL(a, b) memset(a, b, sizeof(a))
using namespace std;
int a[2005], b[2005], la, lb, mod = 1e9 + 7;
int dp[2005][2005];
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cin >> la >> lb;
dp[0][0] = 1;
FOR(i, 1, la) cin >> a[i], dp[i][0] = 1;
FOR(i, 1, lb) cin >> b[i], dp[0][i] = 1;
FOR(i, 1, la) {
FOR(j, 1, lb) {
dp[i][j] = (dp[i - 1][j] + dp[i][j - 1] - dp[i - 1][j - 1] + mod) % mod;
if (a[i] == b[j])
dp[i][j] = (dp[i][j] + dp[i - 1][j - 1]) % mod;
}
}
cout << dp[la][lb];
RE 0;
}
| #include <bits/stdc++.h>
#define int long long
#define F first
#define S second
#define P pair
#define FOR(i, a, b) for (int i = a; i <= b; i++)
#define V vector
#define RE return
#define ALL(a) a.begin(), a.end()
#define MP make_pair
#define PB push_back
#define PF push_front
#define FILL(a, b) memset(a, b, sizeof(a))
using namespace std;
int a[2005], b[2005], la, lb, mod = 1e9 + 7;
int dp[2005][2005];
signed main() {
ios::sync_with_stdio(0);
cin.tie(0);
cin >> la >> lb;
dp[0][0] = 1;
FOR(i, 1, la) cin >> a[i], dp[i][0] = 1;
FOR(i, 1, lb) cin >> b[i], dp[0][i] = 1;
FOR(i, 1, la) {
FOR(j, 1, lb) {
dp[i][j] = (dp[i - 1][j] + dp[i][j - 1] - dp[i - 1][j - 1] + mod) % mod;
if (a[i] == b[j])
dp[i][j] = (dp[i][j] + dp[i - 1][j - 1]) % mod;
}
}
cout << dp[la][lb];
RE 0;
}
| [
"identifier.change",
"variable_declaration.type.primitive.change"
] | 818,626 | 818,627 | u751741878 | cpp |
p03003 | #include <bits/stdc++.h>
typedef long long ll;
typedef double ld;
using namespace std;
ll mod = 1e9 + 7;
int main() {
ll n, m;
cin >> n >> m;
int A[n], B[m];
for (int i = 0; i < n; i++) {
cin >> A[i];
}
for (int j = 0; j < m; j++)
cin >> B[j];
long long dp[n + 1][m + 1];
memset(dp, 0, sizeof(0));
for (int i = 0; i <= n; i++) {
dp[0][i] = 1;
}
for (int j = 0; j <= m; j++)
dp[j][0] = 1;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
dp[i][j] = dp[i - 1][j] + dp[i][j - 1] - dp[i - 1][j - 1];
if (A[i - 1] == B[j - 1]) {
dp[i][j] += dp[i - 1][j - 1];
}
dp[i][j] += mod;
dp[i][j] %= mod;
}
}
cout << dp[n][m] << endl;
} | #include <bits/stdc++.h>
typedef long long ll;
typedef double ld;
using namespace std;
ll mod = 1e9 + 7;
int main() {
ll n, m;
cin >> n >> m;
int A[n], B[m];
for (int i = 0; i < n; i++) {
cin >> A[i];
}
for (int j = 0; j < m; j++)
cin >> B[j];
long long dp[n + 1][m + 1];
memset(dp, 0, sizeof(0));
for (int i = 0; i <= n; i++) {
dp[i][0] = 1;
}
for (int j = 0; j <= m; j++)
dp[0][j] = 1;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
dp[i][j] = dp[i - 1][j] + dp[i][j - 1] - dp[i - 1][j - 1];
if (A[i - 1] == B[j - 1]) {
dp[i][j] += dp[i - 1][j - 1];
}
dp[i][j] += mod;
dp[i][j] %= mod;
}
}
cout << dp[n][m] << endl;
} | [
"assignment.variable.change",
"identifier.replace.add",
"literal.replace.remove",
"variable_access.subscript.index.change",
"identifier.replace.remove",
"literal.replace.add"
] | 818,643 | 818,644 | u257965594 | cpp |
p03003 | /**
* code generated by JHelper
* More info: https://github.com/AlexeyDmitriev/JHelper
* @author
*/
#include <bits/stdc++.h>
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
using namespace std;
typedef long long int64;
static int64 MOD = 1e9 + 7;
class ECommonSubsequence {
public:
void solve(std::istream &in, std::ostream &out) {
int n, m;
in >> n >> m;
vector<int> u(n), v(m);
forn(i, n) in >> u[i];
forn(i, m) in >> v[i];
vector<vector<int>> dp(n + 1, vector<int>(m + 1, 0));
forn(i, n + 1) dp[i][0] = 1;
forn(i, m + 1) dp[0][i] = 1;
fore(i, 1, n) fore(j, 1, m) {
dp[i][j] = dp[i - 1][j] + dp[i][j - 1];
if (v[i - 1] != u[j - 1])
dp[i][j] -= dp[i - 1][j - 1];
dp[i][j] = (dp[i][j] + MOD * 10) % MOD;
}
out << dp[n][m] << endl;
}
};
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ECommonSubsequence solver;
std::istream &in(std::cin);
std::ostream &out(std::cout);
solver.solve(in, out);
return 0;
} | /**
* code generated by JHelper
* More info: https://github.com/AlexeyDmitriev/JHelper
* @author
*/
#include <bits/stdc++.h>
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
using namespace std;
typedef long long int64;
static int64 MOD = 1e9 + 7;
class ECommonSubsequence {
public:
void solve(std::istream &in, std::ostream &out) {
int n, m;
in >> n >> m;
vector<int> u(n), v(m);
forn(i, n) in >> u[i];
forn(i, m) in >> v[i];
vector<vector<int>> dp(n + 1, vector<int>(m + 1, 0));
forn(i, n + 1) dp[i][0] = 1;
forn(i, m + 1) dp[0][i] = 1;
fore(i, 1, n) fore(j, 1, m) {
dp[i][j] = dp[i - 1][j] + dp[i][j - 1];
if (u[i - 1] != v[j - 1])
dp[i][j] -= dp[i - 1][j - 1];
dp[i][j] = (dp[i][j] + 10 * MOD) % MOD;
}
out << dp[n][m] << endl;
}
};
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ECommonSubsequence solver;
std::istream &in(std::cin);
std::ostream &out(std::cout);
solver.solve(in, out);
return 0;
} | [
"identifier.change",
"control_flow.branch.if.condition.change",
"expression.operation.binary.remove",
"assignment.change"
] | 818,652 | 818,653 | u635804867 | cpp |
p03003 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 2e3 + 10;
const int modn = 1e9 + 7;
int a[maxn], b[maxn];
ll dp[maxn][maxn];
int main() {
int n, m;
scanf("%d%d", &n, &m);
for (int i = 1; i <= n; i++)
scanf("%d", &a[i]);
for (int i = 1; i <= m; i++)
scanf("%d", &b[i]);
for (int i = 0; i <= n; i++)
dp[i][0] = 1;
for (int i = 0; i <= m; i++)
dp[0][i] = 1;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
dp[i][j] =
((dp[i - 1][j] + dp[i][j - 1]) % modn - dp[i - 1][j - 1]) % modn;
if (a[i] == b[j])
dp[i][j] = (dp[i][j] + dp[i - 1][j - 1]) % modn;
}
}
printf("%lld\n", dp[n][m]);
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 2e3 + 10;
const int modn = 1e9 + 7;
int a[maxn], b[maxn];
ll dp[maxn][maxn];
int main() {
int n, m;
scanf("%d%d", &n, &m);
for (int i = 1; i <= n; i++)
scanf("%d", &a[i]);
for (int i = 1; i <= m; i++)
scanf("%d", &b[i]);
for (int i = 0; i <= n; i++)
dp[i][0] = 1;
for (int i = 0; i <= m; i++)
dp[0][i] = 1;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
dp[i][j] =
((dp[i - 1][j] + dp[i][j - 1]) % modn - dp[i - 1][j - 1] + modn) %
modn;
if (a[i] == b[j])
dp[i][j] = (dp[i][j] + dp[i - 1][j - 1]) % modn;
}
}
printf("%lld\n", dp[n][m]);
} | [
"assignment.change"
] | 818,670 | 818,671 | u115357063 | cpp |
p03003 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e3 + 10;
const int modn = 1e9 + 7;
int a[maxn], b[maxn];
ll dp[maxn][maxn];
int main() {
int n, m;
scanf("%d%d", &n, &m);
for (int i = 1; i <= n; i++)
scanf("%d", &a[i]);
for (int i = 1; i <= m; i++)
scanf("%d", &b[i]);
for (int i = 0; i <= n; i++)
dp[i][0] = 1;
for (int i = 0; i <= m; i++)
dp[0][i] = 1;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
dp[i][j] =
((dp[i - 1][j] + dp[i][j - 1]) % modn - dp[i - 1][j - 1]) % modn;
if (a[i] == b[j])
dp[i][j] = (dp[i][j] + dp[i - 1][j - 1]) % modn;
}
}
printf("%lld\n", dp[n][m]);
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 2e3 + 10;
const int modn = 1e9 + 7;
int a[maxn], b[maxn];
ll dp[maxn][maxn];
int main() {
int n, m;
scanf("%d%d", &n, &m);
for (int i = 1; i <= n; i++)
scanf("%d", &a[i]);
for (int i = 1; i <= m; i++)
scanf("%d", &b[i]);
for (int i = 0; i <= n; i++)
dp[i][0] = 1;
for (int i = 0; i <= m; i++)
dp[0][i] = 1;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
dp[i][j] =
((dp[i - 1][j] + dp[i][j - 1]) % modn - dp[i - 1][j - 1] + modn) %
modn;
if (a[i] == b[j])
dp[i][j] = (dp[i][j] + dp[i - 1][j - 1]) % modn;
}
}
printf("%lld\n", dp[n][m]);
} | [
"literal.number.change",
"expression.operation.binary.change",
"assignment.change"
] | 818,672 | 818,671 | u115357063 | cpp |
p03003 | #include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <unordered_map>
#include <vector>
using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;
template <class T> ostream &operator<<(ostream &os, const vector<T> &vec) {
for (const auto &e : vec)
os << e << (&e == &vec.back() ? "\n" : " ");
return os;
}
#ifdef _DEBUG
template <class T> void dump(const char *str, T &&h) {
cerr << str << " = " << h << "\n";
};
template <class Head, class... Tail>
void dump(const char *str, Head &&h, Tail &&...t) {
while (*str != ',')
cerr << *str++;
cerr << " = " << h << "\n";
dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else
#define DMP(...) ((void)0)
#endif
template <int Modulo = MOD> struct Mint {
lint val;
constexpr Mint(lint v = 0) noexcept : val(v % Modulo) {
if (val < 0)
v += Modulo;
}
constexpr Mint &operator+=(const Mint &r) noexcept {
val += r.val;
if (val >= Modulo)
val -= Modulo;
return *this;
}
constexpr Mint &operator-=(const Mint &r) noexcept {
val -= r.val;
if (val < 0)
val += Modulo;
return *this;
}
constexpr Mint &operator*=(const Mint &r) noexcept {
val = val * r.val % Modulo;
return *this;
}
constexpr Mint &operator/=(const Mint &r) noexcept {
lint a = r.val, b = Modulo, u = 1, v = 0;
while (b) {
lint t = a / b;
a -= t * b;
swap(a, b);
u -= t * v;
swap(u, v);
}
val = val * u % Modulo;
if (val < 0)
val += Modulo;
return *this;
}
constexpr Mint operator+(const Mint &r) const noexcept {
return Mint(*this) += r;
}
constexpr Mint operator-(const Mint &r) const noexcept {
return Mint(*this) -= r;
}
constexpr Mint operator*(const Mint &r) const noexcept {
return Mint(*this) *= r;
}
constexpr Mint operator/(const Mint &r) const noexcept {
return Mint(*this) /= r;
}
constexpr int getmod() { return Modulo; }
constexpr Mint operator-() const noexcept { return val ? Modulo - val : 0; }
constexpr bool operator==(const Mint &r) const noexcept {
return val == r.val;
}
constexpr bool operator!=(const Mint &r) const noexcept {
return val != r.val;
}
friend ostream &operator<<(ostream &os, const Mint<Modulo> &x) noexcept {
return os << x.val;
}
friend istream &operator>>(istream &is, Mint<Modulo> &x) noexcept {
lint tmp;
is >> tmp;
x = Mint<Modulo>(tmp);
return is;
}
friend constexpr Mint<Modulo> modpow(const Mint<Modulo> &a, lint n) noexcept {
Mint res(1), tmp = a;
while (n > 0) {
if (n & 1)
res *= tmp;
tmp *= tmp;
n >>= 1;
}
return res;
}
};
using mint = Mint<>;
template <class T> vector<T> make_vec(size_t s, T val) {
return vector<T>(s, val);
}
template <class... Size> auto make_vec(size_t s, Size... tail) {
return vector<decltype(make_vec(tail...))>(s, make_vec(tail...));
}
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
int N, M;
cin >> N >> M;
vector<int> S(N), T(M);
for (int i = 0; i <= N; i++)
cin >> S[i];
for (int i = 0; i <= M; i++)
cin >> T[i];
auto dp = make_vec(N + 1, M + 1, mint(0));
for (int i = 0; i < N; i++)
dp[i][0] = 1;
for (int j = 0; j < M; j++)
dp[0][j] = 1;
for (int i = 0; i < N; i++) {
for (int j = 0; j < M; j++) {
if (S[i] != T[j])
dp[i + 1][j + 1] -= dp[i][j];
dp[i + 1][j + 1] += dp[i + 1][j] + dp[i][j + 1];
}
}
cout << dp[N][M] << "\n";
return 0;
} | #include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <unordered_map>
#include <vector>
using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;
template <class T> ostream &operator<<(ostream &os, const vector<T> &vec) {
for (const auto &e : vec)
os << e << (&e == &vec.back() ? "\n" : " ");
return os;
}
#ifdef _DEBUG
template <class T> void dump(const char *str, T &&h) {
cerr << str << " = " << h << "\n";
};
template <class Head, class... Tail>
void dump(const char *str, Head &&h, Tail &&...t) {
while (*str != ',')
cerr << *str++;
cerr << " = " << h << "\n";
dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else
#define DMP(...) ((void)0)
#endif
template <int Modulo = MOD> struct Mint {
lint val;
constexpr Mint(lint v = 0) noexcept : val(v % Modulo) {
if (val < 0)
v += Modulo;
}
constexpr Mint &operator+=(const Mint &r) noexcept {
val += r.val;
if (val >= Modulo)
val -= Modulo;
return *this;
}
constexpr Mint &operator-=(const Mint &r) noexcept {
val -= r.val;
if (val < 0)
val += Modulo;
return *this;
}
constexpr Mint &operator*=(const Mint &r) noexcept {
val = val * r.val % Modulo;
return *this;
}
constexpr Mint &operator/=(const Mint &r) noexcept {
lint a = r.val, b = Modulo, u = 1, v = 0;
while (b) {
lint t = a / b;
a -= t * b;
swap(a, b);
u -= t * v;
swap(u, v);
}
val = val * u % Modulo;
if (val < 0)
val += Modulo;
return *this;
}
constexpr Mint operator+(const Mint &r) const noexcept {
return Mint(*this) += r;
}
constexpr Mint operator-(const Mint &r) const noexcept {
return Mint(*this) -= r;
}
constexpr Mint operator*(const Mint &r) const noexcept {
return Mint(*this) *= r;
}
constexpr Mint operator/(const Mint &r) const noexcept {
return Mint(*this) /= r;
}
constexpr int getmod() { return Modulo; }
constexpr Mint operator-() const noexcept { return val ? Modulo - val : 0; }
constexpr bool operator==(const Mint &r) const noexcept {
return val == r.val;
}
constexpr bool operator!=(const Mint &r) const noexcept {
return val != r.val;
}
friend ostream &operator<<(ostream &os, const Mint<Modulo> &x) noexcept {
return os << x.val;
}
friend istream &operator>>(istream &is, Mint<Modulo> &x) noexcept {
lint tmp;
is >> tmp;
x = Mint<Modulo>(tmp);
return is;
}
friend constexpr Mint<Modulo> modpow(const Mint<Modulo> &a, lint n) noexcept {
Mint res(1), tmp = a;
while (n > 0) {
if (n & 1)
res *= tmp;
tmp *= tmp;
n >>= 1;
}
return res;
}
};
using mint = Mint<>;
template <class T> vector<T> make_vec(size_t s, T val) {
return vector<T>(s, val);
}
template <class... Size> auto make_vec(size_t s, Size... tail) {
return vector<decltype(make_vec(tail...))>(s, make_vec(tail...));
}
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
int N, M;
cin >> N >> M;
vector<int> S(N), T(M);
for (int i = 0; i < N; i++)
cin >> S[i];
for (int i = 0; i < M; i++)
cin >> T[i];
auto dp = make_vec(N + 1, M + 1, mint(0));
for (int i = 0; i <= N; i++)
dp[i][0] = 1;
for (int j = 0; j <= M; j++)
dp[0][j] = 1;
for (int i = 0; i < N; i++) {
for (int j = 0; j < M; j++) {
if (S[i] != T[j])
dp[i + 1][j + 1] -= dp[i][j];
dp[i + 1][j + 1] += dp[i + 1][j] + dp[i][j + 1];
}
}
cout << dp[N][M] << "\n";
return 0;
} | [
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 818,675 | 818,676 | u532573979 | cpp |
p03003 | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#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 REP(i, n) for (ll i = 0; i < (n); ++i)
#define REPR(i, n) for (ll i = n; i >= 0; i--)
#define FOREACH(x, a) for (auto &(x) : (a))
#define VECCIN(x) \
for (auto &youso_ : (x)) \
cin >> youso_
#define bitcnt(x) __builtin_popcount(x)
#define lbit(x) __builtin_ffsll(x)
#define rbit(x) __builtin_clzll(x)
#define SZ(x) ((ll)(x).size())
#define fi first
#define se second
#define All(a) (a).begin(), (a).end()
#define rAll(a) (a).rbegin(), (a).rend()
template <typename T = long long> inline T IN() {
T x;
cin >> x;
return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&...tail) {
cin >> head;
CIN(move(tail)...);
}
#define CCIN(...) \
char __VA_ARGS__; \
CIN(__VA_ARGS__)
#define DCIN(...) \
double __VA_ARGS__; \
CIN(__VA_ARGS__)
#define LCIN(...) \
ll __VA_ARGS__; \
CIN(__VA_ARGS__)
#define SCIN(...) \
string __VA_ARGS__; \
CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"
#define Printv(v) \
{ \
FOREACH(x, v) { cout << x << " "; } \
cout << "\n"; \
}
template <typename T = string> inline void eputs(T s) {
cout << s << "\n";
exit(0);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
std::fill((T *)array, (T *)(array + N), val);
}
template <typename T> using PQG = priority_queue<T, vector<T>, greater<T>>;
template <typename T> using PQ = priority_queue<T>;
typedef long long ll;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<ll, ll> PL;
typedef vector<PL> VPL;
typedef vector<bool> VB;
typedef vector<double> VD;
typedef vector<string> VS;
const int INF = 1e9;
const int MOD = 1e9 + 7;
// const int MOD = 998244353;
const ll LINF = 1e18;
// const double PI = atan(1.0) * 4.0;
const ll dx[] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[] = {0, 1, 1, 1, 0, -1, -1, -1};
#define PI 3.141592653589793238
// 1000000007 で割ったあまりを扱う構造体
template <int MOD> struct Fp {
long long val;
constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
if (val < 0)
v += MOD;
}
constexpr int getmod() { return MOD; }
constexpr Fp operator-() const noexcept { return val ? MOD - val : 0; }
constexpr Fp operator+(const Fp &r) const noexcept { return Fp(*this) += r; }
constexpr Fp operator-(const Fp &r) const noexcept { return Fp(*this) -= r; }
constexpr Fp operator*(const Fp &r) const noexcept { return Fp(*this) *= r; }
constexpr Fp operator/(const Fp &r) const noexcept { return Fp(*this) /= r; }
constexpr Fp &operator+=(const Fp &r) noexcept {
val += r.val;
if (val >= MOD)
val -= MOD;
return *this;
}
constexpr Fp &operator-=(const Fp &r) noexcept {
val -= r.val;
if (val < 0)
val += MOD;
return *this;
}
constexpr Fp &operator*=(const Fp &r) noexcept {
val = val * r.val % MOD;
return *this;
}
constexpr Fp &operator/=(const Fp &r) noexcept {
long long a = r.val, b = MOD, u = 1, v = 0;
while (b) {
long long t = a / b;
a -= t * b;
swap(a, b);
u -= t * v;
swap(u, v);
}
val = val * u % MOD;
if (val < 0)
val += MOD;
return *this;
}
constexpr bool operator==(const Fp &r) const noexcept {
return this->val == r.val;
}
constexpr bool operator!=(const Fp &r) const noexcept {
return this->val != r.val;
}
friend constexpr ostream &operator<<(ostream &os, const Fp<MOD> &x) noexcept {
return os << x.val;
}
friend constexpr istream &operator>>(istream &is, Fp<MOD> &x) noexcept {
return is >> x.val;
}
friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
if (n == 0)
return 1;
auto t = modpow(a, n / 2);
t = t * t;
if (n & 1)
t = t * a;
return t;
}
};
using mint = Fp<MOD>;
mint dp[2020][2020];
mint sum[2020][2020];
signed main() {
LCIN(N, M);
VL S(N), T(M);
VECCIN(S);
VECCIN(T);
REP(i, N + 1) sum[i][0] = 1;
REP(j, M + 1) sum[0][j] = 1;
REP(i, N) REP(j, M) {
if (S[i] == T[j])
dp[i + 1][j + 1] += sum[i][j];
sum[i + 1][j + 1] +=
dp[i + 1][j + 1] + sum[i][j + 1] + sum[i + 1][j] + sum[i][j];
}
cout << dp[N][M] << "\n";
} | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#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 REP(i, n) for (ll i = 0; i < (n); ++i)
#define REPR(i, n) for (ll i = n; i >= 0; i--)
#define FOREACH(x, a) for (auto &(x) : (a))
#define VECCIN(x) \
for (auto &youso_ : (x)) \
cin >> youso_
#define bitcnt(x) __builtin_popcount(x)
#define lbit(x) __builtin_ffsll(x)
#define rbit(x) __builtin_clzll(x)
#define SZ(x) ((ll)(x).size())
#define fi first
#define se second
#define All(a) (a).begin(), (a).end()
#define rAll(a) (a).rbegin(), (a).rend()
template <typename T = long long> inline T IN() {
T x;
cin >> x;
return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&...tail) {
cin >> head;
CIN(move(tail)...);
}
#define CCIN(...) \
char __VA_ARGS__; \
CIN(__VA_ARGS__)
#define DCIN(...) \
double __VA_ARGS__; \
CIN(__VA_ARGS__)
#define LCIN(...) \
ll __VA_ARGS__; \
CIN(__VA_ARGS__)
#define SCIN(...) \
string __VA_ARGS__; \
CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"
#define Printv(v) \
{ \
FOREACH(x, v) { cout << x << " "; } \
cout << "\n"; \
}
template <typename T = string> inline void eputs(T s) {
cout << s << "\n";
exit(0);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
std::fill((T *)array, (T *)(array + N), val);
}
template <typename T> using PQG = priority_queue<T, vector<T>, greater<T>>;
template <typename T> using PQ = priority_queue<T>;
typedef long long ll;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<ll, ll> PL;
typedef vector<PL> VPL;
typedef vector<bool> VB;
typedef vector<double> VD;
typedef vector<string> VS;
const int INF = 1e9;
const int MOD = 1e9 + 7;
// const int MOD = 998244353;
const ll LINF = 1e18;
// const double PI = atan(1.0) * 4.0;
const ll dx[] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[] = {0, 1, 1, 1, 0, -1, -1, -1};
#define PI 3.141592653589793238
// 1000000007 で割ったあまりを扱う構造体
template <int MOD> struct Fp {
long long val;
constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
if (val < 0)
v += MOD;
}
constexpr int getmod() { return MOD; }
constexpr Fp operator-() const noexcept { return val ? MOD - val : 0; }
constexpr Fp operator+(const Fp &r) const noexcept { return Fp(*this) += r; }
constexpr Fp operator-(const Fp &r) const noexcept { return Fp(*this) -= r; }
constexpr Fp operator*(const Fp &r) const noexcept { return Fp(*this) *= r; }
constexpr Fp operator/(const Fp &r) const noexcept { return Fp(*this) /= r; }
constexpr Fp &operator+=(const Fp &r) noexcept {
val += r.val;
if (val >= MOD)
val -= MOD;
return *this;
}
constexpr Fp &operator-=(const Fp &r) noexcept {
val -= r.val;
if (val < 0)
val += MOD;
return *this;
}
constexpr Fp &operator*=(const Fp &r) noexcept {
val = val * r.val % MOD;
return *this;
}
constexpr Fp &operator/=(const Fp &r) noexcept {
long long a = r.val, b = MOD, u = 1, v = 0;
while (b) {
long long t = a / b;
a -= t * b;
swap(a, b);
u -= t * v;
swap(u, v);
}
val = val * u % MOD;
if (val < 0)
val += MOD;
return *this;
}
constexpr bool operator==(const Fp &r) const noexcept {
return this->val == r.val;
}
constexpr bool operator!=(const Fp &r) const noexcept {
return this->val != r.val;
}
friend constexpr ostream &operator<<(ostream &os, const Fp<MOD> &x) noexcept {
return os << x.val;
}
friend constexpr istream &operator>>(istream &is, Fp<MOD> &x) noexcept {
return is >> x.val;
}
friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
if (n == 0)
return 1;
auto t = modpow(a, n / 2);
t = t * t;
if (n & 1)
t = t * a;
return t;
}
};
using mint = Fp<MOD>;
mint dp[2020][2020];
mint sum[2020][2020];
signed main() {
LCIN(N, M);
VL S(N), T(M);
VECCIN(S);
VECCIN(T);
REP(i, N + 1) sum[i][0] = 1;
REP(j, M + 1) sum[0][j] = 1;
REP(i, N) REP(j, M) {
if (S[i] == T[j])
dp[i + 1][j + 1] += sum[i][j];
sum[i + 1][j + 1] +=
dp[i + 1][j + 1] + sum[i][j + 1] + sum[i + 1][j] - sum[i][j];
}
cout << sum[N][M] << "\n";
} | [
"misc.opposites",
"expression.operator.arithmetic.change",
"assignment.value.change",
"expression.operation.binary.change",
"identifier.change",
"io.output.change"
] | 818,685 | 818,686 | u139031151 | cpp |
p03003 | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#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 REP(i, n) for (ll i = 0; i < (n); ++i)
#define REPR(i, n) for (ll i = n; i >= 0; i--)
#define FOREACH(x, a) for (auto &(x) : (a))
#define VECCIN(x) \
for (auto &youso_ : (x)) \
cin >> youso_
#define bitcnt(x) __builtin_popcount(x)
#define lbit(x) __builtin_ffsll(x)
#define rbit(x) __builtin_clzll(x)
#define SZ(x) ((ll)(x).size())
#define fi first
#define se second
#define All(a) (a).begin(), (a).end()
#define rAll(a) (a).rbegin(), (a).rend()
template <typename T = long long> inline T IN() {
T x;
cin >> x;
return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&...tail) {
cin >> head;
CIN(move(tail)...);
}
#define CCIN(...) \
char __VA_ARGS__; \
CIN(__VA_ARGS__)
#define DCIN(...) \
double __VA_ARGS__; \
CIN(__VA_ARGS__)
#define LCIN(...) \
ll __VA_ARGS__; \
CIN(__VA_ARGS__)
#define SCIN(...) \
string __VA_ARGS__; \
CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"
#define Printv(v) \
{ \
FOREACH(x, v) { cout << x << " "; } \
cout << "\n"; \
}
template <typename T = string> inline void eputs(T s) {
cout << s << "\n";
exit(0);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
std::fill((T *)array, (T *)(array + N), val);
}
template <typename T> using PQG = priority_queue<T, vector<T>, greater<T>>;
template <typename T> using PQ = priority_queue<T>;
typedef long long ll;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<ll, ll> PL;
typedef vector<PL> VPL;
typedef vector<bool> VB;
typedef vector<double> VD;
typedef vector<string> VS;
const int INF = 1e9;
// const int MOD = 1e9 + 7;
const int MOD = 998244353;
const ll LINF = 1e18;
// const double PI = atan(1.0) * 4.0;
const ll dx[] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[] = {0, 1, 1, 1, 0, -1, -1, -1};
#define PI 3.141592653589793238
// 1000000007 で割ったあまりを扱う構造体
template <int MOD> struct Fp {
long long val;
constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
if (val < 0)
v += MOD;
}
constexpr int getmod() { return MOD; }
constexpr Fp operator-() const noexcept { return val ? MOD - val : 0; }
constexpr Fp operator+(const Fp &r) const noexcept { return Fp(*this) += r; }
constexpr Fp operator-(const Fp &r) const noexcept { return Fp(*this) -= r; }
constexpr Fp operator*(const Fp &r) const noexcept { return Fp(*this) *= r; }
constexpr Fp operator/(const Fp &r) const noexcept { return Fp(*this) /= r; }
constexpr Fp &operator+=(const Fp &r) noexcept {
val += r.val;
if (val >= MOD)
val -= MOD;
return *this;
}
constexpr Fp &operator-=(const Fp &r) noexcept {
val -= r.val;
if (val < 0)
val += MOD;
return *this;
}
constexpr Fp &operator*=(const Fp &r) noexcept {
val = val * r.val % MOD;
return *this;
}
constexpr Fp &operator/=(const Fp &r) noexcept {
long long a = r.val, b = MOD, u = 1, v = 0;
while (b) {
long long t = a / b;
a -= t * b;
swap(a, b);
u -= t * v;
swap(u, v);
}
val = val * u % MOD;
if (val < 0)
val += MOD;
return *this;
}
constexpr bool operator==(const Fp &r) const noexcept {
return this->val == r.val;
}
constexpr bool operator!=(const Fp &r) const noexcept {
return this->val != r.val;
}
friend constexpr ostream &operator<<(ostream &os, const Fp<MOD> &x) noexcept {
return os << x.val;
}
friend constexpr istream &operator>>(istream &is, Fp<MOD> &x) noexcept {
return is >> x.val;
}
friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
if (n == 0)
return 1;
auto t = modpow(a, n / 2);
t = t * t;
if (n & 1)
t = t * a;
return t;
}
};
using mint = Fp<MOD>;
mint dp[2020][2020];
signed main() {
LCIN(N, M);
VL S(N), T(M);
VECCIN(S);
VECCIN(T);
REP(i, N + 1) dp[i][0] = 1;
REP(j, M + 1) dp[0][j] = 1;
REP(i, N) REP(j, M) {
if (S[i] == T[j])
dp[i + 1][j + 1] += dp[i][j];
dp[i + 1][j + 1] += dp[i + 1][j];
dp[i + 1][j + 1] += dp[i][j + 1];
dp[i + 1][j + 1] -= dp[i][j];
}
cout << dp[N][M] << "\n";
} | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#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 REP(i, n) for (ll i = 0; i < (n); ++i)
#define REPR(i, n) for (ll i = n; i >= 0; i--)
#define FOREACH(x, a) for (auto &(x) : (a))
#define VECCIN(x) \
for (auto &youso_ : (x)) \
cin >> youso_
#define bitcnt(x) __builtin_popcount(x)
#define lbit(x) __builtin_ffsll(x)
#define rbit(x) __builtin_clzll(x)
#define SZ(x) ((ll)(x).size())
#define fi first
#define se second
#define All(a) (a).begin(), (a).end()
#define rAll(a) (a).rbegin(), (a).rend()
template <typename T = long long> inline T IN() {
T x;
cin >> x;
return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&...tail) {
cin >> head;
CIN(move(tail)...);
}
#define CCIN(...) \
char __VA_ARGS__; \
CIN(__VA_ARGS__)
#define DCIN(...) \
double __VA_ARGS__; \
CIN(__VA_ARGS__)
#define LCIN(...) \
ll __VA_ARGS__; \
CIN(__VA_ARGS__)
#define SCIN(...) \
string __VA_ARGS__; \
CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"
#define Printv(v) \
{ \
FOREACH(x, v) { cout << x << " "; } \
cout << "\n"; \
}
template <typename T = string> inline void eputs(T s) {
cout << s << "\n";
exit(0);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
std::fill((T *)array, (T *)(array + N), val);
}
template <typename T> using PQG = priority_queue<T, vector<T>, greater<T>>;
template <typename T> using PQ = priority_queue<T>;
typedef long long ll;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<ll, ll> PL;
typedef vector<PL> VPL;
typedef vector<bool> VB;
typedef vector<double> VD;
typedef vector<string> VS;
const int INF = 1e9;
const int MOD = 1e9 + 7;
// const int MOD = 998244353;
const ll LINF = 1e18;
// const double PI = atan(1.0) * 4.0;
const ll dx[] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[] = {0, 1, 1, 1, 0, -1, -1, -1};
#define PI 3.141592653589793238
// 1000000007 で割ったあまりを扱う構造体
template <int MOD> struct Fp {
long long val;
constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
if (val < 0)
v += MOD;
}
constexpr int getmod() { return MOD; }
constexpr Fp operator-() const noexcept { return val ? MOD - val : 0; }
constexpr Fp operator+(const Fp &r) const noexcept { return Fp(*this) += r; }
constexpr Fp operator-(const Fp &r) const noexcept { return Fp(*this) -= r; }
constexpr Fp operator*(const Fp &r) const noexcept { return Fp(*this) *= r; }
constexpr Fp operator/(const Fp &r) const noexcept { return Fp(*this) /= r; }
constexpr Fp &operator+=(const Fp &r) noexcept {
val += r.val;
if (val >= MOD)
val -= MOD;
return *this;
}
constexpr Fp &operator-=(const Fp &r) noexcept {
val -= r.val;
if (val < 0)
val += MOD;
return *this;
}
constexpr Fp &operator*=(const Fp &r) noexcept {
val = val * r.val % MOD;
return *this;
}
constexpr Fp &operator/=(const Fp &r) noexcept {
long long a = r.val, b = MOD, u = 1, v = 0;
while (b) {
long long t = a / b;
a -= t * b;
swap(a, b);
u -= t * v;
swap(u, v);
}
val = val * u % MOD;
if (val < 0)
val += MOD;
return *this;
}
constexpr bool operator==(const Fp &r) const noexcept {
return this->val == r.val;
}
constexpr bool operator!=(const Fp &r) const noexcept {
return this->val != r.val;
}
friend constexpr ostream &operator<<(ostream &os, const Fp<MOD> &x) noexcept {
return os << x.val;
}
friend constexpr istream &operator>>(istream &is, Fp<MOD> &x) noexcept {
return is >> x.val;
}
friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
if (n == 0)
return 1;
auto t = modpow(a, n / 2);
t = t * t;
if (n & 1)
t = t * a;
return t;
}
};
using mint = Fp<MOD>;
mint dp[2020][2020];
signed main() {
LCIN(N, M);
VL S(N), T(M);
VECCIN(S);
VECCIN(T);
REP(i, N + 1) dp[i][0] = 1;
REP(j, M + 1) dp[0][j] = 1;
REP(i, N) REP(j, M) {
if (S[i] == T[j])
dp[i + 1][j + 1] += dp[i][j];
dp[i + 1][j + 1] += dp[i + 1][j];
dp[i + 1][j + 1] += dp[i][j + 1];
dp[i + 1][j + 1] -= dp[i][j];
}
cout << dp[N][M] << "\n";
} | [
"literal.number.change"
] | 818,687 | 818,688 | u139031151 | cpp |
p03003 | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(void) {
int N, M;
cin >> N >> M;
vector<int> S(N), T(M);
for (int i = 0; i < N; i++) {
cin >> S.at(i);
}
for (int i = 0; i < M; i++) {
cin >> T.at(i);
}
vector<vector<int>> dp(N + 1, vector<int>(M + 1, 1));
ll P = 1000 * 1000 * 1000 + 7;
for (int i = 1; i <= N; i++) {
ll sum = 0;
for (int j = 1; j <= M; j++) {
if (S.at(i - 1) == T.at(j - 1)) {
dp.at(i).at(j) = dp.at(i - 1).at(j - 1) + dp.at(i - 1).at(j) + sum;
sum += dp.at(i - 1).at(j - 1);
dp.at(i).at(j) = dp.at(i).at(j) % P;
sum = sum % P;
} else {
dp.at(i).at(j) = dp.at(i - 1).at(j) + sum;
dp.at(i).at(j) = dp.at(i).at(j) % P;
}
// cout<< dp.at(i).at(j)<<" ";
}
// cout<< endl;
}
dp.at(N).at(M) = dp.at(N).at(M) % P;
cout << dp.at(N).at(M);
} | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(void) {
int N, M;
cin >> N >> M;
vector<int> S(N), T(M);
for (int i = 0; i < N; i++) {
cin >> S.at(i);
}
for (int i = 0; i < M; i++) {
cin >> T.at(i);
}
vector<vector<ll>> dp(N + 1, vector<ll>(M + 1, 1));
ll P = 1000 * 1000 * 1000 + 7;
for (int i = 1; i <= N; i++) {
ll sum = 0;
for (int j = 1; j <= M; j++) {
if (S.at(i - 1) == T.at(j - 1)) {
dp.at(i).at(j) = dp.at(i - 1).at(j - 1) + dp.at(i - 1).at(j) + sum;
sum += dp.at(i - 1).at(j - 1);
dp.at(i).at(j) = dp.at(i).at(j) % P;
sum = sum % P;
} else {
dp.at(i).at(j) = dp.at(i - 1).at(j) + sum;
dp.at(i).at(j) = dp.at(i).at(j) % P;
}
// cout<< dp.at(i).at(j)<<" ";
}
// cout<< endl;
}
dp.at(N).at(M) = dp.at(N).at(M) % P;
cout << dp.at(N).at(M);
}
| [
"call.arguments.change"
] | 818,731 | 818,732 | u154931839 | cpp |
p03003 | #include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_set>
#include <vector>
using namespace std;
#define REP(i, m, n) for (int i = (int)m; i < (int)(n); ++i)
#define rep(i, n) REP(i, 0, n)
typedef long long ll;
typedef pair<int, int> pint;
typedef pair<ll, int> pli;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;
ll dp[2010][2010];
char s[2010], t[2010];
int n, m;
void solve() {
rep(i, n + 1) dp[i][0] = 1;
rep(j, m + 1) dp[0][j] = 1;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % mod;
dp[i][j] %= mod;
if (s[i] == t[j]) {
dp[i][j] += dp[i - 1][j - 1];
dp[i][j] %= mod;
}
dp[i][j] += mod - dp[i - 1][j - 1];
dp[i][j] %= mod;
}
}
}
int main() {
cin >> n >> m;
rep(i, n) cin >> s[i + 1];
rep(i, m) cin >> t[i + 1];
solve();
cout << dp[n][m] << endl;
/*
rep(i,n+1){
rep(j,m+1){
cout << "(i,j): (" << i << ',' << j << ") dp[i][j]:" << dp[i][j] << endl;
}
}
*/
return 0;
} | #include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_set>
#include <vector>
using namespace std;
#define REP(i, m, n) for (int i = (int)m; i < (int)(n); ++i)
#define rep(i, n) REP(i, 0, n)
typedef long long ll;
typedef pair<int, int> pint;
typedef pair<ll, int> pli;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;
ll dp[2010][2010];
ll s[2010], t[2010];
int n, m;
void solve() {
rep(i, n + 1) dp[i][0] = 1;
rep(j, m + 1) dp[0][j] = 1;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % mod;
dp[i][j] %= mod;
if (s[i] == t[j]) {
dp[i][j] += dp[i - 1][j - 1];
dp[i][j] %= mod;
}
dp[i][j] += mod - dp[i - 1][j - 1];
dp[i][j] %= mod;
}
}
}
int main() {
cin >> n >> m;
rep(i, n) cin >> s[i + 1];
rep(i, m) cin >> t[i + 1];
solve();
cout << dp[n][m] << endl;
/*
rep(i,n+1){
rep(j,m+1){
cout << "(i,j): (" << i << ',' << j << ") dp[i][j]:" << dp[i][j] << endl;
}
}
*/
return 0;
} | [
"variable_declaration.type.change"
] | 818,753 | 818,754 | u906208439 | cpp |
p03003 | #include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <queue>
#include <utility>
#include <vector>
#define MOD 1000000007
using namespace std;
long long dp[2005][2005];
int main(int argc, char *argv[]) {
int n, m;
cin >> n >> m;
vector<int> s(n), t(m);
for (int i = 0; i < n; i++)
cin >> s[i];
for (int i = 0; i < m; i++)
cin >> t[i];
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
if (s[i] == t[j]) {
dp[i + 1][j + 1] = ((dp[i + 1][j] + dp[i][j + 1]) % MOD + 1) % MOD;
} else {
dp[i + 1][j + 1] =
((dp[i + 1][j] + dp[i][j + 1]) % MOD - dp[i][j]) % MOD;
}
}
}
cout << (dp[n][m] + 1) % MOD << endl;
return 0;
}
| #include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <queue>
#include <utility>
#include <vector>
#define MOD 1000000007
using namespace std;
long long dp[2005][2005];
int main(int argc, char *argv[]) {
int n, m;
cin >> n >> m;
vector<int> s(n), t(m);
for (int i = 0; i < n; i++)
cin >> s[i];
for (int i = 0; i < m; i++)
cin >> t[i];
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
if (s[i] == t[j]) {
dp[i + 1][j + 1] = ((dp[i + 1][j] + dp[i][j + 1]) % MOD + 1) % MOD;
} else {
dp[i + 1][j + 1] =
((dp[i + 1][j] + dp[i][j + 1]) % MOD + (MOD - dp[i][j])) % MOD;
}
}
}
cout << (dp[n][m] + 1) % MOD << endl;
return 0;
}
| [
"assignment.change"
] | 818,757 | 818,758 | u801102476 | cpp |
p03003 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
ll dp_memo[2010][2010];
ll sum_memo[2010][2010];
ll N, M;
vector<ll> S;
vector<ll> T;
ll dp(ll a, ll b);
ll sum(ll c, ll d);
// dp(a,b)は最後にS[a],T[b]を使う共通部分列の個数
// sum(a,b)はdp(0,0) + dp(0,1) + ... + dp(a,b)のこと。
//記号は基本解説PDF準拠
ll dp(ll a, ll b) {
if (a < 0 || b < 0) {
return 0;
} //やばい範囲は0で返す
if (dp_memo[a][b] != -1) {
return dp_memo[a][b];
}
if (S[a] != T[b]) {
return 0;
} else {
return dp_memo[a][b] = (sum(a - 1, b - 1) + 1) % MOD;
}
}
//漸化式は解説準拠
ll sum(ll c, ll d) {
if (c < 0 || d < 0) {
return 0;
}
if (sum_memo[c][d] != -1) {
return sum_memo[c][d];
} //すでに書き込まれている場合はメモカさいき
return sum_memo[c][d] = (MOD + sum(c - 1, d) + sum(c, d - 1) -
sum(c - 1, d - 1) + dp(c, d)) %
MOD;
}
int main() {
cin >> N >> M;
S.resize(N + 1);
T.resize(M + 1);
for (int i = 0; i < 2010; i++) {
for (int j = 0; j < 2010; j++) {
dp_memo[i][j] = -1;
sum_memo[i][j] = -1;
}
}
//-1は未更新
for (int i = 0; i < 2010; i++) {
dp_memo[i][0] = 0;
dp_memo[0][i] = 0;
}
dp_memo[0][0] = 1; //初期条件
for (int i = 1; i <= N; i++) {
cin >> S[i];
}
for (int j = 1; j <= M; j++) {
cin >> T[j];
}
S[0] = INF;
T[0] = INF; //()のこと
cout << sum(N, M) << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
ll dp_memo[2010][2010];
ll sum_memo[2010][2010];
ll N, M;
vector<ll> S;
vector<ll> T;
ll dp(ll a, ll b);
ll sum(ll c, ll d);
// dp(a,b)は最後にS[a],T[b]を使う共通部分列の個数
// sum(a,b)はdp(0,0) + dp(0,1) + ... + dp(a,b)のこと。
//記号は基本解説PDF準拠
ll dp(ll a, ll b) {
if (a < 0 || b < 0) {
return 0;
} //やばい範囲は0で返す
if (dp_memo[a][b] != -1) {
return dp_memo[a][b];
}
if (S[a] != T[b]) {
return 0;
} else {
return dp_memo[a][b] = sum(a - 1, b - 1) % MOD;
}
}
//漸化式は解説準拠
ll sum(ll c, ll d) {
if (c < 0 || d < 0) {
return 0;
}
if (sum_memo[c][d] != -1) {
return sum_memo[c][d];
} //すでに書き込まれている場合はメモカさいき
return sum_memo[c][d] = (MOD + sum(c - 1, d) + sum(c, d - 1) -
sum(c - 1, d - 1) + dp(c, d)) %
MOD;
}
int main() {
cin >> N >> M;
S.resize(N + 1);
T.resize(M + 1);
for (int i = 0; i < 2010; i++) {
for (int j = 0; j < 2010; j++) {
dp_memo[i][j] = -1;
sum_memo[i][j] = -1;
}
}
//-1は未更新
for (int i = 0; i < 2010; i++) {
dp_memo[i][0] = 0;
dp_memo[0][i] = 0;
}
dp_memo[0][0] = 1; //初期条件
for (int i = 1; i <= N; i++) {
cin >> S[i];
}
for (int j = 1; j <= M; j++) {
cin >> T[j];
}
S[0] = INF;
T[0] = INF; //()のこと
cout << sum(N, M) << endl;
return 0;
}
| [] | 818,792 | 818,793 | u904123392 | cpp |
p03003 | #include <algorithm>
#include <climits>
#include <cmath>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define MOD 1000000007LL
using namespace std;
using pii = pair<int, int>;
using ll = long long;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n, m;
cin >> n >> m;
vector<int> s(n + 1), t(m + 1);
vector<vector<ll>> dp(n + 1, vector<ll>(m + 1));
for (int i = 1; i <= n; i++)
cin >> s[i];
for (int i = 1; i <= m; i++)
cin >> t[i];
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % MOD;
if (s[i] == t[j])
dp[i][j] = (dp[i][j] + 1) % MOD;
else
dp[i][j] = (dp[i][j] - dp[i - 1][j - 1]) % MOD;
}
}
cout << (dp[n][m] + 1) % MOD;
return 0;
}
| #include <algorithm>
#include <climits>
#include <cmath>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define MOD 1000000007LL
using namespace std;
using pii = pair<int, int>;
using ll = long long;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n, m;
cin >> n >> m;
vector<int> s(n + 1), t(m + 1);
vector<vector<ll>> dp(n + 1, vector<ll>(m + 1));
for (int i = 1; i <= n; i++)
cin >> s[i];
for (int i = 1; i <= m; i++)
cin >> t[i];
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % MOD;
if (s[i] == t[j])
dp[i][j] = (dp[i][j] + 1) % MOD;
else
dp[i][j] = (dp[i][j] - dp[i - 1][j - 1] + MOD) % MOD;
}
}
cout << (dp[n][m] + 1) % MOD;
return 0;
}
| [
"assignment.change"
] | 818,819 | 818,820 | u827841970 | cpp |
p03003 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define fi first
#define se second
#define pb push_back
#define all(v) (v).begin(), (v).end()
ll mod = 1000000007;
ll INF = 1000000099;
// cin.tie(0);
// ios::sync_with_stdio(false);
//二分累乗法 modを設定すること
ll dp[2100][2100];
signed main() {
ll n, m;
cin >> n >> m;
vector<ll> s(n, 0), t(m, 0);
for (int i = 0; i < n; i++) {
cin >> s.at(i);
}
for (int i = 0; i < m; i++) {
cin >> t.at(i);
}
memset(dp, 0, sizeof(dp));
dp[0][0] = 1;
for (int i = 0; i < n + 1; i++) {
for (int j = 0; j < m + 1; j++) {
if (i > 0 && j > 0 && s[i - 1] == t[j - 1])
dp[i][j] += dp[i - 1][j - 1];
if (j > 0)
dp[i][j] += dp[i][j - 1];
if (i > 0)
dp[i][j] += dp[i - 1][j];
if (i - 1 >= 0 && j - 1 >= 0)
dp[i][j] -= mod - dp[i - 1][j - 1] % mod;
dp[i][j] %= mod;
}
}
cout << dp[n][m] % mod << endl;
}
/*共通文字列のDPは、それぞれの文字列をどこまで見たかに対応する二つの添え字をもってやる
*/
| #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define fi first
#define se second
#define pb push_back
#define all(v) (v).begin(), (v).end()
ll mod = 1000000007;
ll INF = 1000000099;
// cin.tie(0);
// ios::sync_with_stdio(false);
//二分累乗法 modを設定すること
ll dp[2100][2100];
signed main() {
ll n, m;
cin >> n >> m;
vector<ll> s(n, 0), t(m, 0);
for (int i = 0; i < n; i++) {
cin >> s.at(i);
}
for (int i = 0; i < m; i++) {
cin >> t.at(i);
}
memset(dp, 0, sizeof(dp));
dp[0][0] = 1;
for (int i = 0; i < n + 1; i++) {
for (int j = 0; j < m + 1; j++) {
if (i > 0 && j > 0 && s[i - 1] == t[j - 1])
dp[i][j] += dp[i - 1][j - 1];
if (j > 0)
dp[i][j] += dp[i][j - 1];
if (i > 0)
dp[i][j] += dp[i - 1][j];
if (i - 1 >= 0 && j - 1 >= 0)
dp[i][j] += mod - dp[i - 1][j - 1];
dp[i][j] %= mod;
}
}
cout << dp[n][m] % mod << endl;
}
/*共通文字列のDPは、それぞれの文字列をどこまで見たかに対応する二つの添え字をもってやる
*/
| [
"expression.operator.change",
"expression.operation.binary.remove"
] | 818,827 | 818,828 | u317711717 | cpp |
p03003 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define fi first
#define se second
#define pb push_back
#define all(v) (v).begin(), (v).end()
ll mod = 1000000007;
ll INF = 1000000099;
// cin.tie(0);
// ios::sync_with_stdio(false);
//二分累乗法 modを設定すること
ll dp[2100][2100];
signed main() {
ll n, m;
cin >> n >> m;
vector<ll> s(n, 0), t(m, 0);
for (int i = 0; i < n; i++) {
cin >> s.at(i);
}
for (int i = 0; i < m; i++) {
cin >> t.at(i);
}
memset(dp, 0, sizeof(dp));
dp[0][0] = 1;
for (int i = 0; i < n + 1; i++) {
for (int j = 0; j < m + 1; j++) {
if (i > 0 && j > 0 && s[i - 1] == t[j - 1])
dp[i][j] += dp[i - 1][j - 1];
if (j > 0)
dp[i][j] += dp[i][j - 1];
if (i > 0)
dp[i][j] += dp[i - 1][j];
if (i - 1 >= 0 && j - 1 >= 0)
dp[i][j] -= mod - dp[i - 1][j - 1] % mod;
dp[i][j] %= mod;
}
}
cout << dp[n][m] % mod << endl;
}
/*共通文字列のDPは、それぞれの文字列をどこまで見たかに対応する二つの添え字をもってやる
*/
| #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define fi first
#define se second
#define pb push_back
#define all(v) (v).begin(), (v).end()
ll mod = 1000000007;
ll INF = 1000000099;
// cin.tie(0);
// ios::sync_with_stdio(false);
//二分累乗法 modを設定すること
ll dp[2100][2100];
signed main() {
ll n, m;
cin >> n >> m;
vector<ll> s(n, 0), t(m, 0);
for (int i = 0; i < n; i++) {
cin >> s.at(i);
}
for (int i = 0; i < m; i++) {
cin >> t.at(i);
}
memset(dp, 0, sizeof(dp));
dp[0][0] = 1;
for (int i = 0; i < n + 1; i++) {
for (int j = 0; j < m + 1; j++) {
if (i > 0 && j > 0 && s[i - 1] == t[j - 1])
dp[i][j] += dp[i - 1][j - 1];
if (j > 0)
dp[i][j] += dp[i][j - 1];
if (i > 0)
dp[i][j] += dp[i - 1][j];
if (i - 1 >= 0 && j - 1 >= 0)
dp[i][j] += mod - dp[i - 1][j - 1] % mod;
dp[i][j] %= mod;
}
}
cout << dp[n][m] % mod << endl;
}
/*共通文字列のDPは、それぞれの文字列をどこまで見たかに対応する二つの添え字をもってやる
*/
| [
"expression.operator.change"
] | 818,827 | 818,830 | u317711717 | cpp |
p03003 | #include <iostream>
using namespace std;
const int C = 2005;
int s[C];
int t[C];
long long dp[C][C];
long long MOD = 1000000009;
int main() {
int N, M;
while (cin >> N >> M) {
for (int i = 0; i < C; i++) {
s[i] = t[i] = 0;
for (int j = 0; j < C; j++) {
dp[i][j] = 0;
}
dp[i][0] = dp[0][i] = 1;
}
for (int i = 1; i <= N; i++) {
cin >> s[i];
}
for (int i = 1; i <= M; i++) {
cin >> t[i];
}
for (int i = 1; i <= N; i++) {
for (int j = 1; j <= M; j++) {
dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % MOD;
if (s[i] != t[j]) {
dp[i][j] = (dp[i][j] - dp[i - 1][j - 1] + MOD) % MOD;
}
}
}
cout << dp[N][M] << endl;
}
}
| #include <iostream>
using namespace std;
const int C = 2005;
int s[C];
int t[C];
long long dp[C][C];
long long MOD = 1000000007;
int main() {
int N, M;
while (cin >> N >> M) {
for (int i = 0; i < C; i++) {
s[i] = t[i] = 0;
for (int j = 0; j < C; j++) {
dp[i][j] = 0;
}
dp[i][0] = dp[0][i] = 1;
}
for (int i = 1; i <= N; i++) {
cin >> s[i];
}
for (int i = 1; i <= M; i++) {
cin >> t[i];
}
for (int i = 1; i <= N; i++) {
for (int j = 1; j <= M; j++) {
dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % MOD;
if (s[i] != t[j]) {
dp[i][j] = (dp[i][j] - dp[i - 1][j - 1] + MOD) % MOD;
}
}
}
cout << dp[N][M] << endl;
}
}
| [
"literal.number.change",
"variable_declaration.value.change"
] | 818,838 | 818,839 | u159335277 | cpp |
p03003 | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define mod 1000000007
int n, m, s[2003], t[2003], d[2003][2003];
bool db = 0;
int a(int u, int v) {
int res = (u + v) % mod;
if (res < 0)
res += mod;
return res;
}
int dp(int u, int v) {
int &ans = d[u][v];
if (ans != LONG_MIN) {
return ans;
}
if (u == 0 || v == 0)
return ans = 1;
return ans = a(a(dp(u, v - 1), dp(u - 1, v)),
(s[u] != t[v]) * dp(u - 1, v - 1));
}
signed main() {
cin >> n >> m;
for (int i = 1; i <= n; i++)
cin >> s[i];
for (int i = 1; i <= m; i++)
cin >> t[i];
for (int i = 0; i <= n; i++)
for (int j = 0; j <= m; j++)
d[i][j] = LONG_MIN;
cout << dp(n, m);
}
| #include <bits/stdc++.h>
using namespace std;
#define int long long
#define mod 1000000007
int n, m, s[2003], t[2003], d[2003][2003];
bool db = 0;
int a(int u, int v) {
int res = (u + v) % mod;
if (res < 0)
res += mod;
return res;
}
int dp(int u, int v) {
int &ans = d[u][v];
if (ans != LONG_MIN) {
return ans;
}
if (u == 0 || v == 0)
return ans = 1;
return ans = a(a(dp(u, v - 1), dp(u - 1, v)),
-(s[u] != t[v]) * dp(u - 1, v - 1));
}
signed main() {
cin >> n >> m;
for (int i = 1; i <= n; i++)
cin >> s[i];
for (int i = 1; i <= m; i++)
cin >> t[i];
for (int i = 0; i <= n; i++)
for (int j = 0; j <= m; j++)
d[i][j] = LONG_MIN;
cout << dp(n, m);
}
| [
"expression.operation.unary.add",
"call.arguments.change",
"function.return_value.change"
] | 818,844 | 818,845 | u839109522 | cpp |
p03005 | #include <bits/stdc++.h>
#define I inline void
using namespace std;
using ll = long long;
using ld = long double;
const int N = 2e6 + 7;
// How interesting!
int n;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
// freopen("in.in", "r" , stdin) ;
int k;
cin >> k;
if (k == 1)
cout << 0;
else
cout << n - k;
return 0;
} | #include <bits/stdc++.h>
#define I inline void
using namespace std;
using ll = long long;
using ld = long double;
const int N = 2e6 + 7;
// How interesting!
int n;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
// freopen("in.in", "r" , stdin) ;
int k;
cin >> n >> k;
if (k == 1)
cout << 0;
else
cout << n - k;
return 0;
} | [
"expression.operation.binary.add"
] | 818,850 | 818,851 | u812179198 | cpp |
p03005 | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) begin(v), end(v)
using ll = long long;
int main() {
int n, k;
cin >> n >> k;
if (k == 0 || n == k)
cout << 0 << endl;
else
cout << n - k << endl;
} | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) begin(v), end(v)
using ll = long long;
int main() {
int n, k;
cin >> n >> k;
if (k == 1 || n == k)
cout << 0 << endl;
else
cout << n - k << endl;
} | [
"literal.number.change",
"control_flow.branch.if.condition.change"
] | 818,861 | 818,862 | u587622858 | cpp |
p03005 | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) begin(v), end(v)
using ll = long long;
int main() {
int n, k;
cin >> n >> k;
if (k == 0 && n == k)
cout << 0 << endl;
else
cout << n - k << endl;
} | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) begin(v), end(v)
using ll = long long;
int main() {
int n, k;
cin >> n >> k;
if (k == 1 || n == k)
cout << 0 << endl;
else
cout << n - k << endl;
} | [] | 818,864 | 818,862 | u587622858 | cpp |
p03005 | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) begin(v), end(v)
using ll = long long;
int main() {
int n, k;
cin >> n >> k;
if (k == 0)
cout << 0 << endl;
else
cout << n - k << endl;
} | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) begin(v), end(v)
using ll = long long;
int main() {
int n, k;
cin >> n >> k;
if (k == 1 || n == k)
cout << 0 << endl;
else
cout << n - k << endl;
} | [
"literal.number.change",
"control_flow.branch.if.condition.change"
] | 818,865 | 818,862 | u587622858 | cpp |
p03005 | #include <algorithm>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vvll = vector<vll>;
using vc = vector<char>;
using vvc = vector<vc>;
using vb = vector<bool>;
using vvb = vector<vb>;
using pll = pair<ll, ll>;
#define all(v) v.begin(), v.end()
const ll INF = 1e18;
const ll mod = 1e9 + 7;
const double pie = acos(-1);
vll dx4 = {-1, 0, 1, 0};
vll dy4 = {0, -1, 0, 1};
vll dx8 = {-1, 0, 1, 1, 1, 0, -1, -1};
vll dy8 = {-1, -1, -1, 0, 1, 1, 1, 0};
void fix_cout() { cout << fixed << setprecision(20); }
ll gcd(ll a, ll b) {
if (b == 0)
return a;
return gcd(b, a % b);
}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
void chmax(ll &a, ll b) {
if (a < b)
a = b;
}
void chmin(ll &a, ll b) {
if (a > b)
a = b;
}
int main() {
ll n, k;
cin >> n >> k;
cout << (n == 1 ? 0 : k - n) << endl;
} | #include <algorithm>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vvll = vector<vll>;
using vc = vector<char>;
using vvc = vector<vc>;
using vb = vector<bool>;
using vvb = vector<vb>;
using pll = pair<ll, ll>;
#define all(v) v.begin(), v.end()
const ll INF = 1e18;
const ll mod = 1e9 + 7;
const double pie = acos(-1);
vll dx4 = {-1, 0, 1, 0};
vll dy4 = {0, -1, 0, 1};
vll dx8 = {-1, 0, 1, 1, 1, 0, -1, -1};
vll dy8 = {-1, -1, -1, 0, 1, 1, 1, 0};
void fix_cout() { cout << fixed << setprecision(20); }
ll gcd(ll a, ll b) {
if (b == 0)
return a;
return gcd(b, a % b);
}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
void chmax(ll &a, ll b) {
if (a < b)
a = b;
}
void chmin(ll &a, ll b) {
if (a > b)
a = b;
}
int main() {
ll n, k;
cin >> n >> k;
cout << (k == 1 ? 0 : n - k) << endl;
} | [
"identifier.change",
"control_flow.loop.for.condition.change",
"io.output.change",
"expression.operation.binary.remove"
] | 818,866 | 818,867 | u993074316 | cpp |
p03005 | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define debug(var) \
do { \
cout << #var << " : "; \
view(var); \
} while (0)
template <class T> bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
template <class T> bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
using namespace std;
template <class T> void view(T e) { cout << e << endl; }
template <class T> void view(const vector<T> &v) {
for (const auto &e : v) {
cout << e << " ";
}
cout << endl;
}
template <class T> void view(const vector<vector<T>> &vv) {
for (const auto &v : vv) {
view(v);
}
}
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int, int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;
int main() {
int n, k;
cin >> n >> k;
if (n == 1)
cout << 0 << endl;
else
cout << n - k << endl;
}
| #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define debug(var) \
do { \
cout << #var << " : "; \
view(var); \
} while (0)
template <class T> bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
template <class T> bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
using namespace std;
template <class T> void view(T e) { cout << e << endl; }
template <class T> void view(const vector<T> &v) {
for (const auto &e : v) {
cout << e << " ";
}
cout << endl;
}
template <class T> void view(const vector<vector<T>> &vv) {
for (const auto &v : vv) {
view(v);
}
}
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int, int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;
int main() {
int n, k;
cin >> n >> k;
if (k == 1)
cout << 0 << endl;
else
cout << n - k << endl;
}
| [
"identifier.change",
"control_flow.branch.if.condition.change"
] | 818,868 | 818,869 | u697968316 | cpp |
p03005 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, M;
cin >> N >> M;
if (M == 1)
printf("0");
else
printf("%d", N - M - 2);
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, M;
cin >> N >> M;
if (M == 1)
printf("0");
else
printf("%d", N - M);
return 0;
} | [
"expression.operation.binary.remove"
] | 818,870 | 818,871 | u527058497 | cpp |
p03005 | #include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
struct point {
int x;
int y;
};
int i, j, k, count1 = 0, count2 = 0;
int main() {
int n, k;
cin >> n >> k;
cout << (k == 1 ? 1 : n - k) << endl;
} | #include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
struct point {
int x;
int y;
};
int i, j, k, count1 = 0, count2 = 0;
int main() {
int n, k;
cin >> n >> k;
cout << (k == 1 ? 0 : n - k) << endl;
} | [
"literal.number.change",
"io.output.change"
] | 818,883 | 818,884 | u225660136 | cpp |
p03005 | const int LG = 21;
const int FN = 400005;
const long long MOD = 1e9 + 7;
const long long INF = 1e9;
const long long INFLL = 1e18;
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
#define forn(i, n) for (int(i) = 0; (i) != (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define fi first
#define se second
#define re return
#define pb push_back
#define uniq(x) \
sort(all(x)); \
(x).resize(unique(all(x)) - (x).begin())
#ifdef LOCAL
#define dbg(x) cerr << __LINE__ << " " << #x << " " << x << endl
#define ln cerr << __LINE__ << endl
#else
#define dbg(x) void(0)
#define ln void(0)
#endif // LOCAL
int cx[4] = {-1, 0, 1, 0};
int cy[4] = {0, -1, 0, 1};
string Ans[2] = {"No", "Yes"};
string ANS[2] = {"NO", "YES"};
ll inq(ll x, ll y) {
if (!y)
re 1 % MOD;
ll l = inq(x, y / 2);
if (y % 2)
re l *l % MOD *x % MOD;
re l *l % MOD;
}
ll rev(ll x) { return inq(x, MOD - 2); }
bool __precomputed_combinatorics = 0;
vector<ll> __fact, __ufact, __rev;
void __precompute_combinatorics() {
__precomputed_combinatorics = 1;
__fact.resize(FN);
__ufact.resize(FN);
__rev.resize(FN);
__rev[1] = 1;
for (int i = 2; i < FN; i++)
__rev[i] = MOD - __rev[MOD % i] * (MOD / i) % MOD;
__fact[0] = 1, __ufact[0] = 1;
for (int i = 1; i < FN; i++)
__fact[i] = __fact[i - 1] * i % MOD,
__ufact[i] = __ufact[i - 1] * __rev[i] % MOD;
}
ll fact(int x) {
if (!__precomputed_combinatorics)
__precompute_combinatorics();
return __fact[x];
}
ll cnk(int n, int k) {
if (k < 0 || k > n)
return 0;
if (!__precomputed_combinatorics)
__precompute_combinatorics();
return __fact[n] * __ufact[n - k] % MOD * __ufact[k] % MOD;
}
int Root(int x, vector<int> &root) {
if (x == root[x])
return x;
return root[x] = Root(root[x], root);
}
void Merge(int v, int u, vector<int> &root, vector<int> &sz) {
v = Root(v, root), u = Root(u, root);
if (v == u)
return;
if (sz[v] < sz[u]) {
sz[u] += sz[v];
root[v] = u;
} else {
sz[v] += sz[u];
root[u] = v;
}
}
int ok(int x, int n) { return 0 <= x && x < n; }
void bfs(int v, vi &dist, vector<vi> &graph) {
fill(all(dist), -1);
dist[v] = 0;
vi q = {v};
for (int i = 0; i < q.size(); i++) {
for (auto u : graph[q[i]]) {
if (dist[u] == -1) {
dist[u] = dist[q[i]] + 1;
q.push_back(u);
}
}
}
}
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n, k;
cin >> n >> k;
if (n == 1)
cout << 0;
else
cout << n - k;
}
/* Note:
Check constants at the beginning of the code.
N is set to 4e5 but be careful in problems with large constant factor.
Setting N in every problem is more effective.
Check corner cases.
N = 1
No def int long long for now.
Add something here.
*/
| const int LG = 21;
const int FN = 400005;
const long long MOD = 1e9 + 7;
const long long INF = 1e9;
const long long INFLL = 1e18;
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
#define forn(i, n) for (int(i) = 0; (i) != (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define fi first
#define se second
#define re return
#define pb push_back
#define uniq(x) \
sort(all(x)); \
(x).resize(unique(all(x)) - (x).begin())
#ifdef LOCAL
#define dbg(x) cerr << __LINE__ << " " << #x << " " << x << endl
#define ln cerr << __LINE__ << endl
#else
#define dbg(x) void(0)
#define ln void(0)
#endif // LOCAL
int cx[4] = {-1, 0, 1, 0};
int cy[4] = {0, -1, 0, 1};
string Ans[2] = {"No", "Yes"};
string ANS[2] = {"NO", "YES"};
ll inq(ll x, ll y) {
if (!y)
re 1 % MOD;
ll l = inq(x, y / 2);
if (y % 2)
re l *l % MOD *x % MOD;
re l *l % MOD;
}
ll rev(ll x) { return inq(x, MOD - 2); }
bool __precomputed_combinatorics = 0;
vector<ll> __fact, __ufact, __rev;
void __precompute_combinatorics() {
__precomputed_combinatorics = 1;
__fact.resize(FN);
__ufact.resize(FN);
__rev.resize(FN);
__rev[1] = 1;
for (int i = 2; i < FN; i++)
__rev[i] = MOD - __rev[MOD % i] * (MOD / i) % MOD;
__fact[0] = 1, __ufact[0] = 1;
for (int i = 1; i < FN; i++)
__fact[i] = __fact[i - 1] * i % MOD,
__ufact[i] = __ufact[i - 1] * __rev[i] % MOD;
}
ll fact(int x) {
if (!__precomputed_combinatorics)
__precompute_combinatorics();
return __fact[x];
}
ll cnk(int n, int k) {
if (k < 0 || k > n)
return 0;
if (!__precomputed_combinatorics)
__precompute_combinatorics();
return __fact[n] * __ufact[n - k] % MOD * __ufact[k] % MOD;
}
int Root(int x, vector<int> &root) {
if (x == root[x])
return x;
return root[x] = Root(root[x], root);
}
void Merge(int v, int u, vector<int> &root, vector<int> &sz) {
v = Root(v, root), u = Root(u, root);
if (v == u)
return;
if (sz[v] < sz[u]) {
sz[u] += sz[v];
root[v] = u;
} else {
sz[v] += sz[u];
root[u] = v;
}
}
int ok(int x, int n) { return 0 <= x && x < n; }
void bfs(int v, vi &dist, vector<vi> &graph) {
fill(all(dist), -1);
dist[v] = 0;
vi q = {v};
for (int i = 0; i < q.size(); i++) {
for (auto u : graph[q[i]]) {
if (dist[u] == -1) {
dist[u] = dist[q[i]] + 1;
q.push_back(u);
}
}
}
}
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n, k;
cin >> n >> k;
if (k == 1)
cout << 0;
else
cout << n - k;
}
/* Note:
Check constants at the beginning of the code.
N is set to 4e5 but be careful in problems with large constant factor.
Setting N in every problem is more effective.
Check corner cases.
N = 1
No def int long long for now.
Add something here.
*/
| [
"identifier.change",
"control_flow.branch.if.condition.change"
] | 818,889 | 818,890 | u798339690 | cpp |
p03005 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int n, k;
cin >> n >> k;
if (n == 0) {
cout << 0 << endl;
return 0;
}
cout << n - k << endl;
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int n, k;
cin >> n >> k;
if (k == 1) {
cout << 0 << endl;
return 0;
}
cout << n - k << endl;
} | [
"identifier.change",
"control_flow.branch.if.condition.change",
"literal.number.change"
] | 818,891 | 818,892 | u582684800 | cpp |
p03005 | #include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <string>
#include <unistd.h>
#include <utility>
#include <vector>
using namespace std;
typedef long long int ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define drep(i, n) for (int i = n - 1; i >= 0; i--)
#define itrep(itr, base) for (auto itr = base.begin(); itr != base.end(); itr++)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define yes cout << "yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define no cout << "no" << endl
#define PI 3.14159265359
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const int mod = 1000000007;
void P(int x) { cout << x << endl; }
void P(long x) { cout << x << endl; }
void P(double x) { cout << x << endl; }
void P(ll x) { cout << x << endl; }
void P(string x) { cout << x << endl; }
void P(char x) { cout << x << endl; }
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 main() {
int n, k;
cin >> n >> k;
if (k == 1)
P(n);
else
P(n - k);
return 0;
}
| #include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <string>
#include <unistd.h>
#include <utility>
#include <vector>
using namespace std;
typedef long long int ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define drep(i, n) for (int i = n - 1; i >= 0; i--)
#define itrep(itr, base) for (auto itr = base.begin(); itr != base.end(); itr++)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define yes cout << "yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define no cout << "no" << endl
#define PI 3.14159265359
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const int mod = 1000000007;
void P(int x) { cout << x << endl; }
void P(long x) { cout << x << endl; }
void P(double x) { cout << x << endl; }
void P(ll x) { cout << x << endl; }
void P(string x) { cout << x << endl; }
void P(char x) { cout << x << endl; }
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 main() {
int n, k;
cin >> n >> k;
if (k == 1)
P(0);
else
P(n - k);
return 0;
}
| [
"identifier.replace.remove",
"literal.replace.add",
"call.arguments.change"
] | 818,893 | 818,894 | u152335469 | cpp |
p03005 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
if (k == 1)
cout << 1 << endl;
else
cout << n - k << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
if (k == 1)
cout << 0 << endl;
else
cout << n - k << endl;
return 0;
}
| [
"literal.number.change",
"io.output.change"
] | 818,907 | 818,908 | u729703601 | cpp |
p03005 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
int n, k;
cin >> n >> k;
if (k == 0)
cout << 0 << endl;
else
cout << n - k << endl;
} | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
int n, k;
cin >> n >> k;
if (k == 1)
cout << 0 << endl;
else
cout << n - k << endl;
} | [
"literal.number.change",
"control_flow.branch.if.condition.change"
] | 818,909 | 818,910 | u440217234 | cpp |
p03005 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i, n) for (ll i = 0; i < n; i++)
#define INF 9223372036854775807
#define all(x) (x).begin(), (x).end()
ll ts = 1000000007;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
ll n, k;
cin >> n >> k;
cout << (n == k ? 0 : n - k) << "\n";
} | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i, n) for (ll i = 0; i < n; i++)
#define INF 9223372036854775807
#define all(x) (x).begin(), (x).end()
ll ts = 1000000007;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
ll n, k;
cin >> n >> k;
cout << (n == k || k == 1 ? 0 : n - k) << "\n";
} | [
"expression.operation.binary.add"
] | 818,911 | 818,912 | u166419774 | cpp |
p03005 | #include <bits/stdc++.h>
using namespace std;
int main(void) {
int n, k;
cin >> n >> k;
if (k != 1)
n -= k;
cout << n << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main(void) {
int n, k;
cin >> n >> k;
if (k != 1)
n -= k;
else
n = 0;
cout << n << endl;
return 0;
}
| [
"control_flow.branch.else_if.replace.remove",
"control_flow.branch.if.replace.add",
"assignment.add"
] | 818,917 | 818,918 | u890331732 | cpp |
p03005 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, K;
cin >> N >> K;
vector<int> a(N);
for (int i = 0; i < N; i++) {
if (i < N - 1) {
a.at(i) = 1;
N--;
} else
a.at(i) = N;
}
cout << a.at(N - 1) - a.at(0) << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, K;
cin >> N >> K;
vector<int> a(K);
for (int i = 0; i < K; i++) {
if (i < K - 1) {
a.at(i) = 1;
N--;
} else
a.at(i) = N;
}
cout << a.at(K - 1) - a.at(0) << endl;
} | [
"identifier.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.change",
"control_flow.branch.if.condition.change",
"io.output.change"
] | 818,919 | 818,920 | u936602931 | cpp |
p03005 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
if (n == 1)
n = k;
int ans = n - k;
cout << ans << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
if (k == 1)
n = k;
int ans = n - k;
cout << ans << endl;
return 0;
} | [
"identifier.change",
"control_flow.branch.if.condition.change"
] | 818,923 | 818,924 | u255302563 | cpp |
p03005 | #include <bits/stdc++.h>
#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 _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define ll long long
#define ALL(v) (v).begin(), (v).end()
using namespace std;
void solve() {
int n, k;
cin >> n >> k;
if (k = 1)
cout << 0 << endl;
else
cout << n - k << endl;
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
solve();
return 0;
}
| #include <bits/stdc++.h>
#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 _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define ll long long
#define ALL(v) (v).begin(), (v).end()
using namespace std;
void solve() {
int n, k;
cin >> n >> k;
if (k == 1)
cout << 0 << endl;
else
cout << n - k << endl;
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
solve();
return 0;
}
| [
"expression.operation.compare.replace.add",
"assignment.replace.remove",
"misc.typo"
] | 818,925 | 818,926 | u863717702 | cpp |
p03005 | #include <algorithm> //next_permutation
#include <iostream>
#include <set>
#include <stdio.h> //printf("%.*f\n",*********);
#include <string> //char('a'=32+'A')
#include <vector> //s.erase(n),vector
//to_string,string,substr
#include <cmath> //min,max
#include <complex>
#include <iomanip>
#include <locale>
#include <math.h>
#include <queue>
#include <random>
#include <sstream>
#include <time.h>
#include <utility> //swap
#define rt "\n"
#define rep(i, n) for (int i = 0; i < n; i++)
#define rop(i, n) for (int i = 1; i <= n; i++) // start==1
#define drep(i, n) for (int i = n - 1; 0 <= i; i--)
#define drop(i, n) for (int i = n; 0 < i; i--) // end==1
#define yes(ans) \
if (ans) \
cout << "yes" << rt; \
else \
cout << "no" << rt;
#define Yes(ans) \
if (ans) \
cout << "Yes" << rt; \
else \
cout << "No" << rt;
#define YES(ans) \
if (ans) \
cout << "YES" << rt; \
else \
cout << "NO" << rt;
#define Yay(ans) \
if (ans) \
cout << "Yay!" << rt; \
else \
cout << ":(" << rt;
#define sec(a, b, ans) \
if (ans) \
cout << a << rt; \
else \
cout << b << rt;
#define vcin(a, n) rep(i, n) cin >> a[i]; // vcin(配列名),(繰り返し回数)
#define sort(s) sort(s.begin(), s.end()) //昇順
#define reve(s) reverse(s.begin(), s.end()) //反転
#define please return
#define AC 0
#define rapid_pleaseAC_fast \
cin.tie(0); \
ios::sync_with_stdio(false)
#define pi 3.1415926535897932384626 // pi
#define nine 1000000000 // 10^9
using namespace std;
typedef vector<int> vint;
typedef long double ldouble;
typedef vector<string> vstr;
typedef vector<char> vchar;
typedef vector<double> vdou;
typedef vector<double> vdouble;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<char>> vvchar;
typedef vector<vector<double>> vvdouble;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<string>> vvstr;
typedef vector<vector<bool>> vvbool;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;
long long GCD(long long a, long long b) {
if (b == 0)
return a;
else
return GCD(b, a % b);
}
long long LCM(long long a, long long b) { return a * b / GCD(a, b); }
unsigned GetDigit(unsigned num) { return std::to_string(num).length(); }
int tow(int n) { // 2のn乗
if (n == 0)
return 1;
int x = tow(n / 2);
x *= x;
if (n % 2 == 1)
x *= 2;
return x; //@domino
}
int KETA(int n) { // Sum of Each Digit
int sum = 0;
while (n > 0) {
sum += n % 10;
n /= 10;
}
return sum;
}
unsigned ND(unsigned num) { // Number of Digits
return std::to_string(num).length(); // outmax=10
}
bool KIBN(string s) {
rep(i, s.size() / 2) {
if (s[i] != s[s.size() - 1 - i])
return false;
}
return true;
}
/*
(char)toupper(a[n])=文字列のn文字目を大文字で出力
pow(a,b)=aのb乗
*/
int main(void) {
rapid_pleaseAC_fast;
int n, k;
cin >> n >> k;
if (k == 0) {
cout << 0 << rt;
} else {
cout << n - k << rt;
}
please AC;
}
//参考:--- | #include <algorithm> //next_permutation
#include <iostream>
#include <set>
#include <stdio.h> //printf("%.*f\n",*********);
#include <string> //char('a'=32+'A')
#include <vector> //s.erase(n),vector
//to_string,string,substr
#include <cmath> //min,max
#include <complex>
#include <iomanip>
#include <locale>
#include <math.h>
#include <queue>
#include <random>
#include <sstream>
#include <time.h>
#include <utility> //swap
#define rt "\n"
#define rep(i, n) for (int i = 0; i < n; i++)
#define rop(i, n) for (int i = 1; i <= n; i++) // start==1
#define drep(i, n) for (int i = n - 1; 0 <= i; i--)
#define drop(i, n) for (int i = n; 0 < i; i--) // end==1
#define yes(ans) \
if (ans) \
cout << "yes" << rt; \
else \
cout << "no" << rt;
#define Yes(ans) \
if (ans) \
cout << "Yes" << rt; \
else \
cout << "No" << rt;
#define YES(ans) \
if (ans) \
cout << "YES" << rt; \
else \
cout << "NO" << rt;
#define Yay(ans) \
if (ans) \
cout << "Yay!" << rt; \
else \
cout << ":(" << rt;
#define sec(a, b, ans) \
if (ans) \
cout << a << rt; \
else \
cout << b << rt;
#define vcin(a, n) rep(i, n) cin >> a[i]; // vcin(配列名),(繰り返し回数)
#define sort(s) sort(s.begin(), s.end()) //昇順
#define reve(s) reverse(s.begin(), s.end()) //反転
#define please return
#define AC 0
#define rapid_pleaseAC_fast \
cin.tie(0); \
ios::sync_with_stdio(false)
#define pi 3.1415926535897932384626 // pi
#define nine 1000000000 // 10^9
using namespace std;
typedef vector<int> vint;
typedef long double ldouble;
typedef vector<string> vstr;
typedef vector<char> vchar;
typedef vector<double> vdou;
typedef vector<double> vdouble;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<char>> vvchar;
typedef vector<vector<double>> vvdouble;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<string>> vvstr;
typedef vector<vector<bool>> vvbool;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;
long long GCD(long long a, long long b) {
if (b == 0)
return a;
else
return GCD(b, a % b);
}
long long LCM(long long a, long long b) { return a * b / GCD(a, b); }
unsigned GetDigit(unsigned num) { return std::to_string(num).length(); }
int tow(int n) { // 2のn乗
if (n == 0)
return 1;
int x = tow(n / 2);
x *= x;
if (n % 2 == 1)
x *= 2;
return x; //@domino
}
int KETA(int n) { // Sum of Each Digit
int sum = 0;
while (n > 0) {
sum += n % 10;
n /= 10;
}
return sum;
}
unsigned ND(unsigned num) { // Number of Digits
return std::to_string(num).length(); // outmax=10
}
bool KIBN(string s) {
rep(i, s.size() / 2) {
if (s[i] != s[s.size() - 1 - i])
return false;
}
return true;
}
/*
(char)toupper(a[n])=文字列のn文字目を大文字で出力
pow(a,b)=aのb乗
*/
int main(void) {
rapid_pleaseAC_fast;
int n, k;
cin >> n >> k;
if (k == 1) {
cout << 0 << rt;
} else {
cout << n - k << rt;
}
please AC;
}
//参考:--- | [
"literal.number.change",
"control_flow.branch.if.condition.change"
] | 818,927 | 818,928 | u742306624 | cpp |
p03005 | #include <iostream>
using namespace std;
#define loop(i, n, a) for (int i = a; i < n; ++i)
int main() {
int n, k;
cin >> n >> k;
if (n == 1) {
cout << 0;
return 0;
}
cout << n - k;
return 0;
} | #include <iostream>
using namespace std;
#define loop(i, n, a) for (int i = a; i < n; ++i)
int main() {
int n, k;
cin >> n >> k;
if (k == 1) {
cout << 0;
return 0;
}
cout << n - k;
return 0;
} | [
"identifier.change",
"control_flow.branch.if.condition.change"
] | 818,931 | 818,932 | u089230684 | cpp |
p03005 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define rep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define rREP(i, m, n) for (int(i) = (n)-1; (i) >= (m); --(i))
#define all(x) (x).begin(), (x).end()
#define out(y, x, h, w) (y) < 0 || (x) < 0 || (y) >= (h) || (x) >= (w)
constexpr int INF = 1000000001;
constexpr ll mod = 1000000007;
constexpr double PI = 3.1415926535897932;
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
inline void init() {
cin.tie(nullptr);
cout.tie(nullptr);
ios::sync_with_stdio(false);
cout << fixed << setprecision(15);
}
int main() {
init();
int N, K;
cin >> N >> K;
if (K == 1)
cout << 0 << "\n";
cout << N - K << "\n";
return 0;
} | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define rep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define rREP(i, m, n) for (int(i) = (n)-1; (i) >= (m); --(i))
#define all(x) (x).begin(), (x).end()
#define out(y, x, h, w) (y) < 0 || (x) < 0 || (y) >= (h) || (x) >= (w)
constexpr int INF = 1000000001;
constexpr ll mod = 1000000007;
constexpr double PI = 3.1415926535897932;
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
inline void init() {
cin.tie(nullptr);
cout.tie(nullptr);
ios::sync_with_stdio(false);
cout << fixed << setprecision(15);
}
int main() {
init();
int N, K;
cin >> N >> K;
if (K == 1) {
cout << 0 << "\n";
} else
cout << N - K << "\n";
return 0;
} | [
"control_flow.branch.else.add"
] | 818,933 | 818,934 | u813559924 | cpp |
p03005 | #include <bits/stdc++.h>
using namespace std;
namespace FAST_IO {
template <typename T> void read(T &a) {
a = 0;
int f = 1;
char c = getchar();
while (!isdigit(c)) {
if (c == '-') {
f = -1;
}
c = getchar();
}
while (isdigit(c)) {
a = a * 10 + c - '0';
c = getchar();
}
a = a * f;
}
template <typename T> void write(T a) {
if (a < 0) {
a = -a;
putchar('-');
}
if (a > 9) {
write(a / 10);
}
putchar(a % 10 + '0');
}
template <typename T> void writeln(T a) {
write(a);
puts("");
}
} // namespace FAST_IO
int main() {
int n, k;
cin >> n >> k;
if (n == 1) {
cout << 0;
} else {
cout << n - k;
}
}
| #include <bits/stdc++.h>
using namespace std;
namespace FAST_IO {
template <typename T> void read(T &a) {
a = 0;
int f = 1;
char c = getchar();
while (!isdigit(c)) {
if (c == '-') {
f = -1;
}
c = getchar();
}
while (isdigit(c)) {
a = a * 10 + c - '0';
c = getchar();
}
a = a * f;
}
template <typename T> void write(T a) {
if (a < 0) {
a = -a;
putchar('-');
}
if (a > 9) {
write(a / 10);
}
putchar(a % 10 + '0');
}
template <typename T> void writeln(T a) {
write(a);
puts("");
}
} // namespace FAST_IO
int main() {
int n, k;
cin >> n >> k;
if (k == 1) {
cout << 0;
} else {
cout << n - k;
}
}
| [
"identifier.change",
"control_flow.branch.if.condition.change"
] | 818,935 | 818,936 | u207310767 | cpp |
p03005 | #include <bits/stdc++.h>
int main(int argc, char **argv) {
int n, k;
std::cin >> n >> k;
if (k == 0)
std::cout << '0';
else
std::cout << n - k;
std::cout << '\n';
return 0;
}
| #include <bits/stdc++.h>
int main(int argc, char **argv) {
int n, k;
std::cin >> n >> k;
if (k == 1)
std::cout << '0';
else
std::cout << n - k;
std::cout << '\n';
return 0;
}
| [
"literal.number.change",
"control_flow.branch.if.condition.change"
] | 818,937 | 818,938 | u316440712 | cpp |
p03005 | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <string>
#include <vector>
#pragma region Macros
#define int long long
#define double long double
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;
#define rep(i, n) for (int i = 0; i < n; i++)
#define REP(i, n) for (int i = 1; i <= n; i++)
#define LAST(x) x[x.size() - 1]
#define ALL(x) (x).begin(), (x).end()
#define swap(a, b) (a += b, b = a - b, a -= b)
#define CEIL(a, b) ((a + b - 1) / b)
int FACT(int a) {
if (a == 0)
return 1;
else
return a * FACT(a - 1);
}
int nPr(int n, int r) {
int s = n - r + 1;
int sum = 1;
for (int i = s; i <= n; i++)
sum *= i;
return sum;
}
// int nCr1(int n, int r)
// int nCr2(int n, int r)
int GCD(int a, int b) // assuming a,b >= 1
{
if (a < b)
swap(a, b);
if (b == 0)
return a;
if (a % b == 0)
return b;
return GCD(b, a % b);
}
int LCM(int a, int b) // assuming a,b >= 1
{
return a * b / GCD(a, b);
}
double LOG(int a, int b) { return log(b) / log(a); }
inline bool BETWEEN(int x, int min, int max) {
if (min <= x && x <= max)
return true;
else
return false;
}
using namespace std;
#pragma endregion
signed main() {
int N, K;
cin >> N >> K;
if (N != 1)
cout << N - K;
else
cout << 0;
} | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <string>
#include <vector>
#pragma region Macros
#define int long long
#define double long double
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;
#define rep(i, n) for (int i = 0; i < n; i++)
#define REP(i, n) for (int i = 1; i <= n; i++)
#define LAST(x) x[x.size() - 1]
#define ALL(x) (x).begin(), (x).end()
#define swap(a, b) (a += b, b = a - b, a -= b)
#define CEIL(a, b) ((a + b - 1) / b)
int FACT(int a) {
if (a == 0)
return 1;
else
return a * FACT(a - 1);
}
int nPr(int n, int r) {
int s = n - r + 1;
int sum = 1;
for (int i = s; i <= n; i++)
sum *= i;
return sum;
}
// int nCr1(int n, int r)
// int nCr2(int n, int r)
int GCD(int a, int b) // assuming a,b >= 1
{
if (a < b)
swap(a, b);
if (b == 0)
return a;
if (a % b == 0)
return b;
return GCD(b, a % b);
}
int LCM(int a, int b) // assuming a,b >= 1
{
return a * b / GCD(a, b);
}
double LOG(int a, int b) { return log(b) / log(a); }
inline bool BETWEEN(int x, int min, int max) {
if (min <= x && x <= max)
return true;
else
return false;
}
using namespace std;
#pragma endregion
signed main() {
int N, K;
cin >> N >> K;
if (K != 1)
cout << N - K;
else
cout << 0;
} | [
"identifier.change",
"control_flow.branch.if.condition.change"
] | 818,945 | 818,946 | u545364250 | cpp |
p03005 | #include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define REP2(i, x, n) for (int i = x; i < (n); i++)
int main() {
int n, k;
cin >> n, k;
int ans = n - k;
if (k == 1)
ans = 0;
cout << ans << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define REP2(i, x, n) for (int i = x; i < (n); i++)
int main() {
int n, k;
cin >> n >> k;
int ans = n - k;
if (k == 1)
ans = 0;
cout << ans << endl;
return 0;
}
| [] | 818,947 | 818,948 | u685800831 | cpp |
p03005 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
if (n == 1) {
cout << 0;
} else {
cout << n - k;
}
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
if (k == 1) {
cout << 0;
} else {
cout << n - k;
}
} | [
"identifier.change",
"control_flow.branch.if.condition.change"
] | 818,949 | 818,950 | u955282280 | cpp |
p03005 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
if (n % k == 0) {
cout << 0;
} else {
cout << 1;
}
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
if (k == 1) {
cout << 0;
} else {
cout << n - k;
}
} | [
"expression.operation.binary.remove",
"literal.number.change",
"control_flow.branch.if.condition.change",
"identifier.replace.add",
"literal.replace.remove",
"io.output.change"
] | 818,951 | 818,950 | u955282280 | cpp |
p03005 | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
typedef long long ll;
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
int n, k;
cin >> n >> k;
if (n == 1)
cout << 0 << endl;
else
cout << n - k << endl;
return 0;
} | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
typedef long long ll;
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
int n, k;
cin >> n >> k;
if (k == 1)
cout << 0 << endl;
else
cout << n - k << endl;
return 0;
} | [
"identifier.change",
"control_flow.branch.if.condition.change"
] | 818,962 | 818,963 | u374051158 | cpp |
p03005 | #include <bits/stdc++.h>
using namespace std;
#define rep(i, j, n) for (int i = (int)(j); i < (int)(n); i++)
#define REP(i, j, n) for (int i = (int)(j); i <= (int)(n); i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(), (a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int, int>
#define priq priority_queue<int>
#define disup(A, key) distance(A.begin(), upper_bound(ALL(A), (int)(key)))
#define dislow(A, key) distance(A.begin(), lower_bound(ALL(A), (int)(key)))
#define tii tuple<int, int, int>
signed main() {
int N, K, ans = 0;
cin >> N >> K;
if (K > 0)
ans = N - K;
cout << ans << endl;
}
| #include <bits/stdc++.h>
using namespace std;
#define rep(i, j, n) for (int i = (int)(j); i < (int)(n); i++)
#define REP(i, j, n) for (int i = (int)(j); i <= (int)(n); i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(), (a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int, int>
#define priq priority_queue<int>
#define disup(A, key) distance(A.begin(), upper_bound(ALL(A), (int)(key)))
#define dislow(A, key) distance(A.begin(), lower_bound(ALL(A), (int)(key)))
#define tii tuple<int, int, int>
signed main() {
int N, K, ans = 0;
cin >> N >> K;
if (K > 1)
ans = N - K;
cout << ans << endl;
}
| [
"literal.number.change",
"control_flow.branch.if.condition.change"
] | 818,964 | 818,965 | u347057617 | cpp |
p03005 | #pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define F first
#define S second
#define int long long
//#define ll long long
//#define int unsigned long long
#define pb push_back
#define double long double
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
const int N = 300000;
int mod = 1e9 + 7;
int a[N], f[N];
string s;
main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
// freopen("input.txt", "r", stdin);
int n, k;
cin >> n >> k;
if (n == 1) {
cout << 0;
return 0;
}
cout << n - k;
}
| #pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define F first
#define S second
#define int long long
//#define ll long long
//#define int unsigned long long
#define pb push_back
#define double long double
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
const int N = 300000;
int mod = 1e9 + 7;
int a[N], f[N];
string s;
main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
// freopen("input.txt", "r", stdin);
int n, k;
cin >> n >> k;
if (k == 1) {
cout << 0;
return 0;
}
cout << n - k;
}
| [
"identifier.change",
"control_flow.branch.if.condition.change"
] | 818,966 | 818,967 | u373008269 | cpp |
p03005 | #include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <string>
#include <vector>
#define CHMAX(a, b) a = std::max(a, b)
#define CHMIN(a, b) a = std::min(a, b)
#define CHABS(a) a = std::abs(a)
#define COUT(a) std::cout << a << std::endl
#define CERR(a) std::cerr << a << std::endl
#define FOR(n) for (lli i = 0; i < n; i++)
using namespace std;
using lli = long long int;
using pll = pair<lli, lli>;
using tlll = tuple<lli, lli, lli>;
using vll = vector<lli>;
lli mod197 = 1000000007LL;
lli INF = 10000000000000;
// ax + by = gcd(a,b) 最大公約数
template <typename T> T extgcd(T a, T b, T &x, T &y) {
T d = a;
if (b != 0) {
d = extgcd(b, a % b, y, x);
y -= (a / b) * x;
} else {
x = 1;
y = 0;
}
return d;
}
int main(void) {
int n, k;
cin >> n >> k;
COUT((n == 1 ? 0 : n - k));
return 0;
} | #include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <string>
#include <vector>
#define CHMAX(a, b) a = std::max(a, b)
#define CHMIN(a, b) a = std::min(a, b)
#define CHABS(a) a = std::abs(a)
#define COUT(a) std::cout << a << std::endl
#define CERR(a) std::cerr << a << std::endl
#define FOR(n) for (lli i = 0; i < n; i++)
using namespace std;
using lli = long long int;
using pll = pair<lli, lli>;
using tlll = tuple<lli, lli, lli>;
using vll = vector<lli>;
lli mod197 = 1000000007LL;
lli INF = 10000000000000;
// ax + by = gcd(a,b) 最大公約数
template <typename T> T extgcd(T a, T b, T &x, T &y) {
T d = a;
if (b != 0) {
d = extgcd(b, a % b, y, x);
y -= (a / b) * x;
} else {
x = 1;
y = 0;
}
return d;
}
int main(void) {
int n, k;
cin >> n >> k;
COUT((k == 1 ? 0 : n - k));
return 0;
}
| [
"identifier.change",
"control_flow.loop.for.condition.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 818,968 | 818,969 | u155216115 | cpp |
p03005 | #include <algorithm>
#include <bits/stdc++.h>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string.h>
#include <string>
#include <utility>
#include <vector>
using namespace std;
using ll = long long;
#define ALL(a) (a).begin(), (a).end()
#define FOR(i, a, b) for (long long int i = (a); i <= (b); i++)
#define RFOR(i, a, b) for (long long int i = (a); i >= (b); i--)
#define MOD 1000000007
#define LLONG_MAXs 9223372036854775800 / 2
#define ALL(a) (a).begin(), (a).end()
#include <cmath>
#include <iostream>
using namespace std;
bool isPrimeNum(ll x) { // 素数である場合 true を返す
if (x <= 1) { // 1以下である場合は素数でないことがすぐにわかる
return false;
}
// sqrt( double型 ) は引数の平方根を double型で返すので、int型でキャスト
int n = (int)sqrt((double)x);
for (int i = 2; i <= n; i++) {
if (x % i == 0) { // 割り切る整数がある場合、即判定終了
return false;
}
}
return true; // 割り切る整数がない場合、素数である
}
ll myPow(ll x, ll n, ll m) {
if (n == 0)
return 1;
if (n % 2 == 0)
return myPow(x * x % m, n / 2, m);
else
return x * myPow(x, n - 1, m) % m;
}
constexpr ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
constexpr ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
constexpr ll abs(ll a, ll b) {
if (a >= b)
return a - b;
if (a < b)
return b - a;
}
constexpr double dabs(double a, double b) {
if (a >= b)
return a - b;
if (a < b)
return b - a;
}
constexpr ll min(ll a, ll b) {
if (a >= b)
return b;
if (a < b)
return a;
}
constexpr ll max(ll a, ll b) {
if (a >= b)
return a;
if (a < b)
return b;
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int dx8[8] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy8[8] = {0, 1, 0, -1, 1, 1, -1, -1};
class UnionFind {
public:
//親の番号を格納する。親だった場合は-(その集合のサイズ)
vector<int> Parent;
//作るときはParentの値を全て-1にする
//こうすると全てバラバラになる
UnionFind(int N) { Parent = vector<int>(N, -1); }
// Aがどのグループに属しているか調べる
int root(int A) {
if (Parent[A] < 0)
return A;
return Parent[A] = root(Parent[A]);
}
//自分のいるグループの頂点数を調べる
int size(int A) {
return -Parent[root(A)]; //親をとってきたい]
}
bool issame(int x, int y) { return root(x) == root(y); }
// AとBをくっ付ける
bool connect(int A, int B) {
// AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
A = root(A);
B = root(B);
if (A == B) {
//すでにくっついてるからくっ付けない
return false;
}
//大きい方(A)に小さいほう(B)をくっ付けたい
//大小が逆だったらひっくり返しちゃう。
if (size(A) < size(B))
swap(A, B);
// Aのサイズを更新する
Parent[A] += Parent[B];
// Bの親をAに変更する
Parent[B] = A;
return true;
}
};
long long fac[510000], finv[510000], inv[510000];
// テーブルを作る前処理
void COMinit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (int i = 2; i < 510000; i++) {
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
// 二項係数計算
long long COM(int n, int k) {
if (n < k)
return 0;
if (n < 0 || k < 0)
return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
long long modinv(long long a, long long m) {
long long b = m, u = 1, v = 0;
while (b) {
long long t = a / b;
a -= t * b;
swap(a, b);
u -= t * v;
swap(u, v);
}
u %= m;
if (u < 0)
u += m;
return u;
}
string replaceAll(string &replacedStr, string from, string to) {
unsigned int pos = replacedStr.find(from);
int toLen = to.length();
if (from.empty()) {
return replacedStr;
}
while ((pos = replacedStr.find(from, pos)) != std::string::npos) {
replacedStr.replace(pos, from.length(), to);
pos += toLen;
}
return replacedStr;
}
void yn(bool flag) {
if (flag) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return;
}
void YN(bool flag) {
if (flag) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
return;
}
std::vector<ll> enum_div(ll n) // nの約数を列挙
{
std::vector<ll> ret;
for (ll i = 1; i * i <= n; ++i) {
if (n % i == 0) {
ret.push_back(i);
if (i != 1 && i * i != n) {
ret.push_back(n / i);
}
}
}
ret.push_back(n);
return ret;
}
void Ssort(int no, char *month[]) {
int i, j;
char *temp;
for (i = 0; i < no; i++) {
for (j = i + 1; j < no; j++) {
if (strcmp((month[i]), (month[j])) > 0) {
temp = *(month + i);
*(month + i) = *(month + j);
*(month + j) = temp;
}
}
}
}
// グラフセット
struct Edge {
ll to; // 辺の行き先
ll weight; // 辺の重み
Edge(int t, int w) : to(t), weight(w) {}
};
// using Graph = vector<vector<Edge>>;
using Graph = vector<vector<int>>;
// cout<<std::setprecision(30)
int main() {
ll A, B, C, D;
ll X[10000] = {};
ll ans = 0;
string S, S2;
cin >> A >> B;
ans = (A - B);
if (B == 1)
ans == 0;
cout << ans << endl;
return 0;
} | #include <algorithm>
#include <bits/stdc++.h>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string.h>
#include <string>
#include <utility>
#include <vector>
using namespace std;
using ll = long long;
#define ALL(a) (a).begin(), (a).end()
#define FOR(i, a, b) for (long long int i = (a); i <= (b); i++)
#define RFOR(i, a, b) for (long long int i = (a); i >= (b); i--)
#define MOD 1000000007
#define LLONG_MAXs 9223372036854775800 / 2
#define ALL(a) (a).begin(), (a).end()
#include <cmath>
#include <iostream>
using namespace std;
bool isPrimeNum(ll x) { // 素数である場合 true を返す
if (x <= 1) { // 1以下である場合は素数でないことがすぐにわかる
return false;
}
// sqrt( double型 ) は引数の平方根を double型で返すので、int型でキャスト
int n = (int)sqrt((double)x);
for (int i = 2; i <= n; i++) {
if (x % i == 0) { // 割り切る整数がある場合、即判定終了
return false;
}
}
return true; // 割り切る整数がない場合、素数である
}
ll myPow(ll x, ll n, ll m) {
if (n == 0)
return 1;
if (n % 2 == 0)
return myPow(x * x % m, n / 2, m);
else
return x * myPow(x, n - 1, m) % m;
}
constexpr ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
constexpr ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
constexpr ll abs(ll a, ll b) {
if (a >= b)
return a - b;
if (a < b)
return b - a;
}
constexpr double dabs(double a, double b) {
if (a >= b)
return a - b;
if (a < b)
return b - a;
}
constexpr ll min(ll a, ll b) {
if (a >= b)
return b;
if (a < b)
return a;
}
constexpr ll max(ll a, ll b) {
if (a >= b)
return a;
if (a < b)
return b;
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int dx8[8] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy8[8] = {0, 1, 0, -1, 1, 1, -1, -1};
class UnionFind {
public:
//親の番号を格納する。親だった場合は-(その集合のサイズ)
vector<int> Parent;
//作るときはParentの値を全て-1にする
//こうすると全てバラバラになる
UnionFind(int N) { Parent = vector<int>(N, -1); }
// Aがどのグループに属しているか調べる
int root(int A) {
if (Parent[A] < 0)
return A;
return Parent[A] = root(Parent[A]);
}
//自分のいるグループの頂点数を調べる
int size(int A) {
return -Parent[root(A)]; //親をとってきたい]
}
bool issame(int x, int y) { return root(x) == root(y); }
// AとBをくっ付ける
bool connect(int A, int B) {
// AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
A = root(A);
B = root(B);
if (A == B) {
//すでにくっついてるからくっ付けない
return false;
}
//大きい方(A)に小さいほう(B)をくっ付けたい
//大小が逆だったらひっくり返しちゃう。
if (size(A) < size(B))
swap(A, B);
// Aのサイズを更新する
Parent[A] += Parent[B];
// Bの親をAに変更する
Parent[B] = A;
return true;
}
};
long long fac[510000], finv[510000], inv[510000];
// テーブルを作る前処理
void COMinit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (int i = 2; i < 510000; i++) {
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
// 二項係数計算
long long COM(int n, int k) {
if (n < k)
return 0;
if (n < 0 || k < 0)
return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
long long modinv(long long a, long long m) {
long long b = m, u = 1, v = 0;
while (b) {
long long t = a / b;
a -= t * b;
swap(a, b);
u -= t * v;
swap(u, v);
}
u %= m;
if (u < 0)
u += m;
return u;
}
string replaceAll(string &replacedStr, string from, string to) {
unsigned int pos = replacedStr.find(from);
int toLen = to.length();
if (from.empty()) {
return replacedStr;
}
while ((pos = replacedStr.find(from, pos)) != std::string::npos) {
replacedStr.replace(pos, from.length(), to);
pos += toLen;
}
return replacedStr;
}
void yn(bool flag) {
if (flag) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return;
}
void YN(bool flag) {
if (flag) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
return;
}
std::vector<ll> enum_div(ll n) // nの約数を列挙
{
std::vector<ll> ret;
for (ll i = 1; i * i <= n; ++i) {
if (n % i == 0) {
ret.push_back(i);
if (i != 1 && i * i != n) {
ret.push_back(n / i);
}
}
}
ret.push_back(n);
return ret;
}
void Ssort(int no, char *month[]) {
int i, j;
char *temp;
for (i = 0; i < no; i++) {
for (j = i + 1; j < no; j++) {
if (strcmp((month[i]), (month[j])) > 0) {
temp = *(month + i);
*(month + i) = *(month + j);
*(month + j) = temp;
}
}
}
}
// グラフセット
struct Edge {
ll to; // 辺の行き先
ll weight; // 辺の重み
Edge(int t, int w) : to(t), weight(w) {}
};
// using Graph = vector<vector<Edge>>;
using Graph = vector<vector<int>>;
// cout<<std::setprecision(30)
int main() {
ll A, B, C, D;
ll X[10000] = {};
ll ans = 0;
string S, S2;
cin >> A >> B;
ans = (A - B);
if (B == 1)
ans = 0;
cout << ans << endl;
return 0;
} | [
"expression.operation.compare.replace.remove",
"assignment.replace.add",
"misc.typo"
] | 818,972 | 818,973 | u043443359 | cpp |
p03005 | #include <algorithm>
#include <bits/stdc++.h>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string.h>
#include <string>
#include <utility>
#include <vector>
using namespace std;
using ll = long long;
#define ALL(a) (a).begin(), (a).end()
#define FOR(i, a, b) for (long long int i = (a); i <= (b); i++)
#define RFOR(i, a, b) for (long long int i = (a); i >= (b); i--)
#define MOD 1000000007
#define LLONG_MAXs 9223372036854775800 / 2
#define ALL(a) (a).begin(), (a).end()
#include <cmath>
#include <iostream>
using namespace std;
bool isPrimeNum(ll x) { // 素数である場合 true を返す
if (x <= 1) { // 1以下である場合は素数でないことがすぐにわかる
return false;
}
// sqrt( double型 ) は引数の平方根を double型で返すので、int型でキャスト
int n = (int)sqrt((double)x);
for (int i = 2; i <= n; i++) {
if (x % i == 0) { // 割り切る整数がある場合、即判定終了
return false;
}
}
return true; // 割り切る整数がない場合、素数である
}
ll myPow(ll x, ll n, ll m) {
if (n == 0)
return 1;
if (n % 2 == 0)
return myPow(x * x % m, n / 2, m);
else
return x * myPow(x, n - 1, m) % m;
}
constexpr ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
constexpr ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
constexpr ll abs(ll a, ll b) {
if (a >= b)
return a - b;
if (a < b)
return b - a;
}
constexpr double dabs(double a, double b) {
if (a >= b)
return a - b;
if (a < b)
return b - a;
}
constexpr ll min(ll a, ll b) {
if (a >= b)
return b;
if (a < b)
return a;
}
constexpr ll max(ll a, ll b) {
if (a >= b)
return a;
if (a < b)
return b;
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int dx8[8] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy8[8] = {0, 1, 0, -1, 1, 1, -1, -1};
class UnionFind {
public:
//親の番号を格納する。親だった場合は-(その集合のサイズ)
vector<int> Parent;
//作るときはParentの値を全て-1にする
//こうすると全てバラバラになる
UnionFind(int N) { Parent = vector<int>(N, -1); }
// Aがどのグループに属しているか調べる
int root(int A) {
if (Parent[A] < 0)
return A;
return Parent[A] = root(Parent[A]);
}
//自分のいるグループの頂点数を調べる
int size(int A) {
return -Parent[root(A)]; //親をとってきたい]
}
bool issame(int x, int y) { return root(x) == root(y); }
// AとBをくっ付ける
bool connect(int A, int B) {
// AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
A = root(A);
B = root(B);
if (A == B) {
//すでにくっついてるからくっ付けない
return false;
}
//大きい方(A)に小さいほう(B)をくっ付けたい
//大小が逆だったらひっくり返しちゃう。
if (size(A) < size(B))
swap(A, B);
// Aのサイズを更新する
Parent[A] += Parent[B];
// Bの親をAに変更する
Parent[B] = A;
return true;
}
};
long long fac[510000], finv[510000], inv[510000];
// テーブルを作る前処理
void COMinit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (int i = 2; i < 510000; i++) {
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
// 二項係数計算
long long COM(int n, int k) {
if (n < k)
return 0;
if (n < 0 || k < 0)
return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
long long modinv(long long a, long long m) {
long long b = m, u = 1, v = 0;
while (b) {
long long t = a / b;
a -= t * b;
swap(a, b);
u -= t * v;
swap(u, v);
}
u %= m;
if (u < 0)
u += m;
return u;
}
string replaceAll(string &replacedStr, string from, string to) {
unsigned int pos = replacedStr.find(from);
int toLen = to.length();
if (from.empty()) {
return replacedStr;
}
while ((pos = replacedStr.find(from, pos)) != std::string::npos) {
replacedStr.replace(pos, from.length(), to);
pos += toLen;
}
return replacedStr;
}
void yn(bool flag) {
if (flag) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return;
}
void YN(bool flag) {
if (flag) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
return;
}
std::vector<ll> enum_div(ll n) // nの約数を列挙
{
std::vector<ll> ret;
for (ll i = 1; i * i <= n; ++i) {
if (n % i == 0) {
ret.push_back(i);
if (i != 1 && i * i != n) {
ret.push_back(n / i);
}
}
}
ret.push_back(n);
return ret;
}
void Ssort(int no, char *month[]) {
int i, j;
char *temp;
for (i = 0; i < no; i++) {
for (j = i + 1; j < no; j++) {
if (strcmp((month[i]), (month[j])) > 0) {
temp = *(month + i);
*(month + i) = *(month + j);
*(month + j) = temp;
}
}
}
}
// グラフセット
struct Edge {
ll to; // 辺の行き先
ll weight; // 辺の重み
Edge(int t, int w) : to(t), weight(w) {}
};
// using Graph = vector<vector<Edge>>;
using Graph = vector<vector<int>>;
// cout<<std::setprecision(30)
int main() {
ll A, B, C, D;
ll X[10000] = {};
ll ans = 0;
string S, S2;
cin >> A >> B;
ans = (A - B - 1);
if (B == 0)
ans == 0;
cout << ans << endl;
return 0;
} | #include <algorithm>
#include <bits/stdc++.h>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string.h>
#include <string>
#include <utility>
#include <vector>
using namespace std;
using ll = long long;
#define ALL(a) (a).begin(), (a).end()
#define FOR(i, a, b) for (long long int i = (a); i <= (b); i++)
#define RFOR(i, a, b) for (long long int i = (a); i >= (b); i--)
#define MOD 1000000007
#define LLONG_MAXs 9223372036854775800 / 2
#define ALL(a) (a).begin(), (a).end()
#include <cmath>
#include <iostream>
using namespace std;
bool isPrimeNum(ll x) { // 素数である場合 true を返す
if (x <= 1) { // 1以下である場合は素数でないことがすぐにわかる
return false;
}
// sqrt( double型 ) は引数の平方根を double型で返すので、int型でキャスト
int n = (int)sqrt((double)x);
for (int i = 2; i <= n; i++) {
if (x % i == 0) { // 割り切る整数がある場合、即判定終了
return false;
}
}
return true; // 割り切る整数がない場合、素数である
}
ll myPow(ll x, ll n, ll m) {
if (n == 0)
return 1;
if (n % 2 == 0)
return myPow(x * x % m, n / 2, m);
else
return x * myPow(x, n - 1, m) % m;
}
constexpr ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
constexpr ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
constexpr ll abs(ll a, ll b) {
if (a >= b)
return a - b;
if (a < b)
return b - a;
}
constexpr double dabs(double a, double b) {
if (a >= b)
return a - b;
if (a < b)
return b - a;
}
constexpr ll min(ll a, ll b) {
if (a >= b)
return b;
if (a < b)
return a;
}
constexpr ll max(ll a, ll b) {
if (a >= b)
return a;
if (a < b)
return b;
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int dx8[8] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy8[8] = {0, 1, 0, -1, 1, 1, -1, -1};
class UnionFind {
public:
//親の番号を格納する。親だった場合は-(その集合のサイズ)
vector<int> Parent;
//作るときはParentの値を全て-1にする
//こうすると全てバラバラになる
UnionFind(int N) { Parent = vector<int>(N, -1); }
// Aがどのグループに属しているか調べる
int root(int A) {
if (Parent[A] < 0)
return A;
return Parent[A] = root(Parent[A]);
}
//自分のいるグループの頂点数を調べる
int size(int A) {
return -Parent[root(A)]; //親をとってきたい]
}
bool issame(int x, int y) { return root(x) == root(y); }
// AとBをくっ付ける
bool connect(int A, int B) {
// AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
A = root(A);
B = root(B);
if (A == B) {
//すでにくっついてるからくっ付けない
return false;
}
//大きい方(A)に小さいほう(B)をくっ付けたい
//大小が逆だったらひっくり返しちゃう。
if (size(A) < size(B))
swap(A, B);
// Aのサイズを更新する
Parent[A] += Parent[B];
// Bの親をAに変更する
Parent[B] = A;
return true;
}
};
long long fac[510000], finv[510000], inv[510000];
// テーブルを作る前処理
void COMinit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (int i = 2; i < 510000; i++) {
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
// 二項係数計算
long long COM(int n, int k) {
if (n < k)
return 0;
if (n < 0 || k < 0)
return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
long long modinv(long long a, long long m) {
long long b = m, u = 1, v = 0;
while (b) {
long long t = a / b;
a -= t * b;
swap(a, b);
u -= t * v;
swap(u, v);
}
u %= m;
if (u < 0)
u += m;
return u;
}
string replaceAll(string &replacedStr, string from, string to) {
unsigned int pos = replacedStr.find(from);
int toLen = to.length();
if (from.empty()) {
return replacedStr;
}
while ((pos = replacedStr.find(from, pos)) != std::string::npos) {
replacedStr.replace(pos, from.length(), to);
pos += toLen;
}
return replacedStr;
}
void yn(bool flag) {
if (flag) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return;
}
void YN(bool flag) {
if (flag) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
return;
}
std::vector<ll> enum_div(ll n) // nの約数を列挙
{
std::vector<ll> ret;
for (ll i = 1; i * i <= n; ++i) {
if (n % i == 0) {
ret.push_back(i);
if (i != 1 && i * i != n) {
ret.push_back(n / i);
}
}
}
ret.push_back(n);
return ret;
}
void Ssort(int no, char *month[]) {
int i, j;
char *temp;
for (i = 0; i < no; i++) {
for (j = i + 1; j < no; j++) {
if (strcmp((month[i]), (month[j])) > 0) {
temp = *(month + i);
*(month + i) = *(month + j);
*(month + j) = temp;
}
}
}
}
// グラフセット
struct Edge {
ll to; // 辺の行き先
ll weight; // 辺の重み
Edge(int t, int w) : to(t), weight(w) {}
};
// using Graph = vector<vector<Edge>>;
using Graph = vector<vector<int>>;
// cout<<std::setprecision(30)
int main() {
ll A, B, C, D;
ll X[10000] = {};
ll ans = 0;
string S, S2;
cin >> A >> B;
ans = (A - B);
if (B == 1)
ans = 0;
cout << ans << endl;
return 0;
} | [
"expression.operation.binary.remove",
"literal.number.change",
"control_flow.branch.if.condition.change",
"expression.operation.compare.replace.remove",
"assignment.replace.add",
"misc.typo"
] | 818,974 | 818,973 | u043443359 | cpp |
p03005 | #include <algorithm>
#include <bits/stdc++.h>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string.h>
#include <string>
#include <utility>
#include <vector>
using namespace std;
using ll = long long;
#define ALL(a) (a).begin(), (a).end()
#define FOR(i, a, b) for (long long int i = (a); i <= (b); i++)
#define RFOR(i, a, b) for (long long int i = (a); i >= (b); i--)
#define MOD 1000000007
#define LLONG_MAXs 9223372036854775800 / 2
#define ALL(a) (a).begin(), (a).end()
#include <cmath>
#include <iostream>
using namespace std;
bool isPrimeNum(ll x) { // 素数である場合 true を返す
if (x <= 1) { // 1以下である場合は素数でないことがすぐにわかる
return false;
}
// sqrt( double型 ) は引数の平方根を double型で返すので、int型でキャスト
int n = (int)sqrt((double)x);
for (int i = 2; i <= n; i++) {
if (x % i == 0) { // 割り切る整数がある場合、即判定終了
return false;
}
}
return true; // 割り切る整数がない場合、素数である
}
ll myPow(ll x, ll n, ll m) {
if (n == 0)
return 1;
if (n % 2 == 0)
return myPow(x * x % m, n / 2, m);
else
return x * myPow(x, n - 1, m) % m;
}
constexpr ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
constexpr ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
constexpr ll abs(ll a, ll b) {
if (a >= b)
return a - b;
if (a < b)
return b - a;
}
constexpr double dabs(double a, double b) {
if (a >= b)
return a - b;
if (a < b)
return b - a;
}
constexpr ll min(ll a, ll b) {
if (a >= b)
return b;
if (a < b)
return a;
}
constexpr ll max(ll a, ll b) {
if (a >= b)
return a;
if (a < b)
return b;
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int dx8[8] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy8[8] = {0, 1, 0, -1, 1, 1, -1, -1};
class UnionFind {
public:
//親の番号を格納する。親だった場合は-(その集合のサイズ)
vector<int> Parent;
//作るときはParentの値を全て-1にする
//こうすると全てバラバラになる
UnionFind(int N) { Parent = vector<int>(N, -1); }
// Aがどのグループに属しているか調べる
int root(int A) {
if (Parent[A] < 0)
return A;
return Parent[A] = root(Parent[A]);
}
//自分のいるグループの頂点数を調べる
int size(int A) {
return -Parent[root(A)]; //親をとってきたい]
}
bool issame(int x, int y) { return root(x) == root(y); }
// AとBをくっ付ける
bool connect(int A, int B) {
// AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
A = root(A);
B = root(B);
if (A == B) {
//すでにくっついてるからくっ付けない
return false;
}
//大きい方(A)に小さいほう(B)をくっ付けたい
//大小が逆だったらひっくり返しちゃう。
if (size(A) < size(B))
swap(A, B);
// Aのサイズを更新する
Parent[A] += Parent[B];
// Bの親をAに変更する
Parent[B] = A;
return true;
}
};
long long fac[510000], finv[510000], inv[510000];
// テーブルを作る前処理
void COMinit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (int i = 2; i < 510000; i++) {
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
// 二項係数計算
long long COM(int n, int k) {
if (n < k)
return 0;
if (n < 0 || k < 0)
return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
long long modinv(long long a, long long m) {
long long b = m, u = 1, v = 0;
while (b) {
long long t = a / b;
a -= t * b;
swap(a, b);
u -= t * v;
swap(u, v);
}
u %= m;
if (u < 0)
u += m;
return u;
}
string replaceAll(string &replacedStr, string from, string to) {
unsigned int pos = replacedStr.find(from);
int toLen = to.length();
if (from.empty()) {
return replacedStr;
}
while ((pos = replacedStr.find(from, pos)) != std::string::npos) {
replacedStr.replace(pos, from.length(), to);
pos += toLen;
}
return replacedStr;
}
void yn(bool flag) {
if (flag) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return;
}
void YN(bool flag) {
if (flag) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
return;
}
std::vector<ll> enum_div(ll n) // nの約数を列挙
{
std::vector<ll> ret;
for (ll i = 1; i * i <= n; ++i) {
if (n % i == 0) {
ret.push_back(i);
if (i != 1 && i * i != n) {
ret.push_back(n / i);
}
}
}
ret.push_back(n);
return ret;
}
void Ssort(int no, char *month[]) {
int i, j;
char *temp;
for (i = 0; i < no; i++) {
for (j = i + 1; j < no; j++) {
if (strcmp((month[i]), (month[j])) > 0) {
temp = *(month + i);
*(month + i) = *(month + j);
*(month + j) = temp;
}
}
}
}
// グラフセット
struct Edge {
ll to; // 辺の行き先
ll weight; // 辺の重み
Edge(int t, int w) : to(t), weight(w) {}
};
// using Graph = vector<vector<Edge>>;
using Graph = vector<vector<int>>;
// cout<<std::setprecision(30)
int main() {
ll A, B, C, D;
ll X[10000] = {};
ll ans = 0;
string S, S2;
cin >> A >> B;
ans = (A - B);
if (A % B == 0)
ans--;
cout << ans << endl;
return 0;
} | #include <algorithm>
#include <bits/stdc++.h>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string.h>
#include <string>
#include <utility>
#include <vector>
using namespace std;
using ll = long long;
#define ALL(a) (a).begin(), (a).end()
#define FOR(i, a, b) for (long long int i = (a); i <= (b); i++)
#define RFOR(i, a, b) for (long long int i = (a); i >= (b); i--)
#define MOD 1000000007
#define LLONG_MAXs 9223372036854775800 / 2
#define ALL(a) (a).begin(), (a).end()
#include <cmath>
#include <iostream>
using namespace std;
bool isPrimeNum(ll x) { // 素数である場合 true を返す
if (x <= 1) { // 1以下である場合は素数でないことがすぐにわかる
return false;
}
// sqrt( double型 ) は引数の平方根を double型で返すので、int型でキャスト
int n = (int)sqrt((double)x);
for (int i = 2; i <= n; i++) {
if (x % i == 0) { // 割り切る整数がある場合、即判定終了
return false;
}
}
return true; // 割り切る整数がない場合、素数である
}
ll myPow(ll x, ll n, ll m) {
if (n == 0)
return 1;
if (n % 2 == 0)
return myPow(x * x % m, n / 2, m);
else
return x * myPow(x, n - 1, m) % m;
}
constexpr ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
constexpr ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
constexpr ll abs(ll a, ll b) {
if (a >= b)
return a - b;
if (a < b)
return b - a;
}
constexpr double dabs(double a, double b) {
if (a >= b)
return a - b;
if (a < b)
return b - a;
}
constexpr ll min(ll a, ll b) {
if (a >= b)
return b;
if (a < b)
return a;
}
constexpr ll max(ll a, ll b) {
if (a >= b)
return a;
if (a < b)
return b;
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int dx8[8] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy8[8] = {0, 1, 0, -1, 1, 1, -1, -1};
class UnionFind {
public:
//親の番号を格納する。親だった場合は-(その集合のサイズ)
vector<int> Parent;
//作るときはParentの値を全て-1にする
//こうすると全てバラバラになる
UnionFind(int N) { Parent = vector<int>(N, -1); }
// Aがどのグループに属しているか調べる
int root(int A) {
if (Parent[A] < 0)
return A;
return Parent[A] = root(Parent[A]);
}
//自分のいるグループの頂点数を調べる
int size(int A) {
return -Parent[root(A)]; //親をとってきたい]
}
bool issame(int x, int y) { return root(x) == root(y); }
// AとBをくっ付ける
bool connect(int A, int B) {
// AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
A = root(A);
B = root(B);
if (A == B) {
//すでにくっついてるからくっ付けない
return false;
}
//大きい方(A)に小さいほう(B)をくっ付けたい
//大小が逆だったらひっくり返しちゃう。
if (size(A) < size(B))
swap(A, B);
// Aのサイズを更新する
Parent[A] += Parent[B];
// Bの親をAに変更する
Parent[B] = A;
return true;
}
};
long long fac[510000], finv[510000], inv[510000];
// テーブルを作る前処理
void COMinit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (int i = 2; i < 510000; i++) {
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
// 二項係数計算
long long COM(int n, int k) {
if (n < k)
return 0;
if (n < 0 || k < 0)
return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
long long modinv(long long a, long long m) {
long long b = m, u = 1, v = 0;
while (b) {
long long t = a / b;
a -= t * b;
swap(a, b);
u -= t * v;
swap(u, v);
}
u %= m;
if (u < 0)
u += m;
return u;
}
string replaceAll(string &replacedStr, string from, string to) {
unsigned int pos = replacedStr.find(from);
int toLen = to.length();
if (from.empty()) {
return replacedStr;
}
while ((pos = replacedStr.find(from, pos)) != std::string::npos) {
replacedStr.replace(pos, from.length(), to);
pos += toLen;
}
return replacedStr;
}
void yn(bool flag) {
if (flag) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return;
}
void YN(bool flag) {
if (flag) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
return;
}
std::vector<ll> enum_div(ll n) // nの約数を列挙
{
std::vector<ll> ret;
for (ll i = 1; i * i <= n; ++i) {
if (n % i == 0) {
ret.push_back(i);
if (i != 1 && i * i != n) {
ret.push_back(n / i);
}
}
}
ret.push_back(n);
return ret;
}
void Ssort(int no, char *month[]) {
int i, j;
char *temp;
for (i = 0; i < no; i++) {
for (j = i + 1; j < no; j++) {
if (strcmp((month[i]), (month[j])) > 0) {
temp = *(month + i);
*(month + i) = *(month + j);
*(month + j) = temp;
}
}
}
}
// グラフセット
struct Edge {
ll to; // 辺の行き先
ll weight; // 辺の重み
Edge(int t, int w) : to(t), weight(w) {}
};
// using Graph = vector<vector<Edge>>;
using Graph = vector<vector<int>>;
// cout<<std::setprecision(30)
int main() {
ll A, B, C, D;
ll X[10000] = {};
ll ans = 0;
string S, S2;
cin >> A >> B;
ans = (A - B);
if (B == 1)
ans = 0;
cout << ans << endl;
return 0;
} | [
"expression.operation.binary.remove",
"literal.number.change",
"control_flow.branch.if.condition.change"
] | 818,975 | 818,973 | u043443359 | cpp |
p03005 | #include <algorithm>
#include <bitset>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <string.h>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n, k, ans, a, b;
cin >> n >> k;
if (k == 1)
ans = 0;
else
ans = (n - k) - 1;
cout << ans << "\n";
return 0;
}
| #include <algorithm>
#include <bitset>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <string.h>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n, k, ans, a, b;
cin >> n >> k;
if (k == 1)
ans = 0;
else
ans = (n - k);
cout << ans << "\n";
return 0;
}
| [
"expression.operation.binary.remove"
] | 818,980 | 818,981 | u696290869 | cpp |
p03005 | #include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = (n)-1; i >= 0; --i)
#define srep(i, n, s) for (int i = s; i < (n); ++i)
#define rsrep(i, n, s) for (int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define aall(a) (a), (a) + countof(a) // for array sorting
#define raall(a) (a), (a) + countof(a), greater<>()
#define show(x) cout << #x << " = " << x << endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) \
{ \
if (f) \
puts("YES"); \
else \
puts("NO"); \
}
#define yns(f) \
{ \
if (f) \
puts("Yes"); \
else \
puts("No"); \
}
#define show_ary(...) \
{ \
cout << #__VA_ARGS__ << " = "; \
for (const auto &x : (__VA_ARGS__)) { \
cout << x << " "; \
} \
cout << endl; \
}
#define show_pair(...) \
cout << #__VA_ARGS__ << " = " << endl; \
for (const auto &x : (__VA_ARGS__)) { \
cout << " " << x.fi << " : " << x.se << endl; \
}
#define out_ary(...) \
{ \
for (const auto &x : (__VA_ARGS__)) { \
cout << x << " "; \
} \
cout << endl; \
}
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9 + 7;
int main() {
int n, k;
cin >> n >> k;
int ans = n - k;
if (n == 1)
ans = 0;
cout << ans << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = (n)-1; i >= 0; --i)
#define srep(i, n, s) for (int i = s; i < (n); ++i)
#define rsrep(i, n, s) for (int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define aall(a) (a), (a) + countof(a) // for array sorting
#define raall(a) (a), (a) + countof(a), greater<>()
#define show(x) cout << #x << " = " << x << endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) \
{ \
if (f) \
puts("YES"); \
else \
puts("NO"); \
}
#define yns(f) \
{ \
if (f) \
puts("Yes"); \
else \
puts("No"); \
}
#define show_ary(...) \
{ \
cout << #__VA_ARGS__ << " = "; \
for (const auto &x : (__VA_ARGS__)) { \
cout << x << " "; \
} \
cout << endl; \
}
#define show_pair(...) \
cout << #__VA_ARGS__ << " = " << endl; \
for (const auto &x : (__VA_ARGS__)) { \
cout << " " << x.fi << " : " << x.se << endl; \
}
#define out_ary(...) \
{ \
for (const auto &x : (__VA_ARGS__)) { \
cout << x << " "; \
} \
cout << endl; \
}
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9 + 7;
int main() {
int n, k;
cin >> n >> k;
int ans = n - k;
if (k == 1)
ans = 0;
cout << ans << endl;
return 0;
} | [
"identifier.change",
"control_flow.branch.if.condition.change"
] | 818,982 | 818,983 | u365512540 | cpp |
p03005 | #include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = (n)-1; i >= 0; --i)
#define srep(i, n, s) for (int i = s; i < (n); ++i)
#define rsrep(i, n, s) for (int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define aall(a) (a), (a) + countof(a) // for array sorting
#define raall(a) (a), (a) + countof(a), greater<>()
#define show(x) cout << #x << " = " << x << endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) \
{ \
if (f) \
puts("YES"); \
else \
puts("NO"); \
}
#define yns(f) \
{ \
if (f) \
puts("Yes"); \
else \
puts("No"); \
}
#define show_ary(...) \
{ \
cout << #__VA_ARGS__ << " = "; \
for (const auto &x : (__VA_ARGS__)) { \
cout << x << " "; \
} \
cout << endl; \
}
#define show_pair(...) \
cout << #__VA_ARGS__ << " = " << endl; \
for (const auto &x : (__VA_ARGS__)) { \
cout << " " << x.fi << " : " << x.se << endl; \
}
#define out_ary(...) \
{ \
for (const auto &x : (__VA_ARGS__)) { \
cout << x << " "; \
} \
cout << endl; \
}
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9 + 7;
int main() {
int n, k;
cin >> n >> k;
int ans = n - k;
if (n == 0)
ans = 0;
cout << ans << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = (n)-1; i >= 0; --i)
#define srep(i, n, s) for (int i = s; i < (n); ++i)
#define rsrep(i, n, s) for (int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define aall(a) (a), (a) + countof(a) // for array sorting
#define raall(a) (a), (a) + countof(a), greater<>()
#define show(x) cout << #x << " = " << x << endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) \
{ \
if (f) \
puts("YES"); \
else \
puts("NO"); \
}
#define yns(f) \
{ \
if (f) \
puts("Yes"); \
else \
puts("No"); \
}
#define show_ary(...) \
{ \
cout << #__VA_ARGS__ << " = "; \
for (const auto &x : (__VA_ARGS__)) { \
cout << x << " "; \
} \
cout << endl; \
}
#define show_pair(...) \
cout << #__VA_ARGS__ << " = " << endl; \
for (const auto &x : (__VA_ARGS__)) { \
cout << " " << x.fi << " : " << x.se << endl; \
}
#define out_ary(...) \
{ \
for (const auto &x : (__VA_ARGS__)) { \
cout << x << " "; \
} \
cout << endl; \
}
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9 + 7;
int main() {
int n, k;
cin >> n >> k;
int ans = n - k;
if (k == 1)
ans = 0;
cout << ans << endl;
return 0;
} | [
"identifier.change",
"control_flow.branch.if.condition.change",
"literal.number.change"
] | 818,984 | 818,983 | u365512540 | cpp |
p03005 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, K;
cin >> N >> K;
if (N == 1) {
cout << 0 << endl;
} else {
cout << N - K << endl;
}
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, K;
cin >> N >> K;
if (K == 1) {
cout << 0 << endl;
} else {
cout << N - K << endl;
}
} | [
"identifier.change",
"control_flow.branch.if.condition.change"
] | 818,985 | 818,986 | u028572059 | cpp |
p03005 | #include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define in(x, y, h, w) x >= 0 && x < h &&y >= 0 && y < w
#define int long long
// using ll = long long;
using P = pair<int, int>;
template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
const int INF = 1e+18;
const double EPS = 1e-9;
const int MOD = 1000000007;
const int dx[] = {1, 0, -1, 0}, dy[] = {0, -1, 0, 1};
signed main() {
int n, k;
cin >> n >> k;
if (!k)
cout << 0 << endl;
else
cout << n - k << endl;
} | #include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define in(x, y, h, w) x >= 0 && x < h &&y >= 0 && y < w
#define int long long
// using ll = long long;
using P = pair<int, int>;
template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
const int INF = 1e+18;
const double EPS = 1e-9;
const int MOD = 1000000007;
const int dx[] = {1, 0, -1, 0}, dy[] = {0, -1, 0, 1};
signed main() {
int n, k;
cin >> n >> k;
if (k == 1)
cout << 0 << endl;
else
cout << n - k << endl;
} | [
"expression.operation.unary.logical.remove",
"control_flow.branch.if.condition.change"
] | 818,993 | 818,994 | u456611841 | cpp |
p03005 | #include <iostream>
using namespace std;
int main() {
int N, K;
cin >> N >> K;
if (K == 0 || N == K)
cout << 0 << endl;
else
cout << N - K << endl;
} | #include <iostream>
using namespace std;
int main() {
int N, K;
cin >> N >> K;
if (K == 1 || N == K)
cout << 0 << endl;
else
cout << N - K << endl;
} | [
"literal.number.change",
"control_flow.branch.if.condition.change"
] | 819,001 | 819,002 | u815026012 | cpp |
p03005 | #include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
int main() {
int N, K;
cin >> N >> K;
if (K = 1) {
cout << 0 << endl;
} else {
int ans1 = N - K + 1;
int ans2 = ans1 - 1;
cout << ans2 << endl;
}
} | #include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
int main() {
int N, K;
cin >> N >> K;
if (K == 1) {
cout << 0 << endl;
} else {
int ans1 = (N - K) + 1;
int ans2 = ans1 - 1;
cout << ans2 << endl;
}
} | [
"expression.operation.compare.replace.add",
"assignment.replace.remove",
"misc.typo"
] | 819,003 | 819,004 | u955534952 | cpp |
p03005 | /*
これを入れて実行
g++ code.cpp
./a.out
*/
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
typedef long double ld;
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
bool greaterSecond(const pair<int, int> &f, const pair<int, int> &s) {
return f.second > s.second;
}
ll gcd(ll a, ll b) {
if (b == 0)
return a;
return gcd(b, a % b);
}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll nCr(ll n, ll r) {
if (r == 0 || r == n) {
return 1;
} else if (r == 1) {
return n;
}
return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
ll nPr(ll n, ll r) {
r = n - r;
ll ret = 1;
for (ll i = n; i >= r + 1; i--)
ret *= i;
return ret;
}
//-----------------------ここから-----------
int main(void) {
int n, k;
cin >> n >> k;
if (k == 1) {
return 0;
} else {
cout << n - k << endl;
}
} | /*
これを入れて実行
g++ code.cpp
./a.out
*/
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
typedef long double ld;
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
bool greaterSecond(const pair<int, int> &f, const pair<int, int> &s) {
return f.second > s.second;
}
ll gcd(ll a, ll b) {
if (b == 0)
return a;
return gcd(b, a % b);
}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll nCr(ll n, ll r) {
if (r == 0 || r == n) {
return 1;
} else if (r == 1) {
return n;
}
return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
ll nPr(ll n, ll r) {
r = n - r;
ll ret = 1;
for (ll i = n; i >= r + 1; i--)
ret *= i;
return ret;
}
//-----------------------ここから-----------
int main(void) {
int n, k;
cin >> n >> k;
if (k == 1) {
cout << 0 << endl;
} else {
cout << n - k << endl;
}
} | [
"io.output.change",
"io.output.newline.add"
] | 819,005 | 819,006 | u845000384 | cpp |
p03005 | #include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for (int i = x; i < n; i++)
#define INF 2e9
signed main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n, k;
cin >> n >> k;
if (k == 1) {
cout << 1;
} else {
cout << n - k;
}
return (0);
}
| #include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for (int i = x; i < n; i++)
#define INF 2e9
signed main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n, k;
cin >> n >> k;
if (k == 1) {
cout << 0;
} else {
cout << n - k;
}
return (0);
}
| [
"literal.number.change",
"io.output.change"
] | 819,009 | 819,010 | u132033278 | cpp |
p03005 | #include <iostream>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
if (n != 1)
cout << n - k << endl;
else
cout << 0 << endl;
} | #include <iostream>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
if (k != 1)
cout << n - k << endl;
else
cout << 0 << endl;
} | [
"identifier.change",
"control_flow.branch.if.condition.change"
] | 819,017 | 819,018 | u131230001 | cpp |
p03005 | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x) cerr << #x << " : " << x << '\n'
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;
typedef tree<ll, null_type, less<ll>, rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
const ll Mod = 1000000007LL;
const int Maxn = 2e5 + 10;
const ll Inf = 2242545357980376863LL;
const ll Log = 30;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
ll n, k;
cin >> n >> k;
cout << (n == 1 ? 0 : n - k) << '\n';
return 0;
}
/*
1
5 1
20 21 22 23 24
1
4 2
1 2 3 4
2 4 1 3
*/
| #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x) cerr << #x << " : " << x << '\n'
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;
typedef tree<ll, null_type, less<ll>, rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
const ll Mod = 1000000007LL;
const int Maxn = 2e5 + 10;
const ll Inf = 2242545357980376863LL;
const ll Log = 30;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
ll n, k;
cin >> n >> k;
cout << (k == 1 ? 0 : n - k) << '\n';
return 0;
}
/*
1
5 1
20 21 22 23 24
1
4 2
1 2 3 4
2 4 1 3
*/
| [
"identifier.change",
"control_flow.loop.for.condition.change",
"io.output.change"
] | 819,021 | 819,022 | u787690200 | cpp |
p03005 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, K;
cin >> N >> K;
if (N == 1) {
cout << 0 << endl;
} else if (N == K) {
cout << 0 << endl;
} else {
cout << N - K << endl;
}
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, K;
cin >> N >> K;
if (K == 1) {
cout << 0 << endl;
} else if (K == N) {
cout << 0 << endl;
} else {
cout << N - K << endl;
}
} | [
"identifier.change",
"control_flow.branch.if.condition.change",
"expression.operation.binary.remove"
] | 819,023 | 819,024 | u273355214 | cpp |
p03005 | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
// start
int n, k;
cin >> n >> k;
cout << (k == 1 ? 0 : n - k + 1) << endl;
// end
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
// start
int n, k;
cin >> n >> k;
cout << (k == 1 ? 0 : n - k) << endl;
// end
return 0;
}
| [
"expression.operation.binary.remove"
] | 819,025 | 819,026 | u376234649 | cpp |
p03005 | #include <bits/stdc++.h>
using namespace std;
#define REP(i, a) for (int i = 0; i < (a); i++)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;
int main() {
int n, k;
cin >> n >> k;
if (n == 1) {
cout << 0 << endl;
} else {
cout << n - k << endl;
}
} | #include <bits/stdc++.h>
using namespace std;
#define REP(i, a) for (int i = 0; i < (a); i++)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;
int main() {
int n, k;
cin >> n >> k;
if (k == 1) {
cout << 0 << endl;
} else {
cout << n - k << endl;
}
} | [
"identifier.change",
"control_flow.branch.if.condition.change"
] | 819,029 | 819,030 | u366398972 | cpp |
p03005 | #include <bits/stdc++.h>
using namespace std;
#define REP(i, a) for (int i = 0; i < (a); i++)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;
int main() {
int n, k;
cin >> n >> k;
if (n == 1) {
cout << 1 << endl;
} else {
cout << n - k << endl;
}
} | #include <bits/stdc++.h>
using namespace std;
#define REP(i, a) for (int i = 0; i < (a); i++)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;
int main() {
int n, k;
cin >> n >> k;
if (k == 1) {
cout << 0 << endl;
} else {
cout << n - k << endl;
}
} | [
"identifier.change",
"control_flow.branch.if.condition.change",
"literal.number.change",
"io.output.change"
] | 819,031 | 819,030 | u366398972 | cpp |
p03005 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int n, k;
cin >> n >> k;
if (n == 1)
cout << 0 << '\n';
else
cout << n - k << '\n';
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int n, k;
cin >> n >> k;
if (k == 1)
cout << 0 << '\n';
else
cout << n - k << '\n';
return 0;
}
| [
"identifier.change",
"control_flow.branch.if.condition.change"
] | 819,036 | 819,037 | u925767073 | cpp |
p03005 | #include <stdio.h>
int main() {
int a, b;
scanf("%d%d", &a, &b);
printf("%d\n", a - b);
} | #include <stdio.h>
int main() {
int a, b;
scanf("%d%d", &a, &b);
printf("%d\n", b > 1 ? a - b : 0);
} | [] | 819,046 | 819,047 | u648138491 | cpp |
p03005 | #include <algorithm>
#include <iomanip>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
int main(void) {
int n, k;
cin >> n >> k;
if (k == 0) {
cout << 0 << endl;
} else {
cout << n - k << endl;
}
return 0;
}
| #include <algorithm>
#include <iomanip>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
int main(void) {
int n, k;
cin >> n >> k;
if (k == 1) {
cout << 0 << endl;
} else {
cout << n - k << endl;
}
return 0;
}
| [
"literal.number.change",
"control_flow.branch.if.condition.change"
] | 819,054 | 819,055 | u114838227 | cpp |
p03005 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
if (n % k == 0) {
cout << 0 << endl;
} else {
cout << 1 << endl;
}
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
if (k == 1) {
cout << 0 << endl;
} else {
cout << n - k << endl;
}
} | [
"expression.operation.binary.remove",
"literal.number.change",
"control_flow.branch.if.condition.change",
"identifier.replace.add",
"literal.replace.remove",
"io.output.change"
] | 819,068 | 819,069 | u244626757 | cpp |
p03005 | #include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template <class T> constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template <class T> constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char> T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char> T_char TU(T_char cX) { return toupper(cX); };
typedef pair<LL, LL> pii;
const int vy[] = {-1, -1, -1, 0, 1, 1, 1, 0},
vx[] = {-1, 0, 1, 1, 1, 0, -1, -1};
const int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
int popcnt(unsigned long long n) {
int cnt = 0;
for (int i = 0; i < 64; i++)
if ((n >> i) & 1)
cnt++;
return cnt;
}
int d_sum(LL n) {
int ret = 0;
while (n > 0) {
ret += n % 10;
n /= 10;
}
return ret;
}
int d_cnt(LL n) {
int ret = 0;
while (n > 0) {
ret++;
n /= 10;
}
return ret;
}
LL gcd(LL a, LL b) {
if (b == 0)
return a;
return gcd(b, a % b);
};
LL lcm(LL a, LL b) {
LL g = gcd(a, b);
return a / g * b;
};
#define ALL(qpqpq) (qpqpq).begin(), (qpqpq).end()
#define UNIQUE(wpwpw) \
sort(ALL((wpwpw))); \
(wpwpw).erase(unique(ALL((wpwpw))), (wpwpw).end())
#define LOWER(epepe) transform(ALL((epepe)), (epepe).begin(), TL<char>)
#define UPPER(rprpr) transform(ALL((rprpr)), (rprpr).begin(), TU<char>)
#define FOR(i, tptpt, ypypy) for (LL i = (tptpt); i < (ypypy); i++)
#define REP(i, upupu) FOR(i, 0, upupu)
#define INIT \
std::ios::sync_with_stdio(false); \
std::cin.tie(0)
int n, k;
int main() {
cin >> n >> k;
cout << (n != 1 ? n - k : 0) << endl;
} | #include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template <class T> constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template <class T> constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char> T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char> T_char TU(T_char cX) { return toupper(cX); };
typedef pair<LL, LL> pii;
const int vy[] = {-1, -1, -1, 0, 1, 1, 1, 0},
vx[] = {-1, 0, 1, 1, 1, 0, -1, -1};
const int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
int popcnt(unsigned long long n) {
int cnt = 0;
for (int i = 0; i < 64; i++)
if ((n >> i) & 1)
cnt++;
return cnt;
}
int d_sum(LL n) {
int ret = 0;
while (n > 0) {
ret += n % 10;
n /= 10;
}
return ret;
}
int d_cnt(LL n) {
int ret = 0;
while (n > 0) {
ret++;
n /= 10;
}
return ret;
}
LL gcd(LL a, LL b) {
if (b == 0)
return a;
return gcd(b, a % b);
};
LL lcm(LL a, LL b) {
LL g = gcd(a, b);
return a / g * b;
};
#define ALL(qpqpq) (qpqpq).begin(), (qpqpq).end()
#define UNIQUE(wpwpw) \
sort(ALL((wpwpw))); \
(wpwpw).erase(unique(ALL((wpwpw))), (wpwpw).end())
#define LOWER(epepe) transform(ALL((epepe)), (epepe).begin(), TL<char>)
#define UPPER(rprpr) transform(ALL((rprpr)), (rprpr).begin(), TU<char>)
#define FOR(i, tptpt, ypypy) for (LL i = (tptpt); i < (ypypy); i++)
#define REP(i, upupu) FOR(i, 0, upupu)
#define INIT \
std::ios::sync_with_stdio(false); \
std::cin.tie(0)
int n, k;
int main() {
cin >> n >> k;
cout << (k != 1 ? n - k : 0) << endl;
} | [
"identifier.change",
"control_flow.loop.for.condition.change",
"io.output.change"
] | 819,070 | 819,071 | u093922224 | cpp |
p03005 | #include <iostream>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
cout << (k != 1) * n - k << endl;
} | #include <iostream>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
cout << (k != 1) * (n - k) << endl;
} | [] | 819,072 | 819,073 | u234435881 | cpp |
p03005 | #include <bits/stdc++.h>
using namespace std;
int n, k;
int main() {
cin >> n >> k;
if (k == 1)
cout << "0";
cout << n - k;
} | #include <bits/stdc++.h>
using namespace std;
int n, k;
int main() {
cin >> n >> k;
if (k == 1)
cout << "0";
else
cout << n - k;
} | [
"control_flow.branch.else_if.replace.remove",
"control_flow.branch.if.replace.add"
] | 819,076 | 819,077 | u185917548 | cpp |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.