akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}
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;
}
int vector_finder(std::vector<ll> vec, int number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}

int main() {
  int N, M; cin >> N >> M;
  vector<vector<int>> tree(N + 1);
  REP(i, M) {
    int A, B; cin >> A >> B;
    tree[A].push_back(B);
    tree[B].push_back(A);
  }
  vector<int> ans(N + 1, 0);
  queue<int> q; q.push(1);
  while(!q.empty()) {
    int tmp = q.front(); q.pop();
    for(int i = 0; i < tree[tmp].size(); ++i) {
      if(ans[tree[tmp][i]] != 0) continue;
      ans[tree[tmp][i]] = tmp;
      q.push(tree[tmp][i]);
    }
  }
  cout << "Yes" << endl;
  for(int i = 2; i <= N; ++i) {
    cout << ans[i] << endl;
  }
}

Measured memory_bytes: 10148
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <cmath>
#include <functional>
#include <queue>
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n1,n2) for(int i=n1;i<n2;i++)
#define put(a) cout<<a<<endl;
using namespace std;
typedef long long ll;
//typedef unsigned long long ull;

const ll INF = 9223372036854775807;
const int inf = 2147483647;

int main() {
    int n,k;
    cin >> n >> k;
    ll res = 0;
    FOR(b,1,n+1){
        int p = n / b;
        int r = n % b;
        res += p*max(0,b-k);
        res += max(0,r-k+1);
    }
    if(k==0){
        res -= n;
    }
    put(res);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define r(i,a,b) for(register int i=a;i<=b;i++)
#define ID(c) ('0'<=(c)&&(c)<='9')
#define pb push_back
using namespace std;
const int N= 3333 ;
inline int qr()
{
	int x=0,f=1;char c=getchar();
	for(;!ID(c);c=getchar()) if(c=='-') f=-1;
	for(; ID(c);c=getchar()) x=(x<<3)+(x<<1)+(c^'0');
	return x*f;
}
ll INF=1e18;
ll a,b,c,d; 
ll ans[10];
int main()
{
	
	cin>>a>>b>>c>>d;
	 ans[1]=a*c;ans[2]=a*d;ans[3]=b*c;ans[4]=b*d;
	 ll maxn=-INF;
	for(int i=1;i<=4;i++)
	{
		maxn=max(maxn,ans[i]);
	}
	cout<<maxn<<endl;
 	return 0;
 } 

Measured memory_bytes: 3592
#pragma region _head

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
#include<iomanip>
#include<queue>
#include<stack>
#include<numeric>
#include<utility>
#include<regex>

#pragma region _define

#define int LL
#define f(i,a,b) for(LL i=a;i<b;i++)
#define f_vI(v,n) f(i,0,n)cin>>v[i]
#define f_v2I(v1,v2,n) f(i,0,n)cin>>v1[i]>>v2[i]
#define f_v3I(v1,v2,v3,n) f(i,0,n)cin>>v1[i]>>v2[i]>>v3[i]
#define f_vO(v,n) f(i,0,n)cout<<v[i]<<endl
#define ei else if
#define all(a) a.begin(),a.end()
#define size(s) ((LL)s.size())
#define F first
#define S second
#define check() cout<<"! ! !"
#define endl "\n"
#define _y() cout<<"Yes"<<endl
#define _Y() cout<<"YES"<<endl
#define _n() cout<<"No"<<endl
#define _N() cout<<"NO"<<endl
#define int_INF 1<<29
#define ll_INF 1LL<<60
#define MOD 1000000007

#pragma endregion

#pragma region _using

using namespace std;

using LL = long long;
using st = string;
using vi = vector<LL>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vd = vector<double>;
using vvd = vector<vd>;
using vvvd = vector<vvd>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<st>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvvb = vector<vvb>;
using qi = queue<LL>;
using qc = queue<char>;
using qs = queue<st>;
using si = stack<LL>;
using sc = stack<char>;
using ss = stack<st>;
using pi = pair<LL, LL>;
using mll = map<LL, LL>;
using mcl = map<char, LL>;
using vpi = vector<pi>;

#pragma endregion

void y_n(bool p) {
	p ? _y() : _n();
}

void Y_N(bool p) {
	p ? _Y() : _N();
}

LL gcd(LL a, LL b) {
	LL r;
	while ((r = a % b) != 0) {
		a = b;
		b = r;
	}
	return b;
}
LL lcm(LL a, LL b) {
	return (a / gcd(a, b) * b);
}

//素数判定
bool is_prime(int n) {
	for (int i = 2; i*i <= n; i++) {
		if (n % i == 0) {
			return false;
		}
	}
	return true;
}

//階乗計算
LL factorial(LL n) {
	LL a = 1, ret = 1;
	while (a < n) {
		a++;
		ret *= a;
		ret %= MOD;
	}
	return ret;
}

#pragma endregion 




/*****************************************************************************/
signed main(void) {
	cin.tie(0); ios::sync_with_stdio(false);

	int n;
	cin >> n;
	vd p(n);
	f_vI(p, n);
	vvd dp(n + 1, vd(n + 1, 0));
	dp[0][0] = 1.0;
	f(i, 0, n) {
		f(j, 0, i+1) {
			dp[i + 1][j + 1] += dp[i][j] * p[i];
			dp[i + 1][j] += dp[i][j] * (1.0 - p[i]);
		}
	}
	double ans = 0.0;
	f(i, (n + 1) / 2, n+1) {
		ans += dp[n][i];
	}
	cout << fixed << setprecision(10) << ans;
	return 0;
}

Measured memory_bytes: 70784
#include <bits/stdc++.h>
using namespace std;

int main(){
int N, K;
cin >> N >> K ;
vector<int>A(N) ;

for(int i=0; i<N;i++) cin >> A.at(i);

sort(A.begin(),A.end());
reverse(A.begin(),A.end());

int sum = 0;
for(int i=0;i<K;i++){
      sum = sum + A.at(i) ;
}

cout << sum << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define pb push_back
template<class T>void chmax(T &a,T b){if(a<b)a=b;}
template<class T>void chmin(T &a,T b){if(a>b)a=b;}
constexpr int INF=1000000000000000000;
constexpr int mod=1000000007;
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int kaijo[2000010];
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
void init_fact(){
    kaijo[0]=1;
    for(int i=1;i<=2000000;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=mod;
    }
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%mod;
    int memo=modpow(a,b/2);
    return memo*memo%mod;
}
int comb(int a,int b){
    if(!kaijo[0])init_fact();
    return kaijo[a]*modpow(kaijo[a-b],mod-2)%mod*modpow(kaijo[b],mod-2)%mod;
}
int inv(int x){
    x=modpow(x,mod-2);
    return x;
}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){
    double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
    double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
    double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
    double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
    return tc*td<0&&ta*tb<0;
}
int n,cnt[200010],a[200010],b[200010];
bool used[200010];
vector<int>v[200010];
void dfs(int x){
    used[x]=true;
    for(int i:v[x]){
        if(!used[i]){
            dfs(i);
            cnt[x]+=cnt[i];
        }
    }
}
signed main(){
    cin>>n;
    rep(i,n-1){
        cin>>a[i]>>b[i];
        a[i]--,b[i]--;
        v[a[i]].pb(b[i]);
        v[b[i]].pb(a[i]);
    }
    rep(i,n)cnt[i]=1;
    dfs(0);
    //rep(i,n)cerr<<cnt[i]<<endl;
    int half=inv(2);
    int ans=0;
    rep(i,n-1){
        int A=min(cnt[a[i]],cnt[b[i]]);
        int B=n-A;
        int AA=(1-modpow(half,A)+mod)%mod;
        int BB=(1-modpow(half,B)+mod)%mod;
        ans+=AA*BB%mod;
        ans%=mod;
    }
    ans-=n*half%mod;
    ans+=mod;
    ans%=mod;
    ans++;
    ans%=mod;
    ans-=modpow(half,n);
    ans+=mod;
    ans%=mod;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 23680
## 2020/01/19 Not yet
import heapq
N, M = map(int,input().split())
A = list(map(int,input().split()))

for i in range(N):
    A[i] *= -1

heapq.heapify(A)

for _ in range(M):
    x = heapq.heappop(A)
    heapq.heappush(A, (-x//2)*(-1))  

print(-sum(A))



Measured memory_bytes: 14184
#include <stdio.h>
int a, b, x, y;
int main() {
	scanf("%d%d%d%d", &a, &b, &x, &y);
	if (!(a % x + b % y)) {
		printf("No\n");
		return 0;
	}
	printf("Yes\n");
	for (int i = 1; i <= a; i++) {
		for (int j = 1; j <= b; j++) {
			if (i % x + j % y) {
				printf("1000");
			}
			else {
				printf("%d", -1000 * x * y + 999);
			}
			if (j == b)printf("\n");
			else printf(" ");
		}
	}
}

Measured memory_bytes: 1728
#include<bits/stdc++.h>
typedef long long ll;
typedef std::pair<int,int> P;
using namespace std;
int INF = 1LL << 30;
int MOD = 1e9+7;
main(){
    int N,C;
    cin >> N >> C;
    vector<int> S,T;
    vector<vector< P > >  Ch;
    Ch.resize(C);
    for(int i = 0;i < N;i++){
        int a,b,c;
        cin >> a >> b >> c;
        Ch[c-1].push_back(P(a,b));
    }
    for(int i = 0;i < C;i++){
        sort(Ch[i].begin(),Ch[i].end());
    }
    /*
    cout << endl;
    for(int i = 0;i < C;i++){
        for(auto p:Ch[i])cout << p.first << " " << p.second << endl;
        cout << endl;
    }
    */
    for(int i = 0;i < C;i++){
        if(!Ch[i].size())continue;
        int s = Ch[i][0].first,t = s;
        //cout << s << ":" << t << endl;
        for(auto p:Ch[i]){
            //cout << p.first << ":" << s << " " << p.second <<  ":" << t << endl;
            if(t != p.first){
                S.push_back(s);
                T.push_back(t);
                s = p.first;
            }
                t = p.second;
        }
        
        S.push_back(s);
        T.push_back(t);
    }
    /*
    for(int i = 0;i < S.size();i++){
        cout << S[i] << " " << T[i] << endl;
    }
    */
    vector<int> cnt(100010),imos(100010);
    for(int i = 0;i < S.size();i++){
        cnt[S[i]]++;
        cnt[T[i]+1]--;
    }
    for(int i = 1;i <= 100000;i++)imos[i] = imos[i-1] + cnt[i-1]; 
    int maxi = 0;
    
    for(int i = 0;i < 100000;i++){
        //cout << i << " " << imos[i] << endl;
        maxi = max(maxi, imos[i]);
    }
    cout << maxi << endl;
}

Measured memory_bytes: 3156
#include<bits/stdc++.h>
using namespace std;

//x,yを常にx>yにするfunction
/*
void func(int x, int y){
  int z;
  if(x<y){
    z = x;
    x = y;
    y = z;
  }
}
*/

int main(){
  int64_t N;
  int64_t K;
  cin >> N >> K;
  
  //func(N,K);
  int64_t z;
  
  
  bool q = true;
  while(q){
    
    N = N % K;  //N<K
    if(K-N>N){
      break;
    }
    
    z = N;
    N = K;
    K = z;
    
    
    //N = N % K;
    
    //func(N,K);
    /*
    if(N<K){
      z = N;
      N = K;
      K = z;
    }
    */
    
  }
  cout << N << endl;
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
	int n;
	cin >> n;
	int ans = 0;
	rep(i, n) {
		int a;
		cin >> a;
		ans += a - 1;
	}
	
	cout << ans << endl;
}

Measured memory_bytes: 256
//written by NewbieChd
#include <iostream>
using namespace std;

int main() {
    unsigned long long n, i, ans = 0;
    cin >> n;
    for (i = 1; i * i < n; ++i)
        if (n % i == 0 && i < n / i - 1)
            ans += n / i - 1;
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
sx, sy, tx, ty = map(int, input().split())
dx = tx - sx
dy = ty - sy

print('R' * dx + 'U' * dy + 'R' + 'D' * (dy + 1) + 'L' * (dx + 1) + 'U' + 'U' * dy + 'R' * dx + 'U' + 'L' * (dx + 1) + 'D' * (dy + 1) + 'R')


Measured memory_bytes: 3064
#include<iostream>
using namespace std;

int main() {
  int N; string S; cin >> N >> S;
  int l = 0, r = N-1, c = 0;
  while (l < r) {
    while (l < N && S[l] == 'R') l++;
    while (r >= 0 && S[r] == 'W') r--;
    if (l < r) c++;
    l++; r--;
  }
  cout << c << endl;
}

Measured memory_bytes: 3704
#include <iostream>
#include <cmath>
#include <string>
#include <list>
#include <iomanip>
#include <vector>
#include <bitset>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <set>
#include <cmath>
#define si short int
#define pii pair<int, int>
#define lli long long int
using namespace std;
int n;

bool comp(pair<int, lli> a, pair<int, lli> b) {
	if (a.first == b.first)
	{
		if (a.second < b.second)
		{
			return true;
		}
		else
		{
			return false;
		}
	}
	if (a.first > b.first)
	{
		return true;
	}
	else
	{
		return false;
	}
}

int main() {
	iostream::sync_with_stdio(false);

	cin >> n;
	lli onum = 0;
	vector<bool> k(n);
	lli p = 0;
	for (int i = 0; i < n; i++)
	{
		lli a;
		cin >> a;
		if (a != 0)
		{
			p += a;
		}
		else {
			onum += (lli)floor(p / 2);
			p = 0;
		}
	}
	onum += (lli)floor(p / 2);
	cout << onum;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(int (i) = 0; (i) < (n); (i)++)

const int nax = 1e5 + 5;
vector<int> edges[nax];
int in_degree[nax];
int dist[nax];
bool visited[nax];

void dfs(int a) {
    assert(!visited[a]);
    visited[a] = true;
    for(int b : edges[a]) {
        dist[b] = max(dist[b], dist[a] + 1);
        --in_degree[b];
        if(in_degree[b] == 0) {
            dfs(b);
        }
    }
}

int main() {
    int n, m;
    scanf("%d%d", &n, &m);
    while(m--) {
        int a, b;
        scanf("%d%d", &a, &b);
        edges[a].push_back(b);
        ++in_degree[b];
    }
    for(int i = 1; i <= n; ++i) {
        if(!visited[i] && in_degree[i] == 0) {
            dfs(i);
        }
    }
    int answer = 0;
    for(int i = 1; i <= n; ++i) {
        answer = max(answer, dist[i]);
    }
    printf("%d\n", answer);
}

Measured memory_bytes: 9728
#include <stdio.h>
int main(void){
    // Your code here!
    int a,b;
    int g[]={0,2,0,1,0,1,0,0,1,0,1,0};
    scanf("%d%d",&a,&b);
    if(g[a-1]==g[b-1]) printf("Yes");
    else printf("No");
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>

using namespace std;
 
int main() {

	int n;
	cin>>n;

	vector<int> d1(n+1), d2(n+1);

	for(int i=1; i<=n; i++) cin>>d1[i]>>d2[i];

	for(int i=3; i<=n; i++) {

		if(d1[i]==d2[i] && d1[i-1]==d2[i-1] && d1[i-2]==d2[i-2]) {
			cout<<"Yes"<<endl;
			return 0;
		}
	}

	cout<<"No"<<endl;

	return 0;
}

Measured memory_bytes: 3628
#include<stdio.h>
#include<stdlib.h>

int main() {
  int i ,n , a[100],j,min,k=0,ire,t,ff;
  scanf("%d",&n);
  if(n<1 || 100< n) exit(0);

  for(i=0;i<n;i++) {
    scanf("%d",&a[i]);
  }

  for(i=0;i<n;i++) {
    min = i;
    ff=0;
    for(j=i+1;j<n;j++) {

      if(a[j]<a[min]) {
	min=j;
	ff=1;
    }
    }
      if(ff==1) {
      ire=a[i];
      a[i]=a[min];
      a[min]=ire;
      k++;
      }
  }

  for(i=0;i<n;i++) {
    printf("%d",a[i]);
    if(i!=n-1) printf(" ");
  }
  printf("\n%d\n",k);
  return 0;
}



Measured memory_bytes: 2112
#include <bits/stdc++.h>
#include <iostream>
using namespace std; 
typedef long long lint;
vector <lint> vec;
int main(){
	int n;
	string a;
	cin>>n;
	cin>>a;
	for(int i=0;i<a.size();i++)a[i]=65+(a[i]+n-65)%26;
	for(int i=0;i<a.size();i++)cout<<a[i];
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define pb push_back
#define eb emplace_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define llbidx(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y) // 二要素間の距離
#define deg2rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad2deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)
#define Find(set, element) set.find(element) != set.end()

typedef pair<int, int> PI;
typedef pair<ll, ll> PLL;

template<class T>
inline bool chmax(T &a, T b) {
  if(a < b) {
    a = b;
    return true;
  }
  return false;
};

template<class T>
inline bool chmin(T &a, T b) {
  if(a > b) {
    a = b;
    return true;
  }
  return false;
};

int main() {
  int N, Y;
  cin >> N >> Y;
  Y /= 1000;
  int A, B, C;
  A = B = C = -1;
  rep(a, 0, N+1) {
    rep(b, 0, N+1 - a) {
      int c = N - a - b;
      if (a * 10 + b * 5 + c == Y) {
        A = a;
        B = b;
        C = c;
        break;
      }
    }
  }

  printf("%d %d %d\n", A, B, C);
};


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
bool tnot(bool t){
    if(t)return false;
    else return true;
}
int main(void){
    string s;
    cin>>s;
    ll n=s.length();
    vector<string>s0(n);
    rep(0,i,n){
        s0[i]=s.substr(i,1);
    }
    ll q;
    cin>>q;
    ll t=true;
    vector<string>s1,s2;
    rep(0,i,q){
        ll T;
        cin>>T;
        if(T==1){
            t= tnot(t);
        }else{
            ll f;
            string c;
            cin>>f>>c;
            if(f==1){
                if(t==true){
                    s1.push_back(c);
                }else{
                    s2.push_back(c);
                }
            }else{
                if(t==true){
                    s2.push_back(c);
                }else{
                    s1.push_back(c);
                }
            }
        }
    }
    ll ns1=s1.size();
    ll ns2=s2.size();
    if(t){
        rep(0,i,ns1){
            cout<<s1[ns1-1-i];
        }
        rep(0,i,n){
            cout<<s0[i];
        }
        rep(0,i,ns2){
            cout<<s2[i];
        }
        cout<<endl;
    }else{
        rep(0,i,ns2){
            cout<<s2[ns2-1-i];
        }
        rep(0,i,n){
            cout<<s0[n-1-i];
        }
        rep(0,i,ns1){
            cout<<s1[i];
        }
        cout<<endl;
    }
}


Measured memory_bytes: 17264
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define maxs(a, b) a = max(a, b)
#define mins(a, b) a = min(a, b)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll linf = (ll)4e18;
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	string s, t;
	cin >> s >> t;
	s += s;
	int n = s.size();
	vector<set<int>> is(26);
	rep(i, n) is[s[i] - 'a'].insert(i);
	int k = t.size();
	int pos = -1;
	ll ans = 0;
	bool ok = 1;
	rep(i, k) {
		int num = t[i] - 'a';
		if (is[num].size() == 0) {
			ok = 0;
			break;
		}
		auto itr = is[num].lower_bound(pos + 1);
		if (itr == is[num].end()) {
			ans += n - pos;
			ans += *is[num].begin();
			pos = *is[num].begin();
		}
		else {
			ans += *itr - pos;
			pos = *itr;
		}
	}
	if (ok) cout << ans << endl;
	else cout << -1 << endl;
	return 0;
}


Measured memory_bytes: 9964
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

#define print(a) {for(auto xxxxx : (a)) cout << xxxxx << ' '; cout << '\n';}
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

ll next(){ll x; cin >> x;return x;}
const int maxn = 3e5 + 2, intf = 2e9;
const ll inf = 2e18, mod = 998244353;
const ld eps = 1e-9;

ll ans = 2 , n;

void cnt(ll d){
	//ans++;
//	cout << d << '\n';

	ll m = n;
	while(m % d == 0) m /= d;

	ans += (m % d) == 1;
}

void solve(){
	cin >> n;
	if (n == 2){
		cout << 1 << '\n';
		return;
	}

	for (ll i = 2; i*i <= n; i++){
		if (n % i) continue;
		cnt(i);
		if (n / i != i) cnt(n / i);
	}

	n--;
	for (ll i = 2; i*i <= n; i ++){
		if (n % i == 0){
			ans++;
			if (n / i != i) ans++;
		}
	}

	cout << ans;
}

signed main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cout.precision(20);
    
    for (int t = 1; t--;) solve();

	return 0;
}
/*


*/



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define MOD 1000000007
#define MAX 200003

int main(){
  int N;
  cin>>N;
  vector<ll> A(N);
  ll sum=0;
  for(int i=0;i<N;i++){
    cin>>A[i];
    sum+=A[i];
  }
  sum%=MOD;
  sum=sum*sum%MOD;
  for(int i=0;i<N;i++){
    sum+=A[i]*(MOD-A[i]);
    sum%=MOD;
  }
  sum*=(MOD+1)/2;
  sum%=MOD;
  cout<<sum<<endl;
}


Measured memory_bytes: 4760
import Control.Applicative
import Data.List
import Text.Printf

main :: IO ()
main = do
  [w,h,x,y,r] <- map read . words <$> getLine
  putStrLn $ if solve w h x y r then "Yes" else "No"

solve :: Int -> Int -> Int -> Int -> Int -> Bool
solve w h x y r
  | x - r < 0 = False
  | x + r > w = False
  | y - r < 0 = False
  | y + r > h = False
  | otherwise = True



Measured memory_bytes: 3660
import Data.Char

splitBy :: Char -> String -> [String]
splitBy _ [] = []
splitBy a x =
  let s = takeWhile (/= a) x
      x'= dropWhile (/= a) x
  in
    if x' == []
    then [s]
    else s:(splitBy a $ drop 1 x')

ans s = map intToDigit $ map length $ splitBy ' ' s

main = do
  c <- getContents
  let i = takeWhile (/= "END OF INPUT") $ lines c
      o = map ans i
  mapM_ putStrLn o
  

Measured memory_bytes: 3696
// 標準入力
var fs = require('fs'),
length = fs.fstatSync(process.stdin.fd).size,
buffer = new Buffer(length),
bytesRead = fs.readSync(process.stdin.fd, buffer, 0, length, 0),
input = buffer.toString('hex', 0, bytesRead).split('0a'); // hexでreadしたら早い？
main();
 
function main(){
  // 26と互いに素の値
  var multiply = new Int8Array([1,3,5,7,9,11,15,17,19,21,23,25]);
  var lenj = multiply.length;
  var alphabets = new Int8Array(26);
  var convertTable = new Int8Array(123);
  for(var init = 123; init--;)
    convertTable[init] = init;

FIRST:for(var i = 1, leni = input.length - 1; i < leni; i++){
    var inp = input[i];
    var c = inp.split('20');
    var clen = c.length;
  
    for(var j = 0; j < lenj; j++){
      var alpha = multiply[j];
      for(var beta = 26; beta--;){
        for(var conv = 26; conv--;){ // a-zの変換表作成
          alphabets[conv] = (conv * alpha + beta) % 26 + 97;
        }

        // thatとthisの変換後のacsiiコードを取得
        var thatIs = alphabets[19].toString(16) + alphabets[7].toString(16) + alphabets[0].toString(16) + alphabets[19].toString(16);
        var thisIs = alphabets[19].toString(16) + alphabets[7].toString(16) + alphabets[8].toString(16) + alphabets[18].toString(16);

        var found = false;
        for(var d = clen; d--;){
          var cd = c[d];
          if(cd == thatIs || cd == thisIs){
            found = true;
            break;
          }
        }
        
        if(found){
          for(var conv = 26; conv--;){
            var fromCode = alphabets[conv];
            convertTable[fromCode] = conv + 97; // key-valueの入れ替え
          }
          
          var result = "";
          for(var k = 0; k < inp.length; k+=2){
            result += String.fromCharCode(convertTable[parseInt(inp[k] + inp[k+1], 16)]);
          }
          console.log(result);
          continue FIRST;
        }
        
      }
    }
  
  }
}

Measured memory_bytes: 9964
A, B, M = [int(i) for i in input().split()]
a_i = [int(i) for i in input().split()]
b_i = [int(i) for i in input().split()]
m_i = [[int(j) for j in input().split()] for i in range(M)]


min_v = 10**6
for m in m_i:
    v = a_i[m[0]-1] + b_i[m[1]-1] - m[2]

    if v < min_v:
        min_v = v

min_pair = min(a_i) + min(b_i)

if min_pair < min_v:
    min_v = min_pair

print(min_v)


Measured memory_bytes: 32496
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ld = long double;

#define rep(i, a, b) for (auto i = (a); i < (b); ++i)
#define trav(e, x) for (auto &e : x)
#define eb(x...) emplace_back(x)
#define all(x) begin(x), end(x)

template<class T> bool ckmin(T& a, const T& b) { return a > b ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

const int N = 1 << 17;
int cnt[N];

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);

	int n; cin >> n;

	ll s = 0;
	rep(i, 0, n) {
		int x; cin >> x; s += x;
		++cnt[x];
	}
	int q; cin >> q;
	while (q--) {
		int b, c; cin >> b >> c;
		s += cnt[b] * (c - b);
		cnt[c] += cnt[b];
		cnt[b] = 0;
		cout << s << '\n';
	}
}

Measured memory_bytes: 4016
#include <bits/stdc++.h>
using namespace std;
#define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long ll;

int main(){FIN
	
	ll a, b, c, m, n;
	cin >> a >> b >> c;
	n = c - a - b;
	m = 4 * a * b;
	if (n < 0)
		cout << "No\n";
	else {
		if (n * n > m)
			cout << "Yes\n";
		else
			cout << "No\n";
	}
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vp;

int gcd(int a, int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int lcm(int a, int b){
    return a*b/gcd(a,b);
}


signed main(void) {
    int n,m;
    cin >> n >> m;
    vi a(n);
    rep(i,n) cin >> a[i];
    loop(i,1,m+1){
        rep(j,n-1){
            if(a[j]%i > a[j+1]%i)swap(a[j],a[j+1]);
        }
    }
    rep(i,n)cout << a[i] << endl;
}



Measured memory_bytes: 3108
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#pragma GCC optimize("unroll-loops")
//#pragma warning(disable : 4996)

#ifdef _MSC_VER
#include <intrin.h>
#define __builtin_popcount __popcnt
#define __builtin_popcountll __popcnt64
#endif

#include <limits.h>
#include <math.h>
#include <time.h>

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <complex>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define FORR(i, m, n) for (int i = m - 1; i >= n; --i)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v, n) reverse(v, v + n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define print(x) cout << (x) << '\n'
#define pe(x) cout << (x) << " "
#define DEBUG(x) cout << #x << ": " << x << endl
#define lb(v, n) lower_bound(v.begin(), v.end(), (n))
#define ub(v, n) upper_bound(v.begin(), v.end(), (n))
#define int long long
//#define double long double
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i, v.size()) cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
template <typename T1, typename T2> inline void chmin(T1& a, T2 b) {
	if (a > b) a = b;
}
template <typename T1, typename T2> inline void chmax(T1& a, T2 b) {
	if (a < b) a = b;
}
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef array<int, 3> arr3;
std::random_device rd;
std::mt19937 mt(rd());
ll MOD = 998244353;
constexpr int MAX = 5050;
const double pi = acos(-1);
// constexpr double EPS = 1e-10;


void solve() {
	int N; cin >> N;
	vector<int>A(N), B(N);
	REP(i, N)cin >> A[i] >> B[i];
	vector<arr3>v;
	REP(i, N) {
		v.push_back({ A[i],i,0 });
		v.push_back({ B[i],i,1 });
	}
	VSORT(v);
	bool f0 = false, f1 = false;
	ll sum = 0;
	map<int, int>mpA, mpB;
	REP(i, N) {
		if (v[i][2] == 0)f0 = true;
		else f1 = true;
		sum += v[i][0];
		if (v[i][2] == 0) {
			mpA[v[i][1]]++;
		}
		else mpB[v[i][1]]++;
	}
	if (!f0 || !f1) {
		print(sum);
	}
	else {
		bool found = false;
		REP(i, N) {
			if (mpA.count(i) && mpB.count(i))found = true;
		}
		if (found)print(sum);
		else {
			if (v[N - 1][1] != v[N][1]) {
				sum -= v[N - 1][0];
				sum += v[N][0];
				print(sum);
			}
			else {
				int d = v[N + 1][0] - v[N - 1][0];
				chmin(d, v[N][0] - v[N - 2][0]);
				sum += d;
				print(sum);
			}
		}
	}
}
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	 //int q;
	 //cin >> q;
	 //while (q--)
	solve();
}


Measured memory_bytes: 14188
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <fstream>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <assert.h>
using namespace std;
#define eps 0.000000001
#define LONG_INF 10000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD 998244353
#define seg_size 65536*2
#define REP(i,n) for(long long i = 0;i < n;++i)
int main() {
	int n, k;
	cin >> n >> k;
	k--;
	REP(i, n) {
		int a;
		cin >> a;
		if (a == 1) {
			int left = i;
			int right = n - i - 1;
			int hoge = left % k + right % k;
			int ans = left / k + right / k;
			ans += (hoge + k - 1) / k;
			cout << ans << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define pb push_back
#define eb emplace_back
template<class T>void chmax(T &a,T b){if(a<b)a=b;}
template<class T>void chmin(T &a,T b){if(a>b)a=b;}
constexpr int INF=1000000000000000000;
constexpr int mod=1000000007;
constexpr double eps=1e-8;
const double pi=acos(-1);
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int Random(int mi,int ma){
    random_device rnd;
    mt19937 mt(rnd());//32bit
    //[mi,ma]
    uniform_int_distribution<int>engine(mi,ma);
    return engine(mt);
}
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%mod;
    int memo=modpow(a,b/2);
    return memo*memo%mod;
}
vector<int>kaijo,invkaijo;
void init_fact(int n){
    kaijo.resize(n+1);
    invkaijo.resize(n+1);
    kaijo[0]=1;
    for(int i=1;i<=n;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=mod;
    }
    rep(i,n+1)invkaijo[i]=modpow(kaijo[i],mod-2);
}
int comb(int a,int b){
    if(a<b)return 0;
    if(a<0||b<0)return 0;
    return kaijo[a]*invkaijo[a-b]%mod*invkaijo[b]%mod;
}
int inv(int x){
    x=modpow(x,mod-2);
    return x;
}

signed main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int n;
    cin>>n;
    if(n%1000==0)cout<<0<<endl;
    else cout<<1000-(n%1000)<<endl;
    return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#include <iostream>
#include <math.h>
using namespace std;
int main() {
    string w;
    cin >> w;
    int size = w.size();
    map<char, int>d;
    for (int i=0; i<size; i++) {
        if (d.count(w[i]) > 0) {
            d[w[i]] = d[w[i]] + 1;
        } else {
            d[w[i]] = 1;
        }
    }

    bool beautiful = true;
    for (auto c : d) {
        if (c.second % 2 != 0) {
            beautiful = false;
            break;
        }
    }

    if (beautiful) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3556
#include<iostream>
using namespace std;
int main(){
  int n,a[100000],q,b,ans=0;
  cin>>n;
  for(int i=0;i<n;i++)cin>>a[i];
  cin>>q;
  while(q--){
    cin>>b;
    int l=0,r=n,m;
    while(l<r){
      m=(l+r)/2;
      if(b<a[m])r=m;
      else l=m+1;
    }
    r--;
    if(a[r]==b)ans++;
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 1548
N = int(input())
A = list(map(int, input().split()))
col = [0]*9

for a in A:
  if 1 <= a <= 399:
    col[0] += 1
  elif 400 <= a <= 799:
    col[1] += 1 
  elif 800 <= a <= 1199:
    col[2] += 1 
  elif 1200 <= a <= 1599:
    col[3] += 1
  elif 1600 <= a <= 1999:
    col[4] += 1
  elif 2000 <= a <= 2399:
    col[5] += 1
  elif 2400 <= a <= 2799:
    col[6] += 1
  elif 2800 <= a <= 3199:
    col[7] += 1
  elif 3200 <= a:
    col[8] += 1

ans = 0
if col[8] == N:
  print(1, N)
  exit()
  
for i in range(8):
  if col[i] > 0:
    ans += 1
print(ans, end=" ")
ans += col[8]
print(ans)

Measured memory_bytes: 61532
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String num = br.readLine();
		int n = Integer.parseInt(num);
		int x = n / 100;
		int z = n % 10;

		if (x == z) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 21332
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,a,b) for(int i=(a),_end_=(b);i<=_end_;i++)
#define DREP(i,a,b) for(int i=(a),_end_=(b);i>=_end_;i--)
#define EREP(i,u) for(int i=start[u];i;i=e[i].next)
#define fi first
#define se second
#define mkr(a,b) make_pair(a,b)
#define SZ(A) ((int)A.size())
template<class T>inline void chkmin(T &a,T b){ if(a>b)a=b;}
template<class T>inline void chkmax(T &a,T b){ if(a<b)a=b;}
inline void myassert(bool a,string s){ if(!a)cerr<<s<<endl,exit(0);}
inline int read()
{
	int s=0,f=1;char ch=getchar();
	while(!isdigit(ch) && ch!='-')ch=getchar();
	if(ch=='-')ch=getchar(),f=-1;
	while(isdigit(ch))s=s*10+ch-'0',ch=getchar();
	return ~f?s:-s;
}

const int maxn=120;

int n,m,k,mod;
int jc[maxn],jcn[maxn],inv[maxn];
int pw[maxn][maxn*maxn];
int pwinv[maxn][maxn*maxn];

inline void init()
{
	n=read();m=read();k=read();mod=read();
	jc[0]=jc[1]=jcn[0]=jcn[1]=inv[1]=1;
	REP(i,2,100)jc[i]=(ll)jc[i-1]*i%mod,inv[i]=(ll)(mod-mod/i)*inv[mod%i]%mod,jcn[i]=(ll)jcn[i-1]*inv[i]%mod;
	REP(i,0,k)
	{
		pw[i][0]=pwinv[i][0]=1;
		REP(j,1,n*m)pw[i][j]=(ll)pw[i][j-1]*i%mod,pwinv[i][j]=(ll)pwinv[i][j-1]*inv[i]%mod;
	}
}

int f[maxn][maxn][maxn];
int g[maxn][maxn];

inline void doing()
{
	f[k+1][0][0]=1;
	REP(i,0,n)REP(j,0,m)f[k][i][j]=(ll)pw[k][i*j]*jcn[i]%mod*jcn[j]%mod;
	
	DREP(val,k-1,1)
	{
		/*REP(i,0,n)REP(j,0,m)REP(x,i,n)REP(y,j,m)REP(a,x,n)REP(b,y,m)
		{
			f[val][a][b]=(f[val][a][b]+(ll)f[val+1][i][j]*pw[val][a*b-i*j]%mod*jcn[x-i]%mod*jcn[y-j]%mod*jcn[a-x]%mod*jcn[b-y]%mod*pw[k-val][(n-i)*(m-j)-(n-x)*(m-y)]%mod*pw[k-val+1][(n-x)*(m-y)-(n-a)*(m-b)]%mod*(x+y-i-j&1?-1:1))%mod;
			}*/
		memset(g,0,sizeof(g));
		REP(i,0,n)REP(j,0,m)g[i][j]=(ll)f[val+1][i][j]*pwinv[val][i*j]%mod*pw[k-val][(n-i)*(m-j)]*(i+j&1?-1:1)%mod;
		DREP(i,n,0)DREP(j,m,0)
			REP(x,i+1,n)g[x][j]=(g[x][j]+(ll)g[i][j]*jcn[x-i])%mod;
		DREP(i,n,0)DREP(j,m,0)
			REP(y,j+1,m)g[i][y]=(g[i][y]+(ll)g[i][j]*jcn[y-j])%mod;
		REP(x,0,n)REP(y,0,m)g[x][y]=(ll)g[x][y]*pwinv[k-val][(n-x)*(m-y)]%mod*pw[k-val+1][(n-x)*(m-y)]*(x+y&1?-1:1)%mod;
		DREP(i,n,0)DREP(j,m,0)
			REP(x,i+1,n)g[x][j]=(g[x][j]+(ll)g[i][j]*jcn[x-i])%mod;
		DREP(i,n,0)DREP(j,m,0)
			REP(y,j+1,m)g[i][y]=(g[i][y]+(ll)g[i][j]*jcn[y-j])%mod;
		REP(a,0,n)REP(b,0,m)g[a][b]=(ll)g[a][b]*pw[val][a*b]%mod*pwinv[k-val+1][(n-a)*(m-b)]%mod;
		REP(i,0,n)REP(j,0,m)f[val][i][j]=g[i][j];
	}
	int ans=(ll)f[1][n][m]*jc[n]%mod*jc[m]%mod;
	ans=(ans+mod)%mod;
	printf("%d\n",ans);
}

int main()
{
	init();
	doing();
	return 0;
}


Measured memory_bytes: 19072
#include<iostream>
#include<cstdio>
#include<queue>
#include<vector>
#include<string.h>
#include<algorithm>
#include <cmath>

using namespace std;

int H,A,i,j,k,N;

int main()
{
  cin>>H>>N;
  A=0;
  for(i=0;i<N;i++)
  {
    cin>>k;
    A+=k;
  }
  
  if(A>=H) cout<<"Yes";
  else cout <<"No";

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define in ({int x=0;int c=getchar(),n=0;for(;!isdigit(c);c=getchar()) n=(c=='-');for(;isdigit(c);c=getchar()) x=x*10+c-'0';n?-x:x;})
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int rnd(int l,int r){return l+rng()%(r-l+1);}
#define fasty ios_base::sync_with_stdio(false),cin.tie(nullptr);
#define task "agc40a"
#define forinc(a,b,c) for(int a=b,_c=c;a<=_c;++a)
#define fordec(a,b,c) for(int a=b,_c=c;a>=_c;--a)
#define forv(a,b) for(auto&a:b)
#define fi first
#define se second
#define pb push_back
#define ii pair<int,int>
#define mt make_tuple
#define all(a) a.begin(),a.end()
#define reset(f, x) memset(f, x, sizeof(f))
#define bit(x,i) ((x>>(i-1))&1)
#define on(x,i) (x|(1ll<<(i-1)))
#define off(x,i) (x&~(1<<(i-1)))
main(){
    //freopen(task".inp","r",stdin);
    //freopen(task".out","w",stdout);
    string s; cin>>s; int n=s.size(),ret=0; s=" "+s;
    vector<ii> v;
    vector<int> ans(n+2);
    int j=1;
    forinc(i,2,n+1){
        if(i>n || s[i]!=s[i-1]){
            v.pb((s[j]=='<'?ii(j,i):ii(i,j)));
            j=i;
        }
    }
    sort(all(v),[](ii i,ii j){
        return abs(i.fi-i.se)>abs(j.fi-j.se);
    });
    forv(i,v){
        int j,t; tie(j,t)=i;
        if(j<=t){
            forinc(k,j,t) ans[k]=max(ans[k],k-j);
        } else{
            fordec(k,j,t) ans[k]=max(ans[k],j-k);
        }
    }
    forinc(i,1,n+1) ret+=ans[i];
    cout<<ret;
}
/**

 < > > > < < > < < < < < > > > <
0 3 2 1 0 1 2 0 1 2 3 4 5 2 1 0 1
0 1 2 1 0 1 1 0 1 2 3 4 3 2 1 0 1
1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7

*/



Measured memory_bytes: 10236
n,a,b=map(int,input().split())
s=input()
passed=0
rank_b=1
for i in range(n):
    if s[i]=="a":
        if passed<a+b:
            print("Yes")
            passed+=1
        else:
            print("No")
    elif s[i]=="b":
        if passed<a+b and rank_b<=b:
            print("Yes")
            rank_b+=1
            passed+=1
        else:
            print("No")
    else:
        print("No")

Measured memory_bytes: 9308
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

void shit(){
    int d,t,s;
    cin>>d>>t>>s;
    if(t*s>=d)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

int main() {
    int _=1;
//    cin>>_;
    while (_--){
        shit();
    }
    return 0;
}

Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int H = scan.nextInt();
		int W = scan.nextInt();
		String[] str = new String[H + 2];
		String tmp = "";
		for(int i = 0; i < W + 2; i++) {
			tmp += "#";
		}
		str[0] = tmp;
		str[str.length - 1] = tmp;
		for(int i = 1; i <= H; i++) {
			str[i] = "#" + scan.next() + "#";
		}
		for(int i = 0; i < str.length; i++) {
			System.out.println(str[i]);
		}
		scan.close();

	}

}


Measured memory_bytes: 21972
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = Integer.parseInt(sc.next());
    int b = Integer.parseInt(sc.next());
    int x = Integer.parseInt(sc.next());
    String ans = null;
    if(a + b >=  x){
      ans = "YES";
    }else{
      ans = "NO";
    }
    if(a > x){
      ans = "NO";
    }
    System.out.println(ans);
  }
}
      

Measured memory_bytes: 21588
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0; (i)<(n); ++(i))

const int INF = 1001001001;

int main(){
    int x;
    cin>>x;
    rep(i,8){
        if(x<600+i*200){
            cout<<8-i;
            return 0;
        }
    }

    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
#define mod 1000000007
#define init ios::sync_with_stdio(0), cin.tie(0);
typedef vector<int> vi;
typedef pair<int, int> pi;
#define MS(x, y) memset(x, y, sizeof(x))
#define F first
#define S second
#define PB push_back
#define MP make_pair

int main()
{
    init;
    int t;
    cin >> t;
    map<string, int> mp;
    while (t--)
    {
        string s;
        cin >> s;
        mp[s]++;
    }
    cout << "AC x " << mp["AC"] << endl;
    cout << "WA x " << mp["WA"] << endl;
    cout << "TLE x " << mp["TLE"] << endl;
    cout << "RE x " << mp["RE"] << endl;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;

int main()
{
  i64 n;
  cin >> n;
  vector<i64> x(n), y(n);
  for (i64 i = 0; i < n; i++)
    cin >> x[i] >> y[i];
  double ans = 1e9;
  for (i64 i = 0; i < n; i++)
    for (i64 j = i + 1; j < n; j++)
      for (i64 k = j + 1; k < n; k++)
      {
        double g, xc, yc;
        g = y[j] * x[i] - y[i] * x[j] + y[k] * x[j] - y[j] * x[k] + y[i] * x[k] - y[k] * x[i];
        xc = (double)((x[i] * x[i] + y[i] * y[i]) * (y[j] - y[k]) + (x[j] * x[j] + y[j] * y[j]) * (y[k] - y[i]) + (x[k] * x[k] + y[k] * y[k]) * (y[i] - y[j])) / (2 * g);
        yc = -(double)((x[i] * x[i] + y[i] * y[i]) * (x[j] - x[k]) + (x[j] * x[j] + y[j] * y[j]) * (x[k] - x[i]) + (x[k] * x[k] + y[k] * y[k]) * (x[i] - x[j])) / (2 * g);
        g = sqrt((xc - x[i]) * (xc - x[i]) + (yc - y[i]) * (yc - y[i]));
        bool ok = true;
        for (i64 l = 0; l < n; l++)
          if (g < sqrt((xc - x[l]) * (xc - x[l]) + (yc - y[l]) * (yc - y[l])))
            ok = false;
        if (ok)
          ans = min(ans, g);
      }
  for (i64 i = 0; i < n; i++)
    for (i64 j = i + 1; j < n; j++)
    {
      double xc = ((double)x[i] + x[j]) / 2, yc = ((double)y[i] + y[j]) / 2;
      double g = 0;
      for (i64 k = 0; k < n; k++)
        g = max(g, sqrt((xc - x[k]) * (xc - x[k]) + (yc - y[k]) * (yc - y[k])));
      ans = min(ans, g);
    }
  cout << fixed << setprecision(10) << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>

using namespace std;

int main()
{
  int N, K; cin >> N >> K;
  vector<int> x(N);
  for (int i = 0; i < N; ++i) cin >> x[i];

  int ans = 1e9;
  for (int i = 0; i < N-K+1; ++i) {
    int tmp = min(abs(x[i])+abs(x[i+K-1]-x[i]), abs(x[i+K-1])+abs(x[i+K-1]-x[i]));
    ans = min(ans, tmp);
  }

  cout << ans << endl;
}

Measured memory_bytes: 640
//==========//============================================================================
// Name        : Hello5.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <vector>
#include <bits/stdc++.h>
#include <numeric>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using p = pair<int,int>;//<key,value>


int main() {
double l;
cin>>l;
double ans=pow(l/3,3);
printf("%.10f\n",ans);
return 0;
}







Measured memory_bytes: 384
using System;

namespace questionC
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            var line1 = Console.ReadLine().Split(' ');
            var A = Int64.Parse(line1[0]);
            var B = Int64.Parse(line1[1]);
            var C = Int32.Parse(line1[2]);
            var D = Int32.Parse(line1[3]);

            var all = B - A + 1;
            var CCount = Count(A, B, C);
            var DCount = Count(A, B, D);
            var LCM = Lcm(C, D);
            var CDCount = Count(A, B, LCM);
            var canDevide = CCount + DCount - CDCount;

            Console.WriteLine(all - canDevide);

        }

        public static long Lcm(long a, long b)
        {
            long GCD = Gcd(a, b);
            long ab = a * b;
            long val = ab / GCD;
            return val;
        }

        public static long Gcd(long a, long b)
        {
            if (a < b)
                // 引数を入替えて自分を呼び出す
                return Gcd(b, a);
            while (b != 0)
            {
                var remainder = a % b;
                a = b;
                b = remainder;
            }
            return a;
        }

        static long Count(long A, long B, long n)
        {
            if (n < 0)
            {
                return 0;
            }
            var Adev = A / n;
            var Bdev = B / n;
            if (A % n == 0)
            {
                return Bdev - Adev + 1;
            }
            else
            {
                return Bdev - Adev;
            }
        }
    }
}


Measured memory_bytes: 13140
#include<iostream> 
#include <algorithm>
#include <vector>
#include <cstdlib>
#include <sstream>
#include <vector>

using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)

int main() {
	char n, a, b,x;
	cin >> n>>a>>b>>x ;
	if ((a == n && a == b)||( a == b && b == x)) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 3588
#include<iostream>
using namespace std;
int main(){
        int A,B;
        int count=0;
        cin >> A >> B;
        for(int i=A; i<=B; i++){
                if((i%10) != (i/10000))
                        continue;
                if(((i%1000))%100/10 != (i/1000)%10)
                        continue;
                
                count++;
        }
        cout << count << endl;
        return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;

int main(){
  int n,k;
  cin >> n >> k;
  vector<int> v(n+1,0);
  int d,a;
  for(int i=0;i<k;i++){
    cin >> d;
    for(int j=0;j<d;j++){
      cin >> a;
      v[a]++;
    }
  }
  int cnt = 0;
  for(int i=1;i<=n;i++){
    if(v[i]==0){
      cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
using namespace std;
#define int long long
#define pb push_back

int a, b, c;
int32_t main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	cin >> a >> b >> c;
	if (a+b < c) {
		cout << a+2*b+1;
		return 0;
	}
	if (a+b >= c) {
		cout << b+c;
		return 0;
	}
}

Measured memory_bytes: 3608
#include<stdio.h>
typedef long long ll;

int main(void)
{
  ll n,m,k;
  ll a[200010],b[200010];
  scanf("%lld %lld %lld",&n,&m,&k);
  for(ll i=0;i<n;i++){
    scanf("%lld",&a[i]);
  }

  for(ll i=0;i<m;i++){
    scanf("%lld",&b[i]);
  }


  ll sum_a[200010];
  ll sum_b[200010];


  sum_a[0]=0;
  for(int i=1;i<=n;i++){
    sum_a[i]=sum_a[i-1]+a[i-1];
  }

  sum_b[0]=0;
  for(int i=1;i<=m;i++){
    sum_b[i]=sum_b[i-1]+b[i-1];
  }

  // for(int i=0;i<=n;i++){
  //   printf("%lld\n",sum_a[i]);
  // }
  //
  //
  // for(int i=0;i<=m;i++){
  //   printf("%lld\n",sum_b[i]);
  // }
  //

  ll max=0;
  ll j=m;
  for(ll i=0;i<=n;i++){
    if(sum_a[i]<=k){
      while(sum_b[j]>k-sum_a[i]){
        j--;
      }
      //printf("i,j %lld %lld \n",i,j);
      if(i+j>max)max=i+j;
    }
  }

  printf("%lld\n",max);
  return 0;
}


Measured memory_bytes: 7972
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <iomanip>
#include <map>
using namespace std;

void solve(){
  int n, a, b; cin >> n >> a >> b;
  if(a * n > b) cout << b << endl;
  else cout << a * n << endl;
  return;
}

int main(){
  solve();
  return 0;
}


Measured memory_bytes: 256