akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) std::cout << x << '\n'
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define sz(x) ((int)(x).size())
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INF = INT_MAX / 2;
const ll  inf = LLONG_MAX / 2;
const int mod = 1000000007;
const int MAX_N = 101010;
const long double PI = acos(-1);

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(10);
	/*------------------------------*/

	int n, a;
	cin >> n >> a;

	int amari = n % 500;
	if (amari <= a) {
		out("Yes");
	}
	else {
		out("No");
	}

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) ((int)(x).size())
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{       
    int N; cin>>N;
    string s; cin>>s;

    int cur=0;
    for(int i=1;i<N;i++) cur+=(s[i]=='E');
    int ans=cur;

    for(int i=1;i<N;i++){
        if(s[i-1]=='W') cur++;
        if(s[i]=='E') cur--;
        ans=min(ans,cur);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 900
import sys
readline = sys.stdin.readline
MOD = 10**9+7
def frac(limit):
    frac = [1]*limit
    for i in range(2,limit):
        frac[i] = i * frac[i-1]%MOD
    fraci = [None]*limit
    fraci[-1] = pow(frac[-1], MOD -2, MOD)
    for i in range(-2, -limit-1, -1):
        fraci[i] = fraci[i+1] * (limit + i + 1) % MOD
    return frac, fraci
frac, fraci = frac(1341398)
def comb(a, b):
    if not a >= b >= 0:
        return 0
    return frac[a]*fraci[b]*fraci[a-b]%MOD

N = int(readline())

f = [0]*N

for k in range(1, N):
    if 2*k < N:
        continue
    f[k] = comb(k-1, 2*k-N)

g = [f[i]*frac[i]*frac[N-1-i]%MOD for i in range(N)]

ans = 0

for k in range(1, N):
    ans = (ans + k*(g[k] - g[k-1]))%MOD

print(ans)


Measured memory_bytes: 210432
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        long N = scanner.nextLong();
        long[] num = new long[50];
        int k = 0;
        while(N > 0) {
            num[++k] = (N - 1) % 26;
            N--;
            N /= 26;
        }
        String ans = "";
        for (int i = k; i > 0; i--) {
            char c = (char) (97 + num[i]);
            ans += c;
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 38836
N, Q = map(int, input().split())
S = input()
L = [0]*Q 
R = [0]*Q
for q in range(Q):
    l, r = map(int, input().split())
    L[q] = l
    R[q] = r
ans = [0]*Q 
accumulative_count = [0]*(N) 
accumulative_count[0] = 0 
for i in range(1, N, 1): 
    accumulative_count[i] = accumulative_count[i-1]
    if (S[i-1:i] == 'A') & (S[i:i+1] == 'C'):
        accumulative_count[i] = accumulative_count[i-1] + 1
for q in range(Q):
    print(accumulative_count[R[q]-1] - accumulative_count[L[q]-1])


Measured memory_bytes: 14968
n,y = map(int,input().split())
f = False
for i in range(n+1):
    for j in range(n-i+1):
        if 10000 * i + 5000 * j + (n-i-j) * 1000 == y:
            f = True
            print(i,j,n-i-j)
            break
    if f :
        break
if f == False :
    print("-1 -1 -1")

Measured memory_bytes: 3060
#include "bits/stdc++.h"
using namespace std;

int main() {
	long long W, H, A[1000], B[1000];
	cin >> W >> H;
	for (int i = 0; i < W; i++) cin >> A[i];
	for (int i = 0; i < H; i++) cin >> B[i];
	sort(A, A + W, greater<long long>());
	sort(B, B + H, greater<long long>());
	for (int i = 0; i < W; i++) {
		for (int j = 0; j < A[i]; j++) {
			if (B[j] == 0) {
				cout << 0 << endl;
				return 0;
			}
			B[j]--;
		}
		sort(B, B + H, greater<long long>());
	}
	if (B[0] != 0) {
		cout << 0 << endl;
		return 0;
	}
	cout << 1 << endl;
}


Measured memory_bytes: 3156
n, m = map(int,input().split())
a = []
b = []
c = []

for i in range(0, n):
  j = list(map(int, input().split()))
  a.append(j)

for i in range(0, m):
  b.append(int(input()))

for i in range(0, n):
  c = 0
  for j in range(0, m):
    c += a[i][j] * b[j]
  print(c)


Measured memory_bytes: 6008
#include<bits/stdc++.h>
using namespace std;
#define N 1111116
#define next nxt

int n,x[N],y[N],next[N],p[N],f[N],g[N],ans;

int read(){
	int x=0,f=1;char ch=getchar();
	for (;!isdigit(ch);ch=getchar()) if (ch=='-')  f=-f;
	for (;isdigit(ch);ch=getchar()) x=x*10+ch-'0';
	return x*f;
}

void travel(int x){
	int tmp=0,t=0;
	for (int t=p[x];t;t=next[t])
		if (f[x]!=y[t]){
			f[y[t]]=x;travel(y[t]);
			tmp|=g[x]&g[y[t]];g[x]|=g[y[t]];
		}
	while ((1<<t)<=tmp||(1<<t)&g[x]) t++;
	g[x]=(g[x]>>t<<t)|(1<<t);
	ans=max(ans,t);
}

int main(){
	n=read();
	for (int i=1;i<=n-1;i++){
		x[2*i-1]=y[2*i]=read();
		y[2*i-1]=x[2*i]=read();
		next[2*i-1]=p[x[2*i-1]];p[x[2*i-1]]=2*i-1;
		next[2*i]=p[x[2*i]];p[x[2*i]]=2*i;
	}
	travel(1);printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 14336
#!/usr/bin/env python3
n = int(input())

ans = 999999

for i in range(1, n):
    a = [int(c) for c in str(i)]
    b = [int(c) for c in str(n - i)]

    k = sum(a) + sum(b)

    if k < ans:
        ans = k

print(ans)

Measured memory_bytes: 9128
//#pragma GCC optimize "trapv"
//-D_GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define ii pair<int,int>
#define Max 100000+5
#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define f first
#define s second
#define pb push_back
int mod = 1000000007;
int mod1 = 998244353;
vector<int> g[Max];
bool vis[Max];
int d, x, y;
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
void ex(int A, int B) {
    if(B == 0) {
        d = A;
        x = 1;
        y = 0;
    }
    else {
        ex(B, A%B);
        int temp = x;
        x = y;
        y = temp - (A/B)*y;
    }
}


void dfs(int u){

	vis[u]=1;
	for(int i=0;i<g[u].size();i++){
		int v=g[u][i];
		if(vis[v]!=1)
			dfs(v);
	}
}



int power(int a,int b){
    if(b==1)return a;
    if(a>mod)a%=mod;
    int r=1;
    while(b){
        if(b&1)r=r%mod*a%mod;
        a=a%mod*a%mod;
        b/=2;
    }
    return r;
}
class uf{
    vector<int> v;
    vector<int> sz;
    
    
    public :
    uf(int n){
        v.resize(n+1);
        iota(v.begin()+1,v.end(),1);
        sz.resize(n+1,1);
        //1 to sz
    }
    int root(int b){
        while(v[b]!=b){
            b = v[b];
        }   
        return b;
    }
    void u(int a, int b){
        //combine a and b
        
        int ra=root(a);
        int rb=root(b);
        if(ra==rb)return ;
        if(sz[ra]<sz[rb]){
            v[ra] = v[rb];
            sz[rb]+=sz[ra];
        }else{
            v[rb]=v[ra];
            sz[ra]+=sz[rb];
        }
    }
    bool f(int a,int b){
        //same set
        return (root(a)==root(b));
    }
   
    
};
vector<int> matmul(vector<int> a,vector<int> b){
    vector<int> c(4,0);
    c[0] = (a[0]%mod*b[0]%mod + a[1]%mod*b[2]%mod)%mod;
    c[1] = (a[0]%mod*b[1]%mod + a[1]%mod*b[3]%mod)%mod;
    c[2] = (a[2]%mod*b[0]%mod + a[3]%mod*b[2]%mod)%mod;
    c[3] = (a[2]%mod*b[1]%mod + a[3]%mod*b[3]%mod)%mod;
    return c;
}
vector<int> id={1,0,0,1};

int32_t main(){
	IO
	//freopen("input.txt","r",stdin);
    	//freopen("output.txt","w",stdout);
	int n;
  	cin>>n;
  	vector<int> v(n+1);
  	for(int i=1;i<=n;i++)cin>>v[i];
  	sort(all(v));
    double ans = (double)v[1];
  	for(int i=2;i<=n;i++){
    	ans = (ans+v[i])/2;  
    }
  	printf("%lf",ans);
  	
}


Measured memory_bytes: 6080
#include <cstdio>
#include <cmath>
#include <cstring>
#include <iostream>
#include <sstream>
#include <bitset>
#include <memory>
#include <string>
#include <vector>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <deque>
#include <algorithm>
#include <random>
#include <iomanip>
using namespace std;

int main(int argc, char *argv[]) {
	int n;
	cin >> n;
	cout << n / 2 + n % 2 << endl;
}









Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>

using std::cin;using std::cout;using std::cerr;using std::endl;

#define rep(i,a,b) for(int i = a;i <= b;++i)
#define per(i,a,b) for(int i = a;i >= b;--i)

const int mmax = 2e5;
int n,k;
int ovo[mmax + 10];

int main(){

	std::ios::sync_with_stdio(0);
	cin.tie(0);

	cin>>n>>k;
	for(int i = 1;i <= n;i++){
		cin>>ovo[i];
	}
	for(int i = k + 1;i <= n;i++){
		if(ovo[i]>ovo[i - k]) cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
	}



	return 0;
}

Measured memory_bytes: 4432
#include<iostream>
using namespace std;
const int N = 2e5 + 9;
long long n, ans, a[N], cnt[N];
 
int main() {
	cin>>n;
	for (int i = 1; i <= n; ++i) {
        cin>>a[i];
        ++cnt[a[i]];
    }
	for (int i = 1; i <= n; ++i) ans += cnt[i] * (cnt[i] - 1) / 2;
	for (int i = 1; i <= n; ++i)
		cout<<ans - cnt[a[i]] + 1<<endl;
	return 0;
}

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

int main() {
  int x,y,a,b,c;
  cin >> x >> y >> a >> b >> c;
  
  vector<int> p(a);
  for(int i=0; i<a; i++){
    cin >> p[i];
  }
  vector<int> q(b);
  for(int i=0; i<b; i++){
    cin >> q[i];
  }
  vector<int> r(c);
  for(int i=0; i<c; i++){
    cin >> r[i];
  }
  
  sort(p.begin(),p.end());
  sort(q.begin(),q.end());
  sort(r.begin(),r.end());
  
  vector<int> apple(x+y+c);
  for(int i=0; i<x; i++){
    apple[i] = p[a-x+i];
  }
  for(int i=0; i<y; i++){
    apple[x+i] = q[b-y+i];
  }
  for(int i=0; i<c; i++){
    apple[x+y+i] = r[i];
  }
  sort(apple.begin(),apple.end());
  reverse(apple.begin(),apple.end());
  long ans = 0;
  for(int i=0; i<x+y; i++){
    ans += apple[i];
  }
  cout << ans << endl;
}

Measured memory_bytes: 2560
/**
 *    author:  tourist
 *    created: 29.12.2019 23:02:09       
**/
#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a, b;
  cin >> a >> b;
  vector<string> s(100, string(100, '.'));
  for (int i = 0; i < 50; i++) for (int j = 0; j < 100; j++) s[i][j] = '#';
  for (int i = 0; i < 50; i += 2) for (int j = 0; j < 100; j += 2) if (a > 1) { s[i][j] = '.'; --a; }
  for (int i = 0; i < 50; i += 2) for (int j = 0; j < 100; j += 2) if (b > 1) { s[100 - 1 - i][j] = '#'; --b; }
  cout << 100 << " " << 100 << '\n';
  for (int i = 0; i < 100; i++) cout << s[i] << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
#include <string.h>
#include <numeric>
using namespace std;

#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(i,v) for(auto &(i):(v))
#define eachr(i,v) for(auto &(i)=(v).rbegin();(i)!=(v).rend();(i)++)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())
#define endl "\n"

//typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a/gcd(a,b)*b;}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;



int x, y, z, k, a[1010], b[1010], c[1010], l, r = 30000000001ll;

bool ok(int m) {
	int s = 0;
	rep(i,x) rep(j,y) {
		int t = a[i] + b[j];
		int tt = lower_bound(c, c+z, m-t) - c;
		s += z-tt;
	}
	return s>=k;
}

void solve(int m) {
	vector<int> res;
	rep(i,x) rep(j,y) {
		int t = a[i] + b[j];
		int tt = lower_bound(c, c+z, m-t) - c;
		reps(id,tt,z) res.push_back(t + c[id]);
	}
	sort(all(res)), reverse(all(res));
	rep(i,k) cout << res[i] << endl;
}

signed main() {
	cin >> x >> y >> z >> k;
	rep(i,x) cin >> a[i];
	rep(i,y) cin >> b[i];
	rep(i,z) cin >> c[i];
	sort(a,a+x); //, reverse(a,a+x);
	sort(b,b+y); //, reverse(b,b+y);
	sort(c,c+z); //, reverse(c,c+z);
	while (r-l>1) {
		int m = (l+r)/2;
		(ok(m) ? l : r) = m;
	}
	solve(l);
}


Measured memory_bytes: 132444
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const ll p=998244353ll;
const int N=200005;
template<class IT>inline void cmin(IT &a,IT b){if(b<a)a=b;}
template<class IT>inline void cmax(IT &a,IT b){if(a<b)a=b;}

int main(){
	int n,i,a,c=0;
	scanf("%d",&n);
	for(i=1;i<=n;++i){scanf("%d",&a);c+=(a!=i);}
	if(!c||c==2)puts("YES");else puts("NO");
	return 0;
}

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

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = int_fast64_t;
using pll = pair<ll,ll>;
constexpr ll INF = 1LL<<60;
constexpr ll MOD = 1e9+7;
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;}
#if loc||local
void dump(){cerr<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cerr<<h<<", ";dump(forward<Ts>(t)...);}
#else
void dump(){}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){}
#endif
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T> ostream &operator<<(ostream& os,vector<T>const& v){for(auto const& vi:v)os<<vi<<" ";return os;}
template<class T,class U> ostream &operator<<(ostream& os,pair<T,U>const& p){os<<p.first<<","<<p.second;return os;}
template<class T>vector<T> vec(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto vec(size_t a, Ts... ts){return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...));}

signed main(){

  vector<ll> a(5);
  cin>>a;
  rep(i,5)if(a[i]==0){
    cout<<i+1<<endl;
    return 0;
  }

}

Measured memory_bytes: 3624
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <fstream>
#include <iomanip>
using namespace std;
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toStr(T x) { ostringstream sout; sout << x; return sout.str(); }
typedef vector<int> vi;
typedef vector<vi>  vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = INT_MAX / 2;
const int MOD = 1000000007;
typedef vector<ll> vl;
typedef vector<vl> vvl;

ll gcd(ll x, ll y) {
	if (x < y) {
		swap(x, y);
	}
	if (y == 0) {
		return x;
	}
	return gcd(y, x%y);
}

int main() {
	ll N, X;
	cin >> N >> X;

	cout << 3 * (N - gcd(N, X)) << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e6+10;
const ll mod = 1e6+3;
ll q,x,d,n;
ll num[N];
void init()
{
	num[1]=1;
	for(ll i=2;i<=mod;i++)
	num[i]=num[i-1]*i%mod;
}
ll ksm(ll a,ll p)
{
	ll res=1;
	while(p)
	{
		if(p&1)
		res=res*a%mod;
		a=a*a%mod;
		p>>=1;
	}
	return res;
}
int main()
{
	init();
	scanf("%lld",&q);
	while(q--)
	{
		scanf("%lld%lld%lld",&x,&d,&n);
		if(d==0)
		printf("%lld\n",ksm(x,n));
		else
		{
			ll sa=x*ksm(d,mod-2)%mod;
			ll en=sa+n-1;
			if(sa==0||en>=mod)
			printf("0\n");
			else
			{
				ll res=num[en]*ksm(num[sa-1],mod-2)%mod;
				res=res*ksm(d,n)%mod;
				printf("%lld\n",res);
			}
		}
	}
}

Measured memory_bytes: 8704
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<complex>
#include<map>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()
#define EPS (1e-10)
using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef complex<double> P;

int main(){
  int a,b,c;
  int t=0,h=0;
  while(~scanf("%d,%d,%d",&a,&b,&c)){
    if(a == b) h++;
    else if(a*a+b*b==c*c) t++;      
  }
  printf("%d\n%d\n",t,h);
  return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<numeric>
#include<cmath>
#include<queue>
#include<stack>
#include<list>
#include<unordered_map>
#include<unordered_set>
#include<cctype>
#include<iomanip>
#include<limits>
#include<bitset>

using namespace std;
typedef long long int ll; typedef pair<int, int> P; typedef unsigned long long int ull;
const ll mod = 1e9 + 7;
const int inf = 1e9 + 7;
const ll linf = 1LL << 60;
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define REP(i,m,n) for(int i=(m);i<(int)n;i++)
#define all(a) (a).begin(),(a).end()
#define allg(a) (a).begin(),(a).end(),greater<>()
#define SUM(a) accumulate((a).begin(),(a).end(),0)
#define d10 std::setprecision(10)
#define d20 std::setprecision(20)
#define vec vector<int>
#define vecd vector<double>
using str = string;
const double PI = 3.14159265359;
ll gcd(ll a, ll b) { ll t; while (b != 0) { t = a % b; a = b; b = t; }return a; }
int gcd(int a, int b) { int t; while (b != 0) { t = a % b; a = b; b = t; }return a; }
ll recfact(ll start, ll n) {
	ll i;
	if (n <= 16) {
		ll r = start;
		for (i = start + 1; i < start + n; i++) r = r * i % mod;
		return r % mod;
	}
	i = n / 2;
	return recfact(start, i) % mod * recfact(start + i, n - i) % mod;
}
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
}
ll fct(ll n) { return recfact(1, n); }
ll ncm(ll n, ll m) {
	if (n < m)return 0;
	ll x = (fct(n) % mod / (fct(m) * fct(n - m)) % mod) % mod;
	return x;
}
std::string sreverse(string str, int firstItr, int secondItr) {
	if (firstItr < 0 || secondItr>int(str.size() - 1))return str;
	while (firstItr < secondItr) {
		swap(str[firstItr], str[secondItr]);
		firstItr++; secondItr--;
	}
	return str;
}
std::string RunLengthEncoding(std::string str) {
	int itr = 0; std::string res;
	while (itr < int(str.size())) {
		char tmp = str[itr++];
		int length = 1;
		while (itr <int(str.size()) && str[itr] == tmp) { ++itr; ++length; }
		res.push_back(tmp);
		res += to_string(length);
	}
	return res;
}
std::string split(std::string str, size_t first_itr, bool isFront) {
	if (first_itr < 0 || first_itr > str.size()) {
		return str;
	}
	else {
		if (isFront) {
			std::string tmp;
			for (size_t i = 0; i < first_itr; i++) {
				tmp.push_back(str.at(i));
			}
			return tmp;
		}
		else {
			std::string tmp;
			for (size_t i = first_itr; i < str.size(); i++) {
				tmp.push_back(str.at(i));
			}
			return tmp;
		}
	}
}


bool dfs(int depth, str s) {
	/*if (depth == n) {
		ans.push_back(s);
		return false;
	}
	for (int i = 0; i < n; i++) {
		if (dfs(depth + 1, s + dic.at(i))) {
			return true;
		}
	}*/
	return false;
}



ll f(ll a) {
	if (a > 1) {
		return 2 * f(a / 2) + 1;
	}
	else
		return 1;
}



int main() {
	
	ll h; cin >> h;

	ll sum = f(h);
	cout << sum << endl;

	return 0;
}

Measured memory_bytes: 256
//#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"

#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007LL
#define INF (1LL<<60LL)
typedef long long ll;

using namespace std;


ll n;
vector<vector<vector<ll>>> g(15 + 1, vector<vector<ll>>(2, vector<ll>(0)));


ll ret(ll i, vector<ll> l ,ll res) {
	if (i == n + 1) {
		bool flag = true;
		for (ll j = 1; j <= n; j++) {
			if (l[j] == 0) continue;
			for (auto a : g[j][1]) {
				if (l[a] != 1) flag = false;
			}
			for (auto a : g[j][0]) {
				if (l[a] != 0) flag = false;
			}
			if (not flag) break;
		}


		if (flag) {
			return res;
		}
		else {
			return 0;
		}
	}
	vector<ll> l1 = l;
	l1[i] = 1;

	return max(ret(i + 1, l, res), ret(i + 1, l1, res + 1));
}



int main() {
	cin >> n;
	rep(i, n) {
		ll a; cin >> a;
		rep(j, a) {
			ll x, y;
			cin >> x >> y;
			g[i + 1][y].emplace_back(x);
		}
	}
	vector<ll> l0(n + 1, 0);
	ll ans = ret(1, l0 ,0);
	cout << ans << endl;
}

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

using namespace std;

typedef long long ll;

#define FOR(a, b, i) for(int i=a; i<b; i++)
#define RFOR(a, b, i) for(int i=a; i>=b; i--)
#define PB push_back
#define MP make_pair
#define MOD 1e9+7
#define newline cout<<"\n"


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    int n; cin>>n;

    // vector<ll> v(n);
    ll p;

    ll count=0;

    FOR(0, n, i)
    {
        cin>>p;
        while(p%2==0)
        {
            p/=2;
            count++;
        }
    }
    
    cout<<count<<endl;



    return 0;
}

Measured memory_bytes: 256
n,m,x = (int(a) for a in input().split())
ca = []
money = []
for i in range(n) :
    d = list(map(int,input().split()))
    ca.append(d)

for i in range(1,2**n) :
    a = format(i,"b")
    a = a.zfill(n)
    ans = [0]*(m+1)
    for j in range(n) :
        if a[j] == "1" :
            ans = list(map(lambda s,t: s+t, ans , ca[j]))
    l = 0
    for k in range(1,m+1) :
        if ans[k] >= x :
            l += 1
    if l == m :
        money.append(ans[0])

if len(money) != 0 :
    print(min(money))
else :
    print(-1)

    



Measured memory_bytes: 9132
#include"bits/stdc++.h"
using namespace std;
using ll = int64_t;

ll gcd(ll a, ll b) {
    return (b ? gcd(b, a % b) : a);
}

int main() {
    ll N, X;
    cin >> N >> X;
    vector<ll> x(N);
    for (ll i = 0; i < N; i++) {
        cin >> x[i];
    }
    x.push_back(X);
    sort(x.begin(), x.end());

    ll ans;
    for (ll i = 0; i < N; i++) {
        ll diff = x[i + 1] - x[i];
        if (i == 0) {
            ans = diff;
        } else {
            ans = gcd(ans, diff);
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 1792
implicit none
integer (8):: a,b,c
character(1) :: s
read(*,*) a, b

if (a==1 ) then
    a=14
endif

if (b==1 ) then
    b=14
endif

if (a>b) then
    write(*,*) "Alice"
else if (b>a) then
    write(*,*) "Bob"
else
     write(*,*) "Draw"
endif

end


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

using namespace std;

typedef long long ll;

int main(){
  int X;
  cin >> X;

  int start = 400;
  int end   = 599;
  int deg = 8;
  while(end < 2000){
    if(start <= X && X <= end){
      cout << deg << endl;
      return 0;
    }

    start += 200;
    end += 200;
    --deg;
  }

  return 0;
}

Measured memory_bytes: 3628
def is_prime(n):
    if n == 2 or n == 3:
        return True
    i = 2
    while i * i <= n:
        if n % i == 0:
            return False
        i += 1
    return True

N = input()
ans = []
for i in xrange(6, 55555, 5):
    if is_prime(i):
        ans.append(i)
        N -= 1
        if N == 0:
            break

print ' '.join(map(str, ans))


Measured memory_bytes: 2568
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define eps 1e-9
#define maxp 99940000
#define mod 1000000007
#define pi 3.141592653589793238
#define sin(s) scanf("%lld",&s);
#define sout(s) printf("%lld\n",s);
#define in(s) cin>>s
#define in2(a,b) cin>>a>>b
#define in3(a,b,c) cin>>a>>b>>c
#define vll vector<ll>
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define endl '\n'
#define sp ' '
#define gear_change ios_base::sync_with_stdio(false),cin.tie(0)
#define nfl(i,n) for(i=0;i<n;i++)
#define sfl(i,s,e) for(i=s;i<e;i++)
#define ufl(i,n) for(i=n-1;i>=0;i--)
ll power(ll x,ll y){
    ll ret=1;
    while(y>0){
        if(y&1)
            ret=(ret*x);
        y/=2;
        x=(x*x);
    }
    return ret;
}
string rot(string s){
	string ret="";
	ll i;
	for(i=1;s[i];i++){
		ret+=s[i];
	}
	ret+=s[0];
	return ret;
}
ll power(ll x,ll y,ll p)
{
	ll ret=1;
	while(y>0)
	{
		if(y&1)
			ret=(ret*x)%p;
		y/=2;
		x=(x*x)%p;
	}
	return ret%p;
}
void solve(){
	ll x,i,n;
	cin>>x>>n;
	vector<ll>vec(n);
	map<ll,bool>done;
	nfl(i,n){
		cin>>vec[i];
		done[vec[i]]=1;
	}
	ll p1=x;
	ll p2=x;
	while(true){
		if(!done[p1]){
			cout<<p1<<endl;
			return;
		}
		if(!done[p2]){
			cout<<p2<<endl;
			return;
		}
		p1--;
		p2++;
	}
}	
int main(){
	gear_change;
	ll test=1;
	// in(test);
	while(test--){
		solve();
	}
}	


Measured memory_bytes: 3664
#include <iostream>
#include <sstream>
#include <vector>
#include <cassert>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <utility>
#include <tuple>
#include <regex>
#include <map>
#include <cstdint>
#include <set>
#include <deque>
#include <bitset>

using namespace std;
using ull = unsigned long long;
using ll = long long;

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

#define EPS (1e-7)
#define ALL(x) begin(x), end(x)


struct Light {
	vector<ll> switchNums;
	ll onValue; // スイッチが偶数個onの時に光るするなら0,奇数個なら1。
};

bool isOn(ll bit, const Light& light) {
	ll mask = 0;
	for (const auto s: light.switchNums) {
		mask |= 1LL << (s - 1);
	}
	const ll masked = bit & mask;
	const bitset<10> b(masked);
	return (b.count() % 2) == light.onValue;
}

int main() {
	ll N, M;
	cin >> N >> M;


	vector<Light> Ls(M);
	for (size_t i = 0; i < M; i++) {
		ll k;
		cin >> k;
		for (size_t j = 0; j < k; j++) {
			ll s;
			cin >> s;
			Ls[i].switchNums.push_back(s);
		}
	}
	for (size_t i = 0; i < M; i++) {
		cin >> Ls[i].onValue;
	}

	// 全パターン試す。ビットで見る
	ll ans = 0;
	for (size_t i = 0; i < 0x0400; i++) {
		if (all_of(ALL(Ls), [i](auto l) {
			return isOn(i, l);
		})) {
			ans++;
		}
		if (i >= (1LL << N)) {
			break;
		}
	}
	cout << ans << endl;



	return 0;
}

Measured memory_bytes: 256
n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
jewelry = []
for i in range(n):
    if v[i] < c[i]:
        jewelry.append(0)
    else:
        cost = v[i] - c[i]
        jewelry.append(cost)
print(sum(jewelry))

Measured memory_bytes: 3060
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset>    // bitset
#include <cctype>    // isupper, islower, isdigit, toupper, tolower
#include <cstdint>   // int64_t, int*_t
#include <cstdio>    // printf
#include <deque>     // deque
#include <iostream>  // cout, endl, cin
#include <map>       // map
#include <queue>     // queue, priority_queue
#include <set>       // set
#include <stack>     // stack
#include <string>    // string, to_string, stoi
#include <tuple>     // tuple, make_tuple
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <utility>       // pair, make_pair
#include <vector>        // vector
using namespace std;

int gcd(long long a, long long b) { return b != 0 ? gcd(b, a % b) : a; }

int main() {
    int H, N, A[100001];
    cin >> H >> N;
    int sum = 0;
    string ans = "No";
    for(size_t i = 0; i < N; i++) {
        int a ;
        cin >> a;
        sum += a;
        if(sum >= H){
            ans = "Yes";
        }
    }

    cout << ans << endl;
    return 0;
}

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

int main(){
    ll x, k, d; cin >> x >> k >> d;
    if(x < 0) x *= -1;

    ll straight = min(k, x/d);
    k -= straight;
    x -= straight*d;
    if(k%2 == 0) {
        cout << x << endl;
    } else {
        cout << abs(x - d) << endl;
    }
    return 0;
}

Measured memory_bytes: 3632
sub isParaStr{
    my $str = $_[0];
    my $Lh = int length($str)/2;
    substr($str, 0, $Lh) eq reverse substr($str, -$Lh);
}

sub main{
    (my $s, my $e) = split(/ /, <STDIN>);
    my $cnt = 0;
   for (; $s <= $e; $s++){
       if (&isParaStr($s)){
           $cnt++;
       }
   } 

   print $cnt."\n";
}

&main;

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define ff first
#define ss second
#define ll long long
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
#define all(x) x.begin(), x.end()

void solve() {
   int x;
   cin >> x;
   x ^= 1;
   cout << x << '\n';
   
}

int main() {
#ifndef ONLINE_JUDGE
   freopen("C:\\inp.txt", "r", stdin);      freopen("C:\\outp.txt", "w", stdout);
#endif
   ios::sync_with_stdio(false);   cin.tie(NULL);   cout.tie(NULL);
      solve();

   return 0;
}

Measured memory_bytes: 3616
#https://atcoder.jp/contests/abc128
# -*- coding: utf-8 -*-

n,k = map(int,input().split())
v = list(map(int,input().split()))

ans = 0
for left in range(k+1):
    for right in range(k-left+1):
        if left+right > n : continue
        for trash in range (k-left-right+1):
            x = sorted(v[0:left]+v[::-1][0:right])[trash:]
            ans = max(ans,sum(x))

print(ans)

Measured memory_bytes: 3064
def totalcost_recur(i,cost,N,lookup):
  if i>=N:
    return 0
  if i in lookup:
      return lookup[i]
  option1 = abs(cost[i]-cost[i+1]) + totalcost_recur(i+1,cost,N,lookup)
  ans = option1
  if i+2<=N:
    option2 = abs(cost[i]-cost[i+2]) + totalcost_recur(i+2,cost,N,lookup)
    ans = min(option2,ans)
  lookup[i] = ans
  return ans



def totalcost_dp(cost,N):
    dp = [0]*(N+1)
    dp[1] = 0
    dp[2] = abs(cost[2]-cost[1])
    i = 3
    while i<=N:
        option1 = dp[i-1]+abs(cost[i]-cost[i-1])
        option2 = dp[i-2]+abs(cost[i]-cost[i-2])
        dp[i] = min(option1,option2)
        i+=1

    return dp[N]


n = int(input())
cost = list(map(int,input().split()))
cost = [0]+cost
lookup = {}

print(totalcost_dp(cost,n))

Measured memory_bytes: 20860
#include <bits/stdc++.h>
using namespace std;
#define sd(x) scanf("%d", &x)
#define sz(v) (int) v.size()
#define pr(v) For(i, 0, sz(v)) {cout<<v[i]<<" ";} cout<<endl;
#define slld(x) scanf("%lld", &x)
#define all(x) x.begin(), x.end()
#define For(i, st, en) for(ll i=st; i<en; i++)
#define tr(x) for(auto it=x.begin(); it!=x.end(); it++)
#define fast std::ios::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define ll long long
#define ld long double
#define int long long
#define double long double
#define mp make_pair
#define F first
#define S second
typedef pair<int, int> pii;
typedef vector<int> vi;
#define pi 3.141592653589793238
const int MOD = 1e9+7;
const int INF = 1LL<<60;


const int N = 2e5+5;

// it's swapnil07 ;)
 
#ifdef SWAPNIL07
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
int begtime = clock();
#define end_routine() cout << "\n\nTime elapsed: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";
#else
#define endl '\n'
#define trace(...)
#define end_routine()
#endif


void solve(){
    int x, y; cin>>x>>y;
    if(y%2!=0 || x*4<y || x*2>y){
        cout<<"No";
        return;
    }
    cout<<"Yes";
}


signed main()
{
    fast
    #ifdef SWAPNIL07
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
    int t=1; 
    // cin>>t;
    while(t--){
        solve();
        cout<<"\n";
    }
    return 0;
}



Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,Q;cin>>N>>Q;
  string S;cin>>S;
  vector<int>C(N+1,0);
  for(int i=1;i<N;i++)C[i+1]=C[i]+(S.substr(i-1,2)=="AC");
  for(int i=0;i<Q;i++){
    int l,r;cin>>l>>r;
    cout<<C[r]-C[l]<<endl;
  }
}

Measured memory_bytes: 1408
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define ALL(c) (c).begin(), (c).end()

template <typename T> inline void assign_min(T& x, const T& value) noexcept { x = min(x, value); }

int main() {
    int N; cin >> N;
    vector<int> h(N);
    REP(i, N) cin >> h[i];

    // dp[i]: i番目の足場につくまでに支払うコストの総和の最小値
    vector<int> dp(N);
    FOR(i, 1, N) {
        dp[i] = dp[i-1] + abs(h[i] - h[i-1]);
        if (i >= 2) assign_min(dp[i], dp[i-2] + abs(h[i] - h[i-2]));
    }

    cout << dp[N-1] << '\n';
}


Measured memory_bytes: 3940
#include <iostream>
#include <iomanip>
#include <bitset>
#include <string>
#include<algorithm>
#include<cmath>
#include<set>
#include<map>
#include<vector>
#include<tuple>
#include<sstream>
#include<functional>
#include<list>
#include<queue>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
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; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
typedef pair<ll, ll> p;
typedef vector<int> vec;
using Graph = vector<vector<int>>;
using graph = vector<vector<ll>>;

const ll inf = (1LL<<31)-1;
const long long MOD = 1000000007;

struct SegmentTree {
    int n;
    vector<ll> node;

public:
    // 元配列 v をセグメント木で表現する
    SegmentTree(vector<ll> v) {
        // 最下段のノード数は元配列のサイズ以上になる最小の 2 冪 -> これを n とおく
        // セグメント木全体で必要なノード数は 2n-1 個である
        int sz = v.size();
        n = 1; while (n < sz) n *= 2;
        node.assign(2 * n - 1, inf);

        // 最下段に値を入れたあとに、下の段から順番に値を入れる
        // 値を入れるには、自分の子の 2 値を参照すれば良い
        for (int i = 0; i < sz; i++) node[i + n - 1] = v[i];
        for (int i = n - 2; i >= 0; i--) node[i] = min(node[2 * i + 1], node[2 * i + 2]);
    }

    void update(ll x, ll val) {
        // 最下段のノードにアクセスする
        x += (n - 1);

        // 最下段のノードを更新したら、あとは親に上って更新していく
        node[x] = val;
        while (x > 0) {
            x = (x - 1) / 2;
            node[x] = min(node[2 * x + 1], node[2 * x + 2]);
        }
    }

    // 要求区間 [a, b) 中の要素の最小値を答える
// k := 自分がいるノードのインデックス
// 対象区間は [l, r) にあたる

    int getmin(ll a, ll b, ll k = 0, ll l = 0, ll r = -1) {
        // 最初に呼び出されたときの対象区間は [0, n)
        if (r < 0) r = n;

        // 要求区間と対象区間が交わらない -> 適当に返す
        if (r <= a || b <= l) return inf;

        // 要求区間が対象区間を完全に被覆 -> 対象区間を答えの計算に使う
        if (a <= l && r <= b) return node[k];

        // 要求区間が対象区間の一部を被覆 -> 子について探索を行う
        // 左側の子を vl ・ 右側の子を vr としている
        // 新しい対象区間は、現在の対象区間を半分に割ったもの
        ll vl = getmin(a, b, 2 * k + 1, l, (l + r) / 2);
        ll vr = getmin(a, b, 2 * k + 2, (l + r) / 2, r);
        return min(vl, vr);
    }
};

int main() {
    ll n, x;
    cin >> n >> x;
    vector<ll> v(n*2);
    rep(i, n) {
        cin >> v[i];
        v[i + n] = v[i];
    }
    SegmentTree tree(v);
    ll ans = INF;
    rep(i, n ) {
        ll A = 0;
        repd(j, n, n * 2) {
            A += tree.getmin(j - i, j + 1);
        }
        A += i * x;
        ans= min(ans, A);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3256
//! ----------------------------------------------
//! Framework <https://github.com/vain0x/procon>
//!
//! See the bottom of file for solution.
//! ----------------------------------------------

#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Display, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

/// Print values to standard error if debug mode.
#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", e, $e).unwrap()
        })*
    };
}

/// Read from standard input and parse each word.
/// - `read!(T, U, ..)` parses a line as a tuple of words.
/// - `read![[T]]` parses a line as an array of words.
/// - `read![..; N]` parses `N` lines, using `read!(..)` repeatedly.
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

/// Read a line from standard input.
#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();

    #[allow(deprecated)]
    buf.trim_right().to_owned()
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

fn main() {
    let b = rl().chars().next().unwrap();

    let c = match b {
        'A' => 'T',
        'T' => 'A',
        'C' => 'G',
        'G' => 'C',
        _ => unreachable!(),
    };

    println!("{}", c)
}


Measured memory_bytes: 4352
# coding: utf-8
# Your code here!
import fractions

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

N = int(input())
T_li = sorted([int(input()) for i in range(N)])
crr_lcm = T_li[0]

for i in range(1, N):
    crr_lcm = lcm(crr_lcm, T_li[i])
print(crr_lcm)


Measured memory_bytes: 5176
#include <bits/stdc++.h>
 
using namespace std;
#define PB push_back
#define MP make_pair
#define LL long long
#define int LL
#define FOR(i,a,b) for(int i = (a); i <= (b); i++)
#define RE(i,n) FOR(i,1,n)
#define REP(i,n) FOR(i,0,(int)(n)-1)
#define R(i,n) REP(i,n)
#define VI vector<int>
#define PII pair<int,int>
#define LD long double
#define FI first
#define SE second
#define st FI
#define nd SE
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
 
template<class C> void mini(C &a4, C b4) { a4 = min(a4, b4); }
template<class C> void maxi(C &a4, C b4) { a4 = max(a4, b4); }
 
template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<'='<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;cerr<<'='<<h<<','; _dbg(sdbg+1, a...);
}
 
template<class T> ostream &operator<<(ostream& os, vector<T> V) {
  os << "["; for (auto vv : V) os << vv << ","; return os << "]";
}
template<class L, class R> ostream &operator<<(ostream &os, pair<L,R> P) {
  return os << "(" << P.st << "," << P.nd << ")";
}
 
#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif
 
int n;
int get(int a){
  cout << a << endl;
  string z;
  cin >> z; 
  if(z[0] == 'V')exit(0);
  return (z[0] == 'M') ^ (a % 2);
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(11);
  cerr << fixed << setprecision(6);
  cin >> n;
  int po = 0;
  int ko = n;
  int wp = get(po);
  while(po+1 != ko){
    int m = (po + ko) / 2;
    if(get(m) == wp){
      po = m;
    }else{
      ko = m;
    }
  }
}

Measured memory_bytes: 852
N, M = map(int, input().split())

# Mの約数dのうち、 dN <= M を満たす最大のdが解
ans = max(
    (
        M // d if (M // d) * N <= M else
        d if d * N <= M else
        1
    )
    for d in range(1, int(M**0.5) + 10)
    if M % d == 0
)

print(ans)


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

int main(void){
	int n;scanf("%d",&n);
	vector<int> a(n),b(n);
	for(int i=0;i<n;i++){scanf("%d",&a[i]);a[i]--;}
	for(int i=0;i<n;i++){b[a[i]] = i;}
	int l = 1;int lmax = 1;
	for(int i=1;i<n;i++){
		if(b[i] > b[i-1]){ l++; lmax = max(lmax,l);}
		else l = 1;
	}
	cout << n - lmax << endl;
	return 0;
}

Measured memory_bytes: 1792
n = input()
lis = []
ans = 0
for i in xrange(n):
    com = raw_input()
    if   com[0] == 'i':
        lis.append(com[7:])
    elif com[6] == ' ':
        try:
            lis.pop(~lis[::-1].index(com[7:]))
        except:
            pass
    elif com[6] == 'F':
        lis.pop()
    else:ans += 1
 
print ' '.join( map(str, reversed(lis[ans:])) )

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

int main() {
  string s;
  cin >> s;
  int c =0;
  
  if (s[0] == '1') c++;
  if (s[1] == '1') c++;
  if (s[2] == '1') c++;
 
  cout << c << endl;
 
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <complex>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B,C,L,R;
string S,T;
const ll MOD = 998244353;
const ll INF = 1LL << 59;
const long double EPS = 1e-9;
typedef pair<ll,ll> P;

typedef vector<P> vp;
typedef vector<vp> matP;

int main(){
    cin>>N>>M>>Q;
    class union_find{
            vector<long> parent, tree_size;
        public:
            union_find(unsigned long _n) : parent(_n), tree_size(_n, 1){
                for(unsigned long i = 0; i < _n; ++i)parent[i] = i;
            }
            ll find(ll x){
                while(parent[x] != x)x = parent[x] = parent[parent[x]];
                return x;
            }
            void merge(ll a, ll b){
                a = find(a);
                b = find(b);
    	    if(a==b) return;
                if(tree_size[a] < tree_size[b])swap(a, b);
                tree_size[a] += tree_size[b];
                parent[b] = a;
                return;
            }
    	bool same(ll a, ll b){
    	    a = find(a);
    	    b = find(b);
    	    return a == b;
    	}
        };
    //uf.mergeのように使う
    //ufはMAX_N+1でとるか、代入時に0-indexedにする
    union_find uf(N+1);
    mat query(Q,vec(3));
    rep(i,Q) rep(j,3) cin>>query[i][j];
    vec ord(Q);
    rep(i,Q) ord[i] = i;
    sort(ord.begin(), ord.end(), [&](ll x, ll y){
        return query[x][2] < query[y][2];
    });
    ll numg = N;
    rep(i,Q){
        vec temp = query[ord[i]];
        if(temp[2] == 0){
            numg -= 1 - uf.same(temp[0], temp[1]);
            uf.merge(temp[0], temp[1]);
        }else{
            if((uf.same(temp[0], temp[1])) || (M == N - 1)){
                cout<<"No"<<endl;
                return 0;
            }
        }
    }
    cout<<(M <= N + numg * (numg - 3) / 2 ? "Yes" : "No")<<endl;
}

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

int main(){
  int n;
  cin >> n;
  vector <int> a(n);
  for ( int i = 0; i < n; ++i ) {
    cin >> a[i];
  }
  int ans = 0;
  for ( int i = 1; i < n - 1; ++i ) {
    vector <int> alt_a;
    for (int j = -1 ; j <= 1; ++j ) {
      alt_a.push_back(a[i + j]);
    }
    //cout << alt_a[0] << alt_a[1] << alt_a[2] << endl;
    int med = alt_a[1];
    sort(alt_a.begin(),alt_a.end());
    if(alt_a[1] == med)ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <bitset>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <queue>

using namespace std;

struct BoolName : numpunct<char> {
  string t, f;
  BoolName (string t = "Yes", string f = "No") : t(t), f(f) {}
  string do_truename() const {return t;}
  string do_falsename() const {return f;}
};

struct Initializer {
  Initializer() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(15) << boolalpha;
    cout.imbue(locale(cout.getloc(), new BoolName));
  }
} initializer;

template<typename T> istream& operator>>(istream &s, vector<T> &v) {
  for (T &t : v) s >> t;
  return s;
}

template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
  for (const T &t : v) s << t << endl;
  return s;
}

void set_bool_name(string t, string f) {
  cout.imbue(locale(cout.getloc(), new BoolName(t, f)));
}

int main() {
  int n, m;
  cin >> n >> m;
  cout << ((n * 100 + m * 1800) << m) << endl;
}



Measured memory_bytes: 256
#include<cstdio>
#include<queue>
using namespace std;
struct cube{
	int men[30];
	int cnt;
};
queue<cube> cb;
int jg();
int h(cube,int,int);
cube cg(cube,int,int,int);
int minn=8;
int main(){
	int n,i,j;
	cube c;
	scanf("%d", &n);
	for(i=0;i<n;i++){
		minn=8;
		for(j=0;j<30;j++){
			scanf("%d",&c.men[j]);
			c.cnt=0;
		}
		cb.push(c);
		jg();
		printf("%d\n",minn);
		while(!cb.empty()){
			cb.pop();
		}
	}
	return 0;
}
int jg(){
	cube a;
	int i,v;
	while(1){
	for(i=0;i<30;i++){
		a.men[i]=cb.front().men[i];
	}
	a.cnt=cb.front().cnt;
	cb.pop();
	if(a.cnt>8){
		return 0;
	}
	v=h(a,0,8)+h(a,9,11)+h(a, 12, 14)+h(a, 15, 17)+h(a, 18, 20)+h(a, 21, 29);
	if(v==6&&minn>a.cnt){
		minn=a.cnt;
	}
	cb.push(cg(a,0,1,2));
	cb.push(cg(a,0,3,6));
	cb.push(cg(a,2,5,8));
	cb.push(cg(a,6,7,8));
	}
	return 0;
}
int h(cube a, int s, int e) {
	int i,v=0;
	for (i = s; i<e; i++) {
		if (a.men[i] != a.men[i + 1]) {
			v = 1;
		}
	}
	if (v == 0) {
		return 1;
	}
	else {
		return 0;
	}
}
cube cg(cube p,int a,int b,int c){
	int temp;
	if (a == 0 && b == 1 && c == 2) {
		temp = p.men[a];
		p.men[a] = p.men[27];
		p.men[27] = temp;
		temp = p.men[b];
		p.men[b] = p.men[28];
		p.men[28] = temp;
		temp = p.men[c];
		p.men[c] = p.men[29];
		p.men[29] = temp;
		temp = p.men[14];
		p.men[14] = p.men[15];
		p.men[15] = temp;
		temp=p.men[20];
		p.men[20]=p.men[18];
		p.men[18]=temp;
	}
	else if (a == 0 &&b == 3 && c == 6) {
		temp = p.men[a];
		p.men[a] = p.men[23];
		p.men[23] = temp;
		temp = p.men[b];
		p.men[b] = p.men[26];
		p.men[26] = temp;
		temp = p.men[c];
		p.men[c] = p.men[29];
		p.men[29] = temp;
		temp = p.men[9];
		p.men[9] = p.men[20];
		p.men[20] = temp;
		temp=p.men[17];
		p.men[17]=p.men[15];
		p.men[15]=temp;
	}
	else if (a == 2 && b == 5 && c == 8) {
		temp = p.men[a];
		p.men[a] = p.men[21];
		p.men[21] = temp;
		temp = p.men[b];
		p.men[b] = p.men[24];
		p.men[24] = temp;
		temp = p.men[c];
		p.men[c] = p.men[27];
		p.men[27] = temp;
		temp = p.men[18];
		p.men[18] = p.men[11];
		p.men[11] = temp;
		temp=p.men[14];
		p.men[14]=p.men[12];
		p.men[12]=temp;
	}
	else {
		temp = p.men[a];
		p.men[a] = p.men[21];
		p.men[21] = temp;
		temp = p.men[b];
		p.men[b] = p.men[22];
		p.men[22] = temp;
		temp = p.men[c];
		p.men[c] = p.men[23];
		p.men[23] = temp;
		temp = p.men[17];
		p.men[17] = p.men[12];
		p.men[12] = temp;
		temp=p.men[9];
		p.men[9]=p.men[11];
		p.men[11]=temp;
	}
	p.cnt++;
	return p;
}

Measured memory_bytes: 34540