akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()

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

    int N;
    cin >> N;
    cout << 0 << endl;
    string res;
    cin >> res;
    if (res == "Vacant") return 0;
    int lb = 0, ub = N;
    string prev_res = res;
    int prev_loc = 0;
    REP(i, 20) {
        int m = (lb + ub) / 2;
        cout << m << endl;
        string cur;
        cin >> cur;
        if (cur == "Vacant") break;
        if (prev_loc == lb) {
            if (((m - lb) % 2 == 0) ^ (prev_res == cur)) {
                ub = m;
            } else {
                lb = m;
            }
        } else {
            if (((ub - m) % 2 == 0) ^ (prev_res == cur)) {
                lb = m;
            } else {
                ub = m;
            }
        }
        prev_res = cur;
        prev_loc = m;
    }
}


Measured memory_bytes: 852
#include <bits/stdc++.h>
#define cout16 cout << setprecision(16) 
#define rep(i,n) for(int i=0;i<n;i++ )
#define rep2(i,f,n) for(int i=f;i<n;i++ )
#define SORT(A) sort(A.begin(),A.end())
#define REV(A) reverse(A.begin(),A.end())
typedef long long int ll;
using vi = std::vector<int>;
using vvi = std::vector<std::vector<int>>;
using vll = std::vector<ll>;
using vvll = std::vector<std::vector<ll>>;
using P = std::pair<int,int>;
using vp = std::vector<P>;
using namespace std;
#define INF 1001001001
#define LL_INF 1001001001001001001
#define fi first
#define se second

int main(void) {
	int n,m; cin >> n >> m;
	int ans = n*(n-1)/2 + m*(m-1)/2;
	cout << ans	<< endl;

}




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

using namespace std;

int main(int argc, char *argv[]) {
	int N;
	cin >> N;
	vector<int> a(N+1);
	for (int i = 1; i <= N; i++) cin >> a[i];

	int ans = 0;
	for (int i = 1; i <= N; i++) {
		if (i == a[i] && i + 1 == a[i+1]) {
			ans++;
			i++;
		} else if (i == a[i] && i + 1 != a[i+1]) {
			ans++;
		}
	}

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

Measured memory_bytes: 640
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

typedef long long int int64;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))

typedef struct dpoint{
  int x,y;
} point;

void isort(point *a,int n){
  int i,j;
  for(i=1;i<n;i++){
    point t=a[i];
    j=i-1;
    while(j>=0 && t.x<a[j].x){
      a[j+1]=a[j];
      j--;
    }
    a[j+1]=t;
  }
  return;
}

void run(void){
  int n;
  scanf("%d",&n);
  point *a=(point *)malloc(sizeof(point)*n);
  point *b=(point *)malloc(sizeof(point)*n);
  int i;
  for(i=0;i<n;i++){
    int x,y;
    scanf("%d%d",&x,&y);
    a[i].x=x;
    a[i].y=y;
  }
  for(i=0;i<n;i++){
    int x,y;
    scanf("%d%d",&x,&y);
    b[i].x=x;
    b[i].y=y;
  }
  isort(a,n);
  isort(b,n);
  int cnt=0;
  for(i=n-1;i>=0;i--){
    int j;
    for(j=0;j<n;j++){
      if(a[i].x<b[j].x && a[i].y<b[j].y) break;
    }
    if(j==n) continue;
    int min=j;
    for(j=min+1;j<n;j++){
      if(a[i].y<b[j].y && b[min].y>b[j].y) min=j;
    }
    cnt++;
    b[min].y=-1;
  }
  printf("%d\n",cnt);
  return;
}

int main(void){
  run();
  return 0;
}


Measured memory_bytes: 128
# int(input()) # 入力が1つ
from collections import deque
n, m = map(int, input().split()) # 入力が複数
# [int(i) for i in input().split()] # 配列で数字

graph = [[] for _ in range(n)]
for _ in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    graph[a].append(b)
    graph[b].append(a)

def bfs(graph, n, start):
    visited = [False] * n
    visited[start] = True
    que = deque([start])
    count = 1
    ans = [None] * n
    while que:
        root = que.popleft()
        for node in graph[root]:
            if not visited[node]:
                visited[node] = True
                que.append(node)
                if not ans[node]:
                    ans[node] = root
    result = all(visited)
    return result, ans

r, ans = bfs(graph, n, 0)
if r:
    print('Yes')
    for a in ans[1:]:
        print(a + 1)
else:
    print('No')


Measured memory_bytes: 34868
#include<bits/stdc++.h>
#define _LIBCPP_DEBUG 0
using namespace std;
typedef long long int ll;
ll MOD = 1e9 + 7;
int INF = 1 << 30;

int main(void){

    int S,W; cin>>S>>W;

    if(W >= S){
        cout<<"unsafe"<<endl;
    } else{
        cout<<"safe"<<endl;
    }


}


Measured memory_bytes: 3592
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UncheckedIOException;
import java.util.ArrayDeque;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) {
		SC sc = new SC(System.in);
		int N=sc.nextInt();
		ArrayDeque<Integer> TF=new ArrayDeque<Integer>();
		for(int i=0; i<N; i++) {
			String tmp=sc.next();
			if(tmp.charAt(0)=='T') {
				TF.addLast(1);
			}
			else {
				TF.addLast(0);
			}
		}
		while(TF.size()>1) {
			int a=TF.remove();
			int b=TF.remove();
			if(a==1 && b==0) {
				TF.addFirst(0);
			}
			else {
				TF.addFirst(1);
			}
		}
		if(TF.remove()==0) {
			pl('F');
		}
		else {
			pl('T');
		}
	}
	static class SC {
		private BufferedReader reader = null;
		private StringTokenizer tokenizer = null;
		public SC(InputStream in) {
			reader = new BufferedReader(new InputStreamReader(in));
		}
		public String next() {
			if (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				}
			}
			return tokenizer.nextToken();
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public double nextDouble() {
			return Double.parseDouble(next());
		}
		public String nextLine() {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new UncheckedIOException(e);
			}
		}
	}
	public static void pl(Object o) {
		System.out.println(o);
	}
	public static void pl() {
		System.out.println();
	}
	public static void p(Object o) {
		System.out.print(o);
	}
}


Measured memory_bytes: 35196
#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const int MOD = 1000000007;

string s;
void inc() {
  for (int i = 0; i < s.size(); ++i) {
    ++s[i];
    if (s[i] == '2') {
      s[i] = '0';
    } else {
      return;    
    }
  }
  s.push_back('1');
}

const int MAX = 100003;
long p[MAX];
long q[MAX];
int main() {
  cin >> s;
  reverse(s.begin(), s.end());
  inc();
  
  long a = 1;
  long b = 1;
  for (int i = 0; i < MAX; ++i) {
    p[i] = a;
    q[i] = b;
    a = a * 2 % MOD;
    b = b * 3 % MOD;
  }
  
  int cnt = 0;
  long sum = 0;
  for (int i = (int)s.size() - 1; i >= 0; --i) {
    if (s[i] == '1') {
      sum = (sum + p[cnt] * q[i] % MOD) % MOD;
      ++cnt;
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 2048
fn main() {
    let k = read::<usize>();
    let s = read::<String>();

    if s.len() <= k {
        println!("{}", s);
        return;
    }

    println!("{}{}", &s[..k], "...");
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().parse().ok().unwrap()
}

Measured memory_bytes: 2080
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <algorithm>
using namespace std;
int main()
{
    int a,b,s[5];
    scanf("%d %d",&a,&b);
    s[0]=a+b;
    s[1]=a-b;
    s[2]=a*b;
    sort(s,s+3);
    printf("%d\n",s[2]);
}


Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define all(c) begin(c), end(c)
const int INF =
    sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = 1'000'000'007;
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
bool chmin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

template <typename T>
vector<T> gen_v(size_t a) {
    return vector<T>(a);
}
template <typename T, typename... Ts>
auto gen_v(size_t a, Ts... ts) {
    return vector<decltype(gen_v<T>(ts...))>(a, gen_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type fill_v(T& t, const V& v) {
    t = v;
}
template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type fill_v(T& t, const V& v) {
    for (auto& e : t) fill_v(e, v);
}

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int M, D;
    cin >> M >> D;
    int cnt = 0;
    rep(m, 1, M + 1) {
        rep(d, 1, D + 1) {
            if (d >= 20 && (d % 10) >= 2 && (d / 10) * (d % 10) == m) { cnt++; }
        }
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 892
def comb(n,r)
  r.times.inject(1){|s,i| s * (n - i) / (i + 1) }
end
N = gets.chomp.chars.map(&:to_i)
K = gets.to_i
ans = N.size - N.count(&:zero?) >= K ? 1 : 0

N.each.with_index(1).inject(0) do |nz,(d, i)|
  break if nz == K
  t = N.size - i
  if !d.zero?
    ans += (d - 1) * comb(t, K - nz - 1) * (9 ** (K - nz - 1))
    ans += comb(t, K - nz) * (9 ** (K - nz))
    nz + 1
  else
    nz
  end
end
puts ans


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

int main()
{
    int n;cin>>n;
    vector<int>cc(n+1);
    for(int i=1;i<=n;i++){
        cin>>cc[i];
    }
    int num=0;
    int flag=1;
    for(int i=1;i<=n;i++){
        if(cc[i]==flag){
            num++;
            flag++;
        }
    }

    if(num==0){
        cout<<"-1"<<endl;
        return 0;
    }
    cout<<n-num<<endl;
    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>
#include<functional>
#include<cstring>
#include<string>
#include<vector>
#include<queue>
#include<cmath>
#include<algorithm>
#include<map>
#include<ctime>
using namespace std;
typedef long long ll;
typedef long double ld;
const int maxn = 1e5+3;
const int inf = 1e5;
const int modn = 1e9+7;
const ld eps = 1e-8;
const long double PI = acos(-1.0);
void qRead(ll &x){x = 0;char a;for(a = getchar();a <'0' || a > '9';a = getchar());for(;a >= '0' && a <= '9';a = getchar())x = x*10 + a-'0';}
void qRead(int &x){x = 0;char a;for(a = getchar();a <'0' || a > '9';a = getchar());for(;a >= '0' && a <= '9';a = getchar())x = x*10 + a-'0';}
ll qpow(ll a,ll b,ll mo = modn){
//    printf("%lld\n",mo);
    ll res = 1;
    while(b){
        if(b & 1)res = (res*a) % mo;
        a = (a*a) % mo;
        b >>= 1;
    }
    return res;
}
ld qpow(ld a,ll b){
    ld res = 1;
    while(b){
        if(b & 1)res *= a;
        a = a*a;
        b >>= 1;
    }
    return res;
}
ll gcd(ll a,ll b){
    if(!b)return a;
    return gcd(b,a%b);
}
//ll vis[maxn],prime[maxn],cnt,smallP[maxn];
//void getPrime(int n){
//    cnt = 0;
//    for(int i = 1;i <= n;i++)vis[i] = 0;
//    for(ll i = 2;i <= n;i++){
//        if(!vis[i]){
//            prime[++cnt] = i;
//            smallP[i] = i;
//        }
//        for(int j = 1;j <= cnt && i*prime[j] <= n;j++){
//            vis[prime[j]*i] = 1;
//            smallP[prime[j]*i] = prime[j];
//            if((i % prime[j]) == 0)break;
//        }
//    }
//}
int numDis[11],cnt;
bool judge(ll n){
    while(n){
        int x = n % 10;
        for(int i = 1;i <= cnt;i++){
            if(numDis[i] == x)return 0;
        }
        n /= 10;
    }
    return 1;
}
int main(){
    ll n,k;
    cnt = 0;
    scanf("%lld%lld",&n,&k);
    for(int i = 1;i <= k;i++){
        int x;
        scanf("%d",&x);
        numDis[++cnt] = x;
    }
    bool found = 0;
    while(!found){
        if(judge(n)){
            printf("%lld\n",n);
            return 0;
        }
        n++;
    }
}


Measured memory_bytes: 256
//Utkarsh.25dec
#include <bits/stdc++.h>
#include <chrono>
#include <random>
#define ll long long int
#define ull unsigned long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define rep(i,n) for(ll i=0;i<n;i++)
#define loop(i,a,b) for(ll i=a;i<=b;i++)
#define vi vector <int>
#define vs vector <string>
#define vc vector <char>
#define vl vector <ll>
#define all(c) (c).begin(),(c).end()
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define deb(x) cerr<<#x<<' '<<'='<<' '<<x<<'\n'
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// ordered_set s ; s.order_of_key(val)  no. of elements strictly less than val
// s.find_by_order(i)  itertor to ith element (0 indexed)
typedef vector<vector<ll>> matrix;
ll power(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll modInverse(ll a){return power(a,mod-2);}
const int N=500023;
bool vis[N];
vector <int> adj[N];
void solve()
{
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll ans=a*c;
    ans=max(ans,a*d);
    ans=max(ans,b*c);
    ans=max(ans,b*d);
    cout<<ans<<'\n';
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int T=1;
    //cin>>T;
    int t=0;
    while(t++<T)
    {
        //cout<<"Case #"<<t<<":"<<' ';
        solve();
        //cout<<'\n';
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

Measured memory_bytes: 15380
#include<bits/stdc++.h>
using namespace std;
 
template <class T1, class T2>
ostream& operator << (ostream& out, const pair <T1, T2> p)
{
	out << '(' << p.first << ',' << p.second << ')';
	return out;
}
 
template <class T1, class T2>
istream& operator >> (istream& in, pair<T1, T2> &p)
{
	in >> p.first >> p.second;
	return in;
}
 
template <class T>
istream& operator >> (istream& in, vector<T> &v)
{
	for (T &x : v)
		in >> x;
	return in;
}
 
template <class T>
ostream& operator << (ostream& out, const vector<vector<T> > &v)
{
	for (const vector<T> &x : v)
		out << x << '\n';
	return out;
}
 
template <class T>
ostream& operator << (ostream& out, const vector<T> &v)
{
	for (const T &x : v)
		out << x << ' ';
	return out;
}
 
 
#define ll long long
#define lf long double
#define pb push_back
#define mp make_pair
#define F first
#define S second
typedef pair <ll,ll > ii;
typedef vector <ll> vi;
typedef vector <ii> vii;
typedef vector <bool> vb;
typedef vector <vector <ll> > vv;
typedef vector <vector <vector<ll> > > vvv;
typedef vector <string> vs;
typedef vector <lf> vf;
#define sz(x) (ll)(x).size()
#define tr1(x) cerr << #x << ": " << x << nl
#define tr2(x, y) cerr << #x << ": " << x << " | " << #y << ": " << y << nl
#define tr3(x,y,z) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<nl
#define tr4(x,y,z,w) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<" | "<<#w<<": "<<w<<nl
#define trv(a) cerr<<#a<<": ";for(ll zz=0;zz<sz(a);zz++) cerr<<a[zz]<<" ";cerr<<nl
#define trset(s) cerr<<#s<<": ";for(auto &i:s) cerr<<i<<" ";cerr<<nl
#define epsilon 0.000000001L
#define inf 9999999999999999ll// ~ 10^16
#define nl endl
#define all(x) x.begin(), x.end()
#define r_all(x) x.rbegin(), x.rend()
#define fast()  ios_base::sync_with_stdio(false);cin.tie(NULL)
#define mod 1000000007ll
#define modulo 998244353ll
ll power(ll a,ll b){return b?power(a*a%mod,b/2)*(b%2?a:1)%mod:1;}

int main() 
{
    fast();
    ll n,m,k;
    cin>>n>>m>>k;
    vs s(n);
    cin>>s;

    ll ans=0;
    for(ll i=0;i<(1ll<<n);i++)
    {
        for(ll j=0;j<(1ll<<m);j++)
        {
            vi row(n,true);
            vi col(m,true);
            for(ll k1=0;k1<n;k1++)
            {
                if((1ll<<k1) &i)
                {
                    row[k1]=false;
                }
            }
            for(ll k1=0;k1<m;k1++)
            {
                if((1ll<<k1)&j)
                {
                    col[k1]=false;
                }
            }

            ll count=0;
            for(ll i1=0;i1<n;i1++)
            {
                for(ll j1=0;j1<m;j1++)
                {
                    if(row[i1] && col[j1] && s[i1][j1]=='#')
                    {
                        count++;
                    }
                }
            }
            if(count==k)
                ans++;
        }
    }
    cout<<ans<<nl;
}


Measured memory_bytes: 3556
#include <bits/stdc++.h>
#define inf (1<<29)
#define sq(n) ((n)*(n))
#define rep(i,n) for(int i=0;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define MEMSET(a) memset(a,0,sizeof(a))
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define int long long
using namespace std;
using ll = long long;

ll n,k,w[100000];

int f(ll p){
	int i=0;
	rep(j,k){
		int s=0;
		while(s+w[i]<=p){
			s+=w[i++];
			if(i==n)return n;
		}
	}
	return i;
}

signed main(){
	cin>>n>>k;
	rep(i,n)cin>>w[i];
	ll l=0,r=1000000000;
	while(r-l>1){
		ll m=(l+r)/2;
		if(f(m)>=n)r=m;
		else l=m;
	}
	cout<<r<<endl;
	return 0;
}


Measured memory_bytes: 3872
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const ll N=1e5+5;
vector<ll> f[N],b[N];
ll par[N],sz[N];
ll dsu_parent(ll node){
    if(node==par[node])return node;
    return par[node]=dsu_parent(par[node]);
}
void dsu_union(ll a,ll b){
    a=dsu_parent(a);
    b=dsu_parent(b);
    if(a==b)return;

    if(sz[a]<sz[b])swap(a,b);
    sz[a]+=sz[b];
    par[b]=a;
}
void init(){
    for(ll i=0;i<N;i++)par[i]=i,sz[i]=1;
}
int main(){
    cin.tie(NULL); cout.tie(NULL);
    ios_base:: sync_with_stdio(false);
    ll n,m,k;cin>>n>>m>>k;
    init();
    for(ll i=0,u,v;i<m;i++){
        cin>>u>>v;
        f[u].push_back(v);
        f[v].push_back(u);
        dsu_union(u,v);
    }
    for(ll i=0,u,v;i<k;i++){
        cin>>u>>v;
        b[u].push_back(v);
        b[v].push_back(u);
    }

    for(ll i=1;i<=n;i++){
        ll ans = n - 1 - f[i].size() -  b[i].size() - ( n - sz[dsu_parent(i)] );
        for(auto &ele:b[i])if(dsu_parent(i) != dsu_parent(ele))ans++;
        cout<<ans<<" ";
    }
}




Measured memory_bytes: 14452
import math
X,K,D=map(int,input().split(' '))

n=math.ceil(X/D)
m=math.floor(X/D)

n_moveto0=0

if abs(X-n*D) <= abs(X-m*D):
  n_moveto0=abs(n)
  x_min=X-n*D
else: 
  n_moveto0=abs(m)
  x_min=X-m*D


if n_moveto0>=K:
  print(min([abs(X-D*K),abs(X+D*K)]))
else:
  if (K-n_moveto0)%2==0:
    print(abs(x_min))
  else:
    print(min([abs(x_min+D),abs(x_min-D)]))


Measured memory_bytes: 9228
/*
https://www.luogu.com.cn/blog/litble-blog/solution-at2170

https://blog.csdn.net/weixin_30262255/article/details/99456653

”我们只要不断维护这一等差数列，维护首项末项公差，每次对答案的贡献是首项与末项的平均数。“

搭配食用，第一篇更佳

呜呜呜神仙题。。只能靠题解度日这个亚子 ಠ_ಠ
*/
#include <bits/stdc++.h>
#define rep(i, x, y) for (int i = x; i <= y; i++)
using namespace std;

const int N = 2e5 + 10;
int n;
double d, k, ans;

int main() {
    cin >> n >> d >> k;
    double nn = (n << 1);
    for (int i = n; i; i--) {
        ans += d + (nn - 1) / 2 * k;
        double dd = d + (2 * d + 5 * k) / nn;
        double kk = k + 4 * k / nn;
        k = kk, d = dd, nn -= 2;
    }
    printf("%.10lf\n", ans);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D ;
  
  if (A + B < C + D){
    cout << "Right" << endl;
  }
  else if (A + B > C + D){
    cout << "Left" << endl;
  }
  else{
    cout << "Balanced" << endl;
  }
}

Measured memory_bytes: 256
function main(input) {
  const args = input.split(' ').map(n => parseInt(n, 10));
  const A = args[0];
  const B = args[1];
  
  const cards = {1: 2, 2: 3, 3: 4, 4: 5, 5: 6, 6: 7, 7: 8, 8: 9, 9: 10, 10: 11, 11: 12, 12: 13, 13: 14, 1: 15}
  
  if (cards[A] > cards[B]) {
    console.log('Alice');
  } else if (cards[A] === cards[B]) {
    console.log('Draw');
  } else {
    console.log('Bob');
  }
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 30720
using System;
using System.Linq;
using System.Collections.Generic;

class P
{
    static void Main()
    {
        Console.ReadLine();
        int k = int.Parse(Console.ReadLine());
        int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int res = 0;
        foreach (var boal in x)
        {
            res += Math.Min(boal, Math.Abs(k - boal)) * 2;
        }
        Console.WriteLine(res);
    }
}

Measured memory_bytes: 13268
N,K=map(int,input().split())
a = 0
for b in range(1,N+1):
    p=N//b
    a+= p*max(0,b-K)
    a+= max(0,N%b-K+1)
    #print(b,a)
#print(a,K)
print(a if K!=0 else a-N)

Measured memory_bytes: 2940
#include <stdio.h>
int sum(int n){
	int i;
	int a=0;
	for(i=1;i<n;i++){
		a+=i;
	}
	return a;
}
int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	printf("%d",sum(n)+sum(m));
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<cmath>
#include<vector>
#include<algorithm>
using namespace std;

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

    for(int i=0;i<n;i++){
        int minj = i;
        for(int j=i;j<n;j++)
            if(a[j] < a[minj])minj = j;
        swap(a[i], a[minj]);
        if(minj != i)cnt++;
    }

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

    return 0;
}


Measured memory_bytes: 3096
#include <bits/stdc++.h>
#include <random>
#include <chrono>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int
#define ull unsigned ll
#define pb push_back
#define popb pop_back
#define mt make_tuple
#define eb emplace_back
#define mp make_pair
#define ff first
#define ss second
#define pii pair <int,int>
#define piii pair <pii,int>
#define piiii pair <pii,pii>
#define plll pair <pair <ll, ll>, ll>
#define rep0(i,n) for(ll i=0;i<(ll)n;i++)
#define rep1(i,n) for(ll i=1;i<=(ll)n;i++)
#define rep(i,x,y) for(ll i=(ll)x;i<=(ll)y;i++)
#define reprev(i,n) for(ll i=(ll)n;i>=0;i--)
#define all(c) c.begin(),c.end()
#define print(a) rep0(i,a.size()) cout << a[i] << " "
#define hi() cout << "\nHello, I am error. Can you find me? :):):)\n"
#define Randomize mt19937 rng(chrono::steady_clock::now().time_since_eppoch().count())
 
using namespace __gnu_pbds;
using namespace std;
using ordered_set =  tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>;

const int mod = 1e9+7;
const long double pi = acos(-1);

ll power(ll x, ll y){
	x %= mod;
	ll ans = 1;
	while(y){
		if(y&1) ans = (ans*x)%mod;
		y /= 2;
		x = (x*x)%mod;
	}
	return ans;
}

void solve(){

	int k;
	cin >> k;
	ll ans = 0;
	rep1(x,k) rep1(y,k) rep1(z,k){
		ans += __gcd(x,__gcd(y,z));
	}
	cout << ans;

	return;
}

int main(){

	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);

	int TC = 1,t = 0;
	// cin >> TC;
	while(t++ < TC){
		// cout << "Case #" << t << ": ";
		solve();
		// cout << "\n";
	}

	cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";

	return 0; 
}

Measured memory_bytes: 3788
n = gets.chomp.to_i
as = []
aset = {}
gets.chomp.split(' ').each{|i|
  ii = i.to_i
  if aset[ii].nil?
    aset[ii] = 0
    index = as.bsearch_index{|v| v > ii }
    if index.nil?
      as.push(ii)
    else
      as.insert(index, ii)
    end
  end
  aset[ii] += 1
}

# p aset
# p as

last = as.last

j = 0
as.each{|aj|
  if aset[aj] === -1
    j += 1
    next
  end

  mul = 2
  ai = aj * mul
  while ai <= last
    if aset[ai] != -1
      aset[ai] = -1
    end
    mul += 1
    ai = aj * mul
  end
  j += 1
}

# p aset

puts as.filter{|ai| aset[ai] === 1 }.length


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

using namespace __gnu_pbds;
using namespace std;

#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// order_of_key (val): returns the no. of values less than val
// find_by_order (k): returns the kth largest element.(0-based)

#define ll long long int
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define pi pair<ll,ll>
#define pii pair<ll,pi >
#define ppi pair<pi,ll>
#define ppp pair<pi,pi >
#define ex(str,a,b) str.substr((int)(a),min((int)str.size()-a,(int)(b-a+1))) 
#define all(X) X.begin(),X.end()
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

// for pair comparison function(ascending order) use return (i1.ff < i2.ff);

/* string operations :
   str.substr (x,y) : returns a substring str[x],str[x+1],...str[x+y-1]
   __builtin_popcount(n) : no. of set bits in n.
*/

const int M = (1<<20)+5;
const int md = 1e9+7;

priority_queue<ll,vector<ll >,greater<ll > > pq;

ll pwr(ll a,ll n,ll m)
{
	ll p=1;
	while(n>0)
	{
		if(n%2==1)
			p=(p*a)%m;
		a=(a*a)%m;
		n=n/2;
	}
	return p;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	ll a,b,c,k;
	cin >> a >> b >> c >> k;
	while(b<=a)
	{
		b *= 2;
		k--;
	}
	while(c<=b)
	{
		c *= 2;
		k--;
	}
	if(k>=0)
		cout << "Yes" << "\n";
	else
		cout << "No" << "\n";
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define rep(i,n) for(long long i=0; i<n; i++)
#define Rep(i,n) for(long long i=1; i<n; i++)
#define ll long long
#include <math.h>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <queue>
#include <set>
#include <vector>


using namespace std;
#define PI acos(-1)
using P =pair<ll,ll>;

ll ketasu(ll a){
   ll num=1;
   while(a/10){
       num++;
       a/=10;
   }
   return num;
}

ll gcd(ll a,ll b){return b ? gcd(b,a%b) :a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}

ll kosuu(ll a){
    ll sum=0;
    for(ll i=1;i*i<=a;i++){
        if(a%i==0){
            if(a!=1&&i*i!=a){
            sum+=2;
            }else{
             sum++;   
            }
        }
    }
    return sum;
}

ll n;



    vector<pair<ll,ll>>p;
void fs(ll a){
    for(ll i=2;i*i<=n;i++){
        ll cnt=0;
        while(n%i==0){
            n/=i;
            cnt++;
        }
        p.emplace_back(i,cnt);
    }
    return;
}


ll di[]={1,0,-1,0};
ll dj[]={0,-1,0,1};
int main(){
   int n;
   cin>>n;
    long long int a[n],ans=0,i;
    int mod=1000000007;
    long long int sum=0;
 
    for( i = 0 ; i < n ; i++ ){
            cin>>a[i];
        sum = sum + a[i];
        sum%=mod;
    }
    for( i = 0 ; i < n ; i++ ){
        sum = sum - a[i];
        if(sum<0)sum+=mod;
 
        ans+=(a[i]%mod * sum%mod)%mod;
        ans%=mod;
    }
    cout<<ans%mod;
 
    return 0;
}
 




Measured memory_bytes: 5184
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n,m;
    while(cin>>n>>m)
    {
        long long s=0;
        if(n>=2&&m>=2)
        s=(n-2)*(m-2);
        if(n==1&&m==1)
            s=1;
        else if(n==1)
        {
            if(m>2)
                s=m-2;
        }
        else if(m==1)
        {
            if(n>2)
                s=n-2;
        }
        cout<<s<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
while True:
	m,f,r=map(int,raw_input().split())
	if m==f==r==-1: break
	if m+f<30 or m==-1 or f==-1: print 'F'
	elif m+f>=80: print 'A'
	elif 65<=m+f: print 'B'
	elif 50<=m+f: print 'C'
	elif r>=50: print 'C'
	else: print 'D'

Measured memory_bytes: 6408
N, M = map(int, input().split())


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])
    if temp != 1:
        arr.append([temp, 1])

    if arr == [] and n != 1:
        arr.append([n, 1])

    return arr


mod = 10**9 + 7


def cmb(n, r, mod):
    if (r < 0 or r > n):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod


g1 = [1, 1]  # 元テーブル
g2 = [1, 1]  # 逆元テーブル
inverse = [0, 1]  # 逆元テーブル計算用テーブル

for i in range(2, N + 1):
    g1.append((g1[-1] * i) % mod)
    inverse.append((-inverse[mod % i] * (mod//i)) % mod)
    g2.append((g2[-1] * inverse[-1]) % mod)


primes = factorization(M)
# 何箇所に分けるか（cnt以下）,その中でどう分けるか（しきりをどこにおくか（振り分けられないものが出ると選べれないのとおなじになるので、cnt - 選んだ数））
if N == 1:
    print(1)
    exit(0)
ans = 1

for p, cnt in primes:
    tmp = 0
    for i in range(1, min(cnt, N)+1):
        tmp += cmb(N, i, mod) * cmb(cnt-1, i-1, mod)
        #print(tmp, p, cnt, i)
        tmp %= mod
    ans *= tmp
    ans %= mod

print(ans)


Measured memory_bytes: 20900
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
    sc.Scan()
    i, e := strconv.Atoi(sc.Text())
    if e != nil {
        panic(e)
    }
    return i
}

func nextString() string {
    sc.Scan()
    return sc.Text()
}

func main() {
    buf := make([]byte, 0)
    sc.Buffer(buf, 4000000)
    sc.Split(bufio.ScanWords)
	n := nextInt()
	k := nextInt()
    q := nextInt()
    
    player := make([]int, n + 1, n + 1)

    for i := 0; i < q; i++ {
        a := nextInt()
        player[a]++
    }

    for i := 1; i <= n; i++ {
        if ( k + player[i] - q > 0) {
            fmt.Println("Yes")
        } else {
            fmt.Println("No")
        }
    }
}

Measured memory_bytes: 3968
n, m, c = map(int, input().split())

b = list(map(int, input().split()))

a = []

for i in range(n):
    a.append(list(map(int, input().split())))

ans = 0

for i in range(n):
    sum = 0
    for j in range(m):
        sum += a[i][j] * b[j]
    if sum + c > 0:
        ans += 1

print(ans)

Measured memory_bytes: 3064
n,m = map(int,input().split())
pb = [0]*n
wa = 0
ac = 0
for i in range(m):
    p,s = input().split()
    p = int(p)
    if pb[p-1] == -1:
        continue
    else:
        if s =="AC":
            wa += pb[p-1]
            pb[p-1] = -1
            ac+=1
        else:
            pb[p-1]+=1
print(ac,wa)

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

 
const int mxN=2e5;
int n, m;
ll k, a[mxN+1], b[mxN+1];
 
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
 
	cin >> n >> m >> k;
	for(int i=0; i<n; ++i) {
		cin >> a[i+1];
		a[i+1]+=a[i];
	}
	for(int i=0; i<m; ++i) {
		cin >> b[i+1];
		b[i+1]+=b[i];
	}
	int ans=0;
	for(int i=0, j=m; i<=n; ++i) {
		if(a[i]>k)
			break;
		while(a[i]+b[j]>k)
			--j;
		ans=max(i+j, ans);
	}
	cout << ans;
}

Measured memory_bytes: 6776
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <set>
#include <iostream>
#include <stack>
#include <vector>
#include <string>
#include <map>
#include <cmath>
#include <queue>
#include <random>
#include <chrono>
using namespace std;

int a[15][15];

int id[15][15];

typedef pair<int, int> pii;

vector<pair<pii, int> > edges;

int d[15][15];

int A, B;

int idX(int i){
    return i + 1;
}

int idY(int i){
    return 202 - i;
}

int c[105][105];

int main(){
    cin >> A >> B;
    for(int i = 1;i <= A;i++){
        for(int j = 1;j <= B;j++){
            scanf("%d", &d[i][j]);
        }
    }
    for(int i = 0;i <= 100;i++){
        for(int j = 0;j <= 100;j++){
            int mx = 0;
            for(int i1 = 1;i1 <= A;i1++){
                for(int j1 = 1;j1 <= B;j1++){
                    int len = i1 * i + j1 * j;
                    mx = max(mx, d[i1][j1] - len);
                }
            }
            c[i][j] = mx;
        }
    } 
    bool flag = true;
    for(int i1 = 1;i1 <= A;i1++){
        for(int j1 = 1;j1 <= B;j1++){
            bool find = false;
            for(int i = 0;i <= 100;i++){
                for(int j = 0;j <= 100;j++){
                    if(i * i1 + j * j1 + c[i][j] == d[i1][j1])
                        find = true;
                }
            }
            flag &= find;
        }
    }
    if(flag){
        puts("Possible");
        for(int i = 1;i <= 100;i++){
            edges.push_back(make_pair(make_pair(i, i + 1), -2));
        }
        for(int i = 102;i <= 201;i++){
            edges.push_back(make_pair(make_pair(i, i + 1), -1));
        }
        for(int i = 0;i <= 100;i++){
            for(int j = 0;j <= 100;j++){
                if(c[i][j] <= 100)
                    edges.push_back(make_pair(make_pair(idX(i), idY(j)), c[i][j]));
            }
        }
        cout << 202 << " " << edges.size() << endl;
        for(auto e : edges){
            pii p = e.first;
            int val = e.second; 
            if(val == -2){
                cout << p.first << " " << p.second << " X" << endl;
            }else if(val == -1){
                cout << p.first << " " << p.second << " Y" << endl;
            }else{
                cout << p.first << " " << p.second << " " << val << endl;
            }
        }
        cout << 1 << " " << 202 << endl;
    }else{
        puts("Impossible"); 
    }
    return 0;
}


Measured memory_bytes: 888
#include <stdio.h>
int main()
{
    int x, i;
    i = 1;
    x = 0;
    
    while (i > 0) {
        scanf ("%d", &x);
        if (x == 0) {
            break;
        }
        printf ("Case %d: %d\n", i, x);
        i++;
    }
    
    return 0;
}

Measured memory_bytes: 600
// abc128_b
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

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

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF ((1 << 29)-1)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

int main() {
#ifdef LOCAL
    ifstream in("../arg.txt");
    cin.rdbuf(in.rdbuf());
#endif

    int N;
    cin >> N;

    struct Info {string s; int p;};
    vector<Info> SP(N);
    REP(i, N) cin >> SP[i].s >> SP[i].p;

    vector<int> indices(N);
    iota(ALL(indices), 0);

    sort(ALL(indices), [&](int x, int y){
        if (SP[x].s == SP[y].s){
            return SP[x].p > SP[y].p;
        } else {
            return SP[x].s < SP[y].s;
        }
    });

    REP(i, N){
        print(indices[i]+1);
    }


    return 0;
}


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

#define _USE_MATH_DEFINES
#include<math.h>


using namespace std;
typedef long long ll;

typedef pair<ll, ll> pll;
typedef tuple<int, int, int> ti3;

const ll MOD_CONST = 1000000007;
//const ll MOD_CONST = 998244353;


const int INF = 1000000000;
//const ll INF = 1000000000000000000;

int main() {
	int n, d, a;
	cin >> n >> d >> a;

	vector<pll> monst(n);
	for (int i = 0; i < n; i++) {
		cin >> monst[i].first >> monst[i].second;
	}

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

	priority_queue<pll,vector<pll>,greater<pll>> pq;

	ll sum = 0;

	ll ans = 0;
	for (int i = 0; i < n; i++) {
		while (!pq.empty()) {
			int p = pq.top().first;

			if (p >= monst[i].first) {
				break;
			}

			sum -= pq.top().second;
			pq.pop();

		}
	
		ll hp = monst[i].second;
		hp -= sum;

		if (hp <=0) {
			continue;
		}

		ll num = hp / a;
		if (hp % a != 0) {
			num++;
		}

		ll atk = num * a;
		sum += atk;
		ans += num;

		ll maxD = monst[i].first + 2 * d;
		pq.push(make_pair(maxD, atk));
		

	}

	cout << ans << endl;
	
}



Measured memory_bytes: 5492
#include<cstdlib>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<map>
#include<queue>
#include<vector>
#include<iostream>
using namespace std;
int main()
{
    long long int x,y,ans = 12000000000;
    scanf("%lld%lld",&x,&y);
    if(x % 3 == 0 || y % 3 == 0)
        printf("0");
    else
    {
        if(x < y) x ^= y ^= x ^= y;
        ans = y;
        long long int tem1=0,tem2=12000000000;
        for(int i = x/3; i <= x/3+1; i++)
            for(int j = y/2; j <= y/2+1; j++)
            {
                tem1=0,tem2=12000000000;
                tem1=max(y*i, tem1);
                tem1=max(tem1, (x-i)*j);
                tem1=max(tem1, (x-i)*(y-j));
                tem2=min(y*i, tem2);
                tem2=min(tem2, (x-i)*j);
                tem2=min(tem2, (x-i)*(y-j));
                ans = min(ans, tem1 - tem2);
            }
        for(int i = y/3; i <= y/3+1; i++)
            for(int j = x/2; j <= x/2+1; j++)
            {
                tem1 = 0, tem2 =12000000000;
                tem1=max(x*i, tem1);
                tem1=max(tem1, (y-i)*j);
                tem1=max(tem1, (y-i)*(x-j));
                tem2=min(x*i, tem2);
                tem2=min(tem2, (y-i)*j);
                tem2=min(tem2, (y-i)*(x-j));
                ans = min(ans, tem1 - tem2);
            }
        printf("%lld",ans);
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
using pii = pair<int, int>;
const int MOD = 1e9 + 7;
const int INF = 1 << 29;
const int N = 1e5 + 2;
 
struct IOsetup{
  IOsetup(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); 
    cout.tie(nullptr);
    cout << fixed << setprecision(20);
  }
}IO;

int Func(string A, string B){
  int ret = 0, j, a = (int)A.length(), b = (int)B.length();
  for (j = 0; j <= a - b; j++)
    if (A.substr(j, b) == B) ret++;
  return ret;
}

int32_t main(){
 int n;
 string s;
 cin >> n >> s;
 int ret = Func(s, "ABC");
 cout << ret << endl; 
}

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

int main(){

    int N;
    cin >> N;

    vector<long long> a(N);    
    vector<long long> b(N);    
    vector<long long> c(N);    

    for(int i = 0; i < N; i++){
        cin >> a[i];
    }
    for(int i = 0; i < N; i++){
        cin >> b[i];
    }
    for(int i = 0; i < N; i++){
        cin >> c[i];
    }

    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    sort(c.begin(), c.end());

    long long ans = 0;
    for(int i = 0; i < N; i++){
        auto itr1 = lower_bound(a.begin(), a.end(), b[i]);
        auto itr2 = upper_bound(c.begin(), c.end(), b[i]);
        //cout << (itr1 - a.begin()) << " " << (c.end() - itr2) << endl;  
        ans += (itr1 - a.begin()) * (c.end() - itr2);
    }
    cout << ans << endl;


    long long last_num = c[0];
    long long last_index = 0;

    /*
    int count_bc[N] = {N};
    int b_index = 0;
    for(int i = 0; i < N; i++){

        while(b[b_index] < c[i]){
            count_bc[b_index] = N - i;
            b_index ++;
            count_bc[b_index] =  count_bc[b_index-1] ;
        }
    }
    for(int i = b_index; i < N; i++){
        count_bc[i] = count_bc[b_index];
    }


    int count_ab[N] = {0};
    b_index = 0;
    for(int i = 0; i < N; i++){

        if(b[b_index] > a[i]){
            count_ab[b_index] = i + 1;
        }
        while(b[b_index] <= a[i]){
            b_index ++;
            count_ab[b_index] = count_ab[b_index-1];
            if(b[b_index] > a[i]) count_ab[b_index] ++ ;
        }
    }
    for(int i = b_index; i < N; i++){
        count_ab[i] = count_ab[b_index];
    }
    */

    /*
    for(int i  = 0; i < N; i++){
        cout << count_ab[i] << " ";
    }
    cout << endl;

    for(int i  = 0; i < N; i++){
        cout << count_bc[i] << " ";
    }
    cout << endl;
    */



}

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

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

    std::vector<int> h(n);
    for(int i = 0; i < n; i++) {
        cin >> h[i];
    }
    string ans = "Yes";
    int q;
    for(int i = 0; i < n-1;i++) {
        if(h[i] < h[i+1]) {
            h[i+1]--;
        }
        if(h[i] > h[i+1]) ans = "No";
    }

    cout << ans << endl;

}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>

using namespace std;

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


int main(){
    string S;
    cin >> S;
    int w;  cin >> w;
    for(int i = 0; i < S.length(); i++){
        if(i % w == 0)  cout << S[i];
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
def is_prime(n):
    i = 2
    while i*i <= n:
        if n%i==0:
            return False
        i+=1
    return True
N = input()
ans = []
for i in xrange(6,55555,5):
    if is_prime(i):
        ans.append(i)
        N -= 1
    if N == 0:
        break
print(' '.join(map(str,ans)))

Measured memory_bytes: 2568
#include <iostream>
#include <iomanip>
#include <queue>
#include <deque>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <bitset>

#define REP(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define FILL(x, y) memset(x, y, sizeof(x))
#define pb push_back
#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...) 42
#endif

template<class T>bool chmax(T &a, const T &b) {
   if (a < b) {
      a = b;
      return 1;
   }
   return 0;
}
template<class T>bool chmin(T &a, const T &b) {
   if (a > b) {
      a = b;
      return 1;
   }
   return 0;
}

using namespace std;
using ll = long long;

const int kInf = 2e9;
const ll kLInf = 2e18;

int gcd (int a, int b) {
   return b ? gcd(b, a % b) : a;
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main()
{
   cout << fixed << setprecision(10);

   int A,B;
   cin >> A >> B;
   int ans = A - 2 * B;
   if (ans < 0) {
      ans = 0;
   }
   cout << ans << endl;
   
   return 0;
}



Measured memory_bytes: 256
#include<stdio.h>

int main(void){
  int n=0,tmp=0;
  scanf("%d",&n);
  char buf[12];
  snprintf(buf,12,"%d",n);
  for(int i=0;i<strlen(buf);i++){
    tmp+=(buf[i]-'0');
  }
  if(n%tmp)printf("No\n");
  else printf("Yes\n");
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <algorithm>
#include <cassert>
#include <limits>
#include <numeric>
#include <type_traits>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <functional>
#include <utility>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <complex>
#include <climits>
#include <time.h>

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef pair<ll, ll> P;
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)

ll GetDigit(ll num){
    ll digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}
const double PI = 3.14159265358979;
/******変数定義start******/
ll n;
/*******変数定義end*******/
ll solve(){
    cin >> n;
    for(ll i = sqrt(n); i >0; i--){
        if(n % i == 0){
            cout << max(GetDigit(i), GetDigit(n/i)) << endl;
            return 0;
        }
    }
    return 0;
}

int main(){

    //clock_t start = clock();
    cout << std::fixed << std::setprecision(10);
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll end = solve();
    return end;
    //clock_t end = clock();
    //const double time = static_cast<double>(end - start) / CLOCKS_PER_SEC * 1000.0;
    //printf("time %lf[ms]\n", time);
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iomanip>
#include <limits>
using namespace std;
// 素因数分解
typedef pair<long long, long long> P;
vector<P> prime_factorize(long long n)
{
vector<P> res;
for (long long p = 2; p * p <= n; ++p)
{
if (n % p != 0)
continue;
int num = 0;
while (n % p == 0)
{
++num;
n /= p;
}
res.push_back(make_pair(p, num));
}
if (n != 1)
res.push_back(make_pair(n, 1));
return res;
}
// 因数分解
long long gcd(long long x, long long y)
{
  if (y == 0)
  {
    return x;
  }
  else
  {
    return gcd(y, x % y);
  }
}
const int MOD = 1000000007;
typedef long long int ll;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i, n) for (int i = 0; i < (n); i++)

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

Measured memory_bytes: 3536
try:
    while True:
        a,b,c,d,e,f=map(int, input().split())
        y = (a*f - c*d) / (a*e - b*d)
        x = (c - b*y) / a
        
        print('{:.03f}'.format(x), '{:.03f}'.format(y))
      
except:
    pass


Measured memory_bytes: 5612
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef queue<ll> ql;
typedef deque<ll> dql;
typedef priority_queue<ll, vl/*, greater<ll>*/> pql; //降順(/*昇順*/)
typedef set<ll> sl;
typedef pair<ll, ll> pl;
typedef vector<vl> vvl;
typedef vector<pl> vpl;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define rep2(i, n) for(ll i = 1; i <= ll(n); i++)
//#define rep(i, k, n) for(ll i = k-1; i < ll(n); i++)
//#define rep2(i, k, n) for(ll i = k; i <= ll(n); i++)
#define all(v) (v).begin(), (v).end()
bool chmin(ll &a, ll b) {if(b < a) {a = b; return 1;} return 0;}
bool chmax(ll &a, ll b) {if(b > a) {a = b; return 1;} return 0;}
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
const ll MAX = 1e9;
const char newl = '\n';

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

  ll n;
  string s;
  cin >> n >> s;
  
  vl f(n);
  vl exist(26);
  rep(i, n) if(!exist[s[i]-'a']) {
    exist[s[i]-'a'] = 1;
    f[i]++;
  }
  exist = vl (26, 0);
  rep(i, n) if(!exist[s[n-1-i]-'a']) {
    exist[s[n-1-i]-'a'] = 1;
    f[n-1-i]--;
  }
  ll ans=0, cnt=0;
  rep(i, n) {
    cnt += f[i];
    chmax(ans, cnt);
  }
  cout << ans << newl;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h> //C++の機能を「全て」読み込むための命令
#define rep(i,n) for(int i=0; i<(n); ++i)
#define cout(x) cout<<x<<endl
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
using vi = vector<int>;
using Mat = vector<vector<int>>;

int main(){
    //読み込み
    int n,m;
    cin >> n >> m;
    vi k(m);
    Mat s(m);
    rep(i,m){
        cin >> k[i];
        rep(j,k[i]){
            int s_;
            cin >> s_;
            s[i].push_back(s_);
        }
    }
    vi p(m);
    rep(i,m) cin >> p[i];

    //スイッチの状態の組み合わせ(最大1024通り)を全探索．
    bool can = true;
    int ans = 0;
    for(int t=0; t<(1<<n); ++t){
        can = true;
        bitset<11> ss(t);
        for(int i=0; i<m; ++i){
            int sum = 0;
            for(int j=0; j<k[i]; ++j){
                if(ss.test(s[i][j]-1)) sum += 1;
            }
            if(p[i]!=sum%2){
                can = false; 
                break;
            }
        }
        if(can) ans += 1;
    }
    cout(ans);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF (1<<30)
#define MOD 1000000007
#define l_ength size
using ll = long long;
using namespace std;
int main(){
	int n, m;
	cin >> n;
	m = n;
	int sum = 0;
	while(n){
		sum += n % 10;
		n /= 10;
	}
	if(m%sum == 0){
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
	return 0;
}

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

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

  long long a_cnt, b_cnt;
  a_cnt = b_cnt = 0;
  for (int i=0; i<n; i++) {
    int c = b[i] - a[i];
    if (c > 0) {
      if (c <= a_cnt) {
        a_cnt -= c / 2;
      } else {
        b_cnt += c / 2 - a_cnt;
        a_cnt = 0;
      }
    } else if (c < 0) {
      c = abs(c);
      if (c <= b_cnt) {
        b_cnt -= c;
      } else  {
        a_cnt += c - b_cnt;
        b_cnt = 0;
      }
    }
  }
  if (b_cnt >= a_cnt) {
    cout<<"Yes"<<endl;
  } else {
    cout<<"No"<<endl;
  }
}

Measured memory_bytes: 384