akhauriyash/Code-Regression huggingface dataset:
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define mii map <int, int>
#define mll map <ll, ll>
#define pii pair <int, int>
#define pll pair <ll, ll>
#define vi vector <int>
#define vd vector <double>
#define vll vector <ll>
#define fi first
#define se second
#define si set <int>
#define sll set <ll>
#define spii set <pii>
#define vs vector <string>
#define vpii vector <pair <int,int> >
#define vpll vector <pair <long long,long long> >
#define vvi vector <vector <int> >
#define vvpii vector <vector <pii > >
#define mp make_pair
#define vvll vector <vll>
#define vsi vector <si>
#define forn(i, n) for (int i = 0; i < (n); i++)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define for1(i, n) for (int i = 1; i < (n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(),(x).rend()


const ll INFLL = 1e18;
const int MAXN = 1e6+100;
const ll INF = 1e9;
const ll mod1=1e9+7;
const ll mod2=2e9+11;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#ifdef LOCAL
    freopen("a.in","r",stdin);
#endif
    int n,m;
    cin>>n>>m;
    vector <int> h(n);
    rep(i,n)
    cin>>h[i];
    vector <int> good(n);
    while (m--)
    {
        int x,y;
        cin>>x>>y;
        x--,y--;
        if (h[x]>h[y])
            good[y]=1;
        if (h[x]<h[y])
            good[x]=1;
        if (h[x]==h[y])
            good[x]=1,good[y]=1;
    }
    int cnt=0;
    for (int i=0;i<n;i++)
    {
        if (good[i]==0)
            cnt++;
    }
    cout<<cnt;




}

Measured memory_bytes: 3972
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s, t;
    cin >> s >> t;
    int i, len = s.size();
    map <char, char> a, b;
    map<char,char>::iterator ita, itb;
    for(i = 0; i < len; i++)
    {
        ita = a.find(s[i]), itb = b.find(t[i]);

        if(ita == a.end() && itb == b.end())
        {
            a.insert({s[i], t[i]});
            b.insert({t[i], s[i]});
        }
        else if(ita == a.end() || itb == b.end())
        {
            printf("No");
            return 0;
        }
        else if(a[s[i]] != t[i] || b[t[i]] != s[i])
        {
            printf("No");
            return 0;
        }
    }
    printf("Yes");
}


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

bool dfs(string s){
  string t[3];
  if(s.size()<4)return s=="ABC";
  bool u[3]={};
  for(int i=0;i<s.size();i++){
    bool f=i+2<s.size();
    for(int j=0;f&&j<3;j++)if(s[i+j]!='A'+j)f=0;
    for(int j=0;j<3;j++)
      t[j]+=f?'A'+j:s[i];
    if(!f)u[s[i]-'A']=1;
    i+=f*2;
  }
  if(s.size()!=t[0].size())
    for(int i=0;i<3;i++)if(!u[i]&&dfs(t[i])){return 1;}
  return 0;
}

int main(){
  string s;
  cin>>s;
  cout<<(dfs(s)?"Yes":"No")<<endl;
}


Measured memory_bytes: 46436
//AtCoder AGC029 A - Irreversible operation
//Wを左にずらした回数、wの位置の累積和-wの個数の累積和
#include <bits/stdc++.h>
using namespace std;
using ll=int64_t;
#define FOR(i,a,b) for(int64_t i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
int main() {
    string S; cin>>S;
    ll sum1=0;
    ll num=0;
    ll sum2=0;
    REP(i,S.size()){
        if(S[i]=='W'){
            sum1+=i;
            sum2+=num;
            ++num;
        }
    }
    ll ans=sum1-sum2;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
//#define ll long long
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; }
#define rep(i, n) REP(i, 0, n)
#define rep_rev(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
#define all(x) (x).begin(),(x).end()
ll t1,t2,t3;
const ll mod = 1000000007;
const int INF = 1e9;
const ll INFLONG = 1e18;
void swap(ll *x,ll *y){
  ll tmp;
  tmp = *x;
  *x = *y;
  *y = tmp;
}
ll n,u,v;
vector<ll> emb_u(100000,-1);
vector<ll> emb_v(100000,-1);
vector<ll> node[100000];
void dp_u(ll k,ll dis){
  if(emb_u[k] != -1){
    return;
  }
  emb_u[k] = dis;
  for(auto itr: node[k]){
    dp_u(itr,dis+1);
  }
}
void dp_v(ll k,ll dis){
  if(emb_v[k] != -1){
    return;
  }
  emb_v[k] = dis;
  for(auto itr: node[k]){
    dp_v(itr,dis+1);
  }
}
int main(){
  cin >> n >> u >> v;
  u--;
  v--;
  rep(i,n-1){
    cin >> t1 >> t2;
    t1--,t2--;
    node[t1].push_back(t2);
    node[t2].push_back(t1);
  }


  dp_u(u,0);
  dp_v(v,0);
  ll l1 = 0;
  rep(i,n){
    if(emb_u[i] < emb_v[i]){
      chmax(l1,emb_v[i]);
    }
  }
  ll ans = l1-1;
  cout << ans << endl;
}

Measured memory_bytes: 9984
#include <iostream>
#include <string>
#include <queue>
#include <algorithm>
using namespace std;

using P = pair<int, int>;
constexpr int INF = 1<<30;
constexpr int di[4] = {0,1,0,-1};
constexpr int dj[4] = {1,0,-1,0};

int main() {
    int h, w;
    cin >> h >> w;
    vector<string> field(h);
    for(int i=0;i<h;i++){
        cin >> field[i];
    }
    // BFS
    vector<vector<int> > d(h, vector<int>(w,INF));
    d[0][0] = 1;
    queue<P> que;
    que.push(P(0,0));

    while(!que.empty()){
        P pos = que.front();
        que.pop();
        int i = pos.first, j = pos.second;
        for(int k=0;k<4;k++){
            int ni = i+di[k], nj = j+dj[k];
            if(ni < 0 || ni >= h) continue;
            if(nj < 0 || nj >= w) continue;
            if(field[ni][nj] == '#') continue;
            if(d[ni][nj] > d[i][j] + 1){
                d[ni][nj] = d[i][j] + 1;
                que.push(P(ni,nj));
            }
        }
    }
    if(d[h-1][w-1] == INF){
        cout << -1 << endl;
    }
    else{
        int black = 0;
        for(int i=0;i<h;i++){
            for(int j=0;j<w;j++){
                if(field[i][j] == '#') black++;
            }
        }
        cout << h*w - black - d[h-1][w-1] << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>					
using namespace std;	
int main(void)	
{		long long n,k;
cin>>n>>k;
long long hea[200001];long long ans = 0;
	for(int i=0;i<n;i++){
	cin>>hea[i];
}
if(k>=n){
cout<<ans;
	return 0;
}else if(k==0){
	for(int i = 0;i<n;i++){
		ans+=hea[i];
	}
cout<<ans;
	return 0;
}else{
	sort(hea,hea+n);
for(int i=0;i<n-k;i++){
	ans+=hea[i];
}	
cout<<ans;	return 0;

}					
return 0;	 									
 } 

Measured memory_bytes: 1792
import java.util.Scanner;

    public class Main {
    	public static void main(String[] args){
    		 Scanner sc = new Scanner(System.in);
    		 String insert = sc.next();
    		 String ajitama = insert.substring(0,1);
    		 String tyashu = insert.substring(1,2);
    		 String negi = insert.substring(2,3);
    		 int ramen_nedan = 700;
    		 int tuika_nedan = 100;
    		 int kensaku = 0;
    		 String kensakuMoji = "o";
    		 String[] inserthairetsu = {ajitama,tyashu,negi};

    		 for(int i = 0; i < inserthairetsu.length; i++) {

    			 if(inserthairetsu[i].equals(kensakuMoji)) {
    				 kensaku++;
    			 }
    		 }
    		 System.out.println(ramen_nedan + (tuika_nedan * kensaku));
    	}
    }

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

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

#define int ll
#define all(x) x.begin(), x.end()
#define mp make_pair
#define mt make_tuple
#define x first
#define y second
#define pb push_back
#define sz(x) int(x.size())

int MOD = 1;

const int N = 5002;
int n;
int c[N];
int dp[N];

signed main() {
#ifdef LC
	assert(freopen("input.txt", "r", stdin));
#endif
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n >> MOD;
	int h = (n - 1) / 2;
	for (int i = 0; i < h; ++i) {
		int l = i + 1;
		int r = n - i - 1;
		for (int j = l + 1; j <= r; ++j) {
			c[j] += 1;
		}
	}
	for (int j = 1; j < n; ++j) {
		++c[j];
	}

	dp[0] = 1;
	for (int i = 1; i < n; ++i) {
		for (int j = 0; j + c[i] < n; ++j) {
			dp[j] %= MOD;
			dp[j + c[i]] += dp[j];
		}
	}
	
	int answer = 0;
	for (int j = 0; j < n; ++j) {
		dp[j] %= MOD;
		answer += (n - j) * dp[j];
		answer %= MOD;
	}
	cout << answer << "\n";
	return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//clock_t start=clock();clock_t end=clock();cout<<(double)(end-start)/CLOCKS_PER_SEC<<endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef pair<pii,pii> P;
typedef tuple<ll,ll,ll> tl;
typedef pair<double,double> pdd;
typedef vector<vector<ll>> mat;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll mod5=1000000009;
ll inf=1LL<<62;
double pi=3.141592653589793238462643383279L;
double eps=1e-14;
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
#define srep(itr,st) for(auto itr=st.begin();itr!=st.end();itr++)
#define mrep(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define Max(a,b) a=max(a,b)
#define Min(a,b) a=min(a,b)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
#define umh unordered_map<ll,ll,custom_hash>
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    ll c=gcd(a,b);
    return a*b/c;
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
ll beki(ll n,ll k,ll md){
  ll ret=1;
  ll now=n;
    now%=md;
  while(k>0){
    if(k%2==1){
      ret*=now;
      ret%=md;
    }
    now*=now;
    now%=md;
    k/=2;
  }
  return ret;
}
ll gyaku(ll n,ll md){
  return beki(n,md-2,md);
}
ll popcount(ll n){
    ll ret=0;
    ll u=n;
    while(u>0){
        ret+=u%2;
        u/=2;
        
    }
    return ret;
}

int main(){
    ios::sync_with_stdio(false);cin.tie(0);
    ll ans=0;
    ll a[3],n;
    cin>>a[0]>>a[1]>>a[2]>>n;
    rep(i,0,3001){
        rep(j,0,3001){
            ll now=i*a[0]+j*a[1];
            if(now<=n&&(n-now)%a[2]==0)ans++;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
cnt = 0

for i in range(N):
    cnt += B[A[i]-1]
    if i > 0 and ( A[i-1] + 1 ) == A[i]:
        cnt += C[A[i-1]-1]
print(cnt)

Measured memory_bytes: 3064
#include <stdio.h>
#define X 100

int main(){
	int D, N;
	scanf("%d %d", &D, &N);
	int i, ans, num=1, temp;
	
	for(i=0;i<D;i++){
		num*=X;
	}
	ans=num*N;
	temp=ans;
	if(!D){
		if(N==100){
			printf("%d", 101);
			return 0;
		}
		printf("%d", ans);
		return 0;
	}
	for(i=0;i<=D&&temp%100==0;i++){
		temp/=X;
	}
	if(i!=D){
		for(i=0;;i++){
			ans+=num;
			temp=ans;
			for(i=0;i<=D&&temp%100==0;i++){
				temp/=X;
			}
			if(i==D){
				break;
			}
		}
	}
	
	printf("%d", ans);
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		String n = sc.next();
		sc.close();

		if (n.indexOf("7") != -1) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 35648
#include <iostream>
#include<math.h>
#include<algorithm>
#include<string>
#include<vector>
#include<iomanip>
using namespace std;
#define FOR(i,n) for(int (i)=0;(i)<(n);(i)++)

int retl(int K,int L){
    int tmp=0;
    while(pow(2,tmp) * L < K){
        tmp++;
    }
    return tmp;
}

struct A{
    string s;
    int p;
    int order;
};
bool cmp(const A &a,const A &b){
    if(a.s==b.s){
        return a.p>b.p;
    }else{
        return a.s<b.s;
    }
}

int main(){
    int N;
    cin  >> N;
    int P[N];
    A* q=new A[N]();
    //string S[N];
    FOR(i,N){
        string Q;
        cin >>Q >>P[i];
        A tmp=A{Q,P[i],i+1};
        q[i]=tmp;
    }

    
    sort(q,q+N,cmp);

  
    FOR(i,N){
        cout << q[i].order <<endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <numeric>
using namespace std;
typedef long long ll;

int main(){
    int n;cin>>n;
    ll ans=0;
    for(int i=1;i<=n;i++){
        if(i%3==0||i%5==0)continue;
        ans+=i*1ll;
    }
    cout<<ans;
}


Measured memory_bytes: 3188
#include<cstdio>
#define N 110000
inline char gc(){
	static char now[1<<16],*T,*S;
	if (T==S){T=(S=now)+fread(now,1,1<<16,stdin);if (T==S) return EOF;}
	return *S++;
} 
inline int read(){
	int x=0;char ch=gc();
	while (ch<'0'||ch>'9') ch=gc();
	while (ch<='9'&&ch>='0'){x=x*10+ch-'0';ch=gc();}
	return x;
}
inline int gcd(int x,int y){
	if (y==0) return x;return gcd(y,x%y);
}
int cur,n,a[N],mod,g1[N],g2[N];long long sum;
void printans(){
	if (!cur) printf("Second");else printf("First");
}
int main(){
	//freopen("d.in","r",stdin);
	n=read();
	for (int i=1;i<=n;++i) a[i]=read(),(mod+=a[i]%2)%=2;
	if (n%2&&!mod) {printf("First");return 0;}
	if (!(n%2)) {if (mod) printf("First");else printf("Second");return 0;}
	while (1){sum=0;
		for (int i=1;i<=n;++i) g1[i]=gcd(a[i],g1[i-1]);
		for (int i=n;i>=1;--i) g2[i]=gcd(a[i],g2[i+1]);
		for (int i=1;i<=n;++i) sum+=a[i];int g;
		for (int i=1;i<=n;++i){
			if (a[i]==1) {printans();return 0;}
			g=gcd(g1[i-1],gcd(a[i]-1,g2[i+1]));
			if (((sum-1)/g)%2) break;
		}
		if (g==1) {printans();return 0;}
		for (int i=1;i<=n;++i) a[i]/=g;
		cur^=1;
	}
	return 0;
}

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

#define ll long long int
#define pii pair<int,int>
#define PII pair<ll,ll>

const ll sz=1e5+100;

int main()
{
    ll n,m,i,j,k,p,x,y,t;

    cin>>n>>x>>t;

    //ll ans=(ll)(ceil((double)x)/(double)t);
    ll ans;

    ans=((n % x)==0) ? (n/x) :(n/x)+1;

    cout<<ans*t<<'\n';
}


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

typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define fi first
#define se second

int h,w;
int top[7];
int under[7];
int lf[7];
int rg[7];

bool dfs(const vector<int> &a, const vector<string> &b)
{
    bool ret=false;
    int A=a.size();

    int ct=0;
    rep(i,A) ct+=a[i];
    if(ct==A) return true;

    //i??????????????????????????§???????????????????????¨??????
    rep(i,A)
    {
        //??¢????????£???
        if(a[i]==1) continue;

        bool ok=true;
        char focus='0'+i;
        for(int y=top[i]; y<=under[i]; ++y)
        {
            for(int x=lf[i]; x<=rg[i]; ++x)
            {
                if(b[y][x]!=focus && b[y][x]!='S')
                {
                    ok=false;
                    break;
                }
            }
            if(!ok) break;
        }

        if(ok)
        {
            vector<int> na(a);
            vector<string> nb(b);
            na[i]=1;

            for(int y=top[i]; y<=under[i]; ++y)
            for(int x=lf[i]; x<=rg[i]; ++x)
            {
                if(nb[y][x]==focus) nb[y][x]='S';
            }

            ret|=dfs(na,nb);
        }
    }

    return ret;
}

int main()
{
    int n;
    cin >>n;
    rep(T,n)
    {
        cin >>h >>w;

        vector<string> f(h);
        rep(i,h) cin >>f[i];

        int im[26];
        fill(im,im+26,-1);

        int ct=0;
        rep(i,h)rep(j,w)
        {
            if(f[i][j]!='.')
            {
                int idx=f[i][j]-'A';
                if(im[idx]==-1) im[idx]=ct++;
            }
        }

        rep(i,h)rep(j,w)
        {
            if(f[i][j]!='.') f[i][j]=im[f[i][j]-'A']+'0';
        }

        fill(top,top+7,h);
        fill(under,under+7,0);
        fill(lf,lf+7,w);
        fill(rg,rg+7,0);
        rep(i,h)rep(j,w)
        {
            if(f[i][j]!='.')
            {
                int idx=f[i][j]-'0';

                top[idx]=min(top[idx],i);
                under[idx]=max(under[idx],i);
                lf[idx]=min(lf[idx],j);
                rg[idx]=max(rg[idx],j);
            }
        }

        vector<int> use(ct,0);
        bool valid=dfs(use,f);

        string ans="SUSPICIOUS";
        if(valid) ans="SAFE";
        std::cout << ans << std::endl;
    }
    return 0;
}

Measured memory_bytes: 3208
#include<iostream>
#include<string>
#include<stack>
#include<cstring>
#include<cstdio>
#include<cstdlib>
using namespace std;

int main(){
	string str;
	stack<int> S;
	int a, b;
	while (cin >> str){
		if (str == "+"){
			a = S.top();
			S.pop();
			b = S.top();
			S.pop();
			S.push(a + b);
		}
		else if (str == "-"){
			a = S.top();
			S.pop();
			b = S.top();
			S.pop();
			S.push(b-a);
		}
		else if (str == "*"){
			a = S.top();
			S.pop();
			b = S.top();
			S.pop();
			S.push(a*b);
		}
		else{
			S.push(atoi(str.c_str()));
		}
	}
	cout << S.top() << endl;
}

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

int main(){
    int x,y,g,h,j,z,k;
    cin >> x >> y;
    z = max(x,y);
    k = min(x,y);
    while(1){
        h = z % k;
        if(h == 0){
            cout << k;
            break;
        }
        z = k;
        k = h;
    }
    cout << endl;
}
    
    


Measured memory_bytes: 3104
S = input()
N = len(S)
is_strong_palindrome = True

if not S == S[::-1]:
    is_strong_palindrome = False

S_head = S[:(N-1)//2]
if not S_head == S_head[::-1]:
    is_strong_palindrome = False

S_tail = S[:(N-1)//2]
if not S_tail == S_tail[::-1]:
    is_strong_palindrome = False

print("Yes" if is_strong_palindrome else "No")

Measured memory_bytes: 3064
# 自分をiとしたとき自分よりあとのjと比べj-iが最大になる箇所の数を数える、という感じ
# （Tは不要？） b
# A[i]はユニークなので
# 左から最小、右から最大を保存?（なんでこれが浮かんだ？）
#       7 10 4 5 9 3 6 8 2 1
# 最小:  7 7 4 4 4 3 3 3 2 1
# 最大: 10 10 9 9 9 8 8 8 2 1
# dif maxの数になる
# だるそうなので集合でやる（ユニークなので）
n, t = map(int, input().split())
arr = list(map(int, input().split()))
min_from_left, max_from_right = [arr[0]], [arr[-1]]
for i in range(1, n):
    min_from_left.append(min(min_from_left[i - 1], arr[i]))
    max_from_right.append(max(max_from_right[i - 1], arr[n - 1 - i]))

max_from_right = max_from_right[::-1]
max_dif = 0
difs = set()
for i in range(n - 1):
    if max_dif < max_from_right[i + 1] - min_from_left[i]:
        max_dif = max_from_right[i + 1] - min_from_left[i]
        difs = set()
        difs.add((max_from_right[i + 1], min_from_left[i]))
    elif max_dif == max_from_right[i + 1] - min_from_left[i]:
        difs.add((max_from_right[i + 1], min_from_left[i]))
print(len(difs))

Measured memory_bytes: 15580
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    A, B = LI()

    # 実験した結果
    def f(x):
        rem = x % 4
        if rem == 0:
            return x
        elif rem == 1:
            return 1
        elif rem == 2:
            return x + 1
        elif rem == 3:
            return 0

    ans = f(B) ^ f(A - 1)
    print(ans)

if __name__ == '__main__':
    resolve()


Measured memory_bytes: 10124
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int main()
{
    string str1, str2;
    int cnt = 0;
    cin >> str1;
    transform(str1.begin(), str1.end(), str1.begin(), ::tolower);
    while (true)
    {
        cin >> str2;
        if (str2 == "END_OF_TEXT")
        {
            break;
        }
        transform(str2.begin(), str2.end(), str2.begin(), ::tolower);
        if (str1 == str2)
        {
            ++cnt;
        }
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 3160
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <utility>
#include <set>
#include <stack>
#include <climits>
#include <cmath>

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define rep1(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define reps(i,s,n) for(int i=s, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define MEMSET(v, h) memset((v), h, sizeof(v))
typedef long long ll;
const char sp = ' ';


using namespace std;

int main(void){
    int N, M, di[4], s, c;
    cin>>N>>M;
    rep(i, 4) di[i]=10;
    rep(i, M){
        cin>>s>>c;
        if(di[s]!=10 && di[s]!=c){cout<<-1<<endl; return 0;}
        di[s]=c;
    }
    if(N==1 && M==0){cout<<0<<endl; return 0;}
    if(di[1]==0){
        if(N==1){cout<<0<<endl; return 0;}
        else{cout<<-1<<endl; return 0;}
    }
    rep1(i, N){
        if(di[i]==10){
            if(i==1) di[i]=1;
            else di[i]=0;
        }
    }
    int count=0;
    rep1(i, 3){
        N--;
        count+=di[i]*pow(10, N);
        if(N==0) break;
    }
    cout<<count<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
#define FOR(i, u, y) for (decay<decltype(y)>::type i = (u), _##i = (y); i < _##i; ++i)
#define FORD(i, u, y) for (decay<decltype(u)>::type i = (u), _##i = (y); i > _##i; --i)
#ifdef zerol
#define dbg(args...) do { cout << "DEBUG: " << #args << " -> "; err(args); } while (0)
#else
#define dbg(...)
#endif
void err() { cout << endl; }
template<template<typename...> class T, typename t, typename... Args>
void err(T<t> a, Args... args) { for (auto u: a) cout << u << ' '; err(args...); }
template<typename T, typename... Args>
void err(T a, Args... args) { cout << a << ' '; err(args...); }
// -----------------------------------------------------------------------------

const int N = 1E5 + 100;
int n, m;
string s, t;

int main() {
    cin >> n >> m;
    cin >> s >> t;
    int g = __gcd(n, m);
    int a = n / g, b = m / g;
    dbg(a, b);
    for (int i = 0, j = 0; i < n && j < m; i += a, j += b) {
        if (s[i] != t[j]) {
            puts("-1");
            return 0;
        }
    }
    cout << 1LL * n * m / g << endl;
}

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

int main(){
    int n,k;
    cin >> n >> k;
    int ans = 1;
    for(int i  = 0; i < n; i++){
        if(ans+k < ans*2){
            ans += k;
        }else{
            ans *= 2;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
# coding: utf-8
import sys
input = sys.stdin.readline
N,M=map(int,input().split())
A=[0]*M
dp=[-1]*(N+1)
for i in range(M):
    tmp=int(input())
    dp[tmp]=0
#print(dp)
dp[0]=1
dp[1]=0 if dp[1]==0 else 1

for i in range(2,N+1):
    if dp[i]!=0:
        dp[i]=dp[i-1]+dp[i-2]
        
print(dp[N]%(10**9+7))

Measured memory_bytes: 470392
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#define rep(i, n) for (int i = 0; i < n; i++)
#define rep1(i, n) for (int i = 1; i <= n; i++)
#define show(a, n) rep(i,n) {cout<<a[i]<<' ';} cout<<endl;

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<long long, long long> pll;

const int INF = 1 << 30;
const long long INFL = 1LL << 62;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 100000;

int main() {
	ll n,k;cin>>n>>k;
	ll a[N];
	rep(i,n) cin>>a[i];
	ll c[50][2];
	rep(i,50) c[i][0]=c[i][1]=0;
	rep(i,n) rep(j,50) c[j][(a[i]>>j)%2]++;
	ll x=0;
	for(int i=49;i>=0;i--) if(c[i][0]>c[i][1]&&(x|(1ll<<i))<=k) x|=(1ll<<i);
	ll ans=0;
	rep(i,n) ans+=a[i]^x;
	cout<<ans<<endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int N;
    cin >> N;
    for(int i = 0; i < 15; i++){
        for(int j = 0; j <= 25; j++){
            if(4*j + 7*i == N){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
}

Measured memory_bytes: 256
// {{{
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdint>
#include <cstdio>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;
// }}}

using ll = long long;

string S;

int main() {
    cin >> S;
    int k = S.size();
    int c = 0;
    for (int i = 0; i < k; ++i) {
        if (S[i] == 'o') ++c;
    }

    cout << (c + (15 - k) >= 8 ? "YES" : "NO") << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main() {
	int i;
	char c[3][4];

	for (i = 0;i < 2;i++) {
		scanf("%s", &c[i][0]);
	}

	if (c[0][0] == c[1][2] && c[0][1] == c[1][1] && c[0][2] == c[1][0]) printf("YES\n");
	else printf("NO\n");
	

	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>

using namespace std;
typedef long long ll;
ll solve(ll h) {
    if (h == 1) return 1;
    ll next = h / 2;
    return solve(next) * 2 + 1;
}

int main() {
    ll h; cin >> h;
    cout << solve(h) << endl;
    return 0;
}

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

using namespace std;

typedef long long ll;

int main(){
    int N, C, K;
    cin >> N >> C >> K;
    vector<int> T(N);
    for(int i = 0; i < N; ++i){
        cin >> T[i];
    }
    
    sort(T.begin(), T.end(), greater<int>());
    
    int n_limit = T[0] - K;
    int ans = 0;
    int cnt = 1;
    
    for(int i = 1; i < N; ++i){
        if(cnt < C){
            if(T[i] >= n_limit){
                cnt++;
            }
            else{
                n_limit = T[i] - K;
                ans++;
                cnt = 1;
            }
        }
        else{
            n_limit = T[i] - K;
            ans++;
            cnt = 1;
        }
    }
    if(cnt > 0)     ans++;
    
    cout << ans << endl;
}

Measured memory_bytes: 640
#include <stdio.h>

int mintwo(int kouyaku1,int kouyaku2);
int minthree(int kouyaku1,int kouyaku2,int kouyaku3);
void kouyakutwo();
void kouyakuthree();

int main(void){
    int n=0;
    
    scanf("%d",&n);
    if(n==2){
        kouyakutwo();
    }else{
        kouyakuthree();
    }


}

void kouyakutwo(){
	int kouyaku1=0,kouyaku2=0,i=1;
	int minvalue;
	scanf("%d %d",&kouyaku1,&kouyaku2);//数値を入力

	minvalue=mintwo(kouyaku1,kouyaku2);


	while(i <= minvalue)
	    {
		if(kouyaku1%i==0&&kouyaku2%i==0){
			printf("%d\n",i);
		}
		
		i=i+1;
	}
    
}

void kouyakuthree(){
	int kouyaku1=0,kouyaku2=0,kouyaku3=0;
	int i=1;
	int minvalue;

	scanf("%d %d %d",&kouyaku1,&kouyaku2,&kouyaku3);

	minvalue=minthree(kouyaku1,kouyaku2,kouyaku3);


	while(i <= minvalue)
		{
			if(kouyaku1%i==0&&kouyaku2%i==0&&kouyaku3%i==0){
				printf("%d\n",i);
			}
			
			i=i+1;
		}
    
}

int mintwo(int kouyaku1,int kouyaku2){
	int minvalu;

	if(kouyaku1<kouyaku2){
	    
		minvalu=kouyaku1;
	}else{
	    
		minvalu=kouyaku2;
	}

	return minvalu;


}

int minthree(int kouyaku1,int kouyaku2,int kouyaku3){
    
	int minvalu;
	
	minvalu=kouyaku1;
	
	if(minvalu>kouyaku2){
	    
		minvalu=kouyaku2;
		
	}
	if(minvalu>kouyaku3){
	    
		minvalu=kouyaku3;
		
	}

	return minvalu;
}



Measured memory_bytes: 2104
N,Q = map(int, input().split())
S = input()
LR = [list(map(lambda x : int(x)-1, input().split())) for _ in range(Q)]

L = [0 for _ in range(N)]
R = [0 for _ in range(N)]

for i in range(1,N):
    if S[i-1:i+1] == 'AC':
        if i == 0:
            L[i] = 1
        else:
            L[i] = L[i-1] + 1
    else:
        if i > 0:
            L[i] = L[i-1]

for i in range(Q):
    Li = LR[i][0]
    Ri = LR[i][1]

    print(L[Ri] - L[Li])





Measured memory_bytes: 31512
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fr(a,b) for(int i=a;i<b;i++)
#define frn(a,b) for(int i=a;i>=b;i--)
#define vi vector<int>
#define pii pair<int,int>
#define vpi vector<pair<int,int>>
#define test int t;cin>>t; while(t--)
#define mp make_pair
#define pb push_back
#define pu push
void fast(){ 
ios_base::sync_with_stdio(false); cin.tie(NULL); 
#ifndef ONLINE_JUDGE 
	freopen("input.txt","r",stdin); 
	freopen("output.txt","w",stdout); 
#endif
}
int32_t main(){
	fast();
	string s,t;
	cin>>s>>t;
	int n = s.length();
	int m = t.length();
		if(m == n+1){
		fr(0,n) if(s[i] != t[i]){cout<<"No";return 0;}
		cout<<"Yes";
	}
	else cout<<"No";
}

Measured memory_bytes: 3652
import std.stdio, std.array, std.conv, std.typecons, std.algorithm;

T diff(T)(const ref T a, const ref T b) { return a > b ? a - b : b - a; }

void main() {
    immutable ip = readln.split.to!(ulong[]);
    immutable x = ip[0], a = ip[1];

    ulong ret;
    if (x<a) ret = 0;
    else ret = 10;
    writeln(ret);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;;
#define rep(i, n) for(int i = 0;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define INF 1<<30
#define LINF 1LL<<62
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
const int MOD = 1000000007;
 
typedef long long ll;
typedef vector<ll> vl;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;cin >> n;
  vector<P> v(n);
  rep(i,n){
    ll a,b;cin >> a >> b;
    v[i] = mp(b,a);
  }
  sort(all(v));
  ll now =0;
  rep(i,n){
    ll sime = v[i].first;
    ll time = v[i].second;
    if(now+time>sime){
      cout << "No" << endl;
      return 0;
    }
    now += time;
  }
  cout << "Yes" <<endl;
}



Measured memory_bytes: 3456
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<cmath>
#include<string>

#define ls (t<<1)
#define rs ((t<<1)+1)
#define mid ((l+r)>>1)
#define fi first
#define se second
#define mk make_pair
#define pb push_back

#define N 2005
#define M 200005
#define seed 23333
#define Mo 924844033

void jia(int &x,int y)
{
		x+=y; if (x>=Mo) x-=Mo; 
}

using namespace std;
int i,j,m,n,p,k,G[N][N][4],F[N][N],s[N],H[N],l,fac[N];
void work(int x)
{
		int i,j,k;
		for (i=0;i<=s[x];++i)
			for (j=0;j<=s[x];++j)
				memset(G[i][j],0,sizeof(G[i][j]));
		G[0][0][1]=1;
		for (i=0;i<s[x];++i)
			for (j=0;j<=i;++j)
				for (k=0;k<4;++k)
				{
						jia(G[i+1][j][k>>1],G[i][j][k]);
						if ((k&1)==0)
							jia(G[i+1][j+1][k>>1],G[i][j][k]);
						if (i!=s[x]-1) 
							jia(G[i+1][j+1][(k>>1)+2],G[i][j][k]);
				}
		for (i=0;i<=s[x];++i)
			for (j=0;j<4;++j) 
				jia(F[x][i],G[s[x]][i][j]);
}
int main()
{
		fac[0]=1;
		for (i=1;i<N;++i) fac[i]=1ll*fac[i-1]*i%Mo;
		scanf("%d%d",&n,&k);
		for (i=1;i<=n;++i) s[i%k]++;
		for (i=0;i<k;++i) work(i);
		for (i=1;i<k;++i)
		{
				for (j=s[0];j>=0;--j)
					for (l=s[i];l;--l)
						jia(F[0][j+l],1ll*F[0][j]*F[i][l]%Mo);
				s[0]+=s[i];
		}
		int ans=0;
		for (i=0;i<=s[0];++i)
			if (i&1) ans=(ans-1ll*F[0][i]*fac[n-i]%Mo+Mo)%Mo;
			else jia(ans,1ll*F[0][i]*fac[n-i]%Mo);
		printf("%d\n",ans); 
}


Measured memory_bytes: 62976
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
using namespace std;

void solve(){
  int n; cin >> n;
  cout << 800 * n - n / 15 * 200 << endl;
  return;
}

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


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (W, H, x, y) = readLine()!!.split(' ').map { it.toLong() }
    val ans = H * W / 2.0
    if ((W == x * 2) && (H == y * 2)) {
        println("$ans 1")
    } else {
        println("$ans 0")
    }
}

Measured memory_bytes: 36248
//------------------------------------------
// C++ templete 
//------------------------------------------
#include <bits/stdc++.h>
using namespace std;

#define endl "\n"

//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

//REPEAT
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//container util
//------------------------------------------
#define pb push_back
#define paired make_pair
#define ALL(a) (a).begin(),(a).end()
#define PRINT(V) for (auto v : (V)) cout << v << " "
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())

//constant
//------------------------------------------
const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

//math
//------------------------------------------
int QP(int a,int b){int ans=1;do{if(b&1)ans=1ll*ans*a%MOD;a=1ll*a*a%MOD;}while(b>>=1);return ans;}
int QP(int a,int b,int MOD){int ans=1;do{if(b&1)ans=1ll*ans*a%MOD;a=1ll*a*a%MOD;}while(b>>=1);return ans;}
int GCD(int a,int b){return b?GCD(b,a%b):a;}

//debug
//------------------------------------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//grobal variable
//------------------------------------------
//動的計画法で役に立つ関数
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const int nmax=8;

bool Graph[nmax][nmax];

int dfs(int v,  int N, bool visited[nmax])
{
    bool all_visited=true;
    
    REP(i, N)
    {
        if (!visited[i]) 
        {
            all_visited=false;
            break;
        }
    }

    //終了条件
    if (all_visited) 
    { 
        return 1;
    }
    
    int res = 0;
    
    //訪れていない隣接頂点を探す
    REP(i, N)
    {
        if (Graph[v][i]==false) continue;
        if (visited[i]) continue;
        
        //iを訪れる
        visited[i]=true;
        res += dfs(i, N, visited);
        visited[i] = false;
    }

    return res;
}

int main() 
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    int N, M;
    cin >> N >> M;
    
    REP(i, M)
    {
        int A, B; cin >> A>>B;
        Graph[A-1][B-1] = Graph[B-1][A-1] = true;
    }
        
    bool visited[nmax];

    REP(i, nmax)
    {
        visited[i] = false;
    }
    
    visited[0] = true;cout << dfs(0,N, visited) << endl;
    return 0;
}



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

int main()
{
  int n;
  int tmp;
  std::vector<int> d;
  std::cin >> n;
  for (int i = 0; i < n; i++)
  {
    std::cin >> tmp;
    d.push_back(tmp);
  }
  std::sort(d.begin(), d.end());
  
  int result;
  if (d[n/2] == d[n/2 - 1])
    result = 0;
  else
    result = d[n/2] - d[n/2 - 1];
  
  std::cout << result << std::endl;

  return 0;
}

Measured memory_bytes: 892
#include <iostream>
#include <algorithm>
#include <tuple>
#include <vector>
#include <string>
#include <queue>

using namespace std;

int main(int argc, char const *argv[])
{
    long long n, k;
    cin >> n >> k;
    
    cout << min(n%k, k- (n%k)) << endl;
    return 0;
}


Measured memory_bytes: 3624
#include <iostream> 
#include <string> 
#include <vector> 
#include <cmath> 
#include <algorithm> 
#include <cstdlib> 
#include <ctime> 
#include <cstdio> 
#include <functional> 
#include <set> 
#include <sstream> 
#include <cctype>
#include <stack>
#include <queue>
#include <cstring>
#include <map>
#include <list>
#include <cassert>
 
using namespace std; 

int main(){

	int n,m;
	cin>>n>>m;

	vector<vector<bool> > e(n,vector<bool>(n,false));
	for(int i=0;i<m;i++){
		int a,b;
		cin>>a>>b;
		a--,b--;
		e[a][b]=e[b][a]=true;
	}

	vector<int> order(n);
	for(int i=0;i<n;i++) order[i]=i;
	long long res=0;

	do{

		bool ok=true;
		for(int i=0;i<n-1 && ok;i++){
			if(!e[order[i]][order[i+1]]) ok=false;
		}

		if(ok) res++;

	}while(next_permutation(order.begin()+1,order.end()));


	cout<<res<<endl;
}

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

const int INF = 1 << 28;

typedef pair < int , int > Pi;

struct Node
{
	int l, r, mpos, nmpos, c1, c2;
	bool operator < (const Node d) const { return (c1 > d.c1); }
};

struct Segtree
{

	Pi data[1 << 19 + 2];
	int size;
	
	Segtree() : size(1 << 18)
	{
		fill_n(data, 1 << 19 + 2, Pi(INF, INF));
	}
	
	void update(int k, int x)
	{
		k += size - 1;
		data[k] = Pi(x, k - size + 1);
		while(k != 0) {
			k = (k - 1) >> 1;
			data[k] = min(data[k * 2 + 1], data[k * 2 + 2]);
		}
	}

	Pi query(int a, int b)
	{
		return (query(a, b, 0, 0, size - 1));
	}

	Pi query(int a, int b, int k, int l, int r)
	{
		if(b < l || r < a) return (Pi(INF, INF));
		if(a <= l && r <= b) return (data[k]);
		return (min(query(a, b, k * 2 + 1, l, (l + r) / 2), query(a, b, k * 2 + 2, (l + r) / 2 + 1, r)));
	}

};

Node getNode(int l, int r);

int N;
int P[200005];
Segtree tree1, tree2;

int main()
{
	cin >> N;
	for(int i = 0; i < N; i++) {
		cin >> P[i];
		if(i % 2) tree2.update(i, P[i]);
		else tree1.update(i, P[i]);
	}
	bool flag = false;
	priority_queue < Node > pq;
	int mpos = tree1.query(0, N - 1).second, nmpos = tree2.query(mpos + 1, N - 1).second;
	pq.push( (Node) { 0, N - 1, mpos, nmpos, P[mpos], P[nmpos] } );
	while(!pq.empty()) {
		Node d = pq.top(); pq.pop();
		if(flag) cout << " ";
		cout << d.c1 << " " << d.c2; flag = true;
		if(d.mpos - 1 - d.l != -1) pq.push( getNode(d.l, d.mpos - 1) );
		if(d.nmpos - 1 - d.mpos - 1 != -1) pq.push( getNode(d.mpos + 1, d.nmpos - 1) );
		if(d.r - d.nmpos - 1 != -1) pq.push( getNode(d.nmpos + 1, d.r) );
	}
	cout << endl;
	return (0);
}

Node getNode(int l, int r)
{
	int mpos, nmpos;
	if(l % 2 == 0) {
		mpos = tree1.query(l, r).second, nmpos = tree2.query(mpos + 1, r).second;
	} else {
		mpos = tree2.query(l, r).second, nmpos = tree1.query(mpos + 1, r).second;
	}
	return ((Node) { l, r, mpos, nmpos, P[mpos], P[nmpos] } );
}


Measured memory_bytes: 36084
#pragma GCC optimize(2)
#pragma G++ optimize(2)
#include<bits/stdc++.h>
#include<math.h>
#define si(a) scanf("%d",&a)
#define sl(a) scanf("%lld",&a)
#define sd(a) scanf("%lf",&a)
#define ss(a) scanf("%s",a)
#define ms(a) memset(a,0,sizeof(a))
#define repi(i,a,b) for(register int i=a;i<=b;++i)
#define repd(i,a,b) for(register int i=a;i>=b;--i)
#define reps(s) for(int i=head[s];i;i=e[i].nxt)
#define ce(i,r) i==r?'\n':' '
#define pb push_back 
#define fi first
#define se second
#define pr(x) cout<<#x<<": "<<x<<endl

using namespace std;
typedef long long ll;

double pi = acos(-1);
int r;

int main(){
	cin>>r;
	cout<<2 * r * pi;
	return 0;
} 

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

using namespace std;

int main(void){
    int a, b, c;
    cin >> a >> b >> c;
    
    int k;
    cin >> k;
  
    while (a >= b){
        k--;
        b = b * 2;
        if (b > a) break;
    }
    
    while (b >= c){
        k--;
        c = 2 * c;
        
        if (c > b) break;
    }
   
    if (k >= 0) cout << "Yes" << endl;
    else cout << "No" << endl;
    
}



Measured memory_bytes: 3628
import sys
sys.setrecursionlimit(10 ** 5 + 10)


def input(): return sys.stdin.readline().strip()


def resolve():

    N = int(input())
    A, B = [0] * N, [0] * N

    for i in range(N):
        A[i], B[i] = map(int, input().split())

    x = 1

    for i in range(N-1):
        x = max(-(-A[i]*x // A[i+1]), -(-B[i]*x // B[i+1]))

    print(x*(A[N-1]+B[N-1]))


resolve()

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

typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef pair<int,ii> iii;
typedef vector<pair<ii,int>> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
typedef map<int,int> mii;
typedef map<char,int> mci;
typedef priority_queue<int> pqi;
typedef priority_queue<ii> pqii;
typedef priority_queue<int,vi,greater<int>> pqmini;
typedef priority_queue<ii,vii,greater<ii>> pqminii;
typedef long long lli;

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define si(n) scanf("%d",&n)
#define iout(n) printf("%d\n",n)
#define slli(n) scanf("%lld",&n)
#define lliout(n) printf("%lld\n",n)
#define FOR(i,n) for(int i=0;i<n;i++)

#define EPS 10e-9;
#define PI 3.14159265359
#define EULER 2.7182818284
#define MOD 1000000007

//global variables
//end global variables

void preprocess(void){
	return;
}

int main(void){
	//freopen("output.txt","w",stdout);
	//freopen("input.txt","r",stdin);
	preprocess();
	int t;
	//si(t);
	t=1;
	for(int z=1;z<=t;z++){
        //printf("Case #%d: ",z);	
        lli x;
        slli(x);
        if(x%11==0){
            lliout(2*x/11);
        }
        else{
            if(x%11>6){
                lliout(2*(x/11)+2);
            }
            else{
                lliout(2*(x/11)+1);
            }
        }
    }
	return 0;
}


Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::*;
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n = read();
    let t: f64 = read();
    let a: f64 = read();

    let mut mi: f64 = 1000.0;
    let mut ans = 0;
    for i in 0..n {
        let h: f64 = read();
        let kion = t - h * 0.006;
        let sa = (a - kion).abs();
        if sa < mi {
            mi = sa;
            ans = i;
        }
    }

    println!("{}", ans + 1);
}

Measured memory_bytes: 4352
#pragma GCC optimize "trapv"
#include<bits/stdc++.h>

#define ll long long int
#define pb push_back
#define ppb pop_back
#define ff first
#define ss second
#define sz(s) (ll)(s.size())
#define vvi vector<vector<ll>>
#define vi vector<ll>
#define all(a) (a).begin(),(a).end()
#define pii pair<ll,ll>
#define dbg(x,y) cout<<x<<" "<<y<<endl
#define endl '\n'
#define M 1000000007
const ll INF = 1ll<<60;

using namespace std;
//-----------------------------------------//


void solve(){
	ll n,d;
	cin>>n>>d;
	ll x,y;
	ll cnt=0;
	while(n--){
		cin>>x>>y;
		double b = sqrt(x*x+y*y);
		if(b<=d) ++cnt;
	}

	cout<<cnt<<endl;
}



int main(){

	#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
	#endif
	
	int t=1;
	// cin>>t;
	while(t--){
        solve();
	}
}


Measured memory_bytes: 3544
#入力
n,m = map(int,input().split())
a_list = [input() for nesya in range(n)]
b = [input() for motsu in range(m)]

#二重ループによりN*NからM*Mの正方形を取り出す(j行目i列目)
for i in range(n-m+1):
  for j in range(n-m+1):
    #j~j+m-1行目のi~i+m-1列目をリスト型にする
    s = [(a_list[k])[i:i+m] for k in range(j,j+m)]
    #テンプレート(問題文)と一致しているか
    if b == s:
      #一致していたら終わる
      break
    #違ったら続ける
  #一致していた時、外側のリストについても終了する
  if b == s:
    break    

#判定
if b == s:
  #含んでいた
  print('Yes')
else:
  #含んでいなかった
  print('No')

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <iomanip>
#include <cmath>
using namespace std;
using ll = long long;
#define rep(i, j, n) for(size_t i = (j); i < (n); ++i)
#define rrep(i, j, n) for(size_t i = (n) - 1; (j) <= i; --i)
constexpr ll MOD = 1000000007;
constexpr ll INF = 1LL << 60;

int main() {
	cin.tie(0); ios_base::sync_with_stdio(false);
	int n; cin >> n;
	vector<int> p(n);

	vector<int> a(n), b(n);
	vector<int> target(n);
	int s = 500000000;
	rep(i, 0, n) {
		cin >> p[i];
		--p[i];
		target[p[i]] = s++;
	}

	a[0] = 1;
	b[0] = target[0] - 1;
	rep(i, 1, n) {
		// target[i] = a[i] + b[i]
		// b[i - 1] > b[i]
		// a[i - 1] < a[i]
		// となるようにtarget[i]を分割
		a[i] = target[i] - b[i - 1] + 1;
		if (a[i] <= a[i - 1]) a[i] = a[i - 1] + 1;
		b[i] = target[i] - a[i];
	}

	rep(i, 0, n) cout << a[i] << " \n"[i == n - 1];
	rep(i, 0, n) cout << b[i] << " \n"[i == n - 1];
	return 0;

}


Measured memory_bytes: 3736
#include<bits/stdc++.h>
#define ll long long int
#define ar array
#define pb push_back
#define input(arr,n) for(int i = 0; i<n; i++) cin>>arr[i]
const int mod = 1e9+7;
ll power(ll a,ll b){ll r=1;for(;b;b>>=1){if(b&1)r=r*a%mod;a=a*a%mod;}return r;}
using namespace std;

const int MAX = 1000001; 
struct Query 
{ 
    int l, r, idx; 
}; 

bool cmp(Query x, Query y) 
{ 
    return x.r < y.r; 
} 

void update(int idx, int val, int bit[], int n) 
{ 
    for (; idx <= n; idx += idx&-idx) 
        bit[idx] += val; 
} 

int query(int idx, int bit[], int n) 
{ 
    int sum = 0; 
    for (; idx>0; idx-=idx&-idx) 
        sum += bit[idx]; 
    return sum; 
} 

void answeringQueries(int arr[], int n, Query queries[], int q) 
{ 
    int bit[n+1]; 
    memset(bit, 0, sizeof(bit)); 
    int last_visit[MAX]; 
    memset(last_visit, -1, sizeof(last_visit)); 
    int ans[q]; 
    int query_counter = 0; 
    for (int i=0; i<n; i++) 
    { 
        if (last_visit[arr[i]] !=-1) 
            update (last_visit[arr[i]] + 1, -1, bit, n); 
        last_visit[arr[i]] = i; 
        update(i + 1, 1, bit, n); 
        while (query_counter < q && queries[query_counter].r == i) 
        { 
            ans[queries[query_counter].idx] = 
                    query(queries[query_counter].r + 1, bit, n)- 
                    query(queries[query_counter].l, bit, n); 
            query_counter++; 
        } 
    } 
    for (int i=0; i<q; i++) 
        cout << ans[i] << endl; 
} 

int main() 
{ 
    int n,q,x,y;
    cin>>n>>q;
    int arr[n];
    for(int i=0;i<n;i++)
        cin>>arr[i];
    Query queries[q];
    for(int i=0;i<q;i++){
        cin>>x>>y;
        x--;y--;
        queries[i].l=x;
        queries[i].r=y;
        queries[i].idx=i;
    }
    sort(queries, queries+q, cmp); 
    answeringQueries(arr, n, queries, q); 
    return 0; 
}

Measured memory_bytes: 19368
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>

#define int long long int
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

int n;
vector<vector<int>> edge;

P dfs(int v, int par){
    P ans = {1, 1};

    for(int u : edge[v]){
        if(u == par){
            continue;
        }

        P tmp = dfs(u, v);
        ans.first *= (tmp.first + tmp.second) % MOD;
        ans.first %= MOD;
        ans.second *= tmp.first;
        ans.second %= MOD;
    }
    return ans;
}

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

    cin >> n;
    edge = vector<vector<int>>(n, vector<int>());
    rep(i, n - 1){
        int x, y;
        cin >> x >> y;
        edge[x-1].push_back(y-1);
        edge[y-1].push_back(x-1);
    }

    P ans = dfs(0, -1);
    cout << (ans.first + ans.second) % MOD << endl;

    return 0;
}


Measured memory_bytes: 11264
#include "bits/stdc++.h"
#define ll long long
#define vi vector <int>
#define vii vector <vi>
using namespace std;

const int mod = 1e9 + 7;
const int mnx = 1e6 + 9;

ll n;
string s, f;

int main(){
    cin >> n >> s >> f;

    for(int i = 0; i < n + n; i++){
        if(i % 2 == 0){
            cout << s[i / 2];
        } else {
            cout << f[i / 2];
        }
    }

    return 0;
}















































Measured memory_bytes: 256