akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<list>
#include<set>
#include<string>
using namespace std;
int gcd(int a, int b) {
	int c = a % b;
	while (c != 0) {
		a = b;
		b = c;
		c = a % b;
	}
	return b;
}
struct UnionFind {
	vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

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

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

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

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

ll M = 1000000007;

vector<ll> fac(300001); //n!(mod M)
vector<ll> ifac(300001); //k!^{M-2} (mod M)

ll mpow(ll x, ll n) {
	ll ans = 1;
	while (n != 0) {
		if (n & 1) ans = ans * x % M;
		x = x * x % M;
		n = n >> 1;
	}
	return ans;
}
void setcomb() {
	fac[0] = 1;
	ifac[0] = 1;
	for (ll i = 0; i < 1000000; i++) {
		fac[i + 1] = fac[i] * (i + 1) % M; // n!(mod M)
	}
	ifac[1000000] = mpow(fac[1000000], M - 2);
	for (ll i = 1000000; i > 0; i--) {
		ifac[i - 1] = ifac[i] * i%M;
	}
}
ll comb(ll a, ll b) {
	if (a == 0 && b == 0)return 1;
	if (a < b || a < 0)return 0;
	ll tmp = ifac[a - b] * ifac[b] % M;
	return tmp * fac[a] % M;
}
ll perm(ll a, ll b) {
	if (a == 0 && b == 0)return 1;
	if (a < b || a < 0)return 0;
	return fac[a] * ifac[a - b] % M;
}
// mod. m での a の逆元 a^{-1} を計算する
long long modinv(long long a) {
	long long 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;
}
vector<vector<ll>> mul(vector<vector<ll>> a, vector<vector<ll>> b, int n) {
	int i, j, k, t;
	vector<vector<ll>> c(n);
	for (i = 0; i < n; i++) {
		for (j = 0; j < n; j++) {
			t = 0;
			for (k = 0; k < n; k++)
				t = (t + a[i][k] * b[k][j] % M) % M;
			c[i].push_back(t);
		}
	}
	return c;
}

template< typename Monoid >
struct SegmentTree {

	int sz;
	vector< Monoid > seg;

	const Monoid M1;

	SegmentTree(int n, const Monoid &M1) : M1(M1) {
		sz = 1;
		while (sz < n) sz <<= 1;
		seg.assign(2 * sz, M1);
	}

	void set(int k, const Monoid &x) {
		seg[k + sz] = x;
	}

	void build() {
		for (int k = sz - 1; k > 0; k--) {
			seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
		}
	}

	void update(int k, const Monoid &x) {
		k += sz;
		seg[k] = x;
		while (k >>= 1) {
			seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
		}
	}

	Monoid query(int a, int b) {
		Monoid L = M1, R = M1;
		for (a += sz, b += sz; a < b; a >>= 1, b >>= 1) {
			if (a & 1) L = f(L, seg[a++]);
			if (b & 1) R = f(seg[--b], R);
		}
		return f(L, R);
	}

	Monoid value(const int &k) const {
		return seg[k + sz];
	}

	Monoid f(Monoid a, Monoid b) {
		return a + b;
	}

};

int main() {
	int k, x, i;
	cin >> k >> x;
	for (i = x - k + 1; i < x + k; i++)
		cout << i << " ";
}

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

typedef long long ll;
typedef pair<int, int> P;
#define MOD 1000000007
#define INF (1 << 30)
#define REP(i, m, n) for(int i = (int)m; i < (int)n; ++i)
#define rep(i, n) REP(i, 0, n)

void func(ll h, ll w, ll &ans) {
    for(int i = 1; i <= h; i++) {
        ll a, b, c;
        a = i*w;
        // 横(縦)に 3
        b = ((h-i)/2)*w;
        c = w*h - a - b;
        ll maxS = max({a, b, c});
        ll minS = min({a, b, c});
        ans = min(ans, maxS - minS);

        // 横(縦)に 1 , 縦(横)に 2
        b = (h-i)*(w/2);    // *w/2 とすると壊れるので注意
        c = w*h - a - b;

        maxS = max({a, b, c});
        minS = min({a, b, c});
        ans = min(ans, maxS - minS);
    }
}

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

    ll h, w; cin >> h >> w;
    ll ans = INF;
    func(h, w, ans);
    swap(h, w);
    func(h, w, ans);
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 256
A=[]
for i in range(3):
  A.append(list(map(int, input().split())))  

N = int(input())
B = []
for i in range(N):
  B.append(int(input()))

#print(A)
#print(B)

match = []
for A_line in A:
  match.append([(a in B) for a in A_line])

#print(match)
ans = False
# 横
for m in match:
  ans = ans or all(m)

# 縦
match_v = [[m[i] for m in match] for i in range(3)]
#print(match_v)
for m in match_v:
  ans = ans or all(m)
# 斜め
ans = ans or all([match[i][i] for i in range(3)])
ans = ans or all([match[2-i][i] for i in range(3)])

print('Yes' if ans else 'No')

Measured memory_bytes: 3064
#include <iostream>
using namespace std;
typedef long long  ll;

#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)

int main()
{
	ll N; cin >> N;
	ll A[100], B[100];
	rep(i, 0, N) {
		cin >> A[i];
	}
	rep(i, 0, N) {
		cin >> B[i];
	}
	ll max = 0;
	rep(i, 0, N) {
		ll cnt = 0;
		repe(j, 0, i) {
			cnt += A[j];
		}
		rep(k, i, N) {
			cnt += B[k];
		}
		if (max < cnt) {
			max = cnt;
		}
	}
	cout << max << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define FOR(i,n,m) for(int i = m;i<n;i++)
#define rep(i,n) FOR(i,n)
#define ll long long
#define INF (1e9)
#define PI (acos(-1))
int dy[] = { 0, 0, 1, -1 };
int dx[] = { 1, -1, 0, 0 };
using namespace std;
int n;
string s;
int a[100000];
int main() {
	int aa, bb;
	cin >> aa >> bb;
	if (aa <= bb)cout << aa << endl;
	else cout << aa - 1 << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
 using namespace std;
 int main() {
    int a,b,t;
	cin >> a >> b >> t;
    int n = 1;
	int total = 0;
	while (a*n < t + 0.5) {
		total += b;
		n++;
	}
	cout << total << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		// シミュレーション
		Scanner sc = new Scanner(System.in);
		String S = sc.next();

		boolean[] news = new boolean[4];
		for (int i = 0; i < S.length(); i++) {
			char here = S.charAt(i);
			switch (here) {

			case 'N':
				news[0] = true;
				continue;
			case 'E':
				news[1] = true;
				continue;
			case 'W':
				news[2] = true;
				continue;
			case 'S':
				news[3] = true;
				continue;
			}
		}

		String ans = "No";
		if(news[0] && news[3]) {
			if(news[1] && news[2]) {
				ans = "Yes";
			}else if(!news[1] && !news[2]) {
				ans = "Yes";
			}
		}
		if(news[1] && news[2]) {
			if(news[0] && news[3]) {
				ans = "Yes";
			}else if(!news[0] && !news[3]) {
				ans = "Yes";
			}
		}
		System.out.println(ans);
	}

}


Measured memory_bytes: 21844
N=int(input())
A = [list(map(int, input().split())) for i in range(N)]
result=0
flag=True
isbreak=False
for m in range(N-1):
    for n in range(m+1,N):
        list_t=list(range(N))
        list_t.remove(m)
        list_t.remove(n)
        for t in list_t:
            if A[m][n]>A[m][t]+A[t][n]:
                result=-1                
                isbreak=True
                break
            elif A[m][n]==A[m][t]+A[t][n] and result!=-1:
                flag=False
                break
        if flag and result!=-1:
            result+=A[m][n]
        else:
            flag=True
        if isbreak:
            break
    if isbreak:
        break
print(result)


Measured memory_bytes: 75340
#include <bits/stdc++.h>
#ifdef __LOCAL
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
    #include <filesystem>
    namespace fs = std::filesystem;
#else
    #define DBG(X)
    #define SAY(X)
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 1,-1, 1,-1};
int dy[]={0, 1, 0, -1, 1, 1,-1,-1};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);
static mt19937 _g(time(nullptr));
 
inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const map<T, S> p) { for (auto el : p) cout << "[" << el.first << ";" << el.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

int N,M;
vector<int> A;
int sum=0;
void input(){
    fast_io();
    #ifdef __LOCAL
        fs::path __p = __FILE__;
        fs::path __input, __output;
        __input = __output = __p.parent_path();
        __input += string("/input/") + string(__p.stem()) + string(".txt");
        __output += string("/output/") + string(__p.stem()) + string(".txt");
        freopen(__input.c_str(), "r", stdin);
        freopen(__output.c_str(), "w", stdout);
    #endif
    cin >> N >> M;
    for (int i = 0; i < M; i++)
    {
        int a; cin >> a; sum+=a;
    }
    
}

int solve(){
    int a = N-sum;
    if(a<0) a=-1;
    cout << a << endl;
    return 0;
}   

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


Measured memory_bytes: 3668
# include <bits/stdc++.h>
# define rep(i, n) for(ll i = 0; i < (n); ++i)
# define reps(i, n) for(ll i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(ll i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(ll i=((int)(n)); i>0; --i)
# define ll long long
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
# define P pair<int, int>
using namespace std;
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; }
ll lmax(ll a, ll b){if(a>= b) return a;return b;}
ll lmin(ll a, ll b){if(a>= b) return b;return a;}
static const ll INF = 1e18;

int main() {
  int n; cin >> n;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];

  rep(i, n){
    if(a[i]==0){
      cout << 0 << endl;
      return 0;
    }
  }

  ll ub = 1e18, ans = 1;
  rep(i, n){
    if(ub/ans >= a[i]){
      ans *= a[i];
    } else {
      cout << -1 << endl;
      return 0;
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 4040
#include<iostream>

using namespace std;

int main(void){
 char c;
 cin >> c;
 if( c >= 'a' && c <= 'z' ){
  cout << 'a';
  return 0;
 }
  
  if( c >= 'A' && c <= 'Z' ){
  cout << 'A';
  return 0;
 }
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
string s[200005];
map<string, int> mp;
int main()
{
	ios_base::sync_with_stdio(0);
	int n;
	cin >> n;
	int ans = 0;
	for (int i = 0; i < n; i++) {
		cin >> s[i];
		mp[s[i]]++;
	}
	for (auto x : mp) {
		ans = max(ans, x.second);
	}
	for (auto x : mp) {
		if (x.second == ans)
			cout << x.first << "\n";
	}
	return 0;
}

Measured memory_bytes: 27520
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
    string s,t;
    cin >>s>>t;
    sort(s.begin(), s.end());
    sort(t.begin(),t.end());
    reverse(t.begin(),t.end());
    if(s<t){
        cout <<"Yes"<<endl;
    }else{
        cout <<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 

using namespace std;
#define rep(i, s, e) for (int(i) = (s); (i) <= (e); ++(i))
#define all(x) x.begin(),x.end()


int main()
{
	int n, k, res;
	res = 0;
	cin >> n >> k;
	for (int i = 0; i + k - 1 < n; ++i)
	{
		++res;
	}
	cout << res;
}



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

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

    if (s == "SUN") {
        cout << 7;
    } else if (s == "MON") {
        cout << 6;
    } else if (s == "TUE") {
        cout << 5;
    } else if (s == "WED") {
        cout << 4;
    } else if (s == "THU") {
        cout << 3;
    } else if (s == "FRI") {
        cout << 2;
    } else {
        cout << 1;
    }

    cout << endl;

    return 0;
}


Measured memory_bytes: 256
K,N=(int(x) for x in input().split())
A =[int(x) for x in input().split()]

A.append(K + A[0])
# print(A)
A_sub = []

for i in range(len(A)-1):
    A_sub.append(abs(A[i] - A[i + 1]))
# print(A_sub)
print(sum(A_sub) - max(A_sub))

Measured memory_bytes: 26436
#include<iostream>
#include<vector>
using namespace std;
enum{BLANK,WALL};
enum{UP,RIGHT,DOWN,LEFT};
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};

int main()
{
  int W,H;
  int x,y,d;
  string s;
  int k;
  while(cin>>W>>H,W|H){
    x=y=1;
    d=UP;
    while(cin>>s,s!="STOP"){
      if(s=="FORWARD"){
	cin>>k;
	x+=dx[d]*k;
	y+=dy[d]*k;
      }else if(s=="BACKWARD"){
	cin>>k;
	x-=dx[d]*k;
	y-=dy[d]*k;
      }else if(s=="RIGHT"){
	d++;
      }else if(s=="LEFT"){
	d--;
      }
      d=(d+4)%4;
      if(x>W)x=W;
      if(x<1)x=1;
      if(y>H)y=H;
      if(y<1)y=1;
    }
    cout<<x<<" "<<y<<endl;
  }
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define newl "\n"
using namespace std;
using lli = long long int;
using vvint = vector <vector <int>>;
const int mod = 1e9 + 7;

const int N = 2e5 + 1;

void solve(){
	string s;
	cin >> s;
	string s1 = s.substr(0,2);
	string s2 = s.substr(2,2);
	if(("01" <= s1  and s1 <= "12" and "00" <= s2 and s2 <= "99") and ("00" <= s1 and s1 <= "99" and "01" <= s2 and s2 <= "12")) cout << "AMBIGUOUS" << newl;
	else if("01" <= s1 and s1 <= "12" and "00" <= s2 and s2 <= "99") cout << "MMYY" << newl;
	else if("00" <= s1 and s1 <= "99" and "01" <= s2 and s2 <= "12") cout << "YYMM" << newl;
	else cout << "NA" << newl;

	return;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout << fixed << setprecision(10);
	#ifdef EXECUTE_LOCALLY
		   freopen("in.txt","r",stdin);
	#endif
	int t = 1;
	//cin >> t;
	while(t--) solve();
	#ifdef EXECUTE_LOCALLY
    	cout << setprecision(3) << "program time: " << (double)clock() / CLOCKS_PER_SEC << newl;
	#endif
	return 0;
}


Measured memory_bytes: 3584
#include<iostream>
using namespace std;
int main()
{
  int a,b;
  cin>>a>>b;
  if(a<b)
  {
    for(int i=1;i<=b;i++)
      cout<<a;
  }
  else
    for(int i=0;i<a;i++)
      cout<<b;
}
  

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
#include<cstdio>
using namespace std;
#define N 100002
long long a[N];
int main(){
	int n,i;
	long long ret;
	scanf("%d",&n);
	for( i=0;i<n;i++ )
		scanf("%d",&a[i]);
	if( n==2 )
		printf("%d\n",abs(a[0]-a[1]));
	else
	{
		sort(a,a+n);
		int left,right;
		int ps=1,pe=n-1,cnt=1;
		left = right =0;
		long long ret1=0;
		while( ps<pe ){
			if( cnt&1 )
			{
				if( abs( a[pe]-a[left] )+ abs( a[pe-1]-a[right] ) < abs( a[pe]-a[right] )+ abs( a[pe-1]-a[left] ))
				{
					ret1+=abs( a[pe]-a[right] )+ abs( a[pe-1]-a[left] );
					left = pe-1,right = pe;
				}
				else
				{
					ret1+=abs( a[pe]-a[left] )+ abs( a[pe-1]-a[right] );
					left = pe,right = pe-1;
				}
				pe-=2;
			}
			else
			{
				if( abs( a[ps]-a[left] )+ abs( a[ps+1]-a[right] ) < abs( a[ps]-a[right] )+ abs( a[ps+1]-a[left] ))
				{
					ret1+=abs( a[ps]-a[right] )+ abs( a[ps+1]-a[left] );
					left = ps+1,right = ps;
				}
				else
				{
					ret1+=abs( a[ps]-a[left] )+ abs( a[ps+1]-a[right] );
					left = ps,right = ps+1;
				}
				ps+=2;
			}
			cnt++;
		}
		if( ps==pe )
			ret1+=max(abs(a[left]-a[ps]),abs(a[right]-a[ps])); 
		long long ret2=0;
		cnt=0;
		left = right =n-1;
		ps = 0,pe = n-2;
		while( ps<pe ){
			if( cnt&1 )
			{
				if( abs( a[pe]-a[left] )+ abs( a[pe-1]-a[right] ) < abs( a[pe]-a[right] )+ abs( a[pe-1]-a[left] ))
				{
					ret2+=abs( a[pe]-a[right] )+ abs( a[pe-1]-a[left] );
					left = pe-1,right = pe;
				}
				else
				{
					ret2+=abs( a[pe]-a[left] )+ abs( a[pe-1]-a[right] );
					left = pe,right = pe-1;
				}
				pe-=2;
			}
			else
			{
				if( abs( a[ps]-a[left] )+ abs( a[ps+1]-a[right] ) < abs( a[ps]-a[right] )+ abs( a[ps+1]-a[left] ))
				{
					ret2+=abs( a[ps]-a[right] )+ abs( a[ps+1]-a[left] );
					left = ps+1,right = ps;
				}
				else
				{
					ret2+=abs( a[ps]-a[left] )+ abs( a[ps+1]-a[right] );
					left = ps,right = ps+1;
				}
				ps+=2;
			}
			cnt++;
		} 
		if( ps==pe )
			ret2+=max(abs(a[left]-a[ps]),abs(a[right]-a[ps]));
		ret=max(ret1,ret2);
		printf("%lld\n",ret);
	}	
	return 0;
}


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

using namespace std;

#define DUMP(x) std::cerr << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP(i, k, n) for (int i = (k); i < (int)(n); ++i)
#define ALL(r) r.begin(), r.end()
#define YES puts("YES")
#define Yes puts("Yes")
#define NO puts("NO")
#define No puts("No")
#define IMP puts("IMPOSSIBLE")
#define Imp puts("Impossible")
#define imp puts("impossible")
#define M1 puts("-1")
#define pb push_back

template <typename T>
T dup(T x, T y)
{
    return (x + y - 1) / y;
};
template <typename A, size_t N, typename T>
inline void arrayFill(A (&array)[N], const T &val) { std::fill((T *)array, (T *)(array + N), val); }

using ll = int64_t;
using vint = vector<int32_t>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pint = pair<int32_t, int32_t>;
using pll = pair<ll, ll>;
using setint = set<int32_t>;
using setstr = set<string>;
using qint = queue<int32_t>;
using qpint = queue<pint>;

constexpr std::int32_t INF = 1001001001;
constexpr std::int64_t LINF = 1001001001001001001;

void Main()
{
    int a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;
    ll sum = 0;

    while (x != 0 || y != 0)
    {
        if (min(x, y) >= 1)
        {
            if (a + b > c * 2)
            {
                sum += c * 2;
            }
            else
            {
                sum += a + b;
            }
            --x;
            --y;
        }
        else
        {
            if (x != 0)
            {
                if (a > c * 2)
                {
                    sum += c * 2;
                }
                else
                {
                    sum += a;
                }
                --x;
            }
            else
            {
                if (b > c * 2)
                {
                    sum += c * 2;
                }
                else
                {
                    sum += b;
                }
                --y;
            }
        }
    }
    cout << sum << endl;
}

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


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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define ANS(n) cout << (n) << endl
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)
#define mp make_pair

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int32 n,k;
    cin >> n >> k;
    double ans = 0;
    for(int32 dice = 1; dice <= n; ++dice){
        int32 score = dice;
        int32 cnt = 0;
        while(score < k){
            cnt++;
            score *= 2;
        }
        ans += pow((double)1 / 2, cnt) / n;
    }
    printf("%.12f\n", ans);
    return 0;
}

Measured memory_bytes: 384
import math

N=int(input())
s = list(map(int,input().split()))
c = []

for i in range(9):
    c.append(0)

for i in s:
    ii = math.floor(i / 400)
    if ii > 8:
        ii = 8
    c[ii] = c[ii] + 1

a = 0
for i in range(8):
    if c[i] > 0:
        a = a + 1

b = a + c[8]
a = max(a, 1)

print(a, b)


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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  int s = 0;
  for (auto& e : a) {
    cin >> e;
    s ^= e;
  }

  for (auto& e : a) cout << (s ^ e) << ' ';
  cout << endl;
}


Measured memory_bytes: 3968
#include<iostream>
using namespace std;
typedef long long LL;
LL a[100010];
int main(){
	int n;
	cin>>n;
	LL X=0,S=a[1]+a[2];
	for(int i=1;i<=n;++i) {
		cin>>a[i];
		if(i<=2) S=S+a[i];
		else X=X^a[i];
	}
	if((a[1]+a[2]-X)%2||(a[1]+a[2]-X)<0){
		puts("-1");
		return 0;
	}
	LL D=(a[1]+a[2]-X)/2;
	if(D>a[1]){
		puts("-1");
		return 0;
	}
	LL s1=D,s2=0;
	for(int i=45;i>=0;--i){
		int xi=(X>>i)&1ll,di=(D>>i)&1ll;
		if(xi==0&&di==0){
			continue;
		}
		else if(xi==1&&di==0){
			if(s1+(1ll<<i)<a[1]){
				s1=s1+ (1ll<<i);
			}
			else s2+=(1ll<<i);
		}
		else if(xi==0&&di==1){
			continue;
		}
		else {
			puts("-1");
			return 0;
		}
	}
	if(s1==0) puts("-1");
	else 
	cout<<a[1]-s1<<endl;
	return 0;
} 

Measured memory_bytes: 3128
while True:
    a, b, c = map(str, input().split())
    if(b == "?"):
        break
    else:
        a = int(a)
        c = int(c)
        if(b == "+"):
            print(a + c)
        elif(b == "-"):
            print(a - c)
        elif(b == "*"):
            print(a * c)
        elif(b == "/"):
            print(a // c)


Measured memory_bytes: 5596
#include<cstdio>

using namespace std;

typedef long long ll;

int main(){
	ll sum=0;
	int q; scanf("%d",&q);
	while(q--){
		char c;
		int n; scanf("%*d %c%d",&c,&n);
		if(c=='(') sum+=n; else sum-=n;
		puts(sum==0?"Yes":"No");
	}

	return 0;
}

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

#define ll long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define dbg(x) cerr << #x << ": " << x << endl;
#define dbg2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define dbg3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define dbgB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

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

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

template<typename T>
void printA(vector<T> &printArray, char between = ' ') {
   int paSize = printArray.size();
   for (int i = 0; i < paSize; i++) { cerr << printArray[i] << between;}
   if (between != '\n') {cerr << endl;}
}

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

int main() {
   int N, Y;
   cin >> N >> Y;

   for (int x = 0; x <= 2000; x++) {
      for (int y = 0; y <= 2000; y++) {
         int z = N - x - y;
         if (z > N || z < 0) continue;
         int sum = 10000*x + 5000*y + 1000*z;
         if (sum == Y) {
            printf("%d %d %d\n", x, y, z);
            return 0;
         }
      }
   }
   printf("%d %d %d\n", -1, -1, -1);

   return 0;
}

Measured memory_bytes: 256
N, K = gets.split(' ').map(&:to_i)
A = gets.split(' ').map(&:to_i)

require 'pp'
def debug obj
  # PP.pp obj, STDERR
end
debug [N,K]
debug A
sum = 0
sumA = A.map{|a| sum += a }
bt_list = []

(0..(N)).to_a.combination(2) do |l,r|
  bt_list.push(((sumA[r] || 0) - sumA[l]).abs)
end

bt_list.sort!.reverse!
debug bt_list

r = 0

max = sumA.last

maxlog = Math.log2(max).to_i
bt_list_size = bt_list.size
maxlog.downto(0) do |i|
  count = 0
  ra = r + (1 << i)
  bt_list.each do |bt|
    if ra == ( ra & bt )
      count += 1
      if count >= K
        r = ra
        break
      end
    end
  end
end

puts r

Measured memory_bytes: 13560
#include <iostream>
#include <string>
#include <vector>

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

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

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

  string result = "";
  rep(i, S.size()) {
    if (S[i] == 'B') {
      if (result.size() > 0) {
        result = result.substr(0, result.size()-1);
      }
    } else {
      result += S[i];
    }
  }

  cout << result << endl;
  return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var scan = bufio.NewScanner(os.Stdin)

func main() {
	scanWords()
	a := scanNextInt()
	b := scanNextInt()
	printCompareResult(a, b)
}

func scanWords() {
	scan.Split(bufio.ScanWords)
}

func scanNextInt() int {
	scan.Scan()

	inputInt, err := strconv.Atoi(scan.Text())
	if err != nil {
		panic(err)
	}

	return inputInt
}

func printCompareResult(a, b int) {
	if a == b {
		fmt.Println("a == b")
	} else if a > b {
		fmt.Println("a > b")
	} else {
		fmt.Println("a < b")
	}
}



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

int main()
{
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  string s;
  cin >> n >> s;
  map<pair<string, string>, int> cnt, cnt2;
  for (int i = 0; i < 1 << n; ++i) {
    string r, b;
    for (int j = 0; j < n; ++j) {
      if (i & 1 << j) {
        r += s[j];
      } else {
        b += s[j];
      }
    }
    ++cnt[{r, b}];
  }
  for (int i = 0; i < 1 << n; ++i) {
    string r, b;
    for (int j = n; j < 2 * n; ++j) {
      if (i & 1 << j - n) {
        r += s[j];
      } else {
        b += s[j];
      }
    }
    ++cnt2[{r, b}];
  }
  long long ans = 0;
  for (int i = 0; i < 1 << n; ++i) {
    string r, b;
    for (int j = 0; j < n; ++j) {
      if (i & 1 << j) {
        r += s[j];
      } else {
        b += s[j];
      }
    }
    string r2 = b, b2 = r;
    reverse(r2.begin(), r2.end());
    reverse(b2.begin(), b2.end());
    ans += (long long) cnt2[{r2, b2}];
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 132864
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <stack>
#include <deque>
#include <queue>
#include <set>
#include <cmath>
#include <algorithm>
#include <map>
#include <list>

using namespace std;

#define FOR( i, k, n ) for ( int i = ( k ); i <= ( int )( n ); ++i )
#define REP( i, n ) FOR( i, 1, n )

typedef long long ll;
typedef pair< int, int > P;

#define MAX_N 100
#define MAX_M 99

int main() {
	stack< int > nums;
	char ch[ 100 ];
	while( cin >> ch ) {
		if( ch[ 0 ] == '+' || ch[ 0 ] == '-' || ch[ 0 ] == '*' ) {
			int num1, num2, ans;
			num2 = nums.top();  nums.pop();
			num1 = nums.top();  nums.pop();
			switch( ch[ 0 ] ) {
			case '+' : ans = num1 + num2; break;
			case '-' : ans = num1 - num2; break;
			case '*' : ans = num1 * num2; break; 
			};
			nums.push( ans );
		} else {
			int num = atoi( ch );
			nums.push( num );
		}
	}
	cout << nums.top() << endl;
	return 0;
}

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

#define rep(i,n) for (int i = 0; i < (n); ++i)
const int INF = 1e9+7;

int main() {
	int N,T,A,m=INF,d=0,r=1;
	cin >> N >> T;

	rep(i,N) {
		cin >> A;
		m = min(m, A);
		if(d == 0)
			d = max(A-m, 0);
		else if(max(A-m,0) == d)
			r++;
		else
			d = max(d, max(A-m, 0));
	}

	cout << r << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
using namespace std;
#define MOD 1000000007
#define INF 1<<30
#define LINF (ll)1<<62
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> P;
typedef vector<pair<ll, ll>> vpl;

vl s(100005);
vl t(100005);

ll search(ll k, bool st){
    if(st){
        auto lb = lower_bound(all(t),k);
        auto lb2 = lb - 1;
        //cout << "lb:" << *lb << " " << *lb2 << " " << k << endl;
        if(lb == t.end()) return k - *lb2;
        else{
            if(*lb2 != 0) return min(*lb - k, k - *lb2);
            else return *lb - k;
        }
    }else{
        auto lb = lower_bound(all(s),k);
        auto lb2 = lb - 1;
        if(lb == s.end()) return k - *lb2;
        else{
            if(*lb2 == 0) return *lb - k;
            else return min(*lb - k, k - *lb2);
        }
    }
}

int main(){
    ll a,b,q; cin >> a >> b >> q;
    rep(i,a) cin >> s[i];
    rep(i,b) cin >> t[i];
    sort(all(s));
    sort(all(t));
    ll x;
    vl ans(q);
    rep(i,q) {
        cin >> x;
        auto sritr = lower_bound(all(s),x);
        auto slitr = sritr - 1;
        auto tritr = lower_bound(all(t),x);
        auto tlitr = tritr - 1;
        //cout << *sritr << " " << *tritr << endl;
        ll mn = LINF;
        if(sritr != s.end()) mn = min(mn, *sritr-x+search(*sritr, true));
        //cout << mn << " ";
        if(*slitr != 0) mn = min(mn, x-*slitr+search(*slitr,true));
        //cout << mn << " ";
        if(tritr != t.end()) mn = min(mn, *tritr-x+search(*tritr, false));
        //cout << mn << " ";
        if(*tlitr != 0) mn = min(mn, x-*tlitr+search(*tlitr, false));
        //cout << mn << " ";
        //cout << endl;
        ans[i] = mn;
    }
    rep(i,q) cout << ans[i] << endl;

}


Measured memory_bytes: 3712
//QWsin
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define rep(i,x,y) for(int i=x;i<=y;++i)
#define out(i,u) for(int i=first[u];i!=-1;i=nxt[i])
#define repvc(i,vc) for(int i=0,Sz=vc.size();i<Sz;++i)
using namespace std;
inline int read()
{
	char ch=getchar();int ret=0,f=1;
	while(ch<'0' || ch>'9') {if(ch=='-')f=-1;ch=getchar();}
	for(;ch>='0' && ch<='9';ch=getchar()) ret=ret*10+ch-'0';
	return ret*f;
}

inline void print(string name,int *arr,int len){
	rep(i,1,len) printf("%s[%d]=%d\n",name.c_str(),i,arr[i]);puts("");
}
inline void print(string name,int a){
	printf("%s=%d\n",name.c_str(),a);puts("");
}

typedef long long ll;
const int INF=1<<30;

int main()
{
	
	int a,b;cin>>a>>b;
	if(a*500>=b) puts("Yes");
	else puts("No");
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define inf 1e9
using namespace std;


ll find(ll arr[][2], ll n, ll w) {
	ll dp[n + 1][w + 1];

	for (ll i = 0; i <= n; i++) {
		for (ll j = 0; j <= w; j++) {
			if (i == 0 || j == 0)
				dp[i][j] = 0;
			else if ( arr[i - 1][0] <= j ) {
				dp[i][j] = max(dp[i - 1][j], arr[i - 1][1] + dp[i - 1][j - arr[i - 1][0]]);
			} else
				dp[i][j] = dp[i - 1][j];
		}
	}
	return dp[n][w];
}

int main() {


	fio
	ll n, w;
	cin >> n >> w;

	ll arr[n][2];

	for (ll i = 0; i < n; i++)
		cin >> arr[i][0] >> arr[i][1];

	cout << find(arr, n, w) << "\n";
}



Measured memory_bytes: 79232
#include <cstdio>
#include <cstring>
#include <utility>
#include <iostream>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#define rep(i, s, g) for ((i) = (s); (i) < (g); ++(i))
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = (1e18) + 1;

int main(void)
{
    int n, d, a;
    vector<P> monster;
    int x, h;
    int i, j;
    int target, targetx, targeth;
    int mid;
    ll count;
    ll ans = 0;
    vector<int> damage(200010, 0);

    cin >> n >> d >> a;

    monster.emplace_back(0, 0);

    rep(i, 1, n + 1)
    {
        cin >> x >> h;
        monster.emplace_back(x, h);
    }

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

    rep(i, 1, n + 1)
    {
        damage[i] += damage[i - 1];

        if (damage[i] < monster[i].second)
        {
            target = i;
        }
        else
        {
            continue;
        }

        targetx = monster[target].first;
        targeth = monster[target].second - damage[target];

        count = (targeth + a - 1) / a;

        ans += count;

        int ok = 0, ng = n + 1;

        while (ng - ok > 1)
        {
            mid = (ok + ng) / 2;

            if (monster[mid].first <= targetx + d * 2)
            {
                ok = mid;
            }
            else
            {
                ng = mid;
            }
        }
        damage[target] += count * a;
        damage[ng] += -count * a;
    }

    cout << ans << endl;
}


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

int main(){
	int N,W;
	cin>>N>>W;

	int v[1000],w[1000];
	for(int i=0;i<N;i++)
		cin>>v[i]>>w[i];

	int DP[101][10001];
	for(int i=0;i<=N;i++)
		DP[i][0]=0;
	for(int j=0;j<=W;j++)
		DP[0][j]=0;

	for(int i=1;i<=N;i++){
		for(int j=0;j<=W;j++){
			if(j<w[i-1])
				DP[i][j]=DP[i-1][j];
			else{
				if(DP[i-1][j]>DP[i][j-w[i-1]]+v[i-1])
					DP[i][j]=DP[i-1][j];
				else
					DP[i][j]=DP[i][j-w[i-1]]+v[i-1];
			}
		}
	}
	
	cout<<DP[N][W]<<endl;
	
	return 0;
}

	

Measured memory_bytes: 7012
n, k, c = map(int,input().split())
s = input()
left = [0 for _ in range(n)]
right = [0 for _ in range(n)]
cnt = 0
i = 0
while i < n:
    if s[i] == 'o':
        cnt += 1
        left[i] = cnt
        i += c
        if cnt == k:
            break
    i += 1

cnt = k+1
i = n-1
while i >= 0:
    if s[i] == 'o':
        cnt -= 1
        right[i] = cnt
        i -= c
        if cnt == 0:
            break
    i -= 1

ans = []
for i in range(n):
    li = left[i]
    ri = right[i]
    if li > 0 and ri > 0 and li == ri:
        ans.append(i+1)
for a in ans:
    print(a)

Measured memory_bytes: 28580
#include<iostream>
#include<string>
#include<queue>
#include<vector>
using namespace std;
static const int MAX=100;
int D[MAX][MAX];
int main(void)
{
	int H,W;
	cin >> H >> W;
	queue<int > Q;
	vector<int > P;
	
	for(int i=0;i<H;i++)
	{
		string x;
		cin >> x;
		int take=0;
		
		for(int j=0;j<W;j++)
		{
			if(x[j]=='.')
			{
				D[i][j]=1;
				take++;
			}
		}
		if(take==W)
			Q.push(i);
	}
	
	
	for(int i=0;i<W;i++)
	{
		int take=0;
		for(int j=0;j<H;j++)
			take+=D[j][i];
			
		if(take==H)
			P.push_back(i);
	}
	
	
	
	for(int i=0;i<H;i++)
	{
		if(Q.size())
		{
			int r=Q.front();
			if(r==i)
			{
				Q.pop();
				continue;
			}
		}
		for(int j=0;j<W;j++)
		{
			
			
			int put=-1;
			int k;
			for(k=0;k<P.size();k++)
			{
				if(P[k]==j)
				{
					put=1;
					break;
				}
			}
			
			
			if(put==1){}
			else if(D[i][j]==1)
				cout << ".";
			else
				cout << "#" ;
			
			
		}
		cout << endl;
	}
	
	
	
	return 0;
}

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

using namespace std;
using ll = long long;
using ld = long double;

//#define int long long
//signed main(){
int main() {
//    ios_base::sync_with_stdio(false);
//    cin.tie(NULL);
    int n,m;
    cin >> n >> m;
    vector<vector<int>> rew(m);
    for(int i = 0; i < n; i++) {
        int a,b;
        cin >> a >> b;
        if(a>m) continue;
        rew[a-1].emplace_back(b);
    }
    priority_queue<int> pque;
    int ans=0;
    for(int i = 0; i < m; i++) {
        rew[i].emplace_back(0);
        int siz=rew[i].size();
        for(int j = 0; j < siz; j++) {
            pque.push(rew[i][j]);
        }
        int add=pque.top();
        pque.pop();
        ans+=add;
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 6784
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
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; }

#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { INIT(){
  cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;


signed main() {
  int A, V, B, W, T;
  cin >> A >> V >> B >> W >> T;

  int di = (V-W)*T;

  if(abs(A-B) > di) NO;
  else YES;

  return 0;
}

Measured memory_bytes: 3604
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0539

"""
import sys
from sys import stdin
from bisect import bisect_right
input = stdin.readline



def main(args):
    while True:
        d = int(input())        #  ??°??¶????????????
        if d == 0:
            break
        n = int(input())        #  ??¬????????????????????°
        m = int(input())        #  ??¨????????°
        cw_pos = [int(input()) for _ in range(n-1)]
        dests = [int(input()) for _ in range(m)]

        cw_pos.append(0)
        cw_pos.append(d)
        cw_pos.sort()

        ccw_pos = [d-x for x in cw_pos]
        ccw_pos.sort()


        total_distance = 0
        for t in dests:
            if t == 0:
                continue
            i = bisect_right(cw_pos, t)
            a1 = min(t-cw_pos[i-1], cw_pos[i]-t)

            j = bisect_right(ccw_pos, d-t)
            a2 = min(d-t-ccw_pos[j-1], ccw_pos[j]-(d-t))

            ans = min(a1, a2)
            total_distance += ans

        print(total_distance)


if __name__ == '__main__':
    main(sys.argv[1:])
    

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

using namespace std;

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

int main(){
  std::cin.tie(nullptr);                  // 標準入出力高速化
  std::ios_base::sync_with_stdio(false);  // SとS++の入出力出力を非同期
  string a,b;
  cin>>a>>b;
  string c=a,d=b;
  rep(i,1,stoi(b))c+=a;
  rep(i,1,stoi(a))d+=b;
  c<=d ? cout<<c<<endl : cout<<d<<endl;  
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define all(x) x.begin(),x.end()

template<class T>
static inline std::vector<T> ndvec(size_t&& n, T val) noexcept {
  return std::vector<T>(n, std::forward<T>(val));
}

template<class... Tail>
static inline auto ndvec(size_t&& n, Tail&&... tail) noexcept {
  return std::vector<decltype(ndvec(std::forward<Tail>(tail)...))>(n, ndvec(std::forward<Tail>(tail)...));
}

template<class T, class Cond>
struct chain {
  Cond cond; chain(Cond cond) : cond(cond) {}
  bool operator()(T& a, const T& b) const {
    if(cond(a, b)) { a = b; return true; }
    return false;
  }
};
template<class T, class Cond>
chain<T, Cond> make_chain(Cond cond) { return chain<T, Cond>(cond); }

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

  vector<bool> ab(100000, true);
  vector<bool> bc(100000, true);
  vector<bool> ca(100000, true);

  rep(i,0,a.size()) rep(j,0,b.size()) {
    if(a[i] != '?' && b[j] != '?' && a[i] != b[j]) {
      ab[i - j + 50000] = false;
    }
  }
  std::swap(a, b);
  std::swap(b, c);
  rep(i,0,a.size()) rep(j,0,b.size()) {
    if(a[i] != '?' && b[j] != '?' && a[i] != b[j]) {
      bc[i - j + 50000] = false;
    }
  }
  std::swap(a, b);
  std::swap(b, c);
  rep(i,0,a.size()) rep(j,0,b.size()) {
    if(a[i] != '?' && b[j] != '?' && a[i] != b[j]) {
      ca[i - j + 50000] = false;
    }
  }
  std::swap(a, b);
  std::swap(b, c);
  i64 ans = 6000;
  rep(i,-4000, 4001) rep(j,-4000,4001) {
    if(ab[i + 50000] && ca[ -j + 50000] && bc[j - i + 50000]) {
      ans = std::min(ans, std::max({ i64(a.size()), i64(b.size()) + i, i64(c.size()) + j }) - std::min({ 0ll, i, j }));
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
$F = []
def make_fibonachi(n)
  $F[0] = 1
  $F[1] = 1
  2.upto(n) do |i|
    $F[i] = $F[i - 1] + $F[i - 2]
  end
end

def main
  n = gets.to_i
  make_fibonachi(n)
  puts $F[-1]
end

main



Measured memory_bytes: 6856
#include<iostream>
#include<cstdio>
using namespace std;
long long n,m,h=0;
int main()
{
    cin>>n>>m;
    cout<<min(n,m/2)+max(m-n*2,h)/4;//为什么要跟h比较，因为h是0，也是long long类型。而它们不能跟0比较，因为0默认是int类型。
    return 0;
} 

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

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPl(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define REPRl(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < (int)n; i++)
#define FORl(i, m, n) for(ll i = m; i < (ll)n; i++)
#define ALL(v) v.begin(), v.end()
ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}
ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}
int main() {
  string n;cin>>n;
  REP(i,3){
    if(n[i]=='1'){
      n[i]='9';
    }else{
      n[i]='1';
    }
  }
  cout << n << endl;
}


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

using namespace std;

using ll = long long;
using ull = unsigned long long;
template<class T> using v = vector<T>;

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

template<class T> T read() { T x{}; cin >> x; return x; }
template<class T> v<T> read(int N){ v<T> x(N); REP(i, N) cin >> x[i]; return x; }

template<class T>
void write(const T &x){ cout << x << endl; }
void write(double x){ printf("%.15f\n", x); }

const double PI=3.14159265358979323846;

// vars

ll r;

void input() {
    r = read<ll>();
}

void solve() {
    write(r * r);

}

int main() {
    input();
    solve();
}



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

// int/long:		-2,147,483,648 - 2,147,483,647 (-2^31 <= int < 2^31)
// long/long long:	-9,223,372,036,854,775,808 - 9,223,372,036,854,775,807 (-2^63 <= long < 2^63)

// lower_bound(A.begin(), A.end(), N)
// upper_bound(...

// A.erase(unique(A.begin(), A.end()), A.end())

// bit: &/and, |/or, ^/xor, ~/not

// getline(cin, String)
// while (getline(cin, S)) {}

// cout <<fixed <<setprecision(10)

// priority_queue<int> q;
// priority_queue<int, vector<int>, less<int>> q; // Default: vector, less
// priority_queue<vector<int>, vector<vector<int>>, greater<vector<int>>> q;

// Graph
// Warshall-Floyd: Distance between each node, N^3
// Dijkstra: Distance from the start node, N^2
// DFS(Depth-First Search)

//
// Notes
//
// When specified less than N, try full scan.
// RE: empty vector
// Check Qs
// long/int
// xor -> count each bit
// Check values
// 	1,000,000 -> Loop
// 	100,000	-> vector(int:400KB, long:800KB) 

#define	INF (1<<30)
//1,073,741,824
//= 536,870,912 *2

#define	MOD 1000000007

#define	Rep0(i, n)	for (int i=0; i<n; i++)
#define	Rep1(i, n)	for (int i=1; i<=n; i++)
#define	RepL0(i, n)	for (long i=0; i<n; i++)
#define	RepL1(i, n)	for (long i=1; i<=n; i++)
#define Sort(P)	sort(P.begin(), P.end())
#define Rev(P)	reverse(P.begin(), P.end())

int	main() {
	long N, M, V, P;//N: Qs, M: Judge, V: Selected Qs, P: Passing Qs
	cin >>N >>M >>V >>P;
	vector<long> A(N, 0);
	RepL0(i, N)
		cin >>A.at(i);
	sort(A.begin(), A.end());
	long PASS=A.at(N-P);
	long NN=P;// Counter
	long SS=0;
	long WW=N-P+1;
	for (long i=WW-2; i>=0; i--) {
		if (A.at(i)+M<PASS)
			break;
		SS+=A.at(i+1);
		long VV=V-(P-1)-i;
		if (VV<=1) {
			NN++;
			continue;
		}
		long SSS=(A.at(i)+M)*(WW-1-i);
		SSS-=SS;
		if (SSS>=M*(VV-1))
			NN++;
		else
			break;
	}
	cout <<NN <<endl;
	return 0;
}



Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>

using namespace std;
const int maxn=1000+10;
int n;
char a[maxn],b[maxn];
int dp[maxn][maxn];
void solve(char *a,char *b)
{

    int la=strlen(a)-1,lb=strlen(b)-1;
    for(int i=0;i<la;i++) dp[i][0]=0;
    for(int i=0;i<lb;i++) dp[0][i]=0;

    for(int i=0;i<la;i++)
    {
        for(int j=0;j<lb;j++)
        {
            if(a[i]==b[j]) dp[i+1][j+1]=dp[i][j]+1;
            else dp[i+1][j+1]=max(dp[i+1][j],dp[i][j+1]);
        }

    }
    printf("%d\n",dp[la][lb]);

}
int main()
{
//    freopen("in.txt","r",stdin);
    scanf("%d",&n);
    getchar();
    while(n--)
    {
        fgets(a,sizeof(a),stdin);
        fgets(b,sizeof(b),stdin);
        solve(a,b);
    }

    return 0;
}

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

int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    string res ;
    if(a==b&&c!=a)res = "Yes";
    else if(a==c&&b!=a)res="Yes";
    else if(b==c&&a!=b)res="Yes";
    else res="No";
    cout<<res;
    return 0;
}


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

int main()
{
    int x, y;
    cin >> x >> y;
    for (int i = 0; i <= 100; i++)
    {
        for (int j = 0; j <= 100; j++)
        {
            if ((i + j) == x)
            {
                if (2 * i + 4 * j == y)
                {
                    cout << "Yes" << endl;
                    return 0;
                }
            }
        }
    }

    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3620
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
//const ll mod=998244353;
const ll mod=1000000007;
ll GCD(ll a,ll b) {return b ? GCD(b,a%b):a;}
ll LCM(ll c,ll d){return c/GCD(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
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; }
int main(){
    int n;
    cin>>n;
    string s;
    cin>>s;
    if(s.size()<=n)cout<<s<<"\n";
    else cout<<s.substr(0,n)<<"..."<<"\n";
}


Measured memory_bytes: 3616
#include<bits/stdc++.h>
#define st first
#define nd second 

using  namespace std;
using pii = pair<int, int>;
using ll = long long;
char s[150];
bool ch(int len){
	for(int i = 1; i <= len; i++){
		if(i >= len - i + 1) return true;
		if(s[i] != s[len - i +1]) return false;
	}
}
int main(){
	scanf("%s", s + 1);
	int n = strlen(s+1);
	printf((ch(n) && ch(n/2)) ? "Yes" : "No");

}

Measured memory_bytes: 256
#include<map>
#include<iostream>
#include<deque>
#include<algorithm>
#include<string>
#include<cctype>
#include<iomanip>
#include<vector>
#include<queue>
 
using namespace std;
#define REP(i,b,e) for(ll i=(ll)b;i<(ll)e;i++)
#define rep0(i,n) REP(i,0ll,n)
#define rep1(i,n) REP(i,1ll,n+1)
 
#define shosu setprecision(13)
 
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> Q;
//ll longinf=1ll<<60;
int inf=1<<29;
int dn[4]={-1,1,0,0};
int dm[4]={0,0,-1,1};
ll longinf=(1ll<<60);

int main(){
      int x,y;
      cin>>x>>y;
      cout<<x+(y/2)<<endl;

      return 0;
}

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

int main() {
	int N;
	cin >> N;
	vector<string> s(N);
	for (int i = 0;i < N;++i) {
		cin >> s[i];
	}
	int M;
	cin >> M;
	vector<string> t(M);
	for (int i = 0;i < M;++i) {
		cin >> t[i];
	}
	sort(s.begin(), s.end());
	sort(t.begin(), t.end());
	int ans = 0;
	for (int i = 0;i < N;++i) {
		int count = 0;
		for (int j = 0;j < N;++j) {
			if (s[j] == s[i]) {
				count++;
			}
		}
		for (int j = 0;j < M;++j) {
			if (t[j] == s[i]) {
				count--;
			}
		}
		if (count > ans) {
			ans = count;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256