akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  string S, T;
  cin >> S >> T;
  vector<char> ans(2*N);
  for(int i = 0; i < 2*N; i++){
    if(i % 2 == 0){
      ans.at(i) = S.at(i/2);
    }
    else{
      ans.at(i) = T.at(i/2);
    }
  }
  for(int i = 0; i < 2*N; i++){
    cout << ans.at(i);
  }
}

Measured memory_bytes: 256
def test():
    s = list(input())
    a = len(s) - 1
    for i in range(2**a):
        op = ["-"]*a
        for j in range(a):
            if (i>>j)&1:
                op[j] = "+"
        ans = ""
        for n,k in zip(s,op+[""]):
            ans += n + k
        if eval(ans) == 7:
            print(ans+"=7")
            return


if __name__ == "__main__":
    test()


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

using namespace std;
using namespace std;
#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
//rep…「0からn-1まで」の繰り返し
#define rep2(i,s,n) for(long long i=s; i<=(long long)(n);i++)
//rep2…「sからnまで」の繰り返し
#define repr(i,s,n) for(long long i=s;i>=(long long)(n);i--)
//repr…「ｓからnまで」の降順の繰り返し

typedef long long ll;

const ll inf = 1e9+7;
const ll mod = 1e9+7;

int main(){
    ll n,k;
    cin>>n>>k;

    vector<ll>h(n);
    rep(i,n)cin>>h[i];

    sort(h.begin(),h.end());
    
    ll ans=inf;

    rep(i,n-k+1)ans=min(ans,h[i+k-1]-h[i]);

    cout<<ans<<endl;

}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
constexpr int di[] = { 0, 1, 0, -1 }, dj[] = { 1, 0, -1, 0 };
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define sortr(v) sort((v).rbegin(), (v).rend())
#define all(v) (v).begin(), (v).end()
#define MAX 2000001
#define vmax 10000
constexpr ll inf = 1000000000000;
/*cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);*/

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











Measured memory_bytes: 256
import java.util.Scanner;


class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int [] a = new int[4];
		
		a[0] = scan.nextInt();
		a[1] = scan.nextInt();
		a[2] = scan.nextInt();
		int i, j;
		for (i = 1;i <= 2;i++){
			a[3] = a[i];
			for(j = i - 1;j >= 0 && a[j] > a[3];j--){
				a[j + 1] = a[j];
			}
			if(j != i - 1){
				a[j + 1] = a[3];
			} 
		}
		System.out.print(a[0] + " ");
		System.out.print(a[1] + " ");
		System.out.println(a[2]);
		scan.close();
	}
}


Measured memory_bytes: 26176
#include <stdio.h>
#include <iostream>
#include <vector>

using namespace std;

int main(){
    int N;
    string S;
    string answer = "No";

    cin >> N >> S;

    if (N % 2 == 0){
        if (S.substr(0, N / 2) == S.substr(N / 2, N - 1)){
            answer = "Yes";
        }
    }
 

    cout << answer << endl;
    
    return 0;
}


Measured memory_bytes: 256
# include <stdio.h>
# include <bits/stdc++.h>
using namespace std;
# define fi cin
# define fo cout
# define x first
# define y second
# define ll long long
# define IOS ios_base :: sync_with_stdio(0);cin.tie(0)
# define p(v) cerr << #v << " = " << v << '\n'
# define p2(v) cerr << #v << " = " << (complex < int > (v.x,v.y)) << '\n'
# define vi vector < int >
# define vll vector < ll >
# define pii pair < int , int >
# define mp make_pair
const int mod = 1e9 + 7;
int main(void)
{
    #ifdef CF
    freopen("input","r",stdin);
    #endif // CF
    srand(time(0));
    fo << fixed << setprecision(7);
    cerr << fixed << setprecision(7);
    static int a[1 << 20];
    static int b[1 << 20];
    static int A[1 << 20];
    static int B[1 << 20];
    int n;
    fi>>n;
    for (int i = 1;i <= n;++i)
        fi>>a[i];
    for (int i = 1;i <= n;++i)
        fi>>b[i];
    for (int i = 1;i <= n;++i)
        if (a[i] != a[i-1])
            A[i] = a[i];
    for (int i = n;i;--i)
        if (b[i] != b[i+1])
            B[i] = b[i];
    for (int i = 1;i <= n;++i)
        if (A[i] > b[i] || B[i] > a[i] || (A[i] && B[i] && A[i] != B[i]))
            return fo << "0\n",0;
    int ans = 1;
    for (int i = 1;i <= n;++i)
        if (!A[i] && !B[i])
            ans = (1ll * ans * min(a[i],b[i])) % mod;
    fo << ans << '\n';
    cerr << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';
    return 0;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
 
typedef long long LL;
typedef pair<int, int> pii;
 
#define fst first
#define snd second
#define pb push_back
#define eb emplace_back
#define REP(i, a, b)  for(int i = (a), i##end = (b); i < i##end; ++i)
#define DREP(i, a, b) for(int i=(a-1), i##end = (b); i >=i##end; --i)
 
template <typename T> bool chkmax(T& a, T b) { return a < b ? a = b, 1 : 0; }
template <typename T> bool chkmin(T& a, T b) { return a > b ? a = b, 1 : 0; }
 
const int mod = 1e9 + 7;
const int oo = 0x3f3f3f3f;
const int maxn = 200000 + 10;

template<typename T> T read() {
    T n(0), f(1);
    char ch = getchar();
    for( ;!isdigit(ch); ch = getchar()) if(ch == '-') f = -1;
    for( ; isdigit(ch); ch = getchar()) n = n * 10 + ch - 48; 
    return n * f;
}

char s[maxn];
int sum[26];
long long ans;

int main() {
#ifdef Wearry
    freopen("data.txt", "r", stdin);
    freopen("ans.txt", "w", stdout);
#endif

    scanf("%s", s);
    int len = strlen(s);
    for(int i = 0; i < len; ++i) {
        sum[s[i] - 'a'] ++;
        ans += (i+1) - sum[s[i] - 'a'];
    }
    printf("%lld\n", ans + 1);

    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

using namespace __gnu_pbds; 
using namespace std;

using   ll=long long;
using   ld=long double;

#define fast        	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ordered_set 	tree<pll, null_type,less<pll>, rb_tree_tag,tree_order_statistics_node_update>

#define endl        	"\n"
#define pb          	push_back
#define mp          	make_pair
#define F           	first
#define S           	second

#define ALL(v)      	v.begin(),v.end()
#define ALLR(v)     	v.rbegin(),v.rend()
#define pii         	3.14159265358979323
#define inf     		LLONG_MAX
#define ones(x)     	__builtin_popcount(x)
#define fill(a,b)   	memset(a,b,sizeof(a))
#define mod 			1000000007

ll mod_pow(ll a,ll b) 
{
    ll res = 1;
    while(b)	
    {
        if(b&1) 	
        {
        	res=(res*a)%mod;
        }
        a=(a*a)%mod;
        b>>=1;
    }
    return res;
}

ll mod_inverse(ll a) 
{
	return mod_pow(a , mod-2);
}

void solve() 
{
	int n;
	
	cin >> n;
	
	int a[n] , b[n];
	
	for(int i = 0; i < n; ++i) {
		cin >> a[i] >> b[i];
	}
	
	sort(a , a+n);
	sort(b , b+n);
	
	if(n % 2) {
		cout << b[n/2] - a[n/2] + 1;
		return;
	}
	
	int low = a[n/2] + a[n/2 - 1];
	int high = b[n/2] + b[n/2 - 1];
	
	cout << high - low + 1;
}

signed main() {
    fast;
    
    ll t;
 
    t=1;
    
    //cin >> t;
    
    while(t--) {
        solve();
    }
 
    return 0;
}


Measured memory_bytes: 5164
//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF =1e9;
const ll LINF=1e18;
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; 
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
//setprecision(15)有効数字15桁
//-std=c++14
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a / gcd(a, b)*b;}
int n, m;
vector<int> a;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    map<int,int> m;
    for (int i = 0; i < n; i++)
    {
        int temp;
        cin >> temp;
        a.push_back(temp);
        m[temp]++;
        if(m[temp]>1)return NO,0;
    }
    YES;
}



Measured memory_bytes: 10484
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define INF 2e9
using namespace std;
typedef long long ll;
void inputVector(vector<int> * p, int a){ REP(i, a){ int input; cin >> input; p -> push_back(input); }}

int main(int argc, const char * argv[]) {  
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, m, s = 0; cin >> n >> m;
  vector<int> x, d;
  inputVector(&x, m);
  sort(x.begin(), x.end());
  REP(i, m - 1) {
    d.push_back(x[i+1] - x[i]);
  }
  sort(d.begin(), d.end(), greater<int>());
  REP(i, m - 1) {
    if (i > n - 2) {
      s += d[i];
    }
  }
  cout << s << endl;
  return 0;
}

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

int	main()
{
	int	N, M, Q;
	cin >> N >> M >> Q;
	vector<vector<int>>	cnt_vec(N + 1, vector<int>(N + 1, 0));
	int	L, R;
	for (int i = 0; i < M; ++i) {
		cin >> L >> R;
		cnt_vec.at(L).at(R) += 1;
	}
	vector<vector<int>>	cumsum(N + 1, vector<int>(N + 1, 0));
	for (int i = N; i > 0; --i) {
		for (int j = 1; j <= N; ++j) {
			cumsum.at(i).at(j) = cnt_vec.at(i).at(j);
			cumsum.at(i).at(j) += cumsum.at(i).at(j - 1);
			if (i < N) {
				cumsum.at(i).at(j) += cumsum.at(i + 1).at(j);
				cumsum.at(i).at(j) -= cumsum.at(i + 1).at(j - 1);
			}
		}
	}
	int	p, q;
	for (int i = 0; i < Q; ++i) {
		cin >> p >> q;
		cout << cumsum.at(p).at(q)  << endl;
	}
}


Measured memory_bytes: 2944
#include <iostream>
#include<algorithm>
#include<sstream>
#include<cmath>
#include<vector>
#include<iomanip>
#include<map>
#include<set>
#include<queue>
#include<deque>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i,n) for(int i = 0; i < n;i++)
#define mod 1000000007
#define pi  acos(-1)
#define c(n) cout << fixed <<setprecision(10) << n << endl
int main() {
	int a, b, x; cin >> a >> b >> x;
	ld d;
	if (2 * x > a * a * b)d = 2.0 *(b * a * a - x) / pow(a,3);
	else d = 1.0 * b * b * a / (2 * x);
	c((atan(d)) / pi * 180);
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	found := false
	for i := 0; i < n; i++ {
		for j := 0; j < n; j++ {
			s := 4*i + 7*j
			if s == n {
				found = true
			}
		}
	}
	if found {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


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

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)

using ll = long long;
using ld = long double;
ll INF = LLONG_MAX;

using vi = vector<int>;
using vll = vector<ll>;
using pii = pair<int, int>;

namespace output {
	void pr(int x) { cout << x; }
	void pr(long x) { cout << x; }
	void pr(ll x) { cout << x; }
	void pr(unsigned x) { cout << x; }
	void pr(unsigned long x) { cout << x; }
	void pr(unsigned long long x) { cout << x; }
	void pr(float x) { cout << x; }
	void pr(double x) { cout << x; }
	void pr(ld x) { cout << x; }
	void pr(char x) { cout << x; }
	void pr(const char* x) { cout << x; }
	void pr(const string& x) { cout << x; }
	void pr(bool x) { pr(x ? "true" : "false"); }
	template<class T> void pr(const complex<T>& x) { cout << x; }
	
	template<class T1, class T2> void pr(const pair<T1,T2>& x);
	template<class T> void pr(const T& x);
	
	template<class T, class... Ts> void pr(const T& t, const Ts&... ts) { 
		pr(t); pr(ts...); 
	}
	template<class T1, class T2> void pr(const pair<T1,T2>& x) { 
		pr("{",x.f,", ",x.s,"}"); 
	}
	template<class T> void pr(const T& x) { 
		pr("{"); // const iterator needed for vector<bool>
		bool fst = 1; for (const auto& a: x) pr(!fst?", ":"",a), fst = 0; 
		pr("}");
	}
	
	void print() { pr("\n"); } // print w/ spaces
	template<class T, class... Ts> void print(const T& t, const Ts&... ts) { 
		pr(t); if (sizeof...(ts)) pr(" "); print(ts...); 
	}
}

using namespace output;

ll MOD = 1e9+7;
ll binpow(ll a, ll b) {
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        res %= MOD;
        a = a * a;
        a %= MOD;
        b >>= 1;
    }
    return res;
}



const ll MAXN = 2e6+20;

vll fact (MAXN);
vll invfact (MAXN);
vll inv (MAXN);

ll choose(ll n, ll k) {
    return fact[n] * invfact[k] % MOD * invfact[n-k] % MOD;
}

int main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	fact[0] = 1;
    FOR(i, 1, MAXN) fact[i] = fact[i-1] * i % MOD;

    inv[1] = 1;
    FOR(i, 2, MAXN) inv[i] = (MOD - (MOD/i) * inv[MOD%i] % MOD) % MOD;

    invfact[0] = 1;
    FOR(i, 1, MAXN) invfact[i] = invfact[i-1] * inv[i] % MOD;

	ll K; cin >> K;
	string S; cin >> S; 
	ll N = S.size() + K;
	ll ans = 0;
	F0R(i, K+1) {
		ll l = N - i - 1;
		ans += binpow(26, i) * binpow(25, l - S.size() + 1) % MOD * choose(l, S.size() - 1) % MOD;
		ans %= MOD;
	}
	print(ans);
}

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

using namespace std;

using ll = long long;
using ld = long double;

template<class W>
struct Tree {
    int n;
    std::vector<std::vector<std::pair<int, W>>> adj;

    explicit Tree(int _n) : n(_n), adj(_n) {}

    void add_edge(const int v1, const int v2, const W w) {
        adj[v1].emplace_back(std::make_pair(v2, w));
        adj[v2].emplace_back(std::make_pair(v1, w));
    }

    std::pair<int, W> Dfs(const int prev, const int cur) {
        std::pair<int, W> res(cur, 0);
        for (const auto &e : adj[cur]) {
            if (prev == e.first) continue;
            auto nxt = Dfs(cur, e.first); nxt.second += e.second;
            if (res.second < nxt.second) res = nxt;
        }
        return res;
    }

    std::pair<int, int> farthest_pair;
    W Diameter() {
        const auto v1 = Dfs(-1, 0), v2 = Dfs(-1, v1.first);
        farthest_pair = std::make_pair(v1.first, v2.first);
        return v2.second;
    }
};

bool Solve() {
    int n;
    cin >> n;

    Tree<int> tree(n);
    for (int i = 0, a, b; i + 1 < n; ++i) {
        cin >> a >> b;
        tree.add_edge(a - 1, b - 1, 1);
    }

    return tree.Diameter() % 3 != 1;
}

int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    // cout << setprecision(8) << setiosflags(ios::fixed);

    if (Solve()) cout << "First" << endl;
    else cout << "Second" << endl;

    return 0;
}


Measured memory_bytes: 18176
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(10000)

# Debug output
def chkprint(*args):
    names = {id(v):k for k,v in inspect.currentframe().f_back.f_locals.items()}
    print(', '.join(names.get(id(arg),'???')+' = '+repr(arg) for arg in args))

# Binary converter
def to_bin(x):
    return bin(x)[2:]

# Set 2 dimension list
def dim2input(N):
    li = []
    for _ in range(N):
        li.append(list(map(int, input())))
    return li

# --------------------------------------------

dp = None

def main():
    N, A, B = list(map(int, input().split()))

    print(min(N*A, B))

main()


Measured memory_bytes: 5056
n, m = map(int, input().split())

s, c = [], []
for _ in range(m):
  s_, c_ = map(int, input().split())
  s.append(s_)
  c.append(c_)

for i in range(10**n):
  ans = str(i)
  if len(ans) == n and all([ans[s[j]-1] == str(c[j]) for j in range(m)]):
    print(ans)
    exit()

print(-1)

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

struct edge{
  int to, cost;
};

int main(int argc, char *argv[]){
    int n, m, r;
  cin >> n >> m >> r;
  vector<vector<edge> > g(n);
  int from;
  for (int i = 0; i < m; i++) {
    edge e;
    cin >> from >> e.to >> e.cost;
    g[from].push_back(e);
  }
  int dp[n];
  for (int i = 0; i < n; i++) {
    dp[i] = 1e9;
  }
  dp[r] = 0;
  //???????????§?????????
  bool update = true;
  while(update){
    update = false;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < g[i].size(); j++) {
        edge e = g[i][j];
        if(dp[e.to] > dp[i] + e.cost){
          dp[e.to] = dp[i] + e.cost;
          update = true;
        }
      }
    }
  }
  for (int i = 0; i < n; i++) {
    if(dp[i] == 1e9)std::cout << "INF" << std::endl;
    else std::cout << dp[i] << std::endl;
  }
  return 0;
}

Measured memory_bytes: 10244
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

// vectorの重複削除
// std::sort(test.begin(), test.end());
// test.erase(std::unique(test.begin(), test.end()), test.end());

using namespace std;
using ll = long long;
using P = pair<int, int>; // vector<P> ba(n); みたいな感じですぐ使える ba[i] = P(a, b); make_pairをしなくてもいい
// typedef vector<int> v;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}
#define rep(i, c) for(int i = 0; i < int(c); i++)
#define ALL(x) (x).begin(), (x).end() //sort(ALL(obj))みたいな
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値
#define pb push_back //
// const int MOD = 1000000007;
// string alpha="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
// printf("%.20f\n", ans); あれ
// const double PI = 3.141592653589793238462643383;


int main() {
  int n,d,x; cin>>n>>d>>x;
  int a,ans=0;
  rep(i,n) {
    cin>>a;
    ans += (d%a==0) ? d/a : d/a+1;
  }
  cout << ans + x << endl;
}


Measured memory_bytes: 3176
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<ll,ll> P;

void Main() {
  ll n,m,x;
  cin >> n >> m >> x;
  string s[n];
  rep(i,n) R s[i];
  ll ans=MAX;
  rep(t,1<<n) {
    vector<P> v;
    P p=P(0,0);
    REP(i,1,n) {
      ll f1=!(t&(1<<(i-1))),f2=!(t&(1<<i));
      if(f1==f2) p.S=i;
      else {
        v.pb(p);
        p=P(i,i);
      }
    }
    v.pb(p);
    ll c[v.size()];
    mem(c);
    ll sum=v.size()-1;
    rep(j,m) {
      ll d[v.size()],f=0;
      mem(d);
      rep(k,v.size()) {
        REP(i,v[k].F,v[k].S+1) d[k]+=s[i][j]=='1';
        if(d[k]>x) goto next;
        if(c[k]+d[k]>x) f=1;
      }
      if(f) {
        sum++;
        rep(k,v.size()) c[k]=d[k];
      } else {
        rep(k,v.size()) c[k]+=d[k];
      }
    }
    ans=min(ans,sum);
  next:;
  }
  pr(ans);
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


Measured memory_bytes: 256
a1,a2,a3 = map(int, input().split())
a = [a1,a2,a3]

b = [0,0,0,0,0,0]
b[0] = abs(a[1]-a[0]) + abs(a[2]-a[1])
b[1] = abs(a[2]-a[0]) + abs(a[1]-a[2])
b[2] = abs(a[0]-a[1]) + abs(a[2]-a[0])
b[3] = abs(a[2]-a[1]) + abs(a[0]-a[2])
b[4] = abs(a[0]-a[2]) + abs(a[1]-a[0])
b[5] = abs(a[1]-a[2]) + abs(a[0]-a[1])


print(int(min(b)))

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

int main() {
  string s; cin >> s;
  ll n = s.size();
  ll ans = 0;
  string s2;
  rep(i,n/2){
    s2 += s.at(n-i-1);
  }
  rep(i,n/2){
    if(s.at(i)!=s2.at(i)) ans++;
  }
  cout << ans << endl;
  
  return 0;
}

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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)
#define mp make_pair

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    REP(i,(signed)s.size()){
        if(i % 2 == 0){
            if(s[i] != 'R' && s[i] != 'U' && s[i] != 'D'){
                Yes(false);
                return 0;
            }
        }else{
            if(s[i] != 'L' && s[i] != 'U' && s[i] != 'D'){
                Yes(false);
                return 0;
            }
        }
    }
    Yes(true);
    return 0;
}

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

using namespace std;
using ll =long long;
typedef pair<int,int> P;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }
//Write From this Line

int main()
{
	int d;
	cin >> d;
	vector<int> c(26);
	rep(i,26) cin >> c[i]; 
	vector<vector<int>> s(d,vector<int>(26));
	rep(i,d) rep(j,26) cin >> s[i][j];
	int count = 14;
	rep(i,d){
		cout << count << endl;
		count ++;
		if(count == 27) count = 1;
	}
}


Measured memory_bytes: 3680
#include<bits/stdc++.h>
using namespace std;
double n,d,x[200010],y[200010],ans;
int main(){
    cin>>n>>d;
    for (int i=0;i<n;i++) cin>>x[i]>>y[i];
    for (int i=0;i<n;i++){
        double num=x[i]*x[i]+y[i]*y[i];
        num=sqrt(num);
        if (num<=d) ans++;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 6960
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

use std::cmp::{max, min};

fn main() {
    input! {
        n: usize,
        a: [i64; n],
    }

    let mut tbl = vec![vec![None; n + 1]; n + 1];
    let ans = rec(0, n - 1, &a, &mut tbl).0;
    println!("{}", ans);
}

fn rec(l: usize, r: usize, a: &[i64], tbl: &mut Vec<Vec<Option<(i64, i64)>>>) -> (i64, i64) {
    if l == r {
        return (0, a[l]);
    }

    if tbl[l][r].is_some() {
        return tbl[l][r].unwrap();
    }

    let mut ans = (i64::max_value(), 0);
    for m in l..r {
        let ll = rec(l, m, a, tbl);
        let rr = rec(m + 1, r, a, tbl);
        let w = ll.1 + rr.1;
        let cur = (ll.0 + rr.0 + w, w);
        ans = min(ans, cur);
    }

    tbl[l][r] = Some(ans);
    ans
}


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

int main(){
    int a,b;
    cin >> a >> b;
    int ans=1;
    int c;
    c=a;
    while(c<b){
        c+=a-1;
        ++ans;
    }

if(b==1){
    cout << 0 << endl;
}
else{
    cout << ans << endl;
}

    return 0;
}

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

using namespace std;


int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, L;
  cin >> n >> L;
  vector<int> a(n);
  long long sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }        
  int s = -1;
  for (int i = 0; i + 1 < n; i++) {
    if (a[i] + a[i + 1] >= L) {
      s = i;
    }
  }
  if (s == -1) {
    cout << "Impossible\n";
    return 0;
  }
  cout << "Possible\n";
  for (int i = 0; i < s; i++) {
    cout << i + 1 << '\n';
  }
  for (int i = n - 1; i > s + 1; i--) {
    cout << i << '\n';
  }
  cout << s + 1 << '\n';
  return 0;
}

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

#pragma GCC optimize ("O2")
#pragma GCC optimize ("tree-vectorize")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define FFOR(i, a, b) FOR(i, a, b+1)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) FOR(i, 1, n+1)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define LEN(x) (int)(x).size()
#define DUMP(x) cerr<<__LINE__<<' '<<#x<<"="<<(x)<<endl;
#define pb push_back
#define eb emplace_back
#define mp make_pair

using namespace std;
using lint = long long;
using pii =  pair<int, int>;
using pll =  pair<lint, lint>;
template <typename T> using vc = vector<T>;
template <typename T> using vvc = vector<vector<T>>;
template <typename T> inline bool chmax(T &a, T b){if(a<b){a = b; return true;} return false;}
template <typename T> inline bool chmin(T &a, T b){if(a>b){a = b; return true;} return false;}

constexpr lint ten(int n) {return n==0 ? 1 : ten(n-1)*10;}

class vertex{
public:
    int x, y, dir;
    lint dist;
    vertex(int x, int y, int dir, lint dist) : x(x), y(y), dir(dir), dist(dist){}
};

class FPondSkater {
public:
    const lint INF = ten(15);
    int H, W, K, xs, ys, xe, ye;
    vc<int> dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
    vector<vvc<lint>> dist;
    vc<string> grid;

    inline bool valid(int x, int y){
        return 0<=x and x<H and 0<=y and y<W;
    }

    void dijkstra(){
        auto cmp = [](vertex& v1, vertex& v2){return v1.dist>v2.dist;};
        priority_queue<vertex, vector<vertex>, decltype(cmp)> pq(cmp);
        REP(i, 4) pq.emplace(xs, ys, i, 0);
        while(not pq.empty()){
            int cx = pq.top().x, cy = pq.top().y, dir = pq.top().dir, d = pq.top().dist;
            pq.pop();
            if(dist[cx][cy][dir]<INF) continue;
            dist[cx][cy][dir] = d;
            REP(i, 4){
                if(i==dir){
                    int nx = cx + dx[i], ny = cy + dy[i];
                    if(valid(nx, ny) and grid[nx][ny]=='.' and dist[nx][ny][i]==INF){
                        pq.emplace(nx, ny, i, d+1);
                    }
                }else{
                    if(dist[cx][cy][i]==INF){
                        int nd = (d+K-1) / K * K;
                        pq.emplace(cx, cy, i, nd);
                    }
                }
            }
        }
    }

    void solve(std::istream& in, std::ostream& out){
        ios_base::sync_with_stdio(false);
        in.tie(nullptr), out.tie(nullptr);
        in>>H>>W>>K;
        in>>xs>>ys>>xe>>ye;
        xs--, ys--, xe--, ye--;
        grid.resize(H);
        dist.resize(H, vvc<lint>(W, vc<lint>(4, INF)));
        for(auto& g : grid) in>>g;
        dijkstra();
        lint ans = INF;
        REP(i, 4) chmin(ans, dist[xe][ye][i]);
        if(ans==INF) out<<"-1\n";
        else out<<(ans+K-1)/K<<'\n';
    }
};


int main() {
	FPondSkater solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 143856
#include <cstdio>
using namespace std;

int main(){
  int N, K; scanf("%d%d", &N, &K);

  long long ans = 0;

  for(int b = K + 1; b <= N; b++){
    ans += N / b * (b - K);
    int t = N % b; if(t >= K) ans += t - K + 1;
  }

  if(K == 0) ans -= N;

  printf("%lld\n", ans);
  return 0;
}

Measured memory_bytes: 128
void main() {
	auto ip = readAs!(int[]), A = ip[0], B = ip[1];
	foreach(i; 1..11000) {
		auto a = (i * 0.08).floor, b = (i * 0.1).floor;
		if(a == A && b == B) {
			writeln(i);
			return;
		}
	}
	writeln(-1);
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

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

int main() {
  	int N;
  	cin >> N;
  
	vector<int> v(N);
  	for(int i = 0; i < N; i++) {
      cin >> v.at(i);
    }
  
	int total;
  	for(int i = 0; i < N; i++) {
      for(int j = i + 1; j < N; j++) {
      	total += v.at(i) * v.at(j);
      }
    }
  
  	cout << total;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

#define int long long

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

	int a, b;
	cin >> a >> b;
	int g = __gcd(a, b);
	int ans = 1;
	int wg = g;
	for (int i = 2; i * i <= wg; i++) {
		int c = 0;
		while (g % i == 0) {
			g /= i;
			c++;
		}
		if (c) {
			ans++;
		}
	}
	if (g > 1) ans++;
	cout << ans << endl;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define all(z) (z).begin(),(z).end() 
#define MOD 1000000007
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll isprime(ll n)
{
	for(int i=2;i<n;i++)
		if(n%i==0)
		return 0;
		
	return 1;	
}
int main()
{ 
    FAST;
	ll a,b;
	cin>>a>>b;
	cout<<6-a-b;
}


Measured memory_bytes: 3604
"use strict";
// import bigInt from 'big-integer'

const Main = input => {
  input = input.trim().split(" ");
  if (
    parseInt(input[0], 10) + parseInt(input[1], 10) + parseInt(input[2], 10) <=
    21
  )
    console.log("win");
  else console.log("bust");
};

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 21064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll dp[101][100001];
ll v[101],w[101];
ll solve(ll n,ll val)
{
    if(n==0&&val==0)
        return 0;
    else if(n==0)
        return 1000000000000LL;
    if(dp[n][val]!=0)
        return dp[n][val];
    if(v[n]<=val)
        dp[n][val]=min(solve(n-1,val),w[n]+solve(n-1,val-v[n]));
    else
        dp[n][val]=solve(n-1,val);
    return dp[n][val];
}
int main()
{
    ll n,W;
    cin>>n>>W;
    for(int i=1;i<=n;i++)
        cin>>w[i]>>v[i];
    for(ll i=0;i<=100000;i++)
        if(dp[n][i]==0)
            solve(n,i);
    ll ans=0;
    for(ll i=1;i<=100000;i++)
        if(dp[n][i]<=W)
            ans=i;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 78336
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <numeric>
#include <complex>
#include <cassert>
#include <random>


int main() {
    int n; std::cin >> n;
    std::vector<int> b(n + 1);
    for (int i = 1; i < n; i++) std::cin >> b[i];
    b[0] = b[n] = 1e9;
    int ans = 0;
    for (int i = 1; i <= n; i++) {
        ans += std::min(b[i], b[i - 1]);
    }
    std::cout << ans << std::endl;
    return 0;
}


Measured memory_bytes: 256
import sys
while True:
    H, W = map(int, input().split())
    if H == W == 0:
        sys.exit()
    A = 0
    for _ in range(H):
        if A == 0:
            if W % 2 == 0:
                print('#.' * (W // 2))
            else:
                print('#.' * (W // 2), end='')
                print('#')
            A = 1
        elif A == 1:
            if W % 2 == 0:
                print('.#' * (W // 2))
            else:
                print('.#' * (W // 2), end='')
                print('.')
            A = 0
    print()


Measured memory_bytes: 5624
#include <bits/stdc++.h>
#define rep(i, a, b) for(ll i = ll(a); i < ll(b); i++)
#define rer(i, a, b) for(ll i = ll(a) - 1; i >= ll(b); i--)
#define sz(v) (int)(v).size()
#define pb push_back
#define sc second
#define fr first
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
using namespace std;
typedef long long int ll;
typedef pair <int, int> P;

const ll MOD=1000000007;
ll ans;
int t;
void dfs(vector<set<int>> &G, vector<set<int>> &rG, int n){
    if(n==0){
        if(sz(G[n])==t/2) ans++;
        return;
    }
    else{
        if(sz(G[n])>t/2||sz(rG[n])>t/2) return;
        set<int> res;
        for(auto e: G[n]) res.insert(e);
        for(auto e: rG[n]) res.insert(e);
        vector<int> cur;
        rep(i,0,n){
            if(!res.count(i)) cur.pb(i);
        }
        if(t/2==sz(G[n])){
            for(auto e: cur){
                rG[n].insert(e);
                G[e].insert(n);
            }
            dfs(G,rG,n-1);
            for(auto e: cur){
                rG[n].erase(e);
                G[e].erase(n);
            }
        }
        else{
            int comb=(1<<(t/2-sz(G[n])))-1;
            while(comb<1<<sz(cur)){
                rep(i,0,sz(cur)){
                    if(comb&(1<<i)){
                        G[n].insert(cur[i]);
                        rG[cur[i]].insert(n);
                    }
                    else{
                        rG[n].insert(cur[i]);
                        G[cur[i]].insert(n);
                    }
                }
                dfs(G,rG,n-1);
                rep(i,0,sz(cur)){
                    if(comb&(1<<i)){
                        G[n].erase(cur[i]);
                        rG[cur[i]].erase(n);
                    }
                    else{
                        rG[n].erase(cur[i]);
                        G[cur[i]].erase(n);
                    }
                }
                int x=comb&-comb, y=comb+x;
                comb=((comb&~y)/x>>1)|y;
            }
        }
    }
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    for(;;){
        int n;
        cin>>n;
        if(!n) return 0;
        int m;
        cin>>m;
        vector<set<int>> G(n), rG(n);
        rep(i,0,m){
            int x,y;
            cin>>x>>y;
            x--; y--;
            G[x].insert(y); rG[y].insert(x);
        }
        ans=0;
        t=n;
        dfs(G, rG, n-1);
        cout <<ans<<"\n";
    }
}


Measured memory_bytes: 3168
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
constexpr int inf=1e9+7;
constexpr ll longinf=1LL<<60 ;
constexpr ll mod=1e9+7 ;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    string s;
    cin>>s;
    int ans=0;
    REP(i,'0','9'+1)REP(j,'0','9'+1)REP(k,'0','9'+1){
        int cur=0;
        rep(l,n){
            if(cur==2&&s[l]==k)++cur;
            if(cur==1&&s[l]==j)++cur;
            if(cur==0&&s[l]==i)++cur;
        }
        if(cur==3)++ans;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 384
// AtCoder150 C

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <math.h>
#include <assert.h>
#include <string.h>
#include <memory.h>
#include <malloc.h>
#include <stdlib.h>
#include <ctype.h>

// qsortで用いる比較用関数．*a<*bならaが先になる．
int compare(const void* a, const void* b) {
    return *(int*)a - *(int*)b;
}

int revcompare(const void* a, const void* b) {
    return *(int*)b- *(int*)a;
}

int main(void)
{
    int i,j,n;
    char s[11];

    scanf("%s", s);

    int min = 753;

    for(i = 0; i < strlen(s)-2;i++){
        int tmp = (s[i]-'0')*100 + (s[i+1]-'0')*10 + (s[i+2]-'0');
        if(min > abs(tmp-753)) min = abs(tmp-753);
    }
    printf("%d", min);
    return 0;

}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main() {
    int N=0, x=0;
    cin >> N >> x;
    vector<int> a(N);
    int ans = 0;
    for (int i=0; i < N; i++) cin >> a[i];
    sort(a.begin(), a.end());
    for (int i = 0; i < N; i++){
        if(i == N-1){
            if (x == a[i]) ans ++;
        }else{ 
            if(x >= a[i]){
                x -= a[i];
                ans++;
            }
        }
    }
    cout << ans;




}

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

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

    ll d = abs(a - b);
    if (v <= w) {
        cout << "NO" << endl;
        return 0;
    }

    ll s = v - w;
    if (d <= t * s) {
        cout << "YES" << endl;
    }
    else {
        cout << "NO" << endl;
    }
    return 0;
}

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

int times = 0;
int deep(int c, int depth)
{
	if (depth < 3)
	{
		for (int i = 0; i < 10; i++)
		{
			if (c >= i)
			{
				deep(c - i, depth + 1);
			}
		}
	}
	else if (depth == 3 && c < 10) 
		times++;
	return 0;
}

int main()
{
	int n;
	while (cin >> n)
	{
		times = 0;
		int c = n;
		if (c <= 36)
			deep(c, 0);
		else
			times = 0;
		cout << times << endl;
	}

	return 0;
}

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
using namespace std;

int main() {
    ll a, b, k;
    cin >> a >> b >> k;
    ll takahashi = max(a - k, 0ll);
    ll aoki = k - a < 0 ? b : max(b - (k - a), 0ll);
    cout << takahashi << " " << aoki << endl;
    return 0;
}

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

int main()
{
  int N; cin >> N;
  vector<bitset<10>> F(N);
  for (int i = 0; i < N; ++i) {
    string tmp = "";
    for (int j = 0; j < 10; ++j) {
      string f; cin >> f;
      tmp += f;
    }
    F[i] = bitset<10>(tmp);
  }

  vector<vector<ll>> P(N, vector<ll>(11));
  for (int i = 0; i < N; ++i) {
    for (int j = 0; j < 11; ++j) {
      cin >> P[i][j];
    }
  }

  ll ans = -(1<<30);
  for (int j = 1; j < (1<<10); ++j) {
    ll sum = 0;
    for (int i = 0; i < N; ++i) {
      bitset<10> tmp = bitset<10>(j) & F[i];
      sum += P[i][tmp.count()];
    }

    ans = max(ans, sum);
  }

  cout << ans << endl;
}

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

int main() {
    ll N, K; cin >> N >> K;
    ll ans = 0;
    // 累積和と準備
    ll S[N + 2];
    S[0] = 0;
    // 0, 1, ... , N
    for (int i = 0; i < N + 1; ++i) {
        S[i + 1] = S[i] + i;
    }
    for (int i = K; i <= N + 1; ++i) {
        // 最小のi個の和
        ll min_sum = S[i] - S[0];
        // 最大のi個の和
        ll max_sum = S[N + 1] - S[N + 1 - i];
        ans += max_sum - min_sum + 1;
        ans %= MOD;
    }
    cout << ans << endl;
}

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

constexpr int inf = 0x3f3f3f3f;
constexpr ll linf = 0x3f3f3f3f3f3f3f3fLL;

const char a[] = "SW";

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

    int n; cin >> n;
    string s; cin >> s;

    for (int bits = 0; bits < 4; bits++) {
        string ans;
        ans.push_back(a[bits & 1]);
        ans.push_back(a[(bits >> 1) & 1]);
        for (int i = 1; i < n - 1; i++) {
            ans.push_back(a[(ans[i] == 'S') ^ (s[i] == 'x') ^ (ans[i - 1] == 'S')]);
        }
        if ((ans[n - 1] == 'S') ^ (s[n - 1] == 'x') ^ (ans[n - 2] == ans[0])) continue;
        if ((ans[0] == 'S') ^ (s[0] == 'x') ^ (ans[n - 1] == ans[1])) continue;
        cout << ans << endl;
        return 0;
    }
    cout << -1 << endl;
    return 0;
}


Measured memory_bytes: 748
import java.util.*;
import java.io.*;
import static java.lang.Math.*;

public class Main {
    public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		
		// 入力
		long a = sc.nextLong();
		long b = sc.nextLong();
		long x = sc.nextLong();
		
		// 計算
		long result = 0;
		result = b/x - a/x;
		if(a%x == 0) result++;
		
		// 出力
		System.out.println(result);
	}
	
	public static class Scanner {
		private BufferedReader br; private StringTokenizer tok;
		public Scanner(InputStream is) throws IOException { br = new BufferedReader(new InputStreamReader(is));}
		private void getLine() throws IOException { while(!hasNext()) tok = new StringTokenizer(br.readLine());}
		private boolean hasNext() { return tok != null && tok.hasMoreTokens();}
		public String next() throws IOException { getLine(); return tok.nextToken();}
		public int nextInt() throws IOException { return Integer.parseInt(next());}
		public long nextLong() throws IOException { return Long.parseLong(next());}
		public double nextDouble() throws IOException { return Double.parseDouble(next());}
	}
}


Measured memory_bytes: 21204
#http://simanman.hatenablog.com/entry/2013/06/24/200306
#10/27

data = Array.new()
number = Array.new()


	while data = gets do
		number.push(data.split(" "))
	end


j = 0

for i in number 
	 number[j] = i.map(&:to_i)
	 j += 1
end

common = Array.new().map{[]}

k = 0
h = 0

for i in number
	for j in number[h]
		for tmp in 1 .. j
			if(j%tmp == 0)
				if(tmp == 1)
					common.push([])
				end
				common[k].push(tmp)
			end
		end
		k += 1
	end
	h += 1
end

#p common

 
result = Array.new()

1.step(k , 2){|l|
	p ((common[l-1]&common[l]).max)
}
=begin
a = Array.new().map{[]}

p a
(a.push([]))[0].push(1)
a[0].push(2)
p a
=end

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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int mod = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

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

  ll n = 3;
  vector<ll> a(n);
  REP(i, n)
    cin >> a[i];

  sort(a.begin(), a.end());
  ll ans = 0;
  REP(i, n-1)
    ans += a[i+1] - a[i];
  
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int kMaxSize = 100;

int main (void)
  {
   int  i, j, r, c, table[kMaxSize][kMaxSize], csum, rsum[kMaxSize], allsum = 0; // [column][row]
   scanf("%d %d\n", &r, &c);
   for ( i = 0; i < r ; i++ ) {
     for ( j = 0; j < c ; j++ ) {
       scanf("%d", &table[j][i]);
     } 
   }
   for ( i = 0; i < r ; i++ ) {
     csum = 0;
     for ( j = 0; j < c ; j++ ) {
       printf("%d ", table[j][i]);
       csum += table[j][i];
     }
     printf("%d\n", csum);
   }
   for ( j = 0; j < c ; j++ ) {
     rsum[j] = 0;
     for ( i = 0; i < r ; i++ ) {
       rsum[j] += table[j][i];
     }
     printf("%d ", rsum[j]);
   }
   for ( j = 0; j < c ; j++ ) {
     allsum += rsum[j];
   }
   printf("%d\n", allsum);
   return 0;
  }
  



Measured memory_bytes: 2044
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#define NIL -1
#define MAX 500000
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
using namespace std;
int n;
int root;
int *p = new int[MAX];       //    p---|  Unit
int *left2 = new  int[MAX]; // left2 --|--------> T
int *right2 = new int[MAX]; //right2---|
int *key = new int[MAX];     // key----|
    
void Init(){
  rep(i,MAX){
    p[i]=left2[i]=right2[i]=key[i]=NIL;
  }
}
    
bool SEARCH(int x,int k){
  if(k == key[x])return true;
  if(x == NIL)return false;
  if(k < key[x])return SEARCH(left2[x],k);
  else return SEARCH(right2[x],k);
}
   
    
void TREE_INSERT(int z){
  int y = NIL;
  int x = root;
    
  while(x != NIL){
    y = x;
    if(key[z] < key[x]){
      x = left2[x];
    }
    else x = right2[x];
  }
  p[z]=y;
  if(y == NIL){
    root = z;
  }
  else if(key[z] < key[y]){
    left2[y] = z;
  }else{
    right2[y] = z;
  }
    
}
    
void InorderTreeWalk(int x){
  if(x != NIL){
    InorderTreeWalk(left2[x]);
    printf(" %d",key[x]);
    InorderTreeWalk(right2[x]);
  }
}
    
void PreorderTreeWalk(int x){
  if(x != NIL){
    printf(" %d",key[x]);
    PreorderTreeWalk(left2[x]);
    PreorderTreeWalk(right2[x]);
  }
}
    
    
int main(){
  int val;
  string op;
  long long zr;                   
    
    
  scanf("%d",&n);
  Init();
  root = -1;
  zr=0;
  while(n-- > 0){
    cin >> op;
    if(op == "insert"){
      scanf("%d",&val);
      key[zr]=val;       
      TREE_INSERT(zr);
      zr++;
    }else if(op == "print"){
      InorderTreeWalk(root);
      printf("\n");
      PreorderTreeWalk(root);
      printf("\n");
    }
    else if(op == "find"){
      scanf("%d",&val);
      if(SEARCH(root,val)){
    printf("yes\n");
      }else{
    printf("no\n");
      }
          
    
    }
  }
    
  delete [] p;
  delete [] left2;
  delete [] right2;
  delete [] key;
   
  return 0;
}



Measured memory_bytes: 10764