akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <unordered_map>
#include <set>
#include <map>
#define rep(i,n) for (int i=0; i<n;++i)
#define ALL(a)  (a).begin(),(a).end()
#define PI 3.14159265358979
typedef long long ll;
using namespace std;
const ll MOD = 1e9+7LL;
const int INF = 2e9;
string S;
set<char> c;

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

  cin >> S;
  rep(i,3) {
    c.insert(S[i]);
  }
  if (c.size()>1) {
    cout << "Yes" << "\n";
  } else cout << "No" << "\n";
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using i64 = int_fast64_t;
#define rep(i, N) for(int (i) = 0; (i) < (N); (i)++)
#define all(v) (v).begin(), (v).end()
#define eb emplace_back

int main(){
    int N;
    cin >> N;
    int cnt[10][10] = {};

    int d = 1;
    for(int n = 1; n <= N; n++){
        if(n % (10*d) == 0) d *= 10;
        cnt[n / d][n % 10]++;
    }

    int ans = 0;
    for(int n = 0; n < 10; n++){
        for(int m = 0; m < 10; m++){
            ans += cnt[n][m] * cnt[m][n];
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cctype>

#include <algorithm>
#include <random>
#include <bitset>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <vector>
#include <chrono>
#include <iostream>
#include <limits>
#include <numeric>

#define LOG(FMT...) fprintf(stderr, FMT)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

template <class T>
istream& operator>>(istream& is, vector<T>& v) {
  for (T& x : v)
    is >> x;
  return is;
}

template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  if (!v.empty()) {
    os << v.front();
    for (int i = 1; i < v.size(); ++i)
      os << ' ' << v[i];
  }
  return os;
}

int main() {
#ifdef LBT
  freopen("test.in", "r", stdin);
  int nol_cl = clock();
#endif
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int n;
  cin >> n;
  vector<int> a(n);
  cin >> a;
  sort(a.begin(), a.end());
  int x = 0;
  while (n - x > 1 && a[n - x - 2] - x - 1 > 0) ++x;
  int u = a[n - x - 1] - x, v = 0;
  for (int i = 0; i < n - x; ++i) v += a[i] > x;
  if ((u - 1) % 2 == 1 || (v - 1) % 2 == 1)
    cout << "First";
  else
    cout << "Second";

#ifdef LBT
  LOG("Time: %dms\n", int ((clock()
          -nol_cl) / (double)CLOCKS_PER_SEC * 1000));
#endif
  return 0;
}


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

int main()
{
	ll n,k; cin>>n>>k; int a[n];
	for (int i=0; i<n; i++)
		cin>>a[i];
	sort(a,a+n);	ll dp[k+1]={0}; dp[a[0]]=1;

	for (int i=a[0]+1; i<=k; i++)
	{
		for (int j=0; j<n; j++)
		{
			if ( (i-a[j])>=0)
			{
				if (dp[i-a[j]]==0)
					dp[i]=1;
			}
		}
	}
	//for (int i=0; i<=k; i++)
	//	cout<<" "<<i<<" : "<<dp[i]<<endl;
	//cout<<endl;

	if (dp[k]==0)
		cout<<"Second"<<endl;
	else
		cout<<"First"<<endl;
	return 0;
}

Measured memory_bytes: 1024
var
  a,b,c,x,i,j,k,ans:longint;
begin
  readln(a,b,c,x);
  for i:=0 to a do
  for j:=0 to b do
  for k:=0 to c do
    if i*500+100*j+k*50=x then inc(ans);
  writeln(ans);
end.

Measured memory_bytes: 128
import java.util.Scanner;

public class Main
{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		sc.close();
		printNum("", 'a', n);
	}

	private static void printNum(String str, char mx, int n)
	{
		if (str.length() == n) {
			System.out.println(str);
		} else {
			for (char c='a'; c<=mx; c++) {
				printNum(str+c, (char)((c==mx)?mx+1:mx), n);
			}
		}
	}
}


Measured memory_bytes: 43644
import math
#import numpy as np
import queue
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    a = input()
    if a.isupper():
        print("A")
    else:
        print("a")

    return

if __name__ == '__main__':
    main()


Measured memory_bytes: 68720
#include <iostream>
#include <algorithm>

using namespace std;

int s[300010];

int main() {
	int wNum = 0;
	int N;
	cin >> N;
	for (int i = 1; i <= N; i++) {
		char c;
		cin >> c;
		s[i] = s[i - 1];
		if (c == 'E') {
			s[i]++;
		}
		if (c == 'W') {
			wNum++;
		}
	}
	int eNum = N - wNum;
	int mi = 400000;
	for (int i = 1; i <= N; i++) {
		int lW = (i - 1) - s[i - 1];
		int rE = eNum - s[i];
		mi = min(mi, lW + rE);
	}
	cout << mi << endl;
	//system("pause");
}

Measured memory_bytes: 1408
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>


using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x*x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define loop(n) FOR(i,0,n)
#define rrep(i,a,b) for(int i=(a);i>=(b);--i)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

//i番目までみたときのj枚選んだときのカードの合計がkである組合せの総数。
LL dp[51][51][3000];

//基本
//平均＝合計/枚数
//合計＝平均×枚数
//j枚使ったときの合計がk=jaになっている場所をみるとして条件を言い換えた。
int main() {

	int n, a; cin >> n >> a;

	vector<int> x(n);
	for (int i = 0; i < n; i++) {
		cin >> x[i];
	}

	//dp初期化式。
	dp[0][0][0]=1;


	//本来はテーブルの容量を超えている遷移は枝刈りするが、
	//制約も小さく。集計のときにアクセスしないのでdpテーブルを
	//大きくとって対処した。

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			for (int k = 0; k < 3000; k++) {
				dp[i + 1][j + 1][k + x[i]] += dp[i][j][k];
				dp[i + 1][j][k] += dp[i][j][k];
			}
		}
	}

	LL ans = 0;
	for (int i = 1; i < n + 1; i++) {
		ans += dp[n][i][i*a];
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 60032
X = int(input())
if X >= 1800 :
    ans = 1
elif X >= 1600 :
    ans = 2 
elif X >= 1400 :
    ans = 3
elif X >= 1200 :
    ans = 4
elif X >= 1000 :
    ans = 5
elif X >= 800 :
    ans = 6
elif X >= 600 :
    ans = 7
else :
    ans = 8

print(ans)

Measured memory_bytes: 9120
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cstdint>
#include <map>
#include <cmath>
 

using namespace std;

int64_t gcd(int64_t a, int64_t b)
{
  int64_t c;
  while(a)
  {
     c = a; a = b%a; b = c;
  }
  return b;
}
 
int main()
{
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int64_t n;
    cin >> n;
    
    vector<int64_t> xs(n+1);
    for(auto& x : xs)
        cin >> x;

    vector<int64_t> dxs(n);
    for(size_t i = 0; i < dxs.size(); ++i)
        dxs[i] = abs(xs[i+1] - xs[i]);
        
    cout << accumulate(begin(dxs), end(dxs), dxs[0], gcd) << '\n';
    
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
#include <bitset>

using namespace std;

int main() {
    int n;
    cin >> n;

    using ll = long long;

    vector<vector<ll>> a(n, vector<ll>(n));

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            cin >> a[i][j];
        }
    }

    vector<ll> c(1 << n);

    for (int i = 0; i < (1 << n); i++) {
        bitset<16> bs(i);

        for (int j = 0; j < n; j++) {
            for (int k = j + 1; k < n; k++) {
                if (bs[j] && bs[k]) {
                    c[i] += a[j][k];
                }
            }
        }
    }

    const ll inf = 1LL << 60;

    vector<ll> dp(1 << n, -inf);

    dp[0] = 0;

    for (int i = 0; i < (1 << n); i++) {
        int S = ((1 << n) - 1) ^ i;
        for (int T = S; T > 0; T = (T - 1) & S){
            dp[i | T] = max(dp[i | T], dp[i] + c[T]);
        }
    }

    cout << dp[(1 << n) - 1] << endl;
}


Measured memory_bytes: 1280
N = int(input())
A = input().split()
count = 0
count_min = 0
for i in range(N):
    count = 0
    Ai = int(A[i])
    if Ai % 2 != 0:
        count_min = 0
        break
    while Ai % 2 == 0:
        count += 1
        Ai = Ai / 2
    if count_min == 0:
        count_min = count
    elif count_min > count:
        count_min = count

print(count_min)

Measured memory_bytes: 3060
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] arr = new int[n];
		for (int i = 0; i < n; i++) {
			arr[i] = sc.nextInt();
		}
		int count = 0;
		for (int i = 1; i < n - 1; i++) {
			if ((arr[i] < arr[i - 1] && arr[i] > arr[i + 1]) || (arr[i] > arr[i - 1] && arr[i] < arr[i + 1])) {
				count++;
			}
		}
		System.out.println(count);
	}
}


Measured memory_bytes: 23892
#include<iostream>
#include<cmath>
using namespace std;
static const int MAX_N=10e5;
#define INF 10e10
int cost[MAX_N];
long dp[MAX_N];
int main(void){
	int N;
		cin >> N;
	for(int i=0;i<N;i++){
		cin >> cost[i];
		dp[i+1]=INF;
	}
	dp[1]=abs(cost[1]-cost[0]);
	for(int i=2;i<N;i++){
		long q=dp[i-1]+abs(cost[i]-cost[i-1]);
		long w=dp[i-2]+abs(cost[i]-cost[i-2]);
		dp[i]=q<w?q:w;
	}
	cout << dp[N-1] << endl;
	return 0;
}

Measured memory_bytes: 5120
/*  TAHMID RAHMAN
    DAMIAN FOREVER
     MATH LOVER
    NEVER GIVE UP
*/
#include<bits/stdc++.h>
using namespace std;
#define pi acos(-1.0)
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define ll long long
#define pb push_back
#define fi first
#define se second
#define in insert
#define mp make_pair
#define GCD(a,b) __gcd(a,b);
#define endl "\n"
#define FRU freopen("out.txt","w",stdout)
#define FRO freopen("in.txt","r",stdin)
#define INFLL 9223372036854775807
#define debug 0
#define MAXN   100001
#define ar array
const int mxN=2e5;
const int MOD=1e9+7;
bool sortbysec(const pair<int,int> &a,const pair<int,int> &b){return (a.second < b.second);}
//Don't hesitate to ask me if you don't understand my code.......Happy coding,Tahmid...;
 int main()
 {
     fastio;
     string s;
     cin>>s;
     ll c1=0,c2=0,i,j;
     if(s.size()==1)
     {
         cout<<0<<endl;
         return 0;
     }
     if(s.size()==2)
     {
         if(s[0]==s[1])
            cout<<1<<endl;
         else
            cout<<0<<endl;
         return 0;
     }
     for(i=0;i<s.size()-1;i+=2)
     {
        if(s[i]=='1'&&s[i+1]=='1')
            c1++;
        else if(s[i]=='0'&&s[i+1]=='0')
            c1++;
        else if(s[i]=='0'&&s[i+1]=='1')
           c1+=2;

        if(s[i]=='1'&&s[i+1]=='1')
            c2++;
        else if(s[i]=='0'&&s[i+1]=='0')
            c2++;
        else if(s[i]=='1'&&s[i+1]=='0')
           c2+=2;

     }
     if(s.size()%2!=0)
     {
         if(s[s.size()-1]=='0')
            c1++;
         else
            c2++;
     }
     //cout<<c1<<" "<<c2<<endl;
     cout<<min(c1,c2)<<endl;

 }


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

using namespace std;

int main(void)
{
	int n, m;
	cin >> n >> m;
	int h[n];
	for (int i = 0; i < n; i++) {
		cin >> h[i];
	}
	vector<vector<int>> g;
	g.resize(n);
	for (int i = 0; i < m; i++) {
		int a, b;
		cin >> a >> b;
		g[a-1].push_back(b-1);
		g[b-1].push_back(a-1);
	}

	int count = 0;
	for (int i = 0; i < n; i++) {
		bool ok = true;
		for (int j = 0; j < g[i].size(); j++) {
			if (h[i] <= h[g[i][j]])
				ok = false;
		}
		if (ok)
			count++;
	}
	cout << count << endl;
}


Measured memory_bytes: 8800
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(obj)   (obj).begin(),(obj).end()

#define debug(var)  do{std::cout << __LINE__ << "> " << #var << ": ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

void Main() {
	int N, W; cin >> N >> W;
	vi w(N);
	vl v(N);
	REP(i, N) cin >> w[i] >> v[i];

	vvl dp(N + 1, vl(W + 1, 0));
	REP(i, N) {
		REP(j, W + 1) {
			if (w[i] <= j) {
				dp[i + 1][j] = max(dp[i + 1][j], dp[i][j - w[i]] + v[i]);
			}
			dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
		}
	}
	cout << dp[N][W] << endl;
}

int main() {
    cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
}


Measured memory_bytes: 80256
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define ll long long
#define ld long double
#define MOD 1000000007
// #define nl cout << bl
#define rt ll Q[100005] = {0}
#define mp make_pair
#define test() \
    ull t;     \
    cin >> t;  \
    while (t--)
#define pb push_back
#define ff first
#define ss second
#define all(v) v.begin(), v.end()
#define s(ar, n) sort(ar, ar + n)
#define rs(ar, n) sort(ar, ar + n, greater<ll>())
#define oa(a, n)               \
    for (ll i = 0; i < n; i++) \
        cout << a[i] << " ";
#define cn(a, n)               \
    for (ll i = 0; i < n; i++) \
        cin >> a[i];
#define ov(a, n)                    \
    for (ll i = n - 1; i >= 0; i--) \
        cout << a[i] << " ";        \
    nl
#define ovp(a, n)              \
    for (ll i = 0; i < n; i++) \
        cout << a[i].ff << " " << a[i].ss << bl;
#define maxa(ar, N) *max_element(ar, ar + N)
#define mina(ar, N) *min_element(ar, ar + N)
#define present(c, x) ((c).find(x) != (c).end())
#define fastio()                  \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0)
typedef pair<int, int> pii;
ll fast_exp(ll base, ll exp)
{
    ll res = 1;
    while (exp > 0)
    {
        if (exp % 2 == 1)
            res = (res * base) % MOD;
        base = (base * base) % MOD;
        exp /= 2;
    }
    return res % MOD;
}
ll fib(ll n)
{
    if (n < 2)
        return n;
    ll a = 0, b = 1, pre;
    int i = 1;
    while (i < n)
    {
        pre = (a + b) % MOD;
        a = b;
        b = pre;
        i++;
    }
    return pre;
}
ll fac(ll n)
{
    if (n % 2 == 0)
        return 2;

    for (ll i = 3; i * i <= n; i += 2)
    {
        if (n % i == 0)
            return i;
    }

    return n;
}
ll fact(ll n)
{
    if (n > 1)
        return n * fact(n - 1);
    else
        return 1;
}
bool sortbysec(const tuple<int, int, int> &a,
               const tuple<int, int, int> &b)
{
    return (get<1>(a) < get<1>(b));
}
int countFreq(string t, string s)
{
    int m = 7;
    int n = s.length();
    int ans = 0;
    for (int i = 0; i < n - 6; i++)
    {
        string str = s.substr(i, 7);
        ans += (str == t);
    }
    return ans;
}
string prefix(string s, string t)
{
    int n = s.length();
    int m = t.length();
    string res = "";
    for (int i = 0; i < min(n, m); i++)
    {
        if (s[i] == t[i])
        {
            res += s[i];
        }
        else
        {
            break;
        }
    }
    return res;
}
int main()
{
    fastio();
    ll a, b, c, k;
    cin >> a >> b >> c >> k;
    int count = 0;
    while (b <= a)
    {
        b *= 2;
        count++;
    }
    while (c <= b)
    {
        c *= 2;
        count++;
    }
    if (count <= k)
    {
        cout << "Yes\n";
    }
    else
    {
        cout << "No\n";
    }
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,m;
	cin >> n >> m;
	int a[60],b[60];
	int bridge[60]={};
	for(int i=0;i<m;i++){
		cin >> a[i] >> b[i];
		bridge[a[i]]++;
		bridge[b[i]]++;
	}
	for(int i=1;i<n+1;i++){
		cout << bridge[i] << endl;
	}
    return 0;
}


Measured memory_bytes: 256
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use {
    proconio::{marker::*, *},
    std::{cmp::*, collections::*, mem::*},
};

fn main() {
    input! {
        n:usize,p:i64,
        mut a:[i64;n],
    }
    let mut one = 0i64;
    let mut zero = 0i64;
    for i in 0..n {
        if a[i] % 2 == 0 {
            zero += 1;
        } else {
            one += 1;
        }
    }
    let ep = 1i64 << zero;
    let op: i64 = if one == 0 {
        (p + 1) % 2
    } else {
        1i64 << (one - 1)
    };
    println!("{}", op * ep);
}


Measured memory_bytes: 2124
#include <bits/stdc++.h>
#define FOR(i,a,b)  for(int (i)=(a);(i)<(b);(i)++)
#define REP(i,n)    FOR(i,0,n)
#define RER(i,n)    FOR(i,0,(n+1))
#define pb          push_back
#define mp(a,b)     make_pair((a),(b))
#define mset(m,v)   memset(m,v,sizeof(m))
using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pair<int, int> > vpii;
typedef long long ll;
typedef vector<ll> vl;
typedef pair<ll,ll> pll;
typedef vector<pair<ll, ll> > vpll;
typedef vector<string> vs;
typedef long double ld;
const double EPS    = 1e-10;
const int INF       = 1e+9;
const double PI     = acos(-1);


auto main() -> int
{
    int n;
    cin >> n;

    if ( n/100 == n%10 ) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}



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

int main() {
	int a[3];
	for(int i=0;i<3;i++)
	  cin>>a[i];
	sort(a,a+3);
	a[0]+=(a[1]+10*a[2]);
	cout<<a[0]<<'\n';
	// your code goes here
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<utility>
#include<numeric>
#include<vector>
#include<map>
#include<set>
#include<tuple>
#include<stack>
#include<queue>
#include<functional>
#include<iterator>
#include<cmath>
#include<cctype>

using namespace std;

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

const int INF = 1e9;


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

	int h,w; cin >> h >> w;

	int c[10][10];
	for(int i=0;i<10;i++){
		for(int j=0;j<10;j++){
			cin >> c[i][j];
		}
	}
	for(int k=0;k<10;k++){
		for(int i=0;i<10;i++){
			for(int j=0;j<10;j++){
				c[i][j] = min(c[i][j],c[i][k]+c[k][j]);
			}
		}
	}

	int a[h][w];
	int ans=0;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cin >> a[i][j];
			if(a[i][j] != -1 && a[i][j] != 1) ans += c[a[i][j]][1];
		}
	}
	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <queue>
#include <cctype>
#include <stdio.h>
#include <map>
#include <math.h>
 
 
using namespace std;
 
int main(int argc, char const* argv[])
{
    int e;
    while (cin >> e, e) 
    {
        int x,y,z;
        int m = 1000000;
 
        //for (int i = 0; i <= e; i++) 
        //{
        //    for (int j = 0; j*j <= e; j++) 
        //    {
        //        for (int k = 0; k*k*k <= e; k++) 
        //        {
        //            //cout << " x y z = " << i << j << k <<endl;
        //            if ( i + j*j + k*k*k == e) 
        //            {
        //                m = min( m, i + j + k);
        //            }
        //        }
        //    }
        //}
        for (int k = 0;  k*k*k <= e; k++) 
        {
            int j = sqrt(e - k*k*k);
            int i = e - k*k*k -j*j;
            m = min( m, i + j + k);
        }
        cout << m << endl;
    }
    return 0;
}

Measured memory_bytes: 2968
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  int a,b;
  int r[100];
  int s[100];
  int p[100][100];
  int sum;
  int c;
  int check;
  while(1){
    c=0;
    check=0;
    for(int i=0;i<100;i++){
      for(int j=0;j<100;j++){
	p[i][j]=0;
      }
    }
    cin>>N;
    if(N==0) break;
    for(int i=0;i<N;i++){
      cin>>a;
      if(a==0) continue;
      for(int j=0;j<a;j++){
	cin>>b;
	p[i][b-1]=1;
      }
    }
    for(int i=0;i<N;i++){
      sum=0;
      for(int j=0;j<N;j++){
	sum+=p[j][i];
      }
      r[i]=sum;
    }
    cin>>a;
    for(int i=0;i<a;i++){
      cin>>b;
      if(r[b-1]==0) c=2;
      if(r[b-1]==1){
	for(int j=0;j<N;j++){
	  if(p[j][b-1]==1){
	    if(check==j+1) break;
	    check=j+1;
	    c++;
	    break;
	  }
	}
      }
    }
    if(c!=1) cout<<-1<<endl;
    else cout<<check<<endl;
    }
  return 0;
}



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

using namespace std;

#define Turbo ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define HOME 1,1
#define print(x) cout<<#x<<" = "<<x<<"\n";

const int MOD = 1000000007;
const int N = 200000 + 5;

int f[N];

inline int add(int a, int b) {
    a += b;
    if (a >= MOD) a -= MOD;
    if (a < 0) a += MOD;
    return a;
}

inline int mul(int a, int b) {
    return a * (long long) b % MOD;
}

inline int expow(int a, int b) {
    int ans = 1;
    while (b) {
        if (b & 1) ans = mul(ans, a);
        a = mul(a, a);
        b >>= 1;
    }
    return ans;
}

inline int comb(int n, int k) {
    int p = mul(f[k], f[n - k]);
    int inv = expow(p, MOD - 2);
    return mul(f[n], inv);
}

inline void BuildFact() {
    f[0] = 1;
    for (int i = 1; i < N; i++)
        f[i] = mul(f[i - 1], i);
}

inline int cnt(int r1, int c1, int r2, int c2) {
    int n = r2 - r1;
    int m = c2 - c1;
    int sm = n + m;
    return comb(sm, n);
}

int main() {
    Turbo;
    BuildFact();
    int n, m, a, b;
    cin >> n >> m >> a >> b;
    if (a == n || b == m) {
        cout << "0\n";
        return 0;
    }

    int ans = cnt(HOME, n, m);

    int row = n - a + 1;

    for (int col = 1; col <= b; col++) {
        int scad = cnt(HOME, row - 1, col);
        if (row < n) {
            scad = mul(scad, cnt(row, col, n, m));
        }
        ans = add(ans, - scad);

    }
    cout << ans << "\n";
    return 0;
}



Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>
#include <math.h>
#include <bitset>

#define X first
#define Y second
#define vsort(v) sort(v.begin(), v.end())
#define vrev(v) reverse(v.begin(), v.end())
#define P pair

// stoi(s): string to int
// stod(s): string to double

// INT_MAX
// INT_MIN
// LLONG_MAX
// LLONG_MIN
// DBL_MIN
// DBL_MAX
// LDBL_MIN
// LDBL_MAX

// A-Z: 65~90
// a-z: 97~122
// |a-z| = 26

// 2進数変換
// string s = bitset<20>(x).to_string();

using namespace std;
using ll = long long;

int main(int argc, const char *argv[])
{
    int n;
    cin >> n;
    vector<int> v(n);
    for (int i = 0; i < n; i++)
    {
        cin >> v[i];
    }

    int max = -1, cnt = 0;
    for (int i = 0; i < n; i++)
    {
        if (v[i] >= max)
        {
            cnt++;
            max = v[i];
        }
    }
    cout << cnt << endl;
}


Measured memory_bytes: 256
N = int(input())
x = [0]*N
u = [0]*N
for i in range(0,N):
    x[i], u[i] = input().split()

t = 0

for i in range(0,N):
    if u[i] == 'JPY':
        t = t + int(x[i])
    else:
        t = t + (380000*float(x[i]))

print(t)

Measured memory_bytes: 38256
/*
    Author: Nguyen Tan Bao
    Status:
    Idea:
*/

#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, int> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;

const ll MODBASE = 1000000007LL;
const int MAXN = 10000010;
const int MAXM = 1000;
const int MAXK = 16;
const int MAXQ = 200010;

int n, nt[MAXN];

void sieveBase(int n) {
    FOR(i,2,n) {
        if (nt[i] == 0) {
            nt[i] = i;
            for (ll j = (ll) i * i; j <= n; j += i) nt[j] = i;
        }
    }
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    sieveBase(10000000);
    cin >> n;
    ll res = 0;
    FOR(i,1,n) {
        int N = i;
        ll numDiv = 1;
        while (N > 1) {
            int g = nt[N], cnt = 0;
            while (N % g == 0) {
                N /= g;
                cnt++;
            }
            numDiv *= cnt+1;
        }
        res += numDiv * i;
    }
    cout << res;
    return 0;
}


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

def partition(a, p, r)
  x = a[r]

  i=p-1
  p.upto(r-1) do |j|
    if a[j] <= x
      i = i+1
      a[i], a[j] = a[j], a[i]
    end
  end
  a[i+1], a[r] = a[r], a[i+1]
  return i+1
end

q = partition(a,0, n-1)

a[q] = "[%d]" % a[q]

puts a.join(" ")


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

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; }

using ll = long long;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int INF = 1<<30;
const ll mod = 1000000007LL;

int f(const vector<vector<int>> &g,int s){
    int t = g[s].size();
    int ans = 0;
    if(t==0) return ans;
    priority_queue<int> q;
    auto ite = g[s].begin();
    for(int i = 0; i < t; i++){
        q.push(f(g,*ite));
        ite++;
    }
    int cnt = 1;
    while(!q.empty()){
        int s = q.top();
        q.pop();
        chmax(ans,s+cnt);
        cnt++;
    }
    return ans;
}

int main() {
    int N;
    cin>>N;
    vector<vector<int>> g(N);
    for(int i = 1;i < N; i++){
        int x;
        cin>>x;
        g[x-1].push_back(i);
    }
    cout<<f(g,0)<<endl;
}

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

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

        static void Method(string[] args)
        {
            int[] nabcd = ReadInts();
            int n = nabcd[0];
            long a = nabcd[1];
            long b = nabcd[2];
            long c = nabcd[3];
            long d = nabcd[4];
            long delta = b - a;
            for(long m = 0; m < n; m++)
            {
                if(c*(n-1-m)-d*m<=delta
                    && delta <= -c * m + d * (n - 1 - m))
                {
                    Console.WriteLine("YES");
                    return;
                }
            }
            Console.WriteLine("NO");
        }

        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 13140
#include<bits/stdc++.h>
#define pb push_back
#define all(x) x.begin(), x.end()
using namespace std;
using ll = long long;
using vi = vector<ll>;
using vvi = vector<vi>;
using pi = pair<ll, ll>;
using vpi = vector<pi>;
const ll mod = 998244353;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll x, n, s = 0;
vi b, u, l, ord;
ll f(ll i, ll x) {
	if(x>b[i])
	return b[i]*(l[i]-u[i]) + u[i]*x;
	return x*l[i];
}
bool can(ll v) {
	ll ans = 0, sm1 = 0, fl = v/x, p=v%x;
	for(ll i = 0; i < fl && i < n; i++) sm1+=f(ord[i],x);
	ans = sm1;
	for(ll i = fl; i < n; i++) ans = max(ans, sm1+f(ord[i], p));
	if(fl < n) sm1+=f(ord[fl],x);
	for(ll i = 0; i <= fl & i < n; i++) ans = max(ans, sm1-f(ord[i], x)+f(ord[i], p));
	return ans+s>=0;
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin >> n >> x;
	b.resize(n);
	u.resize(n);
	l.resize(n);
	for (int i = 0; i < n; i++)
		cin >> b[i] >> l[i] >> u[i], ord.pb(i), s -= l[i] * b[i];
	sort(all(ord), [&](const int& a, const int &b) {
		return f(a, x) > f(b, x);
	});
	if(s==0) {
		cout << 0;
		return 0;
	}
	ll ans = 0;
	for(ll a = 1ll<<42; a; a>>=1)
		if(!can(ans+a)) ans += a;
	cout << ans+1;
	return 0;
}


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

#define ed cout<<"\n";
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long 
#define ffor(i,a,b) for(ll i=(ll)(a);i<(ll)(b);++i)
#define rep(i, n) ffor(i,0,n)
#define All(obj) (obj).begin(),(obj).end()
#define INF ((ll)1e9+7)
#define c(a) cout<<a<<"\n";
using namespace std;
const int N = 100005;






int main() {
	speed;
	cout << fixed << setprecision(6);
	/*start*/
	int n;
	string s;
	cin >> n >> s;
	n /=2;
	bool f = true;
	rep(i, n) {
		if (s[i] != s[i + n]) {
			f = false;
			break;
		}
	}
	if (n*2!=s.size())f = false;
	s = f ? "Yes" : "No";
		c(s);
	ed;
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
using namespace std;

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
	#define eprintf(...) 42
#endif

typedef long long ll;
typedef pair<int, int> pii;
#define mp make_pair

struct Point {
	ll x, y;

	Point() : x(), y() {}
	Point (ll _x, ll _y) : x(_x), y(_y) {}

	void scan() {
		scanf("%lld%lld", &x, &y);
	}

	Point operator + (const Point &a) const {
		return Point(x + a.x, y + a.y);
	}
	Point operator - (const Point &a) const {
		return Point(x - a.x, y - a.y);
	}
	ll operator % (const Point &a) const {
		return x * a.x + y * a.y;
	}
	ll operator * (const Point &a) const {
		return x * a.y - y * a.x;
	}
};

const ll MOD = 998244353;
ll add(ll x, ll y) {
	x += y;
	if (x >= MOD) return x - MOD;
	return x;
}
ll sub(ll x, ll y) {
	x -= y;
	if (x < 0) return x + MOD;
	return x;
}
ll mult(ll x, ll y) {
	return (x * y) % MOD;
}

const int N = 300;
bool onLine(Point A, Point B, Point C) {
	return (A - B) * (A - C) == 0;
}

int n;
Point a[N];
ll p2[N];

int main()
{
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	scanf("%d", &n);
	for (int i = 0; i < n; i++)
		a[i].scan();

	p2[0] = 1;
	for (int i = 1; i < N; i++)
		p2[i] = add(p2[i - 1], p2[i - 1]);

	ll ans = p2[n];
	ans = sub(ans, 1 + n);
	

	for (int i = 0; i < n; i++)
		for (int j = i + 1; j < n; j++) {
			int cnt = 0;
			bool bad = false;
			for (int k = 0; k < n; k++) {
				if (onLine(a[i], a[j], a[k])) cnt++;
				if (k == j)
					bad = (cnt > 2);
			}
			if (!bad)
				ans = sub(ans, sub(p2[cnt], cnt + 1));
		}
	printf("%lld\n", ans);

	return 0;
}


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

using namespace std;

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

Measured memory_bytes: 3604
#include<set>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int MAXN=2e5+5;
char s[MAXN],t[MAXN];
int c[256+5],d[256+5];
 
int main() 
{
	scanf("%s%s",s,t);
	int len=strlen(s);
	memset(c,-1,sizeof c);
	memset(d,-1,sizeof d);
	set<char> cnt;
	for(int i=0;i<len;i++)
		cnt.insert(s[i]);
	for(int i=0;i<len;i++) {
		if(c[t[i]]!=-1&&c[t[i]]!=s[i]) {
			if(t[i]==s[i]&&cnt.size()<=26)
				continue;
			puts("No");
			return 0;
		}
		c[t[i]]=s[i];
	}
	for(int i=0;i<len;i++) {
		if(d[s[i]]!=-1&&d[s[i]]!=t[i]) {
			if(t[i]==s[i]&&cnt.size()<=26)
				continue;
			puts("No");
			return 0;
		}
		d[s[i]]=t[i];
	}
	puts("Yes");
	return 0;
}
 

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

int main() {
    int a, b, k, cnt = 0;
    cin >> a >> b >> k;
    for (int i = min(a, b); i >= 1; i--) {
        if (a % i == 0 && b % i == 0) cnt++;
        if (cnt == k) {
            cout << i << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
### classes

class BIT
  def initialize(n)
    @n = n
    @bits = (n + 1).times.map{0}
  end

  def sum(x)
    s = 0
    while x > 0
      s += @bits[x]
      x -= (x & -x)
    end
    s
  end

  def add(x, v)
    while x <= @n
      @bits[x] += v
      x += (x & -x)
    end
  end
end

class BIT2D
  def initialize(h, w)
    @h = h
    @bits = (h + 1).times.map{BIT.new(w)}
  end

  def sum(y, x)
    return 0 if y == 0 || x == 0
    s = 0
    while y > 0
      s += @bits[y].sum(x)
      y -= (y & -y)
    end
    s
  end

  def add(y, x, v)
    while y <= @h
      @bits[y].add(x, v)
      y += (y & -y)
    end
  end
end

### main

loop do
  n = gets.to_i
  break if n == 0

  w, h = gets.split.map(&:to_i)

  bit2 = BIT2D.new(h, w)

  n.times do
    xi, yi = gets.split.map(&:to_i)
    bit2.add(yi, xi, 1)
  end

  sw, th = gets.split.map(&:to_i)

  max_pn = 0

  for y in (th..h)
    y0 = y - th
    for x in (sw..w)
      x0 = x - sw
      pn = bit2.sum(y, x) - bit2.sum(y0, x) - bit2.sum(y, x0) + bit2.sum(y0, x0)
      max_pn = pn if max_pn < pn
    end
  end

  puts max_pn
end

Measured memory_bytes: 6228
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF (1LL<<50)
#define MOD 1000000007
#define PI 3.141592653589793

int main(){
    double A,B,H,M;
    cin >> A >> B  >> H >> M;
    double Aw = (60*H + M)/720 * 360;
    double Bw = M/60 * 360;
    double w = min(abs(Aw-Bw),360-abs(Aw-Bw));
    double wr = w * PI/180.0;
    double ans = A*A + B*B - 2*A*B*cos(wr);
    ans = sqrtl(ans);
    cout << setprecision(15) << ans << endl;
    return 0;
}

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

int main() {
  int N, mod = 1e9+7;
  cin >> N;
  vector<int> V(N + 1);
  for (int i = 2; i <= N; i++) {
    int tmp = i;
    for (int j = 2; j <= N; j++) {
      while (tmp % j == 0) tmp /= j, V.at(j)++;
    }
  }
  long ans = 1;
  for (int i = 2; i < N + 1; i++) {
    if (V.at(i)) (ans *= V.at(i) + 1) %= mod;
  }
  cout << ans << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define PI 3.141592653589793
#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, a, n) for (int i = a; i < (n); i++)
#define rrep(i, n, k) for (int i = (n); i >= (k); i--);
#define all(x) (x).begin(), (x).end()
#define vi vector<int>
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T>vector<T> make_vector(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto make_vector(size_t a, Ts... ts){return vector<decltype(make_vector<T>(ts...))>(a, make_vector<T>(ts...));}
const int MOD = 998244353;
const int INF = 2e18;

signed main() {
    int N;
    cin >> N;
    vector<string> temp;
    function<void(string, char, int, int)> tree = [&](string now, char add, int count, int unique) {
        now += add;
        if (count == N) {
            temp.push_back(now);
        } else {
            for (char i = 'a'; i <= 'a' + count; i++) {
                int c = i - 'a' + 1;
                if (c <= unique) tree(now, i, count + 1, unique);
                else if (c == unique + 1) tree(now, i, count + 1, unique + 1);
            }
        }
    };
    tree("", 'a', 1, 1);
    for (auto ans : temp) {
        cout << ans << endl;
    }
}


Measured memory_bytes: 7796
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <queue>


using namespace std;
using ll = long long int;

template <class T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto i = v.begin(); i != v.end(); i++) {
    os << *i << " ";
  }
  return os;
}


void solve(std::string s){
  int l = 0;
  int r = s.size()-1;
  ll ans=0;
  while(l < r) {
    if(s[l] == 'x' and s[r] != 'x') {
      s.insert(r+1, 1, 'x');
      ans++;
      l++;
    } else if(s[l] != 'x' and s[r] == 'x'){
      s.insert(l, 1, 'x');
      ans++;
      r++;
    } else if(s[l] == s[r]) {
      l++;
      r--;      
    } else {
      std::cout << -1 << std::endl;
      return;
    }
    // std::cout << l << " " << r << std::endl;
    // std::cout << s[l] << " " << s[r] << std::endl;
    // std::cout << s << std::endl;
  }
  std::cout << ans << std::endl;
  // std::cout << s << std::endl;
}

int main(){
  std::string s;
  std::cin >> s;
  solve(s);
  return 0;
}



Measured memory_bytes: 640
#include<stdio.h>
#include<string.h>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	char p[55][55];
	int m,n;
	memset(p,'0',sizeof(p)) ;
	scanf("%d %d",&m,&n);
	for(int i=1;i<=m;i++)
	{
		for(int j=1;j<=n;j++)
		cin>>p[i][j];
	} 
	int e=0;
	for(int i=1;i<=m;i++)
	{
		for(int j=1;j<=n;j++)
		{
			if(p[i][j]=='.')
			{				
					
					if(p[i-1][j-1]=='#')
					e++;
					if(p[i-1][j]=='#')
					e++;
					if(p[i-1][j+1]=='#')
					e++;
					if(p[i][j+1]=='#')
					e++;
					if(p[i][j-1]=='#')
					e++;
					if(p[i+1][j-1]=='#')
					e++;
					if(p[i+1][j]=='#')
					e++;
					if(p[i+1][j+1]=='#')
					e++;
					p[i][j]='0'+e;
                                        e=0;
				}		
		}
	}
	for(int i=1;i<=m;i++)
	{
		for(int j=1;j<=n;j++)
		{
			printf("%c",p[i][j]);
		}
		printf("\n");
	}
	return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
int main(){
  ll s,c;
  cin>>s>>c;
  ll ans=0;
  if(s*2<=c){
    ans+=s;
    c-=s*2;
    ans+=c/4;
  }
  else{
    ans+=c/2;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
from collections import defaultdict, Counter
import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)

H, W, N = map(int, input().split())
d = defaultdict(int)
for _ in range(N):
    x, y = map(int, input().split())
    for i in range(-2, 1):
        if 1 <= x + i <= H - 2:
            for j in range(-2, 1):
                if 1 <= y + j <= W - 2:
                    d[(x + i, y + j)] += 1

c = Counter(d.values())
zero = (H - 2) * (W - 2) - len(d)
print(zero)
for i in range(1, 10):
    print(c[i])

Measured memory_bytes: 166872
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;
vector<vi> e;
double dp[600];
double rec(int c, int use){
	double &res = dp[c];
	if(res >= 0) return res;
	int k = e[c].size();
	if(k == 0) return res = 0;
	if(k == 1) return res = 1 + rec(e[c].back(), use);
	
	if(c != use){
		double sum = 0;
		for(int i : e[c]) sum += rec(i, use);
		return res = sum / k + 1;
	}
	
	vector<double> r;
	for(int i : e[c]) r.pb(rec(i, use));
	
	return res = 1 + (accumulate(all(r), 0.0) - *max_element(all(r))) / (r.size() - 1);
}
int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	int n, m; cin >> n >> m;
	e.resize(n);
	rep(i, m){
		int s, t; cin >> s >> t;
		e[s - 1].pb(t - 1);
	}
	double ans = INF;
	rep(i, n){
		memset(dp, -1, sizeof(dp));
		ans = min(ans, rec(0, i));
	}
	printf("%.20f\n", ans);
	return 0;
}

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

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1000000007
#define INF LONG_LONG_MAX
#define yn(f) cout << (f ? "Yes" : "No") << endl;

int hoge[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
int k;

signed main() {
    cin >> k;
    cout << hoge[--k] << endl;
}


Measured memory_bytes: 768
#include <iostream>
    using namespace std;
     
    int main() {
    	int n, a[100005], ans = 0, now = 1;
    	cin >> n;
    	for (int i = 1; i <= n; i++) cin >> a[i];
     
    	while (now != 2) {
    	    now = a[now];
    	    ans++;
    	    if (ans > n) break;
    	}
    	if (ans < n) cout << ans;
    	else cout << -1;
    	return 0;
    }

Measured memory_bytes: 3992
#define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <numeric>
#include <stdio.h>
#include <vector>
#include <map>
#include <queue>

using namespace std;
typedef long long ll;
using Graph = vector<vector<ll>>;

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

int main() {
    ll L,R,d;
    cin >> L >> R >> d;
    ll out = R/d - (L-1)/d;
    cout << out << endl;
    return 0;
}



Measured memory_bytes: 3544
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define F first
#define S second
const int mod = 1e9 + 7, A = 5e5 + 2;

int main() {
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    int n, x;
    cin >> n >> x;
    ll a[n];
    for (int i = 0; i < n; i++) cin >> a[i];
    ll sum = 0;
    for (int i = 0; i <= x; i++) {
        for (int j = 0; i + j <= min(n, x); j++) {
            priority_queue<ll, vector<ll>, greater<ll>> pq;
            for (int k = 0; k < i; k++)
                pq.push(a[k]);
            for (int k = n - 1, c = 0; c < j; c++, k--)
                pq.push(a[k]);
            for (int k = i + j; k < x; k++) {
                if (!pq.empty() && pq.top() < 0) pq.pop();
            }
            ll val = 0;
            while(!pq.empty()) val += pq.top(), pq.pop();
            sum = max(sum, val);
        }
    }
    cout << sum;
    return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
int main()
{
	int n,a;
	scanf("%d",&n);//&a,&b,&c);
	while(n--)
	{
		scanf("%d",&a);
		if(a%2==0)
			if(a%3!=0&&a%5!=0)
			{
				puts("DENIED");
				return 0;
			}
	}
	puts("APPROVED");
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h> 
//#define <- プログラムの文字列を置換する
//typedef <- 新しい型に名前を付けるためのキーワード

using namespace std;

#define MAX_N 1
#define PI 3.14159265359
#define mod 1000000007

const long long INF = 1000000000;

int main(){
    string s;
    cin >> s;
    string ans = string();
    for(int i = 1; i <= s.length(); ++i){ 
        ans += 'x' ;
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;
typedef long long ll;
typedef long int li;
typedef long double lb;
#define rep(i,j,n) for (ll i = j; i < (n); i++)
#define repr(i,j,n) for(ll i = j; i >= (n); i--)
#define all(x) (x).begin(),(x).end()
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
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; }
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const ll INF = 1LL<<60;

int main(){

  ll r,c;cin>>r>>c;
  ll a[r+1][c+1];rep(i,0,r)rep(j,0,c)cin>>a[i][j];

  rep(i,0,r){
    a[i][c]=accumulate(a[i],a[i]+c,0);
  }
  rep(j,0,c+1){
    ll sum=0;
    rep(i,0,r)sum+=a[i][j];
    a[r][j]=sum;
  }

  rep(i,0,r+1){
    rep(j,0,c+1){
      if(j!=c)cout<<a[i][j]<<" ";
      else out(a[i][j]);
    }
    // if(i!=r)cout<<endl;
  }


  return 0;
}



Measured memory_bytes: 3172
#include<iostream>
#include<cmath>

using namespace std;

int main() {
	int N, M = 1, i, j;
	cin >> N;
	for (i = 9; i-1 ; i--) {
		for (j = 32; j; j--) {
			if (M <=pow(j, i)&&pow(j,i)<=N) M = pow(j,i);
		}
	}
	cout << M << endl;
}

Measured memory_bytes: 384
N = int(input())
ans = 0
itr = 1
while(itr<=N):
    if itr < 10:
        ans += 1
    if 100 <= itr & itr < 1000:
        ans += 1
    if 10000 <= itr & itr <100000:
        ans+=1
    itr += 1
print(ans)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define MOD (1000000007)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()

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; }

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

const ll INF = 1LL << 60;

int main(){
  int n; string s; cin >> n >> s;
  rep(bit, (1<<2)){
    vector<bool> sheep(n+1,0);
    sheep[0] = (bit & 1);
    sheep[1] = (bit & 10);
    for (int i = 1; i < n; i++) {
      if(sheep[i] == (s[i] == 'o')) sheep[i+1] = sheep[i-1];
      else sheep[i+1] = !sheep[i-1];
    }
    //整合性の確認
    if(sheep[n] == sheep[0] && ((s[0] == 'o')==sheep[0]) == (sheep[1]==sheep[n-1])){
      rep(i, n) std::cout << ((sheep[i]) ? 'S' : 'W');
      std::cout << '\n';
      return 0;
    }
  }
  std::cout << -1 << '\n';
}


Measured memory_bytes: 512