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

using namespace std;
using ll = long long;
constexpr ll MOD = 998244353;
constexpr int NMAX = 302;

ll bilang[NMAX][NMAX][NMAX]; // (# of chars left in target, opcount, # of ones I ate)
char simula[NMAX];
int lenToZero[NMAX];

ll bilangin(int i, int j, int k) {
	if (i < 0 || j < 0 || k < 0 ||
		i >= NMAX || j >= NMAX || k >= NMAX) return 0;
	else return bilang[i][j][k];
}

int main() {
	scanf("%s", simula);
	int k; scanf("%d", &k);
	int n = strlen(simula);
	for (int i = 0; i < n; ++i) {
		if (simula[i] == '0') lenToZero[i] = 0;
		else lenToZero[i] = (i == 0 ? 1000000 : 1 + lenToZero[i-1]);
	}
	bilang[0][0][0] = 1;
	for (int targetLen = 1; targetLen <= n; ++targetLen) {
		for (int opcount = 0; opcount <= n; ++opcount) {
			for (int kinain = 0; kinain <= targetLen; ++kinain) {
				int sourceLen = targetLen - kinain;
				if (sourceLen == 0) {
					bilang[targetLen][opcount][kinain] = opcount == 0 ? 1 : 0;
					continue;
				}
				if (simula[sourceLen - 1] == '0') {
					bilang[targetLen][opcount][kinain] = (bilangin(targetLen - 1, opcount, kinain)
							+ bilangin(targetLen - 1, opcount, kinain - 1)) % MOD;
				} else {
					bilang[targetLen][opcount][kinain] = 
						(bilangin(targetLen - 1, opcount - lenToZero[sourceLen - 1], kinain + lenToZero[sourceLen - 1])
							+ bilangin(targetLen - 1, opcount, kinain)) % MOD;
				}
//				printf("t = %d s = %d o = %d k = %d is %lld\n", targetLen, sourceLen, opcount, kinain,
//						bilangin(targetLen, opcount, kinain));
			}
		}
	}
	ll ans = 0;
	for (int finalOps = 0; finalOps <= min(k, n); ++finalOps) ans = (ans + bilangin(n, finalOps, 0)) % MOD;
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 217556
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cmath>
#include <queue>
#include <numeric>
#include <climits>
#include <iterator>
#include <iomanip>
#include <stack>
#include <set>
#include <cstdio>
#include <bitset>
#include <functional>
#include <tuple>
#include <list>
#include <deque>
using namespace std;

typedef pair<int, int> P;

#define FOR(i, a, n) for (ll i = (ll)a; i<(ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)

typedef long long ll;
typedef vector<int> VI;

int a[200010];
int b[200010];
int main() {
    cin.tie(0);
   	ios::sync_with_stdio(false);
    
    int n; cin >> n;
    set<int> st;
    REP(i, n){
        int a, b; cin >> a >> b;
        if(a==1){
            if(st.find(b)!=st.end()) cout << 1 << endl;
            else cout << 0 << endl;
        }else if(a==0){
            st.insert(b);
            cout << st.size() << endl;
        }else{
            st.erase(b);
        }
    }
	return 0;
}


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

int main(){
    int N;
    cin >> N;
    int L[N];
    for(int i=0; i<N; i++){
        cin >> L[i];
    }
    int count = 0;
    for(int i=0; i<N; i++){
        for(int j=i+1; j<N; j++){
            for(int k=j+1; k<N; k++){
                if((L[i]!=L[j] && L[j]!=L[k] && L[k]!=L[i]) && (L[j]+L[k]>L[i]) && (L[i]+L[j]>L[k]) && (L[i]+L[k]>L[j])) count++;
            }
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 3632
N = int(input())
A = list(map(int,input().split()))
B = (N+1)*[0]

for n in range(N,0,-1):
  B[n] = (sum(B[n::n])+A[n-1])%2

print(B.count(1))
for n in range(N+1):
  if B[n]:
    print(n,end=" ")

Measured memory_bytes: 13544
#include <stdio.h>

int main(void)
{
    int R;
        
    
    scanf("%d", &R);

    if(R >= 2800)
        printf("AGC\n");
    else if(R >=1200)
        printf("ARC\n");
    else
        printf("ABC\n");

    //system("pause");
    
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
#include <math.h> 
#include <iostream>
#include <string>



int main(){
    string S ;
    cin >> S;
    int N = S.length() ;
    string Sr = S;
    bool step1 = false;
    bool step2 = false;
    bool step3 = false;
    //vector<int> vec(N);
    
    int n = (N-1)/2;
    int n2 = (N+3)/2;
    string S3 = S.substr(0,n);
    string S4 = S.substr(n2-1);
    

    string S3r = S3;
    std::reverse( S3r.begin(), S3r.end() );
    string S4r = S4;
    std::reverse( S4r.begin(), S4r.end() );
    std::reverse( Sr.begin(), Sr.end() );
    if(S.compare(Sr)==0){
        step1 = true;
        //cout << "1" << endl;
    }
    if(S3.compare(S3r)==0){
        step2 = true;
        //cout << "2" << endl;
    }
    if(S4.compare(S4r)==0){
        step3 = true;
        //cout << "3" << endl;
    }

    if(step1&&step2&&step3){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    /*
    cout << S3 << endl;
    cout << S3r << endl;
    
    cout << S4 << endl;
    cout << S4r << endl;
    //cout << S;

    /*
    for(int i = 0;i < N;i++){
        cin >> vec.at(i);
    }*/

    //cout << N << endl;
    

    
}


Measured memory_bytes: 256
lis = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
n = int(input())
print(lis[n-1])

Measured memory_bytes: 2940
#include <iostream>

using namespace std;

int main()
{
    int a[4];
    bool flag[4] = {false};
    for(int i = 0; i < 4; i++) {
        cin >> a[i];
        switch(a[i]) {
            case 1 : flag[0] = true; break;
            case 9 : flag[1] = true; break;
            case 7 : flag[2] = true; break;
            case 4 : flag[3] = true; break;
        }
    }
    
    for(int i = 0; i < 4; i++) {
        if(!flag[i]) {
            cout << "NO" << endl;
            return 0;
        }
    }
    
    cout << "YES" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 0> { using type = T; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
template <class T> inline void chmin(T &a, const T& b) { if (b < a) a = b; }
template <class T> inline void chmax(T &a, const T& b) { if (b > a) a = b; }
/* clang-format on */

int main() {
#ifdef DEBUG
  ifstream ifs("in.txt");
  cin.rdbuf(ifs.rdbuf());
#endif
  int N;
  while (cin >> N) {
    vec<int, 2> A = make_v(N, N - 1, 0);
    for (int i = 0; i < N; i++) {
      for (int j = 0; j < N - 1; j++) cin >> A[i][j], --A[i][j];
      reverse(A[i].begin(), A[i].end());
    }
    auto check = [&](int i) {
      if (A[i].empty()) return false;
      int j = A[i].back();
      return A[j].back() == i;
    };
    queue<int> q;
    for (int i = 0; i < N; i++) {
      if (A[i].back() < i && check(i)) q.push(i);
    }
    int res = 0, done = 0;
    while (!q.empty()) {
      ++res;
      done += q.size();
      queue<int> nq;
      while (!q.empty()) {
        int i = q.front();
        q.pop();
        int j = A[i].back();
        A[i].pop_back();
        A[j].pop_back();
        if (check(i)) nq.push(i);
        if (check(j)) nq.push(j);
      }
      q = nq;
    }
    cout << (done < N * (N - 1) / 2 ? -1 : res) << endl;
  }
  return 0;
}


Measured memory_bytes: 4224
#include<stdio.h>
int main(){
  int h,w,siro,i,j,oku=0;
  int masu[101][101]={};
  char s[101];
  scanf("%d%d",&h,&w);
  for(i=0;i<h;i++){
      scanf("%s",s);
    for(j=0;j<w;j++){
      if(s[j]=='#')
        masu[i][j]=2;
      if(s[j]=='.')
        masu[i][j]=1;
    }
  }
  for(i=0;i<h;i++){
    siro=0;
    for(j=0;j<w;j++){
      if(masu[i][j]==2)siro=1;
    }
    if(siro==0){
      for(j=0;j<w;j++){
        masu[i][j]=0;
      }
    }
  }
  for(i=0;i<w;i++){
    siro=0;
    for(j=0;j<h;j++){
      if(masu[j][i]==2)siro+=1;
    }
    if(siro==0){
      for(j=0;j<h;j++){
        masu[j][i]=0;
      }
    }
  }
  for(i=0;i<h;i++){
    oku=0;
    for(j=0;j<w;j++){
      if(masu[i][j]==1){
        printf(".");
        oku=1;
      }
      if(masu[i][j]==2){
        printf("#");
        oku=1;
      }
    }
    if(oku>0)
      puts("");
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include<map>
#define MEM(var,val) memset(var,(val),sizeof(var))
#define MAX(a,b) ((a) > (b) ? (a) : (b))
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#define nitro   ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define vll vector<ll>
#define pll pair<ll,ll>
#define mp make_pair
#define pb push_back
#define F first
#define S second
int  main()
{
    nitro;
    int k,a,b;
    cin>>k>>a>>b;
    if(a%k==0||b%k==0||(a/k)!=b/k)
        cout<<"OK";
    else cout<<"NG";

}


Measured memory_bytes: 3648
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
typedef long long ll;

using namespace std;

int main()
{
	ll v, n;
	cin >> n;
	vector<vector<ll>> dp(n, vector<ll>(n, 0));
	vector<ll> V(n);
	for (int i = 0; i < n; i++) {
		cin >> v;
		V[i] = v;
	}
	for (int i = 0; i < n; i++) {
		dp[i][i] = V[i];
	}
	//forstekoordinat = bredde, andre = hoyde
	for (int R = 1; R < n; R++) {
		for (int L = R - 1; L >= 0; L--) {
			if (R == L) { dp[R][R] = V[R]; }
			else {
				dp[R][L] = max(V[R] - dp[R - 1][L], V[L] - dp[R][L + 1]);
			}
		}
	}
	cout << dp[n-1][0];
}

Measured memory_bytes: 70656
#include <bits/stdc++.h>
#include <string>
using namespace std;
#define ll long long
#define endl "\n"
#define print_array(name,n) for(ll o=0;o<n;o++) cout<<name[o]<<" "
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define inf 2e18
#define pll pair<ll,ll>
#define pii pair<int,int>
bool sortbysecond(const pair<int,int> &a,const pair<int,int> &b){
	return (a.ss>b.ss);
}
 
ll gcd(ll a,ll b){ if(b==0) return a; return gcd(b,a%b) ;} 

template <typename T>
string NumberTostring(T Number )
{
	ostringstream ss;
	ss<<Number;
	return ss.str();
}
 

 
int main()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
 	ll n;
 	cin>>n;
 	vector<ll> vec(n+1);
 	for(int i=1;i<=n;i++){
 		for(int j=1;j*i<=n;j++){
 			vec[j*i]++;
 		}
 	}   
 	ll sum = 0;
 	for(int i=1;i<=n;i++){
 		sum+= i*vec[i];
 	}
 	cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 81332
#ifdef DEBUG_IS_VALID
#define DEB 1 
#define _LIBCPP_DEBUG 0
#else
#define DEB 0
#define NDEBUG
#endif

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

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(Int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i, x, n) for(Int i = x; i >= n; i--)
#define rrep(i, n) RREP(i,n,0)
#define pb push_back
#define fi first
#define se second
#pragma GCC optimize ("-O3")

using namespace std;

#define DUMPOUT cout
#define dump(...) if(DEB) DUMPOUT<<"  "<<#__VA_ARGS__<<" :["<<__LINE__<<":"<<__FUNCTION__<<"]"<<endl<<"    "; if(DEB) dump_func(__VA_ARGS__)
template<typename T1,typename T2>ostream& operator << (ostream& os, pair<T1,T2> p){cout << "(" << p.first << ", " << p.second << ")"; return os;}
template<typename T>ostream& operator << (ostream& os, vector<T>& vec) { os << "{"; for (int i = 0; i<vec.size(); i++) os << vec[i] << (i + 1 == vec.size() ? "" : ", "); os << "}"; return os; }
template<typename T>ostream& operator << (ostream& os, set<T>& st){cout << "{"; for(auto itr = st.begin(); itr != st.end(); itr++) cout << *itr << (next(itr)!=st.end() ? ", " : ""); cout << "}"; return os;}
template<typename T1,typename T2>ostream& operator << (ostream& os, map<T1,T2> mp){cout << "{"; for(auto itr = mp.begin(); itr != mp.end(); itr++) cout << "(" << (itr->first) << ", " << (itr->second) << ")" << (next(itr)!=mp.end() ? "," : ""); cout << "}"; return os; }

void dump_func(){DUMPOUT << endl;}
template <class Head, class... Tail>void dump_func(Head&& head, Tail&&... tail){ DUMPOUT << head; if (sizeof...(Tail) == 0) { DUMPOUT << " "; } else { DUMPOUT << ", "; } dump_func(std::move(tail)...);}
template<class T> inline bool chmax(T& a,T const& b){if(a>=b) return false; a=b; return true;}
template<class T> inline bool chmin(T& a,T const& b){if(a<=b) return false; a=b; return true;}

using Int = long long;
using ll = long long;
using P = pair<Int,Int>;
using vi = vector<Int>;
using vvi = vector<vi>;
using vp = vector<P>;
using vvp = vector<vp>;

const Int INF = (1LL<<50);

void solve(long long N, std::vector<long long> x, std::vector<long long> y){
  Int ma1 = -INF, ma2 = -INF;
  Int mi1 = INF, mi2 = INF;
  rep(i, N){
    chmax(ma1, x[i] + y[i]);
    chmax(ma2, x[i] - y[i]);
    chmin(mi1, x[i] + y[i]);
    chmin(mi2, x[i] - y[i]);
  }
  cout << max(ma1 - mi1, ma2 - mi2) << endl;
}

int main(){
  std::cout << std::fixed << std::setprecision(15);
  long long N;
  scanf("%lld",&N);
  std::vector<long long> x(N);
  std::vector<long long> y(N);
  for(int i = 0 ; i < N ; i++){
    scanf("%lld",&x[i]);
    scanf("%lld",&y[i]);
  }
  solve(N, std::move(x), std::move(y));
  return 0;
}


Measured memory_bytes: 6448
import sys
(sx, sy, tx, ty) = map(int, raw_input().split())

dx, dy = tx - sx, ty - sy


for i in xrange(dy):
    sys.stdout.write('U')
for i in xrange(dx):
    sys.stdout.write('R')
    
###

for i in xrange(dy):
    sys.stdout.write('D')
for i in xrange(dx):
    sys.stdout.write('L')

###


sys.stdout.write('L')

for i in xrange(dy + 1):
    sys.stdout.write('U')
for i in xrange(dx + 1):
    sys.stdout.write('R')
    
sys.stdout.write('D')

###
sys.stdout.write('R')

for i in xrange(dy + 1):
    sys.stdout.write('D')
for i in xrange(dx + 1):
    sys.stdout.write('L')
    
sys.stdout.write('U')
sys.stdout.write('\n')


Measured memory_bytes: 2692
import sys
read=sys.stdin.read

n,*p=map(int,read().split())
p.append(-1)
cl=[]
f=0
for i in range(n+1):
  if p[i]==i+1:
    if f==0:
      cl.append(1)
      f=1
    else:
      cl[-1]+=1
  else:
    if f==1:
      cl[-1]=cl[-1]//2+(cl[-1]%2)
    f=0

print(sum(cl))

Measured memory_bytes: 20524
#include <cstdio>
#include <vector>
#include <algorithm>

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

using namespace std;

typedef long long ll;

int main(){
	int n,K; scanf("%d%d",&n,&K);
	int x1[50],y1[50],z1[50],x2[50],y2[50],z2[50];
	rep(i,n) scanf("%d%d%d%d%d%d",x1+i,y1+i,z1+i,x2+i,y2+i,z2+i);

	vector<int> X,Y,Z;
	rep(i,n){
		X.push_back(x1[i]); X.push_back(x2[i]);
		Y.push_back(y1[i]); Y.push_back(y2[i]);
		Z.push_back(z1[i]); Z.push_back(z2[i]);
	}
	sort(X.begin(),X.end()); X.erase(unique(X.begin(),X.end()),X.end());
	sort(Y.begin(),Y.end()); Y.erase(unique(Y.begin(),Y.end()),Y.end());
	sort(Z.begin(),Z.end()); Z.erase(unique(Z.begin(),Z.end()),Z.end());

	ll ans=0;
	rep(i,(int)X.size()-1) rep(j,(int)Y.size()-1) rep(k,(int)Z.size()-1) {
		int cnt=0;
		rep(l,n){
			if(x1[l]<=X[i] && X[i+1]<=x2[l]
			&& y1[l]<=Y[j] && Y[j+1]<=y2[l]
			&& z1[l]<=Z[k] && Z[k+1]<=z2[l]) cnt++;
		}
		if(cnt>=K) ans+=(ll)(X[i+1]-X[i])*(Y[j+1]-Y[j])*(Z[k+1]-Z[k]);
	}
	printf("%lld\n",ans);

	return 0;
}

Measured memory_bytes: 1056
#include <bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define MAX 2000005
#define MOD 1000000007
#define MOD2 998244353
#define pb push_back
#define mp make_pair
#define pii pair<ll,ll>
#define vi vector<ll>
#define vp vector<pii>
#define all(v) v.begin(),v.end()
#define sz(x) (ll)x.size()
#define F first
#define S second
#define FOR(i,a,b) for(ll i=a;i<b;++i)
#define ROF(i,a,b) for(ll i=a;i>=b;--i)
#define trace(x) cerr<<#x<<": "<<x<<'\n';
typedef long long ll;
using namespace std;
//using namespace __gnu_pbds;
//#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>

ll mexp(ll a, ll b){
    ll ans=1;
    a%=MOD;
    while(b){
        if(b&1) ans=ans*a%MOD;
        b>>=1;
        a=a*a%MOD;
    }
    return ans;
}

int n,k;
set<int>s;

int solve(int val,int len){
    int ans=MOD;
    if(val>=n){
        return val;
    }
    if(len>6){
        return MOD;
    }
    for(int x:s){
        ans=min(ans,solve(10*val+x,len+1));
    }
    return ans;
}

int main(){
    IOS

    cin>>n>>k;
    FOR(i,0,10){
        s.insert(i);
    }
    FOR(i,0,k){
        int x;
        cin>>x;
        s.erase(x);
    }
    cout<<solve(0,0);

    cerr<<"Time: "<<1.0/CLOCKS_PER_SEC<<" ms"<<endl;
    return 0;
}

Measured memory_bytes: 256
import sys
import math

from collections import defaultdict
from collections import deque
def load(vtype=int):
    return vtype(input().strip())
def load_list(seplator=" ", vtype=int):
    return [vtype(v) for v in input().strip().split(seplator)]
def exit():
    import sys
    sys.exit(0)
def perm_sub(li, used):
    if len(li) == len(used):
        return [deque()]
    k = []
    for i in range(len(li)):
        if i in used:
            continue
        used.add(i)
        sub_list = perm_sub(li, used)
        for sub in sub_list:
            sub.appendleft(li[i])
        k.extend(sub_list)
        used.discard(i)
    return k
def perm_li(li):
    return perm_sub(li, set())
def perm_n(n):
    return perm_sub(list(range(n)), set())
def join_i(li, sep=""):
    return sep.join([str(e) for e in li])
def li2n(li):
    n, base = 0, 1
    for i in range(len(li)-1, -1, -1):
        n += li[i] * base
        base *= 10
    return n
def sli2ili(li):
    return [int(s) for s in li] 
def prime_list(n):
    li = [i for i in range(2, n+1)]
    for i in range(len(li)):
        if li[i] >= int(math.sqrt(n)):
            break
        if li[i] == -1:
            continue
        for j in range(i+1, len(li)):
            if li[j] % li[i] == 0:
                li[j] = -1
    return [n for n in li if n != -1]
def gcd(a, b):
    a, b = max(a, b), min(a, b)
    while True:
        r = a % b
        if r == 0: return b
        a, b = b, r
def lcm(a, b):
    return int(a * b / gcd(a,b))
def all_subset(li):
    s = []
    n = len(li)
    for bit in range(0, (1<<(n+1))):
        ss = set()
        for i in range(0, n):
            if (bit & (1 << i)):
                ss.add(li[i])
        s.append(ss)
    return s
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

n = load()
s = load(str)

pre = s[0]
result = 1

for i in range(1, len(s)):
    if s[i] != pre:
        result += 1
    pre = s[i]

print(result)


Measured memory_bytes: 3700
#include<iostream>
#include<cmath>
using namespace std;
int main(){
  int n; cin >> n;
  while(n--){
    double x[4],y[4];
    for(int i=0;i<4;i++) cin >> x[i] >> y[i]; 
    if(abs((x[3] - x[2]) * (y[1] - y[0]) - (x[1] - x[0]) * (y[3] - y[2])) < 1e-10)
      cout<<"YES"<<endl;
    else
      cout<<"NO"<<endl;
  }
}

Measured memory_bytes: 3132
N=gets.to_i
if N==1
    ps=[gets.to_f]
else
    ps=gets.split.map(&:to_f)
end

ps.unshift(0)
dp=Array.new(N+1){Array.new(N+1,0.0)}
dp[0][0]=1.0
for i in 1..N
    f=ps[i]
    for j in 0..i
        if j==0
            dp[i][j]=dp[i-1][0]*(1-f)
        elsif j==i && j!=0
            dp[i][j]=dp[i-1][i-1]*f
        else
            dp[i][j]=dp[i-1][j-1]*f+dp[i-1][j]*(1-f)
        end
    end
end
puts dp[N][N/2+1..-1].inject(:+)


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

const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;
const int MOD =   1000000007;

/// Lib
///

int main(){
#ifdef MYLOCAL
    ifstream in("input.txt");
    cin.rdbuf(in.rdbuf());
#endif
    string L; cin >> L;
    int n = L.size();

    ll dp[100010][2] {};
    dp[0][0] = 1;
    for(int i = 0; i < n; i++){
        dp[i+1][1] += 3 * dp[i][1];
        dp[i+1][1] %= MOD;
        if(L[i] == '1'){
            dp[i+1][0] += 2 * dp[i][0];
            dp[i+1][0] %= MOD;
            dp[i+1][1] += dp[i][0];
            dp[i+1][1] %= MOD;
        }else{
            dp[i+1][0] += dp[i][0];
            dp[i+1][0] %= MOD;
        }
    }

    ll ans = (dp[n][0] + dp[n][1]) % MOD;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 2048
use proconio::{input, fastout, marker::Chars};

#[fastout]
fn main() {
    input! {
        h: usize,
        w: usize,
        k: usize,
        c: [Chars; h],
    }
    let mut res = 0;

    for i in 0..((2 as usize).pow(h as u32)) {
        for j in 0..((2 as usize).pow(w as u32)) {
            let mut temp_c = c.clone();
            for ii in 0..h {
                if ((i+1) & (1 << ii)) > 0 {
                    for i_j in 0..w {
                        temp_c[ii][i_j] = 'r';
                    }
                }
            }
            for jj in 0..w {
                if ((j+1) & (1 << jj)) > 0 {
                    for j_i in 0..h {
                        temp_c[j_i][jj] = 'r';
                    }
                }
            }

            // cnt #
            let mut temp_cnt_k = 0;
            for cnt_i in 0..h {
                for cnt_j in 0..w {
                    if temp_c[cnt_i][cnt_j] == '#' {
                        temp_cnt_k += 1;
                    }
                }
            }
            if temp_cnt_k == k {
                res += 1;
            }
        }
    }

    println!("{:?}", res);
}


Measured memory_bytes: 2204
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <queue>

using i64 = long long;

int main() {
    int n; scanf("%d", &n);
    int N = 3 * n;
    std::vector<int> a(N);
    for(int i = 0; i < N; i++) scanf("%d", &a[i]);
    
    std::vector<i64> A(N, 1LL << 60);
    reverse(begin(a), end(a));
    
    i64 sum = 0;
    std::priority_queue<i64> qu;
    for(int i = 0; i < N; i++) {
        sum += a[i];
        qu.push(a[i]);
        
        while(qu.size() > n) {
            sum -= qu.top();
            qu.pop();
        }
        if(qu.size() == n and N - i - 1 >= n) A[N - i - 2] = sum;
    }
    reverse(begin(a), end(a));

    sum = 0;
    i64 ans = -(1LL << 60);
    std::priority_queue<i64, std::vector<i64>, std::greater<i64>> que;
    for(int i = 0; i < N; i++) {
        sum += a[i];
        que.push(a[i]);

        while(que.size() > n) {
            sum -= que.top();
            que.pop();
        }
        
        if(que.size() == n) {
            ans = std::max(ans, sum - A[i]);
        }
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 6132
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <iomanip>

using namespace std;
typedef long long ll;
typedef pair<int, int> ii;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP2(i,n,s) for(int i=(int)(s);i<(int)(n);++i)
#define RREP(i,n,s) for(int i=(int)(s);i>=(int)(n);--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin(),ie=(c).end();i!=ie;++i)
#define ALL(c) (c).begin(), (c).end()

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

    if (a <= 8 && b <= 8) {
        cout << "Yay!" << endl;
    }
    else {
        cout << ":(" << endl;
    }
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        //コード
    	Scanner sc = new Scanner(System.in);
//    	File file = new File("src/in.txt");
//    	Scanner sc = new Scanner(file);

    	int K = sc.nextInt();
    	String S = sc.next();

    	if(S.length()<=K) {
    		System.out.println(S);
    	} else {
    		System.out.println(S.substring(0, K)+"...");
    	}

    }
}

Measured memory_bytes: 27092
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define REP(i,n) for (ll i = 0; i < (n); ++i)
#define RREP(i, n) for (ll i = (n) - 1; i >= 0; --i)
#define ALL(v) (v).begin(), (v).end()
template<class T>
using reverse_priority_queue = priority_queue<T, vector<T>, greater<T>>;


int main(){
    ll h, w, k;
    cin >> h >> w >> k;
    ll x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    x1--; y1--; x2--; y2--;
    vector<string> c(h);
    REP(i, h){
        cin >> c.at(i);
    }

    vector<vector<ll>> dist(h, vector<ll>(w, numeric_limits<ll>::max()));
    reverse_priority_queue<array<ll, 3>> que;
    que.push({0, x1, y1});
    dist.at(x1).at(x2) = 0;
    while(!que.empty()){
        const auto arr = que.top(); que.pop();
        const ll di = arr.at(0);
        const ll xi = arr.at(1);
        const ll yi = arr.at(2);
        assert(c.at(xi).at(yi) != '@');
        if(dist.at(xi).at(yi) < di){ continue; }

        const ll dx[] = {-1, 1, 0, 0};
        const ll dy[] = {0, 0, -1, 1};
        REP(j, 4){
            for(ll l = 1; l <= k; ++l){
                const ll xj = xi + dx[j] * l;
                const ll yj = yi + dy[j] * l;
                if(xj < 0 || xj >= h || yj < 0 || yj >= w ||
                   c.at(xj).at(yj) == '@'){
                    break;
                }
                if(dist.at(xj).at(yj) < di + 1){
                    break;
                }else if(dist.at(xj).at(yj) == di + 1){
                    continue;
                }else{
                    dist.at(xj).at(yj) = di + 1;
                    que.push({di + 1, xj, yj});
                }
            }
        }
    }

    if(dist.at(x2).at(y2) == numeric_limits<ll>::max()){
        cout << -1 << endl;
    }else{
        cout << dist.at(x2).at(y2) << endl;
    }
    return 0;
}


Measured memory_bytes: 20024
#include <iostream>
#include <string>
#include <algorithm>
#include <limits.h>
using namespace std;

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

int main(){

    
    int K;
    cin >> K;
    int ans=0;
    for(int a=1;a<=K;a++){

        for(int b=1;b<=K;b++){
            for(int c=1;c<=K;c++){
                int h = gcd(a,b);
                
                h = gcd(h,c);
                
                ans += h;
            }
        }
    }
    cout << ans;
    
}

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

using namespace std;

int main() {
  int n;
  cin >> n;
  double sum = 0;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    sum += 1.0 / x;
  }
  sum = 1.0 / sum;
  cout << sum;
  return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 19 22:51:44 2018

@author: maezawa
"""

class node():
    def __init__(self, key, parent=None, right=None, left=None):
        self.key = key
        self.parent = parent
        self.right = right
        self.left = left
        
def insert(z):
    global root
    y = None
    x = root
    while x != None:
        y = x
        if z.key < x.key:
            x = x.left
        else:
            x = x.right
    z.parent = y
    
    if y == None:
        root = z
    elif z.key < y.key:
        y.left = z
    else:
        y.right = z  
    #inorder(root)
    
def find(x, k):
    while x != None and k != x.key:
        if k < x.key:
            x = x.left
        else:
            x = x.right
    return x
        
def inorder(u):
    if u == None:
        return
    inorder(u.left)
    print(' {}'.format(u.key), end = '')
    inorder(u.right)
    
def preorder(u):
    if u == None:
        return
    print(' {}'.format(u.key), end = '')
    preorder(u.left)
    preorder(u.right)
    
root = None

n = int(input())
for i in range(n):
    q = list(input().split())
    if q[0] == 'insert':
        z = node(int(q[1]))
        insert(z)
    elif q[0] == 'find':
        if find(root, int(q[1])):
            print('yes')
        else:
            print('no')
    elif q[0] == 'print':
        inorder(root)
        print()
        preorder(root)
        print()
        
        


Measured memory_bytes: 85232
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<deque>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#include<regex>
#include<bitset>
#include<complex>
#include<chrono>
#include<random>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

ll gcd(ll n, ll m) {
	ll tmp;
	while (m!=0) {
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m) {
	return abs(n * m) / gcd(n, m);//gl=xy
}
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
 
using namespace std;

void solve(){
  string s;
  cin>>s;
  int n=s.size();
  if(n%2){
    cout<<"No";
    return;
  }
  bool ng=false;
  for(int i=0;i<s.size()-1;i+=2){
    if(s[i]=='h'&&s[i+1]=='i');
    else ng=true;
  }
  if(ng)cout<<"No";
  else cout<<"Yes";
}

int main(){
	ios::sync_with_stdio(false);
  cin.tie(0);
	cout<<fixed<<setprecision(15);
  solve();
	return 0;
}


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

#define MAX 100001
int main(){
	int N,A,B,i;
	int japan=0, over=0;
	char input[MAX];
	scanf("%d%d%d",&N,&A,&B);
	scanf("%s",input);
	for(i=0;i<N;i++){
		if(input[i]=='a'){
			if(japan+over==A+B) printf("No\n");
			else{
				printf("Yes\n");japan++;
			}
		}else if(input[i]=='b'){
			if(japan+over==A+B) printf("No\n");
			else if(over==B){
				printf("No\n");
			}else{
				printf("Yes\n");
				over++;
			}
		}else{
			printf("No\n");
		}
	}
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>
#include<string>
#include <map>
#include <queue>
#include <stack>

#define DIV 1000000007
using namespace std;

int main() {
    int N, M;
    cin >> N >> M;

    int p;
    string s, ac = "AC", wa = "WA";
    map<int, pair<bool, int>> pro;
    for (int i = 0; i < M; i++) {
        cin >> p >> s;
        if (s == ac)
            pro[p].first=true;
        else if(!pro[p].first)
            pro[p].second++;
    }
    int ans_ac = 0, ans_wa = 0;
    for (auto x : pro) {
        if (x.second.first) {
            ans_ac++;
            ans_wa += x.second.second;
        }
    }
    cout << ans_ac << " " << ans_wa << endl;
    
}


Measured memory_bytes: 6528
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define ll long long
#define ll_MAX LONG_LONG_MAX
#define ll_MIN LONG_LONG_MIN
#define pi pair<int, int>
#define endl "\n"
#define MAXN 100005
using namespace std;

string s, t;

void solve()
{
    cin >> s >> t;
    int res = INT_MAX;
    for (int i = 0; i < s.size() - t.size() + 1; i++)
    {
        int cnt = 0;
        for (int j = 0; j < t.size(); j++)
        {
            if (s[i + j] != t[j])
                cnt++;
        }
        // cout << cnt << endl;
        res = min(res, cnt);
    }
    cout << res << endl;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    solve();
}

Measured memory_bytes: 3652
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine();
            var cN = s.Contains("N");
            var cS = s.Contains("S");
            var cW = s.Contains("W");
            var cE = s.Contains("E");
            var ns = !(cN ^ cS);
            var we = !(cW ^ cE);
            Console.WriteLine((ns && we) ? "Yes" : "No");
        }
    }
}


Measured memory_bytes: 2648
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 18;
const int MAXM = (1 << 17) + 11;
const int mod = 1e9 + 7;
int f[MAXN][MAXM];
int fac[MAXM], inv[MAXM];
int n, m, a[MAXN], ans;
inline int A(int x, int y){
	return x + y - (x + y >= mod ? mod : 0);
}
inline int M(int x, int y){
	return 1LL * x * y % mod;
}
inline int C(int n, int m){
	if(n < m)return 0;
	if(n < 0 || m < 0)return 0;
	return M(fac[n], M(inv[n-m], inv[m]));
}
int main(){
	fac[0] = inv[0] = fac[1] = inv[1] = 1;
	for(int i = 2;i <= 1 << 17; i++){
		fac[i] = M(fac[i-1], i);
		inv[i] = mod - 1LL * mod / i * inv[mod%i] % mod;
	}
	for(int i = 2;i <= 1 << 17; i++){
		inv[i] = M(inv[i-1], inv[i]);
	}
	cin>>n>>m;
	for(int i = 1;i <= m; i++){
		cin>>a[i];
	}
	f[m+1][0] = 1;
	for(int i = m + 1;i > 1; i--){
		for(int s = 0;s < 1 << n; s++){
			if(!f[i][s])continue;
			f[i-1][s] = A(f[i-1][s], f[i][s]);
			for(int j = 0;j < n; j++){
				if(s >> j & 1)continue;
				int S = s | (1 << j);
				f[i-1][S] = A(f[i-1][S], M(f[i][s], M(C((1 << n) - s - a[i-1], (1 << j) - 1), fac[1<<j])));
			}
		}
	}
	for(int i = 0;i < 1 << n; i++){
		int cnt = 0;
		for(int j = 0;j < n; j++)cnt += i >> j & 1;
		int sum = M(f[1][i], M(fac[(1<<n)-i-1], 1 << n));
		if(cnt & 1)ans = A(ans, mod - sum);
		else ans = A(ans, sum);
//		printf("i=%d cnt=%d sum=%d\n", i, cnt, sum);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 9728
#include<bits/stdc++.h>
#define int long long
const int inf=1145141919ll;
const int mod=1000000007ll;
const int dd[]={0,-1,0,1,0};
using namespace std;
int a,b,c,d;
int p[214514];
signed main(){
	int i,j;
	cin>>a;
	for(i=0;i<a;i++)
		cin>>p[i];
	int ans=1145141919810893;
	int sum=0,u=0;
	for(i=0;i<a;i++)
		sum+=p[i];
	for(i=1;i<a;i++){
		u+=p[i-1];
		sum-=p[i-1];
		ans=min(ans,abs(u-sum));
	}
	cout<<ans<<endl;
}

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

int main(void)
{
    long long N, M;
    cin >> N >> M;
    vector<long long> vec(N);
    for (long long i = 0; i< N; i++)
    {
        cin >> vec[i];
    }
    sort(vec.begin(), vec.end());

    for (long long i = 0; i < M; i++)
    {
        vec[N-1] = vec[N-1] / 2;

        long long minnum = -1;
        long long maxnum = N-1;
        while(1)
        {
            if(maxnum - minnum <= 1)
            {
                vec.insert(vec.begin() + maxnum, vec[N-1]);
                vec.pop_back();
                break;
            }
            if(vec[N-1] > vec[(minnum + maxnum) / 2])
            {
                minnum = (minnum + maxnum) / 2;
            }
            else
            {
                maxnum = (minnum + maxnum) / 2;
            }
        }
    }

    long long ans = 0;
    for (long long i = 0; i < N; i++)
    {
        ans += vec[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 4788
use std::error::Error;
use std::io;

pub fn main() {
    if let Err(_e) = run() {
        panic!("failed.");
    }
}

fn run() -> Result<(), Box<dyn Error>> {
    let mut input = String::new();
    io::stdin().read_line(&mut input)?;
    let nums: Vec<i64> = input
        .trim()
        .split_whitespace()
        .map(|s| s.parse::<i64>().unwrap())
        .collect();
    input.clear();

    if nums[1] % 2 == 1 {
        println!("No");
        return Ok(());
    }

    let max = nums[1] / 2;
    let mut min = nums[1] / 4;
    if nums[1] % 4 != 0 {
        min += 1;
    }
    if nums[0] <= max && nums[0] >= min {
        println!("Yes");
    } else {
        println!("No");
    }

    Ok(())
}


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

using namespace std;

#define int long long
#define double long double
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for(ll i = (a); i > (b); --i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define bitcnt(x) __builtin_popcount(x)
#define lbit(x) __builtin_ffsll(x)
#define rbit(x) __builtin_clzll(x)
#define SZ(x) ((ll)(x).size())
#define fi first
#define se second
#define All(a) (a).begin(), (a).end()
#define rAll(a) (a).rbegin(), (a).rend()

template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CCIN(...)                                                              \
    char __VA_ARGS__;                                                          \
    CIN(__VA_ARGS__)
#define DCIN(...)                                                              \
    double __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"
#define Printv(v)                                                              \
    {                                                                          \
        FOREACH(x, v) { cout << x << " "; }                                    \
        cout << "\n";                                                          \
    }
template <typename T = string> inline void eputs(T s) {
    cout << s << "\n";
    exit(0);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    std::fill((T *)array, (T *)(array + N), val);
}

template <typename T> using PQG = priority_queue<T, vector<T>, greater<T>>;
template <typename T> using PQ = priority_queue<T>;

typedef long long ll;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<ll, ll> PL;
typedef vector<PL> VPL;
typedef vector<bool> VB;
typedef vector<double> VD;
typedef vector<string> VS;

const int INF = 1e9;
// const int MOD = 1e9 + 7;
const int MOD = 998244353;
const ll LINF = 1e18;
// const double PI = atan(1.0) * 4.0;
const ll dx[] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[] = {0, 1, 1, 1, 0, -1, -1, -1};
#define PI 3.141592653589793238

signed main() {
	LCIN(H,A);
  	cout << (H+A-1)/A << "\n";
}


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

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>

#define pb push_back
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end()
#define mp make_pair

using namespace std;

typedef long long int64;
typedef vector<int> vi;
typedef pair<int, int> ii;

class TaskA {
 public:
  void solveOne(istream &in, ostream &out) {
    int d;
    in >> d;
    int g = __gcd(d, 360);
    out << 360 / g << "\n";
  }

  void solve(std::istream &in, std::ostream &out) {
    int nt = 1;
    for (int it = 0; it < nt; ++it) {
      solveOne(in, out);
    }
  }
};


int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  TaskA solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}


Measured memory_bytes: 3636
Option Strict On
Module Module1

    Sub Main()
        Dim a As Integer = Convert.ToInt32(Console.ReadLine())
        Dim b As Integer = Convert.ToInt32(Console.ReadLine())
        Dim c As Integer = Convert.ToInt32(Console.ReadLine())
        Dim d As Integer = Convert.ToInt32(Console.ReadLine())
        Dim e As Integer = Convert.ToInt32(Console.ReadLine())
        Dim k As Integer = Convert.ToInt32(Console.ReadLine())
        If e - a > k Then
            Console.WriteLine(":(")
        Else
            Console.WriteLine("Yay!")
        End If
        Console.ReadLine()
    End Sub

End Module

Measured memory_bytes: 11220
#include <bits/stdc++.h>
#pragma comment(linker, "/stack:256000000")
#pragma gcc optimize("O3")
#pragma gcc target("sse4")
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef double dbl;
typedef long double ldbl;
typedef pair<ll, ll> pll;
typedef string str;
typedef vector<int> vi;
typedef vector<ll> vll;
//#define HASH
#define pb push_back
#define forn(i, n) for(ll (i) = 0; (i) < (n); ++(i))
#define fornm(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define rfornm(i, m, n) for(ll (i) = (m); (i) >= (n); --(i))
#define fin() for(ll i = 0; i < n; ++i)
#define readvec(vector, n) {ll temp_vec_val;forn(i, n){cin >> temp_vec_val;vector.push_back(temp_vec_val);}}
#define printvec(vector, delimeter) {ll length_of_vector=vector.size();\
                                    forn(i, length_of_vector){cout << vector[i] << delimeter;}}
#define sortvec(vector) sort(vector.begin(), vector.end())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(20);
    ll x, y, z;
    cin >> x >> y >> z;
    ll c = 0;
    x -= z;
    while (x >= y+z) {
        c++;
        x -= (y+z);
    }
    cout << c << endl;
    return 0;
}


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

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

using namespace std;

typedef pair<int, int> P;

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

vector<int> prime(int n){
    vector<int> t;
    vector<bool> x(n+1, true);
    t.push_back(2);

    int i;
    for(i = 3; i * i <= n; i += 2){
        if(!x[i]){
            continue;
        }
        t.push_back(i);
        for(int j = i; j <= n; j += i){
            x[j] = false;
        }
    }
    for(; i <= n; i += 2){
        if(x[i]){
            t.push_back(i);
        }
    }
    return t;
}

int powM(int x, int n){
    if(n == 0){
        return 1;
    }
    if(n % 2 == 0){
        return powM(x * x % MOD, n / 2);
    }
    return powM(x, n-1) * x % MOD;
}

int factM(int n){
    static vector<int> t = {1};

    if((int)t.size() > n){
        return t[n];
    }

    for(int i = t.size(); i <= n; i++){
        t.push_back(t[i-1] * i % MOD);
    }
    return t[n];
}

class combination{
    private:
        vector<int> t;

    public:
        combination(int n): t(n+1){
            t[n] = powM(factM(n), MOD-2);

            for(int i = n-1; i >= 0; i--){
                t[i] = t[i+1] * (i+1) % MOD;
            }

        }

        int comb(int n, int k){
            if(n < k){
                return 0;
            }
            return factM(n) * t[k] % MOD * t[n-k] % MOD;
        }
};

signed main(){
    int n, m;
    cin >> n >> m;

    vector<int> p = prime(100000);
    vector<int> fact((int)p.size());
    int x = m;

    rep(i, (int)p.size()){
        while(x % p[i] == 0){
            fact[i]++;
            x /= p[i];
        }
    }
    if(x != 1){
        p.push_back(0);
        fact.push_back(1);
    }

    combination c(n + 1000);
    int ans = 1;
    rep(i, (int)p.size()){
        if(fact[i] == 0){
            continue;
        }
        int tmp = c.comb(fact[i] + n - 1, fact[i]);
        ans = ans * tmp % MOD;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 2364
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int ans = 0;
		
		for(int i=1; i<=n; i++){
		    for(int j=1; j<=n; j++){
		        for(int k=1; k<=n; k++){
		            ans++;
		        }
		    }
		}
		
        System.out.println(ans);
	}
}


Measured memory_bytes: 35528
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<cmath>
using namespace std;
const double pi=acos(-1);
int n;
struct pt
{
	double x,y,slop;
}a[110],b[110];
int read()
{
	int x=0,f=1;char ch=getchar();
	for(;ch<'0'||ch>'9';ch=getchar()) if(ch=='-') f=-1;
	for(;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';
	return x*f;
}
bool cmp(pt p,pt q){return p.slop<q.slop;}
int main()
{
	n=read();
	for(int i=1;i<=n;i++)
		a[i].x=read(),a[i].y=read();
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=n;j++)
			b[j]=a[j];
		swap(b[i],b[1]);
		for(int j=2;j<=n;j++)
		{
			b[j].slop=atan2(b[j].y-b[1].y,b[j].x-b[1].x)+pi/2;
			if(b[j].slop<0) b[j].slop+=pi*2;
		}
		sort(b+2,b+n+1,cmp);
		double ans=0;
		for(int j=3;j<=n;j++)	
			ans=max(ans,b[j].slop-b[j-1].slop-pi);
		ans=max(ans,b[2].slop-b[n].slop+pi);
		printf("%.15lf\n",ans/(pi*2));			 
	}	
	
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
template < class T > inline bool chmax(T& a, T b) {if (a < b) { a=b; return true; } return false; }
template < class T > inline bool chmin(T& a, T b) {if (a > b) { a=b; return true; } return false; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    V<int> s(4);
    for (int i = 0; i < 4; i++) cin >> s[i];

    int ans = INF;
    for (int state = 3; state < (1 << 4); state++) {
        if (__builtin_popcount(state) != 2) continue;
        int t0 = 0, t1 = 0;
        for (int i = 0; i < 4; i++) {
            if ((state >> i) & 1) t1 += s[i];
            else t0 += s[i];
        }
        chmin(ans, abs(t0 - t1));
    }
    cout << ans << '\n';
    return 0;
}



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

int main() {
    vector<int> o;
    int tmp, tcost = 0;
    for (int i = 0; i < 5; ++i) {
        cin >> tmp;
        o.push_back(tmp);
        tcost += ((tmp+9) / 10) * 10;
    }
    tmp = 644; // tcostの上限は643
    for (int i: o) {
        tmp = min(tmp, tcost - ((i+9) / 10) * 10 + i);
    }
    tcost = tmp;
    cout << tcost << endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define LL long long
using namespace std;

int main(void)
{
    int n,i,j;
    LL T;
    while(scanf("%d%lld",&n,&T)==2)
    {
        LL t = 0;
        LL sum = T;
        for(i=1;i<=n;i++)
        {
            LL x;
            scanf("%lld",&x);
            if(i == 1)
                continue;
            if(x < t + T)
            {
                sum -= t+T-x;
            }
            sum += T;
            t = x;
        }
        cout << sum << endl;
    }

    return 0;
}


Measured memory_bytes: 256
let rec solve = function
  | [] -> true
  | [_] -> false
  | c1 :: c2 :: s -> c1 = c2 && solve s

let () =
  let w = read_line () in
  Array.init (String.length w) (fun i -> w.[i])
  |> Array.to_list
  |> List.sort compare
  |> solve
  |> (function true -> "Yes" | false -> "No")
  |> print_endline

Measured memory_bytes: 384
program Cant_Wait_for_Holiday
  implicit none
  character(3) :: s
  integer :: n
  read(*,*) s
  select case (s)
    case ("SUN")
      n = 7
    case ("MON")
      n = 6
    case ("TUE")
      n = 5
    case ("WED")
      n = 4
    case ("THU")
      n = 3
    case ("FRI")
      n = 2
    case ("SAT")
      n = 1
  end select
  write(*,'(i0)') n
end program Cant_Wait_for_Holiday

Measured memory_bytes: 256