akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>

int main()
{
	int k, s;
	scanf("%d%d", &k, &s);
	int ans = 0;
	for (int i = 0; i <= k; ++i)
		for (int j = 0; j <= k && i + j <= s; ++j)
			ans += s - i - j <= k;
	printf("%d\n", ans);
	return 0;
}

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

#define Fast ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define FO freopen("in.txt", "r", stdin)
#define FC freopen("out.txt", "w", stdout)
#define aise cout<<"aise"<<endl
#define pb push_back
#define mp make_pair
#define ll long long
#define mset(v, a) memset(v, a, sizeof(v))
#define pll pair< ll, ll >
#define pdd pair< double, double >
#define ff first
#define ss second
#define pi acos(-1.0)
#define mxN 2097162
#define inf 1e9
#define MOD 1000000007

int main()
{

    ll n, ch=0;
    vector<ll> v1, v2;
    cin >> n;
    for(ll i = 0; i < n; i++)
    {

        ll x;
        cin >> x;
        v1.pb(x);
    }
    v2=v1;
    sort(v2.begin(), v2.end());
    for(ll i = 0; i < v1.size(); i++)
    {

        if(v1[i] != v2[i]) ch++;
    }
    if(ch > 2) cout << "NO";
    else cout << "YES";
}


Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
typedef pair<int,int> p;
const int inf=(1<<30);
#define rep(i,a,n)	for(int i=a;i<n;i++)
#define rrep(i,a,n) for(int i=(a-1);i>=n;i--)

	ll dp[41][405][405];
	
int main(){
	ll n,ma,mb;
	cin>>n>>ma>>mb;
	rep(i,0,n+1)rep(j,0,405)rep(k,0,405)dp[i][j][k]=inf;
	ll a[41],b[41],c[41];
	rep(i,0,n)cin>>a[i]>>b[i]>>c[i];
	dp[0][0][0]=0;
	rep(i,0,n)rep(j,0,405)rep(k,0,405){
		if(dp[i][j][k]==inf)continue;
		dp[i+1][j+a[i]][k+b[i]]=min(dp[i+1][j+a[i]][k+b[i]],dp[i][j][k]+c[i]);
		dp[i+1][j][k]=min(dp[i][j][k],dp[i+1][j][k]);
	}
	ll ans=inf;
	rep(i,1,405)rep(j,1,405)if(i*mb==j*ma)ans=min(ans,dp[n][i][j]);
	if(ans==inf)cout<<-1<<endl;
	else cout<<ans<<endl;
				
}

Measured memory_bytes: 52736
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
int main(){
  ll n;
  cin >> n;
  if(n >= 1000)cout << "ABD"  << endl;
  else cout << "ABC" << endl;
}

Measured memory_bytes: 3668
#include<iostream>
#include<vector>
using namespace std;
vector<long long> price;
void constructHeap(vector<long long> &price,int i,int length);
int main(){
    int n,m;
    long long data;
    long long cnt=0;
    cin >> n >> m;
    for(int j=0;j<n;j++){
        cin >>  data;
        price.push_back(data);
    }
    for(int i=price.size()/2-1;i>=0;i--){
        constructHeap(price,i,price.size());
    }
    for(int j=0;j<m;j++){
        price[0]/=2;
        constructHeap(price,0,price.size());
        // cout << price[0] << '\t';
    }
    for(int j=0;j<n;j++){
        // cout << price[j] << endl;
        cnt+=price[j];
    }
    cout << cnt;
    return 0;
}
void constructHeap(vector<long long> &price,int i,int length){
    long long temp = price[i];
    for(int k=2*i+1;k<length;k=k*2+1){
        if(k+1<length&&price[k]<price[k+1]) k++;
        if(price[k] > temp){
            price[i] = price[k];
            i = k;
        }
        else break;
    }
    price[i] = temp;
}

Measured memory_bytes: 1400
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline void rd(int &x){
  int k, m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void rd(long long &x){
  int k, m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(long long x){
  char f[20];
  int m=0, s=0;
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
template<class S, class T> inline S chmax(S &a, T b){
  if(a<b){
    a=b;
  }
  return a;
}
int N;
int M;
long long X[1000];
long long Y[1000];
long long Z[1000];
long long val[1000];
int main(){
  int i, mask;
  long long res=-1;
  rd(N);
  rd(M);
  {
    int Lj4PdHRW;
    for(Lj4PdHRW=0;Lj4PdHRW<(N);Lj4PdHRW++){
      rd(X[Lj4PdHRW]);
      rd(Y[Lj4PdHRW]);
      rd(Z[Lj4PdHRW]);
    }
  }
  for(mask=0;mask<(8);mask++){
    for(i=0;i<(N);i++){
      if(mask&1){
        if(mask&2){
          if(mask&4){
            val[i] =-X[i]+Y[i]+Z[i];
          }
          else{
            val[i] =-X[i]+Y[i]-Z[i];
          }
        }
        else{
          if(mask&4){
            val[i] =-X[i]-Y[i]+Z[i];
          }
          else{
            val[i] =-X[i]-Y[i]-Z[i];
          }
        }
      }
      else{
        if(mask&2){
          if(mask&4){
            val[i] =X[i]+Y[i]+Z[i];
          }
          else{
            val[i] =X[i]+Y[i]-Z[i];
          }
        }
        else{
          if(mask&4){
            val[i] =X[i]-Y[i]+Z[i];
          }
          else{
            val[i] =X[i]-Y[i]-Z[i];
          }
        }
      }
    }
    sort(val, val+N);
    reverse(val, val+N);
    {
      int KL2GvlyY;
      long long Q5VJL1cS;
      if(M==0){
        Q5VJL1cS = 0;
      }
      else{
        Q5VJL1cS = val[0];
        for(KL2GvlyY=(1);KL2GvlyY<(M);KL2GvlyY++){
          Q5VJL1cS += val[KL2GvlyY];
        }
      }
      chmax(res, Q5VJL1cS);
    }
  }
  wt_L(res);
  wt_L('\n');
  return 0;
}
// cLay varsion 20190822-2

// --- original code ---
// int N, M;
// ll X[1000], Y[1000], Z[1000];
// ll val[1000];
// {
//   int i, mask;
//   ll res = -1;
//   rd(N,M,(X,Y,Z)(N));
//   rep(mask,8){
//     rep(i,N) val[i] = if[mask&1, -] X[i] if[mask&2, +, -] Y[i] if[mask&4, +, -] Z[i];
//     sort(val, val+N);
//     reverse(val, val+N);
//     res >?= sum(val(M));
//   }
//   wt(res);
// }


Measured memory_bytes: 256
import bisect
N = int(input())
R = [tuple(map(int,input().split())) for i in range(N)]
B = [tuple(map(int,input().split())) for i in range(N)]

#ソートしてR<Bとなる点をGreedyで探索
R.sort()
B.sort()
i=0
ans=0
red_y = []
for b_x,b_y in B:
    #b_xよりxが小さいRをすべてred_yに追加
    while i<N and R[i][0]<b_x:
        bisect.insort_right(red_y,R[i][1])
        i+=1
    #r_x<b_x,r_y<b_yを満たす点があればカウント
    if red_y and red_y[0]<b_y:
        idx = bisect.bisect_right(red_y,b_y)-1
        ans+=1
        red_y.pop(idx)
print(ans)

Measured memory_bytes: 3064
s = input().split(" ")
n = int(s[0])
m = int(s[1])
l = int(s[2])
a = [[0 for i in range(m)] for j in range(n)]
b = [[0 for i in range(l)] for j in range(m)]
for i in range(n):
    s = input().split(" ")
    for j in range(m):
        a[i][j] = int(s[j])
for i in range(m):
    s = input().split(" ")
    for j in range(l):
        b[i][j] = int(s[j])
for i in range(n):
    for j in range(l):
        sk = 0
        for k in range(m):
            sk += a[i][k] * b[k][j]
        if j == l-1:
            print(sk)
        else:
            print(sk,end=" ")

Measured memory_bytes: 8644
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define FORR(i, a, b) for (int i = b - 1; i >= a; --i)
#define SORT(v) sort(v.begin(), v.end())
#define SORTR(v) sort(v.rbegin(), v.rend())
#define REV(v) reverse(v.begin(), v.end())
#define ITER(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define LB(v, x) (lower_bound(v.begin(), v.end(), x) - v.begin())
#define UB(v, x) (upper_bound(v.begin(), v.end(), x) - v.begin())
#define SZ(v) (int)v.size()
using namespace std;
using ll = long long;
using P = pair<int, int>;

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

    ll N, D;
    cin >> N >> D;
    int cnt = 0;
    REP(i, N) {
        ll x, y;
        cin >> x >> y;
        if (x * x + y * y <= D * D) {
            ++cnt;
        }
    }
    cout << cnt << endl;

    return 0;
}


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

using Size = int;
using Vertex = int;
using Weight = long long;
struct Edge {Vertex from, to; Weight weight;};
using Graph = std::vector<std::vector<Edge>>;

using LL = long long;
const LL M = 1e9 + 7;

LL combination(LL n, LL r) {
  if(n < r) return 0;
  if(n < 0 || r < 0) return 0;
  static std::vector<LL> fact{1, 1}, inv{1, 1}, finv{1, 1};
  for(LL i = fact.size(); i <= n; ++i) {
    fact.emplace_back(fact.back() * i % M);
    inv.emplace_back(inv.at(M % i) * (M - M / i) % M);
    finv.emplace_back(finv.back() * inv.back() % M);
  }
  return (fact[n] * finv[n - r] % M) * finv[r] % M;
}

LL power(LL m, LL n) {
  if(!n) return 1;
  return (n & 1) ? (power(m, n - 1) * m % M) : power(m * m % M, n >> 1);
}
LL inverse(LL n) {
  return power(n, M-2);
}
void rerooting(const Graph& G) {
  struct DP {
    LL val=1, size=0;
    const DP operator+(const DP& o) const {
      auto r(*this);
      r.val*=o.val;
      r.val%=M;
      r.val*=combination(r.size + o.size, o.size);
      r.val%=M;
      r.size+=o.size;
      return r;
    }
    const DP operator-(const DP& o) const {
      auto r(*this);
      r.size-=o.size;
      r.val*=inverse(combination(r.size + o.size, o.size));
      r.val%=M;
      r.val*=inverse(o.val);
      r.val%=M;
      return r;
    }
    const DP addRoot() const {return {val, size+1};}
  };
  std::vector<DP> dp(G.size());
  std::function<void(Vertex, Vertex)> dfs = [&](Vertex v, Vertex p) {
    for(const auto& e: G[v]) if(e.to != p) {
      dfs(e.to, e.from);
      dp[v] = dp[v] + dp[e.to].addRoot();
    }
  };
  std::function<void(Vertex, Vertex)> rev = [&](Vertex v, Vertex p) {
    for(const auto& e: G[v]) if(e.to != p) {
      dp[e.to] = dp[e.to] + (dp[v] - dp[e.to].addRoot()).addRoot();
      rev(e.to, e.from);
    }
  };
  dfs(0,-1); rev(0,-1);
  for(auto v=0; v<G.size(); ++v) cout<< dp[v].addRoot().val << endl;
}

int main() {
  int N;
  cin >> N;
  Graph G(N);
  for(auto i=1; i<N; ++i) {
    int a, b;
    cin >> a >> b;
    --a; --b;
    G[a].push_back({a, b});
    G[b].push_back({b, a});
  }
  rerooting(G);
}


Measured memory_bytes: 27524
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
typedef  long long ll;
ll gcd(ll x,ll y){
   if(y==0) return x;
   else return gcd(y,x%y);
}
ll lcm(ll x,ll y){
   return x/gcd(x,y)*y;
}
using namespace std;

int main(){
    int n,m;
    cin>>n>>m;
    int sum=0;
    vector<int>a(n);
    rep(i,n){
        cin>>a[i];
        sum+=a[i];
    }
    sort(a.begin(),a.end(),greater<int>());

    double x=1/double(4*m);
    bool f=true;
    rep(i,m){
        if(a[i]<sum*x) f=false;
    }
    f? cout<<"Yes":cout<<"No";

return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string { sc.Scan(); return sc.Text() }
func scanRunes() []rune { return []rune(scanString()) }
func scanInt() int { a,_ := strconv.Atoi(scanString()); return a }
func scanInt64() int64 { a,_ := strconv.ParseInt(scanString(),10,64); return a }
func scanFloat64() float64 { a,_ := strconv.ParseFloat(scanString(),64); return a }

func scanInts(n int) []int {
	res := make([]int, n); for i := 0; i < n; i++ { res[i] = scanInt() }; return res
}

func debug(a ...interface{}) { fmt.Fprintln(os.Stderr, a...) }

func abs(a int) int { if a<0 { return -a }; return a }
func min(a,b int) int { if a<b { return a }; return b }
func max(a,b int) int { if a>b { return a }; return b }

//•*¨*•.¸¸♪Main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)

func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	n := scanInt()
	a,b := 1,2
	for i := 1; i < n; i++ {
		if n==2 || i*(i+1) > n*2 {
			fmt.Fprintln(wr, "No")
			return
		}
		if i*(i+1) == n*2 {
			a = i
			b = i+1
			break
		}
	}

	fmt.Fprintln(wr, "Yes")
	fmt.Fprintln(wr, b)
	s := make([][]int, b)
	for i := 0; i < b; i++ {
		s[i] = make([]int, a)
	}

	c := 1
	for i := 0; i < a; i++ {
		for j := i; j < a; j++ {
			s[i][j] = c
			s[j+1][i] = c
			c++
		}
	}

	for i := 0; i < b; i++ {
		fmt.Fprint(wr, a)
		for j := 0; j < a; j++ {
			fmt.Fprintf(wr," %d", s[i][j])
		}
		fmt.Fprintln(wr)
	}

}


Measured memory_bytes: 5248
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <iomanip>

using namespace std;

using ll = long long;
const ll INF = 1e18L + 5;
const int mod = 1e9 + 7;

int n;
string k;

void add(int& a, int b){
    a += b;
    if(a >= mod){
        a -= mod;
    }
}

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    
    cin >> k;
    int D;
    cin >> D;
    vector<vector<int>> dp(D, vector<int>(2));
    //dp[sum][smaller_already] number of ways to chose digits so far such that the sum of digits modulo D is sum and smaller already says whether we already chosen some digit smaller than in K
    int len = k.size();
    dp[0][0] = 1;
    for(int where = 0; where < len; where++){
        vector<vector<int>> newDp(D, vector<int>(2));
        for(int sum = 0; sum < D; sum++){
            for(bool sm_already : {false, true}){
                for(int digit = 0; digit < 10; digit++){
                    if(digit > k[where] - '0' && !sm_already){
                        break;
                    }
                    add(newDp[(sum + digit) % D][sm_already || (digit < k[where] - '0')], dp[sum][sm_already]);
                }
            }
        }
        dp = newDp;
    }
    int answer = dp[0][false] + dp[0][true] - 1;
    answer %= mod;
    if(answer == -1){
        answer = mod - 1;
    }
    cout << answer;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i = 0;i<((ll)(n));i++)
#define reg(i,a,b) for(ll i = ((ll)(a));i<=((ll)(b));i++)
#define irep(i,n) for(ll i = ((ll)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(ll i = ((ll)(b));i>=((ll)(a));i--)
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T = int> void print(vector<T> v){for(auto a:v)cout<<a<<" ";cout<<endl;}

/*
*/

double l;

int main(void){
	cin>>l;
	cout<<fixed<<setprecision(15)<<l*l*l/27<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i,n) for(int i=0;i<n;++i)
#define all(v) v.begin(), v.end()
typedef long long int ll;
typedef unsigned long long ull;
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;}
typedef pair<ll,ll> P;
const long long MOD = 1e9+7;
const ll INF = 1LL << 60;

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


    if(a < b){
        cout << "a < b" << endl;
    }else if(a > b){
        cout << "a > b" << endl;
    }else{
        cout << "a == b" << endl;
    }

}


Measured memory_bytes: 3088
// atcoder/abc169/B/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; for (auto& i: v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { for (auto& i: v) is >> i; return is; }
template<typename T> ostream& operator << (ostream& os, set<T> s) { os << "#{"; for (auto& i: s) os << i << ","; os << "}"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; for (auto& i: m) os << i << ","; os << "}"; return os; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

using lli = long long int;
using ull = unsigned long long;
using point = complex<double>;
using str = string;
template<typename T> using vec = vector<T>;

constexpr array<int, 8> di({0, 1, -1, 0, 1, -1, 1, -1});
constexpr array<int, 8> dj({1, 0, 0, -1, 1, -1, -1, 1});
constexpr lli mod = 1e9 + 7;

#include <boost/multiprecision/cpp_int.hpp>
using big = boost::multiprecision::cpp_int;

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.setf(ios_base::fixed);
  cout.precision(20);

  int n;
  while (cin >> n) {
    vec<lli> v(n);
    cin >> v;

    if (count(v.begin(), v.end(), 0)) {
      cout << 0 << endl;
      continue;
    }

    double sum = 0;
    each (i, v) {
      sum += log10(i);
    }
    if (18.0 < sum) cout << -1 << endl;
    else {
      lli p = 1;
      each (i, v) p *= i;
      if (p <= 1000000000000000000LL) cout << p << endl;
      else cout << -1 << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 3996
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
A = [list(map(int, input().split())) for _ in range(N)] # N行M列

count = 0
for a in A:
    sum = 0
    for a_i, b_i in zip(a, B):
        sum += a_i * b_i
    sum += C
    if sum > 0:
        count += 1

print(count)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define faster() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl '\n'
#define mx_int_prime 999999937
#define mem(a,b) memset(a, b, sizeof(a) )
#define PB push_back
#define F first
#define S second
#define all(a) (a).begin(),(a).end()
typedef long long ll;
typedef long double ld;
const int mx=2e5+125;
const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const ll infLL = 9000000000000000000;
ll p[mx],a[mx],b[mx];
void solve()
{
    ld d,t,s;
    cin>>d>>t>>s;
    ld ans=d/s;
    if(ans<=t)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
}
int main()
{
    faster();
    int tc;
    tc=1;
    while(tc--)
        solve();
    return 0;
}


Measured memory_bytes: 3724
#include<iostream>
#include<string>
int main(void) {
	int sx, sy, tx, ty;
	std::cin >> sx >> sy >> tx >> ty;
	int dx = tx - sx;
	int dy = ty - sy;
	for (int L1 = 0; L1 < dx; L1++)
		std::cout << "R" ;
	for (int L2 = 0; L2 < dy; L2++)
		std::cout << "U" ;
	for (int L1 = 0; L1 < dx; L1++)
		std::cout << "L" ;
	for (int L2 = 0; L2 < dy; L2++)
		std::cout << "D" ;

	std::cout << "D" ;
	for (int L1 = 0; L1 < dx + 1; L1++)
		std::cout << "R" ;
	for (int L2 = 0; L2 < dy + 1; L2++)
		std::cout << "U" ;
	std::cout << "L" ;

	std::cout << "U" ;
	for (int L1 = 0; L1 < dx + 1; L1++)
		std::cout << "L" ;

	for (int L2 = 0; L2 < dy + 1; L2++)
		std::cout << "D" ;
	std::cout << "R" << std::endl;
	system("pause");
}

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

int i=0,num[100];

int pop(){

  i--;
  return num[i];

}

void push(int x){
  num[i] = x;
  i++;

}

int main(){
  int x,ans1,ans2;
  char s[100];

  while( scanf("%s", s) != EOF ){
    if ( s[0] == '+' ){
      ans1 = pop();
      ans2 = pop();
      push(ans1 + ans2);
    }
    else if ( s[0] == '-' ){

      ans1 = pop();
      ans2 = pop();
      push(ans2 - ans1);
    }
    else if ( s[0] == '*' ){
      ans1 = pop();
      ans2 = pop();
      push(ans1 * ans2);
      
    }
    else {
      x = atoi(s);

      push(x);
      
    }
  }
  
  printf("%d\n",num[i-1]);
  return 0;
}

Measured memory_bytes: 548
#include <iostream>
#include <deque>
#include <string>
#include <vector>
#include <queue>
#include <cstdio>
#include <stack>
#include <algorithm>
#include <cstring>
#include <cctype>
#include <cstdio>
#include <cmath>
#include<list>
#include <cstdlib>
using namespace std;
typedef long long ll;

int n;

list<int> p;

int main()
{
    scanf("%d",&n);
    char s[20];
    int x;
    for(int i = 0; i < n; ++i){
        scanf("%s",s);
        if(s[0] == 'i'){
            scanf("%d",&x);
            p.push_front(x);
        }else if(s[6] == 'F'){
            p.pop_front();
        }else if(s[6] == 'L'){
            p.pop_back();
        }else if(s[0] == 'd'){
            scanf("%d",&x);
            for(list<int>::iterator it = p.begin(); it != p.end(); ++it){
                if(*it == x){
                    p.erase(it);
                    break;
                }
            }
        }
    }
    for(list<int>::iterator it = p.begin(); it != p.end(); ++it){
        printf("%s%d",it == p.begin() ? "" : " ", *it);
    }
    printf("\n");
    return 0;
}

Measured memory_bytes: 34456
import java.util.*;
import java.io.PrintWriter;
import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		int w = parseInt(sc.next());
		int a = parseInt(sc.next());
		int b = parseInt(sc.next());
		sc.close();
		int d = 0;
		if(a<b) {
			d = b-(a+w);
		} else {
			d = a-(b+w);
		}
		if(d<0)d=0;
		out.println(d);
	}
}


Measured memory_bytes: 21716
K = int(input())
P = [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]

print(P[K - 1])

Measured memory_bytes: 2940
//#include<iostream>
#include<cstring>
#include<cstdio>
//#include<math.h>
//#include<set>
//#include<queue>
//#include<bitset>
//#include<vector>
#include<algorithm>
#include<stdlib.h>
using namespace std;
//#define int long long
#define LL long long
int qread()
{
	char c; int s=0,f=1; while ((c=getchar())<'0' || c>'9') (c=='-') && (f=-1);
	do s=s*10+c-'0'; while ((c=getchar())>='0' && c<='9'); return s*f;
}

//Pay attention to '-' , LL and double of qread!!!!


int n;
#define maxn 500010
const int inf=1e9;
int a[maxn],mx[maxn],mx2[maxn],pos1[maxn],pos2[maxn];
 
inline void up(int x, int delta, int pos)
{
	if(mx[x]<=delta && pos!=pos1[x])
	{
		mx2[x]=mx[x];
		pos2[x]=pos1[x];
		mx[x]=delta;
		pos1[x]=pos;
	}
	else if(mx2[x]<delta && pos!=pos1[x]) mx2[x]=delta, pos2[x]=pos; 
}
 
int main()
{
	n=qread(); int N=1<<n;
	for(int i=0;i<N;i++) mx[i]=qread(), mx2[i]=-inf, pos1[i]=i;
	int ans=-inf;
	for(int i=1;i<N;i++)
	{
		for(int j=0;j<18;j++)  if(i&(1<<j)) 
		up(i,mx[i^(1<<j)],pos1[i^(1<<j)]), up(i,mx2[i^(1<<j)],pos2[i^(1<<j)]);
		ans=max(ans, mx[i]+mx2[i]);
//		printf("%d %d %d %d\n", mx[i], pos1[i], mx2[i], pos2[i]);
		printf("%d\n", ans);
	}
	
	return 0;
}

Measured memory_bytes: 10240
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
const ll MOD = 1000000007;
const ll INF = 2147483647;
const ll LINF = 9223372036854775807;
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()

int main() {
	ll n, a, b; cin >> n >> a >> b;
	ll ans = n/(a+b);
	ans*=a;
	ans+=min(a,n%(a+b));
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		try {
			String str = br.readLine();
			String strr = str.substring(0,str.length()-8);
			System.out.println(strr);
//			long max  = 1000000007;
		}catch (Exception e) {
			System.exit(0);
		}
	}

}


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

int main() {
  int n;
  cin >>n;
  vector<int> h(n);
  rep(i,n) cin >>h[i];
  reverse(h.begin(), h.end());
  bool can = true;
  rep(i,n-1){
    if(h[i]<h[i+1]) h[i+1]--;
    if(h[i]<h[i+1]){
      can = false;
      break;
    }
  }
  if(can) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 640
<?php
  
fscanf(STDIN,"%d",$n);
$a = explode(" ",trim(fgets(STDIN)));
sort($a);
$min = $a[0];
$mons = 10000000000000;
while(true){
	for($i=0;$i<=count($a);$i++){
 		if($i==count($a)){
          echo $min;
          exit;
        }
      	if($a[$i]%$min!=0) {
          $mons = $a[$i]%$min;
          $a[$i] = $mons;
        }
      	if($min>$mons){
          $min = $mons;
          break;
        }
	}
}


Measured memory_bytes: 12792
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        long p = sc.nextLong();
        long ans = 1;
        Map<Long, Long> map = primeNumMap(p);
        for (Entry<Long, Long> entry : map.entrySet()) {
            long e = entry.getValue();
            if (e >= n) {
                long a = e / n;
                ans *= Math.pow(entry.getKey(), a);            }
        }

        System.out.println(ans);
    }

    //素因数分解してmapにわたす。
    static Map<Long, Long> primeNumMap(long m) {
        Map<Long, Long> map = new HashMap<>();
        for (long i = 2; i <= m; i++) {

            if (m % i == 0) {
                while (m % i == 0) {
                    m /= i;
                    if (m == 1) {
                        if (map.containsKey(i)) {
                            map.put(i, map.get(i) + 1);
                        } else {
                            map.put(i, 1l);
                        }
                        return map;

                    } else {
                        if (map.containsKey(i)) {
                            map.put(i, map.get(i) + 1);
                        } else {
                            map.put(i, 1l);
                        }
                    }
                }
                if (isPrimeNum(m)) {
                    if (map.containsKey(m)) {
                        map.put(m, map.get(m) + 1);
                    } else {
                        map.put(m, 1l);
                    }
                    return map;
                }
            }

        }
        return map;
    }

    static boolean isPrimeNum(long m) {
        boolean ans = true;
        for (int i = 2; i <= Math.sqrt(m); i++) {
            if (m % i == 0) {
                return false;
            }
        }
        return ans;
    }

}

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

using namespace std;
#define sz(a) int(a.size())
#define ll  long long
#define mod (long long)(1e9+7)
#define endl '\n'
#define ENGZ ios::sync_with_stdio(0);ios_base::sync_with_stdio(0);cin.tie(0) , cout.tie(0) ;
#define pi (acos(-1))



ll fp(ll n , ll p )
{
    if(p==0)
        return 1;
    if(p==1)
        return n ;
    ll res = fp(n,p/2)%mod ;
    res=((res)*(res))%mod ;
    if(p%2)
        res=(res*n)%mod ;
    return res ;
}


vector< int> v;



int main()
{
    ENGZ;
    int n , a ;
    cin>>n ;
    for(int i=0 ; i<n; i++)cin>>a,v.push_back(a) ;
    map<int,int> mp;
    for(int i=sz(v)-1 ; i>=0 ; i--)
    {
        auto it = mp.upper_bound(v[i]);
        if(it != mp.end())
        {
            it->second -- ;
            if(it->second == 0)mp.erase(it);
        }
        mp[v[i]]++ ;
    }
    int ans = 0 ;
    for(auto i:mp)
        ans += i.second ;
    cout<<ans <<endl ;
    return 0;
}


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

int i;
char code[300],mes[150];
char encode[6][5]={{'a','b','c','d','e'},{'f','g','h','i','j'},{'k','l','m','n','o'},{'p','q','r','s','t'},{'u','v','w','x','y'},{'z','.','?','!',' '}};

int main(){
	while(fgets(code,300,stdin)!=NULL){
		code[strlen(code)-1]='\0';
		if(strlen(code)%2!=0)printf("NA\n");
		else{
			for(i=0;i<(signed)strlen(code);i+=2){
				if(code[i]-'1'<0 || code[i]-'1'>5 || code[i+1]-'1'<0 || code[i+1]-'1'>4){
					i=999;
					printf("NA\n");
				}
				else mes[i/2]=encode[code[i]-'1'][code[i+1]-'1'];
			}
			if(i<999){
				mes[i/2]='\0';
				printf("%s\n",mes);
			}
		}
		
	}
	return 0;
}

Measured memory_bytes: 524
N = int(input())
H = list(map(int, input().split()))

m = []
c = 0

for n in range(N - 1):
  if H[n] >= H[n + 1]:
    c += 1
  else:
    m.append(c)
    c = 0

m.append(c)
print(max(m))

Measured memory_bytes: 14252
#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <algorithm>

using namespace std;
using ld = long double;

struct point {
    ld x, y, c;
};

using vp = vector<point>;

const int M = 50;
const ld EPS = 1e-12;

ld dis(point a, point b) {
    ld dx = a.x - b.x;
    ld dy = a.y - b.y;
    return sqrt(dx * dx + dy * dy);
}

vp cyc_intersec(point a, point b) {
    ld d = dis(a, b);
    if (d > a.c + b.c + EPS || d < abs(a.c - b.c) - EPS) {
        return {};
    }

    ld p = acos(max(-1.0l, min(1.0l, (a.c * a.c + d * d - b.c * b.c) / (2 * a.c * d))));
    ld t = atan2(b.y - a.y, b.x - a.x);

    point p1, p2;
    p1.x = a.x + a.c * cos(t + p);
    p1.y = a.y + a.c * sin(t + p);
    p2.x = a.x + a.c * cos(t - p);
    p2.y = a.y + a.c * sin(t - p);

    return {p1, p2};
}

int calc(point x, const vp &cyc) {
    int r = 0;
    for (point y : cyc) {
        if (dis(x, y) < y.c + EPS) {
            r++;
        }
    }
    return r;
}

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

    int n, k;
    cin >> n >> k;
    vp p(n);
    for (int i = 0; i < n; i++) {
        cin >> p.at(i).x >> p.at(i).y >> p.at(i).c;
    }

    if (k == 1) {
        cout << 0 << endl;
        return 0;
    }

    ld l = 0, r = 2e5;
    for (int q = 0; q < M; q++) {
        ld mid = (l + r) / 2;

        vp cyc(n);
        for (int i = 0; i < n; i++) {
            cyc.at(i).x = p.at(i).x;
            cyc.at(i).y = p.at(i).y;
            cyc.at(i).c = mid / p.at(i).c;
        }

        bool f = false;

        for (point x : p) {
            if (calc(x, cyc) >= k) {
                f = true;
            }
        }

        for (int i = 0; i < n; i++) {
            for (int j = i + 1; j < n; j++) {
                vp t = cyc_intersec(cyc.at(i), cyc.at(j));
                for (point x : t) {
                    if (calc(x, cyc) >= k) {
                        f = true;
                    }
                }
            }
        }

        if (f) {
            r = mid;
        } else {
            l = mid;
        }
    }

    cout << fixed << setprecision(7) << r << endl;

    return 0;
}


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

int col[110][110];
int a[10010];

int main()
{
	ios::sync_with_stdio(false);
	int i,j,m,n,k;
	cin>>n>>m>>k;
	for(i=1;i<=k;i++)
	{
		cin>>a[i];
	}
	k=1;
	for(i=0;i<n;i++)
	{
		if(i&1)
		{
			for(j=m-1;j>=0;j--)
			{
				while(a[k]==0) k++;
				col[i][j]=k;
				a[k]--;
			}
		}
		else
		{
			for(j=0;j<m;j++)
			{
				while(a[k]==0) k++;
				col[i][j]=k;
				a[k]--;
			}
		}
	}
	for(i=0;i<n;i++)
	{
		for(j=0;j<m;j++)
		{
			if(j) cout<<" ";
			cout<<col[i][j]; 
		}
		cout<<"\n";
	}
	return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
 
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize("-ffloat-store")
 
#define int  long long
#define rep(i,begin,end) for(__typeof(end)i=(begin)-((begin)>(end));i!=(end)-((begin)>(end));i+=1-2*((begin)>(end)))
#define F first
#define S second
#define sz(x) ((int)x.size())
#define pb push_back
#define pf push_front
#define eb emplace_back
#define all(v) (v).begin(), (v).end()
#define mod 1000000007
#define what_is(x) cerr << #x << " is " << x <<"\n";
#define sortA(v) sort(v.begin(), v.end())
#define sortD(v) sort(v.rbegin(), v.rend())
#define PI 3.14159265358979323846
#define vout(a) for(auto x:a) cout<<x<<" ";
#define INF 10000000000000000 //1e16
 
// #define ordered_set tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
 
 
// using namespace __gnu_pbds;
using namespace std;
 
using ll  = long long;
using vi  = vector<int>;
using pii = pair<int,int>;
using vii = vector<pii>;
using mi  = multiset<int>;
using mii = multiset<pii>;
 
int lcm(int a,int b) {return (a*(b/__gcd(a,b)));}



void solve()
{
    int n,m,t,i,k,r,l,u,v,w,j,s,sum=0,pos,flag=0,count=0;
    string S,T,U; 
    // int a,b;
    cin>>l;
    cout<<fixed<<setprecision(10)<<(l/3.0)*(l/3.0)*(l/3.0);
}
 
 
signed 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);
    int t=1;
    // cin>>t;
    while(t--)
    {
        solve();
        if(t)cout<<"\n";
    }
    return 0;
}

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

#define fo(i,s,t) for(int i = s; i <= t; ++ i)
#define fd(i,s,t) for(int i = s; i >= t; -- i)
#define bf(i,s) for(int i = head[s]; i; i = e[i].next)
#define mp make_pair
#define fi first
#define se second
#define pii pair<int,int>
#define pb push_back
#define VI vector<int>
#define sf scanf
#define pf printf
#define fp freopen
#define SZ(x) ((int)(x).size())
#define IF_DEBUG 0
typedef long long ll;
typedef double db;
const int inf = 1<<30;
const ll INF = 1ll<<60;
const db Inf = 1e20;
const db eps = 1e-9;

void gmax(int &a,int b){a = (a > b ? a : b);}
void gmin(int &a,int b){a = (a < b ? a : b);}
ll Q, H, S, D, N, mn;

int main()
{
	cin >> Q >> H >> S >> D >> N;
	mn = D;
	if(Q*8 < mn) mn = Q*8;
	if(H*4 < mn) mn = H*4;
	if(S*2 < mn) mn = S*2;
	if(N%2==0) cout << N/2*mn << endl;
	else 
	{
		ll ans = N/2*mn;
		mn = S;
		if(Q*4 < mn) mn = Q*4;
		if(H*2 < mn) mn = H*2;
		cout << ans + mn << endl;
	}  
	return 0;
}

Measured memory_bytes: 256
N, K = map(int, input().split())

mod = 10**9+7
fac = [1]*(N+1)
rev = [1]*(N+1)
 
for i in range(1,N+1):
  fac[i] = i*fac[i-1]%mod
  rev[i] = pow(fac[i], mod-2, mod)
 
comb = lambda a,b:(fac[a]*rev[a-b]*rev[b])%mod
for i in range(1, K+1):
    ans = (comb(K-1, i-1)*comb(N-K+1, i))%mod if N-K+1>=i else 0
    print(ans)

Measured memory_bytes: 3444
#include <iostream>

int main() {
  long long x; std::cin >> x;
  long long d = 100;
  long long y = 0;
  
  while (d < x) {
    d += (d / 100);
    ++y;
  }
  
  std::cout << y << std::endl;
  
  return 0;
}

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

int main(){
    int n;
    double x=0;
    scanf("%d", &n);
    
    for (int i=1; i<=n; ++i) {
        if (i%2 != 0)
            ++x;
    }
    
    printf("%f\n", x/n);
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define VPII vector<pair<int,int> >
#define F first
#define S second
#define RF(x) freopen(x,"r",stdin)
#define WF(x) freopen(x,"w",stdout)
typedef long long LL;
using namespace std;
typedef pair<LL,LL> PLL;
typedef pair<int,int> PII;
const LL MOD = 1e9+7;
const int SIZE = 1e6+5;
const LL INF = 1LL<<58;
const double eps = 1e-13;

unordered_map<LL,LL> m;

int main(){
	LL x,y;cin>>x>>y;
	m[-y]=INF;
	m[y]=INF;
	m[x]=0;
	m[-x]=1;
	if(x==0)m[-x]=0;
	if(x<=y)m[y]=min(m[y],y-x);
	if(-x<=y)m[y]=min(m[y],m[-x]+(y-(-x)));
	if(x<=-y)m[-y]=min(m[-y],m[x]+(-y-x));
	if(-x<=-y)m[-y]=min(m[-y],m[-x]+(-y-(-x)));
	if(y==0)m[y]=min(m[y],m[-y]);
	else m[y]=min(m[y],m[-y]+1);
	printf("%lld",m[y]);
}


Measured memory_bytes: 384
#include <iostream>
#include <sstream>
#include <string>
#include <math.h>
using namespace std;

int main(){
        int a,b;
        cin >> a >> b;
        ostringstream oss;
        oss << a << b;
        string str = oss.str();
        int c=stoi(str);
        if((int)sqrt(c)*(int)sqrt(c) == c){
                cout << "Yes" << endl;
        }else{
                cout << "No" << endl;
        }

        return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <cctype>
#include <cstdio>
#include <vector>
using namespace std;

int main()
{
    int a,b;
    cin >> a >> b;
    if(a%3==0 || b%3==0 || (a+b)%3==0){
        cout << "Possible";
    }else{
        cout << "Impossible";
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(),(x).end())
#define ALL(x) x.begin(),x.end()
#define db(x) cout<<#x<<"="<<x<<endl
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, n, m) for(int i = n; i >= m; i--)
#define INF (1e9)
#define PI (acos(-1))
using namespace std;
typedef long long ll;

int main(){

  int A,B,C;
  cin >> A>>B>>C;

  cout << max(0,(C-(A-B))) <<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	vector<int> a(n,0);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    int ans=0;
    for(int i=0;i<n;i++){
        while(a[i]%2==0){
            ans++;
            a[i]=a[i]/2;
        }
    }
    cout<<ans<<endl;
}


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

 
/*
ll gcds(ll a,ll b){
    if(a<b){
        swap(a,b);
    }
    ll r=a%b;
    if(r==0){
        return b;
    }
    while(r>0){
        r=a%b;
        a=b;
        b=r;
    }
    return a;
}
 
 
ll lcms(ll a,ll b){
    ll mmr=gcds(a,b);
    a=a/mmr;
    b=b/mmr;
    return a*b*mmr;
}
*/

int main(){
    int A,B;
    cin>>A>>B;
    int mini=0;
    if(A*100%8==0){
        mini=A*100/8;
    }
    else{
        mini=A*100/8+1;
    }

    int maxi=0;
    if((A+1)*100%8==0){
        maxi=(A+1)*100/8-1;
    }
    else{
        maxi=(A+1)*100/8;
    }

    int start=B*10;
    int finish=(B+1)*10;
    int tmp=0;
    for(int i=start;i<finish;i++){
        if(mini<=i && i<=maxi){
            cout<<i<<endl;
            tmp++;
            break;
        }
    }
    if(tmp==0){
        cout<<-1<<endl;
    }
}

Measured memory_bytes: 256
//まともに使い方を理解していないくせにincludeしまくる人間のクズ
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <iostream>


//using namespace stdしないと表記がめんどくさいからね、仕方ないね
using namespace std;

//可読性を上げるためのdefineが仇となる典型的パターン
#define FOR(x) for(int i = 0; i < x; i++)

//ローカル変数とグローバル変数は使い分けよう！
stack<short> x, y;
short a[10], n, j, i, m, ans;

//関数って楽しいよね！（魔王スマイル）
void solve(short c, short sum, short cnt){
	if(cnt == n){
		if(sum == m) ans++;
		return;
	}
	if(cnt < n && c > 9) return;
	solve(c + 1, sum + c, cnt + 1);
	solve(c + 1, sum, cnt);
	return;
}

int main(){
	while(true){
		scanf("%d %d", &n, &m);
		if(n == 0 && m == 0) return 0;
		ans = 0;
		solve(0, 0, 0);
		printf("%d\n", ans);
	}
}

Measured memory_bytes: 1188
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>

using namespace std;

int main()
{
  int A, B, C;
  cin >> A >> B >> C;

  if (B / A > C) cout << C << endl;
  else cout << B / A << endl;
}

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


int n;

char S[2][60];
int dy[60][4][4];
const int MOD = 1000000007;

int go(int idx, int up, int down) {
	if (idx == n)return 1;

	auto& ret = dy[idx][up][down];
	if (ret != -1)return ret;
	ret = 0;

	if (S[0][idx] != S[1][idx]) {
		for (int u = 1; u <= 3; u++) {
			for (int d = 1; d <= 3; d++) {
				if (u != d && up!=u && down!=d) {
					ret += go(idx + 2, u, d);
					ret %= MOD;
				}
			}
		}
	}
	else {
		for (int p = 1; p <= 3; p++) {
			if (p != up && p != down) {
				ret += go(idx + 1, p, p);
				ret %= MOD;
			}
		}
	}
	return ret;

}


int main() {
	memset(dy, 0xff, sizeof(dy));
	scanf("%d%s%s", &n, S[0], S[1]);
	printf("%d", go(0, 0, 0));
}

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

#define NDEBUG
#ifdef DEBUG
#include "../cout11.h"
#undef NDEBUG
#endif
#include <cassert>

typedef long long ll;
typedef long double Double;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef pair<double,double> dd;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<long double> vD;

#define sz(a)  int((a).size())
#define pb  push_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define found(s,e)  ((s).find(e)!=(s).end())
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))
#define cons make_pair


bool solve(string& s) {
    int L = s.size();
    vi cnt(3,0);
    rep(i,L){
        cnt[s[i]-'a']++;
    }
    sort(ALL(cnt));
    cnt[1] -= cnt[0];
    cnt[2] -= cnt[0];
    if (cnt[1] == 0 && cnt[2] == 0) return true;
    if (cnt[1] == 0 && cnt[2] == 1) return true;
    if (cnt[1] == 1 && cnt[2] == 1) return true;
    return false;
}

int main() {
    string s; cin >> s;
    cout << (solve(s) ? "YES":"NO") << endl;
    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <string>
#include <map>
#include <queue>
#include <vector>
#include <cstdlib>
#define mp make_pair
#define pb push_back
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
const int DMAX=100000+5;
const int MOD=1000000000+7;
template<class T> inline void read(T &x){
	x=0;
	T f=1;
	char ch=getchar();
	while(ch<'0' || ch>'9'){
		if(ch=='-'){
			f=-1;
		}
		ch=getchar();
	}
	while(ch<='9' && ch>='0'){
		x=x*10+(ch-'0');
		ch=getchar();
	}
	x*=f;
}

ll n,m;
int main(){
	read(n),read(m);
	if(n==0 || n==m){
		cout<<0<<endl;
		return 0;
	}
	cout<<min(n%m,m-(n%m))<<endl;
	return 0;
}


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

int main()
{
	double a, b, c;
	cin >> a >> b >> c;
	double h =  b *sin((c *  M_PI )/ 180);
	cout << fixed << (a * h) / 2 << endl;
	cout << a + b + sqrt(a * a + b * b - 2 * a * b * cos((c * M_PI)/180)) << endl;
	cout << h << endl;

	return 0;
}

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

#define crap ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define db1(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'
#define rep(i,n) for(int i=0;i<(n);++i)
#define repA(i,a,n) for(int i=a;i<=(n);++i)
#define repD(i,a,n) for(int i=a;i>=(n);--i)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define CN cout<<"NO\n"
#define CY cout<<"YES\n"

using namespace std;
using ll = long long;
ll gcd(ll a, ll b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b);  
      
} 
// #define MAXN 1000001 
// ll sieve[MAXN]; 
// void makesieve()
// {
//     sieve[1] = 1; 
//     for (int i = 2; i < MAXN; i++) 
//         sieve[i] = i; 
//     for (int i = 4; i < MAXN; i += 2) 
//         sieve[i] = 2; 
//     for (int i = 3; i * i < MAXN; i++) { 
//         if (sieve[i] == i) { 
//             for (int j = i * i; j < MAXN; j += i) 
//                 if (sieve[j] == j) 
//                     sieve[j] = i; 
//         } 
//     } 
// }
ll powerflow(ll x, ll n)
{
    ll res;
    if (n == 0) {
        return 1;
    }
    res = powerflow(x, n-1);             // recurse
    if(INT_MAX / res < x) {          // check for overflow
        return -1; //LONG_MAX;
    }
    return x * res;
}
ll mod=1000000007;
ll power(ll a,ll b,ll m)
{
    a%=m;b%=m;
    ll res=1;
    while(b!=0)
    {
        if(b&1)
        res=(res*a);
        b=b/2;
        a=(a*a)%mod;
    }
    return res;
}
struct compare  
 {  
   bool operator()(const int& l, const int& r)  
   {  
       return l > r;  
   }  
 };
void solve()
{
    string s;
    cin>>s;
    cout<<s;
    if(s[s.size()-1]=='s')
        cout<<"es";
    else
        cout<<"s";
}
int main()
{
    crap;
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r", stdin) ;
        freopen("output.txt","w", stdout) ;
        freopen("error.txt","w", stderr) ;
    #endif
    int t;t=1;
   // cin>>t;
    while(t--)
        {solve();}
    return 0;
}

Measured memory_bytes: 3640
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		StringTokenizer st = new StringTokenizer(br.readLine());
		int[] x = new int[5];
		
		StringBuilder sb = new StringBuilder();
		
		for(int i=0; i<5; i++) {
			x[i] = Integer.parseInt(st.nextToken());
			
			if(x[i] == 0)
				sb.append(i+1 + "\n");
		}
		
		System.out.println(sb);
		
	}

}

Measured memory_bytes: 35868
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int i=0,j=0;
        while(true){
            int H=sc.nextInt();
            int W=sc.nextInt();
            if(H==0&&W==0)break;
            for(i=0;i<H;i++){
                for(j=0;j<W;j++){
                    System.out.print("#");
                }
                System.out.print("\n");
        }
System.out.print("\n");
    }
}
}


Measured memory_bytes: 36500
s = input()
t = input()

difArr = []

for i in range(len(s) - len(t) + 1):
  difCount = 0
  for j in range(len(t)):
    if not(s[i + j] == t[j]):
      difCount += 1
  difArr.append(difCount)

print(min(difArr))


Measured memory_bytes: 8972
import java.io.IOException;
import java.util.Scanner;
class Main{
	public static void main(String[] args)throws NumberFormatException, IOException{
		//System.out.println(" ");
		Scanner scan = new Scanner(System.in);
		int n =scan.nextInt();
		String taro;
		String hanako;
		int taroWin = 0;
		int hanakoWin = 0;
		for(int kaisuu=0; kaisuu<n; kaisuu++){
			taro = scan.next();
			hanako = scan.next();
			taro = taro + "0";
			hanako = hanako + "0";
			char[] taroChar = taro.toCharArray();
			char[] hanakoChar = hanako.toCharArray();
			for(int i=0;i<taro.length() && i<hanako.length(); i++){
				//?????????????????????
				String charToString = String.valueOf(taroChar[i]);
				byte[] taroNumber = charToString.getBytes("US-ASCII");
				charToString = String.valueOf(hanakoChar[i]);
				byte[] hanakoNumber = charToString.getBytes("US-ASCII");
//				System.out.println(taroNumber[0]+" "+hanakoNumber[0]);
				if(taroNumber[0] > hanakoNumber[0]){
					taroWin += 2;
					hanakoWin -= 1;
					break;
				}
				else if(taroNumber[0] < hanakoNumber[0]){
					hanakoWin += 2;
					taroWin -= 1;
					break;
				}
			}
			taroWin += 1;
			hanakoWin += 1;
		}
		System.out.println(taroWin+" "+hanakoWin);
	}
}

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

int main(){
  string s;
  getline(cin, s);
  string ans;
  for(int i = 0; i < s.size(); i++){
     if(i == 0) ans += s.at(i);
     else if(s.at(i - 1) == ' ') ans += s.at(i);
  }
  cout << ans << endl;
}

Measured memory_bytes: 3024