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
p02987
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; if (s[0] == s[1] && s[2] == s[3] && s[0] != s[2]) cout << "yes" << endl; else if (s[0] == s[2] && s[1] == s[3] && s[0] != s[1]) cout << "yes" << endl; else if (s[0] == s[3] && s[1] == s[2] && s[0] != s[1]) cout << "yes" << endl; else cout << "no" << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; if (s[0] == s[1] && s[2] == s[3] && s[0] != s[2]) cout << "Yes" << endl; else if (s[0] == s[2] && s[1] == s[3] && s[0] != s[1]) cout << "Yes" << endl; else if (s[0] == s[3] && s[1] == s[2] && s[0] != s[1]) cout << "Yes" << endl; else cout << "No" << endl; return 0; }
[ "literal.string.change", "literal.string.case.change", "io.output.change" ]
795,241
795,242
u318501828
cpp
p02987
#include <algorithm> #include <iostream> #include <math.h> #include <string> using namespace std; int main() { string S; int judge = 0; if (S[0] == S[1]) { if (S[0] != S[2] && S[2] == S[3]) { cout << "Yes"; } else { cout << "No"; } } else if (S[0] == S[2]) { if (S[0] != S[1] && S[1] == S[3]) { cout << "Yes"; } else { cout << "No"; } } else if (S[0] == S[3]) { if (S[0] != S[1] && S[1] == S[2]) { cout << "Yes"; } else { cout << "No"; } } else { cout << "No"; } return 0; }
#include <algorithm> #include <iostream> #include <math.h> #include <string> using namespace std; int main() { string S; cin >> S; int judge = 0; if (S[0] == S[1]) { if (S[0] != S[2] && S[2] == S[3]) { cout << "Yes"; } else { cout << "No"; } } else if (S[0] == S[2]) { if (S[0] != S[1] && S[1] == S[3]) { cout << "Yes"; } else { cout << "No"; } } else if (S[0] == S[3]) { if (S[0] != S[1] && S[1] == S[2]) { cout << "Yes"; } else { cout << "No"; } } else { cout << "No"; } return 0; }
[]
795,247
795,248
u725133562
cpp
p02987
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; #define ll long long #define ull unsigned ll #define all(x) x.begin(), x.end() #define CHECK_BIT(var, pos) ((var) & (1 << (pos))) #define eb emplace_back const int M = 1e9 + 7; typedef long double ldb; typedef vector<int> vi; typedef vector<ll> vll; typedef vector<string> vs; typedef tree<pair<int, int>, null_type, less<pair<int, int>>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; int main() { string s; cin >> s; int ch[26] = {}; sort(all(s)); for (int i = 0; i < 4; ++i) { ch[s[i] - 'A']++; } sort(ch, ch + 26); if (ch[25] == 2 && ch[24] == 2) cout << "YES" << endl; else cout << "NO" << endl; }
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; #define ll long long #define ull unsigned ll #define all(x) x.begin(), x.end() #define CHECK_BIT(var, pos) ((var) & (1 << (pos))) #define eb emplace_back const int M = 1e9 + 7; typedef long double ldb; typedef vector<int> vi; typedef vector<ll> vll; typedef vector<string> vs; typedef tree<pair<int, int>, null_type, less<pair<int, int>>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; int main() { string s; cin >> s; int ch[26] = {}; sort(all(s)); for (int i = 0; i < 4; ++i) { ch[s[i] - 'A']++; } sort(ch, ch + 26); if (ch[25] == 2 && ch[24] == 2) cout << "Yes" << endl; else cout << "No" << endl; }
[ "literal.string.change", "literal.string.case.change", "io.output.change" ]
795,249
795,250
u694882399
cpp
p02987
#include <bits/stdc++.h> #include <math.h> #include <set> #define ll long long int #define mod 1000000007 #define MAX 10000003 #define pb push_back #define mem(x, y) memset(x, y, sizeof(x)) #define loop(i, x, y) for (ll i = x; i < y; i++) #define rloop(i, x, y) for (ll i = x - 1; i >= y; i--) using namespace std; vector<vector<ll>> vec2d; vector<pair<ll, ll>> vec_pair; multiset<ll> node[200003]; // vector<pair<ll, ll> > vec_pair; int main() { string str; cin >> str; ll arr[27]; for (ll i = 0; i < 26; i++) arr[i] = 0; ll n = str.size(), a, b; for (ll i = 0; i < n; i++) { a = (int)str[i] - 65; b = arr[a]; b++; arr[a] = b; } ll t = 0; for (ll i = 0; i < 26; i++) { if (arr[i] == 2) t++; } if (t == 2) cout << "YES" << endl; else cout << "NO" << endl; return 0; }
#include <bits/stdc++.h> #include <math.h> #include <set> #define ll long long int #define mod 1000000007 #define MAX 10000003 #define pb push_back #define mem(x, y) memset(x, y, sizeof(x)) #define loop(i, x, y) for (ll i = x; i < y; i++) #define rloop(i, x, y) for (ll i = x - 1; i >= y; i--) using namespace std; vector<vector<ll>> vec2d; vector<pair<ll, ll>> vec_pair; multiset<ll> node[200003]; // vector<pair<ll, ll> > vec_pair; int main() { string str; cin >> str; ll arr[27]; for (ll i = 0; i < 26; i++) arr[i] = 0; ll n = str.size(), a, b; for (ll i = 0; i < n; i++) { a = (int)str[i] - 65; b = arr[a]; b++; arr[a] = b; } ll t = 0; for (ll i = 0; i < 26; i++) { if (arr[i] == 2) t++; } if (t == 2) cout << "Yes" << endl; else cout << "No" << endl; return 0; }
[ "literal.string.change", "literal.string.case.change", "io.output.change" ]
795,257
795,258
u266685049
cpp
p02987
//==========================Head files========================== #include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <vector> #define LL long long #define db double #define mp make_pair #define pr pair<int, int> #define fir first #define sec second #define pb push_back #define ms(i, j) memset(i, j, sizeof i) using namespace std; //==========================Templates========================== inline int read() { int x = 0, f = 1; char c = getchar(); while (c < '0' || c > '9') { if (c == '-') f = -1; c = getchar(); } while (c >= '0' && c <= '9') { x = x * 10 + c - '0'; c = getchar(); } return x * f; } inline LL readl() { LL x = 0, f = 1; char c = getchar(); while (c < '0' || c > '9') { if (c == '-') f = -1; c = getchar(); } while (c >= '0' && c <= '9') { x = x * 10 + c - '0'; c = getchar(); } return x * f; } int power(int a, int b) { int ans = 1; while (b) { if (b & 1) ans = ans * a; b >>= 1; a = a * a; } return ans; } int power_mod(int a, int b, int mod) { a %= mod; int ans = 1; while (b) { if (b & 1) ans = (ans * a) % mod; b >>= 1, a = (a * a) % mod; } return ans; } LL powerl(LL a, LL b) { LL ans = 1ll; while (b) { if (b & 1ll) ans = ans * a; b >>= 1ll; a = a * a; } return ans; } LL power_modl(LL a, LL b, LL mod) { a %= mod; LL ans = 1ll; while (b) { if (b & 1ll) ans = (ans * a) % mod; b >>= 1ll, a = (a * a) % mod; } return ans; } LL gcdl(LL a, LL b) { return b == 0 ? a : gcdl(b, a % b); } LL abssl(LL a) { return a > 0 ? a : -a; } int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); } int abss(int a) { return a > 0 ? a : -a; } //==========================Main body========================== #define LD "%I64d" #define D "%d" #define pt printf #define sn scanf #define pty printf("Yes\n") #define ptn printf("No\n") //==========================Code here========================== char s[10]; int main() { cin >> s; sort(s, s + 4); if (s[0] == s[1] && s[2] == s[3] && s[0] != s[1]) pty; else ptn; return 0; }
//==========================Head files========================== #include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <vector> #define LL long long #define db double #define mp make_pair #define pr pair<int, int> #define fir first #define sec second #define pb push_back #define ms(i, j) memset(i, j, sizeof i) using namespace std; //==========================Templates========================== inline int read() { int x = 0, f = 1; char c = getchar(); while (c < '0' || c > '9') { if (c == '-') f = -1; c = getchar(); } while (c >= '0' && c <= '9') { x = x * 10 + c - '0'; c = getchar(); } return x * f; } inline LL readl() { LL x = 0, f = 1; char c = getchar(); while (c < '0' || c > '9') { if (c == '-') f = -1; c = getchar(); } while (c >= '0' && c <= '9') { x = x * 10 + c - '0'; c = getchar(); } return x * f; } int power(int a, int b) { int ans = 1; while (b) { if (b & 1) ans = ans * a; b >>= 1; a = a * a; } return ans; } int power_mod(int a, int b, int mod) { a %= mod; int ans = 1; while (b) { if (b & 1) ans = (ans * a) % mod; b >>= 1, a = (a * a) % mod; } return ans; } LL powerl(LL a, LL b) { LL ans = 1ll; while (b) { if (b & 1ll) ans = ans * a; b >>= 1ll; a = a * a; } return ans; } LL power_modl(LL a, LL b, LL mod) { a %= mod; LL ans = 1ll; while (b) { if (b & 1ll) ans = (ans * a) % mod; b >>= 1ll, a = (a * a) % mod; } return ans; } LL gcdl(LL a, LL b) { return b == 0 ? a : gcdl(b, a % b); } LL abssl(LL a) { return a > 0 ? a : -a; } int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); } int abss(int a) { return a > 0 ? a : -a; } //==========================Main body========================== #define LD "%I64d" #define D "%d" #define pt printf #define sn scanf #define pty printf("Yes\n") #define ptn printf("No\n") //==========================Code here========================== char s[10]; int main() { cin >> s; sort(s, s + 4); if (s[0] == s[1] && s[2] == s[3] && s[0] != s[2]) pty; else ptn; return 0; }
[ "literal.number.change", "variable_access.subscript.index.change", "control_flow.branch.if.condition.change" ]
795,259
795,260
u774596402
cpp
p02987
// Keep Working hard #include <bits/stdc++.h> using namespace std; #define int long long #define IOS \ ios::sync_with_stdio(false); \ cin.tie(nullptr); \ cout.precision(10); const int N = 1e5 + 5; int a[N]; void solve() { string s; cin >> s; map<int, int> mp; for (int i = 0; i < 4; i++) { mp[s[i] - 'A']++; } for (auto i : mp) { if (i.second != 2) { cout << "No"; exit(0); } } cout << "Yes"; } void fileIO() { #ifndef ONLINE_JUDGE freopen("int.txt", "r", stdin); freopen("out.txt", "w", stdout); #endif } int32_t main() { IOS; fileIO(); int t = 1; while (t--) { solve(); } return 0; }
// Keep Working hard #include <bits/stdc++.h> using namespace std; #define int long long #define IOS \ ios::sync_with_stdio(false); \ cin.tie(nullptr); \ cout.precision(10); const int N = 1e5 + 5; int a[N]; void solve() { string s; cin >> s; map<int, int> mp; for (int i = 0; i < 4; i++) { mp[s[i] - 'A']++; } for (auto i : mp) { if (i.second != 2) { cout << "No"; exit(0); } } cout << "Yes"; } void fileIO() { #ifndef ONLINE_JUDGE freopen("int.txt", "r", stdin); freopen("out.txt", "w", stdout); #endif } int32_t main() { IOS; // fileIO(); int t = 1; while (t--) { solve(); } return 0; }
[ "call.remove" ]
795,265
795,266
u490234157
cpp
p02987
#include <bits/stdc++.h> using namespace std; #define fi first #define endl "\n" #define se second #define ll long long // priority_queue<int, vector<int>, greater<int> > pq; #define _CRT_SECURE_NO_DEPRECATE const int N = 30030; #define rep(i, begin, end) \ for (__typeof(end) i = (begin) - ((begin) > (end)); \ i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end))) const ll mod = 1e9 + 7; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); string s; cin >> s; set<char> st; rep(i, 0, 4) { st.insert(s[i]); } if (st.size() == 2) cout << "yes"; else cout << "No"; }
#include <bits/stdc++.h> using namespace std; #define fi first #define endl "\n" #define se second #define ll long long // priority_queue<int, vector<int>, greater<int> > pq; #define _CRT_SECURE_NO_DEPRECATE const int N = 30030; #define rep(i, begin, end) \ for (__typeof(end) i = (begin) - ((begin) > (end)); \ i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end))) const ll mod = 1e9 + 7; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); string s; cin >> s; set<char> st; rep(i, 0, 4) { st.insert(s[i]); } if (st.size() == 2) cout << "Yes"; else cout << "No"; }
[ "literal.string.change", "literal.string.case.change", "io.output.change" ]
795,267
795,268
u278557567
cpp
p02987
// JSD #include <iostream> #include <set> #include <vector> using namespace std; int main() { string s; set<char> st; cin >> s; for (int i = 0; i < s.length(); i++) st.insert(s[i]); if (st.size() == 2) cout << "YES\n"; else cout << "NO\n"; return 0; }
// JSD #include <iostream> #include <set> #include <vector> using namespace std; int main() { string s; set<char> st; cin >> s; for (int i = 0; i < s.length(); i++) st.insert(s[i]); if (st.size() == 2) cout << "Yes\n"; else cout << "No\n"; return 0; }
[ "literal.string.change", "literal.string.case.change", "io.output.change" ]
795,271
795,272
u436019023
cpp
p02987
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<ll> vi; typedef vector<vi> vvi; typedef vector<string> vs; typedef pair<ll, ll> pii; typedef vector<pii> vpii; #define pb(x) push_back(x) #define ppb() pop_back() #define mp(x, y) make_pair(x, y) #define mod 1000000007 #define FOR0(i, n) for (ll i = 0; i < n; i++) #define FOR(i, a, b) for (ll i = a; i < b; i++) #define FORD(i, a, b) for (ll i = (a); i >= (int)(b); i--) #define sf(n) scanf("%lld", &n) #define sfc(x) scanf("%c", &x) #define pf(x) printf("%lld", x) #define pff(x) printf("%lf", x) #define pfc(x) printf("%c", x) #define pfs(x) printf("%s", x) #define sf2(a, b) scanf("%lld %lld", &a, &b) #define sf3(a, b, c) scanf("%lld %lld %lld", &a, &b, &c) #define pfn(n) printf("%lld\n", n) //#define pfs(n) printf("%lld ", n) #define ff first #define ss second #define mem(a, b) memset(a, b, sizeof(a)) #define sz size() #define ll long long #define all(c) (c).begin(), (c).end() #define fast \ ios_base::sync_with_stdio(0); \ cin.tie(NULL); \ cout.tie(NULL); const ll INF = 2e18; bool prime[100010]; void SieveOfEratosthenes(ll n) { memset(prime, true, sizeof(prime)); for (ll p = 2; p * p <= n; p++) { if (prime[p] == true) { for (ll i = p * p; i <= n; i += p) prime[i] = false; } } } ll power(ll x, ll y) { if (y == 0) return 1; else if (y % 2 == 0) return power(x, y / 2) * power(x, y / 2); else return x * power(x, y / 2) * power(x, y / 2); } ll power1(ll a, ll b) { ll res = 1; while (b) { if (b & 1) { res *= a; } a = a * a; b >>= 1; } return res; } ll mod_power(ll a, ll b, ll m) { ll res = 1; a %= m; while (b) { if (b & 1) { res = res * a % m; } a = a * a % m; b >>= 1; } return res; } ll printDivisors(ll n) { ll count = 0; for (ll i = 1; i <= sqrt(n); i++) { if (n % i == 0) { if (n / i == i) count++; else // Otherwise print both printf("%d %d ", i, n / i); } } } bool isPrime(int n) { if (n <= 1) return false; if (n <= 3) return true; if (n % 2 == 0 || n % 3 == 0) return false; for (int i = 5; i * i <= n; i = i + 6) if (n % i == 0 || n % (i + 2) == 0) return false; return true; } ll par[1000001]; ll ranki[1000001] = {0}; ll find(ll x) { if (par[x] != x) { par[x] = find(par[x]); } return par[x]; } void unionset(ll x, ll y) { ll xr = find(x); ll yr = find(y); if (ranki[xr] > ranki[yr]) { par[yr] = xr; } else if (ranki[xr] < ranki[yr]) { par[xr] = yr; } else { par[yr] = xr; ranki[xr]++; } } // vector<pii> v[10001]; // ll vis[10001]={0}; // ll dis[10001]; // void dijkstra(){ // FOR0(i,10001)dis[i]=1e18; // multiset<pii > s; // s.insert({0,1}); // dis[1]=0; // while(!s.empty()){ // pii up = *s.begin(); // ll u=up.ss; // s.erase(s.begin()); // if(vis[u])continue; // vis[u]=1; // FOR0(i,v[u].size()){ // ll e = v[u][i].ff,w=v[u][i].ss; // if(dis[u]+w<dis[e]){ // dis[e]=dis[u]+w; // s.insert({dis[e],e}); // } // } // } // } // void dijkstra(ll s){ // FOR0(i,10001)dis[i]=INF; // dis[s] = 0; // priority_queue<pii , vpii , greater<pii >> pq; // //priority_queue<pair<int, int>, vector<pair<int, int>>, // greater<pair<int, int>>> q; pq.push({0, s}); while(!pq.empty()) // { // int u = pq.top().ss; // //int d = pq.top().first; // pq.pop(); // if(vis[u]) continue; // vis[u] = 1; // for(auto it: v[u]) // { // int e = it.ff; // int w = it.ss; // if(dis[u] + w < dis[e]) // { // dis[e] = dis[u] + w; // pq.push({dis[e], e}); // } // } // } // } // void dfs1(ll s,ll count){ // vis[s]=1; // //val[s]=count; // FOR0(i,v[s].size()){ // if(!vis[v[s][i]]){ // dfs1(v[s][i],count); // } // } // } // void dfs(ll s){ // stack<ll> st; // st.push(s); // vis[s]=1; // while(!st.empty()){ // ll u = st.top(); // st.pop(); // FOR0(i,v[u].size()){ // if(!vis[v[u][i]]){ // st.push(v[u][i]); // vis[v[u][i]]=1; // } // } // } // } // ll bs(){ // ll l,h,mid; // while(l<=h){ // mid = (l+h)/2; // if(a[mid]==x)return mid; // else if(x>a[mid]){ // l = mid+1; // } // else if(x<a[mid]){ // h = mid-1; // } // } // } // ll lbs(){ // ll l,h,mid; // while(l<h){ // mid = (l+h)/2; // if(x<=a[mid]){ // h = mid; // } // else{ // l = mid-1; // } // } // if(a[l]==x)return l; // else return -1; // } // ll ubs(){ // ll l,h,mid; // while(l<h){ // mid = (l+h)/2; // if(a[mid]<=x)l = mid; // else{ // h = mid-1; // } // } // if(a[h]==x)return h; // else return -1; // } int main() { fast string s; cin >> s; ll freq[26] = {0}; FOR0(i, s.length()) freq[s[i] - 'a']++; ll count = 0, count1 = 0; FOR0(i, 26) { if (freq[i] > 0) count++; if (freq[i] == 2) count1++; } if (count == 2 && count1 == 2) cout << "Yes\n"; else cout << "No\n"; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<ll> vi; typedef vector<vi> vvi; typedef vector<string> vs; typedef pair<ll, ll> pii; typedef vector<pii> vpii; #define pb(x) push_back(x) #define ppb() pop_back() #define mp(x, y) make_pair(x, y) #define mod 1000000007 #define FOR0(i, n) for (ll i = 0; i < n; i++) #define FOR(i, a, b) for (ll i = a; i < b; i++) #define FORD(i, a, b) for (ll i = (a); i >= (int)(b); i--) #define sf(n) scanf("%lld", &n) #define sfc(x) scanf("%c", &x) #define pf(x) printf("%lld", x) #define pff(x) printf("%lf", x) #define pfc(x) printf("%c", x) #define pfs(x) printf("%s", x) #define sf2(a, b) scanf("%lld %lld", &a, &b) #define sf3(a, b, c) scanf("%lld %lld %lld", &a, &b, &c) #define pfn(n) printf("%lld\n", n) //#define pfs(n) printf("%lld ", n) #define ff first #define ss second #define mem(a, b) memset(a, b, sizeof(a)) #define sz size() #define ll long long #define all(c) (c).begin(), (c).end() #define fast \ ios_base::sync_with_stdio(0); \ cin.tie(NULL); \ cout.tie(NULL); const ll INF = 2e18; bool prime[100010]; void SieveOfEratosthenes(ll n) { memset(prime, true, sizeof(prime)); for (ll p = 2; p * p <= n; p++) { if (prime[p] == true) { for (ll i = p * p; i <= n; i += p) prime[i] = false; } } } ll power(ll x, ll y) { if (y == 0) return 1; else if (y % 2 == 0) return power(x, y / 2) * power(x, y / 2); else return x * power(x, y / 2) * power(x, y / 2); } ll power1(ll a, ll b) { ll res = 1; while (b) { if (b & 1) { res *= a; } a = a * a; b >>= 1; } return res; } ll mod_power(ll a, ll b, ll m) { ll res = 1; a %= m; while (b) { if (b & 1) { res = res * a % m; } a = a * a % m; b >>= 1; } return res; } ll printDivisors(ll n) { ll count = 0; for (ll i = 1; i <= sqrt(n); i++) { if (n % i == 0) { if (n / i == i) count++; else // Otherwise print both printf("%d %d ", i, n / i); } } } bool isPrime(int n) { if (n <= 1) return false; if (n <= 3) return true; if (n % 2 == 0 || n % 3 == 0) return false; for (int i = 5; i * i <= n; i = i + 6) if (n % i == 0 || n % (i + 2) == 0) return false; return true; } ll par[1000001]; ll ranki[1000001] = {0}; ll find(ll x) { if (par[x] != x) { par[x] = find(par[x]); } return par[x]; } void unionset(ll x, ll y) { ll xr = find(x); ll yr = find(y); if (ranki[xr] > ranki[yr]) { par[yr] = xr; } else if (ranki[xr] < ranki[yr]) { par[xr] = yr; } else { par[yr] = xr; ranki[xr]++; } } // vector<pii> v[10001]; // ll vis[10001]={0}; // ll dis[10001]; // void dijkstra(){ // FOR0(i,10001)dis[i]=1e18; // multiset<pii > s; // s.insert({0,1}); // dis[1]=0; // while(!s.empty()){ // pii up = *s.begin(); // ll u=up.ss; // s.erase(s.begin()); // if(vis[u])continue; // vis[u]=1; // FOR0(i,v[u].size()){ // ll e = v[u][i].ff,w=v[u][i].ss; // if(dis[u]+w<dis[e]){ // dis[e]=dis[u]+w; // s.insert({dis[e],e}); // } // } // } // } // void dijkstra(ll s){ // FOR0(i,10001)dis[i]=INF; // dis[s] = 0; // priority_queue<pii , vpii , greater<pii >> pq; // //priority_queue<pair<int, int>, vector<pair<int, int>>, // greater<pair<int, int>>> q; pq.push({0, s}); while(!pq.empty()) // { // int u = pq.top().ss; // //int d = pq.top().first; // pq.pop(); // if(vis[u]) continue; // vis[u] = 1; // for(auto it: v[u]) // { // int e = it.ff; // int w = it.ss; // if(dis[u] + w < dis[e]) // { // dis[e] = dis[u] + w; // pq.push({dis[e], e}); // } // } // } // } // void dfs1(ll s,ll count){ // vis[s]=1; // //val[s]=count; // FOR0(i,v[s].size()){ // if(!vis[v[s][i]]){ // dfs1(v[s][i],count); // } // } // } // void dfs(ll s){ // stack<ll> st; // st.push(s); // vis[s]=1; // while(!st.empty()){ // ll u = st.top(); // st.pop(); // FOR0(i,v[u].size()){ // if(!vis[v[u][i]]){ // st.push(v[u][i]); // vis[v[u][i]]=1; // } // } // } // } // ll bs(){ // ll l,h,mid; // while(l<=h){ // mid = (l+h)/2; // if(a[mid]==x)return mid; // else if(x>a[mid]){ // l = mid+1; // } // else if(x<a[mid]){ // h = mid-1; // } // } // } // ll lbs(){ // ll l,h,mid; // while(l<h){ // mid = (l+h)/2; // if(x<=a[mid]){ // h = mid; // } // else{ // l = mid-1; // } // } // if(a[l]==x)return l; // else return -1; // } // ll ubs(){ // ll l,h,mid; // while(l<h){ // mid = (l+h)/2; // if(a[mid]<=x)l = mid; // else{ // h = mid-1; // } // } // if(a[h]==x)return h; // else return -1; // } int main() { fast string s; cin >> s; ll freq[26] = {0}; FOR0(i, s.length()) freq[s[i] - 'A']++; ll count = 0, count1 = 0; FOR0(i, 26) { if (freq[i] > 0) count++; if (freq[i] == 2) count1++; } if (count == 2 && count1 == 2) cout << "Yes\n"; else cout << "No\n"; }
[ "literal.string.change", "literal.string.case.change", "variable_access.subscript.index.change", "expression.operation.binary.change" ]
795,275
795,276
u729778766
cpp
p02987
#include <bits/stdc++.h> using namespace std; map<char, int> cnt; int main() { string S; cin >> S; for (int i = 0; i < 4; i++) cnt[S[i]]++; if (cnt[S[0]] == 2 && cnt[S[1]] == 2 && cnt[S[2]] == 2 && cnt[S[3]] == 2) cout << "YES\n"; else cout << "NO\n"; return 0; }
#include <bits/stdc++.h> using namespace std; map<char, int> cnt; int main() { string S; cin >> S; for (int i = 0; i < 4; i++) cnt[S[i]]++; if (cnt[S[0]] == 2 && cnt[S[1]] == 2 && cnt[S[2]] == 2 && cnt[S[3]] == 2) cout << "Yes\n"; else cout << "No\n"; return 0; }
[ "literal.string.change", "literal.string.case.change", "io.output.change" ]
795,277
795,278
u538921909
cpp
p02987
#include <bits/stdc++.h> using namespace std; #define ff first #define ss second using ll = long long; using ld = long double; const char nl = '\n'; /* -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- * -*- -*- -*- -*- */ #include <bits/extc++.h> namespace pbds = __gnu_pbds; template <typename key, typename val = pbds::null_type, typename comp = less<key>> using ostree = pbds::tree<key, val, comp, pbds::rb_tree_tag, pbds::tree_order_statistics_node_update>; using vi = vector<int>; using vll = vector<ll>; #define all(x) std::begin(x), std::end(x) mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); template <typename... Args, template <typename...> typename T> string to_string(T<Args...> const &); string to_string(string const &s) { return '"' + s + '"'; } string to_string(char const &c) { return to_string(string(1, c)); } string to_string(char const *c) { return to_string(string(c)); } string to_string(bool const &b) { return (b ? "1" : "0"); } template <typename... Args> string to_string(pair<Args...> const &p) { return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; } template <typename... Args, template <typename...> typename T> string to_string(T<Args...> const &S) { string s = "{"; for (auto const &e : S) s += " " + to_string(e); s += " }"; return s; } template <typename Tail> void debug_out(Tail t) { cerr << " " << to_string(t) << " ]" << endl; } template <typename Head, typename... Tail> void debug_out(Head h, Tail... t) { cerr << " " << to_string(h) << ","; debug_out(t...); } #define pr(...) cerr << "[" << (#__VA_ARGS__) << "] : [", debug_out(__VA_ARGS__) template <typename T> void dbr(T lb, T ub) { cerr << '{'; for (auto it = lb; it != ub; it++) cerr << ' ' << to_string(*it); cerr << " }" << endl; } template <typename T, typename Comp = less<T>> bool smin(T &mem, T const &v, Comp const &cmp = Comp()) { return cmp(v, mem) ? mem = v, true : false; } template <typename T, typename Comp = less<T>> bool smax(T &mem, T const &v, Comp const &cmp = Comp()) { return cmp(mem, v) ? mem = v, true : false; } /* -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- * -*- -*- -*- -*- */ int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); string s; cin >> s; sort(all(s)); cout << (s[0] == s[1] and s[2] == s[3] and s[1] != s[2] ? "YES" : "NO") << endl; } /* -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- * -*- -*- -*- -*- */
#include <bits/stdc++.h> using namespace std; #define ff first #define ss second using ll = long long; using ld = long double; const char nl = '\n'; /* -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- * -*- -*- -*- -*- */ #include <bits/extc++.h> namespace pbds = __gnu_pbds; template <typename key, typename val = pbds::null_type, typename comp = less<key>> using ostree = pbds::tree<key, val, comp, pbds::rb_tree_tag, pbds::tree_order_statistics_node_update>; using vi = vector<int>; using vll = vector<ll>; #define all(x) std::begin(x), std::end(x) mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); template <typename... Args, template <typename...> typename T> string to_string(T<Args...> const &); string to_string(string const &s) { return '"' + s + '"'; } string to_string(char const &c) { return to_string(string(1, c)); } string to_string(char const *c) { return to_string(string(c)); } string to_string(bool const &b) { return (b ? "1" : "0"); } template <typename... Args> string to_string(pair<Args...> const &p) { return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; } template <typename... Args, template <typename...> typename T> string to_string(T<Args...> const &S) { string s = "{"; for (auto const &e : S) s += " " + to_string(e); s += " }"; return s; } template <typename Tail> void debug_out(Tail t) { cerr << " " << to_string(t) << " ]" << endl; } template <typename Head, typename... Tail> void debug_out(Head h, Tail... t) { cerr << " " << to_string(h) << ","; debug_out(t...); } #define pr(...) cerr << "[" << (#__VA_ARGS__) << "] : [", debug_out(__VA_ARGS__) template <typename T> void dbr(T lb, T ub) { cerr << '{'; for (auto it = lb; it != ub; it++) cerr << ' ' << to_string(*it); cerr << " }" << endl; } template <typename T, typename Comp = less<T>> bool smin(T &mem, T const &v, Comp const &cmp = Comp()) { return cmp(v, mem) ? mem = v, true : false; } template <typename T, typename Comp = less<T>> bool smax(T &mem, T const &v, Comp const &cmp = Comp()) { return cmp(mem, v) ? mem = v, true : false; } /* -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- * -*- -*- -*- -*- */ int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); string s; cin >> s; sort(all(s)); cout << (s[0] == s[1] and s[2] == s[3] and s[1] != s[2] ? "Yes" : "No") << endl; } /* -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- * -*- -*- -*- -*- */
[ "literal.string.change", "literal.string.case.change", "io.output.change" ]
795,281
795,282
u268245868
cpp
p02987
#include <assert.h> #include <bits/stdc++.h> #include <time.h> using namespace std; #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; // s.order_of_key(x); // gives order of x in the set #define For(i, x, n) for (long long i = x; i < n; i++) #define rFor(i, x, n) for (long long i = x; i >= n; i--) #define itFor(it, st) for (auto it = st.begin(); it != st.end(); it++) #define MOD 1000000007 #define PI 3.141592653589793 #define INF 999999999999999999 #define N 1000005 #define ll long long #define ld long double #define pb push_back #define mp make_pair #define fi first #define se second #define sp " " #define cont continue #define brk break #define deb1(x) cout << #x << ": " << x << endl #define deb2(x, y) cout << #x << ": " << x << " | " << #y << ": " << y << endl #define deb3(x, y, z) \ cout << #x << ":" << x << " | " << #y << ": " << y << " | " << #z << ": " \ << z << endl #define deb4(a, b, c, d) \ cout << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " \ << c << " | " << #d << ": " << d << endl #define deb5(a, b, c, d, e) \ cout << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " \ << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl #define deb6(a, b, c, d, e, f) \ cout << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " \ << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " \ << #f << ": " << f << endl using namespace std; void setprime(ll n = 15000002); ll choose(ll n, ll k); void showArray(ll a[], ll n); ll gcd(ll a, ll b); ld len(ld x1, ld y1, ld x2, ld y2); ld gcd_ld(ld x, ld y); ll power(ll x, ll n); ll power1(ll x, ll n); int main() { cin.tie(0); cout.tie(0); ios::sync_with_stdio(0); cout << fixed; cout << setprecision(3); srand(time(NULL)); string s; cin >> s; map<char, ll> h; For(i, 0, 4) h[s[i]]++; if (h.size() == 2) { ll cnt = 0; itFor(it, h) { if (it->second == 2) cnt++; } if (cnt == 2) { cout << "YES"; return 0; } } cout << "NO"; return 0; // cout<<"\nTime used = // "<<static_cast<double>(clock())/(CLOCKS_PER_SEC)<<"s"<<endl; // - for // checking time used for a test case return 0; } // s1.substr(1,3) - return 3 characters starting from position 1 as substring of // string sz1. eg sz1="shreynumh" sz1.substr(2,5)="reyan" num = atoi(s.c_str()); // //convert string s to integer num n.erase(i,std::string::npos); //erase i th // position in string n , decreasing string size s.find(b)!= std::string::npos - // finds string b in string a - true if found cout<<"Time used = // "<<static_cast<double>(clock())/(CLOCKS_PER_SEC)<<"s"<<endl; // - for // checking time used for a test case void setprime(ll isprime[], ll n, ll cc = 0) { isprime[1] = 1; map<ll, ll> hm; ll i; for (i = 2; i * i <= 15000002; i++) if (isprime[i] == 0) { for (ll j = 2 * i; j <= 15000001; j += i) if (isprime[j] == 0) isprime[j] = i; isprime[i] = i; hm[i] = cc; cc++; } for (; i < 15000002; i++) if (isprime[i] == 0) isprime[i] = i, hm[i] = cc, cc++; } ll choose(ll n, ll k) { if (k == 0) return 1; return (n * choose(n - 1, k - 1)) / k; } void showArray(ll a[], ll n) { For(i, 0, n) { cout << a[i] << " "; } cout << endl; } ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); } ld len(ld x1, ld y1, ld x2, ld y2) { return sqrt(pow((x1 - x2), 2) + pow((y1 - y2), 2)); } ld gcd_ld(ld x, ld y) { ld eps = 0.0001; while (fabs(x) > eps && fabs(y) > eps) { if (x > y) x -= floor(x / y) * y; else y -= floor(y / x) * x; } return x + y; } ll power(ll x, ll n) { if (n == 0) return 1; else if (n % 2 == 0) // n is even return (power((x * x) % MOD, n / 2)) % MOD; else // n is bal return (x * power((x * x) % MOD, (n - 1) / 2)) % MOD; } ll power1(ll x, ll n) { ll num = 1; For(i, 0, n) { num = (num * x) % MOD; } return num; }
#include <assert.h> #include <bits/stdc++.h> #include <time.h> using namespace std; #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; // s.order_of_key(x); // gives order of x in the set #define For(i, x, n) for (long long i = x; i < n; i++) #define rFor(i, x, n) for (long long i = x; i >= n; i--) #define itFor(it, st) for (auto it = st.begin(); it != st.end(); it++) #define MOD 1000000007 #define PI 3.141592653589793 #define INF 999999999999999999 #define N 1000005 #define ll long long #define ld long double #define pb push_back #define mp make_pair #define fi first #define se second #define sp " " #define cont continue #define brk break #define deb1(x) cout << #x << ": " << x << endl #define deb2(x, y) cout << #x << ": " << x << " | " << #y << ": " << y << endl #define deb3(x, y, z) \ cout << #x << ":" << x << " | " << #y << ": " << y << " | " << #z << ": " \ << z << endl #define deb4(a, b, c, d) \ cout << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " \ << c << " | " << #d << ": " << d << endl #define deb5(a, b, c, d, e) \ cout << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " \ << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl #define deb6(a, b, c, d, e, f) \ cout << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " \ << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " \ << #f << ": " << f << endl using namespace std; void setprime(ll n = 15000002); ll choose(ll n, ll k); void showArray(ll a[], ll n); ll gcd(ll a, ll b); ld len(ld x1, ld y1, ld x2, ld y2); ld gcd_ld(ld x, ld y); ll power(ll x, ll n); ll power1(ll x, ll n); int main() { cin.tie(0); cout.tie(0); ios::sync_with_stdio(0); cout << fixed; cout << setprecision(3); srand(time(NULL)); string s; cin >> s; map<char, ll> h; For(i, 0, 4) h[s[i]]++; if (h.size() == 2) { ll cnt = 0; itFor(it, h) { if (it->second == 2) cnt++; } if (cnt == 2) { cout << "Yes"; return 0; } } cout << "No"; return 0; // cout<<"\nTime used = // "<<static_cast<double>(clock())/(CLOCKS_PER_SEC)<<"s"<<endl; // - for // checking time used for a test case return 0; } // s1.substr(1,3) - return 3 characters starting from position 1 as substring of // string sz1. eg sz1="shreynumh" sz1.substr(2,5)="reyan" num = atoi(s.c_str()); // //convert string s to integer num n.erase(i,std::string::npos); //erase i th // position in string n , decreasing string size s.find(b)!= std::string::npos - // finds string b in string a - true if found cout<<"Time used = // "<<static_cast<double>(clock())/(CLOCKS_PER_SEC)<<"s"<<endl; // - for // checking time used for a test case void setprime(ll isprime[], ll n, ll cc = 0) { isprime[1] = 1; map<ll, ll> hm; ll i; for (i = 2; i * i <= 15000002; i++) if (isprime[i] == 0) { for (ll j = 2 * i; j <= 15000001; j += i) if (isprime[j] == 0) isprime[j] = i; isprime[i] = i; hm[i] = cc; cc++; } for (; i < 15000002; i++) if (isprime[i] == 0) isprime[i] = i, hm[i] = cc, cc++; } ll choose(ll n, ll k) { if (k == 0) return 1; return (n * choose(n - 1, k - 1)) / k; } void showArray(ll a[], ll n) { For(i, 0, n) { cout << a[i] << " "; } cout << endl; } ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); } ld len(ld x1, ld y1, ld x2, ld y2) { return sqrt(pow((x1 - x2), 2) + pow((y1 - y2), 2)); } ld gcd_ld(ld x, ld y) { ld eps = 0.0001; while (fabs(x) > eps && fabs(y) > eps) { if (x > y) x -= floor(x / y) * y; else y -= floor(y / x) * x; } return x + y; } ll power(ll x, ll n) { if (n == 0) return 1; else if (n % 2 == 0) // n is even return (power((x * x) % MOD, n / 2)) % MOD; else // n is bal return (x * power((x * x) % MOD, (n - 1) / 2)) % MOD; } ll power1(ll x, ll n) { ll num = 1; For(i, 0, n) { num = (num * x) % MOD; } return num; }
[ "literal.string.change", "literal.string.case.change", "io.output.change" ]
795,283
795,284
u375267383
cpp
p02987
#include <algorithm> #include <deque> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string.h> #include <string> #include <unordered_set> #include <vector> #define mod 998244353 using namespace std; struct str { int idx, cnt; }; int n, m, k, arr[300010]; string s, temp; map<char, int> mp; bool chk[30]; int main() { cin >> s; int cnt = 0; for (int i = 0; i < s.size(); i++) { mp[s[i]]++; } if (mp.size() == 2) { for (auto i = mp.begin(); i != mp.end(); i++) { if (i->second != 2) { printf("NO"); return 0; } } printf("YES"); return 0; } printf("NO"); return 0; }
#include <algorithm> #include <deque> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string.h> #include <string> #include <unordered_set> #include <vector> #define mod 998244353 using namespace std; struct str { int idx, cnt; }; int n, m, k, arr[300010]; string s, temp; map<char, int> mp; bool chk[30]; int main() { cin >> s; int cnt = 0; for (int i = 0; i < s.size(); i++) { mp[s[i]]++; } if (mp.size() == 2) { for (auto i = mp.begin(); i != mp.end(); i++) { if (i->second != 2) { printf("No"); return 0; } } printf("Yes"); return 0; } else printf("No"); return 0; }
[ "literal.string.change", "literal.string.case.change", "call.arguments.change", "io.output.change", "control_flow.branch.else_if.replace.remove", "control_flow.branch.if.replace.add" ]
795,287
795,288
u590012868
cpp
p02987
#include <algorithm> #include <forward_list> #include <iostream> #include <math.h> #include <numeric> #include <queue> #include <stdlib.h> #include <string> #include <vector> #define mod 1000000007 using namespace std; int main() { string S; cin >> S; for (int i = 0; i < 4; i++) { int count = 0; for (int j = 0; j < 4; j++) { if (S[i] == S[j]) count++; } if (count == 2) ; else break; if (i == 3) { cout << "YES" << endl; return 0; } } cout << "NO"; }
#include <algorithm> #include <forward_list> #include <iostream> #include <math.h> #include <numeric> #include <queue> #include <stdlib.h> #include <string> #include <vector> #define mod 1000000007 using namespace std; int main() { string S; cin >> S; for (int i = 0; i < 4; i++) { int count = 0; for (int j = 0; j < 4; j++) { if (S[i] == S[j]) count++; } if (count == 2) ; else break; if (i == 3) { cout << "Yes" << endl; return 0; } } cout << "No"; }
[ "literal.string.change", "literal.string.case.change", "io.output.change" ]
795,289
795,290
u998203751
cpp
p02987
#include <bits/stdc++.h> #define rb(a, b, c) for (int a = b; a <= c; a++) #define rl(a, b, c) for (int a = b; a >= c; a--) #define niv vector<int> #define LL long long #define IT iterator #define PB(a) push_back(a) #define II(a, b) make_pair(a, b) #define FIR first #define SEC second using namespace std; const int INF = 0x3f3f3f3f; typedef pair<int, int> mp; typedef pair<mp, mp> superpair; int main() { string s; cin >> s; map<char, int> M; rb(i, 0, 3) { M[s[i]]++; } map<char, int>::IT ite = M.begin(); for (ite; ite != M.end(); ite++) { if (ite->SEC != 2) { cout << "No"; return 0; } } cout << "Yse"; return 0; }
#include <bits/stdc++.h> #define rb(a, b, c) for (int a = b; a <= c; a++) #define rl(a, b, c) for (int a = b; a >= c; a--) #define niv vector<int> #define LL long long #define IT iterator #define PB(a) push_back(a) #define II(a, b) make_pair(a, b) #define FIR first #define SEC second using namespace std; const int INF = 0x3f3f3f3f; typedef pair<int, int> mp; typedef pair<mp, mp> superpair; int main() { string s; cin >> s; map<char, int> M; rb(i, 0, 3) { M[s[i]]++; } map<char, int>::IT ite = M.begin(); for (ite; ite != M.end(); ite++) { if (ite->SEC != 2) { cout << "No"; return 0; } } cout << "Yes"; return 0; }
[ "literal.string.change", "io.output.change" ]
795,291
795,292
u751730221
cpp
p02987
#include "bits/stdc++.h" using namespace std; string a; int main() { cin >> a; sort(a.begin(), a.end()); if (a[0] == a[1] and a[2] == a[3] and a[1] != a[2]) cout << "YES"; else cout << "NO"; }
#include "bits/stdc++.h" using namespace std; string a; int main() { cin >> a; sort(a.begin(), a.end()); if (a[0] == a[1] and a[2] == a[3] and a[1] != a[2]) cout << "Yes"; else cout << "No"; }
[ "literal.string.change", "literal.string.case.change", "io.output.change" ]
795,293
795,294
u325959156
cpp
p02987
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < (int)n; i++) #define MOD 1000000009 using namespace std; typedef long long ll; int main() { string str; cin >> str; if (str[0] == str[1]) { if (str[0] != str[2] && str[2] == str[3]) cout << "Yes" << endl; return 0; } if (str[0] == str[2]) { if (str[0] != str[1] && str[1] == str[3]) cout << "Yes" << endl; return 0; } if (str[0] == str[3]) { if (str[0] != str[1] && str[1] == str[2]) cout << "Yes" << endl; return 0; } cout << "No" << endl; }
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < (int)n; i++) #define MOD 1000000009 using namespace std; typedef long long ll; int main() { string str; cin >> str; if (str[0] == str[1]) { if (str[0] != str[2] && str[2] == str[3]) { cout << "Yes" << endl; return 0; } } if (str[0] == str[2]) { if (str[0] != str[1] && str[1] == str[3]) { cout << "Yes" << endl; return 0; } } if (str[0] == str[3]) { if (str[0] != str[1] && str[1] == str[2]) { cout << "Yes" << endl; return 0; } } cout << "No" << endl; }
[]
795,295
795,296
u138062788
cpp
p02987
#include <iostream> #include <string> using namespace std; int main() { string S; cin >> S; if (S[0] == S[1] && S[2] == S[3] && S[0] != S[2]) { cout << "Yes" << endl; } else if (S[0] == S[2] && S[1] == S[3] && S[0] != S[1]) { cout << "Yes" << endl; } else if (S[0] == S[4] && S[1] == S[2] && S[0] != S[1]) { cout << "Yes" << endl; } else { cout << "No" << endl; } return 0; }
#include <iostream> #include <string> using namespace std; int main() { string S; cin >> S; if (S[0] == S[1] && S[2] == S[3] && S[0] != S[2]) { cout << "Yes" << endl; } else if (S[0] == S[2] && S[1] == S[3] && S[0] != S[1]) { cout << "Yes" << endl; } else if (S[0] == S[3] && S[1] == S[2] && S[0] != S[1]) { cout << "Yes" << endl; } else { cout << "No" << endl; } return 0; }
[ "literal.number.change", "variable_access.subscript.index.change", "control_flow.branch.if.condition.change" ]
795,297
795,298
u904123392
cpp
p02987
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef unsigned long long int ull; typedef long double ld; typedef pair<ll, ll> pll; typedef pair<int, int> pii; #define pb push_back #define mp make_pair #define ff first #define ss second #define all(a) a.begin(), a.end() #define sz(a) (ll)(a.size()) #define endl "\n" ll gcd(ll a, ll b) { if (b == 0) { return a; } return gcd(b, a % b); } const ll L = 1e5 + 5; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); string s; cin >> s; if (s[0] == s[1]) { if (s[0] != s[2] && s[2] == s[3]) { cout << "YES" << endl; return 0; } } else if (s[0] == s[2]) { if (s[0] != s[1] && s[1] == s[3]) { cout << "YES" << endl; return 0; } } else if (s[0] == s[3]) { if (s[0] != s[1] && s[1] == s[2]) { cout << "YES" << endl; return 0; } } cout << "NO" << endl; return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef unsigned long long int ull; typedef long double ld; typedef pair<ll, ll> pll; typedef pair<int, int> pii; #define pb push_back #define mp make_pair #define ff first #define ss second #define all(a) a.begin(), a.end() #define sz(a) (ll)(a.size()) #define endl "\n" ll gcd(ll a, ll b) { if (b == 0) { return a; } return gcd(b, a % b); } const ll L = 1e5 + 5; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); string s; cin >> s; if (s[0] == s[1]) { if (s[0] != s[2] && s[2] == s[3]) { cout << "Yes" << endl; return 0; } } else if (s[0] == s[2]) { if (s[0] != s[1] && s[1] == s[3]) { cout << "Yes" << endl; return 0; } } else if (s[0] == s[3]) { if (s[0] != s[1] && s[1] == s[2]) { cout << "Yes" << endl; return 0; } } cout << "No" << endl; return 0; }
[ "literal.string.change", "literal.string.case.change", "io.output.change" ]
795,305
795,306
u616547520
cpp
p02987
#include <bits/stdc++.h> using namespace std; #define int long long #define pb emplace_back #define f(i, n) for (int i = 0; i < n; i++) #define F first #define S second #define fast ios::sync_with_stdio(false), cin.tie(0); int32_t main() { fast; string s; sort(s.begin(), s.end()); if (s[0] == s[1] && s[2] == s[3] && s[1] != s[2]) cout << "Yes"; else cout << "No"; }
#include <bits/stdc++.h> using namespace std; #define int long long #define pb emplace_back #define f(i, n) for (int i = 0; i < n; i++) #define F first #define S second #define fast ios::sync_with_stdio(false), cin.tie(0); int32_t main() { fast; string s; cin >> s; sort(s.begin(), s.end()); if (s[0] == s[1] && s[2] == s[3] && s[1] != s[2]) cout << "Yes"; else cout << "No"; }
[]
795,312
795,313
u670919462
cpp
p02987
#include <algorithm> #include <iomanip> #include <iostream> #include <string> #include <vector> using namespace std; typedef long long ll; typedef pair<int, int> P; int main() { ios::sync_with_stdio(false); cin.tie(0); string s; cin >> s; char a = s[0], b = s[1], c = s[2], d = s[3]; if ((a == b && c == d) || (a == c && b == d) || (a == d && b == c)) { if (a == b && b == c && c == d && d == a) { cout << "NO\n"; } else { cout << "YES\n"; } } else { cout << "NO\n"; } return 0; }
#include <algorithm> #include <iomanip> #include <iostream> #include <string> #include <vector> using namespace std; typedef long long ll; typedef pair<int, int> P; int main() { ios::sync_with_stdio(false); cin.tie(0); string s; cin >> s; char a = s[0], b = s[1], c = s[2], d = s[3]; if ((a == b && c == d) || (a == c && b == d) || (a == d && b == c)) { if (a == b && b == c && c == d && d == a) { cout << "No\n"; } else { cout << "Yes\n"; } } else { cout << "No\n"; } return 0; }
[ "literal.string.change", "literal.string.case.change", "io.output.change" ]
795,316
795,317
u019356802
cpp
p02987
#include <algorithm> #include <cmath> #include <iostream> #include <string> #define INF 10e10 using namespace std; // #define y cout << "yes"<< endl #define Y cout << "YES" << endl #define y cout << "Yes" << endl // #define n cout << "no"<< endl #define N cout << "NO" << endl #define n cout << "No" << endl #define pu(q) cout << q; #define put(q) cout << q << " "; #define puts(q) cout << q << endl; // int a,b,c,d,e,f,g,h,ans,res; // char a,b,c,d,e,f,g,h,ans,res; string a, b, c, d, e, f, g, h, ans, res; // double a,b,c,d,e,f,g,h,ans,res; void take(int x); int main(void) { take(1); //数 if (((a[0] == a[1] && a[2] == a[3]) && a[0] != a[2]) || ((a[0] == a[2] && a[1] == a[3]) && a[0] != a[1])) { // y; //Yes Y; // YES // n; //No // N; //NO } else if (((a[0] == a[3] && a[1] == a[2]) && a[0] != a[1])) { // y; Y; // n; // N; } /* else if(){ // y; // Y; // n; // N; } else if(){ // y; // Y; // n; // N; } */ else { // y; // Y; // n; N; } return 0; } void take(int x) { if (x == 1) cin >> a; else if (x == 2) cin >> a >> b; else if (x == 3) cin >> a >> b >> c; else if (x == 4) cin >> a >> b >> c >> d; else if (x == 5) cin >> a >> b >> c >> d >> e; else if (x == 6) cin >> a >> b >> c >> d >> e >> f; else if (x == 7) cin >> a >> b >> c >> d >> e >> f >> g; else if (x == 8) cin >> a >> b >> c >> d >> e >> f >> g >> h; return; }
#include <algorithm> #include <cmath> #include <iostream> #include <string> #define INF 10e10 using namespace std; // #define y cout << "yes"<< endl #define Y cout << "YES" << endl #define y cout << "Yes" << endl // #define n cout << "no"<< endl #define N cout << "NO" << endl #define n cout << "No" << endl #define pu(q) cout << q; #define put(q) cout << q << " "; #define puts(q) cout << q << endl; // int a,b,c,d,e,f,g,h,ans,res; // char a,b,c,d,e,f,g,h,ans,res; string a, b, c, d, e, f, g, h, ans, res; // double a,b,c,d,e,f,g,h,ans,res; void take(int x); int main(void) { take(1); //数 if (((a[0] == a[1] && a[2] == a[3]) && a[0] != a[2]) || ((a[0] == a[2] && a[1] == a[3]) && a[0] != a[1])) { y; // Yes // Y; //YES // n; //No // N; //NO } else if (((a[0] == a[3] && a[1] == a[2]) && a[0] != a[1])) { y; // Y; // n; // N; } /* else if(){ // y; // Y; // n; // N; } else if(){ // y; // Y; // n; // N; } */ else { // y; // Y; n; // N; } return 0; } void take(int x) { if (x == 1) cin >> a; else if (x == 2) cin >> a >> b; else if (x == 3) cin >> a >> b >> c; else if (x == 4) cin >> a >> b >> c >> d; else if (x == 5) cin >> a >> b >> c >> d >> e; else if (x == 6) cin >> a >> b >> c >> d >> e >> f; else if (x == 7) cin >> a >> b >> c >> d >> e >> f >> g; else if (x == 8) cin >> a >> b >> c >> d >> e >> f >> g >> h; return; }
[ "identifier.change" ]
795,320
795,321
u174265495
cpp
p02987
#include <bits/stdc++.h> // CLOCKS_PER_SEC #define se second #define fi first #define ll long long #define Pii pair<int, int> #define Pli pair<ll, int> #define ull unsigned long long #define pb push_back #define ALL(x) x.begin(), x.end() #define fio \ ios::sync_with_stdio(false); \ cin.tie(0); #define db double #define mk make_pair const double Pi = 3.14159265; const int N = 2e5 + 10; const int M = 2e5 + 10; const ull base = 163; const int INF = 0x3f3f3f3f; const int mod = 1e9 + 7; const db eps = 1e-8; const db pi = acos(-1); using namespace std; int a[40]; int main() { string s; cin >> s; for (int i = 0; i < 4; ++i) { a[s[i] - 'A'] += 1; } int tot = 0; for (int i = 0; i < 26; ++i) { if (a[i]) tot++; } if (tot <= 2) puts("Yes"); else puts("No"); return 0; }
#include <bits/stdc++.h> // CLOCKS_PER_SEC #define se second #define fi first #define ll long long #define Pii pair<int, int> #define Pli pair<ll, int> #define ull unsigned long long #define pb push_back #define ALL(x) x.begin(), x.end() #define fio \ ios::sync_with_stdio(false); \ cin.tie(0); #define db double #define mk make_pair const double Pi = 3.14159265; const int N = 2e5 + 10; const int M = 2e5 + 10; const ull base = 163; const int INF = 0x3f3f3f3f; const int mod = 1e9 + 7; const db eps = 1e-8; const db pi = acos(-1); using namespace std; int a[40]; int main() { string s; cin >> s; for (int i = 0; i < 4; ++i) { a[s[i] - 'A'] += 1; } int tot = 0; for (int i = 0; i < 26; ++i) { if (a[i] == 2) tot++; } if (tot == 2) puts("Yes"); else puts("No"); return 0; }
[ "control_flow.branch.if.condition.change", "control_flow.loop.for.condition.change", "expression.operator.compare.change" ]
795,322
795,323
u496707633
cpp
p02987
#include <bits/stdc++.h> #include <iostream> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); bool flag = true; string s; cin >> s; long int n = s.length(), count = 0; long int hash[128] = {0}; for (long int i = 0; i < n; i++) { if (hash[s[i]] == 0) count++; hash[s[i]]++; } for (long int i = 0; i < n; i++) { if (hash[s[i]] != 2) { flag = false; break; } } if (flag && count == 2) cout << "YES\n"; else cout << "NO\n"; }
#include <bits/stdc++.h> #include <iostream> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); bool flag = true; string s; cin >> s; long int n = s.length(), count = 0; long int hash[128] = {0}; for (long int i = 0; i < n; i++) { if (hash[s[i]] == 0) count++; hash[s[i]]++; } for (long int i = 0; i < n; i++) { if (hash[s[i]] != 2) { flag = false; break; } } if (flag && count == 2) cout << "Yes\n"; else cout << "No\n"; }
[ "literal.string.change", "literal.string.case.change", "io.output.change" ]
795,324
795,325
u442327849
cpp
p02987
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll MOD = 1e9 + 7; int main() { string a; cin >> a; int b[101]; memset(b, 0, sizeof(b)); for (int i = 0; i < 3; i++) { int c = a[i] - '0'; // cout<<c<<endl; b[c]++; } int cnt = 0; for (int i = 0; i < 101; i++) { if (b[i] != 0) cnt++; } if (cnt == 2) { cout << "Yes" << endl; } else { cout << "No" << endl; } }
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll MOD = 1e9 + 7; int main() { string a; cin >> a; int b[101]; memset(b, 0, sizeof(b)); for (int i = 0; i < 4; i++) { int c = a[i] - '0'; // cout<<c<<endl; b[c]++; } int cnt = 0; for (int i = 0; i < 101; i++) { if (b[i] == 2) cnt++; } if (cnt == 2) { cout << "Yes" << endl; } else { cout << "No" << endl; } }
[ "literal.number.change", "control_flow.loop.for.condition.change", "expression.off_by_one", "expression.operation.binary.change" ]
795,330
795,331
u876784108
cpp
p02987
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) #define REPP(i, n) for (int i = 1; i <= n; i++) const double PI = acos(-1); const double EPS = 1e-15; long long INF = LLONG_MAX; #define i_7 (long long)(1E9 + 7) long mod(long a) { long long c = a % i_7; if (c >= 0) return c; return c + i_7; } using namespace std; bool prime(int n) { if (n == 1) { return false; } else if (n == 2) { return true; } else { for (int i = 2; i <= sqrt(n); i++) { if (n % i == 0) { return false; } } return true; } } long long gcd(long long a, long long b) { if (a < b) { swap(a, b); } if (a % b == 0) { return b; } else { return gcd(b, a % b); } } long long lcm(long long x, long long y) { return (x / gcd(x, y)) * y; } class UnionFind { public: //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。 vector<int> Parent; //クラスを作るときは、Parentの値を全て-1にする。 //以下のようにすると全てバラバラの頂点として解釈できる。 UnionFind(int N) { Parent = vector<int>(N, -1); } // Aがどのグループに属しているか調べる int root(int A) { if (Parent[A] < 0) return A; return Parent[A] = root(Parent[A]); } //自分のいるグループの頂点数を調べる int size(int A) { return -Parent[root(A)]; //先祖をrootで取っておきたい。 } // AとBをくっ付ける bool connect(int A, int B) { // AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける A = root(A); B = root(B); if (A == B) { //すでにくっついてるからくっ付けない return false; } //大きい方(A)に小さいほう(B)をくっ付けたい //大小が逆だったらAとBをひっくり返す。 if (size(A) < size(B)) swap(A, B); // Aのサイズを更新する Parent[A] += Parent[B]; // Bの親をAに変更する Parent[B] = A; return true; } }; int main() { string s; cin >> s; int cnt[26] = {}; REP(i, 4) { cnt[(int)(s[i] - 'a')]++; } int num = 0; REP(i, 26) { if (cnt[i] == 2) { num++; } } if (num == 2) { cout << "Yes" << endl; } else { cout << "No" << endl; } return 0; }
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) #define REPP(i, n) for (int i = 1; i <= n; i++) const double PI = acos(-1); const double EPS = 1e-15; long long INF = LLONG_MAX; #define i_7 (long long)(1E9 + 7) long mod(long a) { long long c = a % i_7; if (c >= 0) return c; return c + i_7; } using namespace std; bool prime(int n) { if (n == 1) { return false; } else if (n == 2) { return true; } else { for (int i = 2; i <= sqrt(n); i++) { if (n % i == 0) { return false; } } return true; } } long long gcd(long long a, long long b) { if (a < b) { swap(a, b); } if (a % b == 0) { return b; } else { return gcd(b, a % b); } } long long lcm(long long x, long long y) { return (x / gcd(x, y)) * y; } class UnionFind { public: //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。 vector<int> Parent; //クラスを作るときは、Parentの値を全て-1にする。 //以下のようにすると全てバラバラの頂点として解釈できる。 UnionFind(int N) { Parent = vector<int>(N, -1); } // Aがどのグループに属しているか調べる int root(int A) { if (Parent[A] < 0) return A; return Parent[A] = root(Parent[A]); } //自分のいるグループの頂点数を調べる int size(int A) { return -Parent[root(A)]; //先祖をrootで取っておきたい。 } // AとBをくっ付ける bool connect(int A, int B) { // AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける A = root(A); B = root(B); if (A == B) { //すでにくっついてるからくっ付けない return false; } //大きい方(A)に小さいほう(B)をくっ付けたい //大小が逆だったらAとBをひっくり返す。 if (size(A) < size(B)) swap(A, B); // Aのサイズを更新する Parent[A] += Parent[B]; // Bの親をAに変更する Parent[B] = A; return true; } }; int main() { string s; cin >> s; int cnt[26] = {}; REP(i, 4) { cnt[(int)(s[i] - 'A')]++; } int num = 0; REP(i, 26) { if (cnt[i] == 2) { num++; } } if (num == 2) { cout << "Yes" << endl; } else { cout << "No" << endl; } return 0; }
[ "literal.string.change", "literal.string.case.change", "variable_access.subscript.index.change", "expression.operation.binary.change" ]
795,332
795,333
u222293734
cpp
p02987
#include <bits/stdc++.h> using namespace std; #define ll long long #define mod 1000000007 int main() { ios::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL); string str; cin >> str; int ar[27] = {}; for (int i = 0; i < 4; i++) ar[str[i] - 'A']++; int h = 0; vector<int> v; for (int i = 0; i < 26; i++) if (ar[i]) { ++h; v.push_back(ar[i]); } if (h == 2) { if (v[0] == 2) { cout << "YES"; return 0; } } cout << "NO\n"; return 0; }
#include <bits/stdc++.h> using namespace std; #define ll long long #define mod 1000000007 int main() { ios::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL); string str; cin >> str; int ar[27] = {}; for (int i = 0; i < 4; i++) ar[str[i] - 'A']++; int h = 0; vector<int> v; for (int i = 0; i < 26; i++) if (ar[i]) { ++h; v.push_back(ar[i]); } if (h == 2) { if (v[0] == 2) { cout << "Yes"; return 0; } } cout << "No\n"; return 0; }
[ "literal.string.change", "literal.string.case.change", "io.output.change" ]
795,338
795,339
u972547684
cpp
p02987
#include <bits/stdc++.h> #define pb push_back #define mp make_pair #define ll long long int #define INF INT_MAX #define mod #define chutiyaap \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL) using namespace std; bool sortbysec(const pair<ll, ll> &a, const pair<ll, ll> &b) { return (a.second < b.second); } ll gcd(ll a, ll b) { if (a == 0) return b; return gcd(b % a, a); } int main() { chutiyaap; string s; cin >> s; sort(s.begin(), s.end()); if (s[0] == s[1] && s[2] == s[3] && s[1] != s[2]) cout << "YES"; else cout << "NO"; }
#include <bits/stdc++.h> #define pb push_back #define mp make_pair #define ll long long int #define INF INT_MAX #define mod #define chutiyaap \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL) using namespace std; bool sortbysec(const pair<ll, ll> &a, const pair<ll, ll> &b) { return (a.second < b.second); } ll gcd(ll a, ll b) { if (a == 0) return b; return gcd(b % a, a); } int main() { chutiyaap; string s; cin >> s; sort(s.begin(), s.end()); if (s[0] == s[1] && s[2] == s[3] && s[1] != s[2]) cout << "Yes"; else cout << "No"; }
[ "literal.string.change", "literal.string.case.change", "io.output.change" ]
795,340
795,341
u776675173
cpp
p02987
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; const int inf = 2147483647, dx[] = {-1, 0, 1, 0}, dy[] = {0, -1, 0, 1}; // 上 左 下 右 const int N = 100005, M = 1000005, mod = 1000000007; const long long llinf = 9223372036854775807ll; // int & long long string s; int a[30], x; int main() { cin >> s; for (int i = 0; i < s.size(); i++) a[s[i] - 'A']++; for (int i = 0; i < 26; i++) if (a[i] == 2) x++; if (x == 2) cout << "YES"; else cout << "NO"; return 0; }
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; const int inf = 2147483647, dx[] = {-1, 0, 1, 0}, dy[] = {0, -1, 0, 1}; // 上 左 下 右 const int N = 100005, M = 1000005, mod = 1000000007; const long long llinf = 9223372036854775807ll; // int & long long string s; int a[30], x; int main() { cin >> s; for (int i = 0; i < s.size(); i++) a[s[i] - 'A']++; for (int i = 0; i < 26; i++) if (a[i] == 2) x++; if (x == 2) cout << "Yes"; else cout << "No"; return 0; }
[ "literal.string.change", "literal.string.case.change", "io.output.change" ]
795,344
795,345
u965118468
cpp
p02987
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define bit(n) (1LL << (n)) #define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()); template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; } using namespace std; typedef long long ll; typedef pair<int, int> P; int main() { string s; cin >> s; map<char, int> m; for (int i = 0; i < s.size(); i++) { if (m.find(s[i]) == m.end()) m[s[i]] = 0; m[s[i]]++; } if (m.size() != 2) { cout << "No" << endl; return 0; } for (auto p : m) { if (p.second != 2) cout << "No" << endl; return 0; } cout << "Yes" << endl; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define bit(n) (1LL << (n)) #define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()); template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; } using namespace std; typedef long long ll; typedef pair<int, int> P; int main() { string s; cin >> s; map<char, int> m; for (int i = 0; i < s.size(); i++) { if (m.find(s[i]) == m.end()) m[s[i]] = 0; m[s[i]]++; } if (m.size() != 2) { cout << "No" << endl; return 0; } for (auto p : m) { if (p.second != 2) { cout << "No" << endl; return 0; } } cout << "Yes" << endl; }
[]
795,348
795,349
u746411953
cpp
p02987
#include "bits/stdc++.h" using namespace std; typedef long long ll; //#define int long long template <class T> bool INRANGE(T x, T a, T b) { return a <= x && x <= b; } template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return 1; } return 0; } template <class T> void printv(vector<T> v) { for (T t : v) { cout << t << " "; } cout << '\n'; } #define REP(i, n) for (int i = 0; i < (n); ++i) #define RREP(i, n) for (int i = (n); i >= 0; --i) #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define RFOR(i, a, b) for (int i = (a); i >= (b); --i) #define ALL(v) (v).begin(), (v).end() #define debug(x) \ cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \ << " " << __FILE__ << endl; typedef vector<int> vi; typedef vector<string> vs; typedef vector<vi> vvi; typedef pair<int, int> pii; int main() { cin.tie(0); ios::sync_with_stdio(false); string s; cin >> s; map<char, int> m; for (char c : s) { m[c]++; } if (m.size() == 2) cout << "Yse" << endl; else cout << "No" << endl; return 0; }
#include "bits/stdc++.h" using namespace std; typedef long long ll; //#define int long long template <class T> bool INRANGE(T x, T a, T b) { return a <= x && x <= b; } template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return 1; } return 0; } template <class T> void printv(vector<T> v) { for (T t : v) { cout << t << " "; } cout << '\n'; } #define REP(i, n) for (int i = 0; i < (n); ++i) #define RREP(i, n) for (int i = (n); i >= 0; --i) #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define RFOR(i, a, b) for (int i = (a); i >= (b); --i) #define ALL(v) (v).begin(), (v).end() #define debug(x) \ cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \ << " " << __FILE__ << endl; typedef vector<int> vi; typedef vector<string> vs; typedef vector<vi> vvi; typedef pair<int, int> pii; int main() { cin.tie(0); ios::sync_with_stdio(false); string s; cin >> s; map<char, int> m; for (char c : s) { m[c]++; } if (m.size() == 2) cout << "Yes" << endl; else cout << "No" << endl; return 0; }
[ "literal.string.change", "io.output.change" ]
795,352
795,353
u299377613
cpp
p02987
#include <algorithm> #include <iostream> using namespace std; int main() { char s[5]; cin >> s; sort(s, s + 4); if (s[0] == s[1] && s[2] == s[3] && s[0] != s[2]) cout << "yes" << endl; else cout << "no" << endl; return 0; }
#include <algorithm> #include <iostream> using namespace std; int main() { char s[5]; cin >> s; sort(s, s + 4); if (s[0] == s[1] && s[2] == s[3] && s[0] != s[2]) cout << "Yes" << endl; else cout << "No" << endl; return 0; }
[ "literal.string.change", "literal.string.case.change", "io.output.change" ]
795,363
795,364
u879726139
cpp
p02987
#include <bits/stdc++.h> using namespace std; string s; int num[30], k; int main() { cin >> s; int l = s.size(); for (int i = 0; i < l; i++) { num[s[i] - 'a']++; if (num[s[i] - 'a'] == 2) k++; } if (k == 2) puts("Yes"); else puts("No"); return 0; }
#include <bits/stdc++.h> using namespace std; string s; int num[30], k; int main() { cin >> s; int l = s.size(); for (int i = 0; i < l; i++) { num[s[i] - 'A']++; if (num[s[i] - 'A'] == 2) k++; } if (k == 2) puts("Yes"); else puts("No"); return 0; }
[ "literal.string.change", "literal.string.case.change", "variable_access.subscript.index.change", "expression.operation.binary.change", "control_flow.branch.if.condition.change" ]
795,365
795,366
u211255798
cpp
p02987
#include <bits/stdc++.h> using namespace std; // define #define str string #define rep(x, y) for (int i = x; i < y; i++) #define REP(x, y) for (int j = x; j < y; j++) #define all(x) x.begin(), x.end() #define elif else if // vectordefine #define vint vector<int> #define vc vector<char> #define vtr vector<string> #define pb(n) push_back(n) // queuedefine #define qint queue<int> #define qc queue<char> #define qstr queue<str> // mapdefine #define mint map<int> #define mc map<char> // pairdefine #define pint pair<int, int> #define pis pair<int, str> #define pic pair<int, char> #define pci pair<char, int> #define mod 100000007 // main signed main() { int N, M, O, P, count = 0, count2 = mod, count3 = 0, stack = 0; str S, T; double l, s; vint ST(4); rep(0, 4) { cin >> ST[i]; } sort(all(ST)); if (ST[0] == ST[1] && ST[2] == ST[3] && ST[0] != ST[3]) cout << "Yes" << endl; else cout << "No" << endl; }
#include <bits/stdc++.h> using namespace std; // define #define str string #define rep(x, y) for (int i = x; i < y; i++) #define REP(x, y) for (int j = x; j < y; j++) #define all(x) x.begin(), x.end() #define elif else if // vectordefine #define vint vector<int> #define vc vector<char> #define vtr vector<string> #define pb(n) push_back(n) // queuedefine #define qint queue<int> #define qc queue<char> #define qstr queue<str> // mapdefine #define mint map<int> #define mc map<char> // pairdefine #define pint pair<int, int> #define pis pair<int, str> #define pic pair<int, char> #define pci pair<char, int> #define mod 100000007 // main signed main() { int N, M, O, P, count = 0, count2 = mod, count3 = 0, stack = 0; str S, T; double l, s; vc ST(4); rep(0, 4) { cin >> ST[i]; } sort(all(ST)); if (ST[0] == ST[1] && ST[2] == ST[3] && ST[0] != ST[3]) cout << "Yes" << endl; else cout << "No" << endl; }
[ "variable_declaration.type.change" ]
795,367
795,368
u347579224
cpp
p02988
#define rep(i, n) for (int i = 0; i < (n); i++) #include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<int, int>; const int MOD = 1000000007; // MAX int 2,147,483,647 // MAX O(n) 10^18 int main() { int n; cin >> n; vector<int> p(n); rep(i, n) cin >> p.at(i); int count = 0; rep(i, n - 2) { if (p.at(i) < p.at(i + 1) && p.at(i + 1) < p.at(i + 2) || p.at(i + 2) < p.at(i) && p.at(i) < p.at(i + 1)) { count++; } } cout << count << endl; return 0; }
#define rep(i, n) for (int i = 0; i < (n); i++) #include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<int, int>; const int MOD = 1000000007; // MAX int 2,147,483,647 // MAX O(n) 10^18 int main() { int n; cin >> n; vector<int> p(n); rep(i, n) cin >> p.at(i); int count = 0; rep(i, n - 2) { if (p.at(i) < p.at(i + 1) && p.at(i + 1) < p.at(i + 2) || p.at(i + 2) < p.at(i + 1) && p.at(i + 1) < p.at(i)) { count++; } } cout << count << endl; return 0; }
[ "control_flow.branch.if.condition.change", "expression.operation.binary.remove" ]
795,375
795,376
u475280305
cpp
p02988
#define rep(i, n) for (int i = 0; i < (n); i++) #include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<int, int>; const int MOD = 1000000007; // MAX int 2,147,483,647 // MAX O(n) 10^18 int main() { int n; cin >> n; vector<int> p(n); rep(i, n) cin >> p.at(i); int count = 0; rep(i, n - 2) { if (p.at(i) < p.at(i + 1) || p.at(i + 1) < p.at(i + 2)) { count++; } else if (p.at(i + 2) < p.at(i + 1) || p.at(i + 1) < p.at(i)) { count++; } } cout << count << endl; return 0; }
#define rep(i, n) for (int i = 0; i < (n); i++) #include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<int, int>; const int MOD = 1000000007; // MAX int 2,147,483,647 // MAX O(n) 10^18 int main() { int n; cin >> n; vector<int> p(n); rep(i, n) cin >> p.at(i); int count = 0; rep(i, n - 2) { if (p.at(i) < p.at(i + 1) && p.at(i + 1) < p.at(i + 2)) { count++; } else if (p.at(i + 2) < p.at(i + 1) && p.at(i + 1) < p.at(i)) { count++; } } cout << count << endl; return 0; }
[ "misc.opposites", "control_flow.branch.if.condition.change" ]
795,377
795,378
u475280305
cpp
p02988
#include <algorithm> #include <cmath> #include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } int ans = 0; for (int i = 0; i < n - 1; i++) { if (a[i - 1] < a[i] && a[i] < a[i + 1]) { ans++; } else if (a[i - 1] > a[i] && a[i + 1] < a[i]) { ans++; } } cout << ans; }
#include <algorithm> #include <cmath> #include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } int ans = 0; for (int i = 1; i < n - 1; i++) { if (a[i - 1] < a[i] && a[i] < a[i + 1]) { ans++; } else if (a[i - 1] > a[i] && a[i + 1] < a[i]) { ans++; } } cout << ans; }
[ "literal.number.change", "variable_declaration.value.change", "control_flow.loop.for.initializer.change", "expression.off_by_one" ]
795,379
795,380
u141180505
cpp
p02988
/* START BY THE NAME OF ALMIGHTY ALLAH THIS WONT BE ACCEPTED STOP_GIVING_UP ██╗███████╗████████╗██╗ █████╗ ██╗ ██╗ ██║██╔════╝╚══██╔══╝██║██╔══██╗██║ ██╔╝ ██║███████╗ ██║ ██║███████║█████╔╝ ██║╚════██║ ██║ ██║██╔══██║██╔═██╗ ██║███████║ ██║ ██║██║ ██║██║ ██╗ ╚═╝╚══════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ */ #include <bits/stdc++.h> #define l(i, a, n) for (int i = a; i < n; i++) #define pb push_back #define in insert #define mp make_pair #define lw(v) sort(v.begin(), v.end()); #define hi(v) sort(v.begin(), v.end(), greater<long long>()); #define all(v) v.begin(), v.end() #define filein freopen("input.txt", "r", stdin) #define fileout freopen("output.txt", "w", stdout) using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); long long t, r = 1, r1 = 0, r2 = 0, k = 0, a, b, c = 1, m, d = 0, n, e, f, x = 0, g, p = 0, q = 0, y = 0, z = 0; vector<long long> v; vector<long long> u; set<char> s; std::vector<int>::iterator it; string s1, s2, s3, s4; cin >> n; l(i, 0, n) { cin >> a; v.pb(a); } l(i, 1, n) { if ((v[i] > v[i + 1] && v[i] < v[i - 1]) || (v[i] > v[i - 1] && v[i] < v[i + 1])) { d++; } } cout << d - 1 << endl; }
/* START BY THE NAME OF ALMIGHTY ALLAH THIS WONT BE ACCEPTED STOP_GIVING_UP ██╗███████╗████████╗██╗ █████╗ ██╗ ██╗ ██║██╔════╝╚══██╔══╝██║██╔══██╗██║ ██╔╝ ██║███████╗ ██║ ██║███████║█████╔╝ ██║╚════██║ ██║ ██║██╔══██║██╔═██╗ ██║███████║ ██║ ██║██║ ██║██║ ██╗ ╚═╝╚══════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ */ #include <bits/stdc++.h> #define l(i, a, n) for (int i = a; i < n; i++) #define pb push_back #define in insert #define mp make_pair #define lw(v) sort(v.begin(), v.end()); #define hi(v) sort(v.begin(), v.end(), greater<long long>()); #define all(v) v.begin(), v.end() #define filein freopen("input.txt", "r", stdin) #define fileout freopen("output.txt", "w", stdout) using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); long long t, r = 1, r1 = 0, r2 = 0, k = 0, a, b, c = 1, m, d = 0, n, e, f, x = 0, g, p = 0, q = 0, y = 0, z = 0; vector<long long> v; vector<long long> u; set<char> s; std::vector<int>::iterator it; string s1, s2, s3, s4; cin >> n; l(i, 0, n) { cin >> a; v.pb(a); } l(i, 1, n - 1) { if ((v[i] > v[i + 1] && v[i] < v[i - 1]) || (v[i] > v[i - 1] && v[i] < v[i + 1])) { d++; } } cout << d << endl; }
[ "expression.operation.binary.remove" ]
795,381
795,382
u635989753
cpp
p02988
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> vec(n); for (int i = 0; i < n - 2; i++) { cin >> vec[i]; } int cnt = 0; for (int i = 0; i < n; i++) { if (vec[i] < vec[i + 1] && vec[i + 1] < vec[i + 2]) cnt++; if (vec[i] > vec[i + 1] && vec[i + 1] > vec[i + 2]) cnt++; } cout << cnt << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> vec(n); for (int i = 0; i < n; i++) { cin >> vec[i]; } int cnt = 0; for (int i = 0; i < n - 2; i++) { if (vec[i] < vec[i + 1] && vec[i + 1] < vec[i + 2]) cnt++; if (vec[i] > vec[i + 1] && vec[i + 1] > vec[i + 2]) cnt++; } cout << cnt << endl; }
[ "control_flow.loop.for.condition.change", "expression.operation.binary.remove" ]
795,405
795,406
u587622858
cpp
p02988
#include <bits/stdc++.h> using namespace std; int main() { int n, ans = 0; vector<int> p(20); vector<bool> flag(20); for (int i = 0; i < n; i++) cin >> p[i]; if (p[0] < p[1]) flag[0] = true; else flag[0] = false; for (int i = 1; i < n - 1; i++) { if (p[i] < p[i + 1]) flag[i] = true; else flag[i] = false; if (flag[i] == flag[i - 1]) ans++; } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int n, ans = 0; vector<int> p(20); vector<bool> flag(20); cin >> n; for (int i = 0; i < n; i++) cin >> p[i]; if (p[0] < p[1]) flag[0] = true; else flag[0] = false; for (int i = 1; i < n - 1; i++) { if (p[i] < p[i + 1]) flag[i] = true; else flag[i] = false; if (flag[i] == flag[i - 1]) ans++; } cout << ans << endl; }
[]
795,407
795,408
u652660628
cpp
p02988
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll INF = 1e16; const ll mod = 1000000007; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { ll n; cin >> n; vector<ll> v(n); rep(i, n) cin >> v.at(i); ll res = 0; rep(i, n - 2) { if (v.at(i) < v.at(i + 1) && v.at(i + 1) < v.at(i + 2)) res++; if (v.at(i + 2) > v.at(i + 1) && v.at(i + 1) > v.at(i)) res++; } cout << res << endl; }
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll INF = 1e16; const ll mod = 1000000007; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { ll n; cin >> n; vector<ll> v(n); rep(i, n) cin >> v.at(i); ll res = 0; rep(i, n - 2) { if (v.at(i) < v.at(i + 1) && v.at(i + 1) < v.at(i + 2)) res++; if (v.at(i + 2) < v.at(i + 1) && v.at(i + 1) < v.at(i)) res++; } cout << res << endl; }
[ "misc.opposites", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
795,409
795,410
u785492958
cpp
p02987
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define FAST ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0) #define dofloat cout << fixed << setprecision(8) #define pb push_back #define mp make_pair #define fi first #define se second #define bitcount __builtin_popcount #define all(vec) vec.begin(), vec.end() #define rall(vec) vec.rbegin(), vec.rend() using namespace __gnu_pbds; using namespace std; // typedef typedef long long ll; typedef long double ld; typedef vector<long long> vl; typedef pair<long long, long long> pll; typedef vector<pair<long long, long long>> vll; typedef vector<pair<int, int>> vii; typedef vector<int> vi; typedef pair<int, int> ii; // constants const long long MOD = 1000000007; const long long MAX = 100005; const long double PI = 3.14159265359; const long double G = 9.807; const long long INF = 1e18; const long double EPS = 1e-6; // gcd of a and b long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; } // distance between (a,b) and (c,d) long double dis(long long a, long long b, long long c, long long d) { return sqrt(((a) - (c)) * ((a) - (c)) + ((b) - (d)) * ((b) - (d))); } // simple prime check bool isprime(long long a) { if (a == 2) return 1; if (!(a & 1)) return 0; for (ll i = 3; i * i <= a; i += 2) { if (a % i == 0) return 0; } return 1; } // fast expo long long mpow(long long base, long long exponent, long long modulus) { if (modulus == 1) return 0; long long result = 1; base = base % modulus; while (exponent) { if (exponent % 2 == 1) result = (result * base) % modulus; exponent = exponent >> 1; base = (base * base) % modulus; } return result; } // modular inverse ll minv(ll a, ll mod) { ll _gcd = gcd(a, mod); assert(_gcd == 1); return mpow(a, mod - 2, mod); } /* template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; */ /* ll dx[]={1,0,-1,0,1,1,-1,-1}; ll dy[]={0,-1,0,1,1,-1,-1,1}; */ /* void sieve(int N){ for(int i=0;i<=N;i++){ spf[i]=i; } for(int i=2;i*i<=N;i++){ if(spf[i]==i){ for(int j=i*i;j<=N;j+=i){ spf[j]=min(spf[j],i); } } } return; } */ /* void nCr(ll n,ll k){ ll i,j; for(i=0;i<=n;i++){ for(j=0;j<=min(i,k);j++){ if(j==0 or j==i)C[i][j]=1LL; else C[i][j]=(C[i-1][j-1]+C[i-1][j])%MOD; } } return; } */ /* ll ncr(ll N,ll K){ if(N<K)return 0; if(K==0)return 1; if(N==0)return 0; ll den=1; for(ll i=1;i<=K;i++)den*=i; ll num=1; while(K--){ num*=N; if(num%den==0){ num/=den; den=1; } N--; } return num; } */ string s; int main() { FAST; cin >> s; sort(all(s)); if (s[0] == s[1] and s[1] != s[2] and s[2] == s[3]) { cout << "YES"; } else { cout << "NO"; } return 0; }
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define FAST ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0) #define dofloat cout << fixed << setprecision(8) #define pb push_back #define mp make_pair #define fi first #define se second #define bitcount __builtin_popcount #define all(vec) vec.begin(), vec.end() #define rall(vec) vec.rbegin(), vec.rend() using namespace __gnu_pbds; using namespace std; // typedef typedef long long ll; typedef long double ld; typedef vector<long long> vl; typedef pair<long long, long long> pll; typedef vector<pair<long long, long long>> vll; typedef vector<pair<int, int>> vii; typedef vector<int> vi; typedef pair<int, int> ii; // constants const long long MOD = 1000000007; const long long MAX = 100005; const long double PI = 3.14159265359; const long double G = 9.807; const long long INF = 1e18; const long double EPS = 1e-6; // gcd of a and b long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; } // distance between (a,b) and (c,d) long double dis(long long a, long long b, long long c, long long d) { return sqrt(((a) - (c)) * ((a) - (c)) + ((b) - (d)) * ((b) - (d))); } // simple prime check bool isprime(long long a) { if (a == 2) return 1; if (!(a & 1)) return 0; for (ll i = 3; i * i <= a; i += 2) { if (a % i == 0) return 0; } return 1; } // fast expo long long mpow(long long base, long long exponent, long long modulus) { if (modulus == 1) return 0; long long result = 1; base = base % modulus; while (exponent) { if (exponent % 2 == 1) result = (result * base) % modulus; exponent = exponent >> 1; base = (base * base) % modulus; } return result; } // modular inverse ll minv(ll a, ll mod) { ll _gcd = gcd(a, mod); assert(_gcd == 1); return mpow(a, mod - 2, mod); } /* template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; */ /* ll dx[]={1,0,-1,0,1,1,-1,-1}; ll dy[]={0,-1,0,1,1,-1,-1,1}; */ /* void sieve(int N){ for(int i=0;i<=N;i++){ spf[i]=i; } for(int i=2;i*i<=N;i++){ if(spf[i]==i){ for(int j=i*i;j<=N;j+=i){ spf[j]=min(spf[j],i); } } } return; } */ /* void nCr(ll n,ll k){ ll i,j; for(i=0;i<=n;i++){ for(j=0;j<=min(i,k);j++){ if(j==0 or j==i)C[i][j]=1LL; else C[i][j]=(C[i-1][j-1]+C[i-1][j])%MOD; } } return; } */ /* ll ncr(ll N,ll K){ if(N<K)return 0; if(K==0)return 1; if(N==0)return 0; ll den=1; for(ll i=1;i<=K;i++)den*=i; ll num=1; while(K--){ num*=N; if(num%den==0){ num/=den; den=1; } N--; } return num; } */ string s; int main() { FAST; cin >> s; sort(all(s)); if (s[0] == s[1] and s[1] != s[2] and s[2] == s[3]) { cout << "Yes"; } else { cout << "No"; } return 0; }
[ "literal.string.change", "literal.string.case.change", "io.output.change" ]
795,421
795,422
u091650402
cpp
p02987
#include <bits/stdc++.h> #define db(x) cout << #x << "=" << x << endl; using namespace std; char a[10]; int cnt[27]; int main() { scanf("%s", a); for (int i = 0; i < 4; i++) cnt[a[i] - 'a']++; bool flg = 0; for (int i = 0; i < 26; i++) if (cnt[i] && cnt[i] != 2) flg = 1; puts(flg ? "No" : "Yes"); return 0; }
#include <bits/stdc++.h> #define db(x) cout << #x << "=" << x << endl; using namespace std; char a[10]; int cnt[27]; int main() { scanf("%s", a); for (int i = 0; i < 4; i++) cnt[a[i] - 'A']++; bool flg = 0; for (int i = 0; i < 26; i++) if (cnt[i] && cnt[i] != 2) flg = 1; puts(flg ? "No" : "Yes"); return 0; }
[ "literal.string.change", "literal.string.case.change", "variable_access.subscript.index.change", "expression.operation.binary.change" ]
795,423
795,424
u928673524
cpp
p02988
#include <bits/stdc++.h> using namespace std; int main() { int n; vector<int> p(n); for (int i = 0; i < n; i++) { cin >> p[i]; } int cnt = 0; for (int i = 0; i < n - 2; i++) { if ((p[i] < p[i + 1] && p[i + 1] < p[i + 2]) || (p[i] > p[i + 1] && p[i + 1] > p[i + 2])) { cnt++; } } cout << cnt << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> p(n); for (int i = 0; i < n; i++) { cin >> p[i]; } int cnt = 0; for (int i = 0; i < n - 2; i++) { if ((p[i] < p[i + 1] && p[i + 1] < p[i + 2]) || (p[i] > p[i + 1] && p[i + 1] > p[i + 2])) { cnt++; } } cout << cnt << endl; }
[]
795,427
795,428
u147762850
cpp
p02988
#include <bits/stdc++.h> using namespace std; main() { int n; cin >> n; vector<int> v(n); for (int i = 0; i < n; i++) cin >> v[i]; int ans = 0; for (int i = 0; i < -2; i++) { vector<int> a = {v[i], v[i + 1], v[i + 2]}; sort(a.begin(), a.end()); if (a[1] == v[i + 1]) ans++; } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; main() { int n; cin >> n; vector<int> v(n); for (int i = 0; i < n; i++) cin >> v[i]; int ans = 0; for (int i = 0; i < n - 2; i++) { vector<int> a = {v[i], v[i + 1], v[i + 2]}; sort(a.begin(), a.end()); if (a[1] == v[i + 1]) ans++; } cout << ans << endl; }
[]
795,437
795,438
u720321944
cpp
p02988
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> p(N); for (int i = 0; i < N; i++) { cin >> p.at(i); } int ans = 0; for (int i = 1; i < N; i++) { if ((p[i - 1] < p[i]) && (p[i] < p[i + 1])) ans++; else if ((p[i - 1] > p[i]) && (p[i] > p[i + 1])) ans++; } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> p(N); for (int i = 0; i < N; i++) { cin >> p.at(i); } int ans = 0; for (int i = 1; i < N - 1; i++) { if ((p[i - 1] < p[i]) && (p[i] < p[i + 1])) ans++; else if ((p[i - 1] > p[i]) && (p[i] > p[i + 1])) ans++; } cout << ans << endl; }
[ "control_flow.loop.for.condition.change", "misc.off_by_one" ]
795,442
795,443
u016183710
cpp
p02988
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> p(N); for (int i = 0; i < N; i++) { cin >> p.at(i); } int ans = 0; for (int i = 0; i < N; i++) { if ((p[i - 1] < p[i]) && (p[i] < p[i + 1])) ans++; else if ((p[i - 1] > p[i]) && (p[i] > p[i + 1])) ans++; } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> p(N); for (int i = 0; i < N; i++) { cin >> p.at(i); } int ans = 0; for (int i = 1; i < N - 1; i++) { if ((p[i - 1] < p[i]) && (p[i] < p[i + 1])) ans++; else if ((p[i - 1] > p[i]) && (p[i] > p[i + 1])) ans++; } cout << ans << endl; }
[ "literal.number.change", "variable_declaration.value.change", "control_flow.loop.for.initializer.change", "expression.off_by_one", "control_flow.loop.for.condition.change", "misc.off_by_one" ]
795,444
795,443
u016183710
cpp
p02988
#include <bits/stdc++.h> using namespace std; int main() { int i, n, m, c = 0; vector<int> a; cin >> n; for (i = 0; i < n; i++) { cin >> m; a.push_back(m); } for (i = 1; i < n - 1; i++) { if (a[i + 1] > a[i] && a[i] > a[i - 1] && a[i + 1] > a[i - 1] || a[i - 1] > a[i] && a[i] > a[i + 1] && a[i - 1] > a[i + 1]) { c++; } } cout << c - 1; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int i, n, m, c = 0; vector<int> a; cin >> n; for (i = 0; i < n; i++) { cin >> m; a.push_back(m); } for (i = 1; i < n - 1; i++) { if (a[i + 1] > a[i] && a[i] > a[i - 1] && a[i + 1] > a[i - 1] || a[i - 1] > a[i] && a[i] > a[i + 1] && a[i - 1] > a[i + 1]) { c++; } } cout << c; return 0; }
[ "expression.operation.binary.remove" ]
795,449
795,450
u173252932
cpp
p02988
#include <bits/stdc++.h> using namespace std; int main() { int i, n, m, c = 0; vector<int> a; cin >> n; for (i = 0; i < n; i++) { cin >> m; a.push_back(m); } for (i = 1; i < n; i++) { if (a[i + 1] > a[i] && a[i] > a[i - 1] && a[i + 1] > a[i - 1] || a[i - 1] > a[i] && a[i] > a[i + 1] && a[i - 1] > a[i + 1]) { c++; } } cout << c - 1; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int i, n, m, c = 0; vector<int> a; cin >> n; for (i = 0; i < n; i++) { cin >> m; a.push_back(m); } for (i = 1; i < n - 1; i++) { if (a[i + 1] > a[i] && a[i] > a[i - 1] && a[i + 1] > a[i - 1] || a[i - 1] > a[i] && a[i] > a[i + 1] && a[i - 1] > a[i + 1]) { c++; } } cout << c; return 0; }
[ "control_flow.loop.for.condition.change", "misc.off_by_one", "expression.operation.binary.remove" ]
795,451
795,450
u173252932
cpp
p02988
#include <iostream> using namespace std; int main() { int n; cin >> n; int arr[n]; for (int i = 0; i < n; i++) { cin >> arr[i]; } int a = 0; for (int i = 0; i < n - 1; i++) { if (arr[i] > arr[i - 1] && arr[i + 1] > arr[i] || arr[i] < arr[i - 1] && arr[i + 1] < arr[i]) { a++; } } cout << a << endl; return 0; }
#include <iostream> using namespace std; int main() { int n; cin >> n; int arr[n]; for (int i = 0; i < n; i++) { cin >> arr[i]; } int a = 0; for (int i = 1; i < n - 1; i++) { if (arr[i] > arr[i - 1] && arr[i + 1] > arr[i] || arr[i] < arr[i - 1] && arr[i + 1] < arr[i]) { a++; } } cout << a << endl; return 0; }
[ "literal.number.change", "variable_declaration.value.change", "control_flow.loop.for.initializer.change", "expression.off_by_one" ]
795,454
795,455
u105471115
cpp
p02988
#include <algorithm> #include <complex> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string.h> #include <string> #include <time.h> #include <vector> using namespace std; #define rep(i, a, n) for (int i = (a); i < (n); i++) #define ll long long #define llint long long int #define sort(s) sort(s.begin(), s.end()) #define reverse(v) reverse(v.begin(), v.end()); #define Yes(ans) \ if (ans) \ cout << "Yes" << endl; \ else \ cout << "No" << endl; #define YES(ans) \ if (ans) \ cout << "YES" << endl; \ else \ cout << "NO" << endl; #define hei(a) vector<a> #define whei(a) vector<vector<a>> #define UF UnionFind #define rt0 return 0 #define INF 100000000 constexpr auto mod = 1000000007; //辞書順はnext_permutation( begin( v ), end( v ) );やで! // 2のn乗を求めるよ!!! int ni(int n) { if (n == 0) return 1; int x = ni(n / 2); x *= x; if (n % 2 == 1) x *= 2; return x; } //フィボナッチ数列のx番目を求めるよ! llint f(int x, vector<llint> &s) { if (x == 0) return 0; if (x == 1) return 1; if (s[x] != 0) return s[x]; return s[x] = f(x - 1, s) + f(x - 2, s); } // aとbの最大公約数を求めるよ! llint gcd(llint a, llint b) { if (a < b) swap(a, b); if (b == 0) return a; return gcd(b, a % b); } // a^n mod を計算する long long modpow(long long a, long long n, long long mod) { long long res = 1; while (n > 0) { if (n & 1) res = res * a % mod; a = a * a % mod; n >>= 1; } return res; } // mod. m での a の逆元 a^{-1} を計算するよ! long long modinv(long long a, long long m) { long long b = m, u = 1, v = 0; while (b) { long long t = a / b; a -= t * b; swap(a, b); u -= t * v; swap(u, v); } u %= m; if (u < 0) u += m; return u; } // aCbをmod.mで割った余りを求める ll int c(ll int a, ll int b, ll int m) { ll int ans = 1; for (ll int i = 0; i < b; i++) { ans *= a - i; ans %= m; } for (ll int i = 1; i <= b; i++) { ans *= modinv(i, m); ans %= m; } return ans; } // m進数のn桁を全列挙やで int dfs(int m, int n, vector<int> a, vector<int> s) { int MIN = 100000000; stack<string> st; st.push(""); while (!st.empty()) { string now = st.top(); st.pop(); if (now.size() == n) { int x[3] = {0}; int y[3] = {0}; for (int i = 0; i < n; i++) { if (now[i] - '0' != 3) { x[now[i] - '0'] += s[i]; y[now[i] - '0']++; } } int sum = 0; int ng = 0; for (int i = 0; i < 3; i++) { if (x[i] == 0) ng = 1; sum += abs(x[i] - a[i]); if (y[i] > 1) sum += 10 * (y[i] - 1); } if (ng == 0) MIN = min(MIN, sum); } else { for (int i = m - 1; i >= 0; i--) { string next = now + to_string(i); st.push(next); } } } return MIN; } //迷路やで void bfs() { int sx, sy; int gx, gy; int h, w; cin >> h >> w; cin >> sx >> sy >> gx >> gy; sx--; sy--; gx--; gy--; whei(char) a(h, vector<char>(w)); whei(int) d(h, vector<int>(w, INF)); rep(i, 0, h) rep(j, 0, w) { cin >> a[i][j]; } int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1}; d[sx][sy] = 0; queue<pair<int, int>> que; que.push(pair<int, int>(sx, sy)); while (que.size()) { pair<int, int> p = que.front(); que.pop(); if (p.first == gx && p.second == gy) break; for (int i = 0; i < 4; i++) { int nx = p.first + dx[i]; int ny = p.second + dy[i]; if (0 <= nx && 0 <= ny && nx < h && ny < w && a[nx][ny] != '#' && d[nx][ny] == INF) { que.push(pair<int, int>(nx, ny)); d[nx][ny] = d[p.first][p.second] + 1; } } } cout << d[gx][gy] << endl; } void press(vector<int> &v) { v.erase(unique((v).begin(), (v).end()), v.end()); } void press(vector<char> &v) { v.erase(unique((v).begin(), (v).end()), v.end()); } llint min(llint a, llint b) { if (a < b) return a; return b; } llint max(llint a, llint b) { if (a < b) swap(a, b); return a; } llint p(int n) { if (n == 1) return 1; return n * p(n - 1); } struct UnionFind { vector<int> par; // par[i]:iの親の番号 (例) par[3] = 2 : 3の親が2 UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化 for (int i = 0; i < N; i++) par[i] = i; } int size(int a) { return par[root(a)]; } int root(int x) { // データxが属する木の根を再帰で得る:root(x) = {xの木の根} if (par[x] == x) return x; return par[x] = root(par[x]); } void unite(int x, int y) { // xとyの木を併合 int rx = root(x); // xの根をrx int ry = root(y); // yの根をry if (rx == ry) return; // xとyの根が同じ(=同じ木にある)時はそのまま par[rx] = ry; // xとyの根が同じでない(=同じ木にない)時:xの根rxをyの根ryにつける } bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す int rx = root(x); int ry = root(y); return rx == ry; } }; int main() { int n; cin >> n; int ans = 0; hei(int) a(n); rep(i, 0, n) cin >> a[i]; rep(i, 1, n - 1) { hei(int) x(3); rep(j, 0, 3) x[j] = a[i - 1 + i]; sort(x); if (x[1] == a[i]) ans++; } cout << ans << endl; return 0; }
#include <algorithm> #include <complex> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string.h> #include <string> #include <time.h> #include <vector> using namespace std; #define rep(i, a, n) for (int i = (a); i < (n); i++) #define ll long long #define llint long long int #define sort(s) sort(s.begin(), s.end()) #define reverse(v) reverse(v.begin(), v.end()); #define Yes(ans) \ if (ans) \ cout << "Yes" << endl; \ else \ cout << "No" << endl; #define YES(ans) \ if (ans) \ cout << "YES" << endl; \ else \ cout << "NO" << endl; #define hei(a) vector<a> #define whei(a) vector<vector<a>> #define UF UnionFind #define rt0 return 0 #define INF 100000000 constexpr auto mod = 1000000007; //辞書順はnext_permutation( begin( v ), end( v ) );やで! // 2のn乗を求めるよ!!! int ni(int n) { if (n == 0) return 1; int x = ni(n / 2); x *= x; if (n % 2 == 1) x *= 2; return x; } //フィボナッチ数列のx番目を求めるよ! llint f(int x, vector<llint> &s) { if (x == 0) return 0; if (x == 1) return 1; if (s[x] != 0) return s[x]; return s[x] = f(x - 1, s) + f(x - 2, s); } // aとbの最大公約数を求めるよ! llint gcd(llint a, llint b) { if (a < b) swap(a, b); if (b == 0) return a; return gcd(b, a % b); } // a^n mod を計算する long long modpow(long long a, long long n, long long mod) { long long res = 1; while (n > 0) { if (n & 1) res = res * a % mod; a = a * a % mod; n >>= 1; } return res; } // mod. m での a の逆元 a^{-1} を計算するよ! long long modinv(long long a, long long m) { long long b = m, u = 1, v = 0; while (b) { long long t = a / b; a -= t * b; swap(a, b); u -= t * v; swap(u, v); } u %= m; if (u < 0) u += m; return u; } // aCbをmod.mで割った余りを求める ll int c(ll int a, ll int b, ll int m) { ll int ans = 1; for (ll int i = 0; i < b; i++) { ans *= a - i; ans %= m; } for (ll int i = 1; i <= b; i++) { ans *= modinv(i, m); ans %= m; } return ans; } // m進数のn桁を全列挙やで int dfs(int m, int n, vector<int> a, vector<int> s) { int MIN = 100000000; stack<string> st; st.push(""); while (!st.empty()) { string now = st.top(); st.pop(); if (now.size() == n) { int x[3] = {0}; int y[3] = {0}; for (int i = 0; i < n; i++) { if (now[i] - '0' != 3) { x[now[i] - '0'] += s[i]; y[now[i] - '0']++; } } int sum = 0; int ng = 0; for (int i = 0; i < 3; i++) { if (x[i] == 0) ng = 1; sum += abs(x[i] - a[i]); if (y[i] > 1) sum += 10 * (y[i] - 1); } if (ng == 0) MIN = min(MIN, sum); } else { for (int i = m - 1; i >= 0; i--) { string next = now + to_string(i); st.push(next); } } } return MIN; } //迷路やで void bfs() { int sx, sy; int gx, gy; int h, w; cin >> h >> w; cin >> sx >> sy >> gx >> gy; sx--; sy--; gx--; gy--; whei(char) a(h, vector<char>(w)); whei(int) d(h, vector<int>(w, INF)); rep(i, 0, h) rep(j, 0, w) { cin >> a[i][j]; } int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1}; d[sx][sy] = 0; queue<pair<int, int>> que; que.push(pair<int, int>(sx, sy)); while (que.size()) { pair<int, int> p = que.front(); que.pop(); if (p.first == gx && p.second == gy) break; for (int i = 0; i < 4; i++) { int nx = p.first + dx[i]; int ny = p.second + dy[i]; if (0 <= nx && 0 <= ny && nx < h && ny < w && a[nx][ny] != '#' && d[nx][ny] == INF) { que.push(pair<int, int>(nx, ny)); d[nx][ny] = d[p.first][p.second] + 1; } } } cout << d[gx][gy] << endl; } void press(vector<int> &v) { v.erase(unique((v).begin(), (v).end()), v.end()); } void press(vector<char> &v) { v.erase(unique((v).begin(), (v).end()), v.end()); } llint min(llint a, llint b) { if (a < b) return a; return b; } llint max(llint a, llint b) { if (a < b) swap(a, b); return a; } llint p(int n) { if (n == 1) return 1; return n * p(n - 1); } struct UnionFind { vector<int> par; // par[i]:iの親の番号 (例) par[3] = 2 : 3の親が2 UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化 for (int i = 0; i < N; i++) par[i] = i; } int size(int a) { return par[root(a)]; } int root(int x) { // データxが属する木の根を再帰で得る:root(x) = {xの木の根} if (par[x] == x) return x; return par[x] = root(par[x]); } void unite(int x, int y) { // xとyの木を併合 int rx = root(x); // xの根をrx int ry = root(y); // yの根をry if (rx == ry) return; // xとyの根が同じ(=同じ木にある)時はそのまま par[rx] = ry; // xとyの根が同じでない(=同じ木にない)時:xの根rxをyの根ryにつける } bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す int rx = root(x); int ry = root(y); return rx == ry; } }; int main() { int n; cin >> n; int ans = 0; hei(int) a(n); rep(i, 0, n) cin >> a[i]; rep(i, 1, n - 1) { hei(int) x(3); rep(j, 0, 3) x[j] = a[i - 1 + j]; sort(x); if (x[1] == a[i]) ans++; } cout << ans << endl; return 0; }
[ "assignment.value.change", "identifier.change", "variable_access.subscript.index.change", "expression.operation.binary.change" ]
795,456
795,457
u407213771
cpp
p02988
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int a[n + 1]; for (int i = 1; i < n + 1; i++) { cin >> a[i]; } int ans = 0; for (int i = 2; i < n + 1; i++) { if (a[i - 1] < a[i] && a[i + 1] > a[i]) { ans++; } else if (a[i - 1] > a[i] && a[i + 1] < a[i]) { ans++; } } cout << ans; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int a[n + 1]; for (int i = 0; i < n; i++) { cin >> a[i]; } int ans = 0; for (int i = 1; i < n - 1; i++) { if (a[i - 1] < a[i] && a[i + 1] > a[i]) { ans++; } else if (a[i - 1] > a[i] && a[i + 1] < a[i]) { ans++; } } cout << ans; }
[ "literal.number.change", "variable_declaration.value.change", "control_flow.loop.for.initializer.change", "expression.off_by_one", "control_flow.loop.for.condition.change", "expression.operation.binary.remove", "misc.opposites", "expression.operator.arithmetic.change", "expression.operation.binary.c...
795,458
795,459
u214137532
cpp
p02988
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; int main() { int n; vector<int> p(n); for (int i = 0; i < n; i++) { cin >> p[i]; } int ans = 0; for (int i = 1; i < n - 1; i++) { if ((p[i] - p[i - 1]) * (p[i] - p[i + 1]) < 0) { ans += 1; } } cout << ans << endl; }
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> p(n); for (int i = 0; i < n; i++) { cin >> p[i]; } int ans = 0; for (int i = 1; i < n - 1; i++) { if ((p[i] - p[i - 1]) * (p[i] - p[i + 1]) < 0) { ans += 1; } } cout << ans << endl; }
[]
795,462
795,463
u346629192
cpp
p02988
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; int ans = 0; vector<int> vec(N); for (int i = 0; i < N; i++) { cin >> vec.at(i); if (i > 1) { if (((vec.at(i) < vec.at(i - 1)) && (vec.at(i - 1) < vec.at(i - 2)) || ((vec.at(i) > vec.at(i - 1))) && (vec.at(i - 1) > vec.at(i + 2)))) { ans++; } } } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; int ans = 0; vector<int> vec(N); for (int i = 0; i < N; i++) { cin >> vec.at(i); if (i > 1) { if (((vec.at(i) < vec.at(i - 1)) && (vec.at(i - 1) < vec.at(i - 2)) || ((vec.at(i) > vec.at(i - 1))) && (vec.at(i - 1) > vec.at(i - 2)))) { ans++; } } } cout << ans << endl; }
[ "misc.opposites", "expression.operator.arithmetic.change", "control_flow.branch.if.condition.change" ]
795,466
795,467
u280120599
cpp
p02988
// include #include <algorithm> #include <cmath> #include <cstdlib> #include <iomanip> #include <iostream> #include <map> #include <sstream> #include <string> #include <utility> #include <vector> //マクロとか #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep1(i, n) for (int i = 1; i < (int)(n) + 1; i++) #define all(vecto) vecto.begin(), vecto.end() #define max3(a, b, c) max(a, max(b, c)) #define min3(a, b, c) min(a, min(b, c)) using ll = long long; //自前の関数たち //最大公約数 ll GCD(ll a, ll b) { if (b == 0) return a; else return GCD(b, a % b); } //最小公倍数 ll LCM(ll a, ll b) { return (a * b) / GCD(a, b); } // namespace my namespace my { //配列の最大値or最小値を数値で返す関数 template <class T> T max_element(std::vector<T> vec) { std::sort(vec.begin(), vec.end()); return vec.at(vec.size() - 1); } template <class T> T min_element(std::vector<T> vec) { std::sort(vec.begin(), vec.end()); return vec.at(0); } } // namespace my // yes,noを出力するやつ void ans(bool qus) { if (qus == true) std::cout << "Yes" << std::endl; else std::cout << "No" << std::endl; } void Ans(bool qust) { if (qust == true) std::cout << "YES" << std::endl; else std::cout << "NO" << std::endl; } // std名前空間を使用 using namespace std; //////////////////////////////////////////////////////////////////////////////// //スタート bool is_second(int *pA); int main() { int n; int count = 0; cin >> n; vector<int> vec(n); rep(i, n) { cin >> vec[i]; } for (int i = 2; i < n; i++) { int *pA; pA = new int; pA[0] = vec[i - 1]; pA[1] = vec[i]; pA[2] = vec[i + 1]; if (is_second(pA)) count++; delete pA; } cout << count << endl; } bool is_second(int *pA) { if (pA[1] == max3(pA[0], pA[1], pA[2])) return false; if (pA[1] == min3(pA[0], pA[1], pA[2])) return false; else return true; }
// include #include <algorithm> #include <cmath> #include <cstdlib> #include <iomanip> #include <iostream> #include <map> #include <sstream> #include <string> #include <utility> #include <vector> //マクロとか #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep1(i, n) for (int i = 1; i < (int)(n) + 1; i++) #define all(vecto) vecto.begin(), vecto.end() #define max3(a, b, c) max(a, max(b, c)) #define min3(a, b, c) min(a, min(b, c)) using ll = long long; //自前の関数たち //最大公約数 ll GCD(ll a, ll b) { if (b == 0) return a; else return GCD(b, a % b); } //最小公倍数 ll LCM(ll a, ll b) { return (a * b) / GCD(a, b); } // namespace my namespace my { //配列の最大値or最小値を数値で返す関数 template <class T> T max_element(std::vector<T> vec) { std::sort(vec.begin(), vec.end()); return vec.at(vec.size() - 1); } template <class T> T min_element(std::vector<T> vec) { std::sort(vec.begin(), vec.end()); return vec.at(0); } } // namespace my // yes,noを出力するやつ void ans(bool qus) { if (qus == true) std::cout << "Yes" << std::endl; else std::cout << "No" << std::endl; } void Ans(bool qust) { if (qust == true) std::cout << "YES" << std::endl; else std::cout << "NO" << std::endl; } // std名前空間を使用 using namespace std; //////////////////////////////////////////////////////////////////////////////// //スタート bool is_second(int *pA); int main() { int n; int count = 0; cin >> n; vector<int> vec(n); rep(i, n) { cin >> vec[i]; } for (int i = 1; i < n - 1; i++) { int *pA; pA = new int; pA[0] = vec[i - 1]; pA[1] = vec[i]; pA[2] = vec[i + 1]; if (is_second(pA)) count++; delete pA; } cout << count << endl; } bool is_second(int *pA) { if (pA[1] == max3(pA[0], pA[1], pA[2])) return false; if (pA[1] == min3(pA[0], pA[1], pA[2])) return false; else return true; }
[ "literal.number.change", "variable_declaration.value.change", "control_flow.loop.for.initializer.change", "expression.off_by_one", "control_flow.loop.for.condition.change", "misc.off_by_one" ]
795,468
795,469
u296160120
cpp
p02988
#include <algorithm> #include <bits/stdc++.h> #include <iostream> #include <string> using namespace std; int main() { int n; cin >> n; int p[n]; for (int i = 0; i < n; i++) cin >> p[i]; int ans = 0; for (int i = 0; i < (n - 3); i++) { if (((p[i + 1] > p[i + 2]) && (p[i + 1] > p[i])) || ((p[i + 1] < p[i + 2]) && (p[i + 1] < p[i]))) continue; else ans++; } cout << ans << endl; }
#include <algorithm> #include <bits/stdc++.h> #include <iostream> #include <string> using namespace std; int main() { int n; cin >> n; int p[n]; for (int i = 0; i < n; i++) cin >> p[i]; int ans = 0; for (int i = 0; i < (n - 2); i++) { if (((p[i + 1] > p[i + 2]) && (p[i + 1] > p[i])) || ((p[i + 1] < p[i + 2]) && (p[i + 1] < p[i]))) continue; else ans++; } cout << ans << endl; }
[ "literal.number.change", "control_flow.loop.for.condition.change", "expression.off_by_one", "expression.operation.binary.change" ]
795,470
795,471
u904995051
cpp
p02988
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> p(n); for (int i = 0; i < n; i++) { cin >> p.at(i); } int ans = 0; for (int i = 2; i < n; i++) { int mi = min(p.at(i - 2), min(p.at(i - 1), p.at(i))); int ma = max(p.at(i - 2), min(p.at(i - 1), p.at(i))); if (!((p.at(i - 1) == mi) || (p.at(i - 1) == ma))) { ans++; } } cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> p(n); for (int i = 0; i < n; i++) { cin >> p.at(i); } int ans = 0; for (int i = 2; i < n; i++) { int mi = min(p.at(i - 2), min(p.at(i - 1), p.at(i))); int ma = max(p.at(i - 2), max(p.at(i - 1), p.at(i))); if (!((p.at(i - 1) == mi) || (p.at(i - 1) == ma))) { ans++; } } cout << ans << endl; return 0; }
[ "misc.opposites", "identifier.change", "call.function.change", "call.arguments.change" ]
795,476
795,477
u030246664
cpp
p02988
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> data(n); for (int i = 0; i < n; i++) { cin >> data.at(i); } int count = 0; for (int i = 0; i < n - 3; i++) { if (data.at(i) > data.at(i + 1) && data.at(i + 1) >= data.at(i + 2)) { count++; } else if (data.at(i + 2) > data.at(i + 1) && data.at(i + 1) >= data.at(i)) { count++; } } cout << count << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> data(n); for (int i = 0; i < n; i++) { cin >> data.at(i); } int count = 0; for (int i = 0; i < n - 2; i++) { if (data.at(i) > data.at(i + 1) && data.at(i + 1) >= data.at(i + 2)) { count++; } else if (data.at(i + 2) > data.at(i + 1) && data.at(i + 1) >= data.at(i)) { count++; } } cout << count << endl; }
[ "literal.number.change", "control_flow.loop.for.condition.change", "expression.off_by_one", "expression.operation.binary.change" ]
795,478
795,479
u164352406
cpp
p02988
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef long double ld; typedef vector<ll> vl; typedef vector<string> vs; typedef vector<char> vc; typedef queue<ll> ql; typedef deque<ll> dql; typedef priority_queue<ll, vl /*, greater<ll>*/> pql; //降順(/*昇順*/) typedef set<ll> sl; typedef pair<ll, ll> pl; typedef vector<vl> vvl; typedef vector<pl> vpl; #define rep(i, n) for (ll i = 0; i < ll(n); i++) //#define rep2(i, n) for(ll i = 1; i <= ll(n); i++) //#define rep(i, k, n) for(ll i = k-1; i < ll(n); i++) #define rep2(i, k, n) for (ll i = k; i <= ll(n); i++) #define all(v) (v).begin(), (v).end() bool chmin(ll &a, ll b) { if (b < a) { a = b; return 1; } return 0; } bool chmax(ll &a, ll b) { if (b > a) { a = b; return 1; } return 0; } const ll INF = 1LL << 60; const ll MOD = 1e9 + 7; // const ll MOD = 998244353; const ll MAX = 1e9; const char newl = '\n'; int main() { ios::sync_with_stdio(false); cin.tie(0); ll n; cin >> n; vl p(n); rep(i, n) cin >> p[i]; ll cnt = n - 2; rep2(i, 2, n - 2) { if (p[i - 1] > p[i] && p[i] < p[i + 1]) cnt--; if (p[i - 1] < p[i] && p[i] > p[i + 1]) cnt--; } cout << cnt << newl; return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef long double ld; typedef vector<ll> vl; typedef vector<string> vs; typedef vector<char> vc; typedef queue<ll> ql; typedef deque<ll> dql; typedef priority_queue<ll, vl /*, greater<ll>*/> pql; //降順(/*昇順*/) typedef set<ll> sl; typedef pair<ll, ll> pl; typedef vector<vl> vvl; typedef vector<pl> vpl; #define rep(i, n) for (ll i = 0; i < ll(n); i++) //#define rep2(i, n) for(ll i = 1; i <= ll(n); i++) //#define rep(i, k, n) for(ll i = k-1; i < ll(n); i++) #define rep2(i, k, n) for (ll i = k; i <= ll(n); i++) #define all(v) (v).begin(), (v).end() bool chmin(ll &a, ll b) { if (b < a) { a = b; return 1; } return 0; } bool chmax(ll &a, ll b) { if (b > a) { a = b; return 1; } return 0; } const ll INF = 1LL << 60; const ll MOD = 1e9 + 7; // const ll MOD = 998244353; const ll MAX = 1e9; const char newl = '\n'; int main() { ios::sync_with_stdio(false); cin.tie(0); ll n; cin >> n; vl p(n); rep(i, n) cin >> p[i]; ll cnt = n - 2; rep2(i, 1, n - 2) { if (p[i - 1] > p[i] && p[i] < p[i + 1]) cnt--; if (p[i - 1] < p[i] && p[i] > p[i + 1]) cnt--; } cout << cnt << newl; return 0; }
[ "literal.number.change", "call.arguments.change" ]
795,484
795,485
u682191329
cpp
p02988
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef long double ld; typedef vector<ll> vl; typedef vector<string> vs; typedef vector<char> vc; typedef queue<ll> ql; typedef deque<ll> dql; typedef priority_queue<ll, vl /*, greater<ll>*/> pql; //降順(/*昇順*/) typedef set<ll> sl; typedef pair<ll, ll> pl; typedef vector<vl> vvl; typedef vector<pl> vpl; #define rep(i, n) for (ll i = 0; i < ll(n); i++) //#define rep2(i, n) for(ll i = 1; i <= ll(n); i++) //#define rep(i, k, n) for(ll i = k-1; i < ll(n); i++) #define rep2(i, k, n) for (ll i = k; i <= ll(n); i++) #define all(v) (v).begin(), (v).end() bool chmin(ll &a, ll b) { if (b < a) { a = b; return 1; } return 0; } bool chmax(ll &a, ll b) { if (b > a) { a = b; return 1; } return 0; } const ll INF = 1LL << 60; const ll MOD = 1e9 + 7; // const ll MOD = 998244353; const ll MAX = 1e9; const char newl = '\n'; int main() { ios::sync_with_stdio(false); cin.tie(0); ll n; cin >> n; vl p(n); rep(i, n) cin >> p[i]; ll cnt = n - 2; rep2(i, 2, n - 1) { if (p[i - 1] > p[i] && p[i] < p[i + 1]) cnt--; if (p[i - 1] < p[i] && p[i] > p[i + 1]) cnt--; } cout << cnt << newl; return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef long double ld; typedef vector<ll> vl; typedef vector<string> vs; typedef vector<char> vc; typedef queue<ll> ql; typedef deque<ll> dql; typedef priority_queue<ll, vl /*, greater<ll>*/> pql; //降順(/*昇順*/) typedef set<ll> sl; typedef pair<ll, ll> pl; typedef vector<vl> vvl; typedef vector<pl> vpl; #define rep(i, n) for (ll i = 0; i < ll(n); i++) //#define rep2(i, n) for(ll i = 1; i <= ll(n); i++) //#define rep(i, k, n) for(ll i = k-1; i < ll(n); i++) #define rep2(i, k, n) for (ll i = k; i <= ll(n); i++) #define all(v) (v).begin(), (v).end() bool chmin(ll &a, ll b) { if (b < a) { a = b; return 1; } return 0; } bool chmax(ll &a, ll b) { if (b > a) { a = b; return 1; } return 0; } const ll INF = 1LL << 60; const ll MOD = 1e9 + 7; // const ll MOD = 998244353; const ll MAX = 1e9; const char newl = '\n'; int main() { ios::sync_with_stdio(false); cin.tie(0); ll n; cin >> n; vl p(n); rep(i, n) cin >> p[i]; ll cnt = n - 2; rep2(i, 1, n - 2) { if (p[i - 1] > p[i] && p[i] < p[i + 1]) cnt--; if (p[i - 1] < p[i] && p[i] > p[i + 1]) cnt--; } cout << cnt << newl; return 0; }
[ "literal.number.change", "call.arguments.change", "expression.operation.binary.change" ]
795,486
795,485
u682191329
cpp
p02988
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> vs(n); for (auto &x : vs) cin >> x; int ans = 0; for (int i = 1; i < n - 1; ++i) { int a = vs[i - 1]; int b = vs[i]; int c = vs[i + 1]; int mn = min(a, min(b, c)); int mx = max(a, min(b, c)); if (vs[i] != mn and vs[i] != mx) ++ans; } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> vs(n); for (auto &x : vs) cin >> x; int ans = 0; for (int i = 1; i < n - 1; ++i) { int a = vs[i - 1]; int b = vs[i]; int c = vs[i + 1]; int mn = min(a, min(b, c)); int mx = max(a, max(b, c)); if (vs[i] != mn and vs[i] != mx) ++ans; } cout << ans << endl; }
[ "misc.opposites", "identifier.change", "call.function.change", "call.arguments.change" ]
795,491
795,492
u808092084
cpp
p02988
#include <algorithm> #include <bitset> #include <cassert> #include <cfloat> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <limits.h> #include <list> #include <map> #include <math.h> #include <numeric> #include <queue> #include <random> #include <set> #include <sstream> #include <stack> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <string> #include <tuple> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } using namespace std; #define int long long #define ll long long #define rep(i, n) for (ll i = 0; i < (n); i++) #define P pair<ll, ll> #define sz(x) (ll) x.size() #define ALL(x) (x).begin(), (x).end() #define ALLR(x) (x).rbegin(), (x).rend() #define VE vector<ll> #define COUT(x) cout << (x) << endl #define MA map<ll, ll> #define SE set<ll> #define PQ priority_queue<ll> #define PQR priority_queue<ll, VE, greater<ll>> #define YES(n) cout << ((n) ? "YES" : "NO") << endl #define Yes(n) cout << ((n) ? "Yes" : "No") << endl #define EPS (1e-10) #define pb push_back long long MOD = 1000000007; // const long long MOD = 998244353; const long long INF = 1LL << 60; const double PI = acos(-1.0); struct mint { ll x; // typedef long long ll; mint(ll x = 0) : x((x % MOD + MOD) % MOD) {} mint operator-() const { return mint(-x); } mint &operator+=(const mint a) { if ((x += a.x) >= MOD) x -= MOD; return *this; } mint &operator-=(const mint a) { if ((x += MOD - a.x) >= MOD) x -= MOD; return *this; } mint &operator*=(const mint a) { (x *= a.x) %= MOD; return *this; } mint operator+(const mint a) const { mint res(*this); return res += a; } mint operator-(const mint a) const { mint res(*this); return res -= a; } mint operator*(const mint a) const { mint res(*this); return res *= a; } mint pow(ll t) const { if (!t) return 1; mint a = pow(t >> 1); a *= a; if (t & 1) a *= *this; return a; } // for prime MOD mint inv() const { return pow(MOD - 2); } mint &operator/=(const mint a) { return (*this) *= a.inv(); } mint operator/(const mint a) const { mint res(*this); return res /= a; } }; istream &operator>>(istream &is, const mint &a) { return is >> a.x; } ostream &operator<<(ostream &os, const mint &a) { return os << a.x; } struct Sieve { int n; vector<int> f, primes; Sieve(int n = 1) : n(n), f(n + 1) { f[0] = f[1] = -1; for (ll i = 2; i <= n; ++i) { if (f[i]) continue; primes.push_back(i); f[i] = i; for (ll j = i * i; j <= n; j += i) { if (!f[j]) f[j] = i; } } } bool isPrime(int x) { return f[x] == x; } vector<int> factorList(int x) { vector<int> res; while (x != 1) { res.push_back(f[x]); x /= f[x]; } return res; } vector<P> factor(int x) { vector<int> fl = factorList(x); if (fl.size() == 0) return {}; vector<P> res(1, P(fl[0], 0)); for (int p : fl) { if (res.back().first == p) { res.back().second++; } else { res.emplace_back(p, 1); } } return res; } }; template <class t> t gcd(t a, t b) { return b != 0 ? gcd(b, a % b) : a; } ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; } bool prime(ll n) { for (ll i = 2; i <= sqrt(n); i++) { if (n % i == 0) return false; } return n != 1; } map<ll, ll> prime_factor(ll n) { map<ll, ll> ret; for (ll i = 2; i * i <= n; i++) { while (n % i == 0) { ret[i]++; n /= i; } } if (n != 1) ret[n] = 1; return ret; } ll modinv(ll a, ll m) { ll b = m, u = 1, v = 0; while (b) { ll t = a / b; a -= t * b; swap(a, b); u -= t * v; swap(u, v); } u %= m; if (u < 0) u += m; return u; } vector<pair<char, int>> RunLength(string s) { if (s.size() == 0) return {}; vector<pair<char, int>> res(1, pair<char, int>(s[0], 0)); for (char p : s) { if (res.back().first == p) { res.back().second++; } else { res.emplace_back(p, 1); } } return res; } // Digit Count int GetDigit(int num) { return log10(num) + 1; } // bit calculation[how many "1"] (= __builtin_popcount()) int bit_count(int n) { int cnt = 0; while (n > 0) { if (n % 2 == 1) cnt++; n /= 2; } return cnt; } vector<long long> enum_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); if (N / i != i) res.push_back(N / i); } } sort(res.begin(), res.end()); return res; } const ll dx[4] = {1, 0, -1, 0}; const ll dy[4] = {0, 1, 0, -1}; struct edge { ll to, cost; }; typedef long double ld; using Graph = vector<VE>; class UnionFind { public: vector<ll> par; // 各元の親を表す配列 vector<ll> siz; // 素集合のサイズを表す配列(1 で初期化) // Constructor UnionFind(ll sz_) : par(sz_), siz(sz_, 1) { for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身 } void init(ll sz_) { par.resize(sz_); siz.resize(sz_, 1); for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身 } // Member Function // Find ll root(ll x) { // 根の検索 while (par[x] != x) { x = par[x] = par[par[x]]; // x の親の親を x の親とする } return x; } // Union(Unite, Merge) bool merge(ll x, ll y) { x = root(x); y = root(y); if (x == y) return false; // merge technique(データ構造をマージするテク.小を大にくっつける) if (siz[x] < siz[y]) swap(x, y); siz[x] += siz[y]; par[y] = x; return true; } bool issame(ll x, ll y) { // 連結判定 return root(x) == root(y); } ll size(ll x) { // 素集合のサイズ return siz[root(x)]; } }; signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); // cout << fixed << setprecision(20); // combination com(200010); int n; cin >> n; VE a(n); rep(i, n) { cin >> a[i]; } int ans = 0; for (int i = 0; i < n - 2; i++) { VE tmp; rep(j, 3) tmp.push_back(a[i] + j); sort(ALL(tmp)); if (tmp[1] == a[i + 1]) { ans++; } } cout << ans << endl; return 0; }
#include <algorithm> #include <bitset> #include <cassert> #include <cfloat> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <limits.h> #include <list> #include <map> #include <math.h> #include <numeric> #include <queue> #include <random> #include <set> #include <sstream> #include <stack> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <string> #include <tuple> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } using namespace std; #define int long long #define ll long long #define rep(i, n) for (ll i = 0; i < (n); i++) #define P pair<ll, ll> #define sz(x) (ll) x.size() #define ALL(x) (x).begin(), (x).end() #define ALLR(x) (x).rbegin(), (x).rend() #define VE vector<ll> #define COUT(x) cout << (x) << endl #define MA map<ll, ll> #define SE set<ll> #define PQ priority_queue<ll> #define PQR priority_queue<ll, VE, greater<ll>> #define YES(n) cout << ((n) ? "YES" : "NO") << endl #define Yes(n) cout << ((n) ? "Yes" : "No") << endl #define EPS (1e-10) #define pb push_back long long MOD = 1000000007; // const long long MOD = 998244353; const long long INF = 1LL << 60; const double PI = acos(-1.0); struct mint { ll x; // typedef long long ll; mint(ll x = 0) : x((x % MOD + MOD) % MOD) {} mint operator-() const { return mint(-x); } mint &operator+=(const mint a) { if ((x += a.x) >= MOD) x -= MOD; return *this; } mint &operator-=(const mint a) { if ((x += MOD - a.x) >= MOD) x -= MOD; return *this; } mint &operator*=(const mint a) { (x *= a.x) %= MOD; return *this; } mint operator+(const mint a) const { mint res(*this); return res += a; } mint operator-(const mint a) const { mint res(*this); return res -= a; } mint operator*(const mint a) const { mint res(*this); return res *= a; } mint pow(ll t) const { if (!t) return 1; mint a = pow(t >> 1); a *= a; if (t & 1) a *= *this; return a; } // for prime MOD mint inv() const { return pow(MOD - 2); } mint &operator/=(const mint a) { return (*this) *= a.inv(); } mint operator/(const mint a) const { mint res(*this); return res /= a; } }; istream &operator>>(istream &is, const mint &a) { return is >> a.x; } ostream &operator<<(ostream &os, const mint &a) { return os << a.x; } struct Sieve { int n; vector<int> f, primes; Sieve(int n = 1) : n(n), f(n + 1) { f[0] = f[1] = -1; for (ll i = 2; i <= n; ++i) { if (f[i]) continue; primes.push_back(i); f[i] = i; for (ll j = i * i; j <= n; j += i) { if (!f[j]) f[j] = i; } } } bool isPrime(int x) { return f[x] == x; } vector<int> factorList(int x) { vector<int> res; while (x != 1) { res.push_back(f[x]); x /= f[x]; } return res; } vector<P> factor(int x) { vector<int> fl = factorList(x); if (fl.size() == 0) return {}; vector<P> res(1, P(fl[0], 0)); for (int p : fl) { if (res.back().first == p) { res.back().second++; } else { res.emplace_back(p, 1); } } return res; } }; template <class t> t gcd(t a, t b) { return b != 0 ? gcd(b, a % b) : a; } ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; } bool prime(ll n) { for (ll i = 2; i <= sqrt(n); i++) { if (n % i == 0) return false; } return n != 1; } map<ll, ll> prime_factor(ll n) { map<ll, ll> ret; for (ll i = 2; i * i <= n; i++) { while (n % i == 0) { ret[i]++; n /= i; } } if (n != 1) ret[n] = 1; return ret; } ll modinv(ll a, ll m) { ll b = m, u = 1, v = 0; while (b) { ll t = a / b; a -= t * b; swap(a, b); u -= t * v; swap(u, v); } u %= m; if (u < 0) u += m; return u; } vector<pair<char, int>> RunLength(string s) { if (s.size() == 0) return {}; vector<pair<char, int>> res(1, pair<char, int>(s[0], 0)); for (char p : s) { if (res.back().first == p) { res.back().second++; } else { res.emplace_back(p, 1); } } return res; } // Digit Count int GetDigit(int num) { return log10(num) + 1; } // bit calculation[how many "1"] (= __builtin_popcount()) int bit_count(int n) { int cnt = 0; while (n > 0) { if (n % 2 == 1) cnt++; n /= 2; } return cnt; } vector<long long> enum_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); if (N / i != i) res.push_back(N / i); } } sort(res.begin(), res.end()); return res; } const ll dx[4] = {1, 0, -1, 0}; const ll dy[4] = {0, 1, 0, -1}; struct edge { ll to, cost; }; typedef long double ld; using Graph = vector<VE>; class UnionFind { public: vector<ll> par; // 各元の親を表す配列 vector<ll> siz; // 素集合のサイズを表す配列(1 で初期化) // Constructor UnionFind(ll sz_) : par(sz_), siz(sz_, 1) { for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身 } void init(ll sz_) { par.resize(sz_); siz.resize(sz_, 1); for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身 } // Member Function // Find ll root(ll x) { // 根の検索 while (par[x] != x) { x = par[x] = par[par[x]]; // x の親の親を x の親とする } return x; } // Union(Unite, Merge) bool merge(ll x, ll y) { x = root(x); y = root(y); if (x == y) return false; // merge technique(データ構造をマージするテク.小を大にくっつける) if (siz[x] < siz[y]) swap(x, y); siz[x] += siz[y]; par[y] = x; return true; } bool issame(ll x, ll y) { // 連結判定 return root(x) == root(y); } ll size(ll x) { // 素集合のサイズ return siz[root(x)]; } }; signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); // cout << fixed << setprecision(20); // combination com(200010); int n; cin >> n; VE a(n); rep(i, n) { cin >> a[i]; } int ans = 0; for (int i = 0; i < n - 2; i++) { VE tmp; rep(j, 3) tmp.push_back(a[i + j]); sort(ALL(tmp)); if (tmp[1] == a[i + 1]) { ans++; } } cout << ans << endl; return 0; }
[ "call.arguments.change" ]
795,493
795,494
u809967037
cpp
p02988
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> p(n); for (int i = 0; i < n; i++) cin >> p.at(i); int k = 0; for (int i = 0; i < n - 2; i++) { if (p.at(i - 1) < p.at(i) && p.at(i) < p.at(i + 1)) k++; else if (p.at(i + 1) < p.at(i) && p.at(i) < p.at(i - 1)) k++; } cout << k << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> p(n); for (int i = 0; i < n; i++) cin >> p.at(i); int k = 0; for (int i = 1; i < n - 1; i++) { if (p.at(i - 1) < p.at(i) && p.at(i) < p.at(i + 1)) k++; else if (p.at(i + 1) < p.at(i) && p.at(i) < p.at(i - 1)) k++; } cout << k << endl; }
[ "literal.number.change", "variable_declaration.value.change", "control_flow.loop.for.initializer.change", "expression.off_by_one", "control_flow.loop.for.condition.change", "expression.operation.binary.change" ]
795,497
795,498
u247123590
cpp
p02988
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> P(N); for (int i = 0; i < N; i++) { cin >> P.at(i); } int count = 0; for (int k = 0; k < N - 1; k++) { if ((P.at(k) - P.at(k - 1)) * (P.at(k + 1) - P.at(k)) > 0) { count++; } } cout << count << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> P(N); for (int i = 0; i < N; i++) { cin >> P.at(i); } int count = 0; for (int k = 1; k < N - 1; k++) { if ((P.at(k) - P.at(k - 1)) * (P.at(k + 1) - P.at(k)) > 0) { count++; } } cout << count << endl; }
[ "literal.number.change", "variable_declaration.value.change", "control_flow.loop.for.initializer.change", "expression.off_by_one" ]
795,499
795,500
u702468315
cpp
p02988
#include <bits/stdc++.h> using namespace std; int main() { int n, ans = 0; cin >> n; vector<int> p(n); for (int i = 0; i < n; i++) { cin >> p[i]; } for (int i = 0; i < n - 1; i++) { if (p[i + 1] > p[i] && p[i] > p[i - 1]) ans++; if (p[i - 1] > p[i] && p[i] > p[i + 1]) ans++; } cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n, ans = 0; cin >> n; vector<int> p(n); for (int i = 0; i < n; i++) { cin >> p[i]; } for (int i = 1; i < n - 1; i++) { if (p[i + 1] > p[i] && p[i] > p[i - 1]) ans++; if (p[i - 1] > p[i] && p[i] > p[i + 1]) ans++; } cout << ans << endl; return 0; }
[ "literal.number.change", "variable_declaration.value.change", "control_flow.loop.for.initializer.change", "expression.off_by_one" ]
795,503
795,504
u216525464
cpp
p02988
#include <bits/stdc++.h> using namespace std; int main() { int n; int ans = 0; vector<int> p(n); for (int i = 0; i < n; i++) cin >> p[i]; for (int i = 1; i < n - 1; i++) { if (p[i] == p[i - 1] + p[i] + p[i + 1] - min({p[i - 1], p[i], p[i + 1]}) - max({p[i - 1], p[i], p[i + 1]})) ans++; } cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n; int ans = 0; cin >> n; vector<int> p(n); for (int i = 0; i < n; i++) cin >> p[i]; for (int i = 1; i < n - 1; i++) { if (p[i] == p[i - 1] + p[i] + p[i + 1] - min({p[i - 1], p[i], p[i + 1]}) - max({p[i - 1], p[i], p[i + 1]})) ans++; } cout << ans << endl; return 0; }
[]
795,505
795,506
u578969098
cpp
p02988
#include <bits/stdc++.h> using namespace std; int n; vector<int> p; int main() { cin >> n; p.resize(n); for (int i = 0; i < n; i++) cin >> p[i]; int cnt = 0; for (int i = 1; i < n - 1; i++) { if ((p[i + 1] > p[i] && p[i] > p[i - 1]) && (p[i - 1] > p[i] && p[i] > p[i + 1])) cnt++; } cout << cnt << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int n; vector<int> p; int main() { cin >> n; p.resize(n); for (int i = 0; i < n; i++) cin >> p[i]; int cnt = 0; for (int i = 1; i < n - 1; i++) { if ((p[i + 1] > p[i] && p[i] > p[i - 1]) || (p[i - 1] > p[i] && p[i] > p[i + 1])) cnt++; } cout << cnt << endl; return 0; }
[ "misc.opposites", "control_flow.branch.if.condition.change" ]
795,509
795,510
u589508454
cpp
p02988
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; int main() { int n, k, flag; cin >> n; int a[n]; rep(i, n) { cin >> k; a[i] == k; } for (int i = 1; i < n - 1; i++) { if ((a[i] - a[i + 1]) * (a[i] - a[i - 1]) < 0) flag++; } cout << flag << endl; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; int main() { int n, k, flag = 0; cin >> n; int a[n]; rep(i, n) { cin >> k; a[i] = k; } for (int i = 1; i < n - 1; i++) { if ((a[i] - a[i + 1]) * (a[i] - a[i - 1]) < 0) flag++; } cout << flag << endl; }
[ "variable_declaration.value.change", "expression.operation.compare.replace.remove", "assignment.replace.add", "misc.typo" ]
795,517
795,518
u070779615
cpp
p02988
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; #define rep(i, n) for (int i = 0; i < (int)(n); i++) //二項係数の計算 int nCr(int A, int B) { ll ans = 1; for (int i = 0; i < B; i++) { ans *= A - i; } for (int i = 0; i < B; i++) { ans /= i + 1; } return ans; } int main() { int N; cin >> N; vector<int> p(N); int ans = 0; rep(i, N) { cin >> p[i]; } rep(i, N) { if (i == 0 || i == N - 1) { } else { if (p[i] < p[i - 1] && p[i + 1] < p[i]) { ans++; } else if (p[i] < p[i + 1] && p[i - 1] < p[i]) { ans++; } } cout << ans << endl; } }
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; #define rep(i, n) for (int i = 0; i < (int)(n); i++) //二項係数の計算 int nCr(int A, int B) { ll ans = 1; for (int i = 0; i < B; i++) { ans *= A - i; } for (int i = 0; i < B; i++) { ans /= i + 1; } return ans; } int main() { int N; cin >> N; vector<int> p(N); int ans = 0; rep(i, N) { cin >> p[i]; } rep(i, N) { if (i == 0 || i == N - 1) { } else { if (p[i] < p[i - 1] && p[i + 1] < p[i]) { ans++; } else if (p[i] < p[i + 1] && p[i - 1] < p[i]) { ans++; } } } cout << ans << endl; }
[]
795,535
795,536
u983563612
cpp
p02988
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int a; cin >> a; int b[a]; for (int i = 0; i < a; i++) cin >> b[i]; int ans = 0; for (int i = 0; i < a - 2; i++) { if (b[i] > b[i + 1] && b[i + 2] > b[i + 1]) ans++; if (b[i] < b[i + 1] && b[i + 2] < b[i + 1]) ans++; } cout << ans; }
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int a; cin >> a; int b[a]; for (int i = 0; i < a; i++) cin >> b[i]; int ans = 0; for (int i = 0; i < a - 2; i++) { if (b[i] > b[i + 1] && b[i + 2] < b[i + 1]) ans++; if (b[i] < b[i + 1] && b[i + 2] > b[i + 1]) ans++; } cout << ans; }
[ "misc.opposites", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
795,537
795,538
u079532978
cpp
p02988
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> p(n); for (int i = 0; i < n; i++) cin >> p.at(i); int ans = 0; for (int i = 0; i < n - 1; i++) { if (p[i - 1] > p[i] && p[i] > p[i + 1]) ans++; else if (p[i - 1] < p[i] && p[i] < p[i + 1]) ans++; } cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> p(n); for (int i = 0; i < n; i++) cin >> p.at(i); int ans = 0; for (int i = 1; i < n - 1; i++) { if (p[i - 1] > p[i] && p[i] > p[i + 1]) ans++; else if (p[i - 1] < p[i] && p[i] < p[i + 1]) ans++; } cout << ans << endl; return 0; }
[ "literal.number.change", "variable_declaration.value.change", "control_flow.loop.for.initializer.change", "expression.off_by_one" ]
795,544
795,545
u497715246
cpp
p02988
#include <algorithm> #include <cmath> //abs()かfabs()で少数絶対値 #include <cstdlib> //abs()で整数絶対値 #include <deque> #include <functional> //sort第三引数greater<型名>()で降順 #include <iomanip> //cout<<setw(数字) で空白による桁揃え #include <iostream> //cout<<right で右揃え #include <map> #include <queue> #include <string> #include <vector> using namespace std; using ll = long long int; int main() { int n; cin >> n; int ans = 0; vector<int> p(n); for (int i = 0; i < n; i++) cin >> p[i]; for (int i = 1; i < n - 1; i++) if ((p[i - 1] < p[i] && p[i] < p[i + 1]) || (p[i - 1] > p[i] && p[i]) > p[i + 1]) ans++; cout << ans << endl; return 0; }
#include <algorithm> #include <cmath> //abs()かfabs()で少数絶対値 #include <cstdlib> //abs()で整数絶対値 #include <deque> #include <functional> //sort第三引数greater<型名>()で降順 #include <iomanip> //cout<<setw(数字) で空白による桁揃え #include <iostream> //cout<<right で右揃え #include <map> #include <queue> #include <string> #include <vector> using namespace std; using ll = long long int; int main() { int n; cin >> n; int ans = 0; vector<int> p(n); for (int i = 0; i < n; i++) cin >> p[i]; for (int i = 1; i < n - 1; i++) if ((p[i - 1] < p[i] && p[i] < p[i + 1]) || (p[i - 1] > p[i] && p[i] > p[i + 1])) ans++; cout << ans << endl; return 0; }
[ "control_flow.branch.if.condition.change" ]
795,546
795,547
u022890424
cpp
p02988
#include <bits/stdc++.h> using namespace std; #define all(a) a.begin(), a.end() #define rep(i, n) for (int i = 0; i < n; i++) #define endl "\n" typedef long long ll; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; vector<int> v(n); rep(i, n) { cin >> v[i]; } int ans = 0; for (int i = 0; i < n - 1; i++) { if ((v[i - 1] < v[i]) && (v[i] < v[i + 1])) ans++; else if ((v[i - 1] > v[i] && v[i] > v[i + 1])) ans++; } cout << ans; return 0; }
#include <bits/stdc++.h> using namespace std; #define all(a) a.begin(), a.end() #define rep(i, n) for (int i = 0; i < n; i++) #define endl "\n" typedef long long ll; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; vector<int> v(n); rep(i, n) { cin >> v[i]; } int ans = 0; for (int i = 1; i < n - 1; i++) { if ((v[i - 1] < v[i]) && (v[i] < v[i + 1])) ans++; else if ((v[i - 1] > v[i] && v[i] > v[i + 1])) ans++; } cout << ans; return 0; }
[ "literal.number.change", "variable_declaration.value.change", "control_flow.loop.for.initializer.change", "expression.off_by_one" ]
795,550
795,551
u611594870
cpp
p02988
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> p(n); for (int i = 1; i <= n; i++) { cin >> p.at(i); } int ans = 0; for (int i = 2; i < n; i++) { if (p.at(i - 1) < p.at(i) && p.at(i) < p.at(i + 1)) { ans++; } else if (p.at(i - 1) > p.at(i) && p.at(i) > p.at(i + 1)) { ans++; } } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> p(n); for (int i = 0; i < n; i++) { cin >> p.at(i); } int ans = 0; for (int i = 1; i < n - 1; i++) { if (p.at(i - 1) < p.at(i) && p.at(i) < p.at(i + 1)) { ans++; } else if (p.at(i - 1) > p.at(i) && p.at(i) > p.at(i + 1)) { ans++; } } cout << ans << endl; }
[ "literal.number.change", "variable_declaration.value.change", "control_flow.loop.for.initializer.change", "expression.off_by_one", "expression.operator.compare.change", "control_flow.loop.for.condition.change", "expression.operation.binary.change", "misc.off_by_one" ]
795,552
795,553
u856957535
cpp
p02988
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define int long long #define fr(i, a, b) for (int i = a; i <= b; ++i) #define rep(i, a, b) for (int i = a; i < (b); ++i) #define trav(a, x) for (auto &a : x) #define all(x) begin(x), end(x) #define rall(x) (x).rbegin(), (x).rend() #define sz(x) (int)(x).size() #define pb push_back #define fst first #define snd second using namespace __gnu_pbds; using ordered_set = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>; // find_by_order(k):returns iterator to kth element starting from 0 // order_of_key(k):returns count of elements strictly smaller than k typedef long long ll; typedef pair<int, int> pii; typedef vector<int> vi; typedef long double ld; template <class T> using min_heap = priority_queue<T, vector<T>, greater<T>>; template <typename T> T gcd(T a, T b) { return (b ? __gcd(a, b) : a); } template <typename T> T lcm(T a, T b) { return (a * (b / gcd(a, b))); } template <typename T> void remdup(vector<T> &v) { sort(all(v)); v.erase(unique(all(v)), v.end()); } template <typename T> void re(vector<T> &v) { trav(i, v) cin >> i; } void unsyncIO() { ios_base::sync_with_stdio(0); cin.tie(0); } #ifdef np #include "C:\Users\navodit\Desktop\mycodes\pr.h" #else #define trace(...) #endif #define MOD 1000000007 void solve() { int n; cin >> n; vi p(n); re(p); int cnt = 0; for (int i = 1; i <= n; ++i) { vi v = {p[i - 1], p[i], p[i + 1]}; sort(all(v)); cnt += (v[1] == p[i]); } cout << cnt << endl; } signed main() { unsyncIO(); int tt = 1; // cin >> tt; rep(i, 0, tt) solve(); #ifdef np cout << endl << endl << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"; #endif return 0; }
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define int long long #define fr(i, a, b) for (int i = a; i <= b; ++i) #define rep(i, a, b) for (int i = a; i < (b); ++i) #define trav(a, x) for (auto &a : x) #define all(x) begin(x), end(x) #define rall(x) (x).rbegin(), (x).rend() #define sz(x) (int)(x).size() #define pb push_back #define fst first #define snd second using namespace __gnu_pbds; using ordered_set = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>; // find_by_order(k):returns iterator to kth element starting from 0 // order_of_key(k):returns count of elements strictly smaller than k typedef long long ll; typedef pair<int, int> pii; typedef vector<int> vi; typedef long double ld; template <class T> using min_heap = priority_queue<T, vector<T>, greater<T>>; template <typename T> T gcd(T a, T b) { return (b ? __gcd(a, b) : a); } template <typename T> T lcm(T a, T b) { return (a * (b / gcd(a, b))); } template <typename T> void remdup(vector<T> &v) { sort(all(v)); v.erase(unique(all(v)), v.end()); } template <typename T> void re(vector<T> &v) { trav(i, v) cin >> i; } void unsyncIO() { ios_base::sync_with_stdio(0); cin.tie(0); } #ifdef np #include "C:\Users\navodit\Desktop\mycodes\pr.h" #else #define trace(...) #endif #define MOD 1000000007 void solve() { int n; cin >> n; vi p(n); re(p); int cnt = 0; for (int i = 1; i + 1 < n; ++i) { vi v = {p[i - 1], p[i], p[i + 1]}; sort(all(v)); cnt += (v[1] == p[i]); } cout << cnt << endl; } signed main() { unsyncIO(); int tt = 1; // cin >> tt; rep(i, 0, tt) solve(); #ifdef np cout << endl << endl << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"; #endif return 0; }
[ "control_flow.loop.for.condition.change", "expression.operation.binary.change" ]
795,556
795,557
u128142444
cpp
p02988
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<ll, ll> P; typedef pair<int, int> Pi; #define rep(i, n) for (ll i = 0; i < n; i++) #define FOR(i, a, b) for (ll i = a; i < b; i++) #define fi first #define se second #define endl "\n" template <typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <typename T> ostream &operator<<(ostream &s, const complex<T> &d) { return s << "(" << d.real() << ", " << d.imag() << ")"; } template <typename T1, typename T2> ostream &operator<<(ostream &s, const pair<T1, T2> &d) { return s << "(" << d.first << ", " << d.second << ")"; } template <typename T> ostream &operator<<(ostream &s, const vector<T> &d) { int len = d.size(); rep(i, len) { s << d[i]; if (i < len - 1) s << " "; } return s; } template <typename T> ostream &operator<<(ostream &s, const vector<vector<T>> &d) { int len = d.size(); rep(i, len) { s << d[i] << endl; } return s; } template <typename T> ostream &operator<<(ostream &s, const set<T> &v) { s << "{ "; for (auto itr = v.begin(); itr != v.end(); ++itr) { if (itr != v.begin()) { s << ", "; } s << (*itr); } s << " }"; return s; } template <typename T> ostream &operator<<(ostream &s, const multiset<T> &v) { s << "{ "; for (auto itr = v.begin(); itr != v.end(); ++itr) { if (itr != v.begin()) { s << ", "; } s << (*itr); } s << " }"; return s; } template <typename T1, typename T2> ostream &operator<<(ostream &s, const map<T1, T2> &m) { s << "{" << endl; for (auto itr = m.begin(); itr != m.end(); ++itr) { s << " " << (*itr).first << " : " << (*itr).second << endl; } s << "}" << endl; return s; } const ll mod = 1'000'000'007; const ll inf = 1'000'000'000'000'000'00; const int INF = 1'000'000'000; const double EPS = 1e-10; const double PI = acos(-1); int main() { cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; vector<int> p(n); rep(i, n) cin >> p[i]; int ans = 0; FOR(i, 1, n - 1) { vector<int> vec; vec.push_back(p[i - 1]); vec.push_back(p[i]); vec.push_back(p[i + 1]); sort(begin(vec), end(vec)); if (vec[i] == p[i]) ans++; } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<ll, ll> P; typedef pair<int, int> Pi; #define rep(i, n) for (ll i = 0; i < n; i++) #define FOR(i, a, b) for (ll i = a; i < b; i++) #define fi first #define se second #define endl "\n" template <typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <typename T> ostream &operator<<(ostream &s, const complex<T> &d) { return s << "(" << d.real() << ", " << d.imag() << ")"; } template <typename T1, typename T2> ostream &operator<<(ostream &s, const pair<T1, T2> &d) { return s << "(" << d.first << ", " << d.second << ")"; } template <typename T> ostream &operator<<(ostream &s, const vector<T> &d) { int len = d.size(); rep(i, len) { s << d[i]; if (i < len - 1) s << " "; } return s; } template <typename T> ostream &operator<<(ostream &s, const vector<vector<T>> &d) { int len = d.size(); rep(i, len) { s << d[i] << endl; } return s; } template <typename T> ostream &operator<<(ostream &s, const set<T> &v) { s << "{ "; for (auto itr = v.begin(); itr != v.end(); ++itr) { if (itr != v.begin()) { s << ", "; } s << (*itr); } s << " }"; return s; } template <typename T> ostream &operator<<(ostream &s, const multiset<T> &v) { s << "{ "; for (auto itr = v.begin(); itr != v.end(); ++itr) { if (itr != v.begin()) { s << ", "; } s << (*itr); } s << " }"; return s; } template <typename T1, typename T2> ostream &operator<<(ostream &s, const map<T1, T2> &m) { s << "{" << endl; for (auto itr = m.begin(); itr != m.end(); ++itr) { s << " " << (*itr).first << " : " << (*itr).second << endl; } s << "}" << endl; return s; } const ll mod = 1'000'000'007; const ll inf = 1'000'000'000'000'000'00; const int INF = 1'000'000'000; const double EPS = 1e-10; const double PI = acos(-1); int main() { cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; vector<int> p(n); rep(i, n) cin >> p[i]; int ans = 0; FOR(i, 1, n - 1) { vector<int> vec; vec.push_back(p[i - 1]); vec.push_back(p[i]); vec.push_back(p[i + 1]); sort(begin(vec), end(vec)); if (vec[1] == p[i]) ans++; } cout << ans << endl; }
[ "identifier.replace.remove", "literal.replace.add", "variable_access.subscript.index.change", "control_flow.branch.if.condition.change" ]
795,560
795,561
u340010271
cpp
p02988
#include <algorithm> #include <iostream> #include <set> #include <vector> using namespace std; using P = pair<int, int>; int main() { int n; cin >> n; vector<int> a(n); for (int i = 0; n > i; i++) { cin >> a[i]; } int Z = 0; for (int i = 1; n - 1 > i; i++) { if (max({a[i - 1], a[i], a[i + 1]}) != a[i] && max({a[i - 1], a[i], a[i + 1]}) != a[i]) Z++; } cout << Z << endl; }
#include <algorithm> #include <iostream> #include <set> #include <vector> using namespace std; using P = pair<int, int>; int main() { int n; cin >> n; vector<int> a(n); for (int i = 0; n > i; i++) { cin >> a[i]; } int Z = 0; for (int i = 1; n - 1 > i; i++) { if (max({a[i - 1], a[i], a[i + 1]}) != a[i] && min({a[i - 1], a[i], a[i + 1]}) != a[i]) Z++; } cout << Z << endl; }
[ "misc.opposites", "identifier.change", "call.function.change", "control_flow.branch.if.condition.change" ]
795,568
795,569
u466161487
cpp
p02988
#include <bits/stdc++.h> //#include <boost/math/common_factor.hpp> using namespace std; #define ll long long int #define fast \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); #define mod 1000000007 #define endl '\n' int main() { fast int n; cin >> n; int a[n]; int cnt = 0; for (int i = 0; i < n - 2; ++i) cin >> a[i]; for (int i = 0; i < n - 2; ++i) { int b[3]; b[0] = a[i]; b[1] = a[i + 1]; b[2] = a[i + 2]; sort(b, b + 3); if (b[1] == a[i + 1]) cnt++; } cout << cnt; #ifndef ONLINE_JUDGE cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"; #endif }
#include <bits/stdc++.h> //#include <boost/math/common_factor.hpp> using namespace std; #define ll long long int #define fast \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); #define mod 1000000007 #define endl '\n' int main() { fast int n; cin >> n; int a[n]; int cnt = 0; for (int i = 0; i < n; ++i) cin >> a[i]; for (int i = 0; i < n - 2; ++i) { int b[3]; b[0] = a[i]; b[1] = a[i + 1]; b[2] = a[i + 2]; sort(b, b + 3); if (b[1] == a[i + 1]) cnt++; } cout << cnt; #ifndef ONLINE_JUDGE cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"; #endif }
[ "control_flow.loop.for.condition.change", "expression.operation.binary.remove" ]
795,572
795,573
u734938632
cpp
p02988
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int p[20]; for (int i = 0; i < n; i++) { cin >> p[i]; } int count = 0; for (int i = 1; i < n - 2; i++) { if (p[i - 1] < p[i] && p[i] < p[i + 1] || p[i - 1] > p[i] && p[i] > p[i + 1]) { count++; } } cout << count - 1 << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int p[20]; for (int i = 0; i < n; i++) { cin >> p[i]; } int count = 0; for (int i = 1; i < n - 1; i++) { if (p[i - 1] < p[i] && p[i] < p[i + 1] || p[i - 1] > p[i] && p[i] > p[i + 1]) { count++; } } cout << count << endl; }
[ "literal.number.change", "control_flow.loop.for.condition.change", "expression.off_by_one", "expression.operation.binary.change", "expression.operation.binary.remove" ]
795,574
795,575
u101777447
cpp
p02988
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int p[20]; for (int i = 0; i < n; i++) { cin >> p[i]; } int count = 0; for (int i = 1; i < n; i++) { if (p[i - 1] < p[i] && p[i] < p[i + 1] || p[i - 1] > p[i] && p[i] > p[i + 1]) { count++; } } cout << count - 1 << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int p[20]; for (int i = 0; i < n; i++) { cin >> p[i]; } int count = 0; for (int i = 1; i < n - 1; i++) { if (p[i - 1] < p[i] && p[i] < p[i + 1] || p[i - 1] > p[i] && p[i] > p[i + 1]) { count++; } } cout << count << endl; }
[ "control_flow.loop.for.condition.change", "misc.off_by_one", "expression.operation.binary.remove" ]
795,576
795,575
u101777447
cpp
p02988
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; int main() { int n; vector<int> p(20); cin >> n; for (int i = 0; i < n; i++) cin >> p[i]; int ans = 0; for (int i = 1; i < n - 1; i++) { if (p[i - 1] < p[i] && p[i] < p[i + 1]) ans++; else if (p[i - 1] > p[i] && p[i] > p[i + 1]) ans++; } cout << ans + 1 << endl; }
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; int main() { int n; vector<int> p(20); cin >> n; for (int i = 0; i < n; i++) cin >> p[i]; int ans = 0; for (int i = 1; i < n - 1; i++) { if (p[i - 1] < p[i] && p[i] < p[i + 1]) ans++; else if (p[i - 1] > p[i] && p[i] > p[i + 1]) ans++; } cout << ans << endl; }
[ "expression.operation.binary.remove" ]
795,577
795,578
u258108378
cpp
p02988
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; int main() { int n; vector<int> p(20); cin >> n; for (int i = 0; i < n; i++) cin >> p[i]; int ans = 0; for (int i = 1; i < n - 2; i++) { if (p[i - 1] < p[i] && p[i] < p[i + 1]) ans++; else if (p[i - 1] > p[i] && p[i] > p[i + 1]) ans++; } cout << ans + 1 << endl; }
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; int main() { int n; vector<int> p(20); cin >> n; for (int i = 0; i < n; i++) cin >> p[i]; int ans = 0; for (int i = 1; i < n - 1; i++) { if (p[i - 1] < p[i] && p[i] < p[i + 1]) ans++; else if (p[i - 1] > p[i] && p[i] > p[i + 1]) ans++; } cout << ans << endl; }
[ "literal.number.change", "control_flow.loop.for.condition.change", "expression.off_by_one", "expression.operation.binary.change", "expression.operation.binary.remove" ]
795,579
795,578
u258108378
cpp
p02988
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; vector<int> p(n); int result = 0; for (int i = 0; i < n; i++) { cin >> p[i]; } for (int i = 1; i < n - 1; i++) { if (p[i - 1] < p[i] && p[i] < p[i + 1]) { result++; } else if (p[i + 1] < p[i] && p[i - 1] < p[i]) { result++; } } cout << result << endl; }
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; vector<int> p(n); int result = 0; for (int i = 0; i < n; i++) { cin >> p[i]; } for (int i = 1; i < n - 1; i++) { if (p[i - 1] < p[i] && p[i] < p[i + 1]) { result++; } else if (p[i + 1] < p[i] && p[i] < p[i - 1]) { result++; } } cout << result << endl; }
[ "control_flow.loop.for.condition.change", "expression.operation.binary.remove", "control_flow.branch.if.condition.change", "misc.off_by_one" ]
795,586
795,587
u600215903
cpp
p02988
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; vector<int> p(n); int result = 0; for (int i = 0; i < n; i++) { cin >> p[i]; } for (int i = 1; i < n - 1; i++) { if (p[i - 1] < p[i] && p[i] < p[i + 1]) { result++; } else if (p[i - 1] < p[i] && p[i - 1] < p[i]) { result++; } } cout << result << endl; }
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; vector<int> p(n); int result = 0; for (int i = 0; i < n; i++) { cin >> p[i]; } for (int i = 1; i < n - 1; i++) { if (p[i - 1] < p[i] && p[i] < p[i + 1]) { result++; } else if (p[i + 1] < p[i] && p[i] < p[i - 1]) { result++; } } cout << result << endl; }
[ "misc.opposites", "expression.operator.arithmetic.change", "variable_access.subscript.index.change", "control_flow.branch.if.condition.change", "control_flow.loop.for.condition.change", "expression.operation.binary.remove", "misc.off_by_one" ]
795,588
795,587
u600215903
cpp
p02988
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; vector<int> p(n); int result = 0; for (int i = 0; i < n; i++) { cin >> p[i]; } for (int i = 1; i < n - 1; i++) { if (p[i - 1] < p[i] && p[i] < p[i + 1]) { result++; } else if (p[i - 1] > p[i] && p[i - 1] < p[i]) { result++; } } cout << result << endl; }
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; vector<int> p(n); int result = 0; for (int i = 0; i < n; i++) { cin >> p[i]; } for (int i = 1; i < n - 1; i++) { if (p[i - 1] < p[i] && p[i] < p[i + 1]) { result++; } else if (p[i + 1] < p[i] && p[i] < p[i - 1]) { result++; } } cout << result << endl; }
[ "misc.opposites", "expression.operator.arithmetic.change", "variable_access.subscript.index.change", "control_flow.branch.if.condition.change", "expression.operator.compare.change", "control_flow.loop.for.condition.change", "expression.operation.binary.remove", "misc.off_by_one" ]
795,589
795,587
u600215903
cpp
p02988
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; vector<int> p(n); int result = 0; for (int i = 0; i < n; i++) { cin >> p[i]; } for (int i = 1; i < n - 1; i++) { if (p[i - 1] < p[i] && p[i] < p[i + 1]) { result++; } else if (p[i - 1] < p[i] && p[i] < p[i - 1]) { result++; } } cout << result << endl; }
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; vector<int> p(n); int result = 0; for (int i = 0; i < n; i++) { cin >> p[i]; } for (int i = 1; i < n - 1; i++) { if (p[i - 1] < p[i] && p[i] < p[i + 1]) { result++; } else if (p[i + 1] < p[i] && p[i] < p[i - 1]) { result++; } } cout << result << endl; }
[ "misc.opposites", "expression.operator.arithmetic.change", "variable_access.subscript.index.change", "control_flow.branch.if.condition.change" ]
795,590
795,587
u600215903
cpp
p02988
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; vector<int> p(n); int result = 0; for (int i = 0; i < n; i++) { cin >> p[i]; } for (int i = 0; i < n; i++) { if (p[i - 1] < p[i] && p[i] < p[i + 1]) { result++; } else if (p[i - 1] < p[i] && p[i] < p[i - 1]) { result++; } } cout << result << endl; }
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; vector<int> p(n); int result = 0; for (int i = 0; i < n; i++) { cin >> p[i]; } for (int i = 1; i < n - 1; i++) { if (p[i - 1] < p[i] && p[i] < p[i + 1]) { result++; } else if (p[i + 1] < p[i] && p[i] < p[i - 1]) { result++; } } cout << result << endl; }
[ "literal.number.change", "variable_declaration.value.change", "control_flow.loop.for.initializer.change", "expression.off_by_one", "control_flow.loop.for.condition.change", "misc.off_by_one", "misc.opposites", "expression.operator.arithmetic.change", "variable_access.subscript.index.change", "cont...
795,591
795,587
u600215903
cpp
p02988
#include <bits/stdc++.h> #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) using namespace std; typedef long long ll; template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; } int main() { int N; cin >> N; vector<int> p(N); for (int i = 0; i < N; i++) cin >> p[i]; int count; for (int i = 0; i < N - 2; i++) { if (p[i] < p[i + 1] && p[i + 1] < p[i + 2]) count++; if (p[i + 2] < p[i + 1] && p[i + 1] < p[i]) count++; } cout << count << endl; return 0; } // cout << setprecision(13); // next_permutation(); //__gcd(); // reverse(); // set ,tuple ,pair; // bitset // vector.find // vector.count
#include <bits/stdc++.h> #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) using namespace std; typedef long long ll; template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; } int main() { int N; cin >> N; vector<int> p(N); for (int i = 0; i < N; i++) cin >> p[i]; int count = 0; for (int i = 0; i < N - 2; i++) { if (p[i] < p[i + 1] && p[i + 1] < p[i + 2]) count++; if (p[i + 2] < p[i + 1] && p[i + 1] < p[i]) count++; } cout << count << endl; return 0; } // cout << setprecision(13); // next_permutation(); //__gcd(); // reverse(); // set ,tuple ,pair; // bitset // vector.find // vector.count
[ "variable_declaration.value.change" ]
795,600
795,601
u005906204
cpp
p02988
#include <iostream> #include <vector> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; using ll = long long; using P = pair<int, int>; int main() { int n; cin >> n; vector<int> p(n); rep(i, n) { cin >> p[i]; } int count = 0; for (int i = 0; i < n - 2; i++) { if (p[i - 1] < p[i] && p[i] < p[i + 1]) { count++; } else if (p[i + 1] < p[i] && p[i] < p[i - 1]) { count++; } } cout << count << endl; return 0; }
#include <iostream> #include <vector> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; using ll = long long; using P = pair<int, int>; int main() { int n; cin >> n; vector<int> p(n); rep(i, n) { cin >> p[i]; } int count = 0; for (int i = 1; i < n - 1; i++) { if (p[i - 1] < p[i] && p[i] < p[i + 1]) { count++; } else if (p[i + 1] < p[i] && p[i] < p[i - 1]) { count++; } } cout << count << endl; return 0; }
[ "literal.number.change", "variable_declaration.value.change", "control_flow.loop.for.initializer.change", "expression.off_by_one", "control_flow.loop.for.condition.change", "expression.operation.binary.change" ]
795,603
795,604
u602267597
cpp
p02988
#include <iostream> using namespace std; int main() { int n, counter = 0; cin >> n; int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 1; i < (n - 1); i++) { if (a[i] > a[i - 1] && a[i] < a[i + 1]) counter++; else if (a[i] < a[i - 1] && a[i] > a[i + 1]) counter++; else continue; } }
#include <iostream> using namespace std; int main() { int n, counter = 0; cin >> n; int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 1; i < (n - 1); i++) { if (a[i] > a[i - 1] && a[i] < a[i + 1]) counter++; else if (a[i] < a[i - 1] && a[i] > a[i + 1]) counter++; else continue; } cout << counter; }
[]
795,607
795,608
u798780187
cpp
p02988
#include <algorithm> #include <array> #include <cmath> #include <iomanip> #include <iostream> #include <numeric> #include <string> #include <vector> using namespace std; int main() { int n; cin >> n; vector<int> ps(n); for (int i = 0; i < n; i++) { cin >> ps[i]; } int cnt; for (int i = 1; i < n - 1; i++) { if ((ps[i - 1] < ps[i] && ps[i] < ps[i + 1]) || (ps[i - 1] > ps[i] && ps[i] > ps[i + 1])) cnt++; } cout << cnt << endl; }
#include <algorithm> #include <array> #include <cmath> #include <iomanip> #include <iostream> #include <numeric> #include <string> #include <vector> using namespace std; int main() { int n; cin >> n; vector<int> ps(n); for (int i = 0; i < n; i++) { cin >> ps[i]; } int cnt = 0; for (int i = 1; i < n - 1; i++) { if ((ps[i - 1] < ps[i] && ps[i] < ps[i + 1]) || (ps[i - 1] > ps[i] && ps[i] > ps[i + 1])) cnt++; } cout << cnt << endl; }
[ "variable_declaration.value.change" ]
795,609
795,610
u579786106
cpp
p02988
#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; std::cin >> n; std::vector<int> p(n); rep(i, n) std::cin >> p[i]; int ans = 0; for (int i = 1; i < n - 1; ++i) { if ((p[i - 1] < p[i]) && (p[i] > p[i + 1])) ans++; else if ((p[i - 1] > p[i]) && (p[i] < p[i + 1])) ans++; } std::cout << ans << "\n"; 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; std::cin >> n; std::vector<int> p(n); rep(i, n) std::cin >> p[i]; int ans = 0; for (int i = 1; i < n - 1; ++i) { if ((p[i - 1] < p[i]) && (p[i] < p[i + 1])) ans++; else if ((p[i - 1] > p[i]) && (p[i] > p[i + 1])) ans++; } std::cout << ans << "\n"; return 0; }
[ "misc.opposites", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
795,613
795,614
u589238650
cpp
p02988
#include <bits/stdc++.h> using namespace std; int main() { int N; int p[30]; cin >> N; int res = 0; for (size_t i = 0; i < N; i++) { cin >> p[i]; } for (int i = 0; i < N - 1; i++) { if (p[i - 1] < p[i] && p[i] < p[i + 1]) { res++; } else if ((p[i - 1] > p[i] && p[i] > p[i + 1])) { res++; } } cout << res << '\n'; }
#include <bits/stdc++.h> using namespace std; int main() { int N; int p[30]; cin >> N; int res = 0; for (size_t i = 0; i < N; i++) { cin >> p[i]; } for (int i = 1; i < N - 1; i++) { if (p[i - 1] < p[i] && p[i] < p[i + 1]) { res++; } else if ((p[i - 1] > p[i] && p[i] > p[i + 1])) { res++; } } cout << res << '\n'; }
[ "literal.number.change", "variable_declaration.value.change", "control_flow.loop.for.initializer.change", "expression.off_by_one" ]
795,617
795,618
u182146635
cpp
p02988
#include <iostream> #include <vector> int main() { int n; std::cin >> n; std::vector<int> p; int temp; int cnt = 0; while (std::cin >> temp) p.push_back(temp); for (auto i = p.begin() + 2; i < p.end(); ++i) if ((*(i - 1) < *i && *i < *(i + 1)) || (*(i + 1) < *i && *i < *(i - 1))) ++cnt; std::cout << cnt << std::endl; return 0; }
#include <iostream> #include <vector> int main() { int n; std::cin >> n; std::vector<int> p; int temp; int cnt = 0; while (std::cin >> temp) p.push_back(temp); for (auto i = p.begin() + 1; i < p.end() - 1; ++i) if ((*(i - 1) < *i && *i < *(i + 1)) || (*(i + 1) < *i && *i < *(i - 1))) ++cnt; std::cout << cnt << std::endl; return 0; }
[ "literal.number.change", "control_flow.loop.for.initializer.change", "expression.off_by_one", "expression.operation.binary.change", "control_flow.loop.for.condition.change", "misc.off_by_one" ]
795,628
795,629
u864752370
cpp
p02988
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define rep1(i, n) for (int i = 1; i <= (n); i++) #define repm(i, m, n) for (int i = m; i < (n); i++) using namespace std; using ll = long long; using vi = vector<int>; using vvi = vector<vi>; using pii = pair<int, int>; int main() { int n; cin >> n; vi p(n); rep(i, n) cin >> p.at(i); int ans = 0; rep1(i, n - 1) { if (p.at(i - 1) < p.at(i) && p.at(i) < p.at(i + 1)) ans++; else if (p.at(i - 1) > p.at(i) && p.at(i) > p.at(i + 1)) ans++; } cout << ans << endl; return 0; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define rep1(i, n) for (int i = 1; i <= (n); i++) #define repm(i, m, n) for (int i = m; i < (n); i++) using namespace std; using ll = long long; using vi = vector<int>; using vvi = vector<vi>; using pii = pair<int, int>; int main() { int n; cin >> n; vi p(n); rep(i, n) cin >> p.at(i); int ans = 0; rep1(i, n - 2) { if (p.at(i - 1) < p.at(i) && p.at(i) < p.at(i + 1)) ans++; else if (p.at(i - 1) > p.at(i) && p.at(i) > p.at(i + 1)) ans++; } cout << ans << endl; return 0; }
[ "literal.number.change", "call.arguments.change", "expression.operation.binary.change" ]
795,632
795,633
u850516963
cpp
p02988
#include <bits/stdc++.h> #define sz(arr) (int)arr.size() #define All(arr) arr.begin(), arr.end() using namespace std; typedef long long ll; void _cin() {} template <class Head, class... Tail> void _cin(Head &&head, Tail &&...tail) { cin >> head; _cin(forward<Tail>(tail)...); } #define Cin(T, ...) \ T __VA_ARGS__; \ _cin(__VA_ARGS__) #define Cins(T, n, xs) \ vector<T> xs(n); \ for (int i = 0; i < n; ++i) \ cin >> xs[i] void Main() { Cin(int, n); Cins(int, n, vi); int ans = 0; for (int i = 2; i < n; ++i) { vector<int> tmp = {vi[i - 1], vi[i], vi[i + 1]}; sort(All(tmp)); if (tmp[1] == vi[i]) ans++; } cout << ans << endl; return; } int main() { cout << fixed << setprecision(15); Main(); return 0; }
#include <bits/stdc++.h> #define sz(arr) (int)arr.size() #define All(arr) arr.begin(), arr.end() using namespace std; typedef long long ll; void _cin() {} template <class Head, class... Tail> void _cin(Head &&head, Tail &&...tail) { cin >> head; _cin(forward<Tail>(tail)...); } #define Cin(T, ...) \ T __VA_ARGS__; \ _cin(__VA_ARGS__) #define Cins(T, n, xs) \ vector<T> xs(n); \ for (int i = 0; i < n; ++i) \ cin >> xs[i] void Main() { Cin(int, n); Cins(int, n, vi); int ans = 0; for (int i = 1; i < n - 1; ++i) { vector<int> tmp = {vi[i - 1], vi[i], vi[i + 1]}; sort(All(tmp)); if (tmp[1] == vi[i]) ans++; } cout << ans << endl; return; } int main() { cout << fixed << setprecision(15); Main(); return 0; }
[ "literal.number.change", "variable_declaration.value.change", "control_flow.loop.for.initializer.change", "expression.off_by_one", "control_flow.loop.for.condition.change", "misc.off_by_one" ]
795,646
795,647
u994307795
cpp
p02988
#include <algorithm> #include <bitset> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <math.h> #include <set> #include <stdlib.h> #include <string> #include <utility> #include <vector> using namespace std; typedef long long int ll; #define MOD 998244353 ll gcd(ll a, ll b) { if (a % b == 0) return (b); else return (gcd(b, a % b)); } int main() { ll n; cin >> n; vector<ll> p(n); for (ll i = 0; i < n; i++) { cin >> p[i]; } ll ans = 0; for (ll i = 0; i < n - 2; i++) { if (p[i] < p[i + 1] && p[i + 1] < p[i + 2]) ans++; else if (p[i] > p[i + 1] && p[i + 1] > p[i - 2]) ans++; } cout << ans << endl; return 0; }
#include <algorithm> #include <bitset> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <math.h> #include <set> #include <stdlib.h> #include <string> #include <utility> #include <vector> using namespace std; typedef long long int ll; #define MOD 998244353 ll gcd(ll a, ll b) { if (a % b == 0) return (b); else return (gcd(b, a % b)); } int main() { ll n; cin >> n; vector<ll> p(n); for (ll i = 0; i < n; i++) { cin >> p[i]; } ll ans = 0; for (ll i = 0; i < n - 2; i++) { if (p[i] < p[i + 1] && p[i + 1] < p[i + 2]) ans++; else if (p[i] > p[i + 1] && p[i + 1] > p[i + 2]) ans++; } cout << ans << endl; return 0; }
[ "misc.opposites", "expression.operator.arithmetic.change", "variable_access.subscript.index.change", "control_flow.branch.if.condition.change" ]
795,650
795,651
u474551232
cpp
p02988
// Author: getharshkumar #include <bits/stdc++.h> using namespace std; #define ll int64_t const ll N = 1e6 + 6, M = 1e9 + 7; ll p[N]; int main() { ios::sync_with_stdio(false), cin.tie(nullptr); ll n, c = 0; cin >> n; for (ll i = 0; i < n; i++) cin >> p[i]; for (ll i = 1; i + 1 < n; i++) { vector<ll> v(p + i, p + i + 2); sort(v.begin(), v.end()); c += (p[i] == v[1]); } cout << c; return 0; }
// Author: getharshkumar #include <bits/stdc++.h> using namespace std; #define ll int64_t const ll N = 1e6 + 6, M = 1e9 + 7; ll p[N]; int main() { ios::sync_with_stdio(false), cin.tie(nullptr); ll n, c = 0; cin >> n; for (ll i = 0; i < n; i++) cin >> p[i]; for (ll i = 1; i + 1 < n; i++) { vector<ll> v(p + i - 1, p + i + 2); sort(v.begin(), v.end()); c += (p[i] == v[1]); } cout << c; return 0; }
[ "assignment.change" ]
795,652
795,653
u319625425
cpp
p02988
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> p(n); for (int i = 0; i < n; ++i) cin >> p.at(i); int c = 0; for (int i = 0; i < n - 2; ++i) { bool c1 = p.at(i) <= p.at(i + 1) && p.at(i + 1) <= p.at(i + 2); bool c2 = p.at(i + 2) <= p.at(i + 1) && p.at(i + 1) <= p.at(i); if (c1 && c2) ++c; } cout << c << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> p(n); for (int i = 0; i < n; ++i) cin >> p.at(i); int c = 0; for (int i = 0; i < n - 2; ++i) { bool c1 = p.at(i) <= p.at(i + 1) && p.at(i + 1) <= p.at(i + 2); bool c2 = p.at(i + 2) <= p.at(i + 1) && p.at(i + 1) <= p.at(i); if (c1 || c2) ++c; } cout << c << endl; return 0; }
[ "misc.opposites", "control_flow.branch.if.condition.change" ]
795,657
795,658
u294683729
cpp
p02988
#include <bits/stdc++.h> using namespace std; using ll = long long; using vi = vector<int>; using vvi = vector<vi>; using vd = vector<double>; using vvd = vector<vd>; using vc = vector<char>; #define rep(i, x, n) for (int i = x; i < n; i++) #define all(x) x.begin(), x.end() int main() { int n, ans = 0; cin >> n; vi p(n); rep(i, 1, n) cin >> p[i]; rep(i, 1, n) { if ((p[i - 1] < p[i] && p[i] < p[i + 1]) || (p[i - 1] > p[i] && p[i] > p[i + 1])) { ans++; } } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; using ll = long long; using vi = vector<int>; using vvi = vector<vi>; using vd = vector<double>; using vvd = vector<vd>; using vc = vector<char>; #define rep(i, x, n) for (int i = x; i < n; i++) #define all(x) x.begin(), x.end() int main() { int n, ans = 0; cin >> n; vi p(n); rep(i, 0, n) cin >> p[i]; rep(i, 1, n - 1) { if ((p[i - 1] < p[i] && p[i] < p[i + 1]) || (p[i - 1] > p[i] && p[i] > p[i + 1])) { ans++; } } cout << ans << endl; }
[ "literal.number.change", "call.arguments.change" ]
795,659
795,660
u688825490
cpp