akhauriyash/Code-Regression huggingface dataset:
#include<string>
#include<vector>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<sstream>
#include<functional>
#include<map>
#include<set>
#include<cmath>

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

#define EPS 1e-6

using namespace std;

bool intriangle(double x1,double y1,double x2,double y2,double x3,double y3,double xp,double yp){

double a=y2-y1;
double b=x1-x2;
double c=y1*(x2-x1)-x1*(y2-y1);

if((a*xp+b*yp+c)*(a*(x1+x2+x3)+b*(y1+y2+y3)+3*c)>0)
return true;
else
return false;
}

int main(){

double x1,y1,x2,y2,x3,y3,xp,yp;

while(true){

cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp;

if(cin.fail()) break;

if(intriangle(x1,y1,x2,y2,x3,y3,xp,yp) && intriangle(x2,y2,x3,y3,x1,y1,xp,yp) && intriangle(x3,y3,x1,y1,x2,y2,xp,yp))
cout << "YES" << endl;
else cout << "NO" << endl;

}

	return 0;
}

Measured memory_bytes: 1216
//
// Created by Administrator on 2020/2/6.
//

#include <bits/stdc++.h>

using namespace std;
const int maxn = 1e5 + 10;
long long a[maxn], pre[maxn], sum[maxn];
char opt[maxn];

int main() {
    int n;
    while (~scanf("%d", &n)) {
        for (int i = 1; i < n; ++i) {
            scanf("%lld %c", &a[i], &opt[i]);
            pre[i] = pre[i - 1] + a[i];
            if (i > 1 && opt[i - 1] == '-') sum[i] = sum[i - 1] - a[i];
            else sum[i] = sum[i - 1] + a[i];
        }
        scanf(" %lld", &a[n]);
        if (opt[n - 1] == '-') sum[n] = sum[n - 1] - a[n];
        else sum[n] = sum[n - 1] + a[n];
        pre[n] = pre[n - 1] + a[n];
        long long ans = sum[n];
        for (int i = 1; i < n; ++i) {
            if (opt[i] == '-') {
                long long temp = 0;
                int j;
                for (j = i + 1; j < n; ++j)
                    if (opt[j] == '-') break;
                temp = sum[i] - (pre[j] - pre[i]) + pre[n] - pre[j];
//                printf("%lld %d %d %lld %lld %lld\n", temp, i, j, sum[i], pre[j], pre[n]);
                ans = max(ans, temp);
            }
        }
        printf("%lld\n", ans);
    }
    return 0;
}



Measured memory_bytes: 2688
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
#define erep(i,n) for(int i = 0;i<=n;i++)
#define rep1(i,n) for(int i = 1;i<n;i++)
#define erep1(i,n) for(int i = 1;i<=n;i++)
typedef long long ll;
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstring vector<string>
#define vdouble vector<double>
#define vll vector<ll>:
#define vbool vector<bool>
#define INF 1101010101010101010
#define MOD 1000000007
#define int long long
using P = pair<int,int>;

signed main(){
  int h,w;
  cin >> h >> w;
  vvint mass(h,vint(w));
  rep(i,h) rep(j,w) cin >> mass[i][j];
  bool judge = false;
  int count = 0;
  vector<vector<int>> ans(300000,vint(4)); 
  rep(i,h){
    if(i % 2 == 0){
      rep(j,w){
        if(i != h-1 || j != w-1){
          if(mass[i][j] % 2 == 1 && !(judge)){
            judge = true;
            if(j == w-1){
              ans[count][0] = i+1;
              ans[count][1] = j+1;
              ans[count][2] = i+2;
              ans[count][3] = j+1;
            }
            else{
              ans[count][0] = i+1;
              ans[count][1] = j+1;
              ans[count][2] = i+1;
              ans[count][3] = j+2;            
            }
            count++;
          }
          else if(mass[i][j] % 2 == 1 && judge){
            judge = false;
          }
          else if(mass[i][j] % 2 == 0 && judge){
            if(j == w-1){
              ans[count][0] = i+1;
              ans[count][1] = j+1;
              ans[count][2] = i+2;
              ans[count][3] = j+1;
            }
            else{
              ans[count][0] = i+1;
              ans[count][1] = j+1;
              ans[count][2] = i+1;
              ans[count][3] = j+2;            
            }
            count++;
          }
        }
      }
    }
    else{
      for(int j = w-1;j >= 0;j--){
        if(i != h-1 || j != 0){
          if(mass[i][j] % 2 == 1 && !(judge)){
            judge = true;
            if(j == 0){
              ans[count][0] = i+1;
              ans[count][1] = 1;
              ans[count][2] = i+2;
              ans[count][3] = 1;
            }
            else{
              ans[count][0] = i+1;
              ans[count][1] = j+1;
              ans[count][2] = i+1;
              ans[count][3] = j;            
            }
            count++;
          }
          else if(mass[i][j] % 2 == 1 && judge){
            judge = false;
          }
          else if(mass[i][j] % 2 == 0 && judge){
            if(j == 0){
              ans[count][0] = i+1;
              ans[count][1] = 1;
              ans[count][2] = i+2;
              ans[count][3] = 1;
            }
            else{
              ans[count][0] = i+1;
              ans[count][1] = j+1;
              ans[count][2] = i+1;
              ans[count][3] = j;            
            }
            count++;
          }
        }
      }
    }
  }
  cout << count << endl;
  rep(i,count){
    cout << ans[i][0] << " " << ans[i][1] << " " << ans[i][2] << " " << ans[i][3] << endl;
  }
}

Measured memory_bytes: 25856
#include<stdio.h>
int main(void){	
	int a,b;
	scanf("%d %d",&a,&b);
	if (a<13&&a>5)
	{
		printf("%d\n", b/2);
	}else if (a<=5)
	{
		printf("0\n");
	}else{
		printf("%d\n",b );
	}
	return 0;
}


Measured memory_bytes: 128
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int ans = 0;
        if(s.equals("RRR")) ans = 3;
        else if(s.equals("RRS") || s.equals("SRR")) ans = 2;
        else if(s.contains("R")) ans = 1;
        System.out.println(ans);
        sc.close();

    }

}


Measured memory_bytes: 35528
//ABC 128 D enque

#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;

typedef long long ll;
ll n,k,v[55];

ll solve(ll l,ll r)
{
   vector<ll> t;
   
   for(int i=0;i<=l;i++)    //枚举：左边取到了L，右边取到了R 
      t.push_back(v[i]);
   
   for(int i=r;i<n;i++)
      t.push_back(v[i]);
   
   sort(t.begin(),t.end());   //为什么要排序？ 贪心？ 
                              //放回操作如何处理？ 
   
   ll lim=k-t.size();          
   if(lim<0)return 0;        //枚举的两端元素过多了
   
   ll sum=0;
   for(int i=0;i<t.size();i++){
      if(t[i]<0&&lim>0){    //取出并“扔掉” 
         lim--;
      }else                 //正数留下 
	     sum+=t[i];
   }
   
   //cout<<l<<" "<<r<<" "<<sum<<endl;
   return sum;
}

int main()
{
   cin>>n>>k;
   
   for(int i=0;i<n;i++)  cin>>v[i];
   
   ll ans=0;
   
   for(int i=-1;i<n;i++)
     for(int j=i+1;j<=n;j++){
        ans=max(ans,solve(i,j));
     }
   
   cout<<ans<<endl;
   return 0;
}



Measured memory_bytes: 256
n,a,b = map(int,input().split())
mod = 10**9 + 7
double = [2]
for _ in range(30):
  tmp = double[-1] ** 2
  tmp %= mod
  double.append(tmp)
#print(double)
ans = 1
m = int(n)
for i in range(32):
  if m % 2 == 1:
    ans *= double[i]
    ans %= mod
  m //= 2
  if m == 0:
    break
def inv(x):
  y = 1
  while x != 1:
    y *= mod // x + 1
    y %= mod
    x -= mod % x
  return y
ta = 1
for i in range(a):
  ta *= n-i
  ta %= mod
  ta *= inv(i+1)
  ta %= mod
tb = 1
for i in range(b):
  tb *= n-i
  tb %= mod
  tb *= inv(i+1)
  tb %= mod
ans -= ta
ans -= tb
ans -= 1
ans %= mod
print(ans)
#print(inv(5))

Measured memory_bytes: 3064
#include <algorithm>
#include <iostream>
#include <limits>
#include <numeric>
#include <string>
#include <type_traits>

#define rep(i, x, n) for (int i = x; i < n; i++)
using namespace std;
const long long INF = 1LL << 60;
int c[11];
int p[11];
int N;
long long G;
int solve(int m, long long sum, int n, int umu[])
{

    if (n == N)
    {
        if (sum >= G)
        {
            // cout << "koe" << endl;
            return m;
        }
        else
        {

            for (int i = N - 1; i >= 0; i--)
            {
                int ten = (i + 1) * 100;
                // cout<<"NO:"<<N - 1 - i<<",umu:"<<umu[N - 1 - i] <<endl;
                if (umu[i] != 1)
                {
                    // {cout<<"tmpsum:"<<(p[N - 1 - i] - 1) * (N - i) * 100 + sum <<endl;
                    if ((p[i] - 1) * (N - i) * 100 + sum >= G)
                    {
                        // cout << "koe2:" <<m +1+ ((G - sum) / ((N - i) * 100))<< endl;
                        return m  + ((G - sum + ten - 1) / ten);
                    }
                    else
                    {
                        sum += (p[i] - 1) * ten;
                        m += p[i] - 1;
                    }
                }
            }
            // cout << "koe3" << endl;
            return 100000;
        }
    }
    int ret1, ret2;
    ret2 = solve(m, sum, n + 1, umu);
    umu[n] = 1;
    ret1 = solve(m + p[n], sum + 100 * (n + 1) * p[n] + c[n], n + 1, umu);
    return min({ret1, ret2});
}
int main()
{
    cin >> N >> G;
    rep(i, 0, N)
    {
        cin >> p[i] >> c[i];
    }
    int U[11];
    cout << solve(0, 0, 0, U) << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <random>
#include <tuple>
#include <iomanip>
#include <cstring>

using namespace std;

typedef long long ll;
//typedef pair<int,int> Pint;
//typedef pair<ll, ll> P;
typedef pair<ll, pair<ll, ll>> P;
//typedef tuple<int,int,int> T;
typedef vector<ll> vec;
typedef vector<vec> mat;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define revrep(i, n) for(ll i = (n-1); i >= 0; i--)
#define pb push_back
#define f first
#define s second
const ll INFL = 1LL << 60;//10^18 = 2^60
const int INF = 1 << 30;//10^9
const ll MOD = 1e9 + 7;
//const ll MOD  = 998244353;
vector<ll> dy = {0, 0, 1, -1, 1, 1, -1, -1, 0};
vector<ll> dx = {1, -1, 0, 0, 1, -1, 1, -1, 0};

ll max(ll a, ll b){return (a > b) ? a : b;}
ll min(ll a, ll b){return (a < b) ? a : b;}
ll pow_long(ll x, ll k){
  ll res = 1;
  while(k > 0){
    if(k % 2) res *= x;
    x *= x;
    k /= 2;
  }
  return res;
}
ll pow_mod(ll x, ll k){
  x %= MOD; x += MOD; x %= MOD;
  ll res = 1;
  while(k > 0){
    if(k % 2){
      res *= x; res %= MOD;
    }
    x *= x; x %= MOD;
    k /= 2;
  }
  return res;
}
ll inverse(ll x){return pow_mod(x, MOD - 2);};

//最大公約数
ll gcd(ll a, ll b){
    if(b == 0) return a;
    return gcd(b, a % b);
}

//最小公倍数
ll lcm(ll x, ll y){return x / gcd(x, y) * y;};

//コンビネーション
const int MAXcomb = 200010;
ll fac[MAXcomb], finv[MAXcomb], inv[MAXcomb];
//facはn!,finvは1/n!
//invは逆元
void COMinit(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < MAXcomb; i++){
        fac[i] = fac[i-1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
        finv[i] = finv[i-1] * inv[i] % MOD;
    }
}
ll comb(int n, int k){
    if(n < k) return 0;
    if(n < 0 || k < 0) return 0;
    return fac[n] * finv[k] % MOD * finv[n-k] % MOD;
}

ll N;
vector<ll> A;

bool cmp(int i, int j){
  return A[i] > A[j];
}

int main(void){
  cin >> N;
  A.resize((1 << N) + 1);
  rep(i, 1 << N) cin >> A[i];
  A[1 << N] = -1;
  vector<pair<ll,ll>> ans(1 << N, {-1, (1 << N)});
  rep(i, (1 << N)){
    ans[i].first = i;
  }

  rep(i, N)rep(j, (1 << N)){
    if((j >> i) & 1){
      vector<ll> x = {ans[j].f, ans[j].s, ans[j-(1 << i)].f, ans[j-(1 << i)].s};
      sort(x.begin(), x.end(), cmp);
      x.erase(unique(x.begin(), x.end()), x.end());
      ans[j] = {x[1], x[0]};
    }
  }
  ll now = -1;
  for(int i = 1; i <= (1 << N)-1; i++){
    now = max(now, A[ans[i].f] + A[ans[i].s]);
    cout << now << endl;
  }

}


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

int main(){
  int W, a, b;
  cin >> W >> a >> b;
  int ans;
  if (b >= (a + W)) ans = b - (a + W);
  else if (a >= (b + W)) ans = a - (b + W);
  else ans = 0;
  cout << ans << endl;
}

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

const int N = 5e3 + 10, mod = 1e9 + 7;

struct edge {
    int to, s, t;
};
vector<edge> adj[55];

int main() {
    // ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int tc = 1; 
    //scanf("%d", &tc);
    while(tc--) {
        int n, m, s; scanf("%d%d%d", &n, &m, &s);
        for(int i = 0; i < m; i++) {
            int u, v, s, t; scanf("%d%d%d%d", &u, &v, &s, &t);
            adj[u].push_back({v, s, t});
            adj[v].push_back({u, s, t});
        }
        vector<int> c(n + 1), d(n + 1);
        for(int i = 1; i <= n; i++) scanf("%d%d", &c[i], &d[i]);
        vector<vector<long long>> dis(n + 1, vector<long long>(N, (1LL << 60)));
        priority_queue<pair<ll, pair<int, int>>, vector<pair<ll, pair<int, int>>>, greater<pair<ll, pair<int, int>>>> q;
        q.push({0, {1, min(s, N - 1)}});
        while(!q.empty()) {
            ll w = q.top().first;
            int u = q.top().second.first;
            int sl = q.top().second.second;
            q.pop();
            if(dis[u][sl] <= w) continue;
            dis[u][sl] = w;
            if(sl + c[u] < N && dis[u][sl + c[u]] > w + d[u]) q.push({w + d[u], {u, sl + c[u]}});
            for(auto x : adj[u]) {
                if(sl - x.s < 0) continue;
                if(dis[x.to][sl - x.s] > w + x.t) q.push({w + x.t, {x.to, sl - x.s}});
            }
        }
        for(int u = 2; u <= n; u++) {
            ll ans = (1LL << 60);
            for(int i = 0; i < N; i++) ans = min(ans, dis[u][i]);
            printf("%lld\n", ans);
        }
    }    
    return 0;
}

Measured memory_bytes: 13600
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define inf LLONG_MAX>>2
#define MAX 1000000
#define mod 1000000007
#define pb push_back
#define f(i,a,n,x) for ((i)=(a);(i)<(n);(i)+=(x))
#define fd(i,a,n,x) for ((i)=(a);(i)>=(n);(i)-=(x))
#define fi first
#define se second
#define mk make_pair
#define pi pair
#define vt vector
#define ms multiset
#define is insert
using namespace std;
void read(vt<ll> &a,ll n){ll i,temp;f(i,0,n,1){cin>>temp;a.pb(temp);}}
ll fa[MAX];
ll power(ll p,ll q){
    ll res=1;
    p%=mod;
    while(q){
        if (q&1)
            res=(res*p)%mod;
        q>>=1;
        p=(p*p)%mod;
    }
    return res;
}
ll fact(ll n){
    if (n<=1)
        return fa[n]=1;
    if (fa[n])
        return fa[n];
    return fa[n]=(n*fact(n-1))%mod;
}
ll ncr(ll n,ll r){
    if (!r)
        return 1;
    return (((fact(n)*power(fact(n-r),mod-2))%mod)*power(fact(r),mod-2))%mod;
}
void solve(){
    ll n,i,n1,count=0;
    vt<ll> a;
    cin>>n;
    if (n==2){
        cout<<1<<endl;
        return;
    }
    n1=n;
    for (i=2;i*i<=(n-1);i++)
        if (!((n-1)%i))
            if ((n-1)/i==i)
                count++;
            else
                count+=2;
    count++;
    for (i=2;i*i<=n;i++)
        if (!(n%i))
            if (n/i==i)
                a.pb(i);
            else{
                a.pb(i);
                a.pb(n/i);
            }
    a.pb(n);
    f(i,0,a.size(),1){
        n1=n;
        while(!(n1%a[i]))
            n1/=a[i];
        if (n1%a[i]==1)
            count++;
    }
    cout<<count<<endl;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll t=1;
    //cin>>t;
    while(t--)
        solve();
    return 0;
}

Measured memory_bytes: 3648
#include<iostream>
#include<string>
using namespace std;
int main(){
  string s;
  cin>>s;
  int a=1,n=0,S=0,w=0,e=0;
  for(int i=0;i<s.size();i++){
  	if(s[i]=='N')n++;
    if(s[i]=='S')S++;
    if(s[i]=='W')w++;
    if(s[i]=='E')e++;
  }
  if(n>0&&S==0)a=0;
  if(w>0&&e==0)a=0;
  if(S>0&&n==0)a=0;
  if(e>0&&w==0)a=0;
  if(a==1)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include<math.h>
#include <algorithm>
using namespace std;

int main(){
	int N,M,tmp;
	scanf("%d",&N);
	scanf("%d",&M);
	int target[M],score[N];
	for(int i=0; i < N; i++)score[i] = 0;

	for(int i=0; i < M; i++)scanf("%d",&target[i]);

	for(int i=0; i < M; i++){
		for(int k = 0; k < N; k++){
			scanf("%d",&tmp);
			if(tmp == target[i]){
				score[k]++;
			}else{
				score[target[i]-1]++;
			}
		}
	}

	for(int i=0; i < N; i++)printf("%d\n",score[i]);

    return 0;
}

Measured memory_bytes: 2672
#include<stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
 
int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}
 
int main()
{
    int N;
    int A[101]={};
  
    int i=0;
    int j=0;
//    int k=0;
    int max=0;
    int max_ans=0;
  
 // 整数の入力
    scanf("%d", &N);
   for(i=0;i<N;i++){
    scanf("%d", &A[i]);
//    printf("%d\n",A[i]);
//     A1l[i]=A1l[i-1]+A1[i];
   }

    qsort(A, 101, sizeof(int), compare_int);
   for(i=0;i<101;i++){
   if((i%2)==0){
   max=max+A[i];
   }else{
   max=max-A[i];
   }

   }
  printf("%d\n",max);


return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
int main(){
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		float x1,x2,x3,x4,y1,y2,y3,y4;
		scanf("%f%f%f%f%f%f%f%f",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
		float k1=(y2-y1)/(x2-x1),k2=(y4-y3)/(x4-x3);
		if(k1==k2)printf("YES\n");
		else printf("NO\n");}
	return 0;}


Measured memory_bytes: 2612
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/




int N, A[201010];
//---------------------------------------------------------------------------------------------------
ll get(int b) {
    ll res = 0;
    rep(i, 0, N) res += abs(A[i] - b);
    return res;
}
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N;
    rep(i, 0, N) {
        cin >> A[i];
        A[i] -= (i + 1);
    }
    sort(A, A + N);

    int x;
    if (N % 2 == 1) x = A[N / 2];
    else x = (A[N / 2 - 1] + A[N / 2]) / 2;

    ll ans = infl;
    chmin(ans, get(x));
    chmin(ans, get(x - 1));
    chmin(ans, get(x + 1));
    cout << ans << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <atcoder/segtree>
#define rep(i, n) for(int i = 0; i < n; i++)
#define vv(T) vector<vector<T>>
#define coa cout << ans << endl; return 0;
using namespace std;
using namespace atcoder;
using ll = long long;
template<typename T>
using vec = vector<T>;
template<typename T>
using vvec = vector<vector<T>>;
using qint = queue<int>;
using sint = stack<int>;
using pii = pair<int, int>;

const int MAX_A = 3e5 + 5;

int op(int a, int b){
    return max(a, b);
}
int e(){
    return 0;
}

int main(){
    ll n, k;
    cin >> n >> k;

    segtree<int, op, e> segtree(MAX_A);
    rep(i, n){
        int x;
        cin >> x;
        int l = x - k, r = x + k + 1;
        l = max(l, 0); r = min(r, MAX_A);
        int present = segtree.prod(l, r) + 1;
        segtree.set(x, present);
    }

    int ans = segtree.prod(0, MAX_A);
    coa;
}


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

#pragma region Macro
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define SORT(v) sort(v.begin(), v.end())
#define pb(a) push_back(a)
#define eb(a) emplace_back(a)
#define vi vector<int>
#define vvi vector<vector<int>>
#define chmax(x,y) (x = max(x,y))
#define chmin(x,y) (x = min(x,y))

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#pragma endregion

class DisjointSet{
	public:
		vector<int> rank, p, nakama;

		DisjointSet(){}
		DisjointSet(int size){
			rank.resize(size, 0);
			p.resize(size, 0);
			nakama.resize(size, 0);
			for(int i=0; i < size; i++) makeSet(i);
		}

		void makeSet(int x){
			p[x] = x;
			rank[x] = 0;
			nakama[x] = 1;
		}

		void unite(int x, int y){
			if(findSet(x) == findSet(y)) return;
			link(findSet(x), findSet(y));
		}

		void link(int x, int y){
			if(rank[x] > rank[y]){
				p[y] = x;
				nakama[x] += nakama[y];
			}
			else{
				p[x] = y;
				nakama[y] += nakama[x];
				if(rank[x] == rank[y]){
					rank[y]++;
				}
			}
		}

		int findSet(int x){
			if(x != p[x]){
				p[x] = findSet(p[x]);
			}
			return p[x];
		}

		// make
		int maxSize(){
			int ret = 0;
			for(int i=0; i < nakama.size(); i++){
				chmax(ret, nakama[i]);
			}

			return ret;
		}
};

void solve(){
	#define int ll
	// ここに処理を記述
	// コンパイル時はエイリアス「gpp」--> c++17でコンパイル
	
	int n, m;
	cin >> n >> m;

	DisjointSet ds = DisjointSet(n);
	rep(i,m){
		int a,b;
		cin >> a >> b;
		a--; b--;
		ds.unite(a,b);
	}

	cout << ds.maxSize() << endl;

}

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	
	solve();
	return 0;
}

Measured memory_bytes: 5568
n, x, y = map(int, input().split())

dic = {}
for i in range(1, n):
  for j in range(i + 1, n + 1):
    a = j - i
    b = abs(x - i) + 1 + abs(j - y)
    c = abs(y - i) + 1 + abs(j - x)
    l = min(a, b, c)
    if l not in dic.keys():
      dic[l] = 1
    else:
      dic[l] += 1
for i in range(1, n):
  print(dic.get(i, 0))

Measured memory_bytes: 9336
NK = list(map(int, input().split()))
Hi = list(map(int, input().split()))

N = NK[0]
K = NK[1]
Hi.sort()
reversed_Hi = list(reversed(Hi))

for i in range(len(reversed_Hi)):
    if not reversed_Hi:
        break

    if K == 0:
        break
    else:
        K -= 1
        reversed_Hi[i] = 0

count = 0
for i in reversed_Hi:
    count += i

print(count)

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n), b(n), c(n);
  for (int i = 0; i < n; i++)
    cin >> a[i] >> b[i] >> c[i];

  vector<vector<int>> dp(n + 1, vector<int>(3));

  for (int i = 1; i <= n; i++) {
    dp[i][0] = max(dp[i - 1][1], dp[i - 1][2]) + a[i - 1];
    dp[i][1] = max(dp[i - 1][0], dp[i - 1][2]) + b[i - 1];
    dp[i][2] = max(dp[i - 1][0], dp[i - 1][1]) + c[i - 1];
  }
  int ans = 0;
  for (int i = 0; i < 3; i++) {
    ans = max(ans, dp[n][i]);
  }
  cout << ans << endl;
}

Measured memory_bytes: 6912
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<queue>
using namespace std;
#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
typedef pair<int, int>P;
const int INF = 1e8;

signed main() {
	int N;
	string S;
	cin >> N >> S;
	vector<int>E(N + 1, 0);
	rep(i, N)E[i + 1] = E[i] + (S[i] == 'E');
	int mn = INF;
	int cnt;
	rep(i, N) {
		cnt = (i - E[i]) + (E[N] - E[i + 1]);
		mn = min(mn, cnt);
	}
	cout << mn;
}

Measured memory_bytes: 2948
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
using namespace std;

int main(){
    int A,X = 1;
    cin >> A;
    string B[A];
    cin >> B [0];
    for (int i = 1; i < A ; i++){
        cin >> B[i];
        int Y=0;
        for (int j = 0;j < i ;j++){
            if (B[j] == B[i]){
                X = 0;
            }
        }
        if (B[i-1].back() != B[i].front()){
            X = 0;
        }

    }
    if (X==0) {
        cout << "No" << endl;
    } else {
        cout << "Yes" <<endl;
    }

}

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

int main() {
  int N, A, B;
  cin >> N >> A >> B;
  // 1≤N≤20
  // 1≤A≤50
  // 1≤B≤50
  // 電車を使うと 1 人あたり A 円かかります。
  // タクシーを使うと N 人で B 円かかります。
  // 最小の合計交通費を表す整数を出力せよ。

  // 電車で移動
  // N * A
  // タクシーで移動
  // B
  if (N * A < B) {
    cout << N * A << endl;
  } else {
    cout << B;
  }

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007LL

typedef long long ll;
typedef pair<ll,ll> P;

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

	ll x, k, d;cin >> x >> k >> d;
	x = abs(x);

	ll kake = x / d;
	if(kake >= k) {
		x -= d * k;
		cout << x << endl;
	}
	else {
		k -= kake;
		x -= d * kake;
		if(k % 2 == 0) {
			cout << x << endl;
		}
		else {
			cout << (d - x) << endl;
		}
	}

	return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
int main()	{
  int x;
  cin>>x;
  int a,b,c;
  a=x/500;
  b=x%500;
  c=b/5;
  int ans=1000*a+5*c;
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
typedef long long lint;
const int N=2e5+5;
const int mod=1e9+7;
int n,lim1,lim2,npos1,npos2,col[N],wgt[N],lpos[N];
int fac[N],ifac[N];
int size[N],*list[N];

inline int nxi(){
	int x=0;
	char c;
	while((c=getchar())>'9'||c<'0');
	while(x=x*10-48+c,(c=getchar())>='0'&&c<='9');
	return x;
}

template <class T> inline int fpow(int x,T t){
	int ans=1;
	for(; t; x=(lint)x*x%mod,t>>=1){
		if(t&1) ans=(lint)ans*x%mod;
	}
	return ans;
}

inline void init(){
	fac[0]=1;
	for(int i=1; i<=n; ++i){
		fac[i]=(lint)fac[i-1]*i%mod;
	}
	ifac[n]=fpow(fac[n],mod-2);
	for(int i=n; i; --i){
		ifac[i-1]=(lint)ifac[i]*i%mod;
	}
}

namespace U{
	int fa[N];
	int find_rt(const int x){
		return fa[x]?fa[x]=find_rt(fa[x]):x;
	}
	inline void link(int x,int y){
		//printf("linked: %d %d\n",x,y);
		x=find_rt(x),y=find_rt(y);
		if(x!=y) fa[x]=y;
	}
}

int solve(const int x){
	static int buk[N];
	int res=fac[size[x]];
	for(int i=0; i<size[x]; ++i){
		++buk[col[list[x][i]]];
	}
	for(int i=0; i<size[x]; ++i){
		if(!buk[col[list[x][i]]]) continue;
		res=(lint)res*ifac[buk[col[list[x][i]]]]%mod;
		buk[col[list[x][i]]]=0;
	}
	return res;
}

int main(){
	n=nxi(),lim1=nxi(),lim2=nxi();
	init();
	wgt[0]=mod;
	for(int i=1; i<=n; ++i){
		col[i]=nxi(),wgt[i]=nxi();
		if(!lpos[col[i]]||wgt[lpos[col[i]]]>wgt[i]){
			lpos[col[i]]=i;
		}
	}
	for(int i=1; i<=n; ++i){
		if(i!=lpos[col[i]]&&wgt[i]+wgt[lpos[col[i]]]<=lim1){
			U::link(i,lpos[col[i]]);
		}
	}
	for(int i=1; i<=n; ++i){
		if(!lpos[i]) continue;
		int tmp=lpos[i];
		if(wgt[npos1]>wgt[tmp]) std::swap(npos1,tmp);
		if(wgt[npos2]>wgt[tmp]) std::swap(npos2,tmp);
	}
	assert(npos1);
	for(int i=1; i<=n; ++i){
		if(npos1&&col[i]!=col[npos1]&&wgt[i]+wgt[npos1]<=lim2){
			U::link(i,npos1);
		}
		if(npos2&&col[i]!=col[npos2]&&wgt[i]+wgt[npos2]<=lim2){
			U::link(i,npos2);
		}
	}
	for(int i=1; i<=n; ++i){
		++size[U::find_rt(i)];
	}
	for(int i=1; i<=n; ++i){
		if(U::find_rt(i)==i){
			list[i]=new int[size[i]];
			size[i]=0;
		}
	}
	for(int i=1; i<=n; ++i){
		int rt=U::find_rt(i);
		list[rt][size[rt]++]=i;
	}
	int ans=1;
	for(int i=1; i<=n; ++i){
		if(U::find_rt(i)==i){
			ans=(lint)ans*solve(i)%mod;
		}
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 13952
// by Balloons
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define mpr make_pair
#define debug() puts("okkkkkkkk")
#define rep(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)

using namespace std;

typedef long long LL;
#define int LL

const int inf = 1 << 30;
const int maxn=1005;

int C[maxn][maxn];
int n,p;
int a[maxn];
int n0,n1,m0,m1;

signed main(){
	scanf("%lld%lld",&n,&p);
//	++n;
	for(int i=1;i<=n;i++){
		scanf("%lld",&a[i]),a[i]%=2;
		if(a[i]==0)++n0;
		else ++n1;
	}
//	a[1]=0;++n0;
	sort(a+1,a+n+1);
	
	C[0][0]=1;
	for(int i=1;i<=1000;i++){
		C[i][0]=1;
		for(int j=1;j<=i;j++)C[i][j]=C[i-1][j]+C[i-1][j-1];
	}
	
	int ans=0;
	for(int i=0;i<=n0;i++){
		for(int j=0;j<=n1;j++){
			if(j%2==p)
				ans+=C[n0][i]*C[n1][j];
		}
	}
	printf("%lld\n",ans);

	return 0;
}


Measured memory_bytes: 7424
from collections import deque

h, w = map(int, input().split())
a = [input() for _ in range(h)]

d = deque()
dist = [[-1] * w for _ in range(h)]
for i in range(h):
    for j in range(w):
        if a[i][j] == '#':
            d.append([i, j])
            dist[i][j] = 0

dy = [-1, 0, 1, 0]
dx = [0, -1, 0, 1]
while d:
    x1, y1 = d.popleft()

    for i in range(4):
        x2 = x1 + dx[i]
        y2 = y1 + dy[i]

        if 0 <= x2 < h and 0 <= y2 < w and dist[x2][y2] == -1:
            d.append([x2, y2])
            dist[x2][y2] = dist[x1][y1] + 1

print(max(list(map(lambda x: max(x), dist))))

Measured memory_bytes: 171812
d={}
n=int(input())
d[0]="pon"
d[1]="pon"
d[2]="hon"
d[3]="bon"
d[4]="hon"
d[5]="hon"
d[6]="pon"
d[7]="hon"
d[8]="pon"
d[9]="hon"
# n=int(input())
print(d[n%10])

Measured memory_bytes: 9192
import math

A, B, N = map(int, input().split())

solved_flag = False
if B==1:
    ans = 0
    solved_flag = True
else:
    if B <= N:
        x = B-1
    else:
        x = N

if not solved_flag:
    ans = math.floor(A*x/B) - A*math.floor(x/B)
print(ans)

Measured memory_bytes: 9068
#include <bit>
#include <bitset>
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <iomanip>

typedef long double ld;
typedef long long ll;

using namespace std;


/* TEMPLATE ENDS HERE */

#define MAXN (1 << 20)

int n;
ll a[MAXN];

ll f(ll x) {
	ll ret = 0;
	for (int i = 0; i < n; i++) {
		ret += llabs(x - a[i]);
	}
	return ret;
}

int main() {
	cout << fixed << setprecision(12);	
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		a[i] -= i + 1;
	}
	sort(a, a + n);
	int lm = n / 2;
	int rm = n + 1 / 2;
	if (n == 1) {
		rm = lm;
	}
	cout << min(f(a[lm]), f(a[rm])) << endl;
/*	ll l = -MAXN, r = MAXN;
	while (r - l > 2) {
		ll m1 = (2 * l + r) / 3;
		ll m2 = (2 * r + l) / 3;
		if (f(m1) > f(m2)) {
			l = m1;
		} else {
			r = m2;
		}
	}
	//cout << l << endl;
	cout << min(min(f(l), f(l + 1)), f(l + 2)) << endl;*/
	return 0;
}


ll MOD = ((ll)1e9 + 7);

struct mod {
	ll x;

	mod(ll tx = 0) {
		x = tx;
		x %= MOD;
	}
	
	mod& operator=(const ll & tx) {
		x = tx % MOD;
		return *this;
	}
	
	mod& operator=(const mod & m2) {
		x = m2.x;
		return *this;
	}

	mod operator+(const mod& m2) const {
		return mod((x + m2.x) % MOD);
	}

	mod& operator+=(const mod& m2) {
		x += m2.x;
		x %= MOD;
		return *this;
	}

	mod operator-(const mod & m2) const {
		return mod((x - m2.x + MOD) % MOD);
	}

	mod& operator-=(const mod & m2) {
		x -= m2.x;
		x = (x + MOD) % MOD;
		return *this;
	}

	mod operator*(const mod & m2) const {
		return mod((x * m2.x) % MOD);
	}

	mod& operator*=(const mod & m2) {
		x *= m2.x;
		x %= MOD;
		return *this;
	}

	mod mypow(ll k) const {
		mod ret = 1;
		mod cur = x;
		while (k) {
			if (k & 1) {
				ret *= cur;
			}
			cur *= cur;
			k >>= 1;
		}
		return ret;
	}

	mod inv() const {
		return mypow(MOD - 2);
	}

	mod operator/(const mod & m2) const {
		return (*this) * m2.inv();
	}

	mod& operator/=(const mod & m2) {
		x *= m2.inv().x;
		x %= MOD;
		return *this;
	}

	bool operator<(const mod & m2) const {
		return x < m2.x;
	}
};

ostream &operator<<(ostream & os, const mod & m) {
	return os << m.x;
}



Measured memory_bytes: 5148
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll mod=1000000007;
int main() {
	ll i,j,k,l,m,n,t;
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	cin>>j>>k;
	l=2-j;
	for(i=0;i<100;i++)
	{
	    l=l-1+j;
	    if(l>=k)
	    {
	        cout<<i<<endl;
	        return 0;
	    }
	}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>
#include <queue>
#include <string>
#include <map>
#include <set>

using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORIT(it, c) for (__typeof((c).begin())it = (c).begin(); it != (c).end(); it++)
#define MEMSET(v, h) memset((v), h, sizeof(v))

struct State {
  int left;
  int right;
  int sum;
  State() {;}
  State(int left, int right, int sum) : left(left), right(right), sum(sum) {;}
  bool operator<(const State &rhs) const {
    if (left != rhs.left) { return left < rhs.left; }
    if (right != rhs.right) { return right < rhs.right; }
    return sum < rhs.sum;
  }
};

double memo[10][1 << 9][200];
int card[2][18];
double calc(int depth, int right, int sum, int rsum) {
  if (!isnan(memo[depth][right][sum])) { return memo[depth][right][sum]; }
  if (sum > 85) { return 1.0; }
  if (rsum > 85) { return 0.0; }
  assert(depth != 10);
  double ret = 0.0;
  REP(j, 9) {
    if (right & (1 << j)) { continue; }
    int ndepth = depth + 1;
    int nright = right | (1 << j);
    int v = card[0][depth] + card[1][j];
    int nsum = sum + (card[0][depth] > card[1][j] ? v : 0);
    int nrsum = rsum + (card[0][depth] < card[1][j] ? v : 0);
    ret += calc(ndepth, nright, nsum, nrsum);
  }
  ret /= 9 - depth;
  return memo[depth][right][sum] = ret;
};

int main() {
  int test;
  scanf("%d", &test);
  while (test--) {
    MEMSET(memo, -1);
    REP(iter, 2) {
      REP(i, 9) {
        scanf("%d", &card[iter][i]);
      }
    }


    double ans = calc(0, 0, 0, 0);
    ans = max(ans, 0.0);
    ans = min(ans, 1.0);
    printf("%.5f %.5f\n", ans, 1.0 - ans);
  }
}

Measured memory_bytes: 8904
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<pair<int,int>> vp;
typedef pair<int,int> pii;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
#define sz(a) a.size()
const ll MOD = 1e9+7;
const int MAX = 10000000;
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
//cout << 'H' << endl;
//next_permutation(ALL(p));
//typedef priority_queue<int> pque;//これは大きい順
//typedef priority_queue<int, vector<int>, greater<int>> pque;//これは小さい順


int main(){
	int n;
	cin >> n;
	vector<int> d(n);
	rep(i,n) cin >> d[i];

	int ans=0;
	rep(i,n) FOR(j,i+1,n){
		ans += d[i]*d[j];
	}

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


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

int main(){
	int a,b;
	cin>>a>>b;
	
	int count=0;
	for(int i=a;i<=b;i++){
		string c=to_string(i);
		
		if(c[0]==c[4]&&c[1]==c[3]) count++;
	}
	
	cout<<count<<endl;
	
	return 0;
}

Measured memory_bytes: 256
// When you are hungry for something and you're determined and you're focused 
// and you're committed to something it's hard to surrender, isn't it?

#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define endl "\n"
#define ll long long 
#define int ll
#define mod 1000000007
#define mod1 1000000006
#define modi 998244353
#define setbit(x) __builtin_popcount(x)
#define fff(i,n) for(int i=0;i<n;i++)
#define ff first
#define ss second
#define pb push_back
vector<ll> vi[300005];
int color[100005];
ll pa[500005];
ll si[500005];
#define pb push_back
bool visi[1000005]={false};
bool is[100005];
ll fac[10000001];
ll prime[400005];
ll bit[100005];
const long double eps = 1.0e-14;      // allowable error
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL);
 
 
void fact(){
    fac[0]=1;
    for(int i=1;i<=10000000;i++){
        fac[i]=(fac[i-1]*i)%mod;
    }
    return ;
}
void sieve(){
    prime[0]=0;
    prime[1]=0;
    for(int i=2;i<400005;i++){
        prime[i]=1;
    }
    for(int i=2;i*i<400005;i++){
        if(prime[i]==1){
            for(int j=i*i;j<400005;j+=i){
                prime[j]=0;
            }
        }
    }
    
}
 
ll power(ll n , ll p ){
    if(p==0)
        return 1;
    
    ll res = power((n*n)%mod,p/2);
    if(p%2==1)
        res = (n*res)%mod;
    
    return res;
}
 
 
void upd(ll i,ll val,ll n) {
    for(;i<=n;i+=i&(-i))
        bit[i]+=val;
}
 
ll qry(ll i) {
    ll sum=0;
    for(;i>0;i-=i&(-i))
        sum+=bit[i];
    return sum;
}
 
 
ll fin(ll u) {
    if(pa[u]==u)
        return u;
    return fin(pa[u]);
}
 
void uni(ll u,ll v) {
    ll p1=fin(u);
    ll p2=fin(v);
    if(p1==p2)
        return;
    if(si[p1]<si[p2])
        swap(p1,p2);
    si[p1]+=si[p2];
    pa[p2]=p1;
    return;
}
 
int32_t main() {
    fio
    
    int n,a;
    cin >> n >> a;
    
    int ans=0;
    if(n%a>0) {
        ans+=1;
    }
    ans +=(n/a);
    cout << ans;

	return 0;
    
}

Measured memory_bytes: 8832
# -*- coding: utf-8 -*-

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
#from math import gcd
import bisect
from collections import defaultdict
from collections import deque
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

######OUTPUT######
def Yes(): print("Yes"); return
def No(): print("No"); return

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr

#####MakeDivisors######
def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#####BitCount#####
def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count

#####ChangeBase#####
def Base_10_to_n(X, n):
  if X//n:
    return Base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def Base_n_to_10(X, n):
  return sum(int(str(X)[-i])*n**i for i in range(len(str(X))))

#####IntLog#####
def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count

#############
# Main Code #
#############

A,B,C,D = inputIL()

b1 = (1<<B)-(1<<A)
b2 = (1<<D)-(1<<C)
ans = b1 & b2
print(count_bit(ans))

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

const int inf = 1e9;
const ll linf = 1e18;




int main()
{
    int n; ll k; 
    cin >> n >> k;
    vector<ll> a(n), f(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 0; i < n; i++) cin >> f[i];
    
    sort(a.begin(), a.end());
    sort(f.begin(), f.end(), greater<int>());

    ll maxx = 0;
    for (int i = 0; i < n; i++) maxx = max(maxx, a[i] * f[i]);

    auto OK = [&](ll key) -> bool {
        ll _k = k;
        for (int i = 0; i < n; i++) {
            ll t = a[i] * f[i];
            if (t > key) _k -= (t - key + f[i] - 1) / f[i];
        }
        return _k >= 0;
    };

    ll left = -1, right = maxx;
    while (right - left > 1) {
        ll mid = (left + right) / 2;
        if (OK(mid)) right = mid;
        else left = mid;
    }

    cout << right << endl;
    return 0;
}

Measured memory_bytes: 3328
import Data.List
import Data.Tuple
import Data.Monoid
import Data.Foldable

oper (a, b) = let h = div a 2 in (b+h, h)

f [a, b, k] = (if odd k then swap else id) $ appEndo (foldMap Endo (replicate k oper)) (a, b)

joinTuple (a, b) = show a ++ " " ++ show b

main = do
    map read . words <$> getLine >>= putStrLn . joinTuple . f

Measured memory_bytes: 508
#include<iostream>
#include<string>
using namespace std;
int main()
{
  string s;
  cin>>s;
  
    if((s[2]==s[3]) && (s[4]==s[5]))
  {
    cout<<"Yes"<<endl;
    }
    else
    {
      cout<<"No"<<endl;
  }
  return 0;
}


Measured memory_bytes: 3076
#include<cstdio>
int n,ans=100005;
int main()
{
	scanf("%d",&n);
	for(int i=1;i*2<=n;i++)
	{
		int a=i,b=n-i,cnt=0;
		while(a)
		{
			cnt+=a%10;
			a/=10;
		}
		while(b)
		{
			cnt+=b%10;
			b/=10;
		}
		if(cnt<ans) ans=cnt;
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 128
<?php   
    fscanf(STDIN,"%s",$n);
	//explode(" ",trim(fgets(STDIN));
	

   if($n[strlen($n)-1] == 0 || 
      $n[strlen($n)-1] == 1 ||
      $n[strlen($n)-1] == 6 ||
      $n[strlen($n)-1] == 8){
     echo "pon\n";
   }elseif($n[strlen($n)-1]==3){
     echo "bon\n";
   }else{
     echo "hon\n";
   }



Measured memory_bytes: 16196
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
fn main() { 
    println!("{}", {
        input!{
            s: chars,
        }
        s.iter().take(s.len() / 2)
            .zip(s.iter().rev().take(s.len() / 2))
            .filter(|&(&a, &b)| { a != b })
            .count()
    });
}


Measured memory_bytes: 4352
import java.util.Scanner;
import java.util.Arrays;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int p=0;
        int[] a=new int[100000];
        while(true){
            a[p]=sc.nextInt();
            if(a[p]==0)break;
            p++;
        }
        for(int i=0;i<p;i++)System.out.println("Case "+(i+1)+": "+a[i]);
    } 
}


Measured memory_bytes: 43144
import numpy as np
def eratosthenes(n):
    is_prime = np.ones((n+1,), dtype=bool)
    is_prime[:2] = False
    for i in range(2,n+1):
        if is_prime[i]:
            is_prime[i*2::i]=False
    return np.arange(n+1)[is_prime]
Ps = eratosthenes(1000)
def divisor(n):
    for p in Ps:
        if p*p>n:return -1
        if n%p==0:return p
def prime_division(n):
    d={}
    while n>1:
        p=divisor(n)
        if p==-1:d[n]=d.get(n,0)+1;break
        else:d[p]=d.get(p,0)+1;n//=p
    return d

N=int(input())
d={}
for i in range(1,N):
  p=prime_division(i+1)
  for k,v in p.items():
    d[k]=d.get(k,0)+v
r=1
for v in d.values():
  r=r*(v+1)%1000000007
print(r)

Measured memory_bytes: 12508
#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <cstring>
#include <iomanip>
#include <cmath>
#include <tuple>
#include <map>
#include <unordered_map>
using namespace std;
typedef long long ll;

int main(int argc, char *argv[])
{
    ll x;
	ll now = 100;
	ll count = 0;
	cin >> x;
	do {
		now += now / 100;
		count++;
	} while (now < x);

	cout << count << endl;

	return 0;
}


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

using namespace std;

int main()
{
    int n;
    cin>>n;
    string s,t;
    cin>>s;
    cin>>t;
    int i;
    for(i=0;i<n;i++)
    {
        cout<<s[i]<<t[i];
    }
}


Measured memory_bytes: 256