akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
	int n;
	cin >> n;
	int a[] = { 1, 2, 4, 8, 16, 32, 64 };

	for (int i = 0; i < 7; i++) {
		if (a[i] > n) {
			cout << a[i - 1] << endl;
          return 0;
		}
		else if (64 <= n){
			cout << 64 << endl;
          return 0;
		}
	}

}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
    int a,b,c,i,cnt;

    for(i=0;i<200;i++){
        cnt=1;
        if(scanf("%d %d",&a,&b) == EOF)break;
        c=a+b;
        while((c=c/10)!=0)cnt++;
        printf("%d\n",cnt);
    }
    return 0;
}

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

using namespace std;

typedef long long ll;

const double pi = 3.14159265358979323846;

#define rep(i, n) for (ll i = 0; i < n; i++)
#define mod 1000000007LL
#define PS(p) cout << setprecision(15) << fixed << p << endl;
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
#define ALL(c) c.begin(), c.end()
#define CIN(v) cin >> v;
#define COUT(v) cout << v << endl;

int main() {
  ll A, B;

  CIN(A >> B);

  if (B == 1) {
    COUT(0);
    return 0;
  }

  ll c = 1;
  ll t = A;
  while (true) {

    if (B <= t) {
      COUT(c);
      return 0;
    }

    t += A - 1;
    c++;
  }

  return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 30;
const int MOD = 1e9 + 7;

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  int ret = min(B, D) - max(A, C);
  ret = max(0, ret);
  cout << ret << endl;
  return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
using ll = long long;
int main()
{
    ll n,k;
    cin >> n >> k;
    if(n % k == 0)
    {
        cout << "0\n";
    }
    else if(n < k)
    {
        cout << min(n,(ll)fabs(n - k)) << "\n";
    }
    else
    {
        n %= k;
        cout << min(n,(ll)fabs(n - k)) << "\n";
    }
    
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>

#include<vector>
#include<string>

#include<algorithm>
#include<cmath>
using namespace std;
typedef long long ll;
const ll INF = 1e12+1;
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;}


//1と2  3か1
//1と2と3 6か4か2か0
//1 2 3 4   10か8か6か4か2か0
//12345  15か13か11か...
//123456 21か19か17か...


ll X;

int main() {
    cin >> X;
    ll i = 1;
    while (true) {
        ll x = i * (i+1)/2;
        if (x >= X) {
            cout << i << endl;
            return 0;
        }
        i++;
    }

}


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

#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define size_t unsigned long long
#define ll long long
#define rep(i,a) for(int i=0;i<(a);i++)
#define repr(i,a) for(int i=(int)(a)-1;i>=0;i--)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORR(i,a,b) for(int i=(int)(b)-1;i>=a;i--)
#define ALL(a) a.begin(), a.end()
using namespace std;
int si() { int x; scanf("%d", &x); return x; }
long long sl() { long long x; scanf("%lld", &x); return x; }
string ss() { string x; cin >> x; return x; }
void pi(int x) { printf("%d ", x); }
void pl(long long x) { printf("%lld ", x); }
void pd(double x) { printf("%.15f ", x); }
void ps(const string &s) { printf("%s ", s.c_str()); }
void br() { putchar('\n'); }

const ll MOD = 1e9 + 7;
const ll INF = 1e9 + 5;

struct mint {
    int n;
    mint(int n_ = 0) : n(n_) {}
};

mint operator+(mint a, mint b) { a.n += b.n; if (a.n >= MOD) a.n -= MOD; return a; }
mint operator-(mint a, mint b) { a.n -= b.n; if (a.n < 0) a.n += MOD; return a; }
mint operator*(mint a, mint b) { return (long long)a.n * b.n % MOD; }
mint &operator+=(mint &a, mint b) { return a = a + b; }
mint &operator-=(mint &a, mint b) { return a = a - b; }
mint &operator*=(mint &a, mint b) { return a = a * b; }

typedef pair<int, int> P;

const ll N = 2e5+5;
string s;
ll n,m,k;
ll a,p;
ll num1, num2[N];
ll result1, result;
ll h[N];

int main () {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n >> k;
  rep(i,n) cin >> h[i];
  if (n <= k) {
    cout << 0 << endl;
    return 0;
  }
  SORT(h,n);
  rep(i, n-k) result += h[i];
  cout << result << endl;
}


Measured memory_bytes: 1792
n = input(); a = 0; b = 0; c = int(n[0])
for i in range(len(n)):
    if n[i] != "9":
        if a == 0: a += 1; b = i
        else: a += 1
if a == 0: print(9*len(n))
elif a == 1 and b == 0: print(c+9*(len(n)-1))
else: print(c-1+9*(len(n)-1))

Measured memory_bytes: 9196
#include<stdio.h>
int main(void)
{
	int k,s,x,y,z,ans=0;
	scanf("%d%d",&k,&s);
	for(x=0;x<=k;x++){
		for(y=0;y<=k;y++){
			z=s-(x+y);
			if(z<=k&&z>=0){
				ans++;
			}
		}
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 1724
#include <math.h>
#include <cmath>
#include <algorithm>
#include <iostream>

using namespace std;
int main() {
    int A, B, H, M;// A < B
    cin >> A >> B >> H >> M;

    double sheta = 0;
    double ans = 0;
    double PI = 3.141592653589793;

    double hour = 30 * H + (M / 2.0);
    double min = 6 * M;
    bool flag = hour > min;

    if(flag){
        if(hour - min >= 180){
            sheta = (360 - (hour - min)) / 180.0 * PI;
        }else{
            sheta = (hour - min) / 180.0 * PI;
        }
    }else{
        if(min - hour >= 180){
            sheta = (360 - (min - hour)) / 180.0 * PI;
        }else{
            sheta = (min - hour) / 180.0 * PI;
        }
    }
    ans = sqrt(A * A + B * B - 2.0 * A * B * cos(sheta));
    printf("%.15f\n", ans);
}

Measured memory_bytes: 4200
#include <iostream>
#include <cmath>
#include <algorithm>
#include <map>
#include <string>
#include <vector>
#define FOR(i, a, b)  for(int i=a; i<b; ++i)
#define rFOR(i, a, b) for(int i=a-1; i>=b; --i)
#define REP(i, n) for(int i=0; i<n; ++i)
#define rREP(i, n) for(int i=n-1; i>=0; --i)
#define all(a)  a.begin(), a.end()
#define MAXNUM 5000
using namespace std;
typedef long long ll;

int main(){
  int m;  cin >> m;
  REP(i, m){
    map<string, int> mp;
    string train; cin >> train;

    REP(i, train.length()-1){
      string sub;
      sub = train.substr(0, i+1);
      string a(sub);
      reverse(sub.begin(), sub.end());
      string r_a(sub);

      sub = train.substr(i+1, train.length()-(i+1));
      string b(sub);
      reverse(sub.begin(), sub.end());
      string r_b(sub);

      mp[a+b]++;
      mp[b+a]++;
      mp[r_a+b]++;
      mp[b+r_a]++;
      mp[a+r_b]++;
      mp[r_b+a]++;
      mp[r_a+r_b]++;
      mp[r_b+r_a]++;

    }
    cout << mp.size() << endl;
  }
  return 0;
}


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

int main()
{
	string s;
	bool f=false;
	int i,l;
	cin>>s;
	l=s.size();
	for(i=0;i<l;i++)
	{
		if(s[i]=='C')f=true;
		if(s[i]=='F'&&f==true){cout<<"Yes"<<endl;return 0;}
	}
	cout<<"No"<<endl;
 } 

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>

int main()
{
  int N, L;
  std::cin >> N >> L;
  std::vector<int> w(N);
  std::vector<int> diff(N);

  int sum = 0;
  for(int i=0; i<N; i++) {
    w[i] = L + i;
    sum += w[i];
  }
  for(int i=0; i<N; i++) {
    diff[i] = std::abs(sum - (sum - w[i]));
  }
  auto it = std::min_element(diff.begin(), diff.end());

  std::cout << sum - w[it-diff.begin()] << std::endl;


  return 0;
}


Measured memory_bytes: 3564
#include<bits/stdc++.h>
using namespace std;
vector<int>dy({0,-1,0,1}),dx({1,0,-1,0});

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int h,w,ch,cw,dh,dw; cin>>h>>w>>ch>>cw>>dh>>dw; --ch,--cw,--dh,--dw;
	vector<string>s(h); for(auto&&i:s)cin>>i;
	vector<vector<int>>mn(h,vector<int>(w,2e9)); mn.at(ch).at(cw)=0;
	deque<pair<int,int>>q; q.push_front({ch,cw});
	while(q.size()){
		pair<int,int>t=q.front(); q.pop_front();
		for(int i=0;i<4;++i){
			int ny=t.first+dy.at(i),nx=t.second+dx.at(i);
			if(ny<0||ny>=h||nx<0||nx>=w||s.at(ny).at(nx)!='.'||mn.at(ny).at(nx)<=mn.at(t.first).at(t.second))continue;
			mn.at(ny).at(nx)=mn.at(t.first).at(t.second);
			q.push_front({ny,nx});
		}
		for(int y=-2;y<=2;++y){
			for(int x=-2;x<=2;++x){
				int ny=t.first+y,nx=t.second+x;
				if(ny<0||ny>=h||nx<0||nx>=w||s.at(ny).at(nx)!='.'||mn.at(ny).at(nx)<=mn.at(t.first).at(t.second)+1)continue;
				mn.at(ny).at(nx)=mn.at(t.first).at(t.second)+1;
				q.push_back({ny,nx});
			}
		}
	}
	cout<<(mn.at(dh).at(dw)!=2e9?mn.at(dh).at(dw):-1)<<"\n"s;
}


Measured memory_bytes: 8644
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <string>
#include <iterator>
#include <iomanip>
#include <queue>
#include <set>
#include <map>

using namespace std;

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    int ans = 0;
    set<int> s;
    s.insert(a);
    s.insert(b);
    s.insert(c);
    for(auto it = s.begin(); it != s.end(); ++it){
        ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<string>
#include<iostream>
#include<vector>
#include<cstdlib>
using namespace std;
 
template <class T> using V = vector<T>;
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
 
const long long INF = 1LL << 60;
 
using ll = long long;
using db = double;
using st = string;
using ch = char;
using bl = bool;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
using vbl = V<bl>;

 
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>=(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;
  
 

vll dp(100100);

ll sum(ll n) {
ll m=0;
  FOR(i,0,20){
    m+=n%10;
    n/=10;
    if(n==0){
      break;
    }
  }
  return m;
}
 
 
const int MAX = 510000;
const int MOD = 1000000007;
 
long long fac[MAX], finv[MAX], inv[MAX];
 
void Comuse() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
 
#define comuse Comuse()
 
ll combi(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
 
 
 
ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}




 
/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
 
 
signed main() {
  ll n;
    ci(n);
  vll A(n);
  FOR(i,0,n){
    ci(A[i])
  }
  SORT(A);
  //REV(A);

  ll m=A[n-1];
  vll B(n-1);
  FOR(i,0,n-1){
    B[i]=min(A[i],m-A[i]);
  }
  SORT(B);
  //REV(B);

  bl b=true;

  FOR(i,0,n-1){
    if(A[i]==B[n-2]){
      cout<<m<<" "<<A[i]<<endl;
      b=false;
      break;
    }
  }

  if(b){
    cout<<m<<" "<<m-B[n-2]<<endl;
  }
}


Measured memory_bytes: 2560
#include<iostream>
#include <algorithm>
#include <functional>
#include <cmath>

using namespace std;

int main(){
  int N;
  int T, A;
  int H[1010];

  cin >> N >> T >> A;
  for(int i = 1;i < N + 1;i++){
    cin >> H[i];
  }

  //double temp[1010] = {};
  double temp = 10000000;
  int ans = 0;
  for(int i = 1;i < N + 1;i++){
    double a = abs((double)A - ((double)T - ( (double)H[i] * 0.006)));
    if(temp > min(a, temp) ){
      ans = i;
      temp = min(temp, a);
    }

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


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

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)

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

int main(void) {
    string s;
    int size = 26;
    int w[size]={0};
    cin >> s;
    REP(i, s.size()){
        w[s[i]-'a'] = 1;
    }
    REP(i, size){
        if(w[i]==0){
            cout << char(i+'a') << endl;
            return 0;
        }
    }
    cout << "None" << endl;
    return 0;
}


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

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define each(i, mp) for (auto &i : mp)

int main()
{
  int k, a, b;
  cin >> k >> a >> b;
  for (int i = a; i <= b; i++)
  {
    if (i % k == 0)
    {
      cout << "OK" << endl;
      return 0;
    }
  }
  cout << "NG" << endl;
  return 0;
}


Measured memory_bytes: 3636
//"push hoge"と言われたらhogeを最後に入れ、"pop"と言われたら最後尾を取りだす。"quit"で終わり。
#include<iostream>
using namespace std;

int main(){
	char str[20];
	int hoge = 0;

	cin >> str;
	for(int i=0;i<20;i++){
		if(str[i] == '\0'){
			hoge = i-1;
			break;
		}
		hoge = i;
	}
	for(int i=hoge;i>=0;i--)
		cout << str[i];
	cout << endl;

	return 0;
}

Measured memory_bytes: 1132
#include <bits/stdc++.h>
using namespace std;
typedef int64_t ll;
using P   = pair<ll, ll>;
using mat = vector<vector<ll>>;

void IOS() { ios::sync_with_stdio(false), cin.tie(0); }

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

const ll INF = 1e16;
const ll MOD = 1e9 + 7;
// int dx[4]    = {1, 0, -1, 0};
// int dy[4]    = {0, 1, 0, -1};
// ll pas[5001][5002];

signed main() {
    IOS();
    int a[4] = {};
    for (int i = 0; i < 4; ++i) {
        int x;
        cin >> x;
        if (x == 1) a[0]++;
        if (x == 4) a[1]++;
        if (x == 7) a[2]++;
        if (x == 9) a[3]++;
    }
    bool ok = true;
    for (int i = 0; i < 4; ++i) {
        if (a[i] != 1) ok = false;
    }
    cout << (ok ? "YES" : "NO") << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_int.hpp>
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
////////////////////////////


int main(){fastio
    ll n;cin>>n;
    
    ll a[n];rep(i,0,n-1)cin>>a[i];
    ll ans=0;
    rep(i,0,n-1){
        if(i==0)ans++;
        else if(a[i-1]>=a[i])ans++;
    }
    cout<<ans<<endl<<n<<endl;
    return 0;
}



Measured memory_bytes: 4000
def perm(n,r,p):
  if (r < 0) or (n < r):
    return 0
  return fac[n]*finv[n-r]%p

n = pow(10,5)*2+10
MOD = pow(10,9)+7

fac = [-1]*(n+1); fac[0] = 1; fac[1] = 1 #階乗
finv = [-1]*(n+1); finv[0] = 1; finv[1] = 1 #階乗の逆元
inv = [-1]*(n+1); inv[0] = 0; inv[1] = 1 #逆元
for i in range(2,n+1):
  fac[i] = fac[i-1]*i%MOD
  inv[i] = MOD - inv[MOD%i]*(MOD//i)%MOD
  finv[i] = finv[i-1]*inv[i]%MOD


N,M = map(int,input().split())
if abs(N-M) > 1:
  print(0);exit()
if N == M:
  ans = fac[N]*perm(M,N-1,MOD)*2
else:
  if M > N:
    N,M = M,N
  ans = fac[N]*perm(M,N-1,MOD)
print(ans%MOD)

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

const int MAX = 1e3;
int main() {
    vector<int> imos(MAX + 1);
    int a, b; cin >> a >> b;
    imos[a]++, imos[b]--;
    int n; cin >> n;
    while (n--) {
        int s, f; cin >> s >> f;
        imos[s]++, imos[f]--;
    }
    for (int i = 1; i <= MAX; i++) imos[i] += imos[i - 1];
    for (int i = 0; i <= MAX; i++) if (imos[i] > 1) {
        cout << 1 << endl;
        return 0;
    }
    cout << 0 << endl;
    return 0;
}


Measured memory_bytes: 3104
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}
fn main() {
    let s: String = read();
    println!("{}{}", 2018, &s[4..]);
}


Measured memory_bytes: 4352
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <utility>
#include <algorithm>
#include <map>
#include <cassert>
using namespace std;
#define REPP(i,a,b) for(int i = (a); i < (b); ++i)
#define REP(i,a) for(int i = 0; i < (a); ++i)
#define PER(i,a) for(int i = (a) - 1; i >= 0; --i)
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define MP make_pair

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

const int maxn = 2e5 + 5;
int n, a[maxn], h[maxn];
ll tree[maxn * 4];

ll query(int node, int start, int end, int l, int r) {
    if (start > r || end < l) return 0;
    if (l <= start && end <= r) return tree[node];
    int mid = (start + end) /2;
    ll x = query(node * 2 + 1, start, mid, l, r),
       y = query(node * 2 + 2, mid + 1, end, l, r);
    return max(x, y);
}

void update(int node, int start, int end, int index, ll val) {
    if (start == end) {
        tree[node] = val;
        return;
    }
    int mid = (start + end) / 2;
    if (start <= index && index <= mid)
        update(node * 2 + 1, start, mid, index, val);
    else
        update(node * 2 + 2, mid + 1, end, index, val);
    tree[node] = max(tree[node * 2 + 1], tree[node * 2 + 2]);
}

int main() {
    scanf("%d", &n);
    REP(i, n) scanf("%d", h + i);
    REP(i, n) scanf("%d", a + i);
    ll ans = 0;
    REP(i, n) {
        ll x = query(0, 0, n, 0, h[i]);
        update(0, 0, n, h[i], x + a[i]);
        ans = max(ans, x + a[i]);
    }
    cout << ans << endl;
    return 0;
}


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

int main() 
{
	int n;
	cin >> n;
	vector<int> a(n);
	for (auto& i : a) {
		cin >> i;
	}

	for (int i = 0; i < n; ++i) {
		cout << a[i] ;
		if (i != n - 1) {
			cout << " ";
		}
	}
	cout << endl;

	for (int i = 1; i < n; ++i) {
		int v = a[i];
		int j = i - 1;
		while ( 0 <= j && v < a[j])
		{
			a[j + 1] = a[j];
			--j;
		}
		a[j + 1] = v;
		for (int k = 0; k < n; ++k) {
			cout << a[k];
			if (k != n - 1) {
				cout << " ";
			}
		}
		cout << endl;
	}

	return 0;
}


Measured memory_bytes: 3040
//shan61916
#include <bits/stdc++.h>
  using namespace std;
typedef   long long ll;
typedef   unsigned long long ull ;
typedef   double dll ;

#define   mp make_pair
#define   pb push_back
#define   ff first 
#define   ss second
#define   IOS ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define   endl "\n" 
#define   pll pair<ll, ll>
#define   all(x) x.begin(), x.end()
#define   vll vector<ll> 

const ll inf = (ll)(1e17 + 17);
const ll mod = (ll)(1e9 + 7);


int main(){
 IOS
#ifdef SHAN
    freopen("input.txt" , "r" , stdin);  
#endif
  ll n;
  cin >> n;
  vll a(n);
  ll tot = 0;\
  for(ll i = 0; i < n; i++){ cin >> a[i]; tot+=a[i]; }
  map<ll, ll> key;
	for(auto it: a) key[it]++;
	ll q;
	cin >> q;
	while(q--) {
		ll x, y;
		cin >> x >> y;
		tot-= key[x]*x;
		tot+= key[x]*y;
		key[y]+= key[x];
		key[x] = 0;
		cout << tot << endl;
	}
  return 0;
} //good night.

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

int main(){
  string s;
  string t = "keyence";

  cin >> s;

  for (int i = 1; i <= 7 ; i++) {
    string s1 = s.substr(0, i);
    string s2 = s.substr(s.size() - 7 + i);
    string s3 = s1 + s2;
    if (t == s3) {
      cout << "YES" << endl;
      return 0;
    }
  }

  cout << "NO" << endl;
  return 0;
}


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

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

Measured memory_bytes: 3632
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i, n) for (int i = 0; i < n; i++)

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

  cout << min(N * A, B) << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <iomanip>
#include <iterator>
#include <algorithm>
#include <functional>
#include <typeinfo>
#include <utility>
#include <tuple>
#include <queue>
#include <deque>

using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define reprrev(i, a, b) for (int i = (int)(b) - 1; i >= (int)(a); i--)
#define reprev(i, n) reprrev(i, 0, n)
#define mp(a, b) make_pair(a, b)
#define all(vec) (vec).begin(), (vec).end()
#define yn(formula) (formula) ? (cout << "Yes" << endl) : (cout << "No" << endl)
#define YN(formula) (formula) ? (cout << "YES" << endl) : (cout << "NO" << endl)
#define MIN(a, b) ((a) < (b)) ? (a) : (b)

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<pii> vp;
typedef vector<pll> vpl;
typedef vector<vi> vvi;
typedef vector<vll> vvl;
typedef vector<vb> vvb;
typedef vector<vc> vvc;
typedef vector<vs> vvs;
typedef vector<vp> vvp;
typedef vector<vpl> vvpl;

constexpr double PI = 3.14159265358979323846;
constexpr ll INF = 1 << 29;
constexpr ll MOD = (ll)1e9 + 7;
constexpr double EPS = 1e-7;
constexpr int dy[4] = { 0, 1, 0, -1 };
constexpr int dx[4] = { 1, 0, -1, 0 };

struct edge { ll to; ll cost; };

/*<ここから>***********************************************************/

template <typename T>
void warshallFloyd(vector<vector<T>> &d) {
	rep(i, d.size()) rep(j, d.size()) rep(k, d.size()) d[j][k] = min(d[j][k], d[j][i] + d[i][k]);
}

bool used[9];
int res = INF;
int N, M, R;
void dfs(vvl &d, vi &r, int c, int las, int dist) {
	if (c == R + 1) {
		if (res > dist) res = dist;
		return;
	}

	rep(i, R) {
		if (!used[i]) {
			used[i] = true;
			if (las == -1) dfs(d, r, c + 1, i, 0);
			else dfs(d, r, c + 1, i, dist + d[r[las]][r[i]]);
			used[i] = false;
		}
	}
}

int main()
{
	cin >> N >> M >> R;
	vi r(R);
	vvp g(N);
	vvl d(N, vll(N, INF));
	rep(i, R) {
		cin >> r[i];
		r[i]--;
	}
	rep(i, M) {
		int A, B, C;
		cin >> A >> B >> C;
		A--; B--;
		d[A][B] = d[B][A] = C;
	}
	
	warshallFloyd(d);
	dfs(d, r, 1, -1, 0);

	cout << res << endl;

	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()
const long long INFLL = 1LL << 60;
const int INFINT = 1 << 30;
const long long MOD = 1e9 + 7;

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

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

ll reg(ll h) {
    if(h == 1)
        return ll(1);
    else
        return ll(reg(h / 2) * 2) + 1;
}

int main() {
    ll N;
    cin >> N;
    cout << reg(N) << endl;
}


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

#define int long long

#define REP(i, b) for(int i = 0; i < (b); i++)
#define REPS(i, b) for(int i = 1; i <= (b); i++)
#define ALL(v) (v).begin(), (v).end()

#define fi first
#define se second
#define pb push_back
#define mp make_pair

using namespace std;

using pi = pair<int, int>;
using vi = vector<int>;
using vs = vector<string>;
using vb = vector<bool>;
using vpi = vector<pi>;
using vvi = vector<vi>;
using vvb = vector<vb>;

const int INF = 1e16;
const int MOD = 1e9+7;

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


signed main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    while(true)
    {
        string s; cin >> s;
        if(s == "-") break;
        int n; cin >> n;
        REP(i, n)
        {
            int h; cin >> h;
            s = s.substr(h, s.length()-h) + s.substr(0, h);
        }
        cout << s << endl;
    }
}


Measured memory_bytes: 3192
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
int main(){
  int m,t,p,r,a,b,c,d;
  while(cin>>m>>t>>p>>r,t){
    int th[55][2]={},w[55][11]={};
    for(int i=0;i<r;i++){
      cin>>a>>b>>c>>d;
      if(d!=0)w[b][c]++;
      else{
	th[b][0]++;
	th[b][1]+=w[b][c]*20+a;
      }
    }
    priority_queue<pair<int,pair<int,int> > > ans;
    for(int i=1;i<=t;i++){
      ans.push(make_pair(th[i][0],make_pair(-th[i][1],i)));
    }
    while(1){
      cout<<ans.top().second.second;
      if(ans.size()==1)break;
      int f=ans.top().first,sf=ans.top().second.first;
      ans.pop();
      if(ans.top().first==f&&ans.top().second.first==sf)cout<<"=";
      else cout<<",";
    }
    cout<<endl;
  }
  return 0;
}

Measured memory_bytes: 3100
#include <bits/stdc++.h>
#define dum(x) cout<<#x<<'='<<x<<endl
#define ll long long
using namespace std;

int main() {
  int n, x;
  cin >> n >> x;
  int md = 100010;
  for (int i = 0; i < n; i++) {
    int m;
    cin >> m;
    md = min(m, md);
    x -= m;
  }
  cout << n + x / md << endl;
}


Measured memory_bytes: 256
//
//  main.cpp
//  ITP1-9-B
//
//  Created by h3037153 on 2017/08/28.
//  Copyright ?? 2017??´ h3037153. All rights reserved.
//
#include<iostream>
#include<string>
using namespace std;
int main(){
    string card;
    string cardBefore,cardBehind;
    int h[100] = {},m = 0, len = 0;
    while( cin >> card >> m){
        if( card == "-" ) break;
        len = card.length();
        for( int i = 0; i < m; i++ ){
            cin >> h[i];
            cardBefore = card.substr(0,h[i]);
            cardBehind = card.substr(h[i],len);
            card = cardBehind + cardBefore ;
        }
        cout<<card<<endl;
    }
    return 0;
}

Measured memory_bytes: 3224
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <climits>
using namespace std;
#define MOD int(1e9 + 7)
#define INF (long long)(1e18)

int main()
{
    cout.precision(18);

    long long N, C, K;
    vector<long long> T;

    cin >> N >> C >> K;
    for (long long i = 0; i < N; i++)
    {
        long long t;
        cin >> t;
        T.push_back(t);
    }

    sort(T.begin(), T.end());

    long long i = 0;
    long long c = 0;
    while (i < N)
    {
        long long v = T[i];

        for (long long j = 0; j < C && i < N; j++)
        {
            if (v + K < T[i])
            {
                break;
            }
            i++;
        }
        c++;
    }
    cout << c << endl;
}

Measured memory_bytes: 1400
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

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

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

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


class BPostdocs {
public:
	void solve(std::istream& cin, std::ostream& cout) {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
        string s;cin >> s;
        int64_t n = s.size();

        rep(i,n){
            if(s[i] != '?')continue;
            s[i] = 'D';
        }
        cout << s << '\n';

	}
	void main2(istream& cin,ostream& cout){

	}
};


int main() {
	BPostdocs solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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


int main(){
	int n,a,b;
	cin>>n>>a>>b;
	if(n==1&&a==b){
		cout<<1<<endl;
		return 0;
	}
	else if(n==1&&a!=b){
		cout<<0<<endl;
		return 0;
	}
	else if(a>b){
		cout<<0<<endl;
		return 0;
	}
	else if(n==2){
		cout<<1<<endl;
		return 0;
	}

	cout<<(long long)(b-a)*(n-2)+1<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int
main(void)
{
	char c;
	char v[6] = "aeiou";

	scanf("%c", &c);

	int i, res = 0;
	for (i = 0; i < 5; i++)
		if (v[i] == c) 
			res = 1;

	puts(res ? "vowel" : "consonant");
	return 0;
}


Measured memory_bytes: 128
import bisect
a = int(input())
b = list(map(int, input().split()))
b.sort()
c = list(map(int, input().split()))
d = list(map(int, input().split()))
d.sort()
ans = 0
for i in range(a):
    ans += bisect.bisect_left(b, c[i]) * (a - bisect.bisect_right(d, c[i]))
print(ans)


Measured memory_bytes: 23360
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define all(v) v.begin(),v.end()
#define mp make_pair
#define ff first
#define ss second
#define MAXN  1000005
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll ans=LLONG_MAX;
    ll n,k,a,b;
    vector<pair<ll,ll> >v;
    cin>>n>>k;
    for(ll i=0;i<n;i++){
        cin>>a>>b;
        v.pb(mp(a,b));
    }
    ll co,t,bb,l,r;
    for(ll i=0;i<n;i++){
        for(ll j=i+1;j<n;j++){
                if(k<3){
                    t=max(v[i].ss,v[j].ss);
                    bb=min(v[i].ss,v[j].ss);
                    r=max(v[i].ff,v[j].ff);
                    l=min(v[i].ff,v[j].ff);
                    co=0;
                    for(ll x=0;x<n;x++){
                        if(v[x].ff>=l&&v[x].ff<=r&&v[x].ss>=bb&&v[x].ss<=t)
                            co++;
                    }
                    if(co>=k){
                        ans=min(ans,(t-bb)*(r-l));
                    }

                    continue;
                }
            for(ll h=j+1;h<n;h++){
                if(k<4){
                    t=max(max(v[i].ss,v[j].ss),v[h].ss);
                    bb=min(min(v[i].ss,v[j].ss),v[h].ss);
                    r=max(max(v[i].ff,v[j].ff),v[h].ff);
                    l=min(min(v[i].ff,v[j].ff),v[h].ff);
                    co=0;
                    for(ll x=0;x<n;x++){
                        if(v[x].ff>=l&&v[x].ff<=r&&v[x].ss>=bb&&v[x].ss<=t)
                            co++;
                    }
                    if(co>=k){
                        ans=min(ans,(t-bb)*(r-l));
                    }

                    continue;
                }
                for(ll g=h+1;g<n;g++){
                    t=max(max(v[i].ss,v[j].ss),max(v[h].ss,v[g].ss));
                    bb=min(min(v[i].ss,v[j].ss),min(v[h].ss,v[g].ss));
                    r=max(max(v[i].ff,v[j].ff),max(v[h].ff,v[g].ff));
                    l=min(min(v[i].ff,v[j].ff),min(v[h].ff,v[g].ff));
                    co=0;
                    for(ll x=0;x<n;x++){
                        if(v[x].ff>=l&&v[x].ff<=r&&v[x].ss>=bb&&v[x].ss<=t)
                            co++;
                    }
                    if(co>=k){
                        ans=min(ans,(t-bb)*(r-l));
                    }
                }
            }
        }
    }
    cout<<ans;


    return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Integer int1 = sc.nextInt();
		Integer int2 = sc.nextInt();

		Integer seki = int1 * int2;

		if (seki % 2 == 0) {
			System.out.println("Even");

		} else {
			System.out.println("Odd");
		}

	}

}


Measured memory_bytes: 35308
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

n = onem()


a = l()

aa = []

for i in range(n):
    aa.append([i,a[i]])
aa.sort(key = lambda x:x[1])
aaa = []

for i in range(n):
    aaa.append(aa[i][0]+1)


print(jo(aaa))





Measured memory_bytes: 31580
#include <bits/stdc++.h>
#define ll long long
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = 1; i <= n; i++)
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
using P = pair <int, int>;
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; }

ll MOD = 1000000007;
ll INF =1<<30;

int main(){
    int x;
    cin >> x;
    if(x>=30) cout << "Yes" <<endl;
    else cout << "No" <<endl;
}



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

#define REP( i, n )     for( int (i) = 0; (i) < (n); (i)++ )
#define ALL( a )        (a).begin(), (a).end()

using namespace std;
using ll = long long;
using P = pair<int, int>;

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( a > b ) { a = b; return 1; } return 0; }

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

int main(){
    ll N; cin >> N;
    ll t;
    for( ll i = 1; i * i <= N; i++ ){
        if( N % i == 0 ){
            t = i;
        }

    }

    cout << ( t - 1 ) + ( N / t - 1 ) << endl;
}


Measured memory_bytes: 384
import scala.io.StdIn._
import scala.annotation.tailrec

object Main {
    def main(args: Array[String]): Unit = sub(readLine().split(" ").map(_.toInt))
    def digit(a: Int, b: Int): Int = if(b == 0) a else digit(b, a % b)

    @tailrec
    def sub(n: Seq[Int]): Unit = {
        val gcd: Int = digit(n(0), n(1))
        val lcm: Long = n.map(_.toLong).product / gcd.toLong
        println(s"$gcd $lcm")
        val next: String = readLine()
        if(next == null) Unit else sub(next.split(" ").map(_.toInt))
    }
}

Measured memory_bytes: 43592
def calc(s):
    n = len(s)
    seq_cnt = []
    cnt, before_c = 0, s[0]
    for c in s:
        if c != before_c:
            seq_cnt.append(cnt)
            cnt = 0
            before_c = c
        cnt += 1
    seq_cnt.append(cnt)
    ret = 0
    for cnt in seq_cnt:
        ret += cnt // 2
    return ret


def main():
    S = input()
    K = int(input())
    N = len(S)
    index = N
    for i, c in enumerate(S):
        if c != S[0]:
            index = i
            break
    if index == N:
        # S consists of single kind of characters
        print(N * K // 2)
    else:
        # S consists of multiple kinds of characters
        print(calc(S[:index]) + (K - 1) * (calc(S[index:] + S[:index])) + calc(S[index:]))


if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
//#include <string>
//#include <algorithm>
//#include <math.h>
//#include <queue>
//#include <stack>
//#include <iomanip>

// sometimes used
//#include <set>
//#include <map>
//#include <numeric>
//#include <list>
//#include <deque>
//#include <unordered_map>

typedef long long LL;
//typedef long double LD;
using namespace std;
 
//#define MOD 1000000007
//#define MAX 100100
//#define NIL -1

int main(){
    LL a;
    double b;
    cin >> a >> b;
    LL tmp_b = (LL)(b*1000);
    tmp_b++;
    tmp_b/=10;
    LL ans=a*tmp_b;
    ans/=100;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3720
#include <iostream>
#include <cstdio>
#define max 100000
#define sen 2000000000
using namespace std;

struct card{
    char suit;
    int value;
};

//???????????¶??????
card l[max/2+2],r[max/2+2];
void Merge(card a[],int n,int left,int mid,int right){
    int n1=mid-left;
    int n2=right-mid;

    for (int i = 0; i < n1; ++i) {
        l[i]=a[left+i];
    }
    for (int i = 0; i < n2; ++i) {
        r[i]=a[mid+i];
    }

    l[n1].value=r[n2].value=sen;
    int i=0,j=0;
    for (int k = left; k < right; ++k) {
        if (l[i].value<=r[j].value){
            a[k]=l[i++];
        } else{
            a[k]=r[j++];
        }
    }
}

void merge_sort(card a[],int n,int left,int right){
    int mid;
    if (left+1<right){
        mid=(left+right)/2;
        merge_sort(a,n,left,mid);
        merge_sort(a,n,mid,right);
        Merge(a,n,left,mid,right);
    }
}

//??????????????????
int partition(card a[],int n,int begin,int end){
    card x=a[end];
    int i=begin-1;
    for (int j = begin; j < end; ++j) {
        if (a[j].value<=x.value){
            i++;
            swap(a[j],a[i]);
        }
    }
    swap(a[i+1],a[end]);
    return i+1;
}

void quicksort(card a[],int n,int begin,int end){
    int q;
    if (begin<end){
        q=partition(a,n,begin,end);
        quicksort(a,n,begin,q-1);
        quicksort(a,n,q+1,end);
    }
}

int main() {
    int n,val,stable=1;
    card a[max],b[max];
    char s[10];

    scanf("%d",&n);
    for (int i = 0; i < n; ++i) {
        scanf("%s %d",s,&val);
        a[i].suit=b[i].suit=s[0];
        a[i].value=b[i].value=val;
    }

    merge_sort(a,n,0,n);
    quicksort(b,n,0,n-1);

    for (int j = 0; j < n; ++j) {
        if (a[j].suit!=b[j].suit)
           stable=0;
    }

    if (stable==1){
        printf("Stable\n");
    } else{
        printf("Not stable\n");
    }

    for (int k = 0; k < n; ++k) {
        printf("%c %d\n",b[k].suit,b[k].value);
    }

    return 0;
}

Measured memory_bytes: 5468
#include <bits/stdc++.h>
using namespace std;
int main(){
double t,d,count=0;
cin>>t>>d;
while(t--){
	double a,b;
	cin>>a>>b;
	double res=sqrt(a*a+b*b);
	if(res<=d){
		count++;
	}
}
cout<<count<<endl;

	return 0;
}

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

int main()
{
	int a[6];

	for(int i=1;i<=5;i++)
	{
		cin>>a[i];

	}

	for(int i=1;i<=5;i++)
	{
		if(a[i]==0)
			cout<<i<<endl;
	}

	return 0;
}

Measured memory_bytes: 3568
#include <iostream>
using namespace std;
int main(){
  int n, count = 0;
  cin >> n;
  if(n % 10 == 0){
    cout << 10 << endl;
  } else {
    while(n > 0){
      int r = n % 10;
      count = count + r;
      n = n / 10;
    }
    cout << count << endl;
  }
  return 0;
}


Measured memory_bytes: 256
n=int(input())
a,b=map(int,input().split())
p=input().split()
p=list(map(int,p))
p.sort()
q=filter(lambda x: x<=a,p)
r=filter(lambda x: a+1<=x<=b,p)
s=filter(lambda x:b+1<=x,p)
a=min(len(list(q)),len(list(r)))
print(min(a,len(list(s))))

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

#define rep(i,N) for(int i=0;i<(int)N;++i)
#define rep1(i,N) for(int i=1;i<=(int)N;++i)

using int64 = long long;
using i64 = long long;

const int inf = 1 << 30;
const i64 inf64 = 1ll << 60;

const int mod = 1e9 + 7;

template<typename T>
vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }

template<typename... Ts>
auto make_v(size_t a, Ts... ts) {
   return vector<decltype(make_v(ts...))>(a, make_v(ts...));
}

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

template <typename T, typename U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
   return os << "(" << p.first << ", " << p.second << ")";
}

template <typename T> 
ostream& operator<<(ostream& os, const vector<T>& v) {
   os << "[";
   for (auto& e : v) os << e << ", ";
   return os << "]";
}

template <typename T>
void warshall_floyd(vector<vector<T>>& g, T inf) {
   for (int k = 0; k < g.size(); ++k) {
      for (int i = 0; i < g.size(); ++i) {
         for (int j = 0; j < g.size(); ++j) {
            if (g[i][k] == inf || g[k][j] == inf) continue;
            g[i][j] = min(g[i][j], g[i][k] + g[k][j]);
         }
      }
   }
}

int main() {
   int V, E; cin >> V >> E;
   auto g = make_v(V, V, inf64);
   rep(i, E) {
      int u, v;
      i64 d;
      cin >> u >> v >> d;
      g[u][v] = d;
   }
   rep(i, V) g[i][i] = 0;

   warshall_floyd(g, inf64);
   rep(i, V) if (g[i][i] < 0) {
      cout << "NEGATIVE CYCLE" << endl;
      return 0;
   }

   rep(i, V) {
      rep(j, V) {
         if (j == 0) {
            if (g[i][j] == inf64) cout << "INF";
            else cout << g[i][j];
         } else {
            if (g[i][j] == inf64) cout << " INF";
            else cout << " " << g[i][j];
         }
      }
      cout << endl;
   }
}


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

int N,tmp; map<int,int> arr; vector<int> v;

void Input(){
	cin>>N;
	for(int i=0; i<N; i++){
		cin>>tmp;
		if(arr[tmp]==0){
			v.push_back(tmp);
			arr[tmp]++;
		}else{
			arr[tmp]++;
		}
	}
	sort(v.begin(),v.end());
}

void Solve(){
	int total=0;
	for(int i=0; i<v.size(); i++){
		for(int j=i+1; j<v.size(); j++){
			for(int k=j+1; k<v.size(); k++){
				if(v[i]+v[j]>v[k]){
					total+=arr[v[i]]*arr[v[j]]*arr[v[k]];
				}
			}
		}
	}
	cout<<total<<'\n';
}

int main(){
	Input();
	Solve();
}

Measured memory_bytes: 3644
#include<stdio.h>
int main(){
	int n,A,B;
	scanf("%d%d%d",&n,&A,&B);
	int res=0,x;
	while(n--){
		scanf("%d",&x);
		if(!(x>=A && x<B))res++;
	}
	printf("%d\n",res);
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> pip;
typedef pair<pll, pll> P;
const ll INF = 1ll<<30;
const ll MOD = 1000000007;
const double EPS = 1e-9;
const bool debug = 0;
//---------------------------------//

int main() {
	string S, T;
	cin >> S >> T;
	int ans = 0;
	REP(i, 3) if (S[i] == T[i]) ans++;
	cout << ans << endl;
	
	
	
	return 0;
}


Measured memory_bytes: 764
N =int(input())
co = {0:0,1:0,2:0,3:0}
ans = 0
foo =0
for _ in range(N):
    i = input()
    foo = 0
    if i[0] =="B":
        foo += 1
    if i[-1] =="A":
        foo += 2
    co[foo] += 1
    ans += i.count("AB")
ans +=  min(co[1],co[2])
ans += co[3]
if co[1]==0 and co[2] == 0 and co[3]!= 0:
    ans -= 1
print(ans)

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int x = scanner.nextInt();
		String result = "ARC";

		if (x < 1200) {
			result = "ABC";
		}
		System.out.println(result);
	}

}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  string s;
  cin >> n >> s;
  int nn=0;
  int maxx=0;
  for(int i=0; i<n; i++){
    if(s[i] == 'I'){
      nn++;
    }
    else{
      nn--;
    }
    maxx = max(maxx, nn);
  }
  cout << maxx << endl;
}

Measured memory_bytes: 256
N,X=map(int, input().split())
L=list(map(int, input().split()))
L.append(0)


d = 0
count = 0

#跳ねる直前からスタート

for i in range(1, N+2):
  if d <= X:
    count = count + 1
    d = d + L[i-1]

print(count)

Measured memory_bytes: 3060
stdin.ReadLine().Split(" ")
|> Array.map int
|> fun x ->
    x
    |> Array.reduce (-)
    |> System.Math.Abs
    |> fun i ->
        if i % 2 = 0 then
            (Array.max x - (i / 2))
            |> System.Math.Abs
            |> string
        else
            "IMPOSSIBLE"

|> printfn "%s"


Measured memory_bytes: 29592
h, w, k = gets.split.map(&:to_i)

ans = Array.new(h){Array.new(w)}
now = 0
l = -1

h.times do |i|
    s = gets.chomp
    x = s.index("#")
    
    if x.nil?
        l + 1 == i ? l = i : ans[i] = ans[i-1]
    else
        now += 1
        ans[i].fill(now, 0..x)
        (x+1).upto(w-1) do |j|
            now += 1 if s[j] == "#"
            ans[i][j] = now
        end
    end
end

l.downto(0) {|i| ans[i] = ans[i+1]}
puts ans.map{|e| e.join(" ")}

Measured memory_bytes: 3964
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define ull unsigned long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define _h cout<<"here"<<endl;
#define fill(a,v) memset(a,v,sizeof(a));
#define all(v) v.begin(),v.end()
#define rep(i,n) for(int i=0;i<n;i+=1)
#define prd(a,n) rep(i,n) cout<<a[i]<<" \n"[i==n-1];// printf("%s\n"," " );
#define ff first
#define ss second
#define pu push_back
const int inf = 1e9+10;
const ll INF = 2e18+10;
const int Mod = 1e9+7;
const int MAXN = 1000010;
const int N=2e5+10;
const int M=210;
const int M1=1e9+7;
const int M2=1e9+9;
const int base=131;
int main()
{
  ios::sync_with_stdio(0), cin.tie(0); cout.tie(0);
  // freopen("input.txt","r",stdin);
  // freopen("output.txt","w",stdout);
  ll n,d,ans=0;
  cin>>n>>d;
  for(int i=1;i<=n;i++)
  {
    ll x,y;
    cin>>x>>y;
    if((x*x+y*y)<=(d*d)) ans++;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 3604