akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstring>
using namespace std;

int main(){
  int H,W; cin >> H >> W;
  char data[101][101];
  for ( int i = 1; i <=H; i++ ) {
    for ( int j = 1; j <= W; j++ ) {
      cin >> data[i][j];
    }
  }
  //  bool f = true;
  int cnt;

  for ( int i = 1; i <= H; i++ ) {
    cnt = 0;
    for ( int j = 1; j <=W; j++ ) {
      if(data[i][j] == '.' ) {
	cnt++;
	if(cnt == W) {
	  for ( int k = 1; k <= W; k++ ) {
	    data[i][k] = 'X';
	  }
	}
		     
      }
    }
  }
    for ( int j = 1; j <= W; j++ ) {
    cnt = 0;
    for ( int i = 1; i <=H; i++ ) {
      // cout << data[i][j];

      if(data[i][j] == '.' || data[i][j] == 'X') {
	cnt++;
	if(cnt == H) {
	  //	  len++;
	  for ( int k = 1; k <= H; k++ ) {
	    //cout << "i " << i << " j " << j << " k " << k;
	    data[k][j] = 'X';
	    //cout << data[j][k];
	  }
	  //	  cout << endl;
	}
		     
      }

    }

    // cout << endl;
  }

    for ( int i = 1; i <= H; i++ ) {
      cnt = 0;
      for ( int j = 1; j<= W; j++ ) {
	if ( data[i][j] != 'X' ){
	cout << data[i][j];	
	}
	if(data[i][j] == 'X' ) cnt++;
	//	 if ( j == W )cout << endl;
      }
      if( cnt != W )cout << endl;
    }
    
    
  return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {

  public static void main(String[] args) { 
      Scanner sc = new Scanner(System.in);
      int h = sc.nextInt();
      int w = sc.nextInt();
      int n = sc.nextInt();

      int[] colors = new int[n+1];
      for(int i = 1; i <= n; i++)
        colors[i] = sc.nextInt();

      int[][] grid = new int[h][w];
      int row = 0, col = 0;
      boolean isTowards = true;
      for(int i = 1; i <= n; i++) {
        int colorCnt = colors[i];
        while(colorCnt > 0) {
          colorCnt--;
          grid[row][col] = i;
          if(isTowards) col++;
          else col--;
          if(col == w) {
            isTowards = !isTowards;
            col = w - 1;
            row++;
          } else if(col == -1) {
            isTowards = !isTowards;
            col = 0;
            row++;
          }
        }
      }
      for(int i = 0; i < h; i++) {
        for(int j = 0; j < w; j++) {
          if(j == w - 1)
            System.out.println(grid[i][j]);
          else
            System.out.print(grid[i][j] + " ");
        }
      }
  }
}

Measured memory_bytes: 32928
/*
  ID: ak260901
  TASK: a
  LANG: C++
*/

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>

using namespace std;

#define foru(i, l, r) for(register int i = l; i <= r; i++)
#define ford(i, r, l) for(register int i = r; i >= l; i--)

char ch[20];

int main() {
  //freopen("a.in", "r", stdin);
  //freopen("a.out", "w", stdout);
  scanf("%s", ch + 1);
  int now = 0;
  now += (ch[1] - '0') * 1000;
  now += (ch[2] - '0') * 100;
  now += (ch[3] - '0') * 10;
  now += (ch[4] - '0') * 1;
  if(now < 2019) {puts("TBD"); return 0;}
  if(now > 2019) {puts("Heisei"); return 0;}
  now = 0;
  now += (ch[6] - '0') * 10;
  now += (ch[7] - '0') * 1;
  if(now > 4) {puts("TBD"); return 0;}
  if(now < 4) {puts("Heisei"); return 0;}
  now = 0;
  now += (ch[9] - '0') * 10;
  now += (ch[10] - '0') * 1;
  if(now > 30) {puts("TBD"); return 0;}
  else  {puts("Heisei"); return 0;}
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1e9 + 7;
const ll INF = LLONG_MAX;

int main()
{
    int h, w;
    cin >> h >> w;
    vector<string> s(h);
    vector<vector<int>> tate(h, vector<int>(w, 0)), yoko(h, vector<int>(w, 0));
    for (int i = 0; i < h; i++)
    {
        cin >> s[i];
    }
    for (int i = 0; i < h; i++)
    {
        int tmp = 0;
        for (int j = 0; j < w; j++)
        {
            if (s[i][j] == '.')
            {
                tmp++;
                yoko[i][j] = tmp;
            }
            if (s[i][j] == '#')
                tmp = 0;
        }
        int ma = 0;
        for (int j = w - 1; j >= 0; j--)
        {
            if (yoko[i][j] > 0)
            {
                ma = max(ma, yoko[i][j]);
                yoko[i][j] = ma;
            }
            else
            {
                ma = 0;
            }
        }
    }
    for (int j = 0; j < w; j++)
    {
        int tmp = 0;
        for (int i = 0; i < h; i++)
        {
            if (s[i][j] == '.')
            {
                tmp++;
                tate[i][j] = tmp;
            }
            if (s[i][j] == '#')
                tmp = 0;
        }
        int ma = 0;
        for (int i = h - 1; i >= 0; i--)
        {
            if (tate[i][j] > 0)
            {
                ma = max(ma, tate[i][j]);
                tate[i][j] = ma;
            }
            else
            {
                ma = 0;
            }
        }
    }
    int ans = 0;
    for (int i = 0; i < h; i++)
    {
        for (int j = 0; j < w; j++)
        {
            ans = max(ans, yoko[i][j] + tate[i][j] - 1);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 35712
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <iomanip>
using namespace std;

int main()
{
    string s;
    cin >> s;
    if((s[2] == s[3]) && (s[4] == s[5])){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
    
}

Measured memory_bytes: 256
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;

int N, W, H, X[200010], Y[200010], R[200010], C[200010];

void update(int &x, int &y, int &ans, int ix, int iy, int res) {
    if(res < ans) {
        x = ix, y = iy, ans = res;
    }
    else if(res == ans) {
        if(ix < x) x = ix, y = iy;
        else if(ix == x and iy < y) y = iy;
    }
}

int calc(int x, int y) {
    int ma = -1, sum = 0;
    for(int i=0; i<N; i++) {
        int val = abs(x - X[i]) + abs(y - Y[i]);
        sum += 2 * val;
        ma = max(ma, val);
    }
    return sum - ma;
}

signed main() {
    cin >> W >> H >> N;
    for(int i=0; i<N; i++) {
        cin >> X[i] >> Y[i];
        R[i] = X[i], C[i] = Y[i];
    }

    sort(R, R+N), sort(C, C+N);
    int x = -1, y = -1, ans = INF;
    for(int i=0; i<2; i++) {
        for(int j=0; j<2; j++) {
            int ix = N / 2 - i, iy = N / 2 - j;
            if(ix < 0 or iy < 0) continue;
            int res = calc(R[ix], C[iy]);
            update(x, y, ans, R[ix], C[iy], res);
        }
    }
    cout << ans << endl << x << " " << y << endl;
    return 0;
}



Measured memory_bytes: 6300
m_d = list()    # 魔法移動距離
for i in range(-2, 3):
    for j in range(-2, 3):
        if (i,j) not in [(0,0),(-1,0),(0,-1),(1,0),(0,1)]:
            m_d += [(i,j)]

h, w = list(map(int, input().split()))
si, sj = list(map(int, input().split()))
ti, tj = list(map(int, input().split()))
s = [None] * h
for i in range(h):
    s[i] = input()

# 距離情報を一番遠い値で初期化
#import numpy as np
INF = int(1e9)
#dist = np.full((h+4, w+4), INF)
dist = [[INF for j in range(w+4)] for i in range(h+4)]

# マップ境界を壁で囲む
S = ['##{}##'.format(s_row) for s_row in s]
S = ['##{}##'.format('#' * (w+4))]*2 + S
S = S + ['##{}##'.format('#' * (w+4))]*2

# BFS探索用キュー
from collections import deque
q_a = deque() # 徒歩
q_b = deque() # ワープ

# 開始位置、終了位置を調整
si, sj = si+1, sj+1
ti, tj = ti+1, tj+1
dist[si][sj] = 0
q_a.append([si,sj])

while (len(q_a)>0):
    i, j = ij = q_a.popleft()
    d = dist[i][j]
    w = False
    for di, dj in [(-1,0),(0,-1),(1,0),(0,1)]:
        ni, nj = di+i, dj+j
        if (S[ni][nj]=='#'):
            w = True
            continue # 壁
        if (dist[ni][nj]<=d):
            continue # 探索済みコスト以上
        dist[ni][nj] = d
        q_a.append([ni,nj])
        
    if w: q_b.append(ij)

    if len(q_a) == 0:
        while (len(q_b)>0):
            i, j = q_b.popleft()
            d = dist[i][j]
            for di, dj in m_d:
                ni, nj = di+i, dj+j
                if (S[ni][nj]=='#'):
                    continue # 壁
                if (dist[ni][nj]<=d):
                    continue # 探索済みコスト以上
                dist[ni][nj] = d+1
                q_a.append([ni,nj])

ans = dist[ti][tj]
if ans == INF:
    ans = -1
print(ans)


Measured memory_bytes: 154524
n = int(input())
l = list(map(int, input().split()))
cnt = 0
for i in range(n):
    if l[i] % 2 == 0:
        if l[i] % 3 == 0:
            cnt += 1
        elif l[i] % 5 == 0:
            cnt += 1
        else:
            print("DENIED")
            quit()
print("APPROVED")


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define ll long long
#define rep(i,n) for(int i = 0; i < int(n); i++)
#define vi vector<int>
using namespace std;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T &a, const T &b){ if(a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b){ if(b<a) { a=b; return 1; } return 0; }

const int MAX = 1e6;
const int MOD = 1e9+7;
long fac[MAX],finv[MAX],inv[MAX];

void combinit(){
  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 com(int n, int k){
  if(n < k) return 0;
  if(n < 0 or k < 0) return 0;
  return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}

int main(){
  cin.tie(0), ios::sync_with_stdio(false);
  combinit();
  ll x,y; cin >> x >> y;
  int cnt = 0;
  while(y != 2*x){
    cnt++;
    y++;
    x--;
    if(x < 0){
      cout << 0;
      return 0;
    }
  }
  cout << com(x,cnt);
  cout << "\n";
  return 0;
}


Measured memory_bytes: 27052
#include <stdio.h>
#define N 100
#define mark (1<<21)
 int min(int a,int b){
   if(a>b)return b;
   else return a;}

 int main(){
   int m[N+1][N+1];
   int p[N+1];
   int i,l,k;
   int n;
   
   scanf("%d",&n);
   for(i=1;i<=n;i++){
     scanf("%d%d",&p[i-1],&p[i]);
   }
   for(i=0;i<=n;i++)m[i][i]=0;

   for(l=2;l<=n;l++){
     for(i=1;i<=n-l+1;i++){
     int j= i+l-1;
     m[i][j]= mark;
     for( k =i;k<=j-1;k++){
       m[i][j]=min(m[i][j],m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j]);
     }

     }
   }
   printf("%d\n",m[1][n]);
   return 0;
 }



Measured memory_bytes: 2052
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <climits>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b, h;
    cin >> a >> b >> h;
    cout << (a + b) * h / 2 << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define rep(i, n) for(int i=0;i<(int)n;i++)
#define PI acos(-1)
#define fast_io ios_base::sync_with_stdio(false) ; cin.tie(0); cout.tie(0);
ll mod=1e9+7;


int main(){
    fast_io

    int a, b, c;
    cin>>a>>b>>c;
    for(int i=a;i<2000000;i+=a){
        if(i%b==c){
            cout<<"YES"<<endl;
            return 0;
        }
    }
    cout<<"NO"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int digitCnt(int p)
{
    int i,c=0,ans=0;
    while(p>0)
    {
        p=p/10;
        c++;
    }
    if(c%2!=0)
    {
        ans++;
    }
    //cout<<ans;
    return ans;

}
int main()
{
    int n,m=0,i;
    cin>>n;
    for(i=1; i<=n; i++)
    {
        m=m+digitCnt(i);
    }
cout<<m<<endl;


}


Measured memory_bytes: 256
def Harshad(n):

    count = 10
    sumn = 0
    while n // count > 0:
        sumn += (n // count) % 10
        count *= 10

    sumn += n % 10

    if n % sumn == 0:
        return "Yes"
    else:
        return "No"


def main():
    n = int(input())
    print(Harshad(n))

if __name__ == '__main__':
    main()


Measured memory_bytes: 38384
str=input()
s=list(str)
alp=list(set(s))

res=10**6
for a in alp:
    idx=[]
    bidx=-1
    max=0
    s.append(a)
    for i in range(len(s)):
        if s[i]==a:
            tmp=i-bidx-1
            #print(i)
            #print(tmp)
            if max<tmp:
                max=tmp
            bidx=i
    s.pop()
    if res>max:
        res=max

print(res)


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

#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;

typedef long long ll;

const int INF = 1 << 30;
const ll LLINF = 1LL << 62;

int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N, K; cin >> N >> K;
    int A[N]; rep(i, N) cin >> A[i];
    int work[N+1];
    rep(i, K){
        fill(work, work+N+1, 0);
        bool nomore = true;
        rep(i, N){
            //A[i]が照らす範囲
            int left = max(0, i-A[i]), right = min(N, i+A[i]+1);
            work[left]++; work[right]--;
        }
        rep(i, N){
            if(i == 0) A[0] = work[0];
            else A[i] = A[i-1] + work[i];
            if(A[i] != N) nomore = false;
        }
        if(nomore) break;
    }
    rep(i, N) cout << A[i] << " "; cout << endl;
    return 0;
}

Measured memory_bytes: 5212
import java.util.Scanner;

public class Main {
	private static long[] all;
	private static long[] p;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long x = sc.nextLong();
		all = new long[n + 1];
		p = new long[n + 1];

		all[0] = 1;
		p[0] = 1;
		for (int i = 1; i <= n; i++) {
			all[i] = 2 * all[i - 1] + 3;
			p[i] = 2 * p[i - 1] + 1;
		}

		System.out.println(solve(n, x));
	}

	private static long solve(int n, long x) {
		if (x <= 0 || n < 0) return 0;
		if (n == 0) return 1;
		if (x == 1) return 0;

		if (x <= 1 + all[n - 1]) return solve(n - 1, x - 1);
		if (x == 2 + all[n - 1]) return p[n - 1] + 1;
		if (x <= 2 * all[n - 1] + 2) return p[n - 1] + 1 + solve(n - 1, x - 2 - all[n - 1]);
		return 2 * p[n - 1] + 1;
	}
}


Measured memory_bytes: 23636
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;
  n%=10;
  if(n==3){
    cout << "bon" << endl;
  }else if(n==0||n==1||n==6||n==8){
    cout << "pon" << endl;
  }else{
    cout << "hon" << endl;
  }
}


Measured memory_bytes: 3596
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define FOR(i,k,n) for(int(i)=(k);(i)<(n);++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v),end(v)
#ifdef ONLINE_JUDGE
  #define debug(x)
  #define debug2(x,y)
  #define debug3(x,y,z)
  #define assert(e) if(!(e)){stod("");}
#else
  #define debug(x) std::cerr<<#x<<": "<<x<<"\n"
  #define debug2(x,y) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<"\n"
  #define debug3(x,y,z) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<", "<<#z<<": "<<z<<"\n"
#endif

using ll=long long;
using vi=std::vector<int>;
using vvi=std::vector<vi>;
using vll=std::vector<ll>;
using vvll=std::vector<vll>;
template<typename T> using vvec=std::vector<std::vector<T>>;
template<typename T>
auto make_v(size_t sz){return std::vector<T>(sz);}
template<typename T,typename... Ts>
auto make_v(size_t sz,Ts...ts){return std::vector<decltype(make_v<T>(ts...))>(sz,make_v<T>(ts...));}
template<typename T>
void fill_v(T&var,const T&x){var=x;}
template<typename V,typename T>
void fill_v(V&v,const T&x){for(auto&& w:v){fill_v(w,x);}}

template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<std::vector<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<std::deque<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s, const std::set<T>&v){
  s<<"\n";for(auto&& elm:v){s<<elm<<"\t";}s<<"\n";return s;}

inline void scan(int&a){scanf("%d",&a);}
inline void scan(ll&a){scanf("%lld",&a);}
inline void scan(char&a){scanf(" %c",&a);}
inline void scan(double&a){scanf("%lf",&a);}
template<typename T>
inline void scan(std::vector<T>&v){for(auto&& sv:v){scan(sv);}}
template<typename First,typename...Args>
inline void scan(First&f,Args&...args){scan(f);scan(args...);}
inline void scan(std::string&s){char BUF[3000000];scanf(" %s",BUF);s=std::string(BUF);}
inline void print(int a){printf("%d\n",a);}
inline void print(ll a){printf("%lld\n",a);}
inline void print(double a){printf("%.12f\n",a);}
inline void print(std::string s){std::cout<<s<<"\n";}

using namespace std;

void solve() {
  int n;
  scan(n);
  vi a(n);
  scan(a);
  int cnt = 0;
  rep (i, n) {
    if (i % 2 == 0 and a[i] % 2 == 1) {
      cnt += 1;
    }
  }
  print(cnt);
}

int main() {
  solve();
  return 0;
}


Measured memory_bytes: 3224
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
using P = pair<int,int>;
using pq = priority_queue<int>;
typedef long long ll;
string y = "Yes";
string n = "No";

int  main()
{
	int x, n; cin >> x >> n;
	vector <int> p(n);
	set <int> st;
	rep(i, n)
	{
		cin >> p[i];
		st.insert(p[i]);
	}
	if (n == 0)
	{
		cout << x << endl; return 0;
	}
	int mx = INT_MAX;
	for (int i = -1; i <= 101; i++)
	{
		if (!st.count(i))
			mx = min(mx, abs(x - i));
	}
	for (int i = -1; i <= 101; i++)
	{
		if (!st.count(i))
		{
			if (mx == abs(x - i))
			{
				cout << i << endl;
				return 0;
			}
		}
	}
	return (0);
}

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

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	string S;
	cin >> S;
	bool elf = true;
	if (S[0] != 'A') elf = false;
	int a = 0;
	int b = 0;
	for (int i = 2; i <= S.size() - 2; ++i) {
		if (S[i] == 'C') {
			a++; b = i;
		}
	}
	if (a != 1) elf = false;
	rep(i, S.size()) {
		if (i == 0 || i == b) continue;
		if (!islower(S[i])) elf = false;
	}
	if (elf) cout << "AC" << endl;
	else cout << "WA" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<string>
#include<vector>
#include<algorithm>
#include<iostream>
using namespace std;
int main(){
    int N,T,E;
    cin>>N>>T>>E;
    int ans=-1;
    for(int i=0;i<N;i++){
        int b;
        cin>>b;
        int a=T%b;
        if(a==0||a+E>=b||a-E<=0)ans=i+1;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1164
#include<bits/stdc++.h>
using namespace std;
int main(){
  cin.tie(NULL);
  ios::sync_with_stdio(false);
  string s;
  cin>>s;
  int n=0,sum=s.size();
  for(int i=1;i<sum;i++){
    if(s[i]!=s[i-1]) n++;
  }
  cout<<n<<'\n';
  return 0;
}


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

using namespace std;
int main() {
	vector<int> a(3);

	cin >> a[0] >> a[1] >> a[2];

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

	cout << a[0] * a[1] / 2 << endl;

	return 0;
}

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

#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 namespace std;
const long long INF = 1LL << 61;
const long long MOD = 1000000000 + 7;

int main() {
	string S; cin >> S;
	rep(i, S.size() - 1) {
		if (S[i] == S[i + 1]) {
			cout << "Bad";
			return 0;
		}
	}
	cout << "Good";
}

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

int main(){
  long long N;
  cin >> N;
  vector<long long> A(N),h(N);
  for(long long i=0; i<N; i++){
    cin >> A[i];
  }
  long long ma,ans=0;
  h[0] = 0;
  for(long long i=1; i<N; i++){
    ma = A[i-1] + h[i-1];
    h[i] = max((long long)0, ma - A[i]);
    ans += h[i];
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 6416
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define ALL(x) (x).begin(), (x).end()
#define REP(i ,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
typedef vector<int>vint;
typedef vector<ll>vll;
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

int main()
{
  int K,N;
  cin >> K >> N;
  vint A(N);
  REP(i,N){
    cin >> A[i];
  }
  
  int ans = 1e7;
  REP(i,N){
    int b = i-1;
    int f = i+1;
    int s_b = K-(A[i]-A[b]);
    int s_f = K-(A[f]-A[i]);
    if(i == 0){
      b = N-1;
      s_b = abs(A[i]-A[b]);
    }else if(i == N-1){
      f = 0;
      s_f = abs(A[f]-A[i]);
    }
    ans = min(ans,min(s_b,s_f));
  }
  cout << ans << endl;
}


Measured memory_bytes: 1024
N,A,B=map(int,input().split())
X=list(map(int,input().split()))
from collections import deque
X=deque(X)
cost=0
now=X.popleft()
while len(X)>0:
    if (X[0]-now)*A<=B:
        cost+=(X[0]-now)*A
    else:cost+=B
    now=X.popleft()
print(cost)

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

int main(){
    int n,m,l;
    cin>>n>>m>>l;
    long long x[n][m],y[m][l],z[n][l];
    rep(i,n)rep(j,m)cin>>x[i][j];
    rep(i,m)rep(j,l)cin>>y[i][j];
    rep(i,n)rep(j,l){
        long long d=0;
        rep(k,m){
            d+=x[i][k]*y[k][j];
        }
        z[i][j]=d;
    }
    rep(i,n){
        rep(j,l){
            if(j<l-1)cout<<z[i][j]<<" ";
            if(j==l-1)cout<<z[i][j];
        }
        cout<<endl;
    }
    return 0;
}


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

int main()
{
	string S;
	cin >> S;

	if (S == "Sunny" ) {
		cout << "Cloudy";
	}
	else if(S == "Cloudy") {
		cout << "Rainy";
	}
	else {
		cout << "Sunny";
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(void){
    // Your code here!
    int sx,sy,tx,ty;
    cin>>sx>>sy>>tx>>ty;
    
    int dx=tx-sx;
    int dy=ty-sy;
    
    cout<<string(dy,'U')<<string(dx,'R');
    cout<<string(dy,'D')<<string(dx,'L');
    
    cout<<'L'<<string(dy+1,'U')<<string(dx+1,'R')<<'D';
    cout<<'R'<<string(dy+1,'D')<<string(dx+1,'L')<<'U'<<endl;
    return 0;
}

Measured memory_bytes: 3600
/*" بِسْمِ اللهِ الرَّحْمٰنِ الرَّحِيْمِ -In the name of Allah."
   Never stop chasing!-MD.SOURAV.

   ░░░░░░░░( •̪●)░░░░░░░░░░░░░░░░░░░░░░░░
   ░░░░░░███████ ]▄▄▄▄▄▄▄▄▃░░░▃░░░░ ▃░
   ▂▄▅█████████▅▄▃▂░░░░░░░░░░░░░░░░░
   [███████████████████].░░░░░░░░░░░░░░
   ◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤...░░░░░░░░░░░░
*/


#include <bits/stdc++.h>


#define yes            cout<<"YES"<<endl
#define no             cout<<"NO"<<endl
#define sz(x)          x.size()
#define ll             long long int
#define li              ong int
#define start          ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define test           int t;cin>>t;while(t--)
#define f(i, a, n)     for(int i=a; i<n;i++)
#define gcd(a,b)       __gcd(a,b)
#define lcd(a,b)       (a*b)/gcd(a,b)
#define pb             push_back
#define mp(x,y)        make_pair(x,y)
#define rsrt(v)        sort(v.begin(),v.end(),greater<int>())
#define srt(v)         sort(v.begin(),v.end())
#define basrt(a,n)     sort(a,a+n,greater<int>())
#define asrt(a,n)      sort(a,a+n)
#define F              first
#define S              second
#define deb(x)         cout << #x << ": " << x << endl;
#define enter(v,n)     for(ll i=0;i<n;i++){ll x;cin>>x;v.pb(x);}
#define MOD 	       1000000007
#define unique(v)      v.erase(unique(v.begin(),v.end()),v.end())
#define ignore         cin.ignore (std::numeric_limits<std::streamsize>::max(),'\n');
#define MAX 32000
#define endl "\n"

using namespace std;

double pi=3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664 ;
typedef vector<ll> vll ;
typedef vector<int> vii ;
typedef vector<pair<ll,ll>> vpllll;
typedef vector<pair<int,int>> vpiiii;
typedef map<ll,ll> mllll;
typedef map<char,ll> mchll;
typedef map<string,ll>msll;

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

void solve()
{

        int n,x,t;
        cin>>n>>x>>t;
        long double x1=n*1.0/x;
       // deb(x1);
        int a=ceil(x1);
        ll ans=a*t;
        cout << ans << endl;

}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll test_case=1;
    //cin>>test_case;
    while(test_case--)
	{
		 solve();
	}

	return 0;
}

Measured memory_bytes: 3636
N, W = map(int, input().split())

dp = [0] * (W + 1)

for i in range(N):
    w, v = map(int, input().split())
    for j in range(W, w-1, -1):
        dp[j] = max(dp[j], dp[j-w] + v)

print(dp[W])

Measured memory_bytes: 41580
#include <cstdio>
int main()
{
    int A,B,C,K,t;
    scanf("%d%d%d",&A,&B,&C);
    scanf("%d",&K);
    if(A<B)
    {
        t=A;
        A=B;
        B=t;
    }
    if(A<C)
    {
        t=A;
        A=C;
        C=t;
    }
    printf("%d\n",(A<<K)+B+C);
    return 0;
}


Measured memory_bytes: 128
import numpy as np


def main():
    h, w = map(int, input().split())
    board = [list(input()) for _ in range(h)]
    board_arr = np.array(board)

    del_h = np.where(np.all(board_arr == '.', axis=1))
    board_arr = np.delete(board_arr, del_h, axis=0)
    del_w = np.where(np.all(board_arr == '.', axis=0))
    board_arr = np.delete(board_arr, del_w, axis=1)
    for row in board_arr:
        row = row.tolist()
        ans = ''.join(row)
        print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 12616
def read_input():
    n = int(input())
    alist = list(map(int, input().split()))

    return n, alist


def submit():
    n, alist = read_input()

    xlist = [0] * n

    for i, a in enumerate(alist):
        if i % 2 == 0:
            xlist[0] += a
        else:
            xlist[0] -= a

    for i, a in enumerate(alist[:-1]):
        xlist[i + 1] = 2*a - xlist[i]

    print(' '.join(map(str, xlist)))


if __name__ == '__main__':
    submit()


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

int main() {
    int n; ll x; cin >> n >> x;
    vector<ll> a(n); rep(i, n) cin >> a[i];
    ll count = 0;
    if(a[0] > x) {
        count += a[0] - x;
        a[0] = x;
    }
    rep(i, n-1) {
        if(a[i] + a[i+1] <= x) continue;
        else {
            count += a[i+1] + a[i] - x; //cout << i << a[i+1] + a[i] - x << endl;
            a[i+1] = x - a[i];
        }
    }
    cout << count << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_int.hpp>
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E17;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
////////////////////////////
// find min(ax + b)
struct CHT {
    deque<l_l> v;
    CHT() {}
    void add(ll a, ll b) {
        l_l t(a, b);
        while(v.size() > 1 && check(v[v.size()-2], v[v.size()-1], t)) v.pop_back();
        v.pb(t);
    }
    ll query(ll x) {
        if(v.empty()) return 0;
        ll l = -1, r = v.size() - 1;
        while(l+1<r) {
            ll mid = (l+r)/2;
            if (f(v[mid], x) >= f(v[mid+1], x)) l = mid;
            else r = mid;
        }
        return f(v[r], x);
    }
    ll query_incr(ll x) {
        if(v.empty()) return 0;
        while(v.size() > 1 && f(v[0], x) >= f(v[1], x)) v.pop_front();
        return f(v[0], x);
    }
    bool check(const l_l &p1, const l_l &p2, const l_l &p3) {
        return (__int128)(p2.first-p1.first)*(p3.second-p2.second) >= (__int128)(p2.second-p1.second)*(p3.first-p2.first);
    }
    ll f(l_l a, ll x){
        return a.first * x + a.second;
    }
};
//////////////////////

int main(){fastio
    CHT cht;
    ll n,c;cin>>n>>c;
    ll h[n];rep(i,0,n-1)cin>>h[i];
    ll dp[n];
    dp[0]=0;
    cht.add(-2*h[0],h[0]*h[0]);
    rep(i,1,n-1){
        ll res=cht.query(h[i]);
        dp[i]=h[i]*h[i]+c+res;
        cht.add(-2*h[i],h[i]*h[i]+dp[i]);
    }
    cout<<dp[n-1]<<endl;
    return 0;
}


Measured memory_bytes: 6656
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N,M,X,cunt;
    cin>>N>>M>>X;
    int A[M];
    for(int i=0;i<M;i++)cin>>A[i];
    cunt=0;
    for(int i=0;i<M;i++){
        if(A[i]<X)cunt++;
        else break;
    }
    cout<<(cunt*2<M?cunt:M-cunt)<<"\n";


    return 0;
}


Measured memory_bytes: 256
import java.util.*
import java.math.*

fun main(args: Array<String>) {
//    var (N,K) = readLine()!!.split(" ").map { it.toInt() }
//    var N = readLine()!!.toInt()
    val S = readLine()!!
//    val D = readLine()!!.split(" ").map { it.toLong() }
    var ans = "Yes"
    var a:Char?=null
    var b:Char?=null
    var isA = false
    var isB = false
    for (c in S) {
        if (a==null) a=c
        else if (a==c) isA = isA xor true
        else if (b==null) b=c
        else if (b==c) isB = isB xor true
    }
    println(if (isA && isB) "Yes" else "No")
}


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

int main() {
  int N;
  cin >> N;
  vector<int> dp(N+1);
  dp[0] = 0;
  for (int i=1; i<=N; ++i) {
    dp[i] = i;
    int power = 1;
    while (power <= i) {
      dp[i] = min(dp[i], dp[i-power] + 1);
      power *= 6;
    }
    power = 1;
    while (power <= i) {
      dp[i] = min(dp[i], dp[i-power] + 1);
      power *= 9;
    }
  }
  cout << dp[N] << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main() {
    int n;
    vector<int> a;
    cin >> n;

    int n_minus = 0;
    for (int i = 0; i < n; i++) {
        int j;
        cin >> j;
        if (j < 0) n_minus++;
        a.emplace_back(abs(j));
    }

    uint64_t ans = 0;
    int minimum = INT32_MAX;
    for (int i = 0; i < n; i++) {
        ans += a[i];
        minimum = min(minimum, a[i]);
    }
    if (n_minus % 2 == 1) {
        ans -= minimum * 2;
    }

    cout << ans << endl;
}


Measured memory_bytes: 892
program bbb

implicit none
integer :: n, i, co
integer, allocatable, dimension(:) :: p

read*, n
allocate(p(n))
read*, p

co=0

do i=2,n-1
if((p(i)<p(i-1)).and.(p(i)>p(i+1))) then
co=co+1
else if((p(i)>p(i-1)).and.(p(i)<p(i+1))) then
co=co+1
end if
end do

write(*,'(i0)') co

end program

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
// #include <boost/dynamic_bitset.hpp>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <chrono>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <typeindex>
#include <typeinfo>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define DEBUG(x) cout << #x << ": " << x << endl
#define INFILE() freopen("input.txt", "r", stdin)
#define REP(i, a, b) for (int i = (a); i < (b); i++)
#define REPC(i, a) REP(i, 0, a)
#define RREP(i, a, b) for (int i = (a); i >= (b); i--)
#define RREPC(i, a) RREP(i, a, 0)
#define ALL(s) begin(s), end(s)
#define RALL(s) rbegin(s), rend(s)

using namespace std;

using ll = long long;
using ull = unsigned long long;
using i_i = pair<int, int>;
using ll_ll = pair<ll, ll>;
using d_i = pair<double, int>;
using i_d = pair<int, double>;
using d_d = pair<double, double>;

static constexpr ll LL_MOD = 1000000009;
static constexpr ll LL2_MOD = 1000000007;
static constexpr double EPS = numeric_limits<double>::epsilon();
static constexpr double PI = 3.14159265358979323846264338327950288;
static constexpr ll INF = 1LL << 60;

static map<type_index, const char *const> scanType = {
{ typeid(int), "%d" },
{ typeid(ll), "%lld" },
{ typeid(double), "%lf" },
{ typeid(char), "%c" }};

template <class T> static void scan(vector<T> &v);
static void scan(vector<string> &v, bool isWord = true);
// static boost::dynamic_bitset<> scan(char trueValue = 'o');
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; }

int main(int argc, char *argv[]) {
	//INFILE();

	int n;
	cin >> n;
	vector<ll_ll> jobs(n);
	for (auto&& j : jobs) {
		cin >> j.second >> j.first;
	}
	sort(ALL(jobs));

	ll total_time = 0;
	for (auto&& j : jobs) {
		total_time += j.second;

		if (total_time > j.first) {
			cout << "No" << endl;
			return 0;
		}
	}

	cout << "Yes" << endl;
	return 0;
}

template <class T> static void scan(vector<T> &v) {
	auto tFormat = scanType[typeid(T)];
	for (T &n : v) {
		scanf(tFormat, &n);
	}
}

static void scan(vector<string> &v, bool isWord) {
	if (isWord) {
		for (auto &n : v) {
			cin >> n;
		}
		return;
	}

	int i = 0, size = v.size();
	string s;
	getline(cin, s);

	if (s.size() != 0) {
		i++;
		v[0] = s;
	}

	for (; i < size; ++i) {
		getline(cin, v[i]);
	}
}

//static boost::dynamic_bitset<> scan(char trueValue) {
//	string s;
//	getline(cin, s);
//
//	if (s.size() == 0) {
//		getline(cin, s);
//	}
//
//	for_each(begin(s), end(s),
//		[trueValue](char &c) { c = (c == trueValue) ? '1' : '0'; });
//	return boost::dynamic_bitset<>(string(rbegin(s), rend(s)));
//}


Measured memory_bytes: 3328
#include<iostream>
#include<cmath>
#include<vector>
#include<string>
#include<queue>
#include<set>
#include<map>
#include<algorithm>
#include<functional>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll, int> plli;
typedef pair<int, pii> pipii;
typedef vector<vector<int> > mati;
typedef vector<vector<double> > matd;

#define rep(i,x,y) for(int i=(x); i<(y); ++i)
const int INF = (1<<30);
const ll INFLL = 1LL<<62;
const long double EPS = 1e-12;

template <typename T>
void vec_print(vector<T> VEC){
  rep(i, 0, VEC.size()){
    cout << VEC[i] << " ";
  }
  cout << "\n";
};

template <typename T>
void mat_print(vector<vector<T> > MAT){
  rep(i, 0, MAT.size()){
    rep(j, 0, MAT[i].size()){
      cout << MAT[i][j] << " ";
    }
    cout << "\n";
  }
};

class HOGE{
  public:
    ll index;
    ll value;
    HOGE(ll index, ll value){
      this->index = index;
      this->value = value;
    };
    ~HOGE(void){
      return;
    };

    void print(void){
      cout << "index : " << index << ", value : " << value << "\n";
      return;
    };
    
    bool operator==(const HOGE &obj){
      return (this->value == obj.value);
    };
    bool operator<(const HOGE &obj){
      return (this->value < obj.value);
    };
    bool operator>(const HOGE &obj){
      return (this->value > obj.value);
    };
};

int main(){
  cin.tie(0); // cut the cin and cout (default, std::flush is performed after std::cin)
  ios::sync_with_stdio(false); // cut the iostream and stdio (DON'T endl; BUT "\n";)

  ll a, b;
  cin >> a >> b;
  if(a+b==15){
    cout << "+\n";
  }else if(a*b==15){
    cout << "*\n";
  }else{
    cout << "x\n";
  }

  return 0;
}


Measured memory_bytes: 256
/*
 _____ _             _              _           _ 
|_   _| |__   ___   / \   _ __  ___| |__  _   _| |
  | | | '_ \ / _ \ / _ \ | '_ \/ __| '_ \| | | | |
  | | | | | |  __// ___ \| | | \__ \ | | | |_| | |
  |_| |_| |_|\___/_/   \_\_| |_|___/_| |_|\__,_|_|                                                

*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#define ll          long long
#define pb          push_back
#define ppb         pop_back
#define    endl        '\n'
#define mii         map<ll,ll>
#define msi         map<string,ll>
#define mis         map<ll, string>
#define rep(i,a,b)    for(ll i=a;i<b;i++)
#define repr(i,a,b) for(ll i=b-1;i>=a;i--)
#define trav(a, x)     for(auto& a : x)
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pair<ll, ll>>
#define vs          vector<string>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define max(a,b)    (a>b?a:b)
#define min(a,b)    (a<b?a:b)

/*    For Debugging    */
#define DEBUG         cerr<<"\n>>>I'm Here<<<\n"<<endl;
#define display(x) trav(a,x) cout<<a<<" ";cout<<endl;
#define what_is(x)  cerr << #x << " is " << x << endl;

std::mt19937_64 rng(std::chrono::steady_clock::now().time_since_epoch().count());
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define TIME        cerr << "\nTime elapsed: " << setprecision(5) <<1000.0 * clock() / CLOCKS_PER_SEC << "ms\n";
#define DECIMAL(n)  cout << fixed ; cout << setprecision(n);
#define FAST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace __gnu_pbds;
using namespace std;
#define PI 3.141592653589793
#define N  200005

vi a[N];
vi tail;
ll v[N];
bool vis[N];
ll ans[N];

int CeilIndex(int l, int r, int key) 
{ 
    while (r - l > 1) { 
        int m = l + (r - l) / 2; 
        if (tail[m] >= key) 
            r = m; 
        else
            l = m; 
    } 
  
    return r; 
} 

void dfs(ll node){
    vis[node]=1;
    ans[node]=sz(tail);
    ll num,pre;
    for(auto i:a[node]){
        if(vis[i])
            continue;
        if(v[i]<tail[0]){
            pre=tail[0];
            tail[0]=v[i];
            dfs(i);
            tail[0]=pre;
        }
        else if(v[i] > tail.back()){
            tail.pb(v[i]);
            dfs(i);
            tail.ppb();
        }
        else{
            num=CeilIndex(-1, tail.size() - 1, v[i]);
            pre=tail[num];
            tail[num]=v[i];
            dfs(i);
            tail[num]=pre;
        }
    }
}

void solve()
{
    ll n;
    cin>>n;
    rep(i,1,n+1)
    cin>>v[i];
    ll x,y;
    rep(i,1,n){
        cin>>x>>y;
        a[x].pb(y);
        a[y].pb(x);
    }
    tail.pb(v[1]);
    dfs(1);
    rep(i,1,n+1){
        cout<<ans[i]<<"\n";
    }

    return;
}
int main()
{
    FAST
    int TESTS=1;
//    cin>>TESTS;
    while(TESTS--)
    {
        solve();
    }
    TIME
    return 0;
}

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

int main() {
    string s ,t;
    cin >> s >> t;
    int a , b;
    string u;
    cin >> a >> b >> u;
    if (s == u) a--;
    else b--;
    cout << a << " " << b << endl;
    return 0;
}

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

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

	vector<double> e( N );
	for( int i = 0; i < N; i++ )  {
		e[i] = p[i] * (p[i] + 1) / 2 / p[i];
	}
	vector<double> acc( N + 1 );
	for( int i = 0; i < N; i++ )  {
		acc[i + 1] = acc[i] + e[i];
	}
	double ans = 0;
	for( int i = 0; i <= N - K; i++ )  {
		ans = max( ans, acc[i + K] - acc[i] );
	}

	cout << fixed << setprecision(12) << ans << endl;
}


Measured memory_bytes: 8052
#include<iostream>
#include <algorithm>
#include<cstdio>
#include<string>
#include<math.h>
#include<vector>
#include <queue>
#include <bits/stdc++.h>
#include <map>
#include <cmath>
#include <cctype>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define srep(i,s,t) for (int i = s; i < t; i++)
#define drep(i,n) for(int i = (n)-1; i >= 0; i--)
using namespace std;
typedef vector<vector<char>> field_t;

typedef pair<int, int> point_t;
vector<vector<pair<int,int>>> z(100010);
int ans[100010];
bool used[100010];
void dfs(int v, int w){
    if(w%2==0){
        ans[v]=1;
    }else{
        ans[v]=0;
    }
    for(auto t:z[v]){
        if(!used[t.first]){
            used[t.first]=true;
            dfs(t.first,t.second+w);
        }
    }
}

int main()
{
    int N,i;
    cin >> N;
    vector<int> x(N); 
    rep(i,N-1){
        int u,v,w;
        cin >> u >> v >> w;
        u--;
        v--;
        z[u].push_back(make_pair(v,w));
        z[v].push_back(make_pair(u,w));
    }
    dfs(0,0);
    rep(i,N){
        cout << ans[i] <<endl;
    }
    return 0;
}

Measured memory_bytes: 8064
#include <bits/stdc++.h>
using namespace std;
int main()
{
long long n,i,j;
cin>>n;
long double len=0;
long double arr1[n], arr2[n];
for(i=0; i<n; i++)
cin>>arr1[i]>>arr2[i];
for(i=0; i<n; i++)
{
  for(j=0; j<n; j++)
  {
    len+=sqrt((arr1[i]-arr1[j])*(arr1[i]-arr1[j])+(arr2[i]-arr2[j])*(arr2[i]-arr2[j]));
  }
}
len=len/n;
cout<<fixed<<setprecision(10)<<len;

}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>

using namespace std;

#define reps(i,f,n) for(int i=f;i<int(n);i++)
#define rep(i,n) reps(i,0,n)

int main(){
	int s;
	cin>>s;
	
	int a = s%60; s/=60;
	int b = s%60; s/=60;
	int c = s%60; s/=60;
	
	cout<<c<<":"<<b<<":"<<a<<endl;
}

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

ll gcd(ll x,ll y){
    if(x%y==0) return y;
    else return gcd(y,x%y);
}

ll lcm(ll x,ll y){
    return x*y/gcd(x,y);
}

ll aaa(ll a,ll x,ll y){
    ll cnt=0,cnt2=0,cnt3=0;
    cnt=a/x;
    cnt2=a/y;
    cnt3=a/lcm(x,y);
    return a-(cnt+cnt2)+cnt3;
}

int main(){
    ll a,b,c,d;
    cin >> a >> b >> c >> d;
    
    cout << aaa(b,c,d)-aaa(a-1,c,d) << endl;
    
    return 0;
}








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

int main(){
  int N;
  int d[110];
  cin >> N;
  int res = 0;
  for (size_t i = 0; i < N; i++) {
    cin >> d[i];
  }
  for (size_t i = 0; i < N-1; i++) {
    for (size_t j = i+1; j < N; j++) {
    res += d[i] *d[j];
    }
  }
        cout << res << '\n';
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include <cmath>
#include <map>
#include <algorithm>
#include <string>
#define rep(i, n) for (int i = 0; i < n; ++i)
using ll = long long;
using namespace std;
#define P pair<int, int>
using namespace std;
int main(void){
    ll a ;
    cin >> a ;
    cout << a + a * a + a*a*a << endl;
    
    return 0;
}

Measured memory_bytes: 3588
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

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

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;

// --------------------------------------
int n;
map<int, int> mp;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> n;
  REP(i, n) {
    int b;
    cin >> b;
    if(mp[b] == 1) mp[b] = 0;
    else mp[b] = 1;
  }

  int ans = 0;
  for (auto const& x: mp) {
    if(x.second >= 1) ans++;
  }

  cout << ans << endl;
}


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

/**
 * vector<int>ar(3);
 * for(auto&e:ar){
 *     scanf("%d",&e);
 * }
 * sort(ar.begin(),ar.end())
 * int sum=accumulate(ar.begin(),ar.end(),0);
 ***/

int main(){
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    if (a<b && b<c) printf("Yes\n");
    else printf("No\n");
    return 0;
}

Measured memory_bytes: 3164
#include <stdio.h>

int main()
{
    int W,H,x,y,r;
    scanf("%d %d %d %d %d", &W,&H,&x,&y,&r);

    int minW,maxW,minH,maxH;
    minW = r;
    maxW = W-r;
    minH = r;
    maxH = H-r;

    if((minW <= x)&&(x <= maxW)&&(minH <= y)&&(y <= maxH)) {
        printf("Yes\n");
    }
    else {
        printf("No\n");
    }

    return(0);
}



Measured memory_bytes: 2112
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }
#define bit(k) (1LL<<(k))
typedef long long ll;

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

const int INF = 1e9;
const ll INFLL = 1e18;
const ll MOD = 1e9+7;
const double PI = acos(-1.0);

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

/*------------------------------------/
for library*/

/*------------------------------------*/

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

    ll N,A,B;
    cin>>N>>A>>B;
    ll ans[] = {INFLL,INFLL};
    ll a,b;
    if((B - A) % 2 == 0){
        ans[0] = (B - A) / 2;
    }
    else{
        {
            a = A;
            b = B;
            ans[0]  = 0;
            ans[0] += A-1;
            a -= A-1;
            b -= A-1;

            a -= 0;
            b -= 1;
            ans[0] += 1;

            ans[0] += (b - a) / 2;
        }
        {
            a = A;
            b = B;
            ans[1] = 0;
            ans[1] +=  N - B;
            a += N-B;
            b += N-B;

            a += 1;
            b += 0;
            ans[1] += 1;

            ans[1] += (b - a)/2;
        }
    }
    //cerr<<ans[0]<<" "<<ans[1]<<endl;
    cout<<min(ans[0], ans[1])<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<numeric>
#include<algorithm>
using namespace std;
int N;
int* median(int* v) {
  int *t = new int[N];
  int *result = new int[2]; 
  std::copy(v, v+N, t);
  std::sort(t, &t[N]);
  result[0] = t[(N/2)-1];
  result[1] = t[N/2];
  delete[] t;
  return result;
}
int main(){
    cin >> N;
    int x[N];
    for (int i = 0; i < N; i++){
        cin >> x[i];
    }
    int* result;
    result = median(x);
    for (int i = 0; i<N; i++){
        if(x[i]<=result[0]){
            cout << result[1]<<endl;
        }else{
            cout << result[0] << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 2940