akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int idx(int y,int m){
  if(m==4||m==6||m==9||m==11)
    return 30;
  else if(m==2){
    if(y%400==0)
      return 29;
    else if(y%100==0)
      return 28;
    else if(y%4==0)
      return 29;
    else
      return 28;
  }
  return 31;
}

void month(int *n,int s,int e,int y){
  int i,ans=*n;
  for(i=s;i<=e;i++){
    ans+=idx(y,i);
  }
  *n=ans;
}

int main(void){
  int d[6],i,j,ans;
  while(1){
    for(i=0;i<6;i++)
      scanf("%d",&d[i]);
    for(i=0;i<6;i++)
      if(d[i]<0)return 0;
    ans=0;
    for(i=d[0]+1;i<d[3];i++){
      if(i%400==0)
	ans+=366;
      else if(i%100==0)
	ans+=365;
      else if(i%4==0)
	ans+=366;
      else ans+=365;
    }
    if(d[0]!=d[3]){
      month(&ans,d[1],12,d[0]);
      ans=ans-d[2]+1;
      month(&ans,1,d[4]-1,d[3]);
      for(i=1;i<d[5];i++)
	ans++;      
    }
    else{
      month(&ans,d[1],d[4]-1,d[0]);
      ans=ans-d[2]+1;
      for(i=1;i<d[5];i++)
	ans++;
    }
    printf("%d\n",ans);
  }
  return 0;
}

Measured memory_bytes: 596
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; i++)
int main()
{
    ll n, T;
    cin >> n >> T;
    ll ans = 0;
    vector<ll> t(n);

    rep(i, n)
    {
        cin >> t[i];
    }
    rep(i, n)
    {
        if (i + 1 >= n)
        {
            ans += T;
        }
        else if (t[i + 1] > t[i] + T)
        { //かぶっていなかったら
            ans += T;
        }
        else
        {
            ans += t[i + 1] - t[i];
        }
        // cout << ans << endl;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1792
/*
 
Sviatoslav Bidzilia 2020
CF: anakib1
 
*/
 
#include <iostream>
#include <cmath>
#include <algorithm>
#include <stdio.h>
#include <cstring>
#include <string>
#include <cstdlib>
#include <vector>
#include <bitset>
#include <map>
#include <chrono>
#include <cassert>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <queue>
#include <ctime>
#include <stack>
#include <functional>
#include <set>
#include <list>
#include <deque>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <stdarg.h>
#include <utility>
 
using namespace std;
 
#define pb push_back
#define mp make_pair
#define ll long long
#define ull unsigned long long
#define ld long double
#define all(a) a.begin(), a.end()
#define SORT(a) sort(all(a))
#define pii pair<int, int>
#define tii triple<int, int, int>
#define sz(x) (int)(x.size())
#define e 1e-7
#define PI acos(-1)
#define inf 1e17
#define vi vector<int>
#define F first
#define S second
#define rng(x) for(int _ = 0; _ < (x); _++)
#define rngi(i, x) for(int i = 0; i < (x); i++)
#define rngsi(s, i, x) for(int i = (s); i <(x); i++)
#define int long long
 
template<typename A, typename B, typename C>
struct triple
{
    A X;
    B Y;
    C Z;
    triple(A a = 0, B b = 0, C c = 0) :X(a), Y(b), Z(c) {}
};
template<typename A, typename B, typename C>
triple<A, B, C> make_triple(A a = 0, B b = 0, C c = 0)
{
    return triple<A, B, C>(a, b, c);
}
template<typename A, typename B, typename C>
bool operator<(const triple<A, B, C>& a, const triple<A, B, C>& b)
{
    if (a.X != b.X)
        return a.X < b.X;
    if (a.Y != b.Y)
        return a.Y < b.Y;
    return a.Z < b.Z;
}
template<typename T, typename SS>
ostream& operator<<(ostream& ofs, const pair<T, SS>& p)
{
    ofs << "( " << p.F << " , " << p.S << " )";
    return ofs;
}
template<typename T>
void print(T a)
{
    for (auto i : a)
        cout << i << ' ';
    cout << '\n';
}
template<typename T>
T max(T a, T b, T c)
{
    return max(a, max(b, c));
}
template<typename T>
T min(T a, T b, T c)
{
    return min(a, min(b, c));
}
struct custom_hash
{
    static uint64_t splitmix64(uint64_t x)
    {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
 
    size_t operator()(uint64_t x) const
    {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
signed main()
{
    //freopen(".in", "r", stdin);
    //freopen(".out", "w", stdout);
    srand(time(NULL));
    cin.tie(0);
    cout.tie(0);
    ios_base::sync_with_stdio(false);
    int n;
    cin >> n;
    vi a(n), b(n);
    rngi(i, n) cin >> a[i] >> b[i];
    SORT(a);SORT(b);
    if(n & 1)
        cout << b[n/2] - a[n/2] + 1 << '\n';
    else{
        int y = (b[n/2] + b[n/2 - 1]), x = (a[n/2] + a[n/2 - 1]);
        cout << y - x+ 1 << '\n';
    }
}
//check corner case (interactives!)
//check n=1 or n=2
//check size of arrays
//more asserts
//scanf printf
//read everything normaly



Measured memory_bytes: 6360
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
using namespace std;

int main()
{
	typedef long long ll;

	ll x,y;
	cin >> x >> y;

	if(abs(x - y) <= 1)
	{
		cout << "Brown" << endl;
	}
	else
	{
		cout << "Alice" << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

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

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;
const ll mod = 1e9 + 7;

const int N = 100100;
ll a[N];

int main(void){
  int n;
  ll t;
  cin >> n >> t;
  REP(i, 0, n) {
    cin >> a[i];
  }
  // get max {a[j] - a[i] | j > i}
  ll mi = 1e16;
  VL diff(n);
  REP(i, 0, n) {
    mi = min(mi, a[i]);
    diff[i] = a[i] - mi;
  }
  ll ma = 0;
  REP(i, 0, n) {
    ma = max(ma, diff[i]);
  }
  int cnt = 0;
  REP(i, 0, n) {
    cnt += diff[i] == ma ? 1 : 0;
  }
  cout << cnt << endl;
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
using namespace std;
int main(){
  int n;
  string s;
  cin >> n >> s;

  int ans = 0;
  for(int i1=0;i1<10;i1++){
    for(int i2=0;i2<10;i2++){
      for(int i3=0;i3<10;i3++){
        int f=1;
        for(int is=0;is<n;is++){
          if(f==1 && s[is]==(i1+'0')){
            f++;
          }
          else if(f==2 && s[is]==(i2+'0')){
            f++;
          }
          else if(f==3 && s[is]==(i3+'0')){
            ans++;
            break;
          }
        }
      }
    }
  }

  cout << ans << endl;
}


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

char s[3][2005];
int len[3],n,ans;
bool f[3][3][2005];
inline long long read()
{
	long long x=0,y=1;char ch=getchar();
	while (ch>'9'||ch<'0'){
		if (ch=='-')y=-1;
		ch=getchar();
	}
	while (ch>='0'&&ch<='9') x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
	return x*y;
}

inline bool check(int a,int b,int st){
	for (int i=1;i+st-1<=n;i++)
	if (s[a][st+i-1]!=s[b][i]&&s[a][st+i-1]!='?'&&s[b][i]!='?') return 0;
	return 1;
}
inline int cal(int a,int b,int c,int x,int y){
	if (n-x+1+n-y+1<=n) return min(len[a]-x+1,len[b])+min(len[b]-y+1,len[c]);
	if (f[a][c][x+y-1]) return min(len[a]-x+1,len[b])+min(max(len[b]-y+1,len[a]-(x+y-1)+1),len[c]);
	return 0;
}
int main()
{
	scanf("%s",s[0]+1);len[0]=strlen(s[0]+1);
	scanf("%s",s[1]+1);len[1]=strlen(s[1]+1);
	scanf("%s",s[2]+1);len[2]=strlen(s[2]+1);
	n=max(len[0],len[1]);
	n=max(len[2],n);
	for (int i=0;i<3;i++)
	for (int j=len[i]+1;j<=n;j++)
	s[i][j]='?';
	for (int i=0;i<3;i++)
	for (int j=0;j<3;j++)
	if (i!=j){
		for (int k=1;k<=n;k++)
		f[i][j][k]=check(i,j,k);
		f[i][j][n+1]=1;
	}
	for (int i=0;i<3;i++)
	for (int j=0;j<3;j++)
	if (i!=j){
		for (int k=1;k<=n+1;k++)
		if (f[i][j][k]){
			for (int h=1;h<=n+1;h++)
			if (f[j][3-i-j][h]) ans=max(ans,cal(i,j,3-i-j,k,h));
		}
	}
	printf("%d\n",len[0]+len[1]+len[2]-ans);
}


Measured memory_bytes: 256
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, S, T = read().split()
N = int(N)

def test(n):
    overlap = N + N - n
    if overlap <= 0:
        return True
    return S[-overlap:] == T[:overlap]

for n in range(N, N + N + 10):
    if test(n):
        break
print(n)

Measured memory_bytes: 9180
import sys
readline = sys.stdin.readline

N = int(readline())
G = [[] for i in range(N)]

for i in range(N - 1):
  a,b = map(int,readline().split())
  G[a - 1].append(b - 1)
  G[b - 1].append(a - 1)
  
C = list(map(int,readline().split()))

def get_farest(x):
  dist = [-1] * N
  stack = [(x,-1,0)]
  while stack:
    v,parent,c = stack.pop()
    if dist[v] != -1:
      continue
    dist[v] = c
    for child in G[v]:
      if child == parent:
        continue
      stack.append([child, v, c + 1])
  maxv = -1
  maxi = -1
  for i in range(len(dist)):
    if dist[i] > maxv:
      maxv = dist[i]
      maxi = i
  return maxi

f = get_farest(0)
start = get_farest(f)

C = sorted(C, reverse = True)
from collections import deque
q = deque([])
q.append([start, -1])
ind = 0
ans = [None] * N
while q:
  v,parent = q.popleft()
  ans[v] = C[ind]
  ind += 1
  for child in G[v]:
    if child == parent:
      continue
    q.append([child, v])
  
print(sum(C[1:]))
print(*ans)

Measured memory_bytes: 11952
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

using namespace std;
typedef long long  ll;
typedef long double ld;
typedef pair<ll,ll> pp;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> super_set;
typedef tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update> multi_set;
#define x1 dfds
#define y1 dsfdsfe
#define pb push_back
#define forn(i,n) for(ll i = 1;i<=n;++i)
#define fi first
#define sc second
#define endl '\n'
#define po(x) (1ll<<x)
const ll DIM = 1E5+7;
ll A[DIM],B[DIM],C[DIM];
int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    ll x,a,y,b;
    cin>>x>>y>>a>>b;
    ll c;
    cin>>c;
    forn(i,a)cin>>A[i];
    forn(i,b)cin>>B[i];
    forn(i,c)cin>>C[i];
    priority_queue<ll,vector<ll>,greater<ll> > R,G;
    ll rsum = 0,gsum = 0;
    forn(i,a){
        R.push(A[i]);
        rsum+=A[i];
    }
    forn(i,b){
        G.push(B[i]);
        gsum+=B[i];
    }
    while(R.size()>x){
        rsum-=R.top();
        R.pop();
    }
    while(G.size()>y){
        gsum-=G.top();
        G.pop();
    }
    sort(C+1,C+1+c,greater<ll>());
    for(ll i = c;i>=1;--i){
        if (R.top()<G.top()){
            ll nl = max(R.top(),C[i]);
            rsum-=R.top();
            R.pop();
            R.push(nl);
            rsum+=nl;
        }
        else{
            ll nl = max(G.top(),C[i]);
            gsum-=G.top();
            G.pop();
            G.push(nl);
            gsum+=nl;
        }
    }
    cout<<rsum+gsum<<endl;
    return 0;
}



Measured memory_bytes: 4980
/*
 * Ankit Raj, NIT Agartala
 */
#include<bits/stdc++.h>
using namespace std;
#define lld long long int
#define MAX_RANGE 10000007
#define BOOST ios_base::sync_with_stdio(0) 
#define NITRO cin.tie(NULL)
#define pb push_back
#define mp make_pair
#define F first
#define S second
int parent[200007];
int size[200007];
int nexti[200007];
int main()
{
	BOOST;
	NITRO;
	clock_t t1,t2;
	t1 = clock();
	/*
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	*/ 
	//Main Code
	int n,k;
	cin>>n>>k;
	int arr[n];
	for(int i=0;i<n;i++)
	{
		cin>>arr[i];
	}
	int dp[n] = {0};
	for(int i=1;i<n;i++)
	{
		dp[i] = dp[i-1] + abs(arr[i]-arr[i-1]);
		for(int j=2;j<=k && i-j>=0;j++)
		{
			dp[i] = min(dp[i],dp[i-j]+abs(arr[i]-arr[i-j]));
		}
	}
	cout<<dp[n-1]<<"\n";
	t2 = clock();
	float diff = (float)t2 - (float)t1;
	float execution_time = diff/CLOCKS_PER_SEC;
	//cout<<"\n"<<execution_time;
	//system("pause");
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
const int MOD = ((int)1e9)+7;
const int INF = (int)(1e9)+(int)(1e7);
const ll INFL = (ll)(1e18)+INF;
const double EPS = 1e-8;
using namespace std;
int main()
{
    ll N,K;
    cin >> N >> K;

    vector<ll>A(N);
    rep(i,N)cin >> A[i];
    sort(A.begin(),A.end());
    ll l = -INFL;
    ll r = INFL;
    while(r-l>1){
        ll mid = (l+r)/2L;
        ll cn =0;
        rep(i,N){
            if(A[i]>=0){
                ll r2=N;
                ll l2=i;
                while (r2-l2>1)
                {
                    ll mmid=(l2+r2)/2L;
                    if(A[i]*A[mmid]<=mid){
                        l2=mmid;
                    }
                    else r2=mmid;
                }
                cn+=l2-(ll)i;
            }
            else{
                ll r2=N;
                ll l2=i;
                while (r2-l2>1)
                {
                    ll mmid=(l2+r2)/2L;
                    if(A[i]*A[mmid]<=mid){
                        r2=mmid;
                    }
                    else l2=mmid;
                }
                cn+=N-r2;
            }
        }
        if(cn<K)l=mid;
        else r=mid;
    }
    cout << r << endl;
    return 0;
}

Measured memory_bytes: 1792
#pragma GCC optimize("Ofast")
#include"bits/stdc++.h"
using namespace std;

int main() {
	int A, B;
	cin >> A >> B;
	if (2 * B > A) {
		cout << 0 << endl;
	}
	else {
		cout << A - 2 * B << endl;
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
int main(void)
{
    int n, x, t, counter = 0;
    scanf("%d %d %d", &n, &x, &t);
    for (int i = 1; i <= n; i++)
    {
        if (i * x >= n)
        {
            counter = i;
            break;
        }
    }
    printf("%d\n", t * counter);
    return 0;
}


Measured memory_bytes: 3704
//INCLUDE
//------------------------------------------
#include <bits/stdc++.h>
//DEFINE
//------------------------------------------
#define ll long long
#define ld long double
#define ALLv(a)  (a).begin(),(a).end()
#define ALL(a,n)  (a),(a)+n
#define vi vector<long long>
#define vd vector<long double>
#define vs vector<string>
#define dcml(n) fixed<<setprecision(n)
//CONST
//------------------------------------------
const ll INF=1010000000000000017LL;
const ll MOD=1000000007LL;
const ld EPS=1e-12;
const ld PI=3.14159265358979323846;
//REPEAT
//------------------------------------------
#define   FOR(i,m,n) for(ll (i)=(m);   (i)<(n);  (i)++)
#define  FORS(i,m,n) for(ll (i)=(m);   (i)<=(n); (i)++)
#define  RFOR(i,m,n) for(ll (i)=(n)-1; (i)>=(n); (i)--)
#define RFORS(i,m,n) for(ll (i)=(n);   (i)>(n);  (i)--)
#define   REP(i,n)   for(ll (i)=0;     (i)<(n);  (i)++)
#define  REPS(i,x)   for(ll (i)=1;     (i)<=(x); (i)++)
#define  RREP(i,x)   for(ll (i)=(x)-1; (i)>=0;   (i)--)
#define RREPS(i,x)   for(ll (i)=(x);   (i)> 0;   (i)--)
#define  WREP(i,in,j,jn) REP(i,in)REP(j,jn)
#define WREPS(i,in,j,jn) REPS(i,in)REPS(j,jn)
//-----------------------------------------
//namespace
using namespace std;
//ライブラリはここに
//↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

//-----------------------------------------
ll d[110][110];
int main(void){
    ll V,E;cin>>V>>E;
    REP(i,V)REP(j,V)d[i][j]=INF;
    REP(i,E){
        ll a,b,c;cin>>a>>b>>c;
        d[a][b]=c;
    }
    REP(i,V)d[i][i]=0;
    REP(k,V){
        REP(i,V){
            REP(j,V){
                d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
            }
        }
    }
    REP(i,V){
        if(d[i][i]<0){
            cout<<"NEGATIVE CYCLE\n";
            exit(0);
        }
    }
    REP(i,V){
        REP(j,V){
            cout<<(d[i][j]<INF/10?to_string(d[i][j]):"INF");
            if(j!=V-1)cout<<" ";
            else cout<<"\n";
        }
    }
}


Measured memory_bytes: 3380
# include <bits/stdc++.h>
#define INF 1e9
using namespace std;

int main(){

  int N; cin >> N;
  vector<pair<pair<string, int>, int>> v(N);
  for(int i=0;i<N; i++){
    string S;
    int P;
    cin >> S >> P;
    v[i] = make_pair(make_pair(S, -P), i+1);
  }

  sort(v.begin(), v.end());
  for(int i=0; i < N; i++){
    cout << v[i].second << endl;
  }

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define in(x,y,h,w) x >= 0 && x < h && y >= 0 && y < w

#define int long long
//using ll = long long;
using P = pair<int,int>;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
 
const int INF=1e+9;
const double EPS=1e-9;
const int MOD=1000000007;

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

signed main(){
	int h,w,K,dp[110][8] = {};
	cin >> h >> w >> K;
	dp[0][0] = 1;
	for(int i = 0;i < h;i++){
		for(int j = 0;j < w;j++){
			for(int k = 0;k < (1 << (w - 1));k++){
				bool isOK = true;
				for(int l = 0;l < w - 2;l++){
					if((k >> l) & (k >> (l + 1)) & 1) isOK = false;
				}
				if(!isOK) continue;
				int nxt = j;
				if((k >> j) & 1) nxt++;
				if(j && ((k >> (j - 1)) & 1)) nxt--;
				(dp[i + 1][nxt] += dp[i][j]) %= MOD;
			}
		}
	}
	cout << dp[h][K - 1] << endl;
}

Measured memory_bytes: 384
use std::io::{BufRead, Write};
use std::io;

fn solve<R: BufRead, W: Write>(mut input: R, mut output: W) {
    let mut s = String::new();
    input.read_line(&mut s).unwrap();
    let mut split = s.split_whitespace();
    let h: usize = split.next().unwrap().parse().unwrap();
    let w: usize = split.next().unwrap().parse().unwrap();
    let mut s = String::new();
    input.read_line(&mut s).unwrap();
    let _: usize = s.trim().parse().unwrap();
    s.clear();
    input.read_line(&mut s).unwrap();
    let a: Vec<usize> = s.split_whitespace().map(|x| x.parse().unwrap()).collect();
    let mut grid = vec![vec![0; w]; h];
    let mut x = 0;
    let mut y = 0;
    let mut index = 0;
    let mut flag = true;
    for (color, i) in a.into_iter().enumerate() {
        for _ in 0..i {
            grid[x][y] = color + 1;
            index += 1;
            if flag {
                if x == h - 1 {
                    y += 1;
                    flag = false;
                } else {
                    x += 1;
                }
            } else {
                if x == 0 {
                    y += 1;
                    flag = true;
                } else {
                    x -= 1;
                }
            }
        }
    }
    for line in grid {
        let text_vec: Vec<_> = line.into_iter().map(|x| x.to_string()).collect();
        writeln!(output, "{}", text_vec.join(" "));
    }
}

fn main() {
    let stdin = io::stdin();
    let stdout = io::stdout();
    solve(stdin.lock(), stdout.lock());
}

#[cfg(test)]
mod tests {
    //     fn test(input: &str, output: &str) {
    //         let mut v: Vec<u8> = Vec::new();
    //         ::solve(input.as_bytes(), &mut v);
    //         assert_eq!(String::from_utf8(v).unwrap(), output);
    //     }

    //     #[test]
    //     fn case1() {
    //         test(
    //             "3
    // 1 10 100\n",
    //             "Yes\n",
    //         );
    //     }
    //     #[test]
    //     fn case2() {
    //         test(
    //             "4
    // 1 2 3 4\n",
    //             "No\n",
    //         );
    //     }
    //     #[test]
    //     fn case3() {
    //         test(
    //             "3
    // 1 4 1\n",
    //             "Yes\n",
    //         );
    //     }
    //     #[test]
    //     fn case4() {
    //         test(
    //             "2
    // 1 1\n",
    //             "No\n",
    //         );
    //     }
    //     #[test]
    //     fn case5() {
    //         test(
    //             "6
    // 2 7 1 8 2 8\n",
    //             "Yes\n",
    //         );
    //     }
}


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

void dfs(int depth,vector<int> v);
int calc(vector<int> v);

#define INF 10000;

int N;
vector<int> target(4);
vector<int> l(8,0);
int m = INF;

int main() {
  cin >> N;
  for (int i=0;i<3;i++){
    cin >> target[i];
  }
  for (int i=0;i<N;i++){
    cin >> l[i];
  }
  vector<int> v(N,0);
  dfs(0, v);
  cout << m << endl;
}

void dfs(int depth,vector<int> v){
  if (depth == N) {
    m = min(m,calc(v));
    return;
  }
  for (int i=0;i<4;i++){
    v[depth] = i;
    dfs(depth+1, v);
  }
}

int calc(vector<int> v){
  vector<int> sum(4,0);
  vector<int> count(4,0);
  for (int i=0;i<N;i++){
    sum[v[i]] += l[i];
    count[v[i]] += 1;
  }
  for (int i=0;i<3;i++){
    if (count[i] == 0) {
      return INF;
    }
  }
  int mp = 0;
  for (int i=0;i<3;i++){
    mp += abs(target[i] - sum[i]) + (count[i] - 1)*10;
  }
  return mp;
}

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

struct Edge { int to, weight; };
vector <Edge> edges[100];

int main() {
    int L;
    cin >> L;

    int n = 0;
    while ((1 << n) <= L) n++;

    for (int i = 1; i < n; i++) {
        edges[i].push_back((Edge){i+1, 0});
        edges[i].push_back((Edge){i+1, 1 << (i - 1)});
    }

    int m = 2 * (n - 1);
    int cur = 1 << (n - 1);
    for (int i = n - 1; i > 0; i--) {
        int p = 1 << (i - 1);
        if (cur + p <= L) {
            edges[i].push_back((Edge){n, cur});
            cur += p; m++;
        }
    }

    cout << n << " " << m << "\n";
    for (int i = 0; i < n; i++) {
        for (Edge e : edges[i]) {
            cout << i << " " << e.to << " " << e.weight << "\n";
        }
    }

    return 0;
}

Measured memory_bytes: 256
let a=Int(readLine()!)!
let arr=readLine()!.characters.split{$0==" "}.map{Int(String($0))!}

var i = 0
var count = 0

for i in 1..<a - 1 {
  if( ( arr[ i - 1 ] < arr[i] ) && ( arr[i] < arr[ i + 1 ] ) ) {
    count += 1
  } else if ( ( arr[ i - 1 ] > arr[i] ) && ( arr[i] > arr[ i + 1 ] ) ) {
    count += 1
  }
}

print( count )

Measured memory_bytes: 4208
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

n,k,s=map(int,input().split())
for i in range(k):
    print(s,end=" ")
if s!=10**9:
    C=10**9
else:
    C=3
for i in range(n-k):
    print(C,end=" ")
print("")

Measured memory_bytes: 50648
#include<iostream>
int main(){
    int a, b, c;
    std::cin >> a >> b >> c;
    if (!(a-5+b-5+c-7) || !(a-7+b-5+c-5) || !(a-5+b-7+c-5)) std::cout<<"YES";
    else std::cout<<"NO";
}

Measured memory_bytes: 256
import typing


class DSU:
    '''
    Implement (union by size) + (path compression)
    Reference:
    Zvi Galil and Giuseppe F. Italiano,
    Data structures and algorithms for disjoint set union problems
    '''

    def __init__(self, n: int = 0):
        self._n = n
        self.parent_or_size = [-1] * n

    def merge(self, a: int, b: int) -> int:
        assert 0 <= a < self._n
        assert 0 <= b < self._n

        x = self.leader(a)
        y = self.leader(b)

        if x == y:
            return x

        if -self.parent_or_size[x] < -self.parent_or_size[y]:
            x, y = y, x

        self.parent_or_size[x] += self.parent_or_size[y]
        self.parent_or_size[y] = x

        return x

    def same(self, a: int, b: int) -> bool:
        assert 0 <= a < self._n
        assert 0 <= b < self._n

        return self.leader(a) == self.leader(b)

    def leader(self, a: int) -> int:
        assert 0 <= a < self._n

        r = a
        while self.parent_or_size[r] >= 0:
            r = self.parent_or_size[r]

        while self.parent_or_size[a] >= 0:
            self.parent_or_size[a], a = r, self.parent_or_size[a]

        return r

    def size(self, a: int) -> int:
        assert 0 <= a < self._n

        return -self.parent_or_size[self.leader(a)]

    def groups(self) -> typing.List[typing.List[int]]:
        leader_buf = [self.leader(i) for i in range(self._n)]

        result = [[] for _ in range(self._n)]
        for i in range(self._n):
            result[leader_buf[i]].append(i)

        return list(filter(lambda r: r, result))


import sys
input = sys.stdin.readline
n, q = map(int, input().split())
uf = DSU(n)
res = []
for i in range(q):
    t, u, v = map(int, input().split())
    if t:
        res.append(int(uf.same(u, v)))
    else:
        uf.merge(u, v)
print("\n".join(map(str, res)))


Measured memory_bytes: 87912
from itertools import accumulate
n,q=list(map(int,input().split()))
s=list(input())
l=[0]*q
r=[0]*q
for i in range(q):
  l[i],r[i]=list(map(int,input().split()))
A=[]
for i in range(n-1):
  if s[i]=="A" and s[i+1]=="C":
    A.append(1)
  else:
    A.append(0)
check=[0]+A+[0]
check=list(accumulate(check))
for i in range(q):
  print(check[r[i]-1]-check[l[i]-1])

Measured memory_bytes: 17288
#include <iostream>
#define llint long long

using namespace std;

llint a, b;

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> a >> b;
	if(a > b) swap(a, b);
	
	for(int i = 1; i <= b; i++) cout << a;
	cout << endl;
	
	return 0;
}

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

#define rep(i,n) FOR(i,0,n)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ROF(i,a,b) for(int i=(a);i>(b);i--)
#define all(a) (a).begin(),(a).end()
#define UNIQUE(v) v.erase(unique(all(v)),v.end())
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef long long ll;

main(){
  int n; cin >> n;
  int ans=0,l,r;
  rep(i,n){
    cin >> l >> r;
    ans+=r-l+1;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
  int n;
  scanf("%d",&n);
  int p[n];
  for(int i=0;i<n;i++){
scanf("%d",&p[i]);
  }
int count=0,min=1000,ind;
  for(int i=0;i<n-1;i++){
   if(p[i]>p[i+1]){
     int j=i;
    while(j<n-1){
      if(min>p[j+1]){
        min=p[j+1];
        ind=j+1;
      }
      j++;}
        
     int w=p[i];
     p[i]=p[ind];
     p[ind]=w;
     break;
   }
  }
  
  for(int i=0;i<n-1;i++){
    if(p[i]>p[i+1]){
      printf("NO");
      return 0;
    }
  }
   printf("YES");
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <numeric>
#define rep(i, n) for(int i=0; i < n; i++)
#define reps(i, n) for(int i=1; i <= n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)

using namespace std;
using ll=long long;

int main() {
  ll n;cin >> n;
  map<ll,pair<ll,ll>> as;
  vector<ll> ass;
  rep(i,n){
    ll a;cin >>a ;
    if(!as.count(a)) {as[a]=mp(0,0);}
    as[a].first++;
    ass.pb(a);
  }
  ll sum=0;
  for(auto iter = begin(as); iter != end(as); ++iter){
    ll comb=((iter->second).first*((iter->second).first-1))/2;
    as[iter->first].second=comb;
    sum +=comb;
  }


  reps(k,n){
    ll number=ass[k-1];
    auto p=as[number];
    ll ans=sum-p.second+((p.first-1)*(p.first-2))/2;
    cout << ans<<endl;
  }
}

Measured memory_bytes: 11120
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Globalization;
using System.Diagnostics;
using static System.Console;
using Pair = System.Collections.Generic.KeyValuePair<int, int>;
//using System.Numerics;

class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().Solve();
        Out.Flush();
    }
    Scanner cin = new Scanner();
    Random rnd = new Random();
    Stopwatch sw = new Stopwatch();
    readonly int[] dd = { 0, 1, 0, -1, 0 };
    readonly int mod = 1000000007;
    readonly string alfa = "abcdefghijklmnopqrstuvwxyz";

    int N;
    void Solve()
    {
        N = cin.Nextint;
        var A = cin.Scanlong;
        long S = 0;
        for (int i = 0; i < N; i++)
        {
            S += A[i];
        }
        long ans = long.MaxValue;

        long now = 0;
        for (int i = 0; i < N - 1; i++)
        {
            now += A[i];
            //WriteLine(Math.Abs((S - now) - now));
            ans = Math.Min(ans, Math.Abs((S - now) - now));
        }
        WriteLine(ans);

    }

}

class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] Scan { get { return ReadLine().Split(); } }
    public int[] Scanint { get { return Array.ConvertAll(Scan, int.Parse); } }
    public long[] Scanlong { get { return Array.ConvertAll(Scan, long.Parse); } }
    public double[] Scandouble { get { return Array.ConvertAll(Scan, double.Parse); } }
    public string Next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return Next;
        }
    }
    public int Nextint { get { return int.Parse(Next); } }
    public long Nextlong { get { return long.Parse(Next); } }
    public double Nextdouble { get { return double.Parse(Next); } }
}

Measured memory_bytes: 29784
N = int(input())
W = [input() for i in range(N)]
ans = "Yes"

if(len(W) != len(set(W))):
    ans = "No"

for i in range(N-1):
    if(W[i][-1] != W[i+1][0]):
        ans = "No"
        break

print(ans)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define INF 1000000001
//0=48,A=65,a=97

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

    return 0;
}

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

using namespace std;

#define LL           long long
#define ULL          long long unsigned
#define LD           long double
#define FOR(i,n)     for(int i=0;i<n;i++)
#define FLR(i,n)     for(LL i=0;i<n;i++)
#define RFOR(i,n)    for(int i=n-1;i>=0;i--)
#define RFLR(i,n)    for(LL i=n-1;i>=0;i--)
#define rep(i,a,b)   for(int i=a;i<=b;i++)
#define repl(i,a,b)  for(LL i=a;i<=b;i++)
#define fast         ios_base::sync_with_stdio(0);cin.tie(0);
#define all(a)       a.begin(),a.end()
#define ABS(x)       ((x)<0?-(x):(x))
#define NL           "\n"
#define pb           push_back
#define pi           acos(-1.0)
#define prec(n)      fixed << setprecision(n)
int main()
{
    fast;
    int a,b,ans;
    cin>>a>>b;
    ans=max(a+b,max(a-b,a*b));
    cout<<ans;


}



Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> P;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)
/*
vector<char>al(26);
al = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
vector<char>AL(26);
AL = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
vector<char>NUM(10);
	NUM = { '0','1','2' ,'3' ,'4' ,'5' ,'6' ,'7' ,'8' ,'9' };
*/



int main() {
	int X, A, B;
	cin >> X >> A >> B;
	if (abs(X - A) > abs(X - B)){
		cout << 'B' << endl;
}
	else {
		cout << 'A' << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <memory>

//#define int long long

using namespace std;

void Main()
{
	string s;
	cin >> s;
	for (auto& i : s) {
		i = 'x';
	}

	cout << s << endl;
}

int32_t main()
{
	Main();
	return 0;
}



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


void goAndCreateAnswer(string& ans, int dist_x, int dist_y, bool isDist_x_positive, bool isDist_y_positive) {

	for (int i = 0; i < dist_y; i++) {
		if (isDist_y_positive) ans += "U";
		else ans += "D";
	}
	for (int i = 0; i < dist_x; i++) {
		if (isDist_x_positive) ans += "R";
		else ans += "L";
	}

	return;
}

void backAndCreateAnswer(string& ans, int dist_x, int dist_y, bool isDist_x_positive, bool isDist_y_positive) {

	for (int i = 0; i < dist_y; i++) {
		if (isDist_y_positive) ans += "D";
		else ans += "R";
	}
	for (int i = 0; i < dist_x; i++) {
		if (isDist_x_positive) ans += "L";
		else ans += "R";
	}

	return;
}


int main() {

	int sx, sy, tx, ty; cin >> sx >> sy >> tx >> ty;

	int dist_x = tx - sx;
	int dist_y = ty - sy;

	bool isDist_x_positive = false;
	bool isDist_y_positive = false;

	if (0 <= dist_x) isDist_x_positive = true;
	if (0 <= dist_y) isDist_y_positive = true;

	string ans;

	goAndCreateAnswer(ans, dist_x, dist_y, isDist_x_positive, isDist_y_positive);
	backAndCreateAnswer(ans, dist_x, dist_y, isDist_x_positive, isDist_y_positive);
	
	dist_x++;
	dist_y++;
	if (isDist_x_positive) {
		ans += "L";
		goAndCreateAnswer(ans, dist_x, dist_y, isDist_x_positive, isDist_y_positive);
		ans += "D";
		ans += "R";
		backAndCreateAnswer(ans, dist_x, dist_y, isDist_x_positive, isDist_y_positive);
		ans += "U";
	}
	else {
		ans += "R";
		goAndCreateAnswer(ans, dist_x, dist_y, isDist_x_positive, isDist_y_positive);
		ans += "U";
		ans += "L";
		backAndCreateAnswer(ans, dist_x, dist_y, isDist_x_positive, isDist_y_positive);
		ans += "D";

	}

	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<list>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<cctype>
#include<cassert>
#include<climits>
#include<string>
#include<bitset>
#include<cfloat>
#include<unordered_set>
#include<iomanip>
#include<numeric>

using namespace std;
using ll =  long long;
using pint =  pair<int,int>;
using vint = vector<int>;
using vvint = vector<vint>;
using vpint = vector<pint>;
#define repi(i,start,end) for(int (i)=(start),TemPNuM=(int)(end);(i)<TemPNuM;++(i))
#define rep(i,end) repi((i),0,(end))
#define rfor(x,v) for(auto& (x) : (v))
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fsort(v,lambda) sort(all((v)),(lambda))
#define vin(v) rep(i,(v).size())cin >> (v)[i];
#define vpin(v) rep(i,(v).size())cin>>v[i].first>>v[i].second
//#define int long long
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<class T>void println(T a){if(cout.precision()!=12)cout<<setprecision(12);cout<<a<<endl;}
//lambda: [](int x, int y){return x<y;}

signed main(void){
    int k, t; cin >> k >> t;
    vint a(t); vin(a);
    sort(rall(a));
    cout << max(a[0] - 1 - (k - a[0]), 0) << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int (i)=0;(i)<(n);i++)
#define INF 1001001001
#define LLINF 1001001001001001001
#define MOD 1000000007
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; }
#define ALL(v) v.begin(), v.end()
typedef long long ll;

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    if(c-a+b>=0)cout << c-a+b <<endl;
    else cout << 0 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
int main(){
	int a[2],vis[16]={0},i,j;
	cin>>a[0]>>a[1];
	sort(a,a+2);
	i=j=0;
	while(1){
		if(!vis[i])i++;
		i%=16;
		j=!j;
		if(a[j]==0)break;
		a[j]--;
	}
	if(a[0]==a[1]&&a[0]==0)cout<<"Yay!\n";
	else cout<<":(\n";
	return 0;
}

Measured memory_bytes: 256
// at_dp_k.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <vector>
#include<algorithm>
using namespace std;
#define FOR(i,a) for(int i=0;i<a;i++)
//true -> person going that turn will win
//false ->person going that turn will lose
int main()
{
	int n,k; bool dp[100001]; cin >> n>>k;
	vector<int>v(n, 0);
	FOR(i, n) {
		cin >> v[i];
	}
	dp[0] = false; //if the person has 0 stones, he cannot move, therefore loses.
	for(int i=1;i<=k;i++){
		//if all moves are wins for the opponent, then you lose
		bool flag = true;
		for (auto x : v) {
			// if theres a move that makes opponent lose, then you win
			if (i - x < 0)continue;
			if (dp[i - x]==false) {
				flag = false;
				dp[i] = true;
			}
		}

		if (flag) {
			dp[i] = false;
		}
	}
	if (dp[k])cout << "First\n";
	else cout << "Second\n";

}


Measured memory_bytes: 384
use std::io;
use std::cmp;
use std::collections::BinaryHeap;
use std::collections::HashMap;
use std::collections::HashSet;
use std::f64::consts::PI;

fn read_line() -> String {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).ok();
    buf
}


fn main() {
    let mut str = read_line();
    let mut cs = str.as_bytes().to_vec();
    cs[0] += 1;
    println!("{}", String::from_utf8(cs.to_vec()).unwrap().trim());
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;using ll=int_fast64_t;using ld=long double;using pll=pair<ll,ll>;using pld=pair<ld,ld>;
const ll INF=1LL<<60;void solve();int main(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(10);solve();}
#define foreach(i,a) for(auto &i:a)
#define SELECTOR(_1,_2,_3,_4,SELECT,...) SELECT
#define rep(...) SELECTOR(__VA_ARGS__,_rep2,_rep1,_rep0)(__VA_ARGS__)
#define _rep0(i,n) for(ll i=0;i<n;++i)
#define _rep1(i,k,n) for(ll i=k;i<n;++i)
#define _rep2(i,k,n,d) for(ll i=k;d!=0&&d>0?i<n:i>n;i+=d)
template<class T> vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<class... Ts> auto make_v(size_t a,Ts... ts){return vector<decltype(make_v(ts...))>(a,make_v(ts...));}
template<class T> inline bool chmax(T &a,const T &b){if(a<b){a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a,const T &b){if(a>b){a=b; return 1;} return 0;}

class RollingHash{
private:
  ll b1=1007,b2=1009;
  ll m1=1e9+9, m2=1e9+7;
  vector<ll> H1,H2,P1,P2;
public:
  RollingHash(string S){
    ll n=(ll)S.size();
    H1.assign(n+1,0); H2.assign(n+1,0); P1.assign(n+1,1); P2.assign(n+1,1);
    rep(i,n){
      H1[i+1]=(H1[i]*b1+S[i])%m1;
      H2[i+1]=(H2[i]*b2+S[i])%m2;
      P1[i+1]=P1[i]*b1%m1;
      P2[i+1]=P2[i]*b2%m2;
    }
  }
  pair<ll,ll> hash(ll l,ll r){
    assert(l<=r);
    ll h1=H1[r]-P1[r-l]*H1[l]%m1;
    ll h2=H2[r]-P2[r-l]*H2[l]%m2;
    return {h1>=0?h1:h1+m1,h2>=0?h2:h2+m2};
  }
};

template<class T,class F>
constexpr T bisection(T l,T r,F f,bool left=true,bool discrete=true){
  T eps=discrete?1:pow(10,-12);
  if((!left)^f(r)) return left?r:r+1;
  if(left^f(l)) return left?l-1:l;
  while(r-l>eps){
    T h=(l+r)/2;
    if((!left)^f(h)) l=h;
    else r=h;
  }
  return discrete?left?l:r:(l+r)/2;
}

void solve(){
  ll n; cin>>n;
  string S; cin>>S;
  RollingHash rh{S};

  auto check=[&](ll k){
    map<pll,ll> mp;
    rep(i,n-k+1){
      pll h=rh.hash(i,i+k);
      if(mp.count(h)){ // 既に h が存在する場合
        if(i-mp[h]>=k) return true;
      }else{
        mp[h]=i;
      }
    }
    return false;
  };

  cout<<bisection((ll)0,n,check)<<"\n";
}

Measured memory_bytes: 768
package main
  
import (
    "fmt"
)

func main() {
    var s, t []byte
    fmt.Scan(&s)
    fmt.Scan(&t)
    var cnt int
    for i := 0; i < 3; i++ {
        if s[i] == t[i] {
            cnt++
        }
    }
    fmt.Println(cnt)
}


Measured memory_bytes: 512
#include <iostream>
#define MAX_N 100
using namespace std;

int N;
int F[MAX_N][10];
int P[MAX_N][11];

int main(){
    cin >> N;
    for(int i = 0; i < N; ++i){
        for(int j = 0; j < 10; ++j){
            cin >> F[i][j];
        }
    }

    for(int i = 0; i < N; ++i){
        for(int j = 0; j < 11; ++j){
            cin >> P[i][j];
        }
    }
    
    int list[10];
    int index = 1;
    int ans = -1e9;
    while(index < 1024) {
        int tmp_ans = 0;
        for(int i = 0; i < 10; ++i){
            list[i] = (index >> i) & 1;
        }
        for(int i = 0; i < N; ++i){
            int tmp = 0;
            for(int j = 0; j < 10; ++j){
                if((list[j] == F[i][j]) && list[j]){
                    tmp++;
                }
            }
            tmp_ans += P[i][tmp];
        }
        ans = max(ans, tmp_ans);
        if(ans == 0){
            cout << index << endl;
            return 0;
        }
        index++;
    };
        
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<stdlib.h>
#include<utility>
#include<functional>
#include<cfenv>
#include<cmath>
#include<string>
#include<queue>
#include<stack>
#include<map>
#include<set>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define vint vector<int>
#define vvint vector<vint>
#define P pair<ll,ll>
#define INT_MAX 2147483647
#define MOD 998244353
#define PI 3.14159265358979323846
#define all(a) (a).begin(),(a).end()
using namespace std;
typedef long long ll;

#define MAX 1000000000000


int main(void) {
	int n; cin >> n;
	vint a(n);
	rep(i, n) {
		cin >> a[i];
	}

	sort(all(a));

	int m = a[a.size()-1];
	vint b(m+1);

	rep(i, a.size()) {
		int x = a[i];
		if (b[a[i] ] != 0) {
			b[a[i]]++;
			continue;
		}
		for (int j = 1; a[i] * j <= m; j++) {
			b[a[i] * j]++;
		}
	}
	int cnt = 0;
	rep(i, a.size()) {
		if (b[a[i]] == 1) {
			cnt++;
		}
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 7856
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define endl "\n"

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


Measured memory_bytes: 3624
import java.util.Scanner;

public class Main {

	public static void main(String args[]) {

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] a = new int[N+1];
		int[] b = new int[N];

		for(int i=0;i<N+1;i++) {
			a[i] = sc.nextInt();
		}

		for(int i=0;i<N;i++) {
			b[i] = sc.nextInt();
		}

		long ans = 0;
		for(int i=0;i<N;i++) {

			if(a[i] >= b[i]) {
				a[i] -= b[i];
				ans += b[i];
			}else {
				b[i] -= a[i];
				ans  += a[i];
				a[i] -= a[i];

				if(a[i+1] >= b[i]) {
					a[i+1] -= b[i];
					ans += b[i];
				}else {
					ans += a[i+1];
					a[i+1] -= a[i+1];
				}
			}
		}
		System.out.println(ans);
	}

}


Measured memory_bytes: 87720
//Author : pakhandi
//
using namespace std;

#include <bits/stdc++.h>

#define wl(n) while(n--)
#define fl(i,a,b) for(i=a; i<b; i++)
#define rev(i,a,b) for(i=a; i>=b; i--)

#define si(n) scanf("%d", &n)
#define sll(l) scanf("%lld",&l)

#define debug(x) cout<<"\n#("<<x<<")#\n"
#define nline printf("\n")

#define mem(a,i) memset(a,i,sizeof(a))

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int

#define PB push_back
#define SZ size
#define MP make_pair

#define IGNORE cin.ignore (std::numeric_limits<std::streamsize>::max(), '\n');

const ll INF = (1LL << 58);
const bool DEBUG = 0;

inline int mul(int _a, int _b)
{
	return (long long) _a * _b % MOD;
}

vector<int> prime;
vector<int> smallestPrimeFactor;
void linearSieve(int _n)
{
	if (_n < 1) _n = 1;
	if ((int)smallestPrimeFactor.size() >= _n + 1) return;
	int primePiBound = _n < 20 ? _n - 1 : (int)(_n / (log(_n * 1.) - 2) + 2);
	prime.assign(primePiBound + 1, numeric_limits<int>::max());
	int _P = 0;
	smallestPrimeFactor.assign(_n + 1, 0);
	smallestPrimeFactor[1] = 1;
	int n2 = _n / 2, n3 = _n / 3, n5 = _n / 5;
	if (_n >= 2)
		prime[_P ++] = 2;
	if (_n >= 3)
		prime[_P ++] = 3;
	for (int q = 2; q <= _n; q += 2)
		smallestPrimeFactor[q] = 2;
	for (int q = 3; q <= _n; q += 6)
		smallestPrimeFactor[q] = 3;
	for (int q = 5; q <= n5; q += 2)
	{
		if (smallestPrimeFactor[q] == 0)
			prime[_P ++] = smallestPrimeFactor[q] = q;
		int bound = smallestPrimeFactor[q];
		for (int i = 2; ; ++ i)
		{
			int p = prime[i];
			if (p > bound) break;
			int pq = p * q;
			if (pq > _n) break;
			smallestPrimeFactor[pq] = p;
		}
	}
	for (int q = (n5 + 1) | 1; q <= _n; q += 2)
	{
		if (smallestPrimeFactor[q] == 0)
			prime[_P ++] = smallestPrimeFactor[q] = q;
	}
	prime.resize(_P);
}

void primeFactors(int _x, vector<pair<int, int> > &_primeFactors)
{
	linearSieve(_x);
	_primeFactors.clear();
	while (_x != 1)
	{
		int p = smallestPrimeFactor[_x], k = 0;
		_x /= p, k ++;
		while (_x % p == 0) _x /= p, k ++;
		_primeFactors.push_back(make_pair(p, k));
	}
}

ll arr[1000000];

int main()
{
	int i, j;

	int n;

	si(n);

	std::vector<pair<int, int> > v;

	ll ans = 1;
	primeFactors(n + 1, v);

	// cerr << here << "\n";

	fl(i,2,n + 1)
	{
		primeFactors(i, v);
		// cerr << i << ":" <<
		fl(j,0,v.SZ())
		{
			arr[v[j].first] += v[j].second;
		}
	}

	fl(i,0,n + 1)
		ans = mul(ans, arr[i] + 1);


	printf("%lld", ans);


	return 0;
}
/*
	Powered by Buggy Plugin
*/


Measured memory_bytes: 256
/* [Template].cpp 
Example code to use when starting new code. This particular problem was problem 
977A_Wrong_Subtraction from CodeForces

Compile: g++  -o C_Low_Elements.exe C_Low_Elements.cpp 
Execute: ./C_Low_Elements
*/ 

#include <cstdio>
#include <iostream>
#include <cmath> 
#include <iomanip>
#include <cstring> 
#include<bits/stdc++.h> 
using namespace std;

int main() { 	
	int N, P, Pmin, result;
	cin >> N;
	Pmin = INT_MAX; 
	result = 0;
	
	for(int i = 0; i < N; i++) { 
		cin >> P; 
		if(P < Pmin) {
			result++; 
			Pmin = P; 
		} 
	}
	
	cout << result << endl;
	
	return 0; 
} 


Measured memory_bytes: 256
n=int(input())
root=[]
t,x,y=0,0,0
for i in range(n):
    ti,xi,yi=map(int,input().split())
    if ti-t<xi-x+yi-y or (ti-t)%2!=(xi-x+yi-y)%2:
        print("No")
        break
    t,x,y=ti,xi,yi
else:
    print("Yes")


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

	int n;
int dp[1<<17]={};
int dfs(int mask,vvi &t){
	if(dp[mask]!=-1){
		return dp[mask];
	}
	if(mask==(1<<(n+1))-1){
		return 0;
	}
	int ret=INT_MAX;
	FOR(i,1,n+1){
		if((mask&(1<<i))==0){
			int cost=INT_MAX;
			REP(j,n+1){
				if((mask&(1<<j))){
					cost=min(cost,t[i][j]);
				}
			}
			ret=min(ret,dfs(mask|(1<<i),t)+cost);
		}
	}
	return dp[mask]=ret;
}

int main(){
	while(cin>>n,n){
		vvi t(n+1,vi(n+1));
		REP(i,n){
			REP(j,n+1){
				cin>>t[i+1][j];
			}
		}
		REP(i,1<<17){
			dp[i]=-1;
		}
		cout<<dfs(1,t)<<endl;
	}
	//REP(i,n){
	//	REP(mask,1<<n){
	//		dp[mask|(1<<i)][i]=min(dp[mask|(1<<i)][i],dp[mask][]);
	//	}
	//}
}

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

int main() {
  std::string ans;;
  char s,t;
  cin >> s;
  for(int i=0;i<3;i++){
  cin >> t;
  if(s!=t){
    ans="Good";
    s=t;
  }else{
    ans="Bad";
    break;
  }
}
  cout << ans << endl;
}


Measured memory_bytes: 256