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

int main()
{
	int d,s,i=0,j,h[300],w[300];
	while(1)/*for(i=0;i>300;i++)*/{
		scanf("%d",&h[i]);
		scanf("%d",&w[i]);
		if(h[i]==0 && w[i]==0){
			break;
		}
		i++;
	}
	d=i;
	for(s=0;s<d;s++){
		for(i=h[s];i>0;i--){
			for(j=w[s];j>0;j--) printf("#");
			printf("\n");
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 572
import numpy as np

H,W,A,B = (int(x) for x in input().split())
mt = np.zeros((H,W))
for j in range(B):
  for i in range(A):
    print(0, end="")
  for i in range(W-A):
    print(1, end="")
  print()
for j in range(H-B):
  for i in range(A):
    print(1, end="")
  for i in range(W-A):
    print(0, end="")
  print()


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

using namespace std;

int main(){
	int N, a[100];
	cin >> N;
	for (int i = 0; i < N; i++){
		cin >> a[i];
	}

	int sum = 0;
	for (int i = 0; i < N; i++){
		sum += a[i];
	}
	int ave = sum / N;

	int ans1 = 0;
	for (int i = 0; i < N; i++){
		ans1 += (a[i] - ave) * (a[i] - ave);
	}

	ave++;
	int ans2 = 0;
	for (int i = 0; i < N; i++){
		ans2 += (a[i] - ave) * (a[i] - ave);
	}

	cout << min(ans1, ans2) << endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
struct card
{  char suit,value;
};
void bubble(struct card c[],int n)//默认冒泡排序为稳定排序 
{  int i,j,t,flag;
   flag=1;
   j=0;
   while(flag)
   {  flag=0;
      for(i=n-1;i>0;i--)
        if(c[i].value<c[i-1].value) //不符合条件的两两交换 直到所有的都满足条件使flag不等于1 
         {  t=c[i].value;
            c[i].value=c[i-1].value;
            c[i-1].value=t;
            t=c[i].suit;
            c[i].suit=c[i-1].suit;
            c[i-1].suit=t;
            j++;
            flag=1;
         }
   }
}
void selection(struct card c[],int n) 
{  int i,t,j,k=0,minnumber;
   for(i=0;i<n;i++)
   {  minnumber=i;
      for(j=i;j<n;j++)
      if(c[j].value<c[minnumber].value)  minnumber=j;//找出未排序的最小值序号 
      if(minnumber!=i)
	  {  t=c[i].value;
         c[i].value=c[minnumber].value;
         c[minnumber].value=t;
         t=c[i].suit;
         c[i].suit=c[minnumber].suit;
         c[minnumber].suit=t;
         k++;
      }
   }
}
int isstable(struct card c1[],struct card c2[],int n)//以冒泡排序为参照判断相应的排序方法是否稳定 
{  int i,t;
   for(i=0;i<n;i++)
     if(c1[i].suit!=c2[i].suit)  
	 {  t=1;
	    break;
	 }
	 else t=0;
	 return t;
}
int main()
{  int i,n,t;
   struct card c1[100],c2[100];
   scanf("%d",&n);
   for(i=0;i<n;i++)
     scanf(" %c%c",&c1[i].suit,&c1[i].value);
   for(i=0;i<n;i++)
     c2[i]=c1[i];
   bubble(c1,n);
   for(i=0;i<n;i++)
   {  if(i>0)  printf(" ");
      printf("%c%c",c1[i].suit,c1[i].value);
   }
   printf("\n");
   printf("Stable\n");
   selection(c2,n);
   for(i=0;i<n;i++)
   {  if(i>0)  printf(" ");
      printf("%c%c",c2[i].suit,c2[i].value);
   }
   printf("\n");
   if(isstable(c1,c2,n))   printf("Not stable\n"); else printf("Stable\n");
}


Measured memory_bytes: 2044
#include <iostream>
#include <cstring>
#include <string>    
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
ll h, w, ans;

ll calc(ll a, ll b, ll c){
	ll r = abs(a-b);
	r = max(abs(b-c), r);
	r = max(abs(c-a), r);
	//cout << a << b << c << r << endl;
	return r;
}

int main(){
	cin >> h >> w;
	ans = h*w;
	ans = min(calc((h/3)*w, (h-h/3)*(w/2), (h-h/3)*(w-w/2)), ans);
	ans = min(calc((h/3+1)*w, (h-h/3-1)*(w/2), (h-h/3-1)*(w-w/2)), ans);
	ans = min(calc((h/3)*w, ((h-h/3)/2)*w, (h-h/3-(h-h/3)/2)*w), ans);
	ans = min(calc((h/3+1)*w, ((h-h/3-1)/2)*w, (h-h/3-1-(h-h/3-1)/2)*w), ans);
	ans = min(calc((w/3)*h, (w-w/3)*(h/2), (w-w/3)*(h-h/2)), ans);
	ans = min(calc((w/3+1)*h, (w-w/3-1)*(h/2), (w-w/3-1)*(h-h/2)), ans);
	ans = min(calc((w/3)*h, ((w-w/3)/2)*h, (w-w/3-(w-w/3)/2)*h), ans);
	ans = min(calc((w/3+1)*h, ((w-w/3-1)/2)*h, (w-w/3-1-(w-w/3-1)/2)*h), ans);
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
 
#define N 100000
#define INF 100000000
 
typedef struct{
  int g;
  int b;
  int c;
}data;
 
int n,A[N];
data D[500000];
 
void singlesource(int num)
{
  int i,ch=1;
 
  for(i=0; i<n; i++)A[i]=INF;
  A[0]=0;
 
  while(ch!=0){
    ch=0;
    for(i=0; i<num; i++){
      if(D[i].c+A[D[i].b]<A[D[i].g]){
	A[D[i].g]=D[i].c+A[D[i].b];
	ch=1;
      }
    }
  }
}
 
int main()
{
  int i,j,k,p,con=0;
 
  scanf("%d",&n);

  for(i=0; i<n; i++){
    if(i<n)break;
  }
  
  for(i=0; i<n; i++){
    scanf("%d%d",&p,&k);
    for(j=0; j<k; j++){
      D[con].b=p;
      scanf("%d%d",&D[con].g,&D[con].c);
      con++;
    }
  }
  singlesource(con);
  for(i=0; i<n; i++)printf("%d %d\n",i,A[i]);
  return 0;
}



Measured memory_bytes: 7560
def card_game():
    n = int(input())
    a_li = [int(i) for i in input().split()]
    ans = 0
    turn_switch = True

    li = sorted(a_li, reverse=True)

    for i in li:
        if turn_switch:
            ans += i
            turn_switch = False
        else:
            ans -= i
            turn_switch = True

    return ans


if __name__ == '__main__':
    print(card_game())


Measured memory_bytes: 3060
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; input_inner ! { iter , $ ( $ r ) * } } ; ( iter = $ iter : ident , $ ( $ r : tt ) * ) => { let s = { use std :: io :: Read ; let mut s = String :: new ( ) ; std :: io :: stdin ( ) . read_to_string ( & mut s ) . unwrap ( ) ; s } ; let mut $ iter = s . split_whitespace ( ) ; input_inner ! { $ iter , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let s = { use std :: io :: Read ; let mut s = String :: new ( ) ; std :: io :: stdin ( ) . read_to_string ( & mut s ) . unwrap ( ) ; s } ; let mut iter = s . split_whitespace ( ) ; input_inner ! { iter , $ ( $ r ) * } } ; }
macro_rules ! input_inner { ( $ iter : expr ) => { } ; ( $ iter : expr , ) => { } ; ( $ iter : expr , mut $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let mut $ var = read_value ! ( $ iter , $ t ) ; input_inner ! { $ iter $ ( $ r ) * } } ; ( $ iter : expr , mut $ var : ident $ ( $ r : tt ) * ) => { input_inner ! { $ iter , mut $ var : usize $ ( $ r ) * } } ; ( $ iter : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ iter , $ t ) ; input_inner ! { $ iter $ ( $ r ) * } } ; ( $ iter : expr , $ var : ident $ ( $ r : tt ) * ) => { input_inner ! { $ iter , $ var : usize $ ( $ r ) * } } ; }
macro_rules ! read_value { ( $ iter : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ iter , $ t ) ) ,* ) } ; ( $ iter : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ iter , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ iter : expr , { chars : $ base : expr } ) => { read_value ! ( $ iter , String ) . chars ( ) . map ( | c | ( c as u8 - $ base as u8 ) as usize ) . collect ::< Vec < usize >> ( ) } ; ( $ iter : expr , { char : $ base : expr } ) => { read_value ! ( $ iter , { chars : $ base } ) [ 0 ] } ; ( $ iter : expr , chars ) => { read_value ! ( $ iter , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ iter : expr , char ) => { read_value ! ( $ iter , chars ) [ 0 ] } ; ( $ iter : expr , usize1 ) => { read_value ! ( $ iter , usize ) - 1 } ; ( $ iter : expr , $ t : ty ) => { $ iter . next ( ) . unwrap ( ) . parse ::<$ t > ( ) . unwrap ( ) } ; }
fn main() {
    input! { n, a: [usize; n] };
    let x = a.iter().fold(0, |acc, &x| acc ^ x);
    let mut b = a.iter().map(|&aa| aa & !x).collect::<Vec<_>>();
    let mut y = 1 << format!("{:b}", b.iter().max().unwrap()).len() - 1;
    let mut k = 0;
    while y > 0 {
        for i in k..n {
            if y & b[i] != 0 {
                b.swap(i, k);
                for j in 0..n {
                    if j != k && y & b[j] != 0 {
                        b[j] ^= b[k];
                    }
                }
                k += 1;
                break;
            }
        }
        y /= 2;
    }
    println!("{}", b.iter().fold(0, |acc, &x| acc ^ x) * 2 + x);
}


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

using namespace std;

string N;


bool cmp(const char c1, const char c2) {
	return c1 > c2;
}

int solve() {
	int L, S, cnt;
	stringstream ss;

	cnt = 0;
	while (true) {
		if (N == "6174") {
			return cnt;
		}
		sort(N.begin(), N.end(), cmp);
		ss << N;
		ss >> L;
		//cout << L << " :output_L" << endl;
		ss.clear();
		sort(N.begin(), N.end());
		ss << N;
		ss >> S;
		//cout << S << " :output_S" << endl;
		ss.clear();
		ss << (L - S);
		ss >> N;
		ss.clear();
		while (N.size() < 4) {
			N = "0" + N;
		}
		//cout << "new:" << N << endl;
		++cnt;
	}
	
}

int main() {

	while (cin >> N, N != "0000") {
		if (N[0] == N[1] && N[1] == N[2] && N[2] == N[3]) {
			cout << "NA" << endl;
			continue;
		}
		cout << solve() << endl;
	}
	
	return 0;
}



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

int N;
long long A[200000];

int main(){
	long long sum = 0, small = LLONG_MAX;
	scanf("%d", &N);
	for(int i = 0; i < N; i++){
		int val;
		scanf("%d", &val);
		sum += val;
		A[i] = sum;
	}
	for(int i = 1; i < N; i++){
		long long a = A[N - 1] - A[i - 1];
		small = min(small, abs(a - A[i - 1]));
	}
	printf("%lld\n", small);
	return 0;
}


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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll m;cin>>m;
  ll ans=48-m;
  print(ans);
  return 0;
}


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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int w, h, x, y;
    cin >> w >> h >> x >> y;
    int multiple_ways = (2*x == w) && (2*y == h);
    long double area = ((long double) w) * h / 2;
    cout << setprecision(30) << area << " " << multiple_ways << endl;
    return 0;
}


Measured memory_bytes: 256
from sys import stdin
def main():
    #入力
    readline=stdin.readline
    n,m,c=map(int,readline().split())
    b=list(map(int,readline().split()))
    a=[list(map(int,readline().split())) for _ in range(n)]

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

if __name__=="__main__":
    main()

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

mx = 1e18
pr = 1
done = True
zero = False

for i in a:
	if i == 0:
		zero = True

if zero == False:
	for i in a:
		pr = pr*i
		if pr > mx:
			break
else:
	pr = 0
if zero or pr <= mx:
	print(pr)
else:
	print(-1)

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

int main(){

    int n;
    string str1,str2;

    int cnt1 = 0;
    int cnt2 = 0;

    cin >> n;
    for (int i = 0; i < n; i++){

        cin >> str1 >> str2;
        if (str1 > str2){
            cnt1 += 3;
        } else if (str1 == str2){
            cnt1 += 1;
            cnt2 += 1; 
        } else {
            cnt2 += 3;
        }

    }

    cout << cnt1 << " " << cnt2 << endl;

    return 0;
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using ll = long long;
using pii = pair<int,int>;
using vi = vector<int>;
using vc = vector<char>;
using vs = vector<string>;
using vpii = vector<pair<int,int>>;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};



int main(void) {
  int h,a;
  cin >> h >> a;
  cout << (h +a- 1)/a << endl;
  
    
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
// define
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define SUB(a, b) a = (a+mod-b)%mod
#define MUL(a, b) a = (((a)%mod) * ((b)%mod)) % mod
#define rollcall cout << "I'm Sucu." << endl;
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define fi first
#define se second
// debug
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> &v){
  for (auto it = v.begin();it != v.end();++it){
    if(it != v.begin())os << " ";os << *it;
  }return os;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, const map<T, U> &mp){
  for(auto x: mp)os << "(" << x.first << "," << x.second << ")" << endl;
  return os;
}
template<typename T, int SIZE>
int array_length(const T (&)[SIZE]){return SIZE;}
template<typename T, int N>
void PRINTF(const T (&a)[N], int s = N, int t = -1, bool f = true){
	if(t == -1){rep(i,s){if(i)cout << " ";cout << a[i];}}
	else repi(i,s,t){if(i!=s)cout << " ";cout << a[i];}
	if(f)cout << "\n";
}
template<typename T, int N1, int N2>
void PRINTF(const T (&a)[N1][N2], int h = N1, int w = N2){
	rep(i,h){rep(j,w){cout << a[i][j] << " \n"[j==w-1];}}
}
string substr(const string &str, int S1, int S2 = -1){
  if(S2 == -1)return str.substr(S1);
  return str.substr(S1, S2-S1);
}
// typedef
typedef complex<double> Point;
typedef pair<int, int> P;
typedef pair<int, P> PP;
typedef pair<P, int> Pi;
typedef vector<int> vi;
typedef deque<int> dq;
const int inf = 1e9+7;
const int INF = 1e18+7;
// int sum = accumulate(a, a+n, 0LL);
// int mx = max_element(a, a+n);
// int mn = min_element(a, a+n);
// int cnt = count(a, a+n, k);

int a[200], b[200];
signed main(){
  int n, m, c, ans = 0;
  cin >> n >> m >> c;
  rep(i,m)cin >> b[i];
  rep(i,n){
    int tmp, sum = 0;
    rep(j,m){
      cin >> tmp;sum += tmp*b[j];
    }
    if(sum + c > 0)ans++;
  }
  cout << ans << endl;
  return 0;
}





Measured memory_bytes: 256
S =[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
n = int(input())
print(S[n-1])

Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
  
int main(void){
    double a, b, c;
    cin >> a >> b >> c;
    double s = (a + b + c) / 2.0;
    
	double ans = sqrt(s*(s-a)*(s-b)*(s-c)); 
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, a, n) for (long long i = (a); i < (long long)(n); ++i)
#define REPC(i, a, n) for (long long i = (a); i <= (long long)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define MATINIT(type, row, col, init) \
  vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T>
using VEC = std::vector<T>;
template <class T>
using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail>
void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec) os << v << ",";
  os << "}";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, queue<T> vec) {
  os << "{";
  while (!vec.empty()) {
    os << vec.front() << ",";
    vec.pop();
  }
  os << "}";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, set<T> &s) {
  os << "{";
  for (auto p : s) os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, map<T1, T2> &m) {
  os << "{";
  for (auto p : m) os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  os << "[" << p.first << " " << p.second << "]";
  return os;
}

int main() {
  int N;
  cin >> N;
  // VEC<queue<int>> TO(N);
  int TO[N][N - 1];
  REP(i, 0, N) {
    REP(j, 0, N - 1) {
      scanf("%d", &TO[i][j]);
      TO[i][j]--;
    }
  }
  queue<pair<int, int>> playQueue;
  auto addPairIfPlayable = [&](pair<int, int> p) {
    static map<pair<int, int>, int> mp;
    if (p.first > p.second) swap(p.first, p.second);
    mp[p]++;
    if (mp[p] == 2) {
      playQueue.push(p);
      mp.erase(p);
    }
  };
  REP(i, 0, N) {
    auto p = make_pair((int)i, TO[i][0]);
    addPairIfPlayable(p);
  }
  VEC<int> index(N, 0);
  // 変更点をqueueに入れるように舐め方を変えると通るらしい
  // DUMP(playQueue);
  // DUMP(playQueue);
  VEC<int> lastGameDay(N, 0);
  while (playQueue.empty() == false) {
    // DUMP(playQueue);
    auto p = playQueue.front();
    playQueue.pop();
    int i = p.first;
    int j = p.second;
    if (index[i] < N - 1 && index[j] < N - 1) {
      // if (TO[i][index[i]] == j && TO[j][index[j]] == i) {
      lastGameDay[i] = lastGameDay[j] = max(lastGameDay[i], lastGameDay[j]) + 1;
      index[i]++;
      index[j]++;
      if (index[i] < N - 1) {
        auto newPair = make_pair(i, TO[i][index[i]]);
        addPairIfPlayable(newPair);
      }
      if (index[j] < N - 1) {
        auto newPair = make_pair(j, TO[j][index[j]]);
        addPairIfPlayable(newPair);
      }
      // DUMP(days, cnt, i + 1, j + 1);
    }
    // }
  }
  REP(i, 0, N) {
    if (index[i] != N - 1) {
      cout << -1 << endl;
      return 0;
    }
  }
  LL days = *max_element(ALL(lastGameDay));
  std::printf("%lld\n", days);

  return 0;
}


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

int main(){
	int N; cin>>N;
	vector<ll> A(N);
	for(int i=0; i<N; ++i) cin>>A[i];

	vector<ll> C(2);
	for(int c=0; c<2; ++c){
		int sign = c?1:-1;
		for(ll s=0, a=0; a<N; ++a, sign*=-1){
			s += A[a];
			if(sign*s<=0){ C[c]+=abs(s)+1; s=sign; }
		}
	}
	cout<< (C[0]<C[1]?C[0]:C[1]) <<endl;
}

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

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<stack<int>> q(n);
    int T;
    cin >> T;
    while (T--) {
        int x; cin >> x;
        if(x==0) {
            int a,b;
            cin >> a >> b;
            q[a].push(b);
        }
        if (x==1) {
            int t;
            cin >> t;
            if (!q[t].empty()) cout << q[t].top() << endl;
        }
        if (x==2) {
            int t;
            cin >> t;
            if (!q[t].empty()) q[t].pop();
        }
    }
    return 0;
}


Measured memory_bytes: 4248
# Beginners Contest (D)

import sys

# 入力取得
input()
n_ls = [int(e) for e in input().split(" ")]

# 探索
satisfy_n = 0
crush_n = 0
for n in n_ls:
	if n == (satisfy_n+1):
		satisfy_n += 1
	else:
		crush_n += 1

# 結果出力
if satisfy_n == 0:
	print(-1)
else:
	print(crush_n)


Measured memory_bytes: 25768
#include<cstdio>
#include<cstring>
int main()
{
    char a[100004];
    scanf("%s",a);
    int l=strlen(a);
    int ant=0;
    for(int i=1;i<l;i++)
    {
    	if(a[i]!=a[i-1])
    	ant++;
	}
	printf("%d\n",ant);
return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF=1001001001;
const int mod=1e9+7;

struct UnionFind{
  vector<int>d;

  UnionFind(int n):d(n,-1){};
  int root(int x){
    if(d[x]<0){return x;}
    else{return d[x]=root(d[x]);}
  }
  bool unite(int x,int y){
    x=root(x);y=root(y);
    if(x==y){return false;}
    if(d[x]>d[y]){swap(x,y);}
    d[x]+=d[y];
    d[y]=x;
    return true;
  }
  bool issame(int x,int y){return root(x)==root(y);}
  int size(int x){return -d[root(x)];}
};
int main(){
  int64_t N,M;
  cin>>N>>M;
  vector<int>A(M),B(M);
  UnionFind uf(N);
  for(int i=0;i<M;i++){
    cin>>A[i]>>B[i];
    A[i]--;B[i]--;
  }
  vector<int64_t>ans(M);
  ans[M-1]=N*(N-1)/2;
  for(int i=M-1;i>=1;i--){
    if(uf.root(A[i])==uf.root(B[i])){ans[i-1]=ans[i];}
    else{ans[i-1]=ans[i]-uf.size(A[i])*uf.size(B[i]);}
    uf.unite(A[i],B[i]);
  }
  for(int i=0;i<M;i++){
    cout<<ans[i]<<endl;
  }
  return 0;
}

Measured memory_bytes: 5004
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<vector>
#include<bitset>

using namespace std;

int gcd(int a,int b){
	return b==0?a:gcd(b,a%b);
}
int n,k;
int maxx;
int main()
{
	cin>>n>>k;
	int now=0;
	for (int i=1;i<=n;i++)
	{
		int x;
		cin>>x;
		now=gcd(now,x);
		maxx=max(maxx,x);
	}
	if (k%now==0&&k<=maxx) printf("POSSIBLE\n");
	else printf("IMPOSSIBLE\n");
		
	return 0;
}


Measured memory_bytes: 256
parseInt(x::String) = parse(Int, x)
parseInt(x::SubString{String}) = parse(Int, x)
parseInt(x::Char) = parse(Int, x)
parseInt(x::Float64) = trunc(Int, x)
parseFloat(x::String) = parse(Float64, x)
parseFloat(x::Int) = trunc(Float64, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    a,b=parseMap(split(readline()))
    println(parseInt(ceil((a+b)/2)))
end
main()

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

using namespace std;

int main() {
	int N, L;
	cin >> N >> L;
	vector<int>A(N);
	for (int i = 0; i < N; i++)
	{
		A[i] = L + i;
	}

	int ans = L;

	for (int i = 0; i < N; i++)
	{
		if (abs(ans) > abs(L + i)) {
			ans = L + i;
		}
	}

	cout << N * (2 * L + N - 1) / 2 - ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
	int i,j,k;
	scanf("%d %d",&i,&j);
	if(i<j)
	{
		i=i+j;
		j=i-j;
		i=i-j;
	}
	for(k=0;k<i;k++)
	printf("%d",j);
	return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<numeric>
#include<limits>
#include<bitset>
#include<functional>
#include<type_traits>
#include<queue>
#include<stack>
#include<array>
#include<random>
#include<utility>
#include<cstdlib>
#include<ctime>

using namespace std;

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

#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep2(i, begin_i, end_i) for (int i = (int)begin_i; i < (int)end_i; i++)

long long INF = 1LL<<60;
long long dp[100010];
int h[100010];
int n;
int x[10],y[10];

double dist(int i,int j){
    double dx = (x[i]-x[j]);
    double dy = (y[i]-y[j]);
    return   pow(dx*dx + dy*dy,0.5);
}

void solve(){
cin>>n;
for(int i=1;i<=n;i++){cin>>x[i]>>y[i];}
double ave=0.0;
for(int i=1;i<=n;i++){
    for(int j=i+1;j<=n;j++)ave+= dist(i,j)*2/n;
}
cout<<fixed<<setprecision(10)<<ave<<endl;
    return ;
}
int main(){
    solve();
    return 0;
}



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

class Main{
    public static void main(String args[])throws IOException{
      try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))){
        int num = Integer.parseInt(br.readLine());
        String[] cypher = br.readLine().split("");

        //for algorithm
        boolean[][][] dp = new boolean[num+1][4][1000];
        int count = 0;

        dp[0][0][0] = true;

        // dynamic programming
        for(int i = 0; i < num; i++){
          for(int j = 0; j <= 3; j++){
            for(int t = 0; t < 1000; t++){
              if(dp[i][j][t]){
                dp[i+1][j][t] = true;

                if(j <= 2){
                  dp[i + 1][j + 1][t*10 + (Integer.parseInt(cypher[i]))] = true;
                }
              }else{
                continue;
              }

            }

          }
        }
        
        for(int i = 0; i < 1000; i++){
          if(dp[num][3][i]){
            count++;
          }
        }
        
        System.out.println(count);

      }
    }
}

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

int d(ll n);

int main(){
    ll t; cin >> t;
    ll sq = sqrtl(t);
    int ma = INT_MIN;
    for(int i = 1; i <= sq; i++){
        if(t%i != 0) continue;
        ll s = t/i;
        ma = max(d(s), d(i));
    }
    cout << ma << endl;
    return 0;
}

int d(ll n){
    int c = 0;
    while(n != 0){
        n/=10;
        c++;
    }
    return c;
}

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


typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ldb;

#define pb push_back
#define popb pop_back
#define si size()
#define be begin()
#define en end()
#define le length()
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second

#define forz(i,n) for( int i=0;i<n;i++)
#define forl(i, n) for(int i = 1; i<= n; i++)
#define deci(n)  fixed<<setprecision(n)
#define high(n) __builtin_popcount(n)
#define parity(n) __builtin_parity(n)
#define ctz(n)  __builtin_ctz(n)
#define mod 1000000007
#define mod2 998244353
#define kira ios::sync_with_stdio(0), cin.tie(0),cout.tie(0)

using namespace std;

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

int main()
{
	// cpc();
	// ios_base::sync_with_stdio(false);
	// cin.tie(NULL);
	// lli t;
	// cin >> t;
	// while (t--)
	// {
	lli k , sum = 0;
	int g;

	cin >> k;
	forl(i, k)
	{
		forl(j, k)
		{
			forl(r, k)
			{
				g = __gcd(j, r);
				sum = sum + __gcd(i, g);
			}
		}

	}
	cout << sum << endl;
	// }
	return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for (ll i=0; i<n; ++i)
#define all(c) begin(c),end(c)
/*
B>A
C>B
*/
int main(){
  ll A,B,C,K; cin>>A>>B>>C>>K;
  ll cnt = 0;
  while (A>=B){
    B*=2;
    cnt++;
  }
  while (B>=C){
    C*=2;
    cnt++;
  }
  if(cnt<=K) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

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

int main()
{
    char A, B;
    cin >> A >> B;
    if (A < B)
    {
        cout << "<";
    }
    else if (A > B)
    {
        cout << ">";
    }
    else
    {
        cout << "=";
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define faster ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
 
typedef vector<int> vi;;
typedef vector<ll> vll;

#define l() length()
#define sz() size()
 
#define b() begin()
#define e() end()
#define all(x) x.begin(), x.end()
 
#define pb(i) push_back(i)
#define PB() pop_back()
 
 
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;
#define mp make_pair
#define Fi first
#define Se second
 
const int maxx=1e6+9;
 
// Happy Coding!


void solve(){
    
    int n;
    cin>>n;
    
    stack<int> s;
    int cnt=0;
    for(int i=0;i<n;i++){
        int x;
        cin>>x;
        while(!s.empty() && s.top()>=x){
            s.pop();
        }
        cnt+=s.empty();
        s.push(x);
    }
    cout<<cnt;
}



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

Measured memory_bytes: 3880
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <tuple>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <numeric>
#include <string.h>
#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define repn(i, x) for (int i = 1; i <= (int)(x); i++)
#define repr(i, x) for (int i = ((int)(x) - 1); i >= 0; i--)
#define reprn(i, x) for (int i = ((int)(x)); i > 0; i--)
#define all(x) (x).begin, (x).end()
using namespace std;
typedef long long int64;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long  INFL = 1e18;
const int MOD = 1000000007;
const int MAX = 210000;
const int MAX_NUM = 999999999;
struct Edge {
	int to, id;
};
vector<vector<Edge>> g;
vector<int> ans;
//逆元を求める関数
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
	  fac[i] = fac[i-1] * i % MOD;
	  inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
	  finv[i] = finv[i-1] * inv[i] % MOD;
	}
}
//組み合わせ
long long COM (int n, int k) {
	if(n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}

void dfs (int v, int c = -1, int p = -1) {
	int k = 1;
	rep (i, g[v].size()) {
		int u = g[v][i].to; int ei = g[v][i].id;
		if (u == p) continue;
		if (c == k) k++;
		ans[ei] = k; k++;
		dfs(u, ans[ei], v);
	}
}
void solve() {
	int n; cin >> n;
	g.resize(n);
	ans = vector<int>(n - 1);
	rep (i, n - 1) {
		int a, b; cin >> a >> b;
		a--; b--;
		g[a].push_back( {b , i});
		g[b].push_back( {a , i});
	}
	dfs(0);
	int mx = 0;
	rep (i, n) {
		mx = max(mx, int(g[i].size()));
	}
	cout << mx << endl;
	rep (i, n - 1) {
		cout << ans[i] << endl;
	}
	return;
}
int main() {
	solve();
	return 0;
}

Measured memory_bytes: 8320
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

constexpr ll infl = 10000000000000000LL;
constexpr int inf = 1000000000;

int main() {
    int n, k;
    cin >> n >> k;
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        int h;
        cin >> h;
        ans += h >= k;
    }
    cout << ans << endl;
    return 0;
}

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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define DBG(...)                              \
  do {                                        \
    cerr << #__VA_ARGS__ << ": ";             \
    debug(__VA_ARGS__);                       \
    cerr << " (L" << __LINE__ << ")" << endl; \
  } while (0)
#else
#define DBG(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define CIN(type, ...) \
  type __VA_ARGS__;    \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << std::endl;
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define COUT(...) write_to_cout(__VA_ARGS__);

#define ALL(x) (x).begin(), (x).end()
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)

using ll = long long;

using namespace std;

int main() {
  CIN(int, N, M);
  COUT(N == M ? "Yes" : "No");
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>
#include <cassert>
#include <functional>
#include <set>
#include <deque>
using namespace std;
typedef long long ll;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
const int INF = 1<<29;
#define LNF __LONG_LONG_MAX__;
const ll MOD = 1000000007;
const int MAX = 200000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// 法mでのaの逆元を計算
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
//最大公約数
int gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }
//最小公倍数
int lcm(int x, int y) { return x / gcd(x, y) * y; }
// nが大きく,kが10^7程度の時の二項係数
long long com[200005];
void combination(long long n,long long k){
    com[0] = 1;
    for(int i=1;i<=k;i++){
        com[i] = (com[i-1]*(n-i+1)%MOD)*modinv(i,MOD)%MOD;
    }
}

int main(){
    int A,B,M; cin >> A >> B >> M;
    vector<int> a(A);
    vector<int> b(B);
    int amin=INF;
    int bmin=INF;
    vector<pair<int,int> > x(M);
    vector<int> c(M);
    for(int i=0;i<A;i++){
        cin >> a[i];
        if(a[i]<amin) amin=a[i];
    }
    for(int i=0;i<B;i++){
        cin >> b[i];
        if(b[i]<bmin) bmin=b[i];
    }
    int out=amin+bmin;
    for(int i=0;i<M;i++){
        int s,t; cin >> s >> t >> c[i];
        if(a[s-1]+b[t-1]-c[i]<out) out = a[s-1]+b[t-1]-c[i];
    }
    cout << out << endl;
    return 0;
}


Measured memory_bytes: 2176
let to_array s = Str.split (Str.regexp_string " ") s
                 |> List.map float_of_string
                 |> Array.of_list;;
let is_parallel x1 y1 x2 y2 x3 y3 x4 y4 =
  let prod =(x2 -. x1) *. (y4 -. y3) -. ( x4 -. x3) *. (y2 -. y1) in
  if prod < (1e-10) && prod > -.(1e-10) then true else false;;

let rec read = function
    0 -> ()
  | i -> let l = read_line () |> to_array in
         let (x1,y1,x2,y2,x3,y3,x4,y4) = (l.(0),l.(1),l.(2),l.(3),l.(4),l.(5),l.(6),l.(7))
         in
         let () = if is_parallel x1 y1 x2 y2 x3 y3 x4 y4 then print_endline "YES"
                  else print_endline "NO"
         in read (i-1);;
let () = read_int () |> read;;

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

typedef struct TFC
{
    int T;
    int F;
    string C;
};

void solve(std::istream &ist, std::ostream &ost)
{
    /* ------- 宣言と入力 ------- */

    string S;
    int Q;

    ist >> S;
    ist >> Q;

    struct TFC Q_uery[Q];

    for (int i = 0; i < Q; i++)
    {
        ist >> Q_uery[i].T;
        if (Q_uery[i].T == 2)
        {
            ist >> Q_uery[i].F;
            ist >> Q_uery[i].C;
        }
    }

    /* ------- 計算 ------- */

    bool mode = true;
    deque<string> deq;

    for (int i = 0; i < S.length(); i++)
    {
        deq.emplace_back(S.substr(i, 1));
    }

    for (int i = 0; i < Q; i++)
    {
        if (Q_uery[i].T == 1)
        {
            mode = !mode;
            continue;
        }
//        if ((Q_uery[i].F == 1 && mode) || (Q_uery[i].F == 2 && !mode))
        if ((Q_uery[i].F == 1) ^ mode)
        {
            deq.emplace_back(Q_uery[i].C);
        }
        else
        {
            deq.emplace_front(Q_uery[i].C);
        }
    }

    if (mode)
    {
        for (auto it = deq.begin(); it != deq.end(); ++it)
        {
            ost << *it;
        }
        ost << endl;
    }
    else
    {
        for (auto it = deq.rbegin(), e = deq.rend(); it != e; ++it)
        {
            ost << *it;
        }
        ost << endl;
    }
}

#ifndef WOMAIN
int main()
{
    solve(std::cin, std::cout);
    return 0;
}
#endif


Measured memory_bytes: 20352
#include <bits/stdc++.h>
const int INF = 1e9;
const int MO = 1e9+7;
using LL = long long;
const LL LINF = 1e18;
const double EPS = 1e-10;
using namespace std;
#define COUT(v) cout<<(v)<<endl
#define CIN(n)  int(n);cin >> (n)
#define LCIN(n) LL(n);cin >> (n)
#define SCIN(n) string(n);cin >> (n)
#define YES(n) cout<<((n)? "YES" : "NO")<<endl
#define Yes(n) cout<<((n)? "Yes" : "No")<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) <<endl

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)

#define FOREACH(x,a) for(auto& (x) : (a) )

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

#define rt return
#define ENDL cout<<endl
#define MAXE(a,b) a=max(a,b)
#define MINE(a,b) a=min(a,b)
#define s second
#define f first

typedef string::const_iterator State;
class PalseError {};
class Edge{
public:
    LL from,to,value;
    Edge(LL a,LL b,LL c){
        from = a;
        to = b;
        value = c;
    }
    Edge(LL a,LL b){
        from = a;
        to = b;
    }
};
/*
 *最大値 -> めぐるできそう
 */
int main(){
    SCIN(str);
    int ok = 1;
    int ng = str.size();
    if(count(ALL(str),'1') == str.size() || count(ALL(str),'0') == str.size()){
        COUT(str.size());
        return 0;
    }
    auto check = [&](int N){
        if(str.size()/2 >= N)return true;
        if(count(str.end()-N,str.begin()+N,'1') == N-(str.size()-N) || count(str.end()-N,str.begin()+N,'0') == N-(str.size()-N)){
            return true;
        }else{
            return false;
        }
    };
    while(ng - ok > 1){
        int mid = (ng+ok)/2;
        if(check(mid)){
            ok = mid;
        }else{
            ng = mid;
        }
    }
    cout<<ok<<endl;
}


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

int main() {
    int K,N;
    cin >> K >> N;
    vector<int> A(N);
    rep(i,N) cin >> A[i];
    int distmx = 0;
    rep(i,N-1){
        distmx = max(distmx,A[i+1]-A[i]);
    }
    distmx = max(distmx,A[0] + (K- A[N-1]));
    cout << K - distmx << endl;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
char ch[65536];
int len;
bool b=false;
int main(){
	cin>>ch;
	len=strlen(ch);
	for(int i=0;i<len;i++){
		if(ch[i]=='C'){
			b=true;
		}
		if(ch[i]=='F'){
			if(b==true){
				cout<<"Yes";
				return 0;
			}
		}
	}
	cout<<"No";
	return 0;
}

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

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

    sort(h, h + n);
    long long count = 0;
    for (int i = 0; i < n - k; i++) count += h[i];
    cout << count << endl;

    return 0;
}

Measured memory_bytes: 4424
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>

using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
signed main(){
  int k,x;cin>>k>>x;
  if(k*500>=x){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <algorithm> 
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i,n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define sz(x) (ll)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
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; 
}
ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  ll n,m;
  cin>>n>>m;
  string s;
  cin>>s;
  vll dp(n+1,INF);
  rep(i,n+1){
    if(s[i]=='0')dp[i]=-1;
  }
  multiset<ll> se;
  dp[0]=0;
  se.insert(0);
  rep(i,n+1){
    if(i==0) continue;
    if(dp[i]==INF){
      se.insert(INF);
      if(i>=m){
        se.erase(se.find(dp[i-m]));
      }
      continue;
    }
    if(*begin(se)==INF){
      COUT(-1);
      return 0;
    }
    dp[i]=*begin(se)+1;
    se.insert(dp[i]);
    if(i>=m){
      se.erase(se.find(dp[i-m]));
    }
  }
  vll ans(0);
  ll cu=dp[n];
  ans.pb(n);
  cu--;
  ll now=n;
  while(cu){
    ll co;
    rep(i,min(now,m)){
      if(cu==dp[now-i-1]){
        co=now-i-1;
      }
    }
    ans.pb(co);
    now=co;
    cu--;
  }
  ans.pb(0);
  reverse(all(ans));
  rep(i,sz(ans)-1){
    cout<<ans[i+1]-ans[i]<<" ";
  }
}

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


using namespace std;

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

int main(){
    int N;
    cin >> N;
    vector<int> P(N),Q(N),vt(N);
    for(int i=0; i<N; i++){
        cin >> P[i];
        vt[i]=i+1;
    }
    for(int i=0; i<N; i++){
        cin >> Q[i];
    }

    int cnt=1,a,b;
    do {
        bool flag1=true,flag2=true;
        for(int i=0; i<N; i++){
            if(vt[i]!=P[i]) flag1=false;
            if(vt[i]!=Q[i]) flag2=false;
        }
        if(flag1==true) a=cnt;
        if(flag2==true) b=cnt;
        cnt++;
    } while(next_permutation(vt.begin(), vt.end()));
    cout << abs(a-b) << endl;

    return 0;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#define  boost ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ull unsigned long long
#define deb(x) cout<<#x<<" "<<x<<endl;
#define deb2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;
#define deb2l(x,y,i) cout<<#x<<i<<" "<<x<<" "<<#y<<i<<" "<<y<<endl;

#define fr(i,l,r) for(ll i=l;i<r;i++)
#define mems(a,x) memset(a,x,sizeof(a))
#define mod 1000000007
#define ff first
#define ss second
#define pb(x) push_back(x)
#define vll vector<ll>
#define pbp(x,y) push_back(make_pair(x,y))
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ll find(ll n){
    if(n==0)
    return 0;
    if(n==1)
    return 1;
    return 2*find(n/2)+1;
}
void solve(){
    ll n;
    cin>>n;
    cout<<find(n);
}

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


Measured memory_bytes: 256
using System;

namespace question2
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            int digit = 0;
            int amari = 0;
            int[] numbers = new int[7];
            int[] all = new int[7];
            numbers[0] = 1;
            numbers[1] = 10;
            numbers[2] = 100;
            numbers[3] = 1000;
            numbers[4] = 10000;
            numbers[5] = 100000;
            numbers[6] = 1000000;
            all[0] = 9;
            all[1] = 0;
            all[2] = 900;
            all[3] = 0;
            all[4] = 90000;
            all[5] = 0;
            all[6] = 9000000;
            int res = 0;
            for (int i =1; i < 7; i++)
            {
                if (N < numbers[i])
                {
                    amari = N - numbers[i-1];
                    if (all[i-1]!=0) res += 1 + amari;
                    if (i == 1) res = N;
                    break;
                }
                res += all[i-1];
            }
            Console.WriteLine(res.ToString());
            //Console.ReadLine();
        }
    }
}


Measured memory_bytes: 13140
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <list>
#include <set>
using namespace std;
typedef long long ll;


int main(int argc, char *args[]) {
	int N,D,X;
	int num_of_chocolate;
	int counter;
	int days;
	int A[101];
	cin >> N >> D >> X;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	num_of_chocolate = 0;
	for (int i = 0; i < N; i++) {
		days = 0;
		counter = 0;
		for (int j = 0;; j++) {
			days = j * A[i] + 1;
			if (days <= D) {
				counter++;
			}
			else {
				break;
			}
		}
		num_of_chocolate = num_of_chocolate + counter;
	}
	num_of_chocolate = num_of_chocolate + X;

	cout << num_of_chocolate << endl;
	
	
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <sstream>
#include <iomanip>
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define min_3(a,b,c) min(a,min(b,c))
#define max_3(a,b,c) max(a,max(b,c))
#define nout(ans) cout << (ans) << "\n"
#define sout(ans) cout << (ans) << " "
using namespace std;

const double pi = 3.14159265359;
const ll INF = 1e12;
const ll MOD = 1e9 + 7;
const ll N = 1e5 + 5;
/*
Decimal Places: cout << fixed << setprecision(n) << ans << endl

String to integer:
stringstream dark(s);
int x = 0; dark >> x;
*/

bool compare(const pair<int, int>&i, const pair<int, int>&j)
{
    return i.second < j.second;
}


ll a, b;

void solve()
{
    cin >> a >> b;
    if ((a+b)%2==1) nout("IMPOSSIBLE");
    else nout((a+b)/2);
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int t = 1;
    //cin >> t;
    for (int i=1; i<=t; i++)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
  char s[12],t[12],u[12];
  int a,b,i;
  scanf("%s %s\n",&s,&t );
  scanf("%d %d\n",&a,&b );
  scanf("%s\n",&u );

  for(i=0;i<11;i++){
    if(s[i] != u[i]){
      b--;
      break;
    }
    if(t[i] != u[i]){
      a--;
      break;
    }
  }
  printf("%d %d\n",a,b );
  return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

int main(void) {
	double max,min,now;
	scanf("%lf",&max);
	min=max;
	while(1) {
		if(scanf("%lf",&now)==-1)break;
		if(now<min)min=now;
		if(now>max)max=now;
	}
	printf("%f\n",max-min);
	return 0;
}

Measured memory_bytes: 0
#include <stdio.h>
int main(){
    int ban,a=0,b=0,ab=0,o=0;
    char gata[3]={0};
    while(scanf("%d,%s",&ban,gata)!=EOF){
        if(gata[0]=='A'){
            if(gata[1]=='B'){
                ab++;}else{
                    a++;
                }
            }
        if(gata[0]=='B'){
            b++;
        }
        if(gata[0]=='O'){
            o++;
        }
    }
    printf("%d\n%d\n%d\n%d\n",a,b,ab,o);
	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define endl '\n'
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define FASTIO ios::sync_with_stdio(0); cin.tie(0);
#define REP(i,a,b) for(int i=a;i<b;i++)
const int inf=2e9;
#define maxx 200005
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;

int main(){
    FASTIO;
    ll ans=0;
    string s;
    cin>>s;
    for(auto c:s) ans+=c-'0';
    if(ans%9==0) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 3716