akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <queue>
#include <limits>
#include <algorithm>

using namespace std;

static const int MAX_N = 1e5 + 10;
static const int INFTY = (1<<30);

class Edge{
public:
	int t, w;
	Edge(){}
	Edge(int t, int w): t(t), w(w) {}
};

vector<Edge> G[MAX_N];
int n, d[MAX_N];
int diameter = 0;

void bfs(int s){
	fill(d, d+n, INFTY);
	queue<int> q;
	q.push(s);
	d[s] = 0;
	int u;
	while(!q.empty()){
		u = q.front(); q.pop();
		for (int i = 0; i < G[u].size(); ++i)
		{
			Edge e = G[u][i];
			if (d[e.t] == INFTY)
			{
				d[e.t] = d[u] + e.w;
				q.push(e.t);
			}
		}
	}
}

int DoubleSweep(){
	bfs(0);
	int maxv = 0;
	int tgt = 0;
	for (int i = 0; i < n; ++i)
	{
		if (d[i]==INFTY) continue;
		if (maxv < d[i])
		{
			maxv = d[i];
			tgt = i;
		}
	}

	bfs(tgt);
	for (int i = 0; i < n; ++i)
	{
		if (d[i] == INFTY) continue;
		diameter = max(diameter, d[i]);
	}

	return diameter;
}


int main(int argc, char const *argv[])
{
	cin >> n;
	for (int i = 0; i < n-1; ++i)
	{
		int s, t, w;
		cin >> s >> t >> w;
		G[s].push_back(Edge(t, w));
		G[t].push_back(Edge(s, w));
	}
	int ans = DoubleSweep();
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 9924
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
#include <cstring>
using namespace std;

using ll = long long;
using P = pair<int, int>;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

template<class T>
inline bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}
template<class T>
inline bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

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

    int N, M;
    cin >> N >> M;
    vector<vector<int>> dist(N, vector<int>(N, INF));
    vector<tuple<int, int, int>> es;
    for(int i = 0; i < N; ++i)  dist[i][i] = 0;
    for(int i = 0; i < M; ++i){
        int a, b, c;
        cin >> a >> b >> c;
        --a, --b;
        dist[a][b] = dist[b][a] = c;
        es.emplace_back(a, b, c);
    }
    
    for(int k = 0; k < N; ++k){
        for(int i = 0; i < N; ++i){
            for(int j = 0; j < N; ++j){
                chmin(dist[i][j], dist[i][k] + dist[k][j]);
            }
        }
    }

    int ans = 0;
    for(int i = 0; i < M; ++i){
        int a, b, c;
        tie(a, b, c) = es[i];
        bool ok = false;
        for(int u = 0; u < N; ++u){
            for(int v = 0; v < N; ++v){
                if(dist[u][a] + c + dist[b][v] == dist[u][v]){
                    ok = true;
                    break;
                }
            }
            if(ok)  break;
        }
        if(ok)  ++ans;
    }
    cout << M - ans << endl;
}

Measured memory_bytes: 3688
// https://atcoder.jp/contests/abc133/tasks/abc133_b
//
#![allow(unused_imports)]
use std::io::*;
use std::fmt::*;
use std::str::*;
use std::cmp::*;
use std::collections::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

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

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

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

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

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn has_integer_distance(a: &Vec<i64>, b: &Vec<i64>) -> bool {
    let n = a.len();
    let mut dist2 = 0;
    for i in 0..n {
        dist2 += (a[i]-b[i])*(a[i]-b[i]);
    }
    let d = (dist2 as f64).sqrt() as i64;
    d * d == dist2
}

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

    let mut pair = 0;
    for i in 0..n {
        for j in i+1..n {
            if has_integer_distance(&points[i], &points[j]) {
                pair += 1;
            }
        }
    }
    println!("{}", pair);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
signed main(){
  long long x,k,d;
    cin>>x>>k>>d;
    x=abs(x);
    long long cnt=x/d;
    if(cnt>=k)cout<<x-k*d<<endl;
    else {
      long long ans=x%d;
      k-=cnt;
      if(k%2)cout<<d-ans<<endl;
      else cout<<ans<<endl;
    }
}


Measured memory_bytes: 3636
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<tr1/unordered_map>
#define ll long long
#define maxn 500050
#define maxa (1<<21)
#define mod 1000000007
using namespace std;
using namespace tr1;
inline int getint(){
    char c=getchar();int x=0;bool p=0;
    while((c>'9'||c<'0')&&c!='-')c=getchar();
    if(c=='-')p=1,c=getchar();
    while(c>='0'&&c<='9')x=x*10+c-'0',c=getchar();
    if(p)x=-x;return x;
}
int n,a[maxn],s1[maxa<<3],s2[maxa<<3],tg[maxa<<3];
inline void pushup(int o){
	s1[o]=(s1[o<<1]+s1[o<<1|1])%mod;
	s2[o]=(s2[o<<1]+s2[o<<1|1])%mod;
}
inline void build(int o,int l,int r){
	tg[o]=0;
	if(l==r){
		s1[o]=1;
		s2[o]=0;
		return;
	}
	int mid=(l+r)>>1;
	build(o<<1,l,mid),build(o<<1|1,mid+1,r);
	pushup(o);
}
inline void gao(int o,int x){
	s1[o]=(s1[o]+1ll*x*s2[o])%mod;
	tg[o]=(tg[o]+x)%mod;
}
inline void pushdown(int o){
	gao(o<<1,tg[o]),gao(o<<1|1,tg[o]);
	tg[o]=0;
}
inline void update(int o,int l,int r,int x,int p){
	if(l==r){
		if(p==n)cout<<s1[o]<<endl;
		s2[o]=(s2[o]+s1[o])%mod;
		return;
	}
	pushdown(o);
	int mid=(l+r)>>1;
	if(x<=mid)update(o<<1,l,mid,x,p);
	else update(o<<1|1,mid+1,r,x,p);
	pushup(o);
}
int main(){
	n=getint();for(int i=1;i<=n;++i)a[i]=getint(),a[i]^=a[i-1];
	build(1,1,maxa);
	int sum=1;
	for(int i=1;i<=n;++i){
		if(!a[i]){
			if(i==n)cout<<(s2[1]+sum)%mod<<endl;
			sum=1ll*sum*2%mod;
			gao(1,1);
		}
		else update(1,1,maxa,a[i],i);
	}
	return 0;
}

Measured memory_bytes: 57472
# N = int(input())
# A,B = map(int,input().split())
# li = list(map(int,input().split()))

h1,m1,h2,m2,k = map(int,input().split())
h = (h2-h1)*60+m2-m1

print(h-k)






# if :
#     print("Yes")
# else:
#     print("No")


Measured memory_bytes: 9180
/*  Author:  Hariom_Pandey
    Created: 2/9/2020 5:27:57 PM
*/
 
#include "bits/stdc++.h"
using namespace std;

#define ll              long long
#define Mset(s, n)      memset(s, n, sizeof(s))
#define Rp0(i, m)       for(int i = 0; i < m; ++i)
#define Rpd(i, m, l)    for(int i = l; i >= m; --i)
#define Rp1(i ,m)       for(int i = 1; i <= m; i++)
#define All(a)          (a).begin(), (a).end()
#define Lwb             lower_bound
#define Upb             upper_bound
#define Sz(a)           int((a).size())
#define u_map           unordered_map
#define Exist(a, b)     (find(All(a), (b)) != (a).end())
#define Sort(x)         sort(All(x))
#define Gsort(x)        sort(All(x), greater<typeof(*((x).begin()))>())
#define Unique(v)       Sort(v); (v).resize(unique(All(v)) - (v).begin())
int32_t main(){
    ll num; cin>>num;
    vector<ll> arr(num);
    for(ll i=0; i<num; ++i) cin>>arr[i];
    ll sz=arr.size();
    Unique(arr);
    ll sz2=arr.size();
    if((sz2==sz)) cout<<"YES";
    else cout<<"NO";


   
   
}





Measured memory_bytes: 1792
process.stdin.resume();
process.stdin.setEncoding('utf8');

// 標準入力取込
var g_input = '';
process.stdin.on('data', function(chunk) {
    g_input += chunk;
});
process.stdin.on('end', function() {
    main(g_input.split(/\r?\n/));
});

const vertical = 3;
const width = 3;

// 解答
function main(inputs){

    // ビンゴカード
    var bingoCard = [inputs[0].split(" "), inputs[1].split(" "), inputs[2].split(" ")];
    // 選ばれた数
    var selectedNum = inputs[3];
    // 選ばれた数値リスト
    var numList = [selectedNum];
    var hit = [[0,0,0],[0,0,0],[0,0,0]];
    var verticalHit = new Array(width);
    var widthHit = 0;

    // 入力値格納
    for (var i = 0; i < selectedNum; i++) {

        numList[i] = inputs[i + 4];
    }

    // ビンゴ判定(縦横)
    for (var m = 0; m < vertical; m++) {

        widthHit = 0;

        for (var n = 0; n < width; n++) {
            if (numList.indexOf(bingoCard[m][n]) > -1) {

                widthHit++;
                hit[m][n] = 1;

                if (verticalHit[n] != 0) {

                    verticalHit[n] = 1;
                }
            } else {

                verticalHit[n] = 0;
            }

            if (n == width - 1
                && ((widthHit == 3)
                   || (m == vertical - 1 && verticalHit.indexOf(1) > -1))) {

                console.log('Yes');
                return;
            }
        }
    }

    // ビンゴ判定(斜め)
    if (crossBingoCheck(hit) === true) {

        console.log('Yes');
        return;
    }

    console.log('No');
}

function crossBingoCheck(hit){

    if ((hit[0][0] + hit[1][1] + hit[2][2] === 3)
       || (hit[0][2] + hit[1][1] + hit[2][0] === 3)) {

        return true;
    }
    
    return false;
}

Measured memory_bytes: 7500
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define print(A,x,n) rep(I,0,n){cout<<(I ? " ":"")<<A[I]x;}cout<<endl;
#define pprint(A,y,m,n) rep(J,0,m){print(A[J],y,n);}
const long mod=1e9+7;
const int size=1e5;
const int inf=1e9;
int main(){
	int A,B,C; cin>>A>>B>>C;
	if(A == B) cout<<C<<endl;
    else if(B == C) cout<<A<<endl;
	else cout<<B<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define maxn 100005
#define F first
#define S second
#define fi(i,a,b) for(int i=a; i<=b; i++)
#define fid(i,a,b) for(int i=a; i>=b; i--)
#define VanLoi "a"
#define gb(i, j) ((i >> j) & 1)
#define reset(x) memset(x, 0,sizeof(x))
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define pii pair<int, int>
#define Block 400

using namespace std;

int n, vt[maxn], dem[maxn], tg[maxn], mi = 1e9;
ll res[maxn], sl = 0;
pii a[maxn], e[maxn];

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
   // freopen(VanLoi".inp", "r", stdin);
   // freopen(VanLoi".out", "w", stdout);
    cin >> n;
    fi(i, 1, n) {
        cin >> e[i].F;
        e[i].S = i;
    }
    sort(e + 1, e + n + 1);
    int j = 0;
    fi(i, 1, n) {
        if (e[i].F != e[i - 1].F) j++;
        a[e[i].S].F = j;
        a[e[i].S].S = e[i].F;
    }
    fi(i, 1, n) {
        dem[a[i].F]++;
        if (vt[a[i].F] == 0) vt[a[i].F] = i;
    }
    fi(i, 1, n) tg[i] = a[i].F;
    sort(tg + 1, tg + n + 1);
    sl = dem[tg[n]];
    fid(i, n - 1, 0) if (tg[i] != tg[i + 1]) {
        int l = vt[tg[i + 1]], r = vt[tg[i]];
        mi = min(mi, l);
        res[mi] += 1ll * (a[l].S - a[r].S) * sl;
        sl += dem[tg[i]];
    }
    fi(i, 1, n) cout << res[i] << '\n';
    return 0;
}


Measured memory_bytes: 4608
#include<stdio.h>
#include<string.h>
int bins(int ,int *,int);





int main(){
  int n,q,i,c=0,j,S[1000000],T[1000000];

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf(" %d",&S[i]);
  }
  scanf("%d",&q);
  for(j=0;j<q;j++){
    scanf(" %d",&T[j]);
  }
  for(i=0;i<q;i++){
    c+=bins(n,S,T[i]);
  }
  printf("%d\n",c);
  return 0;
}
int bins(int n,int *S,int key){
  int left=0;
  int right,mid;
  right = n;
  while(left < right){
    mid=(left+right) /2;
    if(S[mid]==key) return 1;
    else if(key <S[mid]) right = mid;
    else left = mid+1;
      }
  return 0;
}



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


signed main() {
    string A, B;
    cin >> A >> B;
    int a=A.size(), b=B.size();
    if(a != b) {
        if(a > b) cout << "GREATER" << endl;
        else cout << "LESS" << endl;
    } else {
        rep(i, a) {
            if(A[i]>B[i]) {
                cout << "GREATER" << endl;
                return 0;
            } else if(A[i]<B[i]) {
                cout << "LESS" << endl;
                return 0;
            }
        }
        cout << "EQUAL" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
#define pb push_back

const long long MOD = 1000000007;
//const long long MOD = 998244353;
const long long INF = 1LL << 60;
const double PI = acos(-1.0);


long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	unsigned r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a * b / g;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
map<ll, ll> prime_factor(ll n) {
	map<ll, ll> ret;
	for (ll i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			ret[i]++;
			n /= i;
		}
	}
	if (n != 1) ret[n] = 1;
	return ret;
}



const int MAX_N = 100010;


signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int a, b; cin >> a >> b;
	//cout << gcd(a, b) << endl;
	map<int, int>mp, mp2;
	for (auto p : prime_factor(a)) {
		while (p.second--) {
			mp[p.first]++;
		}
	}
	for (auto p : prime_factor(b)) {
		while (p.second--) {
			mp2[p.first]++;
		}
	}
	int ans = 1;
	for (auto x : mp) {
		if (mp2[x.first] > 0)ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		
		Scanner sc = new Scanner(System.in);
		
		while(true){
			int H = sc.nextInt();
			int W = sc.nextInt();
			if(H == 0 && W == 0) break;
			
			for(int i=0; i < H; i++){
				for(int j=0; j < W; j++){
				System.out.print("#");
			}
			System.out.println("");
		}
		System.out.println("");
	    }
	    sc.close();
	}
}



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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr(i,n) for(int i=(int)(n-1);i>=0;i--)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout << #x" = " << x << endl
#define print(x) cout << x << endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<int, P> PIP;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;
typedef set<int> S;

#define INF INT_MAX/3
#define MAX_N 1000000001

int h, w, s, all;
int town[32][32];
P dp[1024][1024];

void dfs(P lu, P rd) {
  int p = lu.fi + lu.se * w, q = rd.fi + rd.se * w;

  if (dp[p][q] != P(0, -INF)) return;

  int sum = 0;
  repl(i, lu.se, rd.se + 1) {
    repl(j, lu.fi, rd.fi + 1) {
      sum += town[i][j];
    }
  }

  int maxDemmand = all - sum;
  if (s >= maxDemmand) dp[p][q] = P(1, s - maxDemmand);

  if ((all - s) * 2 <= sum) {
    repl(i, lu.se, rd.se) {
      int pp = lu.fi + (i + 1) * w, qq = rd.fi + i * w;
      dfs(lu, P(rd.fi, i));
      dfs(P(lu.fi, i + 1), rd);
      maxch(dp[p][q], P(dp[p][qq].fi + dp[pp][q].fi, min(dp[p][qq].se, dp[pp][q].se)));
    }
    repl(i, lu.fi, rd.fi) {
      int pp = i + 1 + lu.se * w, qq = i + rd.se * w;
      dfs(lu, P(i, rd.se));
      dfs(P(i + 1, lu.se), rd);
      maxch(dp[p][q], P(dp[p][qq].fi + dp[pp][q].fi, min(dp[p][qq].se, dp[pp][q].se)));
    }
  }
}

int main(){
  cin.sync_with_stdio(false);
  while(cin >> h >> w >> s, h | w | s) {
    all = 0;
    rep(i, h)rep(j, w) {
      cin >> town[i][j];
      all += town[i][j];
    }

    rep(i, h * w)rep(j, h * w) dp[i][j] = P(0, -INF);
    dfs(P(0, 0), P(w - 1, h - 1));

    cout << dp[0][h * w - 1].fi << " " << dp[0][h * w - 1].se << endl;
  }

  return 0;
}

Measured memory_bytes: 11316
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            //[summary]A - Falling Asleep
            int N = int.Parse(Console.ReadLine());
            var musics = new Dictionary<string, int>();

            for(int i = 0; i < N; i++)
            {
                var line = Console.ReadLine();
                var arr = line.Split(' ');
                var s = arr[0];
                var t = int.Parse(arr[1]);

                musics.Add(s, t);
            }

            var X = Console.ReadLine();
            bool asleep = false;
            int ans = 0;

            foreach(var m in musics)
            {
                if (asleep)
                {
                    ans += m.Value;
                }

                if (m.Key == X)
                {
                    asleep = true;
                }
            }

            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 13268
#include <iostream>
#include <string.h>
using namespace std;
int main() {
    string str;
    cin>>str;
    if(str[str.length()-1]!='s')
    {
        str=str+'s';
    }
    else
    {
        str=str+"es";
    }
    cout<<str<<endl;
    return 0;
}


Measured memory_bytes: 3624
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main(){
    let (a, b): (i32, i32) = (read(), read());
    let remain = a - (b * 2);

    println!("{}", if remain < 0 { 0 } else { remain });
}



Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
ll mod=1e9+7;

int main() {
  ll h,w;
  cin >> h >> w;
  ll o=(w+1)/2;
  ll e=w/2;
  ll ans=(h+1)/2*o+h/2*e;
  if(h==1||w==1) {
    ans=1;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <string>
#include <cmath>

#define mod 1000000007

using namespace std;
 
int main(void){
	
	string s;
	
	cin >> s;
	
	int s_len = s.length();
	
	for(int i=0; 2*i<s_len; i++)
		cout << s[2*i];
	
	return 0;
}

Measured memory_bytes: 512
using System;
using static System.Console;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class Program
{
    static void Main(string[] args)
    {
        int[] input = MyUtil.ReadIntArray();
        WriteLine((double)input[0] / input[1]);

        ReadKey();
    }
}


static class MyUtil
{
    public static int[] ReadIntArray()
    {
        return Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
    }

    /// <summary>
    /// <see cref="IEnumerable{T}"/>の各要素を並べてコンソールに出力します。各要素の間には半角スペースが一つ入ります。
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="ts"></param>
    public static void WriteToConsole<T>(this IEnumerable<T> ts)
    {
        StringBuilder stringBuilder = new StringBuilder();
        foreach (T t in ts)
        {
            stringBuilder.Append(t.ToString());
            stringBuilder.Append(" ");
        }
        stringBuilder.Remove(stringBuilder.Length - 1, 1);
        Console.WriteLine(stringBuilder.ToString());
    }
}

Measured memory_bytes: 13268
import java.util.ArrayList;
import java.util.PriorityQueue;
import java.util.Scanner;
import java.util.Stack;

public class Main 
{
	static Scanner scan = new Scanner(System.in);
	static int cubesNum;
	static ArrayList<Stack<Integer>> stacks = new ArrayList<Stack<Integer>>();

	public static void main(String[] args) 
	{
		while(true)
		{
//			System.out.println("NEW");
			cubesNum = scan.nextInt();
			
			if(cubesNum == 0) {break;}
			
			stacks.clear();
			for(int i = 0; i < cubesNum; i++)
			{
				stacks.add(new Stack<Integer>());
				stacks.get(i).add(i+1);
			}
			
			while(true)
			{
//				System.out.println(stacks);
				
				//take instructions
				int a = scan.nextInt();
				int b = scan.nextInt();
				if(a == 0 && b == 0)
				{
					PriorityQueue<Integer> pq = new PriorityQueue<Integer>();
					
					for(Stack<Integer> s : stacks)
					{
						if(s.size() > 0) {pq.add(s.size());}
					}
					
					while(pq.size() > 0)
					{
						System.out.println(pq.poll());
					}
					System.out.println("end");
					
					break;
				}
				else
				{
					//do instruction
					Stack<Integer> stackOfA = stacks.get(currentStackOf(a));
					Stack<Integer> stackOfB = null;
					if(b > 0) {stackOfB = stacks.get(currentStackOf(b));}
					
					//pick?
					if(a != b)
					{
						if(b == 0) //to the floor
						{
							if(stackOfA.firstElement() == a)
							{
//								System.out.println("ALREADY ON THE FLOOR!");
							}
							else
							{
								//actually put it on the floor
								while(true)
								{
									int lastCube = stackOfA.pop();
									
									//move lastCube to a floor
									addToFloor(lastCube);
									
									if(lastCube == a) {break;}
								}
							}
						}
						else //to another
						{
							//ignore if same stack and a is already above b
							if(!(stackOfA == stackOfB && stackOfA.indexOf(a) > stackOfA.indexOf(b)))
							{
								while(true)
								{
									int lastCube = stackOfA.pop();
									
									//move lastCube to a floor
									if(lastCube != a)
									{
										addToFloor(lastCube);
									}
									else
									{
										stackOfB = stacks.get(currentStackOf(b));
										
										stackOfB.push(a);
										break;
									}
								}
							}
						}
					}
				}
			}
		}
	}
	
	static void addToFloor(int cube)
	{
		for(int i = 0; i < cubesNum; i++)
		{
			Stack<Integer> s = stacks.get(i);
			
			if(s.size() == 0)
			{
				s.push(cube);
				return;
			}
		}
		
		System.out.println("No floor???");
	}
	
	static int currentStackOf(int cube)
	{
		for(int i = 0; i < cubesNum; i++)
		{
			Stack<Integer> s = stacks.get(i);
			
			if(s.contains(cube))
			{
				return i;
			}
		}
		
		System.out.println(cube + " is nowhere!!!");
		return -999;
	}

}



Measured memory_bytes: 33840
use proconio::input;

const MOD : u64 = 1000000007;

fn main() {
    input! {
        n: u64,
        k: u64,
    }

    let mut pattern = 1;
    for m in k..n+1 {
        let min = total(m-1);
        let max = total(n) - total(n-m);
        pattern += max - min + 1;
    }
    println!("{}", pattern % MOD);
}

fn total(n: u64) -> u64 {
    n * (n + 1) / 2
}


Measured memory_bytes: 2096
#include<stdio.h>
#include<string.h>
char a[2000];
long long int s[27],d,f,g,h,j,i;
int main(void)
{
	for(i=1;i<=26;i++)
			s[i]=0;
	while((scanf("%c",&a[1]))!=EOF){
		//d=strlen(a);
	/*	for(i=0;i<=d+1;i++)
			printf("%c\n",a[i]);*/
		//for(i=0;i<=d;i++){
			if(a[1]>=65&&a[1]<=90)
				a[1]+=32;
		//}
		//for(i=0;i<d;i++){
			for(j=1;j<=26;j++){
			//	printf("    %d %c %d\n",a[i]-'0',a[i],a[i]-'0'-48);
				if(j==a[1]-'0'-48){
					s[j]++;
				//	printf("%d %d\n",s[j],j);
				}
			}
		}
	printf("a : %d\n",s[1]);
	printf("b : %d\n",s[2]);
	printf("c : %d\n",s[3]);
	printf("d : %d\n",s[4]);
	printf("e : %d\n",s[5]);
	printf("f : %d\n",s[6]);
	printf("g : %d\n",s[7]);
	printf("h : %d\n",s[8]);
	printf("i : %d\n",s[9]);
	printf("j : %d\n",s[10]);
	printf("k : %d\n",s[11]);
	printf("l : %d\n",s[12]);
	printf("m : %d\n",s[13]);
	printf("n : %d\n",s[14]);
	printf("o : %d\n",s[15]);
	printf("p : %d\n",s[16]);
	printf("q : %d\n",s[17]);
	printf("r : %d\n",s[18]);
	printf("s : %d\n",s[19]);
	printf("t : %d\n",s[20]);
	printf("u : %d\n",s[21]);
	printf("v : %d\n",s[22]);
	printf("w : %d\n",s[23]);
	printf("x : %d\n",s[24]);
	printf("y : %d\n",s[25]);
	printf("z : %d\n",s[26]);
	return 0;
}

Measured memory_bytes: 2748
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<map>
#include<vector>
#include<queue>
#include<stack>
#include<climits>
#include<set>
#include<utility>
#include<typeinfo>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef set<int> S;
#define rep(i, n) for(int i=0; i<n; i++)
const ll MOD=1e9+7;

int main(){

	int n;
	cin >> n;
	n = min(n, 777777753);
	int cnt = 0;

	for(int i=357; i<=n; i++){
		bool is_used[10] = { };
		int t = i;
		bool flag = true;
		while (t > 0) {
			int r = t % 10;
			if (r != 3 && r != 5 && r != 7) {
				flag = false;
				break;
			}
			is_used[r] = true;
			t /= 10;
		}
		if (!flag) {
			continue;
		}
		if (is_used[3] && is_used[5] && is_used[7]) {
			cnt++;
		}
		if (i == 377777775) {
			i = 533333337 - 1;
		}
		if (i == 77777753) {
			i = 333333357 - 1;
		}
		if (i == 577777773) {
			i = 733333335 - 1;
		}
	}

	cout << cnt << endl;

	return 0;
}


Measured memory_bytes: 256
from collections import Counter, defaultdict
import sys
sys.setrecursionlimit(10 ** 5 + 10)
# input = sys.stdin.readline
from math import factorial
import heapq, bisect
import math
import itertools


import queue
from collections import deque



def main():
    high, width = map(int, input().split())
    data_h = list(map(int, input().split()))
    data_w = list(map(int, input().split()))

    mod = 10 ** 9 + 7
    data_h.sort(reverse=True)
    data_w.sort(reverse=True)
    data_h.append(0)
    data_w.append(0)
    ind_h, ind_w = 0, 0

    ans = 1
    for i in range(1, high * width + 1)[::-1]:
        if data_h[ind_h] == i and data_w[ind_w] == i:
            waku = 1
            ind_h += 1
            ind_w += 1
        elif data_h[ind_h] == i:
            waku = ind_w
            ind_h += 1
        elif data_w[ind_w] == i:
            waku = ind_h
            ind_w += 1
        else:
            waku = ind_h * ind_w - (high * width - i)

        ans *= waku
        ans %= mod

    print(ans)

if __name__ == '__main__':
    main()


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

using namespace std;
typedef long long ll;
typedef long double ld;

int dp[100007];
int n, m;
int p[100007];
vector<int>g[100007];

void dijkstra(int node){

    fill(dp, dp+1+n, 1 << 30);
    dp[1] = 0;
    priority_queue<pair<int, int>, vector<pair<int, int>> , greater<pair<int, int>> >qp;
    qp.push({0, 1});

    while(!qp.empty()){

        node = qp.top().second;
        int c = qp.top().first;
        qp.pop();

        for(auto i : g[node]){
            int ady = i;
            if(dp[ady] <= dp[node]+1)
             continue;
            dp[ady] = c+1;
            qp.push({c+1, ady});
            p[ady] = node;
        }
    }
}

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

    cin >> n >> m;
    int a, b;
    for(int i = 1; i <= m; i++){
        cin >> a >> b;
        g[a].push_back(b);
        g[b].push_back(a);
    }

    dijkstra(1);
    for(int i= 2; i <= n; i++)
    if(dp[i] == 1 << 30){
        cout <<"No";
        return 0;
    }

    cout << "Yes\n";
    for(int i = 2; i <= n; i++)
     cout << p[i] << '\n';
}


Measured memory_bytes: 11228
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vl vector<ll>
typedef long long int ll;
typedef long double ld;
using namespace std;
//-------------------------------------------------------------------
ll M=1;
ll INF = 100000000000000;
std::vector<pair<ll, ll> > seg;
void init(ll N){
  while(M<N) M*=2;
  M=M*2-1;
  for(ll i=0;i<M;i++) {
    seg.push_back(make_pair(INF, INF));
  }
  for(ll i=(M+1)/2-1;i<M;i++) seg[i].second = i - ((M+1)/2-1);
}

void update(ll l, ll r, ll x, ll k){
  k+=(M+1)/2-1;
  seg[k].first = x;
  while(k>0){
    k = (k-1)/2;
    if(seg[k*2+1].first>seg[k*2+2].first){
      seg[k].first =  seg[k*2+2].first;
      seg[k].second = seg[k*2+2].second;
    }else{
      seg[k].first =  seg[k*2+1].first;
      seg[k].second = seg[k*2+1].second;
    }
  }
}
pair<ll, ll> query(ll a, ll b, ll l, ll r, ll k){
  if(r<=a || b<=l) return make_pair(INF, INF);
  if(a<=l && r<=b) return seg[k];
  pair<ll, ll> A = query(a, b, l, (l+r)/2, k*2+1);
  pair<ll, ll> B = query(a, b, (l+r)/2, r, k*2+2);
  if(A.first>B.first) return B;
  else return A;
}
std::vector<ll> pr(200000, INF);
//-------------------------------------------------------------------
int main(int argc, char const *argv[]) {
  ll n, m;
  std::cin >> n >> m;
  init(n+1);
  string s;
  std::cin >> s;
  ll z = 0;
  update(0, (M+1)/2, 0, 0);
  for(int i=1;i<=n;i++){
    if(s[i]=='1') continue;
    pair<ll, ll> mini = query(max(z, i-m), i, 0, (M+1)/2, 0);
    pr[i] = mini.second;
    if(i==n&&mini.first==INF){
      std::cout << -1 << '\n';
      return 0;
    }
    update(0, (M+1)/2, mini.first+1, i);
  }

  ll now = n;
  std::vector<ll> ans;
  while(now!=INF){
    ans.push_back(now);
    now = pr[now];
  }
  for(int i=ans.size()-2;i>=0;i--) std::cout << ans[i] - ans[i+1] << (i==0?"\n":" ");
  return 0;
}


Measured memory_bytes: 8048
x,y,a,b,c=map(int,input().split())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))

p.sort()
q.sort()


sin=p[a-x:]+q[b-y:]+r

sin.sort()

print(sum(sin[len(sin)-x-y:]))


Measured memory_bytes: 106152
#include<bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define mp make_pair
#define fi first
#define sc second
ll a,b,c,d;
int main(){
	cin >> a >> b >> c >> d;
	cout << max(0ll,min(b,d) - max(a,c)) << endl;
	return 0;
}


Measured memory_bytes: 384
using System;

namespace AtCoder.Abc
{
    public class QuestionA
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            var a = int.Parse(Console.ReadLine());

            var result = a + (a * a) + (a * a * a);

            Console.WriteLine(result);

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 27372
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>
#include <unordered_map>

using namespace std;
typedef long long int ll;

#define SP(x) setprecision((int)x)
#define SW(x) setw(x) // 桁数指定
#define SF(c) setfill(c) // 埋め文字指定('0')
#define ALL(v) v.begin(), v.end()

int main(int argc, char const *argv[])
{
    string s;
    cin >> s;
    ll a = 0, b = 0;
    for (ll i = 0; i < s.size(); i++)
    {
        if (s[i] - '0' == i % 2)
            a++;
        if (s[i] - '0' != i % 2)
            b++;
    }
    cout << min(a, b) << endl;
}

Measured memory_bytes: 512
#include<stdio.h>
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<algorithm>
#include<string>
#include<math.h>
using namespace std;

int main(){
    long long K,A,B,n;

    cin >> K >> A >> B;
    n = K - A + 1;

    if(B - A < 3 || n <= 0)cout << K + 1<< endl;
    else cout << n / 2 * (B - A) + A + n % 2 << endl;
    
    return 0;
}

Measured memory_bytes: 256
//22-03-2020
     
    #include<bits/stdc++.h>
    using namespace std;
    #define MKM(i,a,b) for(int i=a;i<=b;i++)
    int main()
    {
        int n;
        cin>>n;
        int pi,a[n];
     
        MKM(i,1,n)
        {
            cin>>pi;
            a[pi]=i;
        }
        MKM(i,1,n)
            cout<<a[i]<<" ";
     
            cout<<"\n";     //:D
            return 0;
    }

Measured memory_bytes: 1152
#include <stdio.h>
int main(void)
{
    int n;
    int a, b, c;
    
    scanf("%d", &n);
    
    while ( n > 0 ) {
        scanf("%d %d %d", &a, &b, &c);
        
        if ( a * a == b * b + ( c * c ) ) {
            puts("YES");
        } else if ( b * b == a * a +( c * c ) ) {
            puts("YES");
        } else if ( c * c == b * b + ( a * a ) ) {
            puts("YES");
        } else {
            puts("NO");
        }
        n--;
    }
    
    return 0;
    
}

Measured memory_bytes: 580
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std;
typedef long long ll;
const int MAXN=100005;
int a[MAXN];
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, z, w, i;
    cin>>n>>z>>w;
    for(i=0;i<n;++i) cin>>a[i];
    ll ans=abs(w-a[n-1]);
    if(n!=1) ans=ans>(abs(a[n-1]-a[n-2]))?ans:(abs(a[n-1]-a[n-2]));
    cout<<ans<<endl;
    
    return 0;
}

Measured memory_bytes: 256
a,b = map(int,input().split())
s = input()
lis = [str(i) for i in range(10)]
for i in range(a+b+1):
  if i==a:
    if s[i]!="-":
      print("No")
      break
  else:
    if s[i] not in lis:
      print("No")
      break
else:
  print("Yes")

Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iterator>
#include <numeric>
#include <bitset>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
	int N;
	cin >> N;
	vector<int> a(N);
	int ret = 0;
	for (int i = 0; i < N; i++) {
		cin >> a[i];
		ret += --a[i];
	}

	cout << ret;

	return 0;
}

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

using namespace std;

int main() {
  string a, b, c;
  cin >> a >> b >> c;
  string ans = "";
  ans.push_back( a[0] );
  ans.push_back( b[0] );
  ans.push_back( c[0] );
  transform( ans.cbegin(), ans.cend(), ans.begin(), ::toupper );
  cout << ans << endl;
  return 0;
}

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

ss = len(s)
tt = len(t)

# S = list(s)
# T = list(t)

# print(s)
# print(t[0:-1])

if s == t[0:-1]:
    if int(ss) == int(tt) - 1:
        print('Yes')
    else:
        print('No')
else:
    print('No')


Measured memory_bytes: 9104
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string[] str = Console.ReadLine().Split();
		string S = str[0];
		string T = str[1];
		string[] str2 = Console.ReadLine().Split();
		long N = long.Parse(str2[0]);
		long M = long.Parse(str2[1]);
		string str3 = Console.ReadLine();
		if(str3==S){
			N -= 1;
		} else {
			M -= 1;
		}
		Console.WriteLine(N+" "+M);
	}
}

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

using pii = pair<int, int>;
using ll  = long long;
#define rep(i, j) for (int i = 0; i < (int)(j); i++)
#define repeat(i, j, k) for (int i = (j); i < (int)(k); i++)
#define all(v) v.begin(), v.end()
#define debug(x) cerr << #x << " : " << x << endl

template <class T>
bool set_min(T &a, const T &b) {
    return a > b ? a = b, true : false;
}

template <class T>
bool set_max(T &a, const T &b) {
    return a < b ? a = b, true : false;
}
// vector
template <class T>
istream &operator>>(istream &is, vector<T> &v) {
    for (T &a : v) is >> a;
    return is;
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    for (const T &t : v) os << "\t" << t;
    return os << endl;
}
// pair
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &v) {
    return os << "<" << v.first << ", " << v.second << ">";
}

const int INF = 1 << 30;
const ll INFL = 1LL << 60;

int main() {
    ll A, B, C, K;
    cin >> A >> B >> C >> K;
    ll ans = 0;
    ans += min(A, K);
    K -= A;
    if (K > 0) K -= B;
    if (K > 0) ans -= min(C, K);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N; string s;
  cin >> N >> s;
  int len = s.length();
  for(int i = 0; i < len; i++){
    if(s[i] + N > 'Z') s[i] = s[i] + N - 'Z' +'A'-1;
    else s[i] = s[i] + N;
  }
  cout << s << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {
    string in = "";
    cin >> in;
    vector<int> check(26);
    for (char s : in) {
        check.at(s-'a')++;
    }
    for (int i=0; i<26; i++) {
        if (check.at(i)%2 == 1) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


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

int main(){
    
    int N;
    int A;
    int B;

    cin >> N;
    
    if(N == 1){
        cout << "Hello World" << endl;
    }else
    if(N == 2){
        cin >> A;
        cin >> B;
        cout << A + B << endl;
    }

	return 0;

}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong();
        long b = sc.nextLong();
        long c = sc.nextLong();
        long k = sc.nextLong();

        long ans = 0;
        if (a >= k) {
            ans = k;
        } else if (a + b >= k) {
            ans = a;
        } else {
            ans = a - (k - a - b);
        }

        System.out.print(ans);
    }
}

Measured memory_bytes: 35524
#include<iostream>
#include<bits/stdc++.h>
#include<stdio.h>
using namespace std;
int main(){

int K,S;
scanf("%d %d",&K,&S);
int cnt=0;
for(int x=0;x<=K;++x)
{
	for(int y=0;y<=K;++y){
	
	int z;
	z=S-(x+y);
	if((z<=K)&&(z>=0))
	++cnt;
}
}
printf("%d",cnt);
return 0;
}

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

int main(){
  int x[] = {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};
  int k; cin >> k;
  cout << x[k-1];
  
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <string>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <cmath>
#include <iomanip>
#include <list>
#include <tuple>
#include <bitset>
#include <ciso646>
#include <cassert>

using namespace std;

#define int long long
#define double long double

typedef pair<int, int> P;
typedef tuple<int, int, int> T;

template<class T> string tostr(T x){stringstream o;o<<x;return o.str();}
template<class T> T sqr(T x){return x*x;}
template<class T> T mypow(T x,int n){T r=1;while(n>0){if(n&1)r=r*x;x=x*x;n>>=1;}return r;}

int toint(string s){int v; stringstream i(s);i>>v;return v;}
bool check(int x, int y, int w, int h){return x>=0 && y>=0 && w>x && h>y;}
int gcd(int a,int b){return b ? gcd(b, a%b) : a;}
int lcm(int a,int b){return a / gcd(a, b) * b;}

#define REP(i,a,b)	for(int (i) = (a);i < (b);(i)++)
#define rep(i,n)	REP(i,0,n)
#define PER(i,a,b)	for(int (i) = (a-1);i >= (b);(i)--)
#define per(i,n)	PER(i,n,0)
#define each(i,n)	for(auto &i : n)
#define clr(a)		memset((a), 0 ,sizeof(a))
#define mclr(a)		memset((a), -1 ,sizeof(a))
#define all(a)		(a).begin(),(a).end()
#define sz(a)		(sizeof(a))
#define dump(val) 	cerr << #val " = " << val << endl;
#define dum(val)	cerr << #val " = " << val;
#define Fill(a,v)	fill((int*)a,(int*)(a+(sz(a)/sz(*(a)))),v)

const int dx[8] = { +1,+0,-1,+0,+1,+1,-1,-1 };
const int dy[8] = { +0,-1,+0,+1,-1,+1,-1,+1 };
const int mod = 1e9 + 7;
const int INF = 1e17 + 9;

#define i int
#define f for
#define q if
#define e else
#define w while
#define m >>
#define n <<
#define c cin
#define o cout

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

	i a, b;
	c m a m b;

	q(a == 1)a += 13;
	q(b == 1)b += 13;

	q(a == b) {
		o n "Draw" n endl; 
	}e
	q(a < b) {
		o n "Bob" n endl;
	}e
	q(a > b) {
		o n "Alice" n endl;
	}

	return 0;
}

Measured memory_bytes: 256
import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		// 入力
		int a = sc.nextInt();
		int b = sc.nextInt();

		// 計算
		int result = (b - 1 + a - 2)/(a - 1);
		// 出力
		System.out.println(result);
	}

}


Measured memory_bytes: 21844
#include <stdio.h>
#define M 100000
#define NUL -1

struct node{int oya,L,R; };
struct node s[M];

int r[M],o[M];

void deep(int x,int y){
  if(x==NUL) return;
  r[x]=y;
  deep(s[x].L,y+1);
  deep(s[x].R,y+1);
}

int hy(int x){
  int a=0,b=0;
  if(s[x].L!=NUL) a=hy(s[x].L)+1;
  if(s[x].R!=NUL) b=hy(s[x].R)+1;
  if(a>b) return o[x]=a;
  else return o[x]=b;
}

int sib(int x){
  if(s[x].oya==NUL) return NUL;
  if(s[s[x].oya].L!=x && s[s[x].oya].L!=NUL) return s[s[x].oya].L;
  if(s[s[x].oya].R!=x && s[s[x].oya].R!=NUL) return s[s[x].oya].R;
  return NUL;
}

int main()
{
  int x,i,pa,o1,l1,r1,deg;

  scanf("%d",&pa);

  for(i=0;i<pa;i++) s[i].oya=NUL;

  for(i=0;i<pa;i++){
    scanf("%d%d%d",&o1,&l1,&r1);
    s[o1].L=l1;
    s[o1].R=r1;
    if(l1!=NUL) s[l1].oya=o1;
    if(r1!=NUL) s[r1].oya=o1;
  }

  for(i=0;i<pa;i++) if(s[i].oya==NUL) x=i;

  deep(x,0);
  hy(x);

  for(i=0;i<pa;i++){
    printf("node %d: parent = %d, sibling = %d, ",i,s[i].oya,sib(i));

    deg=0;
    if(s[i].L!=NUL) deg++;
    if(s[i].R!=NUL) deg++;

    printf("degree = %d, depth = %d, height = %d, ",deg,r[i],o[i]);

    if(s[i].oya==NUL) printf("root");
    else if(s[i].L==NUL && s[i].R==NUL) printf("leaf");
    else printf("internal node");
    printf("\n");
  }

  return 0;
}



Measured memory_bytes: 2112
#include <bits/stdc++.h>
#define MOD 1000000007
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define RREP(i,a,b) for(ll i=(a); i>=(b); i--)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef int64_t in;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> p;
typedef vector<pair<ll, ll>> vpl;

int main(){
    vl alphacount(26, 0);
    string s;
    cin >> s;
    ll len = s.size();
    rep(i,len){
        alphacount[(int)s[i] - (int)'a']++;
    }
    rep(i,26){
        if(alphacount[i] % 2 != 0){
            cout << "No" << "\n";
            return 0;
        }
    }
    cout << "Yes" << "\n";
}


Measured memory_bytes: 256
#include <cstdio>

const int MAXN=311, MAXA=311;
const int MOD=998244353;

inline int sum(const int &a, const int &b){
	return (a+b>=MOD)?(a+b-MOD):(a+b);
}

inline int mul(const int &a, const int &b){
	return (int)((1LL*a*b)%(long long)(MOD));
}

int pow(int a, int k){
	int r=1;
	while(k){
		if(k&1)	r=mul(r, a);
		a=mul(a, a);
		k>>=1;
	}
	return r;
}

inline void add(int &f, const int &v){
	f+=v;
	if(f>=MOD)	f-=MOD;
}

int N;

int A[MAXN], Sum[MAXN];

int F[MAXN][MAXN*MAXA];
int G[MAXN][MAXN*MAXA];

int main(){
	
	scanf("%d", &N);
	
	for(int i=1;i<=N;++i)	scanf("%d", &A[i]);
	
	for(int i=1;i<=N;++i)	Sum[i]=sum(Sum[i-1], A[i]);
	
	F[0][0]=1;G[0][0]=1;
	for(int i=0;i<N;++i){
		for(int j=0;j<=Sum[i];++j){
			add(F[i+1][j], F[i][j]);
			add(F[i+1][j+A[i+1]], F[i][j]);
			add(G[i+1][j], sum(G[i][j], G[i][j]));
			add(G[i+1][j+A[i+1]], G[i][j]);
		}
	}
	
	int Ans=pow(3, N);
	
	for(int k=(Sum[N]+1)>>1;k<=Sum[N];++k)
		add(Ans, MOD-mul(3, G[N][k]));
	
	if(!(Sum[N]&1)){
		add(Ans, mul(3, F[N][Sum[N]>>1]));
	}
	
	printf("%d\n", Ans);
	
	return 0;
}

Measured memory_bytes: 227584
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vvc vector<vector<char>>
#define vll vector<ll>
#define rep(a, b, c) for(ll c=a;c<b;c++)
#define re(b, c) for(ll c=0;c<b;c++)
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(int argc, char const *argv[]) {
  ll n, q;std::cin >> n >> q;
  string s;std::cin >> s;
  vvc t = vv(q, 2, 0, char);
  for(int i=0;i<q;i++) std::cin >> t[i][0] >> t[i][1];
  ll l = -1, r = n;
  while(r-l>1){
    ll mid = (l+r)/2;
    ll now = mid;
    re(q, i) if(now>=0&&now<n&&s[now]==t[i][0]) now = now + (t[i][1]=='L'?-1:1);
    if(now<0) l = mid;
    else r = mid;
  }
  ll ok_right = r;
  l = -1, r = n;
  while(r-l>1){
    ll mid = (l+r)/2;
    ll now = mid;
    re(q, i) if(now>=0&&now<n&&s[now]==t[i][0]) now = now + (t[i][1]=='L'?-1:1);
    if(now>=n) r = mid;
    else l = mid;
  }
  if(ok_right==n||l==-1){
    std::cout << 0 << '\n';
    return 0;
  }
  //std::cout << l << " " << ok_right << '\n';
  std::cout << max(l - ok_right + 1, (ll)0) << '\n';
  return 0;
}


Measured memory_bytes: 11456