akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n, m;
	cin >> n >> m;
	ll out = 2*(n+m) - 4;
	ll ans = n*m - out;
	if(ans < 0) ans *= (-1);
	cout << ans << endl;
	return 0;
}

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

int A,B,C;

void solve(){
  int ans=0;
  if(A==B && B==C && C==A){
    cout << 0 << endl;
  }else{
    int MAX,MID,MIN;
    MAX = max(max(A,B),C);
    MIN = min(min(A,B),C);
    MID = A+B+C-MAX-MIN;

    ans += MAX-MID;
    if((MID-MIN)%2==0)  ans += (MID-MIN)/2;
    else ans += (MID-MIN+1)/2+1;

    cout << ans << endl;
  }
}

int main(){
  cin >> A >> B >> C;
  solve();
}

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

int main() {
  int A,B;
  cin >> A;
  cin >> B;
  int a,b,c,d;
  a = (A-A%10000)/10000;
  b = (B-B%10000)/10000;
  c = (A%10000-A%1000)/1000;
  d = (B%10000-B%1000)/1000;
  int n=0;
  int i,j;
  if (a == b) {
    for (i=c;i<=d;++i) {
      for (j=0;j<=9;++j) {
        int k = 10001*a+1010*i+100*j;
        if (A<=k && k<=B) {
          n += 1;
        }
      }
    }
  }
  else {
    n += (b-a-1)*100;
    for (i=c;i<=9;++i) {
      for (j=0;j<=9;++j) {
        int k = 10001*a+1010*i+100*j;
        if (A<=k) {
          n += 1;
        }
      }
    }
    for (i=0;i<=d;++i) {
      for (j=0;j<=9;++j) {
        int k = 10001*b+1010*i+100*j;
        if (k<=B) {
          n += 1;
        }
      }
    }
  }
  cout << n << endl;
}

Measured memory_bytes: 256
import queue

N, M = map(int, input().split())

rooms = [[] for _ in range(N + 1)]
parents = [-1] * (N + 1)
for m in range(M):
    A, B = map(int, input().split())
    rooms[A].append(B)
    rooms[B].append(A)

q = queue.Queue()
q.put((1, 0))
while(not q.empty()):
    x, p = q.get()
    if parents[x] != -1:
        continue
    parents[x] = p
    for connection in rooms[x]:
        if parents[connection] == -1:
            q.put((connection, x))
print('Yes')
for p in parents[2:]:
    print(p)

Measured memory_bytes: 40136
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6;
int n;
int a[maxn + 10], b[maxn + 10], cnt;
char s[maxn + 10];
long long ans;

int main() {
	scanf("%s", s + 1);
	n = strlen(s + 1);
	for (int i = 1; i <= n; ++i) {
		a[++cnt] = s[i]; int tot = 0;
		if (s[i] == 'A') b[cnt] = 1;
		while (cnt >= 3 && a[cnt - 2] == 'A' && a[cnt - 1] == 'B' && a[cnt] == 'C') {
			tot += b[cnt - 2]; ans += b[cnt - 2]; --cnt;
			a[cnt - 1] = 'B'; a[cnt] = 'C';
			b[cnt - 1] = b[cnt] = 0;
		}
		if (tot) {
			a[++cnt] = 'A';
			b[cnt] = tot;
		}
	}
	printf("%lld", ans);
}


Measured memory_bytes: 3328
#include <stdio.h>

inline static void put_int(int x) {
    int s = 0;
    char f[6] = {'0', '0', '0', '0', '0', '0'};
    if (!x) {
        putchar_unlocked('0');
        return;
    }
    while (x) {
        f[s++] += x % 10;
        x /= 10;
    }

    while (s--) putchar_unlocked(f[s]);
}

int main() {
    int flag = 0, l = 0, r = 0, i = 0, tmp;

    for (;(tmp = getchar_unlocked() - 'L') >= 0; i++) {
        if (tmp) {
            // if c is R
            if (flag) {
                flag = 0;

                if ((tmp = r + 1) < l) {
                    if (r) {
                        putchar_unlocked(' ');
                    }
                    putchar_unlocked('0');

                    for (tmp++; tmp < l; tmp++) {
                        putchar_unlocked(' ');
                        putchar_unlocked('0');
                    }
                }

                if (l > 1 || r) {
                    putchar_unlocked(' ');
                }
                tmp = (l - r + 1) / 2 + (i - l) / 2;
                put_int(tmp);
                putchar_unlocked(' ');
                tmp = (i - r) - tmp;
                put_int(tmp);

                for (tmp = l + 1; tmp < i; tmp++) {
                    putchar_unlocked(' ');
                    putchar_unlocked('0');
                }
                r = i;
            }
        } else {
            // if c is L
            if (!flag) {
                flag = 1;
                l = i;
            }
        }
    }

    if ((tmp = r + 1) < l) {
        if (r) {
            putchar_unlocked(' ');
        }
        putchar_unlocked('0');

        for (tmp++; tmp < l; tmp++) {
            putchar_unlocked(' ');
            putchar_unlocked('0');
        }
    }

    if (l > 1 || r) {
        putchar_unlocked(' ');
    }
    tmp = (l - r + 1) / 2 + (i - l) / 2;
    put_int(tmp);
    putchar_unlocked(' ');
    tmp = (i - r) - tmp;
    put_int(tmp);

    for (tmp = l + 1; tmp < i; tmp++) {
        putchar_unlocked(' ');
        putchar_unlocked('0');
    }

    putchar_unlocked('\n');
}


Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <iomanip>
#include <climits>
#include <map>
using namespace std;
string s[105];
int main()
{
	int L,N;
	cin >> N >> L;
	for(int i = 1;i <= N;i++){
		cin >> s[i];
	}
	sort(s + 1,s + N + 1);
	for(int i = 1;i <= N;i++){
		cout << s[i];
	}
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<vector>
#include<cstring>
using namespace std;
int n,m,ans;
vector<int>sw[100];
int p[100],tmp[100];
bool vis[100];
void dfs(int x){
	if(x==n+1){
		memset(tmp,0,sizeof(tmp));
		for(int i=1;i<=n;++i){
			if(!vis[i]) continue;
			for(int j=0;j<sw[i].size();j++){
				int b=sw[i][j];
				tmp[b]++;
			}
		}
		for(int i=1;i<=m;++i) if(tmp[i]%2!=p[i]) return;
		ans++;
		return;
	}
	dfs(x+1);
	vis[x]=1;
	dfs(x+1);
	vis[x]=0;
}
int main(){
	cin>>n>>m;
	for(int i=1;i<=m;++i){
		int k; cin>>k;
		for(int j=0;j<k;++j){
			int t; cin>>t;
			sw[t].push_back(i);
		}
	} 
	for(int i=1;i<=m;++i) cin>>p[i];
	dfs(1);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
S = list(input())
ans = 0
for i in range(len(S)-1):
    if S[i] == '0' and S[i+1] == '0':
        S[i+1] = '1'
        ans += 1
    elif S[i] == '1' and S[i+1] == '1':
        S[i+1] = '0'
        ans += 1
print(ans)


Measured memory_bytes: 3956
#C

N, M = map(int, input().split())
pS = [input().split() for _ in range(M)]

ac = {i+1:0 for i in range(N)}
wa = {i+1:0 for i in range(N)}

for p, S in pS:
  p = int(p)
  if S=="AC":
    ac[p] = 1
  if S=="WA" and ac[p]==0:
    wa[p] += 1

wa = {i+1:acv*wav for i,[acv,wav] in enumerate(zip(ac.values(), wa.values()))}

print(sum(ac.values()), sum(wa.values()))

Measured memory_bytes: 65792
// ABC156_C
#include <algorithm>
#include <bitset>  // static_cast<std::bitset<8>>
#include <cctype>  // std::isdigit()
#include <climits>  // INT_MIN
#include <cmath>
#include <cstring>  // std::memset
#include <functional>  // std::greater<T>()
#include <iomanip>
#include <iostream>
#include <iterator>
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <map>
#include <list>
#include <stack>
#include <queue>
#include <set>
#include <sstream>  // std::stringstream
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>  // std::swap()
#include <vector>
using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> pll;
#define rep(i, n) for (ll i=0; i < n; i++)  // 0 ~ n-1
#define rep1(i, n) for (ll i=1; i <= n; i++)  // 1 ~ n
#define repr(i, n) for (ll i=n-1; i >= 0; i++)  // n-1 ~ 0
#define all(vec) (vec).begin(), (vec).end()
#define sum(vec) accumulate(all(vec), 0LL)  // 0 は初期値
#define min_vec(vec) min_element(all(vec))  // iterator: * を先頭につける
#define max_vec(vec) max_element(all(vec))  // iterator: * を先頭につける
#define idx(vec, element_iter) distance((vec).begin(), element_iter)
const ll INF = 1LL<<60;  // 10^18（const int inf = 1<<29;）
const double PI = acos(-1);

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    // input(sunippets: inpv, inpn, inps)
    ll N;
    cin >> N;
    vector<ll> vec(N);
    rep(i, N) cin >> vec[i];
    
    // calculation
    ll mn = *min_vec(vec);
    ll mx = *max_vec(vec);
    
    ll res = INF;
    for (ll p = mn; p <= mx; ++p) {
        ll tmp_res = 0;
        rep(i, N) {
            tmp_res += (ll)pow(vec[i]-p, 2);
        }
        res = min(res, tmp_res);
    }
    
    cout << res << "\n";
    
    return 0;
}


Measured memory_bytes: 256
/**
 *    Author:  "Robin Singh" !!!!    
**/
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define ff first
#define ss second
#define mp make_pair
#define str string 
#define szz(v) ((int)(v).size())  
#define fr(i, j, k) for(int i = j; i < k; i++)     // 0 -> n-1 (i,0,n)
#define bk(i, j, k) for(int i = j-1; i >= k; i--)  // n-1 -> 0 (i,n,0)
#define frit(it, a) for(__typeof((a).begin()) it = a.begin(); it != a.end(); ++it)
#define mem(ptr)  memset(ptr, 0, sizeof ptr)  // use fill() for value other than 0 //
#define rtn return 
#define itt(a)   __typeof((a).begin())
#define RT  (cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << " ms\n")  // Run Time
#define nl "\n"  // New Line
#define dbg(x) (cerr << #x << " = " << x << "  ")
#define enl (cerr << "\n")
#define dbgg(x,y) (cerr << #x << " = " << x << " -> " << #y << " = " << y << "\n")
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector< pair<int,int> > vpii;
typedef vector< pair<ll, ll> > vpll;
const long long mod = 1e9+7;
const ld eps = 1e-9;
const int inf = (1<<30);
const ll INF = (1LL<<61);

ll gcd(ll a,ll b) { return b==0 ? a : gcd(b, a%b); }
ll expo(ll x, ll y){ ll res = 1; x = x % mod;  while (y > 0) { if (y & 1)res = (res*x) % mod; y = y>>1;x = (x*x) % mod;}return res;}
void matmul(ll a[][2], ll b[][2]) { ll tmp[2][2]; for(int i=0; i<2; i++) { for(int j=0; j<2; j++) { tmp[i][j] = 0; for(int k=0; k<2; k++) tmp[i][j] = (tmp[i][j] + a[i][k]*b[k][j]) % mod; }} for(int i=0; i<2; i++) for(int j=0; j<2; j++) a[i][j] = tmp[i][j]; }  // answer stored in matrix A
ll fibo(int n)    // returns nth fibonacci number, also S(n) = f(n+2)-1
{ if(n == 0) return 0; else if(n == 1) return 1; ll T[2][2] = { {0, 1} , {1, 1} }; ll res[2][2] = { {1, 0}, {0,1} }; n--; while(n) { if(n & 1) matmul(res, T); n >>= 1; matmul(T, T); } return res[1][1]; }
ll ainv, binv;
void extgcd(ll a, ll b){ if(b==0){/* hcf = a; */ ainv = 1; binv = 0; } else{ extgcd(b, a%b); ll temp = ainv; ainv = binv; binv = temp - (a/b)*binv; } }

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);
    string s, t;
    cin >> s >> t;
    int n = s.size();
    for(int i=0; i<n; i++){
        if(s == t){
            cout << "Yes";
            return 0;
        }
        s = s[n-1] + s.substr(0, n-1);
    }
    cout << "No";
    return 0;
}

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

using namespace std;

char map[8][8];

void solve(int x, int y){
	map[y][x]='0';
	int c[6]={1,2,3,-1,-2,-3};
	for(int i=0;i<2;i++){
		for(int j=0;j<6;j++){
			int a,b;
			a=x;
			b=y;
			if(i==0) a+=c[j];
			else b+=c[j];
			if(0<=a&&a<8&&0<=b&&b<8&&map[b][a]=='1') solve(a,b);
		}
	}
}

int main() {
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		for(int j=0;j<8;j++){
			for(int k=0;k<8;k++){
				cin>>map[j][k];
			}
		}
		int x,y;
		cin>>x>>y;
		solve(x-1,y-1);
		cout<<"Data "<<i+1<<":"<<endl;
		for(int j=0;j<8;j++){
			for(int k=0;k<8;k++){
				cout<<map[j][k];
			}
			cout<<endl;
		}
	}
}

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

int main(){
  string U,D;
  cin>>U>>D;
  if((U.at(0)==D.at(2))&&(U.at(1)==D.at(1))&&(U.at(2)==D.at(0))){
    cout<<"YES"<<endl;
    return 0;
  }
  cout<<"NO"<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define MOD 1000000007
#define INF 1000000000000000000

using namespace std;

int main(void){
  ll n;
  cin >> n;
  
  cout << n * (n + 1) / 2 << endl;

  return 0;
}


Measured memory_bytes: 3588
# -*- coding: utf-8 -*-

s = list(input())
t = list(input())

slen = len(s)
tlen = len(t)

cand = []
for i in range(slen - tlen + 1):
    match = True
    for j in range(tlen):
        if s[i + j] == "?" or s[i + j] == t[j]:
            pass
        else:
            match = False
    if match:
        cand.append(i)

if len(cand) != 0:
    cand.reverse()
    ans = ""
    for i in range(slen):
        if not (cand[0] <= i < cand[0] + tlen):
            if s[i] == "?":
                ans += "a"
            else:
                ans += s[i]
        else:
            ans += t[i - cand[0]]
    print(ans)
else:
    print("UNRESTORABLE")

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

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef vector<vpii> vvpii;
typedef long long ll;
typedef long double ld;

#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define fi first
#define se second

const int MAXN = 1e5;
const int INF = 1e9;
vi adj[MAXN+1];
int dist[MAXN+1];
int sa[MAXN+1];

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

    int n, m;
    cin >> n >> m;
    for(int i = 0; i < n+1; ++i)
    {
        dist[i]=INF;
        sa[i] = INF;
    }

    for(int i = 0; i < m; ++i)
    {
        int a, b;
        cin >> a >> b;
        adj[a].pb(b);
        adj[b].pb(a);
    }

    dist[1] = 0;
    queue<int> q;
    q.push(1);

    while(!q.empty())
    {
        int tren = q.front();
        q.pop();

        for(auto e : adj[tren])
        {
            if(dist[e] == INF)
            {
                dist[e] = dist[tren] + 1;
                sa[e] = tren;
                q.push(e);
            }
        }
    }

    bool ok = 1;
    for(int i = 2; i <= n; ++i)
    {
        if(sa[i]==INF)
        {
            ok = 0;
            break;
        }
    }

    if(!ok)
    {
        cout << "No\n";
        return 0;
    }
    cout << "Yes\n";

    for(int i = 2; i <= n; ++i)
        cout << sa[i] << '\n';
}


Measured memory_bytes: 10908
#include<stdio.h>

#define SIZE 200001
#define MIN -1000000000

int main(){
  int i,j;
  int max=MIN,min;
  int a[SIZE];

  while(scanf("%d",&a[i]) != EOF){
    i++;
  }

  min=a[1];
  for(i=2;i<=a[0];i++){
    if(max<a[i]-min)
      max=a[i]-min;
    if(min>a[i])
      min=a[i];
  }
  printf("%d\n",max);

  return 0;
}
    

Measured memory_bytes: 2576
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> i_i;
typedef pair<ld, int> ld_i;

ll INF = LLONG_MAX / 10;
ld EPS = 1e-18;

int gcd(int a, int b) {
	return b ? gcd(b, a % b) : abs(a);
}

struct segtree {
	int n; vector<ll> v;
	segtree(int _n) {
		for (n = 1; n < _n; n *= 2);
		v = vector<ll>(n * 2 - 1, INF);
	}
	void set(int i, ll x) {
		int k = i + n - 1;
		v[k] = x;
		while (k > 0) {
			k = (k - 1) / 2;
			v[k] = min(v[k * 2 + 1], v[k * 2 + 2]);
		}
	}
	ll _get(int i, int j, int k, int l, int r) {
		if (r <= i || j <= l) return INF;
		if (i <= l && r <= j) return v[k];
		ll vl = _get(i, j, k * 2 + 1, l, (l + r) / 2);
		ll vr = _get(i, j, k * 2 + 2, (l + r) / 2, r);
		return min(vl, vr);
	}
	ll get(int i, int j) { return _get(i, j, 0, 0, n); }
};

int main() {
	int N; cin >> N;
	vector<int> x(N), y(N), p(N);
	for (int i = 0; i < N; i++)
		cin >> x[i] >> y[i] >> p[i];
	ll mi = INF;
	map<i_i, int> mp;
	for (int i = 0; i < N; i++)
		if (x[i] || y[i]) {
			int d = gcd(x[i], y[i]);
			i_i xy(x[i] / d, y[i] / d);
			if (!mp.count(xy)) mp[xy] = INT_MAX;
			mp[xy] = min(mp[xy], p[i]);
		}
	vector<int> unko;
	for (auto z: mp) {
		i_i xy = z.first, _xy = i_i(-xy.first, -xy.second);
		if (mp.count(_xy)) {
			unko.push_back(mp[xy] + mp[_xy]);
			mp.erase(_xy);
		}
	}
	if (unko.size() >= 2) {
		sort(unko.begin(), unko.end());
		mi = min(mi, (ll)unko[0] + unko[1]);
	}
	vector<ld_i> v;
	for (int i = 0; i < N; i++)
		if (x[i] || y[i])
			v.push_back(ld_i(atan2l(y[i], x[i]), p[i]));
	N = v.size();
	sort(v.begin(), v.end());
	vector<ld> a(N * 2);
	segtree st(N * 2);
	ld PI = acosl(-1);
	for (int i = 0; i < N; i++) {
		a[i] = v[i].first;
		a[i + N] = a[i] + PI*2;
		st.set(i, v[i].second);
		st.set(i + N, v[i].second);
	}
	for (int i = 0; i < N; i++) {
		ll sum = st.get(i, i + 1);
		int l, r;
		l = upper_bound(a.begin(), a.end(), a[i] + PI/2 + EPS) - a.begin();
		r = lower_bound(a.begin(), a.end(), a[i] + PI - EPS) - a.begin();
		sum += st.get(l, r);
		l = upper_bound(a.begin(), a.end(), a[i] + PI + EPS) - a.begin();
		r = lower_bound(a.begin(), a.end(), a[i] + PI*3/2 - EPS) - a.begin();
		sum += st.get(l, r);
		mi = min(mi, sum);
	}
	if (mi == INF) mi = -1;
	cout << mi << endl;
}

Measured memory_bytes: 38452
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0; i<(n); ++i)
#define REPR(i,n,m) for (int i=(n); i>=(m); --i)
using namespace std;
using LL = long long;
using LD = long double;
using PLL = pair<long long, long long>;
using PLD = pair<long double, long double>;
using VLL = vector<long long>;
using VLD = vector<long double>;
using VPLD = vector<PLD>;

const int INF = numeric_limits<int>::max();

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

    char ch[1];
	cin >> ch[0];
	int i = ch[0] + 1;
	cout << (char) i << endl;
	return 0;
}


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

using namespace std;

int main()
{
    int w[10], k[10];

    for (int i = 0; i < 10; i++) {
        cin >> w[i];
    }
    for (int i = 0; i < 10; i++) {
        cin >> k[i];
    }
    sort(w, w + 10);
    sort(k, k + 10);
    cout << w[9] + w[8] + w[7] << " " << k[9] + k[8] + k[7] << endl;
}



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

using namespace std;

const int mod = 1e9 + 7;

int main () {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int N;
  char ch;
  cin >> N;
  vector < int > adj(N);
  for (int i = 0; i < N; ++i)
    for (int j = 0; j < N; ++j) {
      cin >> ch;
      if (ch == '1')
        adj[i] |= (1 << j);
    }
  vector < int > dp(1 << N);
  dp[0] = 1;
  for (int mask = 1; mask < (1 << N); ++mask) {
    int a = __builtin_popcount(mask), ans = 0;
    for (int b = mask & adj[a - 1]; b; b &= b - 1) {
      ans += dp[mask & ~(b & -b)];
      if (ans >= mod)
        ans -= mod;
    }
    dp[mask] = ans;
  }
  cout << dp[(1 << N) - 1];
}


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

int main() {
	long long n,i,j,k,sum=0,count=0,ans=0;
	cin>>n>>k>>j;
    if(j-(n+k)<0)
    cout<<"No";
    else
    {
        j=j-(n+k);
        if(j*j>4*n*k)
        cout<<"Yes";
        else
        cout<<"No";
    }
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define PI 3.141592653
int main()
{
	ll arr[200002]={0};
	ll n;
	cin>>n;
	rep(i,1,n)
	{
		ll ch;
		cin>>ch;
		arr[ch]+=1;
	}
	rep(i,1,n+1)
	cout<<arr[i]<<"\n";
	return 0;
}

Measured memory_bytes: 5188
#include <vector>
#include <algorithm>
#include <iostream>

using namespace std;

int main(void) {
  int compare, n, x, max;
  cin >> n;
  vector<int> v;
  
  for(int i = 0; i < n; i++) {
    cin >> x;
    v.push_back(x);
  }

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

  compare = v[0];
  max = v[n - 1];
  if(compare == max) {
    cout << compare << endl;
  }
  else { 
    for(int i = 0; i < n; i++) {
      if(i == 0)
        cout << v[0] << " ";
    
      if(compare != v[i]) {
        compare = v[i];
        cout << v[i];
        if(compare != max)
          cout << " ";
      }
    }
    cout << endl;
  }
  
}


Measured memory_bytes: 3560
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Linq;
using System.Diagnostics;
using System.Globalization;


namespace templete
{
    class BinarySearch
    {
        static void Main(string[] args)
        {
            Console.ReadLine();
            int[] num_n = Console.ReadLine().Split().Select(int.Parse).ToArray();

            int q = int.Parse(Console.ReadLine());
            int[] num_q = Console.ReadLine().Split().Select(int.Parse).ToArray();

            int count=0;
            for(int i=0; i<q; i++){
                int key = num_q[i];
                if(Search(num_n,key) != -1)count++;
            }
            Console.WriteLine(count);
        }

        static int Search(int[] num, int key){
            int left=0;
            int right=num.Length;

            while(left<right){
                int mid = (left+right)/2;
                if(num[mid] == key){
                    return mid;
                }else if(num[mid] < key){
                    left = mid+1;
                }else{
                    right = mid;
                }
            }
            return -1;
        }
    }
}


Measured memory_bytes: 22784
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pb push_back
#define ll long long
#define mp make_pair
#define MAXN 1e6
const int mod=1e9+7;

void solve()
{
  ll cnt=0;
  ll n;
  ll val=100;
  cin>>n;
  while(val<n)
  {
    val=val+(val)/100;
    cnt++;
  }
  cout<<cnt<<endl;
}

int main()
{
  fastio
  solve();
}


Measured memory_bytes: 3652
from fractions import gcd
a,b,c,d = map(int, input().split())

l = c*d // gcd(c, d)
x = (a-1) - (a-1)// c - (a-1) // d + (a-1) // l
y = b - b // c - b // d + b //l
print(y - x)

Measured memory_bytes: 5048
#include <bits/stdc++.h>
using namespace std;
long long f[200005];
long long D=1e9+7;
int n;

long long pow2(long long x,int y){
    if(y==0)return 1;
    long long k=pow2(x,y/2);
    return k*k%D*(y%2==1 ? x:1)%D;
}
int main()
{
    long long a,b;
    cin>>n>>a>>b;
    f[0]=1;
    int i,j;
    for(i=1 ; i<=2e5 ; i++)f[i]=f[i-1]*i%D;
    long long aa=1;
    long long bb=1;
    for(i=n ; i>n-a ; i--)aa=aa*i%D;
    for(i=n ; i>n-b ; i--)bb=bb*i%D;

    cout<<(pow2(2,n)-1-aa*pow2(f[a],D-2)%D-bb*pow2(f[b],D-2)%D+D*2)%D;
    return 0;
}


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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define i_i pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< i_i >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second
#define Decimal fixed << setprecision(10)

//int dxy[5] = {0, 1, 0, -1, 0};
// cmd

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

    Int(n);
    vector<int> state(n);
    for (int i = 0; i < n; i++) {
        cin >> state[i];
    }
    Int(dist);
    vvi tap(20, vi(n, 0));

    rep(i, n) {
        int ptr = upper_bound(all(state), state[i] + dist) 
            - state.begin() - 1;
        tap[0][i] = ptr;
    }

    Rep(j, 20) {
        rep(i, n) {
            tap[j][i] = tap[j-1][tap[j-1][i]];
        }
    }

    Int(q);
    while (q--) {
        int2(a, b); a--; b--;
        if (a > b) swap(a, b);
        int ans = 0;
        for (int i = 19; i >= 0; i--) {
            if (tap[i][a] < b) {
                a = tap[i][a];
                ans += 1 << i;
            }
        }
        cout << ans + 1 << endl;
    }

    return 0;
}


Measured memory_bytes: 17536
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define eb          emplace_back
#define c(P)        cout<<P<<"\n"
#define pii         pair<ll,ll>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define F           first
#define S           second
#define mp(x,y)     make_pair(x,y) 
#define mem(a,val)  memset(a,val,sizeof(a))
#define fr(i,a,n)   for(ll i=a;i<n;i++)
#define frr(i,a,n)  for(ll i=n-1;i>=a;i--)


const ll N   =  500005;
const ll mod = 1e9 + 7;

using namespace std;


void solve()
{
// string s;
  ll n,m,k,x=0,y=0,c=0,q,ans=0;
  cin>>n;
  pii a[n];
  for (ll i = 0; i < n; ++i)
  {
    cin>>x>>y;
  a[i] = {y,x};
  }
  sort(a,a+n);
  for (int i = 0; i < n; ++i)
  {
      c +=a[i].S;
      if(c>a[i].F)
      {
            c("No");
            return;

      }

  }
  c("Yes");
  
  //cout<<c<<" ";
}

signed main(){

      ios_base::sync_with_stdio(false);   
      cin.tie(NULL);
      ll T=1;
      //cin>>T;
      while(T--)
      {
      solve();
      }
      return 0;
    }


Measured memory_bytes: 3328
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define NDEBUG
#define eprintf(...) do {} while (0)
#endif
#include<cassert>

using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}

int C[311][311];
int dp[311][311];
int cost(const string &A, const string &B) {
    int len = A.size();
    memset(C, 0, sizeof C);
    for (int i=len; i--;) for (int j=len; j--;) {
	C[i][j] = C[i+1][j+1];
	if (A[len-1-i] == B[len-1-j]) C[i][j]++;
    }

    memset(dp, 0x3f, sizeof dp);
    dp[0][0] = 0;
    REP (i, len+1) REP (j, len+1) {
	amin(dp[i+1][j], dp[i][j] + C[i][j]);
	amin(dp[i][j+1], dp[i][j] + C[i][j]);
    }
    return dp[len][len];
}

int H, W;
char F[311][311];

void MAIN() {
    scanf("%d%d", &H, &W);
    REP (i, H) scanf("%s", F[i]);

    string A(H, 'a'), B(H, 'a');
    int ans = 0;
    REP (j, W-1) {
	REP (i, H) {
	    A[i] = F[i][j];
	    B[i] = F[i][j+1];
	}
	ans += cost(A, B);
    }
    printf("%d\n", ans);
}

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}



Measured memory_bytes: 1152
# coding: utf-8
# Your code here!

N=int(input())
X=list(map(int,input().split()))
Y=list(map(int,input().split()))

ans=0

for i in range(N):
    if(X[i]-Y[i])>0:
        ans+=X[i]-Y[i]
    
print(ans)

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

#define _ << " _ " <<
#define TRACE(x) cout << #x << " = " << x << endl

typedef long long ll;

int n;

void solve(int a, int b, vector<int> v) {
    if (v.size() == 1) {
        cout << a << " " << b << " ";
        return;
    }

    for (int i : v) {
        if ((a ^ b) & (1 << i)) {
            int j;
            if (i == v[0]) j = v[1];
            else j = v[0];

            v.erase(find(v.begin(), v.end(), i));

            int c = a ^ (1 << j);
            int d = c ^ (1 << i);

            solve(a, c, v);
            solve(d, b, v);

            return;
        }
    }
}


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

    int a, b;
    cin >> n >> a >> b;

    int cnt = 0;
    for (int i = 0; i < n; i++)
        if ((a ^ b) & (1 << i)) cnt++;

    if (cnt % 2 == 0) {
        cout << "NO\n";
        return 0;
    }

    cout << "YES\n";

    vector<int> v(n);
    for (int i = 0; i < n; i++) v[i] = i;
    solve(a, b, v);

    return 0;
}



Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	vector<int> v(3);
	REP(i,3)cin >> v[i];
	
	sort(v.begin(),v.end());
	if(v[0] == v[1])cout << v[2] << endl;
	else cout << v[0] << endl;
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>  // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset>     // bitset
#include <cctype>     // isupper, islower, isdigit, toupper, tolower
#include <cstdint>    // int64_t, int*_t
#include <cstdio>     // printf
#include <deque>      // deque
#include <iomanip>    // fixed, setprecision
#include <iostream>   // cout, endl, cin
#include <map>        // map
#include <numeric>    // accumulate
#include <queue>      // queue, priority_queue
#include <set>        // set
#include <stack>      // stack
#include <string>     // string, to_string, stoi
#include <tuple>      // tuple, make_tuple
#include <unordered_map>  // unordered_map
#include <unordered_set>  // unordered_set
#include <utility>        // pair, make_pair
#include <vector>         // vector
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

int main() {
  ll N, K, j = 0, c = 1;
  cin >> N >> K;
  vector<ll> A(N + 1), B, E(N + 1, -1);
  for (ull i = 1; i <= N; i++) {
    cin >> A.at(i);
  }

  while (E[c] == -1) {
    B.push_back(c);
    E[c] = j;
    c = A[c];
    j++;
  }

  ll first = E[c];
  ll loop = j - first;
  cout << (K < j ? B[K] : B[((K - first) % loop) + first]) << endl;
}


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

int main()
{
    int n;
    ll ans = 0;
    int mx = 0;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    rep2(i, 1, n) {
        mx = max(mx, a[i-1]);
        if (a[i] < mx) {
            ans += mx - a[i];
            a[i] = mx;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4028
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define INF 1e16
typedef pair<int,int> P;
typedef long long ll;


int main(void){
    ll n,ans=0;
    cin>>n;
    vector<ll>a(n+1),b(n);
    for(int i=0;i<n+1;i++)cin>>a[i];
    for(int i=0;i<n;i++)cin>>b[i];
    for(int i=0;i<n;i++){
        if(a[i]>b[i])ans+=b[i];
        else{
            ans+=a[i];
            b[i]-=a[i];
            if(a[i+1]>=b[i]){
                ans+=b[i];
                a[i+1]-=b[i];
            }
            else{
                ans+=a[i+1];
                a[i+1]=0;
            }
        }
    }
    cout<<ans<<endl;
}

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

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

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

  Graph A( H , vector<int> (W,0) );
  Graph count( H , vector<int> (W,0) );
  queue< pair<int,int> > que;

  rep(y,H){
    rep(x,W){

      char a;
      cin >> a;
      if( a == '#' ){
       A[y][x]=1;
       que.push( make_pair(x,y) );
      }
   
    }
  }

  vector<int> dx = { 0, 1, 0, -1 };
  vector<int> dy = { 1, 0, -1, 0 };
  int res = 0;
  
  while( !que.empty() ){

        pair<int,int> v = que.front();
        que.pop();

        int x = v.first;
        int y = v.second;

        rep(i,4) {

            int nv_x = x + dx[i];
            int nv_y = y + dy[i];

            //通れるか？
            if ( nv_x < 0 || nv_x >= W ) continue;
            if ( nv_y < 0 || nv_y >= H ) continue;
            if ( A[nv_y][nv_x] == 1 ) continue;
            
            A[nv_y][nv_x] = 1;
            count[nv_y][nv_x] = count[y][x] +1;
            res = count[nv_y][nv_x];
            que.push( make_pair(nv_x,nv_y) );

        }
    }
   
  printf("%d\n", res );
  return 0;

}


Measured memory_bytes: 16272
import math
from sys import exit, stdin

N = int(stdin.readline().rstrip())
TA = [list(map(int, stdin.readline().rstrip().split())) for _ in range(N)]

n, x, y = 1, 1, 1

def ceil(x,y):
    if x%y==0:
        return x//y
    else:
        return (x//y) + 1

for i in range(N):
    n = max(ceil(x, TA[i][0]), ceil(y, TA[i][1]))
    x = TA[i][0]*n
    y = TA[i][1]*n

print(x+y)

Measured memory_bytes: 3188
#include <cctype>
#include <iostream>

using namespace std;


int main(){
    
    int alphabet_counts[26]={0};
    char ch;

    while(cin >> ch){
        if(isalpha(ch)){
            ch = tolower(ch);
            int index = ch - 'a';
            alphabet_counts[index]++;
        }
    }

    char thumbnail = 'a';
    for(int i=0; i<26; i++){
        cout << thumbnail << " : " << alphabet_counts[i] << endl;
        (int)thumbnail++;
    }
            
    return 0;
}




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

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

int main(){
  int n,k,r,s,p;
  string t;
  int max=0,second=0;
  char cmax,csecond;
  cin >> n >> k;
  cin >> r >> s >> p;
  cin >> t;
  int score[n];
  bool flag[n];
  for(int i=0;i<n;i++) flag[i] = true;
  for(int i=0;i<n;i++){
    if(t[i]=='r') {
      t[i]='p';
      score[i]=p;
    }else if(t[i]=='s') {
      t[i]='r';
      score[i]=r;
    }else {
      t[i]='s';
      score[i]=s;
    }
  }
  
  if(r>s){
    if(s>p){
      max = r;
      second = s;
      cmax = 'r';
      csecond = 's';
    }else if(r > p){
      max = r;
      second = p;
      cmax = 'r';
      csecond = 'p';
    }else {
      max = p;
      second = r;
      cmax = 'p';
      csecond = 'r';
    }
  }else{
    if(r>p){
      max = s;
      second = r;
      cmax = 's';
      csecond = 'r';
    }else if(s > p){
      max = s;
      second = p;
      cmax = 's';
      csecond = 'p';
    }else{
      max = p;
      second = r;
      cmax = 'p';
      csecond = 'r';
    }
  }
  long long int sum = 0;
  for(int i=0;i<n;i++){
    if(t[i]==cmax&&flag[i]) {
      sum += max;
      flag[i] = false;
      if(i+k<n) {
	if(t[i+k]==t[i])flag[i+k] = false;
      }
    }
  }

  
  for(int i=0;i<n;i++){
    if(t[i]==csecond&&flag[i]) {
      sum += second;
      flag[i] = false;
      if(i+k<n) {
	if(t[i+k]==t[i]) flag[i+k] = false;
      }
    }
  }

  for(int i=0;i<n;i++){
    if(flag[i]) {
      sum += score[i];
       if(i+k<n) {
	if(t[i+k]==t[i]) flag[i+k] = false;
      }
    }
  }
  cout << sum << endl;
  return 0;
}


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

int main() {
  int n,x;
  cin >> n;
  set<int> box;
  for(int i=0;i<n;i++){
    cin >> x; box.insert(x);
  }
  if(box.size()<n) cout << "NO" << endl;
  else cout << "YES" << endl;
}


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

using namespace std;
using namespace __gnu_pbds; 
  
#define ll long long
#define X first
#define Y second
#define all(x) x.begin(), x.end()
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
	enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
	ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
	*this << "[";
	for (auto it = d.b; it != d.e; ++it)
		*this << ", " + 2 * (it == d.b) << *it;
	ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

const int mod = (int)1e9 + 7;
const int MX = (int)1e5 + 10;

void add_self(int &x, int y){x += y; if(x >= mod) x -= mod;}
void sub_self(int &x, int y){x -= y; if(x < 0) x += mod;}
void mul(int &x, int y){x = x * 1LL * y % mod;}

int main(){

	cin.tie(0); cout.tie(0);
	ios_base::sync_with_stdio(0);
	
	int n, p;
	string s;
	cin >> n >> p >> s;

	int gcd = __gcd(10, p);

	if(gcd != 1){
		// gcd is either, 2, 5
		assert(gcd == 2 || gcd == 5);
		ll res = 0;
		for(int i = 0; i < n; ++i){
			if((s[i] - '0') % gcd == 0)
				res += i + 1;
		}
		cout << res << endl;
		return 0;
	}

	unordered_map<int, int> mp;
	mp[0] = 1;
	ll res = 0;
	int cur = 0;
	int pw = 1;
	//least most to rightmost processing
	for(int i = n - 1; i >= 0; --i){
		cur = (cur + pw * (s[i] - '0')) % p;
		res += mp[cur];
		mp[cur]++;
		pw = (pw * 10) % p;
	}

	cout << res << endl;

	return 0;
}

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

using namespace std;
using ll =long long;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }
void coY() {cout <<"Yes"<<endl;}
void coN(){cout <<"No"<<endl;}
const ll INF = 1LL << 60;
const int mod = 1e9+7;
//Write From this Line

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 main()
{
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i,n) cin >> a[i];
	map<int,int> menu;
	rep(i,n){
		menu[a[i]] ++ ;
	}
	ll ans = modpow(2,(n/2),mod);
	if( n % 2 ) {
		for(auto x: menu){
			if(x.second >= 3 ){
				puts("0");
				return 0 ;
			}
			if(x.first != 0 && x.second != 2){
				puts("0");
				return 0 ;
			}
		}
		if(menu[0] != 1){
			puts("0");
			return 0;
		}
	}
	else {
		for(auto x: menu){
			if(x.second != 2){
				puts("0");
				return 0;
			}
		}
	}
	cout << ans << endl;

}


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

typedef long long ll;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl

const int maxn = 1e6 + 5;

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);
  cout << fixed << setprecision(12);
  int ans = 1e9;
  int n,t; cin>>n>>t;
  while (n--) {
  	int C,T; cin>>C>>T;
    if (T<=t) ans=min(C,ans);
  }
  if (ans==1e9) out("TLE");
  out(ans);
  

  return 0;
}


Measured memory_bytes: 256
from sys import exit

n = int(input())
print(0, flush=True)
inl = input()
inr = inl
if inl == "Vacant":
	exit()
print(n//2, flush=True)
#outr = n//2
inm = input()
if inm == "Vacant":
	exit()

outl, outr = 0, n

while True:
	#前半を見るパターン
	if (((outl+outr)//2 - outl) % 2 == 0 and inl != inm) or (((outl+outr)//2 - outl) % 2 == 1 and inl == inm):
		outr = (outl+outr)//2
		print((outl+outr)//2, flush=True)
		inr = inm
		inm = input()
		if inm == "Vacant":
			exit()

	#後半を見るパターン
	else:
		outl = (outl+outr)//2
		print((outl+outr)//2, flush=True)
		inl = inm
		inm = input()
		if inm == "Vacant":
			exit()

Measured memory_bytes: 3660
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    int N; cin >> N;
    cout<< N * (N+1) /2 << endl;

}

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


int main(){
    int H1, M1, H2, M2, K;
    cin >> H1 >> M1 >> H2 >> M2 >> K;

    int minutes = abs(H2 - H1)*60 + M2 - M1;
    // cout << minutes << endl;
    // cout << minutes - K << "\n";
    int res = minutes - K > 0 ? minutes - K : 0 ;
    cout << res << "\n";

    return 0;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
const int Maxn=5005,mod=1e9+7;
vector<int>e[Maxn];
int sz[Maxn],g[Maxn],f[Maxn][Maxn],dp[Maxn];
int dfs(int x,int fa){
    f[x][1]=1;sz[x]=1;
    for(int y:e[x]){
        if(y==fa)continue;
        dfs(y,x);
        for(int i=sz[x];~i;i--)
            for(int j=sz[y];~j;j--)
                dp[i+j]=(dp[i+j]+1ll*f[x][i]*f[y][j])%mod;
        memcpy(f[x],dp,sizeof(dp));
        memset(dp,0,sizeof(dp));
        sz[x]+=sz[y];
    }
    for(int i=2;i<=sz[x];i+=2)
        f[x][0]=(f[x][0]-1ll*f[x][i]*g[i])%mod;
}
int main(){
    int n;cin>>n;
    for(int i=1;i<n;i++){
        int x,y;cin>>x>>y;
        e[x].push_back(y);
        e[y].push_back(x);
    }
    for(int i=2,lst=1;i<=n;i+=2)
        lst=g[i]=1ll*lst*(i-1)%mod;
    dfs(1,0);
    cout<<(-f[1][0]+mod)%mod<<"\n";
    return 0;
}

Measured memory_bytes: 98688
// abc.108.C - Digits in Multiplication

#include <bits/stdc++.h>
using namespace std;

int main( void ) {
    long long n;
    cin >> n;

    //探索範囲
    int       root_n = sqrt( n );
    long long res    = 0;
    int       ans    = 15;
    for( long long i = 1; i <= root_n; i++ ) {

        if( n % i == 0 ) {
            res     = max( i, n / i );
            int cnt = 0;
            while( res ) {
                res /= 10;
                cnt++;
            }
            ans = min( ans, cnt );
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int toi = scan.nextInt();
		int[] nanido = new int[toi];
		int re = 0;

		for(int i=0;i<toi;i++) {
			nanido[i] = scan.nextInt();
		}

		Arrays.sort(nanido);


			if(nanido[(toi/2)-1] == nanido[toi/2]) {
				re = 0;
			}else {
				re = nanido[toi/2] - nanido[(toi/2)-1];
			}

				System.out.println(re);
		scan.close();

	}

}


Measured memory_bytes: 49440
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<iomanip>


using namespace std;
typedef long long ll;
typedef vector<ll> v;
typedef vector<vector<ll>> vv;


#define MOD 1000000007
#define INF 1001001001
#define MIN -1001001001
#define rep(i,k,N) for(int i=k;i<N;i++)
#define MP make_pair
#define MT make_tuple //tie,make_tuple は別物
#define PB push_back
#define PF push_front
#define all(x) (x).begin(),(x).end()


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

ll inv(ll x){
    // MOD=10e9+7
	ll n=MOD-2,a=1;
	while(n>0){
		if(n%2) a=a*x%MOD;
		x=x*x%MOD;
		n=n/2;
	}
	return a;
}
vector<ll> facts(1,1);
ll factorial(ll n){
    if(facts.size() - 1 >= n)return facts[n];
    else{
        rep(i,facts.size(),n+1){
            facts.push_back((facts[i-1] * i)%MOD);
        }
        return facts[n];
    }
}

vector<ll> inv_facts(1,1);
ll inv_factorial(ll n){
    if(inv_facts.size() - 1 >= n)return inv_facts[n];
    else{
        rep(i,inv_facts.size(),n+1){
            inv_facts.push_back((inv_facts[i-1] * inv(i))%MOD);
        }
        return inv_facts[n];
    }
}

ll Comb(ll n,ll m){
    return (((factorial(n) * inv_factorial(m))%MOD) * inv_factorial(n-m))%MOD;
}

int main(){
    ll S;
    cin>>S;
    ll ans = 0;
    rep(i,1,(S/3)+1){
        ll N = S- 3 * i;
        ans += Comb(N+i-1,i-1);
        ans %= MOD;
    }
    cout<<ans;
    return 0;
}

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


int main() {
  int A,B;
  cin >> A >> B;
  bool a = false;
  int ans;
  for(int i=0;i<10000;i++){
    if(i*8/100==A && i*10/100==B){
      ans = i;
      a = true;
      break;
    }
  }
  if(a) cout << ans << endl;
  else cout << -1 << endl; 
  return 0;
}
        

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<vector>
#include<list>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<string>
#include<utility>
#include<algorithm>
#include<functional>
#include<deque>
#include<string.h>
#include<ctype.h>
using namespace std;

const int MAX_N = 60;
char a[MAX_N][MAX_N];


bool check(int i, int j){
  bool f = true;
  if (a[i][j-1] == '.' && a[i+1][j] == '.' && a[i][j+1] == '.' && a[i-1][j] == '.'){
    f = false;
  }
  return f;
}


int main(){
  int h, w;
  cin >> h >> w;
  for (int i = 1; i <= h; i++){
    for (int j = 1; j <= w; j++){
      cin >> a[i][j];
    }
  }
  for (int i = 1; i <= h; i++){
    a[i][0] = '.';
    a[i][w+1] = '.';
  }
  for (int j = 1; j <= w; j++){
    a[0][j] = '.';
    a[h+1][j] = '.';
  }

  int cnt = 0;
  bool ff = true;
  for (int i = 1; i <= h; i++){
    for (int j = 0; j <= w+1; j++) {
      if (cnt){
        if (a[i][j] == '.'){
          ff = check(i, j-1);
          if (ff == false){
            cout << "No" << endl;
            return 0;
          } else {
            cnt = 0;
          }
        } else {
          cnt = 0;
        }
      }
      if (a[i][j] == '#'){
        cnt++;
      }
    }
  }

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


Measured memory_bytes: 256
N=int(input())
str_list = input().split(' ')
v = [int(x) for x in str_list]

while len(v)>1:
    v.sort(reverse=True)
    val1 = v.pop()
    val2 = v.pop()
    mean = (val1 + val2) / 2.0
    v.append(mean)
print(v[0])


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

i = 0
ans = '0'
while True:
    try:
        if s[i] != '1':
            ans = s[i]
            break
        else:
            i += 1
    except IndexError:
        ans = s[i-1]
        break
    
if k <= len(s):
    ans = '1'
    for i in range(k):
        if s[i] != '1':
            ans = s[i]
            break

print(ans)

Measured memory_bytes: 3064