akhauriyash/Code-Regression huggingface dataset:
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define trav(x,a) for (const auto& x: a)
#define sz(x) (int)(x).size()
#define mem(a,v) memset((a), (v), sizeof (a))
#define enl printf("\n")
#define case(t) printf("Case #%d: ", (t))
#define ni(n) scanf("%d", &(n))
#define nl(n) scanf("%lld", &(n))
#define nai(a, n) for (int _i = 0; _i < (n); _i++) ni(a[_i])
#define nal(a, n) for (int _i = 0; _i < (n); _i++) nl(a[_i])
#define pri(n) printf("%d\n", (n))
#define prl(n) printf("%lld\n", (n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define vii vector<pii>
#define vll vector<pll>
#define vi vector<int>
#define vl vector<long long>
#define pb push_back
#define mp make_pair
#define st first
#define nd second
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef cc_hash_table<int,int,hash<int>> ht;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> oset;
const double pi = acos(-1);
const int mod = 1e9 + 7;
const ll inf = 1e18 + 7;
const int N = 1e6 + 5;
const double eps = 1e-9;
ll a[N];

int main() {
  int n; scanf("%d", &n);
  for (int i = 0; i < n; i++)
    scanf("%lld", a+i);
  for (ll x = 0; x <= n; x++) {
    ll cnt = 0;
    for (int i = 0; i < n; i++)
      if (a[i]+x >= n)
        cnt += (a[i]+x-n) / (n+1) + 1;
    if (cnt <= x) {
      printf("%lld\n", x);
      return 0;
    }
  }
  ll lo = n+1, hi = inf;
  while (lo <= hi) {
    ll mi = (lo+hi) / 2;
    ll cnt = n;
    for (int i = 0; cnt <= mi && i < n; i++)
      cnt += (a[i]+mi-(ll)n)/(ll)(n+1);
    if (cnt <= mi)
      hi = mi - 1;
    else
      lo = mi + 1;
  }
  for (ll x = max((ll)n+1, lo - 4*n*n); x <= lo; x++) {
    ll cnt = n;
    for (int i = 0; i < n; i++)
      cnt += (a[i]+x-(ll)n)/(ll)(n+1);
    if (cnt <= x) {
      printf("%lld\n", x);
      return 0;
    }
  }
  printf("%lld\n", lo);
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <ctype.h>
 
int main(void)
{
    int i, ans=0;
    char W[11], T[1001];
     
    scanf("%s",W);
    while(1) {
        scanf("%s",T);
        if(strcmp(T,"END_OF_TEXT") == 0) break;
        for (i=0; i<strlen(T); i++) {
            T[i] = tolower(T[i]);
        }
        if(strcmp(W,T) == 0) ans++;
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 548
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long LL;
int main()
{
	LL A,B,C,D;
	while(~scanf("%lld%lld%lld%lld",&A,&B,&C,&D))
	{
		LL area1=A*B;
		LL area2=C*D;
		LL ans=max(area1,area2);
		printf("%lld\n",ans);
	}
	return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
#define DATA 100

int main(){
	int a[DATA], b[DATA];
	int i, j, r, tmp1, tmp2;
	int GCD[DATA], LCM[DATA];

	i = 0;
	while (scanf("%d %d", &a[i], &b[i]) != EOF)
		i++;

	for (j = 0; j < i; j++){
		tmp1 = a[j];
		tmp2 = b[j];
		if (tmp1 < tmp2){
			while (tmp1 > 0){
				r =tmp2 % tmp1;
				tmp2 = tmp1;
				tmp1 = r;
			}
			GCD[j] = tmp2;
		}
		else{
			while (tmp2>0){
				r = tmp1 % tmp2;
				tmp1 = tmp2;
				tmp2 = r;
			}
			GCD[j] = tmp1;
		}

		tmp1 = a[j];
		tmp2 = b[j];
		while (a[j] < 2000000000 && b[j] < 2000000000){
			if (a[j] < b[j]){
				a[j] += tmp1;
			}
			else if (b[j] < a[j]){
				b[j] += tmp2;
			}
			if (a[j] == b[j]){
				LCM[j] = a[j];
				break;
			}
		}
		printf("%d %d\n", GCD[j], LCM[j]);
	}

	return 0;
}

Measured memory_bytes: 596
import java.util.*;

public class Main {
	Scanner in = new Scanner(System.in);
	public static void main(String[] args) {
		new Main();
	}
	public Main(){
		new AOJ1171().doIt();
	}
	
	class AOJ1171{
		String input;
		
		String solve(){
			ArrayList<Character> list = new ArrayList<Character>();
			int n = input.length();
			char[] text = input.toCharArray();
			for(int i=0;i<n;i++){
//				System.out.println(list);
				if(text[i]=='('||text[i]=='[')list.add(text[i]);
				else if(text[i]==')'){
					if(list.size()==0)return "no";
					char a = list.remove(list.size()-1);
					if(a!='(')return "no";
				}else if(text[i]==']'){
					if(list.size()==0)return "no";
					char a = list.remove(list.size()-1);
					if(a!='[')return "no";
				}
			}
			if(list.size()==0)return "yes";
			return "no";
		}
		
		void doIt(){
			while(in.hasNext()){
				input = in.nextLine();
				if(input.equals("."))break;
				System.out.println(solve());
			}
		}
	}
	
}

Measured memory_bytes: 32328
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef pair<string , int> s_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define puf push_front
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
//#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
const int64 INF = 1LL << 58;
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 (a>b) { a=b; return 1; } return 0; }
template<typename T> void remove(T & vector, unsigned int index){vector.erase(vector.begin() + index);}


string replace_with_str (string str,string str_from, string str_to) {
    string::size_type pos = 0;
    while (pos = str.find(str_from, pos), pos != string::npos) {
        str.replace(pos, str_from.length(), str_to);
        pos += str_to.length();
    }
    return str;
}

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

  int N; cin >> N;
  ves S(N); rep(i,N) cin >> S[i];
  string T; cin >> T;
  ves a ={}, z = {};
  a.pub(T); z.pub(T);

  rep(i,N) {
    string str1 = replace_with_str(S[i], "?", "a");
    a.pub( str1 );
    string str2 = replace_with_str(S[i], "?", "z");
    z.pub( str2 );
  }

  sort(all(a)); sort(all(z));

  int mi = lower_bound(all(z), T) - z.begin();
  int ma = lower_bound(all(a), T) - a.begin(); 
  
  while(ma + 1 <= a.size() - 1) {
    if(a[ma] == a[ma + 1]) ma++;
    else break;
  }

  for(int i = mi; i < ma; i++) cout << i + 1 << " ";
  cout << ma + 1 << endl;
  return 0;

}

Measured memory_bytes: 1920
#include <iostream>
using namespace std;
int main(){
  int A,B;
  cin >>A>>B;
  if (A+B == 15){
    cout << "+" << endl;
  }else{
    if (A*B == 15){
      cout << "*" <<endl;
    }else{
      cout << "x" <<endl;
    }
  }
}


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

#define INF 1e9
#define llINF 1e18
#define MOD 1e9+7
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ALL(hoge) (hoge).begin(),(hoge).end()
using namespace std;
ll f(ll n){
  ll ret=0;while(n>0){ret+=n%10;n/=10;}return ret;
}
double g(ll n){return (double)(n)/f(n);}
int main(){
  ll k;cin>>k;
  vector<ll>kouho;
  ll num=1;
  for(ll i=0;i<15;i++){
    for(ll j=1;j<150;j++){
      kouho.pb(num*(j+1)-1);
    }
    num*=10;
  }
  sort(ALL(kouho));
  kouho.erase(unique(ALL(kouho)),kouho.end());
  for(ll i=0;i<kouho.size();i++)
    for(ll j=i+1;j<kouho.size();j++)
      if(g(kouho[i]) > g(kouho[j])){
	kouho.erase(kouho.begin() + i);
	i--;
	break;
      }

  for(int i=0;i<k;i++)
    cout<<kouho[i]<<endl;
  return 0;
}

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

int main(){
	int N,W;
	cin >> N >> W;
	vector<ll> weights(N), val(N);
	vector<ll> ans(W+1);

	for(int i=0;i<N;i++){
		cin >> weights[i] >> val[i];
	}


	for(int i=0;i<N;i++){
		for(int j=W;j>=weights[i];j--){
			ans[j] = max(ans[j], ans[j-weights[i]] + val[i]);
		}
	}

	cout << ans[W];
}

Measured memory_bytes: 1024
#include<stdio.h>
int main(){
	char c;
	int a=0,b=0,d=0,f=0;
	while(scanf("%c",&c)!=EOF){
		if(c=='\n'){
			printf("%d\n%d\n",a,b);
			a=0;
			b=0;
			d=0;
			f=0;
		}
		else{
			if(c=='J'){
				if(d==0){
					d++;
				}
				else d=1;
				f=0;
			}
			
			else if(c=='O'){
				if(d==1){
					d++;
				}
				else d=0;
				if(f==1){
					f++;
				}
				else f=0;
			}
			
			else if(c=='I'){
				if(d==2){
					a++;
				}
				d=0;
				if(f==0){
					f++;
				}
				else if(f==2){
					b++;
					f=1;
				}
				else f=1;
			}
			
			else{
				d=0;
				f=0;
			}
		}
	}
}


Measured memory_bytes: 2024
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef pair<int,int>P;
int main(){
  int n,m;
  vector<long long>vec1;
  cin>>n>>m;
  for(int i=0;i<n;i++){
    long long data;
    cin>>data;
    vec1.push_back(data);
  }
  sort(vec1.begin(),vec1.end(),greater<long long>());

  vector<P>query;
  for(int i=0;i<m;i++){
    int cnt,num;
    cin>>cnt>>num;
    query.push_back(P(num,cnt));
  }
  sort(query.begin(),query.end(),greater<P>());
  
  vector<long long>vec2;
  for(int i=0;i<m&&vec2.size()<n;i++){
    int num=query[i].first;
    int cnt=query[i].second;
    for(int j=0;j<cnt&&vec2.size()<n;j++){
      vec2.push_back(num);
    }
  }
  
  long long sum=0;
  int index1=0;
  int index2=0;
  for(int i=0;i<n;i++){
    if(vec1[index1]>vec2[index2]){
      sum+=vec1[index1];
      index1++;
    }else{
      sum+=vec2[index2];
      index2++;
    }
  }
  cout<<sum<<endl;
  return(0);
}

Measured memory_bytes: 3316
#include <cstdio>
#include <cmath>

using namespace std;

int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  int min_l = 0;
  int max_r = n;
  int l, r;
  for (int i = 0; i < m; i++) {
    scanf("%d%d", &l, &r);
    min_l = min_l <= l ? l : min_l;
    max_r = max_r <= r ? max_r : r;
    if (min_l > max_r) {
      printf("0\n");
      return 0;
    }
  }
  printf("%d\n", max_r - min_l + 1);
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int const nax = 3e5 + 10;

int main () {
    int x;

    cin >> x;

    x %= 10;

    if (x == 3) {
        cout << "bon";
    } else if (x == 0 || x == 1 || x == 6 || x == 8) {
        cout << "pon";
    } else cout << "hon";
}
/*
    Good Luck
        -Lucina
*/


Measured memory_bytes: 3632
// 22
/****************************************************
https://searleser97.gitlab.io/algorithms/template.cpp
****************************************************/

#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define fors(_, x, n, s) for (int _ = x; _ < n; _ += s)
#define forn(_, x, n) fors(_, x, n, 1)
#define rep(_, n) forn(_, 0, n)
#define forrs(_, x, n, s) for (int _ = x; _ > n; _ -= s)
#define forrn(_, x, n) forrs(_, x, n, 1)
#define rrep(_, n) forrn(_, n - 1, -1)
#define fi first
#define se second
#define pb push_back
#define pairii pair<int, int>
#define all(x) x.begin(), x.end()
#define cerr(s) cerr << "\033[48;5;196m\033[38;5;15m" << s << "\033[0m"
// typedef __int128_t lli;
typedef long long int li;
typedef long double ld;
// 12
void _main(int tc) {
  int n;
  cin >> n;
  vector<vector<int>> abc(n, vector<int>(3));
  rep(i, n) {
    cin >> abc[i][0];
    cin >> abc[i][1];
    cin >> abc[i][2];
  }
  vector<vector<int>> mem(n, vector<int>(3));
  mem[n - 1][0] = abc[n - 1][0];
  mem[n - 1][1] = abc[n - 1][1];
  mem[n - 1][2] = abc[n - 1][2];
  function<int(int, int)> fhappy = [&](int i, int k) -> int {
    if (mem[i][k] != 0) return mem[i][k];
    rep(j, 3) {
      if (k != j) mem[i][k] = max(mem[i][k], abc[i][k] + fhappy(i + 1, j));
    }
    return mem[i][k];
  };
  auto ans = max({fhappy(0, 0), fhappy(0, 1), fhappy(0, 2)});
  cout << ans << endl;

  // rrep(i, n - 1) {
  //   mem[i][0] = abc[i][0] + max(mem[i + 1][1], mem[i + 1][2]);
  //   mem[i][1] = abc[i][1] + max(mem[i + 1][0], mem[i + 1][2]);
  //   mem[i][2] = abc[i][2] + max(mem[i + 1][0], mem[i + 1][1]);
  // }
  // auto ans = max({mem[0][0], mem[0][1], mem[0][2]});
  // cout << ans << endl;
}

int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  _main(0);
  return 0;
  int tc;
  cin >> tc;
  rep(i, tc) _main(i + 1);
}

Measured memory_bytes: 20608
// https://atcoder.jp/contests/nikkei2019-qual/tasks/nikkei2019_qual_c

#include "algorithm"
#include "bitset"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "map"
#include "numeric"
#include "queue"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define rep1(i, to) for (ll i = 1; i <= (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define unless(cond) if (!(cond))
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;
template <typename T>
inline bool chmax(T& a, T b);
template <typename T>
inline bool chmin(T& a, T b);
void print_ints(vector<ll> v);
template <typename T>
void drop(T a);

const ll INF = 1e18;

void solve() {
  ll N;
  cin >> N;

  VL as(N);
  VL bs(N);
  rep(i, N) cin >> as[i] >> bs[i];

  VPL sums(N);
  rep(i, N) { sums[i] = {as[i] + bs[i], i}; }

  sort(sums.rbegin(), sums.rend());

  ll t_score = 0;
  ll a_score = 0;
  ll next_i = 0;

  while (next_i < N) {
    {
      ll i = sums[next_i].se;
      t_score += as[i];
      next_i++;
    }

    unless(next_i < N) break;

    {
      ll i = sums[next_i].se;
      a_score += bs[i];
      next_i++;
    }
  }

  ll res = t_score - a_score;
  cout << res << endl;
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

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

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

template <typename T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

template <typename T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

void print_ints(vector<ll> v) {
  rep(i, v.size()) {
    if (i > 0) {
      cout << " ";
    }

    cout << v[i];
  }

  cout << endl;
}

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}


Measured memory_bytes: 3456
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cmath>
using namespace std;
//typedef __int64 LL;
typedef pair<int,int> P;
const int INF=100000000;

int main(){
	int M,N;
	int sum=0;
	int a[1010];
	cin>>N>>M;
	for(int i=0;i<N;i++)cin>>a[i],sum+=a[i];
	sort(a,a+N,greater<int>());
	if(a[M-1]*4*M>=sum)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

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

int main(){
    int n;
    double sum = 0, ans;
    std::vector<int> a;

    std::cin >> n;
    for(int b = 0; b < n; b++){
        double c, d;
        std::cin >> c;
        d = 1 / c;
        sum += d;
    }

    ans = 1 / sum;

    std::cout << ans << std::endl;

    return 0;
}


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

#define mp make_pair
#define pb push_back

typedef pair<int, int> pii;
typedef unsigned long long ull;
typedef long long ll;
typedef double db;

int main() {
	int n, d;
	cin >> n >> d;
	cout << (int) (ceil(n / (double) (2 * d + 1))) << endl;
	return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <iomanip>


using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define rep(i, a, b) for (int i=a; i<(b); i++)
#define rp(i, a) for (int i=0; i<(a); i++)
#define repd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define rpd(i,a) for (int i = (a)-1; i >= 0; i--)

#define dump(x)  cout << #x << " = " << (x) << endl;

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy


int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout << std::setprecision(0);
    cout << std::fixed;
    map<ll,ll> mapik;
    ll n;
    cin >> n;
    ll x;
    rp(i,n){
        cin >> x;
        mapik[x]++;
    }
    ll evenNum = 0;
    ll killedCards = 0;
    for(auto k : mapik) {
        if(k.second > 0 && k.second%2==0) {
            ++evenNum;
            killedCards += k.second -2 ;
        }
        if(k.second > 0 && k.second&1)
            killedCards += k.second -1;
    }
    if(evenNum%2 == 0) killedCards += evenNum;
    else killedCards += evenNum + 1;
    cout << n - killedCards << "\n";

   return 0;
}

// read the question correctly (ll vs int)
// template by super1 derived from bqi343


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

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define mp            make_pair
#define pb            push_back
template<class T1, class T2> inline void minup(T1& m, T2 x){ if(m>x) m=static_cast<T2>(x); }
template<class T1, class T2> inline void maxup(T1& m, T2 x){ if(m<x) m=static_cast<T2>(x); }

#define INF 1000000000
#define MOD 1000000009
#define EPS 1E-9

struct UnionFind
{
private:
  vi data;
  int cnt;

public:
  UnionFind(int size) : data(size, -1), cnt(size) {}
  bool unite(int x, int y){
    x = root(x);
    y = root(y);
    if(x != y){
      if(data[y] < data[x]) swap(x, y);
      data[x] += data[y];
      data[y] = x;
      cnt -= 1;
    }
    return x != y;
  }
  bool same(int x, int y){ return root(x) == root(y); }
  int root(int x){ return data[x] < 0 ? x : data[x] = root(data[x]); }
  int size(int x){ return -data[root(x)]; }
  int group(){ return cnt; }
};

int n, q;
int com, x, y;

int main()
{
  cin >> n >> q;
  UnionFind uf(n);

  while(q--){
    cin >> com >> x >> y;
    if(com == 0) uf.unite(x, y);
    else puts(uf.same(x, y) ? "1" : "0");
  }

  return 0;
}

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

namespace B_ABC160
{
    class MainClass
    {

        static int[] s;

        public static void Main(string[] args)
        {
            s = Array.ConvertAll(ReadLine().Split().ToArray(), int.Parse);
            int x = s[0];
            int s500 = x / 500;
            if (s500 > 0) x = x % 500;

            int s5 = x/5;
            WriteLine(s5*5 + s500 * 1000);
        }
    }
}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define fi first
#define se second
int main(){
    int a;
    cin>>a;
    if (a<=599) cout<<8<<endl;
    else if (a<=799) cout<<7<<endl;
    else if (a<=999) cout<<6<<endl;
    else if (a<=1199) cout<<5<<endl;
    else if (a<=1399) cout<<4<<endl;
    else if (a<=1599) cout<<3<<endl;
    else if (a<=1799) cout<<2<<endl;
    else cout<<1<<endl;
}


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

int main() {
  int n,a,b,count,i;
  cin >> n >> a >> b;
  count = 0;
  i = 1;
  while(i <= n){
    if(i<10){
      if(a <= i && i <= b){
        count += i;
      }
    }
    else if(10<=i && i <100){
      if(a <= i/10 + i%10 && i/10 + i%10 <= b){
        count += i;
      }
    }
    else if(100<=i && i <1000){
      if(a <= i/100 + (i%100)/10 + i%10 && i/100 + (i%100)/10 + i%10 <= b){
        count += i;
      }
    }
    else if(1000<=i && i <10000){
      if(a <= i/1000 + (i%1000)/100 + (i%100)/10 + i%10 && i/1000 + (i%1000)/100 + (i%100)/10 + i%10 <= b){
        count += i;
      }
    }
    else {
      if(a == 1){
        count += i;
      }
    }
    i++;
  }
  
  cout << count << endl;
}


Measured memory_bytes: 256
import sys
from collections import Counter
N = int(input())
C = Counter(list(map(int, input().split())))
if len(C) == 1 and C[0] == N:
    print('Yes')
elif len(C) == 2 and N % 3 == 0 and C[0] == N // 3 and N - C[0] == 2 * N // 3:
    print('Yes')
elif len(C) == 3 and N % 3 == 0:
    b = 0
    for c in C.most_common():
        if c[1] != N // 3:
            print('No')
            sys.exit()
        b ^= c[0]
    if b == 0:
        print('Yes')
    else:
        print('No')
else:
    print('No')


Measured memory_bytes: 20976
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cout << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cout<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 200010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 29;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
///////////////////////////////////////////////////////////////////////////////////////////////////

int N;

bool ok[40];

void solve() {
	cin >> N;
	ll x = 0;
	rep(i, 0, N) {
		ll a; cin >> a;
		x ^= a;
		rer(i, 30, 0) {
			if(a % (1 << i) == 0) {
				ok[i] = true;
				break;
			}
		}
	}
	// debug(bitset<5>(x));
	// debug(vi(ok, ok + 31));
	int prev = 0, cnt = 0;
	rer(i, 31, 0) {
		int b = ((x & (1 << i)) > 0);
		if(b != prev) {
			if(!ok[i]) {
				cout << -1 << "\n";
				return;
			}
			cnt++;
			prev = b;
		}
	}
	cout << cnt << "\n";
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
	srand((unsigned int)time(NULL));
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}



Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#include <set>
#include <map>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;

int main(){
  ll m,k;
  cin >> m >> k;
  if(k>=(1<<m)){
    cout << -1 << endl;
    return 0;
  }
  if(m==0){
    cout << "0 0" << endl;
  }else if(m==1){
    if(k==0) cout << "0 0 1 1" << endl;
    else cout << "-1" << endl;
  }else{
    for(ll i = 0; i <= (1<<m)-1; i++){
      if(i==k) continue;
      cout << i << " ";
    }
    cout << k << " ";
    for(ll i = (1<<m)-1; i>=0; i--){
      if(i==k) continue;
      cout << i << " ";
    }
    cout << k << endl;
  }
  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define LL long long
using namespace std;
const int maxn = 1e5 + 10;

double qpow(double a, int x)
{
    double ans = 1.0;
    while(x) {
        if( x & 1)
            ans *= a;
        x >>= 1;
        a *= a;
    }
    return ans;
}
int main()
{
    int n, m;
    scanf("%d%d", &n, &m);
    double ans = 0.0;
    double p = qpow(0.5, m);
    double all = 1.0;
    double each = m * 1900 + (n - m ) * 100;

    for(int i = 1; i <= 1000000; i++) {
        ans += (all * p ) * (each * i);
        all -= all * p;
    }
    printf("%.0f", ans);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
typedef long long ll;
typedef long double ld;
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
const int MOD=1000000007;

int main(){
    ll n;
    ll ans=0;
    cin>>n;
    vector<ll> L(n);
    rep(i,n){
        cin>>L[i];
    }
    sort(L.begin(),L.end());
    for(int i=0;i<n-1;i++){
        for(int j=i+1;j<n;j++){
            ll dis=L[j]-L[i];
            ll sum=L[j]+L[i];
            if(L[i]>dis && L[i]<sum && L[j]>dis && L[j]<sum){
                ans+=lower_bound(L.begin(),L.end(),sum)-upper_bound(L.begin(),L.end(),dis)-2;
            }else if((L[i]>dis && L[i]<sum) || (L[j]>dis && L[j]<sum)){
                ans+=lower_bound(L.begin(),L.end(),sum)-upper_bound(L.begin(),L.end(),dis)-1;
            }else{
                ans+=lower_bound(L.begin(),L.end(),sum)-upper_bound(L.begin(),L.end(),dis);
            }
        }
    }
    ans/=3;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <cstdarg>
#include <sys/time.h>
#include <fstream>
//#include "cout.h"

using namespace std;

#define SZ(x) ((int)x.size())
#define MSET(x,a) memset(x, a, (int)sizeof(x))
#define PB push_back
#define VI vector < int >
#define PII pair < int, int >
#define LL long long
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(), (v).end()
#define FIT(it,v) for (__typeof((v).begin()) it = (v).begin(); it != (v).end(); it++)
#define OUT(A) cout << #A << " = "<< (A) << endl
#define OUT2(A, B) cout << "(" << #A << ", " << #B << ") = (" << (A) << ", "<< (B) << ")" << endl
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }

#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(ALL(c), (e)) != (c).end())

  const int MAX_N = 100010;
	int par[MAX_N];  //親
	int _rank[MAX_N]; //木の深さ

	// n要素で初期化
	void init(int n){
        REP(i, n){
			par[i] = i;
            _rank[i] = 0;
		}
	}
	//木の根を求める
	int find(int x){
		if(par[x] == x) return x;
		else return par[x] = find(par[x]);
	}
	//xとyの属する集合を結合
	void unite(int x, int y){
		x = find(x);
		y = find(y);
		if(x == y) return;
		if(_rank[x] < _rank[y]) par[x] = y;
		else{
			par[y] = x;
			if(_rank[x] == _rank[y]) _rank[x]++;
		}
	}
	//xとyが同じ集合に属するか
	bool same(int x, int y){
		return find(x) == find(y);
	}

int n, m;
int x[100010], y[100010], z[100010];

void solve() {
  cin >> n >> m;
  init(n);
  REP(i, m) {
    int a, b, c;
    cin >> a >> b >> c;
    a--;
    b--;
    // c = c&1;
    // x[i] = a;
    // y[i] = b;
    // z[i] = c;
    unite(a,b);
  }
  set<int> s;
  REP(i, n) s.insert(find(i));
  cout << SZ(s) << endl;
}

int main() {
	solve();
	return 0;
}


Measured memory_bytes: 5760
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		String s[] = new String[N];
		long m = 0;
		long a = 0;
		long r = 0;
		long c = 0;
		long h = 0;
		for(int i=0; i<N; i++){
			s[i] = sc.next();
			char head = s[i].charAt(0);
			if(head=='M')m++;
			else if(head=='A')a++;
			else if(head=='R')r++;
			else if(head=='C')c++;
			else if(head=='H')h++;
		}
		long total = m*a*r + m*a*c + m*a*h + m*r*c + m*r*h + m*c*h + a*r*c + a*r*h + a*c*h + r*c*h;
		System.out.println(total);
	}
}

Measured memory_bytes: 51376
cards,trial = (int(n) for n in input().split(" "))
while True:
    cards = list(reversed([int(n) for n in range(1,(cards)+1)]))
    for n in range(trial):
        num,change = (int(n) for n in input().split(" "))
        num -= 1
        disp = cards[num:num+change]
        cards[change:change+num] = cards[:num]
        cards[:change] = disp
    print(cards[0])
    cards,trial = (int(n) for n in input().split(" "))
    if cards == 0 and trial == 0:
        break

Measured memory_bytes: 7672
#include<bits/stdc++.h>
int freq[1001];
using namespace std ; 
int n ,h;
string arr[10000];

long long done[1001][1001];
int calc(int  i , int j ){
  
  if(i==n-1 and j==h-1)return 1;
  if(i>=n or j>=h or arr[i][j]=='#')return 0;
  if(done[i][j]!=-1)return done[i][j];
  int one =  calc(i+1,j) ;
 int tow =calc(i,j+1);
  //345263555


  return done[i][j]=(one+tow)%(1000000000 +7);
}

int main (){

cin>>n>>h;

for(int i =0;i<n;i++)cin>>arr[i];
//cout<<n<<h<<endl;
memset(done ,-1,sizeof done);
cout <<calc(0,0);}


Measured memory_bytes: 13664
#include <bits/stdc++.h>
#define base 1000000007LL
#define ll long long
#define X first
#define Y second
#define pb push_back
#define Scan(a) scanf("%I64d", &a);
#define CLR(a) memset(a,0,sizeof(a))
#define FOR(i,a,b) for(int i=(a),_b=(b); i<=_b; i++)
#define FORE(i,a,b) for(int i=(a),_b=(b); i>=_b; i--)

using namespace std;

typedef pair<int, int> II;
typedef vector<II> vi;

bool fr[200010], FR[200010];
int g, b[200010], groupRa[200010], res[200010], rail, n, m, k, c[200010];
vector<int> a[200010], A[200010];

void dfsRo(int u)
{
    fr[u] = false;
    b[++g] = u;
    for (vector<int>::iterator it = a[u].begin(); it!=a[u].end(); it++)
        if (fr[*it]) dfsRo(*it);
}

void dfsRa(int u)
{
    FR[u] = false;
    groupRa[u] = rail;
    for (vector<int>::iterator it = A[u].begin(); it!=A[u].end(); it++)
        if (FR[*it]) dfsRa(*it);
}

int main()
{
    ios::sync_with_stdio(0);
    //freopen("inp.txt", "r", stdin);
    scanf("%d", &n);
    scanf("%d", &m);
    scanf("%d", &k);
    while (m--) {
        int u, v;
        scanf("%d %d", &u, &v);
        a[u].pb(v);
        a[v].pb(u);
    }
    while (k--) {
        int u, v;
        scanf("%d %d", &u, &v);
        A[u].pb(v);
        A[v].pb(u);
    }
    FOR(i,1,n) fr[i] = true;
    FOR(i,1,n) FR[i] = true;
    FOR(i,1,n)
        if (FR[i]) {
            rail++;
            dfsRa(i);
        }
    FOR(i,1,n)
        if (fr[i]) {
            g = 0;
            dfsRo(i);
            FOR(j,1,g) c[groupRa[b[j]]]++;
            FOR(j,1,g) res[b[j]] = c[groupRa[b[j]]];
            FOR(j,1,g) c[groupRa[b[j]]] = 0;
        }
    FOR(i,1,n) cout << res[i] << " ";
    return 0;
}


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

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

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

  int coin500 = X / 500;
  int coin5 = (X - coin500 * 500) / 5;

  cout << coin500 * 1000 + coin5 * 5 << endl;
}


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

int function(int x, int y, int z) {
    return (x*x)+(y*y)+(z*z)+(x*y)+(y*z)+(z*x);
}

int main(void) {
    int N;
    int num[10001] = {0};

    scanf("%d", &N);

    for(int x = 1; x <= sqrt(N); x++) {
        for(int y = 1; y <= sqrt(N); y++) {
            for(int z = 1; z <= sqrt(N); z++) {
                int tmp = function(x, y, z);
                if(tmp <= N) num[tmp]++;
            }
        }
    }

    for(int i = 1; i <= N; i++) {
        printf("%d\n", num[i]);
    }
    
    return 0;
}


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

const int N = 300000;
#define debug(a) cout << #a << " = " << a << endl;
#define pii pair<int,int>

int A[1000000];
int B[1000000];


int main(int argc, char const *argv[])
{
	int n;
	scanf("%d",&n);
	long long  ans = 0;
	for(int i = 0; i <= n;i++)scanf("%d",&A[i]);
	for(int i = 0; i < n;i++)scanf("%d",&B[i]);
	for(int i = 0; i < n;i++){
		int hala = min(A[i],B[i]);
		ans += hala;
		B[i] -= hala;
		A[i] -= hala;

		hala = min(A[i+1],B[i]);
		ans += hala;
		B[i] -= hala;
		A[i+1] -= hala;
	}
	printf("%lld\n",ans );
	
	
	return 0;
}

Measured memory_bytes: 4736
#include <iostream>
#include <iomanip>
#include <cmath>

using namespace std;

#define EPS (1e-10)
#define equals(a, b) (fabs((a) - (b)) < EPS)

class Point
{
public:
  double x, y;

  Point(double x = 0, double y = 0) : x(x), y(y) {}

  Point operator+(Point p) { return Point(x + p.x, y + p.y); }
  Point operator-(Point p) { return Point(x - p.x, y - p.y); }
  Point operator*(double a) { return Point(a * x, a * y); }
  Point operator/(double a) { return Point(x / a, y / a); }

  double abs() { return sqrt(norm()); }
  double norm() { return x * x + y * y; }

  bool operator<(const Point &p) const
  {
    return x != p.x ? x < p.x : y < p.y;
  }

  bool operator==(const Point &p) const
  {
    return fabs(x - p.x) < EPS && fabs(y - p.y) < EPS;
  }
};

typedef Point Vector;

struct Segment
{
  Point p1, p2;
};

double dot(Vector a, Vector b)
{
  return a.x * b.x + a.y * b.y;
}

double norm(Vector a)
{
  return a.x * a.x + a.y * a.y;
}

Point project(Segment s, Point p)
{
  Vector base = s.p2 - s.p1;
  double r = dot(p - s.p1, base) / norm(base);
  return s.p1 + base * r;
}

int main()
{
  int x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  Point p1 = Point(x1, y1);
  Point p2 = Point(x2, y2);
  Segment s;
  s.p1 = p1;
  s.p2 = p2;
  int q;
  cin >> q;

  for (int i = 0; i < q; i++)
  {
    int x, y;
    cin >> x >> y;
    Point ans = project(s, Point(x, y));
    cout << fixed << setprecision(11) << ans.x << " " << fixed << setprecision(11) << ans.y << endl;
  }

  return 0;
}



Measured memory_bytes: 3296
import java.util.Scanner;
public class Main{
    public static void main(String args[]){
        int n,r,ans;
        Scanner reader = new Scanner(System.in);
        n=reader.nextInt();
        r=reader.nextInt();
        if(n>=10){
            ans=r;
        }
        else{
            ans=100*(10-n)+r;
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 23892
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;



int main()
{
    int N, Q;
    cin >> N >> Q;
    vector<vector<int>> P(N, vector<int>(3));
    set<pair<int,int>> D;
    for( int i = 0; i < N; ++i ){
        cin >> P[i][1] >> P[i][2] >> P[i][0];
        P[i][1] -= P[i][0];
        P[i][2] -= P[i][0];
    }
    for( int i = 0; i < Q; ++i ){
        int d;
        cin >> d;
        D.insert( make_pair(d, i) );
    }


    // X の小さい順にソート
    sort(P.begin(), P.end());

    vector<int> ans(Q);
    for( int i = 0; i < N; ++i ){
        auto itr = D.lower_bound( make_pair(P[i][1],-1) );
        while( itr->first < P[i][2] and itr != D.end() ){
            ans[itr->second] = P[i][0];
            D.erase(itr++);
        }
    }
    for(auto v: D) ans[v.second] = -1;

    for(auto v: ans) cout << v << endl;
    
    return 0;
}

Measured memory_bytes: 24320
#include "bits/stdc++.h"
using namespace std;
int main() {
	int N;
		cin >> N;
	string S;
	cin >> S;
	long ans = 0;
	for (int i = 0; i < S.size() - 2; i++) {
		if (S.at(i) == 'A' && S.at(i + 1) == 'B' && S.at(i + 2) == 'C') ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
 
#define ALL(obj) (obj).begin(),(obj).end()
#define SPEED cin.tie(0);ios::sync_with_stdio(false);
 
template<class T> using PQ = priority_queue<T>;
template<class T> using PQR = priority_queue<T,vector<T>,greater<T>>;
 
constexpr long long MOD = (long long)1e9 + 7;
constexpr long long MOD2 = 998244353;
constexpr long long HIGHINF = (long long)1e18;
constexpr long long LOWINF = (long long)1e15;
constexpr long double PI = 3.1415926535897932384626433;
 
template <class T> vector<T> multivector(size_t N,T init){return vector<T>(N,init);}
template <class... T> auto multivector(size_t N,T... t){return vector<decltype(multivector(t...))>(N,multivector(t...));}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const multiset<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "{" << obj.first << ", " << obj.second << "}"; return o;}
void print(void) {cout << endl;}
template <class Head> void print(Head&& head) {cout << head;print();}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head << " ";print(forward<Tail>(tail)...);}
template <class T> void chmax(T& a, const T b){a=max(a,b);}
template <class T> void chmin(T& a, const T b){a=min(a,b);}
void YN(bool flg) {cout << (flg ? "YES" : "NO") << endl;}
void Yn(bool flg) {cout << (flg ? "Yes" : "No") << endl;}
void yn(bool flg) {cout << (flg ? "yes" : "no") << endl;}

int main() {
	string S,T; cin >> S >> T;
	int A,B; cin >> A >> B;
	string U; cin >> U;
	if(S==U) A--;
	if(T==U) B--;
	cout << A << " " << B << endl;


    return 0;
}


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

#define endl '\n'
#define ll long long
#define re register
#define pb(x) push_back(x)
#define ce(x) cout << x << endl;

using db = double;
using pii = pair < int, int >;
using pll = pair < ll, ll >;
#define scl1(a)             scanf(“%I64d", &a)
#define scl2(a, b)          scanf("%lld %lld", &a, &b)

#define rep(i,x,n,inc) for(i=x ; i<n ; i+=inc)
#define repr(i,x,n,inc) for( i=x ; i>n ; i+=inc)
#define all(a)      (a).begin(),(a).end()
#define rall(x) (x).rbegin(), (x).rend()
#define unique_sort(x) sort(all(x)), x.resize(distance(x.begin(), unique(all(x))))

#define mp(a,b) make_pair(a,b)
#define ff first
#define ss second
#define hell 1000000007
const db pi = acos(-1);
const long long infl = LLONG_MAX;
const int inf = 0x3f3f3f3f;

#define Foxen(i,s) for (i=s.begin(); i!=s.end(); i++)
#define Fill(s,v) memset(s,v,sizeof(s))
#define cout_p(x, p) cout << fixed << setprecision((p)) << x << endl     //print with precision

#define tc(tt) \
    ll tt;    \
    cin >> tt; \
    for (ll _tt = 0; _tt < tt; _tt++) // testcase   

int32_t main(){

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

ll t,i,x,j,y,z,k,n;

cin>>n>>k;
y=0;
rep(i,0,n,1){
	cin>>x;
	if(x>=k)y++;
}
ce(y)
}


Measured memory_bytes: 256
N = int(input())
# 2 <= N < 4500　くらいが保証されている

for h in range(3501):
    for w in range(3501):
        if 4*h*w-N*w-N*h <= 0:continue
        if N*h*w % (4*h*w-N*w-N*h) == 0:
            print(h,w,N*h*w // (4*h*w-N*w-N*h))
            exit()

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

int main()
{
    int d, g;
    cin >> d >> g;
    vector<int> p(d), c(d);
    for (int i = 0; i < d; ++i)
        cin >> p[i] >> c[i];

    int ans = 1000;
    for (int mask = 0; mask < (1 << d); ++mask)
    {
        // bitが立っているところを完全に解く
        int s = 0, num = 0, rest_max = -1;
        for (int i = 0; i < d; ++i)
        {
            if (mask >> i & 1)
            {
                s += 100 * (i + 1) * p[i] + c[i];
                num += p[i];
            }
            else
            {
                rest_max = i;
            }
        }
        if (s < g)
        {
            int s1 = 100 * (rest_max + 1);
            int need = (g - s + s1 - 1) / s1;
            if (need >= p[rest_max])
            {
                continue;
            }
            num += need;
        }
        ans = min(num, ans);
    }
    cout << ans << endl;
}


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

int main() {
	string ss;
	cin>>ss;
	for (int i=0; i<ss.size(); i++)
		if ((i%2 == 0 && ss[i] == 'L') || (i%2 != 0 && ss[i] == 'R')) {
			cout<<"No"<<endl;
			return 0;
		}
	cout<<"Yes"<<endl;
	return 0;
}

Measured memory_bytes: 256
N,*ds=$<.read.split.map(&:to_i)
mod = 998244353

arr = Array.new(ds.max+1,0)
ds.each do |d|
    arr[d] += 1
end

if arr[0] != 1 || ds[0] != 0
    puts 0
    exit 0
end

n = 1
arr.each_cons(2) do |a,b|
    n *= a**b
end
p n % mod

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

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

template<class T>
T read() {
    T x{};
    cin >> x;
    return x;
}

template<class T>
vector<T> read(int N){
    vector<T> x(N);
    for(int i = 0; i < N; ++i){
        cin >> x[i];
    }
    return x;
}

template<class T>
void write(const T &x){ cout << x << endl; }

template<class T>
void write(const vector<T> &r){
    for(const auto &x : r){
        cout << x << " ";
    }
    cout << endl;
}

int main(){
    auto N = read<ll>();
    auto L = read<ll>(N);
    sort(begin(L), end(L));
    
    ll ans = 0;
    for(int i = 0; i < N; ++i){
        for(int j = i + 1; j < N; ++j){
            ll tmp = L[i] + L[j];
            auto itL = lower_bound(begin(L) + j + 1, end(L), tmp);
            ans += itL - (begin(L) + j + 1);
        }
    }
    write(ans);
    
}

Measured memory_bytes: 256
def counting_sort(array,city,road):
    bucket = [0] * city

    for i in range(road):
        for j in range(2):
            bucket[ (array[i][j] - 1) ] += 1

    return bucket

def main():
    n,m = map(int, input().split())
    way = [list(map(int,input().split())) for _ in range(m)]
    ans_list = counting_sort(way, n, m)
    for k in range(n):
        print( ans_list[k] )

main()

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define VIN(v) for(auto&elem_: (v) )cin>>elem_
#define VOUT(v, sep) for(_loop_int idx=0; idx<(_loop_int)v.size(); idx++) {cout<<v[idx]; if(idx<v.size()-1) cout<<sep;} cout<<endl

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(debugidx,v.size())cout<<" "<<v[debugidx];cout<<endl
#define DEBUG_ARR(v,n) cout<<#v<<":";REP(debugidx,n)cout<<" "<<v[debugidx];cout<<endl
#define ALL(a) (a).begin(),(a).end()

const ll MOD = 1000000007ll;
const int IINF = numeric_limits<int>::max()/2-1;
const ll LINF = numeric_limits<ll>::max()/2-1;
#define FIX(a) ((a)%MOD+MOD)%MOD

struct UnionFind {
  vector< int > data;
 
  UnionFind(int sz) {
    data.assign(sz, -1);
  }
 
  bool unite(int x, int y) {
    x = find(x), y = find(y);
    if(x == y) return (false);
    if(data[x] > data[y]) swap(x, y);
    data[x] += data[y];
    data[y] = x;
    return (true);
  }
 
  int find(int k) {
    if(data[k] < 0) return (k);
    return (data[k] = find(data[k]));
  }
 
  int size(int k) {
    return (-data[find(k)]);
  }
};


int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    int n,m;
    cin>>n>>m;
    UnionFind uf(n);

    int ans = n;
    REP(i,m){
        int x,y,z;
        cin>>x>>y>>z;
        x--;
        y--;
        if(uf.find(x)!=uf.find(y)){
            ans--;
            uf.unite(x,y);
        }
    }

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

Measured memory_bytes: 640
import java.io.*;
import java.util.*;

public class Main {
 	public static void main(String args[]) throws IOException {
     	Scan sc = new Scan();
      	int N = sc.scanInt();
      	int[] height = new int[N];
      	for(int i=0;i<N;i++) {
         	height[i] = sc.scanInt(); 
        }
      	int[] dp = new int[N];
      	dp[0] = 0;
      	if(N > 1) 
          	dp[1] = Math.abs(height[0] - height[1]);
     	if(N > 2) 
          	dp[2] = Math.min(dp[1] + Math.abs(height[1] - height[2]), Math.abs(height[0] - height[2]));
      	for(int i = 3;i<N;i++) {
         	dp[i] = Math.min(dp[i-1] + Math.abs(height[i] - height[i-1]), dp[i-2] + Math.abs(height[i] - height[i-2]));
        }
      	System.out.println(dp[N-1]);
    }
}

class Scan
{
    private byte[] buf=new byte[1024];
    private int index;
    private InputStream in;
    private int total;
    public Scan()
    {
        in=System.in;
    }
    public int scan()throws IOException
    {
        if(total<0)
        throw new InputMismatchException();
        if(index>=total)
        {
            index=0;
            total=in.read(buf);
            if(total<=0)
            return -1;
        }
        return buf[index++];
    }
    public int scanInt()throws IOException
    {
        int integer=0;
        int n=scan();
        while(isWhiteSpace(n))
        n=scan();
        int neg=1;
        if(n=='-')
        {
            neg=-1;
            n=scan();
        }
        while(!isWhiteSpace(n))
        {
            if(n>='0'&&n<='9')
            {
                integer*=10;
                integer+=n-'0';
                n=scan();
            }
            else throw new InputMismatchException();
        }
        return neg*integer;
    }
    public double scanDouble()throws IOException
    {
        double doub=0;
        int n=scan();
        while(isWhiteSpace(n))
        n=scan();
        int neg=1;
        if(n=='-')
        {
            neg=-1;
            n=scan();
        }
        while(!isWhiteSpace(n)&&n!='.')
        {
            if(n>='0'&&n<='9')
            {
                doub*=10;
                doub+=n-'0';
                n=scan();
            }
            else throw new InputMismatchException();
        }
        if(n=='.')
        {
            n=scan();
            double temp=1;
            while(!isWhiteSpace(n))
            {
                if(n>='0'&&n<='9')
                {
                    temp/=10;
                    doub+=(n-'0')*temp;
                    n=scan();
                }
                else throw new InputMismatchException();
            }
        }
        return doub*neg;
    }
    public String scanString()throws IOException
    {
        StringBuilder sb=new StringBuilder();
        int n=scan();
        while(isWhiteSpace(n))
        n=scan();
        while(!isWhiteSpace(n))
        {
            sb.append((char)n);
            n=scan();
        }
        return sb.toString();
    }
    private boolean isWhiteSpace(int n)
    {
        if(n==' '||n=='\n'||n=='\r'||n=='\t'||n==-1)
        return true;
        return false;
    }
}

Measured memory_bytes: 33308