akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(), (x).end())
#define ALL(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define reps(i, m, n) for (ll i = m; i < n; i++)
#define repr(i, m, n) for (ll i = m; i >= n; i--)
#define de(x) cout << #x << "=" << x << endl;
#define SP << " " <<
template <class T> bool maxi(T &a, const T &b) {
    if (a < b) { a = b; return 1;} return 0;}
template <class T> bool mini(T &a, const T &b) {
    if (b < a) { a = b; return 1;} return 0;}
#define dame {cout<< "-1" <<"\n"; return;}
#define INF2 1000000000000000037
#define INF  1000000007
#define MOD  1000000007
using namespace std;
using ll = long long;
using ld = long double;
using P  = pair<ll,ll>;
//--GLOBAL---------------------------------

//--MAIN-----------------------------------
void Main() {
    ll A,B; cin>>A>>B;
    rep(i,10000){
        if(i*8/100==A and i*10/100==B){
            cout<< i <<"\n";
            return;
        }
    }
    dame;
}

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


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

#define int long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define dbg(x) cerr << #x << ": " << x << endl;
#define dbg2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define dbg3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define dbgB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

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

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

template<typename T>
void print1(T begin, T end) {
  while (begin != end) {
    cerr << (*begin) << " ";
    *begin++;
  }
  cerr << endl;
}

template<typename T>
void print2(T Array, int height, int width) {
  for (int i = 0; i < height; i++) {
    for (int j = 0; j < width; j++) {
      cerr << " " << Array[i][j];
    }
    cerr << endl;
  }
}

void print() { std::cerr << endl; }
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  std::cerr << head << " ";
  print(std::forward<Tail>(tail)...);
}

template<class T>
void Add(T &a, const T &b, const T &mod=1000000007) {
  int val = ((a % mod) + (b % mod)) % mod;
  if (val < 0) { val += mod; }
  a = val;
}

template <typename X, typename T> auto vectors(X x, T a) { return vector<T>(x, a); }
template <typename X, typename Y, typename Z, typename... Zs> auto vectors(X x, Y y, Z z, Zs... zs) { auto cont = vectors(y, z, zs...); return vector<decltype(cont)>(x, cont); }

// ------------------------------------------------------------------------------------------

signed main() {
  int n, k;
  cin >> n >> k;

  int ans = 0;
  for (int i = 0; i <= max(0ll,n-k); i++) {
    ans++;
  }
  cout << ans << endl;


  return 0;
}

Measured memory_bytes: 256
//For higher stack size use g++ -O2 -std=c++11 -Wall -Wl,--stack=268435456 a.cpp -o a.exe in cmd
    #include <bits/stdc++.h>
    #include <cstdio>
    #include <cstring>
    #include <cmath>
    #include <cstring>
    #include <chrono>
    #include <complex>
    #define ll long long
    #define ld long double
    #define vi vector<int>
    #define vll vector<ll>
    #define vvi vector < vi >
    #define pii pair<int,int>
    #define pll pair<long long, long long>
    #define mod 1000000007
    #define inf 1000000000000000001;
    #define all(c) c.begin(),c.end()
    #define mp(x,y) make_pair(x,y)
    #define mem(a,val) memset(a,val,sizeof(a))
    #define eb emplace_back
    #define pb push_back
    #define f first
    #define s second
    
    using namespace std;
    int main()
    {
        std::ios::sync_with_stdio(false);
        int T;
        T=1;
        // cin.ignore(); must be there when using getline(cin, s)
        while(T--)
        {
            string s;
            cin>>s;
            ll ans=0,i,j;
            for(i=0;i<s.length();++i)
            {
                ans=(ans+s[i]-'0');
            }
            if(ans%9==0)
            {
                cout<<"Yes"<<endl;
            }
            else
            {
                cout<<"No"<<endl;
            }
        }
        return 0;
    }


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

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

int main() {
  int n;
  cin >> n;
  bool yes = false;
  if(n%f(n) == 0) yes = true;
  if(yes) puts("Yes");
  else puts("No");
  return 0;
}


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

typedef struct{
  int k;
  int pk;
  int lk;
  int rk;
}Heap;

int main(){
  Heap A[251];
  int H;
  int i;

  scanf("%d", &H);
  if(250 < H)
    exit(0);

  for(i = 1; i <= H; i++){
    scanf("%d", &A[i].k);
    if(A[i].k < -2000000000 || 2000000000 < A[i].k)
      exit(1);
    A[i].pk = NULL;
    A[i].lk = NULL;
    A[i].rk = NULL;
  }
    
  for(i = 1; i <= H; i++){
    if(i == 1){
      if(i * 2 <= H && A[i*2].k != NULL)
	A[i].lk = A[i*2].k;
      if(i * 2 + 1 <= H && A[i*2+1].k != NULL)
	A[i].rk = A[i*2+1].k;
    }
    else{
      A[i].pk = A[i/2].k;
      if(i * 2 <= H && A[i*2].k != NULL)
	A[i].lk = A[i*2].k;
      if(i * 2 + 1 <= H && A[i*2+1].k != NULL)
	A[i].rk = A[i*2+1].k;
    }
  }

  for(i = 1; i <= H; i++){
    printf("node %d: key = %d, ", i, A[i].k);
    if(A[i].pk != NULL)
      printf("parent key = %d, ", A[i].pk);
    if(A[i].lk != NULL)
      printf("left key = %d, ", A[i].lk);
    if(A[i].rk != NULL)
      printf("right key = %d, ", A[i].rk);
    printf("\n");
  }

  return 0;
}

Measured memory_bytes: 604
// practice with kaiboy
import java.io.*;
import java.util.*;

public class Main extends PrintWriter {
	Main() { super(System.out, true); }
	Scanner sc = new Scanner(System.in);
	public static void main(String[] $) {
		Main o = new Main(); o.main(); o.flush();
	}

	static final int MD = 1000000007;
	long gcd(long a, long b) {
		return b == 0 ? a : gcd(b, a % b);
	}
	static class V {
		long a, b;
		V(long a, long b) {
			this.a = a; this.b = b;
		}
	}
	void main() {
		int n = sc.nextInt();
		V[] uu = new V[n];
		V[] vv = new V[n];
		int nu = 0, nv = 0;
		int z = 0, pa = 1, pb = 1;
		for (int i = 0; i < n; i++) {
			long a = sc.nextLong();
			long b = sc.nextLong();
			if (a == 0 && b == 0) {
				z++;
				continue;
			}
			if (a == 0) {
				pa = pa * 2 % MD;
				continue;
			}
			if (b == 0) {
				pb = pb * 2 % MD;
				continue;
			}
			if (b < 0) {
				a = -a;
				b = -b;
			}
			long d = gcd(Math.abs(a), b); a /= d; b /= d;
			if (a > 0)
				uu[nu++] = new V(a, b);
			else
				vv[nv++] = new V(b, -a);
		}
		long ans = (pa + pb - 1) % MD;
		Arrays.sort(uu, 0, nu, (u, v) -> Long.signum(u.a != v.a ? u.a - v.a : u.b - v.b));
		Arrays.sort(vv, 0, nv, (u, v) -> Long.signum(u.a != v.a ? u.a - v.a : u.b - v.b));
		for (int i = 0, j = 0; i < nu || j < nv; ) {
			int mode;
			if (j == nv)
				mode = 1;
			else if (i == nu)
				mode = 2;
			else if (uu[i].a < vv[j].a)
				mode = 1;
			else if (uu[i].a > vv[j].a)
				mode = 2;
			else if (uu[i].b < vv[j].b)
				mode = 1;
			else if (uu[i].b > vv[j].b)
				mode = 2;
			else
				mode = 0;
			int pu = 1, pv = 1;
			if (mode != 2) {
				int i_ = i;
				while (i_ < nu && uu[i_].a == uu[i].a && uu[i_].b == uu[i].b) {
					pu = pu * 2 % MD;
					i_++;
				}
				i = i_;
			}
			if (mode != 1) {
				int j_ = j;
				while (j_ < nv && vv[j_].a == vv[j].a && vv[j_].b == vv[j].b) {
					pv = pv * 2 % MD;
					j_++;
				}
				j = j_;
			}
			if (mode == 1)
				ans = ans * pu % MD;
			else if (mode == 2)
				ans = ans * pv % MD;
			else
				ans = ans * (pu + pv - 1) % MD;
		}
		ans = (ans + z - 1) % MD;
		if (ans < 0)
			ans += MD;
		println(ans);
	}
}


Measured memory_bytes: 68752
# include <iostream>

using namespace std;

int main(){
    int a, b, c, d;
    int S1, S2;

    cin >> a >> b >> c >> d;

    S1 = a * b;
    S2 = c * d;

    if(S2 < S1){
        cout << S1 << endl;
    } else {
        cout << S2 << endl;
    }

    return 0;
}


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

using namespace std;
typedef long long ll;

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

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

    ll ans = 0;
    for(int i=0;i<n;i++){
        ans += a[i];
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
N,K=list(map(int,input().split()))
h=list(map(int,input().split()))

dp=[10**10]*N
dp[0]=0

for i in range(1,N):
    for k in range(max(0,i-K),i):
        dp[i]=min(dp[i],abs(h[i]-h[k])+dp[k])

print(dp[N-1])

Measured memory_bytes: 52448
#include <iostream>
#include <cmath>
#include <string>
using namespace std;
int main(){
    int a,b,c,d,i,n;
    int arr1[7] = {1,3,5,7,8,10,12},arr2[4] = {4,6,9,11},arr3 = {2};
    cin>>a>>b;
    c = a;
    d = b;
    for(i = 0;i < 7;i++){
        if(c==arr1[i]){
            c = 0;
        }
        if(d==arr1[i]){
            d = 0;
        }
    }
    if(c==0&&d==0){
        cout<<"Yes";
        return 0;
    }
    c = a;
    d = b;
    for(i = 0;i < 4;i++){
        if(c==arr2[i]){
            c = 0;
        }
        if(d==arr2[i]){
            d = 0;
        }
    }
    if(c==0&&d==0){
        cout<<"Yes";
    }
    else{
        cout<<"No";
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>

using namespace std;
typedef long double ld;

ld a,b,x;

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

  cin >> a >> b >> x;

  if (a * a * b == x) {
    cout << 0 << "\n";
    return 0;
  }

  ld h = x / (a * a);
  ld area = h * a;
  ld h2 = area * 2 / b;
  if (h2 <= a) {
    ld radian = atan2(b, h2);
    ld degree = radian * 180.0 / M_PI;

    printf("%.10Lf\n", degree);
    return 0;
  } else {
    ld space = a * b - area;
    ld h3 = space * 2 / a;

    ld radian = atan2(h3, a);
    ld degree = radian * 180.0 / M_PI;
    printf("%.10Lf\n", degree);
    return 0;
  }
}


Measured memory_bytes: 256
// Try AtCoder
// author: Leonardone @ NEETSDKASU

fn main() {
	let mut stdin = String::new();
    std::io::Read::read_to_string(
    	&mut std::io::stdin(),
        &mut stdin).unwrap();
	let mut stdin = stdin.split_whitespace();
    let mut get = || stdin.next().unwrap();
    macro_rules! get {
    	($t:ty) => (get().parse::<$t>().unwrap());
        () => (get!(i64));
    }
    
    let n = get!();
    let mut ps = vec![];
    for _ in 0..n {
    	let xi = get!();
        let yi = get!();
        let hi = get!();
        ps.push((hi, xi, yi));
    }
    ps.sort();
    let mut map = vec![];
    if let Some((hi, xi, yi)) = ps.pop() {
    	for cy in 0..101 {
	        for cx in 0..101 {
            	let h = hi + (xi - cx).abs() + (yi - cy).abs();
                map.push((h, cx, cy));
    	    }
		}
    }
    while let Some((hi, xi, yi)) = ps.pop() {
    	let mut tmp = vec![];
        for &(h, cx, cy) in map.iter() {
        	let e = std::cmp::max(h - (xi - cx).abs() - (yi - cy).abs(), 0);
            if e == hi {
            	tmp.push((h, cx, cy));
            }
        }
        map = tmp;
    }
    
    if let Some((h, cx, cy)) = map.pop() {
    	println!("{} {} {}", cx, cy, h);
    }
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define N 1100000
#define ll long long
ll K;
int n,m,top;
int a[N],p[N],pos[N],vis[N],fin[N],st[N];
ll v[N],v1[N];
int main()
{
	//freopen("tt.in","r",stdin);
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%lld",&v[i]),p[i]=i;
	scanf("%d%lld",&m,&K);
	for(int i=1;i<=m;i++)
		scanf("%d",&a[i]);
	for(int i=1;i<=m;i++)
		swap(p[a[i]],p[a[i]+1]);
	for(int i=1;i<=n;i++)pos[p[i]]=i;
	for(int i=1,now;i<=n;i++)if(!vis[i])
	{
		st[0]=i;vis[i]=1;top=1;
		now=pos[i];
		while(now!=i)
		{
			st[top]=now;vis[now]=1;top++;
			now=pos[now];
		}
		int t=K%top;
		for(int j=0;j<top;j++)
			fin[st[(j+t)%top]]=st[j];
	}
	v1[1]=v[1];
	for(int i=2;i<=n;i++)v1[i]=v[i]-v[i-1];
	for(int i=1;i<=n;i++)v[i]=v1[fin[i]];
	v1[1]=v[1];
	for(int i=2;i<=n;i++)v1[i]=v[i]+v1[i-1];
	for(int i=1;i<=n;i++)
		printf("%lld.0\n",v1[i]);
	return 0;
}


Measured memory_bytes: 18560
import bisect
def justM(x,N):
    sum_=0
    for i in range(N):
        b=bisect.bisect_left(A,x-A[i])
        sum_+=N-b
    return sum_

N,M=map(int,input().split())
A=sorted(map(int,input().split()))
left,right=-1,(10**5)*2+1
while(right-left>1):
    mid=(right+left)//2
    s=justM(mid,N)
    if s<M:
        right=mid
    else:
        left=mid
D=left
r=[0]*(N+1)
ans=0
for i in range(N):
    r[i+1]=r[i]+A[i]
cnt=0
for i in range(N):
    b=bisect.bisect_left(A,D-A[i])
    ans+=A[i]*(N-b)+(r[N]-r[b])
    cnt+=N-b
print(ans-D*(cnt-M))

Measured memory_bytes: 55352
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
long long n;
long long pow5(long long x){
    long long res=1;
    for (int i=0;i<5;i++){
        res*=x;
    }
    return res;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>n;
    for (long long a=-1000;a<=1000;a++){
        for (long long b=-1000;b<=1000;b++){
            if (pow5(a)-pow5(b)==n){
                cout<<a<<' '<<b;
                return 0;
            }
        }
    }

}

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

public class Hello{
    public static void Main(){
        var input = Console.ReadLine().Split(' ').Select (x => Int32.Parse(x)).ToList();
        var awake = input[0] * 60 + input[1];
        var sleep = input[2] * 60 + input[3];
        if(sleep < awake) sleep += 24 * 60;
        var ret = sleep - awake - input[4];
        Console.WriteLine(ret > 0? ret: 0);
    }
}


Measured memory_bytes: 28316
#include <stdio.h>

int main(void) {
   
    int n,i;
    scanf("%d",&n);
    for (i=1; i<=n; i++){
        if (i%3==0) printf(" %d",i);
      else if(i%10==3)printf(" %d",i);
      else if(i/10%10==3)printf(" %d",i);
      else if(i/100%10==3)printf(" %d",i);
      else if(i/1000%10==3)printf(" %d",i);
       
        }
    
    printf("\n");
    return 0;
}

Measured memory_bytes: 600
import java.util.*;
public class Main{
  public static void main(String[]args){
      Scanner sc = new Scanner(System.in);

      int a = sc.nextInt();
      int b = sc.nextInt();

      if(a<=8&&b<=8){
        System.out.println("Yay!");
      }
      if(a>8||b>8){
      System.out.println(":(");
      }



      }

  }


Measured memory_bytes: 20820
process.stdin.resume();
process.stdin.setEncoding('utf8');

var lines = [];
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
reader.on('line', (line) => {
  lines.push(line.split(" "));
});
reader.on('close', () => {
  solve();
});

function getInt(strArr){
  var rtn = [];
  for(elem of strArr)rtn.push(parseInt(elem));
  return rtn;
}

function getFloat(strArr){
  var rtn = [];
  for(elem of strArr)rtn.push(parseFloat(elem));
  return rtn;
}

function solve(){
  var [z] = lines[0];
  console.log( String.fromCharCode(z.charCodeAt()+1) );
}

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

typedef long long LL;

const int N=300,mod=998244353;

int add(int a,int b,int p=mod){return a+b>=p?a+b-p:a+b;}
int sub(int a,int b,int p=mod){return a-b<0?a-b+p:a-b;}
int mul(int a,int b,int p=mod){return (LL)a*b%p;}
void sadd(int &a,int b,int p=mod){a=add(a,b,p);}
void ssub(int &a,int b,int p=mod){a=sub(a,b,p);}
void smul(int &a,int b,int p=mod){a=mul(a,b,p);}

char s[N+9];
int n,m,c[N+9],cc,cnt[N+9];
int dp[N+9][N+9][N+9],sum[N+9][N+9][2];

void work(){
  scanf("%s%d",s+1,&m);
  n=strlen(s+1);
  int now=0;
  for (int i=1;i<=n;++i)
	s[i]=='0'?++now:c[++cc]=now;
  m=min(m,cc);
  for (int i=1;i<=cc;++i) ++cnt[c[i]];
  dp[now+1][0][0]=1;
  int count=0;
  for (int i=now;i>=0;--i){
	count+=cnt[i];
	//memset(sum,0,sizeof(sum));
    for (int j=0;j<=count;++j)
	  for (int k=0;k<=j&&k<=m;++k){
		sum[j][k][0]=dp[i+1][j][k];
		if (j&&k) sadd(sum[j][k][0],sum[j-1][k-1][0]);
		sum[j][k][1]=dp[i+1][j][k];
		if (j) sadd(sum[j][k][1],sum[j-1][k][1]);
	  }
	for (int j=0;j<=count;++j)
	  for (int k=0;k<=j&&k<=m;++k){
		if (j>cnt[i]&&k) sadd(dp[i][j][k],sum[j-cnt[i]-1][k-1][0]);
		sadd(dp[i][j][k],sum[j][k][1]);
		if (j>cnt[i]) ssub(dp[i][j][k],sum[j-cnt[i]-1][k][1]);
		//printf("%d %d %d : %d\n",i,j,k,dp[i][j][k]);
	  }
  }
  //printf("%d %d\n",count,cc);
  int ans=0;
  for (int k=0;k<=m;++k) sadd(ans,dp[0][count][k]);
  printf("%d\n",ans);
}

int main(){
  int T=1;
  //scanf("%d",&T);
  for (;T--;) work();
  return 0;
}

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

using namespace std;

#define REP1(i,n) for(int i=1, i##_len=(n); i<i##_len; ++i)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define pow(x) x*x
#define ll long long
static const ll MAX = 1000000;
static const ll INFTY = 1e12;

struct edge {
    ll to, cost;
};

using Graph = vector<vector<int>>;
using _Graph = vector<vector<edge>>;
// 入力
int H, W;
vector<vector<char>> field;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

// 深さ優先探索
vector<bool> seen;
vector<int> colors;


int main() {

    ll N; cin >> N;
    vector<ll> H(N);
    REP(i, N)cin >> H[i];

    reverse(H.begin(), H.end());

    REP(i, N-1){
        ll tmp = H[i+1] - H[i];
        if(tmp <= 0){
            continue;
        }
        if(tmp == 1){
            H[i+1]--;
            continue;
        }
        if(tmp > 1){
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;


}
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <sstream>
#include <iomanip>
#include <queue>

#define rep(i,n) for(int i = 0; i < n; i++)
#define rep1(i,n) for(int i = 1; i <= n; i++)
#define co(x) cout << x <<endl
#define cs(x) cout << x <<" "
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
using namespace std;

int main()
{
	int N, Q;
	cin >> N >> Q;
	string S;
	cin >> S;
	vector<int> l(Q + 1);
	vector<int> r(Q + 1);
	rep1(i, Q) cin >> l[i] >> r[i];
	vector<int> c(N); c[0] = 0;
	rep1(i, N-1)
	{
		if (S[i - 1] == 'A' && S[i] == 'C')
			c[i] = c[i - 1] + 1;
		else c[i] = c[i - 1];
	}
	rep1(i, Q)
	{
			co(c[r[i]-1] - c[l[i] - 1]);
	}
	return 0;
}


Measured memory_bytes: 2176
#include <bits/stdc++.h>
 
using namespace std;
 
int dfs(int x, int n, int s)
{
    if (n == 0) {
        return (s == 0);
    }
    if (x == 10) return 0;
             
    int res = 0;
    for (int i = x; i <= 9; i++) {
        res += dfs(i + 1, n - 1, s - i);
    }
    return res;
}
 
int main()
{
    int n, s;
    while (cin >> n >> s, n) {
        cout << dfs(0, n, s) << endl;
    }
    return 0;
}

Measured memory_bytes: 3004
//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin, output: process.stdout
});
var obj; var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error('\n↑入力 ↓出力');
  Main();
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){  
  return {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}}
  };
}
function myout(s){console.log(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
  var N = nextInt();
  var list = nextIntArray();
  var set = new Set();
  for(var i = 0; i < N; i++){
    set.add(list[i]);
  }
  myout((N == set.size) ? "YES" : "NO");
}



Measured memory_bytes: 58284
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(a) (a).begin(),(a).end()
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
const int INF=1e9;
bool used[5050];
vector<int>G[5050];
vector<int>ans;
int rec(int x){
  REP(i,G[x].size()){
    int to=G[x][i];
    if(used[to])continue;
    rec(to);
  }
  ans.PB(x);
  used[x]=true;
}
int main(){
  int n,m;
  while(cin>>n>>m){
    REP(i,n)G[i].clear();
    ans.clear();
    memset(used,false,sizeof(used));
    REP(i,m){int a,b;cin>>a>>b;G[--b].PB(--a);}
    REP(i,n)if(!used[i])rec(i);
    REP(i,n){
      cout<<ans[i]+1<<endl;
    }
    bool ok=true;
    REP(i,n-1){
      int a=ans[i];
      int b=ans[i+1];
      bool f=false;
      REP(i,G[b].size()){
        if(G[b][i]==a)f=true;
      }
      if(!f){
        ok=false;break;
      }
    }
    if(ok)cout<<0<<endl;
    else cout<<1<<endl;
  }
}

Measured memory_bytes: 2028
#include<bits/stdc++.h>
using namespace std;
int n,a[100100];
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
		if(a[i]<a[i-1]){cout<<"No";return 0;}
		if(a[i]!=a[i-1]) a[i]--;
	}
	cout<<"Yes";
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int count;
  int a;
  string s,t;
  cin>>s>>t;
  a=s.size();
  count=0;
  for (int i = 0; i < a; i++) {
    char x,y;
    x=s[i];
      y=t[i];
    if(x != y){
      count++;
    }
  }
  cout<<count<<endl;
}

Measured memory_bytes: 3852
s = input()
li = ['dream', 'dreamer', 'erase', 'eraser']

while s != '':
    for a in li:
        if s[-len(a):] == a:
            s = s[:-len(a)]
            break
    else:
        break
if s == '':
    print('YES')
else:
    print('NO')


Measured memory_bytes: 3188
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String t = sc.next();
    int n = s.length();
    if(t.substring(0, n).equals(s)){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  }
}





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

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int N, K; cin >> N >> K;
	vector<int> A(N);
	for (int& v : A) cin >> v;

	int totSum = accumulate(A.begin(), A.end(), 0);
	for (int x = totSum; true; x--) {
		if (totSum % x) continue;

		int remSum = 0;
		for (int i = 0; i < N; i++) {
			remSum += A[i] % x;
		}
		int cnt = remSum / x;

		nth_element(A.begin(), A.begin() + N - cnt, A.end(), [&](int a, int b) {
			return a % x < b % x;
		});
		int cost = 0;
		for (int i = 0; i < N - cnt; i++) {
			cost += A[i] % x;
		}
		if (cost <= K) {
			cout << x << '\n';
			exit(0);
		}
	}

	return 0;
}


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

int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}

int main(void){
  int n, v[50] = {0};
  double ans;
  scanf("%d", &n);getchar();
  for(int i = 0; i < n; i++){
    scanf("%d", &v[i]);getchar();
  }
  qsort(v, n, sizeof(int), compare_int);
  
  ans = v[0];
  for(int i = 1; i < n; i++){
    ans = (ans + (double)v[i]) / 2.0;
  }
  printf("%.7f", ans);
  return 0;
}

Measured memory_bytes: 128
#include<cstdio>
int main()
{
	int N;
	scanf("%d",&N);
	int ans=N;
	for(int i=0;i<=N;i++)
	{
		int num=0,t=i;
		while(t) num+=t%6,t/=6;
		t=N-i;
		while(t) num+=t%9,t/=9;
		if(num<ans) ans=num;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 128
#!/usr/bin/env python3
import sys


def solve(N: int, a: "List[int]"):
    def f(n):
        res = 0
        while n % 2 == 0:
            n //= 2
            res += 1
        return res
    return sum(map(f, a))


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    print(solve(N, a))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    #test()
    main()


Measured memory_bytes: 10116
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using uint = unsigned int;
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#include"debug_deque.hpp"
#define vector DebugDeque
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printe) FUNC(printw) FUNC(printew) FUNC(printb) FUNC(printd) FUNC(printde);
#endif

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, a, b;
    cin >> n >> a >> b;
    cout << min(b, a * n) << '\n';
}


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

using namespace std;

const int OO = 1e9;
const double EPS = 1e-9;

#define ndl cout << '\n'
#define sz(v) int(v.size())
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define present(a, x) (a.find(x) != a.end())
#ifdef LOCAL
#define db(...) ({cout << "> Line " << __LINE__  \
		<< ": "; _db(#__VA_ARGS__, __VA_ARGS__);})
#define RNG() rng()
#else
#define db(...) true
#define RNG() true
#endif

template<class T>
void _db(const char *dbStr, T e) {
	cout << dbStr << " = " << e << endl;
}
template<class T, class... L>
void _db(const char *dbStr, T e, L... r) {
  while(*dbStr != ',') cout << *dbStr++;
  cout << " = " << e << ','; _db(dbStr + 1, r...);
}
template<class S, class T>
ostream& operator<<(ostream& o, const map<S, T>& v) {
	o << "["; int i = 0;
	for (const pair<S, T>& pr : v) o << (!i++ ? "" : ", ") << "{"
	<< pr.fs << " : " << pr.sc << "}"; return o << "]";
}
template<template <class, class...> class S, class T, class... L>
ostream& operator<<(ostream& o, const S<T, L...>& v) {
	o << "["; int i = 0;
	for (const auto& e : v) o << (!i++ ? "" : ", ") << e;
	return o << "]";
}
template<class S, class T>
ostream& operator<<(ostream& o, const pair<S, T>& pr) {
	return o << "(" << pr.fs << ", " << pr.sc << ")";
}
ostream& operator<<(ostream& o, const string& s) {
	for (const char& c : s) o << c;
	return o;
}

template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;
template<class T> using VVV = VV<V<T>>;
using ll = long long;
using pii = pair<int, int>;
using vi = V<int>;
using vii = V<pii>;
using vvi = VV<int>;
using mii = map<int, int>;
using umii = unordered_map<int, int>;
using si = set<int>;
using usi = unordered_set<int>;





int main() {
	#ifdef LOCAL
	auto stTime = clock();
//	freopen("in.txt", "r", stdin);
	mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
	#endif
	ios::sync_with_stdio(false);
	cout.precision(10);
	cin.tie(0);


	int A, B;

	cin >> A >> B;

	for (int i = 1; i <= 100000; ++i) {
		if (i * 8 / 100 == A && i * 10 / 100 == B) {
			cout << i << '\n';
			return 0;
		}
	}
	cout << -1 << '\n';

	#ifdef LOCAL
	cout << "\n\n\nExecution time: " <<
		(clock() - stTime) * 1e3 / CLOCKS_PER_SEC << " ms" << endl;
	#endif
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<iomanip>
using namespace std;
typedef long long ll;

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

    int ans = 0;
    for (int i = 1; i <= n; i++) {
        if (i < 10) ans++;
        if (i >= 10 && i < 100) continue;
        if (i >= 100 && i < 1000) ans++;
        if (i >= 1000 && i < 10000) continue;
        if (i >= 10000 && i < 100000) ans++;
    }
    cout << ans << endl;
}


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

class AtCode {
  static void Main() {
    var input = Console.ReadLine().Trim().Split(' ');
    var N = int.Parse(input[0]);
    var K = int.Parse(input[1]);
    var Q = int.Parse(input[2]);
        
    int[] scores = Enumerable.Repeat(0, N).ToArray();
    var threshhold = Q - K;
    
    for(var i = 0; i < Q; i++) {
    	int p = int.Parse(Console.ReadLine().Trim()) - 1;
        scores[p]++;
    }
    
    for(var i = 0; i < N; i++) {
      if(scores[i] > threshhold) {
        Console.WriteLine("Yes");
      } else {
        Console.WriteLine("No");
      }
    }
  }
}

Measured memory_bytes: 18784
#include <iostream>
#include <vector>
#include <algorithm>
#include <cassert>
#include <functional>
#include <numeric>
#include <limits>
#include <iomanip>
#include <queue>
#include <cmath>
#include <math.h>
#include <string>
#include <math.h>
#define PI 3.14159265359
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const long long INF = 1LL << 60;
using pll = pair<long long, long long>;

int main() {

	// 標準入力が早くなる。Cスタイルの入出力とC++スタイルの入出力を混合させてはならない。
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);

	string N;
	cin >> N;


	if (string(N).find('7') != std::string::npos) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}


Measured memory_bytes: 3104
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define int long long
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;
typedef complex<ld> com;
constexpr int inf = 1000000010;
constexpr ll INF = 1000000000000000010;
constexpr ld eps = 1e-12;
constexpr ld pi = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }


signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);

	bool flag = false;
	cout << "? " << 1000000000 << endl;
	char c;
	cin >> c;
	if (c == 'Y') flag = true;
	if (flag) {
		int check = 999999999;
		while (true) {
			cout << "? " << check << endl;
			char d;
			cin >> d;
			if (d == 'N') {
				cout << "! " << check + 1 << endl;
				return 0;
			}
			else if (d == 'Y'&&check == 9) {
				cout << "! " << 1 << endl;
				return 0;
			}
			check /= 10;
		}
	}
	else {
		int dig = 9;
		int check = 100000000;
		while (true) {
			cout << "? " << check << endl;
			char d;
			cin >> d;
			if (d == 'Y') break;
			else dig--;
			check /= 10;
		}
		int ok = 1;
		rep(_, dig - 1) ok *= 10;
		int ng = ok * 10;
		while (ng - ok > 1) {
			int mid = (ok + ng) / 2;
			cout << "? " << mid * 10 << endl;
			char d;
			cin >> d;
			if (d == 'N') ok = mid;
			else ng = mid;
		}
		cout << "! " << ng << endl;
	}
}

Measured memory_bytes: 596
#include <stdio.h>

int main()
{
	int dat[4] = {};
	int a, b;

	for (int i = 0; i < 3; i++) {
		scanf("%d %d", &a, &b);

		dat[a - 1]++;
		dat[b - 1]++;
	}

	if (dat[0] == 3 ||
			dat[1] == 3 ||
			dat[2] == 3 ||
			dat[3] == 3) {
		puts("NO");
	} else {
		puts("YES");
	}

	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
struct SegmentTree {
    ll n;
    vector<l_l> node;

    SegmentTree() {
        int sz = 100050;
        n = 1;
        while(n < sz) n *= 2;
        node.resize(2*n-1);
        for(int i = 0; i < sz; i++) {
            node[i+n-1] = {0, 0};
        }
        for(int i = n - 2; i >= 0; i--) node[i] = {0, 0};
    }
    void update(ll x, l_l val) {
         x += n - 1;
         node[x] = val;
         while(x > 0) {
             x = (x - 1) / 2;
             node[x] = max(node[2*x+1], node[2*x+2]);
         }
    }

    l_l getmax(int a, int b, int k = 0, int l=0, int r=-1) {
        if(r<0) r = n;
        if(r <= a || b <= l) return {0, 0};
        if(a<=l && r <= b) return node[k];
        l_l vl = getmax(a,b,2*k+1,l,(l+r)/2);
        l_l vr = getmax(a,b,2*k+2,(l+r)/2, r);
        return max(vl, vr);
    }
};

int main() {
    ll N;
    cin >> N;
    SegmentTree seg;
    vector<l_l> A(N);
    for(ll i = 1; i <= N; i++) {
        A[i-1].second = i;
        cin >> A[i-1].first;
        A[i-1].first = -A[i-1].first;
    }
    sort(A.begin(), A.end());
    for(int i = 0; i < N; i++) {
        A[i].first = -A[i].first;
        int index = A[i].second;
        l_l maximum = seg.getmax(index, N + 1);
        l_l NEW = maximum;
        NEW.first++;
        NEW.second += A[i].first;
        seg.update(index, NEW);
        //cout << endl << i << endl;
        //for(int j = 1; j <= N; j++) {
            //l_l now = seg.getmax(j, j+1);
            //cout << j << " " << now.first << " " << now.second << endl;
        //}
        //cout << i << " " << index << " " << NEW.first << " "<< NEW.second << endl;

    }
    ll ans = 0;
    ll longest = 0;
    for(int i = 1; i <= N; i++) {
        longest = max(longest, seg.getmax(i,i+1).first);
    }
    for(int i = 1; i <= N; i++) {
        l_l val = seg.getmax(i, i+1);
        if(val.first != longest) continue;
        //cout << i << " " << val.first << "s " << val.second << endl;
        ans = max(ans, val.second);
    }
    cout << ans << endl;
}


Measured memory_bytes: 8396
import sys

while True:
    n=int(input())
    if n==0:
        break
    w = [int(x) for x in sys.stdin.readline().split()]

    dp=[[0]*n for i in range(n)] 

    for l in range(n-1):
        r=l+1
        if abs(w[l]-w[r])<2:
            dp[l][r]=2
        
    for i in range(2,n):
        if i%2==1:
            for l in range(n-i):
                r=l+i
                if dp[l+1][r-1]==r-l-1 and abs(w[l]-w[r])<2:
                    dp[l][r]=r-l+1
                else:
                    for lr in range(l+1,r):
                        if dp[l][r]< dp[l][lr]+dp[lr+1][r]:
                            dp[l][r]=dp[l][lr]+dp[lr+1][r]
        else:
            for l in range(n-i):
                r=l+i
#                dp[l][r]=max(dp[l][r],dp[l+1][r],dp[l][r-1])
                if dp[l][r]<dp[l+1][r]:
                    dp[l][r]=dp[l+1][r]
                if dp[l][r]<dp[l][r-1]:
                    dp[l][r]=dp[l][r-1]
    print(dp[0][n-1])



Measured memory_bytes: 7108
#include <bits/stdc++.h>
using namespace std;
int main () {
  int N;
  string S;
  cin >> N >> S;
  int ans = 0, sub = 0;
  for(char a: S) {
    if (a == 'I') sub++;
    else sub--;
    ans = max(ans, sub);
  }
  cout << ans << endl;
  return 0;
}


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

using fint64 = int_fast64_t;
template<fint64 MOD>
struct ModInt {
	fint64 x;
	ModInt():x(0){}
	ModInt(fint64 x):
		x(x>=0?x%MOD:(MOD-(-x)%MOD)%MOD)
		{}
	// 負号
	ModInt operator -() const{
		return ModInt(-x);
	}
	// 加算
	ModInt &operator +=(const ModInt &rhs){
		x+=rhs.x;
		if(x>=MOD) x-=MOD;
		return (*this);
	}
	ModInt operator +(const ModInt &rhs) const{
		return ModInt(*this)+=rhs;
	}
	// 減算
	ModInt &operator -=(const ModInt &rhs){
		x+=MOD-rhs.x;
		if(x>=MOD) x-=MOD;
		return (*this);
	}
	ModInt operator -(const ModInt &rhs) const{
		return ModInt(*this)-=rhs;
	}
	// 乗算
	ModInt &operator *=(const ModInt &rhs){
		x*=rhs.x;
		if(x>=MOD) x%=MOD;
		return (*this);
	}
	ModInt operator *(const ModInt &rhs) const{
		return ModInt(*this)*=rhs;
	}
	// 除算
	ModInt &operator /=(const ModInt &rhs){
		(*this)*=rhs.inverse();
		return (*this);
	}
	ModInt operator /(const ModInt &rhs) const{
		return ModInt(*this)/=rhs;
	}
	// 等号
	bool operator ==(const ModInt &rhs){
		return x==rhs.x;
	}
	bool operator !=(const ModInt &rhs){
		return x!=rhs.x;
	}
	// 累乗
	ModInt pow(fint64 n) const{
		fint64 tmp=x;
		fint64 ret=1;
		while(n>0){
			if(n&1) ret=ret*tmp%MOD;
			tmp=tmp*tmp%MOD;
			n>>=1ll;
		}
		return ModInt(ret);
	}
	// 逆元
	ModInt inverse() const{
		fint64 a=x,b=MOD,s=1,t=0;
		while(b>0){
			fint64 u=a/b;
			a-=u*b;
			s-=u*t;
			swap(a,b);
			swap(s,t);
		}
		return ModInt(s);
	}
	// 入出力
	friend istream &operator >>(istream &lhs,ModInt<MOD> &rhs){
		fint64 x; lhs>>x;
		rhs=ModInt<MOD>(x);
		return lhs;
	}
	friend ostream &operator <<(ostream &lhs,const ModInt<MOD> &rhs){
		return lhs<<rhs.x;
	}
};

constexpr int MOD = 998244353;
using mint = ModInt<MOD>;
mint dp[3010][3010];
int main() {
	int n, s; cin >> n >> s;
	int a[n]; for(int i = 0; i < n; ++i) cin >> a[i];
	dp[0][0] = 1;
	for(int i = 0; i < n; ++i) {
		for(int j = 0; j <= s; ++j) {
			dp[i + 1][j] += dp[i][j] * 2;
			if(j + a[i] <= s) {
				dp[i + 1][j + a[i]] += dp[i][j];
			}
		}
	}
	cout << dp[n][s] << '\n';
	return 0;
}

Measured memory_bytes: 74416
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
	
	ll n;
	cin>>n;
	vector<ll> v(n+1,0);
	
	for(ll x=1;x<=sqrt(n-2)-1;x++)
       {
       	
       	for(ll y=1;y<=sqrt(n-2)-1;y++)
       	{
       		for(ll z=1;z<=sqrt(n-2)-1;z++)
       		{
       			
       			if(x*x+y*y+z*z+x*y+y*z+z*x<=n)
       			{
       				v[x*x+y*y+z*z+x*y+y*z+z*x]++;
				   }
       			
       			
       			
			   }
		   }
	   }
	

for(ll i=1;i<v.size();i++)
{
	cout<<v[i]<<endl;
}

}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll INF = mod * mod;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)

int main()
{
    int N, M; cin >> N >> M;

    priority_queue<int, vector<int>> q;
    rep(i,N)
    {
        int a;
        cin >> a;
        q.push(a);
    }

    rep(i,M)
    {
        int a = q.top(); q.pop();
        q.push(a/2);
    }

    ll ans = 0;
    rep(i,N)
    {
        ans += q.top(); q.pop();
    }
    cout << ans << endl;
}

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

int main(){
    int N, K, Q;
    cin >> N >> K >> Q;

    // i番目の問題に正解した参加者
    vector<int> A(Q);
    for(int i=0; i<Q; ++i) cin >> A.at(i);

    // 各参加者の保有ポイント数
    // 予め全員の点数がQだけ減った数としておき
    // 正解した参加者のポイントが1増えると考える
    vector<int> P(N, K-Q);
    for(int i=0; i<Q; ++i) P.at(A.at(i)-1)++;

    // N人の参加者が勝ち抜けたか敗退したかを確認
    for(int j=0; j<N; ++j){
        cout << (P.at(j) > 0 ? "Yes" : "No") << endl;
    }
}

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

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define ll long long
const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1);


int main(void)
{
    ll n; cin>>n;
    vector<ll> a(n);
    rep(i,n) cin>>a[i];
    sort(a.begin(),a.end());
    double ans=a[0];
    for(int i=1;i<n;i++){
        ans+=a[i];
        ans/=2.0;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3832
#include <iostream>
using namespace std;
int main(){
  int N,SUM,sum;
  cin >> N;
  SUM=0;
  sum=0;
  for(int i=0;i<N;i++){
    int d;
    cin >> d;
    SUM=SUM+d;
    sum=sum+d*d;
  }
  cout << (SUM*SUM-sum)/2 << endl;
  return 0;
}

Measured memory_bytes: 256
N = int(input())
A = []
for n in range(N):
    A.append(int(input()))
B = [0 for n in range(N)]
B[0] = A[0]
for n in range(N-1):
    B[n+1] = max(B[n], A[n + 1])
C = [0 for n in range(N)]
C[-1] = A[-1]
for n in range(N - 1):
    C[-n-2] = max(C[-n-1], A[-n - 2])
for n in range(N):
    if n == 0:
        print(C[1])
    elif n == N - 1:
        print(B[N - 2])
    else:
        print(max(B[n-1], C[n+1]))


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

using namespace std;

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

  vector <string> s(n);
  map<string, int> dict;
  for (int i = 0; i < n; i++)
  {
    string str;
    cin >> str;
    dict[str]++;
  }

  int max_cnt = 0;
  for (auto d: dict)
  {
    if (d.second > max_cnt) max_cnt = d.second;
  }

  for (auto d: dict)
  {
    if (d.second == max_cnt)
    {
      cout << d.first << endl;
    }
  }
}

Measured memory_bytes: 27264
#include "bits/stdc++.h"
#include <unordered_set>

#define _CRT_SECURE_NO_WARNINGS

#define REP(i, n) for(decltype(n) i = 0; i < (n); i++)
#define REP2(i, x, n) for(decltype(x) i = (x); i < (n); i++)

#define ALL(a) (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define DESCSORT(c) sort(c.begin(), c.end(), greater<int>())

using namespace std;

using LL = long long int;
using LD = long double;

using pii = pair<int, int>;
using pll = pair<LL, LL>;
using pdd = pair<double, double>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vl = vector<LL>;
using vvl = vector<vl>;
using vvvl = vector<vvl>;
using vd = vector<double>;
using vvd = vector<vd>;
using vs = vector<string>;
using vb = vector<bool>;
using vvb = vector<vb>;

const int INF = (1 << 30) - 1;
const LL INF64 = ((LL)1 << 62) - 1;
const double PI = 3.1415926535897932384626433832795;

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
LL gcd(LL x, LL y) { return y ? gcd(y, x % y) : x; }

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

	LL n, m;
	cin >> n >> m;

	if (n >= m / 2) {
		cout << m / 2 << endl;
	} else {
		cout << (n * 2 + m) / 4 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
 
int main(){
  
 int i=0;
 
 int j;
 
 int x[3000], y[3000];
  
 while(1){
     scanf("%d %d\n", &x[i], &y[i]);
      
     if(x[i]==0 && y[i]==0)      
         break;
         i++;
 }
 for(j=0; j<i;j++){
    if(x[j]>=y[j])  
        printf("%d %d\n", y[j], x[j]);
    else
        printf("%d %d\n", x[j], y[j]);
 }
return 0;
} 

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

using namespace std;
int s[100000];
int t[50000];

int main()
{
	int n, q, count;
	int l, m, r;

	count = 0;
	cin >> n;

	for (int i = 0; i < n; i++){
		cin >> s[i];
	}


	cin >> q;
	for (int i = 0; i < q; i++){
		cin >> t[i];
	}

	for (int i = 0;i < q; i++){
		l = 0;
		r = n;
		while (l < r){
			m = (l + r) / 2;
			if (s[m] == t[i]){
				count++;
				break;
			}
			else if (s[m] > t[i]){
				r = m;
			}
			else {
				l = m + 1;
			}
		}
	}
	
	cout << count << endl;
}

Measured memory_bytes: 3652
# D - Replacing
NUM = 10**5
N = int(input())
A = list(map(int,input().split()))
S = [0]*(NUM+1)
ans = 0
for x in A:
    S[x] += 1
    ans += x
Q = int(input())
for _ in range(Q):
    B,C = map(int,input().split())
    ans += (C-B)*S[B]
    print(ans)
    S[C] += S[B]
    S[B] = 0

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

using i64 = int64_t;

#define rep(i, x, y) for (i64 i = i64(x), i##_max_for_repmacro = i64(y); i < i##_max_for_repmacro; ++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf = 1.01e9;
const i64 inf64 = 4.01e18;
const double eps = 1e-9;

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

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
    os << "[";
    for (const auto &v : vec) {
        os << v << ",";
    }
    os << "]";
    return os;
}

template <typename T>
bool chmin(T &a, const T &b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template <typename T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template<typename T, size_t size> void fill(T (&ary)[size], const T& val){
    fill_n((T*)ary, size, val);
}

void solve() {
    //const i64 mod = 1'000'000'007;

    i64 N,K;
    cin >> N >> K;

    string S;
    cin >> S;
    if(S[K-1]=='A') S[K-1]='a';
    else if(S[K-1]=='B') S[K-1]='b';
    else if(S[K-1]=='C') S[K-1]='c';

    cout << S << endl;

}

int main() {
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}


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

int main(){
  ll X,K,D;
  cin >> X >> K >> D;
  ll m=0;
  ll count=0;
  if(X<0){
    if(abs(X)%D > D-(abs(X)%D)){
      m=D-(abs(X)%D);
      count=abs(X)/D+1;
    }
    else{
      m=-(abs(X)%D);
      count=abs(X)/D;
    }
  }
  else if(X==0){
    m=0;
    count=0;
  }
  else if(X>0){
    if(X%D > -(X%D)+D){
      m=-D+(X%D);
      count=X/D+1;
    }
    else{
      m=X%D;
      count=X/D;
    }
  }
  if(K>=count){
    if((K-count)%2==0){
      cout << abs(m);
      return 0;
    }
    else if((K-count)%2==1){
      cout << D-abs(m);
      return 0;
    }
  }
  else if(K<count){
    cout << abs(X)-D*K;
    return 0;
  }
}


Measured memory_bytes: 3616
var input = require('fs').readFileSync('/dev/stdin', 'utf8').split(/\n/g);
var a = input[1].split(/\s/g);
var i = 0;
while (true){
	if (a.every(function(e){return e % 2 === 0;})){
		a = a.map(function(e){return e / 2;});
		i++;
	} else {
		break;
	}
}
console.log(i);


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

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
#define all2(a, b) (a).begin(), (a).begin() + (b)
#define debug(vari) cerr << #vari << " = " << (vari) << endl;
const int MOD = 1e9 + 7;

int main()
{
    int n;
    string s, t = "ABC";
    cin >> n >> s;

    int res = 0;
    rep(i, n)
    {
        if (s[i] == 'A')
        {
            int flag = 0;
            rep(j, 3)
            {
                if (s[i + j] != t[j])
                {
                    flag++;
                }
            }
            if (!flag)
                res++;
        }
    }
    cout << res << endl;
    return (0);
}


Measured memory_bytes: 3636