akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define maxn 200005
#define int long long
using namespace std;



int n,q,ans;
int heng[maxn],shu[maxn];

int lowbit(int x)
{
	return x&(-x);
}

int minx,miny;

int getsum(int a[],int x)
{
	int sum=0;
	for(x;x>1;x-=lowbit(x))	sum+=a[x];
	return sum;
}

void add(int *a,int x,int v)
{
	for(x;x<n;x+=lowbit(x))	a[x]+=v;
}

signed main()
{
	cin>>n>>q;
	ans=(n-2)*(n-2);
	
	minx=miny=n;
	add(heng,2,n-2);
	add(shu,2,n-2);
	for(int i=1,x,y;i<=q;i++)
	{
		cin>>x>>y;
		if(x==1)
		{
			ans-=getsum(shu,y);
//			cout<<getsum(shu,y)<<endl
//			cout<<ans<<endl;
			if(miny>y)
			{
				add(heng,2,y-miny);
//				cout<<miny-y<<endl;
				add(heng,minx,miny-y);
				miny=y;
			}
//			cout<<getsum()
		}
		if(x==2)
		{
			ans-=getsum(heng,y);
			if(minx>y)
			{
				add(shu,2,y-minx);
				add(shu,miny,minx-y);
				minx=y;
			}
		}
	}
	cout<<ans<<endl;
} 

Measured memory_bytes: 5220
#include<bits/stdc++.h>
using namespace std;
const int MAX=2000005;
const long long MOD=1000000007;

typedef long long ll;

ll fac[MAX],finv[MAX],inv[MAX];

ll mod_pow(ll x, ll n){ //べき乗
    ll ans=1;
    x%=MOD;
    while(n!=0){
        if(n&1) ans=ans*x%MOD;
        x=x*x%MOD;
        n=n>>1;
    }
    return ans%MOD;
}

void com_init(){ //初期化
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<MAX;i++){
        fac[i]=fac[i-1]*i%MOD;
        //inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
        //finv[i]=finv[i-1]*inv[i]%MOD;
        finv[i]=finv[i-1]*mod_pow(i,MOD-2)%MOD;//フェルマーの小定理より
    }
}

ll comb(ll n, ll k){ //nCk
    if(n<k) return 0;
    if(n<0||k<0) return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}

int main(){
    int k; cin >> k;
    string s; cin >> s;
    com_init();
    int N=s.size();
    ll ans=0;
    for(int i=1;i<=(k+N);i++){
        if(N<=i){
            ans+=((comb(i-1,N-1)*mod_pow(25,i-N))%MOD*mod_pow(26,k+N-i))%MOD;
        }
        ans%=MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 35588
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPS(i,n) for(int i=1, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { std::fill( (T*)array, (T*)(array+N), val ); }
#define INF 1e9
#define PI (acos(-1))
#define mod (int)1e9+7
int main() {
    char s;
    cin>>s;
    if('A'<=s&&'Z'>=s)cout<<"A"<<endl;
    else cout<<"a"<<endl;
    return 0;
}

Measured memory_bytes: 3620
#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 each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)

#define pb push_back
#define INF 999999999
#define MOD 1000000007
#define sp ' '


//typedef
typedef long long ll;
typedef pair<int, int> pint;
typedef pair<long, long> pll;
typedef map<int, int> mint;
typedef set<int> sint;
typedef vector<int> vint;
typedef vector<char> vchr;
typedef vector<long long> vll;
typedef vector<string> vstr;


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 a, ll b, ll c){ll ans=1; rep(i, b){ans=ans*a%c;} return ans;}
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;}
template<typename T>
void dpp(T n){cerr << n << endl;}
template<typename T>
void vpp(T a){rep(i,a.size()){cout << a[i] << endl;}}
template<typename T>
void vdp(T a){rep(i,a.size()){cerr << a[i] << endl;}}

const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int ddx[8] = {1,0,-1,0,1,-1,-1,1};
const int ddy[8] = {0,1,0,-1,1,1,-1,-1};

int main(){

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

    string s;
    cin >> s;

    int k;
    cin >> k;

    set<string> ss;
    rep(i, s.size()){
        for(int j = 1; j <= k; ++j){
            ss.insert(s.substr(i, j));
        }
    }

    auto ans = ss.begin();
    rep(i, k-1) ans++;
    ppp(*ans);

    return 0;
}


Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll minn(ll x, ll y){
    if(x<y)
        return x;
    return y;
}
ll maxx(ll x, ll y){
    if(x>y)
        return x;
    return y;
}
vector <int> v[100009];
int vis[100005];
int cal(int x){
    if(vis[x]!=0)
        return vis[x];
    // cout<<x<<" ";
    int i,maxi=0;
    for(i=0;i<v[x].size();i++){
        maxi = maxx(maxi,cal(v[x][i]));
    }
    vis[x] = 1+maxi;
    return vis[x];
}
int main() {
    int n,m,x,y,i,maxi=0,cur;
    cin>>n>>m;
    while(m--){
        cin>>x>>y;
        v[x].push_back(y);
    }
    for(i=1;i<=n;i++){
        if(vis[i] == 0){
            maxi = maxx(maxi, cal(i));
        }
        // cout<<endl;
    }
    cout<<maxi-1;
}


Measured memory_bytes: 8192
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=int(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
#define rAll(x) (x).rbegin(),(x).rend()
using namespace std;
using ll = long long;

int main(){
    int N;cin>>N;
    vector<int> a(N);
    REP(i, N) cin >> a[i];
    ll ans=0,P=1;
    REP(i,N){
        ll cnt=(a[i]-1)/P;
        ans+=cnt;
        a[i]-=cnt*P;
        if(cnt>=1&&a[i]==P&&P>1) a[i]--;
        P=max(P,a[i]+1LL);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
ll i, temp,t, n,j, a[200600], C;
string s;
int main()
{
    //I am Monim, a tiny creature of Allah
    cin >> n;
    cin >> s;
    while(s[i]!='W' && i<n)
        i++;
    temp = i;
    for(;i<n;i++)
    {
        if(s[i]=='R')
            C++;
    }
    j = C;
//    cout << C << endl;
//    cout << temp << endl;
    for(i=temp;i<j+temp;i++)
    {
        if(s[i]=='R')
            C--;
//        cout <<i <<" "<< s[i] << endl;
    }
    cout << C << endl;
    return 0;
}



Measured memory_bytes: 3700
x, y = map(int, input().split())
cnt = 0
if x == 1:
    if y == 2 or y == 4:
        print('Yes')
    else:
        print('No')
else:
    for i in range(x+1):
        if i*4 + (x-i)*2 == y:
            cnt = 1
            break
        else:
            cnt = 0
        
    if cnt == 0:
        print('No')
    else:
        print('Yes')

Measured memory_bytes: 61740
import java.util.*;

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

    int n = scan.nextInt();
    int k = scan.nextInt();

    int count = 0;
    for (int i=0;i<n;i++){
      int t = scan.nextInt();
      if (t == 1){
        count = i+1;
        break;
      }
    }
    int l = count-1;
    int r = n-count;
    ArrayList<Integer> g = new ArrayList<Integer>();

    for (int j=0;j<=k-1;j++){
      int kk = k-1-j;
      int ret = find(count-1-j,k-1) + find(n-count-kk,k-1)+1;
      g.add(ret);
    }
    Collections.sort(g);
    System.out.println(g.get(0));
  }

  static int find(int a, int b){
    if (a<=0){
      return 0;
    }
    int ret = (int) a/b;
    if (b*ret == a){
      return ret;
    }
    return ret+1;
  }

}


Measured memory_bytes: 57852
import std.algorithm;
import std.array;
import std.container;
import std.conv;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

int solve (int n, int k, int q)
{
	readln;
	auto a = readln.splitter.map !(to !(int)).array;
	auto p = n.iota.array;
	makeIndex (a, p);
	int res = int.max / 2;
	for (int skips = 0; n - (skips + q) >= k - 1; skips++)
	{
		auto s = redBlackTree !(int) ();
		s.insert (-1);
		s.insert (n);
		foreach (i; 0..skips)
		{
			s.insert (p[i]);
		}
		auto t = new int [n + 2];

		int fenSum (int v)
		{
			int res = 0;
			for (v += 1; v > 0; v -= (v & -v))
			{
				res += t[v];
			}
			return res;
		}

		void fenAdd (int v)
		{
			for (v += 1; v < n; v += (v & -v))
			{
				t[v] += 1;
			}
		}

		int inf = int.max / 2;
		int sup = int.min / 2;
		int acc = 0;
		foreach (i; skips..n)
		{
			int cur = p[i];
			auto lo = s.lowerBound (cur).back;
			auto hi = s.upperBound (cur).front;
			auto used = fenSum (hi) - fenSum (lo);
			if (hi - lo - 1 - used >= k)
			{
				fenAdd (cur);
				sup = max (sup, a[cur]);
				inf = min (inf, a[cur]);
				acc += 1;
				if (acc == q)
				{
					break;
				}
			}
		}
		if (acc >= q)
		{
			res = min (res, sup - inf);
		}
	}
	return res;
}

void main ()
{
	int n, k, q;
	while (readf (" %s %s %s", &n, &k, &q) > 0)
	{
		writeln (solve (n, k, q));
	}
}


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

void solve(long long N, vector<long long> a){
	int b = 0, c = 0;
	for(int i = 0; i < N; ++i) {
		if(a[i] % 4 == 0) {
			b++;
		} else if(a[i] % 2 == 1) {
			c++;
		}
	}
	if(b >= c) {
		cout << "Yes" << endl;
	} else if(b >= c - 1 && b + c == N) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
}

int main(){	
	long long N;
	scanf("%lld",&N);
	vector<long long> a(N-1+1);
	for(int i = 0 ; i <= N-1 ; i++){
		scanf("%lld",&a[i]);
	}
	solve(N, a);
	return 0;
}



Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
long long gcd(long long a, long long b) { return b?gcd(b,a%b):a;}
long long lcm(long long a, long long b) { return a/gcd(a,b)*b;}

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

int main() {
  int a, b;
  cin >> a >> b;
  if (a - 2*b > 0) cout << a - 2* b << endl;
  else cout << 0 << endl;
  return 0;
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a,b;
  cin >> a >> b;
 
 int heigthA = b - a - 1;
 int n = heigthA / 2;
 if(heigthA % 2 == 0){
 	cout << (heigthA + 1)* n - a << endl;
 }
 else{
   cout << (heigthA + 1)* n + n + 1 - a << endl;
 }
  
 return 0; 
}

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

int main(){
  int n;
  std::cin >> n;
  std::map<int, int> m;
  rep(i,n){
    int t;
    std::cin >> t;
    m[t]++;
    m[t+1]++;
    if(t-1>=0)m[t-1]++;
  }

  int ans=0;
  for(pair<int,int> v :m){
    ans=max(v.second,ans);
  }
  std::cout << ans << '\n';

  return 0;
}


Measured memory_bytes: 4736
n,x=map(int,input().split())
l=list(map(int,input().split()))
d_list=[]
d=0
for i in range(n):
    d=d+l[i]
    d_list.append(d)

count=1
for j in range(n):
    if d_list[j]<=x:
        count+=1
print(count)

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

using namespace std;

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

const double PI = 3.1415926535897932384626433832795;

const int dx[] = { 0, 1, 0, -1 };
const int dy[] = { -1, 0, 1, 0 };

int gcd(int x, int y) { return y ? gcd(y, x % y) : abs(x); }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : abs(x); }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

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

	const int MAX_V = 100 * 100;

	int n;
	cin >> n;

	vector<int> s(n);
	for (auto &v : s) {
		cin >> v;
	}

	vector<bool> dp(MAX_V + 1);
	dp[0] = true;

	for (auto v : s) {
		for (int i = MAX_V - v; i >= 0; i--) {
			dp[i + v] = dp[i] ? dp[i] : dp[i + v];
		}
	}

	for (int i = MAX_V; i >= 0 ; i--) {
		if (!dp[i] || i % 10 == 0) {
			continue;
		}
		
		cout << i << endl;
		return 0;
	}

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


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;

namespace AtCoder.Probrems.Solvers.ABC123
{
    public class C
    {
        static void Main(string[] args)
        {
            WriteLine(Solve());
        }

        public static long Solve()
        {
            var s = long.Parse(ReadLine());
            var powers = new List<long>();
            for (int i = 0; i < 5; i++)
            {
                powers.Add(long.Parse(ReadLine()));
            }

            var min = powers.Min();
            var result = s / min;
            result += s % min == 0 ? 0 : 1;
            return result + 4;
        }

        private const int MOD = 1000000007;
    }
}


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

using namespace std;
using ll =long long;
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
#define leftunique(a) {sort((a).begin(),(a).end());(a).erase(unique((a).begin(),(a).end()),(a).end());}
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; }
static const ll INF = 1LL << 60;
//Write From this Line

int main()
{
	ll n, k;
	cin >> n >> k;
	string s;
	cin >> s;
	
	vector<ll> Nums;
	ll cnt = 0; // cnowが何個連続で続いているか
	ll cnow = 1; //今見ている数字
	rep(i,n) {
		if(s[i]-'0'==cnow) cnt ++;
		else {
			Nums.push_back(cnt);
			cnt = 1;
			cnow = s[i] - '0';
		}
	}
	if(cnt != 0) Nums.push_back(cnt);
	if(Nums.size() % 2 == 0) Nums.push_back(0);

	// 今　Nums には 1-0-1-0-1と言うものが出来上がった
	vector<ll> a(Nums.size()+1,0);
	rep(i,Nums.size()) {
		a[i+1] = a[i] + Nums[i];
	}
	ll ans = 0;
	ll tmp = 0;
	for(ll left = 0; left < a.size(); left+=2) { // 1-0-1の1のところを左にするので+=2
		ll right = min((ll)Nums.size(), (ll)left + 2 * k + 1);
		tmp = a[right] - a[left];
		ans = max(tmp,ans);
	}
	cout << ans << endl;
}


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

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

using namespace std;

int main(){
  int x,a,b;
  cin>>x>>a>>b;
  
  if(abs(x-a) > abs(x-b)){
    cout<<"B";
  }else{
    cout<<"A";
  }
  
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int count[101];
	int max_count = 0;
	int n, i;
	
	for (i = 0; i < 101; i++) 
		count[i] = 0;
	
	while (scanf("%d", &n) != EOF) 
		count[n]++;
	
	for (i = 1; i < 101; i++) {
		if (max_count < count[i])
			max_count = count[i];
	}
	
	for (i = 1; i < 101; i++) {
		if (count[i] == max_count)
			printf("%d\n", i);
	}
	
	return 0;
}

Measured memory_bytes: 596
#include<iostream>
#include<algorithm>
#include<math.h>
#include<vector>
#include<map>
#include<set>

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

using namespace std;
using ll = long long;
using ull = unsigned long long;

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

    vector<int> H(N); rep(i, N) cin >> H[i];

    vector<int> A(2 * M), B(2 * M);
    rep(i, M) {
        cin >> A[i] >> B[i];
    }    
    rrep(j, M, 2 * M - 1) {
        A[j] = B[j - M];
        B[j] = A[j - M];
    }    

    vector<bool> C(N);
    rep(i, N) C[i] = true;

    rep(j, 2 * M) {
        if (H[A[j] - 1] > H[B[j] - 1]) {
            // １度でも悪い展望台と見なされたら２度といい展望台にはなれない
            if (C[A[j] - 1]) {
                C[A[j] - 1] = true;
            }
        } else {
            C[A[j] - 1] = false;
        }
    }

    int ans = 0;
    rep(i, N) {
        if (C[i]) ans++;
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 5372
#include<bits/stdc++.h>
using namespace std;
int main() {
    int w, a, b;
scanf("%d %d %d",&w,&a,&b);
    if(b >= a + w) 
	cout<<(b - (a + w));
    else if (b + w <= a) 
	cout<<(a - (b + w));
    else 
	cout<<0;
}
 

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,cnt=0;
  cin >> N;
  for(int i = 1; i <= N; i++){
    int a;
    cin >> a;
    if(i % 2 == 1 && a % 2 == 1) cnt++;
  }
  cout << cnt << endl;
}

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

    #define ll long long
    #define ff first
    #define ss second
    #define pb push_back
    #define vll vector<ll>
    #define mll map<ll,ll>
    #define MOD 1000000007
    #define pll pair<ll,ll>
    #define fastio ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
    int main() {
        fastio;
        int h,n;
        cin>>h>>n;
       ll s=0;
       for(int i=0;i<n;i++)
       {
        int x;
        cin>>x;
        s=s+x;

       }
       if(s>=h)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;


    }

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
using vi = vector<i64>;
using vvi = vector<vi>;

int cnt[3];

int main() {
    int n;
    int a, b;
    cin >> n >> a >> b;
    for (int i = 0; i < n; i++) {
        int p;
        cin >> p;
        if (p <= a) cnt[0]++;
        else if (p <= b) cnt[1]++;
        else cnt[2]++;
    }

    int ans = 1e9;
    for (int i = 0; i < 3; i++) {
        ans = min(ans, cnt[i]);
    }
    cout << ans << endl;
}

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

int main() {
	int N;
	cin >> N;
	vector<int>A(N);
	for (int i = 0;i<N;++i) {
		cin >> A[i];
	}
	sort(A.begin(),A.end());
	if (1 == N%2) {
		for (int i = 0;i<N;++i) {
			//02244......
			if (((i+1)/2)*2 !=A[i]) {
				cout << 0<<endl;
				return 0;
			}
		}
	}
	else {
		for (int i = 0; i < N; ++i) {
			//113355......
			if ((1+(i/2) * 2) != A[i]) {
				cout << 0 << endl;
				return 0;
			}
		}
	}
	int ans = 1;
	for (int i = 0;i<N/2;++i) {
		ans *= 2;
		ans %= 1000000007;
	}
	cout << ans<<endl;
	return 0;
}



Measured memory_bytes: 3748
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>
#include <typeinfo>

using namespace std;

int main(){
  int N,K;
  cin >> N >> K;
  vector<int> a(N);
  vector<int> sum(N+1);
  for(int i=0;i<N;i++){
    cin >> a.at(i);
    sum.at(a.at(i))++;
  }

  sort(sum.begin(),sum.end());
  reverse(sum.begin(),sum.end());
  int count=0;
  for(int i=0;i<K;i++)  count+=sum.at(i);
  cout << N-count << endl;
  
  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define SPEED ios_base::sync_with_stdio(false); cin.tie(NULL);
#define FOR(i, a, b) for (ll i = a; i < b; ++i)
#define RFOR(i, b, a) for (ll i = b; i >= a; --i)
#define ALL(x) x.begin(), x.end()
#define DEBUG(args...) { string _s = #args; replace(ALL(_s), ' ', '\0');\
replace(ALL(_s), ',', ' ');\
stringstream _ss(_s); istream_iterator<string> _it(_ss); _debug(_it, args);}
#define endl "\n"
#define F first
#define S second
#define pb(x) push_back(x)
#define mp(x, y) make_pair(x, y)

using namespace std;
using namespace __gnu_pbds;

template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

void _debug(istream_iterator<string>) {}
template<typename T, typename... Args>
void _debug(istream_iterator<string> it, T first, Args... args) {
    cerr << ">> " << *it << " : " << first << endl; _debug(++it, args...);
}
template <typename T1, typename T2>
inline ostream& operator << (ostream& out, const pair<T1, T2>& p) {
    return out << "(" << p.F << ", " << p.S << ")";
}
template<typename T>
inline ostream& operator << (ostream& out, const vector<T>& v) {
    if (v.empty()) return out << "[]";
    else { out << '['; for (auto& e : v) { out << e << ", "; } return out << "\b\b]"; }
}
template<typename T>
inline ostream& operator << (ostream& out, const set<T>& s) {
    if (s.empty()) return out << "{}";
    else { out << '{'; for (auto& e : s) { out << e << ", "; } return out << "\b\b}"; }
}
template<typename T>
inline ostream& operator << (ostream& out, const unordered_set<T>& s) {
    return out << set<T>(ALL(s));
}
template<typename T1, typename T2>
inline ostream& operator << (ostream& out, const map<T1, T2>& m) {
    if (m.empty()) return out << "{}";
    out << '{'; for (auto& p : m) { out << p << ", "; } return out << "\b\b}";
}
template<typename T1, typename T2>
inline ostream& operator << (ostream& out, const unordered_map<T1, T2>& m) {
    return out << map<T1, T2>(ALL(m));
}
template<typename T>
inline ostream& operator << (ostream& out, const ordered_set<T>& s) {
    return out << set<T>(ALL(s));
}

typedef long long ll;
typedef long double ld;
typedef vector<long long> vll;
typedef pair<ll, ll> pll;
typedef vector<pair<ll, ll>> vpll;
typedef unordered_map<ll, ll> STll;
/************************************** MAIN PROGRAM ********************************************/

int main()
{
    //freopen("input.txt", "r", stdin);
    SPEED
    int h, a;
    cin >> h >> a;
    cout << (h + a - 1) / a;
}
/************************************** END OF PROGRAM ******************************************/
/** Stuff you should look for:
 * int overflow, array bounds, over-counting, graph is not a tree/connected
 * special cases (n=1?), set/unordered_set TLE, multi-set/set error
 * do something instead of nothing and stay organized
 */


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	string str;
	cin>>str;
	//cout<<str[0]<<str[1]<<str[2]<<str[3];
	if((str[0]>='A'&&str[0]<='Z')&&(str[1]>='A'&&str[1]<='Z')&&(str[2]>='A'&&str[2]<='Z')&&(str[3]>='A'&&str[3]<='Z')){
	 if(str[0]==str[1]&&str[0]==str[2]&&str[0]==str[3])
	cout<<"No"<<endl;
	else if((str[0]==str[1])&&(str[2]==str[3]))
	cout<<"Yes"<< endl;
	else 
		if((str[0]==str[2])&&(str[1]==str[3]))
	cout<<"Yes"<< endl;
	else 
		if((str[0]==str[3])&&(str[1]==str[2]))
	cout<<"Yes"<< endl;
	else cout<<"No"<<endl;
}
else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
N = int(input())

all_dict = dict()
s = str(input())
for i in range(len(s)):
    if s[i] in all_dict:
        all_dict[s[i]] += 1
    else:
        all_dict[s[i]] = 1
        
for i in range(N-1):
    s = str(input())
    s_dict = dict()
    for j in range(len(s)):
        if s[j] in s_dict:
            s_dict[s[j]] += 1
        else:
            s_dict[s[j]] = 1
            
    and_key = all_dict.keys() & s_dict.keys()
    tmp_dict = dict()
    and_key = list(and_key)
    for j in range(len(and_key)):
        tmp_dict[and_key[j]] = min(all_dict[and_key[j]], s_dict[and_key[j]])
    all_dict = tmp_dict
    
all_dict = sorted(all_dict.items(), key=lambda x:x[0])

for i in range(len(all_dict)):
    for j in range(all_dict[i][1]):
        print(all_dict[i][0], end="")

Measured memory_bytes: 3064
let n = Scanf.scanf " %d" (+) 0
let cs, ss, fs = Array.(make (n - 1) 0, make (n - 1) 0, make (n - 1) 0)
let _ = for i = 0 to n - 2 do Scanf.scanf " %d %d %d" @@ fun a b c -> cs.(i) <- a; ss.(i) <- b; fs.(i) <- c done
let _ = Printf.(Array.iteri (fun j _ -> let t = ref 0 in for i = j to n - 2 do t := ss.(i) + max 0 ((!t - ss.(i) + fs.(i) - 1) / fs.(i)) * fs.(i) + cs.(i) done; printf "%d\n" !t) cs; printf "0\n")

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

fn main() {
    let n: usize = read();
    let min: usize = (0..5).map(|_| read::<usize>()).min().unwrap();

    let mut po = n / min;
    if n % min != 0 {
        po += 1;
    }
    println!("{}", po + 4);
}

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


Measured memory_bytes: 4352
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

from collections import Counter

s = readline().rstrip().decode()[::-1]
m = 0
d = 1
memo = [0]
for check in s:
    m += int(check) * d
    m %= 2019
    d *= 10
    d %= 2019
    memo.append(m)
counter = Counter(memo)
ans = 0
for i in range(2020):
    ans += counter[i] * (counter[i] - 1) // 2
print(ans)


Measured memory_bytes: 16668
#include <stdio.h>
int main(void)


{
	int H, W, i, j;
	H = 1;
	W = 1;
	
	while ((H!=0)||(W!=0))
	{
		scanf("%d %d",&H, &W);
		if ((H==0)&&(W==0))
		{
			break;
		}
		for (i = 0;i < H;i++)
		{
			for (j = 0;j < W;j++)
			{
				printf("#");
			}
			printf("\n");
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 572
#include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
#define dbg(x) cout << #x << '=' << x << '\n';
#define ll long long
#define pi pair<int,int>
#define pl pair<long long,long long>
#define lg length()
#define pb push_back
#define MAXN 100005
#define INF 1000000005
#define LINF 1000000000000000005

long long n,a[305][305],t,v[305][305];

int32_t main(){
    ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
    cin >> n;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            cin >> a[i][j];
            t+=a[i][j];
        }
    }
    t/=2;
    for(int k=1;k<=n;k++){
        for(int i=1;i<=n;i++){
            for(int j=i+1;j<=n;j++){
                if(k==i || k==j) continue;
                if(a[i][k]+a[j][k]<a[i][j]){
                    cout << -1;
                    return 0;
                }
                if(a[i][k]+a[j][k]==a[i][j] && !v[i][j]){
                    t-=a[i][j];
                    v[i][j]=1;
                }
            }
        }
    }
    cout << t;
}


Measured memory_bytes: 1664
// C++(GCC 9.2.1)
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
#define repex(i, a, b, c) for(int i = a; i < b; i += c)
#define repx(i, a, b) repex(i, a, b, 1)
#define rep(i, n) repx(i, 0, n)
#define repr(i, a, b) for(int i = a; i >= b; i--)
LL A[202020];

int main(){
    
    // 1. 入力情報.
    int N;
    scanf("%d", &N);
    rep(i, N) scanf("%lld", &A[i]);
    
    // 2. sort.
    sort(A, A + N, greater<LL>());
    
    // 3. 集計(※大きい値から, 最大2回ずつ加算).
    LL ans = A[0];
    int add = 1;
    repx(i, 1, N / 2 + 1){
        if(++add < N) ans += A[i];
        if(++add < N) ans += A[i];
    }
    
    // 4. 出力.
    printf("%lld\n", ans);
    return 0;
    
}

Measured memory_bytes: 5384
using System;
using static System.Console;

class Program
{
    public static void Main()
    {
	int n = int.Parse(ReadLine());

	// 1, (1)
	// 6, 6^2, ..., 6^6 (6)
	// 9, 9^2, ..., 9^5 (5)

	int ans = n + 1;

	for (int N = 1; N <= n; N++)
	{
	    int res = 0;
	    int n9 = n;
	    
	    int n6 = N;
	    int k = 6;
	    while (k > 0 && n6 > 0)
	    {
		int amount = (int) Math.Pow(6, k);
		int c = n6 / amount;
		res += c;
		n6 -= c * amount;
		n9 -= c * amount;
		k--;
	    }

	    k = 5;
	    while (k > 0 && n9 > 0)
	    {
		int amount = (int) Math.Pow(9, k);
		int c = n9 / amount;
		res += c;
		n9 -= c * amount;
		k--;
	    }

	    res += n9;
	    ans = Math.Min(ans, res);
	}

	WriteLine(ans);
    }
}


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

#define int ll
typedef long long ll;

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

typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;

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

#define ALL(s) (s).begin(),(s).end()
#define ALLn(s,n) s,s+n
#define F first
#define S second
#define pb push_back
#define tc(t) int t; cin >> t; while(t--)
#define _ ios_base::sync_with_stdio(false); cin.tie(NULL);
#define D1(x) { cerr << " [" << #x << ": " << x << "]\n"; }
#define D2(x) { cerr << " [" << #x << ": "; for(auto it:x) cerr << it << " "; cerr << "]\n"; }

const ll MOD = 1e9 + 7;
const ll MAXN = 1e6 + 7;
const ll INF = LONG_LONG_MAX;

void solve() {
	int l,r,d;
	cin >> l >> r >> d;

	int cnt = 0;
	FOR(i,l,r+1) {
		if(i%d == 0) cnt++;
	}

	cout << cnt << '\n';
}

int32_t main() {_
	
#ifndef ONLINE_JUDGE
	freopen("in", "r", stdin);
	freopen("out", "w", stdout);
#endif

	// tc(t)
		solve();
	cerr << "[ Time : " << (float)clock() / CLOCKS_PER_SEC << " secs ]" << endl;
}


Measured memory_bytes: 3784
#!python3.4
# -*- coding: utf-8 -*-
# abc159/abc159_d
import sys
from collections import Counter

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N = i2n()
    A = i2nn()
    cntr = Counter()
    c_dict = {}
    for a in A:
        cntr[a] += 1
    sum_c = 0
    for k in cntr:
        n = cntr[k]
        c = n * (n - 1) // 2 if n > 1 else 0
        sum_c += c
        c_dict[k] = c
    for i in range(N):
        k = A[i]
        n = cntr[k] - 1
        c = n * (n - 1) // 2 if n > 1 else 0
        print(sum_c - c_dict[k] + c)
    return

main()


Measured memory_bytes: 30856
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int Par[200001],Size[200001];
int Pos[200001];


void init(int n)
{
	for(int i = 0;i<=n;i++)
	{
		Par[i] = i;
		Size[i] = 1;
	}
}


int main()
{
	int n;
	cin >> n;
	init(n);
	vector<int> a(n);
	for(int i = 0;i<n;++i)
	{
		cin >> a[i];
		Pos[a[i]] = i+1;
	}

	for(int i = 0;i<n;i++)
	{
		if(Par[a[i]]!=a[i])continue;
		int now = a[i];
		//cout<<';'<<endl;
		while(1)
		{
			if(Pos[now]<Pos[now+1])
			{
				Size[a[i]]++;
				Par[now+1] = 30000000;
				now++;
			}
			else break;
		}
	}
	ll ans = 0;
	for(int i = 0;i<=n;i++)ans = max<ll>(Size[i],ans);
	cout<<n-ans<<endl;

}

Measured memory_bytes: 3456
#include <stdio.h>
const int MAX_SPOTS = 1000;

int abs(int a){
	if(a>=0)
		return a;
	else
		return -a;
}
int max(int a,int b){
	int ret;
	if(a>b)
		ret = a;
	else
		ret = b;
	return ret;
}
int main(){
// initialization phase
	int W,H,N;
	int Xbefore,Ybefore,X,Y;
	int i;
	int sum = 0;
// reading & summarizing phase
	scanf("%d%d%d", &W , &H , &N );
	scanf("%d%d", &Xbefore , &Ybefore );
	for(  i = 0  ;  i < N - 1  ;  i++  ){
		scanf("%d%d", &X , &Y);
		if( ( X - Xbefore ) * ( Y - Ybefore ) >= 0 )
			sum += max(abs(X-Xbefore),abs(Y-Ybefore));
		else
			sum += abs(X-Xbefore)+abs(Y-Ybefore);
		Xbefore = X; Ybefore = Y;
	}
// answer writing phase
	printf("%d\n",sum);
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define int long long
#define all(x) x.begin(), x.end()
using namespace std;
 
void PUNKS_NOT_DEAD() {
    int h, w;
    cin >> h >> w;
  if (w == 1) {
  	cout << 1;
    exit(0);
  }
    if (h == 1) {
        cout << 1;
        exit(0);
    }
    int b = (w + 1) / 2;
    int c = w / 2;
    cout << ((h + 1) / 2) * b + (h / 2) * c;
}
 
signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    PUNKS_NOT_DEAD();
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define deb(x)   cout<<"> "<<#x<<" : "<<x<<endl;
#define deb2(x,y)cout<<"> "<<#x<<"->"<<x<<"  "<<#y<<"->"<<y<<endl;
#define LINE   cout << "--- LINE NO : " << __LINE__ <<"  ---"<< endl;
#define pnr(a)   for(auto x:a){cout<<x<<" ";}cout<<endl;
#define pnr2(a)  for(auto x:a){cout<<x.first<<" "<<x.second<<endl;}

#define  vt            vector
#define  ff            first
#define  ss            second
#define  int           long long
#define  db            long double
#define  pii           pair<int,int>
#define  Maxpq(x)      priority_queue<x>
#define  Minpq(x)      priority_queue<x,vt<x>,greater<x>>

#define  pb            push_back
#define  si(x)         (int)x.size()
#define  all(x)        x.begin(),x.end()
#define  mem(a,x)      memset(a,x,sizeof(a))
#define  FOR(a)        for(auto& x :  a )
#define  forr(i,n)     for(int i=0;i<n;i++)

#define  pi            2*acos(0.0)
#define  inf           (int)1e18
#define  mxn           (int)2e5+5
#define  mod           (int)1e9+7

int mainx()
{
	int n;
	cin >> n;
	int a[n];
	for (int i = 0 ; i < n ; i++)
		cin >> a[i];
	unordered_map< int , int > mp;
	forr(i , n)
	{
		mp[a[i]]++;
	}
	int sum = 0;
	forr(i , n)sum += a[i];
	int q;
	cin >> q;
	forr(_ , q)
	{
		int bi , ci;
		cin >> bi >> ci;

		sum -= (bi * mp[bi]);
		sum += (ci * mp[bi]);
		mp[ci] += mp[bi];
		mp[bi] = 0;
		cout << sum << endl;
	}
	return 0;
}


inline void __INCLUDE() {
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	//freopen("out.txt","w",stdout);
#endif
}

int32_t main() {



	ios::sync_with_stdio(0);
	cin.tie(NULL); cout.tie(NULL);

	//cout << fixed << setprecision(20);

	int tt = 1;
	//cin>>tt;
	for (int t = 1 ; t <= tt ; t++ )
	{
		// cout<<"Case #"<<t<<": ";
		mainx();
	}
	return 0 ;
}



Measured memory_bytes: 7824
#include<stdio.h>
int main(){
int a, b;

  scanf("%d", &a);
  scanf("%d", &b);

  if(a < b){
    printf("a < b\n");
  }else if(a > b){
    printf("a > b\n");
  }else{
    printf("a == b\n");
  }
  return 0;

}

Measured memory_bytes: 1756
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <limits>
#include <numeric>
#include <queue>
#include <set>
#include <bitset>
#include <map>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<long long> vll;
typedef queue<int, int> qii;
typedef pair<int, int> pii;
typedef pair<string, int> psi;

#define PI 3.14159265359
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rept(i,n) rep(i,0,n)

//int型を受け取ってその桁数を返す
int check_digits(int n) {
	int digits = 0;
	while (n != 0) {
		n /= 10;
		digits++;
	}
	return digits;
}

//int型を受け取ってその各桁の和を返す
int sum_digits(int n) {
	int sum=0;
	int N = n;
	while (N) {
		sum += N % 10;
		N /= 10;
	}
	return sum;
}


//最大公約数を返す関数
int gcd(int n, int m) {
	while (n != 0) {
		if (n < m) swap(n, m);
		n = n % m;
	}
	return m;
}


//2点間の距離を返す
float dis(int x1, int y1, int x2, int y2) {
	return sqrt(pow(abs(x1 - x2), 2) + pow(abs(y1 - y2), 2));
}

void yes() {
	cout << "Yes" << endl;
}

void no() {
	cout << "No" << endl;
}

int main() {
	int n;
	string s;
	cin >> n >> s;
	rept(i, s.size()) {
		int temp = s[i] - 'A';
		//cout << "temp: " << temp << endl;
		s[i] =  'A' + ((temp + n) % 26);
	}

	cout << s << endl;

	system("pause");
	return 0;
}


Measured memory_bytes: 504
#include <iostream>
#include <string>
#include <algorithm>

bool equals( const char c1, const char c2 )
{
    return ( c1 == c2 );
}

int main(void)
{
    std::string S, T;
    std::cin >> S >> T;
    std::size_t count = 0;
    auto searchSBegin = S.begin();
    auto searchTBegin = T.begin();
    
    while ( true )
    {
        auto mismatch = std::mismatch( searchSBegin, S.end(), searchTBegin );
        
        if ( mismatch.first == S.end() )
        {
            break;
        }
        
        searchSBegin = ++mismatch.first;
        searchTBegin = ++mismatch.second;
        ++count;
    }
    
    std::cout << count << std::endl;
    return 0;
}


Measured memory_bytes: 3884
# -*- coding: utf-8 -*-

D = int(input())
c = list(map(int, input().split()))
s = []
t = []

for i in range(D):
    s.append(list(map(int, input().split())))

for i in range(D):
    t.append(int(input()) - 1)

last = [0] * 26

ans = 0

for i in range(D):
    ans = ans + s[i][t[i]]
    for j in range(26):
        if t[i] != j:
            last[j] += 1
            ans = ans - (c[j] * last[j])
        elif t[i] == j:
            last[j] = 0
    print(ans)

Measured memory_bytes: 9396
fun main(args: Array<String>) {
  val N = readInt()
  val a = N / 2
  val b = N - a
  println(a * b)
}

fun gcd(a: Int, b: Int): Int = if (a < b) gcd(b, a) else if (b == 0) a else gcd(b, a % b)
fun gcd(a: Long, b: Long): Long = if (a < b) gcd(b, a) else if (b == 0L) a else gcd(b, a % b)
fun lcm(a: Int, b: Int): Int = (a * b) / gcd(a, b)
fun lcm(a: Long, b: Long): Long = (a * b) / gcd(a, b)

fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readInts() = readLine()!!.split(" ").map { it.toInt() }
fun readLongs() = readLine()!!.split(" ").map { it.toLong() }


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

int main() {
  long long n, x;
  cin >> n >> x;
  vector<int> vec(n);
  rep(i, n) cin >> vec.at(i);
  vector<int> d(n+1);
  rep(i, n) d.at(i+1) = d.at(i) + vec.at(i); 
  int ans = 0;
  rep(i, n+1) if(d.at(i) <= x) ans++;
  cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import java.util.function.*;

class Main {
    static Scanner scanner = new Scanner();
    static int mod = 998244353;
    static long inf = 0x7ffffffffffffffL;

    public static void main(String[]$) throws Exception {
        int n = scanner.nextInt();
        Map<Integer, Integer> count = new TreeMap<>();
        int[] d = new int[n];
        for (int i = 0; i < n; i++) {
            d[i] = scanner.nextInt();
            count.put(d[i], count.getOrDefault(d[i], 0) + 1);
        }
        long ans = 1;
        if (d[0] != 0) {
            ans = 0;
        }
        for (int i = 1; i < n; i++) {
            if (d[i] == 0) {
                ans = 0;
            }
            ans = (ans * count.getOrDefault(d[i] - 1, 0)) % mod;
        }
        System.out.println(ans);
    }

    static class System {
        static PrintWriter out = new PrintWriter(java.lang.System.out);

        static {
            Runtime.getRuntime().addShutdownHook(new Thread(System.out::flush));
        }

        static void exit() {
            java.lang.System.exit(0);
        }
    }

    static class Scanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(java.lang.System.in), 0x10000);
        StringTokenizer tokenizer;

        String next() {
            try {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                    tokenizer = new StringTokenizer(reader.readLine());
                }
            } catch (IOException ignored) {
            }
            return tokenizer.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        char[][] nextCharArray(int n, int m) {
            char[][] a = new char[n][m];
            for (int i = 0; i < n; i++) {
                a[i] = next().toCharArray();
            }
            return a;
        }
        int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = nextInt();
            }
            return a;
        }

        int[] nextIntArray(int n, IntUnaryOperator op) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = op.applyAsInt(nextInt());
            }
            return a;
        }

        long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nextLong();
            }
            return a;
        }

        long[] nextLongArray(int n, LongUnaryOperator op) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = op.applyAsLong(nextLong());
            }
            return a;
        }
    }
}


Measured memory_bytes: 48928
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] x = new int[n];
        int[] y = new int[n];
        double D1 = 0, D2 = 0, D3 = 0, D4 = 0;

        for (int i = 0; i < n; i++) x[i] = scan.nextInt();
        

        for (int i = 0; i < n; i++) y[i] = scan.nextInt();

        for (int i = 0; i < n; i++) {
            D1 += Math.abs(x[i] - y[i]);
            D2 += Math.pow(Math.abs(x[i] - y[i]), 2);
            D3 += Math.pow(Math.abs(x[i] - y[i]), 3);
            if (D4 < Math.abs(x[i] - y[i])) D4 = Math.abs(x[i] - y[i]);
        }
        System.out.printf("%8f\n%8f\n%8f\n%8f\n", D1, Math.sqrt(D2), Math.cbrt(D3), D4);
    }
}

Measured memory_bytes: 26636
#include <iostream>
#include <vector>
#include <tuple>
#include <deque>
#include <set>
#include <map>
#include <cmath>
#include <string>
#include <algorithm>
#include <unordered_set>
#define int long long
#define all(x) (x).begin(), (x).end()
#define allr(x) (x).rbegin(), (x).rend()

using namespace std;

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

void fast()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}

const int sz = 1e6 + 5;
int dp[sz][2][2];

signed main()
{
	fast();
	int n;
	cin >> n;
	for (int i = 0; i <= n; ++i)
	{
		for (int j = 0; j < 2; ++j)
			for (int k = 0; k < 2; ++k)
				dp[i][j][k] = 0;
	}
	dp[0][0][0] = 1;
	for (int i = 1; i <= n; ++i)
	{
		dp[i][0][0] = (8 * dp[i - 1][0][0]) % MOD;
		dp[i][0][1] = (dp[i - 1][0][1] * 9 + dp[i - 1][0][0]) % MOD;
		dp[i][1][0] = (dp[i - 1][1][0] * 9 + dp[i - 1][0][0]) % MOD;
		dp[i][1][1] = (dp[i - 1][1][1] * 10 + dp[i - 1][0][1] + dp[i - 1][1][0]) % MOD;			
	}

	cout << dp[n][1][1] << '\n';
	return 0;
}

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

int main() {
  int a,b;
  cin >> a >> b;
  if(a == 1){
    if(b == 1){
      cout << "Draw" << endl;
    }
    else {
      cout << "Alice" << endl;
    }
  }
  else if(b == 1){
    cout << "Bob" << endl;
  }
  else {
    if(a > b){
      cout << "Alice" << endl;
    }
    else if(a == b){
      cout << "Draw" << endl;
    }
    else {
      cout << "Bob" << endl;
    }
  }
  
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>	
#include <cmath>
#include <string>
#include<math.h>
#include<sstream>//���炵���̂Œ���
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define Cout(s) cout<<s<<endl
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
string Yes(bool b) { if (b) { return "Yes"; } else { return "No"; } }
string YES(bool b) { if (b) { return "YES"; } else { return "NO"; } }
//================================================
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

int a = 1, b = 0, c, d, n, k = 0, ans = 0;
string s, t;
int mod = 1000000007;

int main()
{
	cin >> n; int ans; cin >> ans;
	rep(i, n-1) {
		cin >> a;
		ans = gcd(a, ans);
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.OutputStream;
import java.io.IOException;
import java.io.FileReader;
import java.io.FileWriter;

import java.util.Arrays;
import java.util.Collections;
import java.util.ArrayList;
import java.util.List;
import java.util.HashSet;
import java.util.Comparator;
import java.util.Set;
import java.util.HashMap;
import java.util.Map;

public class Main {
    // 標準入力
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    // 標準入力数値配列用 int
    static int[] inputval() throws Exception {
        String[] strarray = br.readLine().trim().split(" ");
        int[] intarray = new int[strarray.length];
        for (int i = 0; i < intarray.length; i++) {
            intarray[i] = Integer.parseInt(strarray[i]);
        }
        return intarray;
    }

    /* 標準入力数値配列用 long */
    static long[] inputLongArr() throws Exception {
        String[] strarray = br.readLine().trim().split(" ");
        long[] longarray = new long[strarray.length];
        for (int i = 0; i < longarray.length; i++) {
            longarray[i] = Long.parseLong(strarray[i]);
        }
        return longarray;
    }

    // 標準入力数値リスト用 int
    static List<Integer> inputIntList() throws Exception {
        List<String> strList = Arrays.asList(br.readLine().trim().split(" "));
        List<Integer> intList = new ArrayList<Integer>();
        for (String elem : strList){
            intList.add(Integer.parseInt(elem));
        }
        return intList;
    }

    // 標準入力数値配列用 integer 降順ソート用
    static Integer[] inputvalInteger() throws Exception {
        String[] strarray = br.readLine().trim().split(" ");
        Integer[] intarray = new Integer[strarray.length];
        for (int i = 0; i < intarray.length; i++) {
            intarray[i] = Integer.parseInt(strarray[i]);
        }
        return intarray;
    }

    /*標準入力long*/
    static long inputLong() throws Exception {
        return Long.parseLong(br.readLine());
    }

    /*標準入力long*/
    static int inputInt() throws Exception {
        return Integer.parseInt(br.readLine());
    }




    public static void main(String[] args) throws Exception {
        // write your code here
        long [] nck = inputLongArr();
        long n = nck[0];
        long c = nck[1];
        long k = nck[2];
        long [] tl = new long [(int) n];
        for (int i=0; i<n; i++){
            tl[i] = inputLong();
        }
        Arrays.sort(tl);
        int ans = 1;
        int index =0;
        for (int i=1; i<n; i++){
            if (i-index >= c || tl[i] - tl[index] >k){
                index=i;
                ans ++;
            }
        }


        System.out.println(ans);

    }

}



Measured memory_bytes: 42840
//                             In The Name Of Allah
#include <bits/stdc++.h>
#define	ss second
#define ff first
#define use_fast ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define ret(n) return cout << n, 0
#define se(n) cout << setprecision(n) << fixed
#define pb push_back
#define int long long
#define ld long double
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC optimize("no-stack-protector,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std; 

const int N = 2e5 + 100, OO = 1e16 + 7, T = 13, M = 1e9 + 7, P = 6151, SQ = 800, lg = 32;
typedef pair <int, int> pii;
int a[N];

int32_t main() {
	use_fast;
	int n, m, z, sum = 0;
	cin >> n >> m;
	for(int i = 0; i < n; i++) {
		cin >> a[i];
		sum += a[i];
	}
	sort(a, a + n);
	n--;
	int t = m;
	while(t--) {
		if(a[n] * 4 * m < sum)
			return cout << "No", 0;
		n--;
	}
	cout << "Yes" << endl;
	return 0; 
} 
/*
be carefull :
1- if not solve after 20 min, read again twice
2- after submit read the code again
3- fun with contest
4- ... 
*/

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

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

    int N;
    cin >> N;

    int num = 0;
    int cur_h = 0;
    while (N--) {
        int H;
        cin >> H;
        if (cur_h <= H) {
            cur_h = H;
            num++;
        }
    }
    cout << num << '\n';



    return 0;
}


Measured memory_bytes: 256
#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 rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<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())
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;

#define INF INT_MAX/3
#define MAX_N 1000
ll n ,a;
void solve(){
   cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>n>>a;
  if(n%500 <= a) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}
int main(){
  solve();
  return 0;
}


Measured memory_bytes: 256