akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

/* typedef */

typedef pair<int,int> pii;

/* global variables */

int bscs[4][13], mps[9];
string crds[5];
pii cs[5];

/* subroutines */

pii parse(string crd) {
  int d, s;

  switch (crd[0]) {
  case 'A': d = 0; break;
  case 'T': d = 9; break;
  case 'J': d = 10; break;
  case 'Q': d = 11; break;
  case 'K': d = 12; break;
  default: d = crd[0] - '1';
  }

  switch (crd[1]) {
  case 'S': s = 0; break;
  case 'C': s = 1; break;
  case 'H': s = 2; break;
  case 'D': s = 3; break;
  }

  return pii(d, s);
}

bool flush() {
  int s = cs[0].second;
  for (int i = 1; i < 5; i++)
    if (cs[i].second != s) return false;
  return true;
}

bool straight() {
  if (cs[0].first == 0 && cs[1].first == 9) {
    for (int i = 2; i < 5; i++)
      if (cs[i].first != 8 + i) return false;
    return true;
  }

  int d = cs[0].first;
  for (int i = 1; i < 5; i++)
    if (cs[i].first != d + i) return false;
  return true;
}

void pairs(int *pns) {
  int cns[13];
  memset(cns, 0, sizeof(cns));
  memset(pns, 0, sizeof(int) * 5);

  for (int i = 0; i < 5; i++) cns[cs[i].first]++;
  for (int i = 0; i < 13; i++) pns[cns[i]]++;
}

int hand() {
  bool sf = straight();
  bool ff = flush();

  if (sf && ff) {
    // Royal Straight Flush
    if (cs[0].first == 0 && cs[1].first == 9) return 8;
    // Straight Flush
    return 7;
  }

  int pns[5];
  pairs(pns);

  // Four Cards
  if (pns[4] == 1) return 6;
  // Full House
  if (pns[3] == 1 && pns[2] == 1) return 5;

  // Flush
  if (ff) return 4;

  // Straight
  if (sf) return 3;

  // Three Card
  if (pns[3] == 1) return 2;

  // Two Pair
  if (pns[2] == 2) return 1;

  // One Pair
  if (pns[2] == 1) return 0;

  // Buta
  return -1;
}

/* main */

int main() {
  for (bool first = true;; first = false) {
    int n;
    cin >> n;
    if (cin.eof()) break;
    
    for (int i = 0; i < 4; i++)
      for (int j = 0; j < 13; j++) cin >> bscs[i][j];

    for (int i = 0; i < 9; i++) cin >> mps[i];

    if (! first) cout << endl;
    
    while (n--) {
      for (int i = 0; i < 5; i++) {
	cin >> crds[i];
	cs[i] = parse(crds[i]);
      }
      sort(cs, cs + 5);

      int h = hand();
      int sc = 0;

      if (h >= 0) {
	int sum = 0;
	for (int i = 0; i < 5; i++)
	  sum += bscs[cs[i].second][cs[i].first];
	sc = sum * mps[h];
      }

      cout << sc << endl;
    }
  }

  return 0;
}

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


signed main(){
    int a, b, c;
    int count = 0;

    cin >> a >> b >> c;

    for(int i = a; i <= b; i++){
        if(c % i == 0){
            count += 1;
        }
    }

    std::cout << count << std::endl;

    return 0;
}


Measured memory_bytes: 3092
#include<iostream>
#include<cstdlib>
#include<string>
#include<vector>
#include<cstring>
using namespace std;

int main() {

	int h, n;

	cin >> h >> n;

	vector<int> a(n);

	int i;
	for (i = 0; i < n; i++) {
		cin >> a[i];
		h -= a[i];
	}

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

	return 0;
}


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

const int N = 100005;
const int L = 18;

vector < pair < int, pair < int, int > > > g[N];
vector < pair < int, pair < int, pair < int, int > > > > queries[N];
int ant[N][L], nv[N], ans[N], dist[N];
vector < int > rememberList[N];
map < int, int > remember[2][N];
map < int, int > now[2];

void build(int u, int p)
{
	ant[u][0] = p;
	for (int i=1; i<L; i++){
		ant[u][i] = ant[ant[u][i-1]][i-1];
	}
	for (pair < int, pair < int, int > > v : g[u])
	{
		if(v.first == p) continue ;
		nv[v.first] = nv[u]+1;
		dist[v.first] = dist[u] + v.second.second;
		build(v.first, u);
	}
}

int lca(int u, int v)
{
	if(nv[u] < nv[v]) swap(u, v);
	for (int i=L-1; i>=0; i--)
	{
		if(nv[ant[u][i]] >= nv[v]){
			u = ant[u][i];
		}
	}
	if(u == v) return u;
	for (int i=L-1; i>=0; i--)
	{
		if(ant[u][i] != ant[v][i])
		{
			u = ant[u][i], v = ant[v][i];
		}
	}
	return ant[v][0];
}

void solve(int u, int p)
{
	for (int x : rememberList[u])
	{
		remember[0][u][x] = now[0][x];
		remember[1][u][x] = now[1][x];
	}

	for (auto x : queries[u]){
		int LCA = x.first;
		int id = x.second.second.second;
		ans[id] -= (now[1][x.second.first] - remember[1][LCA][x.second.first]);
		ans[id] += ((now[0][x.second.first] - remember[0][LCA][x.second.first]) * x.second.second.first);
		// cout << id << ' ' << u << ' ' << remember[1][LCA][x.second.first] << ' ' << 
	}

	for (pair < int, 	pair < int, int > > v : g[u])
	{
		if(v.first == p) continue ;
		now[0][v.second.first]++;
		now[1][v.second.first] += v.second.second;
		solve(v.first, u);
		now[0][v.second.first]--;
		now[1][v.second.first] -= v.second.second;
	}
}

int main()
{
	int n, q;
	scanf("%d %d", &n, &q);
	for (int i=0; i<n-1; i++){
		int u, v, c, d;
		scanf("%d %d %d %d", &u, &v, &c, &d);
		g[u].push_back({v, {c, d}});
		g[v].push_back({u, {c, d}});
	}
	nv[1] = 0;
	build(1, 1);
	for (int i=0; i<q; i++){
		int x, y, u, v;
		scanf("%d %d %d %d", &x, &y, &u, &v);
		int LCA = lca(u, v);
		rememberList[LCA].push_back(x);
		queries[u].push_back({LCA, {x, {y, i}}});
		queries[v].push_back({LCA, {x, {y, i}}});
		ans[i] = dist[u] + dist[v] - 2*dist[LCA];
	}
	solve(1, 1);
	for (int i=0; i<q; i++)
	{
		printf("%d\n", ans[i]);
	}
}


Measured memory_bytes: 57596
#include "bits/stdc++.h"
#define rep(i,b) for(ll i=0;i<b;i++)
#define ll long long
using namespace std;
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vvvl vector<vector<vector<ll>>>
#define debug(x) cerr<<#x<<" "<<x<<'\n';

int main() {
    ll n,b,x;
    set<ll> a;
    rep(i,3){
        cin>>b;
        a.insert(b);
    }
    if(a.size()==2){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
}


Measured memory_bytes: 256
// AtCoder150 C

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <math.h>
#include <assert.h>
#include <string.h>
#include <memory.h>
#include <malloc.h>
#include <stdlib.h>
#include <ctype.h>

// qsortで用いる比較用関数．*a<*bならaが先になる．
int compare(const void* a, const void* b) {
    return *(int*)a - *(int*)b;
}

int revcompare(const void* a, const void* b) {
    return *(int*)b- *(int*)a;
}

int main(void)
{
    int i,j,n;

    int a,b;
    scanf("%d %d", &a, &b);

    char* s = (char*)malloc(sizeof(char) * (a + b + 2));
    scanf("%s", s);
    for(i=0;i<strlen(s);i++){
        if(i == a){
            if(s[i] != '-'){
                printf("No");
                return 0;
            }
        }else{
            if(!(s[i] >= '0'&&s[i] <= '9')){
                printf("No");
                return 0;
            }
        }
    }
    printf("Yes");

    return 0;

}


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

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;
typedef vector<pll> vpl;

#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define ZERO(a) memset(a,0,sizeof(a))

const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

vector<vector<vll>> dp(62, vector<vll>(50, vll(50)));
vector<vll> e(50,vll(50));
vector<vll> multi(vector<vll> a, vector<vll> b){
  vector<vll> res(a.size(),vll(b[0].size()));
  REP(i,a.size()){
    REP(j,b[0].size()){
      REP(g,a[0].size()){
        res[i][j] += a[i][g]*b[g][j];
        res[i][j] %= MOD;
      }
    }
  }

  return res;
}

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

  ll n,k;
  cin>>n>>k;

  REP(i,n)REP(j,n)cin>>dp[0][i][j];

  REP(h,61){
    REP(i,n){
      REP(j,n){
        REP(g,n){
          dp[h+1][i][j] += dp[h][i][g]*dp[h][g][j];
          dp[h+1][i][j] %= MOD;
        }
      }
    }
  }

  REP(i,n)REP(j,n)e[i][j]=0;
  REP(i,n)e[i][i]=1;

  ll power=0;
  while(pow(2,power)<=k){
    if((k>>power)&1)
      e=multi(dp[power],e);
    power++;
  }

  ll ans=0;
  REP(i,n)REP(j,n)ans=(ans+e[i][j])%MOD;
  cout<<ans<<endl;

}


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

int main() {
  int n;
  cin>>n;
  long long a[n+1],sum=0,now=1,ans=1;
  for(int i=0;i<n+1;i++){
    long long l;
    cin>>l;
    a[i]=l;
    sum+=a[i];
  }
  bool tf=true;
  if(a[0]!=0)tf=false;
  if(a[0]==1&&n==0)tf=true;
  for(int i=1;i<=n;i++){
    if(2*now<a[i]){
      tf=false;
      break;
    }
    if(sum<now*2){
      now=sum;
    }
    else{
      now*=2;
    }
    ans+=now;
    now-=a[i];
    sum-=a[i];
  }
  if(tf)cout<<ans<<endl;
  else cout<<-1<<endl;
}

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

void chmin(int &a, int b) {
    if (a > b) a = b;
}

int main() {
    int h, w;
    cin >> h >> w;
    vector<string> s(h);
    for (int i = 0; i < h; i++) {
        cin >> s[i];
    }
    vector<vector<int>> ans(h, vector<int>(w, 1e6));
    ans[0][0] = (s[0][0] == '#');
    for (int i = 0; i < h - 1; i++) {
        ans[i+1][0] = ans[i][0] + (s[i][0] == '.' && s[i+1][0] == '#');
    }
    for (int i = 0; i < w - 1; i++) {
        ans[0][i+1] = ans[0][i] + (s[0][i] == '.' && s[0][i+1] == '#');
    }
    for (int i = 1; i < h; i++) {
        for (int j = 1; j < w; j++) {
            int num1 = ans[i-1][j] + (s[i-1][j] == '.' && s[i][j] == '#');
            int num2 = ans[i][j-1] + (s[i][j-1] == '.' && s[i][j] == '#');
            chmin(ans[i][j], num1);
            chmin(ans[i][j], num2);
        }
    }
    cout << ans[h-1][w-1] << endl;
}

Measured memory_bytes: 3676
n = int(input())

aa =[]
i = 0
score = 0

while score < n:
  i += 1
  score += i
  aa.append(i)
  
if score == n:
  for k in range(len(aa)):
    print(aa[k])
    
else:
  aa.remove(score - n)
  for k in range(len(aa)):
    print(aa[k])

Measured memory_bytes: 9288
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
#define pq_pair_tB priority_queue <pair<ll,ll>, vector<pair<ll,ll> > , greater<pair<ll,ll> > >
#define pq_pair_ts priority_queue <pair<ll,ll> > //第二成分の大きさが関係ない
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}

char m[101][101];

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

    rep(i, 101)rep(j, 101) m[i][j] = '-';

    ll H , W ;
    cin >> H >> W;

    rep(i, H){
        string s;
        cin >> s;

        rep(j, W){
            m[i][j] = s[j];
        }
    }

    rep(i, H){
        bool flag = true;
        rep(j, W){
            if(m[i][j] == '#') flag = false;
        }
        if(flag) rep(j, W) m[i][j] = '-';
    }

    rep(j, W){
        bool flag = true;
        rep(i, H){
            if(m[i][j] == '#') flag = false;
        }
        if(flag) rep(i, H) m[i][j] = '-';
    }

    cerr << "-----------------" << endl;

    rep(i, 101){
        string ans = "";
        rep(j, 101){
            if(m[i][j] == '-') continue;
            ans += m[i][j];
        }
        if(ans != "") cout << ans << endl;

    }


	//cout << fixed << setprecision(16) << ans << endl;
	return 0;
}


Measured memory_bytes: 256
import numpy as np

N = int(input())
H = np.array(input().split(), dtype=np.int32)

"""
A = [10,4,8,7,3]
left_idx = [0,0,2,2,2]
というものを作る
"""
left_idx = np.arange(N)
left_idx[1:][H[:-1] >= H[1:]] = 0
np.maximum.accumulate(left_idx, out=left_idx)

ans = (np.arange(N) - left_idx).max()
print(ans)

Measured memory_bytes: 24232
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define bit(n) (1<<(n))
#define fi first
#define se second
#define ii(x) int x; cin >> (x)
#define ii2(x, y) int x, y; cin >> (x) >> (y)
#define ii3(x, y, z) int x, y, z; cin >> (x) >> (y) >> (z)
#define yn(x, ok, ng) cout << ((x)?(ok):(ng)) << endl
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
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;}
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
int const INF = 1001001001;

int n,a,b,c;
int l[10];
int ans;

void dfs (vector<int> table, int v) {
    table.push_back(v);
    if(SZ(table) == n) {
        vi vec(3), cnt(3);
        rep(i,n) {
            rep(j, 3) {
                if(table[i] == j) vec[j] += l[i], cnt[j]++;
            }
        }
        if (cnt[0] != 0 && cnt[1] != 0 && cnt[2] != 0) {
            sort(vec.rbegin(), vec.rend());
            int cur = abs(a - vec[0]) + abs(b - vec[1]) + abs(c - vec[2]);
            rep(j,3) cur += 10 * (cnt[j] - 1);
            chmin(ans, cur);
        }
    }
    else {
        rep(nv, 4) {
            dfs(table, nv);
        }
    }
}

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

cin >> n >> a >> b >> c;
rep(i,n) cin >> l[i];

ans = INF;
rep(sv , 4) dfs({}, sv);
cout << ans << endl;
return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define c(P)        cout<<P<<"\n"
#define pii         pair<ll,ll>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define F           first
#define S           second
#define sz(a)       (ll)(a.size())
#define cr(P)       cout<<P<<"\n";return;
#define mem(a,val)  memset(a,val,sizeof(a))
#define fr(i,x,n)   for(ll i=x;i<n;i++)
#define frr(i,x,n)  for(ll i=n-1;i>=x;i--)
using namespace std;


const ll N   =  500005;
const ll mod = 1e9 + 7;



void solve(){

  ll x=0,y=0,c=0,ans=0;
  ll n,m,k;
  cin>>n;
  
  vector<ll>a(n+1);
  for (ll i = 1; i < n; ++i){
  cin>>x;
  a[x]++;
  }
  for (ll i = 1; i <= n; ++i){
  		
  	cout << a[i] << "\n"; 
  }
}

signed main(){
     
  ios_base::sync_with_stdio(false);   
  cin.tie(NULL);
  //int T;cin >> T;while (T--)
  solve();
  return 0;
}


Measured memory_bytes: 4784
h , w = map(int, input().split())
a = [list(map(int,input().split())) for i in range(h)]

ans=[]

c=0
for i in range(h):
    if i%2==0:
        for j in range(w):
            if c==0 and a[i][j]%2==1:
                c=1
            if c==2:
                c=0
            if c==1 and j<w-1:
                ans.append([str(i+1),str(j+1),str(i+1),str(j+2)])
                if a[i][j+1]%2==1:
                    c=2
            elif c==1 and j==w-1 and i+1<=h-1:
                ans.append([str(i+1),str(j+1),str(i+2),str(j+1)])
                if a[i+1][j]%2==1:
                    c=2
    if i%2==1:
        for j in range(w):
            if c==0 and a[i][w-1-j]%2==1:
                c=1
            if c==2:
                c=0
            if c==1 and j<w-1:
                ans.append([str(i+1),str(w-j),str(i+1),str(w-j-1)])
                if a[i][w-j-2]%2==1:
                    c=2
            elif c==1 and j==w-1 and i+1<=h-1:
                ans.append([str(i+1),str(w-j),str(i+2),str(w-j)])
                if a[i+1][w-1-j]%2==1:
                    c=2
print(len(ans))
for i in ans:
    print(' '.join(i))


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

int main() {
  int N, M;
  cin >> N >> M;
  int x;
  vector<int> a(N);
  
  for (int i=0; i<M*2; i++) {
    cin >> x;
    a.at(x-1)++;
  }
  
  for (int i=0; i<N; i++)
    cout << a.at(i) <<endl;
    
}


Measured memory_bytes: 256
#include<stdio.h>

int main()
{
    int h,w,i,j,kari,num=0;
	int a[501][501],b[501][501];
	scanf("%d %d",&h,&w);
	for(i=0;i<h;i++)
	{
		for(j=0;j<w;j++)
		{
			scanf("%d",&kari);
			a[i][j]=kari;
			b[i][j]=kari;
		}
	}
	
	for(i=0;i<h;i++)
	{
		for(j=0;j<w;j++)
		{
			if(a[i][j]%2==1&&(!(i==(h-1)&&j==(w-1))))
			{
				if(j!=(w-1))//右
				{
					a[i][j+1]++;
				}
				else//下
				{
					a[i+1][j]++;
				}
				num++;
			}
		}
	}
	printf("%d\n",num);
	for(i=0;i<h;i++)
	{
		for(j=0;j<w;j++)
		{
			if(b[i][j]%2==1&&(!(i==(h-1)&&j==(w-1))))
			{
				if(j!=(w-1))//右
				{
					b[i][j+1]++;
					
					printf("%d %d %d %d\n",i+1,j+1,i+1,j+2);
				}
				else//下
				{
					b[i+1][j]++;
					printf("%d %d %d %d\n",i+1,j+1,i+2,j+1);
				}
			}
		}
	}
}


Measured memory_bytes: 3968
use std::io;
use std::io::Read;

fn main () {
    let mut lines = String::new();
    io::stdin().read_to_string(&mut lines).unwrap();

    let mut results = String::new();
    for line in lines.split('\n') {
        if line == "" {
            break;
        }
        let mut line_iter = line.split_whitespace();
        let n: i64 = line_iter.next().unwrap().parse().unwrap();
        let k: i64 = line_iter.next().unwrap().parse().unwrap();

        let mut count: i64 = 0;
        if k == 0 {
            count = n * n;
        } else {
            let min = k + 1;
            for b in min..(n+1) {
                count += (n/b) * (b-k);
                if (n%b) - k >= 0 {
                    count += (n%b) - k + 1;
                }
            }
        }
        results += &format!("{}\n", count);
    }
    println!("{}", results);
}

Measured memory_bytes: 4352
#include <stdio.h>
#include <string.h>

int main(void)
{
	char a[8];
	char s[101];
	char c[8];
	
	scanf("%s %s %s", a, s, c);
	printf("%c%c%c", a[0], s[0], c[0]);
	
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a,b;
  cin>>a>>b;
  int j=a+b;
  int k=a-b;
  int l=a*b;
  vector<int>tor(3);
  tor={j,k,l};
  sort(tor.begin(),tor.end());
  cout<<tor[2]<<endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define big 1000000007
#define all(a) sort((a).begin(),(a).end()) //ソートのマクロ
#define Re(a) reverse((a).begin(),(a).end())
#define YN(a) if(a){cout<<"Yes"<<endl;}else cout<<"No"<<endl;//条件によってYes、Noを出力する
#define ld long double
int main(){
    int64_t n,d;
    cin>>n>>d;
    vector<int64_t> x(n),y(n);
    int ans=0;
    rep(i,n){
        cin>>x[i]>>y[i];
        if(d*d >=x[i]*x[i]+y[i]*y[i])ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 6308
import java.util.Scanner

object Main {

  def solve(sc: => Scanner): Unit = {
    val N, M = sc.nextInt
    if (N != 0 && M != 0) {
      var ans = 0;
      val A = Array.fill[Array[Int]](N)(Array.fill[Int](M)(sc.nextInt));
      for (i <- 0 until N - 2) {
        for (j <- 0 until M - 2) {
          for (k <- i + 2 until N) {
            for (l <- j + 2 until M) {
              var minv = 1 << 30;
              for (m <- i to k) {
                minv = math.min(minv, A(m)(j));
                minv = math.min(minv, A(m)(l));
              }

              for (m <- j to l) {
                minv = math.min(minv, A(i)(m));
                minv = math.min(minv, A(k)(m));
              }


              var sum = 0;
              for (m <- i + 1 until k) {
                for (n <- j + 1 until l) {
                  if (A(m)(n) >= minv) {
                    sum = -1000000000;
                  }
                  sum += minv - A(m)(n);
                }
              }
              ans = math.max(ans, sum);
            }
          }
        }
      }
      println(ans);
      solve(sc);
    }
  }

  def main(args: Array[String]): Unit = {
    val sc: Scanner = new Scanner(System.in)
    solve(sc)
  }
}

Measured memory_bytes: 72140
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int INF=1e9;

int main(){
    int n;
    string s;
    cin>>n>>s;
    int cnt=0,ans=0;
    for(int i=0;i<n;i++){
        if(s[i]=='I')cnt++;
        else cnt--;
        ans=max(ans,cnt);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
// Author:: MUKUL KUMAR RAI
// Institution:: Jalpaiguri Government Engineering College
//If you are not doing well now just stick to it and learn new things one day you will be...
//Compete with yourself 
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define ld long double
#define fi first
#define se second
#define pb push_back
///*template{{{
#define sz(x) (ll)x.size()
#define all(x) (x.begin(),x.end())
#define trav(a,x) for(auto &a:x)
#define fr(i,a,b)  for(ll i=a;i<=b;i++)
#define fr1(i,a)   for(ll i=0;i<a;i++)
#define frr(i,a,b) for(ll i=b;i>=a;i--)
#define frr1(i,a)   for(ll i=a-1;i>=0;i--)
#define sorta(a,n) sort(a,a+n)
#define sortd(a,n) sort(a,a+n,greater<ll>())
#define sortva(a) sort(a.begin(),a.end())
#define sortvd(a) sort(a.begin(),a.end(),greater<ll>())
#define tc(t) while(t--)
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);
using vi= vector<ll>;
using vvi= vector<vi>;
using vb =vector<bool>;
using vc =vector<char>;
using vs =vector<string>;
using vld =vector<ld>;
using pii =pair<ll,ll>;
using psi =pair<string,ll>;
using pci =pair<char,ll>;
using vpii =vector<pii>;
//}}}template*/
ll mod=1e9+7;
ll const maxn=1e6+5;
ll const inf=1e18;
bool ss(const pair<ll,ll> &a, const pair<ll,ll> &b) { 
    return a.first*b.second+a.second<b.first*a.second+b.second;
}
ll add(ll a,ll b){
    return ((a%mod)+(b%mod))%mod;
}
ll mul(ll a,ll b){
    return ((a%mod)*(b%mod))%mod;
}
ll powm(ll x,ll n,ll M)
{
    ll result=1;
    while(n>0)
    {
        if(n % 2 ==1)
            result=(result * x)%M;
        x=(x*x)%M;
        n=n/2;
    }
    return result;
}
ll modinverse(ll a, ll m){
    return powm(a,m-2,m);
}
bool prime(ll x){
    if(x<=1)return false;
    for(int i=2;i<=sqrt(x);i++)if(x%i==0)return false;
    return true;
}
ll divisor(ll x){
    ll cnt=0;
    for(int i=1;i<=sqrt(x);i++){
        if(x%i==0){
            if(i!=x/i)cnt+=2;
            else cnt+=1;
        }
    }
    return cnt;
}
vector<ll> sieve(ll n) {     
    bool prim[n+1]; 
    memset(prim, true, sizeof(prim)); 
  
    for (ll p=2; p*p<=n; p++) {
        if (prim[p] == true) { 
            for (int i=p*p; i<=n; i += p) 
                prim[i] = false; 
        } 
    }
    vector<ll>v;
    for(int i=2;i<=n;i++)if(prim[i])v.push_back(i);
    return v; 
}
bool check(string s){
    ll l=0,r=sz(s)-1;
    while(l<=r){
        if(s[l]!=s[r])return false;
        l++;
        r--;
    }
    return true;
}
ll dp[1005][1005];
int main(){

    fio;
    ll h,w;
    cin>>h>>w;
    char A[h][w];
    fr1(i,h)fr1(j,w)cin>>A[i][j];
    fr1(i,w){
        if(A[0][i]!='#')dp[0][i]=1;
        else break;
    }
    fr1(i,h){
        if(A[i][0]!='#')dp[i][0]=1;
        else break;
    }

    fr(i,1,h-1)fr(j,1,w-1){
        if(A[i][j]!='#')
        dp[i][j]=add(dp[i-1][j],dp[i][j-1]);
    }
    cout<<dp[h-1][w-1];
    return 0;
}

Measured memory_bytes: 9088
let (p1, p2, p3) = (257, 251, 1000000007)

let pow x n =
  let rec doit i acc =
    if i = n then acc
    else doit (i + 1) (acc*x mod p3) in
  doit 0 1

let solve a (h, w) b (r, c) =
  let make_hash v (y, x) =
    let h1 = Array.make_matrix y x 0 in
    let c1 = pow p1 c in
    let rec duduwa i =
      if i < y then begin
        let rec calc_z j acc =
          if j = c then acc
          else calc_z (j + 1) ((acc*p1 + Char.code v.(i).(j)) mod p3) in
        let rec aux j z =
          if j = x - c then h1.(i).(j) <- z
          else begin
            h1.(i).(j) <- z;
            let new_z = (z*p1 - (Char.code v.(i).(j))*c1 + Char.code v.(i).(j+c)) mod p3 in
            aux (j + 1) (if new_z < 0 then new_z + p3 else new_z)
          end in
        aux 0 (calc_z 0 0);
        duduwa (i + 1)
      end in
    duduwa 0;
    let h2 = Array.make_matrix y x 0 in
    let c2 = pow p2 r in
    let rec doit j =
      if j < x then begin
        let rec calc_z i acc =
          if i = r then acc
          else calc_z (i + 1) ((acc*p2 + h1.(i).(j)) mod p3) in
        let rec aux i z =
          if i = y - r then h2.(i).(j) <- z
          else begin
            h2.(i).(j) <- z;
            let new_z = (z*p2 - h1.(i).(j)*c2 + h1.(i+r).(j)) mod p3 in
            aux (i + 1) (if new_z < 0 then new_z + p3 else new_z)
          end in
        aux 0 (calc_z 0 0);
        doit (j + 1)
      end in
    doit 0;
    h2 in
  let s = make_hash a (h, w) in
  let t = make_hash b (r, c) in
  let rec doit = function
    | (i, _) when i > h - r -> ()
    | (i, j) when j > w - c -> doit (i + 1, 0)
    | (i, j) ->
      if s.(i).(j) = t.(0).(0) then Printf.printf "%d %d\n" i j;
      doit (i, j + 1) in
  doit (0, 0)

let input_array y x =
  let a = Array.make_matrix y x '\000' in
  let rec doit = function
    | (i, _) when i = y -> a
    | (i, j) when j = x -> doit (i + 1, 0)
    | (i, j) ->
      a.(i).(j) <- Scanf.scanf "%c " (fun c -> c);
      doit (i, j + 1) in
  doit (0, 0)

let () =
  let (h, w) = Scanf.scanf "%d %d\n" (fun h w -> (h, w)) in
  let a = input_array h w in
  let (r, c) = Scanf.scanf "%d %d\n" (fun r c -> (r, c)) in
  let b = input_array r c in
  if h >= r && w >= c then solve a (h, w) b (r, c)

Measured memory_bytes: 46352
#include "bits/stdc++.h"
 
using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define REP(i,n) for(int i=0; i<int(n); i++)
#define REREP(i,n) for(int i=int(n-1); i>=0; i--)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define REFOR(i,m,n) for(int i=int(n-1); i>=int(m); i--)
#define ALL(obj) (obj).begin(),(obj).end()
 
#define VI vector<int>
#define VVI vector<vector<int>>
#define VVVI vector<vector<vector<int>>>
#define VD vector<double>
#define VVD vector<vector<double>>
#define VVVD vector<vector<vector<double>>>
#define VL vector<ll>
#define VVL vector<vector<ll>>
#define VVVL vector<vector<vector<ll>>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define VVVB vector<vector<vector<bool>>>
#define VS vector<string>
#define VVS vector<vector<string>>
#define VVVS vector<vector<vector<string>>>
 
#define PII pair<int,int>
#define PDD pair<double,double>
#define PLL pair<ll,ll>
#define VPII vector<pair<int,int>>
#define VVPII vector<vector<pair<int,int>>>
#define VVVPII vector<vector<vector<pair<int,int>>>>
#define VPLL vector<pair<ll,ll>>
#define VVPLL vector<vector<pair<ll,ll>>>
#define VVVPLL vector<vector<vector<pair<ll,ll>>>>
 
#define SUMI(obj) accumulate((obj).begin(), (obj).end(), 0)
#define SUMD(obj) accumulate((obj).begin(), (obj).end(), 0.)
#define SUML(obj) accumulate((obj).begin(), (obj).end(), 0LL)
#define SORT(obj) sort((obj).begin(), (obj).end()) // 1,2,3,4,5...
#define RESORT(obj) sort((obj).begin(), (obj).end(), greater<int>()) // 5,4,3,2,1...
#define UB(obj,n) upper_bound((obj).begin(), (obj).end(), n) //itr > n
#define LB(obj,n) lower_bound((obj).begin(), (obj).end(), n) //itr>= n

#define PB push_back
#define Cout(str) cout << str << endl

const ll MOD = (ll)1e9 + 7;
const ll HINF = (ll)1e18;
const ll LINF = (ll)1e9;
const ll EPS = (ll)1e-8;

int main(){
	int n,m;
	int a,b,c,d;
	int sum;
	string str;
	string s,t;
	char ch;
	VI vi;
	vector<char> vc;
	VS vs;
	int reserve_vi = 100;
	map<int, int> table; 
	string str2, str3;
	map<char, string> vowel;
	vector<char> vowel_vec = {'a', 'e', 'i', 'o', 'u'};

	//cin >> n >> m;
	//cin >> a >> b;
	//cin >> a >> b >> c;
	//cin >> a >> b >> c >> d;
	//cin >> str;
	//cin >> str >> str2 >> str3;
	cin >> n;
	
	//cin >> s >> t;
	//cin >> ch;
	//cin >> a >> ch >> b;
	

	cout << n*800-n/15*200 << endl;
	//cout << accumulate(vi.begin(), vi.begin()+n, 0) << endl;
	//replace(ALL(str), ',', ' ');

	//swap(a, b);
	//vi.resize(N);
	//fill(vi.begin(), vi.end(), 1);
	//vi.reserve(reserve_vi);
	//vi.PB(n);

	//vc.resize(5);
	//vc[i] = (str[i]);

	//sort(vc.begin(), vc.end(), greater<char>());
	//sort(vc.begin(), vc.end());

	//for(auto itr = table.begin(); itr != table.end(); ++itr) {
	return 0;
}



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

int main() {
    int ans = 0;
    int N;
    string S;
    cin >> N >> S;
    for(int i = 0; i < N - 2; i++) {
        if(S.substr(i,3) == "ABC")
            ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <unordered_map>
#include <stdio.h>
#include <list>
#include <vector>
#include <algorithm>
#include <stack>
#include <climits>
#include <cmath>
#include <queue>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; ++i)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

int main()
{
	int n; cin >> n;
	vector<int> A(n);
	rep(i,n)cin >> A[i];
	int count=0;
	while(1)
	{
		rep(i,n)
		{
			if(A[i]%2)
			{
				cout<<count;
				return 0;
			}
			A[i]/=2;
		}
		count++;
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int N = scanner.nextInt();

        int sim = Integer.MAX_VALUE;
        int diff = Integer.MAX_VALUE;

        for(int i=1; i<=11; i++){
            int tmpDiff = Math.abs(N - 111 * i);

            if(111 * i < N){
                continue;
            }

            if(tmpDiff < diff){
                sim = 111 * i;
                diff = tmpDiff;
            }
        }
        System.out.println(sim);

    }
}


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

int main(){
    ll n,k;
    cin >> n >> k;
    ll r,s,p;
    cin >> r >> s >> p;
    string janken;
    cin >> janken;
    
    ll ans=0;
    
    for(ll i=0;i<n;i++){
        char aaa=janken[i];
        if(aaa=='r') ans+=p;
        if(aaa=='s') ans+=r;
        if(aaa=='p') ans+=s;
    }
    
    ll kazu=1;
    ll abc;
    
    for(ll i=0;i<k;i++){
        for(ll j=i;j<n-k;j=j+k){
            //cout << ans << endl;
            abc=j;
            if(janken[j]==janken[j+k]){
                kazu++;
                continue;
            }else{
                ll xxx=kazu/2;
                if(janken[j]=='r') ans=ans-p*xxx;
                if(janken[j]=='s') ans=ans-r*xxx;
                if(janken[j]=='p') ans=ans-s*xxx;
                kazu=1;
            }
        }
        ll xx=kazu/2;
        if(janken[abc]=='r') ans=ans-p*xx;
        if(janken[abc]=='s') ans=ans-r*xx;
        if(janken[abc]=='p') ans=ans-s*xx;
        kazu=1;
    }
    
    //ans=ans-kazu/2;
    
    cout << ans << endl;
    
    return 0;
}



Measured memory_bytes: 512
import java.util.*;

public class Main {
    static Scanner scanner;

    public static void main(String[] args) {
        scanner = new Scanner(System.in);
        int x = nextInt();
        int n = nextInt();
        List<Integer> li = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            li.add(nextInt());
        }
        int a = 0;
        boolean first = true;
        while (true) {

            if (first) {
                if (!li.contains(x)) {
                    System.out.println(x);
                    break;
                }
                first = false;
            } else {
                if (!li.contains(x - a)) {
                    System.out.println(x - a);
                    break;
                } else if (!li.contains(x + a)) {
                    System.out.println(x + a);
                    break;
                }
            }
            a++;
        }
    }

    public static void println(Object o) {
        System.out.println(o);
    }

    public static void print(Object o) {
        System.out.print(o);
    }

    public static void printf(String format, Object... o) {
        System.out.printf(format, o);
    }

    public static int nextInt() {
        return Integer.parseInt(scanner.next());
    }

    public static long nextLong() {
        return Long.parseLong(scanner.next());
    }

    public static double nextDouble() {
        return Double.parseDouble(scanner.next());
    }

    public static short nextShort() {
        return Short.parseShort(scanner.next());
    }

    public static float nextFloat() {
        return Float.parseFloat(scanner.next());
    }

    public static void printYes() {
        System.out.println("Yes");
    }

    public static void printYES() {
        System.out.println("YES");
    }

    public static void printNo() {
        System.out.println("No");
    }

    public static void printNO() {
        System.out.println("NO");
    }

    public static void nextLine() {
        scanner.nextLine();
    }

    public static double distance(double x, double y, double x2, double y2) {
        return Math.sqrt((x2 - x) * (x2 - x) + (y2 - y) * (y2 - y));
    }

    public static int MOD = 1_000_000_007;
    public static int MAX = 100000;
    public static long[] fac = new long[MAX];
    public static long[] finv = new long[MAX];
    public static long[] inv = new long[MAX];

    public static void combinit() {
        fac[0] = fac[1] = 1;
        finv[0] = finv[1] = 1;
        inv[1] = 1;
        for (int i = 2; i < MAX; 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;
        }
    }

    public static long combination(int n, int k) {
        if (n < k || n < 0 || k < 0) return 0;
        return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
    }

    public static long factorial(long n) {
        return n <= 0 ? 1 : n * factorial(n - 1);
    }
}

Measured memory_bytes: 29452
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O0")
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
const ll mod = 1e9+7;
const ll INF = 1e18;
#define All(a) (a).begin(),(a).end()
#define Pi acos(-1)

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << setprecision(15) << fixed;
  chrono::system_clock::time_point start,end;
  start = chrono::system_clock::now();

  string s;
  cin >> s;
  ll ans = 0;
  if (s == "SSS") ans = 0;
  else if (s == "SSR" || s == "SRS" || s == "RSS" || s == "RSR") ans = 1;
  else if (s == "RRR") ans = 3;
  else ans = 2;
  cout << ans << '\n';

  end = chrono::system_clock::now();
  auto elapsed = chrono::duration_cast< chrono::milliseconds >(end - start).count();
  cerr << elapsed << "ms" << '\n';
}

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

int main() {
  long N;
  cin>>N;
  vector<long> A(N);
  vector<long> B(N);
  vector<long> C(N);
  vector<vector<long>> dp(N+1,vector<long>(3));
  for(int i=0;i<N;i++) cin>>A[i]>>B[i]>>C[i];
  for(int i=0;i<=N;i++) for(int j=0;j<=2;j++) dp[i][j]=0;

  dp[0][0]=A[0];
  dp[0][1]=B[0];
  dp[0][2]=C[0];

  for(int i=0;i<N-1;i++){
      dp[i+1][0]=max(dp[i][1],dp[i][2])+A[i+1];
      dp[i+1][1]=max(dp[i][2],dp[i][0])+B[i+1];
      dp[i+1][2]=max(dp[i][0],dp[i][1])+C[i+1];
      //cout<<max(dp[i+1][0],max(dp[i+1][1],dp[i+1][2]))<<endl;
  }
  cout<<max(dp[N-1][0],max(dp[N-1][1],dp[N-1][2]))<<endl;
}


Measured memory_bytes: 11132
#include<bits/stdc++.h>
#define ll long long int

using namespace std;

int main()
{
    ll n,k,x,i,p=999999999999999999;
    cin>>n>>k;
    x=n;

    if(n<k)
    {
        for(i=0; i<100; i++)
        {
            x=(x-k);
            if(x<0)
            {
                x=x*-1;
            }
            p=min(p,x);
        }
    }
    else if(n==k)
    {
        p=0;
    }
    else if(n>k)
    {
        p=n%k;
        x=p;
        for(i=0; i<100; i++)
        {
            x=(x-k);
            if(x<0)
            {
                x=x*-1;
            }
            p=min(p,x);
        }

    }
    cout<<p<<endl;
    return 0;
}




Measured memory_bytes: 256
#include <ctype.h>
#include <stdio.h>
void tocaptital(char s[])
{
    int i=0;

    while(s[i]!='\0'){
        if(isspace(s[i])==1){
            i++;
         }else{
            s[i]=toupper(s[i]);
            i++;
        }
    }
}
int main(void)
{
    char str[200];

    scanf("%[^\n]",str);
    tocaptital(str);
    printf("%s\n",str);

    return 0;
}


Measured memory_bytes: 2040
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <cassert>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <bitset>
#include <stack>
#include <iomanip>
#include <fstream>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define chmax(a,b) (a<b?(a=b,1):0)
#define chmin(a,b) (a>b?(a=b,1):0)
#define valid(y,x,h,w) (0<=y&&y<h&&0<=x&&x<w)
const int INF = 1<<29;
const double EPS = 1e-8;
const double PI = acos(-1);
typedef long long ll;
typedef pair<int,int> pii;

int dp[100];

int main() {
  int D;
  while(cin >> D) {
    int n;
    cin >> n;
    memset(dp,0,sizeof(dp));
    REP(i,n) {
      char a;
      int b;
      cin >> a >> b;
      if (a == 'D') {
        for (int j=D-1; j>=0; --j) {
          chmax(dp[j+1],dp[j]+b);  
        }
      }
    }
    int m;
    cin >> m;
    REP(i,m) {
      char a;
      char b;
      int c;
      cin >> a >> b >> c;
      if (a == 'D' && b == 'D') {
        for (int j=D-2; j>=0; --j) {
          chmax(dp[j+2], dp[j] + c);
        }
      }
    }
    cout << dp[D] << endl;
  }
}

Measured memory_bytes: 1164
#include<iostream>
#include <math.h>
#include <stdio.h>

using namespace std;

int main(){
 double x1,y1,x2,y2;
 cin >> x1 >> y1 >> x2 >> y2;
 printf("%.5f", sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2)));

}


Measured memory_bytes: 3188
#include <iostream>
#include <queue>
#include <utility>
int main(){
  using pair = std::pair<int,int>;
  int bfs[51][51],h,w,i,j,dx[]={1,-1,0,0},dy[]={0,0,1,-1},inf=1001001001,a=0;
  std::cin>>h>>w;
  char m[h][w];
  std::queue<pair> q;
  pair p={0,0};
  q.push(p);
  for(i=0;i<h;++i)for(j=0;j<w;++j)bfs[i][j]=inf;
  bfs[0][0]=1;
  for(i=0;i!=h;++i){
    for(j=0;j!=w;++j){
      std::cin>>m[i][j];
      (m[i][j]=='.'?++a:0);
    }
  }
  while(q.size()){
    p = q.front();
    q.pop();
    if(p.first==h-1&&p.second==w-1)break;
    for(int i=0;i<4;++i){
        if(p.second+dx[i]>=0&&p.second+dx[i]<w&&p.first+dy[i]>=0&&p.first+dy[i]<h&&bfs[p.first+dy[i]][p.second+dx[i]]==inf&&m[p.first+dy[i]][p.second+dx[i]]=='.'){
          q.push({p.first+dy[i],p.second+dx[i]});
          bfs[p.first+dy[i]][p.second+dx[i]]=bfs[p.first][p.second]+1;
      }
    }
  }
  std::cout<<(bfs[h-1][w-1]==inf?-1:a-bfs[h-1][w-1])<<"\n";
}
          
    

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {


    Scanner sc = new Scanner(System.in);
    // get a integer

    int N = sc.nextInt();
//    System.out.println(" integer is " + N);
    List<Integer> aList = new ArrayList<>();
    List<Integer> divideList = new ArrayList<>();
    for(int i = 0;i< N;i++){
      int input = sc.nextInt();
      aList.add(input);
    };
    aList.forEach((i) -> divideList.add(getQuotientDividedBy2(i)));
    System.out.println(Collections.min(divideList));

  };
  public static int getQuotientDividedBy2(int x){
    int divideCount = 0;
    int quotient = 0;
    while(x % 2 == 0){
      x = x / 2;
      divideCount++;
    }
    return divideCount;
  }

  public static int log2(int x) {
    if(x % 2 == 0){
      return (int) (Math.log(x) / Math.log(2));
    }else{
      return 0;
    }
  }
}


Measured memory_bytes: 26964
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

int main(){

	string str;
	while(1){
		getline(cin,str);
		string name = str.substr(0,str.size()-2);
		char type = str[str.size()-1];
		if(type=='L'){
			if(name[0] >= 'a' && name[0] <= 'z'){
				for(int i = 0; i < name.size(); i++){
					if(name[i] == '_'){
						cout << (char)(name[i+1]-'a'+'A') << flush;
						i++;
					}
					else{
						cout << name[i] << flush;
					}
				}
				cout<<endl;
			}
			else{
				cout << (char)(name[0]+'a'-'A') << flush;
				for(int i = 1; i < name.size(); i++){
					cout << name[i]<<flush;
				}
				cout<<endl;
			}
		}
		else if(type=='U'){
			if(name[0] >= 'a' && name[0] <= 'z'){
				cout << (char)(name[0]-'a'+'A') << flush;
				for(int i = 1; i < name.size(); i++){
					if(name[i] == '_'){
						cout << (char)(name[i+1]-'a'+'A') << flush;
						i++;
					}
					else{
						cout << name[i]<<flush;
					}
				}
				cout<<endl;
			}
			else{
				cout << name[0] << flush;
				for(int i = 1; i < name.size(); i++){
					cout << name[i]<<flush;
				}
				cout<<endl;
			}
		}
		else if(type=='D'){
			if(name[0] >= 'a' && name[0] <= 'z'){
				for(int i = 0; i < name.size(); i++){
					if(name[i] >= 'A' && name[i] <= 'Z'){
						cout <<'_'<<flush;
						cout << (char)(name[i]+'a'-'A') << flush;
						//i++;
					}
					else{
						cout << name[i] << flush;
					}
				}
				cout<<endl;
			}
			else{
				cout << (char)(name[0]-'A'+'a') << flush;
				for(int i = 1; i < name.size(); i++){
					if(name[i] >= 'A' && name[i] <= 'Z'){
						cout <<'_'<<flush;
						cout << (char)(name[i] - 'A'+'a') << flush;
					}
					else
						cout << name[i]<<flush;
				}
				cout << endl;
			}
		}
		else
			break;
		//cout<<endl;
	}

	return 0;
}

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

#define int long long
#define endl '\n'
#define mod 1000000007
#define pb push_back
#define ff first
#define ss second
#define ii pair<int,int>
#define vi vector<int>
#define vii vector<ii>
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define rep(i, l, r) for(int i=(int)(l);i<(int)(r);i++)

using namespace std;

const int maxN =1000;




void solve() {
    double d,t,s;
    cin>>d>>t>>s;
    if(d/s <= t)
        cout << "Yes";
    else
        cout << "No";

}

int32_t main() {
    fastIO
    int t = 1;
//    cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}





Measured memory_bytes: 3736
n = int(input())
nxt_btn = {i: int(input()) for i in range(1, n + 1)}

num = -1
crr_btn = 1
for i in range(1, n + 1):
    if nxt_btn[crr_btn] == 2:
        num = i
        break
    crr_btn = nxt_btn[crr_btn]
print(num)


Measured memory_bytes: 22060
[N, M] = list(map(int,input().split()))
AB = [list(map(int, input().split())) for i in range(N)]

AB.sort(key=lambda x:x[0])
tmp = M
ans = 0

for i in range(N):
    #break
    if tmp <= AB[i][1]:
        ans += tmp * AB[i][0]
        break
    
    ans += AB[i][0] * AB[i][1]
    tmp = tmp - AB[i][1]


print(ans)

Measured memory_bytes: 29028
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define N 105
#define INF 100000000
typedef long long ll;
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) int(x.size())
#define IN(a) cin>>(a)
#define OUT(a) cout<<(a)<<endl
typedef pair<int,int> P;
const int MAX = 100005;
const int MOD = 1000000007;

int main(){
    int n;
    cin>>n;
    vector<int>a(n);
    REP(i,n)IN(a[i]);
    vector<int>b(1);
    b[0]=a[n-1];
    for(int i=n-2;i>=0;i--){
        int x=upper_bound(ALL(b),a[i])-b.begin();
        if(x==SZ(b)){
            b.push_back(a[i]);
        }else{
            b[x]=a[i];
        }
    }
    OUT(SZ(b));
    return 0;
}

Measured memory_bytes: 1276
n=int(input())
lis=[]
for i in range(n):
  lis.append(int(input()))
lis.sort()
keep=0
count=0
for i in range(0,n):
  if lis[i]!=keep:
    count+=1
    keep=lis[i]
  else:
    keep=lis[i]
print(count)

Measured memory_bytes: 3060
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <string.h>
#include <fstream>

using namespace std;


#define LL long long
#define N 200100
#define M 10000100
#define MP make_pair
#define Pi acos(-1.0)
#pragma comment(linker,"/STACK:1024000000,1024000000")
#define ls (rt << 1)
#define rs (ls | 1)
#define md ((ll+rr)/2)
#define lson ll, md, ls
#define rson md+1, rr, rs
#define mod 1000000007
#define inf 0x3f3f3f3f
#define sqr(x) ((x)*(x))
#define eps 1e-6
#define MP make_pair
#define uLL unsigned long long
LL powmod(LL a,LL b) {LL res=1;a%=mod;for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
#define F(x) ((x)/3+((x)%3 == 1 ? 0 : tb))
#define G(x) ((x)<tb ? (x)*3+1 : ((x) - tb)*3+2)
#define lowbit(x) ((x)&(-x))
#define fi first
#define se second
#define pii pair<int,int>

int gcd(int x,int y){
    while(y){
        int t = x % y;
        x = y;
        y = t;
    }
    return x;
}

int pos[N],a[N],on[N],at[N];

int main(){
    int n,m,q;
    scanf("%d%d%d",&n,&m,&q);
    for(int i = 0; i < q; i++)
        scanf("%d",&a[i]),a[i]--;
    
    for(int i = 0; i < m; i++){
        at[i] = 0;
        pos[i] = -1;
        on[i] = -1;
    }
    
    int have = 0;
    at[0] = n;
    for(int i = q - 1; i >= 0; i--){
        int v = a[i];
        if(pos[v] == -1){
            pos[v] = have;
            on[have] = v;
            at[have]--;
            have++;
            at[have]++;
            continue;
        }
        if(at[pos[v]] > 0)
            at[pos[v]]--,at[pos[v]+1]++;
    }
    
    int fs = -1;
    for(int i = 0; i <= m; i++)
        if(at[i] > 0){
            fs = i;
            break;
        }
    
    vector<int> all;
    for(int i = fs; i < have; i++){
        all.push_back(on[i]);
    }
    for(int i = 0; i < m; i++)
        if(pos[i] == -1)
            all.push_back(i);
    
    sort(all.begin(), all.end());
    
    for(int i = fs; i < have; i++)
        if(on[i] != all[i - fs]){
            puts("No");
            return 0;
        }
    puts("Yes");
    return 0;
}

Measured memory_bytes: 2428
# B - Tap Dance
def main():
    s = input()
    for i in range(0,len(s)):
        if i % 2 == 0:
            if s[i] in ['R','U','D']:
                continue
            else:
                print('No')
                exit()
        else:
            if s[i] in ['L','U','D']:
                continue
            else:
                print('No')
                exit()
    print('Yes')


if __name__ == '__main__':
    main()

Measured memory_bytes: 9016
#include <stdio.h>

int main() {
    int x1, y1, x2, y2;
    scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
    int xdiff = x2 - x1;
    int ydiff = y2 - y1;
    int x3, y3, x4, y4;
    x3 = x2 - ydiff;
    y3 = y2 + xdiff;
    x4 = x3 - xdiff;
    y4 = y3 - ydiff;
    printf("%d %d %d %d", x3, y3, x4, y4);
    return 0;
}

Measured memory_bytes: 128
n = gets.to_s.to_i
s = gets.to_s.chomp
 
r = s.count('R')
g = s.count('G')
b = s.count('B')

ans = r * g * b
n.times do |i|
  (1...n).each do |t|
    
    j = i + t
    k = j + t
    
    break if n - 1 < k
    ans -= 1 if s[i] != s[j] && s[j] != s[k] && s[k] != s[i]
  end
end

puts ans

Measured memory_bytes: 14388