akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <queue>
#include <set>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>

long long int euclid_gcd(long long int x, long long int y);


int main(){

  long long int N, M, tmp, tmp1, tmp2;
  std::vector<long long int> a;

  scanf("%lld%lld", &N, &M);
  for(long long int i = 0; i < N; i++){
    scanf("%lld", &tmp);
    a.push_back(tmp);
  }

  // calculate powers of 2
  long long int pow2, pow2tmp, flg;
  tmp1 = a[0];
  pow2 = 0;
  while(tmp1%2 == 0){
    tmp1 /= 2;
    pow2++;
  }

  flg = 1;
  for(long long int i = 1; i < N; i++){
    tmp1 = a[i];
    pow2tmp = 0;
    while(tmp1%2 == 0){
      tmp1 /= 2;
      pow2tmp++;
    }

    if(pow2tmp != pow2){
      flg = 0;
      break;
    }
  }

  if(flg == 0){
    std::cerr << "Answer: " << std::endl;
    std::cout << 0 << std::endl;
    return 0;
  }

  // calculate lcm
  long long int lcm_a = a[0], gcdtmp;

  for(long long int i = 1; i < N; i++){
    gcdtmp = euclid_gcd(lcm_a, a[i]);
    lcm_a = (lcm_a * a[i])/gcdtmp;
  }

  std::cerr << "lcm = " << lcm_a << std::endl;

  // calculate answer
  std::cerr << "Answer: " << std::endl;
  std::cout << (M+lcm_a/2)/lcm_a << std::endl;

  return 0;
}


long long int euclid_gcd(long long int x, long long int y){
  if(y == 0){
    return x;
  }
  /*else if(x == 0){
    return y;
  }*/
  else{
    return euclid_gcd(y, x%y);
  }
}

Measured memory_bytes: 1400
#define MAX(a,b) ((a)>(b)?(a):(b))

int N[1002][1002];

int main(){

  char a[1002],b[1002];

  int i,j,_a,_b;scanf("%d",&i);

  while(~scanf("%s%s",a+1,b+1)){

    memset(N,0,sizeof(N));

    _a=strlen(a+1);_b=strlen(b+1);

    for(i=1;i<=_a;i++)

      for(j=1;j<=_b;j++)

	N[i][j]=MAX(MAX(N[i-1][j],N[i][j-1]),N[i-1][j-1]+(a[i]==b[j]));

    printf("%d\n",N[_a][_b]);

  }

  exit(0);

}



Measured memory_bytes: 5720
//Written by Rhitwik Saha//
#include <bits/stdc++.h>
using namespace std;
#define int         long long
#define mp          make_pair
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vb          vector<bool>
#define vc          vector<char>
#define vii         vector<pii>
//#define mi          map<int,int>
//#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (int)x.size()
#define ub(x)       upper_bound(x)
#define lb(x)       lower_bound(x)
#define endl        '\n'
#define file        freopen("input.txt","r",stdin);freopen("output.txt","w",stdout)
#define fastio      ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
// #define N            1e5+5
#define M           1000000007
#define MAX         100005
#define mem0(a)     memset(a,0,sizeof(a))
#define prec        cout<<std::setprecision(9)<<std::fixed
#define forn(i,a,b)  for(int i=a;i<b;i++)

int i,j,k;

void Anon_mouS(){
    int a,b;
    cin>>a>>b;
    string sa,sb;
    for(i=0;i<a;i++)sa+=b+'0';
    for(i=0;i<b;i++)sb+=a+'0';
    if(sa<sb)cout<<sa;
    else cout<<sb; 
}
int32_t main(){
    prec;
    fastio;
    // file;
    // sieve();
    int q=1;
    // cin>>q;
    while(q--)Anon_mouS();
    return 0;
}



Measured memory_bytes: 256
n = int(input())
a_list = list(map(int, input().split()))

max_zettai = 0
for i in range(n-1):
    for j in range(i+1, n):
        sa = abs(a_list[j] - a_list[i])
        max_zettai = max(sa, max_zettai)
print(max_zettai)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

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

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

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

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

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

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001;

template<class T, int SZ> struct LazySegTree {
    T mn[2*SZ], lazy[2*SZ]; // set SZ to a power of 2
    
    LazySegTree() {
        memset (mn,0,sizeof mn);
        memset (lazy,0,sizeof lazy);
    }
    
    void push(int ind, int L, int R) {
        mn[ind] += lazy[ind];
        if (L != R) lazy[2*ind] += lazy[ind], lazy[2*ind+1] += lazy[ind];
        lazy[ind] = 0;
    }
    
    void pull(int ind) {
        mn[ind] = max(mn[2*ind],mn[2*ind+1]);
    }
    
    void build() {
        F0Rd(i,SZ) pull(i);
    }
    
    T qmax(int lo, int hi, int ind = 1, int L = 0, int R = SZ-1) {
        push(ind,L,R);
        if (lo > R || L > hi) return -INF;
        if (lo <= L && R <= hi) return mn[ind];
        
        int M = (L+R)/2;
        return max(qmax(lo,hi,2*ind,L,M), qmax(lo,hi,2*ind+1,M+1,R));
    }
    
    void upd(int lo, int hi, ll inc, int ind = 1, int L = 0, int R = SZ-1) {
        push(ind,L,R);
        if (hi < L || R < lo) return;
        if (lo <= L && R <= hi) {
            lazy[ind] = inc;
            push(ind,L,R);
            return;
        }
        
        int M = (L+R)/2;
        upd(lo,hi,inc,2*ind,L,M); upd(lo,hi,inc,2*ind+1,M+1,R);
        pull(ind);
    }
};

LazySegTree<ll,1<<13> L;
int N,M,A[5000],B[5001][201];

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> N >> M;
    FOR(i,1,N) cin >> A[i];
    FOR(i,1,N+1) FOR(j,1,M+1) cin >> B[i][j];
    
    vector<pair<int,pi>> bes[201];
    ll ans = 0;
    FORd(i,1,N+1) {
        L.upd(i+1,N,-A[i]);
        FOR(j,1,M+1) {
            int mx = i;
            L.upd(i,i,B[i][j]);
            while (sz(bes[j]) && bes[j].back().f <= B[i][j]) {
                L.upd(bes[j].back().s.f,bes[j].back().s.s,B[i][j]-bes[j].back().f);
                mx = bes[j].back().s.s;
                bes[j].pop_back();
            }
            bes[j].pb({B[i][j],{i,mx}});
        }
        ans = max(ans,L.qmax(i,N));
    }
    cout << ans;
}

// read the question correctly (is y a vowel? what are the exact constraints?)
// look out for SPECIAL CASES (n=1?) and overflow (ll vs int?) ARRAY OUT OF BOUNDSS

Measured memory_bytes: 4608
#define LOCAL
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rrep(i, n) for(int i=(n-1); i>=0; --i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define ALL(v) (v).begin(), (v).end()
#define memr(dp, val) memset(dp, val, sizeof(dp))
using namespace std;
typedef long long ll;
static const int INTINF = (INT_MAX >> 1); // 10^9 + 10^7
static const ll LLINF = (LLONG_MAX >> 1);
static const int MAX = 1e5+1;
static const ll MOD = 1e9+7;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T>
using min_priority_queue = priority_queue<T, vector<T>, greater<T> >;
string to_string(string s) { return '"' + s + '"'; }
string to_string(bool b) { return b ? "true" : "false"; }
template <size_t N> string to_string(bitset<N> bs) {
  string res;
  for (size_t i = 0; i < N; ++i) res += '0' + bs[i];
  return res;
}
string to_string(vector<bool> v) {
  string res = "{";
  for (bool e : v) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p);
template <class C> string to_string(C c) {
  string res = "{";
  for (auto e : c) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
void debug() { cerr << '\n'; }
template <class Head, class... Tail> void debug(Head head, Tail... tail) {
  cerr << '\t' << to_string(head), debug(tail...);
}
#ifdef LOCAL
#define print(...) cerr << "[" << #__VA_ARGS__ << "]:", debug(__VA_ARGS__)
#else
#define print(...)
#endif

int main(int argc, const char * argv[]) {
	std::cout << std::fixed << std::setprecision(15);

	int n; cin >> n;
	int a = n % 10;
	if(a == 3){
		cout << "bon" << endl;
	}
	else if(a == 0 || a == 1 || a == 6 || a == 8){
		cout << "pon" << endl;
	}
	else{
		cout << "hon" << endl;
	}
	return 0;
}


Measured memory_bytes: 3624
#include <cstdio>
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <string>
#include <cstring>
#include <sstream>
#include <algorithm>
using namespace std;

const int Maxn = 205;
const int Inf = 1000000000;

int n, m, r;
int dist[Maxn][Maxn];
int seq[Maxn];
int res = Inf;

int main()
{
	scanf("%d %d %d", &n, &m, &r);
	fill((int*)dist, (int*)dist + Maxn * Maxn, Inf);
	for (int i = 1; i <= n; i++)
		dist[i][i] = 0;
	for (int i = 0; i < r; i++)
		scanf("%d", &seq[i]);
	sort(seq, seq + r);
	for (int i = 0; i < m; i++) {
		int a, b, c; scanf("%d %d %d", &a, &b, &c);
		dist[a][b] = min(dist[a][b], c);
		dist[b][a] = min(dist[b][a], c);
	}
	for (int k = 1; k <= n; k++)
		for (int i = 1; i <= n; i++)
			for (int j = 1; j <= n; j++)
				dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
	do {
		int cand = 0;
		for (int i = 0; i + 1 < r; i++)
			cand += dist[seq[i]][seq[i + 1]];
		res = min(res, cand);
	} while (next_permutation(seq, seq + r));
	printf("%d\n", res);
	return 0;
}

Measured memory_bytes: 384
s=input()
k=int(input())

alpha=list('abcdefghijklmnopqrstuvwxyz')

ans=[]
for i in range(len(s)):
    ki= 26-alpha.index(s[i]) if s[i]!='a' else 0
#    print(ki,k)
    if(i==len(s)-1):
        kn=k+alpha.index(s[i])
        kn=kn%26
        ans.append(alpha[kn])
    elif(ki<=k):
        ans.append('a')
        k-=ki
    else:
        ans.append(s[i])
print(''.join(ans))

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

#define ll long long;
mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x; }

struct fast_ios {
  fast_ios() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
  };
} fast_ios_;

int main() {
  int x, y;
  cin >> x >> y;
  // a+b=x, a+2b=y/2, y/2-x>=0
  if (y / 2 - x >= 0 && 2 * x - y / 2 >= 0 && y % 2 == 0)
    puts("Yes");
  else
    puts("No");
  return 0;
}

Measured memory_bytes: 3656
#include <iostream>
#include <cstdio>
#include <cstring>
#include <queue>
using namespace std;

const int MaxN = 100000 + 5, MaxM = 100000 + 5;

int N, M; int cnte;
int Head[MaxN], To[MaxM], Next[MaxM];
int ind[MaxN], dp[MaxN];
queue <int> que;

inline void add_edge(int from, int to) {
  cnte++; To[cnte] = to;
  Next[cnte] = Head[from]; Head[from] = cnte;
}

void init() {
  scanf("%d %d", &N, &M);
  for (int i = 1; i <= M; ++i) {
    int u, v;
    scanf("%d %d", &u, &v);
    add_edge(u, v);
    ind[v]++;
  }
}

void solve() {
  for (int i = 1; i <= N; ++i)
    if (ind[i] == 0) {
      que.push(i);
      dp[i] = 0;
    }

  while (!que.empty()) {
    int u = que.front(); que.pop();
    for (int i = Head[u]; i; i = Next[i]) {
      int v = To[i];
      dp[v] = max(dp[v], dp[u] + 1);
      ind[v]--;
      if (ind[v] == 0) que.push(v);
    }
  }

  int ans = 0;
  for (int i = 1; i <= N; ++i) ans = max(ans, dp[i]);
  cout << ans << endl;
}

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

Measured memory_bytes: 2432
import java.lang.Math.min

fun Boolean.toInt() = if (this) 1 else 0

fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val s = readLine()!!
    val bCumSum = mutableListOf(0)
    val wCumSum = mutableListOf(0)
    for (i in 0 until n) {
        bCumSum.add(bCumSum[i] + (s[i] == '#').toInt())
        wCumSum.add(wCumSum[i] + (s[i] == '.').toInt())
    }
    var ans = n
    for (i in 0..n) {
        val wDiff = bCumSum[i] - bCumSum[0]
        val bDiff = wCumSum[n] - wCumSum[i]
        ans = min(ans, wDiff + bDiff)
    }
    println(ans)
}

Measured memory_bytes: 51880
#include<stdio.h>
int main(){
  int n,d1[12];
  int i,c,b,j;
  while(1){
    scanf("%d",&n);
    if(n==0)break;
    for(i=0;i<n;i++){
      scanf("%d",&d1[i]);
    }
    c=0;
    while(1){
      int d2[12]={0};
      for(i=0;i<n;i++){
	for(j=0;j<n;j++){
	  if(d1[i]==d1[j])d2[i]++;
	}
      }
      b=0;
      for(i=0;i<n;i++){
	if(d1[i]==d2[i])b++;
	d1[i]=d2[i];
      }
      if(b==n)break;
      else c++;
    }
    printf("%d\n",c);
    for(i=0;i<n;i++){
      if(i!=0)printf(" ");
      printf("%d",d1[i]);
    }
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 604
#include <bits/stdc++.h>
using namespace std;
int main(void)
{
  int N;
  scanf("%d", &N);
  int d1 = N/10, d2 = N%10;
  int yes = (9 == d1) || (9 == d2);
  printf("%s\n", yes?"Yes":"No");
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define SZ(x) ((int)x.size())
#define L(i,u) for (register int i=head[u]; i; i=nxt[i])
#define rep(i,a,b) for (register int i=(a); i<=(b); i++)
#define per(i,a,b) for (register int i=(a); i>=(b); i--)
using namespace std;
typedef long long ll;
typedef unsigned int ui;
typedef pair<int,int> Pii;
typedef vector<int> Vi;
template<class T> inline void read(T &x){
	x=0; char c=getchar(); int f=1;
	while (!isdigit(c)) {if (c=='-') f=-1; c=getchar();}
	while (isdigit(c)) {x=x*10+c-'0'; c=getchar();} x*=f;
}
template<class T> inline void umin(T &x, T y){x=x<y?x:y;}
template<class T> inline void umax(T &x, T y){x=x>y?x:y;}
inline ui R() {
	static ui seed=416;
	return seed^=seed>>5,seed^=seed<<17,seed^=seed>>13;
}
const int N = 550000,inf=0x3f3f3f3f;
int n,a[N],ans[N],k,e[N][2],sz[N],m,v[N<<2];
inline void getinv(int *a, int *b){
	static int c[N];
	rep(i,1,n)c[a[i]]=i;rep(i,1,n)b[i]=c[i];
}
int find(int l, int r){
	l=max(l,1);r=min(r,n);if(l>r)return 0;
	l=l+m-1,r=r+m+1;int res=inf;
	while((l>>1)!=(r>>1)){
		if(!(l&1))res=min(res,v[l+1]);
		if(r&1)res=min(res,v[r-1]);
		l>>=1;r>>=1;
	}
	return res<inf?res:0;
}
int main() {
	read(n);read(k);rep(i,1,n)read(a[i]);getinv(a,a);
	for(m=1;m<=n+1;m<<=1);memset(v,0x3f3f3f3f,sizeof(v));
	per(i,n,1){
		int t=find(a[i]+1,a[i]+k-1);if(t)e[a[i]][sz[a[i]]++]=a[t];
		t=find(a[i]-k+1,a[i]-1);if(t)e[a[i]][sz[a[i]]++]=a[t];
		v[m+a[i]]=i;for(int j=m+a[i]>>1;j;j>>=1)v[j]=min(v[j<<1],v[j<<1|1]);
	}
	static int deg[N];priority_queue<int,Vi,greater<int> >heap;
	rep(i,1,n)rep(j,0,sz[i]-1)deg[e[i][j]]++;//,printf("e %d %d\n",i,e[i][j]);
	rep(i,1,n)if(!deg[i])heap.push(i);int now=0;
	while(!heap.empty()){
		int u=heap.top();heap.pop();ans[++now]=u;
		rep(i,0,sz[u]-1){
			if(!--deg[e[u][i]]){
				heap.push(e[u][i]);
			}
		}
	}
	getinv(ans,ans);
	rep(i,1,n)printf("%d\n",ans[i]);
	return 0;
}


Measured memory_bytes: 27764
//Bokan ga bokka--nn!!
//Daily Lunch Special Tanoshii !!
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
typedef long long ll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 2000000000
#define s(x) scanf("%d",&x)
#define rep(i,x) for(int i=0;i<x;i++)
int main()
{
while(1)
{
	int n,k;
	scanf("%d %d",&n,&k);
	if(!n) return 0;
	int ret=-INF;
	int res=0;
	queue<int>que;
	for(int i=0;i<k;i++)
	{
		int s; scanf("%d",&s);
		res+=s;
		que.push(s);
	}
	ret=max(ret,res);
	for(int i=k;i<n;i++)
	{
		int s; scanf("%d",&s);
		res+=s;
		res-=(que.front());
		ret=max(ret,res);
		que.pop();
		que.push(s);
	}
	printf("%d\n",ret);
}
}

Measured memory_bytes: 1340
b, c = map(int, input().split())
n=input()

A=[]
for i in n:
  A.append(i)
if A[c-1]=='A':
  A[c-1]='a'
if A[c-1]=='B':
  A[c-1]='b'
if A[c-1]=='C':
  A[c-1]='c'
ji=''.join(A)
print(ji)

Measured memory_bytes: 3064
#include <cstdio>
#include <iostream>

using namespace std;

int N;
static const int MAX = 1000000;
bool isPrime[MAX];

void solve(int n) {
  int n_2 = n * 2;
  int cnt = 0;
  for (int i = n + 1; i <= n_2; i++) {
    if (isPrime[i]) {
      cnt++;
    }
  }
  printf("%d\n", cnt);
}

void init() {
  isPrime[0] = isPrime[1] = false;
  fill(isPrime, isPrime + MAX, true);
  for (int i = 2; i * i < MAX; i++) {
    for (int j = i + i; j < MAX; j += i) {
      isPrime[j] = false;
    }
  }
}

int main() {
  init();
  while (cin >> N) {
    if (N == 0) {return 0;}
    solve(N);
  }
}

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

using namespace std;

#define Fast  ios::sync_with_stdio(false); cin.tie(0)
#define pb push_back
#define pf push_front
#define pp pop
#define ppb pop_back
#define ppf pop_front
#define mp make_pair
#define S second
#define F first
typedef long long ll;
const ll mod = 1e9 + 7;
const ll N = 1e6 + 5;
ll inf = 1e18;

pair <ll ,ll> p[N];

int main(){

    Fast;

    ll n;
    cin >> n;
    for(int i = 0  ; i < n ;i ++){
        cin >> p[i].F >> p[i].S;
    }

    for(int i = 0  ; i < n-2; i ++){
        if(p[i].F == p[i].S && p[i+1].F == p[i+1].S && p[i+2].F == p[i+2].S){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No";

    return 0;
}


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

#define all(c) (c).begin(),(c).end()
#define endl "\n"
#define ff first
#define ss second
#define allr(c) (c).rbegin(),(c).rend()
#define fr(x,in,n,r) for(ll x=in;x<n;x+=r)
#define ifr(x,n) for(ll x=0;x<n;x++)
#define dfr(x,n) for(ll x=n-1;x>=0;x--)
#define pb(a) push_back(a)
#define pf(a) push_front(a)
#define pof(a) pop_front(a)
#define pob(a) pop_back(a)
#define eb(a) emplace_back(a)
#define ef(a) emplace_front(a)
typedef long long ll;
typedef map<ll,ll> mll;
typedef map<string,ll> msll;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;
typedef long double ld;
#define mod 1000000007
ll n,m,ans=0;
vector<ll> v[11];
bool p[11];
bool b[11];

void fun(ll i){
	if(i==n){
		// ifr(j,n)
		// 	cout<<b[j]<<" ";
		// cout<<endl;
		ll c=0,j,k;
		bool f=1;
		ifr(j,m){
			c=0;
			ifr(k,v[j].size()){
				if(b[v[j][k]-1]==1)
					c++;
			}
			if((c%2)!=p[j]){f=0;break;}
		}
		if(f)
			ans++;
		return ;
	}
	b[i]=0;
	fun(i+1);
	b[i]=1;
	fun(i+1);
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    //freopen("input.txt","r",stdin);
	cin>>n>>m;
	ll t,i,r,j;
	ifr(i,m){
		cin>>t;
		ifr(j,t){
			cin>>r;
			v[i].pb(r);
		}
	}
	ifr(i,m)
		cin>>p[i];
	fun(0);
	cout<<ans<<endl;
	return 0;
}

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


int main(){
  int a,b,c;
  string ans = "No";
  cin >> a >> b >> c;

  if(a > b && b < c && a > c)
    ans = "Yes";
  if(a < b && b > c && a < c)
    ans = "Yes";

  cout << ans << endl;
}

Measured memory_bytes: 768
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <unordered_map>
#include <set>
#include <map>
#define rep(i,n) for (int i=0; i<n;++i)
#define ALL(a)  (a).begin(),(a).end()
#define PI 3.14159265358979
typedef long long ll;
using namespace std;
const ll MOD = 1e9+7LL;
const int INF = 2e9;
int a,b,c;

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

  cin >> a >> b >> c;
  string ans = a+b+c>=22?"bust":"win";
  cout << ans << "\n";
  return 0;
}

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

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

    vector<vector<int>> g(n);
    for(int i = 0; i < m; i++){
        int a, b;
        cin >> a >> b, a--, b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }

    vector<int> dist(n, -1);
    queue<int> que;

    dist[0] = 0;
    que.push(0);

    while(!que.empty()){
        int v = que.front(); que.pop();

        for(auto& nv : g[v]){
            if(dist[nv] != -1) continue;

            dist[nv] = v + 1;
            que.push(nv);
        }
    }
    for(int i = 0; i < n; i++){
        if(dist[i] == -1){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    for(int i = 1; i < n; i++) cout << dist[i] << endl;
    return 0;
}

Measured memory_bytes: 10188
H = int(input())
attackcnt = 0
monstercnt = 1
def monster(h, m, a):
    if h == 1:
        return 0,0,a+m
    else:
        return monster(int((h/2)),2*m,a+m)
a, b, c = monster(H,monstercnt,attackcnt)
print(c)

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

using namespace std;

#define PI 3.14159265358979323846264338327950L

int main(void){

    map<string,long long> mp;
    long long N;
    string tmp;

    cin>>N;

    for(long long i=0;i<N;i++){
        cin>>tmp;
        mp[tmp]++;
    }

    cout<<"AC x "<<mp["AC"]<<endl; 
    cout<<"WA x "<<mp["WA"]<<endl;
    cout<<"TLE x "<<mp["TLE"]<<endl;
    cout<<"RE x "<<mp["RE"]<<endl;



    return 0;
}



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

int main() {
    int n;
    cin>>n;
    double pi;
    vector<double> dp(n+1, 0);
    dp[0] = 1.0;
    for(int i=0; i<n; i++) {
        cin>>pi;
        for(int j = i+1; j >= 0; j--)
            dp[j] = (j == 0 ? 0 : dp[j - 1] * pi) + dp[j] * (1.0 - pi);
    }
    cout<< fixed << setprecision(10) <<
        accumulate(dp.begin() + (n+1)/2, dp.end(), 0.0) <<endl;
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include<string>
using namespace std;
int main(void){
    int a,b;
    string s;
    cin>>a>>s>>b;
    if(s[0]=='+'){
        cout<<a+b<<endl;
    }
    else cout<<a-b<<endl;
    return 0;
    // Your code here!
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(ll i = n;i >= 0;--i)
#define FOR(i,m,n) for(ll i = m, i##_len=(n);i <i##_len; ++i)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const int INF = 1e9;
const ll LLINF = 1e16;
 
int main(void)
{
    int R;
    cin>>R;

    const double PI= acos(-1);

    double A;

    A=2*PI*R;
    cout<< A <<endl;

    return 0;
}


Measured memory_bytes: 3804
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define EPS (1e-7)
#define INF (1e9)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const double PI = acos(-1);
const ll MOD = 1000000007;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
 
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
///////////////////////////////////////////////////////////////

int main() {
  ios::sync_with_stdio(false); cin.tie(nullptr); //入出力高速化
  ll N,M; cin >> N >> M;
  vector<ll> A(N);
  rep(i,N) cin >> A[i];
  
  vector<ll> B(N);
  rep(i,N) {
    if (i == 0) B[0] = A[0];
    else B[i] = B[i-1] + A[i];
    B[i] %= M;
  }
  unordered_map<ll,ll> dic;
  rep(i,N) dic[B[i]]++;
  ll ans = 0;
  for (auto i : dic) {
    if (i.first == 0) ans += i.second;
    ans += (i.second * (i.second - 1) / 2);
  }

  cout << ans << endl;
}

Measured memory_bytes: 5260
// {{{
#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <complex>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <algorithm>
#include <numeric>
using namespace std;

#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define FOR(i, a, b) for(ll i = static_cast<ll>(a); i < static_cast<ll>(b); i++)
#define FORR(i, a, b) for(ll i = static_cast<ll>(a); i >= static_cast<ll>(b); i--)
#define REP(i, n) for(ll i = 0ll; i < static_cast<ll>(n); i++)
#define REPR(i, n) for(ll i = static_cast<ll>(n); i >= 0ll; i--)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> IP;
typedef pair<ll, LP> LLP;

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

constexpr int INF = 100000000;
constexpr ll LINF = 10000000000000000ll;
constexpr int MOD = static_cast<int>(1e9 + 7);
constexpr double EPS = 1e-9;
// }}}

int N, M;
LP p[100000];
LP y[100000];

void init()
{
}

void solve()
{
    sort(y, y+M);
    map<ll, ll> m;
    REP(i, M){
        int n = m[p[y[i].se].fi];
        p[y[i].se].se = n+1;
        m[p[y[i].se].fi] = n+1;
    }
    REP(i, M){
        cout << setfill('0') << setw(12) << p[i].fi*1000000+p[i].se << endl;
    }
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N >> M;
    REP(i, M){
        cin >> p[i].fi >> y[i].fi;
        y[i].se = i;
    }
    solve();
    return 0;
}

// vim:set foldmethod=marker:


Measured memory_bytes: 10880
<?php
  fscanf(STDIN,"%d",$n);
 $t_li = explode(" ",trim(fgets(STDIN)));
 $sum=0;
 for($i=0;$i<count($t_li);$i++) $sum+=$t_li[$i];

 fscanf(STDIN,"%d",$m);
 for($i=0;$i<$m;$i++){
   $sum_douteki = $sum;
   $px=explode(" ",trim(fgets(STDIN)));
   $sum_douteki-=$t_li[$px[0]-1];
   $sum_douteki+=$px[1];
   echo $sum_douteki."\n";
 }
   



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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mp make_pair

using ll = long long;
using vll = vector<ll>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using P = pair<int, int>;

void Main(){
    int n; ll k;
    cin >> n >> k;
    vi a(n+1), b(n+1);
    rep(i, n) cin >> a[i+1];
    
    int now = 1;
    
    while(k){
        if(k%2) now = a[now];
        rep(i,n+1) b[i] = a[a[i]];
        swap(a,b);
        k /= 2;
    }
    
    cout << now << endl;
    return;
}

int main(){
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
	return 0;
}

Measured memory_bytes: 4788
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <utility>
#include <cmath>
#include <map>
#include <set>

#define INF_LL 9000000000000000000
#define INF 2000000000

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

using namespace std;

typedef long long ll;
typedef pair<int, int> PII;
typedef pair<double, int> PDI;

class Union_find{
private:
	vector<int> par;
	vector<int> rank;
	int n;

public:
	Union_find(int a){
		n = a;
		for(int i = 0;i < n;i++){
			par.push_back(i);
			rank.push_back(0);
		}
	}

	int find(int x){
		if(par[x] == x){
			return x;
		}else{
			return par[x] = find(par[x]);
		}
	}

	void unite(int x, int y){
		x = find(x);
		y = find(y);
		if(x == y) return;

		if(rank[x] < rank[y]){
			par[x] = y;
		}else{
			par[y] = x;
			if(rank[x] == rank[y]) rank[x]++;
		}
	}

	bool same(int x, int y){
		return find(x) == find(y);
	}
};

bool dfs(string s, string to){
	bool flag = false;
	if(s == to) return true;
	if(s != to.substr(0, s.size())) return false;

	if(s.size() >= to.size()) return false;
	if(dfs(s+"dream", to)) flag = true;
	if(dfs(s+"dreamer", to)) flag = true;
	if(dfs(s+"erase", to)) flag = true;
	if(dfs(s+"eraser", to)) flag = true;

	return flag;
}

int main(void){
	string s;
	int p = 0;
	string add[4] = {"dream", "dreamer", "erase", "eraser"};
	cin >> s;
	while(p < s.size()){
		if(s.size() - p < 5){
			cout << "NO" << endl;
			return 0;
		}
		if(s.substr(p, 5) == add[0]){
			if(s.substr(p, 7) != add[1]){
				p += 5;
				continue;
			}
			if(s.substr(p+5, 5) != add[2]){
				p += 7;
				continue;
			}else{
				p += 5;
				continue;
			}
		}else if(s.substr(p, 5) == add[2]){
			if(s.substr(p, 6) != add[3]){
				p += 5;
				continue;
			}
			if(s.substr(p+5, 5) != add[2]){
				p += 6;
				continue;
			}else{
				p += 5;
				continue;
			}
		}else{
			cout << "NO" << endl;
			return 0;
		}
	}
	cout << "YES" << endl;
	return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>                                                                          
using namespace std;
int main()
{
  vector<int> group={0,1,0,2,0,2,0,0,2,0,2,0};
  int x,y;
  cin >> x >> y;
  if(group.at(x-1)==group.at(y-1))
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    int a[3];
    for(int i=0;i<3;i++){
        cin >> a[i];
    }
    int ans = a[0]+a[1]+a[2];
    if(ans<22) cout << "win" << endl;
    else cout << "bust" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <list>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iterator>
#include <set>
#include <functional>

using namespace std;

#define DT long long
#define forn(i,n)for(i=0;i<n;i++)
#define forc(i,c,n)for(i=c;i<=n;i++)
#define all(x) (x).begin(), (x).end()


int main() {
	ifstream fin("Text.txt");
	DT i, j, q;
	DT a, b, c,cnt=0,oc=0, n, l,sum=0;
	cin >> n;
	oc = ((1 + n)*n) / 2;
	cin >> a;
	if (n == 1) {
		cout << "YES" << endl;
		return 0;
	}

	vector<DT> vc(n+1);
	vc[0] = a;
	sum = a;
	forn(i, n-1) {
		cin >> b; 
		vc[i + 1]=b;
		sum += b;
	}
	if (sum%oc) {
		cout << "NO" << endl;
		return 0;
	}
	vc[n] = a;
	cnt = sum/ oc;
	DT fcnt,tcnt=0;
	forn(i, n ) {
		b = vc[i + 1];
		if ((a - b + cnt) < 0 || (a - b + cnt) % n) {
			cout << "NO" << endl;
			return 0;
		}
		fcnt = (a - b + cnt) / n;
		tcnt += fcnt;
		a = b;
	}
	if (tcnt == cnt) {
		cout << "YES" << endl;
		return 0;
	}
	cout << "NO" << endl;
	return 0;
}

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

int h,w;
vector<vector<int>> maze(20);

int calc_route(int sx,int sy,int gx,int gy){
    // cout << "sx,sy,gx,gy:" << sx << " " << sy << " " << gx << " " << gy << endl;
    if((sx==gx) && (sy==gy)){
        return 0;
    }
    
    vector<vector<int>> walk_map(20);
    rep(i,h){
        rep(j,w){
            if(maze.at(i).at(j) == 0){
                walk_map.at(i).push_back(-2);    
            }else {
                walk_map.at(i).push_back(-1);
            }
        }
    }
    queue<pair<int,int>> q;

    q.push(pair<int,int>(sx, sy));
    walk_map.at(sy).at(sx) = 0;
    
    while(!q.empty()){
        pair<int,int> p;
        p = q.front();
        q.pop();
        if((p.first == gx) && (p.second == gy)){
            // cout << walk_map.at(p.second).at(p.first) << endl;
            break;
        }

        if((p.first-1) >= 0 && (walk_map.at(p.second).at(p.first-1) == -1)){
            q.push(pair<int,int>(p.first-1,p.second));
            walk_map.at(p.second).at(p.first-1) = walk_map.at(p.second).at(p.first) + 1;
        }
        if((p.first+1) < w && (walk_map.at(p.second).at(p.first+1) == -1)){
            q.push(pair<int,int>(p.first+1,p.second));
            walk_map.at(p.second).at(p.first+1) = walk_map.at(p.second).at(p.first) + 1;
        }
        if((p.second-1) >= 0 && (walk_map.at(p.second-1).at(p.first) == -1)){
            q.push(pair<int,int>(p.first,p.second-1));
            walk_map.at(p.second-1).at(p.first) = walk_map.at(p.second).at(p.first) + 1;
        }
        if((p.second+1) < h && (walk_map.at(p.second+1).at(p.first) == -1)){
            q.push(pair<int,int>(p.first,p.second+1));
            walk_map.at(p.second+1).at(p.first) = walk_map.at(p.second).at(p.first) + 1;
        }
    }
    return walk_map.at(gy).at(gx);
}

int main(){
    cin >> h >> w;
    
    rep(i,h){
        rep(j,w){
            char c;
            cin >> c;
            if(c == '.'){
                maze.at(i).push_back(1);
            }else {
                maze.at(i).push_back(0);
            }
        }
    }
    
    int result = -1;
    rep(sy,h){
        rep(sx,w){
            if(maze.at(sy).at(sx) == 0){
                continue;
            }
            rep(gy,h){
                rep(gx,w){
                    if(maze.at(gy).at(gx) == 0){
                        continue;
                    }

                    result = max(calc_route(sx,sy,gx,gy), result);
                }
            }
        }
    }
    cout << result << endl;
    return 0;
} 

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

int main(void) {
  int n, k, i, cou=0, tmp;
  scanf("%d %d", &n, &k);
 if(k>=n)printf("unsafe");
 else printf("safe");
 return 0;

}


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

int main() {
  int A, B, C, D, E;
  cin >> A >> B >> C >> D >> E;

  int ans;
  if (!(A % 10) && !(B % 10) && !(C % 10) && !(D % 10) && !(E % 10)) {
    ans = A + B + C + D + E;
  }
  else {
    int m(9);
    if (A % 10 != 0) {
      m = min(m, (A % 10));
      A = (A + 10) - (A % 10);
    }
    if (B % 10 != 0) {
      m = min(m, (B % 10));
      B = (B + 10) - (B % 10);
    }
    if (C % 10 != 0) {
      m = min(m, (C % 10));
      C = (C + 10) - (C % 10);
    }
    if (D % 10 != 0) {
      m = min(m, (D % 10));
      D = (D + 10) - (D % 10);
    }
    if (E % 10 != 0) {
      m = min(m, (E % 10));
      E = (E + 10) - (E % 10);
    }
    ans = A + B + C + D + E - 10 + m;
  }
  cout << ans << endl;

  return 0;
}

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

int main(){
	string s;
	cin >> s;
	int i,j,siz=s.size();
	s.pop_back();
	if(siz%2==0){
		s.pop_back();
		siz--;
	} 
		siz/=2;
	
	while(siz>0){
		j=1;
		for(i=0; i<siz; i++){
			if(s[i]!=s[i+siz]) j=0;
		}
		if(j==1){
			cout << siz*2; return 0;			
		}
		s.pop_back();
		s.pop_back();
		siz--;
	}
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <bitset>
using namespace std;

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define index(xs, x) (int)(lower_bound(all(xs), x) - xs.begin())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007

int N, K;
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> N >> K;
  vector<int> minus, plus;
  rep(i, N) {
    int x;
    cin >> x;
    if (x >= 0) plus.pb(x);
    else minus.pb(-x);
  }
  sort(all(plus));
  sort(all(minus));
  long long m = 1LL<<60;
  rep(a, K+1) {
    if (a > plus.size()) continue;
    int b = K-a;
    if (b > minus.size()) continue;
    int right = 0, left = 0;
    if (a > 0) right = plus[a-1];
    if (b > 0) left = minus[b-1];
    m = min(m, 2LL*left+right);
    m = min(m, 2LL*right+left);
  }
  cout << m << "\n";
  return 0;
}


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

using namespace std;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define FOR(i, a, b) for(int i = (a); i < (b); i++)

signed main() {
  IOS;
  int n;
  int s=0, s2=0, mm;
  cin >> n;
  vector<int> W(n);
  FOR (i, 0, n) {
    cin >> W[i];
    s += W[i];
  }
  mm = s;
  FOR (i, 0, n) {
    s2 += W[i];
    mm = min(mm, abs(s2 - (s-s2)));
  }

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll helper(pair<ll,ll> *ar,ll n,ll w,ll ind,ll **dp)
{
    if(ind == n-1)
    {
        if(ar[ind].first <= w)
        return ar[ind].second;
        else
        return 0;
    }
    if(w <= 0)
    return 0;
    
    if(dp[ind][w] != -1)
    return dp[ind][w];
    
    if(ar[ind].first <= w)
    {
        dp[ind][w] = max(ar[ind].second + helper(ar,n,w - ar[ind].first,ind+1,dp),helper(ar,n,w,ind+1,dp));
    }
    else
    {
        dp[ind][w] = helper(ar,n,w,ind+1,dp);
    }
    return dp[ind][w];
}

int main()
{
    ll n,w;
    cin>>n>>w;
    pair<ll,ll> *ar = new pair<ll,ll>[n];
    for(ll i = 0;i<n;i++)
    {
        ll x,y;
        cin>>x>>y;
        ar[i] = {x,y};
    }
    ll **dp = new ll*[n];
    for(ll i = 0;i<n;i++)
    {    dp[i] = new ll[w+1];
        for(ll j = 0;j<=w;j++)
        dp[i][j] = -1;
    }
    cout<<helper(ar,n,w,0,dp)<<endl;
}

Measured memory_bytes: 80256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class Main {

    private static Scanner sc;

    public static void main(String[] args) {
        Main instance = new Main();
        sc = instance.new Scanner();
        instance.solve();
    }

    private void solve() {
        try {
            int N = sc.nextInt();
            int a[] = new int[N];
            for(int i=0; i<N; i++) {
                a[i] = sc.nextInt();
            }

            int alice = 0;
            int bob = 0;

            quickSort(a, 0, N-1);

            for(int i = N-1; i>=0; i-=2) {
                alice += a[i];
                if(i-1>=0) bob += a[i-1]; 
           }

            System.out.println(alice-bob);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void quickSort(int arr[], int begin, int end) {
        if (begin < end) {
            int partitionIndex = partition(arr, begin, end);

            quickSort(arr, begin, partitionIndex-1);
            quickSort(arr, partitionIndex+1, end);
        }
    }

    private int partition(int arr[], int begin, int end) {
        int pivot = arr[end];
        int i = (begin-1);
    
        for (int j = begin; j < end; j++) {
            if (arr[j]<= pivot) {
                i++;
    
                int swapTemp = arr[i];
                arr[i]= arr[j];
                arr[j]= swapTemp;
            }
        }
    
        int swapTemp = arr[i+1];
        arr[i+1]= arr[end];
        arr[end]= swapTemp;
    
        return i+1;
    }

    private class Scanner {
        String[] s;
        int i;
        BufferedReader br;
        String regex = " ";

        public Scanner() {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        @Override
        protected void finalize() throws Throwable {
            try {
                super.finalize();
            } finally {
                destruction();
            }
        }

        private void destruction() throws IOException {
            if (br != null) br.close();
        }

        public String next() throws IOException {
            if (i < s.length) return s[i++];
            String st = br.readLine();
            while (st == "") st = br.readLine();
            s = st.split(regex, 0);
            i = 0;
            return s[i++];
        }

        public int nextInt() throws NumberFormatException, IOException {
            return Integer.parseInt(next());
        }

        public Long nextLong() throws NumberFormatException, IOException {
            return Long.parseLong(next());
        }

        public Double nextDouble() throws NumberFormatException, IOException {
            return Double.parseDouble(next());
        }
    }
}

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

int main(void){
  int x,y,z,k;
  cin >> x >> y >> z >> k;
  vector<long> a(x);
  vector<long> b(y);
  vector<long> c(z);
  for(int i = 0; i < x; i++)cin >> a[i];
  for(int i = 0; i < y; i++)cin >> b[i];
  for(int i = 0; i < z; i++)cin >> c[i];

  vector<long> sumAB(x * y);
  for(int i = 0; i < x; i++){
    for(int j = 0; j < y; j++){
      sumAB[i * y + j] = a[i] + b[j];
    }
  }
  sort(sumAB.rbegin(),sumAB.rend());
  
  sumAB.resize(k);
  vector<long> sumALL(k * z);
  for(int i = 0; i < k; i++){
    for(int j = 0; j < z; j++){
      sumALL[i * z + j] = sumAB[i] + c[j];
    }
  }
  sort(sumALL.rbegin(),sumALL.rend());

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

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

using namespace std;
using ll = long long;
using P = pair<int,int>;
inline int ri() {
	int r; cin >> r; return r;
}


int main()
{
	int a, p;
	cin >> a >> p;
	cout << (a * 3 + p) / 2 << endl;
}

Measured memory_bytes: 256
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <tuple>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <fstream>
#include <random>
//#include <time.h>
#include <ctime>
#pragma endregion //#include
/////////
#define REP(i, x, n) for(int i = x; i < n; ++i)
#define rep(i,n) REP(i,0,n)
#define ALL(X) X.begin(), X.end()
/////////
#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
typedef std::pair<LL,LL> PLL;//
typedef std::pair<int,int> PII;//
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)4e18+20;
const LD PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

void solve(){
	string str;
	cin >> str;
	str[3] = '8';
	cout << str << endl;
}

#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}
#pragma endregion //main()

Measured memory_bytes: 256
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,j,n) for(int i = j; i < n; i++)
#define rrep(i,j,n) for(int i = j-1; i >= n; i--)
#define prec(n) fixed << setprecision(n)
#define print_array(v) rep(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define fi first
#define se second
using namespace std;

int inf = 2147483647;
int64_t inf64 = 9223372036854775807;
int MOD = 1e+7;

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

  int n;
  cin >> n;
  map<int, int> mp;
  rep(i,n-1) {
    int a;
    cin >> a;
    a--;
    mp[a]++;
  }
  rep(i,n) cout << mp[i] << endl;
  return 0;
}

Measured memory_bytes: 12972
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
int N;
int A[200010];
std::vector<int> S;
int main() {
	std::cin >> N;
	for (int i = 1; i <= N; i++) {
		std::cin >> A[i];
		S.push_back(A[i]);
	}
	std::sort(S.begin(), S.end());
	for (int i = 1; i <= N; i++) {
		if (A[i]<=S[N/2 - 1]) {
			std::cout << S[N / 2] << std::endl;
		}
		else {
			std::cout << S[N / 2 - 1] << std::endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3828
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>
#include <stack>



#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).end()

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

typedef long long ll;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n,m;cin>>n>>m;
  vector<string>a(n),b(m);
  rep(i,n){
    cin>>a[i];
  }
  rep(i,m){
    cin>>b[i];
  }
  rep(i,n-m+1)rep(j,n-m+1){
    int f=1;
    rep(p,m)rep(q,m){
      if(a[i+p][j+q]!=b[p][q])f=0;
    }
    if(f){
      cout<<"Yes"<<endl;
      return 0;
    }
  }
  cout<<"No"<<endl;

  return 0;

}


Measured memory_bytes: 256
import java.time.Month;
import java.util.Scanner;

public class Main {

	private static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int x = sc.nextInt(), y = sc.nextInt();
		System.out.println(Month.of(x).minLength() == Month.of(y).minLength() ? "Yes" : "No");
	}
}

Measured memory_bytes: 23252
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>

//#pragma GCC optimize("O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")
//#pragma GCC optimize ("unroll-loops")

using namespace std;
using namespace __gnu_pbds;

#define all(x) x.begin(), x.end()
#define mp make_pair
#define X first
#define Y second

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;
mt19937_64 gen(322);

ll const mod = 1e9 + 7;

namespace {
    ll mul(ll a, ll b) {
        ll val = a * b - (ll)((ld)a * b / mod) * mod;
        if (val < 0) val += mod;
        if (val >= mod) val -= mod;
        return val;
    }
    ll poww(ll a, ll b) {
        ll val = 1;
        a %= mod;
        while (b > 0) {
            if (b % 2) val = mul(a, val);
            a = mul(a, a);
            b >>= 1;
        }
        return val % mod;
    }
    ll inv(ll a) {
        return poww(a, mod - 2);
    }
}

ll const maxn = 3e5 + 5;

struct edge{
    ll to, len;
};

vector<edge>g[maxn];
ll l;

pair<ll,ll> go(pair<ll,ll> p, edge e){
    ll ost = -p.Y;
    ll new_ost = 0;
    ll cnt = p.X;
    ll new_cnt = p.X;
    if(ost >= e.len){
        new_ost = ost - e.len;
    } else{
        cnt++;
        new_ost = l - e.len;
    }
    return{cnt, -new_ost};
}

ll ans[305][305];
signed main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    ll n; cin >> n; ll m; cin >> m; cin >> l;
    for(ll i = 0;i<m;i++){
        ll a,b; cin >> a >> b;
        ll c; cin >> c;
        if(c <= l){
            g[a].push_back({b,c});
            g[b].push_back({a,c});
        }
    }
    for(ll s = 1;s<=n;s++){
        vector<pair<ll,ll>> dp(n+1, {1e9, 1e9});
        vector<char>used(n+1);
        dp[s] = {0, -l};
        for(ll i = 1;i<=n;i++){
            ll u = -1;
            for(ll j = 1;j<=n;j++){
                if (!used[j] && (u == -1 || dp[j] < dp[u]))
                    u = j;
            }
            if(dp[u].X == 1e9) break;
            used[u] = 1;
            for(auto e : g[u]){
                ll v = e.to;
                pair<ll,ll> new_dp = go(dp[u], e);
                if(new_dp < dp[v]){
                    dp[v] = new_dp;
                }
            }
        }
        for(ll t = 1;t<=n;t++) ans[s][t] = (dp[t].X == 1e9 ? -1 : dp[t].X);
    }
    ll q; cin >> q; while(q--){
        ll s, t; cin >> s >> t;
        cout << ans[s][t] << '\n';
    }


    return 0;
}
/*

*/

Measured memory_bytes: 10624