akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v)   (v).begin(),(v).end()
#define vi   vector<int>
#define vvi  vector<vi >
#define vvvi vector<vvi >
#define pii  pair<int,int>
#define INF  (int)1e9
#define MOD  (int)1e9+7
typedef long long llong;
using namespace std;

int main(){
	int r;
	cin>>r;
	
	cout<<3*r*r<<endl;
}

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

using namespace std;

#define x first
#define y second
#define mp make_pair
#define pb push_back
#define sqr(a) ((a) * (a))
#define sz(a) int(a.size())
#define all(a) a.begin(), a.end()
#define forn(i, n) for(int i = 0; i < int(n); i++) 
#define fore(i, l, r) for(int i = int(l); i < int(r); i++)

typedef long long li;
typedef long double ld;
typedef pair<int, int> pt;

template <class A, class B> ostream& operator << (ostream& out, const pair<A, B> &a) {
	return out << "(" << a.x << ", " << a.y << ")";
}

template <class A> ostream& operator << (ostream& out, const vector<A> &v) {
	out << "[";
	forn(i, sz(v)) {
		if(i) out << ", ";
		out << v[i];
	}
	return out << "]";
}

mt19937 rnd(time(NULL));

const int INF = int(1e9);
const li INF64 = li(1e18);
const int MOD = INF + 7;
const ld EPS = 1e-9;
const ld PI = acos(-1.0);

const int N = 100 + 7;

int n;
int a[N];

bool read () {
	if (scanf("%d", &n) != 1)
		return false;
	forn(i, n)
		scanf("%d", &a[i]);
	return true;
}

int binpow(int a, int b){
	int res = 1;
	while (b){
		if (b & 1)
			res = (res * li(a)) % MOD;
		a = (a * li(a)) % MOD;
		b >>= 1;
	}
	return res;
}

pt get(int l, int r){
	if (l == r)
		return mp(1, 0);
	
	int mn = *min_element(a + l, a + r);
	
	vector<pt> dp;
	int lst = l;
	int cnt = 0;
	fore(i, l, r){
		a[i] -= mn;
		if (a[i] == 0){
			dp.pb(get(lst, i));
			lst = i + 1;
			++cnt;
		}
	}
	dp.pb(get(lst, r));
	
	fore(i, l, r)
		a[i] += mn;
	
	int dp1 = binpow(2, mn), dp2 = 0;
	for (auto it : dp)
		dp1 = (dp1 * li(it.x)) % MOD;
	
	int tmp;
	
	tmp = binpow(2, cnt);
	for (auto it : dp)
		tmp = (tmp * li(it.x + it.y)) % MOD;
	dp2 = (dp2 + tmp) % MOD;
	
	tmp = (binpow(2, mn) - 2 + MOD) % MOD;
	for (auto it : dp)
		tmp = (tmp * li(it.x)) % MOD;
	dp2 = (dp2 + tmp) % MOD;
	
	return mp(dp1, dp2);
}

void solve() {
	printf("%d\n", get(0, n).y);
}

int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
	
	int tt = clock();
	
#endif
	
	cerr.precision(15);
	cout.precision(15);
	cerr << fixed;
	cout << fixed;

#ifdef _DEBUG
	while(read()) {	
#else
	if(read()) {
#endif
		solve();
		
#ifdef _DEBUG
	cerr << "TIME = " << clock() - tt << endl;
	tt = clock();
#endif

	}
}

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

int main() {
  int64_t N;
  cin >> N;
  int64_t ans = N - 1;
  for(int64_t i = 1; i * i <= N; i++) {
    if(N % i != 0) {
      continue;
    }
    else if(ans > i + N / i - 2) {
      ans = i + N / i - 2;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

print(rr().count('o')*100 + 700)

















Measured memory_bytes: 27164
n,a,b=list(map(int,input().split()))
#2^n-nCa-nCbを求めればいい。ただし100000007で割ったあまりでなくてはならない
#まずは2^nを求める
def pow(x,n,m):
  if n==0:
    return 1
  res=pow(x*x%m,n//2,m)
  if n%2==1:
    res=res*x%m
  return res

#コンビネーションを求める
c=max(a,b)
inv=[0 for i in range(c+1)]
finv=[0 for i in range(c+1)]
inv[1]=1
finv[0]=finv[1]=1
for i in range(2,c+1):
  #iの逆数を求める。
  #mod　p=1000000007の世界で逆元を求める
  #p=(p//a)*a+(p%a)
  #mod pをとると a=-(p//a)*(p%a)^-1
  inv[i]=1000000007-(1000000007//i)*inv[1000000007%i]%1000000007
  finv[i]=finv[i-1]*inv[i]%1000000007
def kaizyou(k):
  num=1
  for i in range(n-k+1,n+1):
    num=num*i%1000000007
  return num

def combinations(k):
  return kaizyou(k)*finv[k]%1000000007

print((pow(2,n,1000000007)-combinations(a)-combinations(b)-1)%1000000007)

  
  
  


Measured memory_bytes: 24584
#include<bits/stdc++.h>
 
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-funroll-loops")
#pragma GCC target("avx,sse4")
 
#define mms(a,n) memset(a,0,sizeof((a)[0])*(n))
#define mmp(a,b,n) memcpy(a,b,sizeof((b)[0])*(n))
#define lowbit(x) ((x)&-(x))
#define pb push_back
#define fi first
#define se second
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define fo(i,l,r) for(register int i=l,_lim_=r;i<=_lim_;i++)
#define fd(i,r,l) for(register int i=r,_lim_=l;i>=_lim_;i--)
#define fos(i,l,r,d) for(register int i=l,_lim_=r;i<=r;i+=d)
#define fol(i,l,r) for(register ll i=l,_lim_=r;i<=_lim_;i++)
#define fdl(i,r,l) for(register ll i=r,_lim_=l;i>=_lim_;i--)
#define fosl(i,l,r,d) for(register ll i=l,_lim_=r;i<=r;i+=d)
#define Clear(a) memset(a,0,sizeof(a))
#define Copy(a,b) memcpy(a,b,sizeof(b))
#define ALL(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define sqr(x) ((x)*(x))
#define GCD __gcd

using namespace std;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ldb;
typedef double db;
typedef pair<int,int> pi;
typedef vector<int> VI;
typedef vector<VI> VII;

namespace io{
	const int L=(1<<21)+1;
	char ibuf[L],*iS,*iT,obuf[L],*oS=obuf,*oT=obuf+L-1,c,st[55];int f,tp;
	#ifdef whzzt
		#define gc()getchar()
	#else
		#define gc()(iS==iT?(iT=(iS=ibuf)+fread(ibuf,1,L,stdin),(iS==iT?EOF:*iS++)):*iS++)
	#endif
	inline void flush(){fwrite(obuf,1,oS-obuf,stdout);oS=obuf;}
	inline void putc(char x){*oS++=x;if(oS==oT)flush();}
	template<class I>
	inline void gi(I&x){
		for(f=1,c=gc();c<'0'||c>'9';c=gc())if(c=='-')f=-1;
		for(x=0;c<='9'&&c>='0';c=gc())x=x*10+(c&15);x*=f;
	}
	template<class I>
	inline void print(I x){
		if(!x)putc('0');if(x<0)putc('-'),x=-x;
		while(x)st[++tp]=x%10+'0',x/=10;
		while(tp)putc(st[tp--]);
	}
	inline void gs(char*s,int&l){
		for(c=gc();c<'a'||c>'z';c=gc());
		for(l=0;c<='z'&&c>='a';c=gc())s[l++]=c;
	}
	inline void ps(const char*s){
		fo(i,0,strlen(s)-1)putc(s[i]);
	}
};
using io::putc;
using io::gi;
using io::gs;
using io::ps;
using io::print;

const int N=1005,M=1005;

int n,m,A,B,x,y,z;
char s[N][M];

int main(){
	cin>>n>>m>>A>>B;
	fo(i,1,n)fo(j,1,m)s[i][j]='.';
	if(n&1){
		fos(i,1,m-1,2){
			if(!A)break;
			s[n][i]='<';s[n][i+1]='>';A--;
		}
	}
	if(m&1){
		fos(i,1,n-1,2){
			if(!B)break;
			s[i][m]='^';s[i+1][m]='v';B--;
		}
	}
	fos(i,1,n-1,2)fos(j,1,m-1,2){
		if(A>=2){
			s[i][j]='<';s[i][j+1]='>';A--;
			s[i+1][j]='<';s[i+1][j+1]='>';A--;
		}else if(B>=2){
			s[i][j]='^';s[i+1][j]='v';B--;
			s[i][j+1]='^';s[i+1][j+1]='v';B--;
		}else if(i==n-2&&j==m-2&&A==1&&B==1){
			s[i][j]='<';s[i][j+1]='>';s[i][j+2]='^';
			s[i+1][j]='^';s[i+1][j+1]='.';s[i+1][j+2]='v';
			s[i+2][j]='v';s[i+2][j+1]='<';s[i+2][j+2]='>';
			A--;B--;
		}else if(A){
			s[i][j]='<';s[i][j+1]='>';A--;
		}else if(B){
			s[i][j]='^';s[i+1][j]='v';B--;
		}else break;
	}
	if(A||B)puts("NO"),exit(0);
	puts("YES");
	fo(i,1,n)puts(s[i]+1);
	return 0;
}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
#define int long long

using namespace std;
using LL = long long;
using P = pair<int, int>;
using Tapris = tuple<int, int, int>;

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

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e15;
const int MOD = 1e9 + 7;

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

/*************** using variables ***************/
int n;
vector<int> a, ruiseki;
/**********************************************/

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

    cin >> n;
    a.assign(n, 0);
    ruiseki.assign(n+1, 0);
    REP(i, n) cin >> a[i];
    
    FOR(i, 1, n+1){
        ruiseki[i] = ruiseki[i-1] + a[i-1];
    }

    map<int, int> mp;

    int ans = 0;
    REP(i, n+1){
        if(mp.count(ruiseki[i])) ans += mp[ruiseki[i]];
        mp[ruiseki[i]]++;
    }
    cout << ans << endl;
}


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

using namespace std;

const int backet = 333;

int N, Q;
vector< int > g[150000];
int in[150000], out[150000], ptr;

int sz[(150000 + backet - 1) / backet][10];
int convert[(150000 + backet - 1) / backet][10];
int data[150000];

void tour(int idx, int par = -1)
{
  in[idx] = ptr++;
  for(int &to : g[idx]) if(to != par) tour(to, idx);
  out[idx] = ptr;
}

void push(int k)
{
  for(int i = k * backet; i < min(N, (k + 1) * backet); i++) {
    data[i] = convert[k][data[i]];
  }
  for(int i = 0; i < 10; i++) {
    convert[k][i] = i;
    sz[k][i] = 0;
  }
  for(int i = k * backet; i < min(N, (k + 1) * backet); i++) {
    sz[k][data[i]]++;
  }
}

int main()
{
  cin >> N >> Q;
  for(int i = 1; i < N; i++) {
    int U, V;
    cin >> U >> V;
    g[U].push_back(V);
    g[V].push_back(U);
  }
  tour(0);

  int all = (N + backet - 1) / backet;
  for(int i = 0; i < all; i++) {
    sz[i][0] += min(N, (i + 1) * backet) - i * backet;
    for(int j = 0; j < 10; j++) convert[i][j] = j;
  }

  while(Q--) {
    int t, s, x, y;
    cin >> t >> s >> x >> y;

    int a = in[s], b = out[s];

    if(t == 1) {
      int sum = 0;
      for(int i = 0; i < all; i++) {
        int l = i * backet, r = min(N, (i + 1) * backet);
        if(a >= r || b <= l) continue;
        if(a <= l && r <= b) {
          for(int k = 0; k < 10; k++) {
            if(x <= convert[i][k] && convert[i][k] <= y) sum += sz[i][k];
          }
        } else {
          push(i);
          for(int j = max(a, l); j < min(b, r); j++) {
            if(x <= data[j] && data[j] <= y) sum++;
          }
        }
      }
      cout << sum << endl;
    } else {
      for(int i = 0; i < all; i++) {
        int l = i * backet, r = min(N, (i + 1) * backet);
        if(a >= r || b <= l) continue;
        if(a <= l && r <= b) {
          for(int k = 0; k < 10; k++) {
            if(convert[i][k] == x) convert[i][k] = y;
          }
        } else {
          push(i);
          for(int j = max(a, l); j < min(b, r); j++) {
            if(data[j] == x) {
              data[j] = y;
              --sz[i][x];
              ++sz[i][y];
            }
          }
        }
      }
    }
  }
}

Measured memory_bytes: 15316
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define FAST_IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main(){
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int n,h,w;
    while(cin>>n>>h>>w){
        cout<<(n-h+1)*(n-w+1)<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
n,c,k,*a=$<.read.split.map &:to_i
a.sort!
t=1
b=[a[0]]
1.upto(n-1) do |i|
  if b[0]+k>=a[i] && c>b.length
    b<< a[i]
  else
    t+=1
    b=[a[i]]
  end
end
p t

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

using namespace std;
typedef long long ll;
int main(){
  int n; cin >> n;
  ll a; cin >> a;
  ll b; cin >> b;
  if(a > b){
    cout << 0 << "\n";
    return 0;
  }
  if(n == 1){
    if(a == b) cout << 1 << "\n";
    else cout << 0 << "\n";
    return 0;
  }
  //so a <= b and n >= 2
  ll mn = b + (n-1) * a;
  ll mx = a + (n-1) * b;
  cout << mx - mn + 1 << "\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define itn int
#define gI gi

using namespace std;

typedef long long ll;

inline int gi()
{
	int f = 1, x = 0; char c = getchar();
	while (c < '0' || c > '9') {if (c == '-') f = -1; c = getchar();}
	while (c >= '0' && c <= '9') x = x * 10 + (c ^ 48), c = getchar();
	return f * x;
}

inline ll gl()
{
	ll f = 1, x = 0; char c = getchar();
	while (c < '0' || c > '9') {if (c == '-') f = -1; c = getchar();}
	while (c >= '0' && c <= '9') x = x * 10 + (c ^ 48), c = getchar();
	return f * x;
}

const int maxn = 100003;

int n, k, p, m, ton[maxn], vis[maxn];
char s[5];

int main()
{
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);
	n = gi(),m = gi();
	for (int i = 1; i <= m; i+=1)
	{
		int x = gi();
		scanf("%s", s);
		if (vis[x]) continue;
		if (s[0] == 'A') vis[x] = 1;
		else ++ton[x];
	}
	for (int i = 1; i <= n; i+=1) if (vis[i]) ++p, k += ton[i];
	cout << p << ' ' << k << endl;
	return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <utility>
#include <algorithm>

#define lli long long int
#define ll pair<lli, lli>
#define mp make_pair
#define fi first
#define se second

using namespace std;

int main() {
	lli n, m, ans = 0, ambil;
	ll p[100010];
	scanf("%lld %lld", &n, &m);
	for (lli i = 0; i < n; i++)
		scanf("%lld %lld", &p[i].fi, &p[i].se);
	sort(p, p + n);
	for (int i = 0; i < n; i++) {
		ambil = min(m, p[i].se);
		ans += (ambil * p[i].fi);
		m -= ambil;
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 1664
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>

using namespace std;

int main(void){
    string str;
    cin >> str;
    printf("%d", count(str.cbegin(), str.cend(), '1'));
    //printf("%d %d", a, b);
    
    
    return 0;
}


Measured memory_bytes: 256
def find(x):
    if parent[x]<0:
        return x
    else:
        parent[x]=find(parent[x])
        return parent[x]

def same(x,y):
    return find(x)==find(y)

def union(x,y):
    root_x=find(x)
    root_y=find(y)
    if root_x==root_y:
        return
    if parent[root_x]>parent[root_y]:
        root_x,root_y=root_y,root_x
    parent[root_x]+=parent[root_y]
    parent[root_y]=root_x

def members(n,x):
    root=find(x)
    return [i for i in range(n) if find(i)==root]

def get_size(x):
    return -parent[find(x)]

def get_root():
    return [i for i, root in enumerate(parent) if root<0]

N,M=map(int,input().split())
parent=[-1 for i in range(N)]
for i in range(M):
    a,b=map(int,input().split())
    a=a-1
    b=b-1
    union(a,b)

ans=0
for i in parent:
    if i<0:
        ans+=1

print(ans-1)

Measured memory_bytes: 10896
import std;

alias sread = () => readln.chomp();
alias lread = () => readln.chomp.to!long();
alias aryread(T = long) = () => readln.split.to!(T[]);
//aryread!string();
//auto PS = new Tuple!(long,string)[](M);
//x[]=1;でlong[]全要素1に初期化
void main()
{
    auto s = sread();
    long i = 1;
    string previous; //前の文字
    previous = s[0 .. 1];
    // writeln(previous);
    long cnt = 1;
    // writeln(s);
    while (i < (s.length))
    {
        // writeln(s[i .. i + 1]);
        if (previous == s[i .. i + 1])
        {
            if (i + 2 <= s.length)
            {
                previous = s[i .. i + 2];
                i += 2;
                cnt += 1;
            }
            else
            {
                break;
            }
        }
        else
        {
            if (i + 1 <= s.length)
            {
                previous = s[i .. i + 1];
                i += 1;
                cnt += 1;
            }
            else
            {
                break;
            }
        }
        // writeln("i:", i);
        // writeln("pre:", previous);
    }
    writeln(cnt);
}

void scan(L...)(ref L A)
{
    auto l = readln.split;
    foreach (i, T; L)
    {
        A[i] = l[i].to!T;
    }
}

void arywrite(T)(T a)
{
    a.map!text.join(' ').writeln;
}


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


int A[100000];
int n;


int partition(int p, int r){

  int work;
  int x = A[r];
  int tmp = p-1;

  for(int i=p; i<r; i++){
    if(A[i] <= x){
      tmp++;
      work = A[i];
      A[i] = A[tmp];
      A[tmp] = work;
    }
  }
      
  work = A[tmp+1];
  A[tmp+1] = A[r];
  A[r] = work;

  return tmp+1;

}


int main(){

  int q;

  cin >> n;
  for(int i=0; i<n; i++){
    cin >> A[i];
  }

  q = partition(0,n-1);

  cout << A[0];
  for(int i=1; i<n; i++){
    if(i==q){
      cout << ' '<<'[' << A[i] << ']';
    }
    else{
      cout << ' ' << A[i];
    }
  }
  cout << endl;

  return 0;
}

Measured memory_bytes: 1548
#include <bits/stdc++.h>
#define LLI long long int
#define FOR(v, a, b) for(LLI v = (a); v < (b); ++v)
#define FORE(v, a, b) for(LLI v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define REV(v, a, b) for(LLI v = (a); v >= (b); --v)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define ITR(it, c) for(auto it = (c).begin(); it != (c).end(); ++it)
#define RITR(it, c) for(auto it = (c).rbegin(); it != (c).rend(); ++it)
#define EXIST(c,x) ((c).find(x) != (c).end())
#define fst first
#define snd second
#define popcount __builtin_popcount
#define UNIQ(v) v.erase(unique(ALL(v)), v.end())
#define bit(i) (1LL<<i)
#define sz(v) ((LLI)(v).size())

#ifdef DEBUG
#include <misc/C++/Debug.cpp>
#else
#define dump(...) ((void)0)
#endif

#define gcd __gcd

using namespace std;
template <class T> constexpr T lcm(T m, T n){return m/gcd(m,n)*n;}

template <typename I> void join(ostream &ost, I s, I t, string d=" "){for(auto i=s; i!=t; ++i){if(i!=s)ost<<d; ost<<*i;}ost<<endl;}
template <typename T> istream& operator>>(istream &is, vector<T> &v){for(auto &a : v) is >> a; return is;}
template <typename T, typename U> istream& operator>>(istream &is, pair<T,U> &p){is >> p.first >> p.second; return is;}

template <typename T, typename U> bool chmin(T &a, const U &b){return (a>b ? a=b, true : false);}
template <typename T, typename U> bool chmax(T &a, const U &b){return (a<b ? a=b, true : false);}
template <typename T, size_t N, typename U> void fill_array(T (&a)[N], const U &v){fill((U*)a, (U*)(a+N), v);}

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

  int N;
  while(cin >> N){
    vector<LLI> A(N); cin >> A;
    sort(ALL(A));

    vector<LLI> b(N);
    REP(i,N) b[i] = abs(A[i]);

    LLI ans = 0;
    vector<pair<int,int>> ans_op;

    if(A[0] >= 0){ // all positive
      LLI x=A.front();

      FOR(i,1,N-1){
	ans_op.push_back({x,A[i]});
	x -= A[i];
      }

      ans_op.push_back({A.back(), x});

      ans = accumulate(ALL(b), 0LL) - 2*b[0];
    }else if(A.back() < 0){ // all negative

      reverse(ALL(b));
      reverse(ALL(A));
      LLI x=A.front();

      FOR(i,1,N){
	ans_op.push_back({x,A[i]});
	x -= A[i];
      }

      ans = accumulate(ALL(b), 0LL) - 2*b[0];
    }else{
      ans = accumulate(ALL(b), 0LL);

      LLI x=A.front(),y=A.back();

      FOR(i,1,N){
	if(A[i]>=0) break;
	ans_op.push_back({y,A[i]});
	y -= A[i];
      }

      REV(i,N-2,1){
	if(A[i]<0) break;
	ans_op.push_back({x,A[i]});
	x -= A[i];
      }

      ans_op.push_back({y,x});
    }
    
    cout << ans << endl;
    for(auto &p : ans_op){
      cout << p.fst << " " << p.snd << endl;
    }
  }
  
  return 0;
}


Measured memory_bytes: 4340
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;
 
using namespace std;


template<class T> class BIT   // 1-indexed (0 is not used)
{
private:
    int num;
    vector<T> bit;
public:
    BIT(int n):bit(vector<T>(n+1, 0)), num(n) {}

    T sum(int i) {   // sum of 1..i
        if (!i) return 0;
        return bit[i] + sum(i-(i&-i));
    }

    void add(int i, T x) {
        if (i > num) return;
        bit[i] += x;
        add(i+(i&-i), x);
    }

    int lower_bound(T x) {
        T res=0;
        int N=1;
        while(N<num) N*=2;
        int i;
        for(i=N/2; i>0; i/=2) {
            if(res+i<num && bit[res+i]<x) {
                x = x - bit[res +i];
                res = res + i;
            }
        }
        return res + 1;
    }
};

ll InvNum( int n, int* a )
{
    map<int,int> mp;
    int i;
    for(i=0; i<n; i++) {
        mp[a[i]]=0;
    }
    int num=0;
    auto it=mp.begin();
    for(; it!=mp.end(); ++it) {
        num++;
        it->second=num;
    }

    ll ans=0;
    BIT<int> bit(num);
    for(i=0; i<n; i++) {
        ans += i - bit.sum(mp[a[i]]);
        bit.add(mp[a[i]], 1);
    }
    return ans;
}

int main(int argc, char* argv[])
{
    int n;
    scanf("%d", &n);
    vector<int> a(n),b(n);
    int i;
    for(i=0; i<n; i++) {
        scanf("%d", &a[i]);
    }
    for(i=0; i<n; i++) {
        scanf("%d", &b[i]);
    }

    ll ans=LINF;
    int m=(n+1)/2;
    vector<pair<int,int> > aa(m), bb(n-m);
    vector<int> v(n);
    vector<int> w(n);
    int k;
    for(k=0; k<((ll)1<<n); k++) {
        int cnt=0;
        for(i=0; i<n; i++) {
            if(k & ((ll)1<<i)) cnt++;
        }
        if(cnt!=m) continue;

        cnt=0;
        int cnt1=0;
        for(i=0; i<n; i++) {
            if(k & ((ll)1<<i)) {
                aa[cnt]=make_pair((i%2==0? a[i]: b[i]),i);
                cnt++;
            }
            else {
                bb[cnt1]=make_pair((i%2==0? b[i]: a[i]),i);
                cnt1++;
            }
        }
        sort(aa.begin(),aa.end());
        sort(bb.begin(),bb.end());

        for(i=0; i<m; i++) {
            v[i*2]=aa[i].second;
            w[i*2]=aa[i].first;
        }
        for(i=0; i<n-m; i++) {
            v[i*2+1]=bb[i].second;
            w[i*2+1]=bb[i].first;
        }
        int bad=0;
        for(i=1; i<n; i++) {
            if(w[i-1]>w[i])
                bad=1;
        }
        if(bad)
            continue;

        ll tmp=InvNum(n, &v[0]);
        ans=MIN(ans,tmp);
    }
    if(ans==LINF) {
        printf("-1\n");
    }
    else {
        printf("%lld\n", ans);
    }
    return 0;
}


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

using namespace std;

//L[i][j] X[0]..X[i]??¨X[0]..Y[j]???LCS
int L[1001][1001]={};
int main(){
  int testnum;
  cin>>testnum;
  for(int t=0;t<testnum;++t){
    string X,Y;
    cin>>X>>Y;

    for(int i=1;i<=X.length();++i){
      for(int j=1;j<=Y.length();++j){
        if(X[i-1]==Y[j-1])
          L[i][j] = 1 + L[i-1][j-1];
        else
          L[i][j] = max(L[i][j-1],L[i-1][j]);
      }
    }

    cout << L[X.length()][Y.length()] << endl;
  }

  return 0;
}

Measured memory_bytes: 7084
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9 + 7);

int main(void) {
	int n;
	cin >> n;
	
	vector<ll> a(n);
	for(int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	
	if( n <= 2 ) {
		cout << *max_element(a.begin(), a.end()) << endl;
		return 0;
	}
	
	sort(a.begin(), a.end(), greater<ll>());
	
	ll ans = 0LL;
	int cnt = 1;
	for(int i = 0; i < n - 2; ++i) {
		if( i < 2 ) {
			ans += a[i];
		} else {
			if( i % 2 == 0 ) cnt++;
			
			ans += a[cnt];
		}
	}
	
	ans += a[1];
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 4844
#include <iostream>
using namespace std;
int main(void){
    int n, p[50];
    bool flg = true;
    cin >> n;
    for(int i=0;i<n;i++){
        cin >> p[i];
    }
    flg = true;
    for(int k=0;k<n-1;k++){
        if(p[k] > p[k+1]){
            flg = false;
            break;
        }
    }
    if(flg){
        puts("YES");
        return 0;
    }
    for(int i=0;i<n-1;i++){
        for(int j=i+1;j<n;j++){
            if(p[i] > p[j]){
                int t = p[i];
                p[i] = p[j];
                p[j] = t;
                flg = true;
                for(int k=0;k<n-1;k++){
                    if(p[k] > p[k+1]){
                        flg = false;
                        break;
                    }
                }
                if(flg){
                    puts("YES");
                    return 0;
                }
                t = p[i];
                p[i] = p[j];
                p[j] = t;
            }
        }
    }
    puts("NO");
}


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

int main() {
    int n,cnt=1,a[100000],ans=0;
    cin>>n;
    for(int i=0;i<n;i++)cin>>a[i];
    sort(a,a+n);
    for(int i=0;i<n-1;i++){
        if(a[i]==a[i+1]){
            cnt++;
            if(i+1==n-1&&cnt%2==1)ans++;
        }else{
            if(cnt%2==1)ans++;
            if(i+1==n-1)ans++;
            cnt=1;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
 
 
#define FAST_IO ios_base::sync_with_stdio(false), cin.tie(nullptr)
using namespace std;
 
signed main() {
    FAST_IO;
 
    int n;
    cin >> n;
    int jumps[n];
    vector<int> dp(n, 0); // dp[i] : Minimum cost for the frog to reach position i.
    for (int i = 0; i < n; i++) cin >> jumps[i];
    dp[1] = abs(jumps[1] - jumps[0]); // Base value
    for (int i = 2; i < n; i++)
        dp[i] = min(abs(jumps[i] - jumps[i - 1]) + dp[i - 1], abs(jumps[i] - jumps[i - 2]) + dp[i - 2]);
    cout << dp[n - 1];
    return 0;
}

Measured memory_bytes: 3980
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = LONG_LONG_MAX / 2;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main() {
  int X, Y;
  cin >> X >> Y;
  cout << X + Y / 2 << endl;
}


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

using ll=long long;
struct Edge{
    int idx;
    int to;
    ll cost;
};
using Edges=vector<Edge>;
using Graph=vector<Edges>;

int main(){
    int n;
    cin>>n;
    Graph g(n);
    for(int i=0;i<n-1;i++){
        int a,b;
        cin>>a>>b;
        a--,b--;
        g[a].push_back(Edge{i,b,-1});
        g[b].push_back(Edge{i,a,-1});
    }
    vector<ll> s(n);
    for(int i=0;i<n;i++) cin>>s[i];
    vector<int> sz(n);
    function<int(int,int)> setSZ=[&](int v,int pre){
        int res=1;
        for(int i=0;i<g[v].size();i++){
            if(g[v][i].to!=pre) res+=setSZ(g[v][i].to,v);
        }
        return sz[v]=res;
    };
    setSZ(0,-1);
    int err=0;
    int errv=-1;
    int erri=0;
    function<void(int,int)> solve0=[&](int v,int pre){
        for(int i=0;i<g[v].size();i++){
            if(g[v][i].to!=pre){
                solve0(g[v][i].to,v);
                int csz=sz[g[v][i].to];
                int psz=n-sz[g[v][i].to];
                if(csz==psz){
                    err++;
                    errv=v;
                    erri=i;
                    continue;
                }
                g[v][i].cost=(s[v]-s[g[v][i].to])/(csz-psz);
            }
        }
    };
    solve0(0,-1);
    if(err){
        function<pair<ll,ll>(int,int)> solve1=[&](int v,int pre){
            pair<ll,ll> res=make_pair(0LL,0LL);
            for(int i=0;i<g[v].size();i++){
                if(g[v][i].to!=pre){
                    auto ret=solve1(g[v][i].to,v);
                    res.first+=ret.first;
                    res.second+=ret.second;
                    if(g[v][i].cost==-1){
                        res.second+=sz[g[v][i].to];
                    }
                    else{
                        res.first+=sz[g[v][i].to]*g[v][i].cost;
                    }
                }
            }
            return res;
        };
        auto p=solve1(0,-1);
        g[errv][erri].cost=(s[0]-p.first)/p.second;
    }
    vector<ll> res(n-1,-1);
    for(int i=0;i<n;i++){
        for(int j=0;j<g[i].size();j++){
            if(g[i][j].cost!=-1){
                res[g[i][j].idx]=g[i][j].cost;
            }
        }
    }
    for(int i=0;i<n-1;i++){
        cout<<res[i]<<endl;
    }

    return 0;
}

Measured memory_bytes: 19200
#include <bits/stdc++.h>
using namespace std;
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a), i##_len = (b); i < i##_len; ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define _repr(i, n) repri(i, n, 0)
#define repri(i, a, b) for(int i = int(a), i##_len = (b); i >= i##_len; --i)
/* 閉区間で定義しているので注意！repr(i,n,m)でn〜mまで */
#define repr(...) _overload3(__VA_ARGS__, repri, _repr, )(__VA_ARGS__)
/* 逆回しのループ。両閉区間であることに注意 */
#define all(x) (x).begin(), (x).end()
#define debug(x) cerr << #x << ": " << (x) << '\n'
typedef long long lint;
#define int lint
const int INF = (int)1145141919;
int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
const lint LINF = (lint)1e18;
typedef vector<int> vint;
typedef pair<int, int> pint;
template <class T> bool chmax(T &a, const T &b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> bool chmin(T &a, const T &b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T, class U>
std::ostream &operator<<(std::ostream &os, const std::pair<T, U> p) {
    os << "(" << p.first << "," << p.second << ")";
    return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
    os << p.first << " " << p.second;
    return os;
}

template <typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) {
    is >> p.first >> p.second;
    return is;
}

template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) {
    os << "[";
    for(int i = 0; i < (int)v.size(); i++) {
        os << v[i] << (i + 1 != v.size() ? ", " : "");
    }
    os << "]";
    return os;
}

template <typename T> istream &operator>>(istream &is, vector<T> &v) {
    for(T &in : v)
        is >> in;
    return is;
}

template <typename T = lint> vector<T> make_v(size_t a) { return vector<T>(a); }

template <typename T, typename... Ts> auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}

template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type fill_v(T &t, const V &v) {
    t = v;
}

template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type fill_v(T &t, const V &v) {
    for(auto &e : t)
        fill_v(e, v);
}

signed main() {
#ifdef LOCAL
    // ifstream in("in_1.txt");
    // cin.rdbuf(in.rdbuf());
#else
    cin.tie(0);
    ios::sync_with_stdio(false);
#endif

    /* input part */
    int N, M;
    cin >> N;
    vector<int> D(N);
    cin >> D;
    cin >> M;
    vector<int> T(M);
    cin >> T;

    map<int, int> md, mt;
    rep(i, M) { mt[T[i]]++; }
    rep(i, N) { md[D[i]]++; }
    for(auto p : mt) {
        if(p.second <= md[p.first])
            continue;
        cout << "NO" << endl;
        return 0;
    }
    cout << "YES" << endl;
}


Measured memory_bytes: 28416
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
                long l = 1;
                for (int i=1;i<=n;i++){
                     l = l*i % 1000000007;
                }
		System.out.println(l);
	}

}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
using ll = long long;
typedef pair<int, int> P;
ll Mod = 1000000007;
int main() {
  int N;
  cin >> N;
  ll A[N];
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  sort(A,A+N);
  reverse(A,A+N);
  ll ans = 0;
  if (N % 2 == 0) {
    for (int i = 0; i < (N/2); i++) {
      if (i == 0) {
        ans += A[i];
      } else {
        ans += A[i] * 2;
      }
    }
  } else {
    for (int i = 0; i <= (N/2); i++) {
      if (i == 0 || i == (N/2)) {
        ans += A[i];
      } else {
        ans += A[i] * 2;
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 5188
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
using static System.Console;
using static System.Math;
class Z { static void Main() => new K(); }
class K
{
	int F => int.Parse(Str);
	long FL => long.Parse(Str);
	int[] G => Strs.Select(int.Parse).ToArray();
	long[] GL => Strs.Select(long.Parse).ToArray();
	string Str => ReadLine();
	string[] Strs => Str.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
	const int MOD = 1000000007;
	public K()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		Solve();
		Out.Flush();
	}
	void Solve()
	{
		var N = F;
		var A = G;
		var s = A.Sum();
		var id = -1;
		var min = int.MaxValue;
		for (var i = 0; i < N; i++)
		{
			var d = Abs(s - A[i] * N);
			if (d < min) { id = i; min = d; }
		}
		WriteLine(id);
	}
}


Measured memory_bytes: 13396
s=input()
n=len(s)
for i in range(1,n):
  if (n-i)%2==1:
    continue
  success=1
  for j in range((n-i)//2):
    if s[j]!=s[j+(n-i)//2]:
      success=0
  if success==1:
    print(n-i)
    break

Measured memory_bytes: 3060
#include<stdio.h>
int main()
{
    int n,k,a[1005],i,j,t,sum=0;
    scanf("%d %d",&n,&k);
    for(i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
    }
    for(i=0;i<n;i++)
    {
        for(j=i+1;j<n;j++)
        {
            if(a[i]>a[j])
            {
                t=a[i];
                a[i]=a[j];
                a[j]=t;
            }
        }
        if(i<k)
            sum=sum+a[i];
        if(i==k)break;
    }
    printf("%d\n",sum);
    return 0;
}


Measured memory_bytes: 1728
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<iomanip>
#include<math.h>
using namespace std;
int main(){
  long long int N;
  cin >>N;
  long long int a;
  if(N<10){
    a=N;
  }
  else if(N<100){
    a=9;
  }
  else if(N<1000){
    a=9+N-100+1;
  }
  else if(N<10000){
    a=909;
  }
  else if(N<100000){
    a=9+900+N-10000+1;
  }
  else{
    a=90909;
  }
  cout << a << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <limits.h>
#include <cmath>
#include <map>
using namespace std;
using P=pair<int,int>;
using PP=pair<P,P>;
using ll=long long;
int main(){
    int x,y,ret=INT_MAX;
    cin>>x>>y;
    if(x<=y){
        ret=min(ret,y-x);
    }
    if(-x<=y){
        ret=min(ret,1+y+x);
    }
    if(x<=-y){
        ret=min(ret,1+-y-x);
    }
    if(-x<=-y){
        ret=min(ret,2+-y+x);
    }
    cout<<ret<<endl;
}

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

int main() {
  int n;
  cin >> n;
  unordered_map<string, int> mp;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    mp[s]++;
  }
  cout << mp.size() << endl;
  return 0;
}

Measured memory_bytes: 17704
#include <bits/stdc++.h>
//#define int long long

using namespace std;
using LL = long long;
using P = pair<int, int>;

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

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e18;
const int MOD = (int)1e9 + 7;

int atoi(string s){
    int ret = 0;
    REP(i, s.size()){
        ret *= 10;
        ret += s[i] - '0';
    }
    return ret;
}

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

    string s;
    cin >> s;

    int ans = INF;
    REP(i, s.size()-2){
        ans = min(abs(atoi(s.substr(i, 3)) - 753), ans);
    }
    cout << ans << endl;
}

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

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}

int a, b, c, d;

int64_t cost(int64_t a, int64_t b) {
	uint64_t diff = std::abs(a - b);
	uint64_t tmp = diff * (uint64_t) d;
	if (tmp / d != diff || tmp >= 1000000000000000000) return 1000000000000000000;
	return tmp;
}

std::map<int64_t, int64_t> memo;
int64_t dfs(int64_t x) {
	if (memo.count(x)) return memo[x];
	if (x == 0) return memo[0] = 0;
	if (x == 1) return memo[1] = d;
	int64_t res = 1000000000000000000;
	if (x & 1) {
		res = std::min({res, std::min<int64_t>(a + d, cost(x, x / 2)) + dfs(x / 2),
							 std::min<int64_t>(a + d, cost(x, x / 2 + 1)) + dfs(x / 2 + 1)});
	} else res = std::min(res, std::min<int64_t>(a, cost(x, x / 2)) + dfs(x / 2));
	int64_t next = x / 3;
	int amari = x % 3;
	if (3 - x % 3 < x % 3) amari = 3 - x % 3, next++;
	res = std::min(res, std::min(b + (int64_t) amari * d, cost(x, next)) + dfs(next));
	// std::cerr << "cand:" << x << " " << res << std::endl;
	
	next = x / 5;
	amari = x % 5;
	if (5 - x % 5 < x % 5) amari = 5 - x % 5, next++;
	res = std::min(res, std::min(c + (int64_t) amari * d, cost(x, next)) + dfs(next));
	
	// std::cerr << x << " " << res << std::endl;
	return memo[x] = res;
}

int main() {
	int t = ri();
	for (int i = 0; i < t; i++) {
		memo.clear();
		int64_t n;
		scanf("%" SCNd64, &n);
		a = ri();
		b = ri();
		c = ri();
		d = ri();
		printf("%" PRId64 "\n", dfs(n));
	}
	return 0;
}


Measured memory_bytes: 4480
// #define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, l, r) for (int i = (l); i < (r); i++)
#include <bits/stdc++.h>
// #include <atcoder/all>
using namespace std;
// using namespace atcoder;
using ll = long long;
using P = pair<int, int>;
using V = vector<int>;
using VV = vector<V>;

template <class T> inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
//~ int A = (1<<2) | (1<<3) | (1<<5) | (1<<7);
//~ for (int bit=A; ; bit=(bit-1)&A){
//~ if (!bit) break;
//~ }
int next_combination(int sub) {
    int x = sub & -sub, y = sub + x;
    return (((sub & ~y) / x) >> 1) | y;
}
//~ int n=5;
//~ int k=3; // nCkの組み合わせ、ただしk=0には対応してない
//~ int bit=(1<<k)-1; // 1000 -> 0111
//~ for(; bit < (1<<n); bit=nex_combination(bit){
//~ }
bool isPrime(int a) {
    if (a == 2) return true;
    if (a <= 1 || a % 2 == 0) return false;

    for (int i = 3; i * i <= a; i += 2) {
        if (a % i == 0) return false;
    }
    return true;
}
//~ vector<int> a = {1, 14, 32, 51, 51, 51, 243, 419, 750, 910};
vector<int> aaa;
// index が条件を満たすかどうか
bool isOK(int index, int key) {
    if (aaa[index] >= key)
        return true;
    else
        return false;
}
// 汎用的な二分探索のテンプレ
int binary_search(int key) {
    int ng = -1;  //「index = 0」が条件を満たすこともあるので、初期値は -1
    int ok =
        (int)aaa
            .size();  // 「index =
                      // a.size()-1」が条件を満たさないこともあるので、初期値は
                      // a.size()

    /* ok と ng のどちらが大きいかわからないことを考慮 */
    while (abs(ok - ng) > 1) {
        int mid = (ok + ng) / 2;

        if (isOK(mid, key))
            ok = mid;
        else
            ng = mid;
    }
    return ok;
}

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

//~ int v[100100];
//~ int INF = 1 << 30;
//~ vector<vector<int>> dp(310, vector<int>(310));
//~ ll dp[110][100100];
//~ vector<int> dp(100100, 0));

//~ int seen[110];
//~ int ans[110][2];
//~ ll MOD = 1e9 + 7;

void memo() {
    int n = 100;
    vector<int> a(n);
    rep(i, n) {
        cin >> a[i];
        a[i]--;
    }

    vector<int> ans(n);
    iota(ans.begin(), ans.end(), 0);
    sort(ans.begin(), ans.end(), [&](int i, int j) { return a[i] < a[j]; });

    double t1 = 0.1;
    cout << fixed << setprecision(6) << t1 << endl;
}

int main() {
    int k;
    cin >> k;
    rep(i, k) cout << "ACL";
    cout << endl;
    return 0;
}


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

#define PI 3.1415926535897932
#define MOD 1000000007
#define INF 1e9

#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define FOR(i, start, end) for(int i = (start); i < (end); i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;


void solve()
{
    int A, B; cin >> A >> B;
    if(A > 8 || B > 8) cout << ":(" << endl;
    else cout << "Yay!" << endl;
}

int main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    solve();

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include <string>
#include <cctype>

using namespace std;

typedef string::const_iterator State;
class ParseError {};

int expression(State& base);
int number(State& base){
    int ret=0;
    while(isdigit(*base)){
        ret=ret*10+(*base-'0');
        base++;
    }
    return ret;
}
int factor(State& base){
    int ret;
    if(*base=='('){
        base++;
        ret=expression(base);
        base++;
        return ret;
    }
    else
        return number(base);
}
int term(State& base){
    int ret=factor(base);
    while(1){
        if(*base=='*'){
            base++;
            ret*=factor(base);
        }
        else if(*base=='/'){
            base++;
            ret/=factor(base);
        }
        else break;
    }
    return ret;
}
int expression(State& base){
    int ret=term(base);
    while(1){
        if(*base=='+'){
            base++;
            ret+=term(base);
        }
        else if(*base=='-'){
            base++;
            ret-=term(base);
        }
        else break;
    }
    return ret;
}
int main(){
    int n;
    cin>>n;
    while(n--){
        string str;
        cin>>str;
        State base = str.begin();
        cout<<expression(base)<<endl;
    }
}

Measured memory_bytes: 1208
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <stdio.h>
#include <string>
#include <queue>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
int n, k;
string s;
int b[100010], ans;
vector<int> a;

ll pow(ll x, ll y)
{
	if (y == 0) return 1;
	if (y % 2)
	{
		return pow(x, y - 1) * x % mod;
	}
	else
	{
		ll yyy = pow(x, y / 2);
		return yyy * yyy % mod;
	}
}

ll div(ll x)
{
	return pow(x, mod - 2);
}

int main(void)
{
	cin >> n >> k >> s;
	bool q = true;
	for (int i = 0; i < n; i++)
	{
		if (s[i] == '1')
		{
			q = false;
		}
	}
	if (q)
	{
		cout << n << endl;
		return 0;
	}
	bool rev = false;
	a.push_back(-1);
	for (int i = 0; i < n; i++)
	{
		if (s[i] == '0' && !rev)
		{
			rev = true;
		}
		else if (s[i] == '1' && rev)
		{
			a.push_back(i - 1);
			rev = false;
		}
	}
	for (int i = 0; i < a.size(); i++)
	{
		if (i == 0 && s[0] == '0')
		{
			b[0] = -1;
			continue;
		}
		int j = a[i] + 1;
		while (j < n && s[j] == '1')
		{
			j++;
			if (j == n) break;
		}
		b[i] = j - 1;
	}
	b[a.size()] = n - 1;
	for (int i = 0; i < min(k, (int)a.size() + 1); i++)
	{
		ans = max(ans, b[i] + 1);
	}
	for (int i = k; i < a.size() + 1; i++)
	{
		ans = max(b[i] - a[i - k], ans);
	}
	cout << ans << endl;
	cin >> n;
}


Measured memory_bytes: 892
#include <stdio.h>

int main ()
{
  int a, b;

  
  scanf ("%d", &a);

 if( a % 2 == 0 ){
    printf("%d", a/2);
  } else {
   b = a+1;
    printf("%d", b/2);
  }
 
  return 0;
}

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

int main() {
    int a, b;
    cin >> a >> b;
    string x, y;
    for(int i = 0; i < b; i++) {
        string t = to_string(a);
        x.append(t);
    }
    for(int i = 0; i < a; i++) {
        string t = to_string(b);
        y.append(t);
    }
    if(x < y) {
        cout << x << endl;
    }
    else {
        cout << y << endl;
    }
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
int main(void){
	int N,M,i,j,a,b,gen,gend,it;
	int xn[50],yn[50];
	int xm[50],ym[50];
	scanf("%d %d",&N,&M);
	for(i=0;i<N;i++){
		scanf("%d %d",&a,&b);
		xn[i]=a;yn[i]=b;
	}
	for(i=0;i<M;i++){
		scanf("%d %d",&a,&b);
		xm[i]=a;ym[i]=b;
	}
	for(i=0;i<N;i++){
		gen=999;
		gend=987654321;
		for(j=0;j<M;j++){
			it=abs(xm[j]-xn[i])+abs(ym[j]-yn[i]);
			if(gend>it){
				gend=it;gen=j;
			}
		}
		printf("%d\n",gen+1);
	}
	return 0;
}

Measured memory_bytes: 128
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,s,f) for(int i=s;i<f;i++)
#define INF 1000000000000000000
#define MOD 1000000007
#define endl "\n"
#define fcout cout<<fixed<<setprecision(15)
typedef pair<int, int> P;
//struct edge { int to, cost; };

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

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

bool prime(int n) {
    for (int i = 2; i <= sqrt(n); i++) {
        if (n % i == 0)return false;
    }
    return n != 1;
}
int gcd(int x, int y) {
    if (y == 0)return x;
    return gcd(y, x % y);
}
int lcm(int x, int y) {
    return x / gcd(x, y) * y;
}
int mod_pow(int n, int p, int m) {
    if (p == 0) return 1;
    if (p % 2 == 0) {
        int t = mod_pow(n, p / 2, m);
        return (t * t) % m;
    }
    return n * mod_pow(n, p - 1, m) % m;
}
int extGCD(int a, int b, int& x, int& y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    long long d = extGCD(b, a % b, y, x);
    y -= a / b * x;
    return d;
}
int modinv(int a, int m) {
    int b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
int modinv2(int a, int mod) {
    return mod_pow(a, mod - 2, mod);
}
int digit(int x) {
    int cnt = 0;
    while (x > 0) {
        cnt += x % 10;
        x /= 10;
    }
    return cnt;
}
int read() {
    int tmp;
    cin >> tmp;
    return tmp;
}
int xor128() {
    static int x = 123456789, y = 362436069, z = 521288629, w = 88675123;
    int t = (x xor (x << 11));
    x = y; y = z; z = w;
    return (w = (w xor (w >> 19)) xor (t xor (t >> 8)));
}
map<int, int> factaring(int x) {
    map<int, int>ans;
    int now = 2;
    while (now * now <= x) {
        if (x % now == 0) {
            x /= now;
            ans[now]++;
        }
        else now++;
    }
    if (x != 1) ans[x]++;
    return ans;
}
int comb(int n, int k, int mod) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    k = min(k, n - k);
    int x = 1, y = 1;
    rep(i, k) {
        y *= i + 1;
        y %= mod;
    }
    for (int i = n - k + 1; i <= n; i++) {
        x *= i;
        x %= mod;
    }
    return x * modinv(y, mod) % mod;
}

signed main() {
    //srand((unsigned)time(NULL));

    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    string s;
    cin >> s;
    int a = 0;
    rep(i, 6) {
        if (s[i] == '1') a++;
    }
    cout << a << endl;

    return 0;
}


Measured memory_bytes: 256