akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<map>
#include<vector>
#include<queue>
#include<stack>
#include<climits>
#include<set>
#include<utility>
#include<typeinfo>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef set<int> S;
#define rep(i, n) for(int i=0; i<n; i++)
const ll MOD=1e9+7;

int main(){

  int n, d;
  cin >> n >> d;
  cout << (n+2*d)/(2*d+1) << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
#include <cmath>
#include <complex>
#include <map>
using namespace std;

#define rep(i,n) for(int i=0;i<int(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-8
#define F first
#define S second

static const double PI=6*asin(0.5);
typedef long long ll;
typedef complex<double> CP;
typedef pair<long long,int> P;
static const int INF=1<<24;

int main(){
	int n,t,e;
	int x[1100];
	cin>>n>>t>>e;
	rep(i,n){
		cin>>x[i];
		int tmp=x[i];
		rep(j,INF){
			if(x[i]>=t-e&&x[i]<=t+e){
				cout<<i+1<<endl;
				return 0;
			}
			if(x[i]>t+e) break;
			x[i]+=tmp;
		}
	}
	cout<<-1<<endl;
	return 0;
}

Measured memory_bytes: 1164
#!/usr/bin/env python3
# atcoder 
# Türkler var mı?
# Herkese memnün oldum
import sys

iimr = lambda: map(int, sys.stdin.readline().rstrip().split())



def 関数(a, v, b, w, t):
    
    d = abs(a - b)
    if v <= w:
        return "NO"
    s = v-w
    if d <= s*t:
        return "YES"
    else:
        return "NO" 

def çözmek():
    A, V = map(int, input().split())
    B, W = map(int, input().split())
    T = int(input())

    res = []
    res.append(関数(A, V, B, W, T))
    print(*res, sep="\n")

if __name__ == "__main__":
    çözmek()


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

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define rrep(i, n) for(ll i=(n)-1; i >=0; i--)
#define ALL(v) v.begin(),v.end()
#define rALL(v) v.rbegin(),v.rend()
#define FOR(i, j, k) for(ll i=j;i<k;i++)
#define debug_print(var) cerr << #var << "=" << var <<endl;
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cerr<<v[i]<<" "

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<ll, ll> P;
typedef long double ld;
struct edge{ll x, c;};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

ll modpow(ll a, ll n, ll mod){
  ll res=1;
  while(n>0){
    if(n&1) res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll modinv(ll a, ll mod){
  return modpow(a, mod-2, mod);
}

ll gcd(ll a, ll b){
  ll r = a%b;
  if(r==0) return b;
  else return gcd(b, a%b);
}

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}

struct UnionFind{
  ll N;
  llvec p;
  llvec cnt;
  UnionFind(ll n){
    N = n;
    p=llvec(N);
    cnt=llvec(N, 0);
    rep(i, N){
      p[i] = i;
      cnt[i] = 1;
    }
  }

  void con(ll a, ll b){
    P at = root(a);
    P bt = root(b);
    if(at.second!=bt.second){
      if(at.first>bt.first){
        swap(at, bt);
        swap(a, b);
      }
      p[at.second] = bt.second;
      cnt[bt.second]+=cnt[at.second];
      p[a]=bt.second;
    }
  }

  P root(ll a){
    ll atmp = a;
    ll c=0;
    while(atmp!=p[atmp]){
      atmp = p[atmp];
      c++;
    }
    p[a] = atmp;
    return {c, atmp};
  }

  bool is_con(ll a, ll b){
    P at=root(a);
    P bt=root(b);
    return at.second == bt.second;
  }
  
};

struct dijkstra{
  ll N;
  llvec d;
  vector<vector<edge>> e;
  dijkstra(ll n){
    N = n;
    //d = llvec(N, 1e18);
    e = vector<vector<edge>>(N);
  }

  void add_edge(ll from, ll to, ll cost){
    e[from].push_back({to, cost});
  }

  void run(ll start){
    priority_queue<P, vector<P>, greater<P>> que;
    que.push({0, start});
    d = llvec(N, 1e18);
    d[start]=0;
    while(!que.empty()){
      P q = que.top();que.pop();
      ll dc = q.first;
      ll x = q.second;
      if(dc>d[x]){
        continue;
      }else{
        for(auto ip: e[x]){
          if(d[ip.x]<=d[x]+ip.c){
            continue;
          }else{
            d[ip.x]= d[x]+ip.c;
            que.push({d[ip.x], ip.x});
          }
        }
      }
    }
  }  
};


/**************************************
** A main function starts from here  **
***************************************/
int main(){
  ll N, K;
  cin >> N>>K;
  string S;
  cin >> S;
  N=K;
  S[N-1] = tolower(S[N-1]);
  cout << S;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long                                    // long long省略
#define pb push_back                                    // push_back省略
#define mp make_pair                                    // make_pair省略
#define fi first                                        // first省略
#define se second                                       // second省略
#define itn int                                         // int誤字保険                                   // cout誤字保険
#define vecotr vector                                   // vector誤字保険
#define ednl endl                                       // endl誤字保険
#define opt() cin.tie(0); ios::sync_with_stdio(false)   // 入出力速度改善

#define rep(i,l,r) for(ll i=(l);i<(r);i++)               // 範囲[l, r)で刻み1のfor文(順方向)
#define repp(i,l,r,k) for(ll i=(l);i<(r);i+=(k))         // 範囲[l, r)で刻みkのfor文(順方向)
#define rrep(i,l,r) for(ll i=(r-1);i>=(l);i--)           // 範囲[l, r)で刻み1のfor文(逆方向)
#define rrepp(i,l,r,k) for(ll i=(r-1);i>=(l);i-=(k))     // 範囲[l, r)で刻みkのfor文(逆方向)
#define all(x) (x).begin(), (x).end()                   // vectorのポインタ位置指定用
#define max(p,q)((p)>(q)?(p):(q))                       // max拡張
#define min(p,q)((p)<(q)?(p):(q))                       // min拡張
#define bit(n,m)(((n)>>(m))&1)                          // 変数nのm番目のbitを取り出す

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int dy[]={0, 1, 0, -1};                                 // 4方向近傍
int dx[]={1, 0, -1, 0};                                 // 4方向近傍

#define INF ((1LL<<62)-(1LL<<31))
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p) pom(a,p-2,p)

////////////////////////////////////////////////////////////////////////////////////////
int main(){
    ll a, b, k; cin >> a >> b >> k;
    cout << max(a-k, 0) << " " << max(b+min(a-k,0),0) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define dump(x) cout << #x << " = " << (x) << "\n";
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 10007;
static const int INF = 1 << 25;
static const LL LL_INF = 1152921504606846976;
static const int dx[] = { -1, 0, 1, 0,  1, -1,  1, -1 };
static const int dy[] = { 0, -1, 0, 1 , 1,  1, -1, -1 };
int ans;
int n;


int main() {
	while ( ~scanf( "%d", &n ) && n ) {
		ans = 0;
		while ( n != 0 ) {
			n /= 5;
			ans += n;
		}
		printf( "%d\n", ans );
	}
	return 0;
}

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

//define gcd and lcm (using 64bit)
ll gcd(ll a,ll b){
    if (a < b) {
        //^はxor(bitwise operator)。以下三行でswap(a,b)を行っている。
        a ^= b;
        b ^= a;
        a ^= b;
    }
    //only when b==0,this program finds that b means false and returns a.
    return b ? gcd(b, a % b) : a;
}

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


int main(){
    int a,b,c;
    cin>>a>>b>>c;
    cout<<((a+b+c>=22)? "bust" : "win")<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
long long a[2000];
long long money=1000;
long long num=0;
int main() {
	int n;
	cin>>n;
	for(int i=0; i<n; i++) cin>>a[i];
	vector<int>v;
	for(int i=0; i<n; i++) {
		if(a[i]!=a[i-1]) {
			v.push_back(a[i]);
		}
	}
	int len=v.size();
	int flag;
 
 
	if(v[1]>v[0]) flag=1;
	else flag=-1;
 
	if(flag==1) {
		num=1000/v[0];
		money=1000-num*v[0];
	}
	bool f=true;
	for(int i=1; i<len; i++) {
		int temp;
		if(v[i]>v[i-1]) {
			temp=1;
		} else {
			temp=-1;
		}
		if(temp!=flag) {
			f=false;
			if(flag==1) {//卖
				money+=num*v[i-1];
				num=0;
			}
			if(flag==-1) {//买
				num=money/v[i-1];
				money=money-num*v[i-1];
			}
			flag=-flag;
		}
	}
	if(f==true) {
		if(flag==1) cout<<1000-1000/v[0]*v[0]+1000/v[0]*v[len-1]<<endl;
		if(flag==-1) cout<<1000<<endl;
	} else {
		if(flag==1) money+=num*v[len-1];
		cout<<money<<endl;
	}
 
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n ; i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define whole(f, x, ...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x) // decltypeで型取得、引数があればva_argsのところに入れる
using namespace std;
typedef long long ll; // long longをllでかけるようにした
const int INF = 1e9;

bool compare_by_A(pair<string, int> a, pair<string, int> b){
    if(a.first == b.first) return a.second > b.second;
    else return a.first < b.first;
}

int main(void){
    int n;
    cin >> n;
    vector<pair<string, int>> A(n), B(n);
    REP(i, n) {
        cin >> A[i].first >> A[i].second;
        B[i].first = A[i].first;
        B[i].second = A[i].second;
    }
    whole(sort, A, compare_by_A);
    REP(i, n){
        REP(j, n){
            if(A[i].first == B[j].first && A[i].second == B[j].second) cout << j + 1 << endl;
        }
    }
}

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

int main(){
    int k[10];
    char g;
    while(1){
        int s=0,c=0,a,b;
        double v,p=0;
        for(int i=0;i<10;i++) cin>>k[i]>>g,p+=k[i];
        cin>>a>>g>>b;
        if(cin.eof())break;
        p/=(a+b),p*=a;
        while(p>s) s+=k[c],c++;
        cout<<c<<endl;
    }
}

Measured memory_bytes: 1160
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int n,a[10001],b[10001],t;
int ans=100000,bns=0;
int main()
{
	scanf("%d%d",&n,&t);
	for(int i=1;i<=n;i++)
	{
		scanf("%d %d",&a[i],&b[i]);
	}
	for(int i=1;i<=n;i++)
	{
		if(b[i]<=t)
		{
		ans=min(ans,a[i]);
		bns++;
		}
	}
	if(bns==0)
	{
		printf("TLE\n");
	}
	else cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
/*
@Date    : 2019-10-05 11:48:12
@Author  : Adscn (adscn@qq.com)
@Link    : https://www.cnblogs.com/LLCSBlog
*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define IL inline
#define RG register
#define gi geti<int>()
#define gl geti<ll>()
#define gc getchar()
#define File(a) freopen(a".in","r",stdin);freopen(a".out","w",stdout)
template<typename T>IL bool chkmax(T &x,const T &y){return x<y?x=y,1:0;}
template<typename T>IL bool chkmin(T &x,const T &y){return x>y?x=y,1:0;}
template<typename T>
IL T geti()
{
	RG T xi=0;
	RG char ch=gc;
	bool f=0;
	while(!isdigit(ch))ch=='-'?f=1:f,ch=gc;
	while(isdigit(ch))xi=xi*10+ch-48,ch=gc;
	return f?-xi:xi;
}
template<typename T>
IL void pi(T k,char ch=0)
{
	if(k<0)k=-k,putchar('-');
	if(k>=10)pi(k/10);
	putchar(k%10+'0');
	if(ch)putchar(ch);
}
/*
IL unsigned int LOG2(unsigned int x)
{
	unsigned int ret;
	__asm__ __volatile__ ("bsrl %1, %%eax":"=a"(ret):"m"(x));
	return ret;
}
*/
const int P=1e9+7;
const int N=307;
typedef pair<int,int> pii;
vector<pii>e[N];
int n,m,f[N][N][N];
bool check(int r,int b,int g)
{
	int mx=max(r,max(b,g));
	for(auto&&i:e[mx])
	{
		int l=i.first,x=i.second;
		int tot=0;
		if(r>=l)++tot;
		if(g>=l)++tot;
		if(b>=l)++tot;
		if(tot!=x)return false;
	}
	return true;
}
int main(void)
{
	int n=gi,m=gi;
	for(int i=1;i<=m;++i)
	{
		int l=gi,r=gi,x=gi;
		e[r].push_back(make_pair(l,x));
	}
	ll ans=0;
	f[0][0][0]=1;
	for(int i=0;i<=n;++i)
		for(int j=0;j<=n;++j)
			for(int k=0;k<=n;++k)
			{
				if(!f[i][j][k])continue;
				if((i==j&&i&&j)||(j==k&&j&&k)||(i==k&&i&&k)){f[i][j][k]=0;continue;}
				if(!check(i,j,k))continue;
				int mx=max(i,max(j,k));
				(f[mx+1][j][k]+=f[i][j][k])%=P;
				(f[i][mx+1][k]+=f[i][j][k])%=P;
				(f[i][j][mx+1]+=f[i][j][k])%=P;
				if(mx==n)(ans+=f[i][j][k])%=P;
			}
	pi(ans);
	return 0;
}

Measured memory_bytes: 112896
// ABC 153-D
// 2020.1.26 bal4u

#include <stdio.h>

typedef long long ll;

int main()
{
	ll H, a, ans;
	
	scanf("%lld", &H);
	a = 1, ans = 1;
	while (H > 1) {
		H >>= 1, a <<= 1;
		ans += a;
	}
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include<map>

using namespace std;
int m,n,x; 
map< int ,int >a;
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>x;
		a[x]++;
	}
	cin>>m;
	for(int i=1;i<=m;i++)
	{
		cin>>x;
		a[x]--;
		if(a[x]<0) 
		{
			printf("NO");
			return 0;
		}
	}
	printf("YES");
}

Measured memory_bytes: 9600
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define fast_io(); std::ios_base::sync_with_stdio(0); std::cin.tie(0); std::cout.tie(0);
const std::string yes = "Yes";
const std::string no  = "No";

int solve(int x){
    int y = 0;
    while(x%100==0){
        x /= 100;
        y++;
    }
    return y;
}

int main(){
    int d,n;
    std::cin >> d >> n;
    int cnt=0,ans=0;
    while(cnt<n){
        ans++;
        if(solve(ans)==d) cnt++;
    }
    std::cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 3580
A, B = map(int,input().split())

#A,Bに対し、得られるコインの枚数はCOIN１、COIN2、COIN３の３パターンあり、その中で最大値を表示したい

COIN1= A+B
COIN2=A + A-1
COIN3=B + B-1
#print(COIN1) 
#print(COIN2)
#print(COIN3)

if COIN1>= COIN2 and COIN1 >= COIN3:
        print(COIN1)
elif COIN2 >=COIN1 and COIN2 >= COIN3:
    print(COIN2)
elif COIN3 >= COIN1 and COIN3 >=COIN2:
    print(COIN3)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<bool> vb;

const int mod = 1000000007;
struct mint {
  ll x;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint& operator+=(const mint a) {
    if((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const {
    if(!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if(t & 1) a *= *this;
    return a;
  }
  // for prime mod
  mint inv() const { return pow(mod - 2); }
  mint& operator/=(const mint a) { return (*this) *= a.inv(); }
  mint operator/(const mint a) const {
    mint res(*this);
    return res /= a;
  }
};

int main() {
  int n;
  cin >> n;
  vi x(n);
  rep(i, n) cin >> x[i];
  mint ans = 0;
  vector<mint> c(n - 1);
  c[0] = 1;
  rep2(i, 1, n - 1) c[i] = c[i - 1] + mint(1) / (i + 1);
  mint fact = 1;
  rep2(i, 2, n) fact *= i;
  rep(i, n - 1) {
    mint ex = c[i] * (x[i + 1] - x[i]);
    ans += ex;
  }
  printf("%d\n", ans * fact);
}

Measured memory_bytes: 1408
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    //https://atcoder.jp/contests/abc141/tasks/abc141_a
    public class QuestionA
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            long[] inputLongArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();
            Console.WriteLine(Array.IndexOf(inputLongArray,0) + 1);

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 28252
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():
    sa = collections.deque(list(S()))
    sb = collections.deque(list(S()))
    sc = collections.deque(list(S()))
    ans = None 
    nxt = "a"

    while ans == None:
        if nxt == "a":
            if len(sa) == 0:
                ans = "A"
            else:
                nxt = sa.popleft()
        if nxt == "b":
            if len(sb) == 0:
                ans = "B"
            else:
                nxt = sb.popleft()
        if nxt == "c":
            if len(sc) == 0:
                ans = "C"
            else:
                nxt = sc.popleft()
    print(ans)
main()            


Measured memory_bytes: 68364
#include <stdio.h>
int n, f, h, g;
long long x;
char s[20];
long long m[20][20];
long long ans;
int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < 20; j++) {
			s[j] = '0';
		}
		scanf(" %s", s);
		h = 0;
		for (int j = 0; j < 20; j++) {
			if (s[j] == '.')h++;
		}
		x = 0;
		f = 0;
		if (h){
			for (int j = 0; j < 20 && f <= 10; j++) {
				if (s[j] != '.' && s[j] != NULL) {
					x *= 10;
					x += s[j] - '0';
					if (f)g++;
				}
				if (s[j] == '.')f = 1;
				if (s[j] == NULL) {
					for (int k = 0; k < 11 - f; k++)x *= 10;
					f = 10;
				}
				if (f)f++;
			}
		}
		else {
			h = 0;
			while (s[h] != NULL) {
				x *= 10;
				x += s[h] - '0';
				h++;
			}
			for (int k = 0; k < 9; k++)x *= 10;
		}
		h = 0;
		g = 0;
		while (x % 2 == 0 && h < 19) {
			h++;
			x /= 2;
		}
		while (x % 5 == 0 && g < 19) {
			g++;
			x /= 5;
		}
		m[h][g]++;
	}
	for (int i = 0; i < 20; i++) {
		for (int j = 0; j < 20; j++) {
			for (int k = 0; k < 20; k++) {
				for (int l = 0; l < 20; l++) {
					if (i != k || j != l) {
						if (i + k > 17 && j + l > 17)ans += m[i][j] * m[k][l];
					}
					else {
						if (i + k > 17 && j + l > 17)ans += m[i][j] * (m[i][j] - 1);
					}
				}
			}
		}
	}
	printf("%lld\n", ans / 2);
}

Measured memory_bytes: 1724
n,c,k=map(int,input().split())
customer=[int(input()) for i in range(n)]
customer=sorted(customer)
limit=-1
cnt=0
ans=0
for i in range(n):
    if cnt==0:
        limit=customer[i]+k
        cnt+=1
    else:
        if customer[i]>limit:
            ans+=1
            cnt=1
            limit=customer[i]+k
        else:
            if cnt<c:
                cnt+=1
            else:
                ans+=1
                cnt=1
                limit=customer[i]+k
if cnt>0:
    ans+=1
print(ans)

Measured memory_bytes: 8280
/*
[ ( ^ _ ^ ) ]
*/

// problem: atc/abc163_a

import java.io.*;
import java.util.*;


public class Main {
    int INF = (int)1e9;
    long MOD = 1000000007;


    void solve(InputReader in, PrintWriter out) throws IOException {
        int r = in.nextInt();
        out.println(2.0 * r * Math.PI);
    }
    

    public static void main(String[] args) throws IOException {
        InputReader in = new InputReader();
        PrintWriter out = new PrintWriter(System.out);
        int t = 1;//in.nextInt();
        while(t-- >0) {
            new Main().solve(in, out);
        }
        out.close();
    }
    
    public static void show(Object... o) {
        System.out.println(Arrays.deepToString(o));
    }
    
    static class InputReader {
        static BufferedReader br;
        static StringTokenizer st;
        public InputReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        int nextInt() { return Integer.parseInt(next()); }
        long nextLong() { return Long.parseLong(next()); }
        double nextDouble() { return Double.parseDouble(next()); }
    }
}

Measured memory_bytes: 33156
N, M = map(int, input().split())
A = [int(input()) for _ in range(M)]
mod = 10 ** 9 + 7

dp = [0] * (N + 1)
dp[0] = 1
for a in A:
    dp[a] = -1

for i in range(N):
    if dp[i] >= 0:
        if dp[i + 1] >= 0:
            dp[i + 1] += dp[i]
        if i + 2 <= N and dp[i + 2] >= 0:
            dp[i + 2] += dp[i]

print(dp[N] % mod)
# print(dp)


Measured memory_bytes: 462708
dic = {}

n = int(input())
for _ in range(n):
    s = input()
    if dic.get(s):
        dic[s] += 1
    else: 
        dic[s] = 1
        
m = int(input())
for _ in range(m):
    s = input()
    if dic.get(s):
        dic[s] -= 1
    else: 
        dic[s] = -1

ans = 0
for k, v in dic.items():
    ans = max(ans, v)
    
print(ans)



Measured memory_bytes: 3060
#include <algorithm>
#include <vector>
#include <iostream>
typedef long long int lli;
#define rep(i,s,N) for(int i=s;i<N;i++)
using namespace std;

lli euklid(lli x, lli y);

int main(void)
{
	int N, X; cin >> N >> X;
	vector<lli> distance(N);
	rep(i, 0, N) {
		lli tmp; cin >> tmp;
		distance[i] = abs(tmp - X);
	}
	lli ans = distance[0];
	rep(i, 1, N)ans = euklid(ans, distance[i]);

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

lli euklid(lli x, lli y)
{
	lli large = max(x, y);
	lli small = min(x, y);
	lli re = large % small;
	while (re > 0) {
		large = small;
		small = re;
		re = large % small;
	}

	return small;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define maxn 200005
int a[maxn],num[maxn],cnt[maxn];
int main()
{
	int n;
	cin>>n;
	for (int i=1;i<=n;i++) cin>>a[i];
	sort(a+1,a+1+n);
	int cc=0;
	int nt=0;
	for (int i=1;i<=n;i++)
	 {
	 	if (a[i]!=a[i-1])
		{
			num[cc]=a[i-1];
			cnt[cc]=nt;
			cc++;
			nt=1;
		}
		else nt++;
	 }
	 int m;
	 cin>>m;
	 num[cc]=a[n];cnt[cc]=nt;
	 for (int i=1;i<=m;i++)
	 {
	 	int x;
		cin>>x;
		int pos=lower_bound(num+1,num+1+cc,x)-num;
	 	if (cnt[pos]==0 || num[pos]!=x)
		{
			printf("NO\n");
			return 0;
		}
		if (num[pos]==x)
		{
			cnt[pos]--;
		}
	 }
	 printf("YES\n");return 0;
}


Measured memory_bytes: 2560
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <algorithm>

using namespace std;
typedef long long ll;

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

  vector <int> B(M);
  for(int i=0;i<M;i++ )
    cin >> B[i];

  int ans = 0;
  for(int i=0;i<N;i++ )
    {
      int s = 0;
      int tmp = 0;
      for(int j=0;j<M;j++ )
	{
	  cin >> tmp;
	  s += tmp*B[j];
	}
      if( s+C>0 )
	ans++;
    }
  cout << ans << endl;
  return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;

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

  vector<ll> p(n, k);
  for (ll i = 0; i < q; ++i) {
    ll a;
    cin >> a;
    p[a-1] += 1;
  }

  for (ll i = 0; i < n; ++i) {
    p[i] -= q;
    if (p[i] > 0) cout << "Yes" << endl;
    else cout << "No" << endl;
  }

  return 0;
}

Measured memory_bytes: 1408
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))

#################

N,R = LI()

if N>=10:
    print(R)
else:
    print(R+100*(10-N))

Measured memory_bytes: 38384
#!/usr/bin/env python3
import sys

MOD = 1000000007  # type: int

def init(H, W, a):
    val=1
    for i in range(W):
        if a[0][i]=="#":
            val=0
            continue
        a[0][i]=val

    val=1
    for i in range(H):
        if a[i][0]=="#":
            val=0
            continue
        a[i][0]=val

def solve(H: int, W: int, a: "List[List[str]]"):
    init(H, W, a)
    for i in range(1,H):
        for j in range(1,W):
            if a[i][j]=="#": continue
            val=0
            if a[i-1][j]!="#": val+=a[i-1][j]
            if a[i][j-1]!="#": val+=a[i][j-1]
            a[i][j]=val%MOD
    print(a[H-1][W-1])
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    W = int(next(tokens))  # type: int
    #a = [[next(tokens) for _ in range(1)] for _ in range(H)]  # type: "List[List[str]]"
    a = [list(next(tokens)) for _ in range(H)]  # type: "List[List[str]]"
    solve(H, W, a)

if __name__ == '__main__':
    main()


Measured memory_bytes: 43616
using System;
using System.Collections.Generic;
using System.Text;

namespace AtTest.ABC_103
{
    class A
    {
        static void Main(string[] args)
        {
            Method(args);
            Console.ReadLine();
        }

        static void Method(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int[] array = new int[3];
            for (int i = 0; i < 3; i++)
            {
                array[i] = int.Parse(input[i]);
            }

            int cost = 0;
            Array.Sort(array);
            cost += array[1] - array[0];
            cost += array[2] - array[1];

            Console.WriteLine(cost);
        }
    }
}


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

int main() {
  int X, Y, Z;
  cin >> X >> Y >> Z;
  int ans = 0;
  if (X % (Y + Z) >= Z) ans = X / (Y + Z);
  else ans = X / (Y + Z) - 1;
  cout << ans << endl;
}

Measured memory_bytes: 256
H, W = map(int, input().split())
a = [input() for _ in range(H)]

MOD = 10**9+7

dp = [[0]*W for _ in range(H)]

for i in range(H):
    if a[i][0] == '.':
        dp[i][0] = 1
    else :
        break

for j in range(W):
    if a[0][j] == '.':
        dp[0][j] = 1
    else :
        break

for i in range(H):
    for j in range(W):
        if i != 0  or j != 0:
            if a[i][j] == '#':
                dp[i][j] = 0
            else :
                dp[i][j] = (dp[i-1][j]+dp[i][j-1])%MOD
print(dp[H-1][W-1])


Measured memory_bytes: 49212
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define inf 1000000000
#define pb push_back
#define mp make_pair
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
int main(){
IOS;
lli n,w,x,y,i,j;
cin>>n>>w;
vector<pair<lli,lli> > v;
for(i=0;i<n;i++){
    cin>>x;
    cin>>y;
    v.pb(mp(x,y));
}
lli dp[n][w+1]={0};
sort(v.begin(),v.end());
for(j=0;j<=w;j++){
    if(j<v[0].first)
        dp[0][j]=0;
    else dp[0][j]=v[0].second;
}
for(i=0;i<n;i++){
    dp[i][0]=0;
}
for(i=1;i<n;i++){
    for(j=1;j<=w;j++){
        if(j<v[i].first)
        dp[i][j]=dp[i-1][j];
        else{
            dp[i][j]=max(v[i].second+dp[i-1][j-v[i].first],dp[i-1][j]);
        }
    }
}
cout<<dp[n-1][w]<<endl;
}


Measured memory_bytes: 78336
import heapq


X,Y,Z,K = map(int,input().split())

Alist = list( map(int, input().split()))
Blist = list(map(int, input().split()))
Clist = list( map(int, input().split()))
Alist.sort(reverse=True)
Blist.sort(reverse=True)
Clist.sort(reverse=True)

sum =[]
heapq.heapify(sum)

arg_hash = {}
heapq.heappush(sum,((Alist[0]+Blist[0]+Clist[0])*(-1),(0,0,0)))

for i in range(0,K):
    ans,(a,b,c) = heapq.heappop(sum)
    print(-ans)

    arg_a = a+1,b,c
    arg_b = a,b+1,c
    arg_c = a,b,c+1

    if a < X-1 and arg_a not in arg_hash:
        heapq.heappush(sum,((Alist[a+1]+Blist[b]+Clist[c])*(-1),arg_a))
        arg_hash[arg_a]=1
    if b < Y-1 and arg_b not in arg_hash:
        heapq.heappush(sum,((Alist[a]+Blist[b+1]+Clist[c])*(-1),arg_b))
        arg_hash[arg_b]=1
    if c < Z - 1 and arg_c not in arg_hash:
        heapq.heappush(sum, ((Alist[a] + Blist[b] + Clist[c+1]) * (-1), arg_c))
        arg_hash[arg_c] = 1

Measured memory_bytes: 4764
#include <bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i, n) for (i = 0; i < n; i++)
#define Fo(i, k, n) for (i = k; k < n ? i < n : i > n; k < n ? i += 1 : i -= 1)
#define ll long long
#define si(x) scanf("%d", &x)
#define sl(x) scanf("%lld", &x)
#define ss(s) scanf("%s", s)
#define pi(x) printf("%d\n", x)
#define pl(x) printf("%lld\n", x)
#define ps(s) printf("%s\n", s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for (auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int> pii;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
typedef vector<pl> vpl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
int mpow(int base, int exp);
void ipgraph(int m);
void dfs(int u, int par);
const int mod = 1000000007;
const int N = 3e5, M = N;
//=======================

vi g[N];
int a[N];

int main()
{
    ios_base::sync_with_stdio(0);
    int t, i, j, k, p, q, r, x, y, u, v, n, m;
    cin >> r;
    cout<<setprecision(22)<< (double)2 * PI * r;
    return 0;
}

int mpow(int base, int exp)
{
    base %= mod;
    int result = 1;
    while (exp > 0)
    {
        if (exp & 1)
            result = ((ll)result * base) % mod;
        base = ((ll)base * base) % mod;
        exp >>= 1;
    }
    return result;
}

void ipgraph(int n, int m)
{
    int i, u, v;
    while (m--)
    {
        cin >> u >> v;
        g[u - 1].pb(v - 1);
        g[v - 1].pb(u - 1);
    }
}

void dfs(int u, int par)
{
    for (int v : g[u])
    {
        if (v == par)
            continue;
        dfs(v, u);
    }
}


Measured memory_bytes: 10840
n,m,*a=map(int,open(0).read().split())
c=(0,2,5,5,4,5,6,3,7,6)
d=[0]*n*9
for i in range(n):
 for j in a:
  if d[i]or i<1:d[i+c[j]]=max(d[i+c[j]],d[i]*10+j)
print(d[n])

Measured memory_bytes: 15332
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define all(x) x.begin(),x.end()

template<class T>
static inline std::vector<T> ndvec(size_t&& n, T val) { return std::vector<T>(n, std::forward<T>(val)); }
template<class... Tail>
static inline auto ndvec(size_t&& n, Tail&&... tail) {
  return std::vector<decltype(ndvec(std::forward<Tail>(tail)...))>(n, ndvec(std::forward<Tail>(tail)...));
}
template<class Cond> struct chain {
  Cond cond; chain(Cond cond) : cond(cond) {}
  template<class T> bool operator()(T& a, const T& b) const { if(cond(a, b)) { a = b; return true; } return false; }
};
template<class Cond> chain<Cond> make_chain(Cond cond) { return chain<Cond>(cond); }

int main() {
  i64 N, K;
  cin >> N >> K;

  if(2 * K - 1 > N) {
    cout << -1 << endl;
    return 0;
  }
  vector<vector<i64>> ans(3);
  i64 nk = (N + 1) / 2;
  if(N % 2 == 1) {
    rep(i,0,nk) {
      ans[0].push_back(nk + i);
      ans[1].push_back(4 * nk + i - 2);
      ans[2].push_back(5 * nk + 2 * i - 2);
    }
    rep(i,0, nk - 1) {
      ans[0].push_back(2 * nk + i);
      ans[1].push_back(3 * nk - 1 + i);
      ans[2].push_back(5 * nk - 1 + 2 * i);
    }
  }
  else {
    ans[0].push_back(nk);
    ans[1].push_back(3 * nk);
    ans[2].push_back(5 * nk);
    rep(i,0,nk) {
      ans[0].push_back(2 * nk + i);
      ans[1].push_back(3 * nk + 1 + i);
      ans[2].push_back(5 * nk + 1 + 2 * i);
    }
    rep(i,0, nk - 1) {
      ans[0].push_back(nk + 1 + i);
      ans[1].push_back(4 * nk + 1 + i);
      ans[2].push_back(5 * nk + 2 + 2 * i);
    }
  }
  i64 delta = nk - K;
  for(int j = 0; j < 3; j++) {
    for(int i = 0;i < N; i++) {
      ans[j][i] = ans[j][i] - delta;
    }
  }
  for(int i = 0;i < N; i++) {
    cout << ans[0][i] << " " << ans[1][i] << " " << ans[2][i]<< "\n";
  }
}


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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const ll INF = 1e9+10;
const ll MOD = 1e9+7;
const ll LINF = 1e18;



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  
  ll n; cin>>n;
  string s; cin>>s;
  
  ll r=0;
  bool flg=false;
  rep(i,n){
    if(s[i]=='W') flg=true;
    if(flg && s[i]=='R') r++;
  }
  
  ll ans=0;
  flg=false;
  rep(i,n){
    if(r==0) break;
    if(s[i]=='R'){
      if(flg) r--;
      continue;
    }
    flg=true;
    ans++;
    r--;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3768
#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<unordered_map>
#include<queue>
#include<stack>
#include<string>
#include<bitset>
#include<random>
#include<time.h>
#define MOD 1000000007ll
#define INF 1000000000ll
#define EPS 1e-10
#define REP(i,m) for(long long i=0; i<(ll)m; i++)
#define FOR(i,n,m) for(long long i=n; i<(ll)m; i++)
#define DUMP(a) for(long long dump=0; dump<(ll)a.size(); dump++) { cout<<a[dump]; if(dump!=(ll)a.size()-1) cout<<" "; else cout<<endl; }
#define ALL(v) v.begin(),v.end()
#define UNIQUE(v) sort(v.begin(),v.end()); v.erase(unique(v.begin(),v.end()),v.end());
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll n;
	cin>>n;
	vector<ll> a(n);
	REP(i,n) cin>>a[i];
	vector<ll> idx1(20,-1);
	vector<ll> idx2(20,-1);
	ll ans=0;
	REP(i,n) {
		bitset<20> bi(a[i]);
		ll maxi=0;
		REP(j,20) {
			if(bi[j]==1) maxi=max(maxi,idx1[j]+1);
			else maxi=max(maxi,idx2[j]+1);
		}
		ans+=i-maxi+1;
		REP(j,20) {
			if(bi[j]==1) {
				idx2[j]=idx1[j];
				idx1[j]=i;
			}
		}
		//cout<<i<<" "<<ans<<endl;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 1792
#include <stdio.h>

int check_sum(int n) {
  int s = 0;
  s += n/10000;
  s += (n%10000) / 1000;
  s += (n%1000) / 100;
  s += (n%100) / 10;
  s += n%10;
  return s;
}

int main() {
  int N, A, B;
  int sum = 0;
  scanf("%d %d %d", &N, &A, &B);
    while (N > 0) {
      int digit_sum = check_sum(N);
      if (A <= digit_sum && digit_sum <= B) {
        sum += N;
      }
      N--;
    }
    printf("%d\n", sum);

    return 0;
}


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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int x,y,z;
    cin >> x >> y >> z;
    cout << (x + y + z) - max(x ,max(y,z))<<endl;
    return 0;
}


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


using namespace std;

void Solution()
{
    double x1, x2;
    double y1, y2;
    double x3, x4;
    double y3, y4;
    
    while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4)
    {
        double a = (x2 - x1) * (x4 - x3);
        double b = (y2 - y1) * (y4 - y3);
        
        if((float)a + (float)b == 0) // don't forget change to float
        {
            cout<<"YES"<<endl;
        }
        else
        {
            cout<<"NO"<<endl;
        }
        
    }
}

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

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

int main(){
	int m;
	cin >> m;
	int n, k;
	int x[100000];
	int dx[100000];

	for(int ii=0; ii<m; ii++){
		cin >> n >> k;
		for(int i=0; i<n; i++){
			cin >> x[i];
		}
		for(int i=0; i<n-1; i++){
			dx[i] = x[i+1]-x[i];
		}
		sort(dx, dx+(n-1));

		int sum = x[n-1] - x[0];
		for(int i=0; i<(k-1); i++){
			sum -= dx[n-2-i];
		}
		cout << sum << endl;
	}

	return 0;
}

Measured memory_bytes: 1956
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#define ll long long int
#define lim 100010
#define mod 1e9+7
#define INF 1e9
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define ABS(x) ((x)>0?(x):-(x))
int compare(const void *a,const void *b){return *(int*)a-*(int*)b;}

int main(void){
	int r;
	scanf("%d",&r);
	printf("%d",3*r*r);
	return 0;
}

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

#include <iostream>
//#include <algorithm>
// #include <iomanip>
#define ll long long
#define map unordered_map
#define set unordered_set

using namespace std;

const ll MOD = 1000000007;

int main() {
  std::cout << std::fixed << std::setprecision(10);

  ll l;
  scanf("%lld", &l);

  long double three = 3.0;
  long double d = l / three;

  // cout << d << endl;

  long double ans = d * d * d;

  cout << ans << endl;
}


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

using namespace std;

#define rep(i,n) for(int i=0;i<(n);++i)
#define out(S) cout<<(S)<<endl;
#define ShowAll(collection) for(auto i:collection){out(i);}
#define beginend(v) v.begin(),v.end()
#define Foreach(item,collection) for(auto item : collection)

using pii=pair<int,int>;
using vb=vector<bool>;
using ll=long long;
using ull=unsigned long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vvc=vector<vector<char>>;
using ti3=tuple<int,int,int>;
using ulong=unsigned long;
template<typename T> void removeAt(vector<T>& v, int index) { v.erase(v.begin() + index); }
#define OCB(c) (c&1)|(c&2)<<2|(c&4)<<4|(c&8)<<6|(c&16)<<8|(c&32)<<10|(c&64)<<12|(c&128)<<14

int main(){
    int n,a,b;
    cin >>n>>a>>b;

    auto f=[](string s)->int{
        int rt=0;
        for(auto c:s){
            rt+=(c-'0');
        }
        return rt;
    };

    int ans=0;
    rep(i,n){
        auto next=to_string(i+1);
        auto res=f(next);
        if(a<=res&&res<=b){
            ans+=i+1;
        }
    }
    out(ans);
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
	const int MAX = 1001;
	while (true)
	{
		int n;
		cin >> n;
		if (!n)
			break;
		double score[MAX];
		double sum = 0;
		for (int i = 0; i < n; i++)
		{
			cin >> score[i];
			sum += score[i];
		}
		double average = sum / n;
		double sd = 0;
		for (int i = 0; i < n; i++)
			sd += pow(score[i] - average, 2);
		sd = sqrt(sd / n);
		printf("%.8f\n", sd);
	}
}


Measured memory_bytes: 3220
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
''' 
------------------------
author : iiou16
------------------------
'''

def main():
    N = int(input())
    S = input()

    count = 0
    for i in range(N):
        if i == 0:
            count += 1
        else:
            if S[i-1] != S[i]:
                count += 1
    print(count)


if __name__ == '__main__':
    main()

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

using namespace std;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    long long n,m;
    cin>>n>>m;
    long long ar[n];
    for(int i=0;i<n;i++){
        cin>>ar[i];
    }
    sort(ar,ar+n);
    for(int i=0;i<n;i++){
        if(ar[i]<=m){
            if(i==n-1&&ar[i]<m){
                cout<<i<<endl;
                return 0;
            }
            else if(i==n-1&&ar[i]==m){
                cout<<n<<endl;
                return 0;
            }
            m-=ar[i];
            continue;
        }
        else if(ar[i]>m){
            cout<<i<<endl;
            return 0;
        }
    }
    return 0;
}

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

int main(){
    ll x;
    cin >> x;
    ll ans;
    if ( x % 11LL > 6LL ) {
        ans = ( x / 11LL ) * 2LL + 2LL;
    }
    else if ( x % 11LL == 0LL ) {
        ans = ( x / 11LL ) * 2LL; 
    }
    else {
        ans = ( x / 11LL ) * 2LL + 1LL;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define fi first
#define se second
#define bigger (char)toupper
#define smaller (char)tolower
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<string> vs;
typedef vector<char> vc;
typedef long long ll;
typedef unsigned long long ull;

int main() {
    int X;
    cin>>X;
    bool ok=false;
    int i=X/100;
    int rest=X-i*100;
    if(rest>=0&&rest<=i*5) ok=true;
    if(rest<0) ok=false;
    if(ok) cout<<1<<endl;
    else cout<<0<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <vector>
#include <string>
#include <iomanip>
#include <functional>
#include <cassert>
#include <cstdlib>
#include <cmath>
#include <cstring>
using namespace std;


typedef long long lint, ll;
typedef long double ldouble, ld;

#ifdef LOCAL
	#define dbg(expr) cerr << "[" << __LINE__ << "] " << #expr << " = " << (expr) << '\n';
#else
	#define dbg(expr) (void) 0;
#endif


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

    int n;
    cin >> n;
    map<int, int> number;
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        for (int j = -1; j <= 1; j++)
            number[x + j]++;
    }
    int ans = 0;
    for (auto i : number)
        ans = max(ans, i.second);
    cout << ans << endl;
}

Measured memory_bytes: 4736
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
total = sum(a)

for i in range(n):
    if a[i] > b[i]:
        a[i] = a[i] - b[i]
    else:
        b[i] = b[i] - a[i]
        a[i] = 0
        if a[i+1] > b[i]:
            a[i+1] = a[i+1] - b[i]
        else:
            b[i] = b[i] - a[i+1]
            a[i+1] = 0

print(total - sum(a))


Measured memory_bytes: 82148
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cassert>
#include<cmath>
#include<queue>
#include<cstring>
#include<climits>
#include<sstream>
#include<deque>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<bitset>

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

using namespace std;

typedef long long ll;

int main() {
  int N;
  ll T;
  cin >> N >> T;
  vector<ll> t(N);
  rep(i,N) cin >> t[i];
  ll ans = 0;
  ll cur = 0;
  rep(i,N) {
    cur = max(cur,t[i]);
    ll nex = t[i] + T;
    if( nex > cur ) {
      ans += ( nex - cur );
    }
    cur = nex;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<int> G[10];
typedef pair<int,int> P;
map<P,int> S[10];
map<P,int> E;
int n,m,ans;
int dfs(int v,int eb=0,int vb=1){
  //cout<<v<<" "<<vb<<" "<<(1<<n)-1<<endl;
  if(vb+1==1<<n) return 1;
  if(S[v].count(P(eb,vb))) return S[v][P(eb,vb)];
  int res=0;
  for(int i=0;i<(int)G[v].size();i++){
    if(vb>>G[v][i]&1) continue;
    int k=E[P(v,G[v][i])];
    if(eb>>k&1) continue;
    res+=dfs(G[v][i],eb+(1<<k),vb+(1<<G[v][i]));
  }
  //cout<<v<<" "<<res<<endl;
  return S[v][P(eb,vb)]=res;
}
int main(){
  cin>>n>>m;
  for(int i=0;i<m;i++){
    int a,b;
    cin>>a>>b;
    a--;b--;
    G[a].push_back(b);
    G[b].push_back(a);
    E[P(a,b)]=E[P(b,a)]=i;
  }
  cout<<dfs(0)<<endl;
  return 0;
}


Measured memory_bytes: 768
#include <cstring>
#include <map>
#include <unordered_map>
#include <string>
#include <list>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstdio>
#include <iostream>
#include <set>
#include <unordered_set>
using namespace std;

#define MAX(a,b) (a>b?a:b)
#define MIN(a,b) (a<b?a:b)
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int, int> pii;

int gi() {
    int a;
    scanf("%d", &a);
    return a;
}

ll gli() {
    ll a;
#ifndef ONLINE_JUDGE
    scanf("%lld", &a);
#else
    scanf("%I64d", &a);
#endif
    return a;
}

int main() {
    int a[2];
    a[0] = gi();
    a[1] = gi();
    int n = gi();
    for (int i = 0; i < n; i++) {
        int j = i%2;
        a[j] /= 2; a[1-j] += a[j];
    }

    printf("%d %d\n", a[0], a[1]);

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Stack;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);

		char[] str = sc.next().toCharArray();

		Stack<Character> stack = new Stack<Character>();

//		int count = 0;
//		for(int i = 0; i < str.length; i++){
//			if(str[i] == '0'){
//				stack.push(0);
//			}
//			else {
//				if(!stack.isEmpty()){
//					stack.pop();
//					count++;
//				}
//			}
//		}
//
//		stack.removeAllElements();
//		int count2 = 0;
//		for(int i = 0; i < str.length; i++){
//			if(str[i] == '1'){
//				stack.push(0);
//			}
//			else {
//				if(!stack.isEmpty()){
//					stack.pop();
//					count2++;
//				}
//			}
//		}
//
//		System.out.println(Math.max(count*2, count2*2));

		int count = 0;

		for(int i = 0; i < str.length; i++){
			if(!stack.isEmpty() && stack.peek() != str[i]){
				stack.pop();
				count++;
			}
			else {
				stack.push(str[i]);
			}
		}

		System.out.println(count*2);
	}
}

Measured memory_bytes: 26372