akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>

#define FILL(a, n, x) memset((a), (x), sizeof ((a)[0]) * (n))
#define COPY(a, n, b) memcpy((b), (a), sizeof ((a)[0]) * (n))
#define FILLA(a, x) memset((a), (x), sizeof (a))
#define COPYA(a, b) memcpy((b), (a), sizeof (a))

using namespace std;

typedef long long li;
typedef unsigned long long lu;
const li infl = ~0LLU >> 2;

template <class T>
inline void Min(T &x, T y) {
  if (y < x) x = y;
}
template <class T>
inline void Max(T &x, T y) {
  if (y > x) x = y;
}

// const int mod = 998244353;
int mod;
inline int Add(int x) { return x >= mod ? x - mod : x; }
inline void Add(int &x, int y) { x += y; if (x >= mod) x -= mod; }
inline int Sub(int x) { return x < 0 ? x + mod : x; }
inline void Sub(int &x, int y) { x -= y; if (x < 0) x += mod; }
inline int Mul(int x, int y) { return (int)((li)x * y % mod); }
inline int Mul(int x, int y, int z) { return Mul(x, Mul(y, z)); }
int Pow(int x, int y) {
  int z = 1;
  for (; y; y >>= 1) {
    if (y & 1) z = Mul(z, x);
    x = Mul(x, x);
  }
  return z;
}
int Inv(int x) {
  return Pow(x, mod - 2);
}

// ----------------------------------------

const int maxn = 250;
const double eps = 1e-8;

int n;
int L[maxn * 2], R[maxn * 2];
int ord[maxn * 2];

void GetOrd(void) {
  int i = 0, j = n, k = 0;
  while (i < n && j < 2 * n) {
    if (L[i] > R[j]) {
      ord[k++] = i++;
    } else {
      ord[k++] = j++;
    }
  }
  while (i < n) {
    ord[k++] = i++;
  }
  while (j < 2 * n) {
    ord[k++] = j++;
  }
}

int f[2][maxn + 1][maxn + 1];

int main(void) {
  scanf("%d%d", &n, &mod);
  for (int i = 0; i < 2 * n; ++i) {
    L[i] = i < n ? ceil(sqrt(n * n - i * i) - eps) : 0;
    R[i] = floor(sqrt(4 * n * n - i * i) + eps) + 1;
    Min(R[i], 2 * n);
  }

  GetOrd();

  int cur = 0, nxt = 1;
  FILLA(f[cur], 0);
  for (int k = 0; k <= n; ++k) {
    f[cur][0][k] = 1;
  }

  for (int i = 0; i < 2 * n; ++i) {
    FILLA(f[nxt], 0);
    for (int j = 0; j <= n; ++j) {
      for (int k = 0; k <= n; ++k) {
        int val = f[cur][j][k];
        // if (val) {
        //   fprintf(stderr, "f[%d][%d][%d] = %d\n", i, j, k, val);
        // }
        int selected_large = j;
        int selected_small = i - j;
        int plan_small = 2 * n - k;
        int idx = ord[2 * n - i - 1];
        if (idx < n) {
          Add(f[nxt][j + 1][k],
              Mul(val, max(R[idx] - (plan_small + selected_large), 0)));
          Add(f[nxt][j][k],
              Mul(Sub(-val), max(L[idx] - selected_small, 0)));
        } else {
          Add(f[nxt][j][k],
              Mul(val, max(R[idx] - selected_small, 0)));
        }
      }
    }
    swap(cur, nxt);
  }

  int ans = 0;
  for (int k = 0; k <= n; ++k) {
    Add(ans, f[cur][k][k]);
  }
  printf("%d\n", Sub(ans % mod));
  return 0;
}


Measured memory_bytes: 640
//--------------------------------------------------
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,abm,mmx,avx,avx2,popcnt,fma")
#pragma GCC optimize("fast-math")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("Ofast")
//--------------------------------------------------
#include <bits/stdc++.h>
#include <chrono>
#include <set>
#include <map>
#include <deque>
#include <cmath>
#include <queue>
#include <cassert>
#include <random>
#include <bitset>
#include <iomanip>
#include <numeric>
#include <time.h>
#include <ctime>
#include <string>
#include <cstdio>
#include <vector>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <fstream>
#include <stack>
#include <cstring>
//--------------------------------------------------
#define forn(i, n) for(int i = 0; i < n; i++)
#define forw(i, n) for(int i = n-1; i >= 0; --i)
#define forns(i, n, s) for(int i = s; i < n; i++)
#define x first
#define y second
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
//----------------------------------------------------
using namespace std;
//----------------------------------------------------
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef long double ld;
typedef vector<ll> lnum;
typedef complex<ld> comp;
//----------------------------------------------------
const ll mod = 1e9 + 7, mod2 = 998244353;
const ld eps = 1e-6;
const ll inf = 1e18;
const int base = 1e9;
const ld PI = 3.1415926;
//----------------------------------------------------
#define endl '\n';
#ifdef MY_DEBUG
void deb(ld x) { cerr << x << endl; };
#else
void deb(ld x){};
#endif
//----------------------------------------------------
ll t, n, a, b, c, d;
map<ll, ll> m;
vector<pair<int, ll>> op;
//----------------------------------------------------
unsigned int bitcount(ull val) { return __builtin_popcount(val) + __builtin_popcount(val >> 32); }

void local() {
    freopen("test.in", "r", stdin);
}

void remote() {
}

void read() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cin >> t;
}

ll dfs(ll n){
    if(n == 0 || m[n] != 0) return m[n];
    ll ans = ld(4e18 / ld(d)) >= n ? n * d : INT64_MAX;
    for(auto &[mul, price]: op){
        ans = min(ans, price + dfs(n / mul) + (n % mul) * d);
        if(n % mul != 0){
            ans = min(ans, price + dfs(n / mul + 1) + (mul - n % mul) * d);
        }
    }
    return m[n] = ans;
}

int main() {
#ifdef MY_DEBUG
    local();
#else
    remote();
#endif
    read();

    while(t--){
        cin >> n >> a >> b >> c >> d;
        op.pb({2, a});
        op.pb({3, b});
        op.pb({5, c});
        m[0] = 0, m[1] = d;
        cout << dfs(n) << endl;
        m.clear();
        op.clear();
    }

}

Measured memory_bytes: 4484
S_list = [input() for i in range(2)]
S_list_1 = list(map(int,S_list[1].split()))

for i in S_list_1:   
    if i % 2 == 0 :
        if i % 3 !=0 and i % 5 !=0 :
            result="DENIED"
            break
    else:
        result="APPROVED"        
print(result)

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

int main()
{
    ios::sync_with_stdio(0);
    
    int N, K;
    cin >> N >> K;

    if(K == 1)
    {
        cout << 0 << "\n";
        return 0;
    }

    int minn = 1;
    int maxx = N - K + 1;

    cout << maxx - minn << "\n";
    return 0;
}


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

string s;

int main(){
	cin>>s;
	int open=0,sumT=0,banyakT=0;
	for(int i=0; i<s.length(); i++){
		if(s[i]=='S'){
			open++; 
		}
		if(s[i]=='T'&&open>0){
			open--; sumT++;
		}
		if(s[i]=='T')banyakT++;
	}
	cout<<open+banyakT-sumT<<'\n';
}

Measured memory_bytes: 3668
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=5e18;

int main() {
  ll k;
  cin >> k;
  vec ans(50);
  for(ll i=0;i<50;i++) {
    ans[i]=i+k/50;
  }
  k%=50;
  for(ll i=0;i<50;i++) {
    if(i<k) {
      ans[i]+=50-(k-1);
    }
    else {
      ans[i]-=k;
    }
  }
  cout << 50 << endl;
  for(ll i=0;i<50;i++) {
    if(i!=0) {
      cout << " ";
    }
    cout << ans[i];
  }
  cout << endl;
}

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

int main(){
  int X;
  cin >> X;
  int ans = 1;
  for(int i = 2; i < X; i++){
    int a = i*i;
    while(a <= X){
      ans = max(ans, a);
      a *= i;
    }
  }
    cout << ans << endl;
    return 0;
}


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


int main()
{
    ios::sync_with_stdio(false);
    int n = 0;
    int m = 0;
    cin >> n >> m;
    vector<int> dp(n + 1, n + 1);
    dp[0] = 0;
    vector<int> ds(m, 0);
    for (auto & di : ds) cin >> di;
    for (auto di : ds){
        if (di > n) continue;
        for (int i = di; i != n + 1; ++i){
            dp[i] = min(dp[i], dp[i - di] + 1);
        }
    }
    cout << dp[n] << endl;
    return 0;
}

Measured memory_bytes: 3204
#include <stdio.h>

int main(){
  int a,b,c,k;
  int result=0;
  
  scanf("%d %d %d %d",&a,&b,&c,&k);
  
  if(a<k){
    result+=a;
    k=k-a;
  } else {
    result=k;
    k=0;
  }
  
  if(k>0){
    if(b<k){
      k=k-b;
    } else {
      k=0;
    }
  }
  
  if(k>0){
    if(c<k){
      result-=c;
    } else {
      result-=k;
    }
  }
  
  printf("%d",result);
}

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

main() {
  int N;
  cin >> N;
  vector<char> S(N);
  for(int i=0; i<N; i++){
    cin >> S.at(i);
    if( S.at(i) == 'Y' ){
      cout << "Four";
      return 0;
    }
  }
  cout << "Three";
  return 0;
}

  
      

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

#define int long long
#define endl '\n'
#define pii pair<int, int>
#define all(v) v.begin(), v.end()
#define dvec(vct) for(auto i : vct) cout << i << " "; cout << endl;
#define darr(a, n) for(int i=0;i<n;) cout << a[i++] <<' '; cout<< '\n';
#define print_(x) cout << #x << " : " << x << endl;

const int mod = 1e9 + 7;

void solve() {
    int n;
    string s;
    cin >> n >> s;
    int cnt = 0;
    for (int i = 0; i <= n-3; i++) {
        if (s.substr(i, 3) == string("ABC")) {
            cnt++;
        }
    }
    cout << cnt << endl;
}

int32_t main() { 
    ios_base::sync_with_stdio(0); 
    cin.tie(NULL);
    int t = 1;
    // cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}


Measured memory_bytes: 256
def main():
    n, m = map(int, input().split())

    if m - 2 * n >= 0:
        m -= 2 * n
        ans = n
        n = 0

        if (m - 2 * n) % 4 == 0:
            tmp = (m - 2 * n) // 4
        else:
            tmp = (m - 2 * n) // 4 + 1

        ans += (m - 2 * tmp) // 2

    else:
        ans = m // 2

    print(ans)


if __name__ == '__main__':
    main()

Measured memory_bytes: 9160
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;

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


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

ll pow_mod(ll x, ll k){
  x %= MOD; x += MOD; x %= MOD;
  ll res = 1;
  while(k > 0){
    if(k % 2){
      res *= x; res %= MOD;
    }
    x *= x; x %= MOD;
    k /= 2;
  }
  return res;
}
ll inverse(ll x){return pow_mod(x, MOD - 2);};

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

ll lcm(ll x, ll y){return x / gcd(x, y) * y;};


int main(void){
  ll N, C, K;
  cin >> N >> C >> K;
  vector<ll> T(N);
  rep(i, N) cin >> T[i];
  sort(T.begin(), T.end());
  ll now = T[0];
  T.pb(INFL);
  ll cnt = 0;
  ll kyaku = 0;
  rep(i, N+1){
    kyaku++;
    if(T[i] - now > K || kyaku > C){
      kyaku = 1;
      now = T[i];
      cnt++;
    }
  }
  cout << cnt << endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define pp pop_back
#define in insert
#define ff first
#define ss second
#define  show for(int j=0;j<v.size();j++) cout<<v[j]<<" ";
#define ld long double
#define e endl
#define bc __builtin_popcount
#define MOD 1000000007
#define MAXN 200005
#define INT_SIZE 32
#define debug cout<<"we are debugging"<<endl;
#define me(x) memset(x,0,sizeof(x))
ll fast_expo(ll x,ll p)
{if(p==0) return 1;
else if(p%2==0){ ll t=fast_expo(x,p/2)%MOD;return (t*t)%MOD;} else return (x*(fast_expo(x,p-1))%MOD)%MOD;}
int main()
{
    int x;
    cin>>x;
    cout<<!x;

}



Measured memory_bytes: 3592
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <sstream>
#include <iomanip>
#include <iterator>
#include <cctype>
#define pb push_back
#define endl '\n'
#define ll long long
#define PI acos(-1)
#define RUN_FAST ios::sync_with_stdio(false);
#define sz 8000000
using namespace std;

int main()
{
    RUN_FAST; cin.tie(nullptr);
    int n, k, i, tmp, cnt;
    ll sum;

    cin >> n >> k;
    ll arr[n];
    for (i=0; i<n; i++) cin >> arr[i];

    tmp=n-k+1;
    ll arr2[tmp];
    sum=cnt=0;
    for (i=0; i<k; i++) sum+=arr[i];

    for (i=1; i<n; i++) arr[i]+=arr[i-1];

    arr2[cnt++]=sum;
    int x=0;
    for (i=k; i<n; i++) {
        arr2[cnt++]=arr[i]-arr[x++];
    }
    for (i=1; i<tmp; i++) {
        if (arr2[i]>arr2[i-1]) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    return 0;
}


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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

#define FF first
#define SS second

#define DUMP(x) cout<<#x<<":"<<(x)<<endl
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class T>
istream& operator>>(istream& is, vector<T>& xs){
  for(auto& x: xs)
	is >> x;
  return is;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

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

  int M;
  cin >> M;
  cout << 24-M + 24 << endl;

  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#define ll long long
using namespace std;
const int maxn=1e5+50,maxl=15;
int N;
ll ans=0,cnt;
char c;
struct Str{ int num[30]; }st[maxn];
inline bool cmp(const Str&a,const Str&b){
	for(int i=1;i<=26;i++)
		if(a.num[i]!=b.num[i])
			return a.num[i]<b.num[i];
	return 0;
}
int main(){
	scanf("%d",&N);
	for(int i=1;i<=N;i++){
		for(int j=1;j<=10;j++){
			c=getchar();
			while(c<'a'||c>'z')c=getchar();
			st[i].num[c-'a'+1]++;
		}
	}
	sort(st+1,st+N+1,cmp);
	cnt=1;
	for(int i=2;i<=N+1;i++){
		bool flag=1;
		for(int j=1;j<=26;j++){
			if(st[i].num[j]!=st[i-1].num[j]){
				flag=0;
				break;
			}
		}
		if(!flag){
			ans+=cnt*(cnt-1)/2;
			cnt=1;
		}
		else cnt++;
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 12032
#include <stdio.h>
int main(void)
{
  int N;
  scanf("%d", &N);
  if(N % 10 == 7 || N % 100 / 10 == 7 || N % 1000 / 100 == 7) 
    printf("Yes\n");
  else 
    printf("No\n");
}

Measured memory_bytes: 1640
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<deque>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<iterator>
#include<complex>
#include<stack>
#include "stdio.h"
using namespace std;

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

using ll = long long;
using Pii = pair<int, int>;

const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const long long mod_const = 1e9+7;

int dy[] = { 0, 0, 1, -1, 0 };
int dx[] = { 1, -1, 0, 0, 0 };

using MIte = multimap<ll, ll, greater<ll> >::iterator;

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

	// long long?
	ll A, B, C, D;
	cin >> A >> B >> C >> D;

	ll tim = 0;

	tim = min(B, D) - max(A, C);
	if (tim < 0) {
		tim = 0;
	}

	cout << tim << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define print(x)cout<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int f(string x, string y){
  vi cx(26,0),cy(26,0);
  rep(i,sz(x)){
    cx[x[i]-'a']++;
  }

  rep(i,sz(y)){
    cy[y[i]-'a']++;
  }

  int cnt = 0;
  rep(i,26)cnt+=(cx[i] && cy[i]);
  return cnt;
}
int main() {
  int n;
  cin>>n;
  string s;
  cin >> s;
  int ans = 0;
  rep(i,n){
    string x = s.substr(0,i);
    string y = s.substr(i,n);
    maxs(ans,f(x,y));
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
a = int(input())

if 400<=a<=599:
  print("8")
elif 600<=a<=799:
  print("7")
elif 800<=a<=999:
  print("6")
elif 1000<=a<=1199:
  print("5")
elif 1200<=a<=1399:
  print("4")
elif 1400<=a<=1599:
  print("3")
elif 1600<=a<=1799:
  print("2")
elif 1800<=a<=1999:
  print("1")


Measured memory_bytes: 9188
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
 
const int MOD = 1e9 + 7;
 
int main()
{
    
    int h, n; cin >> h >> n;
    vector<int> a(n);
    vector<int> b(n);
    for(int i = 0; i < n; i++) cin >> a[i] >> b[i];
    vector<int> dp(h + 1, INT_MAX);
	dp[0] = 0;
	for(int i = 1; i < h + 1; i++) for(int j = 0; j < n; j++) dp[i] = min(dp[i], dp[max(i - a[j], 0)] + b[j]);
	cout << dp[h];
 
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;


vi adj[100001];
int dp[100001][2];

void col_ways(int cur, int par = 0)
{
	dp[cur][0] = dp[cur][1] = 1;
	for (int nb : adj[cur]) {
		if (nb != par) {
			col_ways(nb, cur);
			dp[cur][0] *= (dp[nb][0] + dp[nb][1]), dp[cur][0] %= mod;
			dp[cur][1] *= dp[nb][0], dp[cur][1] %= mod;
		}
	}
}

int32_t main()
{
	FIO;

	int n; cin >> n;
	for (int i = 1; i < n; i++) {
		int u, v; cin >> u >> v;
		adj[u].pb(v);
		adj[v].pb(u);
	}

	col_ways(1);

	cout << (dp[1][0] + dp[1][1]) % mod << endl;

	return 0;
}

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

#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
using ll = long long;

int main() {
    FAST;

    int i, a, ans;

    for (i = 1; i <= 5; ++i) {
        cin >> a;
        if (!a) ans = i;
    }

    cout << ans;

    return 0;
}


Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    int i;
    bool ans=true;
    cin>>s;
    for(i=0;i<s.size();i++)
    {
        if(i%2&&s[i]=='R')
        {
            ans=false;
            break;
        }
        if(i%2==0&&s[i]=='L')
        {
            ans=false;
            break;
        }
    }
    cout<<(ans?"Yes":"No")<<endl;
}


Measured memory_bytes: 3596
import java.util.Map;
import java.util.Map.Entry;
import java.util.Scanner;
import java.util.TreeMap;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int tempo = sc.nextInt();
		int max = sc.nextInt();
		long amount = 0;
		Map<Long, Long> map = new TreeMap<>();
		for (int i = 0; i < tempo; i++) {
			long key = sc.nextInt();
			long value = sc.nextInt();
			if (map.containsKey(key)) {
				map.put(key, map.get(key) + value);
			} else {
				map.put(key, value);
			}
		}
		for (Entry<Long, Long> entry : map.entrySet()) {
			if (max <= entry.getValue()) {
				amount += max * entry.getKey();
				break;
			} else {
				amount += entry.getKey() * entry.getValue();
				max -= entry.getValue();
			}
		}
		System.out.println(amount);
		sc.close();
	}
}

Measured memory_bytes: 100948
#include <iostream>

using namespace std;

int main() {
    int N;
    cin >> N;
    int ans=0;
    char s[N];
    for (int i = 0; i < N; i++) {
        cin >> s[i];
    }
    for (int i = 0; i < N; i++) {
        if (s[i] != s[i+1]) {
            ans++;
        }
    }
    cout << ans << endl;
}

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

#define EPS 1.e-8
typedef long long int lli;
typedef complex<lli> C;

C v[4];
lli r;

double dot(C &a, C &b) {
  return a.real()*b.real() + a.imag()*b.imag();
}

double zcross(C &a, C &b) {
  return a.real()*b.imag() - a.imag()*b.real();
}

bool tri_in_check() {
  C a;
  lli ina;
  lli ir2 = r*r;
  for (int i=0; i<3; i++) {
    a = v[i] - v[3];
    ina = norm(a);
    if (ina > ir2) {
      return false;
    }
  }
  return true;
}

bool center_in_check() {
  C a, b;
  lli cab;
  bool f[3];
  for (int i=0; i<3; i++) {
    a = v[(i+1)%3] - v[i];
    b = v[3] - v[(i+1)%3];
    cab = zcross(a,b);
    f[i] = (cab > 0);
    if (cab*cab < norm(a)*r*r) {
      return false;
    }
  }
  return (f[0]==f[1] && f[0]==f[2]);
}

int intersect() {
  C a, b;
  double sd, s, t;
  long long int ina, inb, idab, id;
  bool contact = false;
  for (int i=0; i<3; i++) {
    a = v[(i+1)%3] - v[i];
    b = v[3] - v[i];
    ina = norm(a);
    inb = norm(b);
    idab = dot(a,b);
    id = idab*idab - ina*(inb-r*r);
    if (id < 0) {
      continue;
    }
    sd = sqrt((double)id);
    s = (idab+sd)/ina;
    t = (idab-sd)/ina;
    if ((s>EPS&&s<1.-EPS) || (t>EPS&&t<1.-EPS)) {
      if (!id) {
        contact = true;
      } else {
        return 1;
      }
    }
    if (fabs(s)<EPS || fabs(s-1.)<EPS || fabs(t)<EPS || fabs(t-1.)<EPS) {
      contact = true;
    }
  }
  return (contact ? 0 : -1);
}

int main() {
  int t;
  while (1) {
    cin >> v[0].real() >> v[0].imag();
    if (!v[0].real() && !v[0].imag()) break;
    for (int i=1; i<4; i++) {
      cin >> v[i].real() >> v[i].imag();
    }
    cin >> r;
    if (tri_in_check()) {
      cout << "b" << endl;
    } else {
      t = intersect();
      if (t == 1) {
        cout << "c" << endl;
      } else if (t == 0) {
        if (center_in_check()) {
          cout << "a" << endl;
        } else {
          cout << "c" << endl;
        }
      } else {
        if (center_in_check()) {
          cout << "a" << endl;
        } else {
          cout << "d" << endl;
        }
      }
    }
  }
  return 0;
}

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

int main(){
  ll a, b, c, d;
  cin >> a >> b >> c >> d;
  vector<vector<ll>> dp(c+1,vector<ll>(d+1));
  dp[a][b] = 1;
  for(int i = a; i <= c; i++) {
    for(int j = b; j <= d; j++) {
      (dp[i][j] += dp[i-1][j]*j + dp[i][j-1]*i - dp[i-1][j-1]*(i-1)*(j-1)) %= mod;
    }
  }
  if(dp[c][d] < 0) dp[c][d] += mod;
  cout << dp[c][d] << endl;
  return 0;
}


Measured memory_bytes: 73688
import copy

def j(n):
    if n:print("yes")
    else:print("no")
    exit(0)
rem = 10 ** 9 + 7

"""
def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")
"""

def ip():
    return int(input())
def iprow():
    return [int(i) for i in input().split()]
def ips():
    return (int(i) for i in input().split())
def ipmultiplerow(n):
    a = []
    for i in range(n):
        a.append(ip())
    return a
def printrow(a):
    for i in a:
        print(i)

n,k = ips()
a = iprow()
s = 0
for i in a:
    if i>=k:s+=1
print(s)

Measured memory_bytes: 12404
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <queue>
#include <sstream>
#include <stack>
#include <time.h>
#include <vector>
#include <complex>
#include <map>
#include <set>
#include <iomanip>
#include <math.h>
#include <stdlib.h>
#include <list>
#include <utility>
#include <memory>
#include <cstring>
#include <fstream>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <ios> 
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
ll a[100005];
ll dp[100005][2]; 
int main(){
	cin>>n;
	for (int i=1;i<=n;i++) cin>>a[i];
	if(a[1]!=0)dp[1][1]=(a[1]-1ll)/2ll;
	else dp[1][1]=-1e9;
	dp[1][0]=a[1]/2ll;
	for (int i=2;i<=n;i++){
		if(a[i]==0ll) dp[i][1]=-1e9,dp[i][0]=dp[i-1][0];
		else{
			dp[i][1]=(a[i]-1ll)/2ll+dp[i-1][0];
			if (a[i]>=2ll) dp[i][1]=max(dp[i][1],dp[i-1][1]+1ll+(a[i]-2ll)/2ll);
			dp[i][0]=max(a[i]/2ll+dp[i-1][0],dp[i-1][1]+1ll+(a[i]-1ll)/2ll); 
		}
	}
	cout<<dp[n][0];
}

Measured memory_bytes: 2560
use std::io;
use std::str::FromStr;

fn main() {
    let stdin = io::stdin();
    let mut buf = String::new();
    stdin.read_line(&mut buf).ok();
    let mut it = buf.split_whitespace().map(|n| isize::from_str(n).unwrap());
    let (n, m) = (it.next().unwrap(), it.next().unwrap());
		
		if n+m > n*m{
			if n+m > n-m{
				println!("{}",n+m);
			}
			else{
				println!("{}",n-m)
			}
		}
		else{
			if n*m > n-m{
				println!("{}",n*m);
			}
			else{
				println!("{}",n-m);
			}
		}
}

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

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if (((a - b) * (a - b) <= d * d && (b - c) * (b - c) <= d * d) || (a - c) * (a - c) <= d * d) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_s(): return list(input().split())


N = int(input())
aa = inpl()
sums = defaultdict(int)
numbers = set()

for a in aa:
	sums[a] += 1

ans = 0
eve = 0
for i in range(1,10**5+3):
	tmp = sums[i]
	if tmp <= 1:
		continue
	else:
		if tmp%2 == 1:
			ans += (tmp-1)//2
		else:
			ans += tmp//2-1
			eve += 1

ans += (eve+1)//2
print(N-ans*2)


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

using namespace std;

const int N = 2e5+5;

int n;
int a[N];

int main(){
    cin >> n;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
    }
    sort(a + 1 , a + n + 1);
    reverse(a + 1 , a + n + 1);
    long long ans = 0;
    int idx = 1;
    int cnt = 1;
    for(int i = 1; i <= n - 1; i++){
        ans += a[idx];
        cnt++;
        if(cnt == 2){
            idx++;
            cnt = 0;
        }
    }
    cout << ans << "\n";
}


Measured memory_bytes: 4384
N=int(input())
if N==3:
  print(2,5,63)
  exit()
k=0
a=[]
S=0
for i in range(2,30001):
  if k<N-2:
    if i%2==0 or i%3==0 or i%5==0:
      a.append(str(i))
      k+=1
      S+=i
  elif k==N-2:
    if S%2==0:
      if i%2==0:
        a.append(str(i))
        k+=1
        S+=i
        break
    elif S%2==1:
      if i%2==1:
        if i%3==0 or i%5==0:
          a.append(str(i))
          k+=1
          S+=i
          break
a.append(str(30000-S%30))
print(" ".join(a))
    


    

Measured memory_bytes: 40816
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
using namespace std;
const int MOD=1000000007;
const int nmax=3123;
int n;
ll dp[nmax],res,tmp,tmp2;
char s[nmax];
int main(){
    scanf("%d",&n);
    scanf("%s",s+1);
    dp[1]=1;
    for(int i=2; i<=n; ++i){
        if(s[i-1]=='<'){
            tmp=0;
            for(int j=1; j<=i; ++j){
                tmp2=dp[j];
                dp[j]=(dp[j-1]+tmp)%MOD;
                if(dp[j]>=MOD)dp[j]-=MOD;
                tmp=tmp2;
            }
        }
        else
            for(int j=i-2; j>0; --j){
                    dp[j]+=dp[j+1];
                    if(dp[j]>=MOD)dp[j]-=MOD;
            }
    }
    for(int i=1; i<=n; ++i)res+=dp[i];
    res%=MOD;
    printf("%lld",res);
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
 
 
 
public class Main {
 
	public static int k=0;
 
	public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
//        int amount = sc.nextInt();
        long num = sc.nextLong();
 
        num= num+1;
 
 
 
        while(num >= 10){
 
        	k+=9;
        	num = num /10;
 
        }
 
        k = k + (int)num -1;
 
        System.out.println(k);
 
    }
 
}

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

vector <vector <int>> S;
vector <int> P;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, m;
	cin >> n >> m;
	S.resize(m);
	P.resize(m);
	for (int i = 0; i < m; i++){
		int k;
		cin >> k;
		S[i].resize(k);
		for (int j = 0; j < k; j++){
			cin >> S[i][j];
			S[i][j] --;
		}
	}
	for (int i = 0; i < m; i++){
		cin >> P[i];
	}
	int ans = 0;
	for (int mask = 0; mask < (1 << n); mask++){
		bool f = true;
		for (int i = 0; i < m; i++){
			int U = 0;
			for (auto s: S[i]){
				if (mask & (1 << s)){
					U ++;
				}
			}
			if (U % 2 != P[i]){
				f = false;
				break;
			}
		}
		if (!f)
			continue;
		ans ++;
	}
	cout << ans;
}

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

#define REP(i, n) for (ll i = 0; i < ll(n); ++i)
#define RREP(i, n) for (ll i = ll(n) - 1; i >= 0; --i)
#define FOR(i, m, n) for (ll i = m; i < ll(n); ++i)
#define RFOR(i, m, n) for (ll i = ll(n) - 1; i >= ll(m); --i)
#define ALL(v) (v).begin(), (v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end());
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

constexpr int dx[8] = { 1, 1, 0, -1, -1, -1, 0, 1 };
constexpr int dy[8] = { 0, 1, 1, 1, 0, -1, -1, -1 };

using namespace std;

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  set<int> st;
  FOR(i, 1, 10)FOR(j, 1, 10)st.insert(i * j);
  int n; cin >> n;
  if (st.count(n))cout << "Yes" << endl;
  else cout << "No" << endl;
}


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

int main(){
  int n;
  cin>>n;
  if(n<=999) cout<<"ABC"<<endl;
  else cout<<"ABD"<<endl;
}

Measured memory_bytes: 256
(defvar H (read))
(defvar W (read))
(defvar K (read))
(defvar infty (+ H W))
(defvar result infty)

(defun input (N)
  (let  (( l nil ))
    (dotimes (x N)
      (setf l (cons (mapcar #'digit-char-p 
                            (concatenate 'list (read-line)))
                    l)))
    l ))

(defun greed (N l &optional (result 0))
  (if (null l) result
    (if (< N (car l)) result 
      (greed (- N (car l)) (cdr l) (1+ result)))))

(defun split-v (l K)
  (let ((n (reduce #'min
		   (mapcar (lambda (x) (greed K x)) l) )))
    (if (zerop n) nil
        (mapcar (lambda (x) (nthcdr n x)) l) )))

(defun calc (l K &optional (i 0))
  ;(print l)
  (cond
    ((null l) infty)
    ((null (car l)) (1- i))
    (t (calc (split-v l K) K (1+ i))) ))


(defvar row-list (input H))
(defvar dummy nil)

(dotimes (x (expt 2 (1- H)))
  (let ((bool (mapcar #'(lambda (x) (eq #\1 x))
                     (concatenate 'list (format nil "~vB" (1- H) x))) ))
       (setf l (reduce 
                (lambda (x y) (if (car y)
                                  (cons (mapcar #'+ (car x) (cdr y)) 
                                        (cdr x))
                                  (cons (cdr y) x) ))
                (mapcar #'cons
                        (cons dummy bool) row-list ) 
                :initial-value nil ))
       
       (> result (+ (calc l K) (1- (length l))))
           (setf result (min result 
                             (+ (calc l K) (1- (length l))) ))))

(princ result)


Measured memory_bytes: 55528
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  string s;
  cin>>s;
  for(int i=0;i<3;i++)
    cout<<s[i];
  cout<<8;
  for(int i=4;i<10;i++)
    cout<<s[i];
  cout<<endl;
}
  

Measured memory_bytes: 256
$n=<>;@s=sort{$a-$b}@_=<>;
for$e(@_){
	($l,$r)=(0,$n);
	while(1){
		$m=$l+$r>>1;
		$e<$s[$m]?($r=$m):$s[$m]<$e?(($l=$m)):last;
	}
	$x+=$m+$i++&1;
}
print$x/2,$/

Measured memory_bytes: 27900
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<queue>
#include<set>
#include<map>
#include<stack>
#include<bitset>
using namespace std;
typedef long long LL;
const int N=2e5+100;
int gi() {
	int w=0;bool q=1;char c=getchar();
	while ((c<'0'||c>'9') && c!='-') c=getchar();
	if (c=='-') q=0,c=getchar();
	while (c>='0'&&c <= '9') w=w*10+c-'0',c=getchar();
	return q? w:-w;
}
int main()
{
	int n=gi(),k=gi(),i;char c;
	deque<bool>q;bool o=0;
	for (i=1;i<=n;i++,q.push_back(c-'A'))
		while ((c=getchar())!='A'&&c!='B');
	if (k<=n*2) {
		while (k--)
			if (o^q.front())
				q.pop_front(),o^=1,q.push_back(o);
			else
				q.pop_front(),q.push_front(!o);
		for (i=1;i<=n;i++) putchar((o^q.front())+'A'),q.pop_front();
	} else {
		if (n&1) putchar('A'+!(k&1));
		for (i=n>>1;i;i--) putchar('B'),putchar('A');
	}
	return 0;
}

Measured memory_bytes: 640
import sys
from itertools import product

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n = int(input())
    F = [list(map(int, input().split())) for _ in range(n)]
    P = [list(map(int, input().split())) for _ in range(n)]

    res = -f_inf
    for pattern in product([0, 1], repeat=10):
        if sum(pattern) == 0:
            continue

        score = 0
        for f, p in zip(F, P):
            cnt = 0
            for i in range(10):
                if pattern[i] == f[i] == 1:
                    cnt += 1
            score += p[cnt]

        res = max(res, score)

    print(res)


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 43484
n,k=map(int,input().split())
grid=[[0]*k for _ in range(k)]
for i in range(n):
    x,y,c=map(lambda x:x,input().split())
    x,y=int(x),int(y)
    p=(x//k+y//k)%2
    if (p==0 and c=="B")|(p==1 and c=="W"): grid[x%k][y%k]+=1
    else: grid[x%k][y%k]-=1

for i in range(k):
    for j in range(1,k):
        grid[i][j]+=grid[i][j-1]

for i in range(1,k):
    for j in range(k):
        grid[i][j]+=grid[i-1][j]


ans=0
for i in range(k):
    for j in range(k):
        b=grid[i][j]*4+grid[k-1][k-1]-(grid[i][k-1]+grid[k-1][j])*2
        ans=max(ans,n+b,n-b)
print(ans//2)

Measured memory_bytes: 56664
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n,x;
	scanf("%d %d",&n,&x);
	int a[n];
	for(int i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
	}
	long long b[n];
	for(int i=2;i<n;i++)
	{
		b[i]=0x3f3f3f3f;
	}
	b[0]=0;
	b[1]=abs(a[1]-a[0]);
	for(int i=2;i<n;i++)
	{
		for(int t=1;t<=x;t++)
		{
			if(i-t<0)break;
			b[i]=min(b[i-t]+abs(a[i]-a[i-t]),b[i]);
		}
	}
	printf("%lld",b[n-1]);
	return 0;
}

Measured memory_bytes: 4872
fn main() {
	let mut s = String::new();
	use std::io::{Read, Write};
	std::io::stdin().read_to_string(&mut s).unwrap();
	let mut s = s.split_whitespace();
	let _n: usize = s.next().unwrap().parse().unwrap();
	let a: Vec<u32> = s.next().unwrap().bytes().map(|c| 1 << (c - b'a')).collect();
	let mut st = SegmentTree::construct(a, 0, |a, b| a | b);
	let q: usize = s.next().unwrap().parse().unwrap();
	let out = std::io::stdout();
	let mut out = std::io::BufWriter::new(out.lock());
	for _ in 0..q {
		if s.next().unwrap() == "1" {
			let i: usize = s.next().unwrap().parse().unwrap();
			let c: u32 = 1 << (s.next().unwrap().bytes().next().unwrap() - b'a');
			st.set(i - 1, c);
		} else {
			let l: usize = s.next().unwrap().parse().unwrap();
			let r: usize = s.next().unwrap().parse().unwrap();
			writeln!(out, "{}", st.query(l - 1, r).count_ones()).unwrap();
		}
	}
}

pub struct SegmentTree<T, F> {
	n: usize,
	data: Vec<T>,
	e: T,
	op: F,
}

impl<T, F> SegmentTree<T, F>
where
	T: Clone,
	F: Fn(T, T) -> T,
{
	pub fn new(n: usize, e: T, op: F) -> SegmentTree<T, F> {
		SegmentTree { n: n, data: vec![e.clone(); n << 1], e: e, op: op }
	}

	pub fn construct(a: Vec<T>, e: T, op: F) -> SegmentTree<T, F> {
		let n = a.len();
		let mut data = vec![e.clone(); n];
		data.extend(a);
		for i in (1..n).rev() {
			data[i] = op(data[i << 1].clone(), data[i << 1 | 1].clone());
		}
		SegmentTree { n: n, data: data, e: e, op: op }
	}

	pub fn query(&self, s: usize, t: usize) -> T {
		let mut l = self.e.clone();
		let mut r = self.e.clone();
		let mut s = s + self.n;
		let mut t = t + self.n;
		while s < t {
			if s & 1 != 0 {
				l = (self.op)(l, self.data[s].clone());
				s += 1;
			}
			if t & 1 != 0 {
				r = (self.op)(self.data[t - 1].clone(), r);
			}
			s >>= 1;
			t >>= 1;
		}
		(self.op)(l, r)
	}

	pub fn set(&mut self, i: usize, v: T) {
		let mut i = i + self.n;
		self.data[i] = v;
		while {
			i >>= 1;
			i > 0
		} {
			self.data[i] = (self.op)(self.data[i << 1].clone(), self.data[i << 1 | 1].clone());
		}
	}
}


Measured memory_bytes: 12540
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_dec_float.hpp>
using namespace std;
namespace mp = boost::multiprecision;
 
int main(){
    mp::cpp_dec_float_100 a, b, c;
    cin >> a >> b >> c;

    if(a+b-c < -2*mp::sqrt(a*b))
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

}

Measured memory_bytes: 384
#include <iostream>
#include <cassert>

using namespace std;

int main(int argc, char const *argv[]) {
  int count;
  cin >> count;
  int *nums = new int[count];
  for (int i = 0; i < count; i++) {
    cin >> nums[i];
  }

  assert(count >= 2);
  if (count < 2) {
    return 1;
  }

  int maxprofit = - nums[0];
  int maxprofit_buy = nums[0];
  int min_buy = nums[0];

  for(int i = 1; i < count; i++){
    int profit = nums[i] - min_buy;
    if (maxprofit < profit){
      maxprofit_buy = min_buy;
    }
    if(nums[i] < min_buy){
      min_buy = nums[i];
    }
    profit = nums[i] - maxprofit_buy;
    if (maxprofit < profit){
      maxprofit = profit;
    }
  }
  cout << maxprofit << endl;

  delete [] nums;
  return 0;
}

Measured memory_bytes: 3584
N = input()
n = N

if len(N) == 1:
    print(N)
    exit()

if N[1:].count('9') == len(N)-1:
    print(sum([int(i) for i in N]))
    exit()

if N[0]!='9' or any(map(lambda x:x!='9',N)):
    n = chr(ord(N[0])-1) + N[1:]
# elif any(map(lambda x:x!='9',N)):
#     n = chr(min([ord(x) for x in N])-1) + N[1:]

ans = int(n[0]+"9"*(len(n)-1))

# print(int(N),ans)
if int(N) >= ans:
    print(sum([int(i) for i in str(ans)]))
else:
    print(sum([int(i) for i in str(ans)]) -1)


Measured memory_bytes: 3064
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    n,t = readline() |> split |> parseMap
    a = zeros(Int,n,2)
    for i in 1:n
        a[i,:] = readline() |> split |> parseMap
    end
    a = sortrows(a,by=x->x[1])
    dp = -ones(Int,n+1,t+1)
    dp[1,1] = 0
    for i in 1:n
        for j in 1:t
            if dp[i,j]>-1
                dp[i+1,j] = max(dp[i+1,j],dp[i,j])
                dp[i+1,min(j+a[i,1],t+1)] = max(dp[i+1,min(j+a[i,1],t+1)], dp[i,j]+a[i,2])
            end
        end
    end
    println(maximum(dp))
end
main()

Measured memory_bytes: 267660
#include <iostream>
#include <numeric>
#include <stdio.h>
#include <iomanip>
#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;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)






int main() {
		int H,W,N;
		cin >> H >> W >> N;
		vector<int> veh(N);
		for (int i = 0; i < N; i++) {
			cin >> veh.at(i);
		}
		vector<int> vec(H * W);
		int kk = 0;
		rep(i, N) {
			rep(j, veh.at(i)) {
				vec.at(kk) = i+1;
				kk++;
			}
		}
		rep(i, H) {
			if (i % 2 == 0) {
				for (int j = W * i; j < W*(i+1); j++) {
					cout << vec.at(j)<<" ";
				}
				cout << endl;
			}
			else {
				for (int j = W * (i+1)-1; j > i*W-1; j--) {
					cout << vec.at(j)<<" ";
				}
				cout << endl;
			}
		}

	}

Measured memory_bytes: 384
///supercalifragilisticexpialidocious.
#include<bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define PB pop_back
#define pb push_back
#define mp make_pair
#define int long long
#define sz(s) (int)s.size()
#define seper(n) setprecision(n)
#define all(sum) sum.begin(),sum.end()
#define mem(a,b) memset(a,b,sizeof a)
#define IOS ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
typedef long long ll;
typedef map<int , int> mii;
typedef pair<int , int> pii;
typedef map<string , int> msi;
typedef pair<int , string> pis;
const int MAXN = 1e5 + 10;
int n , ans , sum_dif , sum_a , sum_b , a[MAXN], b[MAXN], c[MAXN];
int32_t main()
{
    cin >> n;
    for(int i = 0 ; i < n ; i ++)
        cin >> a[i] , sum_a += a[i];
    for(int i = 0 ; i < n ; i ++)
    {
        cin >> b[i] , sum_b += b[i];
        if(b[i] > a[i])
            sum_dif += (b[i] - a[i]) , ans ++;
        c[i] = a[i] - b[i];
    }
    sort(c , c + n);
    if(sum_a < sum_b)
        return cout << -1 << endl , 0;
    for(int i = n - 1 ; i >= 0 ; i --)
        if(sum_dif > 0)
            ans ++ , sum_dif -= c[i];
        else
            break;
    return cout << ans << endl , 0;
}


Measured memory_bytes: 2560
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func solve() {
	n := nextInt()
	a := nextInts(n)

	sum := 0
	for {
		for i, n := range a {
			// fmt.Fprintln(out, n)
			if n%2 == 1 {
				fmt.Fprintln(out, sum)
				return
			}
			a[i] = n / 2
		}
		sum++
	}

}

func main() {
	in.Split(bufio.ScanWords)

	defer out.Flush()
	solve()
}

// --- template ---

var (
	in  = bufio.NewScanner(os.Stdin)
	out = bufio.NewWriter(os.Stdout)
)

func next() string {
	in.Scan()
	return in.Text()
}

func nextInt() int {
	i, e := strconv.Atoi(next())
	if e != nil {
		fmt.Println(e)
	}
	return i
}

func nextInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = nextInt()
	}
	return res
}


Measured memory_bytes: 640
import java.util.Scanner;
class Main {
    public static void main(String args[]) {
        Scanner scan = new Scanner(System.in);

        int h = scan.nextInt();
        int w = scan.nextInt();

        int number[][] = new int[h + 1][w + 1];

        for (int i = 0; i < h;i++) {
            for (int j = 0; j < w;j++) {
                number[i][j] = scan.nextInt();
                number[i][w] += number[i][j];
                number[h][j] += number[i][j];
            }
            number[h][w] += number[i][w];
        }

        for (int i = 0;i < h + 1;i++) {
            for (int j = 0;j < w + 1;j++) {
                System.out.print(number[i][j]);
                if(j == w) {
                    continue;
                }
                System.out.print(" ");
            }
            System.out.println();
        }
    }
}

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

#define all(v) (v).begin(), (v).end()
#define sortv(v) sort(all(v))
#define uniqv(v) (v).erase(unique(all(v)), (v).end())
#define pb push_back
#define FI first
#define SE second
#define lb lower_bound
#define ub upper_bound
#define mp make_pair
#define test 1
#define TEST if(test)

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;

const int MOD = 1000000007; // 998244353
const int INF = 2e9;
const ll INFLL = 1e18;
const int MAX_N = 1;

int N;
string str;

int main(){
	cin>>N>>str;
	if(N>=3200){
		cout<<str;
	}else{
		cout<<"red";
	}
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main()
{
	char s[99];
	int m,n,i,a,b,c;
	while(scanf("%d%d",&m,&n),m)
	{
		bool dead[1000]={0};
		for(a=0,c=i=1;i<=n;++i)
		{
			scanf("%s",s);
			if(c < m)
			{
				b=0;
				if(i%15==0)
				{
					if(strcmp(s,"FizzBuzz"))b=1;
				}
				else if(i%5==0)
				{
					if(strcmp(s,"Buzz"))b=1;
				}
				else if(i%3==0)
				{
					if(strcmp(s,"Fizz"))b=1;
				}
				else if(i != atoi(s)) b=1;

				if(b)
					dead[a]=1, ++c;

				do
				{
					a = (a+1)%m;
				}while(dead[a]);
			}
		}
		for(b=i=0;i<m;++i) if(!dead[i]) printf("%s%d", b++?" ":"", i+1);
		puts("");
	}
	return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include <string.h>
using namespace std;

int main(){
    int n;
    double ans = 0,s;
    cin >> n;
    for (int i = 0; i < n; i++){
      cin >> s;
      ans += (1/s);
    }
    cout << 1 / ans << endl;
    return 0;
}

Measured memory_bytes: 256