akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define ll          long long
#define dl          double
#define pb          push_back
#define eb          emplace_back
#define mp          make_pair
#define F           first
#define S           second
#define endl        "\n"
#define rep(i,a,b)  for(i=a;i<b;i++)
#define all(v)      v.begin(),v.end()
#define allr(v)     v.rbegin(),v.rend()
#define mod         998244353
#define CIN(V,s,n)  for(int i=s;i<n;i++){cin >> V[i];}
#define COUT(V,s,n) for(int i=s;i<n;i++){cout <<  V[i] << " ";}
#define fast        ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define CLEAR(V);   for(ll i=0;i<V.size();i++) V[i] = 0;
using namespace std;

bool SbS(const pair<int,int> &a,const pair<int,int> &b)
{return (a.second < b.second);}

ll SUMD(ll n)
{   ll sum=0;
    while(n>0){sum += n%10;n = n/10;}
    return sum;
}

ll BS(vector<ll> &PS,ll s,ll e,ll ser)
{
    if(s>e)
        return s;
    ll mid = (s+e)/2;
    if(PS[mid]==ser)
    {
        return mid;
    }
    else if(PS[mid] > ser)
    {
        return BS(PS,s,mid-1,ser);
    }
    else
        return BS(PS,mid+1,e,ser);
}
ll MI(ll a, ll m)
{
    ll m0 = m;
    ll y = 0, x = 1;
    if (m == 1)
      return 0;
    while (a > 1)
    {
        ll q = a / m;
        ll t = m;
        m = a % m, a = t;
        t = y;
        y = x - q * y;
        x = t;
    }
    if (x < 0)
       x += m0;
    return x;
}
/*
void Sieve(int n)
{
    memset(P,true,sizeof(P));
    P[0] = false;
    P[1]= false;
    for(ll i=2;i*i<=n;i++)
    {
        if(P[i])
        {
            for(ll j=i*i;j<=n;j+=i)
            {
                P[j]=false;
            }
        }
    }

}
*/
int nCrModp(int n, int r, int p)
{
    int C[r+1];
    memset(C, 0, sizeof(C));

    C[0] = 1;
    for (int i = 1; i <= n; i++)
    {
        for (int j = min(i, r); j > 0; j--)

            C[j] = (C[j] + C[j-1])%p;
    }
    return C[r];
}

int main()
{
ll t=1;
//cin >> t;
while(t--)
{
    string st="abcdefghijklmnopqrstuvwxyz";
    ll n,m,p,k,i,j,l,t1,r,u,v,x,y,a,b,c,d,q,flag=1,x1,x2,y1,y2;
    cin >> n >> d;
    vector<vector<ll> > P(n,vector<ll> (d));
    for(i=0;i<n;i++)for(j=0;j<d;j++)cin >> P[i][j];
    ll counter=0;
    for(k=0;k<n-1;k++)
    for(i=k+1;i<n;i++)
    {
        ll sum=0;
        for(j=0;j<d;j++)
        {
            sum += (P[k][j]-P[i][j])*(P[k][j]-P[i][j]);
        }
        ll sr = sqrt(sum);
        if(sr*sr == sum)
            counter++;
    }

    cout << counter;
}
    return 0;
}


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

using namespace std;

int main ()
{
  int K,A,B;
  cin>>K>>A>>B;
  for(int i=A;i<=B;i++)
  {
    if(i%K==0)
    {
      cout<<"OK"<<endl;
      return 0;
    }
  }
  cout<<"NG"<<endl;
  return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; ++i)
#define REPP(i, n) for(int i = 1; i <= n; ++i)
#define REPR(i, n) for(int i = n-1; i >= 0; --i)
#define FOR(i, m, n) for(int i = m; i < n; ++i)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
const int MOD = 1000000007;

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b) {if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b) {if(a<b) a=b;}

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

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

#include <algorithm>
#include <cassert>
#include <vector>

namespace atcoder {

// Implement (union by size) + (path compression)
// Reference:
// Zvi Galil and Giuseppe F. Italiano,
// Data structures and algorithms for disjoint set union problems
struct dsu {
  public:
    dsu() : _n(0) {}
    dsu(int n) : _n(n), parent_or_size(n, -1) {}

    int merge(int a, int b) {
        assert(0 <= a && a < _n);
        assert(0 <= b && b < _n);
        int x = leader(a), y = leader(b);
        if (x == y) return x;
        if (-parent_or_size[x] < -parent_or_size[y]) std::swap(x, y);
        parent_or_size[x] += parent_or_size[y];
        parent_or_size[y] = x;
        return x;
    }

    bool same(int a, int b) {
        assert(0 <= a && a < _n);
        assert(0 <= b && b < _n);
        return leader(a) == leader(b);
    }

    int leader(int a) {
        assert(0 <= a && a < _n);
        if (parent_or_size[a] < 0) return a;
        return parent_or_size[a] = leader(parent_or_size[a]);
    }

    int size(int a) {
        assert(0 <= a && a < _n);
        return -parent_or_size[leader(a)];
    }

    std::vector<std::vector<int>> groups() {
        std::vector<int> leader_buf(_n), group_size(_n);
        for (int i = 0; i < _n; i++) {
            leader_buf[i] = leader(i);
            group_size[leader_buf[i]]++;
        }
        std::vector<std::vector<int>> result(_n);
        for (int i = 0; i < _n; i++) {
            result[i].reserve(group_size[i]);
        }
        for (int i = 0; i < _n; i++) {
            result[leader_buf[i]].push_back(i);
        }
        result.erase(
            std::remove_if(result.begin(), result.end(),
                           [&](const std::vector<int>& v) { return v.empty(); }),
            result.end());
        return result;
    }

  private:
    int _n;
    // root node: -1 * component size
    // otherwise: parent
    std::vector<int> parent_or_size;
};

}  // namespace atcoder

using namespace atcoder;

typedef long long int ll;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define all(v) (v).begin(), (v).end()
#define sz(x) int(x.size())
const ll mod = 1000000007;
const ll INF = 1001001001001001000;

int main() {
    int n, q;
    scanf("%d %d", &n, &q);
    dsu d(n);
    for (int i = 0; i < q; i++) {
        int t, u, v;
        scanf("%d %d %d", &t, &u, &v);
        if (t == 0) {
            d.merge(u, v);
        } else {
            if (d.same(u, v)) {
                printf("1\n");
            } else {
                printf("0\n");
            }
        }
    }
    return 0;
}


Measured memory_bytes: 3960
#include <set>
#include <map>
#include <queue>
#include <ctime>
#include <cmath>
#include <cstdio>
#include <bitset>
#include <vector>
#include <cstring>
#include <cassert>
#include <iostream>
#include <algorithm>
using namespace std;
typedef double db;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pa;
typedef unsigned int uint;
typedef unsigned long long ull;
#define w1 first
#define ls (x<<1)
#define w2 second
#define ins insert
#define rs (x<<1|1) 
#define mp make_pair
#define pb push_back
#define mid ((l+r)>>1)
#define sqr(x) ((x)*(x))
#define cle(x) ((x).clear())
#define lowbit(x) ((x)&(-x))
#define SZ(x) (int((x).size()))
#define ms(x,y) memset(x,y,sizeof (x))
#define rep(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)
#define rep2(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define per(i,a,b) for(int (i)=(a);(i)>=(b);(i)--)
#define Rep(p,x) for(int (p)=head[(x)];(p);(p)=nxt[(p)]) 
#define Rep2(p,x) for(int (p)=cur[(x)];(p);(p)=nxt[(p)])
#define All(x) (x).begin(),(x).end()
template<class T>inline void read(T&num){
	num=0;T f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9')num=num*10+ch-'0',ch=getchar();
	num*=f;
}
inline int getgcd(int x,int y){if(!x)return y;return getgcd(y%x,x);}
inline int power(int x,int k,int p){int res=1;for(;k;k>>=1,x=(ll)x*x%p)if(k&1)res=(ll)res*x%p;return res;}
const double pi=acos(-1);	
inline void judge(){
	freopen("input.txt","r",stdin);
} 
//********************************head*************************************
const int maxn=2e5+5,lim=1e8;
int R,C,n,top;
vector<pa>q;
int st[maxn];
int get(int x,int y){
	if(!x)return y;
	if(y==C)return lim+x;
	if(x==R)return 2*lim+C-y;
	if(!y)return 3*lim+R-x;
	return -1;
}
int main(){
	read(R);read(C);read(n);
	rep(i,1,n){
		int x1,y1,x2,y2;read(x1);read(y1);read(x2);read(y2);
		int a1=get(x1,y1),a2=get(x2,y2);
		if(a1!=-1&&a2!=-1)q.pb(mp(a1,i)),q.pb(mp(a2,i));
	}
	sort(All(q));
	rep2(i,0,SZ(q)){
		if(!top||st[top]!=q[i].w2)st[++top]=q[i].w2;
		else top--;
	}
	if(!top)puts("YES");
	else puts("NO");
	return 0;
}

Measured memory_bytes: 3444
/**
*    author:  yuya1234
*    created: 24.06.2020 14:57:44
**/

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)

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

    int a, b, c, d, e, f;
    cin >> a >> b >> c >> d;

    if (a > c)
        e = a;
    else
        e = c;

    if (b > d)
        f = d;
    else
        f = b;

    if (f - e > 0)
        cout << f - e << endl;
    else
        cout << 0 << endl;

    return 0;
}

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

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};

typedef struct node * Node;
#define NIL NULL

Node root;

Node treeMinimum(Node x){
  while(x->left!=NIL)
    x=x->left;
  return x;

}
Node treeMaximum(Node x){
  while(x->right!=NIL)
    x=x->right;
  return x;

}

Node treeSearch(Node u, int k){
  while(u!=NIL&&k!=u->key){
    if(k<u->key)u=u->left;
    else u=u->right;
  }
  return u;
}

Node treeSuccessor(Node x){
  Node y;
  if(x->right!=NIL)return treeMinimum(x->right);
  y=x->parent;
   while(y!=NIL&&x==y->right){
    x=y;
    y=y->parent;
  }
  return y;
}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y
  if(z->left==NIL||z->right==NIL)y=z;
  else y=treeSuccessor(z);

  if(y->left!=NIL){
    x=y->left;
  }else{
    x=y->right;
  }

  if(x!=NIL){
    x->parent=y->parent;
  }

  if(y->parent==NIL){
    root=x;
  }else{
    if(y==y->parent->left){
      y->parent->left=x;
    }else{
      y->parent->right=x;
    }
  }

  if(y!=z){
    z->key=y->key;
  }
  free(y);
}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x!=NIL){
    y=x;
    if(z->key < x->key){
      x=x->left;
    }else{
      x=x->right;
    }
  }
  z->parent = y;
  if(y==NIL){
    root=z;
  }else{
    if(z->key < y->key){
      y->left=z;
    }else{
      y->right=z;
    }
  }
}

void inorder(Node u){
  if(u==NIL)return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}
void preorder(Node u){
  if(u==NIL)return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}


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

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

  if(K<A){
      cout << K << endl;   
  }  else if(K<=A+B){
      cout << A << endl;
  }else{
      cout << A +A+B-K << endl;
  }
  
}

Measured memory_bytes: 3636
#include<stdio.h>
typedef long long ll;
#define REP(i,n) for(int i=0;i<(int)(n);i++)



ll gcd(ll a,ll b){
    ll k;
    if(a==b)return a;
    if(a==0||b==0)return 0;
    if(a<b){
        k=a;
        a=b;
        b=k;
    }
    while(1){
        if(a%b==0)break;
        a%=b;
        k=a;
        a=b;
        b=k;
    }
    return b;
}

int main(){
    
    ll a,b,c,d;
    scanf("%lld%lld%lld%lld",&a,&b,&c,&d);
    ll x,y;
    x=(a-c)*((a>c)*2-1);
    y=(b-d)*((b>d)*2-1);
    ll ggg=gcd(x,y);
    if(ggg==0){
        printf("0\n");
        return 0;
    }
    ll dx=x/ggg;
    ll dy=y/ggg;
    //printf("%lld%lld%lld\n",dx,dy,ggg);
    ll ans=(dx+dy-1)*ggg;
    printf("%lld\n",ans);
    return 0;
    
    /*
    printf("%lld\n",gcd(3,3));
    printf("%lld\n",gcd(6,7));
    printf("%lld\n",gcd(0,2));
    */
}

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










const long int INF = 1e9+5;

int main()
{
    int n,W;
    cin >> n >> W;
    int ttlV=0;
    vector <pair<int,int>> a(n);
    for (int i=0; i<n; i++)
    {
        cin >> a[i].first >> a[i].second;
        ttlV+=a[i].second;
    }

    vector <int> dp(ttlV+1,INF);
    dp[0]=0;
    for (int i=0; i<n; i++)
    {
        int w = a[i].first;
        int v = a[i].second;
        for (int i=ttlV; i-v>=0; i--)
            dp[i] = min(dp[i],dp[i-v]+w);
    }
    int rs=0;
    for (int i=0; i<=ttlV; i++)
        if (dp[i]<=W) rs=max(rs,i);
    cout << rs;
}

/*
10
10 3
1 2 3 4 5 6 7 8 9 10
3 3 4
*/



Measured memory_bytes: 3748
#include "bits/stdc++.h"

using namespace std;

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

	int n, m;
	cin >> n >> m;
	vector<pair<bool,int>> vec;

	vec.resize(n, make_pair<bool,int>(false,1));
	vec[0].first = true;

	for (int i = 0; i < m; i++) {
		int x, y;
		cin >> x >> y;
		vec[x - 1].second--;
		vec[y - 1].second++;
		if (vec[x - 1].first) 
			vec[y - 1].first = true;
		if (vec[x - 1].second == 0)
			vec[x - 1].first = false;
	}

	int c = 0;
	for (auto a : vec)
		c += a.first;

	cout << c << endl;

	return 0;

}

Measured memory_bytes: 1024
def findPath(x):
    if x==(200,200,2):
        for i in range(len(A)-1):
            G[A[i]].remove(A[i+1])
            G[A[i+1]].append(A[i])
        return True
    for y in G[x]:
        if hist[(x[0],x[1],y[0],y[1])]==0:
            hist[(x[0],x[1],y[0],y[1])]=1
            A.append(y)
            if findPath(y):
                return True
            A.pop()
    return False
N = int(input())
G = {}
for _ in range(N):
    a,b = map(int,input().split())
    G[(a,b,0)] = []
G[(-1,-1,-1)] = []
for x in G:
    if x[2]==0:
        G[(-1,-1,-1)].append(x)
for _ in range(N):
    c,d = map(int,input().split())
    G[(c,d,1)] = [(200,200,2)]
    for x in G:
        a,b,s = x[0],x[1],x[2]
        if s==0 and a<c and b<d:
            G[(a,b,0)].append((c,d,1))
G[(200,200,2)] = []
F = 0    
while True:
    A = [(-1,-1,-1)]
    hist = {(a,b,c,d):0 for (a,b,s1) in G for (c,d,s2) in G[(a,b,s1)]}
    if findPath((-1,-1,-1)):
        F += 1
    else:break
print(F)

Measured memory_bytes: 61912
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 30;
const int MOD = 1e9 + 7;

const int OFFSET = 3000;
const int N = 6000;
int64 dp[2][N];

int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  int64* d = dp[0] + OFFSET;
  int64* e = dp[1] + OFFSET;
  d[0] = 1;
  for (int i = 0; i < n; ++i) {
    int x;
    scanf("%d", &x);
    x -= m;
    for (int k = -2500; k <= 2500; ++k) e[k] = d[k];
    for (int k = -2500; k <= 2500; ++k) {
      if (k + x >= -2500 && k + x <= 2500) {
        e[k + x] += d[k];
      }
    }
    swap(d, e);
  }
  printf("%lld\n", d[0] - 1);
  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define REP(i,s,e) for(int i=(s); i<(e);i++)
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n)
#define repe(i,n) for(auto &&i:n)
#define all(v) (v).begin(),(v).end()
#define decimal fixed<<setprecision(20)
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
using namespace std;
using LL = long long;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = 1e9;
const LL LLINF = 1e16;

int n, m;
int dp[55][55][55][55][2][3];
vector<int> a, b, sa, sb;

int dfs(int i, int j, int k, int l, int turn, int pass){
    // cout << i << " " << j << " " << k << " " << l << " " << turn << " " << pass << endl;
    int& ret = dp[i][j][k][l][turn][pass];
    if(ret > -INF) return ret;
    // パスする
    ret = sa[i]-sa[j] - (sb[k]-sb[l]);
    // - まだ終了しない
    if(!(pass==1 && i==j && k==l)){
        ret += dfs(i, i, k, k, turn^1, (i==j&&k==l ? pass+1 : 0));
    }
    // 出す
    if(turn == 0 && i < n){
        if(a[i] != -1) chmax(ret, dfs(i+1, j, k, l, turn^1, 0));
        else chmax(ret, dfs(i+1, j, k, k, turn^1, 0));
    }else if(turn == 1 && k < m){
        if(b[k] != -1) chmin(ret, dfs(i, j, k+1, l, turn^1, 0));
        else chmin(ret, dfs(i, i, k+1, l, turn^1, 0));
    }
    return ret;
}

int main(){
    fastcin();

    cin >> n >> m;
    a.assign(n, 0);
    b.assign(m, 0);
    rep(i, n) cin >> a[i];
    rep(i, m) cin >> b[i];
    sa.assign(n+1, 0);
    sb.assign(m+1, 0);
    rep(i, n) sa[i+1] = sa[i] + max(0, a[i]);
    rep(i, m) sb[i+1] = sb[i] + max(0, b[i]);

    rep(i,55)rep(j,55)rep(k,55)rep(l,55)rep(turn,2)rep(pass,3) dp[i][j][k][l][turn][pass] = -INF;

    cout << dfs(0, 0, 0, 0, 0, 0) << endl;

}


Measured memory_bytes: 217688
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define ll long long
#define M 1000000007
#define sz(a) (ll)a.size()
#define pll pair<ll,ll>
#define rep(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define sep(i,a,b) for(ll i=(ll)a;i>=(ll)b;i--)
#define mll map<ll,ll>
#define vl vector<ll>
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(a) a.begin(),a.end()
#define F first
#define S second
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n;
    string s;
    cin>>n>>s;
    if(n%2)
    {
        cout<<"No\n";
        return 0;
    }
    if(s.substr(0,n/2)==s.substr(n/2,n/2))
        cout<<"Yes\n";
    else
        cout<<"No\n";
}


Measured memory_bytes: 256
n,m=map(int,input().split())
l=list(map(int,input().split()))
tmp=[0]*n

for i in range(m):
    a,b=map(int,input().split())

    if l[a-1] > l[b-1]:
        tmp[b-1]=-1
    elif l[a-1] == l[b-1]:
        tmp[a-1]=-1
        tmp[b-1]=-1
    else:
        tmp[a-1]=-1


print(tmp.count(0))



Measured memory_bytes: 20036
/*--------------------------"SABUJ-JANA"------"JADAVPUR UNIVERSITY"--------*/
/*-------------------------------@greenindia-----------------------------------*/
/*---------------------- Magic. Do not touch.-----------------------------*/
/*------------------------------God is Great/\---------------------------------*/
#include <bits/stdc++.h>
using namespace std;
#define crap ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
//cout<<fixed<<showpoint<<setprecision(12)<<ans<<endl;
#define dbg(x) cerr << #x << " = " << x << endl
#define endl "\n"
#define int long long int
#define double long double
#define pb push_back
#define mp make_pair
#define PI acos(-1)

//const int INF=1e9+5;//billion
int primes[] = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89};
string alpha = "abcdefghijklmnopqrstuvwxyz";
/*----------JU IS LOVE----------*/
//int power(int a,int b,int m){int ans=1;while(b){if(b&1)ans=(ans*a)%m;b/=2;a=(a*a)%m;}return ans;}
//int power(int a, int b){int ans=1;while(b){if(b&1)ans=ans*a;b/=2;a=a*a;}return ans;}


signed main() {
    
	 
	crap;

	int n,d;
	cin>>n>>d;

	int base = 2*d + 1;
	cout<< ceil( (float) n / (float) base) <<endl;
 	
 	

	return 0;
}






Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <map>
#include <cmath>
#include <vector>
#include <queue>
using namespace std;
typedef long long LL;

LL n;
LL a[500005];
LL b[9],c[9];
LL bc,cc;

int main(){
	ios::sync_with_stdio(false);
	cin >> n;
	for(LL i = 1;i <= n;i ++) cin >> b[i];
	for(LL i = 1;i <= n;i ++) cin >> c[i];
	
	for(LL i = 1;i <= n;i ++) a[i] = i;
	
	for(LL i = 1;i <= 100000;i ++){
		LL tb = 1,tc = 1;
		for(LL j = 1;j <= n;j ++){
			if(a[j] != b[j]) tb = 0;
			if(a[j] != c[j]) tc = 0;
		}
		if(tb) bc = i; if(tc) cc = i;
		if(!next_permutation(a + 1,a + 1 + n)) break;
	}
	
	cout << abs(cc - bc) << endl;
	return 0;
}

Measured memory_bytes: 256
import heapq
from collections import deque
from enum import Enum
import sys
import math
from _heapq import heappush, heappop
import copy
from test.support import _MemoryWatchdog

BIG_NUM = 2000000000
HUGE_NUM = 99999999999999999
MOD = 1000000007
EPS = 0.000000001
sys.setrecursionlimit(100000)


MAX = 10
POW = [1]*(MAX)

for i in range(1,MAX):
    POW[i] = POW[i-1]*4

while True:
    NUM = int(input())
    if NUM == -1:
        break
    elif NUM == 0:
        print("0")
        continue

    First = True
    for i in range(MAX-1,-1,-1):
        if POW[i] <= NUM:
            print("%d"%(NUM//POW[i]),end="")
            NUM %= POW[i]
            First = False
        else:
            if First: #
                pass
            else:
                print("0",end="")
    print()


Measured memory_bytes: 13740
#include<iostream>
using namespace std;
int main(){
	int n,r,t,num=0;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>r>>t;
		num=r/100+t/30*5;
		if(r%100>0&&t%30>0){
			cout<<num<<" "<<num+1<<" "<<num+5<<" "<<num+6<<endl;
		}else if(t%30>0){
			cout<<num<<" "<<num+5<<endl;
		}else if(r%100>0){
			cout<<num<<" "<<num+1<<endl;
		}else{
			cout<<num<<endl;
		}
	}
	return 0;
}

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

typedef long long ll;

const int INF = 1000000000;
const int MOD = 1000000007;

int main(int argc, char const *argv[]) {
	int x, y, z, K;
	cin >> x >> y >> z >> K;
	vector<ll> a(x), b(y), c(z);
	rep(i, a.size()) cin >> a[i];
	rep(i, b.size()) cin >> b[i];
	rep(i, c.size()) cin >> c[i];

	sort(all(a), greater<ll>());
	sort(all(b), greater<ll>());
	sort(all(c), greater<ll>());

	/* O(KlogK) */
	priority_queue<tuple<ll, int, int, int>> pq;
	pq.push(make_tuple(a[0] + b[0] + c[0], 0, 0, 0));

	set<tuple<int, int, int>> st;
	rep(i, K) {
		auto e = pq.top(); pq.pop();
		cout << get<0>(e) << endl;
		// cout << get<0>(e) << ' ' << get<1>(e) << ' ' << get<2>(e) << ' ' << get<3>(e) << endl;

		int ea = get<1>(e), eb = get<2>(e), ec = get<3>(e);
		ll sum;
		tuple<int, int, int> ne;

		if (ea+1 < x) {
			sum = a[ea+1] + b[eb] + c[ec];
			ne = make_tuple(ea+1, eb, ec);
			if (st.count(ne) == 0) {
				pq.push(make_tuple(sum, ea+1, eb, ec));
				st.insert(ne);
			}
		}

		if (eb+1 < y) {
			sum = a[ea] + b[eb+1] + c[ec];
			ne = make_tuple(ea, eb+1, ec);
			if (st.count(ne) == 0) {
				pq.push(make_tuple(sum, ea, eb+1, ec));
				st.insert(ne);
			}
		}

		if (ec+1 < z) {
			sum = a[ea] + b[eb] + c[ec+1];
			ne = make_tuple(ea, eb, ec+1);
			if (st.count(ne) == 0) {
				pq.push(make_tuple(sum, ea, eb, ec+1));
				st.insert(ne);
			}
		}

	}
	return 0;
}

Measured memory_bytes: 896
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

X, N, *P = map(int, read().split())
se = frozenset(P)

def gen_nums(X):
  low, high = X-1, X
  while True:
    yield high
    yield low
    low, high = low-1, high+1

for x in gen_nums(X):
  if x not in se:
    break

print(x)


Measured memory_bytes: 9168
/*****
ICPC??´???
1998??´ ??¢?????¢??§??? A??????
*****/
#include<stdlib.h>
#include<stdio.h>
#include<math.h>
#define TRUE 0
#define FALSE 1

int main(void) {
	int i;
	int j;
	int max=(int)pow(2.0,15.0);
	int hurui[max];
	
	/////?´???°?±???????/////
	for(i=0;i<max;i++) {
		hurui[i] = TRUE;
	}
	hurui[0] = FALSE;
	hurui[1] = FALSE;
	
	for(i=2;i<max;i++) {
		for(j=2;j<max;j++) {
			if(i*j<max) {
				hurui[i*j] = FALSE;
			}
		}
	}
	/*for(i=0;i<100;i++) {
		if(hurui[i]==TRUE) printf("%d = ?´???°\n",i);
    }*/
	/////////////////////
	
	int input;
	int count;
	int sum;
	
	while(1) {
		scanf("%d",&input);
		//printf("-%d\n", input);
		if(input==0) break;
		
		count = 0;
		sum = 0;
		
		if(hurui[input] == TRUE) {
			count++;
		}
		for(i=input-1; i>=2; i--) {
			if(hurui[i] == FALSE) continue;
			sum=i;
			for(j=i-1; j>=2; j--) {
				if(hurui[j] == FALSE) continue;
				sum+=j;
				if(sum==input) {
					count++;
					break;
				}
				if(sum>input) {
					break;
				}
			}
		}
		printf("%d\n",count);
	}
	
	exit(0);
}

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

ll func(ll x){
    ll res = 0;
    ll tmp = 1;
    while(x){
        tmp*=10;
        res+=tmp;
        x--;
    }
    return res;
}



int main(){

    ll n;
    cin >> n;
    
    ll ans = 0;
    for(ll i = 1; i <= n; i++){
        if(i/10==0){
            ans ++;
            continue;
        }
        ll now = i;
        ll l,r;
        ll o = 0;
        r = i%10;
        while(now/10>0){
            now /= 10;
            o++;
        }
        l = now;
        if(l==r){
            if(o==1){
                ans += 3;
            }else{
                ans += 5+func(o-2)*2;  
                ll tmp = 1;
                rep(j,o){
                    tmp*=10;
                } 
                // cout << (i- (l*tmp+l))/10 << endl;
                ans += ((i- (l*tmp+l))/10)*2;
            }
        }else if(l<r){
            if(o==1){
                continue;
            }else{
                ans += (1+func(o-2))*2;
            }
        }else if(r==0){
            continue;
        }else{
            ans += (1+func(o-1))*2;
        }
        // cout << "i :" << i << " ans :" << ans <<endl;
    }
    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
#define vec(s) vector

#define vvec(s) vector<vector
>
typedef vector<lli> vi;
typedef vector<vi> vvi;
typedef pair<lli,lli> pii;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YN(x) cout<<(x?"Yes":"No")<<endl;
#define out(s) cout<<s<<endl;
#define pb(s) push_back(s);
#define sp " ";
#define INF 10000000000
#define LINF 9000000000000000000
#define all(s) s.begin(),s.end()
void vout(vi v){
    for(int i=0;i<v.size();i++)
    cout<<v.at(i)<<endl;
}
int main(){
    lli k;
    cin >> k;
    lli tmp = 7;
    lli ans = -1;
    rep(i,k){
        if(tmp%k==0){
            ans = i + 1;
            break;
        }
        else{
            tmp *= 10;
            tmp %= k;
            tmp += 7;
            tmp %= k;
        }
    }
    out(ans);
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
#define Rep(i,a,b) for(register int i=(a);i<=int(b);++i)
#define Dep(i,a,b) for(register int i=(a);i>=int(b);--i)
#define rep(i,a,b) for(register int i=(a);i<int(b);++i)
#define mem(x,v) memset(x,v,sizeof(x))
#define fi first
#define se second
#define gc getchar
#define pc putchar
inline ll rd(){
    ll x=0,f=1;char c=gc();
    for(;!isdigit(c);c=gc())if(c=='-')f=-1;
    for(;isdigit(c);c=gc())x=(x<<1)+(x<<3)+(c^48);
    return x*f;
}
inline void write(ll x){if(x<0)x=-x,pc('-');if(x>=10)write(x/10);putchar(x%10+'0');}
inline void writeln(ll x){write(x);puts("");}
bool Isprime[233333];
ll prime[233333];
void init(int T){
	mem(Isprime,true);*prime = 0;
	for(int i=2;i<=T;i++){
		if(Isprime[i]){
			prime[++*prime] = i;
//			printf("[%d]\n",i);
//			if(i==47) return ;
		}
		for(int j=1;j<=*prime && i * prime[j] <= T;++j){
			Isprime[i*prime[j]] = false;
			if(i%prime[j]==0)break;
		}
	}
}
map<ll,ll> mp1,mp2;
ll ans[505][505],n;
int main(){
	init(8000);
	n = rd();
	if(n==2){
		puts("4 7");
		puts("23 10");
		return 0;
	}
//4	mp3.clear();
	ll wzp = 1;
	Rep(i,1,n)Rep(j,1,n)
			if(((i+j)&1) && !mp1[i+j]) mp1[i+j] = prime[wzp++];
	Rep(i,1,n)Rep(j,1,n)
			if(((i+j)&1) && !mp2[i-j]) mp2[i-j] = prime[wzp++];
	Rep(i,1,n)Rep(j,1,n){
		if((i+j)&1){
			ans[i][j] = (ll)mp1[i+j]*mp2[i-j];
//			while(mp3[ans[i][j]]) ans[i][j]+=(ll)mp1[i+j]*mp2[i-j];
//			mp3[ans[i][j]]++;
		}
	}
//	Rep(i,1,n){
//		Rep(j,1,n){
//			printf("%lld ",(ll)mp1[i+j]*mp2[i-j]);
//		}
//		puts("");
//	}
//	ll mx = 0;
	Rep(i,1,n)Rep(j,1,n)if(!((i+j)&1)){
		ll tmp = 1;
		if(1<=i-1) tmp = tmp / __gcd(tmp,ans[i-1][j]) * ans[i-1][j];
		if(1<=j-1) tmp = tmp / __gcd(tmp,ans[i][j-1]) * ans[i][j-1];
		if(i+1<=n) tmp = tmp / __gcd(tmp,ans[i+1][j]) * ans[i+1][j];
		if(j+1<=n) tmp = tmp / __gcd(tmp,ans[i][j+1]) * ans[i][j+1];
		ans[i][j] = tmp+1;
//		while(mp3[ans[i][j]]) ans[i][j]+=tmp;
//		mp3[ans[i][j]]++;
//		mx = max(mx,ans[i][j]);
	}
//	writeln(mx-1e15);
	Rep(i,1,n){
		Rep(j,1,n)
			printf("%lld ",ans[i][j]);
		puts("");
	}
	return 0;
}

Measured memory_bytes: 5376
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
	int base,i,j,n,o,point;
	char state[8];
	cin >> n;
	for(i=0;i<n;i++)
	{
		o=base=point=0;
		while(o<3)
		{
			cin >> state;
			if (strcmp(state, "HIT") == 0)
			{
					if(base == 3)
						point++;
					else
						base++;
			}
			else if (strcmp(state, "HOMERUN") == 0)
			{
					base++;
					point+= base;
					base =0;
			}
			else if (strcmp(state, "OUT") == 0)
					o++;
		}
		cout << point << endl;
	}
	return 0;
}
					
						

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

int main(){
    ll a,b,v,w,t;
    cin >> a >> v >> b >> w >> t;
    ll dist = abs(a-b);
    ll speed = v-w;
    if(speed*t>=dist){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 3624
my $N = <STDIN>;
my $input = <STDIN>;
chomp $input;
my @arr = split(/ /, $input);
my @ans = (0) x $N;
for(my $i = 0; $i < $N; $i++)
{
    @ans[@arr[$i]-1] = $i + 1;
}
print join(" ", @ans) . "\n";

Measured memory_bytes: 26852
#include<stdio.h>
#include<iostream>

using namespace std;

int H,W;
char tb[110][110];
bool tate[110],yoko[110];
int main(){
    cin >> H >> W;
    for(int i=0; i<H; i++) tate[i] = false;
    for(int i=0; i<W; i++) yoko[i] = false;
    for(int i=0; i<H; i++) {
        for(int j=0; j<W; j++){
            cin >> tb[i][j];
        }
    }
    for(int i=0; i<H; i++){
        for(int j=0; j<W; j++){
            if( tb[i][j] == '#') {
                tate[j] = true;
                yoko[i] = true;
            }
        }
    }
    for(int i=0;i<H; i++){
        if( yoko[i] ) {
            for(int j=0; j<W; j++){
                if(tate[j]) cout << tb[i][j];
            }
        cout << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
n = gets.to_i
ary_p = gets.split.map(&:to_i)
ary_q = gets.split.map(&:to_i)

def f(n, ary)
  x = 0
  m = n
  b = (1..n).inject(1, :*)
  while i = ary.shift
    b /= m
    x += (i - 1) * b
    ary.map! { |z| z > i ? z - 1 : z }
    m -= 1
  end
  x
end

puts (f(n, ary_p) - f(n, ary_q)).abs


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

int main(){
 int n, z, p, q;
 scanf("%d", &n);
 z= (double)n/1.08;
 p= 1.08 * z;
 z++;
 q= 1.08 * z;
 if(p==n) printf("%d", z-1);
 else if(q==n) printf("%d", z);
 else printf(":(");
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<queue>
#include<stack>
using namespace std;
#define vel vector<long long>
#define vvel vector<vel>
#define int long long
#define rep(i,n) for(long long i=0;i<n;i++)
#define sor(v) sort(v.begin(),v.end())
#define mmax(a,b) a=max(a,b)
#define mmin(a,b) a=min(a,b)
#define mkp make_pair
#define pin pair<int,int>
#define V vector
long long p = 998244353;
vel par;
int ru(int a, int r) {
	if (r == 0) { return 1; }
	int ans = ru(a, r / 2);
	ans *= ans; ans %= p;
	if (r % 2 == 1) { ans *= a; ans %= p; }
	return ans;
}
signed main() {
	int n; cin >> n;
	int ans = 10001;
	vel w(n);
	int sum = 0;
	rep(i, n) { cin >> w[i]; sum += w[i]; }
	rep(i, n) {
		int s1 = 0;
		rep(j, i + 1) { s1 += w[j]; }
		mmin(ans, abs(sum - 2 * s1));
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
using System;
namespace HelloWorld
{
    class Program
    {
        static void Main()
        {
            long result = 1;
            int num = int.Parse(Console.In.ReadLine());
            for (int i = 1; i <= num; ++i)
            {
                result *= i;
            }
            Console.Out.WriteLine(result);
        }
    }
}


Measured memory_bytes: 13828
#pragma once
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
ll INF = 10000007;
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
int pr[100010];
void uini(int n) {
	for (size_t i = 0; i <= n; i++)
	{
		pr[i] = i;
	}
}

int parent(int x) {
	if (x == pr[x]) return x;
	return pr[x] = parent(pr[x]);
}

bool unit(int x, int y) {
	int px = parent(x);
	int py = parent(y);

	if (px == py) return false;
	if (px < py) {
		pr[py] = px;
	}
	else {
		pr[px] = py;
	}
	return true;
}
ll at[30][30];
ll bt[30][30];
ll ar[30];
ll upt[30][30][30];
ll mid(ll x, ll y, ll z) {
	if (x <= y && y <= z) {
		return y;
	}
	else if (y <= x && x <= z) {
		return x;
	}
	else return z;
}
int c[30];
ll ggd(ll x, ll v) {

	if (v == 0) return 0;
	ll rem = x % v;
	ll di = ((x / v) * v) * 2;
	ll r = di + x;
	return r + ggd(v, rem) - rem;

}
//]
void solv() {
	int a, b,k;
	cin >> a >> b >> k;
	int c = 0;
	for (int i = min(a,b); i>= 1 ; i--)
	{
		if (a % i == 0 && b % i == 0) {
			c++;
			if (c == k) {
				cout << i << endl;
				return;
			}
		}
	}

	//string s;
	//cin >> s;

	//cin >> n >> m;
	//fill(memo, memo + n, -1);
	//for (size_t i = 0; i < m; i++)
	//{
	//	int p, q,c;
	//	cin >> p >> q >> c;
	//	co[p, q] = c;
	//	co[q, p] = co[p, q];
	//	ve[p].push_back(q);
	//	ve[q].push_back(p);
	//}

	//
	//cout << rec(1, 0) << endl;

}


int main() {
	solv();

	return 0;
}


Measured memory_bytes: 256
import std.stdio;
import std.string;
import std.conv;
import std.math;


int main()
{
	int number = readln.chomp.to!(int);
	double x1,y1,r1,x2,y2,r2,d;


	while(number--)
	{
		readf("%f %f %f %f %f %f\n",&x1,&y1,&r1,&x2,&y2,&r2);
		d = sqrt((x2-x1) * (x2-x1) + (y2-y1) * (y2-y1));

		if( d > r2 + r1)
		{
			writeln(0);
		}
		else if(d < r1 - r2)
		{
			writeln(2);
		}
		else if(d < r2- r1)
		{
			writeln(-2);
		}
		else
		{
			writeln(1);
		}
	}


	return 0;
}

Measured memory_bytes: 1096
//#define _DEBUG
#include "bits/stdc++.h"
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,a4,x,...) x
#define debug_1(x1) cout<<#x1<<": "<<x1<<endl
#define debug_2(x1,x2) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<endl
#define debug_3(x1,x2,x3) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<endl
#define debug_4(x1,x2,x3,x4) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<endl
#define debug_5(x1,x2,x3,x4,x5) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<", "#x5<<": "<<x5<<endl
#ifdef _DEBUG
#define debug(...) CHOOSE((__VA_ARGS__,debug_5,debug_4,debug_3,debug_2,debug_1,~))(__VA_ARGS__)
#else
#define debug(...)
#endif
#define rep(index,num) for(int index=0;index<(int)num;index++)
#define rep1(index,num) for(int index=1;index<=(int)num;index++)
#define brep(index,num) for(int index=(int)num-1;index>=0;index--)
#define brep1(index,num) for(int index=(int)num;index>0;index--)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=(ll)1e+18+1;
int INF=1e+9+1;
int main(){
	int N;
	ll A[100002];
	scan(N);
	rep(i,N+1){
		scan(A[i]);
	}
	ll sum=0;
	ll num[100002];
	if(N==0){
		if(A[0]==1) prin(1);
		else prin(-1);
		return 0;
	}
	else{
		if(A[0]>0){
			prin(-1);
			return 0;
		}
	}
	int flag=1;
	rep(i,N+1){
		if(i<N){
			if(i<=40&&(1LL<<i)<A[i]+1){
				flag=0;
				break;
			}
		}
		else{
			if(i<=40&&(1LL<<i)<A[i]){
				flag=0;
				break;
			}
		}
	}
	if(flag==0){
		prin(-1);
		return 0;
	}
	num[N]=A[N];
	brep(i,N){
		num[i]=num[i+1]+A[i];
	}
	num[0]=1;
	rep1(i,N){
		if(num[i-1]-A[i-1]<=0) flag=0;
		if(num[i-1]-A[i-1]<INFl) num[i]=min(num[i],(num[i-1]-A[i-1])*2);
	}
	rep(i,N){
		if(num[i+1]>(num[i]-A[i])*2||A[i+1]>(num[i]-A[i])*2) flag=0;
		if(num[i+1]<num[i]-A[i]) flag=0;
		debug(i,num[i],A[i],num[i+1]);
	}
	if(flag==0){
		prin(-1);
		return 0;
	}/*
	rep(i,N+1){
		printf("%lld ",num[i]);

	}kaigyo;*/
	rep(i,N+1) sum+=num[i];
	prin(sum);
	return 0;
}


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

int N;
vector<int> A(100);


void print(){
    for(int i = 0; i < N; i++){
        cout << A[i] << (i != N-1 ? " " : "\n");
    }
}

int selection_Sort(int cnt){
    
    
    
    for(int i = 0; i < N; i++){
        
        int min_Num = A[i];
        int min_psi;
        
        for(int j = i; j < N; j++){
            if(min_Num > A[j]){
                min_Num = A[j];            
                min_psi = j;
            }
        }
        
        if(A[i] > min_Num ){
            swap(A[i], A[min_psi]); 
            cnt++;
        }
    }
    
    return cnt;
}


int main(void){
    
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> A[i];
    }
    
    int count = 0;
    count = selection_Sort(count);
    
    
    print();
    cout << count << endl;
    
}



Measured memory_bytes: 3132
#include <iostream>
#include<cmath>
using namespace std;
int main()
{
    int n,a;
    cin>>n;
    for(int i=n;i>=1;i--)
    {
        a=sqrt(i);
        if(i%a==0&&i/a==a)
        {
            cout<<i<<endl;
            return 0;
        }
    }

	return 0;
}

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

int main() {
	int a,b;
	cin >> a >> b;
	int ans=0;
	for (int i = 0; i < 2; i++) {
		bool flug = false;
		if (a <= b&&!flug) {
			ans += b;
			b--;
			flug = true;
		}
		if (b < a&&!flug) {
			ans += a;
			a--;
			flug = true;
		}
	}
		cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
alphabetlist=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']

n=int(input())
ans={moji:100 for moji in alphabetlist}
for i in range(0,n):
    s=input()
    test={moji:0 for moji in alphabetlist}
    for j in range(0,len(s)):
        test[s[j]]+=1
    for moji in alphabetlist:
        ans[moji]=min(ans[moji],test[moji])

x=[]
for moji in alphabetlist:
    for i in range(0,ans[moji]):
        x.append(moji)

ans="".join(x)
print(ans)

Measured memory_bytes: 39280
#include <bits/stdc++.h>
#define int long long
using pii=std::pair<int,int>;
using namespace std;

const int maxn = 1e5 + 5, maxlogn = 18;

int n, l, q, x[maxn], a, b, r[maxlogn][maxn];

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    for(int i = 0; i < n; i++)
        cin >> x[i];
    cin >> l;
    for(int i = n - 1; i >= 0; i--)
    {
        int pos = upper_bound(x, x + n, x[i] + l) - x - 1;
        assert(i == n - 1 || pos > i);
        r[0][i] = pos;
    }
    for(int i = 1; i < maxlogn; i++)
        for(int j = n - 1; j >= 0; j--)
            r[i][j] = r[i - 1][r[i - 1][j]];
    cin >> q;
    for(int i = 0; i < q; i++)
    {
        cin >> a >> b;
        a--; b--;
        if(a > b)
            swap(a, b);
        int ans = 0;
        for(int j = maxlogn - 1; j >= 0; j--)
            if(r[j][a] < b)
            {
                a = r[j][a];
                ans += (1ll << j);
            }
        a = r[0][a];
        assert(a >= b);
        cout << ans + 1 << "\n";
    }
    return 0;
}

Measured memory_bytes: 18504
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>
#include <set>

static const int INF = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

int main() {
    set<int> v;
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        int a;
        cin >> a;
        v.insert(a);
    }
    cout << v.size() << "\n";
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define REP(i,s,e) for(int i=(s); i<(e);i++)
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n)
#define repe(i,n) for(auto &&i:n)
#define all(v) (v).begin(),(v).end()
#define decimal fixed<<setprecision(20)
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
using namespace std;
using LL = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = 1e9;
const LL LLINF = 1e16;

int main(){
    int n, m;
    cin >> n >> m;
    vector<vector<int>> G(n);
    rep(i, m){
        int a, b;
        cin >> a >> b;
        a--; b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    rep(i, n){
        if(G[i].size() % 2){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;

}

Measured memory_bytes: 5376
#include <iostream>
#include <cmath>
#include <vector>
using namespace std;
using vi = vector<int>;
void ins() {}
template<class T,class... Rest>void ins(T& v,Rest&... rest){cin>>v;ins(rest...);}
#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
int main() {
  int N, A, B, C;
  ins(N, A, B, C);

  vi l(N);
  rep(i, N)
    cin >> l[i];

  int ans = 1e9;
  rep(_p, pow(4, N)) {
    int pattern = _p;
    vi v(4, 0), sum(4, 0);
    rep(i, N) {
      ++v[pattern % 4];
      sum[pattern % 4] += l[i];
      pattern /= 4;
    }
    if (v[0] + v[1] + v[2] < 3 || v[0] * v[1] * v[2] == 0)
      continue;
    chmin(ans, (v[0]-1) * 10 + abs(A-sum[0]) + (v[1]-1) * 10 + abs(B-sum[1]) + (v[2]-1) * 10 + abs(C-sum[2]));
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
n,x,m = map(int,input().split())
set_a = set()
a = []
while len(a)<n:
    if x in a:break
    set_a.add(x)
    a.append(x)
    x = x**2%m

ans = sum(a[:min(n,len(a))])
n -= len(a)
if n<1:
    print(ans)
    exit()

i = a.index(x)
l = len(a)-i
ans += sum(a[i:]) * (n//l)
n %= l
ans += sum(a[i:i+n])
print(ans)



Measured memory_bytes: 77644
import java.util.*;

public class Main {
	static class UnionFind {
		int[] param;
		int[] rank;
		int N;
		int xlen;
		
		public UnionFind(int n) {
			N=n;
			param = new int[N];
			rank = new int[N];
			for(int i=0; i<N; i++)
				param[i] = i;
		}
		
		public void init() {
			for(int i=0; i<N; i++)
				param[i] = i;
			Arrays.fill(rank, 0);
		}
		
		public UnionFind(int x, int y) {
			this(x*y);
			xlen=y;
		}
		
		public boolean same(int a, int b) {
			return getRoot(a)==getRoot(b);
		}
		
		public boolean same(int x1, int y1, int x2, int y2) {
			return same(x1*xlen+y1, x2*xlen+y2);
		}
		
		public int getRoot(int a) {
			if(param[a]==a) return a;
			else return (param[a] = getRoot(param[a]));
		}
		
		public void unite(int a, int b) {
			a = getRoot(a);
			b = getRoot(b);
			if(a==b)
				return;
			
			if(rank[a] < rank[b]) {
				param[a] = b;
			} else {
				param[b] = a;
				if(rank[a]==rank[b])
					rank[a]++;
			}
		}
		
		public void unite(int x1, int y1, int x2, int y2) {
			unite(x1*xlen+y1, x2*xlen+y2);
		}
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		int M = sc.nextInt();
		UnionFind uf = new UnionFind(N);
		for(int i=0; i<M; i++) {
			int A = sc.nextInt()-1;
			int B = sc.nextInt()-1;
			uf.unite(A, B);
		}

		int[] g = new int[N];
		for(int i=0; i<N; i++)
			g[i] = uf.getRoot(i);
		
		Arrays.sort(g);
		int max = 0;
		int size = 1;
		for(int i=0; i<N; i++) {
			if(i==N-1 || g[i]!=g[i+1]) {
				max = Math.max(max, size);
				size = 1;
			} else {
				size++;
			}
		}
		
		System.out.println(max);
		sc.close();
	}
}


Measured memory_bytes: 51828
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
typedef long long ll;
namespace mp = boost::multiprecision;
using Mint = mp::cpp_int;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = int(a); i < int(b); i++)
#define all(v) v.begin(), v.end()
#define uni(v) v.erase(unique(all(v)), v.end())
#define sort_g(v) sort(all(v), greater<int>())
#define dump(x) cerr << #x << ' ' << '=' << ' ' << x << endl

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i, N) cin >> A.at(i);

    int cnt = 0;
    bool flg = false;
    while(true) {
        rep(i, N) {
            if(A.at(i) % 2 != 0) flg = true;
        }
        if(flg) break;
        rep(i, N) A.at(i) /= 2;
        cnt++;
    }

    cout << cnt << endl;
}

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

void solve(){
  int n; cin >> n;
  unsigned long long int p1 = 1, p2 = 2, c = 1;
  for(int i = 2; i <= n; i++){
    c = p1 + p2;
    p2 = p1;
    p1 = c;
  }
  cout << c << endl;
  return;
}

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


Measured memory_bytes: 256
n, t = gets.split.map(&:to_i)
a = gets.split.map(&:to_i)
min = a[0]
p = Array.new
a.each_with_index do |b, i|
    p[i] = b - min
    min = b if b < min
end
max = p.max
puts p.count {|pp| pp == max}

Measured memory_bytes: 9420
#include<bits/stdc++.h>
#define fastio     ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define debug(x)   cerr<<#x<<": "<<x<<endl;
#define all(x)     (x).begin() , (x).end()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define endl       '\n'
#define MAX        1000000
typedef long long int ll;
using namespace std;


const ll mod = 1e9+7;
const double eps = 1e-9;




void solve(){
    ll x;
    cin>>x;
    ll ans=0;
    ll tt=100;
    while(tt<x) {
        tt+=(tt/100);
        ans++;
    }
    cout<<ans;
}





int main(){
    fastio
    int test=1;
    while(test--)
        solve();
    return 0;
}


Measured memory_bytes: 3616
#include <iostream>
#include <string>
#include <bits/stdc++.h>
#include <vector>
using namespace std;

int main()
{
    int t, ac = 0, wa = 0, tl = 0, re = 0;
    string s;
    cin >> t;
    for (int i = 0; i < t; i++)
    {

        cin >> s;
        if (s == "AC")
            ac++;
        else if (s == "WA")
            wa++;
        else if (s == "TLE")
            tl++;
        else
            re++;
    }
    cout << "AC x " << ac << "\n" << "WA x " << wa << "\n" << "TLE x " << tl << "\n" << "RE x " << re;
    return 0;
}


Measured memory_bytes: 3592