akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <algorithm>
using namespace std;
#include <cstdio>
#include <tuple>
#include <string>
#include <vector> 
#include <set>
#include <string.h>
#include <map>
#include <cmath>
#include <deque>
using ll = long long;
using Graph = vector<vector<int>>;

deque<pair<int, int> > deq;

const int MAX = 1000;
/* 配列 a の [left, right) をソートします */
void MergeSort(int a[], int left, int right) {
    if (right - left == 1) return;
    int mid = left + (right - left) / 2;

    // 左半分 [left, mid) をソート
    MergeSort(a, left, mid);

    // 右半分 [mid, right) をソート
    MergeSort(a, mid, right);

    //一旦「左」と「右」のソート結果をコピーしておく (右側は左右反転)
    int buf[1000];
    int index_buf = 0;
    for (int i = left; i < mid; ++i) {
        buf[index_buf++] = a[i];
    }
    for (int i = right-1; i >= mid; --i) {
        buf[index_buf++] = a[i];
    }
    int last_index_buf = --index_buf;

    // マージする
    int iterator_left = 0;                    // 左側のイテレータ
    //int iterator_right = (int)buf.size() - 1; // 右側のイテレータ
    int iterator_right = last_index_buf;
    for (int i = left; i < right; ++i) {
        // 左側採用
        if (buf[iterator_left] <= buf[iterator_right]) {
            a[i] = buf[iterator_left++];
        }
        // 右側採用
        else {
            a[i] = buf[iterator_right--];
        }
    }
}

#include <queue>
#include <stack>

void breadthFirstSearch(Graph& G,const int n,int initVertex,vector<int>& dist){
    //BFS用のデータ構造
    dist.assign(n,-1);//頂点の深さ記録
    queue<int> que;//次の訪問先を記録

    //初期値
    dist[initVertex] = 0;
    que.push(initVertex);

    while(!que.empty()){
        int v = que.front();
        que.pop();

        for(auto next_v:G[v]){
            if(dist[next_v] != -1) continue;
            dist[next_v] = dist[v] + 1;
            que.push(next_v);
        }

    }

}

vector<bool> seen;
vector<int> first_order;
vector<int> last_order;
void dfs(Graph& G,int v,int& first,int& last){
    first_order.push_back(first++);
    seen[v] = true;
    for(auto next_v:G[v]){
        if(seen[next_v]) continue;
        dfs(G,next_v,first,last);
    }

    last_order.push_back(last++);




}

double calc(double v){
    int sum=0;
    for(int i=1;i <= v;i++){
        sum = sum + i;
    }

    double ans = sum / v;


    return ans;
}

int main() {

    int n,q;
    cin >> n >> q;

    string str;
    cin >> str;
    vector<pair<int,int>> range;
    
    vector<int> a(n,0);
    vector<int> s(n + 1,0);
    //条件を満たすa
    for(int i=0;i < n-1;i++){
        if(str[i] == 'A' && str[i + 1] == 'C'){
            a[i] = 1;
        }
    }
    //累積和
    for(int i=0;i < n;i++) s[i +1] = s[i] + a[i];

    //クエリ
    for(int i=0;i < q;i++){
        int left,right;
        cin >> left >> right;
        left--;
        right--;

        range.push_back(make_pair(left,right));
    }

    
    for(int i=0;i<q;i++){
        cout << s[range[i].second] - s[range[i].first] << endl;
        
    }

    
    return 0;
}

Measured memory_bytes: 2676
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i,s,n) for(int i = (s); i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main(){
   int n;
   cin >> n;
   int a[n];
   rep(i, n) cin >> a[i];
   int m = a[0], count = 0;
   rep(i, n) {
       if(a[i] <= m)
           count++;
       m = min(m, a[i]);
   }
   cout<< count << endl;
   return 0;
}

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

using namespace std;

struct Op {
  char op;
  int i, j, k;

  Op (char _op = '.', int _i = 0, int _j = 0, int _k = 0) :
    op(_op), i(_i), j(_j), k(_k) {}
};

ostream &operator<< (ostream &out, Op o) {
  out << o.op << " " << o.i << " " << o.j << " " << o.k;
  return out;
}

vector<Op> ans;

typedef long long ll;

int simul (ll a, ll b) {
  vector<ll> arr (2e5, 0);
  arr[0] = a;
  arr[1] = b;
  for (Op op : ans) {
    if (op.op == '<') {
      arr[op.k] = arr[op.i] < arr[op.j];
    } else {
      arr[op.k] = arr[op.i] + arr[op.j];
    }
  }

  /*
  for (int i = 0; i < 500; i++) {
    cout << i << ": " << arr[i] << endl;
  }
  */
  
  return arr[2];
}

void add (int i, int j, int k) {
  ans.push_back(Op('+', i, j, k));
}

void lt (int i, int j, int k) {
  ans.push_back(Op('<', i, j, k));
}

const int A = 0;
const int B = 1;
const int TAR = 2;
const int ONE = 5;
const int ZRO = 6;
void init_one () {
  add(A, B, ONE);
  lt(ZRO, ONE, ONE);
}

void and_ (int i, int j, int k) {
  add(i, j, k);
  lt(ONE, k, k);
}

void or_ (int i, int j, int k) {
  add(i, j, k);
  lt(ZRO, k, k);
}

void not_ (int i, int k) {
  lt(i, ONE, k); // if i = 0 k = 1 otherwise k = 0
}

const int MAX_LG = 60;
const int TPOWS = 100;
void init_tpow () {
  add(TPOWS, ONE, TPOWS);
  for (int i = 1; i < MAX_LG; i++) {
    add(TPOWS + i - 1, TPOWS + i - 1, TPOWS + i);
  }
}

const int ABIN = 200;
const int BBIN = 300;
void to_bin (int orig, int sta) {
  int HOLD = 10;
  int AUX = 11;
  add(ZRO, ZRO, HOLD);
  for (int i = MAX_LG - 1; i >= 0; i--) {
    add(HOLD, TPOWS + i, AUX);
    lt(orig, AUX, AUX);
    not_(AUX, AUX);
    // if we ought to add it to HOLD it is 1 now

    add(ZRO, AUX, sta + i);
    for (int j = 0; j < i; j++) {
      add(AUX, AUX, AUX);
    }
    add(AUX, HOLD, HOLD);
  }
}

const int CBIN = 400;
void add_bin (int asta, int bsta, int cond) { // if cond bsta += asta
  int AUX = 12, BUX = 13;
  for (int i = 0; i < MAX_LG; i++) {
    and_(cond, asta + i, AUX);
    add(AUX, bsta + i, bsta + i);
  }

  for (int i = 0; i < MAX_LG; i++) {
    lt(ONE, bsta + i, AUX);
    add(AUX, bsta + i + 1, bsta + i + 1);
    lt(bsta + i, TPOWS + 1, AUX);
    lt(TPOWS + 1, bsta + i, BUX);
    or_(AUX, BUX, BUX);
    lt(ZRO, bsta + i, AUX);
    and_(AUX, BUX, bsta + i);
  }
}

void dbl_bin (int sta) {
  for (int i = MAX_LG - 1; i > 0; i--) {
    add(sta + i - 1, ZRO, sta + i);
  }
  add(ZRO, ZRO, sta);
}


int main () {
  init_one();
  init_tpow();

  to_bin(A, ABIN);
  to_bin(B, BBIN);

  for (int i = 0; i < MAX_LG; i++) {
    add_bin(ABIN, CBIN, BBIN + i);    
    dbl_bin(ABIN);
  }

  for (int i = 0; i < MAX_LG; i++) {
    for (int j = 0; j < i; j++) {
      add(CBIN + i, CBIN + i, CBIN + i);
    }
    add(CBIN + i, TAR, TAR);
  }

  cout << (int) ans.size() << endl;
  for (Op o : ans) {
    cout << o << '\n';
  }
}


Measured memory_bytes: 4056
//include
//------------------------------------------
#include <bits/stdc++.h>
using namespace std;
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const long long INF = 1000000007;
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
// chmax chmin
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; }

int main(void){
    ll A,B,K; cin >> A >> B >> K;

    if(A<=K){
        B = max((ll)0,B-(K-A));
        A = 0;
    }
    else{
        A -= K;
    }
    cout << A << " " << B << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <tuple>
#include <cassert>

using namespace std;

#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define tr(c, i) for (iter(c) i = (c).begin(); i != (c).end(); ++i)
#define pb(e) push_back(e)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define mp(a,b) make_pair((a), (b))
#define mt(a,b,c) make_tuple((a),(b),(c))

typedef long long ll;

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

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

typedef long double ld;
typedef long long int ll;
vector<vector<ll> > adjlist;
ll max(ll x,ll y){return (x>y)?x:y;} 
#define min(x,y) (x>y)?y:x
#define sfor(a,n,i) for(ll i=a;i<n;i++)
#define rfor(n,a,i) for(ll i=n;i>=a;i--)
#define mod 1000000007
#define pb push_back
#define in insert
#define mp make_pair
#define inf mod
#define bg begin()
#define ed end()
#define sz size()
#define vi vector<ll>
#define vinv vector<vector<ll> >
#define imap map<ll,ll>
#define cmap map<char,ll>
#define smap map<string,ll>
#define iset set<ll>
#define bit(x,i) (x&(1<<i))
int main()
{
    ll a,b,c;
    cin>>a>>b>>c;
    if(a+b+c>=22)
    cout<<"bust"<<endl;
    else
    cout<<"win"<<endl;
    
    return 0;
}



Measured memory_bytes: 256
#include <iostream>

#define P 1000000007

using namespace std;

int main(){
    int N;
    cin >> N;
    string S;
    cin >> S;
    long cnt[26] = {0};
    for(int i = 0; i < S.size(); i++){
        cnt[S[i]-'a']++;
    }
    long ans = 1;
    for(int i = 0; i < 26; i++){
        ans = (ans*(cnt[i]+1))%P;
    }
    ans = (ans-1+P)%P;
    cout << ans << endl;
}

Measured memory_bytes: 512
import sys
input = sys.stdin.readline

N, M = map(int, input().split())
state = [list(map(int, input().split())) for _ in range(N)]

l = 0
r = N+1

while r - l > 1:
    m = (l+r)//2
    ok = True
    canuse = [True]*(M+1)
    pri = [0]*N
    while ok:
        sport = [0]*(M+1)
        for i in range(N):
            while not canuse[state[i][pri[i]]]:
                pri[i] += 1
                if pri[i] > M-1:
                    ok = False
                    break
            if not ok:
                break
            sport[state[i][pri[i]]] += 1
        update = False
        for j in range(1, M+1):
            if sport[j] > m:
                update = True
                canuse[j] = False
        if not update:
            break
    
    if ok:
        r = m
    else:
        l = m
                
    
print(r)

Measured memory_bytes: 4296
#include<iostream>
using namespace std;
int main(){
	int W;
	while(cin>>W){
		bool flag=0;
		for(int i=1;i<=W;i*=2){
			if((W/i)%2==1){
				cout<<(flag?" ":"")<<i;
				flag=1;
			}
		}
		cout<<endl;
	}
	return 0;
}


Measured memory_bytes: 3004
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <numeric>
#include <functional>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <memory>
#include <thread>
#include <tuple>

using namespace std;

int main() {
  int a, b;
  scanf("%d%d", &a, &b);
  if (a + b == 15) {
    printf("+\n");
    return 0;
  } 
  if (a*b == 15) {
    printf("*\n");
    return 0;
  }
  printf("x\n");
  return 0;
}


Measured memory_bytes: 128
N = int(input())
Xs = [list(map(int, input().split(" "))) for _ in range(N)]
"""
input = ["2 3 5","2 1 5","1 2 5","3 2 5"]
input = ["0 0 100", "1 1 98"]
input = ["99 1 191", "100 1 192", "99 0 192"]
Xs = [list(map(int, x.split(" "))) for x in input]
"""

Xs.sort(key=lambda x:x[2], reverse=True)


def solv(Xs):
    for x in range(101):
        for y in range(101):
            h= Xs[0][2]
            Cx = Xs[0][0]
            Cy = Xs[0][1]
            H = h + abs(x - Cx) + abs(y - Cy)
            for i in range(len(Xs)):
                h = max(H - abs(x - Xs[i][0]) - abs(y - Xs[i][1]), 0)
                if h != Xs[i][2]:
                    break
                if i == len(Xs)-1:
                    print("%d %d %d" % (x, y, H))
                    exit(0)


solv(Xs)


Measured memory_bytes: 3064
#include <cstring>
#include <sstream>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>
#include <numeric>
#include <stack>

using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll half_inf = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);
typedef unordered_map<ll, ll> mpll;
typedef unordered_map<char, ll> mpcl;
typedef unordered_map<string, ll> mpsl;
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
template<typename T> using PQ = priority_queue<T>;
template<typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

ll inl() {
    ll x;
    cin >> x;
    return (x);
}

string ins() {
    string x;
    cin >> x;
    return (x);
}

int main() {
#ifdef MY_DEBUG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmissing-noreturn"
    while (true) {
#pragma clang diagnostic pop
#endif
        ll a = inl(), b = inl();
        if (a >= 13) cout << b << endl;
        else if (a <= 12 && a >= 6) cout << b / 2 << endl;
        else cout << 0 << endl;

#ifdef MY_DEBUG
    }
#endif
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll inf=1LL<<60;
long double pi=3.14159265358979323846L;
double eps=1e-12;
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
#define srep(itr,st) for(auto itr=st.begin();itr!=st.end();itr++)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
ll beki(ll n,ll k,ll md){
  ll ret=1;
  ll now=n;
  while(k>0){
    if(k%2==1){
      ret*=now;
      ret%=md;
    }
    now*=now;
    now%=md;
    k/=2;
  }
  return ret;
}
ll gyaku(ll n,ll md){
  return beki(n,md-2,md);
}
int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n,m;cin>>n>>m;
    vector<int> v[n+1];
    int d[n+1][n+1];
    memset(d,0,sizeof d);
    rep(i,0,m){
        int a,b;cin>>a>>b;
        d[a][b]=1;
        d[b][a]=1;
    }
    rep(i,1,n+1)d[i][i]=1;
    rep(i,1,n+1){
        rep(j,1,n+1){
            if(d[i][j]==0)v[i].push_back(j);
        }
    }
    vector<pii> vv;
    bool used[n+1];
    fill(used,used+n+1,false);
    int col[n+1];
    fill(col,col+n+1,0);
    rep(i,1,n+1){
        if(used[i])continue;
        queue<int> q;
        q.push(i);
        col[i]=1;
        used[i]=true;
        int f=0,g=0;
        while(q.size()>0){
            int now=q.front();q.pop();
            //cout<<now<<" "<<col[now]<<endl;
            if(col[now]==1)f++;
            else g++;
            int nc=col[now]+1;
            if(nc==3)nc=1;
            rep(j,0,v[now].size()){
                int ne=v[now][j];
                //cout<<now<<" "<<ne<<endl;
                if(col[ne]==0){
                    col[ne]=nc;
                    used[ne]=true;
                    q.push(ne);
                }
                else{
                    if(col[ne]!=nc){
                        cout<<-1<<endl;
                        return 0;
                    }
                }
            }
        }
        vv.push_back({f,g});
    }
    bool dp[vv.size()+1][1401];
    memset(dp,false,sizeof dp);
    dp[0][700]=true;
    rep(i,0,vv.size()){
        int f=vv[i].first,g=vv[i].second;
        rep(j,0,1401){
            if(dp[i][j]==false)continue;
            dp[i+1][j+f-g]=true;
            dp[i+1][j-f+g]=true;
        }
    }
    int ans=1000000000;
    rep(i,0,1401){
        if(dp[vv.size()][i]==false)continue;
        int y=i-700;
        int f=(y+n)/2;
        int g=(n-y)/2;
        f=f*(f-1)/2;
        
        g=g*(g-1)/2;
        ans=min(ans,f+g);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0; i<(int)(n); i++)
int main(){
int N; long K; cin >> N >> K; int X=2*N, A[X]={}, B[X]={};
REP(i, N){ cin >> A[i]; A[i]--; }
vector<int> M(X, -1);
int nw=0, l=0, s=0;
REP(i, X){ if(M[nw]>0){ l=i-M[nw]; s=i; break; }else{ M[nw]=i; } nw=A[nw]; }
nw=0;  
REP(i, X){ B[i]=nw+1; nw=A[nw]; }
if(K<=(long)s){ cout << B[K] << "\n"; return 0; }
int r=(K-(long)s)%l; cout << B[s+r] << "\n";
}

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

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

  int n;
  std::cin >> n;

  int a[200000] = {};

  for (int i = 0; i < n - 1; ++i) {
    int ai;
    std::cin >> ai;
    ++a[ai - 1];
  }

  for (int i = 0; i < n; ++i) {
    std::cout << a[i] << "\n";
  }

  std::cout << std::flush;

  return 0;
}


Measured memory_bytes: 4424
import sys
from collections import defaultdict, Counter

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, *A = map(int, read().split())

    N_MAX = 10 ** 6

    min_factor = list(range(1, N_MAX + 1, 2))
    for i in range(1, int((N_MAX ** 0.5 - 1) / 2) + 1):
        f = 2 * i + 1
        if min_factor[i] != f:
            continue
        for j in range(2 * i * (i + 1), len(min_factor), f):
            if min_factor[j] > f:
                min_factor[j] = f

    def prime_factorize_fast(n):
        a = Counter()
        while not n & 1:
            a[2] += 1
            n //= 2
        while n != 1:
            a[min_factor[(n - 1) // 2]] += 1
            n //= min_factor[(n - 1) // 2]

        return a

    lcm_prime = Counter()
    for a in A:
        for p, n in prime_factorize_fast(a).items():
            if lcm_prime[p] < n:
                lcm_prime[p] = n

    l = 1
    for p, n in lcm_prime.items():
        l = l * pow(p, n, MOD) % MOD

    ans = 0
    for a in A:
        ans = (ans + pow(a, MOD - 2, MOD)) % MOD

    ans = ans * l % MOD

    print(ans)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 75064
#include <bits/stdc++.h>
using namespace std;
//const int MOD=1e9+7;
//const int MOD=998244353;
const int INF=1e9;
const long long LINF=1e18;
#define int long long
//template
template <typename T>
void fin(T a){
  cout<<a<<endl;
  exit(0);
}
using ld=long double;
//main
signed main(){
  int N,K;cin>>N>>K;
  std::vector<ld> x(N),y(N);
  for(int i=0;i<N;i++)cin>>x[i]>>y[i];
  ld nowx=0,nowy=0,range=1000;
  std::vector<ld> d(N);
  int T=1000;
  ld dist,bestx,besty;
  while(T--){
    dist=LINF,bestx,besty;
    for(ld i=-5;i<=5;i++){
      for(ld j=-5;j<=5;j++){
        ld X=nowx+i*range/5,Y=nowy+j*range/5;
        for(int k=0;k<N;k++)d[k]=sqrt((X-x[k])*(X-x[k])+(Y-y[k])*(Y-y[k]));
        sort(d.rbegin(),d.rend());
        ld D=0;for(int k=0;k<K;k++)D+=d[k];
        if(dist>D){
          dist=D;
          bestx=X,besty=Y;
        }
      }
    }
    nowx=bestx,nowy=besty;
    range/=2;
  }
  fin(dist);
}



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

int main()
{
	int N,M;
	cin >> N >> M;
	cout << N*(N-1)/2 + M*(M-1)/2 << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>

using namespace std;

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

ll mod = 1e9 + 7;

int main(){
	int a,b;

	cin >> a >> b;

	int ans = 0;
	int t = 1;
	while(t<b){
		t--;
		t+=a;
		ans++;
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
n = int(input())
t,a = map(int, input().split())
al = list(map(int, input().split()))

temp = 10**6
res = 0
for i in range(n):
    dt = abs((t - al[i]*0.006)-a)
    if temp >= dt:
        temp = dt
        res = i+1

print(res)

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

typedef long long ll;
ll arr[2000005], arr2[100000] ;
ll MOD = 1e9 + 7;

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

  for(int i = 1; i <= 9; i++){
    if(n % i == 0 and (n/i) <= 9) {
      cout<<"Yes"<<endl;
      return 0;
    }
  }
  cout<<"No"<<endl;
}



Measured memory_bytes: 256
// ALDS1_9_A: Complete Binary Tree

use std::str::FromStr;

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

fn scan_vec<T: FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.split_whitespace().map(|a| T::from_str(a).ok().unwrap()).collect()
}

fn parent(i: usize) -> usize {
    i / 2
}

fn left(i: usize) -> usize {
    2 * i
}

fn right(i: usize) -> usize {
    2 * i + 1
}

fn main() {
    let h = scan::<usize>();
    let mut a = vec![0; 100000];
    
    let b = scan_vec::<i64>();
    for i in 0..h {
        a[i+1] = b[i];
    } 

    for i in 1..h+1 {
        print!("node {}: key = {}, ", i, a[i]);
        if parent(i) >= 1 {
            print!("parent key = {}, ", a[parent(i)]);
        }
        if left(i) <= h {
            print!("left key = {}, ", a[left(i)]);
        }
        if right(i) <= h {
            print!("right key = {}, ", a[right(i)]);
        }
        println!();
    }
}


Measured memory_bytes: 5044
package main

import "fmt"

func main() {
	var N int
	fmt.Scan(&N)
	arr := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scan(&arr[i])
	}
	for i := 1; i < N; i++ {
		print(arr, N)
		v := arr[i]
		j := i - 1
		for ; j >= 0 && arr[j] > v; j-- {
			arr[j+1] = arr[j]
		}
		arr[j+1] = v
	}
	print(arr, N)
}

func print(arr []int, num int) {
	for i := 0; i < num; i++ {
		if i != num-1 {
			fmt.Printf("%d ", arr[i])
		} else {
			fmt.Printf("%d\n", arr[i])
		}
	}
}



Measured memory_bytes: 1204
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<deque>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;

int main()
{
	int  L, R;
	cin >> L >> R;
	if (R - L >= 2019) {
		cout << 0 << endl;
		return 0;
	}
	int ans = mod;
	L %= 2019; R %= 2019;
	if (L > R) {
		cout << 0 << endl;
		return 0;
	}
	for (int i = L; i <= R; i++) {
		for (int j = i + 1; j <= R; j++) {
			ans = min(ans, i * j % 2019);
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n, m;
const int N = 200000;
int a[200][200];
int main() {
    ios_base::sync_with_stdio(false);
    cin >> n;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            a[i][j] = 1;
        }
    }
    int m = n - n % 2;
    for (int i = 1; i <= m / 2; i++) {
        a[i][m - i + 1] = 0;
    }
    vector<pair<int, int> > edges;
    for (int i = 1; i <= n; i++) {
        for (int j = i + 1; j <= n ;j ++) {
            if (a[i][j] == 1) {
                edges.emplace_back(i, j);
            }
        }
    }
    cout << edges.size() << "\n";
    for (auto it: edges) {
        cout << it.first << " " << it.second << "\n";
    }
    return 0;
}

Measured memory_bytes: 512
object Main {
  def main(args: Array[String]) = {
    val Array(n, k, q) = scala.io.StdIn.readLine().split(" ").map(_.toInt)
    val point = Array.fill(n){k - q}
    for(_ <- 0 until q) {
      val ai = scala.io.StdIn.readInt() - 1
      point(ai) += 1
    }
    for(p <- point) println(if (p > 0) "Yes" else "No")
  }
}



Measured memory_bytes: 40472
#include <bits/stdc++.h>
#include <stdio.h>
#include <algorithm>
#include <functional>
#include <iostream>

using namespace std;
 
int main() {
  int A, B, C, X, Y;
  cin >> A >> B >> C >> X >> Y;
  if(A+B <= 2*C){
    cout << A*X+B*Y << endl;
  } 
  else if (X>=Y){
    if(A <= 2*C)
    cout << Y*2*C + (X-Y)*A << endl;
    else 
    cout << X*2*C << endl;
  }
  else{
    if(B <= 2*C)
    cout << X*2*C + (Y-X)*B << endl;
    else 
    cout << Y*2*C << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
    int n,i;
    cin >> n;
    string s[n];
    for(i=0;i<n;i++){
        cin >> s[i];
        sort(s[i].begin(),s[i].end());
    }
    sort(s, s+n);
    long long ans=0,c=0;
    for(i=1;i<n;i++){
        if(s[i]==s[i-1]){
            c++;
            ans+=c;
        }
        else c=0;
    }
    cout << ans << endl;
}

Measured memory_bytes: 7296
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define Repr(i, n, a) for (int i = (n); i >= (a); i--)
#define rep(i, n) Rep(i, 0, n)
#define repr(i, n) Repr(i, n, 0)
#define all(a) (a).begin(), (a).end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;

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

    int n;
    cin >> n;
    vector<int> l(n);
    rep(i, n) cin >> l[i];
    sort(all(l));
    int sum = 0;
    rep(i, n - 1) sum += l[i];
    cout << (l[n - 1] < sum ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
from time import time
from random import randrange
sTime = time()
D = int(input())
C = [int(a) for a in input().split()]
S = [[int(a) for a in input().split()] for _ in range(D)]
A = [randrange(26) for _ in range(D)]

while time() - sTime < 1.8:
    d = randrange(D)
    i = A[d]
    for k in range(d)[::-1]:
        if A[k] == i:
            prev = k
            break
    else:
        prev = -1
    for j in range(26):
        t = S[d][j] - S[d][i]
        for k in range(d)[::-1]:
            if A[k] == j:
                new = k
                break
        else:
            new = -1
        t += C[j] * (d - new) - C[i] * (d - prev)
        if t > 0:
            A[d] = j

print(*[a + 1 for a in A], sep = "\n")

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

int32_t main(){
    ios::sync_with_stdio(0),cin.tie(0);
    int x,y;
    cin >> x >> y;
    int b=(y-2*x)/2;
    if(b>=0 and b<=x and (y-2*x)%2==0)
        cout << "Yes";
    else cout << "No";
}

Measured memory_bytes: 3636
#include <cstdio>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <bitset>
#include <set>
#include <iomanip>
#include <functional>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
//'A' = 65, 'a' = 97

int main()
{
    int n, x;
    cin >> n >> x;
    int a[n];
    rep(i, 0, n) cin >> a[i];

    ll ans = 0;
    rep(i, 0, n - 1) {
        if (x < a[i] + a[i + 1]) {
            if (x <= a[i]) {
                ans += a[i + 1];
                a[i + 1] = 0;
                ans += a[i] - x;
                a[i] = x;
            } else {
                ans += a[i] + a[i + 1] - x;
                a[i + 1] -= a[i] + a[i + 1] - x;
            }
        }
    }
    cout << ans << endl;

}


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

int main() {
  int N, X;
  cin >> N >> X;
  vector<int> L(N);

  int D = 0;
  int cnt = 1;
  for (int i = 0; i < N; ++i) {
    cin >> L.at(i);
    D += L.at(i);
    if (D <= X) cnt++;
  }

  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define L long long
#define vi vector<int>
#define pb push_back
#define pi pair<int,int>
#define pii pair<pi,int>
#define aa first
#define bb second
#define xx aa.aa
#define yy aa.bb
#define zz bb
#define mp make_pair
#define mpp(a,b,c) mp(mp(a,b),c)
using namespace std;
int n,m,q,x[500010],a[500010];
L b[500010];
int main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	int i,j;
	scanf("%d%d",&n,&m);
	a[0]=m;
	for(i=1;i<=n;i++)
	  {
	   scanf("%d",&x[i]);
	   a[i]=min(a[i-1],abs(a[i-1]-x[i]));
	  }
	b[n+1]=1;
	for(i=n;i>0;i--)
	  if(b[i+1]<=x[i]/2)
	    b[i]=b[i+1];
	  else
	    b[i]=b[i+1]+x[i];
	scanf("%d",&q);
	while(q--)
	  {
	   scanf("%d",&i);
	   if(a[i-1]>=b[i+1])
	     printf("YES\n");
	   else
	     printf("NO\n");
	  }
	return 0;
}


Measured memory_bytes: 9728
#include<bits/stdc++.h>
using namespace std;
int main() {
	string s;
	cin>>s;
	int ans=700;
	if(s[0]=='o')ans+=100;
	if(s[1]=='o')ans+=100;
	if(s[2]=='o')ans+=100;
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <ctype.h>
#include <ios> 
#include <iomanip>
using namespace std;

#define N_MAX   (100000)
#define LL_MAX_NUM (1LL<<60)
#define INF 1e7

typedef long long ll;
typedef long long int lli;

int main() {
    int H, W; cin >> H >> W;
	char C[H][W];
    for (int i = 0; i < H; i++)
    {
        for (int j = 0; j < W; j++)
        {
            cin >> C[i][j];
        }
    }
    for (int i = 0; i < H*2; i++)
    {
        for (int j = 0; j < W; j++)
        {
            cout << C[(int)i/2][j];
        }
        cout << endl;
    }
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e17)
#define PI (acos(-1))
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
#define i_7 (long long)(1e9+7)
//#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;

bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd_(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}


int main(){
  
  int s = 0;
  REP(i,3){
    int a;
    cin>>a;
    s += a;
  }
  if(s >= 22){
    cout<<"bust"<<endl;
  }else{
    cout<<"win"<<endl;
  }
  return 0; 
}


Measured memory_bytes: 256
#include <stdio.h>

int A1[100001];
char A2[100001];
int input1[100001];
char input2[100001];

void swap1(int* a, int* b){
  int tmp = *a;
  *a = *b;
  *b = tmp;
}

void swap2(char* a, char* b){
  char tmp = *a;
  *a = *b;
  *b = tmp;
}

int partition(int p, int r){
  int x = A1[r];
  int i = p - 1, j;
  for(j=p;j<r;j++){
    if(A1[j] <= x){
      i++;
      swap1(&A1[i], &A1[j]);
      swap2(&A2[i], &A2[j]);
    }
  }
  swap1(&A1[i+1], &A1[r]);
  swap2(&A2[i+1], &A2[r]);
  return i+1;
}

void quic_sort(int p, int r){
  if(p < r){
    int q = partition(p, r);
    quic_sort(p, q-1);
    quic_sort(q+1, r);
  }
}

int check(int n){
  int i, j;
  for(i=1;i<n;i++){
    if(A1[i-1] == A1[i]){
      int a, b;
      for(j=0;j<n;j++){
        if(A1[i-1] == input1[j] && A2[i-1] == input2[j]) a = j;
        if(A1[i] == input1[j] && A2[i] == input2[j]) b = j;
      }
      if(a > b) return 0;
    }
  }
  return 1;
}

main(){
  int n, i;
  scanf("%d", &n);
  for(i=0;i<n;i++){
    getchar();
    scanf("%c%d", &A2[i], &A1[i]);
  }
  for(i=0;i<n;i++){
    input1[i] = A1[i];
    input2[i] = A2[i];
  }
  quic_sort(0, n-1);
  printf("%s\n", (check(n) ? "Stable" : "Not stable"));
  for(i=0;i<n;i++) printf("%c %d\n", A2[i], A1[i]);
  return 0;
}



Measured memory_bytes: 2688
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		while (true) {
			int n = scanner.nextInt();
			int s = scanner.nextInt();
			if (n == 0 & s == 0) {
				break;
			}
			boolean[] map = new boolean[n];
			Arrays.fill(map, true);
			int t = 1;
			int a = 0;
			for (int i = 0; i < n; i++) {
				while (true) {
					if (t == s & map[a]) {
						t = 1;
						map[a] = false;
						break;
					}
					if (map[a]) {
						t++;
						a = (a + 1) % n;
					} else {
						a = (a + 1) % n;
					}

				}
			}
			System.out.println(a + 1);
		}

	}
}

Measured memory_bytes: 17600
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtTest.Reviews
{
    class ABC117_D
    {
        static void Main(string[] args)
        {
            Method(args);
        }

        static void Method(string[] args)
        {
            long[] nk = ReadLongs();
            long n = nk[0];
            long k = nk[1];
            long[] array = ReadLongs();
            long one = 1;

            int bits = 50;
            int[] cnts = new int[bits];
            for (int i = 0; i < bits; i++)
            {
                for (int j = 0; j < n; j++)
                {
                    if ((array[j] & (one << i)) > 0) cnts[i]++;
                }
            }

            long res = 0;
            for (int i = -1; i < bits; i++)
            {
                if (i >= 0 && (k & (one << i)) == 0) continue;

                long tmp = 0;
                for (int j = 0; j < bits; j++)
                {
                    if (j < i)
                    {
                        tmp += Max(n - cnts[j], cnts[j]) * (one << j);
                    }
                    if (j == i) tmp += cnts[j] * (one << j);
                    if (j > i)
                    {
                        if ((k & (one << j)) > 0)
                        {
                            tmp += (n - cnts[j]) * (one << j);
                        }
                        else
                        {
                            tmp += cnts[j] * (one << j);
                        }
                    }
                }
                res = Max(res, tmp);
            }
            WriteLine(res);
        }

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


Measured memory_bytes: 32348
n, m = map(int, input().split())
abc = [list(map(int, input().split())) for x in range(m)]
nodes = [[] for x in range(n + 1)]

for a, b, c in abc:
    nodes[a].append([a, b, -c])

costs = [None for x in range(n + 1)]
costs[1] = 0
flg = True
for i in range(n):
    for a, b, c in abc:
        if costs[a] == None:
            continue
        if costs[b] == None or costs[b] < costs[a] + c:
            flg = False
            costs[b] = costs[a] + c
    # for node in nodes[1:]:
    #     for a, b, c in node:
    #         if costs[a] == None:
    #             continue
    #         if costs[b] == None or costs[b] > costs[a] + c:
    #             flg = False
    #             costs[b] = costs[a] + c
#     if flg:
#         print(costs[n])
#         break
#     flg = True
# else:
#     print("inf")

ans = costs[n]
negative = [False for x in range(n + 1)]
for i in range(n - 1):
    for a, b, c in abc:
        if costs[a] == None:
            continue
        if costs[b] == None or costs[b] < costs[a] + c:
            costs[b] = costs[a] + c
            negative[b] = True

        if negative[a] == True:
            negative[b] = True

print(negative[n] and "inf" or ans)



Measured memory_bytes: 3828
#include <iostream>
#include <cstdio>
#include <vector>
#include <stack>
#include <math.h>

using namespace std;

typedef long long int ll;
typedef long double ld;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define vsort(a) sort(a.begin(), a.end())
#define rev(a) reverse(a.begin(), a.end())


// a,bの最小公倍数
ll LCM(ll a, ll b){ll lcm = a * b; ll r = a % b;while(r != 0){a = b; b = r; r = a % b;}return lcm /= b;}
// a,bの最大公約数
ll GCD(ll a, ll b){ll r = a % b;while(r != 0){a = b; b = r; r = a % b;}return b;}


const int MOD = 1000000007;
const int INF = INT_MAX;



int main(){

    string s, ss, sss;
    cin >> s >> ss >> sss;

    cout << "A" << ss[0] << "C" << endl;


}





//              g++ -std=c++1z


Measured memory_bytes: 504
import sys

def solve():
    input = sys.stdin.readline
    N = int(input())
    S = input().strip("\n")
    Q = int(input())
    K = [int(k) for k in input().split()]
    for i, k in enumerate(K):
        Ans = 0
        NumD = 0
        NumM = 0
        NumDM = 0
        for i in range(N):
            if S[i] == "D": NumD += 1
            elif S[i] == "M": 
                NumM += 1
                NumDM += NumD
            if i >= k:
                if S[i - k] == "D":
                    NumD -= 1
                    NumDM -= NumM
                elif S[i - k] == "M": NumM -= 1
            if S[i] == "C": Ans += NumDM
        print(Ans)


    return 0

if __name__ == "__main__":
    solve()

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

int main() {
  string S;
  cin >> S;
  int size = S.size();
  int space = size - 1;
  
  long long ans = 0;
  for (int tmp = 0; tmp < (1 << space); tmp++){
    bitset<10> s(tmp);
    vector<long long> flag;
    int point = 0;
    for (int i = 0; i < space; i++){
      if (s.test(i)){
        string push = S.substr(point, i + 1 - point);
        long long pushing = stoll(push);
        flag.push_back(pushing);
        point = i + 1;
      }
    }
    string push_last = S.substr(point, size - point);
    long long pushing_last = stoll(push_last);
    flag.push_back(pushing_last);
    long long sum = 0;
    for (long long a : flag){
      sum += a;
    }
    ans += sum;
  }
  
  cout << ans << endl;
}


Measured memory_bytes: 3624
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
	"unsafe"
)

func main() {
	N := sc.nextInt()

	i := int(math.Ceil(float64(N) / float64(2)))

	fmt.Println(i)

}

/* template functions */
var (
	sc scanner
)

func init() {
	sc = scanner{
		buf: make([]string, 0, 0),
		cur: 0,
		r:   bufio.NewReader(os.Stdin),
	}
}

type scanner struct {
	buf []string
	cur int
	r   *bufio.Reader
}

func (s *scanner) readln() {
	rbuf := make([]byte, 0, 0)
	for {
		line, prefix, err := s.r.ReadLine()
		if err != nil {
			panic(err)
		}
		rbuf = append(rbuf, line...)
		if prefix == false {
			break
		}
	}
	s.cur = 0
	s.buf = strings.Split(*(*string)(unsafe.Pointer(&rbuf)), " ")
}
func (s *scanner) isFull() bool {
	if s.cur == len(s.buf) {
		return true
	}
	return false
}
func (s *scanner) resetCur() {
	s.cur = 0
}
func (s *scanner) next() string {
	if s.cur == 0 {
		s.readln()
	}
	res := s.buf[s.cur]
	s.cur++
	if s.isFull() {
		s.resetCur()
	}
	return res
}
func (s *scanner) nexts() []string {
	s.readln()
	s.resetCur()
	return s.buf
}
func (s *scanner) nextInt() int {
	if s.cur == 0 {
		s.readln()
	}
	res, _ := strconv.Atoi(s.buf[s.cur])
	s.cur++
	if s.isFull() {
		s.resetCur()
	}
	return res
}
func (s *scanner) nextInts() []int {
	s.readln()
	res := make([]int, len(s.buf))
	for i := range s.buf {
		res[i], _ = strconv.Atoi(s.buf[i])
	}
	s.resetCur()
	return res
}
func (s *scanner) nextFloat() float64 {
	if s.cur == 0 {
		s.readln()
	}
	res, _ := strconv.ParseFloat(s.buf[s.cur],
		64)
	s.cur++
	if s.isFull() {
		s.resetCur()
	}
	return res
}
func (s *scanner) nextFloats() []float64 {
	s.readln()
	res := make([]float64, len(s.buf))
	for i := range s.buf {
		res[i], _ = strconv.ParseFloat(s.buf[i],
			64)
	}
	s.resetCur()
	return res
}
func digits(x int) int {
	return len(strconv.Itoa(x))
}
func powInt(x, p int) (result int) {
	result = 1
	for i := 0; i < p; i++ {
		result *= x
	}
	return
}
func max(x, y int) int {
	return int(math.Max(float64(x), float64(y)))
}
func min(x, y int) int {
	return int(math.Min(float64(x), float64(y)))
}
func abs(x int) int {
	return int(math.Abs(float64(x)))
}
func varDump(value ...interface{}) {
	for _, v := range value {
		fmt.Fprintf(os.Stderr, "%#v\n", v)
	}
}
func yes() {
	fmt.Println("Yes")
}
func no() {
	fmt.Println("No")
}


Measured memory_bytes: 640
#include <stdio.h>
#include <stdlib.h>
long xxx[10][901][101];

long pattern(int n,int s,int from){
	long i,x=0;
	if(s>100*n)return 0;
	if(xxx[n][s][from]>=0)x=xxx[n][s][from];
	else{
		for(i=(s-100*(n-1)>from?s-100*(n-1):from); i<100 && i<=s ;i++){x+=pattern(n-1,s-i,i+1);}
		xxx[n][s][from]=x;
	}
	return x;
}

int main(void){
	int n,s,i,j,k;
	for(j=0;j<101;j++){for(k=0;k<101;k++){xxx[1][j][k]=( (j<=100 && k<=j)?1:0 );}}
	for(j=0;j<201;j++){for(k=0;k<101;k++){xxx[2][j][k]=( (2*k<=j && j<=200) ? ((100-k+1)-abs((100-k)-(j-k*2)))/2 : 0 );}}
	for(i=3;i<10;i++){for(j=0;j<=i*100;j++){for(k=0;k<101;k++){xxx[i][j][k]=-1;}}}
    while(scanf("%d %d",&n,&s)*(n+s)){
	printf("%ld\n",pattern(n,s,0));}
    return 0;
}

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

#define ll long long
#define vl vector<ll>
#define vvl vector<vl >
#define pl pair<ll,ll>
#define vpl vector<pl >
#define vvpl vector<vp >
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define wt ll tc; cin>>tc; while(tc--)
#define ft ll tc,ti; cin>>tc; for(ti=1;ti<=tc;ti++)
#define fd(c,element) ((c).find(element)!=(c).end())
#define fdv(c,element) (find(all(c),element)!=(c).end())
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define pb push_back
#define mp make_pair

int main() {
    fio;
    ll i,l,e=0,o=0;
    string s;
    cin>>s;
    l=s.length();
    for(i=0;i<l;i++) {
    	if(i%2==0) {
    		if(s[i]!='0') e++;
    		else o++;
    	}
    	else {
    		if(s[i]!='1') e++;
    		else o++;
    	}
    }
    cout<<min(e,o);
}

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

const string YES = "Yes";
const string NO = "No";

int solve(long long X, long long Y)
{
    long long a, b;
    for (int i = 0; i <= X; i++) //a
    {
        for (int j = 0; j <= X; j++) //b
        {
            if (i + j == X && 2 * i + 4 * j == Y)
            {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    return 0;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main()
{
    long long X;
    scanf("%lld", &X);
    long long Y;
    scanf("%lld", &Y);
    solve(X, Y);
    return 0;
}


Measured memory_bytes: 3764
/*
confirm 0LL and 1LL
confirm cornercases such as 0
confirm times of cin < 10^6
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
template <typename T>
using Vec1 = vector<T>;
template <typename T>
using Vec2 = vector<Vec1<T> >;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define REPN(i, m, n) for(ll (i) = (m); (i) <= (n); ++(i))
#define REPR(i, m, n) for(ll (i) = (m)-1; (i) >= (n); --(i))
#define REPNR(i, m, n) for(ll (i) = (m); (i) >= (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}
template <typename T>
ll pow2(const T n){return (1LL << n);}
template <typename T>
void cosp(const T n){cout << n << ' ';}
void co(void){cout << '\n';}
template <typename T>
void co(const T n){cout << n << '\n';}
template <typename T1, typename T2>
void co(pair<T1, T2> p){cout << p.fs << ' ' << p.sc << '\n';}
template <typename T>
void co(const Vec1<T> &v){for(T i : v) cosp(i); cout << '\n';}
template <typename T>
void co(initializer_list<T> v){for(T i : v) cosp(i); cout << '\n';}
template <typename T>
void ce(const T n){cerr << n << endl;}
void sonic(){ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
constexpr ll INF = 1e9+1;
constexpr ll LINF = 1e18+1;
constexpr ll MOD = 1e9+7;
//constexpr ll MOD = 998244353;
const ld PI = acos(-1);
constexpr ld EPS = 1e-11;

Vec a;

ll f(ll l, ll d, ll m){
	if(m == 2) return abs(a[l] - a[l + d]);
	if(m == 3) return abs(a[l] - a[l + d * 2]);
	
	//bool flg = true;
	//rep(i, n) flg &= (a[l + d * i] != 1);

	ll res = 0;
	if(m & 1) return abs(f(l, d * 2, m / 2) - f(l + d * 2, d * 2, m / 2));
	else return abs(f(l, d * 2, m / 2) - f(l + d, d * 2, m / 2));
}

int main(void){
	ll n;
	cin >> n;
	string s;
	cin >> s;
	a.resize(n);
	bool flg = true;
	rep(i, n){
		a[i] = s[i] - '1';
		flg &= (a[i] != 1);
	}

	if (flg) rep(i, n) a[i] /= 2;

	ll ans = f(0, 1, n);
	if (flg) ans *= 2;
	co(ans);

	return 0;
}


Measured memory_bytes: 12164