akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
using namespace std;
int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) {
        cin >> a[i];
    }
    int M = 0;
    bool cheak = true;
    rep(i, n) {
        if (i > M) cheak = false;
        int D = a[i] / 10;
        M = max(M, i + D);
    }
    reverse(all(a));
    M = 0;
    rep(i, n) {
        if (i > M) cheak = false;
        int D = a[i] / 10;
        M = max(M, i + D);
    }
    puts((cheak) ? "yes" : "no");
    return 0;
}


Measured memory_bytes: 3876
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		double w = sc.nextInt();
		double h = sc.nextInt();
		double x = sc.nextInt();
		double y = sc.nextInt();
		
		System.out.print(w*h/2.0);
		System.out.print(" ");
		
		if(x == w/2 && y == h/2) {
			System.out.println("1");
		}else {
			System.out.println("0");
		}
		
	}

}


Measured memory_bytes: 21844
import java.util.*;

class Main {
	public static void main(String[] args) throws Exception {
		Scanner in = new Scanner(System.in);
        String s=in.nextLine();
        String p=in.nextLine();
        s=s+s;
        if(s.indexOf(p)!=-1){
        	System.out.println("Yes");
        }else{
        	System.out.println("No");
        }
	}
}

Measured memory_bytes: 26364
/************************************************
* @Author: leaflove
* @Date:   2020-03-08 20:14:30
* @File:   randm.cpp
* @Remark:   
************************************************/
#include <bits/stdc++.h>
#define CSE(x,y) memset(x,y,sizeof(x))
#define lowbit(x) (x&(-x))
#define INF 0x3f3f3f3f
#define FAST ios::sync_with_stdio(false);cin.tie(0);
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll , ll> pll;

const int maxn = 111111;
int a[maxn],b[maxn];

int main()
{
	// #ifndef ONLINE_JUDGE
	// freopen("in.in","r",stdin);
	// #endif
	FAST;
	int A,B,M;
	cin>>A>>B>>M;
	int ma=INF,mb=INF;
	for(int i=1;i<=A;i++){
		cin>>a[i];
		ma=min(ma,a[i]);
	}
	for(int i=1;i<=B;i++){
		cin>>b[i];
		mb=min(mb,b[i]);
	}
	int ans=ma+mb;
	for(int i=1;i<=M;i++){
		int x,y,c;
		cin>>x>>y>>c;
		ans=min(ans,a[x]+b[y]-c);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1152
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<cstring>
#include<map>
#include<vector>
#include<set>
using namespace std;
typedef long long ll;
const int N = 2e5+5;
const int inf = 0x3f3f3f3f;
const int mod = 1e9+7;
const double eps = 1e-6;
struct node{
	double x,y;
}g[N];
int a[N];
int main()
{
	int k,n,ans=-1;
	cin>>k>>n;
	for(int i=0;i<n;i++)cin>>a[i];
	sort(a,a+n);
	a[n]=a[0]+k;
	for(int i=1;i<=n;i++)
	ans=max(ans,a[i]-a[i-1]);
	cout<<k-ans;
	return 0;
	return 0;
}

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

int main(){
    
    int n;
    string s;
    cin >> n >> s;

    int x = 0, ans = 0;
    for (int i = 0; i < n; i++){
        if(s[i] == 'I') x++;
        else if(s[i] == 'D')    x--;
        ans = max(x, ans);
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 2147483647
#define INF_LL 9223372036854775807
#define MOD 1000000007
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
vector<int> a;
vector<vector<vector<ll> > > memo;

ll solve(int n, int l, int r) { //n 行動するひと l左端 r右端
	if (memo[n][l][r] != -INF_LL)return memo[n][l][r];
	if (l == r) {
		if (n == 0)return a[l];
		else return -a[l];
	}
	else {
		if (n == 0) {
			memo[n][l][r] = max(solve(1, l + 1, r) + a[l], solve(1, l, r - 1) + a[r]);
		}
		else {
			memo[n][l][r] = min(solve(0, l + 1, r) - a[l], solve(0, l, r - 1) - a[r]);
		}
		return memo[n][l][r];
	}
}
int main() {
	int N;
	cin >> N;
	a = vector<int>(N);
	for (int i = 0; i < N; i++)cin >> a[i];
	memo = vector<vector<vector<ll> > >(2, vector<vector<ll> >(N, vector<ll>(N,-INF_LL)));
	cout << solve(0, 0, N - 1) << endl;
	return 0;
}

Measured memory_bytes: 212224
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val s = readLine()!!
    var ans = 0
    var now = 0
    repeat(n) {
        when(s[it]) {
            'I' -> now++
            'D' -> now--
        }
        ans = Math.max(ans, now)
    }
    println(ans)
}


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

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

int main(void) {
	string s;
	cin >> s;
	if (s[s.length() - 1] == 's') {
		s.append("e");
	}
	s.append("s");
	cout << s << endl;
	return 0;
}

Measured memory_bytes: 3632
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;

namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			var cin = new Scanner2();
			int k = cin.Int();
			int x = cin.Int();
			if (500 * k >= x) {
				Console.WriteLine("Yes");
			} else {
				Console.WriteLine("No");
			}
		}
	}

	public class Scanner2
	{
		private readonly char[] delimiter_ = new char[] { ' ' };
		private readonly string filePath_;
		private string[] buf_;
		private int index_;
		Func<string> reader_;

		public Scanner2(string file = "")
		{
			if (string.IsNullOrWhiteSpace(file)) {
				reader_ = Console.ReadLine;
			} else {
				filePath_ = file;
				var fs = new StreamReader(file);
				reader_ = fs.ReadLine;
			}
			buf_ = new string[0];
			index_ = 0;
		}

		public string Next()
		{
			if (index_ < buf_.Length) {
				return buf_[index_++];
			}

			string st = reader_();
			while (st == "") {
				st = reader_();
			}

			buf_ = st.Split(delimiter_, StringSplitOptions.RemoveEmptyEntries);
			if (buf_.Length == 0) {
				return Next();
			}

			index_ = 0;
			return buf_[index_++];
		}

		public int Int() => int.Parse(Next());
		public long Long() => long.Parse(Next());
		public double Double() => double.Parse(Next());

		public int[] ArrayInt(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Int() + add;
			}
			return Array;
		}

		public long[] ArrayLong(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Long() + add;
			}
			return Array;
		}

		public double[] ArrayDouble(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Double() + add;
			}
			return Array;
		}

		public void Save(string text)
		{
			if (string.IsNullOrWhiteSpace(filePath_)) {
				return;
			}

			File.WriteAllText(filePath_ + "_output.txt", text);
		}
	}
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,m,Q,ans;
int a[15];
 
struct Query {
	int a,b,c,d;
}q[55];
 
void dfs(int x) {
	if(x == n+1) {
		int res = 0;
		for(int i = 1;i <= Q;i++) {
			if(a[q[i].b]-a[q[i].a] == q[i].c) res += q[i].d;
		}
		ans = max(ans,res);
		return;
	}
	for(int i = a[x-1];i <= m;i++) {
		a[x] = i; dfs(x+1);
	}
}
 
int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	cin >> n >> m >> Q;
	for(int i = 1;i <= Q;i++) {
		cin >> q[i].a >> q[i].b >> q[i].c >> q[i].d;
	}
	a[0] = 1;
	dfs(1);
	cout << ans;
} 

Measured memory_bytes: 3624
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<iostream>
using namespace std;
int n;
struct node{
	int y,next;
}a[200010];int len=0,last[100010];
int tot[100010],sta[100010],top=0;
void ins(int x,int y)
{
	a[++len].y=y;
	a[len].next=last[x];last[x]=len;
}
int X;
void dfs(int x,int fa)
{
	sta[++top]=x;tot[x]=1;
	if(n==x) X=sta[(top+1)/2+1];
	for(int i=last[x];i;i=a[i].next)
	{
		int y=a[i].y;
		if(y==fa) continue;
		dfs(y,x);tot[x]+=tot[y];
	}
	top--;
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<n;i++)
	{
		int x,y;scanf("%d %d",&x,&y);
		ins(x,y);ins(y,x);
	}
	dfs(1,0);
	int s1=n-tot[X],s2=tot[X];
	if(s1>s2) printf("Fennec");
	else printf("Snuke");
}

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

namespace csharp
{
    class Program
    {
        static void Main(string[] args)
        {
            var csl = Console.ReadLine();
            var A = int.Parse(csl.Split(' ')[0]);
            var B = int.Parse(csl.Split(' ')[1]);

            if (A % 3 == 0 && A != 0)
            {
                Console.WriteLine("Possible");
            }
            else if (B % 3 == 0 && B != 0)
            {
                Console.WriteLine("Possible");
            }
            else if ((A + B) % 3 == 0 && (A + B) >= 3)
            {
                Console.WriteLine("Possible");
            }
            else
            {
                Console.WriteLine("Impossible");
            }

        }
    }
}

Measured memory_bytes: 13140
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<deque>
using namespace std;
#define ll long long
const int mod = 1000000007;
const int MOD = 998244353;
const ll INF = 1000000000000000000;


int main()
{
	int sum = 0;
	for (int i = 0; i < 3; i++) {
		int A; cin >> A;
		sum += A;
	}
	if (sum <= 21) cout << "win" << endl;
	else cout << "bust" << endl;
}

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

int main(void)
{
	int a[2000000];
	int c, f, n, i, j;
	

	scanf("%d", &n);
	
		for (i = 1; i <= n; i++)
	{
		scanf("%d", &a[i]);
	}
	
	c = 1000000;
	f = 0;
	
	for (j = 1; j <= n; j++)
	{
		if (a[j] < c )
		{
			c = a[j];
			f += 1;
		} 
		
	}
	printf("%d", f);
	return 0;
}



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

/* using */
using namespace std;

/* main constructor */
struct Fast
{
    Fast()
    {
        std::cin.tie(0);
        ios::sync_with_stdio(0);
        //cout << fixed << setprecision(12);
    }
} fast;

/* template */
template <class T>
bool chmax(T &a, const T &b) { return (a < b) ? (a = b, 1) : 0; }
template <class T>
bool chmin(T &a, const T &b) { return (b < a) ? (a = b, 1) : 0; }

/* define */
#define REP(i, x, n) for (int i = x; i < (int)(n); ++i)
#define RREP(i, x, n) for (int i = x - 1; i >= (int)(n); --i)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) REP(i, 1, n + 1)
#define rrep(i, n) RREP(i, n, 0)
#define each(i, n) for (auto &i : n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define eunique(x) \
    sort(all(x));  \
    (x).erase(unique(all(x)), (x).end())
#define int long long
#define mp make_pair
#define r0 return 0

/* function */
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a * b / gcd(a, b); }

/* const */
const int inf = 1e9 + 7;
const int dxl[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dyl[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dxs[4] = {1, 0, -1, 0};
const int dys[4] = {0, 1, 0, -1};

/* main */
signed main(void)
{
    int n,k;
    cin >> n >> k;
    string s;
    cin >> s;
    s[k-1] += 0x20;
    cout << s << endl;
    return 0;
}


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

using namespace std;


//repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define euc_dis(x, y) sqrt(x*x + y*y)

#define MOD 1e9+7
#define sp ' '


using ll = long long;


ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powMod(ll b, ll e, ll m){ll r=1;while(e>0){if(e&1)r=(r%m)*(b%m)%m;b=(b%m)*(b%m)%m;e>>=1;}return r;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

template<typename T>
void ppp(T n){cout << n << endl;}

int main(){

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

    int t, x;
    cin >> t >> x;


    cout << static_cast<double>(t)/x << endl;



    return 0;
}


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

const int N = 333;

int n, m;
int a[N][N], ptr[N], cnt[N];
bool mark[N];

void load() {
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= n; ++i) for (int j = 1; j <= m; ++j) scanf("%d", a[i] + j);
}

void process() {
    for (int i = 1; i <= n; ++i) ptr[i] = 1;
    int ans = n + 1;
    for (int j = 1; j <= m; ++j) {
        for (int i = 1; i <= m; ++i) cnt[i] = 0;
        for (int i = 1; i <= n; ++i) {
            while (mark[a[i][ptr[i]]]) ptr[i]++;
            cnt[a[i][ptr[i]]]++;
        }
        int idx = 0;
        for (int i = 1; i <= m; ++i) if (cnt[i] > cnt[idx]) idx = i;
        mark[idx] = 1;
        ans = min(ans, cnt[idx]);
    }
    printf("%d\n", ans);
}

int main() {
 //   freopen("input.in", "r", stdin);
 //   freopen("output.out", "w", stdout);

    load();
    process();

    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <map>
#include <vector>
#define maxn 1000005
#define LL long long
#define mod 1000000007

using namespace std;

int n,x,y,a[maxn],ans[maxn];

int main()
{
    scanf("%d%d%d",&n,&x,&y);
    if (x>y) swap(x,y);
    for (int i=1;i<n;i++) ans[i]=n-i;
    for (int i=1;i<n;i++)
        for (int j=i+1;j<=n;j++)
    {
        int dis=abs(x-i)+abs(y-j)+1;
        if (dis<j-i) ans[j-i]--,ans[dis]++;
    }
    for (int i=1;i<n;i++) printf("%d\n",ans[i]);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
// ----------------------R00TDADA------------------------------
#define rep(i, a, b) for (__typeof((b)) i = (a); i < (b); i++)
#define nrep(i, a, b) for (__typeof((b)) i = (a); i > (b); i--)
#define all(a) (a).begin(), (a).end()
#define ff first
#define ss second
#define ppi pair<int, int>
#define pppi pair<ppi, int>
#define vi vector<int>
#define vii vector<ppi>
#define viii vector<pppi>
#define vs vector<string>
#define pb push_back
#define bitcount __builtin_popcount //count no's of ones in a set bit
#define prq priority_queue
#define mp make_pair
#define mem(x, val) memset((x), (val), sizeof(x));
#define sz(x) (int)x.size()
#define M_PI 3.14159265358979323846
#define rootdada                      \
    ios_base::sync_with_stdio(false); \
    cin.tie(0);                       \
    cout.tie(0);
#define test  \
    int t;    \
    cin >> t; \
    while (t--)
#define int long long
#define M 1000000007
signed main()
{
    rootdada;
    // #ifndef ONLINE_JUDGE
    //     // for getting input from input.txt
    //     freopen("input.txt", "r", stdin);
    //     // for writing output to output.txt
    //     freopen("output.txt", "w", stdout);
    // #endif
    int n, m;
    cin >> n >> m;
    vi a(m);
    int s = 0;
    rep(i, 0, m)
    {
        cin >> a[i];
        s += a[i];
    }
    if (s <= n)
        cout << n - s << endl;
    else
    {
        cout << -1 << endl;
    }
}

Measured memory_bytes: 3708
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(obj) (obj).begin(),(obj).end()
#define debug(x) cerr << #x << ": " << endl
#define rep(i,n) for(int i=0; (i)<(n); ++(i))
#define rrep(i,n) for(int i=(n); (i)>=0; --(i))
#define reps(i,s,n) for(int i=(s); (i)<(n); ++(i))
#define maxi(v) distance(v.begin(), max_element(v.begin(), v.end()))
#define mini(v) distance(v.begin(), min_element(v.begin(), v.end()))
#define maxemt(v) *max_element(v.begin(), v.end())
#define minemt(v) *min_element(v.begin(), v.end())
#define lb(v,x) v[lower_bound(v.begin(), v.end(), x) - v.begin()]
#define ub(v,x) v[upper_bound(v.begin(), v.end(), x) - v.begin()]
template<class T> inline bool print(T& x){ cout << x << endl; return true; }
template<class T> inline bool print_(T& x){ cout << x << " "; return true; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
ll gcd(ll x, ll y){
  if(y==0) return x;
  else return gcd(y, x%y);
  }
ll lcm(ll x, ll y){
  return x / gcd(x,y) * y;
}
const int INF = 1e9;
const ll llINF = 1LL<<60;
const int MOD = 1e9+7;
const double EPS = 1e-9;
int main(){
  ll x, y; cin >> x >> y;
  ll ans=0;
  while(1){
    if(x<=y){ x*=2; ans++;}
    else break;
  }
  cout << ans; 

return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define xx first
#define yy second
#define mp make_pair
#define pb push_back
#define fill( x, y ) memset( x, y, sizeof x )
#define copy( x, y ) memcpy( x, y, sizeof x )
using namespace std;
 
typedef long long LL;
typedef pair < int, int > pa;

inline int read()
{
	int x = 0, f = 1; char ch = getchar();
	while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); }
	while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
	return x * f;
}
 
int f[100010], g[100010], n;
vector < int > G[100010];
 
inline void dfs(int x, int fa = 0)
{
	f[x] = 1;
	g[x] = 0;
	for(auto y : G[x]) 
		if(y ^ fa) dfs(y, x), f[x] += g[y], g[x] += max(f[y], g[y]);
}
 
int main()
{
	n = read();
	for(int i = 1, x, y; i < n; i ++) 
		x = read(), y = read(), G[x].pb(y), G[y].pb(x);
	dfs(1);
	return 
	puts( max( f[1], g[1] ) <= n / 2 ? "Second" : "First" ), 0;
}

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

typedef long long ll;
typedef unsigned int ui;
typedef unsigned long ul;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef pair<int, int> ii;
typedef vector<ii> vii;
const int INF = int (1e9) + int (1e5);
const ll INFL = ll(2e18) + ll(1e10);
const ui MOD = 1E9 + 7;
const double EPS = 1e-9;
#define FOR(i,n) for (int i=0;i<(n);++i)
#define FOR2(i,a,b) for (int i=(a);i<(b);++i)
#define ROF(i,x) for(int i = (x) ; i >= 0 ; --i)
#define ROF2(i,x,y) for(int i = (y) ; i >= (x) ; --i)
#define MP make_pair
#define ALL(a) (a).begin(),(a).end()
#define ODD(x) (((x)&1)==0?(0):(1))
#define sign(x) ((x > 0) - (x < 0))
#define FAST ios_base::sync_with_stdio(false); cin.tie(0)

inline ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
inline ll gcd(ll a, ll b) { return a ? gcd(b%a, a): b; }
inline ll lcm(ll a, ll b) { return a / gcd(a,b) * b; }

template<class T,class U>
ostream &operator<<(ostream &os,const pair<T,U> &x) {
    return os<<"("<<x.first<<","<<x.second<<")";
}

template<class T>
ostream &operator<<(ostream &os,const vector<T> &x) {
    os << '[';
    if ( !x.empty() ) {
        std::copy (x.begin(), x.end(), std::ostream_iterator<T>(os, ","));
        os << "\b";
    }
    os << "]";
    return os;
}
template<class T>
ostream &operator<<(ostream &os,const vector<vector<T> > &x) {
    os << '[';
    if ( !x.empty() ) {
        os << x[0];
        for (int i=1;i<x.size();++i) os << endl << " " << x[i];
    } else os << "[]";
    os << "]";
    return os;
}

int main() {
    FAST;
    //freopen ("in.txt", "r", stdin);
    int a,b,c;cin>>a>>b>>c;
    if (b+a+1>=c) cout << b+c;
    else{
        cout << 2*b+a+1;
    }

    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
void fmax(int&a,int b){
	if(b>a)a=b;
}
void fmin(int&a,int b){
	if(b<a)a=b;
}
int x[200010],l[20][200010],r[20][200010],n;
void pre(int p,int d){
	int*l=::l[p],*r=::r[p],i;
	l[1]=1;
	for(i=2;i<=n;i++)l[i]=x[i]-x[i-1]>d?i:l[i-1];
	r[n]=n;
	for(i=n-1;i>0;i--)r[i]=x[i+1]-x[i]>d?i:r[i+1];
	l[0]=1;
	r[n+1]=n;
}
int fl[262144],fr[262144],s[200010];
void gao(int l,int r){
	if(l<=r){
		s[l]++;
		s[r+1]--;
	}
}
int main(){
	int V,M,i,j;
	scanf("%d%d",&n,&V);
	for(i=1;i<=n;i++)scanf("%d",x+i);
	for(M=0;V;V>>=1)pre(M++,V);
	pre(M,0);
	fr[0]=n+1;
	for(i=1;i<1<<M;i++){
		fr[i]=n;
		for(j=0;j<M;j++){
			if(i>>j&1){
				fmax(fl[i],r[j+1][fl[i^(1<<j)]+1]);
				fmin(fr[i],l[j+1][fr[i^(1<<j)]-1]);
			}
		}
	}
	for(i=0;i<1<<M;i++){
		gao(l[0][fr[((1<<M)-1)^i]-1],r[0][fl[i]+1]);
	}
	for(i=1;i<=n;i++){
		s[i]+=s[i-1];
		puts(s[i]?"Possible":"Impossible");
	}
}

Measured memory_bytes: 37120
#include<iostream>
#include<string>

#include<algorithm>


using namespace std;

int main(){
    string S;
    cin>>S;
    sort(S.begin(),S.end());
    
    int j=0;
    for(int i=0 ; i<S.size() ; i++){
    	if(S[i]!=(char)('a'+j)){
    		cout<<(char)('a'+j)<<endl;
    		break;
    	}
    	if('a'+j=='z'){
    		cout<<"None"<<endl;
    		break;
    	}
    	if(i==S.size()-1)cout<<(char)('a'+(j+1))<<endl;
    	if(S[i]!=S[i+1])j++;
    }
    
    return 0;
}


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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

typedef long long ll;

const int INF = 1000000000;
const int MOD = 1000000007;

int main () {
    int N; cin >> N;
    map<int, int> A;
    rep(i, N) {
        int a; cin >> a; A[a]++;
    }

    ll a = 0, b = 0;
    for (auto i : A) {
        if (i.second > 3) {
            a = i.first;
            b = i.first;
        } else if (i.second > 1) {
            if (a != 0) b = a;
            a = i.first;
        }
    }
    if (b != 0 && a != 0) cout << a * b << endl;
    else cout << 0 << endl;
}



Measured memory_bytes: 4992
#include<iostream>
#include<vector>

using namespace std;

int main()
{
  int n,m;
  cin >> m >> n;
  
  vector<int> per;
  vector<vector<int> > G;
  G.resize(m);
  bool used[m]; 
  per.resize(m);
  for(int i=0;i<m;i++)
    per[i] = 0,used[i] = false;
  for(int i=0;i<n;i++)
    {
      int x,y;
      cin >> x >> y;
    
      x--,y--;
      per[y]++;
      G[x].push_back(y);
    }
  used[1] = true;
  
  
  for(int i=0;i<m;i++)
    {
      for(int j=0;j<m;j++)
	{
	  if(used[j])
	    continue;
	  if(!per[j])
	    cout << j+1 << endl;
	}
      vector<int> pre = per;

      for(int j=0;j<m;j++)
	{
	  if(used[j])
	    continue;
	  if(!pre[j])
	    {
	      used[j] = true;
	      for(int k=0;k<G[j].size();k++)
		per[G[j][k]]--;
	    }	
	}
    }
  cout << 2 << endl;
  return 0;
}

Measured memory_bytes: 1220
#include <bits/stdc++.h>
#define pb push_back
#define all(x) x.begin(),x.end()
#define cmin(a,b) (a>b?a=b:a)
#define cmax(a,b) (a<b?a=b:a)
#define mem(a,k) memset(a,k,sizeof(a))
#define lop(i,s,t) for(int i=s;i<(t);++i)
#define rep(i,s,t) for(int i=s;i<=(t);++i)
#define dec(i,s,t) for(int i=s;i>=(t);--i)
#define fore(i,v) for(int i=g[v],d=es[i].d;i;i=es[i].nxt,d=es[i].d)
using namespace std;

#define Pr(f,...) //fprintf(stderr,f,##__VA_ARGS__),fflush(stderr)

typedef long long ll;

template<typename T>
void read(T &x){
	x=0; 
	char c;
	for(c=getchar();!isdigit(c);c=getchar()); 
	for(;isdigit(c);c=getchar())x=x*10+c-'0'; 
}

const int N=3005,P=1e9+7; 

int mul(int a,int b){ return 1ll*a*b%P; }
int add(int a,int b){ a+=b; return a>=P?a-P:a; }
int sub(int a,int b){ a-=b; return a<0?a+P:a; }
void upd(int &a,int b){ a=add(a,b); }

int n,m,ans,f[N][N][2];

int main(int argc,char *argv[]){
#ifdef CURIOUSCAT
	//freopen("dat.in","r",stdin);
	//freopen("my.out","w",stdout);
#endif
	//f[i][j]:j->red,n-j blue
	scanf("%d%d",&n,&m); 
	rep(j,1,n)f[0][j][0]=1;
	f[0][0][1]=1;
	lop(i,0,m)rep(j,0,n)rep(spec,0,1){
		int c=f[i][j][spec]; 
		if(j>=1)upd(f[i+1][j-1][spec|(j==1)],c);//RR
		if(j>=1)upd(f[i+1][j][spec|(j==1)],c);//RB
		if(j<n)upd(f[i+1][j][spec],c); 
		if(j<n)upd(f[i+1][j+1][spec],c);
	}
	rep(i,0,n)upd(ans,f[m][i][1]);
	printf("%d\n",ans); 
	return 0;
}


Measured memory_bytes: 70656
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;

#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 1; i < n + 1; i++)
#define PI 3.14159265359
#define EPS 0.0000000001
#define MOD 1000000007
//cout << std::fixed << std::setprecision(15) << y << endl;


int main(){
    char c;
    rep(i, 9){
        cin >> c;
        if(i == 0 || i == 4 || i == 8){
            cout << c;
        }
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
struct Node{
  int key;
  int id,parent,left,right;
};


Node A[20000000];
int H;

void heap(int H){
  for(int i=1;i<=H;i++){
    if(i==1){
      A[i].left=A[2*i].key;
      A[i].right=A[2*i+1].key;
    }
    else {
      A[i].parent=A[i/2].key;
      A[i].left=A[2*i].key;
      A[i].right=A[2*i+1].key;
    }
  }
}
void maxheap(int i){
  int l=0,r=0;
  int lag;
  int tmp;
  l=2*i;
  r=2*i+1;
  if(l<=H && A[l].key>A[i].key){
    lag=l;
  }
  else {
    lag=i;
  }
  if(r<=H&&A[r].key>A[lag].key){
    lag=r;
  }
  if(lag!=i){
    tmp=A[i].key;
    A[i].key=A[lag].key;
    A[lag].key=tmp;
    maxheap(lag);
  }
}
void changeccc(int i,int k){
  int tmp=0;
  if(k<A[i].key){
    return;
  }
  A[i].key=k;
  while(i>1&&A[i/2].key<A[i].key){
    tmp=A[i].key;
    A[i].key=A[i/2].key;
    A[i/2].key=tmp;
    i=i/2;
  }
}

void insert(int k){
  H++;
  A[H].key=-INT_MAX;
  changeccc(H,k);
}

int heaphigh(){
  int maxx;
  if(H<1)return -INT_MAX;
  maxx=A[1].key;
  A[1].key=A[H--].key;
  maxheap(1);
  return maxx;
}
int main(){
  char c[9];
  int k;
  while(1){
    cin>>c;
    if(strcmp(c,"end")==0)break;
    if(strcmp(c,"insert")==0){
      cin>>k;
      insert(k);
    }
    else {
      cout<<heaphigh()<<endl;
    }
  }
  return 0;
}



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

typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(obj) (obj).begin(),(obj).end()

#define P pair<int,int>
#define V vector<int>
#define M map<int,int>
#define S set<int>
#define PQ priority_queue<int>
#define PQG priority_queue<int,V,greater<int>>

#define pb(a) push_back(a)
#define mp make_pair

#define dump(x)  cout << #x << " = " << (x) << "\n";
#define COUT(x) cout<<(x)<<"\n"


int main()
{
    map <char, int> str;
    string s = "";
    cin >> s;


    REP (i, s.size())
    {
        str[s[i]]++;
    }
    bool ans = true;

    for (auto it = str.begin(); it != str.end(); ++it)
    {
        if (it->second % 2 != 0)
        {
            ans = false;
        }
    }

    ans ? COUT("Yes") : COUT("No");


    return 0;
}

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

int main(void){
    int n,i;
    i = 1;
    cin >> n;
    
    if(n < 2){
        cout << n << endl;
    }else{
        for(i=1; i<=n; i*=2){
        }
        cout << i/2 << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int main(){
    cout << fixed << setprecision(10);
    string s;
    int n,k;
    cin >> n >> k >> s;
    int cnt = 0;
    rep(i,n-1){
        if(s[i]!=s[i+1]) cnt++;
    }
    cout << n -1 - max(cnt - 2*k, 0) << endl; 
    return 0;
}

Measured memory_bytes: 512
open Batteries
let () =
  let d,n = Scanf.scanf "%d %d " (fun a b -> a,b) in

  let d = match d with
      0 -> 1
    | 1 -> 100
    | 2 -> 10000
  in

  let n = if n = 100 then 101 else n in

  Printf.printf "%d\n" @@
  d*n


Measured memory_bytes: 3072
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n; long long a=0, b=0;
    for(int i =0; i<n; i++){
        long long a1, b1;
        cin>>a1>>b1;
        if(a<a1&&b<b1){
            a=a1; b=b1;
        }
        else{
            long long m=max((a%a1?a/a1+1:a/a1), (b%b1?b/b1+1:b/b1));
            a=m*a1; b=m*b1;
        }
    }
    cout<<a+b;
    return 0;
}

Measured memory_bytes: 256
a,b = (int(x) for x in input().split())
d = a // b
r = a % b
f = float(a / b)
f = "{0:.5f}".format(f)
ab_list = [d, r, f]
for j in range(2):
    print(ab_list[j],end = ' ')

print(ab_list[2])



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

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

    int x = max(a, b);
    int y = min(a, b);
    while(y != 0){
        int tmp = y;
        y = x % y;
        x = tmp;
    }
    cout << x << endl;

    return 0;
}



Measured memory_bytes: 3124
import Data.Functor( (<$>))
import Control.Monad( replicateM)

main = do
    n <- read <$> getLine
    is <- replicateM n (read <$> getLine)   ::IO [Int]
    let
	primes (i, ps) limit
	    |	limit < i = ps	::[Int]
	    |	otherwise = let
				stop = floor . sqrt . fromIntegral $ i
				candidate = dropWhile (> stop) ps
			    in
				if and $ ( (0/=) . (i`rem`)) <$> candidate
				then primes (i+2, i:ps) limit
				else primes (i+2, ps) limit

	primeTable = reverse $ primes (5,[3,2]) 10000
	
	isPrime i
	  = let
		stop = floor . sqrt . fromIntegral $ i
		checkList = takeWhile (<=stop) primeTable
	    in
		and $ ( (0/=) . (i`rem`)) <$> checkList

    print . length $ filter isPrime is



Measured memory_bytes: 9384
#include<stdio.h>
#include<string.h>
#define N 100000
void enqueue(char*,int,int);
int head=0;
int tail=0;
int time[N];
char name[N][10];
int main(){
  int n,q,i,t=0,ji;
  char mei[10];
  scanf("%d%d",&n,&q);
  for(i=0;i<n;i++){
    scanf("%s%d",mei,&ji);
    enqueue(mei,ji,n);
  }
  
  i=0;
  while(head%(n+1)!=tail%(n+1)){
    if((time[head%(n+1)]-q)<=0){
      t+=time[head%(n+1)];
      printf("%s %d\n",name[head%(n+1)],t);
      head++;
    }else{
      t+=q;
      time[tail%(n+1)]=time[head%(n+1)]-q;
      strcpy(name[tail%(n+1)],name[head%(n+1)]);
      tail++;
      head++;
    }
  }
  return 0;
}

void enqueue(char *na,int ti,int n){
  int next=(tail+1)%(n+1);
  strcpy(name[tail],na);
  time[tail]=ti;
  tail=next;
}



Measured memory_bytes: 2484
#include<iostream>
#include<bitset>

using namespace std;

int dx[8] = { 1, 1, 0, -1, -1, -1, 0, 1 };
int dy[8] = { 0, -1, -1, -1, 0, 1, 1, 1 };
int w, h, c[50][50];
void dfs(int c[50][50], int x, int y);

int main() {
	while (true) {
		cin >> w >> h;
		if (w == 0 && h == 0)	break;
		int counter = 0;
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				cin >> c[j][i];
			}
		}

		for (int i = 0; i < w; i++) {
			for (int j = 0; j < h; j++) {
				if (c[i][j] == 1) {
					dfs(c, i, j);
					counter++;
				}
			}
		}
		cout << counter << endl;

	}
	return 0;
}

void dfs(int c[50][50], int x, int y) {	//(x, y) = 1ということを発見済み
	c[x][y] = 0;
	for (int i = 0; i < 8; i++) {
		if (0 <= x + dx[i] && x + dx[i] < w && 0 <= y + dy[i] && y + dy[i] < h) {
			if (c[x + dx[i]][y + dy[i]] == 1) {
				dfs(c, x + dx[i], y + dy[i]);
			}
		}
	}
}


Measured memory_bytes: 3200
#include <stdio.h>

int riffle_shuffle(int *deckA, int *deckB, int *deckC, int *operation, int n, int r)
{
  int i, ai, bi, ci;
  int oi = 0;

  while(1) {
    ai = bi = ci = 0;
    do {
      for (i = 0; i < operation[oi]; i++) {
        if (deckA[ai] == -1)
          break;
        if (ci < n)
          deckC[ci++] = deckA[ai++];
      }
      for (i = 0; i < operation[oi]; i++) {
        if (deckB[bi] == -1)
          break;      
        if (ci < n)
          deckC[ci++] = deckB[bi++];
      }
    } while (deckA[ai] != -1 || deckB[bi] != -1);

    for (i = 0; i < n/2; i++) {
      deckB[i] = deckC[i];
      deckA[i] = deckC[i + n/2];
    }

    if (n%2 == 1)
      deckA[n/2] = deckC[n-1];

    if (oi > r || operation[++oi] == -1)
      return deckC[--ci];
  }
}


int main(int argc, char const *argv[])
{
  int deckA[50];
  int deckB[50];
  int deckC[50];
  int operation[50];
  int n, r, i, j, last_card;

  while (EOF != scanf("%d %d", &n, &r)) {

    for (i = 0; i < 50; i++)
      deckA[i] = deckB[i] = deckC[i] = operation[i] = -1;
    
    for (i = 0; i < r; i++) 
      scanf("%d", &operation[i]);

    for (i = 0; i < n/2; i++) {
      deckB[i] = i;
      deckA[i] = i + n/2;
    }

    if (n % 2 == 1)
      deckA[n/2] = n-1;

    last_card = riffle_shuffle(deckA, deckB, deckC, operation, n, r);

    printf("%d\n", last_card);

  }
  return 0;
}

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

int main(){
    int n, m, x, sum = 0;
    cin >> n >> m;
    vector<int> a(n);
    for(int i = 0; i < n; i++) {
        cin >> a[i];
        sum += a[i];
    }
    x = (int)(sum / (4.0 * m));
    if(sum % (4 * m) > 0) x++;

    for(int i = 0; i < n; i++){
        if(a[i] >= x) m--;
    }

    cout << (m <= 0 ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.NoSuchElementException

fun main(args: Array<String>) = FastScanner().run {
    val n = nextInt()
    val c = nextLong()
    val k = nextLong()
    val t = LongArray(n){nextLong()}
    t.sort()

    var i = 0
    var cnt = 0
    while (i < n) {
        val j = upperBound(t, t[i] + k)
        if (j - i > c) {
            i += c.toInt()
            cnt++
        } else {
            i = j
            cnt++
        }
    }
    println(cnt)
}

fun upperBound(arr: LongArray, x: Long): Int {
    var ok = arr.size
    var ng = -1
    while (Math.abs(ok - ng) > 1) {
        val mid = (ok + ng) / 2
        if (arr[mid] > x) {
            ok = mid
        } else {
            ng = mid
        }
    }
    return ok
}

class FastScanner {
    private val printable = 33..126
    val `in` = System.`in`
    val buffer = ByteArray(1024)
    var ptr = 0
    var buflen = 0
    fun hasNextByte(): Boolean {
        if (ptr < buflen) {
            return true
        } else {
            ptr = 0
            buflen = `in`.read(buffer)
            if (buflen <= 0) {
                return false
            }
        }
        return true
    }
    fun readByte(): Byte {
        return if (hasNextByte()) buffer[ptr++] else return -1
    }
    fun hasNext(): Boolean {
        while (hasNextByte() && buffer[ptr] !in printable) ptr++
        return hasNextByte()
    }
    fun next(): String {
        if (!hasNext()) throw NoSuchElementException()
        val sb = StringBuilder()
        var b = readByte()
        while (b in printable) {
            sb.appendCodePoint(b.toInt())
            b = readByte()
        }
        return sb.toString()
    }
    fun nextLong(): Long {
        if (!hasNext()) throw NoSuchElementException()
        var n = 0L
        var minus = false
        var b = readByte()
        if (b == '-'.toByte()) {
            minus = true
            b = readByte()
        }
        if (b !in '0'.toByte()..'9'.toByte()) {
            throw NumberFormatException()
        }
        while (true) {
            if (b in '0'.toByte()..'9'.toByte()) {
                n *= 10
                n += b - '0'.toByte()
            } else if (b == (-1).toByte() || b !in printable) {
                return if (minus) -n else n
            } else {
                throw NumberFormatException()
            }
            b = readByte()
        }
    }
    fun nextInt(): Int {
        val nl = nextLong()
        if (nl !in Integer.MIN_VALUE..Integer.MAX_VALUE) throw NumberFormatException()
        return nl.toInt()
    }
    fun nextDouble(): Double {
        return next().toDouble()
    }
}

Measured memory_bytes: 37360
#include <bits/stdc++.h>
using namespace std;
 
typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
#define MP make_pair
#define PB push_back
#define X first
#define Y second
 
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)((a).size())
#define FILL(a, value) memset(a, value, sizeof(a))
#define debug(a) cerr << #a << " = " << a << endl;
 
template<typename T> void setmax(T& x, T y) {x = max(x, y);}
template<typename T> void setmin(T& x, T y) {x = min(x, y);}
 
const double PI = acos(-1.0);
const int INF = 1e9 + 47;
const LL LINF = 1LL * INF * INF;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

void solve1(int n, int k)
{
	VI a(n), b(n);
	FOR(i, 0, n)
	{
		a[i] = k + i;
	}
	FOR(i, 0, (n + 1)/2)
	{
		b[2 * i] = k + 2 * n - 1 - i;
	}
	FOR(i, (n + 1)/2, n)
	{
		b[2*(i - (n + 1)/2) + 1] = k + 2 * n - 1 - i;
	}
	vector<PII> C(n);
	FOR(i, 0, n)
		C[i] = MP(a[i] + b[i], i);
	sort(ALL(C));
	VI c(n);
	FOR(i, 0, n)
	{
		if(C[i].X > k + 2*n + i)
		{
			assert(0);
			exit(0);
		}
		c[C[i].Y] = k + 2 * n + i;
	}
	FOR(i, 0, n)
	{
		cout << a[i] << " " << b[i] << " " << c[i] << endl;
	}
}

void solve(int n, int k)
{
	vector<pair<int, PII>> ans;
	set<int> tmp;
	set<int> open;
	LL sum1 = 0, sum2 = 0;
	FOR(i, 0, n)
	{
		tmp.insert(k + i);
		sum1 += k + i;
		tmp.insert(k + i + n);
		sum1 += k + i + n;
		open.insert((k + i + 2*n));
		sum2 += k + i + 2*n;
	}
	if(sum1 > sum2)
	{
		cout << -1 << endl;
		return;
	}
	solve1(n, k);
	return;
}

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n, k;
	cin >> n >> k;
	solve(n, k);
	
	cerr << "Time elapsed: " << clock() / (double)CLOCKS_PER_SEC << endl;
	return 0;
}
 


Measured memory_bytes: 19328
N,T = map(int,input().split())
A = list(map(int,input().split()))

ma = A[-1]
maL = [ma]
for i in range(1,N):
    if A[-i-1] > ma:
        ma = A[-i-1]
        maL.append(ma)
    else:
        maL.append(ma)

ans = 1
maL = maL[::-1]
sa = maL[0] - A[0]
for i in range(1,N):
    s = maL[i] - A[i]
    if s == sa:
        ans += 1
    elif s > sa:
        ans = 1
        sa = s
print(ans)


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

int main() {
	ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    char alpha; cin >> alpha;
    if (alpha >= 'A' && alpha <= 'Z')
        cout << "A" << "\n";
    else cout << "a" << "\n";
    return EXIT_SUCCESS;
}

Measured memory_bytes: 3580
import java.util.*;

class Main{
  public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
    
    int N = sc.nextInt();
    
    switch(N%10){
      case 2:
      case 4:
      case 5:
      case 7:
      case 9:
        System.out.println("hon");
        return;
      case 0:
      case 1:
      case 6:
      case 8:
        System.out.println("pon");
        return;
      case 3:
        System.out.println("bon");
        return;
    }
  }
}

Measured memory_bytes: 35760
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <functional>
#include <ctime>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iomanip>
#include <float.h>
#include <math.h>
using namespace std;
using ll = long long;
unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

ll ll_gcd(ll a, ll b) {
    if (a < b) return ll_gcd(b, a);
    ll r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

class UnionFind {
public:
    vector <ll> par;
    vector <ll> siz;
    UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    ll root(ll x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) {
        return root(x) == root(y);
    }

    ll size(ll x) {
        return siz[root(x)];
    }
};

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

int main() {
    ll n, c, k;
    cin >> n >> c >> k;
    vector<ll> z(n);
    for (int i = 0; i < n; i++) {
        cin >> z[i];
    }
    sort(z.begin(), z.end());
    ll ans = 0;
    ll t = c+1;
    ll p = 0;
    for (int i = 0; i < n; i++) {
        if (t >= c || z[i] > p+k) {
            t = 0;
            p = z[i];
            ans++;
        }
        t++;
    }
    cout << ans << endl;
}

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

int main(){
  int N, A ,B,sum = 0,n = 0,m = 0;
  cin >> N >> A >> B;


  for(int i = 1; i <= N; i++){
    n = i;
    while(n != 0){
      m += n%10;
      n /= 10;
    }
    if(A <= m && m <= B){
      sum += i;
    }
    m = 0;
  }
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 3636
-- http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_2_B

main = do
    l <- getLine
    let (a:b:c:[]) = map read $ words l :: [Int]
    putStrLn $ cmpr a b c

cmpr :: Int -> Int -> Int -> String
cmpr a b c = if (a < b) && (b < c) then "Yes" else "No"



Measured memory_bytes: 3624
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication3
{
    class Program
    {
        static void Main(string[] args)
        {
            var nm = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var n = nm[0];
            var m = nm[1];
            int[,] a;
            a = new int[n,m];
            int[] b;
            b = new int[m];
            foreach(var i in Enumerable.Range(0,n))
            {
                var x = Console.ReadLine().Split().Select(int.Parse).ToArray();
                foreach (var j in Enumerable.Range(0,m))
                {
                    a[i, j] = x[j];
                }
            }
            foreach(var i in Enumerable.Range(0,m))
            {
                b[i] = int.Parse(Console.ReadLine());
            }
            foreach(var i in Enumerable.Range(0,n))
            {
                var y = (0);
                foreach(var j in Enumerable.Range(0,m))
                {
                    y = y + a[i, j] * b[j];
                }
                Console.WriteLine(y);
            }
        }
    }
}

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

#define INF 1e9
using namespace std;
typedef long long ll;

int main() {

    int n; cin >> n;

    int sum = 0;

    vector<int> s(n);
    for (int i = 0; i < n; ++i) {
        cin >> s[i];
        sum += s[i];
    }

    sort(s.begin(), s.end());

    if (sum % 10 != 0) {
        cout << sum << endl;
        return 0;
    }

    int ans = 0;

    for (int i = 0; i < n; ++i) {
        if (s[i] % 10 != 0) {
            ans = max(ans, sum - s[i]);
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
// Do you knOW what it feels like?

		// To be TorTured by your own MinD?
	
	// I don't wanna feel the PAIN.

// I BeG you to KILL me, pleASE...

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

#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("Os")

#define F first
#define S second
#define pb push_back
#define SZ(x) (ll)(x.size())
#define all(x) x.begin(),x.end()

typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll maxn=2e5+10, lg=17, mod=1e9+7, inf=1e18;

ll n,a,b,s[maxn],f[maxn];
ll ans;

int main(){
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	
	cin>>n>>a>>b;
	if(a>b) swap(a,b);
	for(int i=1;i<=n;i++) cin>>s[i];
	for(int i=2;i<n;i++) if(s[i+1]-s[i-1]<a) return cout<<0,0;
	ll j=0;
	f[0]=1, s[0]=-b;
	for(int i=1;i<=n;i++){
		while(j<i && s[i]-s[j]>=b) ans+=f[j++], ans%=mod;
		f[i]=ans;
		if(s[i]-s[i-1]<a) ans=0, j=i-1;
	}
	for(int i=j;i<=n;i++) ans+=f[i], ans%=mod;
	cout<<ans<<endl;

	return 0;
}


















Measured memory_bytes: 1792
#include <bits/stdc++.h> 
using namespace std;
#define rep(i, N) for(int i=0; i<N; i++)
typedef long long ll;
#define dump(x) cerr<<#x<<"="<<x<<endl

int main() {
    int r, g, b; cin >> r >> g >> b;
    int res = 100 * r + 10 * g + b;
    if(res%4==0){
        cout << "YES" << endl;
    }
    else cout << "NO" << endl;
}

Measured memory_bytes: 256
def dijkstra(edge,start,end) :
    import heapq

    minCosts = [float('inf') for _ in range(len(edge))]

    nodeHeap = []
    heapq.heappush(nodeHeap, (0, start))  # (cost, node)

    while nodeHeap :
        cost, node = heapq.heappop(nodeHeap)

        if minCosts[node] <= cost :
            continue

        minCosts[node] = cost

        for nextNode , weight in edge[node] :
            newCost = cost + weight
            heapq.heappush(nodeHeap, (newCost, nextNode))
    dist = minCosts[endNode]
    if dist == float('inf') :
        return -1
    return dist

N , M = map(int,input().split())

# edges , costs
nodes = [[] for _ in range(3 * N)]

# 辺の入力
for _ in range(M) :
    fromNode , toNode = map(int,input().split())
    fromNode -= 1
    toNode -= 1
    fromNode *= 3
    toNode *= 3

    nodes[fromNode].append((toNode + 1,1))
    nodes[fromNode + 1].append((toNode + 2,1))
    nodes[fromNode + 2].append((toNode,1))

# スタート ゴール
startNode , endNode = map(int,input().split())
startNode -= 1
endNode -= 1
startNode *= 3
endNode *= 3

ans = dijkstra(nodes,startNode,endNode)

if ans == -1 :
    print(ans)
else :
    print(ans // 3)

Measured memory_bytes: 83048
#include <iostream>
#include <string>

using namespace std;

int main()
{
    string s;
    cin >> s;

    int n(0);
    
    for (auto c : s)
    {
        switch(c)
        {
        case '+':
            ++n;
            break;
        case '-':
            --n;
            break;
        default:
            throw;
        }
    }
    
    cout << n << endl; 
}


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

using namespace std;
typedef long long ll;
using graph = vector<vector<int>>;

#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define repd(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#define all(x) (x).begin(),(x).end()
#define size(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

#define INF 1000000000000
#define MOD 10000007
#define MAXR 100000

#define pb push_back
#define mp make_pair
#define f first
#define s second

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; }

int main(){
	int n,m;cin>>n>>m;
	vector<pair<int,int>>t(m);
	rep(i,m){
		int a,b; cin>>a>>b;
		a--;
		b--;
		t[i]=mp(b,a);
	}
	int h=-1,ans=0;
	sort(all(t));
	rep(i,m){
		if(t[i].s>h){
			h=t[i].f-1;
			ans++;
		}
	}
	cout<<ans<<endl;
}



Measured memory_bytes: 1024
import java.util.*;
import java.util.Scanner;

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

        int N = sc.nextInt();

        sc.nextLine();
        String S = sc.nextLine();

        int[] sumWester = new int[N];
        int[] sumEaster = new int[N];

        if (S.charAt(0) == 'W') {
            sumWester[0] += 1;
        }
        for (int i = 1; i < N; i++) {
            sumWester[i] = sumWester[i - 1];
            if (S.charAt(i) == 'W') {
                sumWester[i] += 1;
            }
        }

        if (S.charAt(N - 1) == 'E') {
            sumEaster[N - 1] += 1;
        }
        for (int i = N - 2; i >= 0; i--) {
            sumEaster[i] = sumEaster[i + 1];
            if (S.charAt(i) == 'E') {
                sumEaster[i] += 1;
            }
        }

        int min = Integer.MAX_VALUE;
        for (int i = 0; i < N; i++) {
            int sum = sumWester[i] + sumEaster[i] - 1;
            if (sum < min) {
                min = sum;
            }
        }

        System.out.println(min);

    }
}

Measured memory_bytes: 32984