akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = (1LL<<60);
 
ll H,W,K,N;
ll hh,ww;
ll y[100000],x[100000];
 
vector<ll> g[100005];
vector<ll> G[100005];
 
ll uc=0;
 
ll func(vector<ll> &T,vector<ll> &t,int l,int r, int Y){
 
   
  ll L=T[l];
  ll R=T[r-1];
 
 
  ll cnt = (R+1)/2 - (L-1+1)/2;
 
  ll res=-cnt;
   
  vector<ll> :: iterator it, it2;
  it =lower_bound(t.begin(),t.end(),L);
  it2=upper_bound(t.begin(),t.end(),R);
   
  map<int,int> mp;
  while(it!=it2){
    mp[*it]=1;
    it++;
  }
 
 
  vector<ll> dp(cnt+1,INF);
 
  int sx=L;
  if(sx%2==0)sx++;
   
  dp[0]=0;
  for(int i=0;i<cnt;i++){
    if(dp[i]==INF)continue;
    int px=sx+2*i;
     
    if(mp[px]){
      dp[i+1]=min(dp[i+1],dp[i]+2);
    }else{
      dp[i+1]=min(dp[i+1],dp[i]+1);
    }
 
    if(i+2<=cnt){
      if(mp[px+1]){
        dp[i+2]=min(dp[i+2],dp[i]+4);
      }else{
        dp[i+2]=min(dp[i+2],dp[i]+2);
      }
    }
  }
 
  res+=dp[cnt];
     
  return res;
}
 
ll solve(){
   
  hh=(H+1)/2;
  ww=(W+1)/2;
  if( ww > K )return -1;
  K-=ww;
 
  ll res = 0;
  ll excost = 0;
   
  for(int i=2;i<H;i+=2){
    res+=ww;
     
    if(G[i].empty()){
      continue;
    }
 
    int last=0;
    for(int j=1;j<(int)G[i].size();j++){
      if(G[i][j-1]+3<G[i][j]){
        ll val = func(G[i],g[i],last,j,i);
        res += val;
        excost += val;
        last=j;
      }
    }
     
    if(last+1<(int)G[i].size()){
      ll val = func(G[i],g[i],last,G[i].size(),i);
      res += val;
      excost += val;
    }
  }
 
  int cc=min(K,excost);
  res-=cc*2LL;
  K-=cc;
   
  return max(0LL,res-K);
}
 
int main(){
  cin>>W>>H>>K>>N;
 
 
  for(int i=1;i<=H;i++){
    G[i].push_back(1);
    G[i].push_back(W);
  }
   
  for(int i=0;i<N;i++){
    cin>>x[i]>>y[i];
    G[ y[i] ].push_back( x[i] );
 
    if(x[i]+2<=W)
      G[ y[i] ].push_back( x[i]+2 );
    if(x[i]-2>=1)
      G[ y[i] ].push_back( x[i]-2 );
 
    g[ y[i] ].push_back( x[i] );
     
  }
 
  for(int i=1;i<=H;i++){
    sort(g[i].begin(),g[i].end());
    sort(G[i].begin(),G[i].end());
    G[i].erase( unique(G[i].begin(),G[i].end()) , G[i].end() );
  }
   
  cout<<solve()<<endl;
  return 0;
}

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

using namespace std;


int main()
{
	int n;
	cin >> n;
	int dp[n];

	for (int i=0; i<n; i++)
		scanf("%d", &dp[i]);

	int cost1, cost2;
	cost1 = 0;
	cost2 = abs(dp[1] - dp[0]);

	for (int i=2; i<n; i++) {
		int x = cost2;
		cost2 = min(cost1+abs(dp[i]-dp[i-2]), cost2+abs(dp[i]-dp[i-1]));
		cost1 = x;
	}

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

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


int main() {
	
	int a, b, c, d, e, f;
	cin >> a >> b >> c >> d >> e >> f;
	double mconc = 0;
	int msugar = 0, mmass = 0; 
	for(int i=0; a*i*100<=f; i++){
		for(int j=0; (a*i+b*j)*100<=f; j++){
			for(int k=(a*i+b*j)*e/c; k>=0; k--){
				for(int l=((a*i+b*j)*e - c*k)/d; l>=0; l--){
					int mass = 100*a*i+100*b*j+c*k+d*l;
					int sugar = c*k+d*l;
					if(mass){
						if(mass <= f){
							double conc = (double)sugar / mass;
							if(mconc < conc){
								mconc = conc;
								mmass = mass;
								msugar = sugar;
							}
						}
					}
					
				}
			}
		}
	}
	if (mmass) cout << mmass << ' ' << msugar << endl;
	else cout << 100*a << ' ' << 0 << endl;
	
	
	return 0;
}

Measured memory_bytes: 256
#[test]
fn test_solve() {
    assert_eq!(solve("2 3\n"), "6\n");
    assert_eq!(solve("123 456\n"), "18696\n");
    assert_eq!(solve("100000 99999\n"), "9999900000\n");
}

fn solve(src: &str) -> String {
    let mut sc = Scanner::from_str(src);

    let a: u64 = sc.read();
    let b: u64 = sc.read();

    format!("{}\n", lcm(a, b))
}

fn gcd(a: u64, b: u64) -> u64 {
    match b {
        0 => a,
        1 => 1,
        _ => gcd(b, a % b),
    }
}

fn lcm(a: u64, b: u64) -> u64 {
    a / gcd(a, b) * b
}

fn main() {
    let mut buf = String::new();
    use std::io;
    use std::io::{Read, Write};
    io::stdin().read_to_string(&mut buf).unwrap();
    io::stdout().write_all(solve(&buf).as_bytes()).unwrap();
}

struct Scanner<'a>(std::str::SplitWhitespace<'a>);
impl<'a> Scanner<'a> {
    fn from_str(src: &str) -> Scanner {
        Scanner(src.split_whitespace())
    }
    fn get(&mut self) -> &str {
        self.0.next().unwrap()
    }
    fn read<T: std::str::FromStr>(&mut self) -> T {
        self.get().parse().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> {
        self.get().chars().collect()
    }
}

Measured memory_bytes: 4352
import java.util.Scanner;

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

		int D = sc.nextInt();
		int S = sc.nextInt();
		int T = sc.nextInt();

		if(S*T >= D) {
			System.out.print("Yes");

		}
		else {
			System.out.print("No");
		}

    }
}


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

void bubbleSort(int *a, int n)
{
}
int main()
{
    int n = 0, a[105];

    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> a[i];

    int sp = 0;
    for (int i = 0; i < n; i++)
    {
        for (int j = n - 1; j >= i + 1; j--)
        {
            if (a[j] < a[j - 1])
            {
                swap(a[j], a[j - 1]);
                sp++;
            }
        }
    }

    for (int i = 0; i < n; i++)
     {  
         if (i) cout<<" ";
          cout << a[i];
     }
    cout << endl;
    cout << sp << endl;
    return 0;
}


Measured memory_bytes: 3116
/*Function Template*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> pint;
const int MAX = 510000;
const int MOD = 1000000007;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define Rep(i, n) for(ll i = 1; i < (n); i++)
#define ALL(a)  (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll fac[MAX], finv[MAX], inv[MAX];


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;
}
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll 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;
    }

}
ll Len(ll n) {
  ll s=0;
  while(n!=0) s++, n/=10;
  return s;
}


ll Sint(ll n) {
  ll m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(ll i=s-1;i>=0;i--) m+=n/((ll)pow(10,i))-(n/((ll)pow(10,i+1)))*10;
  return m;
}


ll Svec(vector<ll> v){
  ll n=0;
  for(ll i=0;i<v.size();i++) n+=v[i];
  return n;
}


ll GCD(ll a,ll b) {
  return b ? GCD(b,a%b) : a;
}


ll LCM(ll a,ll b){
  return a/GCD(a,b)*b;
}


ll Factorial(ll n){
  ll m=1;
  while(n>=1) m*=n,n--;
  return m;
}

void runlength(string s,vector<pair<char,ll>> &p){
  ll x=1;
  if(s.size()==1){
    p.push_back(pair<char,ll>(s[0],1));
  }
  for(ll i=0;i<s.size()-1;i++){
    if(s[i]==s[i+1]){
      x++;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[i],x));
      }
    }else{
      p.push_back(pair<char,ll>(s[i],x));
      x=1;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[s.size()-1],x));
      }
    }
  }
}




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

const int MAX_N=100010;
vector<bool> sieve_of_eratosthenes(){
  vector<bool> isPrime(MAX_N+1,true);
  for(int i=2;i<=MAX_N;i++){
    if(isPrime[i]){
      for(int j=2*i;j<=MAX_N;j+=i){
        isPrime[j]=false;
      }
    }
  }
  return isPrime;
}

vector<pint> prime_factorize(ll n){
  vector<pint> ans;
  for(ll p=2;p<=sqrt(n);p++){
    if(n%p!=0) continue;
    ll cnt=0;
    while(n%p==0){
      n/=p;
      cnt++;
    }
    ans.push_back(make_pair(p,cnt));
  }
  if(n!=1) ans.push_back(make_pair(n,1));
  return ans;
}

/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
int main() {
  IOS;
  ll n,w;cin>>n>>w;
  vector<ll> weight(n),value(n);
  rep(i,n) cin>>weight[i]>>value[i];
  ll dp[n+1][Svec(value)+1];
  rep(i,Svec(value)+1) dp[0][i]=1e17;
  dp[0][0]=0;
  rep(i,n){
    rep(j,Svec(value)+1){
      if(j>=value[i]) dp[i+1][j]=min(dp[i][j],dp[i][j-value[i]]+weight[i]);
      else dp[i+1][j]=dp[i][j];
    }
  }
  for(ll i=Svec(value);i>=0;i--){
    if(dp[n][i]<=w){
      cout<<i<<endl;
      return 0;
    }
  }
}

Measured memory_bytes: 79232
import sys
sys.setrecursionlimit(10 ** 7)
read = sys.stdin.buffer.read 
input = sys.stdin.buffer.readline
def inputS(): return input().rstrip().decode()
readlines = sys.stdin.buffer.readlines 

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

ans = 0
if N < 10:
  ans = (100*(10-N) + R)
else:
  ans = R
print(ans)  

Measured memory_bytes: 3064
#include <iostream>
 
using namespace std;
 
int main(){
    unsigned long long N,M,L=1,i=1;
    cin >> N;
    M=N;
    while (1){
     M=M/10;
     if (M<1) break;
     L*=10;
     i++;
    }
    
    unsigned long long a=N/L -1 + (9*(i-1));
    if (N%L==L-1) a+=1;
    cout << a;
    return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#include <sstream>
#include <climits>
#include <cmath>
#include <functional>
#include <map>
#include <stack>
using namespace std;
#define M_PI 3.141592
#define FOR(i,n) for(int i=0;i<(int)n;i++)
#define FORI(i,k,n) for(int i=k;i<(int)n;i++)
#define toRad 2.0*M_PI/360.0
#define inin(x) int x;cin>>x;
#define all(x) x.begin(),x.end()
#define debug(x) cout<<#x<<" "<<x<<endl;
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define EPS 1e-12
#define pri_max 60000
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };

/*
bool memo[pri_max] = {};
vector<int> pri;
void calc()
{
	for (int i = 2; i < pri_max; i++)
	{
		if (memo[i] == false)
		{
			pri.push_back(i);
			for (int l = i; l < pri_max; l += i)
			{
				memo[l] = true;
			}
		}
	}
}*/
double len(pdd a, pdd b)
{
	return sqrt((b.first - a.first)*(b.first - a.first) + (b.second - a.second)*(b.second - a.second));
}

int main()
{
	string gen[5] = { "pre-meiji","meiji","taisho","showa","heisei" };
	int t[5][3] = { {0,0,0},{1868,9,8},{1912,7,30},{1926,12,25},{1989,1,8} };
	int x[3];
	while (cin >> x[0] >> x[1] >> x[2])
	{
		bool flag = true;
		for (int i = 4; i > 0&&flag; i--)
		{
			for (int l = 0; l < 3;l++)
			{
				if (t[i][l]>x[l])break;
				else if (t[i][l] == x[l])
				{
					if (l == 2)
					{
						goto ans;
					}
					continue;
				}
				else
				{
					ans:
					flag = false;
					cout << gen[i] << " " << x[0] - t[i][0] + 1 << " " << x[1] << " " << x[2] << endl;
					break;
				}
			}
		}
		if (flag)
		{
			cout << gen[0] << endl;
		}
	}
}

Measured memory_bytes: 1204
import numpy as np

h, w = [int(x) for x in input().split()]

a = []
for i in range(h):
    ab = input()
    if '#' in ab:
        a.append(ab)

a2 = []
for i in range(w):
    b = [e[i] for e in a]
    if '#' in b:
        a2.append(b)

a = np.array(a2).T

for row in a:
    print(''.join(row))

Measured memory_bytes: 21856
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
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; }
using ll = long long;
using vi = vector<int>; using vvi = vector<vi>;
const ll MOD = 1e9+7; ll INF = 1LL << 60;
const vi d8x = {1, 0, -1, 0, 1, -1, -1, 1}; vi d8y = {0, 1, 0, -1, 1, 1, -1, -1};
const vi d4x = {1, 0, -1, 0}; vi d4y = {0, 1, 0, -1};
//---------------------------------------

int main(){
    ll n,k,q; cin>>n>>k>>q;
    vector<ll> a(q);
    rep(i,q) cin>>a[i];

    vector<ll> point(n,k-q);
    rep(i,q){
        point[a[i]-1]++;
    }
    rep(i,n){
        if(point[i]>=1){
            cout<<"Yes"<<endl;
        }else{
            cout<<"No"<<endl;
        }
    }
}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define mp make_pair
#define pb push_back
#define ip pair<ll,ll>
#define ff first
#define ss second
#define MAX 100005
const ll MOD = 1000000007;

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

	int MX = 61;
	ll powers[MX];
	powers[0] = 1;
	for(int i=1;i<MX;i++)
		powers[i] = powers[i-1]*2;

	int t;
	cin>>t;
	while(t--){
		ll n;
		cin>>n;
		ll a[n];
		for(int i=0;i<n;i++)
			cin>>a[i];
		string s;
		cin>>s;

		vector<ll> basis(MX,0);
			
		int flag = 0;	
		for(int i=n-1;i>=0;i--){
			ll mask = a[i];
			if(s[i] == '0'){
				for (int j = MX-1; j >= 0; j--) {
					if ((mask & powers[j]) == 0) continue;

					if (!basis[j]) {
						basis[j] = mask;
						break;
					}

					mask ^= basis[j];
				}
			}
			else{
				for(int j=MX-1;j>=0;j--){
					if((mask & powers[j]) == 0)
						continue;

					if(!basis[j]){
						flag = 1;
						break;
					}

					mask ^= basis[j];
				}

				if(flag)
					break;
			}	
		}

		cout<< flag <<endl;
 	}	
}	

Measured memory_bytes: 3668
/*
    Author:zeke
    
    pass System Test!
    GET AC!!
*/
#include <iostream>
#include <queue>
#include <vector>
#include <iostream>
#include <vector>
#include <string>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <map>
#include <iomanip>
#include <utility>
#include <stack>
#include <numeric>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rep3(var, min, max) for (ll (var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll (var) = (max) - 1; (var) + 1 > (min); --(var))
#define Mp(a,b) make_pair((a),(b))
#define F first
#define S second
#define Icin(s) ll (s);cin>>(s);
#define Scin(s) ll (s);cin>>(s);
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; }
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
ll MOD = 1e9 + 7;
ll INF =1e18;
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
ll combi(ll a,ll b){
    if(a<b)return 0;
    ll res=1;
    for(ll i=a;i>=a-b+1;i--){
        res*=i;
        res%=MOD;
    }
    rep3(i,1,b+1){
        res*=modinv(i,MOD);
        res%=MOD;
    }
    return res;
}
//a,m=MOD MOD逆元
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,m;
    cin>>n>>m;
    V vec(n);
    ll p=m;
    rep3(i,2,sqrt(m)+1){
        if(p%i==0){
            ll res=0;
            while(p%i==0){
                p/=i;
                res++;
            }
            vec.push_back(res);
        }
    }
    if(p!=1)vec.push_back(1);
    ll res=1;
    rep(i,vec.size()){
        res*=combi(vec[i]+n-1,vec[i]);
        res%=MOD;
    }
    cout<<res<<endl;
}

Measured memory_bytes: 1792
with Ada.Text_IO;
with Ada.Integer_Text_IO;
with Ada.Float_Text_IO;
use Ada.Text_IO;
use Ada.Integer_Text_IO;
use Ada.Float_Text_IO;

procedure hoge is
 a: integer;
 b: integer;
 c: integer;
 d: integer;
 cnt: integer :=0;
begin
 get(a);
 get(b);
 get(c);
 get(d);
 while a>0 and c>0 loop
  if (cnt rem 2)=0 then
   c:=c-b;
  else
   a:=a-d;
  end if;
  cnt:=cnt+1;
 end loop;
 if a<=0 then
  put_line("No");
 else
  put_line("Yes");
 end if;
end hoge;

Measured memory_bytes: 3680
#include <iostream>
#include <cstring>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cstdlib>
#define all(a) a.begin(),a.end()
using namespace std;

typedef vector<int> vi;
struct hoge
{
	int a[10];
	hoge()
	{
		memset(a,0,sizeof a);
	}
};

int n,s;
int memo[20][1000]={};

int calc(hoge v,int val,int size)
{
	if(size>10)return 0;
	memo[size][val]++;
	
	int ans=0;
	for(int i=0;i<=9;i++)
	{
		if(!v.a[i])
		{
			v.a[i]=true;
			ans+=calc(v,val+i*(size+1),size+1);
			v.a[i]=false;
		}
	}
	return ans;
	
}


int main()
{
	hoge x;
	calc(x,0,0);
	while(cin>>n>>s)
	{
		cout<<memo[min(n,19)][min(s,999)]<<endl;
	}
}

Measured memory_bytes: 1204
#include <iostream>

using namespace std;

#define N 8
#define FREE -1
#define NOT_FREE 1

int row[N],col[N],dpos[2*N-1],dneg[2*N-1];

bool X[N][N];

void initialize(){
	for(int i=0;i<N;i++) {
		row[N]=FREE;
		col[N]=FREE;
	}
	for(int i=0;i<2*N-1;i++){
		dpos[i]=FREE;
		dneg[i]=FREE;
	}
}

void printBoard(){
	for(int i=0;i<N;i++){
		for(int j=0;j<N;j++){
			if(X[i][j]){
				if(row[i]!=j) return;
			}
		}
	}
	
	for(int i=0;i<N;i++){
		for(int j=0;j<N;j++){
			cout << ((row[i]==j)?"Q":".");
		}
		cout<<endl;
	}
}

void recursive(int i){
	if(i==N){
		printBoard();return;
	}
	
	for(int j=0;j<N;j++){
		if(NOT_FREE==col[j] || NOT_FREE==dpos[i+j] || NOT_FREE==dneg[i-j+N-1])
			continue;
		row[i]=j;
		col[j]=dpos[i+j]=dneg[i-j+N-1]=NOT_FREE;
		recursive(i+1);
		row[i]=col[j]=dpos[i+j]=dneg[i-j+N-1]=FREE;
	}
}

int main() {
	
	initialize();
	
	for(int i=0;i<N;i++){
		for(int j=0;j<N;j++){
			X[i][j] = false;
		}
	}
	
	int k;cin>>k;
	
	for(int i=0;i<k;i++){
		int r,c;cin>>r>>c;
		X[r][c]=true;
	}
	
	recursive(0);
	
	
	return 0;
}

Measured memory_bytes: 3104
package main

import (
  "fmt"
  "sort"
)

func main ()  {
  a := make([]int, 3)
  for i := range a {
    fmt.Scan(&a[i])
  }
  sort.Ints(a)
  for i := range a {
    fmt.Print(a[i])
    if i + 1 < len(a) {
      fmt.Print(" ")
    }
  }
  fmt.Println("")
}



Measured memory_bytes: 1144
#include <bits/stdc++.h>
#define db(x) cerr << #x << " = " << x << endl;
using namespace std;

const int N = 1e5 + 7;
const int MOD = 1e9 + 7;

int n, x, d, dd[N], prod[N];

int pw(int x, int y){
    if (y == 0) return 1;
    int res = pw(x, y / 2);
    if (y & 1)
        return (1LL * ((1LL * res * res) % MOD) * x) % MOD;
    return (1LL * res * res) % MOD;
}

int C(int k, int n){
    if (k > n) return 0;
    int nk = (1LL * prod[k] * prod[n - k]) % MOD;
    return (1LL * prod[n] * pw(nk, MOD - 2)) % MOD;
}

inline int calc(int k){
    return (C(k, n + 1) - C(k - 1, n - d + 1) + MOD) % MOD;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n;
    for (int i = 1; i <= n + 1; i++){
        cin >> x;
        if (dd[x])
            d = i - dd[x] + 1;
        dd[x] = i;
    }
    prod[0] = 1;
    prod[1] = 1;
    for (int i = 2; i <= n + 1; i++){
        prod[i] = (1LL * prod[i - 1] * i) % MOD;
    }
    for (int i = 1; i <= n + 1; i++){
        cout << calc(i) << endl;
    }
}


Measured memory_bytes: 2048
/* ABC168_A
    Stuartyg */

#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdbool.h>


int main(void){
        int num; /*nのこと*/
        scanf("%d",&num);
        num%=10; /*10で割った余りがnの1の位*/
        switch(num){
        case 3: /*1の位が3ならbonと出力*/
                printf("bon\n");
                break;
        case 0: /*1の位が0，1，6，8ならponと出力*/
                printf("pon\n");
                break;
        case 1:
                printf("pon\n");
                break;
        case 6:
                printf("pon\n");
                break;
        case 8:
                printf("pon\n");
                break;
        default: /*1の位がそれ以外ならhonと出力*/
                printf("hon\n");
                break;
        }
        return 0;
}


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

int main()
{
    string a;
    cin>>a;
    if(a[0]==a[1] && a[1]==a[2])
    {
        cout<<"No\n";
    }
    else
    {
        cout<<"Yes\n";
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;

ll dp[10100][101][2];

signed main(){
    string K;
    int D;
    cin >> K;
    cin >> D;
    dp[0][0][0] = 1;
    int n = K.size();
    for(int digit = 0; digit < n; digit++){
        for(int d = 0; d < D; d++){
            for(int isless = 0; isless < 2; isless++){
                int c = K[digit] - '0';
                for(int next = 0; next < 10; next++){
                    if(next < c){
                        dp[digit + 1][(d + next) % D][1] += dp[digit][d][isless];
                        dp[digit + 1][(d + next) % D][1] %= MOD;
                    }else if(next == c){
                        dp[digit + 1][(d + next) % D][isless] += dp[digit][d][isless];
                        dp[digit + 1][(d + next) % D][isless] %= MOD;
                    }else{
                        if(isless == 1){
                            dp[digit + 1][(d + next) % D][isless] += dp[digit][d][isless];
                            dp[digit + 1][(d + next) % D][isless] %= MOD;
                        }
                    }
                }
            }
        }
    }
    cout << (dp[n][0][0] + dp[n][0][1] - 1 + MOD) % MOD << endl;
}

Measured memory_bytes: 16000
#include <stdio.h>

int main(){
    char input[100][101];
    int pass[100],i,j,h,w;
    
    scanf("%d %d",&h,&w);
    for(i = 0; i < h; i++){
        scanf("%s",input[i]);
    }
    for(i = 0; i < w; i++){
        for(j = 0; j < h; j++){
            if(input[j][i] != '.')
                break;
        }
        pass[i] = (j == h);        
    }
    for(i = 0; i < h; i++){
        for(j = 0; j < w; j++){
            if(input[i][j] != '.')
                break;     
        }
        if(j == w) continue;
        
        for(j = 0; j < w; j++){
            if(pass[j]) continue;
            printf("%c",input[i][j]);
        }
        printf("\n");
    }
    
    
    return 0;
}

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

int a, b, n;

int main()
{
	while (cin >> a >> b >> n) {
		int m = 0;

		a %= b;

		for (int i = 0; i < n; i++) {
			a *= 10;
			m += a / b;
			a %= b;
		}

		cout << m << endl;
	}

	return 0;
}


Measured memory_bytes: 3000
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

const int N=1e5+5;

int n, m, q;
int a[N], b[N];

int cost(int x, int p, int q)
{
	return abs(x-p) + abs(p-q);
}

int32_t main()
{
	IOS;
	cin>>n>>m>>q;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	for(int i=1;i<=m;i++)
		cin>>b[i];
	while(q--)
	{
		int ans=1e18;
		int x;
		cin>>x;
		int idx1=lower_bound(a+1, a+n+1, x) - a;
		int idx2=lower_bound(b+1, b+m+1, x) - b;
		for(int i=max(1LL, idx1-1);i<=min(n, idx1+1);i++)
		{
			for(int j=max(1LL, idx2-1);j<=min(m, idx2+1);j++)
			{
				ans=min(ans, cost(x, a[i], b[j]));
				ans=min(ans, cost(x, b[j], a[i]));
			}
		}
		cout<<ans<<endl;
	}
	return 0;
}


Measured memory_bytes: 2944
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
using namespace std;
string s,t;
int main()
{
	long long i;
	getline(cin,s);
	getline(cin,t);
	for(i=0;i<s.size();i++)
	{
		cout<<s[i];
		if(i<t.size())
		{
			cout<<t[i];
		}
	}
	cout<<endl;
	return(0);
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <cmath>
using namespace std;
int solve(int n)
{
	// 2. 各マスの訪問履歴(memo)を作成する
	//    memoにはスタートからそのマスまでの歩数を格納する(初期値は0)
	int memo[100000] = {};
	// 3. スタートのマスをキューに格納する
	queue<int> q;
	q.push(n);

	// 11. 4から10をキューが空になるまで繰り返す
	while (!q.empty()) {
		// 4. キューの先頭から一マス取得する
		int cur = q.front(); q.pop();

		// 5. 取り出したマスがゴールなら終了
		if (cur == 0) {
			return memo[cur];
		}
		if (cur >= 6) {
			for (int i = 1; i < 50; i++) {
				// 6. 手順4で取り出したマス(cur)から上下左右の何れかに移動する
				int next = cur - pow(9, i);
				// 8. 移動先のマス(next)が道またはゴールであることを確認する(道でもゴールでもない場合は手順6に戻る)
				if (next >= 0) {
					// 9. 移動先のマス(next)が未訪問であることを確認する(訪問済みの場合は手順6に戻る)
					if (memo[next] == 0) {
						// 10. 移動先のマス(next)をキューに格納し、訪問履歴を更新する
						q.push(next);
						memo[next] = memo[cur] + 1;
					}
				}
				else {
					break;
				}
			}
			for (int i = 1; i < 50; i++) {
				// 6. 手順4で取り出したマス(cur)から上下左右の何れかに移動する
				int next = cur - pow(6, i);
				// 8. 移動先のマス(next)が道またはゴールであることを確認する(道でもゴールでもない場合は手順6に戻る)
				if (next >= 0) {
					// 9. 移動先のマス(next)が未訪問であることを確認する(訪問済みの場合は手順6に戻る)
					if (memo[next] == 0) {
						// 10. 移動先のマス(next)をキューに格納し、訪問履歴を更新する
						q.push(next);
						memo[next] = memo[cur] + 1;
					}
				}
				else {
					break;
				}
			}
		}
		else {
			q.push(cur - 1);
			memo[cur-1] = memo[cur] + 1;
		}
	}
	return -1;
}

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

	// 最短歩数はsolveで計算する
	cout << solve(n) << endl;
	return 0;
}

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

int main() {

  int x_next[9] = {1,1,1,1,1,2,2,2,3};
  int y_next[9] = {-2,-1,0,1,2,-1,0,1,0};

  while(true) {

    int w,h;
    cin >> w >> h;
    if ( w == 0 ) break;

    char input;
    int map[30][60];
    int time_r[30][60] = {0};
    int time_l[30][60] = {0};
    vector<int> xr,yr,xl,yl;

    for ( int i = 0; i < h; i++ ) {
      for ( int j = 0; j < w; j++ ) {
	cin >> input;
	if ( input == 'S' ) {
	  xr.push_back(j);
	  yr.push_back(i);
	  xl.push_back(j);
	  yl.push_back(i);
	  map[j][i] = -1;
	}else if ( input == 'T' ) {
	  map[j][i] = 0;
	}else if ( input == 'X' ) {
	  map[j][i] = -1;
	}else {
	  map[j][i] = input - '0';
	}
      }
    }

    while(true) {

      for ( int i = 0; i < xl.size(); i++ ) {
	for ( int j = 0; j < 9; j++ ) {

	  int x = xl[i] + x_next[j];
	  int y = yl[i] + y_next[j];
	  if ( x < 0 || x >= w || y < 0 || y >= h ) continue;

	  if ( map[x][y] >= 0 ) {
	    int t = time_l[ xl[i] ][ yl[i] ] + map[x][y];
	    if ( time_r[x][y] == 0 || time_r[x][y] > t ) {
	      time_r[x][y] = t;
	      if ( map[x][y] > 0 ) {
		xr.push_back(x);
		yr.push_back(y);
	      }
	    }
	  }

	}
      }
      if ( xr.size() == 0 ) break;
      xl.clear();
      yl.clear();

      for ( int i = 0; i < xr.size(); i++ ) {
	for ( int j = 0; j < 9; j++ ) {

	  int x = xr[i] - x_next[j];
	  int y = yr[i] + y_next[j];
	  if ( x < 0 || x >= w || y < 0 || y >= h ) continue;

	  if ( map[x][y] >= 0 ) {
	    int t = time_r[ xr[i] ][ yr[i] ] + map[x][y];
	    if ( time_l[x][y] == 0 || time_l[x][y] > t ) {
	      time_l[x][y] = t;
	      if ( map[x][y] > 0 ) {
		xl.push_back(x);
		yl.push_back(y);
	      }
	    }
	  }

	}
      }
      if ( xl.size() == 0 ) break;
      xr.clear();
      yr.clear();

    }

    int cnt = -1;
    for ( int i = 0; i < w; i++ ) {
      if ( map[i][0] == 0 ) {
	int t = time_r[i][0];
	if ( t == 0 ) t = time_l[i][0];
	if ( t > time_l[i][0] && time_l[i][0] != 0 ) t = time_l[i][0];
	if ( t == 0 ) continue;
	if ( cnt == -1 || t < cnt ) cnt = t;
      }
    }

    cout << cnt << endl;

  }

  return 0;

}

Measured memory_bytes: 1260
#![allow(unused_imports)]
#![allow(unused_macros)]
// use proconio::input;
use std::cmp::{Ordering::*, Reverse};
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, VecDeque};
use std::io::{self, BufWriter, Write};
use std::str::{self, SplitAsciiWhitespace};

// I have no idea what I'm doing

macro_rules! answer {
    ($out:ident, $ans:expr) => {
        writeln!($out, "{}", $ans)
    };
}

fn main() -> Result<(), io::Error> {
    let (stdin, stdout) = (io::stdin(), io::stdout());
    let mut scan = UnsafeScanner::new(stdin.lock());
    let mut out = BufWriter::new(stdout.lock());

    let n: usize = scan.token();
    let d: i64 = scan.token();
    let d2 = d * d;
    let ps: Vec<(i64, i64)> = (0..n).map(|_| scan.pair()).collect();

    let ans = ps
        .into_iter()
        .map(|(x, y)| x*x + y*y)
        .filter(|&dist2| dist2 <= d2)
        .count();

    answer!(out, ans)
}

///////////////////////////////////////////////////////////////////////////////////////////////////

/// Mostly copied from https://github.com/EbTech/rust-algorithms/blob/master/src/scanner.rs
/// Same API as Scanner but nearly twice as fast, using horribly unsafe dark arts
/// **REQUIRES** Rust 1.34 or higher
pub struct UnsafeScanner<R> {
    reader: R,
    buf_str: Vec<u8>,
    buf_iter: SplitAsciiWhitespace<'static>,
}

impl<R: io::BufRead> UnsafeScanner<R> {
    pub fn new(reader: R) -> Self {
        Self {
            reader,
            buf_str: vec![],
            buf_iter: "".split_ascii_whitespace(),
        }
    }

    /// This function should be marked unsafe, but noone has time for that in a
    /// programming contest. Use at your own risk!
    pub fn token<T: str::FromStr>(&mut self) -> T {
        loop {
            if let Some(token) = self.buf_iter.next() {
                return token.parse().ok().expect("Failed parse [Scanner]");
            }
            self.buf_str.clear();
            self.reader
                .read_until(b'\n', &mut self.buf_str)
                .expect("Failed read");
            self.buf_iter = unsafe {
                let slice = str::from_utf8_unchecked(&self.buf_str);
                std::mem::transmute(slice.split_ascii_whitespace())
            }
        }
    }

    pub fn pair<T: str::FromStr>(&mut self) -> (T, T) {
        (self.token(), self.token())
    }
}

// aka #![feature(bool_to_option)]
trait BoolThen {
    fn then_<T>(self, f: impl FnOnce() -> T) -> Option<T>;
}

impl BoolThen for bool {
    fn then_<T>(self, f: impl FnOnce() -> T) -> Option<T> {
        if self {
            Some(f())
        } else {
            None
        }
    }
}

trait BoolToYes {
    fn yes(self) -> &'static str;
}

impl BoolToYes for bool {
    fn yes(self) -> &'static str {
        match self {
            true => "Yes",
            false => "No",
        }
    }
}


Measured memory_bytes: 5156
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0;i < (int)(n);i++)
using ll = long long;
const ll MOD=1000000007;
const long long INF = 1LL << 60;
const double pi=acos(-1.0);

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



int main()
{
  string ans="";
  ll N; cin>>N;
  if(N==0) {cout<<"0"<<endl; return 0;}
  while(N!=0){
    //cout<<N<<endl;
    ll amari=N%(-2);
    N/=(-2);
    if(amari==-1){
      N++;
      amari=1;
    }
    ans+=(char)(amari+'0');
  }
  
  reverse(ans.begin(),ans.end());
  
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3596
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {
    public static void main(String[] args) throws Exception {
        // Here your code !
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int datas[] = new int[10];
        for(int i = 0;i < 10;i++){
            datas[i] =  Integer.parseInt(br.readLine());
        }
        Arrays.sort(datas);
        System.out.println(datas[9]);
        System.out.println(datas[8]);
        System.out.println(datas[7]);
    }
}

Measured memory_bytes: 24508
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (int i = j; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
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; }
//a/bの天井関数 =>  (a + b - 1) / b 

signed main(){
	int n; cin>>n;
	pair<ll,ll> ans;
	cin>>ans.first>>ans.second;
	rep(i,0,n-1){
		ll x=ans.first;
		ll y=ans.second;
		ll a,b; cin>>a>>b;
		ll s =  (x + a - 1) / a; 
		ll t =  (y + b - 1) / b;
		ll m=max(s,t);
		ans=pair<ll,ll>(a*m,b*m);
	}
	
	cout<<ans.first+ans.second;
	
	return 0;
}

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

int main(){
	int a,b;
  	int count=0;
  	string s,saved;
  	cin>>a>>b;
  	for(int i=a;i<=b;i++){
		s=to_string(i);
		saved=to_string(i);
      	reverse(s.begin(),s.end());
        if(saved==s){
          count+=1;
        }
    }
  cout<<count<<endl;
}
      	


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define NUM 2005

int table[NUM];

int main(){

	int N,X,W;
	scanf("%d %d %d",&N,&X,&W);

	for(int i = 0; i < N; i++){

		scanf("%d",&table[i]);
	}

	if(N == 1){

		printf("%d\n",abs(table[0]-W));

	}else{

		printf("%d\n",max(abs(table[N-1]-W),abs(table[N-1]-table[N-2])));
	}

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
#include <cmath>
#include <complex>
#include <map>
using namespace std;

#define rep(i,n) for(int i=0;i<int(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-8

static const double PI=6*asin(0.5);
typedef complex<double> P;
typedef long long ll;

double w;

int main(){
	while(cin>>w){
		if(w<=48.0) cout<<"light fly\n";
		else if(w<=51.0) cout<<"fly\n";
		else if(w<=54.0) cout<<"bantam\n";
		else if(w<=57.0) cout<<"feather\n";
		else if(w<=60.0) cout<<"light\n";
		else if(w<=64.0) cout<<"light welter\n";
		else if(w<=69.0) cout<<"welter\n";
		else if(w<=75.0) cout<<"light middle\n";
		else if(w<=81.0) cout<<"middle\n";
		else if(w<=91.0) cout<<"light heavy\n";
		else cout<<"heavy\n";
	}
	return 0;
}

Measured memory_bytes: 1192
#include <cstdio>
#include <cstring>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>

using namespace std;

int main()
{
	int n;
	long long int x[100000], a, b, t=0;
	scanf("%d %lld %lld", &n, &a, &b);
	for(int i=0; i<n; i++){
		scanf("%lld", &x[i]);
		if(i>0){
			if(a*(x[i]-x[i-1])<b){
				t=t+a*(x[i]-x[i-1]);
			}else{
				t=t+b;
			}
		}
	}
	printf("%lld\n", t);
	return 0;
}


Measured memory_bytes: 896
#include<stdio.h>
int main(){
    unsigned long inact[100][100];    /* 行列Ａの格納用変数 */
    unsigned long act[100];           /* 行列Ｂの格納用変数 */
    unsigned long ans[100];           /* 積の格納用変数 */
    unsigned short row, col;          /* 行列の要素数の格納用変数 */
    unsigned short i, j;              /* ループ変数 */

    /* 配列の初期化 */
    for(i = 0;i < 100;i++){
        for(j = 0;j < 100;j++){
            inact[i][j] = 0;
        }
        act[i] = 0;
        ans[i] = 0;
    }

    /* 行列の要素数の入力 */
    scanf("%d %d", &row, &col);

    /* 行列Ａの入力 */
    for(i = 0;i < row;i++){
        for(j = 0;j < col;j++){
            scanf("%d", &inact[i][j]);
        }
    }

    /* 行列Ｂの入力 */
    for(i = 0;i < col;i++){
        scanf("%d", &act[i]);
    }

    /* ＡとＢの積の計算 */
    for(i = 0;i < row;i++){
        for(j = 0;j < col;j++){
            /* i番目の積の計算 */
            ans[i] += inact[i][j] * act[j];
        }
    }
    /* 積の出力 */
    for(i = 0;i < row;i++){
        /* i番目の積の出力 */
        printf("%d\n", ans[i]);
    }
    return 0;
}


Measured memory_bytes: 2100
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;

int N;
int A;

int main(){

    cin >> N >> A;
    
    N %= 500;
    if(N <= A){
        cout <<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
    

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
// Begin Header {{{
#define all(x) (x).begin(), (x).end()
#define lli long long int
#define rep(i,n) for(lli i=0; i<n; i++)
#define loop(i, j, n) for(lli i=j; i<n; i++)
#define Max(a, b) ((a) > (b) ? (a) : (b))
#define Min(a, b) ((a) < (b) ? (a) : (b))
constexpr int INF  = 0x3f3f3f3f;
const long long mod=1e9+7;
//Function
lli combi(lli n, lli r)
{
	if(r==0 || r==n) return 1;
	else return combi(n-1,r) + combi(n-1,r-1);
}
lli sigma1(lli n){return n*(n+1)/2;}
lli sigma2(lli s, lli n){return sigma1(n) - sigma1(s -1);}
using namespace std;
// }}} End Header

lli body(lli a, lli b){
	return (a-b)*(a-b);
}
bool is_prime(int x){
	if(x<=1) return false;
	for(lli i=2; i*i<=x; i++){
		if(x%i == 0) return false;
	}
	return true;
}
int main()
{
	ios::sync_with_stdio(false); cin.tie(nullptr);
	int n;
	cin >> n;
	while(!is_prime(n)) n++;
	cout << n << endl;
 	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
constexpr int64_t mod=1e9+7;

int main()
{
  int64_t k,a,b;
  cin>>k>>a>>b;
  if(b-a<=2){
    cout<<k+1;
    return 0;
  }
  k-=a-1;
  cout<<a+(b-a)*(k/2)+k%2;
}

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

int main()
{
	double xa1,ya1,xa2,ya2,xb1,yb1,xb2,yb2;
	while(cin>>xa1>>ya1>>xa2>>ya2>>xb1>>yb1>>xb2>>yb2){
		if( xa1<=xb2 && xa2>=xb1 && ya1<=yb2 && ya2>=yb1){
			cout<<"YES"<<endl;
		}else{
			cout<<"NO"<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1220
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf')
ans = 0 ;count = 0 ;pro = 1

s=set()
a,b,c=map(int,input().split())
s.add(a)
s.add(c)
s.add(b)
print(len(s))

Measured memory_bytes: 38256
#include <iostream>
using namespace std ;
int a[1005];
int main() {
  int n;
  cin >> n;
  for (int i = n-1 ; i >= 0 ; i-- ) 
    cin >> a[i] ; 

  for ( int i = 0 ; i < n ; i++ )  {
      cout << a[i];
      if ( i != n-1 ) {
        cout << ' ' ;
      }
  }
  cout << endl ;
}


Measured memory_bytes: 3092
#include <bits/stdc++.h>
#define INF 5000000000000000000
#define ll long long
#define pll pair<ll, ll>
using namespace std;


int main()
{
  ll R, G, B, N;
  cin >> R >> G >> B >> N;
  ll ans = 0;
  for (ll i = 0; i * R <= N; ++i) {
    ll red = i * R;
    for (ll j = 0; j * G <= N - red; ++j) {
      ll green = j * G;
      if ((N - red - green) % B == 0) {
        ans += 1;
      }
    }
  }
  cout << ans << endl;
}


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

int main(void){
   int a,b,i;
   for(i = 1;i <=3000;i++){
      cin>>a>>b;
      if(a==0&&b==0)break;
      if(a >= b){
        cout<<b<<" "<<a<<endl;
      }else if(a < b){
        cout<<a<<" "<<b<<endl;
      }
   }
   return 0;
}


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

int main() {
	char alphabets[6] = {'A', 'B', 'C', 'D', 'E', 'F'};
	char x, y;
	cin >> x >> y;
	
	int x_index;
	for (int i = 0; i < 6; i++) {
		if (x == alphabets[i]) {
			x_index = i;
		}
	}
	
	int y_index;
	for (int i = 0; i < 6; i++) {
		if (y == alphabets[i]) {
			y_index = i;
		}
	}
	
	if (x_index > y_index) {
		cout << '>' << endl;
	} else if (x_index == y_index) {
		cout << '=' << endl;
	} else {
		cout << '<' << endl;
	}
	
}

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


void swap (long int *x, long int *y){
    long int temp;

    temp = *x;
    *x = *y;
    *y = temp;
}

long int partition(long int array[], long int left, long int right){
    long int i, j, pivot;
    i = left;
    j = right + 1;
    pivot = left;

    do{
        do{i++;} while (array[i] > array[pivot]);
        do{j--;} while (array[pivot] > array[j]);

        if(i < j){swap(&array[i], &array[j]);}

    }while(i<j);

    swap(&array[pivot], &array[j]);

    return j;
}

void quick_sort(long int array[], long int left, long int right){
    long int pivot;

    if(left < right){
        pivot = partition(array, left, right);
        quick_sort(array,left, pivot-1);
        quick_sort(array, pivot+1, right);

    }

}


int main(void){

    long int n, k;
    long int a, b, i, j, x;
    long int *max;

    a = 0;
    b = 0;
    scanf("%ld",&n);
    scanf("%ld",&k);

    max = (long int *)malloc(n*sizeof(long int));

    for(i=0;i<n;i++){
        scanf("%ld",&max[i]);
        a += max[i];
    }

    if(n<=k){
        a = 0;
    }
    else if (k==0){
    }
    else{
        quick_sort(max, 0, n-1);
        for(i=0;i<k;i++){
            a -= max[i];
        }
    }

    printf("%ld",a);
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
#define FORR(I,A,B) for(ll I = (B-1); I >= (A); --I)
#define SORT(x) (sort(x.begin(),x.end()))
const ll INF=1e18+7;
const ll MOD=1e9+7;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll n;
	cin >> n;
	vector<ll> a(n);
	FOR(i,0,n)cin>>a[i];
	SORT(a);
	ll x,y=a[0];
	x = a[n-1];
	FOR(i,0,n){
		if(abs(x-2*y)>abs(x-2*a[i]))y=a[i];
	}
	cout << x << " " << y <<endl;
}

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

using namespace std;

int main(){
  string o, e;
  cin >> o >> e;
  string s;
  for(int i = 0; i < e.length(); i++){
    s.push_back(o[i]);
    s.push_back(e[i]);
  }
  
  if(o.length() > e.length()) s.push_back(o[o.length() - 1]);
  
  cout << s << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <vector>
#include <set>
#include <bitset>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using lint = long long;
using namespace std;

const int MOD = 1000000007;
const lint INF = 1LL << 60;

const double PI = acos(-1);
const double Rad2Deg = 180.0 / PI;
const double Deg2Rad = PI / 180.0;

int main() {
    int N, K, h[100050];
    cin >> N >> K;
    for (int i = 0; i < N; i++) cin >> h[i];

    int ans = 0;
    for (int i = 0; i < N; i++) {
        if (h[i] >= K) ++ans;
    }
    cout << ans << endl;
    return 0;
}


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

using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)

int main()
{
    lint const mod =998244353;
    lint n;cin >> n;
    map<int, int> mp;
    int max_d = 0;
    REP(i,n){
        int d;
        cin >> d;
        int tmp = mp[d];
        mp[d] = mp[d] + 1;
        max_d = max(max_d, d);
        if(i!=0&&d==0){
            cout << 0 << "\n";
            return 0;
        }
    }
    lint ans=mp[0];
    if (mp[0] != 1){
        cout << 0 << "\n";
        return 0;
    }
    FOR(i,1,max_d + 1){
        if(mp[i]==0){
                cout << 0 << "\n";
                return 0;
        }
        REP(j,mp[i]){
            ans = ans * mp[i-1] % mod;
        }
    }
    cout << ans << "\n";
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll,ll> pll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef vector<bool> vb;

#define rep(i,m,n) for(ll i=m;i<n;i++)
#define repr(i,m,n) for(ll i=m;i>=n;i--)
#define all(x) x.begin(),x.end()
#define gll greater<ll>()

ll n;
vll a;

void solve(){
  cin >> n;
  a.resize(n);
  rep(i,0,n) cin >> a[i];
  ll d=*max_element(all(a))-*min_element(all(a));

  if(d>1) {
    cout << "No" << endl;
    return;
  }
  if(d==0) {
   if(a[0]==n-1||2*a[0]<=n) cout << "Yes" << endl;
   else cout << "No" << endl;
  return;  
  }
  ll m=*max_element(all(a));
  ll x=0,y=0;
  rep(i,0,n) {
    if(a[i]==m-1) x++;
    else y++;
  }
  if(x<m&&2*(m-x)<=y) cout << "Yes" << endl;
  else cout << "No" << endl;
  
}
int main(){
   cin.tie(nullptr);
  ios::sync_with_stdio(false);
  solve();
}  

Measured memory_bytes: 1152
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<queue>
#include<map>
#include<string>
#include<cassert>
#include<numeric>
#define all(x) (x).begin(),(x).end()
#define print(x) cout << (x) << endl
typedef long long ll;
typedef long double ld;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
 
using namespace std;

int NMAX = 1000001;
vector<int> prime(NMAX,0);
queue<int> pr;

void pre(){
    vector<int> t(NMAX,0);
    for(int i=2; i<NMAX; i++){
        if(t[i] == 0){prime[i] = 1; pr.push(i);}
        for(int j=i; j<NMAX; j+=i)  t[j] = 1;
    }
}

int main(){
    pre();
    int N, g, cnt;  cin >> N;
    int NMAX = 1000001;
    int l = pr.size();
    vector<int> a(N), p(NMAX,0);
    cnt = 0;
    for(int i=0; i<N; i++){
        cin >> a[i];
        if(i == 0)  g = a[i];
        else    g = gcd(g,a[i]);
        if(a[i] == 1){
            cnt++;
        }else if(p[a[i]] == 1){
            for(int j=i+1; j<N; j++){
                cin >> a[j];
                g = gcd(g,a[j]);
            }
            break;
        }else{
            if(prime[a[i]] == 1){
                for(int j=a[i]; j<NMAX; j+=a[i])    p[j] = 1;
            }else{
                queue<int> tmp;
                for(int j=0; j<l; j++){
                    int x = pr.front();
                    pr.pop();
                    if(a[i]%x == 0 && a[i] >= x){
                        for(int k=x; k<NMAX; k+=x)  p[k] = 1;
                    }
                    tmp.push(x);
                }
                pr = tmp;
            }
            if(i == N-1){print("pairwise coprime"); return 0;}
        }
        p[a[i]] = 1;
    }
    if(g == 1){
        if(cnt == N)    print("pairwise coprime");
        else print("setwise coprime");
    }
    else    print("not coprime");
}


Measured memory_bytes: 15512
import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    }

    static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        int N = scan.nextInt();
        int M = scan.nextInt();
        int A[] = new int[N];
        int sum = 0;

        for(int i = 0; i < N; i++) {
            A[i] = scan.nextInt();
            sum += A[i];
        }

        double limit = sum/(double)(4*M);
        int cand = 0;
        for(int i = 0; i < N; i++) {
            if((double)A[i] >= limit)
                cand++;
        }

        if(cand >= M)
            os.println("Yes");
        else
            os.println("No");
    }


}

Measured memory_bytes: 23508
/*|In The Name Of Allah|*/

#include <bits/stdc++.h>

using namespace std;

const int N = 1e5+5;

int a , b;

int main(){
    cin >> a >> b;
    for(double i = 0; i <= (double)1e6; i++){
        if( int(i*0.08) == a && int(i*0.1) == b){
            cout << i << endl;
            return 0;
        }
    }
    puts("-1");
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define st first
#define nd second
#define pii pair<int,int>

using namespace std;

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

    int n; cin>>n;
    ll x;
    ll ans = 0;
    ll p = 0;
    for(int i=1;i<=n;i++)
    {
        cin>>x;
        if(x < p)
        {
            ans += (p - x);
        }
        else p = x;
    }
    cout<<ans;

    return 0;
}


Measured memory_bytes: 3652
N = int(input())
S = input()

O = []
l = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]

for i in range(len(S)):
    for j in range(len(l)):
        if l[j] == S[i]:
            if (j + N) < 26:
                O.append(l[j+N])
            else:
                O.append(l[j+N-26])

string="".join(O)
print(string)


Measured memory_bytes: 3188
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int A;
    int B;
    int C;
    int D;


    scanf("%d\t%d\t%d\t%d", &A, &B, &C, &D);

    int L = A+B;
    int R = C+D;

    if(L>R){
        printf("Left");
    }
    else if(L<R){
        printf("Right");
    }
    else if(L==R){
        printf("Balanced");
    }
}


Measured memory_bytes: 128