akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
 
#define infi            5e9
#define infl            5e18
#define MX              100005
#define pi              2*acos(0.0)
#define ll              long long int
#define rr              read()
#define ff              first
#define ss              second
#define pb              push_back
#define pii             pair<int,int>
#define pll             pair<ll,ll>
#define ms(a,b)         memset(a, b, sizeof(a))
#define loop(i,n)       for(register int i=0;i<n;i++)
#define pool(i,n)       for(register int i=n-1;i>=0;i--)
#define loop1(i,n)      for(register int i=1;i<=n;i++)
#define pool1(i,n)      for(register int i=n;i>0;i--)
 
using namespace std;
 
inline ll read(){char c=getchar();ll num,sign=1;for(;c<'0'||c>'9';c=getchar())if(c=='-')sign=-1;for(num=0;c>='0'&&c<='9';){c-='0';num=num*10+c;c=getchar();}return num*sign;}
// inline ll pw(ll b, ll p){ll ans=1;while(p>0){if(p&1)ans*=b;p>>=1;b*=b;}return ans;}
inline bool isPrime(ll n){if(n==1)return false;if(n==2)return true;if(!(n%2))return false;for(ll i=3;i<=sqrt(n);i+=2)if(!(n%i))return false;return true;}
// inline ll gcd(ll a, ll b){if(a==0)return b;return gcd(b%a,a);}
 
// //*************************************  Bitmask Opereations  **********************************//
// int Set(int N,int pos){return N=N | (1<<pos);}
// int reset(int N,int pos){return N= N & ~(1<<pos);}
// bool check(int N,int pos){return (bool)(N & (1<<pos));}
// //********************************************************************************************//

#define mod 1000000007

bool prime[1100]; 
void sieve(){
    prime[0]=1;

    for(register int i=2; i<1005;){

        for(register int j=i+i; j<1005; j+=i)prime[j]=1;

        for(++i;; i++)
            if(!prime[i])break;
    }
}

int main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    //#ifdef rid.dle//freopen("in.txt", "r", stdin);//#endif

    int n;
    string str;
    cin >> n >> str;

    int cur=0,ans=0;
    loop(i,n){
      (str[i]=='I'?cur++:cur--);
      ans=max(ans,cur);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;
const int iINF = 2147483647 / 2;
const long long int llINF = 9223372036854775807 / 2;

using namespace std;
using ll = long long int;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;

typedef pair<ll, ll> pll;
bool paircomp(const pll &a, const pll &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}

#define REP(i, n) for (ll i = 0; i < (n); i++)
#define RREP(i, n) for (ll i = (n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end())
#define MIN(vec) *std::min_element(vec.begin(), vec.end())
#define ARGMAX(vec)                                                            \
  std::distance(vec.begin(), std::max_element(vec.begin(), vec.end()))
#define ARGMIN(vec)                                                            \
  std::distance(vec.begin(), std::min_element(vec.begin(), vec.end()))
#define REV(T) greater<T>()
#define PQ(T) priority_queue<T, vector<T>, greater<T>>
#define VVL(a, b, c) vector<vector<ll>>(a, vector<ll>(b, c))
#define VV(T, a, b, c) vector<vector<T>>(a, vector<T>(b, c))
#define VVVL(a, b, c, d)                                                       \
  vector<vector<vector<ll>>>(a, vector<vector<ll>>(b, vector<ll>(c, d)))
#define VVV(T, a, b, c, d)                                                     \
  vector<vector<vector<T>>>(a, vector<vector<T>>(b, vector<T>(c, d)))
#define SP(a) setprecision(a)
#define SQRT(a) sqrt((long double)(a))
#define DPOW(a, b) pow((long double)(a), (long double)(b))
#define UNIQUE(vec)                                                            \
  do {                                                                         \
    sort(ALL((vec)));                                                          \
    (vec).erase(std::unique(ALL((vec))), (vec).end());                         \
  } while (0)

ll POW(ll n, ll m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = POW(n, m / 2);
    return (tmp * tmp);
  } else {
    return (n * POW(n, m - 1));
  }
}

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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll A;
  long double B;
  cin >> A >> B;
  ll C = A * B;
  // cout << A * BB << endl;
  // cout << fixed << (A * BB) / (ll)100 << endl;
  cout << C << endl;

  return 0;
}


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

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

  int max_num = 0;
  int start = -1;
  rep(i, s.length()) {
    if (s.at(i) == 'A' && start == -1) {
      start = i;
    } else if (s.at(i) == 'Z' && start != -1) {
      max_num = max(max_num, i - start + 1);
    }
  }

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

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

int main(){
  vector<int> A;
  int q, com, p, x;
  cin >> q;
  for(int i=0;i<q;i++){
    cin >> com;
    switch(com){
    case 0:
      cin >> p;
      A.push_back(p);
      break;
    case 1:
      cin >> x;
      cout << A[x] << endl;
      break;
    case 2:
      A.pop_back();
      break;
    }
  }
  return 0;
}



Measured memory_bytes: 3944
#include<stdio.h>
#include<string.h>

int main(void){
	int n,i,j,ret,l,corr,flg,max;
	char s[128],t[128];
	
	scanf("%d%*c",&n);
	scanf("%s%*c",s);
	scanf("%s%*c",t);
	corr=0;
	flg=0;
	max=0;
	for(i=0;i<n;i++){
		if(s[i]==t[0]){
			for(j=0;j<n;j++){
				if(s[i+j]!=t[j]){
					break;
				}else{
					corr++;
					if(i+j==n-1){
						flg=1;
						break;
					}
				}
			}
		}
		if(max<corr){
			max=corr;
			flg=0;
		}
		corr=0;
	}
	printf("%d\n",2*n-max);
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 9e18;
constexpr int inf = 1e9;
const double INFD = 1e100;
const ll mod = 1000000007;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
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やllをstringに変換
template<typename T> inline string toString(const T &a){
  ostringstream oss;
  oss << a;
  return oss.str();
};
// ---------------------------------------------------------------------------

int main(){
  int N;
  cin >> N;
  if(N == 1){
    cout << 1 << endl;
    cout << 0 << endl;
    return 0;
  }
  if(N == 2){
    cout << 2 << endl;
    cout << 0 << endl;
    cout << 11 << endl;
    return 0;
  }
  cout << N-1 << endl;
  for(int i=0; i<N-1; i++){
    string S = "";
    S += '1';
    S += string(i,'0');
    S += '1';
    cout << S << endl;
  }
  return 0;
}



Measured memory_bytes: 3216
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>

using namespace std;

int main(){
    int A,B;
    cin >> A >> B;
    if(B % A == 0 ){
        cout<< A + B << endl;
    }else{
        cout<< B - A<< endl;
    }

}


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

int main()
{
  int N, K;
  std::cin >> N >> K;
  long double ans = 0;
  for (int i = 1; i <= N; i++)
  {
    if (i >= K)
    {
      ans += (N-i+1)*1.0/N;
      break;
    }
    else
    {
      int tmp = i;
      long double tmp_ans = 1.0/N;
      while (tmp < K)
      {
        tmp *= 2;
        tmp_ans *= 0.5;
      }
      ans += tmp_ans;
    }
  }
  std::cout << std::fixed;
  std::cout << std::setprecision(12) << ans << std::endl;
}


Measured memory_bytes: 256
n,k,q = list(map(int, input().split()))
winners = [int(input()) for i in range(q)]
pts = [0]*n
for i in winners:
    pts[i-1] +=1
final_pts = []
for i in range(n):
    final_pts.append(k-q+pts[i])
for i in final_pts:
    if i > 0:
        print('Yes')
    else:
        print('No')


Measured memory_bytes: 58328
using System;

class Program
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        int taro = 0;
        int hanako = 0;
        for (int i = 0; i < n; i++)
        {
            string[] cards = Console.ReadLine().Split(' ');
            int compare =  String.Compare(cards[0], cards[1], true);
            if (compare > 0)
                taro += 3;
            else if (compare == 0)
            {
                taro += 1;
                hanako += 1;
            }
            else
                hanako += 3;
        }

        Console.WriteLine("{0} {1}", taro, hanako);
    }
}

Measured memory_bytes: 9820
#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <set>
using namespace std;
set<char> s;
int main()
{
    char str;
    while (cin>>str)
    {
     s.insert('a');s.insert('e');s.insert('i');
    s.insert('o'); s.insert('u');
    if (s.find(str)!=s.end())
        cout<<"vowel\n";
    else cout<<"consonant\n";
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(x) (x).begin(),(x).end()

using namespace std;
using ll = long long;


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

    int ans = 0;
    if (a == 1) {
        if (b == 2) ans = 3;
        else ans = 2;
    } else if (a == 2) {
        if (b == 1) ans = 3;
        else ans = 1;
    } else {
        if (b == 1) ans = 2;
        else ans = 1;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
def xorRange(x):
    #0^1^2^...^x
    if x%4 == 0:
        return x
    if x%4 == 1:
        return 1
    if x%4 == 2:
        return x+1
    if x%4 == 3:
        return 0

def f(a,b):
    return xorRange(a-1) ^ xorRange(b)

a,b = [int(x) for x in input().split()]
print(f(a,b))



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

int main()
{
  string S;cin>>S;
  
  for (int i=0;i<=2;i++)
  {
    if (S[i]==S[i+1])
    {
      cout<<"Bad"<<endl;
      return (0);
    }
  }
  
  cout<<"Good"<<endl;
   
}

Measured memory_bytes: 256
void main() {
  problem();
}

void problem() {
  auto a = scan!long;
  auto b = scan!long;
  auto c = scan!long;
  auto d = scan!long;

  long solve() {

    if ((b <= 0 && c >= 0) || (a >= 0 && d <= 0)) {
      return -1 * min(abs(a), abs(b)) * min(abs(c), abs(d));
    }

    return max(a*c, b*d);
  }

  solve().writeln;
}

// ----------------------------------------------

import std.stdio, std.conv, std.array, std.string, std.algorithm, std.container, std.range, core.stdc.stdlib, std.math, std.typecons, std.numeric;
T[][] combinations(T)(T[] s, in int m) {   if (!m) return [[]];   if (s.empty) return [];   return s[1 .. $].combinations(m - 1).map!(x => s[0] ~ x).array ~ s[1 .. $].combinations(m); }
string scan(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T scan(T)(){ return scan.to!T; }
T[] scan(T)(int n){ return n.iota.map!(i => scan!T()).array; }
void deb(T ...)(T t){ debug writeln(t); }
alias Point = Tuple!(long, "x", long, "y");

// -----------------------------------------------


Measured memory_bytes: 2760
#pragma region header
#include <bits/stdc++.h>
using namespace std;

#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_CAT_I(x,y) x ## y
//#define CPP_STR(x) CPP_STR_I(x)
//#define CPP_STR_I(args...) #args
//#define ASSERT(expr...) assert((expr))

using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
//using f80 = __float80;
#pragma endregion

#pragma region const
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#pragma endregion

#pragma region util
#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T(&)[N]) { return static_cast<i64>(N); }

template<typename T, typename U, typename Comp = less<>>
bool chmax(T& xmax, const U& x, Comp comp = {}) {
	if (comp(xmax, x)) {
		xmax = x;
		return true;
	}
	return false;
}
template<typename T, typename U, typename Comp = less<>>
bool chmin(T& xmin, const U& x, Comp comp = {}) {
	if (comp(x, xmin)) {
		xmin = x;
		return true;
	}
	return false;
}
#pragma endregion

#pragma region init
struct ProconInit {
	static constexpr int IOS_PREC = 15;
	static constexpr bool AUTOFLUSH = false;

	ProconInit() {
		cin.tie(nullptr);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(IOS_PREC);
		if (AUTOFLUSH)
			cout << unitbuf;
	}
} PROCON_INIT;
#pragma endregion

int main()
{
	i64 K;
	cin >> K;
	int k = 0;
	int g = 0;
	REP(i, K)
	{
		if (i % 2 == 0)
			g++;
		else
			k++;
	}
	cout << k*g << endl;
	return 0;
}


Measured memory_bytes: 256
/*
 * 角角画伯，かく悩みき
 * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1165&lang=jp
 *
 * 【メモ】
 * 座標の大きさが動的に変わるような座標シュミレート問題は
 * （例えば渦を巻いたり，縦横に予測できない動きをしたりするような問題）
 * 座標から配列の要素にアクセスするのではなく(map[x][y])，
 * 座標の要素としてためて(map.push_back(x); map_y.push_back(y);)から使う．
 */
#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<numeric>
#include<climits>
#include<ctime>
#include<cstring>
#include<sstream>
#define REP(i,p,n) for(int i=p;i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define rep_split(tok,a_str,re) for(char *tok = strtok((char *)a_str.c_str(),re); tok != NULL; tok = strtok(NULL,re))
#define ALL(c) (c).begin(), (c).end()
#define dump(a) cerr << #a << "=" << (a) << endl
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;
template<class T> void chmin(T &t, T f) { if (t > f) t = f; } //t=min
template<class T> void chmax(T &t, T f) { if (t < f) t = f; } //t=max
using namespace std;

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

int main() {
	int N;
	int n,d;
	int max_height,max_width;
	int min_height,min_width;
	vector<int> map_x;
	vector<int> map_y;

	while(cin >> N, N) {
		max_height = max_width=0;
		min_height = min_width=INT_MAX;
		map_x.clear(); map_y.clear();
		map_x.push_back(0); //0,0座標にIndex番号0を入る
		map_y.push_back(0);

		rep(i,N-1) {
			cin >> n >> d; //d=方向
			int x = map_x[n] + dx[d];
			int y = map_y[n] + dy[d];
			map_x.push_back(x); //座標をpushする
			map_y.push_back(y);
		}
		rep(i,map_x.size()) {
			chmax(max_width,map_x[i]);
			chmin(min_width,map_x[i]);
			chmax(max_height,map_y[i]);
			chmin(min_height,map_y[i]);
		}
		cout << max_width-min_width+1 << " " << max_height-min_height+1 << endl;
	}

	return 0;
}

Measured memory_bytes: 1220
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll MOD = (1e+9)+7;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-11;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
int main() {
	int x; cin >> x;
	if (x < 1200)cout << "ABC" << endl;
	else cout << "ARC" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <queue>
using namespace std;
struct edge {int to, cost;};
typedef pair<int,int> P;
const int MAX_V=100000,INF=1000000000;
int V,E,d[MAX_V],r,s,t,c,i;
vector<edge> G[MAX_V];
priority_queue<P,vector<P>,greater<P> >q;

void dijkstra(int s){
  fill(d,d+V,INF);
  d[s]=0;
  q.push(P(0,s));
  while(!q.empty()){
    P p=q.top();
    q.pop();
    int v=p.second;
    if(d[v]<p.first)continue;
    for(i=0;i<(int)G[v].size();i++){
      edge e=G[v][i];
      if(d[e.to]>d[v]+e.cost){
        d[e.to]=d[v]+e.cost;
        q.push(P(d[e.to],e.to));
      }
    }
  }
}

int main(){
  scanf("%d %d %d",&V,&E,&r);
  for(i=0;i<E;i++){
    scanf("%d %d %d",&s,&t,&c);
    edge e;
    e.to=t;e.cost=c;
    G[s].push_back(e);
  }
  dijkstra(r);
  for(i=0;i<V;i++){
    if(d[i]==INF)printf("INF\n");
    else printf("%d\n",d[i]);
  }
  return 0;
}



Measured memory_bytes: 12624
#include<bits/stdc++.h>
#define N 100003
using namespace std;
long long n,m,s[N],t[N],p[N],R[N],ans;
int main(){
  cin>>n>>m;
  for(int i=0;i<n;i++)cin>>s[i]>>t[i];
  for(int i=2;i<m+2;i++)cin>>p[i];
  sort(p,p+m+2);
  R[0]=R[1]=0;
  for(int i=2;i<m+2;i++)R[i]=R[i-2]+p[i]-p[i-1];
  for(int i=0;i<n;i++){
    bool f=1;
    int S=s[i],T=t[i];
    if(S>T)f=0,swap(S,T);
    int l=1,r=m+2,a,md;
    while(l<r){
      md=(l+r)/2;
      if(p[md]>S)r=md;
      else l=md+1;
    }
    a=r;
    l=1,r=m+2;
    while(l<r){
      md=(l+r)/2;
      if(p[md]>=T)r=md;
      else l=md+1;
    }
    r--;
    if(a==r+1)ans+=T-S;
    else{
      if((r-a)%2)ans+=R[r-1]-R[a]+p[a]-S+T-p[r];
      else{
	if(f)ans+=R[r]-R[a]+p[a]-S;
	else ans+=R[r-1]-R[a-1]+T-p[r];
      }
    }
  }
  cout<<ans<<endl;
  return 0;
}

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

#define EPS (1e-7)
#define INF 1e18
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define PI (acos(-1))

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


int main() {

    vector<int> a(3);
    cin >> a[0] >> a[1] >> a[2];

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

    int tmp = a[2] * 2 - a[0] - a[1];
    int ans;
    if (tmp % 2 == 0) ans = tmp / 2;
    else ans = (tmp + 3) / 2;

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<deque>
#include<unordered_map>
#include<unordered_set>
#include<queue>
#include<algorithm>
#include<cmath>
#include<numeric>
#include<iomanip>
using namespace std;

typedef long long LL;
const int MOD = 1e9+7;

void solve(){
	int a,b;
	cin>>a>>b;
	int h,m;
	cin>>h>>m;
	double theta1 = 30 * h;
	theta1 += 1.0*m/2.0;
	// theta1 *=M_PI/180.0;
	double theta2 = 6.0 * m;
	double res = sqrt(1.0 *a*a +1.0* b* b - 2.0 *a*b* cos(1.0* (theta1-theta2)*M_PI/180.0));
	cout<<fixed<<setprecision(20)<<res<<endl;

}


int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	int T = 1;
	// cin>>T;
	while(T--){
		solve();
	}
	return 0;
}


Measured memory_bytes: 4136
#include<bits/stdc++.h>
#include<math.h>
using namespace std;
int main(){
	int a,b[10],c;
	memset(b,0,sizeof(b));
	cin>>a;
	for(int j=0;j<10;j++){
		for(int i=1;pow(i,j+2)<=a;i++){
			b[j]=pow(i,j+2);
		}
	}
	for(int k=0;k<9;k++)
	{	
		for(int m=0;m<9;m++){
			if(b[m]<b[m+1]){
				c=b[m+1];
				b[m+1]=b[m];
				b[m]=c;
			}
		}
	}
	cout<<b[0];
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iostream>
#include <unordered_map>
#include <string>
#include <sstream>
#include <vector>

using namespace std;

struct City {
  int idx;
  int pref;
  int year;
  string id;
};

int main() {
  int N, M;
  cin >> N >> M;
  unordered_map<int, vector<City>> city_map;
  for (int m = 0; m < M; ++m) {
    int P, Y;
    cin >> P >> Y;
    city_map[P].push_back(City{m, P, Y});
  }
  vector<City> result;
  result.reserve(M);
  for (int n = 1; n <= N; ++n) {
    vector<City>& cities = city_map[n];
    if (cities.empty()) continue;
    sort(cities.begin(), cities.end(), [](const City& a, const City& b) {
      return a.year < b.year;
    });
    for (int i = 1, size = cities.size(); i <= size; ++i) {
      stringstream ss;
      City& city = cities[i-1];
      int p_unit = static_cast<int>(floor(log10(city.pref))) + 1;
      for (int j = p_unit; j < 6; ++j) {
        ss << "0";
      }
      ss << city.pref;
      int i_unit = static_cast<int>(floor(log10(i))) + 1;
      for (int j = i_unit; j < 6; ++j) {
        ss << "0";
      }
      ss << i;
      city.id = ss.str();
      result.push_back(city);
    }
  }
  sort(result.begin(), result.end(), [](const City& a, const City& b) {
    return a.idx < b.idx;
  });
  for (const City& city : result) {
    cout << city.id << endl;
  }
  return 0;
}

Measured memory_bytes: 18072
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;
typedef pair<int,int> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
#define getbit(n,i) (((n)&(1LL<<(i)))!=0)
#define setbit0(n,i) ((n)&(~(1LL<<(i))))
#define setbit1(n,i) ((n)|(1LL<<(i)))
#define togglebit(n,i) ((n)^(1LL<<(i)))
#define lastone(n) ((n)&(-(n)))
#define read freopen("debug\\in.txt","r",stdin)
#define write freopen("debug\\out.txt","w",stdout)
#define fi first
#define se second
#define getI(a) scanf("%d",&a)
#define getII(a,b) scanf("%d%d",&a,&b)
#define PI (acos(-1))
#define fastread ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define MOD (1000000007)
#define asz 500005
#define pb push_back
#define ppf pop_front
#define ppb pop_back
#define pf push_front
vector<ll>v[200005];
ll dis[2005][2005];
ll vis[2005];
ll cnt[5000005];
queue<ll>q;
int main(){
    fastread;
    ll n,i,j,k,l,m;
    cin>>n>>k>>l;
    for(i=1;i<n;i++){
        v[i].pb(i+1);
        v[i+1].pb(i);
    }
    v[k].pb(l);
    v[l].pb(k);
    for(i=1;i<=n;i++){
        memset(vis,0,(n+1)*sizeof(ll));
        q.push(i);
        vis[i]=1;
        dis[i][i]=0;
        while(!q.empty()){
            ll temp=q.front();
            q.pop();
            for(auto x: v[temp]){
                if(vis[x]==0){
                    vis[x]=1;
                    dis[i][x]=dis[i][temp]+1;
                    q.push(x);
                }
            }
        }
    }
    for(i=1;i<=n;i++){
        for(j=1;j<=n;j++){
            cnt[dis[i][j]]++;
        }
    }
    for(i=1;i<n;i++)
        cout<<cnt[i]/2<<"\n";
    return 0;
}

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

int main(){
	string s; cin >> s;
	s[2] == s[3] && s[4] == s[5] ? cout << "Yes" << endl : cout << "No" << endl; 
}

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


#define ll long long int
#define vll vector<ll>
#define vllv vector<vector<ll>> 
#define sz size()
#define pb push_back
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

ll ceil1(ll n,ll m){if(n%m==0){return n/m;}return n/m +1;}
vll factor(ll n){
    vll ans;
    if(n>0)ans.pb(1);if(n==2)ans.pb(2);
    for(ll i=2;i*i<=n;i++){if(n%i==0){ans.pb(i);if(n/i!=i)ans.pb(n/i);}}if(n>2)ans.pb(n);
    return ans;
}
ll fact(ll n){
	
    ll res = 1; 
    for (ll i = 2; i <= n; i++) 
        res = res * i; 
    return res; 
} 
  
int nCr(ll n, ll r) 
{ 
    return fact(n) / (fact(r) * fact(n - r)); 
} 
  
void dfs(vllv &v,ll k,vll &par,vll &dis,ll p)
{
 
    par[k]=p;
    dis[k]=dis[p]+1;
    for(ll i=0;i<v[k].sz;i++){
        if(v[k][i]!=p){
            dfs(v,v[k][i],par,dis,k);
        }
    }
}
bool sortbysec(const pair<string,int> &a,const pair<string,int> &b){return (a.second<b.second);} 


ll ston(string s) 
{ 
    stringstream geek(s); 
    ll x = 0; 
    geek >> x; 
    
  
    return x; 
}
ll pow2(ll n,ll k){ll ans=1;
    while(k>0){
        if(k%2==1)ans=ans*n;n=n*n;k/=2;
    }return ans;}
bool prime(int n){
    int i,j;
    for(i=2;i<=sqrt(n);i++){
        if(n%i==0){
            return false;
        }
    }
    return true;
}
bool bserch(vector<string> a, string s){
	
	ll l=0,r=a.sz-1,mid;
	while(l<=r){
		mid=(l+r)/2;
		if(a[mid]==s)return true;
		if(a[mid]<s){
			l=mid+1;
		}else{
			r=mid-1;
		}
	}
	return false;
}

bool sortcol( const vector<int>& v1, 
               const vector<int>& v2 ) { 
 return v1[0] < v2[0]; 
} 

 ll degit(ll n)
 {
 	ll t=0;
 	while(n>0)
 	{
 		t++;
 		n/=10; 	}
 		return t;
 }
 

void solve()
{
	ll a,b,c;
	cin>>a>>b>>c;
	if(c>=a && c<=b)
		cout<<"Yes";
	else
		cout<<"No";
	return;
}

int main()
{
	fast;
    ll q;
    q=1;
    // cin>>q;
    while(q--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

struct UnionFind {
	vector<int> v;
	UnionFind(int n) : v(n)  { for (int i = 0; i < n; i++) v[i] = i; }
	int  find(int x)         { return v[x] == x ? x : v[x] = find(v[x]); }
	void unite(int x, int y) { v[find(x)] = find(y); }
};

int main() {
	int n;
	string s;
	cin >> n >> s;
	int l = 0;
	int r = 0;
		while (l<n&&s[l] == '<') {
			l++;
		}
		while (r<n &&s[n-1-r] == '>') {
			r++;
		}
	cout << n - min(l, r) << endl;
}

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


struct BIT{
	vector<int> seg;
	// [1,n]
	BIT(int N){
		seg.resize(N+1,0);
	};
	int get(int i){
		int ans = 0;
		for(;i;i-=i&-i){
			ans = ans+seg[i];
		}
		return ans;
	}
	void add(int i,int x){
		for(;i<seg.size();i+=i&-i){
			seg[i] = seg[i]+x;
		}
	}
	int get(int l,int r){
		return get(r) - get(l-1);
	}
};

void solve(long long N, vector<long long> A){
	vector<long long> B = A;
	sort(B.begin(),B.end());
	B.erase(unique(B.begin(),B.end()),B.end());
	BIT seg(B.size() + 1);
	for(int i = 0 ; i < A.size() ; i++){
		A[i] = lower_bound(B.begin(),B.end(),A[i]) - B.begin();
	}
	long long ans = 0;
	for(int i = 0 ; i < A.size() ; i++){
		if( (i%2) ^ (A[i]%2) ){
			ans++;
		}
	}
	cout << (ans+1) / 2  << endl;
}



int main(){	
	ios::sync_with_stdio(false);
	long long N;
	cin >> N;
	vector<long long> A(N-1+1);
	for(int i = 0 ; i <= N-1 ; i++){
		cin >> A[i];
	}
	solve(N, A);
	return 0;
}


Measured memory_bytes: 2944
def solve():
    from collections import deque
    from sys import stdin
    f_i = stdin
    
    ans = []
    while True:
        m, c, n = map(int, f_i.readline().split())
        if m == 0:
            break
        
        book_pos = dict()
        studens = deque()
        shelf = m + 1
        
        for i in range(n):
            k = int(f_i.readline())
            books = deque(map(int, f_i.readline().split()))
            for b in books:
                book_pos[b] = shelf
            studens.append(books)
        
        desk = [0] * (m + 1) # number of books on the desk
        D1 = deque()
        cost = 0
        
        while studens:
            s = studens.popleft()
            b = s.popleft()
            
            # get the book
            pos = book_pos[b]
            cost += pos
            if pos == 1:
                D1.remove(b)
            elif pos != shelf:
                desk[pos] -= 1
            
            if len(D1) == c:
                for i, cnt in enumerate(desk[2:], start=2):
                    if cnt < c:
                        # put the book on the i-th desk
                        desk[i] += 1
                        book_pos[b] = i
                        cost += i
                        b_pos = i
                        break
                else:
                    # put the book on the shelf
                    book_pos[b] = shelf
                    cost += shelf
                    b_pos = shelf
                    
                # get the unrequested book on D1
                unrequested = D1.popleft()
                cost += 1
                
                if b_pos == shelf:
                    # put the unrequested book to the shelf
                    book_pos[unrequested] = shelf
                    cost += shelf
                else:
                    for i, cnt in enumerate(desk[b_pos:], start=b_pos):
                        if cnt < c:
                            # put the unrequested book to i-th desk
                            desk[i] += 1
                            book_pos[unrequested] = i
                            cost += i
                            break
                    else:
                        # put the unrequested book to the shelf
                        book_pos[unrequested] = shelf
                        cost += shelf
                
                # take the book from the temporary place to D1
                if b_pos != shelf:
                    desk[b_pos] -= 1
                D1.append(b)
                book_pos[b] = 1
                cost += (b_pos + 1)
            else:
                # return the book to D1
                D1.append(b)
                book_pos[b] = 1
                cost += 1
            
            if s:
                studens.append(s)
        
        ans.append(cost)
    
    print('\n'.join(map(str, ans)))

solve()


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

int main ()
{
    int n, x, a;
    int N;
    cin >> N;
    if (0 < N)
    {
        cin >> a;
        n = x = a;
        --N;
    }
    for (; N > 0; --N)
    {
        cin >> a;
        if (a < n) n = a;
        else if (x < a) x = a;
    }

    cout << x - n << endl;
    return 0;
}

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

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifdef LOCAL
#define debug(x...) cerr <<"at line "<< __LINE__<<": [" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
 
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;


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

template<class T> 		
using ordered_mset= tree<T, null_type, 
		less_equal<T>, 
		rb_tree_tag, tree_order_statistics_node_update> ;
		
*/
 
/*
 
PBDS
-------------------------------------------------
			0 based indexing
-------------------------------------------------			 
1) insert(value)
2) erase(value)
3) order_of_key(value) // Number of items strictly smaller than value
4) *find_by_order(k) : K-th element in a set (counting from zero)
 
*/
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
 
//mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());	

const int mx=1e6+5;

map<int,int>mp;

bool factorize(int n)
{
	set<int>fact;
	
	for(int i=1;i*i<=n;i++)
	{
		if(n%i==0)
		{
			fact.insert(i);
			fact.insert(n/i);
		}
	}
	
	for(int x: fact)
	{
		if(x!=n && mp[x])
		{
			return false;
		}
	}
	
	return mp[n]==1;
}

void solve()
{
	int n;
	cin>>n;
	
	vector<int>vec(n);
	
	for(int &x: vec) cin>>x;
	
	for(int x: vec) mp[x]++;
	
	int ans=0;
	
	for(int x: vec)
	{
		if(factorize(x)) ans++;
	}
	
	cout<<ans;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	
	solve();
	
	#ifdef LOCAL
	cerr<<"\nTime elapsed: " << 1000.0 * clock() / CLOCKS_PER_SEC << " ms\n";
	#endif
	
	
	return 0;
}


Measured memory_bytes: 32988
#include<stdio.h>
int main()
{
    int a,b,c,t;
    t = 0;
    scanf("%d %d %d",&a,&b,&c);
    for(;a<=b;a++)
    {
        if(c%a==0)
        {
            t++;
        }
    }
    printf("%d\n",t);
    return 0;
}

Measured memory_bytes: 596
#include <algorithm>
#include <iostream>
#include <string>
#include <random>
#include <cassert>
#include <cstring>
#include <chrono>
 
using namespace std;
 
typedef long long ll;
 
bool Check(vector<int> a, int m) {
  int n = a.size();
  vector<pair<int, int>> rle;
 
  for (int i = 0; i < n; ++i) {
    int diff = a[i] - (i > 0 ? a[i - 1] : 0);
    if (diff > 0) {
      rle.push_back({0, diff});
      continue;
    }
 
    while (diff < 0) {
      int take = min(-diff, rle.back().second);
      diff += take;
      rle.back().second -= take;
      if (rle.back().second == 0) {
        rle.pop_back();
      }
    }
 
    int numDigits = 0;

    while (!rle.empty() && rle.back().first == m - 1) {
      numDigits += rle.back().second;
      rle.pop_back();
    }
    if (rle.empty()) return false;
 
    int curValue = rle.back().first;
    int curLen = rle.back().second;
    rle.pop_back();

    if (curLen > 1) {
      rle.push_back({curValue, curLen - 1});
    }
    rle.push_back({curValue + 1, 1});
 
    if (numDigits > 0) {
      rle.push_back({0, numDigits});
    }
 
  }
  return true;
}
 
int main()
{
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
 
  int l = 0; int r = n;
  while (r - l > 1) {
    int m = (l + r) / 2;
    if (Check(a, m)) {
      r = m;
    } else {
      l = m;
    }
  }
  int result = r;
  cout << result << endl;
 
  return 0;
}



Measured memory_bytes: 5476
#include<cstdio>
#include<cstring>
#include<cmath>
#include<bitset>
#include<iostream>
#include<algorithm>
#include<string>
#include<utility>
#include<tuple>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<numeric>
#include<functional>
#include<iomanip>
#include<random>

#define IOS ios::sync_with_stdio(false),cin.tie(0)
#define REP(i,n) for(int i = 0;i < n;i++)
#define FOR(i,a,b) for(int i = a;i < b;i++)
#define MEM(a,b) memset(a,b,sizeof(a))
#define ALL(x) (x).begin(),(x).end()
#define LMAX 9223372036854775807
#define LMIN -9223372036854775808

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ull, ull> UP;
typedef tuple<int, int, int> T;

struct UnionFind {
	vector<int> data;
	UnionFind(int size) : data(size, -1) {}
	void unionSet(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;
		}
	}
	bool findSet(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)];
	}
};

ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	int k = a % b;
	if (k == 1)return 1;
	if (k == 0)return b;
	int ans = gcd(b, k);
	return ans;
}
ll digisum(ll a) {
	int sum = 0;
	while (a) {
		sum += a % 10;
		a /= 10;
	}
	return sum;
}
ll countpow(ll a, ll b) {
	int ans = 0;
	if (b == 0)return -1;
	while (1) {
		if (a % b == 0) {
			a /= b;
			ans++;
		}
		else break;
	}
	return ans;
}


int main() {
	int n, m;
	cin >> n;
	m = digisum(n);
	cout << (n % m == 0 ? "Yes" : "No") << endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define mod (ll)(1e9+7)
//a = res or M
#define FOR(i,a,b,c) for(ll i = a;i < b;i++)
const ll p = 50;
ll n;

void multiply(ll a[p][p], ll b[p][p]) {
    ll mul[p][p]; 
    FOR(i,0,p,1) { 
        FOR(j,0,p,1){ 
            mul[i][j] = 0LL; 
            FOR(k,0,p,1){ 
                mul[i][j] = (mul[i][j] + (a[i][k]*b[k][j])) % mod;
            }
        } 
    } 
    FOR(i,0,p,1) 
        FOR(j,0,p,1) 
            a[i][j] = mul[i][j];
} 

void findPow(ll M[p][p],ll exp){
    ll res[p][p];
    memset(res,0LL,sizeof res);
    for(ll i = 0;i < n;i++) res[i][i] = 1LL;
    while(exp>0){
        if(exp&1) multiply(res,M);
        multiply(M,M);
        exp >>= 1LL;
    }
    FOR(i,0,p,1) 
        FOR(j,0,p,1) 
            M[i][j] = res[i][j];
}

int main(){
	ll k;
	ll M[p][p];
	memset(M,0,sizeof M);
	cin >> n >> k;
	for(ll i = 0;i < n;i ++){
		for(ll j = 0;j < n;j++){
			cin >> M[i][j];
		}
	}
	findPow(M,k);
	ll ans = 0LL;
	for(ll i = 0;i < n;i++) for(ll j = 0;j < n;j++) ans = (ans + M[i][j]) % mod;
	cout<<ans<<"\n";
}

Measured memory_bytes: 3704
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn main() {
    let s:String = read();
    println!("{}", if s == "AAA" || s == "BBB" { "No" } else { "Yes" });
}


Measured memory_bytes: 4352
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<map>
#include<iostream>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x.begin(), _x.end(), std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
int main() {
	int l, c = 0;
	char s[100001];
	scanf("%s", s);
	l = strlen(s);
	rep(i, 0, l - 1) {
		if (s[i] != s[i + 1])c++;
	}
	printf("%d\n",c);
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
    int a[100005],b[100005],c[100005],n;
    long long ans=0,nowa=0,nowc=0;
    scanf("%d",&n);
    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++) scanf("%d",&c[i]);
    sort(a,a+n);sort(b,b+n);sort(c,c+n);

    for (int i=0;i<n;i++)
        {
            while ((a[nowa]<b[i])&&(nowa<n)) nowa++;
            while ((c[nowc]<=b[i])&&(nowc<n)) nowc++;
            ans=ans+nowa*(n-nowc);
        }
    printf("%lld\n",ans);
    return 0;
}



Measured memory_bytes: 1536
def chmin(a, b):
    if a > b:
        a = b
    return a

n, k = map(int, input().split())
h = list(map(int, input().split()))

dp = [10**9+10]*n
dp[0] = 0

for i in range(n):
    for j in range(1, k+1):
        if i + j < n:
            dp[i+j] = chmin(dp[i+j], dp[i]+abs(h[i]-h[i+j]))

print(dp[-1])

Measured memory_bytes: 52448
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n, x int
	fmt.Scan(&n, &x)
	as := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&as[i])
	}
	sort.Ints(as)

	ans := 0
	for i := 0; i < n; i++ {
		if as[i] <= x {
			ans++
		}
		x -= as[i]
	}
	if 0 < ans && 0 < x {
		ans--
	}

	fmt.Println(ans)
}


Measured memory_bytes: 1844
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int x, y;
    cin >> x >> y;

    if(x == 2){
        if(y == 2)
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
    }else if(x == 4 || x == 6 || x == 9 || x == 11){
        if(y == 4 || y == 6 || y == 9 || y == 11)
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
    }else{
        if(y == 1 || y == 3 || y == 5 || y == 7 || y == 8 || y == 10 || y == 12)
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
    }

}

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

#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define eb emplace_back
#define rep(i, a, b) for (long i = (a); i <= (b); ++i)
#define per(i, a, b) for (long i = (a); i >= (b); --i)
#define mmst(v) memset(v, 0, sizeof(v))

template<typename T1,typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1,typename T2> inline void chmax(T1 & a, T2 b) { if (a < b) a = b; }

const long kMax2 = 109;
const long kMax3 = 1009;
const long kMax4 = 10009;
const long kMax5 = 100009;
const long kMax6 = 1000009;
const long kMax9 = 1000000010;
const long kInfI = 0x3F3F3F3F;
const float kInfF = 1e15;
const long long kMod = 1000000007;

const long long kMAX = 1000000000;

using namespace std;
using ll = long long;

inline int readInt() {
  char c = getchar();
  while(!isdigit(c) && c != '-') c = getchar();
  int sigma = 1;
  if (c == '-') {
    sigma = -1;
    c = getchar();
  }
  int x = 0;
  while (isdigit(c)) {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return x * sigma;
}

template <class T>
void PrintVector(const vector<T> & v) {
  for (const auto & e: v) {
    cout << e << endl;
  }
}

template <class T>
void PrintVector(const vector<T> & v, int n) {
  rep(i, 0, n - 1) {
    cout << v[i] << endl;
  }
}

double dist(double lhs, double rhs) {
  return sqrt(lhs * lhs + rhs * rhs);
}

ll gcd(ll x, ll y) {
  if (y == 0) return x;
  return gcd(y, x % y);
}

int main() {
  ll ans = 0;
  long n, m, a, b, x, y;
  string s, t;
  vector<string> ss;
  vector<ll> aa;
  vector<ll> ba;
  vector<ll> xx;
  vector<ll> yy;

  cin >> a >> b;


  cout << a * b / gcd(a, b) << endl;

  return 0;
}


Measured memory_bytes: 256
/*
 * Created by Dipta Das on 29-06-2019
 * Title: 
 * Problem Link: 
 * Editorial: 
 * Source Code: 
 * Comments: 
*/

#include <bits/stdc++.h>
#include <stdio.h>
#define fin freopen("input", "r", stdin)
#define whatis(x) cerr << #x << ": " << x << endl;

using namespace std;
using ll = long long;
int ar[200];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    string s;
    cin >> s;
    int n = 4;

    memset(ar, 0, sizeof(0));

    int cnt = 0;
    for (int i = 0; i < n; ++i) {
        if (ar[(int) s[i]] == 0) ++cnt;
        ++ar[(int) s[i]];
    }

    if (cnt == 2) cout << "Yes" << endl;
    else cout << "No" << endl;

    


    return 0;
}



Measured memory_bytes: 256
// In god we trust
 
#include <bits/stdc++.h>
#include <chrono>
#include <algorithm>
#include <signal.h>
#include <thread>
 
#define pb push_back
#define fi first
#define se second
#define Vi vector<int>
#define Vb vector<bool>
#define Pi pair<int, int>
#define MP make_pair
#define MT make_tuple
#define Q queue
#define Qi Q<int>
#define INF 1000000000 
#define LINF 1000000000000000000
#define int long long
using namespace std;
using namespace std::chrono;

unordered_map<int, int> factor(int n){
  int cnt = 0;
  unordered_map<int, int> m;
  int nn = n;
  while (!(nn & 1))
    cnt++, nn /= 2;
  if(cnt)
    m[2] = cnt;
  for (int i = 3; i <= sqrt(n); i++){
    cnt = 0;
    while(nn % i == 0)
      nn /= i, cnt++;
    if (cnt)
      m[i] = cnt;
  }
  if (nn > 2)
    m[nn] = 1;
  
  return m;
}


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

  
  int a;
  double b;
  cin >> a >> b;
  cout << (int) (a * (int)round(b * 100))/ 100 << endl;
  
}


Measured memory_bytes: 3764
apt = Array.new( 4 ){ Array.new( 3 ){ Array.new( 10, 0 ) } }

gets
while ( info = gets )
  b, f, r, v = info.split.map(&:to_i)
  apt[ b-1 ][ f-1 ][ r-1 ] += v
end
apt.each.with_index(0) do | bldg, i |
  puts "#"*20 if i > 0
  bldg.each do | floor |
    puts " "+floor.join( " " )
  end
end

Measured memory_bytes: 6124
#include<algorithm>/*{{{*/
#include<cctype>
#include<cassert>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<ctime>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<vector>
using namespace std;
typedef long long lld;
typedef long double lf;
typedef unsigned long long uld;
typedef pair<int,int> pii;
#define fi first
#define se second
#define pb push_back
#define mk make_pair
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define ROF(i,a,b) for(int i=(a);i>=(b);--i)
namespace RA{
    int r(int p){return 1ll*rand()*rand()%p;}
    int r(int L,int R){return r(R-L+1)+L;}
}/*}}}*/
/******************heading******************/
const int N=1000;

int n,P;
int F[N][N];

int f(int i){ return sqrt(n*n-i*i-1)+1; }
int g(int i){ return min(n*2,(int)sqrt(4*n*n-i*i)+1); }
int sig(int x){ return 1-2*(x&1); }
pair<int,int> A[N*3];
int lh;
int b[N];

signed main(){
    scanf("%d%d",&n,&P);
    FOR(i,0,n-1)A[++lh]={f(i),1};//a
    FOR(i,0,n-1)A[++lh]={g(i),3};//b
    FOR(i,n,n*2-1)A[++lh]={g(i),2};//c
    sort(A+1,A+lh+1);
    int pos=n*2;
    FOR(i,1,n*2){
        assert(A[i].se!=3);
        if(A[i].se==1) b[i]=++pos;
    }
    assert(pos==n*3);
    int ans=0;
    FOR(k,0,n){
        int C=0;//统计之前出现过多少个c
        F[0][0]=1;
        FOR(i,1,n*2){
            FOR(j,0,k) F[i][j]=0;
            if(A[i].se==1){//a
                FOR(j,0,k) F[i][j]=(1ll*F[i-1][j]*(A[b[i]].fi-((i-1-C-j)+n+k))%P+(j==0?0ll:1ll*F[i-1][j-1]*(A[i].fi-(j-1+C))))%P;
            }else {//c
                FOR(j,0,k) F[i][j]=F[i-1][j]*1ll*(A[i].fi-(j+C))%P;
                ++C;
            }
        }
        ans=(ans+F[n*2][k]*sig(k))%P;
    }
    ans=(ans+P)%P;
    printf("%d\n",ans);
    return 0;
}


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

typedef pair<int,int> pint;
typedef pair<pint,pint> ppint;

int main(){
    int H,W;
    cin>>H>>W;
    vector<vector<int> > a(H,vector<int>(W,0));
    int odd=0;
    for(int i=0;i<H;i++) for(int j=0;j<W;j++){
        cin>>a[i][j];
        if(a[i][j]&1)odd++;
    }

    vector<ppint> res;
    int num=0;
    int x=0, y=0;
    for(int iter=0;iter<W*H; iter++){
        if(a[x][y]&1)num++;

        int nx=x,ny=y;
        if(x%2==0){
            if(ny==W-1)nx++;
            else ny++;
        }
        else{
            if(ny==0)nx++;
            else ny--;
        }
        if(num&1)if(num<odd)res.push_back(ppint(pint(x,y),pint(nx,ny)));
        x=nx,y=ny;
    }

    cout<<res.size()<<endl;
    for(auto p:res){
        cout<<p.first.first+1<<" "<<p.first.second+1<<" "<<p.second.first+1<<" "<<p.second.second+1<<endl;
    }
}

Measured memory_bytes: 5232