Datasets:

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
p03192
#include <iostream> using namespace std; int main() { int a, c = 0; int i, b[4]; for (i = 0; i < 4; i++) { b[i] = a % 10; a = a / 10; if (b[i] == 2) c++; } cout << c; return 0; }
#include <iostream> using namespace std; int main() { int a, c = 0; int i, b[4]; cin >> a; for (i = 0; i < 4; i++) { b[i] = a % 10; a = a / 10; if (b[i] == 2) c++; } cout << c; return 0; }
[]
989,137
989,138
u818967913
cpp
p03192
#include <bits/stdc++.h> using namespace std; typedef long long ll; int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; } // MAX int lcm(int a, int b) { return a * b / gcd(a, b); } // MIN main() { string s; cin >> s; int che = 0; for (int i = 0; i < s.size(); i++) { if (s.at(i) == '3') che++; } cout << che << endl; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; } // MAX int lcm(int a, int b) { return a * b / gcd(a, b); } // MIN main() { string s; cin >> s; int che = 0; for (int i = 0; i < s.size(); i++) { if (s.at(i) == '2') che++; } cout << che << endl; }
[ "literal.string.change", "control_flow.branch.if.condition.change" ]
989,151
989,152
u157433024
cpp
p03192
#include <iostream> using namespace std; int main() { string S; cin >> S; int cnt = 0; for (int i = 0; i < 4; i++) { if (S[i] == 2) { cnt++; } } cout << cnt << endl; }
#include <iostream> using namespace std; int main() { string S; cin >> S; int cnt = 0; for (int i = 0; i < 4; i++) { if (S[i] == '2') { cnt++; } } cout << cnt << endl; }
[ "control_flow.branch.if.condition.change" ]
989,153
989,154
u552357043
cpp
p03192
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) int main() { string N; cin >> N; int ans = 0; for (int i = 0; i < 3; ++i) { if (N[i] == '2') ++ans; } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) int main() { string N; cin >> N; int ans = 0; for (int i = 0; i < 4; ++i) { if (N[i] == '2') { ++ans; } } cout << ans << endl; }
[ "literal.number.change", "control_flow.loop.for.condition.change", "expression.off_by_one", "expression.operation.binary.change" ]
989,163
989,164
u653388379
cpp
p03192
#include <bits/stdc++.h> using namespace std; int main() { string N; int num = 0; cin >> N; for (int i = 0; i < 4; ++i) { if (N[i] = '2') { num++; } } cout << num << endl; }
#include <bits/stdc++.h> using namespace std; int main() { string N; int num = 0; cin >> N; for (int i = 0; i < 4; ++i) { if (N[i] == '2') { num++; } } cout << num << endl; }
[ "expression.operation.compare.replace.add", "assignment.replace.remove", "misc.typo" ]
989,165
989,166
u091026689
cpp
p03192
#include <bits/stdc++.h> using namespace std; int main() { string n; int a = 0; cin >> n; for (int i = 0; i < n.size(); i++) { if (n[i] == 2) { a++; } } cout << a << endl; }
#include <bits/stdc++.h> using namespace std; int main() { string n; int a = 0; cin >> n; for (int i = 0; i < n.size(); i++) { if (n[i] == '2') { a++; } } cout << a << endl; }
[ "control_flow.branch.if.condition.change" ]
989,206
989,208
u272156949
cpp
p03192
#include <algorithm> #include <iostream> #include <queue> #include <set> #include <vector> using namespace std; int main() { int N; cin >> N; int res = 0; for (int i = 0; i < N; i++) { if (N % 10 == 2) res++; N /= 10; } cout << res << endl; }
#include <algorithm> #include <iostream> #include <queue> #include <set> #include <vector> using namespace std; int main() { int N; cin >> N; int res = 0; for (int i = 0; i < 4; i++) { if (N % 10 == 2) res++; N /= 10; } cout << res << endl; }
[ "identifier.replace.remove", "literal.replace.add", "control_flow.loop.for.condition.change", "expression.operation.binary.change" ]
989,210
989,212
u855985627
cpp
p03192
#include <bits/stdc++.h> using namespace std; int main() { vector<char> data(4); for (int i = 0; i < 4; i++) { cin >> data.at(i); } // 答えを保持する変数 int answer = 0; for (int i = 0; i < 4; i++) { if (data.at(i) == 2) { answer++; } } cout << answer << endl; }
#include <bits/stdc++.h> using namespace std; int main() { vector<char> data(4); for (int i = 0; i < 4; i++) { cin >> data.at(i); } // 答えを保持する変数 int answer = 0; for (int i = 0; i < 4; i++) { if (data.at(i) == '2') { answer++; } } cout << answer << endl; }
[ "control_flow.branch.if.condition.change" ]
989,214
989,216
u530329977
cpp
p03192
#include <bits/stdc++.h> using namespace std; int main() { vector<int> data(4); for (int i = 0; i < 4; i++) { cin >> data.at(i); } // 答えを保持する変数 int answer = '0'; for (int i = 0; i < 4; i++) { if (data.at(i) == '2') { answer++; } } cout << answer << endl; }
#include <bits/stdc++.h> using namespace std; int main() { vector<char> data(4); for (int i = 0; i < 4; i++) { cin >> data.at(i); } // 答えを保持する変数 int answer = 0; for (int i = 0; i < 4; i++) { if (data.at(i) == '2') { answer++; } } cout << answer << endl; }
[ "variable_declaration.type.primitive.change" ]
989,220
989,216
u530329977
cpp
p03192
#include <bits/stdc++.h> using namespace std; int main() { vector<int> data(4); for (int i = 0; i < 4; i++) { cin >> data.at(i); } // 答えを保持する変数 int answer = 0; for (int i = 0; i < 4; i++) { if (data.at(i) == '2') { answer++; } } cout << answer << endl; }
#include <bits/stdc++.h> using namespace std; int main() { vector<char> data(4); for (int i = 0; i < 4; i++) { cin >> data.at(i); } // 答えを保持する変数 int answer = 0; for (int i = 0; i < 4; i++) { if (data.at(i) == '2') { answer++; } } cout << answer << endl; }
[ "variable_declaration.type.primitive.change" ]
989,222
989,216
u530329977
cpp
p03192
#include <bits/stdc++.h> using namespace std; int main() { vector<char> data(4); for (int i = 0; i < 5; i++) { cin >> data.at(i); } // 答えを保持する変数 int answer = 0; for (int i = 0; i < 4; i++) { if (data.at(i) == 2) { answer++; } } cout << answer << endl; }
#include <bits/stdc++.h> using namespace std; int main() { vector<char> data(4); for (int i = 0; i < 4; i++) { cin >> data.at(i); } // 答えを保持する変数 int answer = 0; for (int i = 0; i < 4; i++) { if (data.at(i) == '2') { answer++; } } cout << answer << endl; }
[ "literal.number.change", "control_flow.loop.for.condition.change", "expression.off_by_one", "expression.operation.binary.change", "control_flow.branch.if.condition.change" ]
989,227
989,216
u530329977
cpp
p03192
#include <bits/stdc++.h> using namespace std; int main() { vector<char> data(4); for (int i = 0; i < 5; i++) { cin >> data.at(i); } // 答えを保持する変数 int answer = 0; for (int i = 0; i < 5; i++) { if (data.at(i) == '2') { answer++; } } cout << answer << endl; }
#include <bits/stdc++.h> using namespace std; int main() { vector<char> data(4); for (int i = 0; i < 4; i++) { cin >> data.at(i); } // 答えを保持する変数 int answer = 0; for (int i = 0; i < 4; i++) { if (data.at(i) == '2') { answer++; } } cout << answer << endl; }
[ "literal.number.change", "control_flow.loop.for.condition.change", "expression.off_by_one", "expression.operation.binary.change" ]
989,228
989,216
u530329977
cpp
p03192
#include <bits/stdc++.h> using namespace std; int main() { vector<char> data(4); for (int i = 0; i < 5; i++) { cin >> data.at(i); } // 答えを保持する変数 int answer = 0; for (int i = 0; i < 5; i++) { if (data.at(i) == 2) { answer++; } } cout << answer << endl; }
#include <bits/stdc++.h> using namespace std; int main() { vector<char> data(4); for (int i = 0; i < 4; i++) { cin >> data.at(i); } // 答えを保持する変数 int answer = 0; for (int i = 0; i < 4; i++) { if (data.at(i) == '2') { answer++; } } cout << answer << endl; }
[ "literal.number.change", "control_flow.loop.for.condition.change", "expression.off_by_one", "expression.operation.binary.change", "control_flow.branch.if.condition.change" ]
989,229
989,216
u530329977
cpp
p03192
#include <algorithm> #include <bits/stdc++.h> #include <bitset> #include <cmath> #include <iostream> #include <string> #include <vector> #define ll long long #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define FFOR(i, a, b) for (int i = (a); i <= (b); ++i) #define REP(i, n) FOR(i, 0, n) #define RREP(i, n) FFOR(i, 0, n) #define SORT(V) sort((V).begin(), (V).end()) #define INF ((1LL << 62) - (1LL << 31)) #define MOD 1000000007 using namespace std; int main() { int N, ans = 0; cin >> N; if (N % 10 == 2) ans++; if ((N % 100) - (N % 10) == 2) ans++; if ((N % 1000) - (N % 100) == 2) ans++; if ((N % 10000) - (N % 1000) == 2) ans++; cout << ans << endl; }
#include <algorithm> #include <bits/stdc++.h> #include <bitset> #include <cmath> #include <iostream> #include <string> #include <vector> #define ll long long #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define FFOR(i, a, b) for (int i = (a); i <= (b); ++i) #define REP(i, n) FOR(i, 0, n) #define RREP(i, n) FFOR(i, 0, n) #define SORT(V) sort((V).begin(), (V).end()) #define INF ((1LL << 62) - (1LL << 31)) #define MOD 1000000007 using namespace std; int main() { int N, ans = 0; cin >> N; if (N % 10 == 2) ans++; if ((N % 100) - (N % 10) == 20) ans++; if ((N % 1000) - (N % 100) == 200) ans++; if ((N % 10000) - (N % 1000) == 2000) ans++; cout << ans << endl; }
[ "literal.number.change", "control_flow.branch.if.condition.change" ]
989,230
989,231
u041282550
cpp
p03192
#include <algorithm> #include <iostream> #include <map> #include <set> #include <string> #include <vector> const int mod = 1e9 + 7; using LL = long long; using std::cin; using std::cout; using std::endl; using std::make_pair; using std::map; using std::max; using std::min; using std::multiset; using std::pair; using std::set; using std::string; using std::vector; std::ostream &operator<<(std::ostream &os, std::map<int, int> &obj) { for (std::map<int, int>::iterator itr = obj.begin(); itr != obj.end(); itr++) { os << itr->first << "^" << itr->second << " "; } return os; } std::ostream &operator<<(std::ostream &os, std::vector<std::map<int, int>> &obj) { for (auto itr = obj.begin(); itr != obj.end(); itr++) { os << *itr << std::endl; } return os; } std::ostream &operator<<(std::ostream &os, std::vector<int> &obj) { for (auto itr = obj.begin(); itr != obj.end(); itr++) { os << *itr << endl; } return os; } namespace ndifix { template <class T> void sort(T &v) { std::sort(v.begin(), v.end()); } } // namespace ndifix int main() { string s; cin >> s; int ans = 0; for (int i = 0; i < 4; i++) if (s[i] = '2') ans++; cout << ans << endl; return 0; }
#include <algorithm> #include <iostream> #include <map> #include <set> #include <string> #include <vector> const int mod = 1e9 + 7; using LL = long long; using std::cin; using std::cout; using std::endl; using std::make_pair; using std::map; using std::max; using std::min; using std::multiset; using std::pair; using std::set; using std::string; using std::vector; std::ostream &operator<<(std::ostream &os, std::map<int, int> &obj) { for (std::map<int, int>::iterator itr = obj.begin(); itr != obj.end(); itr++) { os << itr->first << "^" << itr->second << " "; } return os; } std::ostream &operator<<(std::ostream &os, std::vector<std::map<int, int>> &obj) { for (auto itr = obj.begin(); itr != obj.end(); itr++) { os << *itr << std::endl; } return os; } std::ostream &operator<<(std::ostream &os, std::vector<int> &obj) { for (auto itr = obj.begin(); itr != obj.end(); itr++) { os << *itr << endl; } return os; } namespace ndifix { template <class T> void sort(T &v) { std::sort(v.begin(), v.end()); } } // namespace ndifix int main() { string s; cin >> s; int ans = 0; for (int i = 0; i < 4; i++) if (s[i] == '2') ans++; cout << ans << endl; return 0; }
[ "expression.operation.compare.replace.add", "assignment.replace.remove", "misc.typo" ]
989,241
989,242
u819160021
cpp
p03192
#include <bits/stdc++.h> using namespace std; int main(void) { string n[4]; int count = 0; for (int i = 0; i < 4; i++) { cin >> n[i]; if (n[i] == "2") count++; } cout << count << endl; }
#include <bits/stdc++.h> using namespace std; int main(void) { char n[4]; int count = 0; for (int i = 0; i < 4; i++) { cin >> n[i]; if (n[i] == '2') count++; } cout << count << endl; }
[ "variable_declaration.type.change", "literal.string.change", "control_flow.branch.if.condition.change" ]
989,243
989,244
u079470909
cpp
p03192
#include <bits/stdc++.h> using namespace std; using ll = long long; #define ALL(c) (c).begin(), (c).end() const int MOD = 1000000007; int main() { string s; int t = 0; for (const char c : s) { if (c == '2') { t++; } } cout << t << endl; }
#include <bits/stdc++.h> using namespace std; using ll = long long; #define ALL(c) (c).begin(), (c).end() const int MOD = 1000000007; int main() { string s; cin >> s; int t = 0; for (const char c : s) { if (c == '2') { t++; } } cout << t << endl; }
[]
989,245
989,246
u540491484
cpp
p03192
#include <iostream> using namespace std; int main() { string s; cin >> s; int cnt = 0; for (char x : s) { if (x = '2') { cnt++; } } cout << cnt; // lol }
#include <iostream> using namespace std; int main() { string s; cin >> s; int cnt = 0; for (char x : s) { if (x == '2') { cnt++; } } cout << cnt; // lol }
[ "expression.operation.compare.replace.add", "assignment.replace.remove", "misc.typo" ]
989,249
989,250
u014321021
cpp
p03192
#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); }; template <typename T> vector<T> make_v(size_t a) { return vector<T>(a); } template <typename T, typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...)); } template <typename T, typename V> typename enable_if<is_class<T>::value == 0>::type fill_v(T &t, const V &v) { t = v; } template <typename T, typename V> typename enable_if<is_class<T>::value != 0>::type fill_v(T &t, const V &v) { for (auto &e : t) fill_v(e, v); } 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) string s; int main() { INIT; cin >> s; int cnt = 0; REP(i, 4) { if (i == '2') cnt++; } cout << cnt << 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); }; template <typename T> vector<T> make_v(size_t a) { return vector<T>(a); } template <typename T, typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...)); } template <typename T, typename V> typename enable_if<is_class<T>::value == 0>::type fill_v(T &t, const V &v) { t = v; } template <typename T, typename V> typename enable_if<is_class<T>::value != 0>::type fill_v(T &t, const V &v) { for (auto &e : t) fill_v(e, v); } 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) string s; int main() { INIT; cin >> s; int cnt = 0; REP(i, 4) { if (s[i] == '2') cnt++; } cout << cnt << endl; }
[ "control_flow.branch.if.condition.change" ]
989,253
989,254
u093922224
cpp
p03192
#include <iostream> int main() { int n; std::cin >> n; int count = 0; for (int i = 1; i <= 1000; i *= 10) { count += ((n % i * 10) / i == 2) ? 1 : 0; } std::cout << count << std::endl; }
#include <iostream> int main() { int n; std::cin >> n; int count = 0; for (int i = 1; i <= 10000; i *= 10) { count += ((n % i * 10) / i == 2) ? 1 : 0; } std::cout << count << std::endl; }
[ "literal.number.change", "control_flow.loop.for.condition.change", "expression.operation.binary.change" ]
989,172
989,173
u440856847
cpp
p03192
#include <iostream> #include <string> using namespace std; int main() { string n; cin >> n; int ans = 0; for (int i = 0; i < 4; i++) if (n[i] == 2) ans++; cout << ans << endl; }
#include <iostream> #include <string> using namespace std; int main() { string n; cin >> n; int ans = 0; for (int i = 0; i < 4; i++) if (n[i] == '2') ans++; cout << ans << endl; }
[ "control_flow.branch.if.condition.change" ]
989,213
989,215
u141968173
cpp
p03192
// 12_22.cpp : This file contains the 'main' function. Program execution begins // and ends there. // #include <iostream> #include <string> using namespace std; string s; int c = 0; int main() { cin >> s; for (int i = 0; i < 4; i++) { if (s[i] == 2) { c++; } } cout << c << endl; return 0; } // Run program: Ctrl + F5 or Debug > Start Without Debugging menu // Debug program: F5 or Debug > Start Debugging menu // Tips for Getting Started: // 1. Use the Solution Explorer window to add/manage files // 2. Use the Team Explorer window to connect to source control // 3. Use the Output window to see build output and other messages // 4. Use the Error List window to view errors // 5. Go to Project > Add New Item to create new code files, or Project > Add // Existing Item to add existing code files to the project // 6. In the future, to open this project again, go to File > Open > Project // and select the .sln file
// 12_22.cpp : This file contains the 'main' function. Program execution begins // and ends there. // #include <iostream> #include <string> using namespace std; string s; int c = 0; int main() { cin >> s; for (int i = 0; i < 4; i++) { if (s[i] == '2') { c++; } } cout << c << endl; return 0; } // Run program: Ctrl + F5 or Debug > Start Without Debugging menu // Debug program: F5 or Debug > Start Debugging menu // Tips for Getting Started: // 1. Use the Solution Explorer window to add/manage files // 2. Use the Team Explorer window to connect to source control // 3. Use the Output window to see build output and other messages // 4. Use the Error List window to view errors // 5. Go to Project > Add New Item to create new code files, or Project > Add // Existing Item to add existing code files to the project // 6. In the future, to open this project again, go to File > Open > Project // and select the .sln file
[ "control_flow.branch.if.condition.change" ]
989,221
989,223
u999447364
cpp
p03192
#include <bits/stdc++.h> using namespace std; int main() { int n, result = 0; scanf("%d", &n); while (n) { if (n % 10 == 2) result++; n /= 2; } printf("%d", result); return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n, result = 0; scanf("%d", &n); while (n) { if (n % 10 == 2) result++; n /= 10; } printf("%d", result); return 0; }
[ "literal.number.change", "assignment.value.change" ]
989,259
989,260
u897518464
cpp
p03192
#include <bits/stdc++.h> using namespace std; int main() { string n; cin >> n; int ans = 0; for (int i = 1; i < n.size(); i++) if (n[i] == '2') ans++; cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { string n; cin >> n; int ans = 0; for (int i = 0; i < n.size(); i++) if (n[i] == '2') ans++; cout << ans << endl; return 0; }
[ "literal.number.change", "variable_declaration.value.change", "control_flow.loop.for.initializer.change", "expression.off_by_one" ]
989,261
989,262
u489784632
cpp
p03192
#include <algorithm> #include <array> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <iostream> #include <list> #include <map> #include <queue> #include <random> #include <set> #include <sstream> #include <stack> #include <string> #include <tuple> #include <vector> using namespace std; typedef long long int ll; #define _overload3(_1, _2, _3, name, ...) name #define _rep(i, n) repi(i, 0, n) #define repi(i, a, b) for (int i = int(a); i < int(b); i++) #define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__) #define all(x) (x).begin(), (x).end() #define INF 10000000000 ll a, b, c, n, m, x, y, z, w, h, ans = 0, cnt = 0, mx = 0, mn = INF; string s; int main() { cin.tie(0); ios::sync_with_stdio(false); cin >> s; if (s[0] == '4') { ans++; } if (s[1] == '4') { ans++; } if (s[2] == '4') { ans++; } if (s[3] == '4') { ans++; } cout << ans << endl; }
#include <algorithm> #include <array> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <iostream> #include <list> #include <map> #include <queue> #include <random> #include <set> #include <sstream> #include <stack> #include <string> #include <tuple> #include <vector> using namespace std; typedef long long int ll; #define _overload3(_1, _2, _3, name, ...) name #define _rep(i, n) repi(i, 0, n) #define repi(i, a, b) for (int i = int(a); i < int(b); i++) #define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__) #define all(x) (x).begin(), (x).end() #define INF 10000000000 ll a, b, c, n, m, x, y, z, w, h, ans = 0, cnt = 0, mx = 0, mn = INF; string s; int main() { cin.tie(0); ios::sync_with_stdio(false); cin >> s; if (s[0] == '2') { ans++; } if (s[1] == '2') { ans++; } if (s[2] == '2') { ans++; } if (s[3] == '2') { ans++; } cout << ans << endl; }
[ "literal.string.change", "control_flow.branch.if.condition.change" ]
989,263
989,264
u303059352
cpp
p03192
#include <iostream> #include <string> using namespace std; int main() { string s; cin >> s; int k = 0; for (int i = 0; i < 3; i++) if (s[i] == '2') k++; cout << k; }
#include <iostream> #include <string> using namespace std; int main() { string s; cin >> s; int k = 0; for (int i = 0; i <= 3; i++) if (s[i] == '2') k++; cout << k; }
[ "expression.operator.compare.change", "control_flow.loop.for.condition.change", "expression.off_by_one", "expression.operation.binary.change" ]
989,284
989,285
u556469212
cpp
p03192
#include <algorithm> #include <cmath> #include <functional> #include <iostream> #include <map> #include <vector> #define reps(i, s, n) for (int(i) = (s); (i) < (n); (i)++) #define rep(i, n) reps(i, 0, n) using namespace std; using ll = long long; int main() { int n; cin >> n; int x, a = 0; rep(i, 4) { x = n % 10; if (x == 2) a++; x /= 10; } cout << a << endl; return 0; }
#include <algorithm> #include <cmath> #include <functional> #include <iostream> #include <map> #include <vector> #define reps(i, s, n) for (int(i) = (s); (i) < (n); (i)++) #define rep(i, n) reps(i, 0, n) using namespace std; using ll = long long; int main() { int n; cin >> n; int x, a = 0; rep(i, 4) { x = n % 10; if (x == 2) a++; n /= 10; } cout << a << endl; return 0; }
[ "assignment.variable.change", "identifier.change" ]
989,296
989,297
u704411633
cpp
p03192
// VIVEK UPADHYAY // MANIT, BHOPAL(M.P) /**********************************************************************************************/ /**********************************************************************************************/ // $$ JAB-TAK TODEGA NHI, // TAB -TAK CHODEGA NHI :D #include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <unistd.h> #include <unordered_map> #include <utility> #include <vector> using namespace std; #define F first #define S second #define mk(x, y) make_pair(x, y) #define pb(x) push_back(x) #define LINE cout << "\n"; #define ok cout << "ok\n"; #define dbg(x) cout << #x << " = " << (x) << "\n"; typedef long long ll; const int MAXN = 500510; const int MAX = 1e7 + 1; double pi = 3.1415926535897932384626433832795; const ll inf = 1e18; ll mod = 500500507; ll powr(ll a, ll b) { if (b == 0) return 1LL; ll x = powr(a, b / 2); x = (x * x) % mod; if (b % 2) return ((a % mod) * x) % mod; return x; } ll gcd(ll a, ll b) { if (a == 0) return b; return gcd(b % a, a); } int N = 1e5 + 10; int main() { string s; cin >> s; int cnt = 0; for (int i = 0; i < N; i++) if (s[i] == '2') cnt++; cout << cnt << endl; return 0; }
// VIVEK UPADHYAY // MANIT, BHOPAL(M.P) /**********************************************************************************************/ /**********************************************************************************************/ // $$ JAB-TAK TODEGA NHI, // TAB -TAK CHODEGA NHI :D #include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <unistd.h> #include <unordered_map> #include <utility> #include <vector> using namespace std; #define F first #define S second #define mk(x, y) make_pair(x, y) #define pb(x) push_back(x) #define LINE cout << "\n"; #define ok cout << "ok\n"; #define dbg(x) cout << #x << " = " << (x) << "\n"; typedef long long ll; const int MAXN = 500510; const int MAX = 1e7 + 1; double pi = 3.1415926535897932384626433832795; const ll inf = 1e18; ll mod = 500500507; ll powr(ll a, ll b) { if (b == 0) return 1LL; ll x = powr(a, b / 2); x = (x * x) % mod; if (b % 2) return ((a % mod) * x) % mod; return x; } ll gcd(ll a, ll b) { if (a == 0) return b; return gcd(b % a, a); } int N = 1e5 + 10; int main() { string s; cin >> s; int cnt = 0; for (int i = 0; i < s.length(); i++) if (s[i] == '2') cnt++; cout << cnt << endl; return 0; }
[ "control_flow.loop.for.condition.change", "expression.operation.binary.change", "call.add" ]
989,298
989,299
u753615145
cpp
p03189
#include <bits/stdc++.h> #define int long long #define maxn 3005 #define inv 500000004 #define mod 1000000007 using namespace std; int n, q, a[maxn]; int dp[maxn][maxn]; signed main() { cin >> n >> q; for (int i = 1; i <= n; i++) cin >> a[i]; for (int i = 1; i <= n; i++) for (int j = 1; j <= n; j++) if (a[i] > a[j]) dp[i][j] = 1; for (int i = 1, x, y; i <= q; i++) { cin >> x >> y; dp[x][y] = dp[y][x] = inv * (dp[x][y] + dp[y][x]) % mod; for (int j = 1; j <= n; j++) { if (j == x || j == y) continue; dp[x][j] = dp[y][j] = (inv * dp[x][j] + inv * dp[y][j]) % mod; dp[j][x] = dp[j][y] = (inv * dp[j][x] + inv * dp[j][y]) % mod; } } int now = 1, ans = 0; for (int i = 1; i <= q; i++) (now *= 2) %= mod; for (int i = 1; i <= n; i++) for (int j = 1; j < i; j++) (ans += dp[i][j]) %= mod; cout << ans * now % mod << endl; }
#include <bits/stdc++.h> #define int long long #define maxn 3005 #define inv 500000004 #define mod 1000000007 using namespace std; int n, q, a[maxn]; int dp[maxn][maxn]; signed main() { cin >> n >> q; for (int i = 1; i <= n; i++) cin >> a[i]; for (int i = 1; i <= n; i++) for (int j = 1; j <= n; j++) if (a[i] < a[j]) dp[i][j] = 1; for (int i = 1, x, y; i <= q; i++) { cin >> x >> y; dp[x][y] = dp[y][x] = inv * (dp[x][y] + dp[y][x]) % mod; for (int j = 1; j <= n; j++) { if (j == x || j == y) continue; dp[x][j] = dp[y][j] = (inv * dp[x][j] + inv * dp[y][j]) % mod; dp[j][x] = dp[j][y] = (inv * dp[j][x] + inv * dp[j][y]) % mod; } } int now = 1, ans = 0; for (int i = 1; i <= q; i++) (now *= 2) %= mod; for (int i = 1; i <= n; i++) for (int j = 1; j < i; j++) (ans += dp[i][j]) %= mod; cout << ans * now % mod << endl; }
[ "misc.opposites", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
989,326
989,327
u503512161
cpp
p03189
#include <bits/stdc++.h> #define int long long #define maxn 3005 #define inv 500000004 #define mod 1000000007 using namespace std; int n, q, a[maxn]; int dp[maxn][maxn]; signed main() { cin >> n >> q; for (int i = 1; i <= n; i++) cin >> a[i]; for (int i = 1; i <= n; i++) for (int j = 1; j <= n; j++) if (a[i] > a[j]) dp[i][j] = 1; for (int i = 1, x, y; i <= q; i++) { cin >> x >> y; dp[x][y] = dp[y][x] = inv * (dp[x][y] + dp[y][x]) % mod; for (int j = 1; j <= n; j++) { if (j == x || j == y) continue; dp[x][j] = dp[y][j] = (inv * dp[x][j] + inv * dp[y][j]) % mod; dp[j][x] = dp[j][y] = (inv * dp[j][x] + inv * dp[j][y]) % mod; } } int now = 1, ans = 0; for (int i = 1; i <= q; i++) (now *= 2) %= mod; for (int i = 1; i <= n; i++) for (int j = 1; j <= i; j++) (ans += dp[i][j]) %= mod; cout << ans * now % mod << endl; }
#include <bits/stdc++.h> #define int long long #define maxn 3005 #define inv 500000004 #define mod 1000000007 using namespace std; int n, q, a[maxn]; int dp[maxn][maxn]; signed main() { cin >> n >> q; for (int i = 1; i <= n; i++) cin >> a[i]; for (int i = 1; i <= n; i++) for (int j = 1; j <= n; j++) if (a[i] < a[j]) dp[i][j] = 1; for (int i = 1, x, y; i <= q; i++) { cin >> x >> y; dp[x][y] = dp[y][x] = inv * (dp[x][y] + dp[y][x]) % mod; for (int j = 1; j <= n; j++) { if (j == x || j == y) continue; dp[x][j] = dp[y][j] = (inv * dp[x][j] + inv * dp[y][j]) % mod; dp[j][x] = dp[j][y] = (inv * dp[j][x] + inv * dp[j][y]) % mod; } } int now = 1, ans = 0; for (int i = 1; i <= q; i++) (now *= 2) %= mod; for (int i = 1; i <= n; i++) for (int j = 1; j < i; j++) (ans += dp[i][j]) %= mod; cout << ans * now % mod << endl; }
[ "misc.opposites", "expression.operator.compare.change", "control_flow.branch.if.condition.change", "control_flow.loop.for.condition.change", "expression.off_by_one", "expression.operation.binary.change" ]
989,328
989,327
u503512161
cpp
p03189
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stdio.h> #include <stdlib.h> #include <string.h> using namespace std; #define re register #define ll long long inline int gi() { int f = 1, sum = 0; char ch = getchar(); while (ch > '9' || ch < '0') { if (ch == '-') f = -1; ch = getchar(); } while (ch >= '0' && ch <= '9') { sum = (sum << 3) + (sum << 1) + ch - '0'; ch = getchar(); } return f * sum; } const int N = 3010, Mod = 1e9 + 7, INV2 = 500000004; int n, Q, a[N], f[N][N]; int main() { n = gi(); Q = gi(); int pw = 1; for (int i = 1; i <= n; i++) a[i] = gi(); for (int i = 1; i <= n; i++) for (int j = 1; j <= n; j++) f[i][j] = (a[i] < a[j]); while (Q--) { int x = gi(), y = gi(); pw = 2ll * pw % Mod; f[x][y] = f[y][x] = 1ll * INV2 * (f[x][y] + f[y][x]) % Mod; for (int i = 1; i <= n; i++) if (x != i && i != y) { f[x][i] = f[y][i] = 1ll * INV2 * (f[x][i] + f[y][i]) % Mod; f[i][x] = f[i][y] = 1ll * INV2 * (f[i][x] + f[i][y]) % Mod; } } int ans = 0; for (int i = 1; i <= n; i++) for (int j = 1; j < i; j++) ans = (ans + f[i][j]) % Mod; printf("%d\n", ans * pw % Mod); return 0; }
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stdio.h> #include <stdlib.h> #include <string.h> using namespace std; #define re register #define ll long long inline int gi() { int f = 1, sum = 0; char ch = getchar(); while (ch > '9' || ch < '0') { if (ch == '-') f = -1; ch = getchar(); } while (ch >= '0' && ch <= '9') { sum = (sum << 3) + (sum << 1) + ch - '0'; ch = getchar(); } return f * sum; } const int N = 3010, Mod = 1e9 + 7, INV2 = 500000004; int n, Q, a[N], f[N][N]; int main() { n = gi(); Q = gi(); int pw = 1; for (int i = 1; i <= n; i++) a[i] = gi(); for (int i = 1; i <= n; i++) for (int j = 1; j <= n; j++) f[i][j] = (a[i] < a[j]); while (Q--) { int x = gi(), y = gi(); pw = 2ll * pw % Mod; f[x][y] = f[y][x] = 1ll * INV2 * (f[x][y] + f[y][x]) % Mod; for (int i = 1; i <= n; i++) if (x != i && i != y) { f[x][i] = f[y][i] = 1ll * INV2 * (f[x][i] + f[y][i]) % Mod; f[i][x] = f[i][y] = 1ll * INV2 * (f[i][x] + f[i][y]) % Mod; } } int ans = 0; for (int i = 1; i <= n; i++) for (int j = 1; j < i; j++) ans = (ans + f[i][j]) % Mod; printf("%lld\n", 1ll * ans * pw % Mod); return 0; }
[ "literal.string.change", "call.arguments.change", "io.output.change" ]
989,336
989,337
u810464778
cpp
p03189
#include <bits/stdc++.h> using namespace std; #define ll long long #define ull unsigned long long #define db long double #define pb push_back #define ppb pop_back #define F first #define S second #define mp make_pair #define all(x) (x).begin(), (x).end() mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int N = 3003, MOD = 1e9 + 7; int n, q, a[N], X[N], Y[N], dp[N][N], pw[N]; int rt = (MOD + 1) / 2; void add(int &x, int y) { x += y; if (x >= MOD) { x -= MOD; } } void dbg() { for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { cout << dp[i][j] << ' '; } cout << '\n'; } cout << '\n'; } int main() { ios_base::sync_with_stdio(false), cin.tie(NULL); #ifdef LOCAL freopen("input.txt", "r", stdin); #endif cin >> n >> q; pw[0] = 1; for (int i = 1; i <= n; i++) { pw[i] = (ll)pw[i - 1] * 2 % MOD; } for (int i = 1; i <= n; i++) { cin >> a[i]; } for (int i = 1; i <= q; i++) { cin >> X[i] >> Y[i]; } for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { if (i == j) { continue; } if (a[i] < a[j]) { dp[i][j] = 1; } } } for (int i = 1; i <= q; i++) { int x = X[i], y = Y[i]; int t1 = dp[x][y], t2 = dp[y][x]; add(dp[x][y], t2); add(dp[y][x], t1); dp[x][y] = (ll)dp[x][y] * rt % MOD; dp[y][x] = (ll)dp[y][x] * rt % MOD; for (int j = 1; j <= n; j++) { if (j == x || j == y) { continue; } int d1 = dp[j][x], d2 = dp[j][y]; int d3 = dp[x][j], d4 = dp[y][j]; add(dp[j][x], d2); dp[j][x] = (ll)dp[j][x] * rt % MOD; add(dp[j][y], d1); dp[j][y] = (ll)dp[j][y] * rt % MOD; add(dp[x][j], d4); dp[x][j] = (ll)dp[x][j] * rt % MOD; add(dp[y][j], d3); dp[y][j] = (ll)dp[y][j] * rt % MOD; } } int res = 0; for (int i = 1; i <= n; i++) { for (int j = 1; j < i; j++) { add(res, dp[i][j]); } } cout << (ll)res * pw[q] % MOD; }
#include <bits/stdc++.h> using namespace std; #define ll long long #define ull unsigned long long #define db long double #define pb push_back #define ppb pop_back #define F first #define S second #define mp make_pair #define all(x) (x).begin(), (x).end() mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int N = 3003, MOD = 1e9 + 7; int n, q, a[N], X[N], Y[N], dp[N][N], pw[N]; int rt = (MOD + 1) / 2; void add(int &x, int y) { x += y; if (x >= MOD) { x -= MOD; } } void dbg() { for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { cout << dp[i][j] << ' '; } cout << '\n'; } cout << '\n'; } int main() { ios_base::sync_with_stdio(false), cin.tie(NULL); #ifdef LOCAL freopen("input.txt", "r", stdin); #endif cin >> n >> q; pw[0] = 1; for (int i = 1; i < N; i++) { pw[i] = (ll)pw[i - 1] * 2 % MOD; } for (int i = 1; i <= n; i++) { cin >> a[i]; } for (int i = 1; i <= q; i++) { cin >> X[i] >> Y[i]; } for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { if (i == j) { continue; } if (a[i] < a[j]) { dp[i][j] = 1; } } } for (int i = 1; i <= q; i++) { int x = X[i], y = Y[i]; int t1 = dp[x][y], t2 = dp[y][x]; add(dp[x][y], t2); add(dp[y][x], t1); dp[x][y] = (ll)dp[x][y] * rt % MOD; dp[y][x] = (ll)dp[y][x] * rt % MOD; for (int j = 1; j <= n; j++) { if (j == x || j == y) { continue; } int d1 = dp[j][x], d2 = dp[j][y]; int d3 = dp[x][j], d4 = dp[y][j]; add(dp[j][x], d2); dp[j][x] = (ll)dp[j][x] * rt % MOD; add(dp[j][y], d1); dp[j][y] = (ll)dp[j][y] * rt % MOD; add(dp[x][j], d4); dp[x][j] = (ll)dp[x][j] * rt % MOD; add(dp[y][j], d3); dp[y][j] = (ll)dp[y][j] * rt % MOD; } } int res = 0; for (int i = 1; i <= n; i++) { for (int j = 1; j < i; j++) { add(res, dp[i][j]); } } cout << (ll)res * pw[q] % MOD; }
[ "control_flow.loop.for.condition.change" ]
989,338
989,339
u322084037
cpp
p03189
#include <bits/stdc++.h> const int MAXN = 3e3 + 10, MOD = 1e9 + 7, I2 = (MOD + 1) / 2; int n, Q; int a[MAXN], P[MAXN][MAXN]; int main() { scanf("%d%d", &n, &Q); for (int i = 1; i <= n; ++i) scanf("%d", a + i); for (int i = 1; i <= n; ++i) for (int j = 1; j <= n; ++j) P[i][j] = a[i] > a[j]; for (int i = 1, x, y; i <= Q; ++i) { scanf("%d%d", &x, &y), P[x][y] = P[y][x] = (P[x][y] + P[y][x]) * I2 % MOD; for (int j = 1; j <= n; ++j) if (j != x && j != y) P[x][j] = P[y][j] = 1LL * (P[x][j] + P[y][j]) * I2 % MOD, P[j][x] = P[j][y] = 1LL * (P[j][x] + P[j][y]) * I2 % MOD; } int pro = 1, ans = 0; for (int i = 1; i <= Q; ++i) pro = pro * 2 % MOD; for (int i = 1; i <= n; ++i) for (int j = i + 1; j <= n; ++j) ans = (ans + P[i][j]) % MOD; printf("%d\n", 1LL * ans * pro % MOD); return 0; }
#include <bits/stdc++.h> const int MAXN = 3e3 + 10, MOD = 1e9 + 7, I2 = (MOD + 1) / 2; int n, Q; int a[MAXN], P[MAXN][MAXN]; int main() { scanf("%d%d", &n, &Q); for (int i = 1; i <= n; ++i) scanf("%d", a + i); for (int i = 1; i <= n; ++i) for (int j = 1; j <= n; ++j) P[i][j] = a[i] > a[j]; for (int i = 1, x, y; i <= Q; ++i) { scanf("%d%d", &x, &y), P[x][y] = P[y][x] = 1LL * (P[x][y] + P[y][x]) * I2 % MOD; for (int j = 1; j <= n; ++j) if (j != x && j != y) P[x][j] = P[y][j] = 1LL * (P[x][j] + P[y][j]) * I2 % MOD, P[j][x] = P[j][y] = 1LL * (P[j][x] + P[j][y]) * I2 % MOD; } int pro = 1, ans = 0; for (int i = 1; i <= Q; ++i) pro = pro * 2 % MOD; for (int i = 1; i <= n; ++i) for (int j = i + 1; j <= n; ++j) ans = (ans + P[i][j]) % MOD; printf("%d\n", 1LL * ans * pro % MOD); return 0; }
[ "assignment.change" ]
989,340
989,341
u965088197
cpp
p03189
#include <bits/stdc++.h> #define fo(i, x, y) for (int i = x, B = y; i <= B; i++) #define ff(i, x, y) for (int i = x, B = y; i < B; i++) #define fd(i, x, y) for (int i = x, B = y; i >= B; i--) #define ll long long #define pp printf #define hh pp("\n") using namespace std; const int mo = 1e9 + 7; ll ksm(ll x, ll y) { ll s = 1; for (; y; y /= 2, x = x * x % mo) if (y & 1) s = s * x % mo; return s; } const ll ni2 = ksm(2, mo - 2); const int N = 3005; int n, q, a[N], x[N], y[N]; ll f[N][N]; int main() { scanf("%d %d", &n, &q); fo(i, 1, n) scanf("%d", &a[i]); fo(i, 1, n) fo(j, 1, n) f[i][j] = a[i] > a[j]; fo(i, 1, q) { scanf("%d %d", &x[i], &y[i]); fo(j, 1, n) if (j != x[i] && j != y[i]) { f[j][y[i]] = f[j][x[i]] = (f[j][y[i]] + f[j][x[i]]) * ni2 % mo; f[y[i]][j] = f[x[i]][j] = (f[y[i]][j] + f[x[i]][j]) * ni2 % mo; } f[x[i]][y[i]] = f[y[i]][x[i]] = (f[x[i]][y[i]] + f[y[i]][x[i]]) * ni2; } ll w = ksm(2, q), ans = 0; fo(i, 1, n) fo(j, i + 1, n) ans = (ans + f[i][j] * w) % mo; pp("%lld\n", ans); }
#include <bits/stdc++.h> #define fo(i, x, y) for (int i = x, B = y; i <= B; i++) #define ff(i, x, y) for (int i = x, B = y; i < B; i++) #define fd(i, x, y) for (int i = x, B = y; i >= B; i--) #define ll long long #define pp printf #define hh pp("\n") using namespace std; const int mo = 1e9 + 7; ll ksm(ll x, ll y) { ll s = 1; for (; y; y /= 2, x = x * x % mo) if (y & 1) s = s * x % mo; return s; } const ll ni2 = ksm(2, mo - 2); const int N = 3005; int n, q, a[N], x[N], y[N]; ll f[N][N]; int main() { scanf("%d %d", &n, &q); fo(i, 1, n) scanf("%d", &a[i]); fo(i, 1, n) fo(j, 1, n) f[i][j] = a[i] > a[j]; fo(i, 1, q) { scanf("%d %d", &x[i], &y[i]); fo(j, 1, n) if (j != x[i] && j != y[i]) { f[j][y[i]] = f[j][x[i]] = (f[j][y[i]] + f[j][x[i]]) * ni2 % mo; f[y[i]][j] = f[x[i]][j] = (f[y[i]][j] + f[x[i]][j]) * ni2 % mo; } f[x[i]][y[i]] = f[y[i]][x[i]] = (f[x[i]][y[i]] + f[y[i]][x[i]]) * ni2 % mo; } ll w = ksm(2, q), ans = 0; fo(i, 1, n) fo(j, i + 1, n) ans = (ans + f[i][j] * w) % mo; pp("%lld\n", ans); }
[ "assignment.change" ]
989,352
989,353
u173123334
cpp
p03189
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <map> #include <queue> #include <set> #include <vector> #define MAXN 3005 #define P 1000000007 #define INV 499122177 #define INF 0x3f3f3f3f #define rint register int #define LL long long #define LD long double using namespace std; int n, q, ans, a[MAXN], f[MAXN][MAXN]; inline int add(int x, int y) { return x + y >= P ? x + y - P : x + y; } inline int sub(int x, int y) { return x >= y ? x - y : x - y + P; } inline int ksm(int x, int y) { int ans = 1; while (y) { if (y & 1) ans = 1LL * x * ans % P; x = 1LL * x * x % P, y >>= 1; } return ans; } int main() { scanf("%d%d", &n, &q); for (rint i = 1; i <= n; ++i) scanf("%d", &a[i]); for (rint i = 1; i <= n; ++i) for (rint j = 1; j <= n; ++j) if (a[i] > a[j]) f[i][j] = 1; for (rint i = 1, x, y; i <= q; ++i) { scanf("%d%d", &x, &y); int t1, t2; for (rint j = 1; j <= n; ++j) { if (j == x || j == y) continue; t1 = f[x][j], t2 = f[y][j]; f[y][j] = f[x][j] = 1LL * add(t1, t2) * INV % P; t1 = f[j][x], t2 = f[j][y]; f[j][x] = f[j][y] = 1LL * add(t1, t2) * INV % P; } t1 = f[x][y], t2 = f[y][x]; f[x][y] = f[y][x] = 1LL * add(t1, t2) * INV % P; } int temp = ksm(2, q); for (rint i = 1; i <= n; ++i) for (rint j = i + 1; j <= n; ++j) ans = add(ans, 1LL * f[i][j] * temp % P); printf("%d\n", ans); return 0; }
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <map> #include <queue> #include <set> #include <vector> #define MAXN 3005 #define P 1000000007 #define INV 500000004 #define INF 0x3f3f3f3f #define rint register int #define LL long long #define LD long double using namespace std; int n, q, ans, a[MAXN], f[MAXN][MAXN]; inline int add(int x, int y) { return x + y >= P ? x + y - P : x + y; } inline int sub(int x, int y) { return x >= y ? x - y : x - y + P; } inline int ksm(int x, int y) { int ans = 1; while (y) { if (y & 1) ans = 1LL * x * ans % P; x = 1LL * x * x % P, y >>= 1; } return ans; } int main() { scanf("%d%d", &n, &q); for (rint i = 1; i <= n; ++i) scanf("%d", &a[i]); for (rint i = 1; i <= n; ++i) for (rint j = 1; j <= n; ++j) if (a[i] > a[j]) f[i][j] = 1; for (rint i = 1, x, y; i <= q; ++i) { scanf("%d%d", &x, &y); int t1, t2; for (rint j = 1; j <= n; ++j) { if (j == x || j == y) continue; t1 = f[x][j], t2 = f[y][j]; f[y][j] = f[x][j] = 1LL * add(t1, t2) * INV % P; t1 = f[j][x], t2 = f[j][y]; f[j][x] = f[j][y] = 1LL * add(t1, t2) * INV % P; } t1 = f[x][y], t2 = f[y][x]; f[x][y] = f[y][x] = 1LL * add(t1, t2) * INV % P; } int temp = ksm(2, q); for (rint i = 1; i <= n; ++i) for (rint j = i + 1; j <= n; ++j) ans = add(ans, 1LL * f[i][j] * temp % P); printf("%d\n", ans); return 0; }
[ "preprocessor.define.value.change", "literal.integer.change" ]
989,366
989,367
u229056063
cpp
p03189
#include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <unordered_map> #include <vector> using namespace std; #define ll long long #define REP(i, a, b) for (int i = (a), _end_ = (b); i <= _end_; i++) #define DREP(i, a, b) for (int i = (a), _end_ = (b); i >= _end_; i--) #define EREP(i, a) for (int i = start[(a)]; i; i = e[i].next) template <class T> inline void chkmax(T &a, T b) { if (a < b) a = b; } template <class T> inline void chkmin(T &a, T b) { if (a > b) a = b; } #define fi first #define se second #define mkr(a, b) make_pair(a, b) inline int read() { int sum = 0, p = 1; char ch = getchar(); while (!(('0' <= ch && ch <= '9') || ch == '-')) ch = getchar(); if (ch == '-') p = -1, ch = getchar(); while ('0' <= ch && ch <= '9') sum = sum * 10 + ch - 48, ch = getchar(); return sum * p; } const int maxn = 3e3 + 20; const int mod = 1e9 + 7; const int inv2 = mod + 1 >> 1; int n, a[maxn], q; int f[maxn][maxn], g[maxn][maxn]; inline void init() { n = read(); q = read(); REP(i, 1, n) a[i] = read(); } inline void doing() { int u = 0; REP(i, 1, n) REP(j, 1, n) if (i <= j) g[i][j] = f[i][j] = a[i] < a[j]; else g[i][j] = f[i][j] = a[i] < a[j]; REP(t, 1, q) { int i = read(), j = read(); REP(k, 1, n) if (k != j) { g[i][k] = (ll)inv2 * (f[i][k] + f[j][k]) % mod; } else g[i][j] = (ll)inv2 * (f[i][j] + f[j][i]); REP(k, 1, n) if (k != i) { g[j][k] = (ll)inv2 * (f[j][k] + f[i][k]) % mod; } else g[j][i] = (ll)inv2 * (f[i][j] + f[j][i]) % mod; REP(k, 1, n) if (k != i) { g[k][j] = (ll)inv2 * (f[k][j] + f[k][i]) % mod; } REP(k, 1, n) if (k != j) { g[k][i] = (ll)inv2 * (f[k][i] + f[k][j]) % mod; } REP(k, 1, n) f[i][k] = g[i][k], f[j][k] = g[j][k]; REP(k, 1, n) f[k][i] = g[k][i], f[k][j] = g[k][j]; } int ans = 0, s = 1; REP(i, 1, q) s = (ll)s * 2 % mod; REP(i, 1, n) REP(j, 1, i - 1) { ans = (ans + (ll)f[i][j] * s) % mod; } printf("%d\n", ans); } int main() { init(); doing(); return 0; }
#include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <unordered_map> #include <vector> using namespace std; #define ll long long #define REP(i, a, b) for (int i = (a), _end_ = (b); i <= _end_; i++) #define DREP(i, a, b) for (int i = (a), _end_ = (b); i >= _end_; i--) #define EREP(i, a) for (int i = start[(a)]; i; i = e[i].next) template <class T> inline void chkmax(T &a, T b) { if (a < b) a = b; } template <class T> inline void chkmin(T &a, T b) { if (a > b) a = b; } #define fi first #define se second #define mkr(a, b) make_pair(a, b) inline int read() { int sum = 0, p = 1; char ch = getchar(); while (!(('0' <= ch && ch <= '9') || ch == '-')) ch = getchar(); if (ch == '-') p = -1, ch = getchar(); while ('0' <= ch && ch <= '9') sum = sum * 10 + ch - 48, ch = getchar(); return sum * p; } const int maxn = 3e3 + 20; const int mod = 1e9 + 7; const int inv2 = mod + 1 >> 1; int n, a[maxn], q; int f[maxn][maxn], g[maxn][maxn]; inline void init() { n = read(); q = read(); REP(i, 1, n) a[i] = read(); } inline void doing() { int u = 0; REP(i, 1, n) REP(j, 1, n) if (i <= j) g[i][j] = f[i][j] = a[i] < a[j]; else g[i][j] = f[i][j] = a[i] < a[j]; REP(t, 1, q) { int i = read(), j = read(); REP(k, 1, n) if (k != j) { g[i][k] = (ll)inv2 * (f[i][k] + f[j][k]) % mod; } else g[i][j] = (ll)inv2 * (f[i][j] + f[j][i]) % mod; REP(k, 1, n) if (k != i) { g[j][k] = (ll)inv2 * (f[j][k] + f[i][k]) % mod; } else g[j][i] = (ll)inv2 * (f[i][j] + f[j][i]) % mod; REP(k, 1, n) if (k != i) { g[k][j] = (ll)inv2 * (f[k][j] + f[k][i]) % mod; } REP(k, 1, n) if (k != j) { g[k][i] = (ll)inv2 * (f[k][i] + f[k][j]) % mod; } REP(k, 1, n) f[i][k] = g[i][k], f[j][k] = g[j][k]; REP(k, 1, n) f[k][i] = g[k][i], f[k][j] = g[k][j]; } int ans = 0, s = 1; REP(i, 1, q) s = (ll)s * 2 % mod; REP(i, 1, n) REP(j, 1, i - 1) { ans = (ans + (ll)f[i][j] * s) % mod; } printf("%d\n", ans); } int main() { init(); doing(); return 0; }
[ "assignment.change" ]
989,369
989,370
u057222094
cpp
p03192
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int ans = 0; while (n != 0) { if (n % 2 == 0) ans++; n /= 10; } cout << ans; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int ans = 0; while (n != 0) { if (n % 10 == 2) ans++; n /= 10; } cout << ans; return 0; }
[ "literal.number.change", "control_flow.branch.if.condition.change" ]
989,371
989,372
u611384918
cpp
p03193
#include <bits/stdc++.h> using namespace std; void solve() { int n, h, w; cin >> n >> h >> w; int ans = 0; while (n--) { int a, b; cin >> a >> b; ans += a <= h && b <= w; } cout << ans << endl; } signed main() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(10); solve(); return 0; }
#include <bits/stdc++.h> using namespace std; void solve() { int n, h, w; cin >> n >> h >> w; int ans = 0; while (n--) { int a, b; cin >> a >> b; ans += a >= h && b >= w; } cout << ans << endl; } signed main() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(10); solve(); return 0; }
[ "misc.opposites", "expression.operator.compare.change", "assignment.value.change", "expression.operation.binary.change" ]
989,375
989,376
u104057163
cpp
p03193
#include <algorithm> #include <assert.h> #include <bitset> #include <cassert> #include <cctype> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdint> #include <cstdio> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <limits> #include <list> #include <map> #include <math.h> #include <memory> #include <queue> #include <random> #include <set> #include <stack> #include <stdio.h> #include <stdlib.h> #include <string> #include <tuple> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> #define int long long using namespace std; signed main() { int N, H, W; cin >> N >> H >> W; int A, B; int ans = 0; for (int i = 0; i < N; i++) { cin >> A >> B; if (A <= H && B <= W) { ans++; } } cout << ans << endl; }
#include <algorithm> #include <assert.h> #include <bitset> #include <cassert> #include <cctype> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdint> #include <cstdio> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <limits> #include <list> #include <map> #include <math.h> #include <memory> #include <queue> #include <random> #include <set> #include <stack> #include <stdio.h> #include <stdlib.h> #include <string> #include <tuple> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> #define int long long using namespace std; signed main() { int N, H, W; cin >> N >> H >> W; int A, B; int ans = 0; for (int i = 0; i < N; i++) { cin >> A >> B; if (A >= H && B >= W) { ans++; } } cout << ans << endl; }
[ "misc.opposites", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
989,380
989,381
u580593895
cpp
p03193
#include <bits/stdc++.h> //#include <atcoder/all> using namespace std; // using namespace atcoder; #define ll long long #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define rep(i, n) FOR(i, 0, n) #define rep1(i, n) FOR(i, 1, n + 1) #define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i) #define whole(x) (x).begin(), (x).end() #define rwhole(x) (x).rbegin(), (x).rend() #define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()) #define P pair<int, int> #define debug(var) cerr << "[" << #var << "] " << var << endl template <typename T1, typename T2> bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return true; } else return false; } template <typename T1, typename T2> bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return true; } else return false; } #define vi vector<int> #define vl vector<ll> #define pb push_back #define eb emplace_back #define fi first #define se second #define pr(s) cout << (s) << '\n' ll mod = 1000000007; const int dx[] = {-1, 0, 1, 0}; const int dy[] = {0, -1, 0, 1}; const int INF = 1001001001; const ll INFll = 1E+18; int main() { int n, h, w; cin >> n >> h >> w; int ans = 0; rep(i, n) { int a, b; cin >> a >> b; if (h >= a && w >= b) ans++; } pr(ans); }
#include <bits/stdc++.h> //#include <atcoder/all> using namespace std; // using namespace atcoder; #define ll long long #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define rep(i, n) FOR(i, 0, n) #define rep1(i, n) FOR(i, 1, n + 1) #define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i) #define whole(x) (x).begin(), (x).end() #define rwhole(x) (x).rbegin(), (x).rend() #define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()) #define P pair<int, int> #define debug(var) cerr << "[" << #var << "] " << var << endl template <typename T1, typename T2> bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return true; } else return false; } template <typename T1, typename T2> bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return true; } else return false; } #define vi vector<int> #define vl vector<ll> #define pb push_back #define eb emplace_back #define fi first #define se second #define pr(s) cout << (s) << '\n' ll mod = 1000000007; const int dx[] = {-1, 0, 1, 0}; const int dy[] = {0, -1, 0, 1}; const int INF = 1001001001; const ll INFll = 1E+18; int main() { int n, h, w; cin >> n >> h >> w; int ans = 0; rep(i, n) { int a, b; cin >> a >> b; if (h <= a && w <= b) ans++; } pr(ans); }
[ "misc.opposites", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
989,382
989,383
u488493347
cpp
p03193
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long ll; int main() { int n, h, w; cin >> n >> h >> w; int ans = 0; rep(i, n) { int a, b; cin >> a >> b; if (a <= h && b <= w) ++ans; // else if(a<=w && b<=h)++ans; } cout << ans << 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; int main() { int n, h, w; cin >> n >> h >> w; int ans = 0; rep(i, n) { int a, b; cin >> a >> b; if (a >= h && b >= w) ++ans; // else if(a<=w && b<=h)++ans; } cout << ans << endl; return 0; }
[ "misc.opposites", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
989,386
989,387
u933962236
cpp
p03193
#include <bits/stdc++.h> using namespace std; #define ll int64_t //ライブラリ始まり //定数 //円周率 const double PI = 3.1415926535897932384; //天井 const int INF = 1000000000; // = 10^9 const ll LINF = 1000000000000000; // = 10^15 // ABC文字列 const string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZABC"; const string abc = "abcdefghijklmnopqrstuvwxyzabc"; //よくあるmodくん const ll MOD = 1000000007; // = 10^9 + 7 //関数 // ctoi int ctoi(char c) { if (c == '0') { return 0; } if (c == '1') { return 1; } if (c == '2') { return 2; } if (c == '3') { return 3; } if (c == '4') { return 4; } if (c == '5') { return 5; } if (c == '6') { return 6; } if (c == '7') { return 7; } if (c == '8') { return 8; } if (c == '9') { return 9; } return -1; } //素数判定 bool PN(int x) { if (x <= 1) { return false; } if (x == 2) { return true; } for (int i = 2; i < sqrt(x) + 1; i++) { if (x % i == 0) { return false; } } return true; } //ライブラリ終わり void DO(int c, int x, vector<int> &t, vector<vector<int>> xy) { int XS = xy.size(); if (t.at(x) != -1) { return; } t.at(x) = c; for (int i = 0; i < XS; i++) { if (xy.at(i).at(0) > x) { break; } if (xy.at(i).at(0) == x) { DO(c, xy.at(i).at(1), t, xy); } if (xy.at(i).at(1) == x) { DO(c, xy.at(i).at(0), t, xy); } } } int main() { int N, H, W; cin >> N >> H >> W; int ans = 0; for (int i = 0; i < N; i++) { int A, B; cin >> A >> B; if (A <= H && B <= W) { ans++; } } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; #define ll int64_t //ライブラリ始まり //定数 //円周率 const double PI = 3.1415926535897932384; //天井 const int INF = 1000000000; // = 10^9 const ll LINF = 1000000000000000; // = 10^15 // ABC文字列 const string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZABC"; const string abc = "abcdefghijklmnopqrstuvwxyzabc"; //よくあるmodくん const ll MOD = 1000000007; // = 10^9 + 7 //関数 // ctoi int ctoi(char c) { if (c == '0') { return 0; } if (c == '1') { return 1; } if (c == '2') { return 2; } if (c == '3') { return 3; } if (c == '4') { return 4; } if (c == '5') { return 5; } if (c == '6') { return 6; } if (c == '7') { return 7; } if (c == '8') { return 8; } if (c == '9') { return 9; } return -1; } //素数判定 bool PN(int x) { if (x <= 1) { return false; } if (x == 2) { return true; } for (int i = 2; i < sqrt(x) + 1; i++) { if (x % i == 0) { return false; } } return true; } //ライブラリ終わり void DO(int c, int x, vector<int> &t, vector<vector<int>> xy) { int XS = xy.size(); if (t.at(x) != -1) { return; } t.at(x) = c; for (int i = 0; i < XS; i++) { if (xy.at(i).at(0) > x) { break; } if (xy.at(i).at(0) == x) { DO(c, xy.at(i).at(1), t, xy); } if (xy.at(i).at(1) == x) { DO(c, xy.at(i).at(0), t, xy); } } } int main() { int N, H, W; cin >> N >> H >> W; int ans = 0; for (int i = 0; i < N; i++) { int A, B; cin >> A >> B; if (A >= H && B >= W) { ans++; } } cout << ans << endl; }
[ "misc.opposites", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
989,388
989,389
u453366189
cpp
p03193
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define endl "\n" typedef long long ll; const double pi = 3.14159265358979323846; int ctoi(const char c) { if ('0' <= c && c <= '9') return (c - '0'); return -1; } vector<int> input(int n) { vector<int> vec(n); for (int i = 0; i < n; i++) { cin >> vec.at(i); } return vec; } void output(vector<int> vec) { for (int i = 0; i < vec.size(); i++) { cout << vec[i] << " "; } return; } vector<vector<int>> input(int n, int m) { vector<vector<int>> table(n, vector<int>(m)); for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { cin >> table.at(i).at(j); } } return table; } void output(vector<vector<int>> table) { for (int i = 0; i < table.size(); i++) { for (int j = 0; j < table.at(0).size(); j++) { cout << table.at(i).at(j) << " "; } cout << endl; } } long long perm(int n, int r) { if (n < r) { cout << "error" << endl; return 0; } long long perm = 1; for (int i = n; i > n - r; i--) { perm *= i; } return perm; } long long comb(int n, int r) { if (n < r) { cout << "error" << endl; return 0; } long long comb = perm(n, r); for (int i = r; i > 0; i--) { comb /= i; } return comb; } long long homo(int n, int r) { return comb(n + r - 1, n - 1); } long long fact(int n) { long long fact = 1; for (int i = n; i > 0; i--) { fact *= i; } return fact; } int gcd(int a, int b) { if (a % b == 0) { return (b); } else { return (gcd(b, a % b)); } } int lcm(int a, int b) { return a * b / gcd(a, b); } bool isprime(int n) { if (n < 2) return false; else if (n == 2) return true; else if (n % 2 == 0) return false; for (int i = 3; i <= sqrt(n); i += 2) { if (n % i == 0) { return false; } } return true; } vector<long long> divisors(long long N) { vector<long long> res; for (long long i = 1; i * i <= N; ++i) { if (N % i == 0) { res.push_back(i); // 重複しないならば i の相方である N/i も push if (N / i != i) res.push_back(N / i); } } // 小さい順に並び替える sort(res.begin(), res.end()); return res; /*long long N; cin >> N; vector<long long> res = divisors(N); for (int i = 0; i < res.size(); ++i) { cout << res[i] << " "; } cout << endl;*/ } vector<pair<long long, long long>> prime_factorize(long long N) { vector<pair<long long, long long>> res; for (long long a = 2; a * a <= N; ++a) { if (N % a != 0) continue; long long ex = 0; while (N % a == 0) { ++ex; N /= a; } res.push_back({a, ex}); } if (N != 1) res.push_back({N, 1}); return res; } void sayYes(bool f) { if (f) { cout << "Yes" << endl; } else { cout << "No" << endl; } } void sayYES(bool f) { if (f) { cout << "YES" << endl; } else { cout << "NO" << endl; } } int main() { ll n, h, w; cin >> n >> h >> w; ll ans = 0; rep(i, n) { ll a, b; cin >> a >> b; if (a >= h && b >= w) { ans++; } cout << ans << endl; } }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define endl "\n" typedef long long ll; const double pi = 3.14159265358979323846; int ctoi(const char c) { if ('0' <= c && c <= '9') return (c - '0'); return -1; } vector<int> input(int n) { vector<int> vec(n); for (int i = 0; i < n; i++) { cin >> vec.at(i); } return vec; } void output(vector<int> vec) { for (int i = 0; i < vec.size(); i++) { cout << vec[i] << " "; } return; } vector<vector<int>> input(int n, int m) { vector<vector<int>> table(n, vector<int>(m)); for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { cin >> table.at(i).at(j); } } return table; } void output(vector<vector<int>> table) { for (int i = 0; i < table.size(); i++) { for (int j = 0; j < table.at(0).size(); j++) { cout << table.at(i).at(j) << " "; } cout << endl; } } long long perm(int n, int r) { if (n < r) { cout << "error" << endl; return 0; } long long perm = 1; for (int i = n; i > n - r; i--) { perm *= i; } return perm; } long long comb(int n, int r) { if (n < r) { cout << "error" << endl; return 0; } long long comb = perm(n, r); for (int i = r; i > 0; i--) { comb /= i; } return comb; } long long homo(int n, int r) { return comb(n + r - 1, n - 1); } long long fact(int n) { long long fact = 1; for (int i = n; i > 0; i--) { fact *= i; } return fact; } int gcd(int a, int b) { if (a % b == 0) { return (b); } else { return (gcd(b, a % b)); } } int lcm(int a, int b) { return a * b / gcd(a, b); } bool isprime(int n) { if (n < 2) return false; else if (n == 2) return true; else if (n % 2 == 0) return false; for (int i = 3; i <= sqrt(n); i += 2) { if (n % i == 0) { return false; } } return true; } vector<long long> divisors(long long N) { vector<long long> res; for (long long i = 1; i * i <= N; ++i) { if (N % i == 0) { res.push_back(i); // 重複しないならば i の相方である N/i も push if (N / i != i) res.push_back(N / i); } } // 小さい順に並び替える sort(res.begin(), res.end()); return res; /*long long N; cin >> N; vector<long long> res = divisors(N); for (int i = 0; i < res.size(); ++i) { cout << res[i] << " "; } cout << endl;*/ } vector<pair<long long, long long>> prime_factorize(long long N) { vector<pair<long long, long long>> res; for (long long a = 2; a * a <= N; ++a) { if (N % a != 0) continue; long long ex = 0; while (N % a == 0) { ++ex; N /= a; } res.push_back({a, ex}); } if (N != 1) res.push_back({N, 1}); return res; } void sayYes(bool f) { if (f) { cout << "Yes" << endl; } else { cout << "No" << endl; } } void sayYES(bool f) { if (f) { cout << "YES" << endl; } else { cout << "NO" << endl; } } int main() { ll n, h, w; cin >> n >> h >> w; ll ans = 0; rep(i, n) { ll a, b; cin >> a >> b; if (a >= h && b >= w) { ans++; } } cout << ans << endl; }
[]
989,396
989,397
u492660436
cpp
p03193
#include <bits/stdc++.h> using namespace std; int main() { int n; long int h, w; scanf("%d%ld%ld", &n, &h, &w); long int a[n], b[n]; int i, cnt = 0; for (i = 0; i < n; ++i) { scanf("%ld%ld", &a[i], &b[i]); if (a[i] <= h && b[i] <= w) cnt++; } printf("%d", cnt); }
#include <bits/stdc++.h> using namespace std; int main() { int n; long int h, w; scanf("%d%ld%ld", &n, &h, &w); long int a[n], b[n]; int i, cnt = 0; for (i = 0; i < n; ++i) { scanf("%ld%ld", &a[i], &b[i]); if (a[i] >= h && b[i] >= w) cnt++; } printf("%d", cnt); }
[ "misc.opposites", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
989,405
989,406
u033208015
cpp
p03193
#include <bits/stdc++.h> using namespace std; int n, h, w; int main() { cin >> n >> h >> w; int res = 0; for (int i = 0; i < n; ++i) { int a, b; cin >> a >> b; if (h >= a && w >= b) ++res; } cout << res << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int n, h, w; int main() { cin >> n >> h >> w; int res = 0; for (int i = 0; i < n; ++i) { int a, b; cin >> a >> b; if (h <= a && w <= b) ++res; } cout << res << endl; return 0; }
[ "misc.opposites", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
989,409
989,410
u269963329
cpp
p03193
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; using ll = long long; using Graph = vector<vector<int>>; using P = pair<int, int>; int main() { ll n, h, w; cin >> n >> h >> w; ll ans = 0; rep(i, n) { ll a, b; cin >> a >> b; if (a <= h && b <= w) ans++; } cout << ans << endl; return 0; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; using ll = long long; using Graph = vector<vector<int>>; using P = pair<int, int>; int main() { ll n, h, w; cin >> n >> h >> w; ll ans = 0; rep(i, n) { ll a, b; cin >> a >> b; if (a >= h && b >= w) ans++; } cout << ans << endl; return 0; }
[ "misc.opposites", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
989,411
989,412
u547099897
cpp
p03193
#include <algorithm> #include <cmath> #include <iostream> #include <string> using namespace std; int main() { long long n, h, w, a, b, sum = 0; cin >> n >> h >> w; for (int h = 1; h < n; h++) { cin >> a >> b; if (a >= h && b >= w) { sum++; } } cout << sum << endl; cin >> n; }
#include <algorithm> #include <cmath> #include <iostream> #include <string> using namespace std; int main() { long long n, h, w, a, b, sum = 0; cin >> n >> h >> w; for (int i = 1; i <= n; i++) { cin >> a >> b; if (a >= h && b >= w) { sum++; } } cout << sum << endl; cin >> n; }
[ "variable_declaration.name.change", "identifier.change", "control_flow.loop.for.initializer.change", "control_flow.loop.for.condition.change" ]
989,421
989,420
u986568278
cpp
p03193
#include "bits/stdc++.h" using namespace std; typedef long long ll; const ll MOD = (ll)(1e9 + 7); #define pb push_back #define mp make_pair #define all(x) (x).begin(), (x).end() #define rep(i, n) for (int(i) = 0; (i) < (int)(n); (i)++) #ifdef LOCAL #define debug(x) cerr << #x << ": " << x << endl #else #define debug(x) #endif int dx[4] = {1, 0, -1, 0}; int dy[4] = {0, 1, 0, -1}; int N, H, W; signed main() { cin >> N >> H >> W; int ans = 0; rep(i, N) { int A, B; cin >> A >> B; if (A <= H && B <= W) ans++; } cout << ans << endl; }
#include "bits/stdc++.h" using namespace std; typedef long long ll; const ll MOD = (ll)(1e9 + 7); #define pb push_back #define mp make_pair #define all(x) (x).begin(), (x).end() #define rep(i, n) for (int(i) = 0; (i) < (int)(n); (i)++) #ifdef LOCAL #define debug(x) cerr << #x << ": " << x << endl #else #define debug(x) #endif int dx[4] = {1, 0, -1, 0}; int dy[4] = {0, 1, 0, -1}; int N, H, W; signed main() { cin >> N >> H >> W; int ans = 0; rep(i, N) { int A, B; cin >> A >> B; if (A >= H && B >= W) ans++; } cout << ans << endl; }
[ "misc.opposites", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
989,423
989,424
u422592877
cpp
p03193
#include <bits/stdc++.h> using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); int n, h, w; cin >> n >> h >> w; int a, b, ans = 0; for (int i = 0; i < n; i++) { cin >> a >> b; if (a <= h && b <= w) ans++; } cout << ans << '\n'; }
#include <bits/stdc++.h> using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); int n, h, w; cin >> n >> h >> w; int a, b, ans = 0; for (int i = 0; i < n; i++) { cin >> a >> b; if (a >= h && b >= w) ans++; } cout << ans << '\n'; }
[ "misc.opposites", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
989,425
989,426
u979163294
cpp
p03193
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int i, j, cnt = 0; int n, h, w; cin >> n >> h >> w; int a[n], b[n]; for (i = 0; i < n; i++) cin >> a[i] >> b[i]; for (i = 0; i < n; i++) { if (a[i] <= h && b[i] <= w) cnt++; } cout << cnt; }
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int i, j, cnt = 0; int n, h, w; cin >> n >> h >> w; int a[n], b[n]; for (i = 0; i < n; i++) cin >> a[i] >> b[i]; for (i = 0; i < n; i++) { if (a[i] >= h && b[i] >= w) cnt++; } cout << cnt; }
[ "misc.opposites", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
989,429
989,430
u952130512
cpp
p03193
#include <algorithm> #include <cmath> #include <iostream> #include <numeric> #include <string> #include <unordered_map> #include <vector> using namespace std; using ll = long long; void _cin() {} template <class Head, class... Tail> void _cin(Head &&head, Tail &&...tail) { cin >> head; _cin(forward<Tail>(tail)...); } void _cout() { cout << "\n"; } template <class Head, class... Tail> void _cout(Head &&head, Tail &&...tail) { cout << head; _cout(forward<Tail>(tail)...); } int gcd(int a, int b) { return (b == 0) ? a : gcd(b, a % b); } #define Sq(x) (x) * (x) #define For(i, n) for (int i = 0; i < (n); i++) #define Rep(n) For(_, n) #define Range(c) c.begin(), c.end() #define RevRange(c) c.rbegin(), c.rend() #define Contains(c, x) (find(Range(c), x) != c.end()) #define Search(rb, re, x) distance(rb, find(rb, re, x)) #define Sort(a) sort(Range(a)) #define DeSort(a) sort(RevRange(a)) #define Reverse(c) reverse(Range(c)) #define Unique(a) a.erase(unique(Range(a)), a.end()) #define Cusum(T, xs, sxs) \ vector<T> sxs(xs.size() + 1); \ For(i, (int)xs.size()) sxs[i + 1] = sxs[i] + xs[i] #define Cin(T, ...) \ T __VA_ARGS__; \ _cin(__VA_ARGS__) #define Cins(T, n, xs) \ vector<T> xs(n); \ For(i, n) cin >> xs[i] #define Cins2(T, n, xs, ys) \ vector<T> xs(n), ys(n); \ For(i, n) cin >> xs[i] >> ys[i] #define Cins3(T, n, xs, ys, zs) \ vector<T> xs(n), ys(n), zs(n); \ For(i, n) cin >> xs[i] >> ys[i] >> zs[i] #define Cinss(T, n, m, xs) \ Vec2(T, n, m, xs); \ For(i, n) For(j, m) cin >> xs[i][j] #define Cinm(T, n, map) \ unordered_map<T, int> map; \ Rep(n) { \ Cin(T, x); \ map[x]++; \ } #define Cout(...) _cout(__VA_ARGS__) #define Couts(xs) \ { \ for (const auto &e : xs) \ cout << e << " "; \ cout << "\n"; \ } #define Coutyn(cond) Cout((cond) ? "yes" : "no") #define CoutYn(cond) Cout((cond) ? "Yes" : "No") #define CoutYN(cond) Cout((cond) ? "YES" : "NO") #define vc vector #define Mini(a, x) a = min(a, x) #define Maxi(a, x) a = max(a, x) // constexpr int MOD = 1e9+7; int main(void) { Cin(int, n, h, w); int ans = 0; Rep(n) { Cin(int, a, b); if (a <= h && b <= w) ans++; } Cout(ans); }
#include <algorithm> #include <cmath> #include <iostream> #include <numeric> #include <string> #include <unordered_map> #include <vector> using namespace std; using ll = long long; void _cin() {} template <class Head, class... Tail> void _cin(Head &&head, Tail &&...tail) { cin >> head; _cin(forward<Tail>(tail)...); } void _cout() { cout << "\n"; } template <class Head, class... Tail> void _cout(Head &&head, Tail &&...tail) { cout << head; _cout(forward<Tail>(tail)...); } int gcd(int a, int b) { return (b == 0) ? a : gcd(b, a % b); } #define Sq(x) (x) * (x) #define For(i, n) for (int i = 0; i < (n); i++) #define Rep(n) For(_, n) #define Range(c) c.begin(), c.end() #define RevRange(c) c.rbegin(), c.rend() #define Contains(c, x) (find(Range(c), x) != c.end()) #define Search(rb, re, x) distance(rb, find(rb, re, x)) #define Sort(a) sort(Range(a)) #define DeSort(a) sort(RevRange(a)) #define Reverse(c) reverse(Range(c)) #define Unique(a) a.erase(unique(Range(a)), a.end()) #define Cusum(T, xs, sxs) \ vector<T> sxs(xs.size() + 1); \ For(i, (int)xs.size()) sxs[i + 1] = sxs[i] + xs[i] #define Cin(T, ...) \ T __VA_ARGS__; \ _cin(__VA_ARGS__) #define Cins(T, n, xs) \ vector<T> xs(n); \ For(i, n) cin >> xs[i] #define Cins2(T, n, xs, ys) \ vector<T> xs(n), ys(n); \ For(i, n) cin >> xs[i] >> ys[i] #define Cins3(T, n, xs, ys, zs) \ vector<T> xs(n), ys(n), zs(n); \ For(i, n) cin >> xs[i] >> ys[i] >> zs[i] #define Cinss(T, n, m, xs) \ Vec2(T, n, m, xs); \ For(i, n) For(j, m) cin >> xs[i][j] #define Cinm(T, n, map) \ unordered_map<T, int> map; \ Rep(n) { \ Cin(T, x); \ map[x]++; \ } #define Cout(...) _cout(__VA_ARGS__) #define Couts(xs) \ { \ for (const auto &e : xs) \ cout << e << " "; \ cout << "\n"; \ } #define Coutyn(cond) Cout((cond) ? "yes" : "no") #define CoutYn(cond) Cout((cond) ? "Yes" : "No") #define CoutYN(cond) Cout((cond) ? "YES" : "NO") #define vc vector #define Mini(a, x) a = min(a, x) #define Maxi(a, x) a = max(a, x) // constexpr int MOD = 1e9+7; int main(void) { Cin(int, n, h, w); int ans = 0; Rep(n) { Cin(int, a, b); if (a >= h && b >= w) ans++; } Cout(ans); }
[ "misc.opposites", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
989,437
989,438
u375405838
cpp
p03193
#include <bits/stdc++.h> using namespace std; int main() { int n, H, W, count = 0; cin >> n >> H >> W; for (int i = 0; i < n; i++) { int h, w; cin >> h >> w; if (h <= H && w <= W) count++; } cout << count << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int n, H, W, count = 0; cin >> n >> H >> W; for (int i = 0; i < n; i++) { int h, w; cin >> h >> w; if (h >= H && w >= W) count++; } cout << count << endl; }
[ "misc.opposites", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
989,439
989,440
u351265848
cpp
p03193
#include <cstdio> #include <ctype.h> #include <iostream> #include <string> using namespace std; int main() { int N, count = 0; int H, W; cin >> N >> H >> W; long int A[H], B[W]; for (int i = 0; i < N; i++) { cin >> A[i] >> B[i]; if (A[i] >= H && B[i] >= W) { count++; } } cout << count << endl; return 0; }
#include <cstdio> #include <ctype.h> #include <iostream> #include <string> using namespace std; int main() { int N, count = 0; int H, W; cin >> N >> H >> W; long int A[N], B[N]; for (int i = 0; i < N; i++) { cin >> A[i] >> B[i]; if (A[i] >= H && B[i] >= W) { count++; } } cout << count << endl; return 0; }
[ "identifier.change", "variable_declaration.array_dimensions.change" ]
989,447
989,448
u426572476
cpp
p03193
#include <bits/stdc++.h> using namespace std; int main() { long long N, H, W; cin >> N >> H >> W; vector<vector<long long>> vec(H, vector<long long>(W)); for (int i = 0; i < N; i++) { for (int j = 0; j < 2; j++) { cin >> vec.at(i).at(j); } } int ans = 0; for (int k = 0; k < N; k++) { if ((vec.at(k).at(0) >= H) && (vec.at(k).at(1) >= W)) { ans++; } } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; int main() { long long N, H, W; cin >> N >> H >> W; vector<vector<long long>> vec(N, vector<long long>(2)); for (int i = 0; i < N; i++) { for (int j = 0; j < 2; j++) { cin >> vec.at(i).at(j); } } int ans = 0; for (int k = 0; k < N; k++) { if ((vec.at(k).at(0) >= H) && (vec.at(k).at(1) >= W)) { ans++; } } cout << ans << endl; }
[]
989,449
989,450
u835534008
cpp
p03193
#include <iostream> using namespace std; int n, h, w, a, b, c, i; int main() { for (cin >> n >> h >> w; i < n; i++) cin >> a >> b, c += a <= h && b <= w; cout << c << endl; }
#include <iostream> using namespace std; int n, h, w, a, b, c, i; int main() { for (cin >> n >> h >> w; i < n; i++) cin >> a >> b, c += !(a < h || b < w); cout << c << endl; }
[ "expression.operator.compare.change", "assignment.value.change", "expression.operation.binary.change", "misc.opposites" ]
989,451
989,452
u601082779
cpp
p03193
#include <iostream> using namespace std; int main() { int N, H, W; cin >> N >> H >> W; int count = 0; for (int i = 0; i < N; i++) { int A, B; cin >> A >> B; if (A <= H && B <= W) { count++; } } cout << count << endl; }
#include <iostream> using namespace std; int main() { int N, H, W; cin >> N >> H >> W; int count = 0; for (int i = 0; i < N; i++) { int A, B; cin >> A >> B; if (A >= H && B >= W) { count++; } } cout << count << endl; }
[ "misc.opposites", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
989,455
989,456
u322714721
cpp
p03193
#include <algorithm> #include <bitset> #include <cassert> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <vector> using namespace std; typedef long long ll; void solve() { int n, h, w; cin >> n >> h >> w; int ret = 0; while (n--) { int a, b; cin >> a >> b; ret += h >= a && w >= b; } cout << ret << endl; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); solve(); /* int t; cin >> t; for(int i = 1; i <= t; i++) { cout << "Case #" << i << ": "; solve(); } */ }
#include <algorithm> #include <bitset> #include <cassert> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <vector> using namespace std; typedef long long ll; void solve() { int n, h, w; cin >> n >> h >> w; int ret = 0; while (n--) { int a, b; cin >> a >> b; ret += h <= a && w <= b; } cout << ret << endl; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); solve(); /* int t; cin >> t; for(int i = 1; i <= t; i++) { cout << "Case #" << i << ": "; solve(); } */ }
[ "misc.opposites", "expression.operator.compare.change", "assignment.value.change", "expression.operation.binary.change" ]
989,457
989,458
u109256064
cpp
p03193
#define _USE_MATH_DEFINES #include <algorithm> #include <bitset> #include <climits> #include <cmath> #include <cstdio> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include <unordered_map> #include <vector> using namespace std; ///////////////////library zone!!!!!!!!!!!!!!!!!!!!!!!!!!!! typedef long long ll; typedef long double ld; #define all(a) (a).begin(), (a).end() #define EPS (1e-5) #define bit(n, k) ((n >> k) & 1) const ll Mod = 1000000007; const ll mod = 998244353; struct H { ll x, y; bool operator<(const H &b) const { if (x != b.x) return x < b.x; return y < b.y; } bool operator>(const H &b) const { if (x != b.x) return x > b.x; return y > b.y; } bool operator==(const H &b) const { return x == b.x && y == b.y; } bool operator!=(const H &b) const { return (*this) != b; } }; struct P { ll pos, cost; bool operator<(const P &b) const { return cost < b.cost; } bool operator>(const P &b) const { return cost > b.cost; } }; struct B { ll to, cost; }; struct E { ll from, to, cost; bool operator<(const E &b) const { return cost < b.cost; } bool operator>(const E &b) const { return cost > b.cost; } }; template <typename T, typename U> void chmin(T &a, U b) { if (a > b) a = b; } template <typename T, typename U> void chmax(T &a, U b) { if (a < b) a = b; } template <typename T> T max_0(T a) { if (a < 0) return 0; return a; } template <typename T> T min_0(T a) { if (a > 0) return 0; return a; } ll read() { ll u; ll k = scanf("%lld", &u); return u; } ll gcd(ll i, ll j) { if (i > j) swap(i, j); if (i == 0) return j; return gcd(j % i, i); } ll mod_pow(ll x, ll n, ll p) { ll res = 1; while (n > 0) { if (n & 1) res = res * x % p; x = x * x % p; n >>= 1; } return res; } // x^n%p vector<string> split(string s, char c = ' ') { vector<string> vec; string h = ""; for (int i = 0; i < s.size();) { int j = i; while (j < s.size() && s[j] != ' ') { h += s[j++]; } if (h.size() > 0) vec.push_back(h); h = ""; i = j + 1; } return vec; } const ll Inf = 3023372036854775807; const int inf = 1500000000; #define int long long //---------------------------------------------------- signed main() { int n = read(), sum = 0, h = read(), w = read(); for (int i = 0; i < n; i++) { if (read() >= h && read() >= w) { sum++; } } cout << sum << endl; }
#define _USE_MATH_DEFINES #include <algorithm> #include <bitset> #include <climits> #include <cmath> #include <cstdio> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include <unordered_map> #include <vector> using namespace std; ///////////////////library zone!!!!!!!!!!!!!!!!!!!!!!!!!!!! typedef long long ll; typedef long double ld; #define all(a) (a).begin(), (a).end() #define EPS (1e-5) #define bit(n, k) ((n >> k) & 1) const ll Mod = 1000000007; const ll mod = 998244353; struct H { ll x, y; bool operator<(const H &b) const { if (x != b.x) return x < b.x; return y < b.y; } bool operator>(const H &b) const { if (x != b.x) return x > b.x; return y > b.y; } bool operator==(const H &b) const { return x == b.x && y == b.y; } bool operator!=(const H &b) const { return (*this) != b; } }; struct P { ll pos, cost; bool operator<(const P &b) const { return cost < b.cost; } bool operator>(const P &b) const { return cost > b.cost; } }; struct B { ll to, cost; }; struct E { ll from, to, cost; bool operator<(const E &b) const { return cost < b.cost; } bool operator>(const E &b) const { return cost > b.cost; } }; template <typename T, typename U> void chmin(T &a, U b) { if (a > b) a = b; } template <typename T, typename U> void chmax(T &a, U b) { if (a < b) a = b; } template <typename T> T max_0(T a) { if (a < 0) return 0; return a; } template <typename T> T min_0(T a) { if (a > 0) return 0; return a; } ll read() { ll u; ll k = scanf("%lld", &u); return u; } ll gcd(ll i, ll j) { if (i > j) swap(i, j); if (i == 0) return j; return gcd(j % i, i); } ll mod_pow(ll x, ll n, ll p) { ll res = 1; while (n > 0) { if (n & 1) res = res * x % p; x = x * x % p; n >>= 1; } return res; } // x^n%p vector<string> split(string s, char c = ' ') { vector<string> vec; string h = ""; for (int i = 0; i < s.size();) { int j = i; while (j < s.size() && s[j] != ' ') { h += s[j++]; } if (h.size() > 0) vec.push_back(h); h = ""; i = j + 1; } return vec; } const ll Inf = 3023372036854775807; const int inf = 1500000000; #define int long long //---------------------------------------------------- signed main() { int n = read(), sum = 0, h = read(), w = read(); for (int i = 0; i < n; i++) { if (read() >= h & read() >= w) { sum++; } } cout << sum << endl; }
[ "control_flow.branch.if.condition.change" ]
989,459
989,460
u811004127
cpp
p03193
#include <iostream> using namespace std; int main() { int N; cin >> N; int H, W; cin >> H >> W; int res = 0; for (int i = 0; i < N; ++i) { int h, w; cin >> h >> w; if (h >= H && w >= H) ++res; } cout << res << endl; }
#include <iostream> using namespace std; int main() { int N; cin >> N; int H, W; cin >> H >> W; int res = 0; for (int i = 0; i < N; ++i) { int h, w; cin >> h >> w; if (h >= H && w >= W) ++res; } cout << res << endl; }
[ "identifier.change", "control_flow.branch.if.condition.change" ]
989,467
989,468
u692336506
cpp
p03193
#include <algorithm> #include <iostream> using namespace std; int main() { int N, H, W, A, B, count = 0; cin >> N >> H >> W; for (int i = 0; i < N; i++) { cin >> A >> B; if (A > H && B > W) count++; } cout << count << endl; }
#include <algorithm> #include <iostream> using namespace std; int main() { int N, H, W, A, B, count = 0; cin >> N >> H >> W; for (int i = 0; i < N; i++) { cin >> A >> B; if (A >= H && B >= W) count++; } cout << count << endl; }
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
989,471
989,472
u454087021
cpp
p03193
#include <bits/stdc++.h> using namespace std; using i64 = int64_t; const i64 MOD = 1e9 + 7; const i64 INF = 1e18 + 7; signed main() { int n, h, w; cin >> n >> h >> w; int c = 0; for (int i = 0; i < n; ++i) { int a, b; cin >> a >> b; if (c >= h && c >= w) ++c; } cout << c << endl; }
#include <bits/stdc++.h> using namespace std; using i64 = int64_t; const i64 MOD = 1e9 + 7; const i64 INF = 1e18 + 7; signed main() { int n, h, w; cin >> n >> h >> w; int c = 0; for (int i = 0; i < n; ++i) { int a, b; cin >> a >> b; if (a >= h && b >= w) ++c; } cout << c << endl; }
[ "identifier.change", "control_flow.branch.if.condition.change" ]
989,473
989,474
u705918648
cpp
p03193
#include <iostream> using namespace std; int main() { int N, H, W; cin >> N >> H >> W; int ans = 0; for (int i = 0; i < N; ++i) { int A, B; cin >> A >> B; if (H >= A && W >= B) ++ans; } cout << ans << endl; return 0; }
#include <iostream> using namespace std; int main() { int N, H, W; cin >> N >> H >> W; int ans = 0; for (int i = 0; i < N; ++i) { int A, B; cin >> A >> B; if (H <= A && W <= B) ++ans; } cout << ans << endl; return 0; }
[ "misc.opposites", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
989,485
989,486
u837745858
cpp
p03193
#define _USE_MATH_DEFINES #define _CRT_SECURE_NO_WARNINGS #include <algorithm> #include <cctype> #include <cstdio> #include <ctype.h> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdio.h> #include <string> #include <vector> //#include<bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int a, b; cin >> a >> b; int t = 0; for (int i = 0; i < n; i++) { int x, y; cin >> x >> y; if (a >= x && b >= y) t++; } cout << t << endl; return 0; }
#define _USE_MATH_DEFINES #define _CRT_SECURE_NO_WARNINGS #include <algorithm> #include <cctype> #include <cstdio> #include <ctype.h> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdio.h> #include <string> #include <vector> //#include<bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int a, b; cin >> a >> b; int t = 0; for (int i = 0; i < n; i++) { int x, y; cin >> x >> y; if (a <= x && b <= y) t++; } cout << t << endl; return 0; }
[ "misc.opposites", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
989,492
989,493
u098844816
cpp
p03193
#include <iostream> using namespace std; int main() { int n, h, w; cin >> n >> h >> w; int cnt = 0; while (n--) { int a, b; cin >> a >> b; if (a <= h && b <= w) ++cnt; } cout << cnt << endl; }
#include <iostream> using namespace std; int main() { int n, h, w; cin >> n >> h >> w; int cnt = 0; while (n--) { int a, b; cin >> a >> b; if (a >= h && b >= w) ++cnt; } cout << cnt << endl; }
[ "misc.opposites", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
989,494
989,495
u993619636
cpp
p03193
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for ((i) = 0; (i) < (n); ++(i)) #define repr(i, n) for ((i) = (n); (i) > 0; == (i)) #define FOR(i, j, n) for ((i) = (j); (i) < (n); ++(i)) #define forr(i, j, n) for ((i) = (j); (i) > (n); --(i)) #define debg(a) cout << (a) << endl; #define INF 9999999 #define int long long #define str string #define elif else if int i, j, k, h, w; int a, b, c, x, y, n, m, cnt = 0, ans = 0; str s, t; signed main() { cin >> n >> h >> w; rep(i, n) { cin >> x >> y; if (x <= h && y <= w) cnt++; } debg(cnt); return 0; }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for ((i) = 0; (i) < (n); ++(i)) #define repr(i, n) for ((i) = (n); (i) > 0; == (i)) #define FOR(i, j, n) for ((i) = (j); (i) < (n); ++(i)) #define forr(i, j, n) for ((i) = (j); (i) > (n); --(i)) #define debg(a) cout << (a) << endl; #define INF 9999999 #define int long long #define str string #define elif else if int i, j, k, h, w; int a, b, c, x, y, n, m, cnt = 0, ans = 0; str s, t; signed main() { cin >> n >> h >> w; rep(i, n) { cin >> x >> y; if (x >= h && y >= w) cnt++; } debg(cnt); return 0; }
[ "misc.opposites", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
989,504
989,505
u423624748
cpp
p03193
#include <bits/stdc++.h> using namespace std; int main() { int n, H, W, h, w, res = 0; cin >> n >> H >> W; for (int i = 0; i < n; ++i) { cin >> h >> w; if (h <= H && w <= W) res++; } cout << res; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n, H, W, h, w, res = 0; cin >> n >> H >> W; for (int i = 0; i < n; ++i) { cin >> h >> w; if (h >= H && w >= W) res++; } cout << res; return 0; }
[ "misc.opposites", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
989,509
989,510
u756659922
cpp
p03193
#include <bits/stdc++.h> using namespace std; int main() { int N, H, W; cin >> N >> H >> W; vector<int> A(N); vector<int> B(N); for (int i = 0; i < N; i++) { cin >> A.at(i) >> B.at(i); } int count = 0; for (int i = 0; i < N; i++) { if ((A.at(i) <= H) && (B.at(i) <= W)) { count++; } } cout << count << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int N, H, W; cin >> N >> H >> W; vector<int> A(N); vector<int> B(N); for (int i = 0; i < N; i++) { cin >> A.at(i) >> B.at(i); } int count = 0; for (int i = 0; i < N; i++) { if ((A.at(i) >= H) && (B.at(i) >= W)) { count++; } } cout << count << endl; }
[ "misc.opposites", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
989,511
989,512
u989696545
cpp
p03193
#include <bits/stdc++.h> using namespace std; int main() { int N, H, W; cin >> N >> H >> W; vector<int> A(N); vector<int> B(N); for (int i = 0; i < N; i++) { cin >> A.at(i) >> B.at(i); } int count = 0; for (int i = 0; i < N; i++) { if ((A.at(i) <= H) || (B.at(i) <= W)) { count++; } } cout << count << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int N, H, W; cin >> N >> H >> W; vector<int> A(N); vector<int> B(N); for (int i = 0; i < N; i++) { cin >> A.at(i) >> B.at(i); } int count = 0; for (int i = 0; i < N; i++) { if ((A.at(i) >= H) && (B.at(i) >= W)) { count++; } } cout << count << endl; }
[ "misc.opposites", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
989,513
989,512
u989696545
cpp
p03193
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <cassert> #include <memory> #include <numeric> #include <map> #include <queue> #include <vector> using namespace std; typedef long long LL; int n, a, b; int main() { cin >> n; int c = 0; while (n) { --n; int x, y; scanf("%d%d", &x, &y); if (x >= a && y >= b) ++c; } cout << c << endl; }
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <cassert> #include <memory> #include <numeric> #include <map> #include <queue> #include <vector> using namespace std; typedef long long LL; int n, a, b; int main() { cin >> n >> a >> b; int c = 0; while (n) { --n; int x, y; scanf("%d%d", &x, &y); if (x >= a && y >= b) ++c; } cout << c << endl; }
[ "expression.operation.binary.add" ]
989,518
989,519
u556644523
cpp
p03193
/////////////////////////////////////////// // alloy.cpp created 2018-12-22 // Kamil Tokarski /* biblioteczka */ #include <algorithm> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <unordered_map> #include <vector> using namespace std; // types typedef long long ll; typedef long double ld; #define PR pair #define PII pair<int, int> #define PLL pair<ll, ll> #define VEC vector #define VL VEC<ll> #define VI VEC<int> #define VPI VEC<PII> #define VPL VEC<PLL> // IO #define fastio \ ios_base::sync_with_stdio(NULL); \ cout.tie(NULL); \ cin.tie(NULL) #define precise(x) cout << fixed << setprecision(x) #define read_file(var, file) ifstream var(file) #define write_file(var, file) ofstream var(file) #define close_file(var) var.close() // containers #define sz(x) (int)(x.size()) #define all(x) x.begin(), x.end() /* koniec */ int N; int H, W; int A, B; int answer; int main(int argc, char **argv) { fastio; cin >> N >> H >> W; for (int i = 0; i < N; ++i) { cin >> A >> B; if (A >= H && B >= B) ++answer; } cout << answer << endl; return 0; }
/////////////////////////////////////////// // alloy.cpp created 2018-12-22 // Kamil Tokarski /* biblioteczka */ #include <algorithm> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <unordered_map> #include <vector> using namespace std; // types typedef long long ll; typedef long double ld; #define PR pair #define PII pair<int, int> #define PLL pair<ll, ll> #define VEC vector #define VL VEC<ll> #define VI VEC<int> #define VPI VEC<PII> #define VPL VEC<PLL> // IO #define fastio \ ios_base::sync_with_stdio(NULL); \ cout.tie(NULL); \ cin.tie(NULL) #define precise(x) cout << fixed << setprecision(x) #define read_file(var, file) ifstream var(file) #define write_file(var, file) ofstream var(file) #define close_file(var) var.close() // containers #define sz(x) (int)(x.size()) #define all(x) x.begin(), x.end() /* koniec */ int N; int H, W; int A, B; int answer; int main(int argc, char **argv) { fastio; cin >> N >> H >> W; for (int i = 0; i < N; ++i) { cin >> A >> B; if (A >= H && B >= W) ++answer; } cout << answer << endl; return 0; }
[ "identifier.change", "control_flow.branch.if.condition.change" ]
989,526
989,527
u734207761
cpp
p03193
#include <iostream> using namespace std; int main() { int n; long long h, w; cin >> n >> h >> w; int ans = 0; for (int i = 0; i < n; i++) { long long a, b; cin >> a >> b; if (a > h && b > w) { ans++; } } cout << ans << endl; return 0; }
#include <iostream> using namespace std; int main() { int n; long long h, w; cin >> n >> h >> w; int ans = 0; for (int i = 0; i < n; i++) { long long a, b; cin >> a >> b; if (a >= h && b >= w) { ans++; } } cout << ans << endl; return 0; }
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
989,528
989,529
u467763786
cpp
p03193
#include <iostream> using namespace std; int N, H, W, A, B, ans = 0; int main() { cin >> N >> H >> W; for (int i = 0; i < N; i++) { cin >> A >> B; ans += ((A <= H && B <= W)); } cout << ans << endl; }
#include <iostream> using namespace std; int N, H, W, A, B, ans = 0; int main() { cin >> N >> H >> W; for (int i = 0; i < N; i++) { cin >> A >> B; ans += ((A >= H && B >= W)); } cout << ans << endl; }
[ "misc.opposites", "expression.operator.compare.change", "assignment.value.change", "expression.operation.binary.change" ]
989,532
989,533
u623954643
cpp
p03193
// AtCoderAlloy.cpp : This file contains the 'main' function. Program execution // begins and ends there. // #include <iostream> using namespace std; int n, h, w, a, b; int c = 0; int main() { cin >> n >> h >> w; for (int i = 0; i < n; i++) { cin >> a >> b; if (a <= h && b <= w) { c++; } } cout << c << endl; return 0; } // Run program: Ctrl + F5 or Debug > Start Without Debugging menu // Debug program: F5 or Debug > Start Debugging menu // Tips for Getting Started: // 1. Use the Solution Explorer window to add/manage files // 2. Use the Team Explorer window to connect to source control // 3. Use the Output window to see build output and other messages // 4. Use the Error List window to view errors // 5. Go to Project > Add New Item to create new code files, or Project > Add // Existing Item to add existing code files to the project // 6. In the future, to open this project again, go to File > Open > Project // and select the .sln file
// AtCoderAlloy.cpp : This file contains the 'main' function. Program execution // begins and ends there. // #include <iostream> using namespace std; int n, h, w, a, b; int c = 0; int main() { cin >> n >> h >> w; for (int i = 0; i < n; i++) { cin >> a >> b; if (a >= h && b >= w) { c++; } } cout << c << endl; return 0; } // Run program: Ctrl + F5 or Debug > Start Without Debugging menu // Debug program: F5 or Debug > Start Debugging menu // Tips for Getting Started: // 1. Use the Solution Explorer window to add/manage files // 2. Use the Team Explorer window to connect to source control // 3. Use the Output window to see build output and other messages // 4. Use the Error List window to view errors // 5. Go to Project > Add New Item to create new code files, or Project > Add // Existing Item to add existing code files to the project // 6. In the future, to open this project again, go to File > Open > Project // and select the .sln file
[ "misc.opposites", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
989,534
989,535
u999447364
cpp
p03193
#include <iostream> using namespace std; int main() { int N, H, W; cin >> N >> H >> W; int A; int B; int num = 0; for (int i = 0; i < N; i++) { cin >> A >> B; if (H < A && W < B) { num++; } } cout << num; return 0; }
#include <iostream> using namespace std; int main() { int N, H, W; cin >> N >> H >> W; int A; int B; int num = 0; for (int i = 0; i < N; i++) { cin >> A >> B; if (H <= A && W <= B) { num++; } } cout << num; return 0; }
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
989,536
989,537
u817999507
cpp
p03193
#include <stdio.h> int main() { long int x[1000][2]; long int n, h, w; int count = 0; scanf("%ld %ld %ld", &n, &h, &w); for (int i = 0; i < n; i++) { scanf("%ld %ld", &x[i][0], &x[i][1]); } for (int i = 0; i < n; i++) { if (x[i][0] > h && x[i][1] > w) count++; } printf("%d", count); }
#include <stdio.h> int main() { long int x[1000][2]; long int n, h, w; int count = 0; scanf("%ld %ld %ld", &n, &h, &w); for (int i = 0; i < n; i++) { scanf("%ld %ld", &x[i][0], &x[i][1]); } for (int i = 0; i < n; i++) { if (x[i][0] >= h && x[i][1] >= w) count++; } printf("%d", count); }
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
989,540
989,541
u252238171
cpp
p03193
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <queue> #include <string> #include <vector> int main(void) { int n, h, w; std::cin >> n >> h >> w; int count = 0; for (size_t i = 0; i < n; i++) { int a, b; std::cin >> a >> b; if (a <= h && b <= w) { count++; } } std::cout << count << std::endl; return 0; }
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <queue> #include <string> #include <vector> int main(void) { int n, h, w; std::cin >> n >> h >> w; int count = 0; for (size_t i = 0; i < n; i++) { int a, b; std::cin >> a >> b; if (a >= h && b >= w) { count++; } } std::cout << count << std::endl; return 0; }
[ "misc.opposites", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
989,542
989,543
u914739916
cpp
p03193
#include <stdio.h> int main(void) { int i, n, h, w, ans = 0, a, b; scanf("%d%d%d", &n, &h, &w); for (i = 0; i < n; ++i) { scanf("%d%d", &a, &b); if (a >= w && b >= h) ++ans; } printf("%d", ans); return 0; }
#include <stdio.h> int main(void) { int i, n, h, w, ans = 0, a, b; scanf("%d%d%d", &n, &h, &w); for (i = 0; i < n; ++i) { scanf("%d%d", &a, &b); if (a >= h && b >= w) ++ans; } printf("%d", ans); return 0; }
[ "identifier.change", "control_flow.branch.if.condition.change" ]
989,546
989,547
u440920318
cpp
p03193
#include <stdio.h> int main(void) { int i, n, h, w, ans = 0, a, b; scanf("%d%d%d", &n, &h, &w); for (i = 0; i < n; ++i) { scanf("%d%d", &a, &b); if (a >= w && b >= h) ++ans; } printf("%lld", ans); return 0; }
#include <stdio.h> int main(void) { int i, n, h, w, ans = 0, a, b; scanf("%d%d%d", &n, &h, &w); for (i = 0; i < n; ++i) { scanf("%d%d", &a, &b); if (a >= h && b >= w) ++ans; } printf("%d", ans); return 0; }
[ "identifier.change", "control_flow.branch.if.condition.change", "literal.string.change", "call.arguments.change", "io.output.change" ]
989,548
989,547
u440920318
cpp
p03193
#include <iostream> using namespace std; main() { int N, H, W; cin >> N >> H >> W; int A[N]; int B[N]; for (int ii = 0; ii < N; ii++) { cin >> A[ii]; cin >> B[ii]; } int ans = 0; for (int ii = 0; ii < N; ii++) { if (A[ii] <= H && B[ii] <= W) ans++; } cout << ans << endl; }
#include <iostream> using namespace std; main() { int N, H, W; cin >> N >> H >> W; int A[N]; int B[N]; for (int ii = 0; ii < N; ii++) { cin >> A[ii]; cin >> B[ii]; } int ans = 0; for (int ii = 0; ii < N; ii++) { if (A[ii] >= H && B[ii] >= W) ans++; } cout << ans << endl; }
[ "misc.opposites", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
989,549
989,550
u346834985
cpp
p03193
#include <iostream> #include <vector> using namespace std; #define ll long long int main() { ll n, h, w, ans = 0; cin >> n >> h >> w; vector<ll> a(n), b(n); for (int i = 0; i < n; i++) { cin >> a[i] >> b[i]; if (h >= a[i] && w >= b[i]) ans++; } cout << ans << endl; }
#include <iostream> #include <vector> using namespace std; #define ll long long int main() { ll n, h, w, ans = 0; cin >> n >> h >> w; vector<ll> a(n), b(n); for (int i = 0; i < n; i++) { cin >> a[i] >> b[i]; if (h <= a[i] && w <= b[i]) ans++; } cout << ans << endl; }
[ "misc.opposites", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
989,555
989,556
u468811760
cpp
p03193
#include <cstdio> int main(void) { int n, h, w, a, b, c = 0; scanf("%d%d%d", &n, &h, &w); while (n--) { scanf("%d%d", &a, &b); if ((a > h) && (b > w)) { ++c; } } printf("%d\n", c); return (0); }
#include <cstdio> int main(void) { int n, h, w, a, b, c = 0; scanf("%d%d%d", &n, &h, &w); while (n--) { scanf("%d%d", &a, &b); if ((a >= h) && (b >= w)) { ++c; } } printf("%d\n", c); return (0); }
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
989,557
989,558
u530396049
cpp
p03193
#include <cstdio> int main(void) { int n, h, w, a, b, c = 0; scanf("%d%d%d", &n, &h, &w); while (n--) { scanf("%d%d", &a, &b); if ((a < h) && (b < w)) { ++c; } } printf("%d\n", c); return (0); }
#include <cstdio> int main(void) { int n, h, w, a, b, c = 0; scanf("%d%d%d", &n, &h, &w); while (n--) { scanf("%d%d", &a, &b); if ((a >= h) && (b >= w)) { ++c; } } printf("%d\n", c); return (0); }
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
989,559
989,558
u530396049
cpp
p03193
#include <stdio.h> #include <stdlib.h> int main() { int n, height, width; int ret; ret = scanf("%d%d%d", &n, &height, &width); if (ret == EOF) return -1; int A, B; int count = 0; for (int i = 0; i < n; i++) { ret = scanf("%d%d", &A, &B); if (ret == EOF) return -1; if (A <= height && B <= width) { count++; } } printf("%d\n", count); return 0; }
#include <stdio.h> #include <stdlib.h> int main() { int n, height, width; int ret; ret = scanf("%d%d%d", &n, &height, &width); if (ret == EOF) return -1; int A, B; int count = 0; for (int i = 0; i < n; i++) { ret = scanf("%d%d", &A, &B); if (ret == EOF) return -1; if (A >= height && B >= width) { count++; } } printf("%d\n", count); return 0; }
[ "misc.opposites", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
989,560
989,561
u991974907
cpp
p03193
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, t, t1; int sum = 0, n, i; scanf("%d %lld %lld", &n, &a, &b); for (i = 0; i < n; i++) { scanf("%lld %lld", &t, &t1); if (t <= a && t1 <= b) sum++; } printf("%d", sum); return 0; }
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, t, t1; int sum = 0, n, i; scanf("%d %lld %lld", &n, &a, &b); for (i = 0; i < n; i++) { scanf("%lld %lld", &t, &t1); if (t >= a && t1 >= b) sum++; } printf("%d", sum); return 0; }
[ "misc.opposites", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
989,562
989,563
u356929542
cpp
p03193
#include <iostream> #include <string.h> using namespace std; int main() { int count = 0; int n, h, w, N; int a, b; cin >> n >> h >> w; for (int i = 0; i < n; i++) { cin >> a >> b; if (h <= a && w <= w) { count++; } } cout << count << endl; }
#include <iostream> #include <string.h> using namespace std; int main() { int count = 0; int n, h, w, N; int a, b; cin >> n >> h >> w; for (int i = 0; i < n; i++) { cin >> a >> b; if (h <= a && w <= b) { count++; } } cout << count << endl; }
[ "identifier.change", "control_flow.branch.if.condition.change" ]
989,572
989,573
u000217193
cpp
p03193
#include <iostream> using namespace std; int main() { int h, w, N; cin >> N >> h >> w; int count = 0; for (int i = 0; i < N; i++) { int a, b; cin >> a >> b; if (a > h && b > w) { count += 1; } } cout << count << endl; return 0; }
#include <iostream> using namespace std; int main() { int h, w, N; cin >> N >> h >> w; int count = 0; for (int i = 0; i < N; i++) { int a, b; cin >> a >> b; if (a >= h && b >= w) { count += 1; } } cout << count << endl; return 0; }
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
989,574
989,575
u406145181
cpp
p03193
#include <iostream> #include <string> using namespace std; int N, H, W; int A[1010]; int B[1010]; int main() { cin >> N >> H >> W; for (int i = 0; i < N; i++) cin >> A[i] >> B[i]; int count = 0; for (int i = 0; i < N; i++) { if (A[i] <= H && B[i] <= W) { count++; } } cout << count << endl; }
#include <iostream> #include <string> using namespace std; int N, H, W; int A[1010]; int B[1010]; int main() { cin >> N >> H >> W; for (int i = 0; i < N; i++) cin >> A[i] >> B[i]; int count = 0; for (int i = 0; i < N; i++) { if ((A[i] >= H) && (B[i] >= W)) { count++; } } cout << count << endl; }
[ "control_flow.branch.if.condition.change", "misc.opposites", "expression.operator.compare.change" ]
989,581
989,582
u494871759
cpp
p03183
#include <bits/stdc++.h> #define ll long long #define all(a) (a).begin(), (a).end() #pragma GCC optimize("O3") #pragma GCC optimize("Ofast") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #define sz() size() #define fr first #define sc second #define pb push_back #define er erase #define in insert #define pi pair<int, int> #define pii pair<pair<int, int>, int> #define mp make_pair #define int long long #define rc(s) return cout << s, 0 #define rcc(s) cout << s, exit(0) using namespace std; const int mod = 1e9 + 7; const int modx = 998244353; const int per = 666013; int n, dp[1005][200100]; struct block { int x, y, z; bool operator<(block &blok) { return x + y < blok.x + blok.y; } } bloc[1005]; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); cerr.tie(0); cout.tie(0); srand(chrono::steady_clock::now().time_since_epoch().count()); cin >> n; for (int i = 1; i <= n; i++) { cin >> bloc[i].x >> bloc[i].y >> bloc[i].z; } sort(bloc + 1, bloc + n + 1); for (int i = 1; i <= n; i++) { for (int w = 0; w <= 20005; w++) { dp[i][w] = dp[i - 1][w]; if (w - bloc[i].x >= 0 && w - bloc[i].x <= bloc[i].y) dp[i][w] = max(dp[i][w], dp[i - 1][w - bloc[i].x] + bloc[i].z); } } int res = 0LL; for (int i = 0LL; i <= 20005LL; i++) res = max(res, dp[n][i]); cout << res; }
#include <bits/stdc++.h> #define ll long long #define all(a) (a).begin(), (a).end() #pragma GCC optimize("O3") #pragma GCC optimize("Ofast") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #define sz() size() #define fr first #define sc second #define pb push_back #define er erase #define in insert #define pi pair<int, int> #define pii pair<pair<int, int>, int> #define mp make_pair #define int long long #define rc(s) return cout << s, 0 #define rcc(s) cout << s, exit(0) using namespace std; const int mod = 1e9 + 7; const int modx = 998244353; const int per = 666013; int n, dp[1005][20100]; struct block { int x, y, z; bool operator<(block &blok) { return x + y < blok.x + blok.y; } } bloc[1005]; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); cerr.tie(0); cout.tie(0); srand(chrono::steady_clock::now().time_since_epoch().count()); cin >> n; for (int i = 1; i <= n; i++) { cin >> bloc[i].x >> bloc[i].y >> bloc[i].z; } sort(bloc + 1, bloc + n + 1); for (int i = 1; i <= n; i++) { for (int w = 0; w <= 20005; w++) { dp[i][w] = dp[i - 1][w]; if (w - bloc[i].x >= 0 && w - bloc[i].x <= bloc[i].y) dp[i][w] = max(dp[i][w], dp[i - 1][w - bloc[i].x] + bloc[i].z); } } int res = 0LL; for (int i = 0LL; i <= 20005LL; i++) res = max(res, dp[n][i]); cout << res; }
[ "literal.number.change", "variable_declaration.array_dimensions.change" ]
989,585
989,586
u022510862
cpp
p03183
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<ll, ll> pii; typedef pair<pii, ll> piii; typedef pair<ll, pii> ipii; #define MOD 1000000007 #define mod(a) ((a) % MOD) #define pb push_back #define ft first #define sd second #define mp make_pair #define dbg(x) cerr << #x << " = " << x << "\n" #define dbg2(x, y) cerr << #x << " = " << x << " , " << #y << " = " << y << "\n" #define dbg3(x, y, z) \ cerr << #x << " = " << x << " , " << #y << " = " << y << " , " << #z \ << " = " << z << "\n" #define INF (1LL << 60) /*#include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;*/ #define sync \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0) #define all(v) v.begin(), v.end() #define endl '\n' ll gcd(ll a, ll b) { if (a == 0) return b; return gcd(b % a, a); } ll powm(ll base, ll exp, ll mod = MOD) { base %= mod; ll ans = 1; while (exp) { if (exp & 1LL) ans = (ans * base) % mod; exp >>= 1LL, base = (base * base) % mod; } return ans; } vector<ipii> p; ll dp[10003][20004]; bool comp(ipii a, ipii b) { return (a.ft + a.sd.ft) < (b.ft + b.sd.ft); } int main() { sync; ll n; cin >> n; for (int i = 0; i < n; i++) { ll w, s, v; cin >> w >> s >> v; p.pb({s, {w, v}}); } sort(all(p), comp); ll ans = 0; for (int i = 0; i <= 20004; i++) { dp[0][i] = (p[0].sd.ft <= i ? p[0].sd.sd : 0); } for (int i = 1; i < n; i++) { for (int j = 0; j <= 20000; j++) { if (j == 0) { dp[i][j] = 0; continue; } dp[i][j] = dp[i - 1][j]; if (p[i].sd.ft <= j) { dp[i][j] = max(dp[i][j], dp[i - 1][min(j - p[i].sd.ft, p[i].ft)] + p[i].sd.sd); } } } for (int i = 0; i <= 10000; i++) ans = max(ans, dp[n - 1][i]); cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<ll, ll> pii; typedef pair<pii, ll> piii; typedef pair<ll, pii> ipii; #define MOD 1000000007 #define mod(a) ((a) % MOD) #define pb push_back #define ft first #define sd second #define mp make_pair #define dbg(x) cerr << #x << " = " << x << "\n" #define dbg2(x, y) cerr << #x << " = " << x << " , " << #y << " = " << y << "\n" #define dbg3(x, y, z) \ cerr << #x << " = " << x << " , " << #y << " = " << y << " , " << #z \ << " = " << z << "\n" #define INF (1LL << 60) /*#include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;*/ #define sync \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0) #define all(v) v.begin(), v.end() #define endl '\n' ll gcd(ll a, ll b) { if (a == 0) return b; return gcd(b % a, a); } ll powm(ll base, ll exp, ll mod = MOD) { base %= mod; ll ans = 1; while (exp) { if (exp & 1LL) ans = (ans * base) % mod; exp >>= 1LL, base = (base * base) % mod; } return ans; } vector<ipii> p; ll dp[1003][20004]; bool comp(ipii a, ipii b) { return (a.ft + a.sd.ft) < (b.ft + b.sd.ft); } int main() { sync; ll n; cin >> n; for (int i = 0; i < n; i++) { ll w, s, v; cin >> w >> s >> v; p.pb({s, {w, v}}); } sort(all(p), comp); ll ans = 0; for (int i = 0; i <= 20004; i++) { dp[0][i] = (p[0].sd.ft <= i ? p[0].sd.sd : 0); } for (int i = 1; i < n; i++) { for (int j = 0; j <= 20000; j++) { if (j == 0) { dp[i][j] = 0; continue; } dp[i][j] = dp[i - 1][j]; if (p[i].sd.ft <= j) { dp[i][j] = max(dp[i][j], dp[i - 1][min(j - p[i].sd.ft, p[i].ft)] + p[i].sd.sd); } } } for (int i = 0; i <= 20000; i++) ans = max(ans, dp[n - 1][i]); cout << ans << endl; }
[ "literal.number.change", "variable_declaration.array_dimensions.change", "control_flow.loop.for.condition.change", "expression.operation.binary.change" ]
989,589
989,588
u906162718
cpp
p03183
#define _USE_MATH_DEFINES #include <bits/stdc++.h> using namespace std; // template #define rep(i, a, b) for (int i = (a); i < (b); i++) #define rrep(i, a, b) for (int i = (a); i > (b); i--) #define ALL(v) (v).begin(), (v).end() typedef long long int ll; const int inf = 0x3fffffff; const ll INF = 0x3fffffffffffffff; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } // template end ll dp[10010] = {}; int main() { int n; scanf("%d", &n); vector<int> w(n), s(n), v(n), ord(n); rep(i, 0, n) scanf("%d%d%d", &w[i], &s[i], &v[i]); iota(ALL(ord), 0); sort(ALL(ord), [&](int i, int j) { return s[i] + w[i] < s[j] + w[j]; }); for (int i : ord) rrep(j, s[i], -1) { chmax(dp[j + w[i]], dp[j] + v[i]); } ll ans = 0; rep(i, 0, 10010) chmax(ans, dp[i]); printf("%lld\n", ans); return 0; }
#define _USE_MATH_DEFINES #include <bits/stdc++.h> using namespace std; // template #define rep(i, a, b) for (int i = (a); i < (b); i++) #define rrep(i, a, b) for (int i = (a); i > (b); i--) #define ALL(v) (v).begin(), (v).end() typedef long long int ll; const int inf = 0x3fffffff; const ll INF = 0x3fffffffffffffff; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } // template end ll dp[20010] = {}; int main() { int n; scanf("%d", &n); vector<int> w(n), s(n), v(n), ord(n); rep(i, 0, n) scanf("%d%d%d", &w[i], &s[i], &v[i]); iota(ALL(ord), 0); sort(ALL(ord), [&](int i, int j) { return s[i] + w[i] < s[j] + w[j]; }); for (int i : ord) rrep(j, s[i], -1) { chmax(dp[j + w[i]], dp[j] + v[i]); } ll ans = 0; rep(i, 0, 20010) chmax(ans, dp[i]); printf("%lld\n", ans); return 0; }
[ "literal.number.change", "variable_declaration.array_dimensions.change", "call.arguments.change" ]
989,610
989,611
u407614884
cpp
p03183
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define sz(x) int(x.size()) typedef long long ll; typedef pair<int, int> P; ll dp[10100]; int main() { int n; cin >> n; vector<pair<P, int>> t(n); rep(i, n) { int w, s, v; cin >> w >> s >> v; t[i] = {{w, s}, v}; } sort(t.begin(), t.end(), [&](auto a, auto b) { return a.first.first + a.first.second < b.first.first + b.first.second; }); for (int i = 0; i < n; i++) { for (int j = t[i].first.second; j >= 0; j--) { dp[j + t[i].first.first] = max(dp[j + t[i].first.first], dp[j] + t[i].second); } } ll res = 0; for (int i = 0; i <= 10000; i++) { res = max(res, dp[i]); } cout << res << endl; return 0; }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define sz(x) int(x.size()) typedef long long ll; typedef pair<int, int> P; ll dp[20100]; int main() { int n; cin >> n; vector<pair<P, int>> t(n); rep(i, n) { int w, s, v; cin >> w >> s >> v; t[i] = {{w, s}, v}; } sort(t.begin(), t.end(), [&](auto a, auto b) { return a.first.first + a.first.second < b.first.first + b.first.second; }); for (int i = 0; i < n; i++) { for (int j = t[i].first.second; j >= 0; j--) { dp[j + t[i].first.first] = max(dp[j + t[i].first.first], dp[j] + t[i].second); } } ll res = 0; for (int i = 0; i <= 20000; i++) { res = max(res, dp[i]); } cout << res << endl; return 0; }
[ "literal.number.change", "variable_declaration.array_dimensions.change", "control_flow.loop.for.condition.change", "expression.operation.binary.change" ]
989,612
989,613
u108540384
cpp
p03183
#include <algorithm> #include <bitset> #include <cassert> #include <chrono> #include <cmath> #include <complex> #include <cstdint> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <list> #include <map> #include <queue> #include <random> #include <regex> #include <set> #include <sstream> #include <stack> #include <string> #include <sys/timeb.h> #include <vector> using namespace std; #define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++) #define rep(i, n) repr(i, 0, n) #define reprrev(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--) #define reprev(i, n) reprrev(i, 0, n) #define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++) #define chmin(mi, value) mi = min(mi, value) #define chmax(ma, value) ma = max(ma, value) #define all(a) (a).begin(), (a).end() #define rall(a) (a).rbegin(), (a).rend() #define mp make_pair #define mt make_tuple #define INF 1050000000 #define INFR INT_MAX #define INFL (long long)(4e18) #define INFLR LLONG_MAX #define EPS (1e-10) #define MOD 1000000007 //#define MOD 998244353 #define PI 3.141592653589793238 #define RMAX 4294967295 using vi = vector<int>; using vvi = vector<vector<int>>; using vvvi = vector<vector<vector<int>>>; using vvvvi = vector<vector<vector<vector<int>>>>; using ll = long long; using vll = vector<ll>; using vvll = vector<vector<ll>>; using vvvll = vector<vector<vector<ll>>>; using vd = vector<double>; using vvd = vector<vector<double>>; using vvvd = vector<vector<vector<double>>>; using vb = vector<bool>; using vvb = vector<vector<bool>>; using vc = vector<char>; using vvc = vector<vector<char>>; using vs = vector<string>; using vvs = vector<vector<string>>; using Pi = pair<int, int>; using vPi = vector<Pi>; using vvPi = vector<vector<Pi>>; using vvvPi = vector<vector<vector<Pi>>>; using vvvvPi = vector<vector<vector<vector<Pi>>>>; using Pll = pair<ll, ll>; using vPll = vector<Pll>; using Pd = pair<double, double>; using vPd = vector<Pd>; template <class T> using vec = vector<T>; template <class T> using pql = priority_queue<T, vector<T>, greater<T>>; using Comp = complex<double>; // vvvvvvvvvvvvvvvvvvvvvvv debug output vvvvvvvvvvvvvvvvvvvvvvv // vector input template <typename T> istream &operator>>(istream &is, vector<T> &vec) { for (T &x : vec) is >> x; return is; } // pair template <typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &pair_var) { os << "(" << pair_var.first << ", " << pair_var.second << ")"; return os; } // vector template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec) { os << "{"; for (int i = 0; i < vec.size(); i++) { os << vec[i] << (i + 1 == vec.size() ? "" : ", "); } os << "}"; return os; } // deque template <typename T> ostream &operator<<(ostream &os, const deque<T> &vec) { os << "{"; for (int i = 0; i < vec.size(); i++) { os << vec[i] << (i + 1 == vec.size() ? "" : ", "); } os << "}"; return os; } // map template <typename T, typename U> ostream &operator<<(ostream &os, const map<T, U> &map_var) { os << "{"; repi(itr, map_var) { os << *itr; itr++; if (itr != map_var.end()) os << ", "; itr--; } os << "}"; return os; } // set template <typename T> ostream &operator<<(ostream &os, const set<T> &set_var) { os << "{"; repi(itr, set_var) { os << *itr; itr++; if (itr != set_var.end()) os << ", "; itr--; } os << "}"; return os; } // multiset template <typename T> ostream &operator<<(ostream &os, const multiset<T> &set_var) { os << "{"; repi(itr, set_var) { os << *itr; itr++; if (itr != set_var.end()) os << ", "; itr--; } os << "}"; return os; } #define DUMPOUT cerr void dump_func() { DUMPOUT << endl; } template <class Head, class... Tail> void dump_func(Head &&head, Tail &&...tail) { DUMPOUT << head; if (sizeof...(Tail) > 0) { DUMPOUT << ", "; } dump_func(std::move(tail)...); } #ifdef DEBUG_ #define DEB #define dump(...) \ DUMPOUT << " " << string(#__VA_ARGS__) << ": " \ << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]" << endl \ << " ", \ dump_func(__VA_ARGS__) #else #define DEB if (false) #define dump(...) #endif // ^^^^^^^^^^^^^^^^^^^^^^^ debug output ^^^^^^^^^^^^^^^^^^^^^^^ string YN(bool y, int id = 0) { if (id) cout << id; return (y ? "YES" : "NO"); } string yn(bool y, int id = 0) { if (id) cout << id; return (y ? "Yes" : "No"); } string ON(bool y, int id = 0) { if (id) cout << id; return (y ? "OK" : "NG"); } int dir4[4][2] = {{0, -1}, {-1, 0}, {1, 0}, {0, 1}}; int dir8[8][2] = {{-1, -1}, {0, -1}, {1, -1}, {-1, 0}, {1, 0}, {-1, 1}, {0, 1}, {1, 1}}; // [a,b) int irand(int a, int b) { static mt19937 Rand(static_cast<unsigned int>(time(nullptr))); uniform_int_distribution<int> dist(a, b - 1); return dist(Rand); } // [a,b) double drand(int a, int b) { static mt19937 Rand(static_cast<unsigned int>(time(nullptr))); uniform_real_distribution<double> dist(a, b); return dist(Rand); } // https://qiita.com/IgnorantCoder/items/3101d6276e9bdddf872c template <typename A, typename F> inline auto transform(const A &v, F &&f) { using result_type = decltype(std::declval<F>()(std::declval<typename A::value_type>())); vector<result_type> y(v.size()); std::transform(std::cbegin(v), std::cend(v), std::begin(y), f); return y; } // generate vector which has multiple dimension 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 <typename T> T Max(vector<T> a) { return *max_element(all(a)); } template <typename T> T Min(vector<T> a) { return *min_element(all(a)); } template <typename T> T Sum(vector<T> a) { return accumulate(all(a), (T)0); } // for counting using map template <typename T> void Add(map<T, int> &m, T item) { if (m.find(item) == m.end()) { m[item] = 1; } else { m[item]++; } } // for counting using map template <typename T> void Erase(map<T, int> &m, T item) { if (m.find(item) == m.end()) { } else { if (m[item] == 1) { m.erase(item); } else { m[item]--; } } } // get method for map with default value template <typename T, typename U> U Get(map<T, U> m, T key, U def) { if (m.find(key) == m.end()) { return def; } else { return m[key]; } } template <typename T> inline bool Contains(const set<T> &t, const T &key) { return t.find(key) != t.end(); } template <typename T, typename U> inline bool Contains(const map<T, U> &t, const T &key) { return t.find(key) != t.end(); } template <class T> struct Edge { int from, to; T cost; Edge(int f, int t, T c) : from(f), to(t), cost(c) {} }; template <class T> bool operator<(const Edge<T> e1, const Edge<T> e2) { return e1.cost < e2.cost || (e1.cost == e2.cost && e1.from < e2.from) || (e1.cost == e2.cost && e1.from == e2.from && e1.to < e2.to); } template <class T> ostream &operator<<(ostream &os, const Edge<T> &edge) { os << "(" << edge.from << "->" << edge.to << ":" << edge.cost << ")"; return os; } template <class T = int> class Graph { int n; bool directed; vector<vector<Edge<T>>> edges; public: Graph(int n, bool directed) : n(n), directed(directed), edges(vector<vector<Edge<T>>>(n)) {} void add_edge(int s, int t, T cost) { edges[s].emplace_back(s, t, cost); if (!directed) { edges[t].emplace_back(t, s, cost); } } Graph() {} vector<Edge<T>> &operator[](size_t i) { return edges[i]; } int size() const { return n; } }; //====================================================== int main(void) { int N; cin >> N; vec<tuple<int, int, int, int>> block(N); rep(i, N) { int w, s, v; cin >> w >> s >> v; block[i] = mt(w + s, w, s, v); } sort(all(block)); auto dp = make_v(N + 1, 10001, 0LL); repr(i, 1, N + 1) { int ws, w, s, v; tie(ws, w, s, v) = block[i - 1]; rep(j, 10001) { if (j - w >= 0 && j - w < s) { dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - w] + v); } else { dp[i][j] = dp[i - 1][j]; } } } ll ans = 0; rep(i, 10001) { chmax(ans, dp[N][i]); } cout << ans << endl; return 0; }
#include <algorithm> #include <bitset> #include <cassert> #include <chrono> #include <cmath> #include <complex> #include <cstdint> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <list> #include <map> #include <queue> #include <random> #include <regex> #include <set> #include <sstream> #include <stack> #include <string> #include <sys/timeb.h> #include <vector> using namespace std; #define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++) #define rep(i, n) repr(i, 0, n) #define reprrev(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--) #define reprev(i, n) reprrev(i, 0, n) #define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++) #define chmin(mi, value) mi = min(mi, value) #define chmax(ma, value) ma = max(ma, value) #define all(a) (a).begin(), (a).end() #define rall(a) (a).rbegin(), (a).rend() #define mp make_pair #define mt make_tuple #define INF 1050000000 #define INFR INT_MAX #define INFL (long long)(4e18) #define INFLR LLONG_MAX #define EPS (1e-10) #define MOD 1000000007 //#define MOD 998244353 #define PI 3.141592653589793238 #define RMAX 4294967295 using vi = vector<int>; using vvi = vector<vector<int>>; using vvvi = vector<vector<vector<int>>>; using vvvvi = vector<vector<vector<vector<int>>>>; using ll = long long; using vll = vector<ll>; using vvll = vector<vector<ll>>; using vvvll = vector<vector<vector<ll>>>; using vd = vector<double>; using vvd = vector<vector<double>>; using vvvd = vector<vector<vector<double>>>; using vb = vector<bool>; using vvb = vector<vector<bool>>; using vc = vector<char>; using vvc = vector<vector<char>>; using vs = vector<string>; using vvs = vector<vector<string>>; using Pi = pair<int, int>; using vPi = vector<Pi>; using vvPi = vector<vector<Pi>>; using vvvPi = vector<vector<vector<Pi>>>; using vvvvPi = vector<vector<vector<vector<Pi>>>>; using Pll = pair<ll, ll>; using vPll = vector<Pll>; using Pd = pair<double, double>; using vPd = vector<Pd>; template <class T> using vec = vector<T>; template <class T> using pql = priority_queue<T, vector<T>, greater<T>>; using Comp = complex<double>; // vvvvvvvvvvvvvvvvvvvvvvv debug output vvvvvvvvvvvvvvvvvvvvvvv // vector input template <typename T> istream &operator>>(istream &is, vector<T> &vec) { for (T &x : vec) is >> x; return is; } // pair template <typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &pair_var) { os << "(" << pair_var.first << ", " << pair_var.second << ")"; return os; } // vector template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec) { os << "{"; for (int i = 0; i < vec.size(); i++) { os << vec[i] << (i + 1 == vec.size() ? "" : ", "); } os << "}"; return os; } // deque template <typename T> ostream &operator<<(ostream &os, const deque<T> &vec) { os << "{"; for (int i = 0; i < vec.size(); i++) { os << vec[i] << (i + 1 == vec.size() ? "" : ", "); } os << "}"; return os; } // map template <typename T, typename U> ostream &operator<<(ostream &os, const map<T, U> &map_var) { os << "{"; repi(itr, map_var) { os << *itr; itr++; if (itr != map_var.end()) os << ", "; itr--; } os << "}"; return os; } // set template <typename T> ostream &operator<<(ostream &os, const set<T> &set_var) { os << "{"; repi(itr, set_var) { os << *itr; itr++; if (itr != set_var.end()) os << ", "; itr--; } os << "}"; return os; } // multiset template <typename T> ostream &operator<<(ostream &os, const multiset<T> &set_var) { os << "{"; repi(itr, set_var) { os << *itr; itr++; if (itr != set_var.end()) os << ", "; itr--; } os << "}"; return os; } #define DUMPOUT cerr void dump_func() { DUMPOUT << endl; } template <class Head, class... Tail> void dump_func(Head &&head, Tail &&...tail) { DUMPOUT << head; if (sizeof...(Tail) > 0) { DUMPOUT << ", "; } dump_func(std::move(tail)...); } #ifdef DEBUG_ #define DEB #define dump(...) \ DUMPOUT << " " << string(#__VA_ARGS__) << ": " \ << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]" << endl \ << " ", \ dump_func(__VA_ARGS__) #else #define DEB if (false) #define dump(...) #endif // ^^^^^^^^^^^^^^^^^^^^^^^ debug output ^^^^^^^^^^^^^^^^^^^^^^^ string YN(bool y, int id = 0) { if (id) cout << id; return (y ? "YES" : "NO"); } string yn(bool y, int id = 0) { if (id) cout << id; return (y ? "Yes" : "No"); } string ON(bool y, int id = 0) { if (id) cout << id; return (y ? "OK" : "NG"); } int dir4[4][2] = {{0, -1}, {-1, 0}, {1, 0}, {0, 1}}; int dir8[8][2] = {{-1, -1}, {0, -1}, {1, -1}, {-1, 0}, {1, 0}, {-1, 1}, {0, 1}, {1, 1}}; // [a,b) int irand(int a, int b) { static mt19937 Rand(static_cast<unsigned int>(time(nullptr))); uniform_int_distribution<int> dist(a, b - 1); return dist(Rand); } // [a,b) double drand(int a, int b) { static mt19937 Rand(static_cast<unsigned int>(time(nullptr))); uniform_real_distribution<double> dist(a, b); return dist(Rand); } // https://qiita.com/IgnorantCoder/items/3101d6276e9bdddf872c template <typename A, typename F> inline auto transform(const A &v, F &&f) { using result_type = decltype(std::declval<F>()(std::declval<typename A::value_type>())); vector<result_type> y(v.size()); std::transform(std::cbegin(v), std::cend(v), std::begin(y), f); return y; } // generate vector which has multiple dimension 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 <typename T> T Max(vector<T> a) { return *max_element(all(a)); } template <typename T> T Min(vector<T> a) { return *min_element(all(a)); } template <typename T> T Sum(vector<T> a) { return accumulate(all(a), (T)0); } // for counting using map template <typename T> void Add(map<T, int> &m, T item) { if (m.find(item) == m.end()) { m[item] = 1; } else { m[item]++; } } // for counting using map template <typename T> void Erase(map<T, int> &m, T item) { if (m.find(item) == m.end()) { } else { if (m[item] == 1) { m.erase(item); } else { m[item]--; } } } // get method for map with default value template <typename T, typename U> U Get(map<T, U> m, T key, U def) { if (m.find(key) == m.end()) { return def; } else { return m[key]; } } template <typename T> inline bool Contains(const set<T> &t, const T &key) { return t.find(key) != t.end(); } template <typename T, typename U> inline bool Contains(const map<T, U> &t, const T &key) { return t.find(key) != t.end(); } template <class T> struct Edge { int from, to; T cost; Edge(int f, int t, T c) : from(f), to(t), cost(c) {} }; template <class T> bool operator<(const Edge<T> e1, const Edge<T> e2) { return e1.cost < e2.cost || (e1.cost == e2.cost && e1.from < e2.from) || (e1.cost == e2.cost && e1.from == e2.from && e1.to < e2.to); } template <class T> ostream &operator<<(ostream &os, const Edge<T> &edge) { os << "(" << edge.from << "->" << edge.to << ":" << edge.cost << ")"; return os; } template <class T = int> class Graph { int n; bool directed; vector<vector<Edge<T>>> edges; public: Graph(int n, bool directed) : n(n), directed(directed), edges(vector<vector<Edge<T>>>(n)) {} void add_edge(int s, int t, T cost) { edges[s].emplace_back(s, t, cost); if (!directed) { edges[t].emplace_back(t, s, cost); } } Graph() {} vector<Edge<T>> &operator[](size_t i) { return edges[i]; } int size() const { return n; } }; //====================================================== int main(void) { int N; cin >> N; vec<tuple<int, int, int, int>> block(N); rep(i, N) { int w, s, v; cin >> w >> s >> v; block[i] = mt(w + s, w, s, v); } sort(all(block)); auto dp = make_v(N + 1, 20001, 0LL); repr(i, 1, N + 1) { int ws, w, s, v; tie(ws, w, s, v) = block[i - 1]; rep(j, 20001) { if (j - w >= 0 && j - w <= s) { dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - w] + v); } else { dp[i][j] = dp[i - 1][j]; } } } ll ans = 0; rep(i, 20001) { chmax(ans, dp[N][i]); } cout << ans << endl; return 0; }
[ "literal.number.change", "call.arguments.change", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
989,619
989,620
u366676780
cpp
p03183
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> using namespace std; typedef long long LL; const LL N = 1000000007; struct node { LL w, s, v; } b[1005]; bool cmp(node x, node y) { if (x.s + x.w == y.s + y.w) return x.s < y.s; return x.s + x.w < y.s + y.w; } LL n, V; LL dp[1005][10005] = {0}; int main() { scanf("%lld", &n); for (LL i = 1; i <= n; i++) scanf("%lld %lld %lld", &b[i].w, &b[i].s, &b[i].v); sort(b + 1, b + 1 + n, cmp); V = b[n].s + b[n].w; for (LL i = 1; i <= n; i++) { for (LL v = 0; v <= V; v++) dp[i][v] = max(dp[i][v], dp[i - 1][v]); for (LL v = 0; v <= b[i].s; v++) dp[i][v + b[i].w] = max(dp[i][v + b[i].w], dp[i - 1][v] + b[i].v); } LL ans = 0; for (LL i = 0; i <= V; i++) ans = max(ans, dp[n][i]); printf("%lld\n", ans); return 0; }
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> using namespace std; typedef long long LL; const LL N = 1000000007; struct node { LL w, s, v; } b[1005]; bool cmp(node x, node y) { if (x.s + x.w == y.s + y.w) return x.s < y.s; return x.s + x.w < y.s + y.w; } LL n, V; LL dp[1005][30005] = {0}; int main() { scanf("%lld", &n); for (LL i = 1; i <= n; i++) scanf("%lld %lld %lld", &b[i].w, &b[i].s, &b[i].v); sort(b + 1, b + 1 + n, cmp); V = b[n].s + b[n].w; for (LL i = 1; i <= n; i++) { for (LL v = 0; v <= V; v++) dp[i][v] = max(dp[i][v], dp[i - 1][v]); for (LL v = 0; v <= b[i].s; v++) dp[i][v + b[i].w] = max(dp[i][v + b[i].w], dp[i - 1][v] + b[i].v); } LL ans = 0; for (LL i = 0; i <= V; i++) ans = max(ans, dp[n][i]); printf("%lld\n", ans); return 0; }
[ "literal.number.change", "variable_declaration.array_dimensions.change" ]
989,636
989,637
u206645986
cpp
p03183
#include "bits/stdc++.h" using namespace std; #define show(x) cerr << #x << " = " << x << endl; #define input_from_file freopen("input.txt", "r", stdin) #define output_to_file freopen("output.txt", "w", stdout) #define fastio ios_base::sync_with_stdio(0) #define endl '\n' const int N = 1e3 + 1, W = 2e4 + 5; vector<vector<int>> v(N, vector<int>(3)); long long dp[N][W]; bool compare(vector<int> &v1, vector<int> &v2) { return (v1[0] + v1[1] < v2[0] + v2[1]); } int main() { #ifdef LOCAL input_from_file; output_to_file; #endif fastio; cin.tie(0); cout.tie(0); int n; cin >> n; for (int i = 1; i <= n; ++i) cin >> v[i][0] >> v[i][1] >> v[i][2]; sort(v.begin() + 1, v.begin() + n + 1, compare); for (int i = 1; i <= n; ++i) { for (int j = 0; j < 10; ++j) { dp[i][j] = max(dp[i][j], dp[i - 1][j]); if (v[i][1] >= j && v[i][0] + j < W) { dp[i][j + v[i][0]] = max(dp[i][j + v[i][0]], dp[i - 1][j] + v[i][2]); // cerr <<i << " " << j <<" "<< j + v[i][0] << " "<<dp[i][j+v[i][0]] << // endl; } // cerr << i << " "<< j << " "<< dp[i][j] <<endl; } } long long ans = INT_MIN; for (int i = 1; i < W; ++i) ans = max(dp[n][i], ans); cout << ans; return 0; }
#include "bits/stdc++.h" using namespace std; #define show(x) cerr << #x << " = " << x << endl; #define input_from_file freopen("input.txt", "r", stdin) #define output_to_file freopen("output.txt", "w", stdout) #define fastio ios_base::sync_with_stdio(0) #define endl '\n' const int N = 1e3 + 1, W = 2e4 + 5; vector<vector<int>> v(N, vector<int>(3)); long long dp[N][W]; bool compare(vector<int> &v1, vector<int> &v2) { return (v1[0] + v1[1] < v2[0] + v2[1]); } int main() { #ifdef LOCAL input_from_file; output_to_file; #endif fastio; cin.tie(0); cout.tie(0); int n; cin >> n; for (int i = 1; i <= n; ++i) cin >> v[i][0] >> v[i][1] >> v[i][2]; sort(v.begin() + 1, v.begin() + n + 1, compare); for (int i = 1; i <= n; ++i) { for (int j = 0; j < W; ++j) { dp[i][j] = max(dp[i][j], dp[i - 1][j]); if (v[i][1] >= j && v[i][0] + j < W) { dp[i][j + v[i][0]] = max(dp[i][j + v[i][0]], dp[i - 1][j] + v[i][2]); // cerr <<i << " " << j <<" "<< j + v[i][0] << " "<<dp[i][j+v[i][0]] << // endl; } // cerr << i << " "<< j << " "<< dp[i][j] <<endl; } } long long ans = INT_MIN; for (int i = 1; i < W; ++i) ans = max(dp[n][i], ans); cout << ans; return 0; }
[ "identifier.replace.add", "literal.replace.remove", "control_flow.loop.for.condition.change", "expression.operation.binary.change" ]
989,638
989,639
u014570988
cpp
p03183
#include <bits/stdc++.h> using namespace std; const int N = 1010; typedef long long ll; int n; ll f[N][N * 10]; struct Node { int w, s; ll v; } a[N]; /* 设f[i][j]表示前i个,然后总重量为j的最大答案。 */ /* bool operator < (Node a, Node b) { if(a.s + a.w == b.s + b.w) return a.s < b.s; return a.s + a.w < b.s + b.w; } */ bool operator<(Node a, Node b) { if (a.s + a.w == b.s + b.w) return a.w < b.w; return a.s + a.w < b.s + b.w; } int main() { scanf("%d", &n); for (int i = 1; i <= n; ++i) { scanf("%d%d%lld", &a[i].w, &a[i].s, &a[i].v); } sort(a + 1, a + n + 1); for (int i = 1; i <= n; ++i) { for (int j = 0; j <= a[n].s + a[n].w; ++j) f[i][j] = max(f[i][j], f[i - 1][j]); for (int j = 0; j <= a[i].s; ++j) f[i][j + a[i].w] = max(f[i][j + a[i].w], f[i - 1][j] + a[i].v); } ll ans = 0; for (int i = 0; i <= a[n].s + a[n].w; ++i) ans = max(ans, f[n][i]); printf("%lld\n", ans); /* for(int i = 1; i <= n; ++i) { for(int j = 0; j <= a[n].s; ++j) printf("%d ", f[i][j]); puts(""); }*/ }
#include <bits/stdc++.h> using namespace std; const int N = 1010; typedef long long ll; int n; ll f[N][N * 30]; struct Node { int w, s; ll v; } a[N]; /* 设f[i][j]表示前i个,然后总重量为j的最大答案。 */ bool operator<(Node a, Node b) { if (a.s + a.w == b.s + b.w) return a.s < b.s; return a.s + a.w < b.s + b.w; } int main() { scanf("%d", &n); for (int i = 1; i <= n; ++i) { scanf("%d%d%lld", &a[i].w, &a[i].s, &a[i].v); } sort(a + 1, a + n + 1); for (int i = 1; i <= n; ++i) { for (int j = 0; j <= a[n].s + a[n].w; ++j) f[i][j] = max(f[i][j], f[i - 1][j]); for (int j = 0; j <= a[i].s; ++j) f[i][j + a[i].w] = max(f[i][j + a[i].w], f[i - 1][j] + a[i].v); } ll ans = 0; for (int i = 0; i <= a[n].s + a[n].w; ++i) ans = max(ans, f[n][i]); printf("%lld\n", ans); /* for(int i = 1; i <= n; ++i) { for(int j = 0; j <= a[n].s; ++j) printf("%d ", f[i][j]); puts(""); }*/ }
[ "literal.number.change", "expression.operation.binary.change", "function.return_value.change" ]
989,642
989,643
u993519359
cpp
p03183
#include <bits/stdc++.h> using namespace std; const int N = 1010; typedef long long ll; int n; ll f[N][N * 10]; struct Node { int w, s; ll v; } a[N]; /* 设f[i][j]表示前i个,然后总重量为j的最大答案。 */ bool operator<(Node a, Node b) { if (a.s + a.w == b.s + b.w) return a.s < b.s; return a.s + a.w < b.s + b.w; } int main() { scanf("%d", &n); for (int i = 1; i <= n; ++i) { scanf("%d%d%lld", &a[i].w, &a[i].s, &a[i].v); } sort(a + 1, a + n + 1); for (int i = 1; i <= n; ++i) { for (int j = 0; j <= a[i].s + a[i].w; ++j) f[i][j] = max(f[i][j], f[i - 1][j]); for (int j = 0; j <= a[i].s; ++j) f[i][j + a[i].w] = max(f[i][j + a[i].w], f[i - 1][j] + a[i].v); } ll ans = 0; for (int i = 0; i <= a[n].s + a[n].w; ++i) ans = max(ans, f[n][i]); printf("%lld\n", ans); /* for(int i = 1; i <= n; ++i) { for(int j = 0; j <= a[n].s; ++j) printf("%d ", f[i][j]); puts(""); }*/ }
#include <bits/stdc++.h> using namespace std; const int N = 1010; typedef long long ll; int n; ll f[N][N * 30]; struct Node { int w, s; ll v; } a[N]; /* 设f[i][j]表示前i个,然后总重量为j的最大答案。 */ bool operator<(Node a, Node b) { if (a.s + a.w == b.s + b.w) return a.s < b.s; return a.s + a.w < b.s + b.w; } int main() { scanf("%d", &n); for (int i = 1; i <= n; ++i) { scanf("%d%d%lld", &a[i].w, &a[i].s, &a[i].v); } sort(a + 1, a + n + 1); for (int i = 1; i <= n; ++i) { for (int j = 0; j <= a[n].s + a[n].w; ++j) f[i][j] = max(f[i][j], f[i - 1][j]); for (int j = 0; j <= a[i].s; ++j) f[i][j + a[i].w] = max(f[i][j + a[i].w], f[i - 1][j] + a[i].v); } ll ans = 0; for (int i = 0; i <= a[n].s + a[n].w; ++i) ans = max(ans, f[n][i]); printf("%lld\n", ans); /* for(int i = 1; i <= n; ++i) { for(int j = 0; j <= a[n].s; ++j) printf("%d ", f[i][j]); puts(""); }*/ }
[ "literal.number.change", "expression.operation.binary.change", "identifier.change", "variable_access.subscript.index.change", "control_flow.loop.for.condition.change" ]
989,644
989,643
u993519359
cpp
p03183
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep1(i, n) for (int i = 1; i <= (int)(n); i++) #define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; (i)--) #define rrep1(i, n) for (int i = ((int)(n)); i > 0; (i)--) #define sz(c) ((int)(c).size()) #define all(x) (x).begin(), (x).end() #define mp make_pair #define pb push_back #define fi first #define se second using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vll; typedef pair<int, int> P; typedef pair<int, pair<int, int>> PP; const int MAX = 1e3 + 10; int N; vi w, s; vll v; int S, W; void input() { cin >> N; vi tw(N), ts(N); vll tv(N); rep(i, N) { cin >> tw[i] >> ts[i] >> tv[i]; S = max(S, ts[i]); W = max(W, tw[i]); } vector<P> seq(N); rep(i, N) seq[i] = mp(tw[i] + ts[i], i); sort(all(seq)); rep(i, N) { int ind = seq[i].se; w.pb(tw[ind]); s.pb(ts[ind]); v.pb(tv[ind]); } } ll dp[1010][10010]; ll ans; void solve() { rep(i, N + 1) rep(we, S + W + 1) dp[i][we] = -1; dp[0][0] = 0; rep(i, N) rep(we, S + W + 1) if (dp[i][we] != -1) { dp[i + 1][we] = max(dp[i + 1][we], dp[i][we]); if (we <= s[i]) dp[i + 1][we + w[i]] = max(dp[i + 1][we + w[i]], dp[i][we] + v[i]); } rep(we, S + W + 1) ans = max(ans, dp[N][we]); } void output() { cout << ans; } int main() { input(); solve(); output(); }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep1(i, n) for (int i = 1; i <= (int)(n); i++) #define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; (i)--) #define rrep1(i, n) for (int i = ((int)(n)); i > 0; (i)--) #define sz(c) ((int)(c).size()) #define all(x) (x).begin(), (x).end() #define mp make_pair #define pb push_back #define fi first #define se second using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vll; typedef pair<int, int> P; typedef pair<int, pair<int, int>> PP; const int MAX = 1e3 + 10; int N; vi w, s; vll v; int S, W; void input() { cin >> N; vi tw(N), ts(N); vll tv(N); rep(i, N) { cin >> tw[i] >> ts[i] >> tv[i]; S = max(S, ts[i]); W = max(W, tw[i]); } vector<P> seq(N); rep(i, N) seq[i] = mp(tw[i] + ts[i], i); sort(all(seq)); rep(i, N) { int ind = seq[i].se; w.pb(tw[ind]); s.pb(ts[ind]); v.pb(tv[ind]); } } ll dp[1010][20010]; ll ans; void solve() { rep(i, N + 1) rep(we, S + W + 1) dp[i][we] = -1; dp[0][0] = 0; rep(i, N) rep(we, S + W + 1) if (dp[i][we] != -1) { dp[i + 1][we] = max(dp[i + 1][we], dp[i][we]); if (we <= s[i]) dp[i + 1][we + w[i]] = max(dp[i + 1][we + w[i]], dp[i][we] + v[i]); } rep(we, S + W + 1) ans = max(ans, dp[N][we]); } void output() { cout << ans; } int main() { input(); solve(); output(); }
[ "literal.number.change", "variable_declaration.array_dimensions.change" ]
989,673
989,674
u228214259
cpp
p03183
#include <bits/stdc++.h> using namespace std; #define int long long struct node { int w, s, v; } a[1005]; int n, dp[10005], ans; int cmp(node a, node b) { return a.w + a.s < b.w + b.s; } signed main() { cin >> n; for (int i = 1; i <= n; i++) cin >> a[i].w >> a[i].s >> a[i].v; sort(a + 1, a + n + 1, cmp); for (int i = 1; i <= n; i++) for (int j = a[i].s; j >= 0; j--) dp[j + a[i].w] = max(dp[j + a[i].w], dp[j] + a[i].v); cout << *max_element(dp, dp + 10005) << endl; return 0; }
#include <bits/stdc++.h> using namespace std; #define int long long struct node { int w, s, v; } a[10005]; int n, dp[10000005], ans; int cmp(node a, node b) { return a.w + a.s < b.w + b.s; } signed main() { cin >> n; for (int i = 1; i <= n; i++) cin >> a[i].w >> a[i].s >> a[i].v; sort(a + 1, a + n + 1, cmp); for (int i = 1; i <= n; i++) for (int j = a[i].s; j >= 0; j--) dp[j + a[i].w] = max(dp[j + a[i].w], dp[j] + a[i].v); cout << *max_element(dp, dp + 10000000) << endl; return 0; }
[ "literal.number.change", "variable_declaration.array_dimensions.change", "io.output.change" ]
989,677
989,678
u827581253
cpp
p03183
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> P; #define p_ary(ary, a, b, i) \ do { \ cout << "["; \ for (int(i) = (a); (i) < (b); ++(i)) \ cout << ary[(i)] << ((b)-1 == (i) ? "" : ", "); \ cout << "]\n"; \ } while (0) #define p_map(map, it) \ do { \ cout << "{"; \ for (auto(it) = map.begin();; ++(it)) { \ if ((it) == map.end()) { \ cout << "}\n"; \ break; \ } else \ cout << "" << (it)->first << "=>" << (it)->second << ", "; \ } \ } while (0) struct block { int w, s, v; bool operator<(const block &a) const { return w + s < a.s + a.w; } }; int main() { int n; cin >> n; vector<block> a(n); for (int i = 0; i < n; ++i) cin >> a[i].w >> a[i].s >> a[i].v; sort(a.begin(), a.end()); vector<vector<ll>> dp(n + 1, vector<ll>(10000010, 0)); for (int i = 0; i < n; ++i) { dp[i + 1] = dp[i]; for (int j = 0; j <= a[i].s; ++j) dp[i + 1][j + a[i].w] = max(dp[i + 1][j + a[i].w], dp[i][j] + a[i].v); } ll ans = 0; for (int i = 0; i < 10000010; ++i) ans = max(ans, dp[n][i]); cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> P; #define p_ary(ary, a, b, i) \ do { \ cout << "["; \ for (int(i) = (a); (i) < (b); ++(i)) \ cout << ary[(i)] << ((b)-1 == (i) ? "" : ", "); \ cout << "]\n"; \ } while (0) #define p_map(map, it) \ do { \ cout << "{"; \ for (auto(it) = map.begin();; ++(it)) { \ if ((it) == map.end()) { \ cout << "}\n"; \ break; \ } else \ cout << "" << (it)->first << "=>" << (it)->second << ", "; \ } \ } while (0) struct block { int w, s, v; bool operator<(const block &a) const { return w + s < a.s + a.w; } }; int main() { int n; cin >> n; vector<block> a(n); for (int i = 0; i < n; ++i) cin >> a[i].w >> a[i].s >> a[i].v; sort(a.begin(), a.end()); vector<vector<ll>> dp(n + 1, vector<ll>(20010, 0)); for (int i = 0; i < n; ++i) { dp[i + 1] = dp[i]; for (int j = 0; j <= a[i].s; ++j) dp[i + 1][j + a[i].w] = max(dp[i + 1][j + a[i].w], dp[i][j] + a[i].v); } ll ans = 0; for (int i = 0; i < 20010; ++i) ans = max(ans, dp[n][i]); cout << ans << endl; return 0; }
[ "literal.number.change", "call.arguments.change", "control_flow.loop.for.condition.change", "expression.operation.binary.change" ]
989,686
989,687
u506255180
cpp
p03183
#include <bits/stdc++.h> #define MAX_N (ll)23200 using namespace std; typedef long long ll; ll dp[1005][MAX_N + 1], n; struct node { ll w, s, v, indx; }; node arr[100005]; bool cmp(node a, node b) { return a.w + a.s > b.s + b.w; } ll rec(ll i, ll k) { if (i == n) { return 0; } if (dp[i][k] != -1) { return dp[i][k]; } ll ans = rec(i + 1, k); if (k - arr[i].w >= 0) { ll x = min(k - arr[i].w, arr[i].s); ans = max(ans, rec(i + 1, x) + arr[i].v); } return dp[i][k] = ans; } int main() { ll i, j; cin >> n; for (i = 1; i <= n; i++) { cin >> arr[i].w >> arr[i].s >> arr[i].v; arr[i].indx = i; } sort(arr + 1, arr + n + 1, cmp); for (i = 0; i <= n; i++) { for (j = 0; j <= MAX_N; j++) { dp[i][j] = -1; } } ll ans = rec(1, MAX_N); cout << ans << endl; return 0; }
#include <bits/stdc++.h> #define MAX_N (ll)23200 using namespace std; typedef long long ll; ll dp[1005][MAX_N + 1], n; struct node { ll w, s, v, indx; }; node arr[100005]; bool cmp(node a, node b) { return a.w + a.s > b.s + b.w; } ll rec(ll i, ll k) { if (i == n + 1) { return 0; } if (dp[i][k] != -1) { return dp[i][k]; } ll ans = rec(i + 1, k); if (k - arr[i].w >= 0) { ll x = min(k - arr[i].w, arr[i].s); ans = max(ans, rec(i + 1, x) + arr[i].v); } return dp[i][k] = ans; } int main() { ll i, j; cin >> n; for (i = 1; i <= n; i++) { cin >> arr[i].w >> arr[i].s >> arr[i].v; arr[i].indx = i; } sort(arr + 1, arr + n + 1, cmp); for (i = 0; i <= n; i++) { for (j = 0; j <= MAX_N; j++) { dp[i][j] = -1; } } ll ans = rec(1, MAX_N); cout << ans << endl; return 0; }
[ "control_flow.branch.if.condition.change" ]
989,692
989,693
u903063670
cpp