akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define INFS (1LL<<28)
#define INF (1LL<<60)
#define DEKAI 1000000007
#define lp(i,n) for(int i=0;i<n;i++)
#define int long long
#define double long double
#define all(n) n.begin(),n.end()
typedef complex<double> P;
 
vector<pair<double,pair<double,double>>> ans;
 
double rot(double x,double y){
	double angle=acos(x/(sqrt(x*x+y*y)));
	angle=angle*180.0/acos(-1);
	if(y<0)angle=360.0-angle;
	return angle;
}
 
signed main(){
	cout << fixed << setprecision(15);
	int n;
	cin>>n;
 
	lp(i,n){
		int x,y;
		cin>>x>>y;
		ans.push_back({arg(P(x,y)),{x,y}});
	}
	sort(ans.begin(),ans.end());
	lp(i,n){
		ans.push_back(ans[i]);
	}
	double r=0;
	lp(i,n){
		double sum[2]={0,0};
		for(int j=i;j<n+i;j++){
			sum[0]+=ans[j].second.first;
			sum[1]+=ans[j].second.second;
			r=max<double>(r,sqrt(sum[0]*sum[0]+sum[1]*sum[1]));
		}
	}
	cout<<r<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
main(){
  int n;
  int m;
  int mv[1001];
  int ms[1001];
  int i,j;
  while(1){
    scanf("%d %d",&n,&m);
    if(n==0 && m==0) break;
    for(i=0;i<n;i++)
      scanf("%d",&ms[i]);
    for(i=0;i<m;i++)
      scanf("%d",&mv[i]);
    
    j=0;
    for(i=0;i<m;i++){
      j+=mv[i];
      //printf("J...%d mas%d",j,ms[j]);
      j+=ms[j];
      //printf(" po%d\n",j);
      if(j>=n-1)
	break;
    }
    
    printf("%d\n",i+1);
  }
  return 0;
}

Measured memory_bytes: 0
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
ans=100000000000000
ans1=-1
for i in range(n):
    if abs(a-(t-h[i]*0.006))<ans:
        ans=abs(a-(t-h[i]*0.006))
        ans1=i+1
print(ans1)

Measured memory_bytes: 62536
<?php
$s = "1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51";
$a = explode(', ', $s);
fscanf(STDIN, "%d", $K);
echo $a[$K - 1];


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

int main() {
    string s, t;
    cin >> s >> t;

    if((s.length() + 1) != t.length())
    {
        cout << "No" << endl;
    }
    else
    {
        int i;
        for(i=0; i<s.length(); i++)
        {
            if(s[i] != t[i]) break;
        }
        if(i == s.length()) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    return 0;
}



Measured memory_bytes: 3596
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <cmath>
#include <algorithm>
#include <functional>
#include <array>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define rep1(i,n) for(int i=1;i<=(n);++i)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
typedef pair<int,int> P;
string dir="ENSW";
typedef array<int,6> dice;
dice rotate(dice d,int di){
	dice ret;
	if(di==0){
		ret[0]=d[0];
		ret[1]=d[3];
		ret[2]=d[1];
		ret[3]=d[4];
		ret[4]=d[2];
		ret[5]=d[5];
	}
	if(di==1){
		ret[0]=d[4];
		ret[1]=d[0];
		ret[2]=d[2];
		ret[3]=d[3];
		ret[4]=d[5];
		ret[5]=d[1];
	}
	if(di==2){
		ret[0]=d[1];
		ret[1]=d[5];
		ret[2]=d[2];
		ret[3]=d[3];
		ret[4]=d[0];
		ret[5]=d[4];
	}
	if(di==3){
		ret[0]=d[0];
		ret[1]=d[2];
		ret[2]=d[4];
		ret[3]=d[1];
		ret[4]=d[3];
		ret[5]=d[5];
	}
	return ret;
}
bool can(dice d){
	int a=d[0]+d[5],b=d[1]+d[4],c=d[2]+d[3];
	rep(i,6) if(d[i]<0) return false;
	return (a<=b+c+1&&b<=a+c&&c<=a+b+1);
}
int main(){
	while(true){
		dice a;
		int N=0;
		rep(i,6) cin>>a[i];
		rep(i,6) N+=a[i];
		if(N==0) break;
		int p,q;
		cin>>p>>q;
		sort(all(a));
		string ans="Z";
		int cnt=0;
		do{
//			if(cnt%10==0) show(cnt);
			cnt++;
			dice d=a;
			if(!can(d)) continue;
			string now;
			rep(i,N){
				rep(di,4){
					dice c=rotate(d,di);
					c[4]--;
					if(can(c)){
						now+=dir[di];
						d=c;
						break;
					}
				}
			}
			if(ans>now) ans=now;
		}while(next_permutation(all(a)));
		if(ans[0]=='Z') puts("impossible");
		else cout<<ans.substr(p-1,q-p+1)<<endl;
		//show(ans);
	}
}

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

#define rep(i,N) for(int i=0;i<N;i++)
#define rep2(i,N) for(int i=1;i<=N;i++)
using namespace std;
long long  INF=1e18;
long long mod=1e9+7;

//status unsolved

int main(){
    long long h,w,m;
    cin>>h>>w>>m;

    vector<int> height(300010,0);
    vector<int> width(300010,0);
    
    vector<pair<int,int>> bombers;
    rep(i,m){
        int h1,w1;
        cin>>h1>>w1;
        height[h1]++;
        width[w1]++;
        bombers.push_back(make_pair(h1,w1));
    }
    int maxh=*max_element(height.begin(),height.end());
    int maxw=*max_element(width.begin(),width.end());
    //cout<<"maxs "<<maxh<<" "<<maxw<<endl;
    set<int> treeh;
    set<int> treex;
    for(int i=1;i<=h;i++){
        if(height[i]==maxh){
            treeh.insert(i);
        }
    }
    for(int k=1;k<=w;k++){
        if(width[k]==maxw){
            treex.insert(k);
        }
    }
    int impossible=0;
    for(int i=0;i<m;i++){
        int y=bombers[i].first;
        int x=bombers[i].second;
        if(treeh.find(y)!=treeh.end() && treex.find(x)!=treex.end()){
            impossible++;
        }
    }
    if(impossible<treeh.size()*treex.size()){
        cout<<maxh+maxw<<endl;
    }
    else{
        cout<<maxh+maxw-1<<endl;
    }
    return 0;

}
/*


*/


Measured memory_bytes: 36176
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
	int n,i,j,k;
	scanf("%d",&n);
	ll a[n],sum=0;
	for(i=0;i<n;i++)
	scanf("%lld",&a[i]);
	for(i=0;i<n-2;i++)
	{
		for(j=i+1;j<n-1;j++)
		{
			for(k=j+1;k<n;k++)
			{
				if(a[i]!=a[j]&&a[j]!=a[k]&&a[k]!=a[i])
				{
					int b=a[i],c=a[j],d=a[k];
					if(b+c>d&&b+d>c&&c+d>b&&b-c<d&&b-d<c&&c-d<b)sum++;
				}
			}
		}
	}
	printf("%lld\n",sum);
}

Measured memory_bytes: 3832
#include<iostream>
#include<string>
using namespace std;
int main(){
    string s;
    cin>>s;
    int a[200000];
    int tmp=0;
    for(int i=0;i<s.size();i++){
        tmp+=s[i]-'0';
    }
    if(tmp%9==0)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 3756
import itertools
n = int(input())
li = list(map(int,input().split()))	
c = 0
L = []

for v in itertools.combinations(li, 3):
    
    #print(v[0],v[1],v[2])
    L.append(v)
  
for i in L:
    if(i[0] == i[1] or i[1] == i[2] or i[2] == i[0]):
        c += 0
    else:
        #print(i[0],i[1],i[2])
        if(i[0] + i[1] > i[2] and i[1] + i[2] > i[0] and i[0] + i[2] > i[1]):
            c += 1

print(c)




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




int main() 
{ 
    ios::sync_with_stdio(false);
    cin.tie(0);
    
   while(true){
       string s;
       cin>>s;
       if(s=="-") break;
       
       int n;
       cin>>n;
       while(n--){
           int m; cin>>m;
           s = s.substr(m) + s.substr(0,m);
       }
       cout<<s<<endl;
   }
	
	return 0; 
} 



Measured memory_bytes: 3172
#include <iostream>
#include <cstdlib>


using namespace std;


struct node {
    long k;
    node *l, *r, *p;
};


int top = 0;
node nodes[500001];
node *t, *z;

void insert(long k)
{
    node *f = &nodes[top++];
    f->k = k;

    node *tmp = t, *p = z;
    while(tmp != z) {
        p = tmp;
        if (k <= tmp->k) {
            tmp = tmp->l;
        } else {
            tmp = tmp->r;
        }
    }

    f->p = p;
    if (p == z) {
        t = f;
    } else if (k <= p->k) {
        p->l = f;
    } else {
        p->r = f;
    }
}


void inorder(node *x)
{
    if (x->l != z)
        inorder(x->l);
    cout << " " << x->k;
    if (x->r != z)
        inorder(x->r);
}


void preorder(node *x)
{
    cout << " " << x->k;
    if (x->l != z)
        preorder(x->l);
    if (x->r != z)
        preorder(x->r);
}


void print()
{
    inorder(t);
    cout << endl;
    preorder(t);
    cout << endl;
}


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

    z= &nodes[n];
    z->p = z;
    z->l = z;
    z->r = z;

    t = z;

    for (int i = 0; i < n; i++) {
        nodes[i].p = z;
        nodes[i].l = z;
        nodes[i].r = z;
    }

    for (int i = 0; i < n; i++) {
        string cmd;
        cin >> cmd;
        if (cmd[0] == 'i') {
            long k;
            cin >> k;
            insert(k);
        } else if(cmd[0] == 'p') {
            print();
        }
    }
}


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

#define CK(N, A, B) (A <= N && N < B)
#define REP(i, a, b) for (int i = a; i < b; i++)
#define RREP(i, a, b) for (int i = (b - 1); a <= i; i--)
#define F first
#define S second
#define ll long long

const int INF = 1e9;
const long long LLINF = 1e18;

using namespace std;

int dy[] = {0,1,0,-1};
int dx[] = {1,0,-1,0};
int dy8[] = {0,1,1,1,0,-1,-1,-1};
int dx8[] = {1,1,0,-1,-1,-1,0,1};

/*==================================================*/
/*variable*/
int A, B;
string s[110];
/*==================================================*/
/*function*/

/*==================================================*/

int main() {
    cin>>A>>B;

    REP(i,0,100) s[i] = "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@";

    int cnt = 0;
    REP(i,0,50){
        REP(j,0,100){
            if(A > 1 && i % 2 == 0 && j % 2 == 0){
                s[i][j] = '.';
                A--;
            }else{
                s[i][j] = '#';
            }
        }
    }

    RREP(i,50,100){
        REP(j,0,100){
            if(B > 1 && i % 2 == 0 && j % 2 == 0){
                s[i][j] = '#';
                B--;
            }else{
                s[i][j] = '.';
            }
        }
    }

    cout<<100<<" "<<100<<endl;
    REP(i,0,100){
        cout<<s[i]<<endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int payment[5]={0},change,coin[5]={0},i,j;
	for(i=0;i<5;i++){
		scanf("%d",&payment[i]);
		if(payment[i]==0) break;
	}
	for(j=0;j<5;j++){
		if(payment[j]==0) break;
		change=1000-payment[j];
		while(change>=500){
			change=change-500;
			coin[j]++;
		}
		while(change>=100){
			change=change-100;
			coin[j]++;
		}
		while(change>=50){
			change=change-50;
			coin[j]++;
		}
		while(change>=10){
			change=change-10;
			coin[j]++;
		}
		while(change>=5){
			change=change-5;
			coin[j]++;
		}
		while(change>=1){
			change=change-1;
			coin[j]++;
		}
		printf("%d\n",coin[j]);
		}
	return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(), (x).end())
#define ALL(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define reps(i, m, n) for (ll i = m; i < n; i++)
#define repr(i, m, n) for (ll i = m; i >= n; i--)
#define de(x) cout << #x << "=" << x << endl;
#define SP << " " <<
template <class T> bool maxi(T &a, const T &b) {
    if (a < b) { a = b; return 1;} return 0;}
template <class T> bool mini(T &a, const T &b) {
    if (b < a) { a = b; return 1;} return 0;}
#define dame {cout<< "-1" <<"\n"; return;}
#define INF2 1000000000000000037
#define INF  1000000007
#define MOD  1000000007
using namespace std;
using ll = long long;
using ld = long double;
using P  = pair<ll,ll>;
//--GLOBAL---------------------------------

//--MAIN-----------------------------------
void Main() {
    bool A[3][3];
    rep(i,3){
        rep(j,3){
            A[i][j]=false;
        }
    }
    ll num[3][3];
    rep(i,3){
        rep(j,3){
            cin>>num[i][j];
        }
    }
    ll N; cin>>N;
    rep(i,N){
        ll a; cin>>a;
        rep(i,3){
            rep(j,3){
                if(a==num[i][j]){
                    A[i][j]=true;
                }
            }
        }
    }
    bool ok=false;
    if(A[0][0] and A[0][1] and A[0][2]) ok=true;
    if(A[1][0] and A[1][1] and A[1][2]) ok=true;
    if(A[2][0] and A[2][1] and A[2][2]) ok=true;

    if(A[0][0] and A[1][1] and A[2][2]) ok=true;
    if(A[2][0] and A[1][1] and A[0][2]) ok=true;

    if(A[0][0] and A[1][0] and A[2][0]) ok=true;
    if(A[0][1] and A[1][1] and A[2][1]) ok=true;
    if(A[0][2] and A[1][2] and A[2][2]) ok=true;

    cout<< ( ok ? "Yes" : "No" )<<"\n";

}

//--START----------------------------------
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}
//-----------------------------------------


Measured memory_bytes: 256
#include<stdio.h>
int main(){
    int H,W,a,b;
    while(1){
        scanf("%d %d",&H,&W);
        if(H == 0 && W == 0)break;
        for(a = 0;a < H;a++){
            for(b = 0;b < W;b++){

                if(a > 0 && a != H -1&& b > 0 && b != W-1){
                    printf(".");
                }
                else printf("#");
            }
        printf("\n");
        }
    printf("\n");
    }
    return 0;
}

Measured memory_bytes: 572
#include <stdio.h>
#include <math.h>
int main(){
    int x;
    scanf("%d", &x);
    if(x >=400 && x < 600)printf("8\n");
    if(x >=600 && x < 800)printf("7\n");
    if(x >=800 && x < 1000)printf("6\n");
    if(x >=1000 && x < 1200)printf("5\n");
    if(x >=1200 && x < 1400)printf("4\n");
    if(x >=1400 && x < 1600)printf("3\n");
    if(x >=1600 && x < 1800)printf("2\n");
    if(x >=1800 && x < 2000)printf("1\n");
    return 0;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector <int> p(n);
  for(int i=0;i<n;++i) cin >> p[i];
  sort(p.begin(),p.end());
  int sum=p[n-1]/2;
  for(int i=0;i<n-1;++i) sum+=p[i];
  cout << sum << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#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 INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int inputValue(){
    int a;
    cin >> a;
    return a;
};

void inputArray(int * p, int a){
    REP(i, a){
        cin >> p[i];
    }
};

void inputVector(vector<int> * p, int a){
    REP(i, a){
        int input;
        cin >> input;
        p -> push_back(input);
    }
}

int main()
{
    int N = inputValue();
    vector<ll> A;

    ll sum = 0;
    REP(i, N){
        ll input;
        cin >> input;
        sum += input;
        A.push_back(sum);
    }
    ll ans = LLONG_MAX;
    REP(i, N){
        ans = min(ans, abs(sum - A[i] - A[i]));
    }
    cout << ans << endl;
}


Measured memory_bytes: 2420
#include<stdio.h>
#define M 2000000

int n,a[M+1];

void maxHeapify(int i){
  int l,r,d,S;

  l = 2*i;
  r = 2*i+1;
  
  if(l<=n && a[l]>a[i]) d=l;
  else d=i;
  if(l<=n && a[r]>a[d]) d=r;

  if(d!=i){
    S = a[i];
    a[i] = a[d];
    a[d] = S;
    maxHeapify(d);
  }
}

int main(){
  int i;

  scanf("%d",&n);

  for(i=1;i<=n;i++){
    scanf("%d",&a[i]);
  }
  
  for(i=n/2;i>=1;i--){
    maxHeapify(i);
  }
  
  for(i=1;i<=n;i++){
    printf(" %d",a[i]);
  }

  printf("\n");

  return 0;
}



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

signed main(){
    string s;
    cin>>s;
    if(s=="ABC")puts("ARC");
    else puts("ABC");
    return 0;
}


Measured memory_bytes: 3600
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
const int N = 5e5 + 5;
const int mod = 1e9 + 7; 
using namespace std;

int n, Inv, pw[N], p = 100, hashh[N], vis[2][N];
char s[N]; 

template < typename T >
inline T read()
{
	T x = 0, w = 1; char c = getchar();
	while(c < '0' || c > '9') { if(c == '-') w = -1; c = getchar(); }
	while(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return x * w; 
}

int fpow(int x, int y)
{
	int res = 1;
	for( ; y; y >>= 1, x = 1ll * x * x % mod)
		if(y & 1) res = 1ll * res * x % mod;
	return res; 
}

int gethashh(int l, int r)
{
	return (hashh[r] - 1ll * hashh[l - 1] * pw[r - l + 1] % mod + mod) % mod; 
}

int main()
{
#ifndef ONLINE_JUDGE
	freopen("cpp.in", "r", stdin);
#endif
	scanf("%s", s + 1), n = strlen(s + 1), Inv = fpow(p - 1, mod - 2); 
	for(int i = (pw[0] = 1); i <= n; i++) pw[i] = 1ll * pw[i - 1] * p % mod; 
	for(int i = 1; i <= n; i++) hashh[i] = (1ll * hashh[i - 1] * p + s[i] - 'a' + 1) % mod; 
	for(int tmp, res, i = n; i >= 1; i--)
	{
		res = 1; 
		for(int j = 2; j * i <= n; j++)
		{
			res = (res + pw[(j - 1) * i]) % mod, tmp = 1ll * hashh[i] * res % mod; 
			if(tmp == hashh[j * i]) vis[0][j * i] = i; 
		}
	}
	for(int tmp, res, i = n; i >= 1; i--)
	{
		res = 1; 
		for(int j = 2; j * i <= n; j++)
		{
			res = (res + pw[(j - 1) * i]) % mod, tmp = 1ll * gethashh(n - i + 1, n) * res % mod; 
			if(tmp == gethashh(n - j * i + 1, n)) vis[1][n - j * i + 1] = i; 
		}
	}
	if(!vis[0][n]) { printf("%d\n%d\n", 1, 1); return 0; }
	else if(vis[0][n] == 1) { printf("%d\n%d\n", n, 1); return 0; }
	else
	{
		puts("2"); int ans = 0; 
		for(int i = 1; i < n; i++)
			if(!vis[0][i] && !vis[1][i + 1]) ans++;
		printf("%d\n", ans); 
	}
	return 0; 
}


Measured memory_bytes: 11528
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<functional>
#include<map>
#include<cstdlib>
#include<complex>
#include<numeric>
#include<set>
#include<deque>
#include<queue>

using namespace std;
using Int = long long;
Int INF = 1LL << 60;
const Int MOD = 1000000000 + 7;

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	Int N;
	cin >> N;

	vector<Int> a(N);
	for (Int i = 0; i < N; i++) {
		cin >> a[i];
	}

	Int temp = a[0];
	Int res = 1;
	vector<Int> cnt;

	for (Int i = 1; i < N; i++) {
		if (temp==a[i]) {
			res++;
		}
		else {
			temp = a[i];
			cnt.push_back(res);
			res = 1;
		}
	}
	cnt.push_back(res);

	Int ans = 0;
	Int len = cnt.size();

	for (Int i = 0; i < len; i++) {
		ans += cnt[i] / 2;
	}

	cout << ans << "\n";
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cstdio>
#include<string>
#include <algorithm>
#include <cmath>
#include<vector>
#include<stack>
#define INF 0x3f3f3f3f  
#define maxn 100000+10
using namespace std;

int main()
{
	int a, b, x;
	cin >> a >> b >> x;
	if (a>x)
		cout << "NO" << endl;
    else if (b >= x - a)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <string.h>
#include <string>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <math.h>
#include <algorithm>
#include <numeric>

using namespace std;

// マクロ&定数 ============================================================
typedef unsigned int uint;
typedef long long ll;
//typedef pair<int, int> P;

typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<bool> vbool;
typedef vector<string> vstring;

typedef vector<pair<int, int>> vpint;
typedef vector<pair<ll, ll>> vpll;
typedef vector<pair<double, double>> vpdouble;

typedef vector<vector<int>> vvint;
typedef vector<vector<ll>> vvll;
typedef vector<vpint> vvpint;
typedef vector<vpll> vvpll;
typedef vector<vector<double>> vvdouble;
typedef vector<vector<string>> vvstring;
typedef vector<vector<bool>> vvbool;

typedef vector<vector<vector<ll>>> vvvll;

const int c_YET = -1;
const int INF = 1e9 + 1;
const ll LLINF = 1e17 + 1;
const int DX[9] = { 0,0,1,-1, 1, 1, -1, -1, 0 }; // 4;４近傍
const int DY[9] = { 1,-1,0,0, 1, -1, 1, -1, 0 }; // 8:８近傍 9:(0,0)を含む
const ll MOD = 1e9 + 7; //10^9 + 7
const ll MAX = 1e9;
const double PI = 3.14159265358979323846264338327950288;
//========================================================================




int main() {

	////==================================
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(30);
	////==================================
	
	double R;
	cin >> R;
	
	cout << 2 * R * PI;
	







}





Measured memory_bytes: 3804
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 1000000007
using vi = vector<ll>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける

ll n,x,y;

int main(){
  ll ans=0;
  cin >> n ;

  int k;

  
  for(int a=1;a<=n;a++){
    int amatu=a%10;
    int aa=a;
    while(aa>=10){
      aa/=10;
    }
    int asent=aa;

    if (amatu==0)continue;

    
    if (amatu==asent){
      if (amatu<=n){
        ans++;//1桁
        //cout<<a<<endl;
      }
    }
    if (amatu*10+asent<=n){
      ans++;//2桁
      //cout<<a<<" "<<amatu*10+asent<<endl;
    }
    //3桁
    k=n-(amatu*100+asent);
    if (k>=0){
      ans+=min(k/10+1,10);
    }
    //4桁
    k=n-(amatu*1000+asent);
    if (k>=0){
      ans+=min(k/10+1,100);
    }
    //5桁
    k=n-(amatu*10000+asent);
    if (k>=0){
      ans+=min(k/10+1,1000);
    }
    
    //6桁
    k=n-(amatu*100000+asent);
    if (k>=0){
      ans+=min(k/10+1,10000);
    }
    
  }

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

Measured memory_bytes: 256
// Problem : E - Payment
// Contest : AtCoder - AtCoder Beginner Contest 155
// URL : https://atcoder.jp/contests/abc155/tasks/abc155_e
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

//Macros

#define ll long long
#define db long double
#define pb push_back
#define eb emplace_back
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define mi map<int,int>
#define mii map<pii,int>
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define sz(x) (int)x.size()
#define mod 1000000007
#define EPS 1e-9
#define io ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define inf 1e12
#define PI acos(-1.0)
#define int long long
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define N 1000005

//Solution

int dp[N][2];
string s;

int f(int i, int t){
    if(i == sz(s)) return 0;
    int &ret = dp[i][t];
    if(~ret) return ret;
    ret = inf;
    int x = s[i]-'0';
    if(t){
        if(i < sz(s)-1) x = 9-x;
        else x = 10-x;
        ret = min(ret,f(i+1,1)+x);
        ret = min(ret,f(i+1,0)+x+1);
    } else {
        ret = min(ret,f(i+1,0)+x);
        ret = min(ret,f(i+1,1)+x+1);
    }
    return ret;
}

void solve(){
    cin>>s;
    memset(dp,-1,sizeof(dp));
    while(s.back() == '0') s.pop_back();
    s.insert(s.begin(),'0');
    cout<<f(0,0)<<endl;
}

signed main(){
    io;
    //freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
    int tests;
    //cin>>tests;
    tests = 1;
    while(tests--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 66772
import java.util.*;
import java.io.*;

class Main{
    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String s;
        int num = 0;
        while((s=br.readLine())!=null){
            String[] str = s.split(" ");
            if(!(Integer.parseInt(str[0])>=0 && Integer.parseInt(str[0])<=1000000)){
                if(Integer.parseInt(str[1])>=0 && Integer.parseInt(str[1])<=1000000){
                    continue;
                }
            }
            num = Integer.parseInt(str[0]) + Integer.parseInt(str[1]);
            //System.out.println(str[0]+"\t"+str[1] + "\t"+num);
            int a = String.valueOf(num).length();
            System.out.println(a);
        }
        
        
    }
}

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

int main() {
    cin.tie(0)->sync_with_stdio(false);

    int t;
    cin >> t;

    while (t--) {
        int n; cin >> n;
        vector<ll> a(n); REP(i, n) cin >> a[i];
        string s; cin >> s;

        int ans = 0;
        vector<ll> dp;
        // 最終的な結果から逆算して行って，
        // 現在の要素が最終的な結果を0にすることが可能な要素かどうかを確認していく
        for (int i = n; i--;) {
            // 後ろから見て行った要素が
            // 最終的な結果を0にできる要素群に含まれるかを確認する．
            // 排他的論理和が0なら含まれているし，
            // 0以外なら含まれていないことになる．
            for (ll j : dp) a[i] = min(a[i], a[i]^j);
            if (a[i]) {
                // 排他的論理和は同じものを掛けると消せるので
                // 最終的には0の状態にしたいので，
                // s[i]が0の時の要素が，最終的な結果を0の状態にできる要素になる．
                if (s[i] == '0') dp.push_back(a[i]);
                else {
                    ans = 1;
                    break ;
                }
            }
        }
        cout << ans << '\n';
    }
    return 0;
}

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

int main() {
	string s;cin >> s;
	int cnt =0;
	for(int i=0;i<s.size()/2;++i){
		auto s1 = s.substr(i,1);
		auto s2 = s.substr(s.size()-i-1,1);
		if(s1!=s2)++cnt;
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
  char str[100];
  scanf("%s",str);
  int l=strlen(str),i,cnt=0;
  for(i=0;i<l/2;i++){
    if(str[i]!=str[l-(1+i)]){
      cnt++;
    }
  }
  printf("%d",cnt);
  return 0;
}


Measured memory_bytes: 128
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))

s=input()
t=input()

a=0
for i in range(len(s)):
    if s[i]!=t[i]:
        a+=1
print(a)

Measured memory_bytes: 9472
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
const vector<int> dx = { 1, 0, -1, 0 };
const vector<int> dy = { 0, 1, 0, -1 };
const string ds = "RULD";
int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	int N;
	cin >> N;
	vector<int> X(N), Y(N); vector<char> D(N);
	for (int i = 0; i < N; ++i) {
		string tmp;
		cin >> X[i] >> Y[i] >> tmp;
		D[i] = tmp[0];
	}
	vector<int> xl(4, -1), xr(4, -1), yl(4, -1), yr(4, -1);
	for (int i = 0; i < N; ++i) {
		int dir = ds.find(D[i]);
		if (xl[dir] == -1 || X[xl[dir]] > X[i]) {
			xl[dir] = i;
		}
		if (xr[dir] == -1 || X[xr[dir]] < X[i]) {
			xr[dir] = i;
		}
		if (yl[dir] == -1 || Y[yl[dir]] > Y[i]) {
			yl[dir] = i;
		}
		if (yr[dir] == -1 || Y[yr[dir]] < Y[i]) {
			yr[dir] = i;
		}
	}
	vector<int> sel;
	sel.insert(sel.begin(), xl.begin(), xl.end());
	sel.insert(sel.begin(), xr.begin(), xr.end());
	sel.insert(sel.begin(), yl.begin(), yl.end());
	sel.insert(sel.begin(), yr.begin(), yr.end());
	sort(sel.begin(), sel.end());
	sel.erase(unique(sel.begin(), sel.end()), sel.end());
	if (sel[0] == -1) sel.erase(sel.begin());
	vector<int> xs, ys;
	for (int i : sel) {
		xs.push_back(X[i]);
		xs.push_back(X[i]);
		ys.push_back(Y[i]);
		ys.push_back(Y[i]);
	}
	vector<double> T = { 0.0, 1.0e+9 };
	for (int i = 0; i < sel.size(); ++i) {
		for (int j = 0; j < i; ++j) {
			int xd = abs(X[sel[i]] - X[sel[j]]);
			int yd = abs(Y[sel[i]] - Y[sel[j]]);
			T.push_back(xd / 2.0);
			T.push_back(xd);
			T.push_back(yd / 2.0);
			T.push_back(yd);
		}
	}
	sort(T.begin(), T.end());
	T.erase(unique(T.begin(), T.end()), T.end());
	vector<double> xlen(T.size()), ylen(T.size());
	for (int i = 0; i < int(T.size()); ++i) {
		double txl = 1.0e+10, txr = -1.0e+10, tyl = 1.0e+10, tyr = -1.0e+10;
		for (int j : sel) {
			int dir = ds.find(D[j]);
			double cx = X[j] + dx[dir] * T[i];
			double cy = Y[j] + dy[dir] * T[i];
			txl = min(txl, cx);
			txr = max(txr, cx);
			tyl = min(tyl, cy);
			tyr = max(tyr, cy);
		}
		xlen[i] = txr - txl;
		ylen[i] = tyr - tyl;
	}
	double ans = 1.0e+20;
	for (int i = 0; i < T.size(); ++i) {
		ans = min(ans, xlen[i] * ylen[i]);
	}
	for (int i = 0; i < int(T.size()) - 1; ++i) {
		double td = T[i + 1] - T[i];
		double slopex = (xlen[i + 1] - xlen[i]) / td;
		double slopey = (ylen[i + 1] - ylen[i]) / td;
		double interx = xlen[i] - slopex * T[i];
		double intery = ylen[i] - slopey * T[i];
		// minimize (interx - slopex * t) * (intery - slopey * t) = slopex * slopey * t^2 - (interx * slopey + intery * slopex) * t + interx * intery
		double vertext = (interx * slopey + intery * slopex) / (2 * slopex * slopey);
		if (T[i] < vertext && vertext < T[i + 1]) {
			double nxlen = xlen[i] - slopex * (vertext - T[i]);
			double nylen = ylen[i] - slopey * (vertext - T[i]);
			ans = min(ans, nxlen * nylen);
		}
	}
	cout.precision(15);
	cout << fixed << ans << endl;
	return 0;
}

Measured memory_bytes: 1152
/*   _/                _/                 _/_/_/   _/
  _/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
   _/     _/    _/   _/     _/    _/  _/_/_/     _/
  _/     _/    _/   _/     _/    _/  _/    _/   _/
   _/_/   _/_/       _/_/   _/_/      _/_/     _/ */
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
using ll=long long;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=2e9;
const ll INF=1e18;
using P=pair<int,int>;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  int cnt=0,q,t,f;
  char c;
  cin >> q;
  deque<char> dq;
  for(auto p:s) {
    dq.push_back(p);
  }
  while(q--) {
    cin >> t;
    if(t==1) {
      cnt++;
    }
    else {
      cin >> f >> c;
      if(f==1) {
        if(cnt%2) {
          dq.push_back(c);
        }
        else {
          dq.push_front(c);
        }
      }
      else {
        if(cnt%2) {
          dq.push_front(c);
        }
        else {
          dq.push_back(c);
        }
      }
    }
  }
  if(cnt%2) {
    reverse(dq.begin(),dq.end());
  }
  for(auto p:dq) {
    cout << p;
  }
  cout << "\n";
}

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

int main() {
  int n;
  cin>>n;
  int a[n];
  for (int i=0; i<n; i++) cin>>a[i];
  long long x = 0;
  for (int i=0; i<n; i++) {
    x = x ^ a[i];
  }
  for (int i=0; i<n; i++) {
    cout<<(x ^ a[i]);
    if (i != n - 1) {
      cout<<" ";
    }
  }
  cout<<endl;
}

Measured memory_bytes: 4364
//24
#include<iostream>

using namespace std;

int main(){
  for(int n;cin>>n,n;){
    char t[128]={};
    while(n--){
      char a,b;
      cin>>a>>b;
      t[a]=b;
    }
    int m;
    cin>>m;
    while(m--){
      char c;
      cin>>c;
      cout<<((t[c])?t[c]:c);
    }
    cout<<endl;
  }
  return 0;
}

Measured memory_bytes: 852
#include <iostream>
using namespace std;
int main(void){
   int N,M;
   cin >> N >> M;
   int h[N][M+1];
   int count[M+1];
   int i,j,l;
   int ko;
   int ans =0;
   l=1;
   for(int k=0;k<M+1;k++)
   {
       count[k] = 0;
   }
   for(i=0;i<N;i++)
   {
       cin >> h[i][0];
       ko = h[i][0];
       for(j=1;j<=ko;j++)
       {
           cin >>h[i][j];
           l=1;
           while(1)
           {
               if(h[i][j]==l)
               {
                   count[l]++;
               
                   break;
               }
               l ++;
           }
       }
   }
   if(N==1)
   {
       cout << ko <<endl;
   }
   else
   { 
   for(l=1;l<=M;l++)
   {
       if(count[l] == N)
       {
           ans++;
       }
   }
   cout << ans << endl;
   }
   return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//using namespace atcoder;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) { cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl; }
#define mdebug(m) { cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;} }
#define pb push_back
#define fi first
#define se second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p){ cout << '(' << p.first << ',' << p.second << ')'; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void chOut(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using v_bool = vector<bool>;
using v_Pii = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;

struct UnionFind
{
    vector<int> par, sz;
    int n_cc;

    UnionFind(int N){
        par = vector<int>(N);
        REP(i, N) par[i] = i;
        sz = vector<int>(N, 1);
        n_cc = N;
    }

    int find(int x){
        if(par[x] == x) return x;
        else return par[x] = find(par[x]);
    }

    void unite(int x, int y){
        x = find(x);
        y = find(y);
        if(x == y) return;

        if(sz[x] < sz[y]) swap(x, y);

        par[y] = x;
        sz[x] += sz[y];
        n_cc--;
    }

    bool is_union(int x, int y){
        x = find(x);
        y = find(y);
        return x == y;
    }

    int union_size(int x){
        return sz[find(x)];
    }

};


signed main(){

    int N, M; cin >> N >> M;
    UnionFind UF(N);
    REP(i, M){
        int a, b; cin >> a >> b;
        UF.unite(a - 1, b - 1);
    }
    Out(UF.n_cc - 1);

    return 0;
}


Measured memory_bytes: 4764
//#define _CRT_SECURE_NO_WARNINGS
//             بسم الثالوث الاقدس

#include<iostream>	
#include<algorithm>
#include<cstdio>
#include<sstream>
#include<cmath>
#include<climits>
#include<string>
#include<iomanip>
#include<vector>
#include<stack>
#include<map>
#include<queue>
#include<deque>
#include<set>
#include<fstream>
#include<bitset>
#include <cstring>
using namespace std;
const double EPS = 1e-8;
//jesus help me.......
void fast()
{
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL); cout.tie(NULL);
}
///////////////////////////////////////////////////////////////		
///////////////////////////////////////////////////////////
bool sortby(const pair<int, int>&a, const pair<int, int>&b)
{
	if (a.first >= b.first&&a.second >= b.second)
		return true;
	return false;
}
///////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////
int w[27];
int main()
{
	fast();
	//freopen("keys.in", "r", stdin);
	string s;
	int n;
	cin >> n;
	cin >> s;
	int i = 0,j=1;
	int sum = 0;
	while (j < n)
	{
		int m = 0;
		memset(w, 0, sizeof(w));
		for (int g = 0;g <= i;g++)
		{
			if (w[s[g] - 'a'] == 0)
			{
				w[s[g] - 'a'] = 1;
				for (int h = j;h < n;h++)
				{
					if (s[h] == s[g])
					{
						m++;
						break;
					}
				}
			}
		}
		sum = max(sum, m);
		i++;j++;
	}
	cout << sum << endl;
	//system("pause");
	return 0;
}

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

#define int long long 

const int N = 1e5+10;
const int mod = 1e9 + 7;

signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int a,b,c;
	cin >> a >> b >> c;
	a = a-b;
	if(a >= c) cout << 0;
	else cout << c-a;
}



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

int main() {
  char c;
  cin >> c;
  
  if(c == 'a' ){
  cout << "vowel" << endl;
  }
  else if(c == 'i' ){
  cout << "vowel" << endl;
  }
  else if(c == 'u' ){
  cout << "vowel" << endl;
  }
  else if(c == 'e' ){
  cout << "vowel" << endl;
  }
  else if(c == 'o' ){
  cout << "vowel" << endl;
  }
  
  else{
  cout << "consonant" << endl;
  }
}

Measured memory_bytes: 256
#ifdef __GNUC__
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#endif

#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <cmath>

#include <string>
#include <cstring>
#include <vector>
#include <valarray>
//#include <array>//x C++ (G++ 4.6.4)

#include <queue>
#include <complex>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <cassert>//assert();
#include <fstream>
#include <random>
/////////
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)

/////////
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
#define PII pair<int,int>
/////////
using namespace::std;

// 最大公約数
template<class T>
inline T gcd(T a, T b){return b ? gcd(b, a % b) : a;}
//inline T gcd(T a, T b){return b == 0 ? a : gcd(b, a % b);}
/*inline T gcd(T a,T b){
	while(b != 0 ){
		a = a % b;
		swap(a,b);
	}
	return a;
}*/

// 最小公倍数
template<class T>
inline T lcm(T a, T b){return a / gcd(a, b) * b;}
//inline T lcm(T a, T b){return a * b / gcd(a, b);}
////////////////////////////////

LL mod = 1000000007;

inline void solve(){
	LL S,C;
	cin >> S >> C;
	LL SCC = min(S,C/2);
	LL ans = 0;
	S -= SCC;
	C -= SCC*2;
	ans += SCC;
	if( S==0){
		ans += C/4;
	}
	cout << ans << endl;
}

signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	//std::cout << std::fixed;//小数を10進数表示
	//cout << setprecision(16);//小数点以下の桁数を指定
	
	solve();
}


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

using namespace std;

vector<string> split(const string& s, char c) {
    vector<string> v; stringstream ss(s); string x;
    while (getline(ss, x, c)) v.emplace_back(x); return move(v);
}
template<typename T, typename... Args>
inline string arrStr(T arr, int n) {
    stringstream s; s << "[";
    for(int i = 0; i < n - 1; i++) s << arr[i] << ",";
    s << arr[n - 1] << "]";
    return s.str();
}

#define ANTHRO(args...) {__anthro_begin(__LINE__); __anthro(split(#args, ',').begin(), args);}

inline void __anthro_begin(int line) { cerr << "#" << line << ": "; }
template<typename T> inline void __anthro_out_var(vector<T> val) { cerr << arrStr(val, val.size()); }
template<typename T> inline void __anthro_out_var(T* val) { cerr << arrStr(val,2); } //Change the values in case you want to debug something
template<typename T> inline void __anthro_out_var(T val) { cerr << val; }
inline void __anthro(vector<string>::iterator it) { cerr << endl; }

template<typename T, typename... Args>
inline void __anthro(vector<string>::iterator it, T a, Args... args) {
    cerr << it->substr((*it)[0] == ' ', it->length()) << "=";
    __anthro_out_var(a);
    cerr << "; ";
    __anthro(++it, args...);
}
//Simple Debugger

#define ll long long
#define MOD 1000000007
#define EPS 1e-9
int const INF = (int)1e9 + 1e3;
ll const INFL = (ll)1e18 + 1e6;
/*
    This is D-Knapsack1 from AtcoderJP
*/

int main(){
    ll N,W; cin>>N>>W;
    //This is a 0-1 Knapsack
    vector<ll> v(N),w(N);
    for(ll i=0;i<N;i++){
        cin>>w[i]>>v[i];
    }
    vector<vector<ll>> dp(N+1,vector<ll> (W+1,-INF));
    dp[0][0]=0;
    for(ll i=1;i<=N;i++){
        for(ll j=0;j<=W;j++){
            dp[i][j]=dp[i-1][j];
            //ANTHRO(j-w[i-1]);
            if((j-w[i-1])>=0){
                //ANTHRO(i,j);
                dp[i][j]=max(dp[i][j],dp[i-1][j-w[i-1]]+v[i-1]);
            }
        }
    }
    ll an=-INF;
    for(ll i=0;i<=W;i++){
        an=max(an,dp[N][i]);
    }
    //ANTHRO(dp[N-1]);
    cout<<an;
    return 0;
}


Measured memory_bytes: 80256
#include <bits/stdc++.h>
#define in(n)  int n; cin>>n;
#define loop for(int i=0;i<n;i++)
#define pb push_back
#define pf push_front
#define ll long long int
using namespace std;
int  main()
{
int n;
cin>>n;
ll ar[n];
loop
cin>>ar[i];
int m4=0;
int m2=0;
int m1=0;
loop{
if((ar[i]%4==0))
	m4+=2;
else if(ar[i]%2==0 )
	m4++;
}
if(((n/2)*2)<=m4)
	puts("Yes");
else
	puts("No");
}	

	


Measured memory_bytes: 1024
// ABC158D - String Formation

#include <bits/stdc++.h>
using namespace std;

int main() {
	string S;
	cin >> S;

	int Q;
	cin >> Q;

	int reverse_no = 0;
	string head = "", tail = "";

	int temp_reverse = 0;
	bool isFirst = true;
	for (int i = 0; i < Q; i++) {
		int op1;
		cin >> op1;
		if (op1 == 1) {
			reverse_no++;
			temp_reverse++;
		} else if (op1 == 2) {
			int op2;
			string C;
			cin >> op2 >> C;

			if (isFirst) {
				isFirst = false;
				if (op2 == 1) {
					head = C + head;
				} else if (op2 == 2) {
					tail = tail + C;
				}
				temp_reverse = 0;
			} else {
				if (op2 == 1) {
					if (temp_reverse % 2 == 0) {
						head = C + head;
					} else {
						tail = tail + C;
					}
				} else if (op2 == 2) {
					if (temp_reverse % 2 == 0) {
						tail = tail + C;
					} else {
						head = C + head;
					}
				}
			}
		}
	}

	if (reverse_no % 2 == 1) {
		reverse(S.begin(), S.end());
	}
	if (temp_reverse % 2 == 1) {
		swap(head, tail);
		reverse(head.begin(), head.end());
		reverse(tail.begin(), tail.end());
	}

	cout << head + S + tail << endl;
}


Measured memory_bytes: 1544
from functools import reduce
from fractions import gcd
def lcm(x,y):return x*y//gcd(x,y)
def lcmm(l):return reduce(lcm,l)
n=int(input())
tlis=[]
for i in range(n):
	t=int(input())
	tlis.append(t)
print(lcmm(tlis))


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

using namespace std;

typedef long long ll;

mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());

const int N = 87;

int a[N][N], b[N][N];
int dp[N][N][3 * N * N];

int main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
#endif
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cin >> a[i][j];
        }
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cin >> b[i][j];
        }
    }
    dp[0][0][a[0][0] - b[0][0] + N * N] = true;
    dp[0][0][b[0][0] - a[0][0] + N * N] = true;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if (i == 0 && j == 0) {
                continue;
            }
            for (int v = 0; v < 3 * N * N; v++) {
                int tx = a[i][j] - b[i][j];
                int ty = b[i][j] - a[i][j];
                int upd_x = v - tx;
                int upd_y = v - ty;
                if (upd_x >= 0 && upd_x < 3 * N * N) {
                    if (i > 0) {
                        dp[i][j][v] |= dp[i - 1][j][upd_x];
                    }
                    if (j > 0) {
                        dp[i][j][v] |= dp[i][j - 1][upd_x];
                    }
                }
                if (upd_y >= 0 && upd_y < 3 * N * N) {
                    if (i > 0) {
                        dp[i][j][v] |= dp[i - 1][j][upd_y];
                    }
                    if (j > 0) {
                        dp[i][j][v] |= dp[i][j - 1][upd_y];
                    }
                }
            }
        }
    }
    int ans = N * N * N;
    for (int v = 0; v < 3 * N * N; v++) {
        if (dp[n - 1][m - 1][v]) {
            ans = min(ans, abs(v - N * N));
        }
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 618752
#include <bits/stdc++.h>
using namespace std;
long long int k=1000000007;
long long int f(long long int n,long long int b)
{   long long int x=1,y=1,i;
    // printf("x=%lld  y=%lld  %lld %lld\n",x,y,n,b);

    //for(i=n;i>n-b;i--)x=(x%k)*(i%k)%k,printf("%lld %lld\n",x,i);
   // for(i=1;i<=b;i++)y=(y%k)*(i%k)%k;
    //printf("x=%lld  y=%lld\n",x,y);
   if(n==b)return 1;
   if(b==0)return 1;
    return  f(n-1,b-1)%k+f(n-1,b)%k;



}
long long int solve(long long int b,long long int p)
{   if(p==0)return 1;
    if(p==1)return b;
    long long ans=solve(b,p/2)%k;
    long long ansl=(ans%k*ans%k)%k;
    if(p%2!=0)ansl=(ansl%k*b%k)%k;
    ansl=ansl%k;
    return ansl;
}
int inv(int a)
{  return a==1?1:(long long)(k-k/a)*inv(k%a)%k;

}
long long int ff(long long int n,long long int m)
{     if(m<0)return 0;
      if(n<m)return 0;
      if(m>n-m)m=n-m;
      long long int up=1,down=1,i;
      for(i=0;i<m;i++)
      {  up=up*(n-i)%k;
         down=down*(i+1)%k;
      }
      return up*inv(down)%k;


}
int main()
{  long long int n,a,b;
  scanf("%lld %lld %lld",&n,&a,&b);
  a=min(a,n-a);
  b=min(b,n-b);

  //printf("%lld\n",solve(2,n)-1);
  printf("%lld",(solve(2,n)-1-ff(n,a)-ff(n,b)+2*k)%k);


}


Measured memory_bytes: 256
# include"stdio.h"

int main(){
    int w,h,n;
    scanf("%d %d %d",&w,&h,&n);
    int x[n],y[n],a[n],f[w][h];
    for(int i=0;i<n;i++)
        scanf("%d %d %d",&x[i],&y[i],&a[i]);
    for(int i=0;i<w;i++)
        for(int j=0;j<h;j++)
            f[i][j]=1;
    for(int i=0;i<n;i++){
        if(a[i]==1)
            for(int j=x[i]-1;j>=0;j--)
                for(int k=0;k<h;k++)
                    f[j][k]=0;
        if(a[i]==2)
            for(int j=x[i];j<w;j++)
                for(int k=0;k<h;k++)
                    f[j][k]=0;
        if(a[i]==3)
            for(int j=y[i]-1;j>=0;j--)
                for(int k=0;k<w;k++)
                    f[k][j]=0;
        if(a[i]==4)
            for(int j=y[i];j<h;j++)
                for(int k=0;k<w;k++)
                    f[k][j]=0;
    }
    int ans=0;
    for(int i=0;i<w;i++)
        for(int j=0;j<h;j++)
            if(f[i][j]) ans++;
    printf("%d\n",ans);

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repo(i, n) for(int i=1; i<=n; i++)
#define ssort(a) sort(a.begin(), a.end())
#define INF 1001001001
#define INFll 100100100100100
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << endl;

using namespace std;
using ull = unsigned long long;
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;

int main(){
  string s;
  cin >> s;
  int n=s.size();
  if(s[n-1]=='s'){
    s+="es";
  } else {
    s+="s";
  }
  cout << s << endl;
  return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define ALL(a) (a).begin(), (a).end()
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
const ll mod = 1e9 + 7;

int main()
{
    int n, ans = INT_MAX;
    cin >> n;
    for (int i = 1; i < n; i++)
    {
        int a = i, b = n - i;
        {
            int cnt = 0;
            while (a > 0)
            {
                cnt += a % 10;
                a /= 10;
            }
            while (b > 0)
            {
                cnt += b % 10;
                b /= 10;
            }
            ans = min(ans, cnt);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256