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

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

  string ans;
  int num = 0;
  for (int i = 0; i < s.size(); i++)
  {
    if (s.at(i) == '0')
    {
      ans.push_back('0');
      num++;
    }
    else if (s.at(i) == '1')
    {
      ans.push_back('1');
      num++;
    }
    else
    {
      if (num == 0)
        continue;
      else
      {
        ans.pop_back();
        num--;
      }
    }
  }
  cout << ans << endl;
}


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

int main()
{
	std::string week[]{"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
	std::string S;
	std::cin >> S;
	for (int i{}; i < 7; i++)
		if (S == week[i])
			printf("%d\n", 7 - i);

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> pi;
#define f first
#define s second
#define FAST ios_base::sync_with_stdio(0); cin.tie(0);
const int maxn = 100010;

int a,b,c,k;

int32_t main() {
	FAST
	cin >> a >> b >> c >> k;
	int ans = 0;
	ans += min(a,k);
	k -= ans;
	if (k > 0) k -= b;
	if (k > 0) ans -= min(c,k);
	cout << ans;
}







Measured memory_bytes: 3652
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<string.h>
#include<complex>
using namespace std;
typedef long long int llint;
#define rep(i,n) for(int i=0;i<n;i++)
int main() {
	int h, w;
	char s[51][51];
	cin >> h >> w;
	rep(i, h) {
		cin >> s[i];
	}
	int cnt;
	rep(i, h) {
		rep(j, w) {
			if (s[i][j] == '.') {
				cnt = 0;
				if (i == 0) {
					if (j == 0) {
						if (s[i + 1][j] == '#') {
							cnt++;
						}
						if (s[i][j + 1] == '#') {
							cnt++;
						}
						if (s[i + 1][j + 1] == '#') {
							cnt++;
						}
					}
					else if (j != w - 1) {
						if (s[i][j - 1] == '#') {
							cnt++;
						}
						if (s[i][j + 1] == '#') {
							cnt++;
						}
						if (s[i + 1][j - 1] == '#') {
							cnt++;
						}
						if (s[i + 1][j] == '#') {
							cnt++;
						}
						if (s[i + 1][j + 1] == '#') {
							cnt++;
						}
					}
					else {
						if (s[i][j - 1] == '#') {
							cnt++;
						}
						if (s[i + 1][j] == '#') {
							cnt++;
						}
						if (s[i + 1][j - 1] == '#') {
							cnt++;
						}
					}
				}
				else if (i != h - 1) {
					if (j == 0) {
						if (s[i - 1][j] == '#') {
							cnt++;
						}
						if (s[i - 1][j + 1] == '#') {
							cnt++;
						}
						if (s[i][j + 1] == '#') {
							cnt++;
						}
						if (s[i + 1][j] == '#') {
							cnt++;
						}
						if (s[i + 1][j + 1] == '#') {
							cnt++;
						}
					}
					else if (j != w - 1) {
						if (s[i - 1][j - 1] == '#') {
							cnt++;
						}
						if (s[i - 1][j] == '#') {
							cnt++;
						}
						if (s[i - 1][j + 1] == '#') {
							cnt++;
						}
						if (s[i][j - 1] == '#') {
							cnt++;
						}
						if (s[i][j + 1] == '#') {
							cnt++;
						}
						if (s[i + 1][j - 1] == '#') {
							cnt++;
						}
						if (s[i + 1][j] == '#') {
							cnt++;
						}
						if (s[i + 1][j + 1] == '#') {
							cnt++;
						}
					}
					else {
						if (s[i + 1][j - 1] == '#') {
							cnt++;
						}
						if (s[i + 1][j] == '#') {
							cnt++;
						}
						if (s[i][j - 1] == '#') {
							cnt++;
						}
						if (s[i - 1][j - 1] == '#') {
							cnt++;
						}
						if (s[i - 1][j] == '#') {
							cnt++;
						}
					}
				}
				else {
					if (j == 0) {
						if (s[i - 1][j] == '#') {
							cnt++;
						}
						if (s[i][j + 1] == '#') {
							cnt++;
						}
						if (s[i - 1][j + 1] == '#') {
							cnt++;
						}
					}
					else if (j != w - 1) {
						if (s[i][j - 1] == '#') {
							cnt++;
						}
						if (s[i][j + 1] == '#') {
							cnt++;
						}
						if (s[i - 1][j - 1] == '#') {
							cnt++;
						}
						if (s[i - 1][j] == '#') {
							cnt++;
						}
						if (s[i - 1][j + 1] == '#') {
							cnt++;
						}
					}
					else {
						if (s[i][j - 1] == '#') {
							cnt++;
						}
						if (s[i - 1][j] == '#') {
							cnt++;
						}
						if (s[i - 1][j - 1] == '#') {
							cnt++;
						}
					}
				}
				cout << cnt;
			}
			else {
				cout << "#";
			}
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>

using namespace std;

int a[200010];

int main() {
    int n; scanf("%d", &n);
    for(int i=0; i<n; ++i){
        a[i] = 30000 * i + 1;
    }
    for(int i=0; i<n; ++i){
        int p; scanf("%d", &p);
        a[p-1] += i;
    }

    for(int i=0; i<n; ++i){
        printf("%d", a[i]);
        if(i==n-1) puts(""); else printf(" ");
    }

    for(int i=0; i<n; ++i){
        printf("%d", 30000 * (n - i));
        if(i==n-1) puts(""); else printf(" ");
    }

    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>
#include <numeric>
#include <iomanip>
#include <cstring> 
using namespace std;
using ll=long long;

#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define LLONG_MAXs 9223372036854775800

#include <iostream>
#include <cmath>
using namespace std;
 

 
bool isPrimeNum( ll x ){ // 素数である場合 true を返す
  if( x <= 1 ){ // 1以下である場合は素数でないことがすぐにわかる
    return false;
  }
  // sqrt( double型 ) は引数の平方根を double型で返すので、int型でキャスト
  int n = (int)sqrt( (double)x );
  for( int i = 2; i <= n; i++ ){
    if( x % i == 0 ){ // 割り切る整数がある場合、即判定終了
      return false;
    }
  }
  return true; // 割り切る整数がない場合、素数である
}

constexpr ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
constexpr ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll abs(ll a,ll b){
if(a>=b)return a-b;
if(a<b)return b-a;
}
constexpr ll min(ll a,ll b){
if(a>=b)return b;
if(a<b)return a;
}

constexpr ll max(ll a,ll b){
if(a>=b)return a;
if(a<b)return b;
}

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

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main() {
  ll ans=9999999999999;
  ll A,B,C,X,Y;

  cin>>A>>B>>C>>X>>Y;


  FOR(i,0,200000000){
    ll tmp=999999999999;
//cout<<i<<" "<<ans<<endl;
    tmp=i*C;

    tmp=tmp+max((X-i/2),0)*A;

    tmp=tmp+max((Y-i/2),0)*B;
//cout<<i<<" "<<ans<<endl;
    ans=min(ans,tmp);
  }


cout<<ans<<endl;
return 0;

}
 


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

using namespace std;

#define pb push_back
#define mp make_pair
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long LL;
typedef pair<int, int> PII;

int n, m;
vector<int> g[100000];
int col[100000];
bool bip = true;
int cnt[2];

void dfs(int v, int c) {
    col[v] = c;
    ++cnt[c];
    for (int to : g[v]) if (col[to] == -1) {
        dfs(to, c ^ 1);
    } else {
        if (col[to] != (c ^ 1)) {
            bip = false;
        }
    }
}

int main() {
    scanf("%d%d", &n, &m);
    forn(i, m) {
        int from, to;
        scanf("%d%d", &from, &to), --from, --to;
        g[from].pb(to);
        g[to].pb(from);
    }
    memset(col, -1, sizeof col);
    dfs(0, 0);
    LL ans;
    if (!bip) {
        ans = (LL)n * (n - 1) / 2;
    } else {
        ans = (LL)cnt[0] * cnt[1];
    }
    ans -= m;
    cout << ans << endl;
    return 0;
}


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

#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define intll int long long

int main() {
  int n , t ;
  cin >> n >> t ;
  int ans = 1000000;
  
  rep(i,n){
    int a, b ;
    cin >> a >> b ;
    if(b <= t ){
      ans = min(ans,a);
    }
  }
  
  if(ans >=  1000000)
    cout <<"TLE";
  
  else 
    cout << ans ;
      


}


Measured memory_bytes: 256
import itertools
N,M,Q = map(int, input().split())
a = [0]*Q
b = [0]*Q
c = [0]*Q
d = [0]*Q
for i in range(Q):
    a[i],b[i],c[i],d[i] = map(int, input().split())

ans = 0

for L in list(itertools.combinations_with_replacement(range(1,M+1),N)):
    now = 0
    for i in range(Q):
        if L[b[i]-1] - L[a[i]-1] == c[i]:
            now += d[i]
    ans = max(ans, now)

print(ans)

Measured memory_bytes: 21432
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  vector<string> W(N);
  for(int i=0;i<N;i++){
    cin >> W[i];}
  vector<int> a(N);
  for(int i=0;i<N;i++){
    a[i]=W[i].size();}
  string ans="Yes";
  for(int i=0;i<N-1;i++){
    if(W[i][a[i]-1]!=W[i+1][0]){
      ans="No";}
  }
  int b;
  for(int i=0;i<N;i++){
    b=0;
    for(int j=0;j<N;j++){
      if(W[i]==W[j]){b++;}
    }
    if(b!=1){ans="No";}
  }
  cout << ans << endl;
}
        
    

Measured memory_bytes: 256
n, m = map(int, input().split())
h = list(map(int, input().split()))
list1 = [1] * n
for _ in range(m):
    a, b = map(int, input().split())
    if h[a - 1] <= h[b - 1]:
        list1[a - 1] = 0
    if h[a - 1] >= h[b - 1]:
        list1[b - 1] = 0
print(sum(list1))

Measured memory_bytes: 20112
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store") // to restrict undesirable precision
#pragma GCC optimize ("-fno-defer-pop")// to pop argument of function as soon as it returns
#define all(a) a.begin(),a.end()
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m)%m; t=(t*t)%m; if(b&1) t=((t%m)*(a%m))%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ps push_back
#define fs first
#define sc second
#define takeline cin.ignore();
#define iactive cout.flush();
#define N 3000005
#define endl "\n"
#define mod 1000000007
#define PI 3.141592653589793
//((1.0l)*BIG MULTIPLY MAGIC?)
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
//-----------------------------------------------
int main(){

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

	ll l,r,d,i,c=0;
	ll n;
	cin>>n;
	ll ar[n+1];
	for(i=1;i<=n;i++){
		cin>>ar[i];
		if(i%2&&ar[i]%2){
			c++;
		}
	}
	cout<<c;
	return 0;	
}

Measured memory_bytes: 3616
#include<algorithm>
#include<iostream>
#include<cstring>
#include<fstream>
#include<cstdio>
#include<string>
#include<vector>
#include<cmath>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<list>
#define LL long long
#define FF(i,a,b) for(int i=a;i<=b;++i)
#define RR(i,a,b) for(int i=a;i>=b;--i)
#define SC(x) scanf("%d",&x)
#define SCC(x,y) scanf("%d%d",&x,&y)
#define SCCC(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define SS(x) scanf("%s",x)
#define PR(x) printf("%d\n",x)
#define CL(a,b) memset(a,b,sizeof(a))
#define ll rt<<1
#define rr rt<<1|1
#define mid int m=(x+((y-x)>>1))
#define lson x,m,rt<<1
#define rson m+1,y,rt<<1|1
#define lowbit(x) (x&-x)
#define PB push_back
#define pii pair<int, int>
#define mp(x, y) make_pair(x, y)
#define IN freopen("in.txt","r",stdin)
#define OUT freopen("out.txt","w",stdout)
#define fi freopen("input.txt","r",stdin); freopen("output.txt","w",stdout)
using namespace std;

const int N = 1e5 + 10;
const int inf = 1e9;

struct node{
    int u, v, w;
}e[N*3];
struct node2{
    int x, y, id;
}a[N];
bool cmp(node a, node b){
    return a.w < b.w;
}
bool cmp1(node2 a, node2 b){ return a.x < b.x; }
bool cmp2(node2 a, node2 b){ return a.y < b.y; }
int f[N];
int root(int x){
    if(f[x] == x) return x;
    return f[x] = root(f[x]);
}
int n;
int main()
{
#ifndef ONLINE_JUDGE
    //IN;
#endif

    int cnt = 0;
    SC(n);
    FF(i, 0, n+1) f[i] = i;
    ///
    FF(i, 1, n){
        SCC(a[i].x, a[i].y);
        a[i].id = i;
    }
    sort(a + 1, a + n + 1, cmp1);
    FF(i, 2, n){
        ++cnt;
        e[cnt].u = a[i-1].id; e[cnt].v = a[i].id;
        e[cnt].w = a[i].x - a[i-1].x;
    }
    sort(a + 1, a + n + 1, cmp2);
    FF(i, 2, n){
        ++cnt;
        e[cnt].u = a[i-1].id; e[cnt].v = a[i].id;
        e[cnt].w = a[i].y - a[i-1].y;
    }
    ///
    sort(e+1, e+1+cnt, cmp);
    LL ans = 0;
    FF(i, 1, cnt){
        int u = e[i].u, v = e[i].v, w = e[i].w;
        int rx = root(u), ry = root(v);
        if(rx != ry){
            f[rx] = ry;
            ans += w;
        }
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
// #include <atcoder/all>
using namespace std;
// using namespace atcoder;
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}
#ifdef __LOCAL
#define debug(x) cerr << __LINE__ << ": " << #x << " = " << (x) << '\n'
#define debugArray(x, n)                                      \
  cerr << __LINE__ << ": " << #x << " = {";                   \
  for (long long hoge = 0; (hoge) < (long long)(n); ++(hoge)) \
    cerr << ((hoge) ? "," : "") << x[hoge];                   \
  cerr << "}" << '\n'
#define debugMatrix(x, h, w)                                         \
  cerr << __LINE__ << ": " << #x << " =\n";                          \
  for (long long hoge = 0; (hoge) < (long long)(h); ++(hoge)) {      \
    cerr << ((hoge ? " {" : "{{"));                                  \
    for (long long fuga = 0; (fuga) < (long long)(w); ++(fuga))      \
      cerr << ((fuga ? ", " : "")) << x[hoge][fuga];                 \
    cerr << "}" << (hoge + 1 == (long long)(h) ? "}" : ",") << '\n'; \
  }
#else
#define debug(x) (void(0))
#define debugArray(x, n) (void(0))
#define debugMatrix(x, h, w) (void(0))
#endif

struct UnionFind {
  vector<int> par;
  UnionFind(int size) : par(size, -1) {}
  bool unite(int u, int v) {
    if ((u = root(u)) == (v = root(v))) return false;
    if (par[u] > par[v]) swap(u, v);
    par[u] += par[v], par[v] = u;
    return true;
  }
  bool same(int u, int v) { return root(u) == root(v); }
  int root(int u) { return par[u] < 0 ? u : par[u] = root(par[u]); }
  int size(int u) { return -par[root(u)]; }
};

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  int N, M;
  cin >> N >> M;
  UnionFind uf(N);
  for (int i = 0; i < M; i++) {
    int A, B;
    cin >> A >> B;
    uf.unite(--A, --B);
  }
  bool used[N];
  fill(used, used + N, false);
  int ans = -1;
  for (int i = 0; i < N; i++) {
    int v = uf.root(i);
    if (used[v]) continue;
    used[v] = true;
    ans++;
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 3756
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil
from operator import itemgetter
from copy import deepcopy
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
inf = 10**17
mod = 10**9 + 7
#s=input().rstrip()

n=I()
l=sorted(LI(),reverse=True)
if sum(l)>2*l[0]:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3444
/*
 　　　　　／＞　 フ
 　　　　　| 　_　 _|
 　 　　　／`ミ _x 彡
 　　 　 /　　　 　 |
 　　　 /　  ヽ　　 ?
 　／￣|　　 |　|　|
 　| (￣ヽ＿_ヽ_)_)
 　＼二つ
  */

#include <queue>
#include <vector>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define MP make_pair
#define ll long long
#define fi first
#define se second
using namespace std;

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

template<typename F>
inline void write(F x, char ed = '\n') {
    static short st[30];short tp=0;
    if(x<0) putchar('-'),x=-x;
    do st[++tp]=x%10,x/=10; while(x);
    while(tp) putchar('0'|st[tp--]);
    putchar(ed);
}

template <typename T>
inline void Mx(T &x, T y) { x < y && (x = y); }

template <typename T>
inline void Mn(T &x, T y) { x > y && (x = y); }

const int N = 400005;
struct edges {
    int x, y, val;
    bool operator < (const edges &i) const {
        return val < i.val;
    }
}ed[N];

int d[N], f[N], cnt, m, n; ll ans;
int find(int x) { return f[x] == x ? x : f[x] = find(f[x]); }
int main() {
    read(n), read(m);
    memset(d, 0x3f, sizeof(d));
    for (int i = 1, x, y, z;i <= m; i++) {
        read(x), read(y), read(z);
        ed[++cnt] = (edges){x, y, z};
        Mn(d[x], z + 1), Mn(d[y], z + 2);
    }
    for (int i = 1;i <= n; i++)
        Mn(d[i], d[i-1] + 2);
    Mn(d[0], d[n]);
    for (int i = 1;i <= n; i++)
        Mn(d[i], d[i-1] + 2);
    Mn(d[0], d[n]);
    for (int i = 0;i < n; i++)
        ed[++cnt] = (edges){i, (i + 1) % n, d[i]};
    sort(ed + 1, ed + cnt + 1);
    for (int i = 1;i <= n; i++) f[i] = i;
    for (int i = 1;i <= cnt; i++) {
        int x = ed[i].x, y = ed[i].y, z = ed[i].val;
        x = find(ed[i].x), y = find(ed[i].y);
        x != y && (ans += z, f[x] = y);
    }
    write(ans);
    return 0;
}

Measured memory_bytes: 13196
#include <iostream>
#include <climits>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <deque>
#define INF_INT (INT_MAX / 2)
#define INF_LONG (LONG_MAX / 2)
//#define DEBUG true
#define DEBUG false
using namespace std;

const int MAX = 100001;
const int MOD = 1000000007;

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

int ceil(int x, int y){
  return (x % y == 0) ? x / y : x / y + 1;
}

int gcd(int x, int y){
  return y ? gcd(y, x % y) : x;
}

int lcm(int x, int y){
  return x / gcd(x, y) * y;
}

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

  int h, w;
  cin >> h >> w;
  vector< string > s(h);
  for(int i = 0; i < h; i++) cin >> s[i];

  vector< vector< int > > x(h), y(w);
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      if(s[i][j] == '#'){
        x[i].push_back(j + 1);
        y[j].push_back(i + 1);
      }
    }
  }
  for(int i = 0; i < h; i++){
    x[i].push_back(0);
    x[i].push_back(w + 1);
    sort(x[i].begin(), x[i].end());
  }
  for(int i = 0; i < w; i++){
    y[i].push_back(0);
    y[i].push_back(h + 1);
    sort(y[i].begin(), y[i].end());
  }

  int ans = 0;
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      if(s[i][j] == '.'){
        auto lbx = lower_bound(x[i].begin(), x[i].end(), j + 1);
        auto lby = lower_bound(y[j].begin(), y[j].end(), i + 1);
        ans = max(ans, *lbx - *(lbx - 1) + *lby - *(lby - 1) - 3);
      }
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 40448
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        x: u32,
    }
    match x {
        7 | 5 | 3 => println!("YES"),
        _ => println!("NO")
    };
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
const ll MOD = 1000000007;
#define all(v) v.begin(), v.end()

int main(){
  ll N,P,a=0,b=0,ans=1;
  cin >> N >> P;
  vector<ll> A(N);
  rep(i,N){
    cin >> A.at(i);
    A.at(i)%=2;
    if(A.at(i)==0){
      a++;
    }else{
      b++;
    }
  }
  ans*=(ll)pow(2,a);
  if(P==0){
    ll t=0,x=0;
    while(t<=b){
      ll y=1;
      rep(i,t){
        y*=b-i;
        y/=i+1;
      }
      x+=y;
      t+=2;
    }
    ans*=x;
    cout << ans << endl;
  }else{
    if(b==0){
      cout << 0 << endl;
      return 0;
    }
    ll t=1,x=0;
    while(t<=b){
      ll y=1;
      rep(i,t){
        y*=b-i;
        y/=i+1;
      }
      x+=y;
      t+=2;
    }
    ans*=x;
    cout << ans << endl;
  }
    
    
       
    
  

}

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

int main(){
    int h,n;
    cin >> h >> n;
    int ans;
    ans=0;
    int m;
    m=0;
    vector <int> a(n);
    rep(i,n) {
        cin >> a[i];
        ans+=a[i];
        if (m>a[i]){
            m=a[i];
        }
    }
    
    

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

    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using str = string;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
const double PI = 3.141592653589793238;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define REP(i, m, n) for (int i = m; i < (int)n; i++)
#define all(a) (a).begin(), (a).end()
#define allg(a) (a).begin(), (a).end(), greator<>()
#define d20 std::setprecision(20)
#define veci vector<int>
#define vecll vector<long long int>
template <typename T>
T lcm(T a, T b)
{
	return a / __gcd(a, b) * b;
}

int main()
{
	int n;
	cin >> n;
	veci p(n);
	rep(i, n) cin >> p[i];
	int ans = 0;
	REP(i, 1, n - 1)
	{
		if (max({p[i - 1], p[i], p[i + 1]}) != p[i] && min({p[i - 1], p[i], p[i + 1]}) != p[i])
		{
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_set>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
#include<tuple>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;


int main(){
    ll n;
    string a,b,c;
    cin>>n>>a>>b>>c;
    ll ans=0;
    for(int i=0;i<n;i++){
        if(a[i]!=b[i] && b[i]!=c[i] && c[i]!=a[i]){ans+=2;}
        else if(a[i]==b[i] && b[i]==c[i]){continue;}
        else{ans+=1;}
    }
    cout<<ans<<endl;
    
    
    return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.buffer.readline

#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return sys.stdin.read()


def II(): return int(input())


def MI(): return map(int,input().split())


def MF(): return map(float,input().split())


def LI(): return list(map(int,input().split()))


def LF(): return list(map(float,input().split()))


def TI(): return tuple(map(int,input().split()))

# rstrip().decode('utf-8')

#####segfunc#####
def segfunc(x, y):
    return x*y
#################

#####ide_ele#####
ide_ele = 1
#################

class SegTree:
    """
    init(init_val, ide_ele): 配列init_valで初期化 O(N)
    update(k, x): k番目の値をxに更新 O(logN)
    query(l, r): 区間[l, r)をsegfuncしたものを返す O(logN)
    """
    def __init__(self, init_val, segfunc, ide_ele):
        """
        init_val: 配列の初期値
        segfunc: 区間にしたい操作
        ide_ele: 単位元
        n: 要素数
        num: n以上の最小の2のべき乗
        tree: セグメント木(1-index)
        """
        n = len(init_val)
        self.segfunc = segfunc
        self.ide_ele = ide_ele
        self.num = 1 << (n - 1).bit_length()
        self.tree = [ide_ele] * 2 * self.num
        # 配列の値を葉にセット
        for i in range(n):
            self.tree[self.num + i] = init_val[i]
        # 構築していく
        for i in range(self.num - 1, 0, -1):
            self.tree[i] = self.segfunc(self.tree[2 * i], self.tree[2 * i + 1])

    def update(self, k, x):
        """
        k番目の値をxに更新
        k: index(0-index)
        x: update value
        """
        k += self.num
        self.tree[k] = x
        while k > 1:
            self.tree[k >> 1] = self.segfunc(self.tree[k], self.tree[k ^ 1])
            k >>= 1

    def query(self, l, r):
        """
        [l, r)のsegfuncしたものを得る
        l: index(0-index)
        r: index(0-index)
        """
        res = self.ide_ele

        l += self.num
        r += self.num
        while l < r:
            if l & 1:
                res = self.segfunc(res, self.tree[l])
                l += 1
            if r & 1:
                res = self.segfunc(res, self.tree[r - 1])
            l >>= 1
            r >>= 1
        return res

def main():
	n=II()
	s=input().rstrip().decode()
	S=[]
	for i in s:
		S.append(ord(i)-ord("a"))
	
	seg=[SegTree([1]*n,segfunc,ide_ele) for _ in range(26)]
	
	#print(S)
	#print(seg)
	for i in range(n):
		seg[S[i]].update(i,0)
	
	q=II()
	for _ in range(q):
		a,b,c=input().split()
		if int(a)==1:
			b=int(b)-1
			seg[S[b]].update(b,1)
			t=ord(c)-ord("a")
			seg[t].update(b,0)
			S[b]=t
		
		else:
			#print(S)
			b=int(b)-1
			c=int(c)
			cnt=0
			for se in seg:
				if se.query(b,c)==0:
					cnt+=1
			print(cnt)
			
	
	

if __name__=="__main__":
	main()


Measured memory_bytes: 324820
#include<bits/stdc++.h>
using namespace std;
bool isPrime(int x);
int main(){
    int n;
    cin >> n;
    int a;
    int count = 0;
    for(int i = 0; i < n; i++){
        cin >> a;
        if(isPrime(a)) count++;
    }
    cout << count << endl;

}
bool isPrime(int x){
    for(int i = 2; i <= sqrt(x); i++){
        if(x%i == 0){
            return false;
        }
    }
    return true;
}


Measured memory_bytes: 3120
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,a,b) for (int i = a; i < (b); ++i)
#define all(x) (x).begin(),(x).end()
const int INF = 1000000007;
typedef long long ll;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
ll fac(ll a) { return a > 1 ? fac(a - 1) * a : 1; }
int solve(){
  int n,m;
  scanf("%d%d",&n,&m);
  vector<int>a(n);
  vector<pair<int,int>>cb(m);
  rep(i,n)scanf("%d",&a[i]);
  rep(i,m)scanf("%d%d",&cb[i].second,&cb[i].first);
  sort(a.begin(),a.end());
  sort(cb.rbegin(),cb.rend());
  int now = 0;
  rep(i,m){
    int tmp = 0;
    REP(j,now,min(cb[i].second + now,n + 1)){
      if(a[j] <= cb[i].first){a[j] = cb[i].first;tmp++;}
      else break;
    }
    now += tmp;
    if(now >= n )break;
  }
  ll ans = 0;
  rep(i,n)ans += a[i];
  cout << ans << endl;
  return 0;
}
int main(){
  // ios::sync_with_stdio(false);cin.tie(nullptr);
  // cout << fixed;cout << setprecision(16) << endl; 
  solve();
  return 0;
}

Measured memory_bytes: 1408
#include<stdio.h>

int main (void){
    int n,m;
    scanf("%d %d",&n, &m);
    int a[n];
    for(int i=0; i<n; i++){
        scanf("%d", &a[i]);
    }
    int sum = 0;
    for(int i=0; i<n; i++){
        sum += a[i];
    }
    double sd = (double)sum / (double)(4 * m);
    int count = 0;
    for(int i=0; i<n; i++){
        if((double)a[i] >= sd){
            count++;
        }
    }
    if(count >= m){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define fast_io ios::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
int main(){
	fast_io;
	int n,s=0;
	cin>>n;
	int p[n];
	for(int i=0;i<n;i++) cin>>p[i];
	for(int i=1;i<n-1;i++) if(p[i-1]>p[i]&&p[i+1]<p[i]||p[i-1]<p[i]&&p[i+1]>p[i]) s++;
	cout<<s;
	return 0;
}

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

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define ll long long
const ll mod = 1e9+7;
int inf = 1000000000; //10e9
 
int main() {

    ll n, d;
    cin >> n >> d;

    vector<vector<ll>> xy(n, vector<ll>(2));
    rep(i,n) rep(j,2) cin >> xy[i][j];

    ll count = 0;

    rep(i,n){
        double distance = sqrt(xy[i][0]*xy[i][0] + xy[i][1]*xy[i][1]);
        if(d>=distance){
            count++;
        }
    }

    cout << count << endl;

    return 0;

}

Measured memory_bytes: 14124
N, M, X = map(int, input().split())
lst = [list(map(int, input().split())) for i in range(N)]

ans = float("inf")

for comb in range(2**N):
    cost = 0
    learned = [0]*(M)

    for i in range(N):
        if (comb >> i) & 1:
            cost += lst[i][0]
            for j in range(0, M):
                learned[j] += lst[i][j+1]


    if min(learned)>=X: ans = min(ans,cost)

if ans > 100000*N:
    print(-1)
else:
    print(ans)

Measured memory_bytes: 68712
import collections

n = int(input())
v = list(map(int,input().split()))

odd = collections.Counter(v[0::2]).most_common()
even = collections.Counter(v[1::2]).most_common()

if odd[0][0] == even[0][0]:
    if len(odd) == 1:
        print(n-even[0][1])
    elif len(even) == 1:
        print(n-odd[0][1])
    elif odd[0][1]+even[1][1] < even[0][1]+odd[1][1]:
        print(n-odd[1][1]-even[0][1])
    else:
        print(n-odd[0][1]-even[1][1])
else:
    print(n-odd[0][1]-even[0][1])


Measured memory_bytes: 20700
l=[list(map(int, input().split())) for i in range(3)]
l.sort()
if l[1][0]-l[0][0]==l[1][1]-l[0][1]==l[1][2]-l[0][2]:
    if l[2][0]-l[0][0]==l[2][1]-l[0][1]==l[2][2]-l[0][2]:
        print('Yes')
    else:print('No')
else:
    print('No')

Measured memory_bytes: 3064
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <fstream>
using namespace std;
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toStr(T x) { ostringstream sout; sout << x; return sout.str(); }
typedef vector<int> vi;
typedef vector<vi>  vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = INT_MAX / 10;

struct state {
	int p, c, r;
	state(int p, int c, int r) : p(p), c(c), r(r) {};
	bool operator<(const state &o)const {
		return o.c<c;
	}
};

int main() {
	int N;
	while (cin >> N, N) {
		int S, T, M, A, B;
		vvi dist(N + 1, vi(N + 1, INF));
		cin >> S >> T >> M;
		int num = 1;
		REP(i, M) {
			cin >> A >> B;
			dist[A][B] = min(dist[A][B], num);
			num++;
		}

		priority_queue<state> Q;
		Q.push(state(S, 0, 0));
		vi ncost(N + 1, INF), rcost(N + 1, INF), road(N + 1, INF);
		int ans = INF, ansr = INF;
		while (!Q.empty()) {
			state st = Q.top();
			Q.pop();

			if (ans < st.c) {
				break;
			}

			if (st.p == T) {
				if (st.c < ans) {
					ans = st.c;
					ansr = st.r;
					continue;
				}
				else if (st.c == ans && st.r < ansr) {
					ansr = st.r;
					continue;
				}
			}

			FOR(i, 1, N) {
				if (dist[st.p][i] != INF) {
					if (st.r == 0) {
						if (st.c + 1 < ncost[i]) {
							ncost[i] = st.c + 1;
							Q.push(state(i, st.c + 1, 0));
						}
					}
					else  {
						if (st.c + 1 < rcost[i]) {
							rcost[i] = st.c + 1;
							road[i] = st.r;
							Q.push(state(i, st.c + 1, st.r));
						}
						else if (st.c + 1 == rcost[i] && st.r < road[i]) {
							road[i] = st.r;
							Q.push(state(i, st.c + 1, st.r));
						}
					}
				}
				if (dist[i][st.p] != INF && st.r == 0) {
					if (st.c + 1 < rcost[i]) {
						rcost[i] = st.c + 1;
						road[i] = dist[i][st.p];
						Q.push(state(i, st.c + 1, dist[i][st.p]));
					}
					else if (st.c + 1 == rcost[i] && st.r < road[i]) {
						road[i] = dist[i][st.p];
						Q.push(state(i, st.c + 1, dist[i][st.p]));
					}
				}
			}
		}

		cout << ans << " " << ansr << endl;
	}

	return 0;
}

Measured memory_bytes: 5172
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define until(x) while(!(x))
#define unless(x) if(!(x))
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
#define pc __builtin_popcount

map<int,int> mp;

int32_t main(){
	int n,k,a,b;
	cin>>n>>k;
	for(int i=1;i<=n;i++){
		cin>>a>>b;
		mp[a]+=b;
	}
	int cur = 0;
	for(int i=1;i<=100005;i++){
		cur += mp[i];
		if(cur>=k){
			cout<<i;
			return 0;
		}
	}
}


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

#define ll long long

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

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

  return;
}


long int gcd(long int a, long int b){
  long int c;

  while (b > 0){
    c = a % b;
    a = b;
    b = c;
  }

  return a;
}

int upll(const void*a, const void*b){
  return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;
}

int downll(const void*a, const void*b){
  return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;
}

void sortup(ll*a,int n){
  qsort(a,n,sizeof(ll),upll);
}

void sortdown(ll*a,int n){
  qsort(a,n,sizeof(ll),downll);
}

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

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

int max(int a,int b){
  if(a<b){
    return b;
  }
  else{
    return a;
  }
}

int min(int a,int b){
  if(a<b){
    return a;
  }
  else{
    return b;
  }
}

void chmax(int *a,int b){
  if(*a < b){
    *a = b;
  }

  return;
}

void chmin(int *a,int b){
  if(*a > b){
    *a =b;
  }

  return;
}


int main(void){
  int n;
  scanf("%d",&n);
  int d,e;
  int count=0;
  for(int i=0;i<n;i++){
    if(count==3){
      break;
    }
    scanf("%d%d",&d,&e);
    if(d==e){
      count++;
    }else{
      count=0;
    }
  }
  
  if(count!=3){
    printf("No\n");
  }else{
    printf("Yes\n");
  }
  return 0;
}

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


int main(){
	LL a,b,c,k;
      cin >>a >>b>>c>>k;
 if(k % 2 ==0)cout << a -b <<endl;
  else cout << b-a <<endl;
}












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

int main() {
  int n,m;
  cin >> n >> m;
        if (n == m)  cout << "Yes" << endl;
        else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.*; 
import java.lang.*; 

public class Main{

	static int gcd(int x, int y, int z){
		if(y == 0 && z == 0){
			return x;
		}
		else if(y == 0){
			return gcd(x,z,0);
		}
		else{
			return gcd(y, x%y,z);
		}
	}

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

		int K = scan.nextInt();
		int sum = 0;
		
		for(int a=1; a<=K; a++){
			for(int b=1; b<=K; b++){
				for(int c=1; c<=K; c++){
					sum = sum + gcd(a,b,c);
				}
			}
		}
		
		System.out.println(sum);
	}
}

Measured memory_bytes: 35784
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def bisection(l,r,f,left=True,discrete=True):
    eps=1 if discrete else 10**-12
    if((not left)^f(r)): return r if left else r+1
    elif(left^f(l)): return l-1 if left else l
    while(r-l>eps):
        h=(l+r)//2 if discrete else (l+r)/2
        if((not left)^f(h)): l=h
        else: r=h
    return (l+r)/2 if not discrete else l if left else r

class RollingHash(object):
    from random import randint
    __MASK30=(1<<30)-1
    __MASK31=(1<<31)-1
    __MOD=(1<<61)-1
    __base=randint(129,__MASK31)

    def __init__(self,s:str):
        n=len(s)
        H=[0]*(n+1); P=[1]*(n+1)
        for i in range(n):
            H[i+1]=self.__modulo(self.__multiple(H[i],self.__base)+ord(s[i]))
            P[i+1]=self.__modulo(self.__multiple(P[i],self.__base))
        self.__H=H; self.__P=P

    def __multiple(self,a,b):
        au=a>>31
        ad=a&self.__MASK31
        bu=b>>31
        bd=b&self.__MASK31
        m=ad*bu+au*bd
        mu=m>>30
        md=m&self.__MASK30
        return 2*au*bu+mu+(md<<31)+ad*bd

    def __modulo(self,x):
        x=(x&self.__MOD)+(x>>61)
        if(x>self.__MOD): x-=self.__MOD
        return x

    def hash(self,l,r):
        H=self.__H; P=self.__P
        res=H[r]+self.__MOD*3-self.__multiple(H[l],P[r-l])
        if(res<0): return res+self.__MOD
        else: return self.__modulo(res)

def resolve():
    n=int(input())
    s=input()
    rh=RollingHash(s)
    def check(d):
        J={rh.hash(i,i+d):-1 for i in range(n-d+1)}
        for i in range(n-d+1):
            h=rh.hash(i,i+d)
            if(J[h]!=-1):
                if(i-J[h]>=d): return True
            else: J[h]=i
        return False
    print(bisection(0,n,check))
resolve()

Measured memory_bytes: 52952
N = int(input())
A = [int(a) for a in input().split()]

for i in range(N):
    if A[i] % 2 == 1:
        A.remove(A[i])
        A.insert(i,0)
for i in range(len(A)):
    if A[i] % 3 != 0 and A[i] % 5 != 0:
        print('DENIED')
        exit()
print('APPROVED')

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define C


#ifdef A
int main(void)
{
	int a, b;
	cin >> a >> b;
	if (a == b)
		cout << "a == b" << endl;
	else if (a < b)
		cout << "a < b" << endl;
	else
		cout << "a > b" << endl;

	return 0;
}
#endif
#ifdef B
int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	if (a < b && b < c)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	return 0;
}
#endif
#ifdef C
int main()
{
	vector<int> arr(3);
	for (auto&a : arr)
	{
		cin >> a;
	}
	sort(arr.begin(), arr.end());

	/*for (auto& a : arr)
	{
		cout << a << " ";
	}
	cout << endl;*/

	cout << arr[0] << " " << arr[1] << " " << arr[2] << endl;


	return 0;
}
#endif
#ifdef D
int main()
{
	int S;
	cin >> S;
	int h = S / 3600, m = S / 60 % 60, s = S % 60;

	cout << h << ":" << m << ":" << s << endl;

	return 0;
}
#endif

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

using i32 = std::int_fast32_t;
using i64 = std::int_fast64_t;
template <typename T> constexpr T inf = numeric_limits<T>::has_infinity ? numeric_limits<T>::infinity() : numeric_limits<T>::max() / 4;

#define REP(i, stop) FOR(i, 0, stop)
#define FOR(i, start, stop) for (int i = start, i##_len = stop; i < i##_len; ++i)
#define RREP(i, n) for (int i = n; i-- > 0;)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define COMP(key) [](const auto& a, const auto& b) { return a.key < b.key; }

template<typename T, typename U> istream& operator>>(istream& is, pair<T, U>& a) { return is >> a.first >> a.second; }
template<typename T> istream& operator>>(istream& is, vector<T>& a) { for (T& x : a) is >> x; return is; }

void LOG(const int& x) { cerr << x << "\n"; }
template<typename T> void LOG(const vector<T>& a) { for (const T& x : a) cerr << x << " "; cerr << "\n"; }
template<typename T, std::size_t S> void LOG(const T (&a)[S]) { REP(i, S) cerr << a[i] << " "; cerr << "\n"; }
template<typename T, std::size_t S, std::size_t R> void LOG(const T (&a)[S][R]) { REP(i, S) { REP(j, R) cerr << a[i][j] << " "; cerr << "\n"; } }

i64 ceil(i64 a, i64 b) { return (a - 1) / b + 1; }
i64 gcd(i64 a, i64 b) { while (b != 0) { i64 t = b; b = a % b; a = t; } return a; }
i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
i64 gcd(const vector<i64>& v) { return accumulate(ALL(v), 1LL, static_cast<i64(*)(i64, i64)>(gcd)); }
i64 lcm(const vector<i64>& v) { return v.empty() ? 0LL : accumulate(v.begin() + 1, v.end(), v[0], static_cast<i64(*)(i64, i64)>(lcm)); }
i64 pow(i64 x, i64 y, i64 z) { i64 a = 1; while (y > 0) { if (y & 1) a = a * x % z; x = x * x % z; y /= 2; } return a; }
i64 inv(i64 x, i64 m) { return pow(x, m - 2, m); }

struct InitCpp { InitCpp() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(10); } } initCpp;

const i64 INF = inf<i64>;
using P = pair<i64, i64>;
using T = pair<i64, P>;
const i64 M = 1000000007;
signed main() {
  i64 n, m;
  cin >> n >> m;
  cout << (n == m ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define ll int64_t
#define _GLIBCXX_DEBUG
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main(){
  string sa,sb,sc;
  cin >> sa >> sb >> sc;
  char turn='a';
  char winner;
  while(1){
    if(turn=='a'){
      if(sa==""){
        winner='A';
        break;
      }
      turn=sa.at(0);
      if(sa.size()!=1)
        sa=sa.substr(1,sa.size()-1);
      else
        sa="";
      continue;
    }
    if(turn=='b'){
      if(sb==""){
        winner='B';
        break;
      }
      turn=sb.at(0);
      if(sb.size()!=1)
        sb=sb.substr(1,sb.size()-1);
      else
        sb="";
      continue;
    }
    if(turn=='c'){
      if(sc==""){
        winner='C';
        break;
      }
      turn=sc.at(0);
      if(sc.size()!=1)
        sc=sc.substr(1,sc.size()-1);
      else
        sc="";
    }
  }
  cout << winner << endl;
}

Measured memory_bytes: 256
import java.awt.Polygon;
import java.awt.geom.Area;
import java.awt.geom.PathIterator;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) throws Exception
	{
		new Main().run();
	}
	
	public void run() throws Exception
	{
		Scanner file = new Scanner(System.in);
		int n = file.nextInt();
		String s = file.next();
		if(n >=3200)
			System.out.println(s);
		else
			System.out.println("red");
	}
}


Measured memory_bytes: 21972
#include <iostream>
using std::cin;
using std::cout;
using std::endl;

#include <map>
using std::map;

#include <string>
using std::string;

map<string, int> memo;

int main(void) {
	int n;
	scanf("%lld", &n);
	for (int i=0; i<n; i++) {
		string s; cin >> s;
		memo[s] += 1;
	}

	int mx = 0;
	for (const auto& x: memo) {
		int v = x.second;
		if (v > mx) mx = v; 
	}

	for (auto it = memo.begin(); it != memo.end(); it++) {
		if (it->second == mx)
			cout << it->first << '\n';
	}

	return 0;
}

Measured memory_bytes: 25216
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>
#include <functional> // for less
#include <iostream>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
#define pf(n) cout << n << endl
#define ps() cout <<" ";
#define sf(n) cin >> n
#define in(i,n) for (int i = 0; i < n; i++)
#define vi vector<int>
#define vp vector<pair<int, int>>
#define graph vector< vector<int> >
#define vs vector<string>
/**  '' "\n" ^ -  =**/

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    string a,b;
    cin>>a>>b;
    int c=0;
    for(int i=0;i<a.length();i++)
    {
        if(a[i]==b[i])
        c++;
    }
    cout<<c<<endl;
}


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

struct UnionFind {
    vector<ll> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2
    vector<ll> sz;

    UnionFind(ll N) : par(N), sz(N) { //最初は全てが根であるとして初期化
        for(ll i = 0; i < N; i++) {
          par[i] = i;
          sz[i] = 1;
        }
    }

    ll root(ll x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(ll x, ll y) { // xとyの木を併合
//        cout << "unite: " << x << ", " << y << endl;
        ll rx = root(x); //xの根をrx
        ll ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
        sz[ry] += sz[rx];
    }

    bool same(ll x, ll y) { // 2つのデータx, yが属する木が同じならtrueを返す
        ll rx = root(x);
        ll ry = root(y);
        return rx == ry;
    }
  
    ll size(ll x){ // xが属する木の要素数を返す
//      int p = root(x);
//      int ret = 0;
//      for(int i = 0; i < N; i++) if(i != x && root(i) == p) ret++;
//      for(int i = 0; i < N; i++) if(root(i) == p) ret++;
//      return ret;
      return sz[root(x)];
    }
    void show(ll N){
      for(ll i=0; i<N; i++){
        cout << "par[" << i << "]: " << par[i] << ", ";
      }
      cout << endl;
    }
};

int main(int argc, char** argv){
  ll N, M;
  cin >> N >> M;
  ll comb = N*(N-1)/2;
  ll A[M], B[M];

  UnionFind uf = UnionFind(N);
  
  for(ll cnt0=0; cnt0 < M; cnt0++){
    ll tmpa, tmpb;
    cin >> tmpa >> tmpb;
    tmpa--;tmpb--;
    A[cnt0] = tmpa;
    B[cnt0] = tmpb;
  }
  ll ans[M];
  ans[0] = comb;
//  uf.unite(A[M-1], B[M-1]);

  for(ll cnt0=M-1; cnt0 >= 0; cnt0--){
    ans[cnt0] = comb;
    if(uf.same(A[cnt0], B[cnt0])) continue;
    else {
//      uf.show(N);
      ll szA = uf.size(A[cnt0]);
      ll szB = uf.size(B[cnt0]);
//      printf("cnt0: %lld, szA: %lld, szB: %lld\n", cnt0, szA, szB); 
      comb -= szA*szB;     
      uf.unite(A[cnt0], B[cnt0]);
    }
  }
   
  for(ll cnt0=0; cnt0 < M; cnt0++){
    printf("%lld\n", ans[cnt0]);
  }

  return 0;


}


Measured memory_bytes: 5248
#include<stdio.h>
#include<math.h>

int Prime(int);

int main()
{
  int a[10000];
  int i,j,x,n=0;

  scanf("%d",&x);
  for(i = 0;i < x;i++){
    scanf("%d",&a[i]);
  }

  for(i = 0;i < x;i++){
    if(Prime(a[i]) == 1){
      n++;
    }
  }

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

  return 0;
}

int Prime(int x)
{
  int i=3;
  if(x == 2) return 1;
  else if(x < 2 || x % 2 == 0) return 0;

  else{
    while(i <= sqrt(x)){
      if(x % i == 0) return 0;
      i = i+2;
    }
  }
  return 1;
}



Measured memory_bytes: 2092
#include <stdio.h>

int main()
{
  int N, H[100005];
  
  scanf("%d", &N);
  for(int i=0; i<N; i++) scanf("%d", H+i);
  
  int max = 0;
  for (int i=0; i<N-1; i++)
  {
    int count = 0;
    for (int j=i; j<N-1; j++)
    {
      if (H[j] >= H[j+1])
      {
        count++;
      }
      else
      {
        i=j;
        break;
      }
    }
    
    if (count > max) max = count;

    if (N-i<max)
    {
      break;
    }
  }
  
  printf("%d\n", max);
  return 0;
}

Measured memory_bytes: 512
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
n,m = map(int,readline().split())
lst1 = [list(map(int,readline().split())) for i in range(n)]

import heapq

heap = []
heapq.heapify(heap)

lst1.sort()
ans = 0
now = 0
for i in range(1,m+1):
    while True:
        if now < len(lst1) and lst1[now][0] == i:
            heapq.heappush(heap,-lst1[now][1])
            now += 1
        else:
            break
    if len(heap) != 0:
        ans -= heapq.heappop(heap) #最小値を負で取り出す

print(ans)
            


Measured memory_bytes: 70492