akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int maxN = 3000;
ll dp[maxN][maxN];
ll a[maxN];


ll dfs(int i,int j){
    if(i >j){
        return 0;
    }
    if(i==j){
        dp[i][j] = a[i];
        return dp[i][j];
    }
    ll s,t;
    if(dp[i][j-1] == -1){
        s = a[j] -dfs(i,j-1);
    }else{
        s = a[j]-dp[i][j-1];
    }
    if(dp[i+1][j] == -1){
        t = a[i]-dfs(i+1,j);
    }else{
        t = a[i]-dp[i+1][j];
    }
    dp[i][j] = max(s,t);
    // cerr << "i=" <<i<<"j="<<j <<"val=" << dp[i][j] << endl;
    return dp[i][j];
}




// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&a[i]);
    }
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            dp[i][j] = -1;
        }
    }
    cout << dfs(0,N-1) << endl;
    return 0;
}


Measured memory_bytes: 70656
import java.util.Scanner;

 class Main {


    static double sum;

    private static void recFunc(int[][] a,boolean[] included, int index, int count, double currSum){
        if(count>=a.length){
            sum+=currSum;
            return;
        }

        for(int i=0;i<a.length;i++){
            if(!included[i]){
                included[i]=true;
                if(count==0){
                    recFunc(a, included, i, count+1, currSum);
                }else{
                    double dist = Math.sqrt((Math.pow((a[index][0]-a[i][0]) ,2) + Math.pow((a[index][1]-a[i][1]), 2)));
                    recFunc(a, included, i, count+1, currSum+dist);
                }
                included[i]=false;
            }
        }
    }

    private static  int factorial(int n){
        int a=1;
        for(int i=1;i<=n;i++)
            a=a*i;
        return a;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n=in.nextInt();
        int[][] a=new int[n][2];
        boolean[] included= new boolean[n];
        sum=0;
        for(int i=0;i<n;i++){
            a[i][0]=in.nextInt();
            a[i][1]=in.nextInt();
        }
        recFunc(a, included, 0, 0, 0.0);
        int fact=factorial(n);
        //System.out.println(sum + " " + fact);
        double ans=sum/fact;
        System.out.println(ans);

    }
}


Measured memory_bytes: 21588
n = gets.to_i
ls = gets.split.map(&:to_i)

ans = []
(0..n-1).each do |i|
  (i..n-1).each do |j|
    next if i == j
    next if ls[i] == ls[j]
    (j..n-1).each do |k|
      next if i == k || j == k 
      next if ls[i] == ls[k] || ls[j] == ls[k]

      if ls[i] + ls[j] > ls[k] && ls[k] + ls[i] > ls[j] && ls[j] + ls[k] > ls[i]
        ans << [ls[i], ls[j], ls[k]]
      end
    end
  end
end
puts ans.count

Measured memory_bytes: 22536
#include<bits/stdc++.h>
using namespace std;
const int INF=1e9+5;
int main(){
		int n,k;
		cin>>n>>k;
		int a[n];
		for(int i=0;i<n;i++)
		cin>>a[i];
	    vector<int>dp(n,INF);
	    dp[0]=0;
	    for(int i=0;i<n;++i){
	    	for(int j=i+1;j<=i+k;j++){
	    		if(j<n){
	    			dp[j]=min(dp[j],dp[i]+abs(a[i]-a[j]));
				}
			}
		}
		cout<<dp[n-1]<<endl;
  return 0;
}

Measured memory_bytes: 1024
//****** @author mdazmat9 **********
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define UB upper_bound
#define LB lower_bound
#define BS binary_search
#define MP make_pair
#define EB emplace_back
#define endl "\n"
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define F first
#define S second
#define ALL(a) (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll fast_pow(ll x, ll y, ll p)
{
    ll res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}



void solve() {
    ll n;cin>>n;
   string a,b;cin>>a>>b;
   vector<char> v;
   for(ll i=0;i<n;i++){
       v.EB(a[i]);
       v.EB(b[i]);
   }
   for(auto c:v)cout<<c;

}
int main()
{
    IOS;
    ll t=1;
   //   cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
  
int main(){
  int m,f,b;
    
  cin >> m >> f >> b;
    
  if(b-m > f){
    cout << "NA" << endl;
  }else{
    cout << max(b-m, 0) << endl;
  }
 
  return 0;
}


Measured memory_bytes: 3096
#include<set>
#include<map>
#include<cmath>
#include<queue>
#include<bitset>
#include<string>
#include<cstdio>
#include<cctype>
#include<cassert>
#include<cstdlib>
#include<cstring>
#include<sstream>
#include<iostream>
#include<algorithm>

#define For(i,x,y) for (int i=x;i<y;i++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define lf else if

#define dprintf(...) fprintf(stderr,__VA_ARGS__)
using namespace std;

typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> Vi;

int IN(){
	int c,f,x;
	while (!isdigit(c=getchar())&&c!='-');c=='-'?(f=1,x=0):(f=0,x=c-'0');
	while (isdigit(c=getchar())) x=(x<<1)+(x<<3)+c-'0';return !f?x:-x;
}

const int N=20000+19;
const int p=998244353;
const ll top=1e17;

int Pow(int a,int b){
	int res=1;
	for (;b;b>>=1,a=1ll*a*a%p) if (b&1) res=1ll*res*a%p;
	return res;
}

char A[N],B[N];
int fac[N],inv[N],val[N];
int l,n,m,c,res;

int C(int n,int m){
	return 1ll*fac[n]*inv[m]%p*inv[n-m]%p;
}
int cal(int n,int m,int k){
	return 1ll*C(m,k)*fac[k]%p*fac[m-k]%p*fac[m-k]%p*C(m+n,m-k)%p;
}

int main(){
	fac[0]=1;
	For(i,1,N) fac[i]=1ll*fac[i-1]*i%p;
	inv[N-1]=Pow(fac[N-1],p-2);
	for (int i=N-1;i;i--) inv[i-1]=1ll*inv[i]*i%p;
	scanf("%s%s",A+1,B+1);
	l=strlen(A+1);
	For(i,1,l+1){
		if (A[i]=='1'&&B[i]=='0') n++;
		if (A[i]=='1'&&B[i]=='1') m++;
	}
	For(i,0,n+1) val[i]=1ll*C(n,i)*Pow(i,n)%p;
	For(k,0,m+1){
		ll tmp=0;
		For(i,0,n+1){
			if (n-i&1) tmp-=val[i];else tmp+=val[i];
			if (tmp<-top||tmp>top) tmp%=p;
		}
		tmp=(tmp%p+p)%p;
		res=(res+1ll*fac[n]*tmp%p*cal(n,m,k))%p;
		For(i,0,n+1) val[i]=1ll*val[i]*i%p;
	}
	printf("%d\n",res);
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <utility>
#include <string>
#include <stack>
#include <regex>
 
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
 
using namespace std;
 
typedef long long ll;


int main(int argc, char const *argv[])
{
  ll n;
  cin >> n;
  vector<tuple<ll,ll,ll>> v = vector<tuple<ll,ll,ll>>(n+1);
  REP(i,n){
    ll t,x,y;
    cin >> t >> x >> y;
    v[i+1] = make_tuple(t,x,y);
  }
  v[0] = make_tuple(0,0,0);
  REP(i,n){
    ll t,x,y;
    t = get<0>(v[i+1]) - get<0>(v[i]);
    x = abs(get<1>(v[i]) - get<1>(v[i+1]));
    y = abs(get<2>(v[i]) - get<2>(v[i+1]));
    if ( t  < x+y) {
      cout << "No" << endl;
      return 0;
    }
    if ((t-(x+y))%2 != 0) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
#define ll long long
using namespace std;
signed main(){
  ll a[1000],b[1000],c=0;
  for(ll i=0;i<5;i++){
    cin>>a[i];
    if(a[i] % 10 == 0){
      b[i] = 0;
    }else{
      b[i] = 10 - (a[i] % 10);
    }
  }
  sort(b,b+5);
  for(ll i=0;i<5;i++){
    c += a[i] + b[i];
  }
  cout<<c-b[4]<<"\n";
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <ctype.h>
#include <string.h>

int main(){
	int H,W;
	long long L;
	char c[111][111];
	int memo[111][111][4];
	char dir[] = "ESWN";
	int dy[] = {0,1,0,-1};
	int dx[] = {1,0,-1,0};
	int y,x,d,step;
	int i,j,k;
	
	while(1){
		scanf("%d %d %lld",&H,&W,&L);
		if(H==0)return 0;
		
		for(i=0;i<=H+1;i++){
			for(j=0;j<=W+1;j++){
				c[i][j]='#';
			}
		}
		
		for(i=1;i<=H;i++){
			for(j=1;j<=W;j++){
				scanf(" %c",&c[i][j]);
				if(isalpha(c[i][j])){
					y=i,x=j;
					for(k=0;k<4;k++){
						if(dir[k]==c[i][j]) d=k;
					}
					c[i][j]='.';
				}
			}
		}
		
		/*for(i=0;i<=H+1;i++){
			for(j=0;j<=W+1;j++){
				printf("%c",c[i][j]);
			}
			printf("\n");
		}*/
		//printf("%d %d %d\n",y,x,d);
		
		memset(memo,-1,sizeof(memo));
		step=0;
		while(1){
			int ny,nx;
			//printf("%d %d %c\n",y,x,dir[d]);
			
			if(step == L){
				printf("%d %d %c\n",y,x,dir[d]);
				break;
			}
			
			if(memo[y][x][d]!=-1){
				long long cycle=step-memo[y][x][d];
				long long rest=(L-step)%cycle;
				//printf("LOOP\n");
				for(i=0;i<rest;i++){
					ny = y + dy[d];
					nx = x + dx[d];
					while(c[ny][nx] == '#'){
						d = (d+1) % 4;
						ny = y + dy[d];
						nx = x + dx[d];
					}
					y=ny,x=nx;
				}
				printf("%d %d %c\n",y,x,dir[d]);
				break;
			}
			memo[y][x][d] = step;
			
			ny = y + dy[d];
			nx = x + dx[d];
			while(c[ny][nx] == '#'){
				d = (d+1) % 4;
				ny = y + dy[d];
				nx = x + dx[d];
			}
			y=ny,x=nx;
			step++;
		}
	}
	
	return 0;
}

Measured memory_bytes: 1240
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < b; i++)
using namespace std;

int main() {
    int n, m;
    cin >> n >> m;

    vector<int> s(m), c(m);
    rep(i, 0, m) cin >> s[i] >> c[i];

    vector<int> ans(n, -1);
    rep(i, 0, m) {
        s[i]--;
        if (ans[s[i]] == -1) ans[s[i]] = c[i];
        else if (ans[s[i]] != c[i]) {
            cout << -1 << endl;
            return 0;
        }
    }
    
    if (ans[n - 1] == -1) ans[n - 1] = 0;
    if (ans[0] == -1) ans[0] = 1;
    rep(i, 0, n) if (ans[i] == -1) ans[i] = 0;

    if (n != 1 && ans[0] == 0) {
        cout << -1 << endl;
        return 0;
    }

    rep(i, 0, n) cout << ans[i];
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
s = input()[::-1]
a = ""
for i in range(len(s)):
    a = s[i] + a
    if a == "dreamer" or a == "dream" or a == "erase" or a == "eraser":
        a = ""
    #print(a)
if not a:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll> 
#define P pair<ll,ll>
#define rep(i,n) for(ll (i)=0; (i)<(n); ++(i))
#define print(a) cout << (a) << endl

ll mod=1e9+7;
ll com(ll N, ll K, ll L) {
  ll d=1,e = (L*K)%mod, m_ = mod-2;
  while(m_ != 0) {
    if (m_&1) d = (d*e)%mod;
    e = e*e%mod;
    m_ = m_ >> 1;
  }
  return (N*d)%mod;
}


int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n,k;cin>>n>>k;
  lvector frac(2010,1);
  for(ll i=1;i<2010;++i) frac[i]=(frac[i-1]*i)%mod;
  ll ans=n-k+1;print(ans);
  for(ll i=2;i<=k;++i) {
    ans=0;
    ll blue=com(frac[k-1],frac[i-1],frac[k-i]);
    ll red=n-k-(i-1);
    if(red>-1) {
      ll redpartition=com(frac[red+i],frac[i],frac[red]);
      ans=(blue*redpartition)%mod;
    }
    print(ans);
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
using namespace std;
struct po{int lx,ly,rx,ry;};
int w,h;
string mp[2][51];
int dx[4]={0,0,1,-1};
int dy[4]={1,-1,0,0};

bool bfs(int lx,int ly,int rx,int ry){
  bool visited[50][50][50][50]={};
  queue <po> Q;
  Q.push((po){lx,ly,rx,ry});
  while(!Q.empty()){
    po t=Q.front();Q.pop();
    lx=t.lx, ly=t.ly;
    rx=t.rx, ry=t.ry;
    int cnt=(mp[0][ly][lx]=='%')+(mp[1][ry][rx]=='%');
    if(visited[lx][ly][rx][ry]||cnt==1)continue;;
    if(cnt==2)return true;
    visited[lx][ly][rx][ry]=1;
    for(int i=0;i<4;i++){
      int flg=0;
      int nlx=lx+dx[i],nly=ly+dy[i];
      int nrx=rx-dx[i],nry=ry+dy[i];
      if(nlx<0||nly<0||nlx>=w||nly>=h||mp[0][nly][nlx]=='#')nlx=lx,nly=ly,flg++;
      if(nrx<0||nry<0||nrx>=w||nry>=h||mp[1][nry][nrx]=='#')nrx=rx,nry=ry,flg++;
      if(flg==2||visited[nlx][nly][nrx][nry])continue;
      Q.push((po){nlx,nly,nrx,nry});
    }
  }
  return false;
}

int main(){
  while(1){
    cin >>w>>h;
    if(!w&&!h)break;
    for(int i=0;i<h;i++)cin>>mp[0][i]>>mp[1][i];
    int lx,ly,rx,ry;
    for(int i=0;i<h;i++)
      for(int j=0;j<w;j++){
	if(mp[0][i][j]=='L')lx=j,ly=i;
	if(mp[1][i][j]=='R')rx=j,ry=i;
      }

    if(bfs(lx,ly,rx,ry))cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
  }
  return 0;
}

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

typedef pair<int, int> pii;
typedef long long ll;
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()
#define dump(x) cout << #x << " = " << (x) << endl
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

template<class T, class U> void chmin(T& t, const U& u) { if (t > u) t = u; }
template<class T, class U> void chmax(T& t, const U& u) { if (t < u) t = u; }

template<class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
    os<<"("<<p.first<<","<<p.second<<")";
    return os;
}

template<class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
    os<<"{";
    rep(i, v.size()) {
        if (i) os<<",";
        os<<v[i];
    }
    os<<"}";
    return os;
}

int main() {
    int N, A, B;
    cin >> N >> A >> B;
    cout << min(N * A, B) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<algorithm>
//#include<queue>
//#define d double
#define ll long long
#define ull unsigned long long
using namespace std;
const int maxn=1e5+233;
int a[maxn];
int i,j,k,n,m;

int ra,fh;char rx;
inline int read(){
	rx=getchar(),ra=0,fh=1;
	while(rx<48)rx=='-'&&(fh=-1),rx=getchar();
	while(rx>47)ra=ra*10+rx-48,rx=getchar();return ra*fh;
}



int main(){
	n=read();
	for(i=1;i<=n;i++)a[i]=read();
	sort(a+1,a+1+n);
	int l=1,r=n,mid;ll sz;
	while(l<r){
		mid=(l+r)>>1,sz=a[mid];
		for(i=1;i<=n;i++)if(i!=mid){if(sz*2<a[i])break;else sz+=a[i];}
		if(i>n)r=mid;else l=mid+1;
	}printf("%d\n",n-l+1);
}

Measured memory_bytes: 768
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<deque>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<iterator>
#include<complex>
#include<stack>
#include "stdio.h"
using namespace std;

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

using ll = long long;
using Pii = pair<int, int>;

const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const long long mod_const = 1e9+7;

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

using MIte = multimap<ll, ll, greater<ll> >::iterator;

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

using pll = pair<long long, long long>;



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

	int A, B;
	cin >> A >> B;

	if (A <= 9 && B <= 9) {
		cout << A * B << endl;
	}
	else {
		cout << "-1" << endl;
	}

	return 0;
}


Measured memory_bytes: 256
import heapq

def main():
    N, M, S = map(int, input().split())
    AB = [[] for _ in range(N)]
    maxA = 0
    for _ in range(M):
        u, v, a, b = map(int, input().split())
        AB[u - 1].append((a, b, v - 1))
        AB[v - 1].append((a, b, u - 1))
        maxA = max(maxA, a)
    for i in range(N):
        AB[i].sort()

    CD = [tuple(map(int, input().split())) for _ in range(N)]
    maxS = N * maxA
    cur = [(0, 0, S)]  # (time, station, silver)
    T = [-1] * N
    tc = N
    P = [-1] * N
    while tc:
        t, u, s = heapq.heappop(cur)
        if s <= P[u]:
            continue
        P[u] = s
        if T[u] == -1:
            T[u] = t
            tc -= 1
        for a, b, v in AB[u]:
            if s < a:
                break
            if P[v] < s - a:
                heapq.heappush(cur, (t + b, v, s - a))
        if s != maxS:
            c, d = CD[u]
            min_a = AB[u][0][0]
            k = max(1, (min_a - s + c  - 1) // c)
            heapq.heappush(cur, (t + k * d, u, min(s + k * c, maxS)))
    print('\n'.join(map(str, T[1:])))

main()


Measured memory_bytes: 71196
function Main(input) {
  const data = input.split(' ');
  return (parseInt(data[0]) / parseInt(data[2]) <= parseInt(data[1])) ? 'Yes' : 'No';
}

async function readline() {
  return new Promise((resolve, reject) => {
    const reader = require('readline').createInterface({
      input: process.stdin,
      output: process.stdout
    });
    reader.on('line', line => {
      resolve(line)
    });
  });
}

(async () => {
  console.log(Main(await readline()));
})();

Measured memory_bytes: 30936
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Long a=sc.nextLong();
		Long b=sc.nextLong();
		Long k=sc.nextLong();
		Long ansA=max(0L,a-k);
		Long ansB=ansA!=0?b:max(0L,b-(k-a));
		print(ansA+" "+ansB);
	}
	
	private static int min(int a, int b) {
		return a<b?a:b;
	}
	
	private static Long min(Long a, Long b) {
		return a<b?a:b;
	}
	
	private static int max(int a, int b) {
		return a>b?a:b;
	}
	
	private static Long max(Long a, Long b) {
		return a>b?a:b;
	}
	
	private static void print(String s) {
		System.out.println(s);
	}

}


Measured memory_bytes: 21844
#include <stdio.h>

int main(void) {
	int A1, A2, A3;
	if (scanf("%d%d%d", &A1, &A2, &A3) != 3) return 1;
	puts(A1 + A2 + A3 >= 22 ? "bust" : "win");
	return 0;
}


Measured memory_bytes: 128
#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <tuple>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <complex>
#include <iterator>
#include <array>
#include <memory>
#include <stack>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<double,double>pdd;
typedef pair<ll,ll>pll;
int main(){
    int n;
    while(cin>>n,n){
        vector<pii> ujimatsu(n,pii(0,0));
        vc anko(n);
        rep(i,n){
            cin>>anko[i];
            rep(j,n-1){
                int tiya; cin>>tiya;
                if(tiya==0)ujimatsu[i].first+=100000000;
                else if(tiya==1)ujimatsu[i].second+=1;
                else if(tiya==2)ujimatsu[i].first+=1;
            }
        }
        vector<bool>flag(1000,true);
        rep(i,n){
            int maxi=-INF;
            int ans=0;
            rep(j,n){
                if(!flag[j])continue;
                if(ujimatsu[j].first>maxi){
                    maxi=ujimatsu[j].first;
                    ans=j;
                }else if(ujimatsu[j].first==maxi){
                    if(ujimatsu[ans].second>ujimatsu[j].second){
                        ans=j;
                    }
                }
            }
            flag[ans]=false;
            cout<<anko[ans]<<endl;
        }
    }
}

Measured memory_bytes: 3016
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => { let $var = read_value!($iter, $t); input_inner!{$iter $($r)*} }; }
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
#[warn(dead_code)]
fn sieve_of_eratosthenes(n: usize) -> Vec<usize> {
    // spf:
    // store smallest prime factor of number
    // 最小の素因数を格納
    // is_prime:
    // 配列番号が素数であるかどうかを示す
    let mut spf = vec![None; n + 1];
    let mut is_prime = vec![true; n + 1];
    let mut primes = Vec::new();

    // 0 と 1 は素数ではない
    is_prime[0] = false;
    is_prime[1] = false;

    for i in 2..n + 1 {
        // is_prime[i]:
        // それ以下の素数で割り切られていなければ True となる
        if is_prime[i] {
            // この if 文より i は素数なので
            primes.push(i);

            // 素数はそれ自身の最も小さい素因数であるから
            spf[i] = Some(i);
        }

        // 全ての prime の倍数(prime * i)を取り除く
        for prime in &primes {
            // prime が i の最も小さい因数よりも大きくなってしまったら探索終了
            if i * prime >= n + 1 || prime > &spf[i].unwrap() {
                break;
            }

            is_prime[i * prime] = false;

            // i * primes[j] の最も小さい素数は primes[j] 自身
            spf[i * prime] = Some(*prime);
        }
    }
    primes
}
use std::cmp::Ordering;
#[derive(Eq, PartialEq, Clone, Debug)]
pub struct Rev<T>(pub T);

impl<T: PartialOrd> PartialOrd for Rev<T> {
    fn partial_cmp(&self, other: &Rev<T>) -> Option<Ordering> {
        other.0.partial_cmp(&self.0)
    }
}

impl<T: Ord> Ord for Rev<T> {
    fn cmp(&self, other: &Rev<T>) -> Ordering {
        other.0.cmp(&self.0)
    }
}
fn gcd(a: u64, b: u64) -> u64 {
    if b == 0 {
        a
    } else {
        gcd(b, a % b)
    }
}
fn lcm(a: u64, b: u64) -> u64 {
    a / gcd(a, b) * b
}

#[warn(unused_mut)]
#[warn(unused_imports)]
use std::collections::BTreeSet;
fn main() {
    input! {
        a: u64,
        b: u64,
    }
    println!("{}", lcm(a, b));
}


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

int main() {

 string s;
  cin >> s;
  
  if(s == "AAA")
    cout << "No" << endl;
  
  else if(s == "BBB")
    cout << "No" << endl;
  
  else
    cout << "Yes" << endl;
  
}
    

Measured memory_bytes: 256
extern crate proconio;
use proconio::input;

fn main() {
    input! {
        n: usize,
        d: i64,
        pts: [(i64, i64); n],
    }

    println!(
        "{}",
        pts.iter()
            .filter(|(x, y)| x * x + y * y <= d * d)
            .collect::<Vec<_>>()
            .len()
    );
}


Measured memory_bytes: 9032
#include<algorithm>
#include<cstring>
#include<stdio.h>
#include<iostream>
using namespace std;
unsigned long long a[101];
unsigned long long gcd(unsigned long long x,unsigned long long y){
    if(y==0) return x;
    else return gcd(y,x%y);
}
int main(){
    int n;
    scanf("%d",&n); 
    for(int i=1;i<=n;++i){
        scanf("%lld",&a[i]);
}
    for(int i=2;i<=n;++i){
        a[i]=a[i]/gcd(a[i],a[i-1])*a[i-1];
    }
    printf("%lld\n",a[n]);
    return 0;
}


Measured memory_bytes: 256
import sys,collections
sys.setrecursionlimit(10**7)
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def Ss(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

x,y,z = Is()

print((x-z) // (y+z))


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

typedef long long ll;

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define ANS(n) cout << (n) << endl

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORR(i,a,b) for(int i=(a);i>=(b);i--)

#define ALL(obj) (obj).begin(),(obj).end()

#define pii pair<int,int>

#define pb(a) push_back(a)
#define mp make_pair

int main()
{
	int n;
	cin >> n;
	vector<int> xSorted(n);
	int x[n];
	FOR(i,0,n){
		cin >> x[i];
		xSorted[i] = x[i];
	}
	sort(ALL(xSorted));
	int a = xSorted[n/2-1];
	int b = xSorted[n/2];
	FOR(i,0,n){
		if(x[i] <= a){
			ANS(b);
		}else{
			ANS(a);
		}
	}
	return 0;
}


Measured memory_bytes: 3712
import java.util.Scanner;
/**
 * Created by maxmo on 19.06.2017.
 */
public class Main {
    public static void main(String[] args){
        Scanner s = new Scanner(System.in);
        int a = s.nextInt();
        int b = s.nextInt();

        System.out.println((a + b >= 10)? "error" : a + b);
    }
}

Measured memory_bytes: 21716
using System;
using System.Linq;
namespace Myatcoder
{
    public class Node 
    {
        public string Mark { set; get; }
        public int Num { set; get; }
    }

    public class Program
    {
        public static void Main()
        {
            string str = Console.ReadLine();
            int ans = 0;
            for (int i = 0; i < str.Length; i++) {
                if (str[i] == '+') ans++;
                else if (str[i] == '-') ans--;
                else Console.WriteLine("error");
            }
            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 11092
#include <iostream>
#include <vector>
using namespace std;
typedef long long int ll;

const ll MOD = 1e9 + 7;

ll mod(ll x){
	x %= MOD;
	return x;
}

ll pow(ll x,ll n){
	if(n==0)return 1;
	ll t=pow(x,n/2);
	t=mod(t*t);
	if(n%2) t=mod(t*x);
	return t;
}

int main()
{
	ll n,k; cin>>n>>k;
	vector<ll> a(n);
	for(ll i=0;i<n;i++) cin>>a[i];

	vector<ll> l(n,0),r(n,0);
	
	for(ll i=0;i<n;i++){
		for(ll j=i+1;j<n;j++){
			if(a[j]>a[i]) r[i]++;
		}
	}

	for(ll i=n-1;i>=0;i--){
		for(ll j=i-1;j>=0;j--){
			if(a[j]>a[i]) l[i]++;
		}
	}
	ll ans=0;
	for(ll i=0;i<n;i++){
		ans = mod(ans + (k+1)*l[i]);
		ans = mod(ans + (k-1)*r[i]);
	}

	ans = mod(ans*k);

	ans = mod(ans*pow(2,MOD-2));

	cout<<ans;

}

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

//入力整数の桁数を求める
int keta(int x){
    int k=1;
    while(x >= 10){
        x /= 10;
        k++;
    }
    return k;
}

//10の階乗を計算をする
int ten(int x){
    int ans =1;
    for(int i=0;i<x;i++){
        ans *= 10;
    }
    return ans;
}

int s(int x){
    int origin,ket,sum=0;
    ket = keta(x);
    for(int i=0; i<ket ;i++){
        
        origin = x;
        x /= ten(ket-(i+1));
        sum += x;
        x = origin - x * ten(keta(origin)-1);
        if(keta(origin)-keta(x)>1){
            i++;
        }
        
    }
    return sum;

}
int main(){
    int n;
    cin >> n;
    if(n%s(n) == 0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
x,y = gets.split(' ').map(&:to_f)
c = y - 2 * x
b=0
anser = 'No'
anser = while true do
          break 'No' if b < 0 || b > x
          break 'Yes' if (c ==0 && b ==0) || b == c/2
          b+=1
        end
puts anser


Measured memory_bytes: 14264
using System;
using System.Collections.Generic;
using System.Text;

namespace AtTest.C_Challenge
{
    class ABC_083
    {
        static void Main(string[] args)
        {
            Method(args);
            Console.ReadLine();
        }

        static void Method(string[] args)
        {
            long[] xy = ReadLongs();
            int cnt = 0;
            long val = xy[0];
            do
            {
                cnt++;
                val *= 2;
            }
            while (val <= xy[1]);
            Console.WriteLine(cnt);
        }

        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 11092
n = int(input())
hs = list(map(int, input().split()))
maxh = max(hs)
hs.append(0)
t = 0
for i in range(maxh):
    c = 0
    for j, h in enumerate(hs):
        if c == 0 and i + 1 <= h:
            c = 1
            continue
        if c == 1 and i + 1 > h:
            t += c
            c = 0
print(t)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#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 erep(i,a,n) for(int i = a;i<=n;i++)
typedef long long ll;
#define int long long
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstring vector<string>
#define vdouble vector<double>
#define vll vector<ll>:
#define vbool vector<bool>
#define INF 1101010101010101010
#define MOD 1000000007
#define P pair<int,int>
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; }

signed main(){
  int h,w,k;
  cin >> h >> w >> k;
  vstring mass(h);
  rep(i,0,h) cin >> mass[i];
  vint id(h);
  int ans = INF;
  for(int i = 0;i < 1<<(h-1);i++){
    int g = 0;
    rep(j,0,h){
      id[j] = g;
      if(i>>j&1) g++;
    }
    g++;
    vvint idmass(g,vint(w));
    rep(j,0,h){
      rep(s,0,w){
        idmass[id[j]][s] += mass[j][s] - '0'; 
      }
    }
    bool ok = true;
    rep(j,0,g){
      rep(s,0,w){
        if(idmass[j][s] > k) ok = false;
      }
    }
    if(!ok) continue;
    int num = g-1;
    vint check(g);
    auto add = [&](int a){
      rep(j,0,g){
        check[j] += idmass[j][a];
      }
      rep(j,0,g){
        if(check[j] > k) return false;
      }
      return true;
    };
    rep(j,0,w){
      if(!add(j)){
        // cout << j << endl;
        num++;
        check = vector<int>(g);
        add(j);
      }
    }
    // cout << i << " " << num << endl;
    ans = min(num,ans);
  }
  cout << ans << endl;
}

Measured memory_bytes: 384
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;

#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

#[allow(dead_code)]
fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

struct UnionFind{
    v: Vec<usize>
}

impl UnionFind{
    fn new(n: usize) -> UnionFind{
        let mut v: Vec<usize> = Vec::new();
        for i in 0..n{
         v.push(i);
        }
        UnionFind{v:v}
    }

    fn find(&mut self, i: usize) -> usize{
        if self.v[i] == i{
            i
        }else{
            let ni = self.v[i];
            self.v[i] = self.find(ni);
            self.v[i]
        }
    }

    fn union(&mut self, i: usize, j: usize){
        let root_i = self.find(i);
        let root_j = self.find(j);
        self.v[root_i] = root_j;
    }

}

struct CombMod{
    fac: Vec<u64>,
    inv: Vec<u64>,
    finv: Vec<u64>,
    mmod: u64,
}

impl CombMod{
    pub fn new(max: u64, m: u64) -> CombMod{
        let max: usize = max as usize;
        let mut fac: Vec<u64> = vec![0;max+1];
        let mut finv: Vec<u64> = vec![0;max+1];
        let mut inv: Vec<u64> = vec![0;max+1];

        fac[0] = 1;
        fac[1] = 1;
        finv[0] = 1;
        finv[1] = 1;
        inv[1] = 1;

        for i in 2..max+1{
            fac[i] = fac[i-1] * i as u64 % m;
            inv[i] = m - inv[m as usize %i] * (m/(i as u64)) % m;
            finv[i] = finv[i-1] * inv[i] % m;
        }

        CombMod{
            fac: fac,
            finv: finv,
            inv: inv,
            mmod: m,
        }
    }

    fn get(&self, n: u64, m: u64) -> u64{
        assert!(n >= m && n != 0 && m != 0);
        self.fac[n as usize] * self.finv[m as usize] % self.mmod
            * self.finv[(n-m) as usize] % self.mmod
    }
}

fn main(){
    let n = read_as_vec::<usize>()[0];

    let slimes = read_as_string();

    let mut cur_color = 'D';
    let mut ans = 0;
    for ch in slimes.chars(){
        if ch != cur_color{
            ans += 1;
            cur_color = ch;
        }
    }

    println!("{}", ans);

}


Measured memory_bytes: 4352
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <iostream>
using namespace std;

int main() {
	//step=0 ru
	//step=1 lu
	//step=2 rd
	//step=3 ld

	int n, step, cnt;
	char in[3];
	while (1) {
		step = -1;
		cnt = 0;
		scanf("%d", &n);
		if (n == 0)
			break;
		for (int i = 0; i < n; i++) {
			if (i == n - 1)
				scanf("%s", &in);
			else
				scanf("%s ", &in);
			if (in[0] == 'r'&&in[1] == 'u') {
				if (step == 1) {
					cnt++;
					step = -1;
				}
				else
					step = 0;
			}
			if (in[0] == 'l'&&in[1] == 'u') {
				if (step == 0) {
					cnt++;
					step = -1;
				}
				else
					step = 1;
			}
			if (in[0] == 'r'&&in[1] == 'd') {
				if (step == 3) {
					cnt++;
					step = -1;
				}
				else
					step = 2;
			}
			if (in[0] == 'l'&&in[1] == 'd') {
				if (step == 2) {
					cnt++;
					step = -1;
				}
				else
					step = 3;
			}
		}
		printf("%d\n", cnt);
	}
	return 0;
}


Measured memory_bytes: 3228
s=input()
l=len(s)
ans=[1]*l
for i in range(l-2):
  if s[i]=="R" and s[i+1]=="R":
    ans[i+2]+=ans[i]
    ans[i]=0
for i in range(l-1,0,-1):
  if s[i]=="L" and s[i-1]=="L":
    ans[i-2]+=ans[i]
    ans[i]=0
print(*ans)

Measured memory_bytes: 47684
command = input().split()

nlist = []

for c in command:
    if c == "+":
        ans = nlist[-2] + nlist[-1]
        nlist.pop(-1)
        nlist.pop(-1)
        nlist.append(ans)
    elif c == "-":
        ans = nlist[-2] - nlist[-1]
        nlist.pop(-1)
        nlist.pop(-1)
        nlist.append(ans)
    elif c == "*":
        ans = nlist[-2] * nlist[-1]
        nlist.pop(-1)
        nlist.pop(-1)
        nlist.append(ans)
    else:
        nlist.append(int(c))

print(nlist[0])



Measured memory_bytes: 5600
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a,b;
  cin>>a>>b;
  if(a==1) a=14;
  if(b==1) b=14;
  if(a>b){
    cout<<"Alice"<<endl;
  }else if(a<b){
    cout<<"Bob"<<endl;
  }else{
    cout<<"Draw"<<endl;
  }
}


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

int main()
{
  int N;scanf("%d",&N);
  int a[N],ans=0;
  for(int i=0;i<N;i++){scanf("%d ",&a[i]);a[i]--;}
  for(int i=0;i<N;i++)if(a[a[i]]==i)ans++;
  printf("%d\n",ans/2);
}

Measured memory_bytes: 4152
N, M = map(int, input().split())
e = []
for _ in range(N):
    a, b = map(int, input().split())
    e.append([a, b])

e = list(sorted(e, key=lambda x: x[0]))
# 安値から

cost = 0
cnt = M
e_i = 0
while cnt > 0:
    can_buy = min(cnt, e[e_i][1])
    # 必要本数か売っている本数のうち少ない方

    cost += can_buy * e[e_i][0]
    e[e_i][1] -= can_buy
    cnt -= can_buy
    if e[e_i][1] == 0:
        e_i += 1

print(cost)


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

using namespace std;

const int MX = 100000, md = 1000000007;

int x[MX];

int main() {
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; i++) scanf("%d", x + i);
	
	int cnt = 0, ans = 1;
	for (int i = 0; i < n; i++) {
		cnt++;
		while (cnt > (x[i] + 1) / 2) {
			ans = (ans * 1ll * cnt) % md;
			cnt--;
		}
	}
	
	while (cnt > 0) {
		ans = (ans * 1ll * cnt) % md;
		cnt--;
	}
	
	printf("%d\n", ans);
	
	return 0;
}


Measured memory_bytes: 640
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * y / gcd(x, y); }

long mod = 10^^9 + 7;
//long mod = 998244353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto W = RD;
	auto H = RD;
	auto x = RD;
	auto y = RD;

	double ans1 = W * H / 2.0;
	long ans2   = x == (W / 2.0) && y == (H / 2.0) ? 1 : 0;
	writeln(ans1, " ", ans2);
	stdout.flush();
	debug readln();
}

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

int main(){
  string s,t,u;
  cin >> s;
  int y,m;

  t=s[0];
  t=t+s[1];

  u=s[2];
  u=u+s[3];

  m=stoi(t);
  y=stoi(u);

  if(m>=1 && m<=12){
    if(y>=1 && y<=12){
      cout << "AMBIGUOUS" << endl;
    }
    else if(y>12 || y==0){
      cout << "MMYY" << endl;
    }
  }
  else if(y>=1 && y<=12){
    if(m>12 || m==0){
      cout << "YYMM" << endl;
      }
  }
  else{
    cout << "NA" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <iomanip>
using namespace std;
typedef long long ll;
int INF=1<<29;

int main(){
	ios::sync_with_stdio(false);
	int R,G,B,N,ans=0;
	cin>>R>>G>>B>>N;
	for(int i=0;i<=N/R;i++){
		for(int j=0;j<=(N-R*i)/G;j++){
			if( (N-(R*i+G*j))%B==0 ) ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}



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

using namespace std;

int mark[10],n,m,ans;



void dfs(int d,int sum,int last) {
	if (d == n)  {
		if(sum==m) ans++;
		return;
	}
	else if (sum > m) return;
	for (int i = last; i < 10; i++) {
		dfs(d + 1, sum + i, i + 1);
	}
}
int main() {
	while(1){
		cin >> n >> m;
		if (n == m && n == 0) return 0;
		ans = 0;
		dfs(0, 0, 0);
		cout << ans <<endl;
	}
}


Measured memory_bytes: 2992
#include <iostream>
#include <string>
#include <algorithm>
#define rep(i, n) for(long long i = 0;(i) < (n);(i)++)
using namespace std;
using ll = long long;


ll N;
ll K;
ll Q;
ll a[100000];
ll sco[100000];
ll ans[100000];

int main()
{
	rep(i, N)
	{
		sco[i] = 0;
	}
	cin >> N >> K >> Q;
	rep(i, Q)
	{
		cin >> a[i];
		sco[a[i] - 1]++;
	}
	ll M = -1000000000;
	rep(i, N)
	{
		M = max(M, sco[i]);
	}
	rep(i, N)
	{
		if (M - sco[i] + (Q - M)>= K)
		{
			cout << "No" << endl;
		}
		else cout << "Yes" << endl;
	}
	return 0;
}

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

int main(){
	int n,ans=0;
	cin >> n;
	vector<int> h(n),c(n,0);
	for(auto &x:h)cin>>x;
	for(int i=0;i<n-1;i++){
		c[i] = h[i]>=h[i+1];
	}
	for(int i=n-1;i>=0;i--){
		c[i] = c[i]*(1+c[i+1]);
		ans = max(ans,c[i]);
	}
	cout << ans << endl;
}

Measured memory_bytes: 1024
n = int(input())
numbers = list(map(int, input().split()))

def checkCondition():
  for i in range(n-1):
    if numbers[i] > numbers[i+1]:
      if numbers[i] - numbers[i+1] > 1:
        return False
  for i in range(-1, -n, -1):
    if numbers[i-1] - numbers[i] == 1:
      numbers[i-1] -= 1
    elif numbers[i-1] - numbers[i] > 1:
      return False
  return True

if n == 1:
  print('Yes')
else:
  if checkCondition():
    print('Yes')
  else:
    print('No')

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

int main()
{
  int N;
  cin >> N;
  
  vector<int> a;
  rep(i, N)
  {
    int tmp;
    cin >> tmp;
    a.push_back(tmp);
  }
  
  sort(a.begin(), a.end(), greater<int>());
  
  int Alice = 0;
  int Bob = 0;
  rep(i, N)
  {
    if (0 == i % 2)
    {
      Alice += a[i];
    }
    else
    {
      Bob += a[i];
    }
  }
  
  cout << Alice - Bob << endl;

  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>


int main(void) {

	// 1_6-D Matrix Vector Multiplication

	int i,j,k;
	int n,m,wk;
	int va[100][100];
	int vb[100];
	int vans[100];
	
	scanf("%d %d",&n,&m);
	
	for(i=0; i<n; i++){
		for(j=0; j<m; j++){
			scanf("%d",&wk);
			va[i][j] = wk;
		}
	}
	for(i=0; i<m; i++){
		scanf("%d",&wk);
		vb[i] = wk;
	}

	for(i=0; i<n; i++){
		wk = 0;
		for(j=0; j<m; j++){
			wk = wk + (va[i][j] * vb[j]);
		}
		vans[i] = wk;
	}

	for(i=0; i<n; i++){
		printf("%d\n",vans[i]);
	}
        return 0;
}

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

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);

const int MAX_H = (int)(1e2 + 5);
const int MAX_W = (int)(1e1 + 5);
const ll MOD = (ll)(1e9 + 7);

int h, w, k;

ll dp[MAX_H][MAX_W];
bool arr[MAX_W];
int retain = 0, ls = 1, rs = 2;
ll mv[MAX_W][3];

ll ans;

bool check() {
  for (int l = 1; l <= w - 1; ++l) {
    if (arr[l] && arr[l + 1]) {
      return false;
    }
  }

  return true;
}

int main(void) {
  // Here your code !
  scanf("%d %d %d", &h, &w, &k);

  arr[0] = false;  // guard

  for (int k = 0; k < 1 << (w - 1); ++k) {
    for (int l = 0; l < w - 1; ++l) {
      arr[l + 1] = (k >> l & 1) ? true : false;
    }

    if (!check()) continue;  // in-valid pattern

    for (int j = 1; j <= w; ++j) {
      if (arr[j]) {
        mv[j][rs] += 1;
      } else if (arr[j - 1]) {
        mv[j][ls] += 1;
      } else {
        mv[j][retain] += 1;
      }
    }
  }

  dp[0][1] = 1LL;

  for (int i = 0; i < h; ++i) {
    for (int j = 1; j <= w; ++j) {
      if (j == 1) {
        dp[i + 1][j] += dp[i][j] * mv[j][retain];
        dp[i + 1][j + 1] += dp[i][j] * mv[j][rs];
      } else if (j == w) {
        dp[i + 1][j] += dp[i][j] * mv[j][retain];
        dp[i + 1][j - 1] += dp[i][j] * mv[j][ls];
      } else {
        dp[i + 1][j] += dp[i][j] * mv[j][retain];
        dp[i + 1][j + 1] += dp[i][j] * mv[j][rs];
        dp[i + 1][j - 1] += dp[i][j] * mv[j][ls];
      }

      dp[i + 1][j] %= MOD;
      dp[i + 1][j + 1] %= MOD;
      dp[i + 1][j - 1] %= MOD;
    }
  }

  ans = dp[h][k];

  printf("%lld\n", ans);

  return 0;
}


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

int CountOfDigits(long long n) {
  int sum = 0;
  while (n > 0) {
    sum++;
    n /= 10;
  }
  return sum;
}

int main() {
  long long N;
  cin >> N;

  int ans = CountOfDigits(N);
  for (long long i = 1LL; i * i <= N; i++) {
    if (N % i == 0) {
      int ADigits = CountOfDigits(i);
      int BDigits = CountOfDigits(N / i);
      int res = max(ADigits, BDigits);
      ans = min(ans, res);
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
//Never stop trying
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

typedef string str;
typedef long long ll;
#define int ll
typedef double db;
typedef long double ld;
typedef pair<int, int> pi;
#define fi first
#define se second
typedef vector<int> vi;
typedef vector<pi> vpi;
typedef vector<str> vs;
typedef vector<ld> vd;
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define endl "\n"

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)

const int MOD = 1e9 + 7; //998244353
const ll INF = 1e18;
const int MX = 2e5 + 10;
const int nx[4] = {0, 0, 1, -1}, ny[4] = {1, -1, 0, 0}; //right left down up

template<class T> using V = vector<T>;
template<class T> bool ckmin(T& a, const T& b) { return a > b ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

ll cdiv(ll a, ll b) { return a / b + ((a ^ b) > 0 && a % b); } // divide a by b rounded up
constexpr int log2(int x) { return 31 - __builtin_clz(x); } // floor(log2(x))

#define dbg(x) cerr << " - " << #x << " : " << x << endl;
#define dbgs(x,y) cerr << " - " << #x << " : " << x << " / " << #y << " : " << y << endl;
#define dbgv(v) cerr << " - " << #v << " : " << endl << "[ "; for(auto it : v) cerr << it << ' '; cerr << ']' << endl;

void IO() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}


int32_t main() {
	boost; IO();

	int N; cin>>N;
	vi x(N),y(N);
	FOR(i,0,N) cin>>x[i]>>y[i];

	FOR(i,0,N-2){
		if(x[i]==y[i] && x[i+1]==y[i+1] && x[i+2]==y[i+2]){
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;



	return 0;
}

/* Careful!!!
	.Array bounds
	.Infinite loops
	.Uninitialized variables / empty containers
	.Order of input

   Some insights:
	.Binary search
	.Graph representation
	.Write brute force code
	.Change your approach
*/


Measured memory_bytes: 3652
n, a, b = map(int, input().split())
#combination

mod = 10**9+7

ans = pow(2, n, mod) - 1

c = 1
for i in range(a):
    c *= (n-i)
    c *= pow(i+1, mod-2, mod)
    c %= mod

ans -= c
c = 1
for i in range(b):
    c *= (n-i)
    c *= pow(i+1, mod-2, mod)
    c %= mod

ans -= c
ans += 2*(10**9+7)

print(ans%mod)


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

// TYPEDEF
// ----------------------------------------
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> Pair;
typedef vector<ll> vll;
typedef vector<vector<ll>> Graph;
typedef vector<string> vs;
typedef vector<pair<ll, ll>> Pll;
typedef queue<ll> qll;

// REPEAT
// ----------------------------------------
#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 REPA(i,a) for(ll i=0;i<(ll)(a.size());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--)
#define COUT(a) cout << (a) << endl;
#define ENDL(a) cout << endl;
#define COUTA(i,a) for(ll i=0;i<(ll)(a.size());i++) {cout << (a)[i] << " ";} cout << endl;

// UTIL
// ----------------------------------------
#define pb push_back
#define paired make_pair
#define ALL(a) (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define RSORT(a) sort((a).rbegin(), (a).rend())

// DEBUG
// ----------------------------------------
#ifdef _DEBUG
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
#else
#define debug(x)
#endif

template <typename T>
void debugV(const vector<T> v) {
#ifdef _DEBUG
  rep(i, v.size()) {
    cout << i << ":" << v[i] << " ";
  }
  cout << endl;
#else
  (void)v;
#endif
}

// BIT FLAG
// ----------------------------------------
const unsigned int BIT_FLAG_0 = (1 << 0); // 0000 0000 0000 0001
const unsigned int BIT_FLAG_1 = (1 << 1); // 0000 0000 0000 0010
const unsigned int BIT_FLAG_2 = (1 << 2); // 0000 0000 0000 0100
const unsigned int BIT_FLAG_3 = (1 << 3); // 0000 0000 0000 1000
const unsigned int BIT_FLAG_4 = (1 << 4); // 0000 0000 0001 0000
const unsigned int BIT_FLAG_5 = (1 << 5); // 0000 0000 0010 0000
const unsigned int BIT_FLAG_6 = (1 << 6); // 0000 0000 0100 0000
const unsigned int BIT_FLAG_7 = (1 << 7); // 0000 0000 1000 0000
const unsigned int BIT_FLAG_8 = (1 << 8); // 0000 0001 0000 0000
const unsigned int BIT_FLAG_9 = (1 << 9); // 0000 0010 0000 0000
const unsigned int BIT_FLAG_10 = (1 << 10); // 0000 0100 0000 0000
const unsigned int BIT_FLAG_11 = (1 << 11); // 0000 1000 0000 0000

// CONST
// ----------------------------------------
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr double PI=3.14159265358979323846; // or M_PI
constexpr int MOD = 1000000007;


void Main() {
  string s;
  ll n;

  cin >> n >> s;
  if (n % 2 != 0) {
    COUT("No");
    return;
  }
  else {
    REP(i, n/2) {
      if (s[i] != s[i + n/2]) {
        COUT("No");
        return;
      }
    }
  }
  COUT("Yes");


}

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

/*

3 2
*/


Measured memory_bytes: 3624
#include <iostream>
#include <iomanip>
#include <math.h>

using namespace std;

int main(){
    long n,k,i,s,c;
    cin>>n>>k;
    double d=0;
    for(i=1;i<=n;i++){
        c=0;
        s=i;
        while(s<k){
            s*=2;
            c++;
        }
        d+=1/(n*pow(2,c));
    }
    cout<<setprecision(12)<<d;
    return 0;
}


Measured memory_bytes: 256