akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
 
#define ll long long
#define ld long double

#define all(x) x.begin(), x.end()
#define sz(x) x.size()

using namespace std;

const char nl = '\n';

void solve() {
	int n,ans=0;
	double d;
	cin >> n >> d;
	for(int i = 0; i < n; i++) {
		double x, y;
		cin >> x >> y;
		if(sqrt((x*x)+(y*y))<=d) {
			ans++;
		}
	}
	cout << ans << nl;
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin >> t;
	while(t--) {
		solve();
	}
}


Measured memory_bytes: 3792
n,q = gets.chomp.split(" ").map(&:to_i)
s = gets.chomp
lr_arr = q.times.map{gets.chomp.split(" ").map(&:to_i)}

count = 0
arr = [0]
s.split("").each_cons(2) do |(a,b)|
  if "#{a}#{b}" == "AC" then
    count += 1
  end
  arr << count
end

lr_arr.each do |(l, r)|
  puts arr[r-1] - arr[l-1]
end


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

mt19937 mt(time(nullptr));
// uniform_int_distribution< int > rand_int(0, 10) // rand[0, 10] inclusive

ul mod = 1e9+7;
ul solve(ul idx, ul npc, ul k, vector< vector< ul > > & path, vector< bool > & v) {
  if (v[idx]) return 0;
  v[idx] = true;
  ul nc = 1;
  ul ans = (k > npc ? k-npc : 0);
  //cout << idx << "=" << k << " - " << npc << "=" << ans << endl;
  for (auto c : path[idx]) {
    if (v[c]) continue;
    auto ret = solve(c, nc+(idx==0 ? 0 : 1), k, path, v);
    ans *= ret;
    ans %= mod;
    nc++;
  }
  //cout << idx << ":" << ans << endl;
  return ans;
}

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed;
  ul n, k;
  cin >> n >> k;
  vector< vector< ul > > path(n);
  for (ul i=0; i<n-1; ++i) {
    ul a, b;
    cin >> a >> b;
    a--; b--;
    path[a].push_back(b); path[b].push_back(a);
  }
  vector< bool > v(n, false);
  cout << solve(0, 0, k, path, v) << endl;
  return 0;
}


Measured memory_bytes: 12800
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}

ll a[110];
int main(){
	ll n;
	scanf("%lld",&n);
	rep(i,0,n)scanf("%lld",a+i);
	sortup(a,n);
	printf("%lld",a[n-1]-a[0]);
}

Measured memory_bytes: 128
w, h, n = map(int, input().split())
b = 0
c = 0
for _ in range(n):
    x, y, a = map(int, input().split())
    if a == 1:
        b = max(b, x)
    elif a == 2:
        w = min(w, x)
    elif a == 3:
        c = max(c, y)
    elif a == 4:
        h = min(h, y)
print(max(0, (w-b)) * max(0, (h-c)))


Measured memory_bytes: 3064
# coding: utf-8
from collections import Counter
alp = "abcdefghijklmnopqrstuvwxyz"
w = input()
cnt = dict(Counter(w))
flag = True
for a in alp:
    try:
        if cnt[a] % 2 == 1:
            flag = False
            exit()
    except:
        pass
print("Yes" if flag else "No")

Measured memory_bytes: 3316
#include <iostream>
#include <vector>
#include <algorithm>

int main(){
	int n;
	std::cin>>n;
	
	std::vector<std::vector<int> > activity(n,std::vector<int>(3));
	for(int i=0;i<n;i++){
		std::cin>>activity[i][0]>>activity[i][1]>>activity[i][2];
    }
	
	std::vector<std::vector<long long> > dp(n+1,std::vector<long long>(3));
	dp[0][0]=dp[0][1]=dp[0][2]=0;
	for(int i=1;i<=n;i++){
		for(int j=0;j<3;j++){
			dp[i][j]=std::max(dp[i-1][(j+1)%3],dp[i-1][(j+2)%3])+activity[i-1][j];
		}
	}
	
	long long ans=dp[n][0];
	if(dp[n][1]>ans){
		ans=dp[n][1];
	}
	if(dp[n][2]>ans){
		ans=dp[n][2];
	}
	
	std::cout<<ans<<std::endl;
}

Measured memory_bytes: 11136
#include <string>
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
using namespace std;

typedef long long ll;

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

#define FOR(i, start, end) for(ll i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)

int main(void) {
    int D, G;
    cin >> D >> G;
    vector<int> P(D);
    vector<int> C(D);
    REP (i, D) {
        cin >> P[i] >> C[i];
    }

    int ans = INT_MAX;
    REP (bit, 1 << D) {
        int point = 0;
        int count = 0;
        int s = -1;

        REP (i, D) {
            int b = (bit >> i) & 1;
            if (b == 0) {
                s = i;
            } else {
                point += P[i] * 100 * (i + 1) + C[i];
                count += P[i];
            }
        }
        if (point >= G) {
            ans = min(ans, count);
            continue;
        }
        if (s == -1) {
            continue;
        }

        REP (i, P[s]) {
            point += (s + 1) * 100;
            count++;
            if (point >= G) {
                ans = min(ans, count);
                break;
            }
        }
    }
    cout << ans << endl;

    return 0;
}

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

#define NDEBUG
#ifdef DEBUG
#include "../cout11.h"
#undef NDEBUG
#endif
#include <cassert>

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef pair<double,double> dd;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<ll> vll;

#define sz(a)  int((a).size())
#define pb  push_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define found(s,e)  ((s).find(e)!=(s).end())
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))

ll gcd(ll a, ll b) { while(a) swap(a, b%=a); return b; }

const ll MOD=1000000007LL;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }
// ll comb(ll n, ll k) { ll v=1; for(ll i=1; i<=k; i++) v = DIV(MUL(v, n-i+1),i); return v; }
//

#define INTSPACE 12
char _buf[INTSPACE*300000 + 3];

int loadint() {
    if (fgets(_buf, INTSPACE+3, stdin)==NULL) return 0;
    return atoi(_buf);
}

int loadvec(vector<int>& v, int N=-1) {
    if (N == -1) {
        N = loadint();
        if (N==0) return 0;
    }
    int bufsize = INTSPACE*N + 3;
    if (fgets(_buf, bufsize, stdin)==NULL) return 0;
    v.resize(N);

    int i=0;
    bool last = false;
    for (char *p=&_buf[0]; ;) {
        char *q = p;
        while (*q > ' ') ++q;
        if (*q == 0x0D || *q == 0x0A) last = true;
        *q = 0;
        v[i++] = atoi(p);
        if (last || i == N) break;
        p = q+1;
    }
    // assert(i <= N);
    return i;
}

ll solve(int N, vi& a) {
    sort(ALL(a));
    ll ans = 0;
    rep(i,N){
        ans += a[N+i*2];
    }
    return ans;
}

int main() {
    int N = loadint(); // 1-1e5
    vi a(N*3);
    loadvec(a, N*3);
    cout << solve(N,a) << endl;
    // cout << (solve(N,a) ? "Yes":"No") << endl;
    return 0;
}


Measured memory_bytes: 4608
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <cstdint>
#include <sstream>
#include <map>
#include <vector>
#include <queue>
#include <iomanip>

using namespace std;
typedef long long ll;

ll ans, mx, sum, mn = 1e8, cnt;

int main(){
	ll k,s;
	cin>>k>>s;
	for(ll i=0; i<=k; i++){
		for(ll j=0; j<=k; j++){
			ll flag=s-(i+j);
			
			if(flag>=0 && flag<=k && i+j+flag==s) ans++;
		}
	}
	cout<<ans<<endl;
}


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

//=============BIT============================
const ll MAX_N = pow(10, 5) * 5 + 1;
ll n;
vector<ll> bit(MAX_N + 1, 0);

ll sum(ll i, ll j) {
  j += 1;
  ll si = 0, sj = 0;
  while (i > 0) {
    si += bit.at(i);
    i -= i & -i;
  }
  while (j > 0) {
    sj += bit.at(j);
    j -= j & -j;
  }
  return sj - si;
}

void add(ll i, ll x) {
  i += 1;
  while (i <= n) {
    bit.at(i) += x;
    i += i & -i;
  }
}
//=================================================

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll N, Q;
  cin >> N >> Q;
  n = N;
  for (ll i = 0; i < N; ++i) {
    ll a;
    cin >> a;
    add(i, a);
  }
  for (ll i = 0; i < Q; ++i) {
    ll q, p, x;
    cin >> q >> p >> x;
    if (q == 0) {
      add(p, x);
    }
    else {
      cout << sum(p, x - 1) << "\n";
    }
  }
}


Measured memory_bytes: 8260
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using static System.Console;
using static System.Math;

namespace _100pt
{
    class ABC054A
    {
        static void Main(string[] args)
        {
            int[] init = ReadLine().Split(' ')
                .Select(n => int.Parse(n)).ToArray();
            int A = init[0];
            int B = init[1];

            if (A == 1) A = 14;
            if (B == 1) B = 14;

            if (A == B)
            {
                WriteLine("Draw");
            }
            else if (A > B)
            {
                WriteLine("Alice");
            }
            else
            {
                WriteLine("Bob");
            }
            ReadKey();
        }
    }
}
            


Measured memory_bytes: 13268
s = list(input())
t = list(input())

if s == t:
    print("Yes")
else:
    for i in range(len(t)):
        # 末尾を削除して先頭に追加
        temp = t.pop(-1)
        t.insert(0, temp)
        if s == t:
            print("Yes")
            break
    else:
        print("No")


Measured memory_bytes: 2940
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <functional>
#include <limits.h>
#include <set>
#include <map>
#include <tuple>
using namespace std;

#define ll long long
#define ull unsigned long long
#define rep(i,N) for (ll i=0;i<N;i++)
#define loop(i,N,M) for(ll i=N;i<M;i++)
#define MAX(v) *max_element(v.begin(),v.end())
#define MIN(v) *min_element(v.begin(),v.end())
#define SORTL2S(type,v) sort(v.begin(),v.end(),greater<type>())
#define SORTS2L(type,v) sort(v.begin(),v.end())
#define SORTMF(v,func) sort(v.begin(),v.end(),func)

template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*)array, (T*)(array + N), val);
}

ll N, A, B, C, D;
string S;

void solve() {
	cin >> S;

	ll cnt = 0;
	ll pos = 0;
	ll ans = 0;

	while (pos < S.size()) {
		if (S[pos] == 'A') {
			cnt++;
			pos++;
			continue;
		}
		if (S[pos] == 'B') {
			if (pos+1<S.size() && S[pos + 1] == 'C') {
				ans += cnt;
				pos += 2;
				continue;
			}
			else {
				cnt = 0;
				pos++;
				continue;
			}
		}
		if (S[pos] == 'C') {
			cnt = 0;
			pos++;
			continue;
		}
	}

	cout << ans;

}

int main() {
	solve();
	cout << endl;
	return 0;
}


Measured memory_bytes: 640
#include <stdio.h>
int main(void){
    int w,h;
    while(1){
         scanf("%d %d",&w,&h);
        if(w == 0 && h == 0){
            break;
        }
        for(int i=0;i<w;i++){
            for(int j=0;j<h;j++){
                printf("#");
            }
            printf("\n");
        }
        printf("\n");
    }
    return 0;
}




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

using namespace std;

ll n,x,ans,y,z,ans2;

int main()
{
    cin >> n;
    x=n, z=10;
    while (x)
    {
        if (x%10==9) ans2++;
        x/=z, ans++;
    }
    y=n/pow(z,ans-1);
    if (ans2==ans-1&&y!=9) y++;
    if (ans==1) cout << n;
    else cout << (ans-1)*9+y-1;
}


Measured memory_bytes: 384
gets
a=gets.split.map(&:to_i)

x=[]
x[0]=(0...a.size).map{|i| (-1)**i*a[i] }.reduce(:+) / 2
(1...a.size).each{|i|
  x[i]=a[i-1]-x[i-1]
}
x.map!{|e|e*=2}
print x.join(" ")


Measured memory_bytes: 14140
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;

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

	if (A >= 13) {
		cout << B << endl;
	}
	else if (A >= 6 && A <= 12) {
		cout << B / 2 << endl;
	}
	else {
		cout << 0 << endl;
	}
}

Measured memory_bytes: 3568
#include<iostream>
using namespace std;
int cnt[11];
main()
{
    int a,b,c;
    while(cin>>a>>b>>c)
    {
        for(int i=1;i<=10;i++)cnt[i]=0;
        cnt[a]=cnt[b]=cnt[c]=1;
        int s=0;
        for(int i=1;i<=10;i++)
        {
            if(!cnt[i]&&a+b+i<=20)s++;
        }
        cout<<(s>3?"YES":"NO")<<endl;
    }
}


Measured memory_bytes: 3020
using System;

namespace abc165_b
{
    class Program
    {

        static void Main(string[] args)
        {
            var afterBankDeposit = Int64.Parse(Console.ReadLine());

            var year = 0;
            var bankDeposit = 100L;

            while (bankDeposit < afterBankDeposit)
            {
                bankDeposit += bankDeposit / 100;
                year++;
            }

            Console.WriteLine(year);
        }
    }
}

Measured memory_bytes: 27536
H, W = map(int, input().split())
a = []
for i in range(H):
    b = input()
    a.append(b)
b = []
flag = 0
for i in range(H):
    flag = 0
    for j in range(W):
        if a[i][j] == '#':
            flag = 1
    if flag == 1:
        d = [1 for i in range(W)]
        b.append(d)
    else:
        d = [0 for i in range(W)]
        b.append(d)
for i in range(W):
    flag = 0
    for j in range(H):
        if a[j][i] == '#':
            flag = 1
    if flag == 0:
        for j in range(H):
            b[j][i] = 0

for i in range(H):
    flag = 0
    for j in range(W):
        if b[i][j] == 1:
            print(a[i][j], end = "")
            flag = 1
        if flag == 1 and j == W - 1:
            print("")

Measured memory_bytes: 4724
using DataStructures
function m()
	A=map(S->(x->parse(Int,x)).(split(S)),readlines())
	P=FenwickTree(A[2])
	p=prefixsum
	for (t,l,r)=A[3:end]
		inc!(P,l+1,r*(1-t))
		t>0&&println(p(P,r)-(l<1 ? 0 : p(P,l)))
	end
end
m()

Measured memory_bytes: 342680
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] lreads(T = long)(long n){return generate(()=>readln.chomp.to!T()).take(n).array();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);
// dfmt on

void main()
{
    long K, A, B;
    scan(K, A, B);
    long a = K + 1;
    long b = (max(0, K - (A - 1)) / 2) * max(B - A, 0) + A + (max(0, K - (A - 1)) % 2);
    writeln(max(a, b));
}


Measured memory_bytes: 256
#include <string>
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long int;

int main(){
    int n; cin >> n;
    vector<int> l(n*2);
    for(auto& v:l){
        cin >> v;
    }
    sort(l.begin(), l.end());
    int ans = 0;
    for(int i=0; i<n; i++){
        ans += min(l[i*2], l[i*2+1]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define pii pair<int, int>
#define pb push_back
#define mp make_pair

using namespace std;

string s;
int cnt, lst, ttcnt, comp0=1, lstcmp=1, ans, k;
signed main()
{
	cin >> s;
	cin >> k;
	int l = s.length();
	if(l==1)
	{
		cout << k/2;
		return 0;
	}
	for(int i = 1; i < l; i++)
	{
	//	cout << i << endl;
		int j = i;
		ttcnt=1;
		while(j<l && s[j]==s[j-1])
		{
			ttcnt++;
			j++;
		}
		if(i==1 && s[i]==s[i-1])
		{
			comp0=ttcnt;
			if(comp0==l)
			{
				cout << (l*k)/2;
				return 0;
			}
		}
		else if(j==l)
		{
			lstcmp=ttcnt;
		}
		else
		{
		//	cout << i << " " << j << " - " << ttcnt << endl;
			cnt+=ttcnt/2;
		}
		if(ttcnt!=1) i=j-1;
	}
	ans+=cnt*k;
	if(s[0]==s[l-1])
	{
	//	cout << comp0 << " " << lstcmp << " " << cnt << endl;
		ans+=(comp0/2)+(lstcmp/2);
		ans+=(k-1)*((comp0+lstcmp)/2);
	}
	else
	{
		ans+=k*(comp0/2);
		ans+=k*(lstcmp/2);
	}
	cout << ans;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
struct UnionFind {
	vector<int> data;
	vector<int> horyu;
	vector<int> sum;
	int all = 0;
	UnionFind(vector<int> &X) {
		int size = X.size();
		sum = X;
		data.resize(size, -1);
		horyu.resize(size, 0);

	}

	bool unionSet(int x, int y, int w) {

		x = root(x); y = root(y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
			sum[x] += sum[y];
			horyu[x] += horyu[y];

		}
		horyu[x]++;
		//cerr << x <<" " << y << " " << w << " " << sum[x] << endl;
		if (w <= sum[x]) {
			all += horyu[x];
			horyu[x] = 0;
		}

		return x != y;
	}
	bool findSet(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};
struct E {
	int w;
	int a;
	int b;
	bool operator<(const E &right) const {
		return w < right.w;
	}
};
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, M;
	cin >> N >> M;
	vector<int> A(N);
	int res = 0;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	UnionFind uf(A);
	vector<E> es;
	int a, b, w;
	for (int i = 0; i < M; i++) {
		cin >> a >> b >> w; a--; b--;
		es.push_back(E{ w,a,b });
	}
	sort(es.begin(), es.end());

	for (int i = 0; i < M; i++) {
		uf.unionSet(es[i].a, es[i].b, es[i].w);
	}
	cout << M - uf.all << endl;
}

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

int main() {
	int a, b, k;
	cin >> a >> b >> k;
	vector<int> v;
	for (int i = a; i < a + k; i++)
		if (i <= b)
			v.push_back(i);
	for (int i = b; i > b - k; i--)
		if (i >= a)
			v.push_back(i);
	sort(v.begin(), v.end());
	v.erase(unique(v.begin(), v.end()), v.end());
	for (int i = 0; i < v.size(); i++)
		cout << v[i] << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
main()
{
    char a[10]={0};
    scanf("%s",a);
    int i,len,min=999,diff;
    len=strlen(a);
    for(i=0;i<len-2;i++)
    {
       diff=fabs((((a[i]-48)*100)+((a[i+1]-48)*10)+(a[i+2]-48))-753);
        if(diff<min)
        {
            min=diff;
        }
    }
    printf("%d",min);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define mod 1000000007
ll a[1005][1005];
int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    ll h,w;
    memset(a,0,sizeof a);
    cin>>h>>w;
    string s[h];
   cin.ignore();
    for(ll i=0;i<h;i++)
    {
        cin>>s[i];
    }
    for(ll i=0;i<h;i++)
    {                                          
        for(ll j=0;j<w;j++)
        {
            if(i==0 && j==0 )
            {
               if(s[i][j]=='.') {
                   a[i][j]=1;
                  // cout <<"why this is not signing "<<endl;
               } 
               else
                    a[i][j]=0;
               
            }
            else if(i==0) 
            {
                if(s[i][j]=='.') a[i][j]=a[i][j-1];
                else a[i][j]=0;
            }
            else if(j==0) 
            {
                if(s[i][j]=='.') a[i][j]=a[i-1][j];
                else a[i][j]=0;
            }
            else
            {
               // cout<<s[i][j]<<" ";
                if(s[i][j]=='.') a[i][j]=(a[i-1][j]+a[i][j-1])%mod;
                else
                {
                    a[i][j]=0;
                }   
            } 
          //  cout<<a[i][j]<<" ";   
        }
    }
    cout<<a[h-1][w-1]%mod<<endl;
    return 0;

}

Measured memory_bytes: 9216
#include <bits/stdc++.h>
using namespace std;
int main(){
	long n,m,k;
  cin>>n>>m>>k;
  for(long i=0;i<=n;i++){
      for(long j=0;j<=m;j++){
          if((i*(m-j)+j*(n-i))==k){
              cout<<"Yes"<<endl;
              return 0;
          }
      }
  }
    cout<<"No"<<endl;
}

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

int main(){
    int n;

    while(cin>>n,n){
        pair<int,int>a[25];
        for(int i=0;i<n;i++)cin>>a[i].second>>a[i].first;
        sort(a,a+n);
        int sum=0;
        bool flag=true;
        for(int i=0;i<n;i++){
            sum+=a[i].second;
            if(sum>a[i].first)flag=false;
        }

        cout<<(flag?"Yes":"No")<<endl;
    }
}

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

#define		mina(a, b)	(a = min((a), (b)))

const int INF = 1e9+5;

int main(){
	int n;
	scanf("%d", &n);
	vector <int> h(n);
	for (int i = 0; i < n; ++i){
		scanf("%d", &h[i]);
	}
	vector <int> dp(n, INF);
	dp[0] = 0;
	for (int i = 0; i < n; ++i){
		for (int j = 1; j <= 2; ++j){
			if(i+j < n){
				dp[i+j] = min(dp[i+j], dp[i]+abs(h[i+j]-h[i]));
			}
		}
	}
	printf("%d\n", dp[n-1]);
	return 0;
}			

Measured memory_bytes: 1024
#include <iostream>
using namespace	std;
int main(){
  int a,b;
  cin>>a>>b;
  if(a<=0&&0<=b){
    cout<<"Zero"<<endl;
    return 0;
  }
  if(a>0){
    cout<<"Positive"<<endl;
    return 0;
  }
  if((b-a+1)%2) cout<<"Negative"<<endl;
  else cout<<"Positive"<<endl;
  return 0;

}



Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int D = sc.nextInt();
    int N = sc.nextInt();
    if(D==0&&N<100){
      System.out.println(N);
    }else if(D==0&&N==100){
        System.out.println(101);
    }else if(D==1&&N<100){
      System.out.println(N*100);
    }else if(D==1&&N==100){
      System.out.println(10100);
    }else if(D==2&&N<100){
      System.out.println(N*10000);
    }else if(D==2&&N==100){
      System.out.println(1010000);
    }else{
      return;
    }
  }
  

  
}

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

int main() {

int N;
cin>>N;

if(N-9990<=9&&N-9990>=0){
cout<<"Yes"<<endl;
return 0;
}
  if(N-8880<=9 && N-8880>=0){
cout<<"Yes"<<endl;
return 0;
}
    if(N-7770<=9&&N-7770>=0){
cout<<"Yes"<<endl;
return 0;
}
    if(N-6660<=9&&N-6660>=0){
cout<<"Yes"<<endl;
return 0;
}
    if(N-5550<=9&&N-5550>=0){
cout<<"Yes"<<endl;
return 0;
}
    if(N-4440<=9&&N-4440>=0){
cout<<"Yes"<<endl;
return 0;
}
    if(N-3330<=9&&N-3330>=0){
cout<<"Yes"<<endl;
return 0;
}
    if(N-2220<=9&&N-2220>=0){
cout<<"Yes"<<endl;
return 0;
}
    if(N-1110<=9&&N-1110>=0){
cout<<"Yes"<<endl;
return 0;
}
      if(N-111==1000||N-222==1000||N-333==1000||N-444==1000||N-555==1000||N-666==1000||N-777==1000||N-888==1000||N-999==1000){
cout<<"Yes"<<endl;
return 0;
}
  if(N-111==2000||N-222==2000||N-333==2000||N-444==2000||N-555==2000||N-666==2000||N-777==2000||N-888==2000||N-999==2000){
cout<<"Yes"<<endl;
return 0;
}
      if(N-111==3000||N-222==3000||N-333==3000||N-444==3000||N-555==3000||N-666==3000||N-777==3000||N-888==3000||N-999==3000){
cout<<"Yes"<<endl;
return 0;
}
      if(N-111==4000||N-222==4000||N-333==4000||N-444==4000||N-555==4000||N-666==4000||N-777==4000||N-888==4000||N-999==4000){
cout<<"Yes"<<endl;
return 0;
}
      if(N-111==5000||N-222==5000||N-333==5000||N-444==5000||N-555==5000||N-666==5000||N-777==5000||N-888==5000||N-999==5000){
cout<<"Yes"<<endl;
return 0;
}
       if(N-111==6000||N-222==6000||N-333==6000||N-444==6000||N-555==6000||N-666==6000||N-777==6000||N-888==6000||N-999==6000){
cout<<"Yes"<<endl;
return 0;
}
      if(N-111==7000||N-222==7000||N-333==7000||N-444==7000||N-555==7000||N-666==7000||N-777==7000||N-888==7000||N-999==7000){
cout<<"Yes"<<endl;
return 0;
}
      if(N-111==8000||N-222==8000||N-333==8000||N-444==8000||N-555==8000||N-666==8000||N-777==8000||N-888==8000||N-999==8000){
cout<<"Yes"<<endl;
return 0;
}
      if(N-111==9000||N-222==9000||N-333==9000||N-444==9000||N-555==9000||N-666==9000||N-777==9000||N-888==9000||N-999==9000){
cout<<"Yes"<<endl;
return 0;
}
      if(N==9000||N==8000||N==7000||N==6000||N==5000||N==4000||N==3000||N==2000||N==1000){
cout<<"Yes"<<endl;
return 0;
}
  
else{
cout<<"No"<<endl;
}
}
/*
if(N==9999||N==1111||N==2222||N==3333||N==4444||N==5555||N==6666||N==7777||N==8888){
cout<<"Yes"<<endl;
}

*/

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

// {{{ Template for Competitive Programming
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rrep(i, n) for (int i = n; i >= 0; --i)
#define ALL(x) (x).begin(),(x).end()
const int INF = 1'010'000'000'000'000'017LL;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0 ,1 ,0,-1};
using vint = vector<int>;
using pint = pair<int, int>;
// }}}

signed main() {
	int n;
	cin >> n;
	vector<int> a(n+1);
	for (auto &e : a) cin >> e;
	int cnt = 0;
	rep(i, n) {
		int b;
		cin >> b;
		if (a[i] >= b) {
			a[i] -= b; cnt += b; b = 0;
		}
		else {
			cnt += a[i]; b -= a[i]; a[i] = 0;
		}

		if (a[i+1] >= b) {
			a[i+1] -= b; cnt += b;
		}
		else {
			cnt += a[i+1]; a[i+1] = 0;
		}
	}

	cout << cnt << endl;
}



Measured memory_bytes: 1024
n = gets.to_i
a = gets.chomp
b = gets.chomp
c = gets.chomp
count = 0
for i in 0...n do
  if a[i] != b[i] && b[i] != c[i] && c[i] != a[i]
    count += 2
  elsif a[i] == b[i] && b[i] == c[i]
    count += 0
  else
    count += 1
  end
end
puts count


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



bool is_good(vector<string> box, int n) {
  for(int i = 0; i < n; i++) {
    for(int j = i; j < n; j++) {
      if (box[i][j] != box[j][i]) {
        return false;
      }
    }    
  }
  return true;
}

int main()
{
    // 整数の入力
    int N;
    int res = 0;
    cin >> N;

    vector<string> S;
    string tmp;

    for(int i = 0; i < N; i++) {
      cin >> tmp;
      S.push_back(tmp);
    }

    for(int i = 0; i < N; i++) {
      if(is_good(S, N)) {
        ++res;
      }

      S.push_back(S[0]);
      S.erase(S.begin());
    }
    cout << res * N << "\n";
    return 0;
}

Measured memory_bytes: 512
/*
g++ -std=c++11 -o2 -Wall ABC024B.cpp -o ./out/ABC024B.out
./out/ABC024B.out
*/

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

#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define tr(c, i) for (iter(c) != (c).begin(); i != (c).end(); ++i)
#define pb push_back
#define mp make_pair

typedef long long ll;


int main() {
//  freopen("./input/input.txt", "r", stdin);
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  int qs[200001];
  int ps[200001];
  rep(i, n) {
    int c;
    cin >> c;
    ps[i] = c;
//    ps[i + 1] = c;
  }
  int ans = 0;
  fill(qs, qs + (n + 1), 0);
  rep(i, n) {
    qs[ps[i]] = qs[ps[i] - 1] + 1;
    if (qs[ps[i]] > ans) ans = qs[ps[i]];
  }
  ans = n - ans;
  cout << ans << "\n";
  return 0;
}


Measured memory_bytes: 1792
#include <stdio.h>

int gcd(int a, int b){
	if(a < b) return gcd(b,a);
	int r = a % b;
	if (r == 0) return b;
	return gcd(r, b);
}

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

int main(void){
	int a,b;
	scanf("%d %d", &a, &b);
	long ans = lcm(a, b);
	printf("%ld", ans);
	return 0;
}


Measured memory_bytes: 128
#!/usr/bin/env perl
use 5.10.0;
use utf8;
use strict;
use warnings;
use open qw( :utf8 :std );
use Data::Dumper;
use List::Util qw( max sum );

chomp( my $kn = readline );
chomp( my $an = readline );
#warn "\$kn: $kn";
#warn "\$an: $an";

my( $k, $n ) = split m{\s+}, $kn;
#warn "\$k: $k";
#warn "\$n: $n";
my @a = split m{\s+}, $an;
#warn Dumper \@a;

my $last = $k - $a[-1] + $a[0];

my @distances;
my $previous = shift @a;

while ( @a ) {
    my $current = shift @a;
    my $d = $current - $previous;
    push @distances, $d;
    $previous = $current;
}

push @distances, $last;
#warn Dumper \@distances;

my $max = max @distances;
my $sum = sum @distances;

my $movement = $sum - $max;

say $movement;


exit;



Measured memory_bytes: 32504
n = int(input())
s = list(input())
ans = s.count('E')
r = 10**6
if s[0]=='E':
    ans -= 1

r = min(ans,r)

for i in range(1,n):
    if s[i-1]=='W' and s[i]=='W':
        ans += 1
    elif s[i-1]=='E' and s[i]=='E':
        ans -= 1
    r = min(ans,r)
print(r)


Measured memory_bytes: 5920
x=0
w=input()
while True:
    y=[]
    t=list(input().split())
    
    
    if t[0]=='END_OF_TEXT':
        break
    
    #print(t)
    
    for i in range(len(t)):
        y.append(t[i].lower())
    #print(y)
    
    for j in range(len(t)):
        if y[j]==w:
            x+=1
print(x)        




Measured memory_bytes: 5564
#include <stdio.h>

int main(void){
  	int M,N;
  	int i;
  	int array1[10]={0};
  	int array2[10]={0} ;
  	int count1=0;
  	int count2=0;
  	scanf("%d",&M);
  	scanf("%d",&N);
  
  for(i=0;i<N;i++){
    array1[i]=M;
  }
  
  for(i=0;i<M;i++){
    array2[i]=N;
  }
  
  for(i=0;i<10;i++){
    if(array1[i] != 0){
      count1++;
    } else {
      break;
    }
  }
  
  for(i=0;i<10;i++){
    if(array2[i] != 0){
      count2++;
    } else {
      break;
    }
  }
  
  if(count1 > count2){
    for(i=0;i<count1;i++){
      printf("%d",array1[i]);
    }
  } else if (count1 < count2){
    for(i=0;i<count2;i++){
      printf("%d",array2[i]);
    }
  } else {
    for(i=0;i<count1;i++){
      printf("%d",array1[i]);
    }
  }
  
  return 0;
}
  
  
  

Measured memory_bytes: 128
def partition(a_list):
    # 仕切り位置をi-1とiの間、比較している値の位置をjとする
    i = 0
    for j in range(len(a_list) - 1):
        if a_list[j] > a_list[len(a_list) - 1]:
            continue
        else:
            a_list[i], a_list[j] = a_list[j], a_list[i]
            i += 1
    a_list[len(a_list) - 1] = '[' + str(a_list[len(a_list) - 1]) + ']'
    a_list[i], a_list[len(a_list) - 1] = a_list[len(a_list) - 1], a_list[i]

n = int(input())
A = list(map(int, input().split()))
partition(A)
print(' '.join(map(str, A)))



Measured memory_bytes: 16384
/**
 * At Boss's Expense
 */

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

import static java.lang.Integer.parseInt;

public class Main {

	static boolean[] primes = new boolean[1000001];

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;

		//
		Arrays.fill(primes, true);
		for (int i = 2; i < 1000000 / 2 + 1; i++) {
			if (primes[i]) {
				for (int j = 2 * i; j < 1000000 + 1; j += i) {
					primes[j] = false;
				}
			}
		}

		while ((line = br.readLine()) != null && !line.isEmpty()) {
			int n = parseInt(line.substring(0, line.indexOf(' ')));
			int x = parseInt(line.substring(line.indexOf(' ') + 1));
			if ((n | x) == 0) break;

			int max = 0;
			int[] dp = new int[x + 1];
			int[] c = new int[n];

			for (int i = 0; i < n; i++) c[i] = parseInt(br.readLine());
			for (int i = 0; i < n; i++) {
				for (int j = c[i]; j <= x; j++) {
					dp[j] = Math.max(dp[j], dp[j - c[i]] + c[i]);
					if (primes[dp[j]]) max = Math.max(max, dp[j]);
				}
			}
			System.out.println(max != 0 ? max : "NA");
		}//end while
	}//end main
}

Measured memory_bytes: 88856
N = int(input())
a = list(map(int, input().split()))
f = None
count = 1
for i in range(N - 1):
    if f is None:
        if a[i] < a[i + 1]:
            f = 1
        elif a[i] > a[i + 1]:
            f = -1
        continue

    if (f == 1 and a[i] > a[i + 1]) or (f == -1 and a[i] < a[i + 1]):
        count += 1
        f = None

print(count)
        
    

Measured memory_bytes: 14252
package main

import (
	"fmt"
)

func main() {
	var X int
	fmt.Scan(&X)

	x := X
	res := 2
	if x != 2 {
		if X%2 == 0 {
			x = X + 1
		}
		// fmt.Println(x)
		for i := x; ; i += 2 {
			flag := true
			for j := 3; j < X; j += 2 {
				// fmt.Println(i, j)
				if i%j == 0 {
					flag = false
					break
				}
			}
			if flag {
				res = i
				break
			}
		}
	}

	fmt.Println(res)
}


Measured memory_bytes: 512
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;


public class Main {

    public static void main(String[] args) {
       
        Scanner sc = new Scanner(System.in);
        
       List<Mgawa> list = new ArrayList<>();
       int x,y;
       
       while((x = sc.nextInt()) != 0 && (y =sc.nextInt()) != 0) list.add(new Mgawa(x,y));    
      
       for(Mgawa m : list){   // for(int i=0; i<list.size(); i++) ??
           m.pie();
           System.out.println();
       }
      
       
    }
    
    
}

class Mgawa{
    int x,y;
    Mgawa(int x, int y){
        this.x = x;
        this.y = y;
    }
            

public void pie() {
    
    for(int i=0; i<this.x; i++){
        for(int j=0; j<this.y; j++){
            
        if((i + j) %2 == 0){
            System.out.print("#");
        }else{
            System.out.print(".");
        }
        }
        
        System.out.println();
    }
    
    
}   
    
    
}   
        
    

       

   


        
    

       

   




Measured memory_bytes: 35584
/*

Auther: Ganesh Bhandarkar
							#   RUN   #
		<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>
*/

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

/* KEYWORDS */
#define FASTIO ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
#define pb push_back
#define mk make_pair
#define sq(a) (a)*(a)
#define rep(i,a,b) for(int i=a;i<b;++i)

/*DATATYPES */
typedef double db;
typedef long long ll;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<long long> vll;
typedef pair<int , int > pi;
typedef pair<int , char > pic;
typedef pair<char , char > pc;
typedef pair<char , int > pci;

/*Constants */
const ll mod = 10000000007;

/* Booleans */
// bool OE(int n)  if(n & 1){ return true; } else false;


int main(){

	// #ifndef OJ
	// freopen("input.txt","r",stdin);
	// freopen("output.txt","w",stdout);
	// #endif

	
	
	FASTIO

	int n,m;
	cin>>n>>m;
	if(n>m){
		cout<<"No";
	}else if(n==m){
		cout<<"Yes";
	}


	return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<pi> vp;
typedef vector<pl> vpl;

int main()
{
	ios_base::sync_with_stdio(false); 
	cin.tie(nullptr); 
	cout.tie(nullptr); 
	cerr.tie(nullptr);	

	int n;
	cin >> n;

	vi a(n);
	for (auto& i : a)
		cin >> i;

	vi dp(n, INT32_MAX);
	dp[0] = 0;
	dp[1] = abs(a[1] - a[0]);
	for (int i = 2; i < n; ++i){
		dp[i] = min(dp[i - 1] + abs(a[i] - a[i - 1]), dp[i - 2] + abs(a[i] - a[i - 2]));
	}

	cout << dp[n - 1] << '\n';
}

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

#define ll long long
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    char a,b; cin >> a >> b;
    if((a=='H'&&b=='H')|| (a=='D'&&b=='D')) cout << "H" <<endl;
    else cout << "D" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;   
using ll = long long;
const int INF = 1e9 + 5;
int main() 
{ 
	int n, k; cin >> n >> k;
	vector<int > h(n);
	for(int& x : h) cin >> x;
	vector<int > dp(n, INF);
	dp[0] = 0;
	for(int i = 0; i < n; i++){
		for(int j = i+1; j <= i+k; j++) {
			if(j < n) {
				dp[j] = min(dp[j], dp[i] + abs(h[i] - h[j]));
			}
		}
	}
	cout << dp[n-1];

    return 0; 
} 

Measured memory_bytes: 1152
#include "bits/stdc++.h"
using namespace std;
typedef long long LL;

int main() {
	string N;
	cin >> N;
	if ((N[0] == N[1] && N[1] == N[2]) || (N[1] == N[2] && N[2] == N[3])) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define VV(type, c, m, n, i) vector<vector<type>> c(m, vector<type>(n, i));
#define rep(i,a,n) for(int i=(a), i##_len=(n); i<i##_len; ++i)
#define rrep(i,a,n) for(int i=(a); i>n; --i)
#define len(x) ((int)(x).size())
#define mp make_pair
#define eb emplace_back
typedef long long ll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
int main() {
	int H, W;
	while(true) {
		cin >> H >> W;
		if (H == 0 && W == 0) break;
		string s = "";
		rep(i, 0, W) s += "#";
		rep(i, 0, H) P(s);
		P("");
	}
	return 0;
}

Measured memory_bytes: 3148
#include<bits/stdc++.h>
using namespace std;
long long a[3000],n,k,cnt=0,c[3000],num=0,res,mod=1000000007,sum=0;
long long qpow(long long a,long b){
    long long res=1;
    while(b){
        if(b&1) res=(res*a)%mod;
        a=(a*a)%mod;
        b/=2;
    }
    return res%mod;
}
int main(){
    cin>>n>>k;
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    for(int i=1;i<=n;i++){
        for(int j=i+1;j<=n;j++){
            if(a[i]>a[j]) num++;
        }
        for(int j=1;j<i;j++){
            if(a[i]>a[j]) cnt++;
        }
    }
    res=qpow(2,mod-2);
    sum=(num*k%mod*(k+1)%mod*res%mod+cnt*k%mod*(k-1)%mod*res%mod)%mod;
    cout<<sum;
}

Measured memory_bytes: 256
#! /usr/bin/python
# -*- coding: utf-8 -*-

n = int(raw_input())
for i in range(n):
    ft = raw_input()
    s = set([ft])
    for j in range(1, len(ft)):
        c1 = ft[j:]
        c2 = ft[:j]
        s.add(c1+c2)
        s.add(c1[::-1]+c2)
        s.add(c1[::-1]+c2[::-1])
        s.add(c1+c2[::-1])
        s.add(c2+c1)
        s.add(c2[::-1]+c1)
        s.add(c2[::-1]+c1[::-1])
        s.add(c2+c1[::-1])

    print len(s)

        

Measured memory_bytes: 4272
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)n; i++)
#define all(x) (x).begin(),(x).end()
typedef long long int ll;
using namespace std;
int main()
{
  int n, d;
  cin >> n>>d;
  
  if(n %(2*d + 1) == 0){
    cout << n/(2*d + 1) << endl;
  }else{
    cout << n/(2*d + 1)  + 1<< endl;
  }



}


Measured memory_bytes: 256
import sys
n,m = map(int,input().split())
ls = []
for i in range(n):
    a,b = map(int,input().split())
    ls.append([a,b])

ls.sort()
drink = 0
money = 0
for i in ls:
    for j in range(i[1]):
        money += i[0]
        drink += 1
        if drink >= m:
            print(money)
            sys.exit()


Measured memory_bytes: 20064
import sys

input = sys.stdin.readline


class AtCoder:
    def main(self):
        A, B, K = map(int, input().split())
        tc= max(A - K, 0)
        ac = min(max(A + B - K, 0), B)
        print(str(tc) + ' ' + str(ac))


# Run main
if __name__ == '__main__':
    AtCoder().main()


Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
 
#define forn(i,n) for(int i=0;i<(int)(n);i++)
#define si(c) ((int)(c).size())
#define forsn(i,s,n) for(int i = (int)(s); i<((int)n); i++)
#define dforsn(i,s,n) for(int i = (int)(n)-1; i>=((int)s); i--)
#define all(c) (c).begin(), (c).end()
#define D(a) cerr << #a << "=" << a << endl;
#define pb push_back
#define eb emplace_back
#define mp make_pair
 
typedef long long int ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

template<int N>
struct mod {
    static const int MOD = N;

    // For MOD = 998244353, root = 3 works
    static const int root = 3;

    int value;

    mod(ll value=0) {
        this->value = value % MOD;
        if (this->value < 0) this->value += MOD;
    }

    bool operator==(const mod &o) const { return value == o.value; }
    bool operator!=(const mod &o) const { return value != o.value; }


    mod &operator+=(const mod &o) {
        value += o.value;
        if (value >= MOD) value -= MOD;
        return *this;
    }

    friend mod operator+(mod a, const mod &b) {
        return a += b;
    }

    mod &operator-=(const mod &o) {
        value -= o.value;
        if (value < 0) value += MOD;
        return *this;
    }

    friend mod operator-(mod a, const mod &b) {
        return a -= b;
    }

    mod &operator*=(const mod &o) {
        value = (ll) value * o.value % MOD;
        return *this;
    }

    friend mod operator*(mod a, const mod &b) {
        return a *= b;
    }

    int _inv(int a, int m) const {
        if (a <= 1) return a; 
        auto k = -_inv(m%a,a);
        if (k < 0) k += a;
        return ((ll)m*k+1) / a;
    }

    mod inverse() const {
        return (mod) {_inv(value, MOD)};
    }

    mod &operator/=(const mod &o) {
        return (*this) *= o.inverse();
    }

    friend mod operator/(mod a, const mod &b) {
        return a /= b;
    }

    mod operator^(ll e) {
        mod ans = 1, a = *this;
        while (e > 0) {
            if (e&1) ans *= a;
            e /= 2;
            a *= a;
        }
        return ans;
    }

    friend ostream &operator<<(ostream &out, mod m) {
        out << m.value;
        return out;
    }
};

using modnum = mod<998244353>;

const int N = 3030;

modnum dp[N][N];

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

    int a,b,c,d; 
    cin >> a >> b >> c >> d;
    for (int i = a; i <= c; i++) {
        for (int j = b; j <= d; j++) {
            if (i == a && j == b) {
                dp[i][j] = 1;
                continue;
            }
            dp[i][j] = 0;
            if (i > a) dp[i][j] += dp[i-1][j] * modnum(j);
            if (j > b) dp[i][j] += dp[i][j-1] * modnum(i);
            if (i > a && j > b) dp[i][j] -= dp[i-1][j-1] * modnum(i-1) * modnum(j-1);
        }
    }
    cout << dp[c][d] << endl;

    return 0;
}


Measured memory_bytes: 39384
n = int(input())
s = ["".join(sorted(str(input()))) for _ in range(n)]

t = {}
for i in range(n):
  if s[i] in t:
    t[s[i]] += 1
  else:
    t[s[i]] = 1
print(sum(t[k] * (t[k] -1) // 2 for k in t))

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

int main() {
  int N, A, X;
  cin >> N;
  cin >> A;
  X = (N % 500) - A;
  
  if (X <= 0) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
/*
                                                  __          __
      /\   |   |     /\   |  | |  |     /\   | / |  )   /\   |  )
     /__\  |   |    /__\  |--| |  |    /__\  |<  |-<   /__\  |-<
    /    \ |__ |__ /    \ |  | \__/   /    \ | \ |__) /    \ |  \

*/

#import<bits/stdc++.h>
typedef long long ll;
#define forl(n) for(int i=0; i<n; i++)
#define forll(i,a,b,c) for(int i=a; i<b; i+=c)
#define pb(n) push_back(n)

using namespace std;

int main()
{
    ll a,b,x;
    cin>>a>>b;
    x=a%b;
    cout<<min(x,b-x)<<"\n";
}


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

#define 	pi 				3.1415926536
#define 	mod 			1000000007
#define 	ll  			long long int
#define 	rep(i, a, b) 	for(int i = a ; i < b ; i++)
#define 	repn(i, n) 		for(int i = n - 1 ; i >= 0 ; i--)
#define 	loop(i, a, b)	for(int i = a ; i < b ; i++)
#define 	mod1 			1000003
#define 	hello 			"hello"
#define 	nl 				"\n"
#define 	ws 				" "
#define 	F 				first
#define 	S 				second
#define 	PB 				push_back
#define 	mp				make_pair
#define 	B 				begin()
#define 	E 				end()
#define 	all(v) 			v.begin(), v.end()
#define 	reset(a, val) 	memset(a, val, sizeof(a))
#define 	vi 				vector<int>
#define 	vs 				vector<string>
#define 	print(a) 		for(auto i : a)cout<<i<<" ";cout<<"\n"
#define 	boost 			ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

using namespace std;

//g++ -std=c++14
//fixed<<setprecision(9);
//max_element(mp.begin(), mp.end(), compare)
//greater<int>()


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

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

void solve()
{
  int a, b, c;cin>>a>>b>>c;
  cout<<c<<ws<<a<<ws<<b<<nl;

}

int main()
{
    boost;
  int t = 1;
  // cin>>t;
  while(t--)
      solve();    
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#define INDEX 3
int cube(int figure)
{
    int ans;
    ans=pow(figure,INDEX);
    return ans;
}

int main()
{
    int input,result;
    
    scanf("%d",&input);
    
    result=cube(input);
    
    printf("%d\n",result);
    
    return 0;
}


Measured memory_bytes: 2044
/*
Chase excellence, rating will come automatically.
*/
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define inf 1e9
#define mod 1000000007
#define ff first
#define ss second


int dp[2005][2005];

int fun(int sum, int curr)
{
    if (curr == sum)
    {
        return 1;
    }
    if (curr > sum)
    {
        return 0;
    }
    if (dp[sum][curr] != -1)
        return dp[sum][curr];
    int ans = 0;
    for (int i = 3; i <= sum; i++)
    {
        ans = (ans + fun(sum, curr + i))  % mod;
    }

    return dp[sum][curr] = ans;
}




void solve()
{
    int s;
    cin >> s;

    if (s < 3)
    {
        cout << 0 << "\n";
        return;
    }
    memset(dp, -1, sizeof(dp));
    cout << fun(s, 0);

}

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


Measured memory_bytes: 35048
#include <iostream>
#include <string>
#include <vector>

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

using namespace std;

int N, M;
vector< vector<bool> > A, B;

bool match(int x, int y)
{
  rep(i, M) rep(j, M) {
    if(A[x + i][y + j] != B[i][j]) return false;
  }
  return true;
}

int main()
{
  cin >> N >> M;

  A.resize(N);
  rep(i, N) {
    string a;
    cin >> a;
    A[i].resize(N);
    rep(j, N) A[i][j] = (a[j] == '.') ? false : true;
  }

  B.resize(M);
  rep(i, M) {
    string b;
    cin >> b;
    B[i].resize(M);
    rep(j, M) B[i][j] = (b[j] == '.') ? false : true;
  }

  rep(i, N - M + 1) rep(j, N - M + 1) {
    if(match(i, j)) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#define FOR(i, n) for(int i = 0; i < n; i++) 
using namespace std;

typedef pair<int,int> pii;
typedef long long ll;

void load() {
}

void solve() {
	int n; scanf("%d", &n);
	int cnt = 0;
	for (int i = 1; i <= n; i++) cnt += i % 2;
	printf("%.10f\n", (double)cnt / n); 
}

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


Measured memory_bytes: 128