akhauriyash/Code-Regression huggingface dataset:
/******************************************
* AUTHOR : HRITIK AGGARWAL *
******************************************/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 100005
#define MOD 1000000007
#define dd double
#define vi vector<int>
#define vll vector<ll>
#define forr(i, n) for(int i = 0; i < n; i++)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep1(i,b) for(int i=1;i<=b;i++)
#define pb push_back
#define mp make_pair
#define clr(x) x.clear()
#define sz(x) ((int)(x).size())
#define ms(s, n) memset(s, n, sizeof(s))
#define F first
#define S second
#define int ll
ll po(ll a, ll x,ll m){ if(x==0){return 1;}ll ans=1;ll k=1;  while(k<=x) {if(x&k){ans=((ans*a)%m);} k<<=1; a*=a; a%=m; }return ans; }
int32_t main() {
    
   
 	int n,a,b;
 	cin>>n;
 	if(n&1){
 		a = floor(n/2)+1;
 	}else{
 		a = n/2;
 	}

 	cout<<setprecision(6)<<fixed<<(double)a/n<<"\n";
return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define y0 y12
#define y1 y22
#define INF 987654321
#define PI 3.141592653589793238462643383279502884
#define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
#define fdn(i,a,b,c) for(int (i)=(a);(i)>=(b);(i)-=(c))
#define MEM0(a) memset((a),0,sizeof(a));
#define MEM_1(a) memset((a),-1,sizeof(a));
#define ALL(a) a.begin(),a.end()
#define SYNC ios_base::sync_with_stdio(false);cin.tie(0)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef double db;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef pair<ld, ld> Pd;
typedef vector<int> Vi;
typedef vector<ll> Vll;
typedef vector<db> Vd;
typedef vector<Pi> VPi;
typedef vector<Pll> VPll;
typedef vector<Pd> VPd;
typedef tuple<int, int, int> iii;
typedef tuple<int, int, int, int> iiii;
typedef tuple<ll, ll, ll> LLL;
typedef vector<iii> Viii;
typedef vector<LLL> VLLL;
typedef complex<double> base;
const int MOD = 1000000007;
ll POW(ll a, ll b, ll MMM = MOD) { ll ret = 1; for (; b; b >>= 1, a = (a*a) % MMM)if (b & 1)ret = (ret*a) % MMM; return ret; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { if (a == 0 || b == 0)return a + b; return a*(b / gcd(a, b)); }
int dx[] = { 0,1,0,-1,1,1,-1,-1 }, dy[] = { 1,0,-1,0,1,-1,1,-1 };
int ddx[] = { -1,-2,1,-2,2,-1,2,1 }, ddy[] = { -2,-1,-2,1,-1,2,1,2 };

iii p[200000];
int parent[200000];
int find(int x){
	if(parent[x]<0)return x;
	return parent[x]=find(parent[x]);
}
void merge(int x,int y){
	x=find(x),y=find(y);
	if(x==y)return;
	parent[x]+=parent[y];
	parent[y]=x;
}
int ans[200000];
int main() {
	MEM_1(parent);
	int n;
	scanf("%d",&n);
	fup(i,0,n-1,1){
		int x,y;
		scanf("%d%d",&x,&y);
		p[i]=iii(x,y,i);
	}
	sort(p,p+n);
	int i=0;
	while(i<n){
		int mx=-1,mn=n+5;
		int j=i;
		while(j<n){
			mx=max(mx,get<1>(p[j]));
			mn=min(mn,get<1>(p[j]));
			if(mx==n-i && mn==n-j){
				j++;
				break;
			}
			j++;
		}
		fup(k,i,j-1,1)ans[get<2>(p[k])]=j-i;
		i=j;
	}
	fup(i,0,n-1,1)printf("%d\n",ans[i]);
}

Measured memory_bytes: 7464
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
int main(){
  int N;
  cin >> N;
  vector<int> W(N);
  vector<int> sum(N);
  for(int i = 0; i < N; i++){
    cin >> W.at(i);
    if(i == 0) sum.at(i) = W.at(i);
    else sum.at(i) = sum.at(i-1) + W.at(i);
  }
  int result = sum.at(N-1);
  for(int i = 0; i < N - 1; i++){
    result = min(result, abs(sum.at(i) - (sum.at(N-1) - sum.at(i))));
  }
  cout << result << endl;
}

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

#define endl '\n'
#define rep(n)      for (int i = 0 ; i < n ; i++)
#define all(a)      a.begin(),a.end()
#define NumofDigits(n)    ((long long)log10(n)+1)
#define Unique(n)         (n).erase(unique(all(n)), (n).end())



void quick ()
{
    cin.tie(0);
    cout.tie(0);
    ios_base::sync_with_stdio(0);
}

void readFromText ()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
#endif // ONLINE_JUDGE
}

void time()
{
#ifndef ONLINE_JUDGE
    cout << "\nTime: " << 1.0 * clock() / CLOCKS_PER_SEC << "s\n";
#endif
}

const double Pi = acos(-1.0);
const int MAX = 1e5 ;
bool on [MAX+1];


int main()
{
    quick();
//    readFromText();
    int a , b , k ; cin >> k >> a >> b ;
    bool state = false ;
    for (int i = a ; i <= b ; i++){
        if (i%k==0)state = true;
    }
    if (state)cout << "OK" ;
    else cout << "NG" ;
    return 0;
}

unsigned long long pow(long long base, long long power){
    if(power==0)
        return 1;
    if(power==1)
        return base;
    unsigned long long ans = pow(base, power/2);
    ans *= ans;

    if(power&1)
        return ans*base;
    return ans;
}


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

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define eee(a) (cerr << (#a) << ": " << (a) << endl);


using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using mint = map<int, int>;

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

const char sp = ' ';
const char cmm = ',';
const int MOD = 1e9+7;
const int INF = 1e9;
const ll LINF = 1e18;

ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powmod(ll b, ll e){ll r=1;while(e>0){if(e&1)r=(r%MOD)*(b%MOD)%MOD;b=(b%MOD)*(b%MOD)%MOD;e>>=1;}return r;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

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; }
template<typename T>
void ppp(T n){cout << n << endl;}
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
    int len = v.size();
    s << '[';
    for (int i = 0; i < len; ++i) {
        s << v[i]; if (i < len-1) s << ", ";
    }
    s << ']';
    return s;
}

struct aaa{
    aaa(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(15);
    };
}fastio;

int main(){

    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];

    vector<int> l(n+2, 0);
    vector<int> r(n+2, 0);
    for(int i = 1; i <= n; ++i){
        l[i] = max(l[i-1], a[i-1]);
    }
    for(int i = n-1; i >= 0; --i){
        r[i] = max(r[i+1], a[i]);
    }
    rep(i, n){
        cout << max(l[i], r[i+1]) << endl;
    }

    return 0;
}


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

 
int main(void){
  int n;
  cin >> n;
 
  if(n==1) cout << 1 << endl;
  else if(n<4) cout << 2 << endl;
  else if(n<8) cout << 4 << endl;
  else if(n<16) cout << 8 << endl;
  else if(n<32) cout << 16 << endl;
  else if(n<64) cout << 32 << endl;
  else cout << 64 << endl;
  return 0;
} 

Measured memory_bytes: 3600
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt"
int main() {
  while (1) {
    int a, L; cin >> a >> L;
    if (!a&&!L)break;
    vector<int>nums(1, a);
    for (int time = 0; true;time++) {

      std::ostringstream sout;
      sout << setfill('0') << setw(L) << a;
      string st = sout.str();
      sort(st.begin(), st.end());
      const int amin = stoi(st);
      reverse(st.begin(), st.end());
      const int amax = stoi(st);
      const int next = amax - amin;
      auto it = find(nums.begin(), nums.end(), next);
      if (it != nums.end()) {
        cout << it-nums.begin() << " " << next << " " << nums.end() - it << endl;
        break;
      }
      else {
        nums.push_back(next);
        a = next;
      }
    }
  }
  return 0;
}

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

int main(){
    int a,b,c,d;
    cin >> a >> b >> c >> d;

    if(abs(a-c)<=d){
        cout << "Yes" << endl;
        return 0;
    }else{
        if(abs(b-a)<=d && abs(c-b)<=d){
            cout << "Yes" << endl;
            return 0;
        }else{
            cout << "No" << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
/**
 *    Author:   Jay Sabale
 *	       
**/

#include<bits/stdc++.h>

using namespace std;
 
// Competetive Template:
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ldb;
typedef vector <lli> vl;
typedef vector <string> vs;
typedef vector < pair <long, long> > vll;

// Debugging :
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
 
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define ba  back
#define si size()
#define be begin()
#define en end()
#define le length()
#define mp make_pair 
#define mt make_tuple
#define fi first
#define se second
#define gcd __gcd
#define maxe *max_element
#define mine *min_element
#define deb debug
 
#define forz(i,n) for(lli i=0; i<n; i++)
#define rep(i,k,n) for (lli i = k; i < n; i++)
#define deci(n)  fixed<<setprecision(n)
#define high(n) __builtin_popcount(n)
#define parity(n) __builtin_parity(n)
#define ctz(n)  __builtin_ctz(n)
#define mod 1000000007
#define mod2 998244353
#define kira ios::sync_with_stdio(0), cin.tie(0),cout.tie(0)

// Printing Data :
#define pvec(v) forz(i,v.si) cout<<v[i]<<" "; cout<<endl;
#define parr(arr, n) forz(i,n) cout<<arr[i]<<" "; cout<<endl;
#define p1(i) cout<<i<<endl;
#define p2(i, j) cout<<i<<" "<<j<<endl;
#define p3(i, j, k) cout<<i<<" "<<j<<" "<<k<<endl;
#define p4(i, j, k, l) cout<<i<<" "<<j<<" "<<k<<" "<<l<<endl;

typedef pair <lli,lli> pll;

// CODE BEGINS :

int main()
{
    kira; 

    lli n; cin>>n;
    bool b=false;

    while(n!=0)
    {
        if(n%10 == 7)
        b=true;

        n/=10;
    }

    if(b) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

    return 0;
}




















































Measured memory_bytes: 3644
#!/usr/bin/perl
use Data::Dumper;

my ($n) = map { $_ - 0 } split(/\s+/,<STDIN>);

my @xw = ();
$#xw = 200000;
my @yw = ();
$#yw = 200000;

my @xyu = ();
for(my $i=0;$i<$n;$i++){
  my @xx = split(/\s+/,<STDIN>);
  $xx[0] -= 0;
  $xx[1] -= 0;
  push(@xyu,\@xx);
  
  if( $xx[2] eq 'D' or $xx[2] eq 'U' ){
    $xw[$xx[0]] = +[] unless ref($xw[$xx[0]]);
    push(@{$xw[$xx[0]]},\@xx);
  }
  if( $xx[2] eq 'L' or $xx[2] eq 'R' ){
    $yw[$xx[1]] = +[] unless ref($yw[$xx[1]]);
    push(@{$yw[$xx[1]]},\@xx);
  }
}

my @s1 = ();
$#s1 = 400000;
my @s2 = ();
$#s2 = 400000;

my @xyu1 = sort { $a->[0] <=> $b->[0] } @xyu;

my $mincor = 10 ** 9;

# 最初はサイド衝突を
for(my $i=0;$i<$n;$i++){
  my ($x,$y,$u) = (@{$xyu1[$i]});
  
  my $se1 = $x + $y;
  
  if( $u eq 'U' ){
    if( ref($s1[$se1]->{'R'}) ){
      my $cor = $x - $s1[$se1]->{'R'}->[0];
      $mincor = $cor if $cor < $mincor;
    }
  }
  if( $u eq 'L' ){
    if( ref($s1[$se1]->{'D'}) ){
      my $cor = $x - $s1[$se1]->{'D'}->[0];
      $mincor = $cor if $cor < $mincor;
    }
  }
  $s1[$se1]->{$u} = $xyu1[$i];
  
  my $se2 = $y - $x + 200000;
  
  if( $u eq 'D' ){
    if( ref($s2[$se2]->{'R'}) ){
      my $cor = $x - $s2[$se2]->{'R'}->[0];
      $mincor = $cor if $cor < $mincor;
    }
  }
  
  if( $u eq 'L' ){
    if( ref($s2[$se2]->{'U'}) ){
      my $cor = $x - $s2[$se2]->{'U'}->[0];
      $mincor = $cor if $cor < $mincor;
    }
  }
  
  $s2[$se2]->{$u} = $xyu1[$i];
  
}

if( $mincor != 10 ** 9 ){
  $mincor *= 10;
}

# 次に正面衝突を
#my @xyu1 = sort { $a->[0] <=> $b->[0] } @xyu;



#for(my $i=0;$i<=200000;$i++){
#  if( ref($xw[$i]) ){
#    print ( "x=$i , " . Dumper($xw[$i]) . "\n" );
#  }
#  if( ref($yw[$i]) ){
#    print ( "y=$i , " . Dumper($yw[$i]) . "\n" );
#  }
#}

for(my $i=0;$i<=200000;$i++){
  if( ref($xw[$i]) ){
    my @aa = sort { $a->[1] <=> $b->[1] } @{$xw[$i]}; # y座標で昇順ソート
    my $prevu = -1;
    for(my $j=0;$j<=$#aa;$j++){
      if( $aa[$j]->[2] eq 'D' and $prevu >= 0 ){
        my $cor = ( $aa[$j]->[1] - $prevu ) * 5;
        $mincor = $cor if $cor < $mincor;
      }
      if( $aa[$j]->[2] eq 'U' ){
        $prevu = $aa[$j]->[1];
      }
    }
  }
  if( ref($yw[$i]) ){
    my @aa = sort { $a->[0] <=> $b->[0] } @{$yw[$i]}; # x座標で昇順ソート
    my $prevr = -1;
    for(my $j=0;$j<=$#aa;$j++){
      if( $aa[$j]->[2] eq 'L' and $prevr >= 0 ){
        my $cor = ( $aa[$j]->[0] - $prevr ) * 5;
        $mincor = $cor if $cor < $mincor;
      }
      if( $aa[$j]->[2] eq 'R' ){
        $prevr = $aa[$j]->[0];
      }
    }
  }
}

if( $mincor == 10 ** 9 ){
  print "SAFE\n";
} else {
  print "$mincor\n";
}


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

int main() {
	int weeks;
	cin >> weeks;
	double loan = 100000;
	for (int week = 0; week != weeks; ++week) {
		loan *= 1.05;
		if (int(loan) % 1000 != 0) 
			loan = (loan+1000)-int(loan+1000)%1000;
	}
	cout << fixed << setprecision(0) << loan << endl;
}

Measured memory_bytes: 1232
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i <= (n); i++)
#define show(a, n) rep(i,n) {cout<<a[i]<<' ';} cout<<endl
#define show2(a, n, m) rep(i, n) { rep(j, m) {cout << a[i][j] << ' ';} cout << endl;} 
#define chmin(a, b) a = min(a, b)
#define chmax(a, b) a = max(a, b)

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<long long, long long> pll;
typedef long double ld;

const int INF = 1 << 30;
const long long INFL = 1LL << 60;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 100010;

ll n, k;
vll a;
vll b;

int main() {
//	cout << fixed << setprecision(15);
	cin >> n >> k;
	a = vll(n);
	rep(i, n) cin >> a[i];
	sort(a.begin(), a.end());

	ll lb = lower_bound(a.begin(), a.end(), 0ll) - a.begin();
	ll ub = upper_bound(a.begin(), a.end(), 0ll) - a.begin();
	ll nm = lb, nz = ub - lb, np = n - ub;
	ll nm2 = nm * np;
	ll nz2 = (nm + np) * nz + nz * (nz - 1) / 2;
	ll np2 = nm * (nm - 1) / 2 + np * (np - 1) / 2;

	b = vll(nm);
	rep(i, nm) b[i] = -a[nm - i - 1];

	ll ans;
	if(nm2 < k && k <= nm2 + nz2) {
		ans = 0;
	}
	else if(k <= nm2) {
		ll ok = -1, ng = -1e18 - 1;
		while(ok - ng > 1) {
			ll mid = (ok + ng) / 2;
			ll cnt = 0;
			for(int i = nm + nz; i < n; i++) {
				ll th = (mid + 1) / a[i] - 1;
				cnt += upper_bound(a.begin(), a.begin() + nm, th) - a.begin();
			}
			if(cnt >= k) ok = mid;
			else ng = mid;
		}
		ans = ok;
	}
	else {
		ll ok = 1e18, ng = 0;
		while(ok - ng > 1) {
			ll mid = (ok + ng) / 2;
			ll cnt = 0;
			for(int i = nm + nz; i < n; i++) {
				cnt += upper_bound(a.begin() + i + 1, a.end(), mid / a[i]) - (a.begin() + i + 1);
			}
			rep(i, nm) {
				cnt += upper_bound(b.begin() + i + 1, b.end(), mid / b[i]) - (b.begin() + i + 1);
			}
			if(cnt >= k - nm2 - nz2) ok = mid;
			else ng = mid;
		}
		ans = ok;
	}
	cout << ans << endl;
}


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

using ll = long long;
using namespace std;
constexpr ll inf = 1e15;
constexpr ll mod = 1e9+7;

ll dp[21][50001] = {0};

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

    int N, M;
    cin>>N>>M;
    vector<int> C(M);
    for (int m = 0; m < M; m++) cin>>C[m];

    for (int n = 1; n <= N; n++)
        for (int m = 0; m <= M; m++) dp[m][n] = inf;

    for (int m = 1; m <= M; m++) {
        for (int n = 0; n <= N; n++) {
            dp[m][n] = dp[m-1][n];
            if (n - C[m-1] >= 0) dp[m][n] = min(dp[m][n], dp[m][n-C[m-1]] + 1);
        }
    }
    cout<<dp[M][N]<<endl;

    return 0;
}


Measured memory_bytes: 11376
class Node():
    def __init__(self):
        self.parent = -1
        self.sibling = -1
        self.degree = 0
        self.depth = -1
        self.height = -1
        self.type = ""
        self.left = -1
        self.right = -1


def dfs(id, depth=0):
    Nodes[id].depth, Nodes[id].height = depth, 0
    if Nodes[id].left != -1:
        Nodes[id].height = max(
            Nodes[id].height, dfs(Nodes[id].left, depth+1) + 1)
    if Nodes[id].right != -1:
        Nodes[id].height = max(Nodes[id].height, dfs(
            Nodes[id].right, depth+1) + 1)
    return Nodes[id].height


def main():
    n = int(input())
    global Nodes
    Nodes = [Node() for i in range(n)]

    for i in range(n):
        id, *children = map(int, input().split())
        left = children[0]
        right = children[1]
        if left != -1 and right != -1:
            Nodes[id].type = "internal node"
            Nodes[id].degree = 2
            Nodes[id].left = left
            Nodes[id].right = right
            Nodes[left].sibling = right
            Nodes[right].sibling = left
        elif left != -1 or right != -1:
            Nodes[id].type = "internal node"
            Nodes[id].degree = 1
            if left != -1:
                Nodes[id].left = left
            else:
                Nodes[id].left = right
        else:
            Nodes[id].type = "leaf"
            Nodes[id].degree = 0
        for child in children:
            if child != -1:
                Nodes[child].parent = id

    rootid = ""
    for i, node in enumerate(Nodes):
        if node.parent == -1:
            rootid = i
    Nodes[rootid].type = "root"
    dfs(rootid)

    for i, node in enumerate(Nodes):
        print("node {}: parent = {}, sibling = {}, degree = {}, depth = {}, height = {}, {}".format(
            i, node.parent, node.sibling, node.degree, node.depth, node.height, node.type))


if __name__ == '__main__':
    main()


Measured memory_bytes: 5624
import java.io.*;

class Main {
	public static void main(String args[]) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String buf;

		try {
			int count = 0;
			while ((buf = br.readLine())!=null) {
				StringBuffer sb = new StringBuffer(buf);
				String str1 = buf;
				String str2 = sb.reverse().toString();
				if (str1.equals(str2)) count++;
			}
			System.out.println(count);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}

Measured memory_bytes: 16864
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
struct segtree{
private:
  vector<ll> node,lazy;
  ll siz;
public:
  segtree(int n){
    siz=1;
    while(siz<=n) siz*=2;
    node.resize(siz*2,0);
    lazy.resize(siz*2,0);
  }
  void eval(ll pos){
    node[pos]+=lazy[pos];
    if(pos<siz-1) {
      lazy[pos*2+1]+=(lazy[pos]/2);
      lazy[pos*2+2]+=(lazy[pos]/2);
    }
    lazy[pos]=0;
  }
  void add_q(ll a,ll b,ll x,ll l,ll r,ll pos){
    eval(pos);
    if(b<=l||r<=a) return;
    if(a<=l&&r<=b){
      lazy[pos]+=(x*(r-l));
      eval(pos);
      return;
    }
    ll mid=(l+r)/2;
    add_q(a,b,x,l,mid,pos*2+1);
    add_q(a,b,x,mid,r,pos*2+2);
    node[pos]=node[pos*2+1]+node[pos*2+2];
  }
  ll sum_q(ll a,ll b,ll l,ll r,ll pos){
    if(b<=l||r<=a) return 0;
    eval(pos);
    if(a<=l&&r<=b){
      return node[pos];
    }
    ll mid=(l+r)/2;
    return (sum_q(a,b,l,mid,pos*2+1)+sum_q(a,b,mid,r,pos*2+2));
  }
  void add(ll a,ll b,ll x){
    add_q(a,b,x,0,siz,0);
  }
  ll sum(ll a,ll b){
    return sum_q(a,b,0,siz,0);
  }
  void debug(){
    cout<<"Node:"<<endl;
    ll t=2;
    for(int i=2;i<=siz*2;i++) {
      cout<<node[i-2]<<" ";
      if(i==t){
        t*=2;
        cout<<endl;
      }
    }
    cout<<"Lazy:"<<endl;
    t=2;
    for(int i=2;i<=siz*2;i++){
      cout<<lazy[i-2]<<" ";
      if(i==t){
        t*=2;
        cout<<endl;
      }
    }
  }
};
int main(){
  ll n,k;
  cin>>n>>k;
  segtree seg=segtree(n+5);
  for(int i=0;i<=n;i++){
    seg.add(i,i+1,n-i);
  }
  priority_queue<P,vector<P>,greater<P>> pque;
  pque.push(P(0,0));
  ll ksum=0;
  for(int i=1;i<=n;i++){
    ll a;
    cin>>a;
    a-=k;
    ksum+=a;
    pque.push(P(ksum,i));
  }
  ll ans=0;
  while(!pque.empty()){
    P p=pque.top();
    pque.pop();
    ans+=seg.sum(p.second,p.second+1);
    seg.add(0,p.second,-1);
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 14576
#include <bits/stdc++.h>
using namespace std;
int main(){
	int a, b, c;
	cin >>	a >> b>>c;
	bool flg = 0;
	if(a < c && b > c)
		flg = 1;
	if(a > c && b < c)
		flg = 1;
	cout << (flg ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <random>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
typedef vector<int> vi;
typedef long long ll;
typedef pair<int, int> pii;
typedef double db;
mt19937 mrand(random_device{}());
const ll mod = 1000000007;
int rnd(int x) { return mrand() % x; }
ll powmod(ll a, ll b) { ll res = 1; a %= mod; assert(b >= 0); for (; b; b >>= 1) { if (b & 1)res = res * a%mod; a = a * a%mod; }return res; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
// head

int t;

int main()
{
    ios::sync_with_stdio(false);
#ifdef RG
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout); 
#endif
    cin>>t;
    cout<<(t+1)/2<<endl;
    return 0;
}

Measured memory_bytes: 256
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef ll Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
// #define mt make_tuple
//typedef tuple<pii,int,int> tp;
//typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-7;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	ll n;
	cin>>n;
	loop(i,1,3600)loop(j,1,3600){
		if(4*i*j-n*i-n*j!=0&&(n*i*j)%(4*i*j-n*i-n*j)==0){
			ll t=(n*i*j)/(4*i*j-n*i-n*j);
			if(t<=0)continue;
			cout<<i<<" "<<j<<" "<<t<<endl;
			return 0;
		}
	}
}








Measured memory_bytes: 256
# 定数
INF = float("inf")
MOD = int(1e9 + 7)

# エントリーポイント
def main():
	# 入力
	N = int(input())
	A = list(map(int, input().split()))

	offset = 0
	for a in A:
		offset = a * 2 - offset
	offset //= 2
	for a in A:
		print(offset)
		offset = a * 2 - offset

main()


Measured memory_bytes: 14096
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
class ABC171
{
    static void Main()
    {
        long num_N = long.Parse(Console.ReadLine());
        string[] alph = { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n","o",
                "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z" };

        string ans = "";
        long tempAmari = (num_N - 1) % 26;
        long tempSho   = num_N;
        while (true)
        {
            ans = alph[tempAmari] + ans;
            tempSho = (tempSho - tempAmari - 1) / 26;
            tempAmari = (tempSho - 1) % 26;
            if (tempSho == 0)
            {
                break;
            }
        }
        Console.WriteLine(ans);
        //System.Diagnostics.Debug.WriteLine(ans);
    }
}

Measured memory_bytes: 27536
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>

#define INF 999999999
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define pb(a) push_back(a)

typedef long long unsigned int ll;
using namespace std;

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

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


int main()
{	
	int a, b, c;
	cin >> a >> b >> c;
	
	int ans = a - b;
	
	if (ans > c) {
		ans = 0;
	}
	else {
		ans = c - ans;
	}
	
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
/* {{{ Shinobu kawaii */
/*
  ______   __        _                  __                 
.' ____ \ [  |      (_)                [  |                
| (___ \_| | |--.   __   _ .--.   .--.  | |.--.   __   _   
 _.____`.  | .-. | [  | [ `.-. |/ .'`\ \| '/'`\ \[  | | |  
| \____) | | | | |  | |  | | | || \__. ||  \__/ | | \_/ |, 
 \______.'[___]|__][___][___||__]'.__.'[__;.__.'  '.__.'_/ 

*/
/* }}} */

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

// #define int long long
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

/* cpp template {{{ */

/* short */
#define pb push_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) (v).begin(), (v).end()
#define X real()
#define Y imag()

/* REPmacro */
#define REPS(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) REPS(i, 0, n)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (int i = (a); i >= n; --i)
#define DEP(i, n) DEPS(i, n, 0)

/* debug */
#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

/* typedef */
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<vii> viii;
typedef pair<int, int> pii;
typedef double D;
typedef complex<D> P;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;
const D EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

/* func */
inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; std::cin >> x; return x;}
template <typename T> void print(T x) {std::cout << x << '\n';}
template <typename T>
void print(std::vector<T>& v, std::string s = " ") {
  REP(i, v.size()) {
    if (i != 0) std::cout << s;
    std::cout << v[i];
  }
  std::cout << '\n';
}

/* }}} */

signed main()
{
  string s;
  int k;
  cin >> s >> k;

  REP(i, s.size()) {
    if (s[i] == 'a') continue;
    if (k - (26 - (s[i] - 'a')) >= 0) {
      k -= (26 - (s[i] - 'a'));
      s[i] = 'a';
    }
    debug(k);
    debug(s);
  }
  REP(i, k % 26) {
    if (s[s.size() - 1] == 'z') {
      s[s.size() - 1] = 'a';
    } else {
      s[s.size() - 1]++;
    }
  }
  print(s);

  return 0;
}



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

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

constexpr int INF = 1e9;
//constexpr ll INF = 1LL<<61;
// constexpr ll mod = 1e9+7;

int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  map<int, int> mp;
  int maxa = -1;
  REP(i, N){
    cin >> A[i];
    mp[A[i]]++;
    maxa = max(A[i], maxa);
  }
  sort(A.begin(), A.end());
  vector<bool> dp((int)1e6+5, true);
  int ans = 0;
  REP(i, N){
    if(mp[A[i]] == 1 && dp[A[i]]){
      ans++;
    }
    if(dp[A[i]]){
      for(int j = 1; j*A[i] <= maxa; j++){
        dp[A[i]*j]=false;
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 13468
#include<iostream>
#include<string>
#include<queue>
#include<set>
#include<map>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
  	int a,b,c,d;
  	cin>>a>>b>>c>>d;
  	if((abs(a-b)<=d && abs(b-c)<=d) || abs(c-a)<=d)
  		cout<<"Yes"<<endl;
  	else cout<<"No"<<endl;
  	return 0;
}

Measured memory_bytes: 256
import numpy as np

N,K=map(int,input().split())
A=list(map(int,input().split()))
F=list(map(int,input().split()))
A.sort()
F.sort(reverse=True)

A=np.array(A)
F=np.array(F)

def judge(x):
    over=np.maximum(A*F-x,0)
    shug=-(-over//F).sum()
    return shug<=K

left=-1
right=10**12*+1
while left+1<right:
    mid=(left+right)//2
    if judge(mid):
        right=mid
    else:
        left=mid
print(right)

Measured memory_bytes: 43620
#include<bits/stdc++.h>
#include <string>
#define ll long long int
using namespace std;

const int m=1000000007;

int main()
{
    int k;
    cin>>k;
    int i=1;
    int n=7;
    if(k%2==0 || k%5==0)
    {
        cout<<"-1"<<endl;
    }
    else
    {
        bool flag=0;
        while(i<=1000000)
        {
            if(n%k==0)
            {
                cout<<i<<endl;
                flag=1;
                break;
            }
            else
            {
                n=((n*10)%k+7%k)%k;
                i++;
            }
        }
        if(flag==0)
        {
            cout<<"-1"<<endl;
        }
    }
}


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

//typedef
//------------------------------------------
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//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 SORT(c) sort((c).begin(),(c).end())

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int MOD = 1000000007;

// grid
//--------------------------------------------
VL dx = {0, 1, 0, -1};
VL dy = {1, 0, -1, 0};
VL dx2 = {-1, 0, 1, -1, 1, -1, 0, 1};
VL dy2 = {-1, -1, -1, 0, 0, 1, 1, 1};

//debug
//--------------------------------------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//IO accelerate
//--------------------------------------------
struct InitIO {
    InitIO() {
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(30);
    }
} init_io;

//template
//--------------------------------------------
template<typename T>
istream& operator >>(istream& is, vector<T>& vec) {
  for(T& x: vec) is >> x;
  return is;
}
template<typename T>
ostream& operator <<(ostream& os, const vector<T>& vec) {
  for(int i=0; i<vec.size(); i++){
    os << vec[i] << ( i+1 == vec.size() ? "" : "\t" );
  }
  return os;
}
template<typename T>
ostream& operator <<(ostream& s, const vector<vector<T>>& vv) {
	for (int i = 0; i < vv.size(); ++i) {
		s << vv[i] << endl;
	}
	return s;
}

// 多重vector
// auto dp=make_v<int>(4,h,w) みたいに使える
template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

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

// 多重vectorのためのfill
// fill_v(dp,0) みたいに使える
template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}

//main code

int main(int argc, char *argv[])
{
	LL a,b,k;
	cin >> a >> b >> k;
	if (a+b <= k) {
		cout << "0 0" << endl;
	} else if (a >= k) {
		printf("%lld %lld", a-k, b);
	} else {
		printf("%lld %lld", 0LL, b - (k-a));
	}
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
 int K;
  cin>>K;
  vector<int64_t>A(K);
  for(int i=0;i<K;i++)
    cin>>A.at(i);
  int64_t left=1; int64_t right=1000000000000000000;
    while(1<right-left){
    int64_t mid=left+(right-left)/2;
      int64_t n=mid;
      for(int i=0;i<K;i++)
        n=(n/A.at(i))*A.at(i);
      if(2<=n)
        right=mid;
      else
        left=mid;
    }int64_t left1=1; int64_t right1=1000000000000000000;
    while(1<right1-left1){
    int64_t mid=left1+(right1-left1)/2;
      int64_t n=mid;
      for(int i=0;i<K;i++)
        n=(n/A.at(i))*A.at(i);
      if(3<=n)
        right1=mid;
      else
        left1=mid;
    }
  if(left1<right)
    cout<<-1<<endl;
    else
      cout<<right<<" "<<left1<<endl;
    return 0;
}


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

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

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2019/02/27  Problem: ABC 114 C / Link: http://abc114.contest.atcoder.jp/tasks/abc114_c  ----- */
/* ------問題------



-----問題ここまで----- */
/* -----解説等-----



----解説ここまで---- */

LL ans = 0LL;

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

	VL a; {
		int S = 1;
		FOR(i, 0, 9) {
			S *= 4;
		}
		VI digit({0, 3, 5, 7});
		FOR(state, 0, S) {
			VI used(4);
			int s = state;
			int num = 0;
			bool th = 1;
			FOR(i, 0, 9) {
				if (th && s%4==0) {
					;
				}
				else {
					used[s % 4] = 1; th = 0;
					num *= 10;
					num += digit[s % 4];
				}
				s /= 4;
			}
			if (!used[0]) {
				bool res = 1;
				FOR(i, 1, 4) {
					res &= used[i];
				}
				if (res) {
					a.push_back(num);
				}
			}
		}
	}

	SORT(a);
	LL N;
	cin >> N;

	ans = upper_bound(ALL(a), N) - a.begin();
	cout << ans << "\n";

	return 0;
}


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

#define lli long long int
#define REP(i,s,l) for(lli i=s;i<l;i++)
#define DEBUG 0
#define INF (1LL<<50)
#define MOD 1000000007

int main()
{
    string s, flag = "yes";
    cin >> s;
    set<char> scheck;

    for(lli i=0; i<s.length(); i++){
        if(scheck.find(s[i])==scheck.end()){
            scheck.insert(s[i]);
        }
        else{
            flag = "no";
        }
    }
    cout << flag << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <complex>
#include <algorithm>

using namespace std;

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

    unsigned long long sqrtN = (long)sqrt(n);
    
    unsigned int _quotient = 0;
    unsigned int _remainder = 0;
    for (int i = sqrtN; i > 0; --i) {
        if (n % i == 0) {
            _quotient = i;
            _remainder = n / i;
            break;
        }
    }

    int ans = max((int)log10(_quotient)+1, (int)log10(_remainder)+1);
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#!/usr/bin python3
# -*- coding: utf-8 -*-

from bisect import bisect_left, bisect_right

n, d, a = map(int, input().split())
x = []
xh = dict()
for _ in range(n):
    xi, hi = map(int, input().split())
    x.append(xi)
    xh[xi] = hi
x.sort()

l = 0
ret = 0
ai = [0] * (n+1)
anow = 0
while l < n:
    xl = x[l]
    hl = xh[xl]
    anow += ai[l]
    hl -= a * anow
    if hl > 0:
        r = bisect_right(x, xl+2*d)
        k = (hl+(a-1))//a
        ret += k
        anow += k
        ai[r] -= k
    l += 1
print(ret)


Measured memory_bytes: 41220
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,int> P;
const LL mod=1000000007;
const LL LINF=1LL<<62;
const LL INF=1<<17;

vector<LL> inv;

vector<vector<int>> combination(int n,int r,int k,vector<int> v){
    if(r==k){
        return vector<vector<int>> (1,v);
    }
    vector<vector<int>> ret;
    for(int i=(k==0?0:v[k-1]+1);i<=n-r+k;i++){
        v.push_back(i);
        auto p=combination(n,r,k+1,v);
        copy(ALL(p),back_inserter(ret));
        v.erase(v.end()-1);
    }
    return ret;
}


LL rec(int k,bool t,string s,vector<int> ss){
    if(k==s.length()&&!t) return 1;
    int x=s[k]-'0';
    int mx=t?x:9;
    LL res=0LL;
    if(t){
        for(int i=0;i<=mx;i++){
            if(ss[i]==0) continue;
            ss[i]--;
            res+=rec(k+1,t&&i==mx,s,ss);
            ss[i]++;
        }
    }
    else{
        res=inv[s.length()-k];
        for(int i=0;i<10;i++) res/=inv[ss[i]];
    }
    return res;
}


int main(){
    string s;cin >> s;
    int n=s.length();
    LL t0=1,sum0=0;
    for(int i=0;i<n;i++){
        t0*=s[i]-'0'+1;
        sum0+=s[i]-'0';
    }
    LL c=1;
    for(int i=1;i<16;i++){
        inv.pb(c);
        c*=i;
    }
    auto com=combination(n+9,9,0,vector<int> ());
    LL ans=0;
    for(int i=0;i<com.size();i++){
        com[i].pb(n+9);
        LL t=1,sum=0,k=inv[n]/inv[com[i][0]];
        vector<int> ss(10,0);
        ss[0]=com[i][0];
        for(int j=1;j<com[i].size();j++){
            LL x=com[i][j]-com[i][j-1]-1;
            sum+=x*j;
            k/=inv[x];
            ss[j]=x;
            while(x--) t*=j+1;
        }
        if(sum<sum0) ans+=k;
        else if(sum==sum0){
            if(t<t0) ans+=k;
            if(t==t0) ans+=rec(0,true,s,ss);
        }
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 85888
# -*- coding: utf-8 -*-

import sys
import os
import math


a, b, C = list(map(float, input().split()))
rad = math.radians(C)
S = 1/2 * a * b * math.sin(rad)

L2 = a ** 2 + b ** 2 - 2 * a * b * math.cos(rad)
L = math.sqrt(L2)
around = a + b + L

h = b * math.sin(rad)

print(S)
print(around)
print(h)

Measured memory_bytes: 7740
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<map>
#include<algorithm>
using namespace std;
const long long maxv=10000000000ll;
map <long long,int> cnt;
long long a[101010];
int prime[3030],np;
bool vis[3030];
void findprime()
{
	memset(vis,0,sizeof(vis));
	np=0;
	for(int i=2;i<=2333;i++)
	{
		if(!vis[i])
			prime[++np]=i;
		for(int j=1;j<=np&&i*prime[j]<=2333;j++)
		{
			vis[i*prime[j]]=true;
			if(i%prime[j]==0)
				break;
		}
	}
}
long long findr(long long x)
{
	long long h;
	for(int i=1;i<=np;i++)
	{
		h=prime[i]*prime[i]*prime[i];
		if(h>x)
			break;
		while(x%h==0)
			x/=h;
	}
	return x;
}
long long findto(long long x)
{
	long long reta=1,retb=1;
	int h=0;
	for(int i=1;i<=np;i++)
	{
		h=prime[i]*prime[i]*prime[i];
		if(h>x)
			break;
		h=0;
		while(x%prime[i]==0)
		{
			h++;
			x/=prime[i];
		}
		if(h==1)
			reta*=prime[i];
		else if(h==2)
			retb*=prime[i];
	}
	long long hh=(long long)(sqrt(x)+0.5);
	if(hh*hh==x)
		retb*=hh;
	else
		reta*=x;
	long long ret=reta*retb;
	if(maxv/reta<ret)
		return -1;
	return ret*reta;
}
long long r[101010],to[101010];
int main()
{
	int n;
	int ans=0;
	findprime();
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%lld",&a[i]);
	cnt.clear();
	for(int i=1;i<=n;i++)
	{
		r[i]=findr(a[i]);
		to[i]=findto(r[i]);
		if(to[i]==-1)
		{
			r[i]=to[i];
			ans++;
		}
		else
		{
			cnt[r[i]]++;
			if(r[i]==to[i]&&cnt[r[i]]==1)
				ans++;
		}
	}
	for(int i=1;i<=n;i++)
		if(r[i]!=to[i])
		{
			ans+=max(cnt[r[i]],cnt[to[i]]);
			cnt[r[i]]=0;
			cnt[to[i]]=0;
		}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 12928
#include <iostream>

using namespace std;

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

int a[100010];

int main() {
    int N, K;
    cin >> N >> K;
    rep(i, N)cin >> a[i];

    int cou = 0;
    cou += (N - 1) / (K - 1);
    if (((N - 1)) % (K - 1) != 0)cou++;
    cout << cou << endl;
}

Measured memory_bytes: 640
#include<iostream>
#include<cstring>
using namespace std;
char s[5];
int main() 
{
    cin>>s+1;
    if((s[1]==s[2])&&(s[3]==s[4])&&(s[1]!=s[3])||(s[1]==s[4])&&(s[2]==s[3]&&(s[1]!=s[2]))||(s[1]==s[3])&&(s[2]==s[4])&&(s[1]!=s[2]))
        cout<<"Yes";
    else
        cout<<"No";
    return 0;
}

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

#define int long long
#define ll long long
#define pb push_back
#define mp make_pair
#define f(i,a,n) for(int i=a ; i<(int)n ; i++)
#define rf(i,n,a) for(int i=n ; i>=a ; i--)
#define F first
#define S second
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()
#define fast ios:: sync_with_stdio(false),cin.tie(nullptr);

typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef vector<pii> vpi;

const int inf = 1e9;
const int inf64 = 1e18;
const int MOD = inf + 7;

int32_t main(){
   fast;
   int ok = true;
   int x = 0 , y = 0 , t = 0;
   int n;
   cin >> n;
   f(i,0,n){
      int nt,nx,ny;
      cin >> nt >> nx >> ny;
      int have = nt - t;
      int need = abs(x - nx) + abs(y - ny);

      if(have < need || (have - need) % 2 != 0) ok = false;
      t = nt , x = nx , y = ny;
   }
   cout << (ok ? "Yes" : "No") << "\n";
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
 
////////////// Prewritten code follows. Look down for solution. ////////////////

#define fs first
#define sc second
#define pb push_back
#define mp(a, b) make_pair(a, b)
#define len(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

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

template<typename T>
const T INF = (is_same<T, int>::value ? 1e9 : 1e18);
template<typename T>
inline T mod(T n, T mod){ T res = n%mod; if(res < 0) res += mod; return res; }

/// command for char arrays with spaces -> scanf(" %[^\n]", text);
 
////////////////////////// Solution starts below. //////////////////////////////

int main(){
	fastio;
	string s;
	cin >> s;
	for(int i = 0; i < len(s); i++) s[i] = 'x';
	cout << s << endl;	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define ALL(a)    a.begin(), a.end() 
#define rep(i, K, N)  for(long long int i = K; i <= N; i++)
#define ll long long int
using namespace std;

ll Ans = 0;
map<ll, ll> A;map<ll, ll> B;
vector<ll> V;

void devisorA(ll m){
    
    rep(i, 1, sqrtl(m)){

        if(m%i == 0){

        A[i]++;A[m/i]++;

        }

    }

}

void devisorB(ll m){
    
    rep(i, 1, sqrtl(m)){

        if(m%i == 0){

        B[i]++;B[m/i]++;

        }

    }

}

void prime_judge(ll n){

bool C = 1;

    rep(i, 2, sqrtl(n)){

        if(n%i == 0){C = 0;break;}

    }

if(C)Ans++;

}

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

devisorA(a);devisorB(b);

for(auto x : A ){

    if(min(x.second, B[x.first]) == 0)continue;

    V.push_back(x.first);

}
  
  //for(auto x : B )cout << x.first << " " << x.second;

rep(i, 0, V.size() - 1)prime_judge(V[i]);

cout << Ans;

}

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

int main(){
  int N,sum=0,maximize=0,res;
  cin >> N;
  for(int i=1;i<=N;i++){
    int j=i;
    sum = 0;
    while(j%2==0){
      j=j/2;
      sum++;
    }
    if(sum>=maximize){
      maximize = sum;
      res = i;
    }
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
  int N, X;
  scanf("%d%d", &N, &X);
  int min = 100000,
      rest = X,
      ans = N;
  for(int i = 0; i < N; i++){
    int m;
    scanf("%d", &m);
    rest -= m;
    if(m < min)
      min = m;
  }
  ans += rest/min;
  printf("%d\n", ans);
}


Measured memory_bytes: 128
#include <iostream>
#include <cctype>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <string>
#include <functional>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <bitset>
#define pb push_back 
#define YES cout<<"YES"<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define No cout<<"No"<<endl
#define INF (1<<30)
#define LLINF (1<<60)
#define MOD 1000000007
#define rep(i, n) for(int i=0;i<n;i++)
using ll = long long;
using namespace std;

int n, x, dist[100005];

int gcd(int a, int b) {
    if (b > 0) {
        gcd(b, a%b);
    }
    else if (b == 0) {
        return a;
    }
}
int main() {
    cin >> n >> x;
    for (int i = 0; i < n; i++) {
        int t;
        cin >> t;
        dist[i] = abs(t - x);
    }
    for (int i = 0; i < n-1; i++) {
        dist[i+1]=gcd(dist[i], dist[i+1]);
    }
    cout << dist[n-1] << endl;
    return 0;
}


Measured memory_bytes: 640