akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define ALL(a) (a).begin(),(a).end()
#define DEBUG(a) "(" << #a << ": " << (a) << ")"

template<typename T>
void chmin(T &x, T y) { x = min(x, y); }

template<typename T>
void chmax(T &x, T y) { x = max(x, y); }

typedef long long int lli;
typedef long double ld;
typedef tuple<int,int,int> Tr;

const int INF = INT_MAX/2 - 1;
const double EPS = 1e-14;
const int dx[4] = {0, 1, 0, -1}; // {-1,  0,  1, -1, 1, -1, 0, 1};
const int dy[4] = {1, 0, -1, 0}; // {-1, -1, -1,  0, 0,  1, 1, 1};

int main() {
  cout << fixed << setprecision(10);
  int N, M;
  while (cin >> N >> M and N) {
    vector<Tr> data;
    REP(i, M) {
      int t, s, d;
      cin >> t >> s >> d;
      data.emplace_back(t, --s, --d);
    }
    sort(ALL(data));
    vector<bool> infected(N);
    infected[0] = true;
    for (Tr datum : data) {
      int s, d;
      tie(ignore, s, d) = datum;
      if (infected[s]) infected[d] = true;
    }
    int ans = 0;
    for (bool b:infected) if (b) ans++;
    cout << ans << endl;

  }
  return 0;
}

Measured memory_bytes: 3376
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

int main(){
  int n;
  cin >> n;
  vector<int> al(n);
  ll ave = 0;
  rep(i, n){
    int in;
    cin >> in;
    al.at(i) = in - (i+1);
    ave += al.at(i);
  }
  sort(al.begin(), al.end());

  // ave = (ave)/n;
  // ll avep = ave+1, avem = ave-1;
  // ll ans = 0;
  // rep(i, n){
  //   ans += abs(al.at(i) - ave);
  // }

  // ll add = 0;
  // rep(i, n){
  //   add += abs(al.at(i) - avep);
  // }
  // ans = min(ans, add);

  // add = 0;
  // rep(i, n){
  //   add += abs(al.at(i) - avem);
  // }
  // ans = min(ans, add);

  ll mid = al.at(n/2);
  ll ans = 0;
  rep(i, n){
    ans += abs(al.at(i) - mid);
  }
  if(n % 2 == 0){
    mid = al.at(n/2+1);
    ll add = 0;
    rep(i, n){
      add += abs(al.at(i) - mid);
    }
    ans = min(ans, add);
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=2e5+5;
set<int>s;
int main()
{
    int n,m,k=0,x,y,p=0;
    scanf("%d%d",&n,&m);
    for(int i=0;i<m;i++)
    {
        scanf("%d%d",&x,&y);
        if(x==1) s.insert(y),k++;
        if(y==n) s.insert(x),k++;
    }
    if(s.size()==k)
    printf("IMPOSSIBLE\n");
    else printf("POSSIBLE\n");
}


Measured memory_bytes: 9600
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,a[10],b[10],c[10],l=0,flag,ans1=-1,ans2;
	scanf("%d",&n);
	for(int i=0;i<n;i++)scanf("%d",&b[i]);
	for(int i=0;i<n;i++)scanf("%d",&c[i]);
	for(int i=0;i<n;i++)a[i]=i+1;
	while(1)
	{
		flag=0;
		for(int i=0;i<n;i++)
		{
			if(a[i]!=b[i])
			{
				flag=1;
				break;
			}
		}
		if(flag==0)
		{
			if(ans1==-1)ans1=l;
			else
			{
				ans2=l;
				break;
			}
		}
		flag=0;
		for(int i=0;i<n;i++)
		{
			if(a[i]!=c[i])
			{
				flag=1;
				break;
			}
		}
		if(flag==0)
		{
			if(ans1==-1)ans1=l;
			else
			{
				ans2=l;
				break;
			}
		}
		l++;
		next_permutation(a,a+n);
	}
	printf("%d\n",abs(ans1-ans2));
}

Measured memory_bytes: 256
/* � Ashiq Uddin Pranto
   Department of Computer Science and Engineering
   BATCH 27
   University Of Rajshahi,Bangladesh
*/
#include<bits/stdc++.h>

#define ll long long
#define ld long double
#define FOR(x,y) for(ll i=x;i<=y;i++)
#define pb(x) push_back(x)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define matrix(x) vector<vector<x>>
#define vss vector<string>
#define PI (2*acos(0.0))
#define sqr(x) ((x)*(x))
#define sf(a)   scanf("%d",&a)
#define sfl(a)  scanf("%lld",&a)
#define sff(a,b)    scanf("%d %d",&a,&b)
#define sffl(a,b)   scanf("%lld %lld",&a,&b)
#define sfff(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define sfffl(a,b,c)    scanf("%lld %lld %lld",&a,&b,&c)
#define ms(a,b) memset(a, b, sizeof(a))
#define ff  first
#define ss  second
#define lcm(a, b)   ((a)*((b)/__gcd(a,b)))
#define all(a)  a.begin(),a.end()
#define readfile freopen("input.txt","r",stdin);
#define writefile freopen("output.txt","w",stdout);
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define gap " "
#define mx 104
#define inf (ll)1e9
#define WHITE 1
#define GRAY 2
#define BLACK 3
#define EMPTY_VALUE -1
#define mod 1000000007
#define MOD(a,b) (a%b + b)%b

using namespace std;

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


int main()
{
    //fastio
    string s;
    cin>>s;
    if(s[0]=='R' && s[1]=='R' && s[2]=='R')
    {
        printf("3\n");
    }
    else if((s[0]=='R' && s[1]=='R')||(s[1]=='R'&&s[2]=='R'))
    {
        printf("2\n");
    }
    else if(s[0]=='R'|| s[1]=='R'||s[2]=='R') printf("1\n");
    else printf("0\n");

    return 0;
}

Measured memory_bytes: 3576
import java.util.*;
public class Main{
public static void main(String[] args){
  Scanner sc=new Scanner(System.in);
  int x1=sc.nextInt(),x2=sc.nextInt(),x3=sc.nextInt(),x4=sc.nextInt(),x5=sc.nextInt();
if(x1==0){
System.out.print(1);
}else if(x2==0){
System.out.print(2);
}else if(x3==0){
System.out.print(3);
}
 else if(x4==0){
System.out.print(4);
 }else if(x5==0){
   System.out.print(5);
 }
}}

Measured memory_bytes: 35744
#include"bits/stdc++.h"
using namespace std;
using ll=long long;
template<class T=ll>inline T in(istream&is=cin){T ret;is>>ret;return ret;}
template<class T,class Size=typename vector<T>::size_type>inline auto vector_2d(Size h,Size w,T v){return vector<vector<T>>(h,vector<T>(w,v));}
template<class RandomAccessIterator,class Pair=typename iterator_traits<RandomAccessIterator>::value_type>inline void sort_pairs_by_second(RandomAccessIterator first,RandomAccessIterator last){sort(first,last,[](const Pair&p1,const Pair&p2){return p1.second<p2.second||(p1.second==p2.second&&p1.first<p2.first);});}

int main()
{
    ll n=in(),x=in(),t=in();
    cout<<(n+x-1)/x*t<<endl;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
using namespace __gnu_pbds;
using namespace std;
 
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
typedef long long ll;
typedef long double ld;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll a;
    cin >> a;
    string s;
    cin >> s;
    if (a >= 3200) cout << s << endl;
    else cout << "red" << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main{
    public static void main(String[] args){
        int x;
        //?¨??????\??????????????????????????§????????????
    	Scanner scanner = new Scanner(System.in);
    	//??\????????????int??????????????????
    	x = scanner.nextInt();
        System.out.println(x*x*x);
    }
}

Measured memory_bytes: 25964
#include <iostream>
#include <cstdlib>
#include <vector>
#include <cmath>
using namespace std;
int main()
{
    vector<int> dice;
    int n, a, b, num;
    dice.resize(6);
    cin >> dice[0] >> dice[1] >> dice[2] >> dice[3] >> dice[4] >> dice[5] >> n;
    for (int i=0; i<n; ++i){
        cin >> a >> b;
        if (a == dice[0]){
            if(b == dice[1]){num = dice[2];}
            else if(b == dice[2]){num = dice[4];}
            else if(b == dice[3]){num = dice[1];}
            else if(b == dice[4]){num = dice[3];}
        }
        else if(a == dice[1]){
            if(b == dice[0]){num = dice[3];}
            else if(b == dice[2]){num = dice[0];}
            else if(b == dice[3]){num = dice[5];}
            else if(b == dice[5]){num = dice[2];}
        }
        else if(a == dice[2]){
            if(b == dice[0]){num = dice[1];}
            else if(b == dice[1]){num = dice[5];}
            else if(b == dice[4]){num = dice[0];}
            else if(b == dice[5]){num = dice[4];}
        }
        else if(a == dice[3]){
            if(b == dice[0]){num = dice[4];}
            else if(b == dice[1]){num = dice[0];}
            else if(b == dice[4]){num = dice[5];}
            else if(b == dice[5]){num = dice[1];}
        }
        else if(a == dice[4]){
            if(b == dice[0]){num = dice[2];}
            else if(b == dice[2]){num = dice[5];}
            else if(b == dice[3]){num = dice[0];}
            else if(b == dice[5]){num = dice[3];}
        }
        else if(a == dice[5]){
            if(b == dice[1]){num = dice[3];}
            else if(b == dice[2]){num = dice[1];}
            else if(b == dice[3]){num = dice[4];}
            else if(b == dice[4]){num = dice[2];}
        }
        cout << num << endl;
    }
    return 0;
}



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

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

    int n;
    cin >> n;
    int v[23], c[23];
    for(int i = 0;  i < n; i++){
        cin >> v[i];
    }
    for(int i = 0; i < n; i++){
        cin >> c[i];
    }
    int ans = 0;
    for(int i = 0; i < n; i++){
        if(v[i] - c[i] > 0){
            ans += (v[i] - c[i]);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import math
n, k = map(int, input().split())
per_pro = 1/n
total = 0
if n >= k:
  total += per_pro * (n-k+1)
if n < k:
  for i in range(1, n+1):
    a = math.ceil(math.log(k/i, 2))
    total += per_pro * (1/2)**a
else:
  for i in range(1, k):
    a = math.ceil(math.log(k/i, 2))
    total += per_pro * (1/2)**a
print(total)

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

using namespace std;

int main () {
    int n;
    cin >> n;
    
    vector <long long int> arr(n);
    for (int i = 0; i < n; i ++) {
        cin >> arr[i];
    }
    
    sort(arr.begin(), arr.end());
    for (int i = 0; i < n-1; i ++) {
        if (arr[i] == arr[i+1]) {
            cout << "NO";
            return 0;
        }
    }
    
    cout << "YES";
    
    return 0;
}

Measured memory_bytes: 1792
[input_n, input_m] = map(int, input().split())

input_ks = [list(map(int, input().split())) for i in range(input_m)]
input_p = list(map(int, input().split()))

switch_list = [[bool(i & 2 ** j) for j in range(input_n)]
               for i in range(2 ** input_n)]

count = len(switch_list)
for switch in switch_list:
    for m in range(input_m):
        if ((sum(switch[l - 1] for l in input_ks[m][1:])-input_p[m]) % 2):
            count -= 1
            break
print(count)


Measured memory_bytes: 3188
import numpy as np

def main():
	A, B, X = [int(x) for x in input().split()]

	if (A * A * B) / 2.0 >= X:
		y = (2 * X) / (A * B)
		R = np.arctan(y / B)
		print(90 - np.rad2deg(R))
	else:
		_x = (A * A * B) - X
		y = (2 * _x) / (A * A)
		try:
			R = np.arctan(A / y)
			print(90 - np.rad2deg(R))
		except:
			print(0.000000000)
		
	
if __name__ == "__main__":
	main()


Measured memory_bytes: 21312
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define ll          long long
#define pb          push_back
#define INF         9223372036854775807
#define    endl        '\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)    for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define lower(u)    transform(u.begin(), u.end(), u.begin(), ::tolower);//convert string u to lowercase;
#define upper(u)    transform(u.begin(), u.end(), u.begin(), ::toupper);
using namespace std;

using namespace __gnu_pbds; 
  
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define N  1000005

void solve()
{
    ll n;
    cin>>n;
    ll dp[N];
    vi v;
    rep(i,1,100)
    {
        v.pb(i*i);
    }
    rep(i,1,100)
    {
        rep(j,1,100)
        {
            rep(k,1,100)
            {
                dp[i*i+j*j+k*k+i*j+j*k+i*k]++;
            }
        }
    }
    rep(i,1,n+1)
    {
        cout<<dp[i]<<endl;
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int TESTS=1;
//    cin>>TESTS;
    while(TESTS--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 4112
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
int n;
int a[100005], f[100005];
int main() {
    scanf("%d", &n);
    for (int i = 1; i <= n; ++i)
        scanf("%d", &a[i]), a[i] = -a[i];
    int r = 1; f[r] = a[1];
    for (int i = 2; i <= n; ++i) {
        if (a[i] >= f[r]) 
            f[++r] = a[i];
        else {
            *lower_bound(f + 1, f + 1 + r, a[i] + 1) = a[i];
        }
    }
    printf("%d\n", r);
    return 0;
}

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

#define rep(i,j) for(int i=0;i<(j);i++)
#define reps(i,j,k) for(int i=(j);i<(k);i++)
#define fs first
#define sc seconf
#define pb push_back

using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;

int main(){
	int n;
	while(cin>>n,n){
		int cnt=0;
		rep(i,n){
			if(!i)continue;
			int t=0;
			reps(j,i,n+1){
				if(t>=n)break;
				t += j;
			}
			if(t==n)cnt++;
		}
		cout << cnt << endl;
	}
	return 0;
}

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

int main() {
  int a,b;
  cin>>a>>b;
  vector<int> c(10);
  rep(i,10) c.at(i)=b*10+i;
  int ans=0;
    
  rep(i,10){
    if(c.at(i)*8/100==a){
      ans=c.at(i);
      break;
    }
  }
  
  if(ans==0){
    cout<<-1<<endl;
  }
  else{
    cout<<ans<<endl;
  }
  
  
  
}

Measured memory_bytes: 256
use std::io::stdin;
use std::time::SystemTime;

#[allow(dead_code)]
fn read_line() -> String {
    let mut s = String::new();
    stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

#[allow(dead_code)]
fn read<T>() -> T
where T: std::str::FromStr
{
    read_line().parse::<T>().ok().unwrap()
}

#[allow(dead_code)]
fn read_vec<T>() -> Vec<T>
where T: std::str::FromStr
{
    read_line().split(" ").map(|n| n.parse::<T>().ok().unwrap()).collect()
}

#[allow(dead_code)]
fn read_chars() -> Vec<char>
{
    read_line().chars().collect()
}

#[allow(dead_code)]
fn print_time() -> () {
    println!("{:?}", SystemTime::now());
}

#[allow(unused_variables)]
fn main() {
    let nk: Vec<usize> = read_vec();
    let l: Vec<usize> = read_vec();
    let mut dp = vec![1000000000; nk[0]];
    dp[0] = 0;
    
    let min = |x, y| {
        if x < y {
            x
        } else {
            y
        }
    };
    
    let abs = |x, y| {
        if x < y {
            y - x
        } else {
            x - y
        }
    };
    
    for i in 0..nk[0] {
        for k in 0..nk[1] + 1 {
            if i + k < nk[0] {
                dp[i + k] = min(dp[i + k], dp[i] + abs(l[i], l[i + k]));
            }
        }
    }
    
    println!("{}", dp.last().unwrap());
    
}

Measured memory_bytes: 6396
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(int i = 0; i < x; i++)
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
const ll MOD = 1e9+7;
const int n_max = 1e5+10;

int main(){
    ll n; cin >> n;
    vector<ll> p(n), arr(n);
    rep(i,n){
        ll p[i]; cin >> p[i];
        arr[p[i] - 1] = i;
    }

    ll temp = 0, ans = 0;
    rep(i,n){
        if(!i){
            temp++;continue;
        }
        if(arr[i] > arr[i-1]){
            temp++;
        }
        else{
            ans = max(temp, ans);
            temp = 1;
        }
    }
    ans = max(ans, temp);

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

Measured memory_bytes: 4992
#include <bits/stdc++.h>
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 SZ(x) ((int)(x).size())
#define fi first
#define se second
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
const ll mod=998244353;
ll powmod(ll a,ll b) {ll res=1;a%=mod;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 a,b,c,d;
ll dp[3010][3010];
int main() {
	scanf("%d%d%d%d",&a,&b,&c,&d);
	for (int x=a;x<=c;x++) for (int y=b;y<=d;y++) {
		if (x==a&&y==b) dp[x][y]=1;
		else {
			dp[x][y]=(x*dp[x][y-1]+y*dp[x-1][y]-(x-1)*(y-1)*dp[x-1][y-1])%mod;
		}
	}
	if (dp[c][d]<0) dp[c][d]+=mod;
	printf("%lld\n",dp[c][d]);
}

Measured memory_bytes: 74388
#include<stdio.h>
#define MAX 10000
#define NIL -1

typedef struct N {
  int parent, left, right;
} Node;

Node T[MAX];
int n, D[MAX], H[MAX];

void setDepth(int u, int d){
  if( u == NIL ) return;
  D[u] = d;
  setDepth( T[u].left, d+1);
  setDepth( T[u].right, d+1);
}

int setHeight(int u){
  int h1 = 0, h2 = 0;
  if( T[u].left != NIL )
    h1 = setHeight(T[u].left) + 1;
  if( T[u].right != NIL )
    h2 = setHeight(T[u].right) + 1;
  return H[u] = ( h1 > h2 ? h1 : h2 );
}

int getSibling(int u){
  if( T[u].parent == NIL ) return NIL;
  if( T[T[u].parent].left != u && T[T[u].parent].left != NIL )
    return T[T[u].parent].left;
  if( T[T[u].parent].right != u && T[T[u].parent].right != NIL )
    return T[T[u].parent].right;
  return NIL;
}

void print(int u){
  printf("node %d: ", u);
  printf("parent = %d, ", T[u].parent);
  printf("sibling = %d, ", getSibling(u));
  int deg = 0;
  if( T[u].left != NIL ) deg++;
  if( T[u].right != NIL ) deg++;
  printf("degree = %d, ", deg);
  printf("depth = %d, ", D[u]);
  printf("height = %d, ", H[u]);

  if( T[u].parent == NIL ){
    printf("root\n");
  }
  else if( T[u].left == NIL && T[u].right == NIL ){
    printf("leaf\n");
  }
  else printf("internal node\n");
}

int main(){
  int i, v, l, r, root = 0;

  scanf("%d", &n);

  for( i = 0 ; i < n ; i++ ) T[i].parent = NIL;

  for( i = 0 ; i < n ; i++ ){
    scanf("%d %d %d", &v, &l, &r);
    T[v].left = l;
    T[v].right = r;
    if( l != NIL ) T[l].parent = v;
    if( r != NIL ) T[r].parent = v;
  }

  for( i = 0 ; i < n ; i++ ){
    if( T[i].parent == NIL ) root = i;
  }

  setDepth(root, 0);
  setHeight(root);

  for( i = 0 ; i < n ; i++ ) print(i);

  return 0;
}



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



struct modCalc{
	int mod;
	int n;
	vector<int> fact,invfact;
	modCalc(){};

	modCalc(int _mod,int _n){
		mod=_mod,n=_n;
		fact.resize(n+1,1);
		invfact.resize(n+1,1);

		for(int i=0;i<n;i++)fact[i+1]=fact[i]*(i+1)%mod;
		invfact[n]=modinv(fact[n]);
		for(int i=n;i>1;i--)invfact[i-1]=invfact[i]*i%mod;
	};

	int modpow(int x,int n){
		int ret=1;
		while(n>0){
			if(n&1)(ret*=x)%=mod;
			(x*=x)%=mod;
			n>>=1;
		}
		return ret;
	}
	int modinv(int x){
		return modpow(x,mod-2);
	}
	int nCm(int x,int y){
		if(y==0)return 1;
		else return fact[x]*invfact[y]%mod*invfact[x-y]%mod;
	}
	int nPm(int x,int y){
		return fact[x]*invfact[x-y]%mod;
	}
};

	int n,a,b,c;
	int mod=1e9+7;

int prbM(int m){
	static modCalc mc(mod,max(2*n,100ll));
	int inv100=mc.modinv(100);
	int a0=a*mc.modinv(a+b)%mod;
	int b0=b*mc.modinv(a+b)%mod;
	int ret1=mc.nCm(m-1,n-1)*m %mod *(mc.modpow(a0,n)*mc.modpow(b0,m-n) %mod +mc.modpow(b0,n)*mc.modpow(a0,m-n)%mod)%mod;
	return ret1 *100 %mod * mc.modinv(100-c) % mod;

}


signed main() {
	cin>>n>>a>>b>>c;
	int ret=0;
	for(int m=n;m<=2*n-1;m++){(ret+=prbM(m))%=mod;}
	cout<<ret<<endl;



}


Measured memory_bytes: 3328
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
long long n,f[100001][5],l=0,r,mid,a[1000001],b[100001],c[100001];
int main()
{
    scanf("%lld",&n);
    for(int j=1;j<=n;++j)
        scanf("%lld",&a[j]);
        for(int j=1;j<=n;++j)
        scanf("%lld",&b[j]);
        for(int j=1;j<=n;++j)
        scanf("%lld",&c[j]);
    sort(a+1,a+1+n);sort(b+1,b+1+n);sort(c+1,c+1+n);
    for(int i=1;i<=n;++i)
    {
        f[i][1]=i;
    }
    for(int j=1;j<=n;++j)
        {
            l=1,r=n;
            while(l<=r)
            {
                mid=(l+r)/2;
                if(b[j]<=a[mid])
                {
                    r=mid-1;
                }
                else
                l=mid+1;
            }
            f[j][2]=f[j-1][2]+f[r][1];
        }
    for(int j=1;j<=n;++j)
        {
            l=1,r=n;
            while(l<=r)
            {
                mid=(l+r)/2;
                if(c[j]<=b[mid])
                {
                    r=mid-1;
                }
                else
                l=mid+1;
            }
            f[j][3]=f[j-1][3]+f[r][2];
        }
    printf("%lld",f[n][3]);
    return 0;
}

Measured memory_bytes: 9472
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
using namespace std;
typedef long long int ll;

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; PPPPP(__VA_ARGS__); cerr << endl; } while(false)
template<typename T> void PPPPP(T t) { cerr << t; }
template<typename T, typename... S> void PPPPP(T t, S... s) { cerr << t << ", "; PPPPP(s...); }
#else
#define dump(...)
#endif
template<typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
template<typename T>
bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false;}
template<typename T>
bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false;}
// clang-format on

#include <iomanip>

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<double> p(n);
    REP(i, 0, n) {
        cin >> p[i];
    }
    sort(p.begin(), p.end());
    double prev = (p[0] + p[1]) / 2;
    REP(i, 2, n) {
        prev = (prev + p[i]) / 2;
    }
    cout << fixed << setprecision(10) << prev << endl;
    return 0;
}


Measured memory_bytes: 256
A=int(input())
B=int(input())
C=int(input())
X=int(input())
a=0
for i in range(0,A+1):
    for j in range(0,B+1):
        for k in range(0,C+1):
            if i*500+j*100+k*50==X:
                a+=1
print(a)

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

int main() {
    int N; cin >> N;
    vector< vector<int> > F(N, vector<int>(10));
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < 10; j++) {
            cin >> F[i][j];
        }
    }
    vector< vector<int> > P(N, vector<int>(11));
    for (int i = 0; i < N; i++) {
        for (int j = 0; j <= 10; j++) {
            cin >> P[i][j];
        }
    }
    int ans = -1000000000;
    int tmp;
    for (int i = 1; i < (1<<10); i++) {
        tmp = 0;
        for (int j = 0; j < N; j++) {
            int memo = 0;
            for (int k = 0; k < 10; k++) {
                if (((i>>k)&1) && F[j][k]) {
                    memo++;
                }
            }
            tmp += P[j][memo];
        }
        ans = max(ans, tmp);
    }
    cout << ans << endl;
}


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

int allwa(int n){
	int o = 0;
	for(int i = 1; i <= n; i++)o+=i;
	return o;
}

int main(){
	/*input*/
	int a, b;	cin >> a >> b;
	/*calculation*/
	int ans = 0;
	ans = allwa(b - a) - b;
	/*output*/
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>
using namespace std;

void solve(const vector<int>& as)
{
    int sum = 0;
    for (auto& a : as) {
        sum += a;
    }
    // cout << "sum: " << sum / 2.0 << endl;

    int n = as.size();

    // if (n >= 50) {
    //     cout << (sum + 1) / 2 << endl;
    //     return;
    // }

    bitset<4000001> s, t;
    s[0] = true;
    for (auto& a : as) {
        t = s | (s << a);
        swap(s, t);

        // for (int i = 0; sum - a - i >= 0; i++) {
        //     s[sum - i] |= s[sum - i - a];
        // }
    }

    // // vector<int> s(4000001);

    // s[0] = 1;
    // for (auto& a : as) {

    //     for (int i = 0; sum - a - i >= 0; i++) {
    //         s[sum - i] |= s[sum - i - a];
    //     }
    // }

    auto cand = (sum + 1) / 2;

    for (;;) {
        if (s[cand] > 0) {
            cout << cand << endl;
            return;
        }
        cand++;
    }

    // int64_t acc = 0;
    // for (int i = 1; i < s.size(); i++) {
    //     acc += s[i];
    //     if (acc >= (1L << (n - 1))) {
    //         cout << "* " << (sum + 1) / 2 << endl;
    //         cout << i << endl;
    //         // assert((sum + 1) / 2 == i);
    //         return;
    //     }
    // }
}

int main()
{
    if (0) {
        srand(time(nullptr));
        for (int i = 0; i < 1; i++) {
            int n = 2000;
            vector<int> as(n);
            for (auto& a : as) {
                a = rand() % 2000 + 1;
            }
            solve(as);
        }
        return 0;
    }

    cin.tie(0);

    int n;
    cin >> n;
    vector<int> as(n);
    for (auto& a : as)
        cin >> a;

    solve(as);

    return 0;
}


Measured memory_bytes: 2296
fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)
fun <T> Array<Array<T>>.print() {
    this.forEach {
        println(it.joinToString(" "))
    }
}

fun main() {
    var x = readInt()
    var res = 0
    while (x >= 500) {
        res += 1000
        x -= 500
    }

    while (x >= 5) {
        res += 5
        x -= 5
    }

    println(res)
}

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

using namespace std;

int main()
{
//    freopen("TEST.INP", "r", stdin);
//    freopen("TEST.OUT", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    int t;
    cin >> t;
    while (t)
    {
        if (t % 10 == 7)
        {
            cout << "Yes";
            return 0;
        }
        t /= 10;
    }
    cout << "No";
    return 0;
}


Measured memory_bytes: 3652
s=input()
t=[0]*len(s)
p=0
for i in range(len(s)):
    if s[i]=="R":
        p+=1
    else:
        if p%2==0:
            t[i-1]+=p//2
            t[i]+=p//2
        else:
            t[i-1]+=p//2+1
            t[i]+=p//2
        p=0
t=t[::-1]
s=s[::-1]
for i in range(len(s)):
    if s[i]=="L":
        p+=1
    else:
        if p%2==0:
            t[i-1]+=p//2
            t[i]+=p//2
        else:
            t[i-1]+=p//2+1
            t[i]+=p//2
        p=0
print(*t[::-1])

Measured memory_bytes: 6504
import copy
a, b, n = list(map(int, input().split()))
m = [int(input()) for _ in range(n)]

def dec1(n):
    return n - 1

p = [b-n]*a
p1 = copy.deepcopy(p)
for i, name in enumerate(m):
    p1[name-1] += 1

for i, name in enumerate(p1):
    if name <= 0:
        print("No")
    else:
        print("Yes")

Measured memory_bytes: 58328
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int top, S[1000];

void push(int x){
    //topを加算してからその位置へ挿入
    S[++top]=x;
}

int pop(){
    top--;
    //topが差していた要素を返す
    return S[top+1];
}

int main(){
    int a,b;
    top =0;
    char s[100];
    while(scanf("%s", s) != EOF){
        if(s[0] == '+'){
            a= pop();
            b= pop();
            push(a+b);
        }else if(s[0] == '-'){
            b = pop();
            a = pop();
            push(a-b);
        }else if(s[0] == '*'){
            a = pop();
            b = pop();
            push(a*b);
        } else {
            push(atoi(s));
        }
    }
    printf("%d\n", pop());
    return 0;
}


Measured memory_bytes: 2096
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;

namespace ABC121A_WhiteCells
{
    class Program
    {
        static void Main(string[] args)
        {
#if Local
            var sw = new Stopwatch();
            sw.Start();
            Console.SetIn(new StreamReader("input.in"));
#endif

            var solver = new Solver();
            solver.Solve();
#if Local
            Console.WriteLine($"{sw.ElapsedMilliseconds}ms");
#endif
        }
    }

    class Solver
    {
        public void Solve()
        {
            var input1 = Console.ReadLine().Split(' ').Select(elem => int.Parse(elem)).ToArray();
            var row = input1[0];
            var column = input1[1];

            var input2 = Console.ReadLine().Split(' ').Select(elem => int.Parse(elem)).ToArray();
            var selectedRow = input2[0];
            var selectedColumn = input2[1];

            row -= selectedRow;
            column -= selectedColumn;

            var answer = row * column;
            Console.WriteLine(answer);
        }
    }
}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64
#define rep(i, n) for(int i=0; i<n; i++)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mk make_pair
#define fi first
#define se second
#define pb push_back
#define ALL(x) x.begin(), x.end()
#define V(T) vector<T>
typedef pair<int, int> P;
typedef pair<P, P> PP;
typedef vector<int> vi;
typedef vector<vi> vvi;
int max(int a, int b) {if(b>a) return b; else return a;}
int min(int a, int b) {if(b<a) return b; else return a;}

bool cmp(P a, P b) {
    return a.second < b.second;
}


signed main() {
    int N;
    cin >> N;
    vector<P> vec(N);
    rep(i, N) {
        int a;
        cin >> a;
        vec[i] = P(i, a);
    }
    sort(ALL(vec), cmp);

    vi res(N);
    rep(i, N) {
        res[vec[i].second-1] = vec[i].first+1; 
    }

    rep(i, N) cout << res[i] << " ";
    cout << endl;

    return 0;
}

Measured memory_bytes: 3200
#include<bits/stdc++.h>
#include<vector>
#include<iterator>
#include<deque>
#include<algorithm>
using namespace std;
#define rep(i,n) for(int i = 0; i <(n) ; i++)
#define rep2(i,s,n) for(long long i = (s); i(n) ; i++)
#define ll long long


int main(){
  ll H;
  cin >>H;
  ll tree = 1;
  ll count = 1;
  while(H>1){
   H = abs(H/2);
   tree = tree * 2;
   count = count + tree; 
  }

  cout << count <<endl;

  return 0;
}

Measured memory_bytes: 256
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Text;

public class Program
{

    public void Proc()
    {
        string inpt = Reader.ReadLine();

        int idx = int.Parse(Reader.ReadLine());
        List<char> charlist = inpt.Distinct().OrderBy(a => a).ToList();

        List<string> list = new List<string>();
		for (int i = 0; i < Math.Min(charlist.Count, 5); i++)
        {
            for (int j = 0; j < inpt.Length; j++)
            {
				if(inpt[j] != charlist[i]) {
					continue;
				}
                for (int k = 1; k <= 5; k++)
                {
                    if (j + k > inpt.Length)
                    {
                        break;
                    }
                    string tmp = inpt.Substring(j, k);
                    if (!list.Contains(tmp))
                    {
                        list.Add(tmp);
                    }
                }
            }
            if (list.Count >= 5)
            {
                break;
            }
        }
        list.Sort();
        string ans = list[idx - 1];
        Console.WriteLine(ans);


    }


    public class Reader
    {
        static StringReader sr;
        public static bool IsDebug = false;
        public static string ReadLine()
        {
            if (IsDebug)
            {
                if (sr == null)
                {
                    sr = new StringReader(InputText.Trim());
                }
                return sr.ReadLine();
            }
            else
            {
                return Console.ReadLine();
            }
        }
        private static string InputText = @"
 
 
 
z
1
 
 
";
    }

    public static void Main(string[] args)
    {
#if DEBUG
        Reader.IsDebug = true;
#endif
        Program prg = new Program();
        prg.Proc();
    }
}

Measured memory_bytes: 13280
import java.io.*;
import java.util.*;

public class Main {
  private static int countFactor(int k) {
    int count = 0;
    for (int i = 1; i <= k; i++) {
      if (k % i == 0) {
        count++;
      }
    }
    return count;
  }
  
  private static int solve(int n) {
    int count = 0;
    for (int i = 1; i <= n; i += 2) {
      if (countFactor(i) == 8) {
        count++;
      }
    }
    return count;
  }
  
  private static void execute(ContestReader reader, PrintWriter out) {
    int n = reader.nextInt();
    out.println(solve(n));
  }
  
  public static void main(String[] args) {
    ContestReader reader = new ContestReader(System.in);
    PrintWriter out = new PrintWriter(System.out);
    execute(reader, out);
    out.flush();
  }
}

class ContestReader {
  private BufferedReader reader;
  private StringTokenizer tokenizer;
  
  ContestReader(InputStream in) {
    reader = new BufferedReader(new InputStreamReader(in));
  }
  
  public String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }
  
  public int nextInt() {
    return Integer.parseInt(next());
  }
  
  public long nextLong() {
    return Long.parseLong(next());
  }
  
  public double nextDouble() {
    return Double.parseDouble(next());
  }
  
  public String[] next(int n) {
    String[] array = new String[n];
    for (int i = 0; i < n; i++) {
      array[i] = next();
    }
    return array;
  }
  
  public int[] nextInt(int n) {
    int[] array = new int[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextInt();
    }
    return array;
  }
  
  public long[] nextLong(int n) {
    long[] array = new long[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextLong();
    }
    return array;
  }
  
  public double[] nextDouble(int n) {
    double[] array = new double[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextDouble();
    }
    return array;
  }
  
  public char[] nextCharArray() {
    return next().toCharArray();
  }
  
  public int[][] nextInt(int n, int m) {
    int[][] matrix = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextInt();
      }
    }
    return matrix;
  }
  
  public long[][] nextLong(int n, int m) {
    long[][] matrix = new long[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextLong();
      }
    }
    return matrix;
  }
  
  public double[][] nextDouble(int n, int m) {
    double[][] matrix = new double[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextDouble();
      }
    }
    return matrix;
  }
  
  public char[][] nextCharArray(int n) {
    char[][] matrix = new char[n][];
    for (int i = 0; i < n; i++) {
      matrix[i] = next().toCharArray();
    }
    return matrix;
  }
}


Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long long INF = 9999999999999999;
using ll = long long;
int main(){
  int A,B;
  cin>>A>>B;
  if((2*B)>=A){
    cout << 0 << endl;
  }
  else{
    cout << A-2*B << endl;
  }
  return 0;
}

Measured memory_bytes: 256
import sys

n, m = map(int, input().split())
ed = [[] for _ in range(n)]
v = [None] * n
for _ in range(m):
	l, r, d = map(int, input().split())
	ed[l-1].append([r-1, d])
	ed[r-1].append([l-1, -d])

visited = [False] * n

def dfs(start):
	global ed, v, visited
	s = [start]
	v[start] = 0
	while s:
		label = s.pop()
		if visited[label] == False:
			visited[label] = True
			for e in ed[label]:
				if v[e[0]] is None:
					v[e[0]] = v[label] + e[1]
					s.append(e[0])
				else:
					if v[e[0]] != v[label] + e[1]:
						print("No")
						sys.exit()
	return

for i in range(n):
	if v[i] is None:
		dfs(i)

print("Yes")

Measured memory_bytes: 77712
N = int(input())
a, b = [list(map(int, input().split())) for _ in range(2)]
count = 0
for i in range(len(b)):
    if b[i] > a[i]:
        d = b[i] - a[i]
        count += a[i]
        if d > a[i+1]:
            count += a[i+1]
            a[i + 1] = 0
        else:
            a[i+1] -= d
            count += d

    else:
        count += b[i]
print(count)

Measured memory_bytes: 18624
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)n; ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cout<<*i<<" "; cout<<endl; }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;

int main(){
  int n;
  while(cin>>n && n){
    int y; cin>>y;
    int ans = -1;
    double maxg = -1e8;
    REP(i, n) {
      int id, per, tp;
      cin>>id>>per>>tp;
      double get;
      if(tp == 1){
        get = (1.0 + 0.01 * y * per);
      }else{
        get = pow(1.0 + 0.01 * per, (double)y);
      }
      if(get > maxg){
        maxg = get;
        ans = id;
      }
    }
    cout<<ans<<endl;
  }
  return 0;
}

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

using namespace std;
int main()
{

	int a,b,c;
	scanf("%d %d %d",&a,&b,&c);
	c = c - a + b;
	if (c < 0)c = 0;
	printf("%d\n",c);
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  int n,A[100],ans=0;
  cin>>n;
  for(int i=0;i<n;i++)cin>>A[i];
  for(int i=0;i<n-1;i++){
    for(int j=n-1;j>i;j--){
      if(A[j]<A[j-1]){
	swap(A[j],A[j-1]);
	ans++;
      }
    }
  }
  for(int i=0;i<n;i++){
    if(i)cout<<' ';
    cout<<A[i];
  }
  cout<<endl<<ans<<endl;
  return 0;
}

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

using namespace std;
#define endl '\n'
#define eb emplace_back
#define fst first
#define scd second
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define YES(n) cout << ((n) ? "YES" : "NO" ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl

constexpr int MOD = 1000000007;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }

// value
int N, K;

void solve() {

	cin >> N >> K;

	double ans = 0;

	for (int i = 1; i <= N; i++) {
		double tmp = 1.0 / N;
		if (i < K) {
			double tmp2 = log2((double)K / i);
			int p = int(tmp2) + (tmp2 - (int)tmp2 != 0);

			tmp *= pow(0.5, (double)p);
		}

		ans += tmp;

	}

	printf("%.12f\n", ans);

	return;

}

int main() {

	//cin.tie(0);
	//ios::sync_with_stdio(false);

	solve();

	return 0;

}

Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <iterator>

#include <vector>
#include <queue>
#include <unordered_map>

using namespace std;

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

    if(S=="Sunny")
        cout<<"Cloudy"<<endl;
    else if(S=="Cloudy")
        cout<<"Rainy"<<endl;
    else
        cout<<"Sunny"<<endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const ll p=1000000007ll;
const int N=200005;
template<class IT>inline void cmin(IT &a,IT b){if(b<a)a=b;}
template<class IT>inline void cmax(IT &a,IT b){if(a<b)a=b;}

int main(){
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	printf("%d",c-min(c,a-b));
	return 0;
}

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

int N, sort_cnt = 0;

int main() {
    cin >> N;
    int A[N];
    for (int i = 0; i < N; i++) cin >> A[i];
    
    int flag = 1; // 隣接要素が存在する
    while (flag) {
        flag = 0;
        
        for (int j = N - 1; j >= 1; j--) {
            if (A[j] < A[j - 1]) {
                swap(A[j], A[j - 1]);
                flag = 1;
                sort_cnt++;   
            }
        }
    }
    
    for (int i = 0; i < N - 1; i++) cout << A[i] << " ";
    cout << A[N - 1] << endl;
    cout << sort_cnt << endl;
    
    return 0;
}


Measured memory_bytes: 3100
n, a, b= [int(i) for i in input().split()]
m = 10**9 + 7

def nCk(N, K, m):
  ret = 1  
  for k in range(K):
    ret = (ret *(n - k)) %m
    
  inv = [1 for _ in range(K+1)]
  finv = [1 for _ in range(K+1)]
  for i in range(2, K+1):
    inv[i] = m - inv[m%i]*(m//i)%m
    finv[i] =finv[i-1] * inv[i]%m
    
  return (ret*finv[K])%m


print((pow(2,n,m)-nCk(n,a,m)-nCk(n,b,m)-1)%m)



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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};

int main(){
    double t,x;
    cin>>t>>x;

    cout<<t/x<<endl;
    return 0;
}

Measured memory_bytes: 256
from sys import stdin

S = input()
Q = int(input())

reverse_flg = False

former_list = []
latter_list = []

for q in range(Q):
    T = stdin.readline()[:-1]

    if T == '1':
        if reverse_flg:
            reverse_flg = False
        else:
            reverse_flg = True
    
    else:
        t, f, c = T.split()
        if (f == '1' and reverse_flg == False) or (f == '2' and reverse_flg == True):
            former_list.append(c)
        else:
            latter_list.append(c)


if reverse_flg:
    latter_list = ''.join(reversed(latter_list))
    former_list = ''.join(former_list)
    S = ''.join(list(reversed(S)))
    S = ''.join([latter_list, S, former_list])

else:
    former_list = ''.join(reversed(former_list))
    latter_list = ''.join(latter_list)
    S = ''.join([former_list, S, latter_list])

print(S) 


Measured memory_bytes: 6288
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x) x
#define rep(...) MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c) c.begin(),c.end()
#define mp make_pair
#define write(x) cout<<(x)<<"\n"
using namespace std; typedef long long ll;
typedef vector<int> vi; typedef vector<ll> vll; template<class T>using vv = vector<vector<T>>;
template<class T>vv<T> vvec(size_t n, size_t m, T v) { return vv<T>(n, vector<T>(m, v)); }
template<class T>bool chmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
template<class T>bool chmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
constexpr int INF = 1 << 28, MOD = 1e9 + 7; constexpr ll LINF = 1ll << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); }; }aaaa;

int main() {
    string S;
    cin >> S;
    int N = S.size();

    ll ans = 0;
    int cntA = 0;
    for (int i = 0; i < N;) {
        if (S[i] != 'A') {
            cntA = 0;
            i++;
            continue;
        }

        int j = i + 1;
        for (; j < N;) {
            if (S[j] == 'A') {
                j++;
            }
            else break;
        }

        if (S[j] != 'B' || S[j + 1] != 'C') {
            cntA = 0;
            i = j;
            continue;
        }

        int k = j;
        for (; k < N;) {
            if (k < N - 1 && S[k] == 'B' && S[k + 1] == 'C') {
                k += 2;
            }
            else {
                break;
            }
        }
        cntA += j - i;
        int cntBC = (k - j) / 2;

        ans += (ll)cntA * cntBC;
        
        i = k;
    }

    write(ans);
}

Measured memory_bytes: 720
#include<bits/stdc++.h>
using namespace std;
const int N=3e5+10;
const int mod=1e9+7;
int gi() {
    int x=0,o=1;char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
    if(ch=='-') o=-1,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return x*o;
}
char s[N];
int n,f[N][2][2][3],pw[N],ans=0;
void inc(int &a,int b) {
    a=(a+b>=mod)?a+b-mod:a+b;
}
void dec(int &a,int b) {
    a=(a-b<0)?a-b+mod:a-b;
}
int main() {
    scanf("%s",s),n=strlen(s);
    f[0][0][0][0]=pw[n]=1;
    for(int i=n-1;~i;i--) pw[i]=(s[i]=='?'?2:1)*pw[i+1]%mod;
    for(int i=0;i<n;i++) {
        if(s[i]!='1') {
            for(int j=0;j<2;j++)
                for(int k=0;k<2;k++)
                    for(int l=0;l<3;l++) inc(f[i+1][j][k][(l&1)+1],f[i][j][k][l]);
        }
        if(s[i]!='0') {
            for(int j=0;j<2;j++)
                for(int k=0;k<2;k++) {
                    if(!j&&!k) inc(f[i+1][1][1][0],f[i][j][k][0]);
                    else if(j&&k) inc(ans,1ll*f[i][j][k][0]*pw[i+1]%mod);
                    else inc(f[i+1][!j][k][0],f[i][j][k][0]);
                    inc(f[i+1][j][k][0],f[i][j][k][1]);
                    inc(f[i+1][!j][k][0],f[i][j][k][2]);
                }
        }
    }
    inc(ans,f[n][1][1][0]),printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 15744
#include <stdio.h>
#include <memory.h>
int main(void){
	int n,w,i,v,h[11],maxh,maxv,maxw;
	double ans;
	while(1){
		scanf("%d %d",&n,&w);
		if(!n){
			break;
		}
		maxv=-1;
		ans=maxh=maxw=0;
		memset(h,0,sizeof(h));
		for(i=0;i<n;i++){
			scanf("%d",&v);
			if(maxv<v){
				maxv=v;
			}
			if(maxw<v/w){
				maxw=v/w;
			}
			h[v/w]++;
			if(maxh<h[v/w]){
				maxh=h[v/w];
			}
		}
		for(i=maxw;i>0;i--){
			ans+=i*h[maxw-i];
		}
		ans=ans*1.0/(maxh*maxw);
		ans+=0.01;
		printf("%.16f\n",ans);
	}
	return 0;
}

Measured memory_bytes: 640