akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template <typename Q_type>
using smaller_queue = priority_queue<Q_type, vector<Q_type>, greater<Q_type>>;

const int MOD_TYPE = 1;
const ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
const int INF = (int)1e9;
const ll LINF = (ll)4e18;
const ld PI = acos(-1.0);
const ld EPS = 1e-11;

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << "\n"
#define Yes(n) cout << ((n) ? "Yes" : "No") << "\n"
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << "\n"
#define possible(n) cout << ((n) ? "possible" : "impossible") << "\n"
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << "\n"
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << "\n";

vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(30) << setiosflags(ios::fixed);

  int n;
  cin >> n;
  ld p[3000];
  rep(i, n) cin >> p[i];
  ld dp[3010][3010] = {};
  dp[0][0] = 1.0;
  rep(i, n)
  {
    rep(j, n + 1)
    {
      if (j >= 1)
        dp[i + 1][j] += dp[i][j - 1] * p[i];
      dp[i + 1][j] += dp[i][j] * (1.0 - p[i]);
    }
  }
  ld sum = 0.0;
  for (int i = n / 2 + 1; i <= n; i++)
    sum += dp[n][i];
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 141952
#include<cstdio>
#include<algorithm>
using namespace std;
#define MAXN 110
int x,n,mx,cnt[MAXN];
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&x);
		cnt[x]++;
		mx=max(mx,x);
	}
	bool f=1;
	int k=mx-mx/2;
	for(int i=0;i<k&&f;i++)
		if(cnt[i])
			f=0;
	if(cnt[k]!=1+(mx&1))
		f=0;
	for(int i=k+1;f&&i<=mx;i++)
		if(cnt[i]<2)
			f=0;
	if(f==0) printf("Impossible\n");
	else printf("Possible\n");
}

Measured memory_bytes: 128
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
#include <assert.h>
typedef int64_t ll;
typedef uint64_t ull;
int acs(const void *a, const void *b){return *(int*)a - *(int*)b;} /* 1,2,3,4.. */
int des(const void *a, const void *b){return *(int*)b - *(int*)a;} /* 8,7,6,5.. */
#define min(a,b) (a < b ? a: b)
#define max(a,b) (a > b ? a: b)

#define MAXN (200001)
#define MOD (1000000007)

int main(void)
{
    ll n;
    scanf("%ld",&n);

    ll ans;
    if(n%2==0)
    {
        ans = n/2-1;
    }else
    {
        ans = n/2;
    }
    
    printf("%ld\n", ans);
    return 0;
}


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

int main(){
  int n,a,b,c,x;
  int cnt,y;

  while(1){
    cin >> n >> a >> b >> c >> x;
    if(!n && !a && !b && !c && !x)break;

    cnt = 0;
    for(int i=0;i<n;i++){
      cin >> y;
      while(1){
	if(y == x)break;
	cnt++;
	x = (a * x + b) % c;
	if(cnt>10000)break;
      }
      if(i==n-1)break;
      cnt++;
      x = (a * x + b) % c;
    }

    if(cnt>10000)cout << -1 << endl;
    else cout << cnt << endl;
  }
}

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

int main(void) {
	int N; string s;
	cin >> N >> s;
	int sum = 0;
	int AA = 0;
	int i, j;

	for (i = 0; i < N; i++) {
		int count = 0;
		for (j = 'a'; j <= 'z'; j++) {
			if (s.find(j, i + 1) != -1 && s.rfind(j, i) != -1) {
				count += 1;
			}
		}
		AA = max(AA, count);
	}
	cout << AA << endl;
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;

    int a[n];
    for (int i=0; i<n; ++i) {
        cin >> a[i];
    }
    for (int i=n-1; i>=0; --i) {
        if (i==n-1) {
            cout << a[i];
            continue;
        }
        cout << " " << a[i];
    }
    cout << "\n";

    return 0;
}

Measured memory_bytes: 1200
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
using namespace std;
typedef long long ll;
int main(){
  int n = 0;
  cin >> n;
  int a,b,c;
  a = 0;
  b = 0;
  c = 0;
  for(int i = 1;i <= 3500;i++){
    for(int j = 1;j <= 3500;j++){
      if(4 * i * j != j * n + i * n){
        ll x,y;
        x = 1ll * i * j * n;
        y = 4 * i * j - j * n - i * n;
        if(x % y == 0 && y > 0 && x / y > 0 && x / y <= 3500){
          c = x / y;
          a = i,b = j;
          i = 3501,j = 3501;
        }
        //cout << i << " " << j << endl;
      }
    }
  }
  cout << a << " " << b << " " << c << endl;
}

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

using namespace std;
using ll = long long;

void init();
void solve();

#define rep(i, a) for (int i = 0; i < (int) (a); i++)
#define reps(i, a, b) for (int i = (int) (a); i < (int) (b); i++)
#define rrep(i, a) for (int i = (int) a-1; i >= 0; i--)
#define rreps(i, a, b) for (int i = (int) (a)-1; i >= (int) (b); i--)
#define MP(a, b) make_pair((a), (b))
#define PB(a) push_back((a))
#define all(v) (v).begin(), (v).end()
#define PRINT(f) if((f)){cout << (TRUE__) << endl;}else{cout << FALSE__ << endl;}
#define TRUE__  "YES"
#define FALSE__ "NO"
#define PERM(v) next_permutation(all(v))
#define UNIQUE(v) sort(all(v));(v).erase(unique(all(v)), v.end())
#define CIN(type, x) type x;cin >> x

#ifdef LOCAL
#define lcout(a) cout << a
#define lcoutln(a) cout << a << endl
#define lcerr(a) cerr << a
#define lcerrln(a) cerr << a << endl
#else
#define lcout(a) 
#define lcoutln(a) 
#define lcerr(a) 
#define lcerrln(a) 
#endif
#define MOD 1000000007
#define PI 3.141592653589793238462643383


signed main()
{
	init();
	solve();
}

int N, K;
vector<unsigned int> a, b;

void init()
{
	cin >> N >> K;
	a.resize(N);
	b.resize(N);
	rep(i, N) cin >> a[i] >> b[i];
}

unsigned int mask;

ll culc()
{
	ll res = 0;
	rep(i, N) {
		if ((mask & a[i]) == 0) res += b[i];
	}
	return res;
}

void solve()
{
	ll res = 0;
	unsigned int bit = 1 << 31;
	unsigned int pos = 1 << 31;
	while (true) {
		while ((bit & K) == 0 && bit != 0) bit >>= 1;
		if (bit == 0) break;
		while (pos >= bit) {
			mask |= pos;
			pos >>= 1;
		}
		res = max(res, culc());
		mask &= ~bit;
		bit >>= 1;
	}
	mask = ~K;
	res = max(culc(), res);
	cout << res << endl;
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
 
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);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 VSORT(v) sort(v.begin(), v.end())
#define DVSORT(v) sort(v.begin(), v.end(),greater<int>())
#define SORT(v, n) sort(v, v+n)
#define DSORT(v,n) sort(v, v+n,greater<int>())
#define vi vector<int>
#define pb push_back
#define P pair<int,int>
 
template <class T> void chmin(T&a,const T&b) { a = min(a,b); }
template <class T> void chmax(T&a,const T&b) { a = max(a,b); }
 
void print(){cout<<endl;}
template <class Head, class... Tail>
void print(Head&& h,Tail&&... t){ 
	if(sizeof...(t)==0)
		cout<<h;
	else
		cout<<h<<' ';
	print(move(t)...);
}
 
const double EPS =1e-9;
const long INF =2147483647;//32bit 2*1e+9
const long MOD =1e+9+7;
#define PI 3.14159265258979
 
int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};

int main(void){
	int N,last=0;
	cin>>N;
	REP(i,N+1){
		if(N<=((i*(i+1))/2)){
			last=i; break;
		}
	}

	RFOR(i,1,last+1){
		if(N==0) break;
		else if(i<=N){
		print(i);
		N-=i;
		}
	}
	return 0;
}


Measured memory_bytes: 256
n, l = map(int, input().split())
a = [int(i) for i in range(l, n + l)]

if 0 in a:
    print(sum(a))
elif abs(a[0]) < abs(a[-1]):
    print(sum(a) - a[0])
else:
    print(sum(a) - a[-1])

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

int n;
map<string, int> mp;
string str;
int num;
pair<int, string> len_name[1000000];

signed main()
{
	cin >> n;
	rep(i,n) {
		cin >> str >> num;
		mp[str] += num;
	}

	map<string, int>::iterator it = mp.begin();
	int idx = 0;
	while (it != mp.end()) {
		len_name[idx].first = it->first.length();
		len_name[idx].second = it->first;
		idx++;
		it++;
	} 

	sort(len_name, len_name + idx);

	rep(i,idx) {
		cout << len_name[i].second << " " << mp[len_name[i].second] << endl;
	}
}

Measured memory_bytes: 16856
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <complex>
#include <vector>
#include<limits>
#include<iomanip>
#include<cassert>

using namespace std;

typedef long long ll;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;

const long double pi = 3.141592653589793;

#define debug(x) cout << #x << " = " << (x) << endl;
#define rep(i, n) for(int i = 0;i < n;i++)
#define repi(i, j, n) for(int i = j;i < n;i++)
#define pb push_back
#define mp make_pair
#define mod 998244353
#define F first
#define S second

string s;int k, n;

/*
  --- 0 111111  ----------
      i'     i     (j)

      i(3) j(3) k(5)

      O(N ** 4)
*/

unordered_map<ll, int> dp;
ll state_to_num(int i, int j, int k) {
  return 1LL*i*1E10 + 1LL*j*1E6 + k;
}

int combinations(int i, int j, int k) {
  if(i < 0) return 1;
  if(dp.count(state_to_num(i, j, k)) == 1) {
    return dp[state_to_num(i, j, k)];
  }

  int id = i;
  while(id >= 0 && s[id] == '1') id--;
  if(id == -1) return 1;
  int ans = 0;
  for(int ps = 0;ps <= (i-id+j);ps++) {
    if(ps <= j) {
      ans += combinations(id-1, ps, k);
    } else if(ps-j <= k) {
      ans += combinations(id-1, ps, k-ps+j);
    }
    ans %= mod;
  }
  return dp[state_to_num(i, j, k)] = ans;
}

int main() {

 // freopen("input.in","r",stdin);
 // freopen("output.out","w",stdout);

 cin>>s>>k;
 n = s.size();
 k = min(k, n);

 cout << combinations(n-1, 0, k) << endl;
 if(dp.size() > 1000000) {
   assert(false);
 }

 return 0;
}


Measured memory_bytes: 31772
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<queue>
#include<functional>
#include<map>
#include<set>
#include<cstring>
#include<string>
#include<stack>
#include<stdlib.h>
#include<math.h>
using namespace std;
#define int long long
typedef pair<int, int> pii;
typedef pair<int, char> pic;
typedef priority_queue<pii, vector<pii>, greater<pii> > RPQ;
#define mk make_pair
#define INF (1 << 30)
#define INFL (1ll << 60ll)
#define mod 1000000007



signed main(){
    
    int a, b, c;
    cin >> a >> b >> c;
    for(int i = 0; i < 10; i++){
        c = c * a - b;
        cout << c << endl;
    }

    return 0;
}
/*


*/

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(int)(n); i++)

using namespace std;
using LL = long long;
const LL INF = 1e15;

int main(){
  LL N, K;
  cin >> N >> K;
  vector<LL> P(N), C(N);
  rep(i,N) cin >> P[i];
  rep(i,N) P[i]--;
  rep(i,N) cin >> C[i];
  LL ans=-INF;
  rep(i,N){
    int next=P[i];
    vector<bool> visited(N);
    visited[i]=true;
    vector<LL> score;
    LL now_score=0;
    while(!visited[next]){
      visited[next]=true;
      now_score+=C[next];
      score.emplace_back(now_score);
      next=P[next];
    }
    now_score+=C[next];
    score.emplace_back(now_score);
    LL S=score.size();
    LL res=score[0];
    if(now_score<=0){
      rep(j,min(K,S)) res=max(res,score[j]);
    }
    else{
      if(K<=S){
        rep(j,K) res=max(res,score[j]);
      }
      else{
        LL res1=0, res2=0;
        LL M1=score[S-1]*(K/S-1);
        rep(j,S-1) res1=max(res1,score[j]);
        res1+=M1;
        LL M2=score[S-1]*(K/S);
        rep(j,K%S) res2=max(res2,score[j]);
        res2+=M2;
        res=max(res1,res2);
      }
    }
    ans=max(ans,res);
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3792
#[allow(unused_macros)]
macro_rules ! read_value {($ next : expr , ($ ($ t : tt ) ,* ) ) => {($ (read_value ! ($ next , $ t ) ) ,* ) } ; ($ next : expr , [$ t : tt ; $ len : expr ] ) => {(0 ..$ len ) . map (| _ | read_value ! ($ next , $ t ) ) . collect ::< Vec < _ >> () } ; ($ next : expr , chars ) => {read_value ! ($ next , String ) . chars () . collect ::< Vec < char >> () } ; ($ next : expr , usize1 ) => {read_value ! ($ next , usize ) - 1 } ; ($ next : expr , $ t : ty ) => {$ next () . parse ::<$ t > () . expect ("Parse error" ) } ; }
#[allow(unused_macros)]
macro_rules ! input_inner {($ next : expr ) => {} ; ($ next : expr , ) => {} ; ($ next : expr , $ var : ident : $ t : tt $ ($ r : tt ) * ) => {let $ var = read_value ! ($ next , $ t ) ; input_inner ! {$ next $ ($ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! input {(source = $ s : expr , $ ($ r : tt ) * ) => {let mut iter = $ s . split_whitespace () ; let mut next = || {iter . next () . unwrap () } ; input_inner ! {next , $ ($ r ) * } } ; ($ ($ r : tt ) * ) => {let stdin = std :: io :: stdin () ; let mut bytes = std :: io :: Read :: bytes (std :: io :: BufReader :: new (stdin . lock () ) ) ; let mut next = move || -> String {bytes . by_ref () . map (| r | r . unwrap () as char ) . skip_while (| c | c . is_whitespace () ) . take_while (| c |! c . is_whitespace () ) . collect () } ; input_inner ! {next , $ ($ r ) * } } ; }

#[allow(unused_macros)]
macro_rules ! min {($ a : expr $ (, ) * ) => {{$ a } } ; ($ a : expr , $ b : expr , $ (, ) * ) => {{std :: cmp :: min ($ a , $ b ) } } ; ($ a : expr , $ ($ rest : expr ) ,+ $ (, ) * ) => {{std :: cmp :: min ($ a , min ! ($ ($ rest ) ,+ ) ) } } ; }
#[allow(unused_macros)]
macro_rules ! chmin {($ base : expr , $ ($ cmps : expr ) ,+ $ (, ) * ) => {{let cmp_min = min ! ($ ($ cmps ) ,+ ) ; if $ base > cmp_min {$ base = cmp_min ; true } else {false } } } ; }

#[allow(non_snake_case)]
fn main() {
    input! {
        A: i32,
        B: i32,
        C: i32,
        X: i32,
        Y: i32,
    }
    let mut ret = std::i32::MAX;
    chmin!(ret, A * X + B * Y);
    chmin!(ret, C * 2 * std::cmp::max(X, Y));
    if X >= Y {
        chmin!(ret, C * 2 * Y + A * (X - Y));
    } else {
        chmin!(ret, C * 2 * X + B * (Y - X));
    }

    println!("{}", ret);
}


Measured memory_bytes: 2068
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll> 
#define P pair<ll,ll>
#define ALL(a) a.begin(),a.end()
#define YESNO(i) puts((i)?"YES":"NO");
#define YesNo(i) puts((i)?"Yes":"No");
#define yesno(i) puts((i)?"yes":"no");
#define rep(i,n) for(ll i=0; i<n; ++i)
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;cin>>n;n--;
  string ans;
  while(n>-1) {
    ll div=n/26,rem=n%26;
    ans+='a'+rem;
    n=div-1;
  }
  reverse(ALL(ans));
  print(ans);
  return 0;
}

Measured memory_bytes: 3600
x1,y1,x2,y2=map(int,input().split())

xd= x2-x1
yd= y2-y1

x3 = x2 - yd
y3 = y2 + xd
x4 = x1 - yd
y4 = y1 + xd

print(x3,y3,x4,y4)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

struct CumulativeSum2D{
    vector<vector<int> > data;
    CumulativeSum2D(int H, int W) : data(H + 1, vector<int>(W + 1, 0)) {}
    //要素(x,y)に値zを加える
    void add(int x, int y, int z){
        ++x, ++y;
        if(x >= data.size() || y >= data[0].size()) return;
        data[x][y] += z;
    }
    void build(){
        for(int i = 1; i < data.size(); i++) {
        for(int j = 1; j < data[i].size(); j++) {
            data[i][j] += data[i][j - 1] + data[i - 1][j] - data[i - 1][j - 1];
            }
        }
    }
    //左上[sy, sx], 右下(gx, gy)の矩形内の和を求める(半開区間) (0-index)
    int query(int sx, int sy, int gx, int gy){
        return (data[gx][gy] - data[sx][gy] - data[gx][sy] + data[sx][sy]);
    }
};

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, k;
    cin >> n >> k;
    int h = 2 * k, w = 2 * k;
    int nb = 0, nw = 0;
    CumulativeSum2D csblack(h, w), cswhite(h, w);
    rep(i, 0, n){
        int y, x;
        char c;
        cin >> y >> x >> c;
        y %= h; x %= w;
        if(c == 'B'){
            csblack.add(y, x, 1);
            nb++;
        }
        if(c == 'W'){
            cswhite.add(y, x, 1);
            nw++;
        }
    }
    cswhite.build();
    csblack.build();
    int ans = 0;
    for(int i = 0; i <= k; i++){
        for(int j = 0; j <= k; j++){
            int numblack = csblack.query(0, 0, i, j) + csblack.query(i, j, i + k, j + k) + csblack.query(i + k, j + k, h, w) + csblack.query(0, j + k, i, w) + csblack.query(i + k, 0, h, j);
            int numwhite = cswhite.query(0, 0, i, j) + cswhite.query(i, j, i + k, j + k) + cswhite.query(i + k, j + k, h, w) + cswhite.query(0, j + k, i, w) + cswhite.query(i + k, 0, h, j);
            ans = max(ans, numblack + nw - numwhite);
            ans = max(ans, numwhite + nb - numblack);
            // cout << i << ' ' << j << ' ' << numblack << ' ' << numwhite << endl;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 62976
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int Y = sc.nextInt();
        int y10000 = -1;
        int y5000 = -1;
        int y1000 = -1;
        for(int i=0;i<=N;i++){
            for(int j=0;j<=N-i;j++){
                if(10000*i+5000*j+1000*(N-i-j) == Y){
                    y10000 = i;
                    y5000 = j;
                    y1000 = N-i-j;
                    break;
                }
            }
        }
        System.out.println(y10000+" "+y5000+" "+y1000);
    }
}

Measured memory_bytes: 21844
i = input().split()

n,x = list(map(int, i))

l = input().split()

l = list(map(int, l))

c = 1

aux = 0

step = [0]

for i in range(len(l)):
    try:        
        if step[i] + l[i] <= x:
            step.append(step[i] + l[i])
    except:
        pass

print(len(step))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define plskz ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ll long long
using namespace std;

int main() {
    plskz   
    int a, b;
    cin >> a >> b;
    cout << (b%a ? b-a : a+b);
}

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


ll gcd(ll i,ll j){
        if(j == 0) return i;
        return gcd(j,i%j);
}

ll lcm(ll i,ll j){
        return i / gcd(i,j) * j;
}


int main() {
  int n,m;
  cin >> n >> m;
  vector<int> a(n);
  rep(i,n) cin >> a.at(i);
  rep(i,n) a.at(i) /= 2;
  ll k = 1;
  rep(i,n) k = lcm(k,a.at(i));
  ll ans = 0;
  bool ok = true;
  rep(i,n){
    if( (k/(a.at(i)))%2 == 0){
      ok = false;
      break;
    }
  }
  if(ok){
    if( k > m);
    else ans = (m-k)/(2*k) + 1;
  }
  cout << ans <<endl;
}

Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<functional>
#include<string>
#include<string.h>
#include<limits.h>
#include<vector>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#define int long long
using namespace std;

int dp[2][2000];
int a[2000];
signed main() {
	int n, z, w; cin >> n >> z >> w;
	for (int i = 0; i < n; i++)cin >> a[i];
	for (int i = n - 2; i >= 0; i--) {
		//自分がとった場合の最大(小)値
		int MIN = abs(a[i] - a[n - 1]);
		for (int j = n - 2; j > i&&j >= 0; j--)MIN = min(MIN, dp[1][j]);
		dp[0][i] = MIN;
		int MAX = abs(a[i] - a[n - 1]);
		for (int j = n - 2; j > i&&j >= 0; j--)MAX = max(MAX, dp[0][j]);
		dp[1][i] = MAX;
	}
	int ans = abs(w - a[n - 1]);
	for (int i = 0; i < n - 1; i++) {
		ans = max(ans, dp[0][i]);
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
import bisect

H, W, M = map(int,input().split())
hw = [list(map(int,input().split())) for _ in range(M)]
hw.sort()

rows, columns = [0]*H, [0]*W
for h, w in hw:
    rows[h-1] += 1
    columns[w-1] += 1
max_r, max_c = max(rows), max(columns)

argmax_r, argmax_c = [], []
for i in range(H):
    if max_r == rows[i]:
        argmax_r.append(i)

for i in range(W):
    if max_c == columns[i]:
        argmax_c.append(i)

for r in argmax_r:
    for c in argmax_c:
        idx = bisect.bisect_left(hw, [r+1, c+1])
        if idx == M or hw[idx] != [r+1,c+1]:
            print(max_r + max_c)
            exit()

print(max_r + max_c - 1)

Measured memory_bytes: 175300
#include<bits/stdc++.h>
using namespace std;
string s;
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin>>s;
	if(s[0]=='7'||s[1]=='7'||s[2]=='7') return cout<<"Yes",0;
	cout<<"No";
	return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
const ll N = 1e6 + 5;
const ll base = 313;
const ll base1 = 113;
const ll mod = 1e9 + 7;
ll n, t, pr[N], nx[N], T, k, b[N], c[N], sum= 0, m, tong, ans, pw1[N], pw[N];
struct dang
{
    ll l, r, pos;
};
ll a[N];
string s;
vector<ll> kq;
void sol()
{
    cin >> n;
    for(int i = 1 ; i <= n; i ++)
    {
        cin >> m;
        kq.pb(m);
    }
    sort(kq.begin(), kq.end());
    //kq.erase(unique(kq.begin(), kq.end()), kq.end());
    n = kq.size();
    for(int i = 0; i < n; i ++)
    {
        for(int j = i + 1; j < n; j ++)
        {
            for(int l = j + 1; l < n; l ++)
            {
                if(kq[i] + kq[j] > kq[l] && kq[i] != kq[j] && kq[j] != kq[l])++ans;
            }
        }
    }
    cout << ans;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    sol();
}


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


int main() {
    string S;
    cin >> S;

    int countZero = 0;
    int countOne = 0;
    for (int i = 0; i < S.size(); ++i) {
        if (S[i] == '0') ++countZero;
        if (S[i] == '1') ++countOne;
    }

    int ans = 2 * min(countZero, countOne);

    cout << ans  << endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <iomanip>
#include <algorithm>
#include <sstream>
#include <string>
#include <math.h>
#include <set>
using namespace std;
typedef long long ll;
 
int main() {
	ios::sync_with_stdio(false);
	ll x, sum = 0;
	cin >> x;
	if ( x <= 6 ) cout << 1;
	else if ( x <= 11 ) cout << 2;
	else {
		sum += x/11;
		x%=11;
		if ( !x ) cout << sum * 2; 
		else if ( x <= 6 ) cout << sum * 2 + 1;
		else cout << sum * 2 + 2;
	}
}

Measured memory_bytes: 256
import math
n = int(input())
x = list(map(int, input().split() ))
y = list(map(int, input().split() ))

D = [0 for x in range(3)]
for pi in range(3):
 S = 0
 for ni in range(n):
  S = S + abs(x[ni]-y[ni])**(pi+1)
 D[pi] = S**(1/(pi+1))
 print(D[pi])
Dinf = -math.inf
for ni in range(n):
 Dinf = Dinf if Dinf>abs(x[ni]-y[ni]) else abs(x[ni]-y[ni])
print(Dinf)



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

using namespace std;

int N,T,c,t,x,an = 2000;

int main(void) {
    cin >> N >> T;
    for (x=0 ; x<N ; x++) {
        cin >> c >> t;
        if (T >= t && c < an) an = c;
    }
    if (an == 2000) {
        cout << "TLE\n";
        return 0;
    }
    cout << an << "\n";


}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cassert>
#include <cstdint>
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <bitset>

using namespace std;

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

constexpr ll MOD = 1000000007;
constexpr long double EPS = 1e-10;
constexpr int dyx[4][2] = {
    { 0, 1}, {-1, 0}, {0,-1}, {1, 0}
};
constexpr int N_MAX = 100000;

class UnionFind {
    public:
    int n;
    vector<int> par, rank, size;  //親, 深さ, その木の要素数

    UnionFind(int n): n(n) {
        for(int i=0;i<n;++i){
            par.push_back(i);
            rank.push_back(0);
            size.push_back(1);
        }
    }

    //根を求める
    int find(int x){
        if(par[x] == x){
            return x;
        }else{
            int p = find(par[x]);
            size[x] = size[p];
            return par[x] = p;
        }
    }

    //xとyの属する集合の併合
    void unite(int x, int y){
        x = find(x);
        y = find(y);
        if(x == y) return;
        
        size[x] += size[y];
        size[y] = size[x];
        if(rank[x] < rank[y]){
            par[x] = y;
        }else{
            par[y] = x;
            if(rank[x] == rank[y]) rank[x]++;
        }
    }

    //同じ集合に属するか否か
    bool is_same(int x, int y){
        return find(x) == find(y);
    }
};

int main() {
    std::ios::sync_with_stdio(0); cin.tie(0);
    int n;
    cin >> n;
    UnionFind uf = UnionFind(2*N_MAX);
    int x, y;
    for(int i=0;i<n;++i){
        cin >> x >> y;
        --x; --y;
        uf.unite(x, N_MAX+y);
    }

    vector<ll> count_x(2*N_MAX, 0), count_y(2*N_MAX, 0);
    for(int i=0;i<N_MAX;++i) {
        ++count_x[uf.find(i)];
        ++count_y[uf.find(N_MAX+i)];
    }

    ll ans = 0LL;
    for(int i=0;i<2*N_MAX;++i) {
        ans += count_x[i] * count_y[i];
    }
    ans -= n;

    cout << ans << endl;
}


Measured memory_bytes: 6112
import java.util.*;
public class Main {
    public static void main(String[] args) throws Exception {
        String[] lines = getStdin();
        String str = lines[0];
        int k = Integer.parseInt(str);
        String[] cov = lines[1].split(" ");
        int a = Integer.parseInt(cov[0]);
        int b = Integer.parseInt(cov[1]);
        int c = b - a;
        
            for(int i = a; i <= b; i++){
                if (i % k == 0){
                    System.out.println("OK");
                    return;
                }
            }
            System.out.println("NG");
   }
  private static String[] getStdin() {
    Scanner scanner = new Scanner(System.in);
    ArrayList<String> lines = new ArrayList<>();
    while (scanner.hasNext()) {
      lines.add(scanner.nextLine());
    }
    return lines.toArray(new String[lines.size()]);
  }
}

Measured memory_bytes: 27036
#include <iostream>
#include <cstdlib>
#include <climits>

using namespace std;

int main()
{
  int a, b, c, d, ab, bc, ca;
  std::cin >> a >> b >> c >> d;

  ab = abs(a - b);
  bc = abs(b - c);
  ca = abs(c - a);

  /*
  if (abs(c - a) <= d)
  {
    cout << "YES" << endl;
    return 0;
  }
  
  int k, l;
  k = abs(a - b);
  l = abs(c - b);
  if (k <= d && l <= d)
  {
    cout << "YES" << endl;
    return 0;
  }

  cout << "NO" << endl;
  return 0;
  */

  if ((ab <= d && bc <= d) || ca <= d)
  {
    cout << "Yes";
  } else {
    cout << "No";
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(0)
#define endl "\n"
#define pb push_back
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define int long long
const int MOD=1e9+7;
const int N=2e5+5;
int32_t main()
{
    IOS;
    int n;
    cin>>n;
    int ans=0;
    for(int i=2;i*i<=n;i++)
    {
    	int cnt=0;
    	while(n%i==0)
    	{
    		n/=i;
    		cnt++;
    	}
    	ans+=(-1+sqrt(1+8*cnt))/2;
    }
    if(n>1)
    	ans+=1;
    cout<<ans<<endl;
     
}

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

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define all(a) (a).begin(),(a).end()

template<typename T1, typename T2> inline void chkmin(T1 & x, const T2 & y) {if (y < x) x = y;}
template<typename T1, typename T2> inline void chkmax(T1 & x, const T2 & y) {if (x < y) x = y;}
#define int ll
int n, d;
int ans = 0;

void read() {
	cin >> n >> d;
	for (int i = 0; i < n; i++) {
		int x, y;
		cin >> x >> y;
		if (x * x + y * y <= d * d) {
			ans++;
		}
	}
	cout << ans << endl;
}

void run() {

}

void write() {

}

signed main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0), cout.precision(20), cout.setf(ios::fixed);
	read();
	run();
	write();
	return 0;
}

Measured memory_bytes: 3640
n = gets.to_i
data = n.times.map { gets.strip.split.map(&:to_i) }

def is_reachable(current, next_data)
    # 次の地点までのマンハッタン距離
    tc, xc, yc = current
    tn, xn, yn = next_data
    dist = (xc - xn).abs + (yc - yn).abs
    dt = tn - tc

    # 最短距離でも間に合わない
    return false if dist > dt

    # 行ったり来たりでちょうど到着できるか
    (dist - dt).even?
end

current = [0, 0, 0]
reach = data.all? do |d|
    if is_reachable(current, d)
        current = d
        true
    else
        false
    end
end

puts reach ? 'Yes' : 'No'


Measured memory_bytes: 9468
#include<bits/stdc++.h>
using namespace std;
typedef pair<set<string>,string>P;
set<string>::iterator it1,it2;
struct no{
  int id;
  int syurui;
  double p;
  int same;
  string s;
  set<string>st;
  no *left,*right;
  no(int ID){left=right=NULL;s="";st.clear();id=ID;p=0.0;}
};
int C=0;
typedef no* node;
node make_tree(int l,int r,const string &str){
  int cnt=0;
  node x=new no(C++);
  if(l==r)return x;
  for(int i=l+1;i<r;i++){
    if(str[i]=='(')cnt++;
    if(str[i]==')')cnt--;
    if(cnt==0&&str[i]==' '){
      if(l+1<=i-1)x->left=make_tree(l+1,i-1,str);
      if(i+1<=r-1)x->right=make_tree(i+1,r-1,str);
      break;
    }
  }
  return x;
}
void print_tree(node x){
  if(x->left==NULL && x->right==NULL){
    cout<<'x';
    return;
  }
  cout<<'(';
  if(x->left!=NULL)print_tree(x->left);
  cout<<' ';
  if(x->right!=NULL)print_tree(x->right);
  cout<<')';
}
void delete_tree(node x){
  if(x->left!=NULL)delete_tree(x->left);
  if(x->right!=NULL)delete_tree(x->right);
  delete(x);
}
P calc_tree(node x){
  int cnt=0;
  vector<string>v;
  set<string>sl,sr,st;
  string s1,s2,new_s;
  if(x->left==NULL && x->right==NULL){
    sl.insert("()");
    return P(sl,"()");
  }
  if(x->left!=NULL){
    P p=calc_tree(x->left);
    sl=p.first;
    s1=p.second;
    v.push_back(s1);
  }
  if(x->right!=NULL){
    P p=calc_tree(x->right);
    sr=p.first;
    s2=p.second;
    v.push_back(s2);
  }
  sort(v.begin(),v.end());
  for(it1=sl.begin();it1!=sl.end();it1++){
    st.insert((*it1));
    for(it2=sr.begin();it2!=sr.end();it2++){
      if((*it1)==(*it2))cnt++;
    }
  }
  for(it2=sr.begin();it2!=sr.end();it2++){
    st.insert((*it2));
  }
  for(int i=0;i<v.size();i++){
    new_s+=v[i];
  }
  x->syurui=st.size();
  x->same=cnt;
  x->p=(double)cnt/st.size();
  x->s="("+new_s+")";
  st.insert(x->s);
  x->st=st;
  return P(st,x->s);
}
//(((x ((x ((x x) x)) x)) (x x)) ((x x) x))
//(((x ((x ((x x) x)) x)) (x x)) ((x x) x))

int comp(node l,node r){
  double s1=l->p;
  double s2=r->p;
  if(abs(s1-s2)>1e-9) return s1<s2?1:-1;
  if(!l->left&&!r->left) return 0;
  node ll=l->left;
  node lr=l->right;
  node rl=r->left;
  node rr=r->right;
  if(comp(ll,lr)<0)swap(ll,lr);
  if(comp(rl,rr)<0)swap(rl,rr);
  int c=comp(ll,rl);
  if(!c)return comp(lr,rr);
  return c;
}

void swap_tree(int pre,node x){
  if(x->left==NULL)return;
  if((comp(x->left,x->right)<0)==!pre)swap(x->left,x->right);
  if(x->left!=NULL)swap_tree(0,x->left);
  if(x->right!=NULL)swap_tree(1,x->right);
}

string s;
signed main(){
  while(getline(cin,s),s!="0"){
    C=0;
    node root=make_tree(0,s.size()-1,s);
    calc_tree(root);
    swap_tree(0,root);
    print_tree(root);
    cout<<endl;
    delete_tree(root);
    s="";
  }
}


Measured memory_bytes: 3256
#include <iostream>
using namespace std;
void swap(int*,int*);
int main(){
  int a,b,c;
  cin >> a >> b >> c;
  if(a>b) swap(&a,&b);
  if(b>c) swap(&b,&c);
  if(a>b) swap(&a,&b);
  cout << a <<" "<< b<<" " << c <<endl;
}
 
void swap(int* a,int* b){
  int temp = *a;
  *a = *b;*b = temp;
}

Measured memory_bytes: 1164
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")

#include <bits/stdc++.h>

using namespace std;

#define int long long
#define all(a) (a).begin(), (a).end()
#define sz(a) (int) (a).size()
#define x first
#define y second

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    int k, a, b;
    cin >> k >> a >> b;
    int n = (a + k - 1) / k;
    n *= k;
    if (a <= n && n <= b) {
        cout << "OK\n";
    } else {
        cout << "NG\n";
    }

    return 0;
}

Measured memory_bytes: 3652
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<functional>
#include<queue>
#include <iomanip>
#include<map>
#include<limits>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<utility>
#include<complex>
#include<cstdlib>
#include<set>
#include<cctype>

#define DBG cerr << '!' << endl;
#define REP(i,n) for(int (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(int (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(int (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int i = 0;i < (n);i++)cerr << v[i] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()

using namespace std;

typedef long long ll;
typedef vector<int> iv;
typedef vector<iv> iiv;
typedef vector<string> sv;

ll a[100010];
ll suma[100010];
ll sumb[100010];

int main()
{
	int n,k;cin >> n >> k; 
	
	ll ret = 0;
	for(int i = 1;i <= n;i++)
	{
		cin >> a[i];ret += a[i];
		suma[i] = suma[i-1];sumb[i] = sumb[i-1];
		if(a[i] > 0)suma[i] += a[i];
		sumb[i] += a[i];
	}
		
	REP(i,n-k+1)
	{
		ll tmp = suma[n] - (suma[i+k]-suma[i]);
		ret = max(ret,tmp);
		tmp += sumb[i+k]-sumb[i];
		ret = max(ret,tmp);
	}
	
	cout << max(ret,0ll) << endl;
	
	return 0;
}

Measured memory_bytes: 2560
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      	int a = sc.nextInt();
      	int b = sc.nextInt();
      	if((a<1 || a>9) || (b<1 || b>9)) System.out.println(-1);
      	else System.out.println(a*b);
    }
}

Measured memory_bytes: 35652
#include<stdio.h>
int main()
{
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	if(a>=1&&a<=100&&b>=1&&b<=100&&c>=1&&c<=100)
	{
	 if((b-a)==(c-b))
		printf("YES\n");
	 else
		printf("NO\n");
	}
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<climits>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<bitset>
#include<iomanip>
using namespace std;

#define rep(i,j,n) for(int i=(j);i<(n);i++)
#define rep2(i,j,n) for(int i=(j);i<=(n);i++)
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(),i.rend()
#define INF 1e9

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef pair<int, int> pi;
typedef long long i64;
typedef vector<long long int> vll;

int n, m;
vi a, b;
vi k;
int ans = 0;

void dfs(int x) {
	if (k[x]) return;
	k[x] = true;
	if (count(all(k), true) == n) {
		ans++;
		k[x] = false;
		return;
	}
	rep(i, 0, m) {
		if (a[i] == x) dfs(b[i]);
		else if (b[i] == x) dfs(a[i]);
	}
	k[x] = false;
}

int main() {
	cin >> n >> m;
	a.resize(m);
	b.resize(m);
	k.resize(n + 1, false);
	rep(i, 0, m) {
		cin >> a[i] >> b[i];
	}
	dfs(1);
	cout << ans << endl;
}

Measured memory_bytes: 764
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

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

ll mod(ll a){
  return a % 1000000007;
}

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


int main(){
  ll h,w; cin >> h >> w;
  vector<vector<char>> bw(h,vector<char>(w));
  vvl bc(h,vl(w,0));
  
  for(ll i=0; i < h; i++){
    for(ll j=0; j < w; j++){
      char x; cin >> x;
      bw[i][j] = x;
    }
  }
  
  if(bw[0][0] == '#') bc[0][0] = 1;
  
  for(ll i=0; i < w-1; i++){
    if(bw[0][i]=='.'&& bw[0][i+1]=='#')
      bc[0][i+1] = bc[0][i] + 1;
    else  bc[0][i+1] = bc[0][i];
  }
  
  for(ll i=0; i < h-1; i++){
    if(bw[i][0]=='.'&&bw[i+1][0]=='#')
      bc[i+1][0] = bc[i][0] + 1;
    else bc[i+1][0] = bc[i][0];
  }
  
  for(ll i=1; i < h; i++){
    for(ll j=1; j < w; j++){
      ll hcount = 0; ll wcount = 0;
      if(bw[i-1][j]=='.'&&bw[i][j]=='#') hcount++;
      if(bw[i][j-1]=='.'&&bw[i][j]=='#') wcount++;
      
      bc[i][j] = min(bc[i-1][j] + hcount,bc[i][j-1] + wcount);
    }
  }
  
  cout << bc[h-1][w-1] << endl;
}

  

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int n;
vector<string> S(100, "");

int rec(int& idx, int depth) {
    if (isdigit(S[idx][depth])) {
        return (S[idx++][depth] - '0');
    } else if (S[idx++][depth] == '+') {
        int ret = 0;
        while (S[idx].size() > depth + 1) ret += rec(idx, depth + 1);
        return (ret);
    } else {
        int ret = 1;
        while (S[idx].size() > depth + 1) ret *= rec(idx, depth + 1);
        return (ret);
    }
}

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

    while (cin >> n, n) {
        for (int i = 0; i < n; i++) {
            cin >> S[i];
        }
        S[n] = "";
        int idx = 0;
        cout << rec(idx, 0) << endl;
    }
}


Measured memory_bytes: 3176
#include <cstdio>
#include <bitset>
#include <cmath>
#include <complex>
#include <vector>
#include <algorithm>
#include <stack>
#include <iostream>
#define EPS 1e-6

using namespace std;
typedef complex<double> coor;

double cross(coor a, coor b)
{
  return a.real() * b.imag() - a.imag() * b.real();
}

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

int main()
{
  int N;
  while (scanf(" %d ", &N) == 1) {
    if (N == 0) {break;}
    vector<int> series(N);
    
    for (int i = 0; i < N; i++) {
      int n;
      scanf(" %d ", &n);
      series[i] = n;
    }
    
    int mx = -1000000000;
    for (int i = 0; i < N; i++) {
      int sum = 0;
      for (int j = i; j < N; j++) {
	sum += series[j];

	mx = max(mx, sum);
      }
    }
    printf("%d\n", mx);
  }
  return 0;
}

Measured memory_bytes: 0
import java.util.*;
import java.util.stream.Collectors;



public class Main {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        String[] strings=scanner.next().split("");
        int[] ints=new int[strings.length];
        for(int i=0;i<ints.length;i++){
            ints[i]=Integer.parseInt(strings[i]);
        }
        System.out.println(func(0,ints,new long[]{ints[0]}));
    }
    public static long func(int index, int[] ints,long[] vals){
        if(index==ints.length-1){
            long result=0;
            for(int i=0;i<vals.length;i++){
                result+=vals[i];
            }
            return result;
        }
        long[] vals1=new long[vals.length];
        for(int i=0;i<vals1.length;i++){
            if(i==vals1.length-1){
                vals1[i]=vals[i]*10+ints[index+1];
                continue;
            }
            vals1[i]=vals[i];
        }
        long[] vals2=new long[vals.length+1];
        for(int i=0;i<vals2.length;i++){
            if(i==vals2.length-1){
                vals2[i]=ints[index+1];
                continue;
            }
            vals2[i]=vals[i];
        }
        return func(index+1,ints,vals1)+func(index+1,ints,vals2);
    }
}

Measured memory_bytes: 23764
using System;
using System.Linq;
using System.Collections.Generic;

public class BinarySearch
{
    public static void Main()
    {
        Console.ReadLine();
        var s = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        Console.ReadLine();
        var t = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
    
//        "SearchWithHashSet".Measure(() => 
//        {
              SearchWithHashSet(s, t);
//        });
//        "SearchWithBinarySearch".Measure(() => 
//        {
//            SearchWithBinarySearch(s, t);
//        });
    }
    
    private static void SearchWithHashSet(int[] s, int[] t)
    {
//        ThreadPool.SetMinThreads(32, 32);
        var hashSet = new HashSet<int>(s);
        var c = t.Count(x => hashSet.Contains(x));
        Console.WriteLine(c);
    }
    
    private static void SearchWithBinarySearch(int[] s, int[] t)
    {
        var c = t.Count(x => BinarySearchCore(s, x) > 0);
        Console.WriteLine(c);
    }
    
    private static int BinarySearchCore(int[] s, int key)
    {
        var left = 0;
        var right = s.Count();
        
        while (left < right)
        {
            var mid = (left + right) / 2;
            if (s[mid] == key)
                return mid;
            if (key < s[mid])
                right = mid;
            else
                left = mid + 1;
        }
        
        return -1;
    }
    
}
// Define other methods and classes here

Measured memory_bytes: 20780
let input = readLine()!.split(separator: " ").map{ Int($0)! }
let A = input[0]
let B = input[1]

func getStrength(_ value: Int) -> Int {
    if value == 1 {
        return 13
    } else {
        return value - 1
    }
}

let strengthA = getStrength(A)
let strengthB = getStrength(B)

if strengthA == strengthB {
    print("Draw")
} else {
    print(strengthA > strengthB ? "Alice" : "Bob")
}


Measured memory_bytes: 8244
#include<bits/stdc++.h>
using namespace std;
int fun(int temp)
{
    int ans=0;
    int n=sqrt(temp);
    while(n)
    {
        if(temp%n==0)
        {
            if(n!=temp/n)
            ans=ans+2;
            else
            ans++;
        }
       n--;
    }
    return ans;
}
int main()
{
    int n;
    cin>>n;
    long long int ans=0;
    for(int i=1;i<n;i++)
    {
        ans=ans+fun(n-i);
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 3648
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        B solver = new B();
        solver.solve(1, in, out);
        out.close();
    }

    static class B {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int n = Integer.parseInt(in.next());
            int ans = 0;
            int cnt = 0;
            for (int i = 1; i <= n; i += 2) {
                cnt = 0;
                for (int j = 1; j <= i; j++) {
                    if (i % j == 0) cnt++;
                }
                if (cnt == 8) ans++;
            }

            // 出力
            out.println(ans);

        }

    }
}



Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int dx[] = {1,0,-1,0},dy[] = {0,1,0,-1};
using pii = pair<int,int>;
int func(int a){
  return a+a*a+a*a*a;
}
int main(){
  int n;
  cin>>n;
  cout << func(n) << endl;
}

Measured memory_bytes: 3540
N = int(input())
S = input()
Ecount = S.count('E')
Wcount = 0
min = Ecount
for i in S:
    if i == 'E':
        Ecount -= 1
    else:
        Wcount += 1
    if min > Ecount + Wcount:
        min = Ecount + Wcount
print(min)

Measured memory_bytes: 3672
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <vector>
typedef long long ll;

//double t[100000];

double abs(double a){return (a<0)?-a:a;}

int main(){
        ll N,T,A,H;
        scanf("%lld %lld %lld",&N,&T,&A);
        double mindiff = 10000000;

        int ans = 1000000;
        for(int i = 0; i < N; i++){
                scanf("%lld",&H);
                if(mindiff > abs(T-H*0.006-A)){
                        mindiff = abs(T-H*0.006-A);
                        ans = i;
                }
        }

        printf("%lld\n",ans+1);
}

Measured memory_bytes: 128
#include <iostream>
#include <cctype>
#include <algorithm>
#include <iterator>
#include <functional>
#include <limits>
using namespace std;

int main(void){
  string a[200];
  int s[200];
  int top = 0;
  for(int i=0; i<numeric_limits<int>::max(); i++){
    if(cin.eof()){break;}
    cin >> a[i];
    if(a[i].empty()){
// ignore empty string
    }else if(all_of(a[i].begin(), a[i].end(), [](unsigned char c){return isdigit(c);})){
      top++;
      s[top] = stoi(a[i]);
    }else if(a[i] == "+"){
      s[top-1] = s[top-1] + s[top];
      top-=1;
    }else if(a[i] == "-"){
      s[top-1] = s[top-1] - s[top];
      top-=1;
    }else if(a[i] == "*"){
      s[top-1] = s[top-1] * s[top];
      top-=1;
    }
  }
  cout << s[1] << endl;
  return 0;
}



Measured memory_bytes: 3208
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<set>
using namespace std;
typedef long long ll;
#define INF (1 << 30)
#define rep(i,n) for(int i=0; i<n; ++i)

int main()
{
	int N, K; cin >> N >> K;
	vector<int> A(N);
	rep(i, N) cin >> A[i];
	//K回で長さL以下にできるか
	auto judge = [&](int L) {
		int k = 0;
		rep(i, N) {
			if (A[i] > L) {
				k += (A[i] - 1) / L;
			}
		}
		return (k <= K);
	};
	int l = 0, r = INF;
	while (r > l) {
		int len = (r + l) / 2;
		if (len == 0) {
			l = 1;
			break;
		}
		if (judge(len)) r = len;
		else l = len + 1;
	}
	cout << l << endl;
}


Measured memory_bytes: 3560
#define _USE_MATH_DEFINES
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <clocale>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i, s, n) for(int i = (s), i##_len=(n); i < i##_len; ++i)
#define FORS(i, s, n) for(int i = (s), i##_len=(n); i <= i##_len; ++i)
#define VFOR(i, s, n) for(int i = (s); i < (n); ++i)
#define VFORS(i, s, n) for(int i = (s); i <= (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) FORS(i, 0, n)
#define VREP(i, n) VFOR(i, 0, n)
#define VREPS(i, n) VFORS(i, 0, n)
#define RFOR(i, s, n) for(int i = (s), i##_len=(n); i >= i##_len; --i)
#define RFORS(i, s, n) for(int i = (s), i##_len=(n); i > i##_len; --i)
#define RREP(i, n) RFOR(i, n, 0)
#define RREPS(i, n) RFORS(i, n, 0)
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v), greater<decltype(v[0])>())
#define SZ(x) ((int)(x).size())
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end())

using ll = long long;
using ull = unsigned long long;
using Pi_i = pair<int, int>;
using VB = vector<bool>;
using VC = vector<char>;
using VD = vector<double>;
using VI = vector<int>;
using VLL = vector<ll>;
using VS = vector<string>;
using VSH = vector<short>;
using VULL = vector<ull>;

const int MOD = 1000000007;
const int INF = 1000000000;
const int NIL = -1;

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


int main(){
    int n; cin >> n;
    VI a(n);
    REP(i, n)  cin >> a[i];
    int q; cin >> q;
    REP(i, q){
        int k; cin >> k;
        cout << distance(a.begin(), lower_bound(ALL(a), k)) << "\n";
    }
    return 0;
}



Measured memory_bytes: 3116
#include <iostream>
#include <iomanip>
using namespace std;
typedef long long ll;

int main()
{
    int n;
    cin >> n;
    double x = (double)n / 3;
    double ans = x * x * x;
    cout << fixed << setprecision(7) << ans << '\n';
    return 0;
}

Measured memory_bytes: 256