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

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<(o)<<" ";}
#define dumpl(o) if(DBG){cerr<<#o<<" "<<(o)<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }

//0??????
void fill(string& s, int length, char c = '0') {
	string prefix = "";
	for (int i = s.size(); i < length; i++)prefix += c;
	s = prefix + s;
}

int table[10][10];
char e(string &s) {
	int ret = 0;
	rep(i, 0, 4) {
		ret = table[ret][s[i] - '0'];
	}
	return (char)(ret + '0');
}

int check(string &s) {
	string abcd = s.substr(0, 4);
	return table[e(abcd) - '0'][s[4] - '0'];
}

signed main() {
	rep(i, 0, 10)rep(j, 0, 10)cin >> table[i][j];
	int ans = 0;
	rep(x, 0, 10000) {
		string abcd = to_string(x);
		fill(abcd, 4);
		string abcde = abcd + e(abcd);
		bool flag = false;
		rep(i, 0, 5) {
			rep(c, 0, 10) {
				if (c == abcde[i] - '0')continue;
				string tmp = abcde;
				tmp[i] = c + '0';
				if (check(tmp) == 0) {
					flag = true;
					i = INF;
					break;
				}
			}
		}
		if (flag) {
			ans++;
			continue;
		}
		rep(i, 1, 5) {
			string tmp = abcde;
			swap(tmp[i], tmp[i - 1]);
			if (tmp == abcde)continue;
			if (check(tmp) == 0) {
				flag = true;
				ans++;
				break;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3224
#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
#define MOD 1000000007
#define INF 1000000011
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
using namespace std;
typedef long long ll;
 
int main(){
  int n;
  cin>>n;
  ll x[n+1];
  ll y[n+1];
  rep(i, n){
    cin>>x[i+1]>>y[i+1];}
  
  int ans=100000;
  int val=0;
  
  if(n==1){
    cout<<1<<endl;
    return 0;}
  
  
  for(int i=1; i<=n;i++){
    for(int j=1; j<=n;j++){
      val=0;
      if(i==j){
        continue;}
      double ys[n+1];
      ll xx=x[j]-x[i];
      ll yy=y[j]-y[i];
      
      for(int k=1;k<=n;k++){
        ll xa=x[k]-xx;
        ll ya=y[k]-yy;
        for(int l=1;l<=n;l++){
          if(xa==x[l]&&ya==y[l]){
            val++;
            break;
            }
             }
      }
       
      ans=min(ans, n-val);
    }
  }
  
  
cout<<ans<<endl;
  return 0;
 
}

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

using ll = long long;

using namespace std;

using P = pair<int, int>;
#define fi first
#define se second


P check_lr(string &s) {
    int n = s.size();
    P ans;
    int left = 0, right = 0;
    for (int i=0; i<n; i++) {
        if (s[i] == '(') left++;
        if (s[i] == ')' && right < left) right++;
    }
    ans.se = left - right;
    left = 0, right = 0;
    for (int i=n-1; i>=0; i--) {
        if (s[i] == ')') right++;
        if (s[i] == '(' && left < right) left++;
    }
    ans.fi = right - left;
    return ans;
}

struct retu {
    int l, r, i;
};

#define INF 10000000

int main() {
    int n;
    cin >> n;
    vector<P> lrs;
    P left_edge = {0, 0}, right_edge = {0, 0};
    int dif = 0, complete = 0;
    for (int i=0; i<n; i++) {
        string s; cin >> s;
        P lr = check_lr(s);
        lrs.push_back(lr);
    }
    sort(lrs.begin(), lrs.end(), [](P a, P b) {
        if (a.fi - a.se >= 0 && b.fi - b.se < 0) return false;
        else if (a.fi - a.se < 0 && b.fi - b.se >= 0) return true;
        else if (a.fi - a.se < 0 && b.fi - b.se < 0) {
            return a.fi < b.fi;
        } else {
            return a.se > b.se;
        }
    });
    int match = 0;
    for (auto &lri:lrs) {
        if  (match < lri.fi) {
            cout << "No" << '\n';
            return 0;
        }
        match -= lri.fi;
        match += lri.se;
    }
    cout << (match == 0 ? "Yes" : "No") << '\n';
    return 0;
}

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

struct Edge {
    int from, to;
    long long cost;
};

const long long INF = 10000000000000;

int main() {
    int N, M;
    cin >> N >> M;
    vector<Edge> E(M);
    for (int i = 0; i < M; i++) {
        int a, b, c;
        cin >> a >> b >> c;
        a--; b--; c = -c;
        E[i] = Edge{a, b, c};
    }

    vector<long long> dist(N, INF);
    dist[0] = 0;

    for (int i = 0; i < N - 1; i++) {
        for (int j = 0; j < M; j++) {
            Edge e = E[j];
            if (dist[e.from] == INF) continue;

            if (dist[e.to] > dist[e.from] + e.cost) {
                dist[e.to] = dist[e.from] + e.cost;
            }
        }
    }

    long long res = dist[N - 1];

    vector<bool> negative(N, false);
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < M; j++) {
            Edge e = E[j];
            if (dist[e.from] == INF) continue;

            if (dist[e.to] > dist[e.from] + e.cost) {
                dist[e.to] = dist[e.from] + e.cost;
                negative[e.to] = true;
            }
            if (negative[e.from]) {
                negative[e.to] = true;
            }
        }
    }

    if (negative[N - 1])
        cout << "inf" << endl;
    else
        cout << -res << endl;
    return 0;
}

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

using namespace std;

int main() {
  int n, d;
  cin >> n >> d;
  vector<int> x(n*d);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < d; j++) {
      cin >> x.at(i*d + j);
    }
  }

  int result = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      int sum = 0;
      for (int k = 0; k < d; k++) {
        int distance = abs(x.at(i*d + k) - x.at(j*d + k));
        sum += distance * distance;
      }
      if (fmod(sqrt(sum), 1) == 0) {
        result++;
      }
    }
  }

  cout << result << endl;
  return 0;
}


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

struct bellford
{
    const long long INF=LLONG_MAX;
    struct edge{int u, v; ll w;};
    int nv, ne;
    vector<int> p;
    vector<ll>  d;
    vector<edge> E;

    bellford(int nv, int ne) :  nv(nv), ne(ne)
    {
        p.resize(nv, -1);
        d.resize(nv, INF);
    }

    void relax(int u, int v, ll w)
    {
        if(d[u]!=INF && d[v]>d[u]+w) d[v]=d[u]+w, p[v]=u;
    }

    bool get(int s)
    {
        d[s]=0;
        for(int i=0; i<nv-1; i++)
            for(auto  &e : E) relax(e.u, e.v, e.w);
        for(auto &e : E)
            if(d[e.v]>d[e.u]+e.w)
                return false;
        return true;
    }

    bool get(int s, int t)
    {
        d[s]=0;
        for(int i=0; i<nv; i++)
            for(auto  &e : E) 
                relax(e.u, e.v, e.w);

        vector<bool> visited(nv, false);
        visited[t]=true, t=p[t];
        while(t!=-1 && !visited[t])
        {
            visited[t]=true;
            t=p[t];
        }
        if(t==-1) return true;
        else return false;
    }
};

int main()
{
    int N, M;
    scanf("%d%d", &N, &M);
    bellford g(N, M);
    for(int i=0; i<M; i++)
    {
        int a, b, c;
        scanf("%d%d%d", &a, &b, &c);
        g.E.push_back({a-1,b-1,-c});
    }
    if(g.get(0, N-1))
        printf("%lld\n", -g.d[N-1]);
    else
        printf("inf\n");
    return 0;
}

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

#define ln '\n'
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, a, b) for(int i = (a); i <= (int)(b); ++i)
#define FORR(i, a, b) for(int i = (a); i >= (int)(b); --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
typedef vector<P> VP;
typedef vector<PL> VPL;
typedef vector<string> VS;


class UnionFind {
private:
    VI par;

public:
    UnionFind(int num_of_v) {
        REP(i, num_of_v) par.push_back(i);
    }

    int root(int x) {
        if(par[x] == x) return x;
        else return par[x] = this->root(par[x]);
    }

    void unite(int x, int y) {
        x = root(x);
        y = root(y);
        if(x == y) return;
        par[x] = y;
    }

    bool same(int x, int y) {
        return root(x) == root(y);
    }
};

ll comb2(ll n) {
    return n * (n - 1) / 2;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, m;
    cin >> n >> m;
    VI a(m), b(m);
    REP(i, m) {
        cin >> a[i] >> b[i];
        a[i]--;
        b[i]--;
    }

    UnionFind uf(n);
    VL graph_cnt(n, 1);
    VL ans(m);
    ans[m - 1] = comb2(n);
    FORR(i, m - 1, 1) {
        if(!uf.same(a[i], b[i])) {
            ans[i - 1] = ans[i] - graph_cnt[uf.root(a[i])] * graph_cnt[uf.root(b[i])];
            ll cnt = graph_cnt[uf.root(a[i])] + graph_cnt[uf.root(b[i])];
            uf.unite(a[i], b[i]);
            graph_cnt[uf.root(a[i])] = cnt;
            graph_cnt[uf.root(b[i])] = cnt;
        } else {
            ans[i - 1] = ans[i];
        }
    }

    REP(i, m) cout << ans[i] << ln;
    return 0;
}


Measured memory_bytes: 4216
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e9+7;
signed main() {
    int N,M;
    cin >> N >> M;
    vector<vector<int>>AB(M+1);
    priority_queue<int, vector<int>, less<int>> que;
    for(int i = 0; i < N; i++) {
        int A,B;
        cin >> A >> B;
        if(A > M) {
            continue;
        }
        AB[A-1].push_back(B);
    }
    int ans = 0;
    for(int i = 0; i < M; i++) {
        for(int j = 0; j < AB[i].size(); j++) {
            que.push(AB[i][j]);
        }
        if(que.empty()) {
            continue;
        }
        ans+=que.top();
        que.pop();
    }
    cout << ans << endl;
}

Measured memory_bytes: 5632
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
using namespace std;

typedef long long ll;
typedef double db;
typedef long double ldb;

template<class T> inline void checkmin(T &a,const T &b){if(b<a) a=b;}
template<class T> inline void checkmax(T &a,const T &b){if(b>a) a=b;}

const int inf=1e9+10;
const int maxn=5e5+10;
const int maxv=1<<22;
const int mod=1e9+7;

int a[maxn],n,b[maxn];
vector <int> v;
vector <int> g[maxv];
int dp[maxn];

void add(int &x,int y){
	if(x+y>=mod) x=x+y-mod;
	else x=x+y;
}

int main(){
//	freopen("b.in","r",stdin);
//	freopen("b.out","w",stdout);
//	cout<<maxv<<endl;
	scanf("%d",&n);
	for(int i=0;i<n;i++) scanf("%d",&a[i]);
	if(n<=2000){
		for(int i=1;i<n;i++) a[i]=a[i-1]^a[i];
		// val>=1
		int ans=0;
		for(int val=1;val<1024;val++){
			int sum0=0,sumk=0;
			dp[0]=1; add(sumk,dp[0]);
			for(int i=0;i<n;i++){
				dp[i+1]=0;
				if(a[i]==val){
					dp[i+1]=sumk;
					add(sum0,dp[i+1]);
				}
				if(a[i]==0){
					dp[i+1]=sum0;
					add(sumk,dp[i+1]);
				}
			}	
			add(ans,dp[n]);
		//	if(ans>0) cout<<val<<" "<<ans<<endl;
		}
		// val==0
		dp[0]=1; int sum=0;
		add(sum,dp[0]);
		for(int i=0;i<n;i++){
			dp[i+1]=0;
			if(a[i]==0){
				dp[i+1]=sum;
				add(sum,dp[i+1]);
			}
		}
		add(ans,dp[n]);
		printf("%d\n",ans);
	}	
	else{
		for(int i=1;i<n;i++) a[i]=a[i-1]^a[i];
		for(int i=0;i<n;i++) if(a[i]!=0){
			if(g[a[i]].size()==0) v.pb(a[i]);
			g[a[i]].pb(i);
		}
		for(int i=0;i<n;i++) if(a[i]==0) b[i]=1;
		for(int i=1;i<n;i++) b[i]=b[i-1]+b[i];
	//	for(int i=0;i<v.size();i++) cout<<v[i]<<" "; cout<<endl;
		int ans=0;
		for(int t=0;t<v.size();t++){
			int val=v[t],sum0=0,sumk=0;
			dp[0]=1; add(sumk,dp[0]); 
			dp[n]=0;
			if(g[val][(int)g[val].size()-1]!=n-1) g[val].pb(n-1);
			for(int j=0;j<g[val].size();j++){
				int i=g[val][j];
				if(j==0){
					dp[i+1]=sumk;
					add(sum0,sumk);
				//	if(i==n-1) cout<<val<<endl;
				}
				if(j>0&&a[i]==val){
					int lsti=g[val][j-1];
					int k=b[i]-b[lsti];
					ll addv=ll(ll(ll(k)*ll(sum0))%ll(mod));
					add(sumk,addv);
					dp[i+1]=sumk;
					add(sum0,sumk);
				//	if(i==n-1) cout<<val<<endl;
				}
				if(i==n-1&&a[i]==0){
					dp[i+1]=sum0;
				//	if(i==n-1) cout<<val<<endl;
				}
			}
			add(ans,dp[n]);
		//	cout<<val<<" "<<dp[n]<<endl;
		}
		for(int i=0;i<maxn;i++) dp[i]=0;
		dp[0]=1;
		int sum=0;
		add(sum,dp[0]);
	//	cout<<a[n-1]<<endl;
		for(int i=0;i<n;i++){
			if(a[i]==0){
				dp[i+1]=sum;
				add(sum,dp[i+1]);
			}
		}
		add(ans,dp[n]);
	//	cout<<dp[n]<<endl;
		printf("%d\n",ans);
	}
	return 0;
}

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

int main() {
  string s;

  cin >> s;

  bool N = false, E = false, S = false, W = false;

  for (int i = 0; i < (int)s.size(); i++) {
    if (s.at(i) == 'N')
      N = true;
    else if (s.at(i) == 'W')
      W = true;
    else if (s.at(i) == 'S')
      S = true;
    else
      E = true;
  }

  if ((N && S && !W && !E) || (W && E && !N && !S) || (N && S && W && E))
    cout << "Yes";
  else
    cout << "No";

  return 0;
}

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

int main () {
  int H, W, h, w;
  cin >> H >> W >> h >> w;

  cout << (H*W - (h*W) - (H*w) + h*w) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    ll n;
    cin >> n;
    ll c = 0;
    for (ll t = 1; ; t *= 26) {
        if (n >= t) n -= t, c++;
        else break;
    }
    string s;
    while (c--) {
        s += (n % 26) + 'a';
        n /= 26;
    }
    reverse(s.begin(), s.end());
    cout << s << endl;
}

Measured memory_bytes: 3596
n = int(input())
a = list(map(int,input().split()))

def gcd(a,b):
    if b>a:
        a,b = b,a
    if b==0:
        return a
    else:
        return gcd(b,a%b)

ans = a[0]
for i in range(n-1):
    ans = gcd(ans,a[i+1])
print(ans)

Measured memory_bytes: 15020
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <map>
#include <chrono>
#include <random>
#include <unordered_map>
#include <cassert>
#pragma GCC optimize("O3")
#pragma comment(linker, "STACK:36777216")
using namespace std;
using i64 = int64_t;
constexpr i64 MOD = 1e9 + 7;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
using vi = vector<i64>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using ii = pair<i64, i64>;

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

long lcm(long a, long b) {
    return a / gcd(a, b) * b;
}


int main() {
    i64 n, x;
    cin >> n >> x;
    vi xs(n);
    for (int i = 0; i < n; i++) {
        cin >> xs[i];
        xs[i] -= x;
        xs[i] = abs(xs[i]);
    }
    
    i64 ans = xs[0];
    for (int i = 1; i < n; i++) {
        ans = gcd(ans, xs[i]);
    }
    
    cout << ans << endl;
}
    


Measured memory_bytes: 1024
# coding: utf-8
# Your code here!
A,B,K=map(int,input().split())

if A<=K:
    K-=A
    A=0
    if B<=K:
        print(0, end=' ')
        print(0)
    else:
        B-=K
        print(A,end=' ')
        print(B)

else:
    A-=K
    print(A,end=' ')
    print(B)


Measured memory_bytes: 2940
while True:
    H,W = map(int,input().split())
    if W == 0 and H == 0:break
    for i in range(H):
        for j in range(W):
            if i == 0 or i == H-1 or j == 0 or j == W-1:
                print("#",end="")
            else:
                print(".",end="")
        print()
    print()


Measured memory_bytes: 7004
#include <stdio.h>
#define N 25

typedef struct {
  int p, l, r, s;
}Node;

int depth(Node *,int,int);
int height(Node *,int,int,int);

int depth(Node *node,int num,int con){
  if(node[num].p==-1) return con;
  con++;
  con=depth(node,node[num].p,con);
  return con;
}

int height(Node *node,int num,int con,int max){
  if(node[num].l==-1&&node[num].r==-1){
    if(max<con) max=con;
    return max;
  }
  con++;
  if(node[num].l!=-1) max=height(node,node[num].l,con,max);
  if(node[num].r!=-1) max=height(node,node[num].r,con,max);
  con--;
  return max;
}

int main()
{
  int count,num,i,j,k,d_num,h_num;
  Node no[N];

  scanf("%d",&count);

  for(i=0;i<count;i++){
    no[i].p=-1;
  }

  for(i=0;i<count;i++){
    scanf("%d",&num);
    scanf("%d",&no[num].l);
    scanf("%d",&no[num].r);
    no[no[num].l].p=num;
    no[no[num].r].p=num;
  }

  for(i=0;i<count;i++){
    printf("node %d: parent = %d, ",i,no[i].p);
    if(no[i].p==-1) printf("sibling = -1, ");
    else if(no[no[i].p].l==-1&&no[no[i].p].r==-1) printf("sibling = -1, ");
    else if(no[no[i].p].l==i) printf("sibling = %d, ",no[no[i].p].r);
    else printf("sibling = %d, ",no[no[i].p].l);

    if(no[i].l==-1&&no[i].r==-1) printf("degree = 0, ");
    else if(no[i].l==-1||no[i].r==-1) printf("degree = 1, ");
    else printf("degree = 2, ");

    d_num=depth(no,i,0);
    h_num=height(no,i,0,0);
    
    printf("depth = %d, height = %d, ",d_num,h_num);

    if(no[i].p==-1) printf("root\n");
    else if(no[i].l==-1&&no[i].r==-1) printf("leaf\n");
    else printf("internal node\n");
  }

  return 0;
}

Measured memory_bytes: 2700
#include <iostream>

using namespace std;

int main()
{
	int D, N, a = 1;
  	cin >> D >> N;
  	for(int i = 0; i < D; i++){
      	a *= 100;
    }
  	if(N == 100){
      	cout << 101 * a;
    }else{
      	cout << N * a;
    }
  	return 0;
}

Measured memory_bytes: 256
#include<map>
#include<cmath>
#include<queue>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<fstream>
#include<iostream>
#include<algorithm>
#define re register
#define ll long long
using namespace std;
ll n,x,sum,a[200000];
int main(){
	scanf("%lld%lld",&n,&x);
	int i;
	for(i=1;i<=n;i++)scanf("%lld",&a[i]);
	while(a[1]>x){a[1]--;sum++;}
	for(i=2;i<=n;i++){
		if(a[i]+a[i-1]>x){
			sum+=(a[i]+a[i-1]-x);
			a[i]-=(a[i]+a[i-1]-x);
		}
	}
	printf("%lld",sum);
}

Measured memory_bytes: 1024
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES 
#include<iomanip> 
#include<cmath>  
#include<iostream>
#include<fstream>
#include<vector>
#include<algorithm>
#include<numeric>
#include<bitset>
#include<map>
// #include<unordered_map>
#include<set>
// #include<unordered_set>
#include<queue>
#include<deque>
#include<stack>
#include<functional>
using namespace std;
typedef long long ll;
#define repi(i,a,b) for(ll i = (ll)(a) ; i < (ll)(b) ; i++)
#define repd(i,a,b) for(ll i = (ll)(a) ; i > (ll)(b) ; i--)
#define rd(x) cin >> x
#define wr(x)  cout << x
#define wrln(x) cout << x << endl
#define wl() cout << endl
const ll MAX_10p5 = 100010;
const ll MAX_10p9 = 1000000010;
const ll MAX_10p18 = 1000000000000000010;
const ll MOD = 1000000007;
const ll m4x[4] = { 1,0,-1,0 };
const ll m4y[4] = { 0,1,0,-1 };
const ll m8x[8] = { 1,1,0,-1,-1,-1,0,1 };
const ll m8y[8] = { 0,1,1,1,0,-1,-1,-1 };
const ll m9x[9] = { 1,1,0,-1,-1,-1,0,1,0 };
const ll m9y[9] = { 0,1,1,1,0,-1,-1,-1,0 };

struct edge {
	ll from, to, cost;
	bool operator<(const edge& right) const {
		return cost < right.cost;
	}
};
struct point {
	ll x, y, idx;
	bool operator<(const point& right) const {
		return x == right.x ? y < right.y : x < right.x;
	}
};

template<typename T>
T minT(T a, T b) {
	if (a < b) return a;
	else return b;
}

template<typename T>
T maxT(T a, T b) {
	if (a > b) return a;
	else return b;
}

template<typename T>
T absT(T a) {
	if (a < 0) a *= -1;
	return a;
}

template<typename T>
T powT(T a, T x) {
	T res = 1;
	while (x > 0) {
		if (x & 1) res = res*a;
		a = a*a;
		x >>= 1;
	}
	return res;
}

ll StoLL(string str) {
	ll ret = 0, ini = 0;
	if (str[0] == '-') ini = 1;
	repi(i, ini, str.length()) {
		ret *= 10;
		ret += (ll)(str[i] - '0');
	}
	if (ini) ret *= -1;
	return ret;
}

///////////////////////////////////////////////////////////////////////////////////////


int main() {
	string s;
	ll w;
	rd(s); rd(w);

	for (int i = 0; i < s.length(); i += w) {
		cout << s[i];
	}
	cout << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define maxn 4000
#define maxm maxn+10
using namespace std;
typedef long long LL;
LL temp[maxm][maxm], C[maxm][maxm];
const LL mod = 1e9+7;
LL add(LL a, LL b) { return (a+b) % mod; }
LL mul(LL a, LL b) { return (a*b) % mod; }
void init() {
    for (int i = 0; i <= maxn; ++i) C[i][0] = 1;
    for (int i = 1; i <= maxn; ++i) {
        for (int j = 1; j <= i; ++j) C[i][j] = add(C[i-1][j], C[i-1][j-1]);
    }
    for (int i = 0; i <= maxn; ++i) {
        temp[i][0] = C[i][0];
        for (int j = 1; j <= maxn; ++j) {
            temp[i][j] = add(temp[i][j-1], C[i][j]);
        }
    }
    for (int i = 0; i <= maxn; ++i) {
        for (int j = 1; j <= maxn; ++j) temp[i][j] = add(temp[i][j], temp[i][j-1]);
    }
}
int main() {
//    freopen("in.txt", "r", stdin);
    init();
    int a, b;
    LL ans = 0;
    scanf("%d%d", &a, &b);
    for (int p = 0; p <= a; ++p) {
        for (int q = 0; q <= b-1; ++q) {
            if (p+q > a) continue;
            if (q == 0) ans = add(ans, 1);
            else ans = add(ans, mul(C[b-1][q], temp[q-1][p]));
        }
    }
    printf("%lld\n", ans);
    return 0;
}


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

using uli = unsigned long int;

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define repa(a,i,x) for(int i=a;i<=x;i++)

int main(){
	int X,Y,Z;
	cin >> X >> Y >> Z;
	
	cout << Z << " " << X << " " << Y << endl;
	
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
    int a, b;
    int acc;
    int div;

    while ( 2 == scanf( "%d %d", &a, &b ) ) {
        acc = 1;
        div = 2;
        while ( ( div <= a ) && ( div <= b ) ) {
            if ( ( ( a % div ) ==0 ) && ( b % div == 0 ) ) {
                a /= div;
                b /= div;
                acc *= div;
            }
            else {
                div ++;
            }
        }

        printf( "%d %d\n", acc, acc * a * b );
    }

    return 0;
}

Measured memory_bytes: 592
import java.util.Scanner;

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

		for (int i = x; i > 0; i--) {
			for (int b = 1; b < 32; b++) {
				for (int p = 2; p < 10; p++) {
					if ((int) Math.pow(b, p) == i) {
						System.out.println(i);
						return;
					}
				}
			}
		}
	}
}


Measured memory_bytes: 21844
fun main(args: Array<String>) {
    val n = readLine()?.toInt() ?: return
    val k = readLine()?.toInt() ?: return
    val x = readLine()?.split(" ")?.map(String::toInt) ?: return
    x.sumBy {
        Math.min(it * 2, (k - it) * 2)
    }.let {
        println(it.toString())
    }
}

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

#define ll long long int
#define vi vector<int>
#define ii pair< int , int >
#define vii vector<ii>
#define FOR(i, n) for(ll i = 0; i < (ll)n; i++)
int MAX(int a, int b){return (a > b) ? a:b;}
int MIN(int a, int b){return (a < b) ? a:b;}
int ABS(int x){return (x > 0) ? x:-x;}
int left(int x){return (x<<1);}
int right(int x){return (x<<1)+1;}
int lsone(int x){return (x&(-x));}

const int maxn = 2e5 + 5;

vector<ll> ft;
vector<ii> sorta;
int n, h[maxn], a[maxn];
ll ans[maxn];

void upd(int k, ll val){
	for(; k < ft.size(); k += lsone(k)){
		ft[k] = max(ft[k], val);
	}
}
ll query(int pos){
	ll sum = 0;
	for(;pos > 0; pos -= lsone(pos)){
		sum = max(sum, ft[pos]);
	}
	return sum;
}

int main(){
	scanf("%d", &n);
	ft.assign(n+5, 0);
	for(int i = 1; i <= n; i++){
		scanf("%d", &h[i]);
		sorta.push_back(ii(h[i], i));
	}
	for(int i = 1; i <= n; i++){
		scanf("%lld", &a[i]);
	}
	sort(sorta.begin(), sorta.end());
	for(auto i : sorta){
		int idx = i.second;
		ans[idx] = a[idx];
		ans[idx] += query(idx);
		upd(idx, ans[idx]);
	}
	ll fAns = 0;
	for(int i = 1; i <= n; i++){
		fAns = max(fAns, ans[i]);
	}
	printf("%lld\n", fAns);
}

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

int main(){
    int N;
    cin >> N;
    vector<char> s(N);
    for(int i=0; i<N; i++) cin >> s[i];
    
    sort(s.begin(), s.end());
    s.erase(unique(s.begin(), s.end()), s.end());
    
    if(s.size()==3) cout << "Three" << endl;
    else cout << "Four" << endl;
}


Measured memory_bytes: 256
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <vector>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#define ll long long
#define ms(a,b) memset(a,b,sizeof(a))
using namespace std;

const int MAXN=1e5+100;
const int INF=0x3FFFFFFF;
const ll MOD=1e9+7;

int t[MAXN],x[MAXN],y[MAXN];

int main()
{
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>t[i]>>x[i]>>y[i];
    bool flag=1;
    for(int i=1;i<=n;i++)
    {
        if(x[i]-x[i-1]+y[i]-y[i-1]>t[i]-t[i-1]||(t[i]-t[i-1]-x[i]+x[i-1]-y[i]+y[i-1])%2!=0)
        {
            flag=0;
            break;
        }
    }
    if(flag)    cout<<"Yes"<<endl;
    else    cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 1408
#include<stdio.h>
int main(void){
	int n,run,out,score;
	char in[10];
	scanf("%d",&n);
	while(n--){
		run=out=score=0;
		while(out-3){
			scanf("%s",in);
			switch(in[1]){
			case 'I' : run++;break;
			case 'O' : score+=1+run;run=0;break;
			case 'U' : out++;break;
			}
			if(out==3)break;
		}
		if(run>3)score+=run-3;
		printf("%d\n",score);
	}
	return 0;
}

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

int main() {
    int n;
    map<int , int> h;
    scanf("%d" , &n);
    for (int i = 0 ; i < n ; ++ i) {
        int x;
        scanf("%d" , &x);
        ++ h[x];
    }
    int res = 0;
    vector<int> V;
    for (auto it : h) {
        if (it.second > 1) {
            V.push_back(it.first);
            //cout << it.first << endl;
        }
        if (it.second > 3) {
            res = max(res , it.first);
        }
    }
    sort(V.begin() , V.end());
    if (V.size() < 2 && res == 0) {
        puts("0");
    } else {
        long long w = max((long long)V[V.size() - 1] * V[V.size() - 2] , (long long)res * res);
        cout << w << endl;
    }
}


Measured memory_bytes: 4992
#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<map>
using namespace std;
int main(){  
   int array;
   cin>>array;
   int a=array/100;
   int b=array%100;

    if(0<a && a<13){
        if(0<b && b<13) cout<<"AMBIGUOUS";
        else cout<<"MMYY";
    }
    else{
        if(0<b && b<13) cout<<"YYMM";
        else cout<<"NA";
    }
    

   


    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<bitset>
#include<deque>
#include<functional>
#include<iterator>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<utility>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(ll i=(n);i>=1;i--)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
const ll MOD=1000000007;
const ll INF=1000000000000000;
template<class T> inline bool chmin(T& a, T b){if(a>b){a=b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a=b;return true;}return false;}
ll maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll digsz(ll x){if(x==0) return 1;else{ll ans=0;while(x){x/=10;ans++;}return ans;}}
ll digsum(ll x){ll sum=0;while(x){sum+=x%10;x/=10;}return sum;}
vector<ll> pw2(62,1);vector<ll> pw10(19,1);

vector<ll> vectorprime(ll x){
    vector<bool> is_prime(x+1);
    vector<ll> prime;
    rep(i,x+1) is_prime[i]=true;
    is_prime[0]=is_prime[1]=false;
    for(ll i=2;i<=x;i++){
        if(is_prime[i]){
            prime.pb(i);
        }
        for(int j=i*2;j<=x;j+=i) is_prime[j]=false;
    }
    return prime;
}
map<ll,ll> prime_factor(ll x){
    map<ll,ll> m;
    ll sq=(ll)sqrt(x) + 1;
    vector<ll> v_prime=vectorprime(sq);
    
    ll tmp=x;
    rep(i,sz(v_prime)){
        ll count=0;
        while(tmp % v_prime[i] == 0){
            tmp /= v_prime[i];
            count++;
        }
        if(count != 0) m[v_prime[i]]=count;
        if(tmp==1) break;
    }
    
    if(tmp != 1) m[tmp]=1;
    return m;
}

int main(){
    {rep1(i,61) pw2[i]=2*pw2[i-1];}
    {rep1(i,18) pw10[i]=10*pw10[i-1];}
    
    ll N,K; cin>>N>>K;
    map<ll,ll> m;
    rep(i,N){
        ll A,B; cin>>A>>B;
        m[A]+=B;
    }
    ll tmp=0;
    for(auto it=m.bg;it!=m.ed;it++){
        if(K<=tmp+it->b){
            cout<<it->a<<endl;
            return 0;
        }
        else tmp+=it->b;
    }
}



Measured memory_bytes: 7368
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = 0;
//---------------------------------//

template<int M>
struct ModInt {
public:
	using value_type = long long;
	
	ModInt(value_type val = 0) : val(val < 0 ? (M - (-val % M)) % M : val % M) {}
	
	explicit operator bool() const noexcept { return val; }
	bool operator ==(const ModInt & rhs) const noexcept { return val == rhs.val; }
	bool operator !=(const ModInt & rhs) const noexcept { return !(*this == rhs); }
	ModInt operator +() const noexcept { return ModInt(*this); }
	ModInt operator -() const noexcept { return ModInt(0) -= *this; }
	ModInt operator +(const ModInt & rhs) const noexcept { return ModInt(*this) += rhs; }
	ModInt operator -(const ModInt & rhs) const noexcept { return ModInt(*this) -= rhs; }
	ModInt operator *(const ModInt & rhs) const noexcept { return ModInt(*this) *= rhs; }
	ModInt operator /(const ModInt & rhs) const noexcept { return ModInt(*this) /= rhs; }
	
	ModInt & operator +=(const ModInt & rhs) noexcept {
		val += rhs.val;
		if (val >= M) val -= M;
		return *this;
	}
	ModInt & operator -=(const ModInt & rhs) noexcept {
		if (val < rhs.val) val += M;
		val -= rhs.val;
		return *this;
	}
	ModInt & operator *=(const ModInt & rhs) noexcept {
		val = val * rhs.val % M;
		return *this;
	}
	ModInt & operator /=(const ModInt & rhs) noexcept {
		*this *= rhs.inverse();
		return *this;
	}
	
	ModInt pow(value_type n) const {
		ModInt res = 1, x = val;
		if (n < 0) { x = x.inverse(); n = -n; }
		while (n) { if (n & 1) res *= x; x *= x; n >>= 1; }
		return res;
	}
	
	ModInt inverse() const {
		long long a = val, a1 = 1, a2 = 0, b = M, b1 = 0, b2 = 1;
		while (b > 0) {
			value_type q = a / b, r = a % b;
			value_type nb1 = a1 - q * b1, nb2 = a2 - q * b2;
			a = b; b = r;
			a1 = b1; b1 = nb1;
			a2 = b2; b2 = nb2;
		}
		assert(a == 1);
		return a1;
	}
	
	const value_type & get() const noexcept { return val; }
	static decltype(M) get_mod() noexcept { return M; }
	
	friend std::ostream & operator <<(std::ostream & os, const ModInt & rhs) { return os << rhs.val; }
	friend std::istream & operator >>(std::istream & is, ModInt & rhs) {
		value_type x;
		is >> x;
		rhs = ModInt(x);
		return is;
	}
private:
	value_type val;
};
using mint = ModInt<MOD>;


int main() {
	int N;
	cin >> N;
	vector<vector<int>> g(N);
	REP(i, N - 1)  {
		int u, v;
		scanf("%d %d", &u, &v);
		--u; --v;
		g[u].emplace_back(v);
		g[v].emplace_back(u);
	}
	ll ans = 0;
	REP(i, N) ans += (ll)(1 + N - i) * (N - i) / 2;
	REP(i, N) {
		for (int v : g[i]) {
			if (i < v) {
				ans -= (ll)(i + 1) * (N - v);
			}
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 15096
#include <stdio.h>

int n, A[50];

// 入力値のMから選んだ要素を引いていく再帰関数
int solve(int i, int m) {
    if(m==0) return 1;
    if(i>=n) return 0;
    int res = solve(i+1,m) || solve(i+1,m-A[i]);
    return res;
}

int main(void) {
    int q, M, i;

    scanf("%d", &n);
    for(i=0;i<n;i++) scanf("%d",&A[i]);
    scanf("%d",&q);
    for(i=0;i<q;i++) {
        scanf("%d", &M);
        if(solve(0,M)) printf("yes\n");
        else printf("no\n");
    }
    return 0;
}


Measured memory_bytes: 2044
import sys
n = int(sys.stdin.readline())
ans = ""
x = n
while n >= 26:
  n, mod = divmod (n-1, 26)
  ans =  chr(ord("a") + mod) + ans
if n != 0:
  ans =  chr(ord("a") + n - 1) + ans
print (ans)

Measured memory_bytes: 9108
#pragma GCC optimize("Ofast")
#include <set>
#include <map>
#include <cmath>
#include <stack>
#include <queue>
#include <bitset>
#include <vector>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#define endl '\n'
#define fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define zy 2333333
#define bql 2147483647
using namespace std;
int n,k,ans;
string s;
int main()
{
	fast;
	cin>>n>>k>>s;
	for (int i=0;i<=n-2;i++)
	   if (s[i]==s[i+1])
	      ans++;
	cout<<min(ans+(2*k),n-1)<<endl;
    return 0;
}

Measured memory_bytes: 512
#include <cstdio>
#include <utility>
#include <vector>
#include <algorithm>
using namespace std;

#define gcu getchar_unlocked
#define ii inline int in
#define bs inline bool scan
ii(int c){int n=0;bool m=false;if(c=='-')m=true,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0');return m?-n:n;}
ii() {return in(gcu());}
bs(int &n){int c=gcu();return c==EOF?false:(n=in(c),true);}
bs(char &c){c=gcu();gcu();return c!=EOF;}
// bs(string &s){int c; s = "";
//	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
#undef ii
#undef bs
#define pcu putchar_unlocked
#define vo inline void out
template <typename T>
vo(T n){static char buf[20];char *p=buf;
	if(n<0)pcu('-'),n*=-1;if(!n)*p++='0';else while(n)*p++=n%10+'0',n/=10;
	while (p!=buf)pcu(*--p);}
vo(const char *s){while(*s)pcu(*s++);}
vo(char c){pcu(c);}
// vo(string &s){for (char c: s) pcu(c);}
template <typename head, typename... tail>
vo(head&& h, tail&&... t){out(h);out(move(t)...);}
//template <typename T>
//vo(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);out('\n');}
#undef vo

typedef vector<int> v;

int main() {
	v d(5);
	for (;;) {
		for (int &n: d)
			if (!scan(n))
				return 0;
		sort(d.begin(), d.end());
		v h(5);
		h[0] = 1;
		int t = d[0], c = 0;
		for (auto i = d.begin() + 1; i != d.end(); i++) {
			if (t != *i) {
				if (t + 1 == *i)
					h[4]++;
				t = *i, h[0]++, c = 0;
			} else
				h[c]--, c++, h[c]++;
		}
		if (d == v{1, 10, 11, 12, 13})
			h[4]++;

		if (h[4] == 4) out("straight");
		else if (h[3]) out("four card");
		else if (h[1] && h[2]) out("full house");
		else if (h[2]) out("three card");
		else if (h[1] == 2) out("two pair");
		else if (h[1]) out("one pair");
		else out("null");
		out('\n');
	}
}


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

typedef long long ll; typedef unsigned long long ull; typedef unsigned int uint; typedef long double ld;

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

int n;
cin >> n;
ll t;
ld ans = 1;
for (int i = 0; i < n; i++)
{
    cin >> t;
    if (ans != -1)
       ans *= t;
    if (ans > 1000000000000000000 || ans < 0)
       ans = -1;
    if (t == 0)
       ans = 0;
}
cout << (ll)ans;
return 0;
}

Measured memory_bytes: 3672
#include <iostream>
#include <string>
#include<vector>
using namespace std;
int main() {
	int h, m;
	cin >> h >> m;
	vector<string> vec(h);
	for (int i(0); i < h; i++) {
		cin >> vec[i];
	}
	for (int k(0); k < h; k++) {
		for (int l(0); l < m; l++) {
			if (vec.at(k).at(l) != '#') {
				int count(0);
				for (int i=k-1; i <= k+1; i++) {
					for (int j=l-1; j <= l+1; j++) {
						if (i>=0 && i<h && j>=0 && j<m && vec.at(i).at(j) == '#') {
							count++;
						}
					}
				}
				vec.at(k).at(l) = char(count + '0');
			}
			
		}
	}
	for (int k(0); k < h; k++) {
		cout << vec[k] << 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 1e9
#define ALL(v) v.begin(), v.end()

using namespace std;
typedef unsigned long long ll;

int main(){
    int n;
    cin >> n;
    vector<ll> a(n, 0);
    REP(i, n) {
        cin >> a[i];
    }
    sort(ALL(a), greater<int>());
 
    vector<ll> ans;

    REP(i, n-1){
        if (i+3 <= n-1 && a[i] == a[i+1] && a[i]== a[i+2] && a[i] == a[i+3]){
            ans.push_back(a[i]);
            ans.push_back(a[i]);
        }
        else if (a[i+1] == a[i]) ans.push_back(a[i]);
        
        if (ans.size()>=2) break;
        while (a[i+1] == a[i]) i++;
    }

    if (ans.size()<2) cout << '0' << endl;
    else cout << ans[0] * ans[1] << endl;
}

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

#define ULL unsigned long long
#define LL long long

#define P pair<int, int>

#define pb push_back
//#define mp make_pair
#define pp pop_back

#define lson root << 1
#define rson root << 1 | 1

#define INF32 (int)1e9 + 7
#define INF64 (long long)1e18

#define sc(x) scanf("%d", &x)
#define pr(x) printf("%d\n", x)

#define mem(arry, in) memset(arry, in, sizeof(arry))

#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

#define BEGIN() int T; sc(T); while(T--)

#define rep(i, aa, bb) for (int i = aa; i < bb; ++i)
#define Rep(i, aa, bb) for (int i = aa; i <= bb; ++i)

#define Size(x) (int)(x).size()
#define Range(x) (x).begin(), (x).end()

#define PI acos(-1)

using namespace std;

/*
namespace fastIO {
    #define BUF_SIZE 100000
    bool IOerror = 0;
    inline char nc() {
        static char buf[BUF_SIZE], *p1 = buf + BUF_SIZE, *pend = buf + BUF_SIZE;
        if(p1 == pend) {
            p1 = buf;
            pend = buf + fread(buf, 1, BUF_SIZE, stdin);
            if(pend == p1) {
                IOerror = 1;
                return -1;
            }
        }
        return *p1++;
    }
    inline bool blank(char ch) {
        return ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t';
    }
    inline void read(int &x) {
        char ch;
        while(blank(ch = nc()));
        if(IOerror) return;
        for(x = ch - '0'; (ch = nc()) >= '0' && ch <= '9'; x = x * 10 + ch - '0');
    }
    #undef BUF_SIZE
};
using namespace fastIO;
*/
/*
void print64mul(LL x, LL y) {
#if __SIZEOF_INT128__ == 16
  __int128 res = __int128(x) * y;
  char ch[64];
  int ptr = 0;
  if (res == 0) {
    puts("0");
    return;
  }
  while (res) {
    ch[ptr] = (res % 10) + '0';
    ptr++;
    res /= 10;
  }
  while (ptr)
    putchar(ch[--ptr]);
  putchar('\n');
#else
  constexpr LL limit = 1000000000;
  LL dig[4] = {0};
  dig[0] = x % limit;
  dig[1] = x / limit;
  dig[0] *= y;
  dig[1] *= y;
  dig[1] += dig[0] / limit;
  dig[0] %= limit;
  dig[2] += dig[1] / limit;
  dig[1] %= limit;
  int pos = 2;
  while (pos > 0) {
    if (dig[pos]) break;
    pos--;
  }
  printf("%d", dig[pos]);
  while (pos > 0) {
    pos--;
    printf("%09d", dig[pos]);
  }
  puts("");
#endif
}
*/

int main()
{
    int x, y;
    cin >> x >> y;
    cout << x + y / 2 << endl;
    
    
    return 0;
}





Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;cin>>n;
	int i;string s;
	int cac=0,ctle=0,cwa=0,cre=0;
	for(i=0;i<n;i++)
	{
		cin>>s;
		if(s=="AC")
		cac++;
		else if(s=="WA")
		cwa++;
		else if(s=="TLE")
		ctle++;
		else
		cre++;
	}
	cout<<"AC x "<<cac<<endl;
	cout<<"WA x "<<cwa<<endl;
	cout<<"TLE x "<<ctle<<endl;
	cout<<"RE x "<<cre<<endl;
  return 0;
}

Measured memory_bytes: 3632
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
#include<utility>

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

struct fast_io {
	fast_io(){
		std::cin.tie(nullptr);
		std::ios::sync_with_stdio(false);
	};
} fio;

signed main(){
	cout<<fixed<<setprecision(10);
	
	int N;
	int ans = 0;
	
	cin>>N;
	
	for(int i = 1; i <= N; i++){
		int A;
		
		cin>>A;
		
		if(i%2 && A%2) ans++;
	}
	
	cout<<ans<<endl;
	
	
	return 0;
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;

using ll = long long;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll a, b, k;
  cin >> a >> b >> k;
  cout << max(0LL, a - k) << ' ' << max(0LL, min(b, a + b - k));
  return 0;
}


Measured memory_bytes: 3648
#include <cstdio>

int v[100009];
int fact[100009], invFact[100009];

#define MOD (1000 * 1000 * 1000 + 7)

inline int lgput(int a, int n) {
    int r = 1;
    while (n > 0) {
        if (n % 2)
            r = 1LL * r * a % MOD;
        n /= 2;
        a = 1LL * a * a % MOD;
    }
    return r;
}

inline int comb(int n, int k) {
    if (n < k) return 0;
    return 1LL * fact[n] * invFact[n - k] % MOD * invFact[k] % MOD;
}

int main(){
    int n;
    scanf("%d", &n);

    int sol = 0;
    for(int i = 1; i <= n + 1; i++) {
        int x;
        scanf("%d", &x);
        if (v[x] != 0)
            sol = i - v[x];
        v[x] = i;
    }

    fact[0] = 1;
    for (int i = 1; i <= n + 1; i++)
        fact[i] = 1LL * i * fact[i - 1] % MOD;
    invFact[n + 1] = lgput(fact[n + 1], MOD - 2);
    for (int i = n; i >= 0; i--)
        invFact[i] = 1LL * (i + 1) * invFact[i + 1] % MOD;

    for (int i = 1; i <= n + 1; i++) {
        int ans = comb(n + 1, i);
        ans -= comb(n - sol, i - 1);
        if (ans < 0)
            ans += MOD;
        printf("%d\n", ans);
    }

    return 0;
}


Measured memory_bytes: 2304
/*
h3110_fr13nd,
 
AUTHOR : @sam_jn
*/
 
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
using namespace std;
// using namespace __gnu_pbds;
// typedef tree<pair<int, int>, null_type, less_equal<pair<int, int>>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
#define boost ios_base::sync_with_stdio(false); cin.tie(NULL);
#define ll long long
#define MOD 1000000007
#define pb push_back
#define ff first
#define ss second
#define in(a, n) for(int i = 0; i < n; i++) cin >> a[i];
#define ot1(a, n) for(int i = 0; i < n; i++) cout << a[i] << " "; cout << endl;
#define ot2(a, n) for(int i = 0; i < n; i++) cout << a[i] << "\n";
ll pwr(ll a, ll b);
ll pwr(ll a, ll b, ll m);
int baap[200002];
int find(int i);  
bool Union(int x, int y);
ll inv(ll x) {return pwr(x, MOD - 2, MOD);}

//----------------------------------SOLUTION-BELOW-------------------------------------------// 
void solve(){       
    int n, k;
    cin >> k >> n;
    int a[n];
    in(a, n);
    sort(a, a + n);
    int mx = INT_MIN;
    for(int i = 1; i < n; i++){
        mx = max(a[i] - a[i - 1], mx);
    }
    mx = max(mx, k - a[n - 1] + a[0]);
    cout << k - mx;
}
int main(){
                                                            // #ifndef ONLINE_JUDGE    
                                                            // freopen("../input", "r", stdin);
                                                            // freopen("../output", "w", stdout);
                                                            // #else
                                                            // // online submission
                                                            // #endif
    boost
    int _ = 1;
    // cout << 0 << endl;
    // cin >> _;
    while(_--){
        solve();
        cout << endl;
    }
}
 
 
//--------------------------------------DEFININTIONS---------------------------------------
ll pwr(ll a, ll b){
    if(b == 0)
        return 1 ;
    ll c = pwr(a, b/2) ;
    c = c * c;
    if(b % 2)
        return c*a;
    return c ;
}
ll pwr(ll a, ll b, ll m){
    if(b == 0)
        return 1;
    ll c = pwr(a, b/2, m) % m ;
    c = (c * c) % m;    
    if(b % 2)
        return (c * a%m) % m;
    return c ;
}
int find(int i)  
{  
    if (baap[i] != i)  
        baap[i] = find(baap[i]);  
  
    return baap[i];  
}
 
bool Union(int x, int y)
{
    x = find(x);
    y = find(y);
    if(x == y) return false;
    baap[x] = y;
    return true;
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(void){
    // Your code here!
    int N;
    
    cin >> N;
    
    if(N == 7 || N == 5 || N == 3)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <vector>
#include <string>
#include <algorithm>
#include <iterator>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, n) for(auto i = (n).begin(); i != (n).end(); i++)
#define in_arr(type, a, n) copy_n(istream_iterator<type>(cin), n, (a).begin());

using ll = long long int;

int main(){
    int n;
    cin >> n;
    if(n >= 2000) {
        cout << "1" << endl;
        return 0;
    }
    int x = n % 100, y = n / 100;
    for(int i = 0; i <= y; ++i){
        if(x <= i * 5) {
            cout << 1 << endl;
            return 0;
        }
   }
    cout << 0 << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>//sort,reverse
#include<utility>//pair
#include<queue>//queue,priority_queue
#include<deque>//double_ended queue
#include<map>//map
using namespace std;
typedef long long LL; 
typedef pair<LL,LL> P;//Pでpair<-,->を表す。
const LL MAX=2000010;
const LL MOD=1000000007;
typedef map<LL,LL>::iterator Itr;

int main()
{ 
    LL k;
    cin>>k;
    if(k<10){cout<<k<<endl;return 0;}
    //100000個を深さ優先探索する。
    LL depth=2;
    LL cnt=9;
    vector<int> v;
    LL m[10];
    m[0]=9;
    for(int j=1;j<10;j++){
        //for(int i=1;i<=9;i++){
            v.push_back(1);
            while(!v.empty()){
                if(v.back()>m[v.size()-1]){
                    v.pop_back();
                    if(!v.empty()){v[v.size()-1]++;}
                }
                else if(v.size()<depth){
                    int x=v.back();
                    if(x==0){v.push_back(0);m[v.size()-1]=1;}
                    else if(x==9){v.push_back(8);m[v.size()-1]=9;}
                    else{v.push_back(x-1);m[v.size()-1]=x+1;}
                }
                else{
                    cnt++;
                    if(cnt==k){
                        for(int i=0;i<v.size();i++){
                            cout<<v[i];
                        }
                        cout<<endl;
                        if(cnt==k){return 0;}
                    }
                    v[v.size()-1]++;
                }
            }
        //} 
        depth++;
    }
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int n;
	int r[200000]={1000000000};
	int v=1000000001,o;
	int i;
	
	scanf("%d",&n);
	
	for(i=0;i<n;i++)
	{
		scanf("%d",&r[i]);
	}
	
	o=r[1]-r[0];
	
	for(i=1;i<n;i++)
	{
		
		if(v>r[i-1])
		{
			v=r[i-1];
		}
		if(o<r[i]-v)
		{
			o=r[i]-v;
		}
	}
	
	printf("%d\n",o);
	
	return 0;
}


Measured memory_bytes: 2640
#include<bits/stdc++.h>
using namespace std;
int main()
{
    char str[101];
    int i,len,result;
    while(scanf("%s",str)!=EOF){
     result=0;
    len = strlen(str);

    for(i=0;i < len/2 ;i++){
        if(str[i] != str[len-i-1]){
            result+=1;
        }
    }
   printf("%d\n",result);
    }
return 0;
}


Measured memory_bytes: 256