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

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>

#include <bits/stdc++.h>
#include <cmath>
#include <limits>

using namespace std;
typedef long long LL;
using Graph = vector<vector<int>>;

static long long INF = (1LL<<62);

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

	LL N;
	vector<LL> L;

	cin >> N;
	for(int i=0; i<N; i++){
		LL l;
		cin >> l;
		L.push_back(l);
	}

	LL ans = 0;
	for(int i=0; i<N; i++){
		for(int j=i+1; j<N; j++){
			for(int k=j+1; k<N; k++){
				LL p = L[i];
				LL q = L[j];
				LL r = L[k];
				if(p == q || q == r || r == p){
					continue;
				}
				if(p + q > r && q + r > p && r + p > q){
					ans++;
				}

			}
		}
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 3748
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Rep(i, k, n) for (int i = k; i < (int)(n); i++)
#define RRep(i, k, n) for (int i = k; i > (int)(n); i--)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define ALL(a)  (a).begin(),(a).end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int MOD = 1000000007;
const double PI = acos(-1); //3.14~
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main()
{
    ll l, r; cin >> l >> r;
    ll ans = INF;
    for (ll i = l; i <= l + 2019; i++)
    {
        for (ll j = i + 1; j <= l + 2019; j++)
        {
            if (j > r) break;
            ans = min(ans, i * j % 2019);
        }
        if (i == r)
        {
            break;
        }
    }
    cout << ans << endl;
}

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

int main( void ) {
    
    string str1, str2;
    cin >> str1 >> str2;
    
    if( str1.length() != str2.length() )
        cout << ( str1.length() > str2.length() ? "GREATER" : "LESS" ) << endl;
    else
    if( str1 != str2 )
        cout << ( str1 > str2 ? "GREATER" : "LESS" ) << endl;
    else
        cout << "EQUAL" << endl;
    
    return 0;
}

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

int main()
{
  int m,i,j,k,l,p,len,ans,jud;

  cin>>m;
  for(i=0;i<m;i++){
    string tra;
    cin>>tra;
    len=tra.size();
    ans=0;
    string res[10000];
    for(j=1;j<len;j++){
      string sto1,sto2;
      for(p=0;p<8;p++){
	string dep1,dep2;
	if(p>=0&&p<2){
	  sto1.assign(tra,0,j);
	  sto2.assign(tra,j,len-j);
	} else if(p>=2&&p<4){
	  sto1.assign(tra,0,j);
	  sto2.assign(tra,j,len-j);
	  reverse(sto1.begin(),sto1.end());
	} else if(p>=4&&p<6){
	  sto1.assign(tra,0,j);
	  sto2.assign(tra,j,len-j);
	  reverse(sto2.begin(),sto2.end());
	} else {
	  sto1.assign(tra,0,j);
	  sto2.assign(tra,j,len-j);
	  reverse(sto1.begin(),sto1.end());
	  reverse(sto2.begin(),sto2.end());
	}
	dep1.assign(sto1,0,j); dep1+=sto2;
	dep2.assign(sto2,0,len-j); dep2+=sto1;
	res[2*(j-1)*8+2*p].assign(dep1,0,len); 
	res[2*(j-1)*8+2*p+1].assign(dep2,0,len);
	if(j==1&&p==0){
	  if(res[0]==res[1]) ans=1;
	  if(res[0]!=res[1]) ans=2;
	} else {
	  for(l=0,jud=0;l<2*(j-1)*8+2*p;l++){
	    if(dep1==res[l]){
	      jud=0; break;
	    } else {
	      jud=1;
	    }
	  }
	  if(jud) ans++;
	  for(l=0,jud=0;l<2*(j-1)*8+2*p+1;l++){
	    if(dep2==res[l]){
	      jud=0; break;
	    } else {
	      jud=1;
	    }
	  }
	  if(jud) ans++;
	}
      }
    }
    cout<<ans<<endl;
  }
}


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

using namespace std;

int main(){
    string sa,sb;
    cin >> sa >> sb;
    
    int c = 0;
    for(int i=0; i<3;i++){
        if(sa[i] == sb[i]){
            c++;
        }
    }
    cout << c << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,start,end) for(int i=start;i<=end;i++)
const int INF = 1001001001;
typedef long long ll;
const ll MOD=1000000007;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }
int main(void){
    ll k; cin >> k;
    vector<ll> a;
    FOR(i,1,9){
        a.push_back(i);
    }
    while(1){
        if (k <= a.size()){
            cout << a[k-1] << endl;
            return 0;
        }
        k -= a.size();
        vector<ll> old;
        swap(old,a);
        for(ll x:old){
            for (int i = -1;i<=1;i++){
                int d = x%10+i;
                if ( d < 0 || d > 9) continue;
                ll nx = x*10+d;
                a.push_back(nx);
            }
        }
    }
}


Measured memory_bytes: 1712
import queue
N=int(input())
G=[dict() for i in range(N)]
for i in range(N-1):
    a,b,c=map(int,input().split())
    G[a-1][b-1]=c
    G[b-1][a-1]=c
Q,K=map(int,input().split());K-=1
x=[0 for i in range(Q)]
y=[0 for i in range(Q)]
for i in range(Q):
    x[i],y[i]=map(int,input().split())
    x[i]-=1
    y[i]-=1
q=queue.Queue()
q.put(K)
dist=[-1 for i in range(N)]
dist[K]=0
while(not(q.empty())):
    r=q.get()
    for p in G[r]:
        if dist[p]!=-1:
            continue
        dist[p]=dist[r]+G[p][r]
        q.put(p)
for i in range(Q):
    print(dist[x[i]]+dist[y[i]])


Measured memory_bytes: 60788
def f(x):
    if x>0:return 1
    elif x<0:return -1
    elif x==0:
        return 0


a,b=list(map(int,input().split()))
if a<= 0 and b>=0:
    print('Zero')

if (a<0 and b<0) :
    if (b-a) %2:
        print('Positive')
    else:
        print('Negative')

if (a>0 and b>0):
    print("Positive")

Measured memory_bytes: 3188
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <iomanip>
#include <unordered_set>
using namespace std;
typedef long long LL;
typedef pair<int,int> P;

int x[3000];
int y[3000];

int n;
int main() {
while(1){
	cin >> n;
	if(n==0)return 0;
	unordered_set<int> pos;
	for(int i=0;i<n;i++){
		cin >> x[i] >> y[i];
		pos.insert(6000*x[i]+y[i]);
	}
	int ret=0;
	for(int i=0;i<n;i++){
		for(int j=i+1;j<n;j++){
			int dx=x[i]-x[j];
			int dy=y[i]-y[j];
			int d=dx*dx+dy*dy;
			if(ret<d&&
			   pos.find(6000*(x[i]-dy)+y[i]+dx)!=pos.end()&&
			   pos.find(6000*(x[j]-dy)+y[j]+dx)!=pos.end()){
				ret=d;
			}
		}
	}
	cout << ret << endl;
}
}

Measured memory_bytes: 1360
import java.util.*;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Deque<Coordinate> deque = new ArrayDeque<Coordinate>();
		int w, h;
		int wall;

		while(true){
			deque.clear();
			w = sc.nextInt();
			h = sc.nextInt();
			if(w==0) break;
			Coordinate[][] room = new Coordinate[h][w];
			for(int i=0; i<h; i++){
				for(int j=0; j<w; j++){
					room[i][j] = new Coordinate(i, j);
				}
			}
			for(int i=0; i<2*h-1; i++){
				switch(i%2){
					case 0:
						for(int j=0; j<w-1; j++){
							wall = sc.nextInt();
							room[i/2][j].right += wall;
							room[i/2][j+1].left += wall;
						}
						break;
					case 1:
						for(int j=0; j<w; j++){
							wall = sc.nextInt();
							room[i/2][j].under += wall;
							room[i/2+1][j].up += wall;
						}
						break;
				}
			}
			room[0][0].settled = true;
			deque.offerLast(room[0][0]);
			while(!deque.isEmpty()){
				Coordinate room1 = deque.pollFirst();
				if(room1.left == 0&&room1.x>0){
					if(!room[room1.y][room1.x-1].settled){
						room1.left = 1;
						room[room1.y][room1.x-1].settled = true;
						room[room1.y][room1.x-1].count = room1.count + 1;
						deque.offerLast(room[room1.y][room1.x-1]);
					}
				}
				if(room1.up == 0&&room1.y>0){
					if(!room[room1.y-1][room1.x].settled){
						room1.up = 1;
						room[room1.y-1][room1.x].settled = true;
						room[room1.y-1][room1.x].count = room1.count + 1;
						deque.offerLast(room[room1.y-1][room1.x]);
					}
				}
				if(room1.right == 0&&room1.x<w-1){
					if(!room[room1.y][room1.x+1].settled){
						room1.right = 1;
						room[room1.y][room1.x+1].settled = true;
						room[room1.y][room1.x+1].count = room1.count + 1;
						deque.offerLast(room[room1.y][room1.x+1]);
					}
				}
				if(room1.under == 0&&room1.y<h-1){
					if(!room[room1.y+1][room1.x].settled){
						room1.under = 1;
						room[room1.y+1][room1.x].settled = true;
						room[room1.y+1][room1.x].count = room1.count + 1;
						deque.offerLast(room[room1.y+1][room1.x]);
					}
				}
				if(room[h-1][w-1].settled) break;
			}
			if(room[h-1][w-1].settled){
				System.out.println(room[h-1][w-1].count);
			}else{
				System.out.println("0");
			}
		}
	}

	static class Coordinate{
		public int x, y;
		public int left = 0, right = 0, up = 0, under = 0;
		public int count = 1;
		public boolean settled = false;
		public Coordinate(int i, int j){
			x = j;
			y = i;
		}
	}
}

Measured memory_bytes: 68856
#include<bits/stdc++.h>
using namespace std;
#define int         long long
#define ull 		unsigned long long
#define ll 			long long
#define M 			1000000007
#define pb 			emplace_back
#define p_q 		priority_queue
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define all(a)      (a).begin(),(a).end()
#define sz(x)       (ll)x.size()
#define endl        '\n'
#define gcd(a,b)    __gcd((a),(b))
#define lcm(a,b)    ((a)*(b)) / gcd((a),(b))
#define ios	    	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mp 			make_pair
#define lb 			lower_bound
#define ub			upper_bound
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define ini(a,n,b)	for(ll int i=0;i<n;i++) a[i]=0;
#define cset(a)		__builtin_popcountll(a)
#define hell 		(ull)1e9
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); cerr<<endl; }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}
int n;
vi adj[(ll)1e5+1];
int dp[(ll)1e5+1][2];
void dfs(int s,int e)
{
	dp[s][0]=dp[s][1]=1;
	for(int i:adj[s])
	{
		if(i!=e)
		{
			dfs(i,s);
			dp[s][0]=(dp[s][0]*(dp[i][0]+dp[i][1])%M)%M;
			dp[s][1]=(dp[s][1]*dp[i][0])%M;
		}
	}
}
signed main(void)
{ios 
	cin>>n;
	rep(i,1,n)
	{
		int x,y;
		cin>>x>>y;
		adj[x].pb(y);
		adj[y].pb(x);
	}
	dfs(1,0);
	cout<<(dp[1][0]+dp[1][1])%M<<endl;
}

Measured memory_bytes: 14208
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <numeric>
#include <cmath>
#include <limits>
#include <bitset> 
#include <iterator> 
#include <map>
#include <queue>
#include <set>
#include<deque>
#include <regex>
#define rep(i,n) for(ll i=0;i<(n); ++i)
#define per(i,n) for(ll i=n-1;i>=0; --i)
#define all(x) (x).begin(),(x).end()
#define _GLIBCXX_DEBUG
using namespace std;
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; }
const long long INF = 1LL << 60;
typedef long long ll;
const ll MOD = 1000000007;
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll m1, d1, m2, d2;
	cin >> m1 >> d1 >> m2 >> d2;
	if (m2 != m1)cout << 1 << endl;
	else cout << 0 << endl;
}




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

const int MOD = (int)1e9+7;

int main(){
	long long r,D,x;
	cin >> r >> D >> x;

	for(int i=0;i<10;i++){
		x=r*x-D;
		cout << x << endl;
	}

	return 0;
}


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

using namespace std;

int main(){
    int N,m;
    string s;
    
    m = 0;
    s = "";
    
    cin >> N;
    map<string,int> dic;

    for(int i = 0; i < N; i++){
        cin >> s;
        
        dic[s] += 1;
        
        m = max(m,dic[s]);
    }
    
    for(auto it = dic.begin(); it != dic.end(); it++){
        if(m == it->second){
            cout << it->first << endl;
        }
    }
    
    return 0;
}
  

Measured memory_bytes: 19264
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <iomanip>
using namespace std;

int main() {
  string S;
  cin >> S;
  if(S.at(5) == '0' && S.at(6) <= '4')
    cout << "Heisei" << endl;
  else
    cout << "TBD" << endl;
}

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

using namespace std;

int main( ) {
    ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t,a,b,c;
	t = 1;
	while(t--) {
	 cin >> a >> b;
	 cout << (a + b) % 24 << endl;
	}
	return 0;
}



Measured memory_bytes: 256
N = int(input())
W = [input() for _ in range(N)]


def solve(lis):
	if len(lis) != len(set(lis)):
		return False

	for i in range(N-1):
		if lis[i][-1] != lis[i+1][0]:
			return False

	return True

if solve(W):
	print("Yes")
else:
	print("No")


Measured memory_bytes: 3060
#include <stdio.h>
#include <stdlib.h>

int main()
{
	int a, b, c;
	int k;
	int n;

	scanf("%d%d%d", &a, &b, &c);
	n = 0;
	for (k = a; k <= b; k++) {
		if (c % k == 0) n++;
	}
	printf("%d\n", n);
	return 0;
}



Measured memory_bytes: 2108
n=int(input())
a=list(map(int,input().split()))

def prod(x):
  q=0
  for i in x:
    if i%2==1:
      return False
      break
    else:
      q=1
  if q==1:
    return True
ans=0
while prod(a):
  for i in range(n):
    a[i]=a[i]//2
  ans+=1
print(ans)

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

#define y1 dmytxdy
#define pb push_back
#define fi first
#define se second
#define mp make_pair

using namespace std;

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

template <typename T> bool chkmin(T &x,T y){return x>y?x=y,1:0;}
template <typename T> bool chkmax(T &x,T y){return x<y?x=y,1:0;}

ll readint(){
	ll x=0,f=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

struct node{
	int x,y,z;
	bool operator<(const node c)const{return z<c.z;}
}e[2005];

const int cys=1000000007;
int n,m,tot; ll l,minv;
int v[4005],c[4005],nxt[4005],h[1005],dep[1005],val[1005],f[1005],ff[1005];
bool fl[2005];

int getf(int x){return x==f[x]?x:f[x]=getf(f[x]);}

ll qpow(ll x,ll p){
	ll ret=1;
	for(;p;p>>=1,x=x*x%cys) if(p&1) ret=ret*x%cys;
	return ret;
}

void addedge(int x,int y,int z){
	v[++tot]=y; c[tot]=z; nxt[tot]=h[x]; h[x]=tot;
	v[++tot]=x; c[tot]=z; nxt[tot]=h[y]; h[y]=tot;
}

void dfs(int u){
	for(int p=h[u];p;p=nxt[p]){
		if(v[p]==ff[u]) continue;
		ff[v[p]]=u,val[v[p]]=c[p],dep[v[p]]=dep[u]+1;
		dfs(v[p]);
	}
}

ll getmin(int x,int y){
	ll ret=0;
	while(x!=y){
		if(dep[x]<dep[y]) swap(x,y);
		chkmax(ret,1ll*val[x]);
		x=ff[x];
	}
	return ret;
}

ll getans(){
	ll ret=0;
	for(int i=1;i<=m;i++){
		int fx=getf(e[i].x),fy=getf(e[i].y);
		if(fx==fy) continue;
		f[fx]=fy;
		ret+=e[i].z;
	}
	return ret;
}

int main(){
	n=readint(); m=readint(); l=readint();
	for(int i=1;i<=n;i++) f[i]=i;
	for(int i=1;i<=m;i++) e[i].x=readint(),e[i].y=readint(),e[i].z=readint();
	sort(e+1,e+m+1);
	minv=getans();
	if(l<minv) printf("0\n");
	else if(minv==l){
		int cnt=0;
		for(int i=1;i<=m;i++){
			for(int j=1;j<=n;j++) f[j]=j;
			f[e[i].x]=e[i].y;
			if(getans()+e[i].z==minv) cnt++;
		}
		printf("%lld\n",qpow(2,m-cnt)*(qpow(2,cnt)-2)%cys);
	}
	else{
		for(int i=1;i<=n;i++) f[i]=i;
		for(int i=1;i<=m;i++){
			int fx=getf(e[i].x),fy=getf(e[i].y);
			if(fx==fy) continue;
			f[fx]=fy,addedge(e[i].x,e[i].y,e[i].z),fl[i]=1;
		}
		dep[1]=1; dfs(1);
		int cnt1=0,cnt2=0;
		for(int i=1;i<=m;i++){
			if(fl[i]) continue;
			ll tmp=e[i].z-getmin(e[i].x,e[i].y);
			if(tmp==l-minv) cnt1++;
			else if(tmp>l-minv) cnt2++;
		}
		printf("%lld\n",2*qpow(2,cnt2)*(qpow(2,cnt1)-1)%cys);
	}
	return 0;
}

Measured memory_bytes: 3848
N,K=map(int,input().split())

def base10ton(x,n):
    x_dumy=x
    out=''
    while x_dumy>0:
        out=str(x_dumy%n)+out
        x_dumy=int(x_dumy/n)
    return out

print(len(base10ton(N,K)))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define INF 5000000000000000000
#define ll long long
#define pll pair<ll, ll>
using namespace std;
vector<ll> C(26);
vector<vector<ll>> S;

ll change_evaluation(vector<ll>& T,ll day) {
  day -= 1;
  vector<ll> last(26, -1);
  vector<ll> next(26, T.size());
  ll old = T.at(day) - 1;
  for (ll i = 0; i < day; ++i) {
    last.at(T.at(i) - 1) = i;
  }
  for (ll i = T.size() - 1; i > day; --i) {
    next.at(T.at(i) - 1) =  i;
  }
  ll max_t = 0, max_score = -INF;
  for (ll t = 0; t < 26; ++t) {
    ll score = S.at(day).at(t) - S.at(day).at(old);
    score += (next.at(t) - day) * (day - last.at(t)) * C.at(t);
    score -= (next.at(old) - day) * (day - last.at(old)) * C.at(old);
    if (score > max_score) {
      max_score = score;
      max_t = t;
    }
  }
  return max_t;
}

ll evaluation(ll t, ll day, vector<ll>& last, ll delay = 7) {
  ll score = 0;
  score += S.at(day).at(t);
  for (ll j = 0; j < 26; ++j) {
    score -= delay * (delay - 1) / 2 * C.at(j);
    if (j == t) {
      continue;
    }
    score -= delay * (day + 1 - last.at(j)) * C.at(j);
  }
  return score;
}

ll whole_evaluation(vector<ll>& T) {
  ll D = T.size();
  vector<ll> last(26, 0);
  ll score = 0;
  for (ll i = 0; i < D; ++i) {
    ll contest = T.at(i) - 1;
    last.at(contest) = i + 1;
    score += S.at(i).at(contest);
    for (ll j = 0; j < 26; ++j) {
      score -= (i + 1 - last.at(j)) * C.at(j);
    }
  }
  return score;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  //-----------input-------------
  ll D;
  cin >> D;
  vector<ll> T(D);
  S = vector<vector<ll>>(D, vector<ll>(26));
  for (ll i = 0; i < 26; ++i) {
    cin >> C.at(i);
  }
  for (ll i = 0; i < D; ++i) {
    for (ll j = 0; j < 26; ++j) {
      cin >> S.at(i).at(j);
    }
  }
  //--------------------------------------
  vector<ll> max_T = T;
  ll max_T_score = -INF;
  for (ll delay = 0; delay < 26; ++delay) {
    vector<ll> last(26, 0);
    for (ll day = 0; day < D; ++day) {
      ll max_contest = 0;
      ll max_score = -INF;
      for (ll contest = 0; contest < 26; ++contest) {
        ll temp_score = evaluation(contest, day, last);
        if (temp_score > max_score) {
          max_score = temp_score;
          max_contest = contest + 1;
        }
      }
      last.at(max_contest - 1) = day;
      T.at(day) = max_contest;
    }
    ll temp_T_score = whole_evaluation(T);
    if (temp_T_score > max_T_score) {
      max_T_score = temp_T_score;
      max_T = T;
    }
  }
  T = max_T;

  random_device rnd;
  mt19937 mt(rnd());
  uniform_int_distribution<> rand(1, T.size());
  for (ll i = 0; i < 100000; ++i) {
    ll random = rand(mt);
    ll max_t = change_evaluation(T, random);
    // cout << max_t << " rand" << "\n";
    T.at(random - 1) = max_t + 1;
  }

  // ll score = whole_evaluation(T);
  // cout << score << "\n";

  for (ll i = 0; i < D; ++i) {
    cout << T.at(i) << "\n";
  }

  // vector<ll> ans = evaluation(C, S, T);
  // for (ll i = 0; i < ans.size(); ++i) {
  //   cout << ans.at(i) << "\n";
  // }
}


Measured memory_bytes: 3776
#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define RREP(i,a,b) for(int i=(a);i>=(b);i--)
#define pq priority_queue
#define P pair<int,int>
#define P2 pair<int,P>
#define P3 pair<int,P2>
typedef long long ll; typedef long double ld;
using namespace std;
const int INF=1e9, MOD=1e9+7, around[]={0,1,1,-1,-1,0,-1,1,0,0};
const ll LINF=1e18;
const ld PI=abs(acos(-1));
int n,p,a[55],c=0;

int main(){
  cin >> n >> p;
  REP(i,0,n) cin >> a[i];
  REP(i,0,n) c+=a[i]%2;

  if(c) cout << (1L<<n-1) << endl;
  else cout << (p?0:(1L<<n)) << endl;
  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <utility>
#include <iomanip>
#include <cmath>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
#define rep(i,a,b) for(int i=a;i<(b);++i)
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;}
using ll = long long;
constexpr ll INF = 1LL << 60;
constexpr ll MOD = 1e9 + 7;

int table[26];

int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    string s;cin>>s;
    REP(i,s.size()) ++table[s[i]-'a'];
    REP(i,26) if(table[i]&1){cout << "No" << endl; return 0;}
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define ALL(n) begin(n),end(n)
#define IN(a, x, b) (a<=x && x<b)
#define INIT std::ios::sync_with_stdio(false);std::cin.tie(0);
template<class T> inline T CHMAX(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T CHMIN(T & a, const T b) { return a = (a > b) ? b : a; }

const long double EPS = 1e-10;
const long long INF = 1e18;
const long double PI = acos(-1.0L);

int main()
{
    INIT;
    string s;
    cin >> s;
    cout << (s == "ABC" ? "ARC":"ABC");
    return 0;
}

Measured memory_bytes: 3604
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#define N 5001
#include<bitset>
#include<deque>
#include<cstdlib>
#include<set>
#include<ctime>
#define ll long long
#define mp make_pair
using namespace std;
ll read()
{
	ll x=0,f=1;
	char c=getchar();
	while(c>'9'||c<'0')
	{
		if(c=='-') f=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9')
	{
		x=x*10+c-'0';
		c=getchar();
	}
	return f*x;
}
int n,pos[N],A,B;
ll dp[N][N];
int main()
{
	n=read(),A=read(),B=read();
	memset(dp,20,sizeof(dp));
	dp[0][0]=0;
	for(int i=1;i<=n;++i)
	{
		int x=read();
		pos[x]=i;
	}
	for(int i=1;i<=n;++i)
	{
		ll mn=dp[i-1][0];
		for(int j=0;j<=n;++j)
		{
			if(pos[i]==j) dp[i][j]=mn;
			mn=min(mn,dp[i-1][j]);
			dp[i][j]=min(dp[i][j],mn+(j<pos[i]?B:A));
		}
	}
	ll ans=1e18;
	for(int i=1;i<=n;++i) ans=min(ans,dp[n][i]);
	cout<<ans<<'\n';
	return 0;
 }


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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9;
const ll MOD = 1e9 + 7;

const int MAXN = 1e5 + 5;

void solve(){
	int n, a, b;
	cin >> n >> a >> b;
	if ((a - b) & 1){
		printf("Borys\n");
	} else {
		printf("Alice\n");
	}
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


Measured memory_bytes: 256
n = gets.to_i
a = gets.split.map(&:to_i).sort

count = 0
has_odd = false
while(true)
  a.each_with_index do |aa, i|
    if aa % 2 == 1
      has_odd = true
      break
    end
    a[i] = aa / 2
  end
  break if has_odd

  count += 1
end

puts count


Measured memory_bytes: 1788
import java.util.Collections;
import java.util.LinkedList;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		long N = Long.parseLong(scan.next());
		long C = Long.parseLong(scan.next());
		long K = Long.parseLong(scan.next());
		long bus = 0;
		LinkedList<Long> times = new LinkedList<>();
		while(scan.hasNext()) {
			times.add(Long.parseLong(scan.next()));
		}
		Collections.sort(times, Collections.reverseOrder());
		while(!times.isEmpty()) {
			bus++;
			long end = times.getLast() + K;
			long passNum = 0;
			while(!times.isEmpty() && passNum < C) {
				long time = times.getLast();
				if (time <= end) {
					times.removeLast();
					passNum++;
				}
				else {
					break;
				}
			}
		}
		System.out.println(bus);
	}

}

Measured memory_bytes: 52248
#!/usr/bin/env python3
a, b, c, x, y = map(int, input().split())

ab = a * x + b * y

cc = 0
if x >= y:
    cab = c * 2 * y + (a * (x - y))
else:
    cab = c * 2 * x + (b * (y - x))

if x >= y:
    cc = c * 2 * x
else:
    cc = c * 2 * y


print(min(ab, cab,cc))


Measured memory_bytes: 9092
#include <iostream>
#include <set>
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
#define D()
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 10000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素

int main(){
	ll N,Y;
	std::cin >> N >> Y;
	if (!( Y > 100000*N || Y%1000 != 0)) {
		for ( int x = 0 ; x <= N ; x++ ) {
			if (10000*x>Y) break;
			for ( int y = 0 ; y <= N-x ; y++ ) {
				int z = N-x-y;
				if (10000*x+5000*y+1000*z>Y) break;
				else if (10000*x+5000*y+1000*z==Y) {
					std::cout << x << " " << y << " " << z << std::endl;
					return 0;
				}
			}
		}
	}
	std::cout << "-1 -1 -1" << std::endl;
	return 0;
}
	


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<string>
#include<vector>
using namespace std;
int main(void){

    int N , Q; cin >> N >> Q;
    string S; cin >> S;
    vector<int> l(Q) , r(Q);
    for(int i = 0 ; i < Q ; i++){
       cin >> l[i] >> r[i];
    }

    vector<int> keep(N);
    for(int i = 1 ; i < N ; i++){
            if(S[i - 1] == 'A' && S[i] == 'C') keep[i + 1] = keep[i] + 1;
            else keep[i + 1] = keep[i]; 
    }
    
    for(int i = 0 ; i < Q ; i++){
        cout << keep[r[i]] - keep[l[i]] << endl;
    }

    return 0;
}

Measured memory_bytes: 2176
#include <cstdio>

int main(int argc, char const* argv[])
{
	char str[100];
	char p[100];
	scanf("%s", str);
	scanf("%s", p);
	int i = 0;
	while(str[i]){
			if(str[i] == p[0]){
					int j = 1;
					int k = i + j;
					while(p[j]){
							if(k >= 100 || !str[k])k = 0;
							if(p[j] != str[k])break;
							k++;
							j++;
					}
					if(!p[j]){
							printf("Yes\n");
							return 0;
					}
			}
			i++;
	}
	printf("No\n");
	return 0;
}



Measured memory_bytes: 2680
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)

typedef tuple<int, int, int> P;

vector<pair<int, int> > DXDY { {1, 0}, {-1, 0}, {0, 1}, {0, -1} };

const int INF = 10000000;
int main() {
  int sx,sy,tx,ty;
  int h,w; cin >> h >> w >> sy >> sx >> ty >> tx;
  sy--;sx--;ty--;tx--;
  vector<string> S(h);
  loop(i,0,h) cin >> S[i];

  int dp[h][w];
  loop(i,0,h) loop(j,0,w) dp[i][j] = INF;
  bool done[h][w];
  loop(i,0,h) loop(j,0,w) done[i][j] = false;

  {
    priority_queue<P> Q; // 大きい方優先. 距離は*-1する.
    Q.emplace(0, sy, sx);
    dp[sy][sx] = 0;

    while (Q.size()) {
      auto q = Q.top(); Q.pop();
      int qy = get<1>(q), qx = get<2>(q);
      done[qy][qx] = true;

      // 道の探索
      for (auto&&dxdy: DXDY) {
        int y = qy + dxdy.first, x = qx + dxdy.second;
        if (x < 0 or x >= w) continue;
        if (y < 0 or y >= h) continue;
        if (S[y][x] == '#') continue;
        if (done[y][x]) continue;
        if (dp[y][x] <= dp[qy][qx]) continue;
        dp[y][x] = dp[qy][qx] + 0; // 道はコスト0
        Q.emplace(-dp[y][x], y, x);
      }

      // 空路の探索.
      loop(y,qy-2,qy+3) loop(x,qx-2,qx+3) {
        if (x < 0 or x >= w) continue;
        if (y < 0 or y >= h) continue;
        if (y == qy and x == qx) continue;
        if (S[y][x] == '#') continue;
        if (done[y][x]) continue;
        if (dp[y][x] <= dp[qy][qx] + 1) continue;
        dp[y][x] = dp[qy][qx] + 1;
        Q.emplace(-dp[y][x], y, x);
      }
    }
  }

  if (dp[ty][tx] == INF) cout << -1 << endl;
  else cout << dp[ty][tx] << endl;
  return 0;
}


Measured memory_bytes: 10532
#include<stdio.h>

int main()
{
	int m, n;
	scanf("%d %d", &n, &m);
	int A[101][101];
	int i, j;
	for (i = 1; i <= n; i++)
	{
		for (j = 1; j <= m - 1; j++)
		{
			scanf("%d ", &A[i - 1][j - 1]);
		}
		scanf("%d\n", &A[i - 1][m - 1]);
	}
	int B[101];
	for (j = 0; j <= m - 1; j++)
	{
		scanf("%d", &B[j]);
	}
	int C[101] = { 0 };
	int k;
	for (i = 0; i <= n - 1; i++)
	{
		for (k = 0; k <= m - 1; k++)
		{
			C[i] += A[i][k] * B[k];
		}
	}
	for (i = 0; i <= n - 1; i++)
	{
		printf("%d\n", C[i]);
	}
}

Measured memory_bytes: 1072
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using vint = vector<int>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vchar = vector<char>;
using vvchar = vector<vchar>;
using vp = vector<P>;
using vpp = vector<pair<P, P>>;
using vvp = vector<vp>;

#define rep(i, n) for (int i = 0; i < n; ++i)
#pragma region Debug
istream &operator>>(istream &is, P &a)
{
    return is >> a.first >> a.second;
}
ostream &operator<<(ostream &os, const P &a) { return os << "(" << a.first << "," << a.second << ")"; }

template <typename T>
void view(const std::vector<T> &v)
{
    for (const auto &e : v)
    {
        std::cout << e << " ";
    }
    std::cout << std::endl;
}
template <typename T>
void view(const std::vector<std::vector<T>> &vv)
{
    for (const auto &v : vv)
    {
        view(v);
    }
}
#pragma endregion
#pragma region chminmax
template <typename T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}
template <typename T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}
#pragma endregion

int main()
{
    int n;
    cin >> n;
    vll a(n);
    rep(i, n) cin >> a[i];
    ll ans = 1000;
    ll stock = 0;
    rep(i, n)
    {
        if (i < n - 1)
        {
            if (a[i + 1] > a[i])
            {
                ll buy = ans / a[i];
                stock += buy;
                ans -= buy * a[i];
            }
            if (a[i + 1] < a[i])
            {
                ll sell = stock;
                ans += stock * a[i];
                stock = 0;
            }
        }
        else
        {
            ans += stock * a[i];
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3584
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,b;
cin >> a >> b;
if(a == 1 && b != 1){
	cout << "Alice" << endl;

}
else if(b == 1 && a != 1){
	cout << "Bob" << endl;
}
else if(a > b){
	cout << "Alice" << endl;

}
else if(a < b){
	cout << "Bob" << endl;
}
else{
	cout << "Draw" << endl;
}
}

Measured memory_bytes: 256
N = int(input())
S = input()
a = [0] * N
a[0] = S[1:].count("E")
for i in range(1, N):
    if S[i - 1] == "W":
        a[i] = a[i - 1] + 1
    else:
        a[i] = a[i - 1]
    if S[i] == "E":
        a[i] -= 1
print(min(a))


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

using ll = long long;
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define MAX(a, b) (((a) < (b)) ? (b) : (a))

int const nmax = 100000;
int v[1 + nmax];

int main() {
  int n, lim;
  std::cin >> n >> lim;
  for(int i = 1;i <= n; i++)
    std::cin >> v[i];
  int id = 0;
  for(int i = 1;i < n; i++) {
    if(lim <= v[i] + v[i + 1])
      id = i;
  }
  if(id == 0)
    std::cout << "Impossible";
  else{
    std::cout << "Possible" << '\n';
    for(int i = 1;i < id; i++)
      std::cout << i << '\n';
   for(int i = n - 1;id < i; i--)
     std::cout << i << '\n';
   std::cout << id;
  }
  return 0;
}


Measured memory_bytes: 4004
input_lines = readlines

input_0 = input_lines[0].split(' ')
members_height = input_lines[1].split(' ')
cnt = 0

N = input_0[0]
HEIGHT_LIMIT = input_0[1].to_i

if members_height
  members_height.each do |mem_height|
    cnt = cnt + 1 if mem_height.to_i >= HEIGHT_LIMIT
  end
end
  
puts cnt

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

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

typedef long long ll;
const ll MOD = 998244353;
const ll inf = 1LL<<60;
const double eps = 1e-9;

ll mod_pow(ll n, ll exponent, ll mod) {
    ll pow = 1;
    while(exponent > 0) {
        if((exponent & 1) == 1) {
            pow *= n;
            pow %= mod;
        }
        n *= n;
        n %= mod;
        
        // 桁をずらす
        exponent >>= 1;
    }
    return pow;
}

ll modpow(ll a, ll b)
{
  if(b == 0) return 1; 
  return modpow(a*a%MOD, b/2)*(b%2?a:1)%MOD;
}

int main()
{
    int n, tmp, mx = -1;
    cin >> n;
    vector<ll> d(100000, 0);
    for (int i = 0 ; i < n; i++) {
        cin >> tmp;
        if (i == 0 and tmp != 0) {
            cout << 0 << endl;
            return 0;
        }
        d[tmp]++;
        chmax(mx, tmp);
    }
    ll ans = 1;

    if (d[0] != 1) {
        cout << 0 << endl;
        return 0;
    }
    ll bef = 1;
    for (int i = 1; i <= mx; i++) {
        if (d[i] == 0) {
            cout << 0 << endl;
            return 0;
        }
        ll now = d[i];
        (ans *= mod_pow(bef, now, MOD))%=MOD;
        bef = d[i];
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
#include"bits/stdc++.h"
//#include<boost/multi_array.hpp>
//#include<boost/optional.hpp>
//#include<boost/range/irange.hpp>
//#include<boost/range/algorithm.hpp>
//#include<boost/range/adaptors.hpp>

using namespace std;
//namespace adaptor = boost::adaptors;

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

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

void Main()
{
    vector<int> a(3);
    vector<int> b(3);
    rep(i, 3){
        cin >> a[i] >> b[i];
    }
    vector<int> fffff(5, 0);
    rep(i, 3){
        fffff[a[i]]++;
        fffff[b[i]]++;
    }
    int onec = 0;
    rep(i, 5){
        //cout << fffff[i] << endl;
        if(fffff[i] == 3){
            cout << "NO" << endl;
            return;
        }
    }
    cout << "YES" << endl;
    return;
}

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
using namespace std;
#include<set>
int main()
{
	int n;
	scanf("%d",&n);
	int Array[n];
	int hash[n+10];
	for(int i=0;i<n;i++)
	{
		scanf("%d",&Array[i]);
		hash[Array[i]-1]=i+1;
	}
	set<int> s;
	s.insert(0);
	s.insert(n+1);
	long long  ans=0;
	set<int>:: iterator it,l,r;
	for(int i=0;i<n;i++)
	{
		int t=hash[i];
		s.insert(t);
		it=s.find(t);
		l=it;
		r=it;
		l--;
		r++;
		ans += (long long)(i + 1) * (t - *l) * (*r - t);
	}
	printf("%lld\n",ans);
	/*scanf("%d", &n);
	vector<int> a(n), b(n);
	for(int i = 0; i < n; i++){
		scanf("%d", &a[i]);
		b[a[i] - 1] = i + 1;
	}
	long long ans = 0;
	set<int> s = {0, n + 1};
	for(int i = 0; i < n; i++){
		int t = b[i];
		s.insert(t);
		auto it = s.find(t);
		auto l = it, r = it;
		l--; r++;
		ans += (long long)(i + 1) * (t - *l) * (*r - t);
	}
	printf("%lld\n", ans);*/
	return 0;
}

Measured memory_bytes: 11136
/*
    Author: Alam Khan
    AUST CSE 40th Batch

*/

#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;

typedef long long ll;
typedef tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
#define pb     push_back
#define inf     2e18
#define low     -2e18
#define PI        acos(-1.0)
#define endl  "\n"
#define FAST  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define fr freopen("input.txt","r",stdin)
#define fw freopen("output.txt","w",stdout)
const int sz =2e5+9;
ll a[sz];
int main()
{
    ll i,n,t,k,j,x=0,y=0,m;
    cin>>n>>k;
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    ll lo,mid,hi;
    ll ans = 0;
    lo = 1;
    hi = 1e9;
    while(lo<=hi)
    {
        mid = (lo+hi)/2;
        x = 0;
        for(i=0;i<n;i++)
        {
            if(a[i]%mid!=0)
                y = a[i]/mid+1;
            else y = a[i]/mid;
            x+= y-1;
        }
        if(x<=k)
        {
            ans = mid;
            hi = mid-1;
        }
        else lo  =mid+1;
    }
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 5108
#include<stdio.h>
#include<algorithm>
using namespace std;
int d[110000];
int main(){
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	for(int i=0;i<b;i++)scanf("%d",d+i);
	for(int i=0;i<b;i++){
		d[i]-=c;
		if(d[i]<0)d[i]+=a;
	}
	d[b++]=0;
	d[b++]=a;

	std::sort(d,d+b);
	int ret=999999999;
	for(int i=1;i<b;i++){
		ret=min(ret,100*(a-(d[i]-d[i-1])+min(d[i-1],a-d[i])));
	}
	printf("%d\n",ret);
}

Measured memory_bytes: 1076
#include <bits/stdc++.h>
#define rep(i, N) for (int i = 0; i < (N); i++)
using namespace std;
int main()
{
    int x, a, b;
    cin >> x >> a >> b;
    int Da, Db;
    Da = abs(x - a);
    Db = abs(x - b);
    if (Da < Db)
    {
        cout << 'A' << endl;
    }
    else
    {
        cout << 'B' << endl;
    }
}

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

using namespace std;

int main()
{

    long long int n;
    cin>>n;

    unordered_map<long long int,long long int> hmap1;
    unordered_map<long long int,long long int> hmap2;

    for(long long int i = 1;i<=n;i++)
    {
        long long int a;
        cin>>a;
        hmap1[i + a]++;
        hmap2[i - a]++;
    }

    long long int ans = 0;
    for(auto it:hmap1)
    {
        if(hmap2.find(it.first) != hmap2.end())
        {
            ans += (it.second * hmap2[it.first]);
        }
    } 
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 18560
#include <bits/stdc++.h>
#define rep(var,cnt) for(int (var)=0; (var)<(int)(cnt); ++(var))
#define Rep(var,init,cnt) for(int (var)=(init); (var)<(int)(cnt); ++(var))
#define ran(var,vec) for(auto &(var):(vec))
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define SORT(v) sort(all(v))
#define RSORT(v) sort(rall(v))
#define SUM(v) accumulate(all(v),0)
#define tget(tp,idx) get<idx>(tp)
#define TF(flag) ((flag)?1:0)
#define YN(flag) cout<<(flag?"YES":"NO")<<endl;
#define Yn(flag) cout<<(flag?"Yes":"No")<<endl;
#define yn(flag) cout<<(flag?"yes":"no")<<endl;
#define Cout(v) cout<<(v)<<endl
using namespace std;

using ll = long long;
using ull = unsigned long long;
using pi = pair<int,int>;
using pl = pair<ll,ll>;
using ti = tuple<int,int,int>;
using tl = tuple<ll,ll,ll>;

template<typename T>
using vec = vector<T>;
template<typename T>
using mat = vector<vec<T>>;
template<typename T>
using cub = vector<mat<T>>;
template<typename T>
using val = valarray<T>;

template<typename T>
using pq = priority_queue<T>;
template<typename T>
using rpq = priority_queue<T,vec<T>,greater<T>>;

template<typename T1,typename T2>
ostream &operator<<(ostream &os, const pair<T1,T2> &p){
  os<<"P("<<p.first<<", "<<p.second<<") ";
  return os;
}

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

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

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

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

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

// Usual Template End ===================

// Template End =========================

int main(void){
  int a,b; cin>>a>>b; Cout(a<b?0:10);
}












Measured memory_bytes: 256
N=int(input())
R=[list(map(int,input().split())) for i in range(N)]
B=[list(map(int,input().split())) for i in range(N)]
R=sorted(R,key=lambda x:x[0])
B=sorted(B,key=lambda x:x[0])
ir=0
ans=0
X=[]
for ib in range(N):
  while ir<N and R[ir][0]<=B[ib][0]:
    X.append(R[ir][1])
    ir+=1
  X=sorted(X)
  ix=len(X)-1
  while ix>=0 and X[ix]>=B[ib][1]:
    ix-=1
  if ix!=-1:
    X.pop(ix)
    ans+=1
print(ans)
    

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

typedef long long  ll;

ll MOD = 1000000007;
ll INF = 10000000000000000;
int PI = 3.1415926535;

template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
    vector.erase(vector.begin() + index);
}

using Graph = vector<vector<pair<ll,ll>>>;

ll N;
Graph G(100010);
ll d[100010];
ll done[100010];
priority_queue<pair<ll,ll>> Q;

void dijkstra(ll s){
  fill(d,d + 100010,INF);
  fill(done,done + 100010,false);
  d[s] = 0;
  Q.push(make_pair(0,s));
  while(Q.size()){
    ll x = Q.top().second;
    ll n = G[x].size();
    Q.pop();
    done[x] = true;
    for(ll i = 0;i < n;i++){
      ll y = G[x][i].first;
      ll cost = d[x] + G[x][i].second;
      if(!done[y]){
        if(d[y] > cost){
          d[y] = cost;
          Q.push(make_pair(-cost,y));
        }
      }
    }
  }
  return ;
}

int main(){
  cin >> N;
  for(int i = 0;i < N-1;i++){
    ll a,b,c;cin >> a >> b >> c;
    a--;b--;
    G[a].push_back(make_pair(b,c));
    G[b].push_back(make_pair(a,c));
  }
  ll Q,K;cin >> Q >> K;
  K--;
  vector<ll> ans(Q);
  dijkstra(K);
  for(int i = 0;i < Q;i++){
    int x,y;cin >> x >> y;
    x--;y--;
    ans[i] = d[x] + d[y];
  }
  for(int i = 0;i < Q;i++){
    cout << ans[i] << endl;
  }
}



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

// #define multitest 1
#ifdef Debug
#define db(...) ZZ(#__VA_ARGS__, __VA_ARGS__);
#define pc(...) PC(#__VA_ARGS__, __VA_ARGS__);
template <typename T, typename U>
ostream &operator<<(ostream &out, const pair<T, U> &p)
{
	out << '[' << p.first << ", " << p.second << ']';
	return out;
}
template <typename Arg>
void PC(const char *name, Arg &&arg)
{
	std::cerr << name << " { ";
	for (const auto &v : arg)
		cerr << v << ' ';
	cerr << " }\n";
}
template <typename Arg1>
void ZZ(const char *name, Arg1 &&arg1)
{
	std::cerr << name << " = " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void ZZ(const char *names, Arg1 &&arg1, Args &&... args)
{
	const char *comma = strchr(names + 1, ',');
	std::cerr.write(names, comma - names) << " = " << arg1;
	ZZ(comma, args...);
}
#else
#define db(...)
#define pc(...)
#endif

using ll = long long;
#define f first
#define s second
#define pb push_back
const long long mod = 1000000007;
auto TimeStart = chrono::steady_clock::now();

const int nax = 2e5 + 10;

void solve()
{
	int a, b, c;
	cin >> a >> b >> c;
	int diff = (a - b);
	cout << max(0, c - diff);
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int t = 1;
#ifdef multitest
	cin >> t;
#endif
	while (t--)
		solve();
#ifdef TIME
	cerr << "\n\nTime elapsed: " << chrono::duration<double>(chrono::steady_clock::now() - TimeStart).count() << " seconds.\n";
#endif
	return 0;
}

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

count_odd = 0
count_4 = 0
count_2 = 0
for i in A:
    if i % 2 != 0:
        count_odd += 1
    else:
        if i % 4 == 0:
            count_4 += 1
        else:
            count_2 += 1
            
if count_4 + 1 >= count_odd + count_2:
    print('Yes')
else:
    if count_2 > 1 and count_4 + 1 - count_odd > 0:
        print('Yes')
    else:
        print('No')

Measured memory_bytes: 14252
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)

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

    cout << max(0,C-(A-B))<< endl;
    

}

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

int main(void){
    int a,b;
    cin >> a >> b;
    int sum = 0;
    rep(i,2){
        if(a>b){
            sum += a;
            a--;
        }
        else{
            sum += b;
            b--;
        }
    }
    
    cout << sum <<endl;
    
    return 0;
}




Measured memory_bytes: 256
from sys import stdin, stdout
input = lambda: stdin.readline().rstrip()
write = stdout.write

def main():
    N = int(input())
    A = list(map(int, input().split()))

    cnt = 0
    for i in range(1, N):
        if A[i-1] == A[i]:
            cnt += 1
            A[i] = 0
    print(cnt)

main()


Measured memory_bytes: 2940
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<string>
#include<cstring>
#include<cstdlib>
using namespace std;
unsigned long long a=1,ans=1;
int main()
{
  cin>>a;
  for(unsigned long long i=2;i<=a;i++)ans=(ans*i)%1000000007;
  cout<<ans<<endl;
  return 0;
}


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

int main(){
    string A,B;
    int i=0;
    bool flag = true;
    cin>>A>>B;
    if(A.size()>B.size()){
        cout<<"GREATER"<<endl;
    }else if(A.size()<B.size()){
        cout<<"LESS"<<endl;
    }else{
        for(i=0;i<A.size();i++){
            int a,b;
            a=A.at(i)-'0';
            b=B.at(i)-'0';
            if(a>b){
                cout<<"GREATER"<<endl;
                flag = false;
                break;
            }else if(a<b){
                cout<<"LESS"<<endl;
                flag = false;
                break;
            }
        }
        if(flag==true){
            cout<<"EQUAL"<<endl;
    }
    }
    
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int X = Integer.parseInt(sc.next());
        sc.close();

        if (X == 7 || X == 5 || X == 3) {
            out.printf("YES\n");
        } else {
            out.printf("NO\n");
        }
        out.flush();
    }
}


Measured memory_bytes: 21844