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

int map_max;
int map[100][100];

int main(void) {
	int p_tempnum=0;
	int tempnum;
	int temp[100];
	int kohan_flag=0;
	int i,j;
	char tempbuf[10000];
	char* next;
	while(fgets(tempbuf,sizeof(tempbuf),stdin)) {
		tempnum=0;
		next=strtok(tempbuf,",");
		if(next==NULL) {
			temp[tempnum++]=atoi(tempbuf);
		} else {
			temp[tempnum++]=atoi(next);
			while(next=strtok(NULL,",")) {
				temp[tempnum++]=atoi(next);
			}
		}
		if(tempnum<p_tempnum && !kohan_flag) {
			kohan_flag=1;
			map_max=p_tempnum;
		}
		if(kohan_flag) {
			for(i=0;i<tempnum;i++) {
				map[map_max-i][i+map_max-tempnum+1]=temp[i];
			}
		} else {
			for(i=0;i<tempnum;i++) {
				map[tempnum-i][i+1]=temp[i];
			}
		}
		p_tempnum=tempnum;
	}
	for(i=1;i<=map_max;i++) {
		for(j=1;j<=map_max;j++) {
			if(map[i-1][j]>map[i][j-1])map[i][j]+=map[i-1][j];
			else map[i][j]+=map[i][j-1];
		}
	}
	printf("%d\n",map[map_max][map_max]);
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <algorithm>
using namespace std;

int main()
{
  int n;

  cin >> n;
  int num[n];
  for (int i = 0; i < n; i++) cin >> num[i];
  sort(num, num + n);


  for (int i = 1; i <= num[0]; i++){
    if (n == 2 && num[0] % i == 0 && num[1] % i == 0){
      cout << i << endl;
    }
    else if (n == 3 && num[0] % i == 0 && num[1] % i == 0 && num[2] % i == 0){
      cout << i << endl;
    }
  }
  
  return (0);
}

Measured memory_bytes: 1180
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
constexpr long double EPS = 1e-15;
const long double PI = acos(-1);
constexpr int inf = 2e9;
constexpr ll INF = 2e18;
constexpr ll MOD = 1e9+7;
constexpr ll MOD1 = 998244353;
typedef pair<ll,ll> P;
//#define all(v) (v).begin(), (v).end()
#define rep(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
//#define mp make_pair

vector<pair<int,int>> G[1010][1010];
int in[1010][1010];

pair<int,int> f(int a, int b) {
    if (a > b) swap(a,b);
    return {a,b};
}

void solve() {
    int n;
    cin >> n;
    int left = 0;
    REP(i,n) {
        pair<int,int> pre;
        pair<int,int> now;
        REP(j,n-1) {
            int to = 0;
            cin >> to;
            to--;
            if (j == 0) {
                pre = f(i,to);
            } else {
                now = f(i,to);
                G[pre.fi][pre.se].pb(now);
                in[now.fi][now.se]++;
                left++;
                pre = now;
            }
        }
    }
    vector<pair<int,int>> v;
    int cnt = 0;
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            if (in[i][j] == 0) {
                v.pb({i,j});
            }
        }
    }
    if (v.size() == 0) {
        cout << -1 << endl;
        return;
    }
    vector<pair<int,int>> v1;
    while (1) {
        cnt++;
        for (int i = 0; i < v.size(); i++) {
            pair<int,int> now = v[i];
            for (int j = 0; j < G[now.fi][now.se].size(); j++) {
                pair<int,int> nxt = G[now.fi][now.se][j];
                in[nxt.fi][nxt.se]--;
                left--;
                if (in[nxt.fi][nxt.se] == 0) {
                    v1.pb(nxt);
                }
            }
        }
        if (v1.size() == 0 && left == 0) {
            cout << cnt << endl;
            return;
        }
        if (v1.size() == 0 && left != 0) {
            cout << -1 << endl;
            return;
        }
        v = v1;
        v1.clear();
    }
}

int main(int argc, char *argv[]){
    // /* Regular */
    // int case_num = 1;
    // if (argc > 1 && stoi(argv[1])) cin >> case_num;
    // REP(case_no, case_num) {
    //   cerr << endl << "case " << case_no + 1 << endl;
    //   solve();
    // }
    /* AOJ */
    solve();
    return 0;
}

Measured memory_bytes: 43776
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>
#include <deque>
#include <iomanip>
#include <cstdio>

using namespace std;
typedef  long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define  MP make_pair
#define  PB push_back
#define inf  1000000007
#define rep(i,n) for(int i=0;i<(int)(n);++i)

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
int main(){
    int a,b;
    cin >> a >> b;
    if(a<=8&&b<=8){
        cout << "Yay!" << endl;
    }else{
        cout <<":(" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <iostream>
#include <bitset>
#include <cassert>
#include <queue>
#include <random>
#include <stack>
#include <iomanip>
#include <math.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define repf(i, a, b) for (ll i = (ll)a; i < (ll)b; i++)
#define repr(i, a, b) for (ll i = (ll)a; i > (ll)b; i--)
#define repv(x, arr) for (auto &x : arr)
#define all(v) (v).begin(), (v).end()
#define vec(name, num) vector<ll> name((num), 0);
#define mp(a, b) make_pair(a, b)
#define F first
#define S second
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int> vii;
typedef vector<vii> vvii;
const ll mod = 1e9 + 7;
const int infi = 2147483600;
const ll infl = 1e17;



int main()
{
    int n,x;
    cin >> n >> x;
    if (n==1 && x==1){
        cout << "Yes" << endl
             << 1 << endl;
        return 0;
    }
    if (x==1 || x==2*n-1){
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << endl;
    if (x==n){
        rep(i,2*n-1){
            cout << i + 1 << endl;
        }
    }
    else if (x<n){
        repf(i,x+1,n+1){
            cout << i << endl;
        }
        repf(i,1,x+1){
            cout << i << endl;
        }
        repf(i,n+1,2*n){
            cout << i << endl;
        }
    }
    else{
        repf(i,1,n){
            cout << i << endl;
        }
        repf(i,x,2*n){
            cout << i << endl;
        }
        repf(i,n,x){
            cout << i << endl;
        }
    }
}


Measured memory_bytes: 1536
/**
 *    author:  math2do
 *    created: 20.04.2020 15:36:09 IST
**/

#include <bits/stdc++.h>

using namespace std;

const int mod = (int) (1e9 + 7);

inline void add(int &a, int b) {
  a += b;
  if (a >= mod) {
    a -= mod;
  }
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  int ans = 0;
  auto get = [&](int N) {
    return (long long) N * (N + 1) / 2;
  };
  for (int r = k; r <= n + 1; r++) {
    long long from = get(r - 1);
    long long to = get(n) - (n - r >= 0 ? get(n - r) : 0);
    add(ans, (int) ((to - from + 1) % mod));
  } 
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3600
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	A
# CreatedDate:  2020-04-12 21:00:37 +0900
# LastModified: 2020-04-12 21:01:31 +0900
#


import os
import sys


def main():
    N=input()
    if '7' in N:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()


Measured memory_bytes: 9088
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
    int r,g,b;
    cin>>r>>g>>b;
    if((100*r+10*g+b)%4==0)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}

Measured memory_bytes: 256
/*  `-._:  .:'   `:::  .:\           |\__/|           /::  .:'   `:::  .:.-'
        \      :          \          |:   |          /         :       /    
         \     ::    .     `-_______/ ::   \_______-'   .      ::   . /      
          |  :   :: ::'  :   :: ::'  :   :: ::'      :: ::'  :   :: :|       
          |     ;::         ;::         ;::         ;::         ;::  |       
          |  .:'   `:::  .:'   `:::  .:'   `:::  .:'   `:::  .:'   `:|       
          /     :           :           :           :           :    \       
         /______::_____     ::    .     ::    .     ::   _____._::____\      
                       `----._:: ::'  :   :: ::'  _.----'                    
                              `--.       ;::  .--'                           
                                  `-. .:'  .-'                               
                                     \    /                        
                                      \  /                                   
                                       \/  */

//ヾ(⌐■_■)ノ♪ ◢◤
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
    int n;
    cin>>n;
    int dp[n+1][3],a[n][3];
    for(int i=0;i<=n;i++)
    {
        for(int j=0;j<3;j++)
            dp[i][j]=0;
    }
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<3;j++)
            cin>>a[i][j];
    }
    for(int i=1;i<=n;i++)
    {
        dp[i][0]=max(a[i-1][0]+dp[i-1][1],a[i-1][0]+dp[i-1][2]);
        dp[i][1]=max(a[i-1][1]+dp[i-1][0],a[i-1][1]+dp[i-1][2]);
        dp[i][2]=max(a[i-1][2]+dp[i-1][0],a[i-1][2]+dp[i-1][1]);
    }
    cout<<max(dp[n][0],max(dp[n][1],dp[n][2]));
}
                
                

Measured memory_bytes: 2560
N = int(input())
nums=[int(input()) for _ in range(N)]
MAX = 10**4
dp = [0] * (MAX+1)
dp[0] = 1
for num in nums:
  for i in range(MAX+1)[::-1]:
    if dp[i] == 1:
      dp[i+num] = 1
ans = 0
for i in range(MAX+1):
  if dp[i] == 1 and i%10 != 0:
    ans = i
print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef vector<double> Vec;
typedef vector<Vec> Mat;
typedef pair<ll,ll> P;
typedef pair<double,ll> Pd;
typedef priority_queue<P,vector<P>,greater<P>> P_queue;
typedef priority_queue<Pd,vector<Pd>,greater<Pd>> Pd_queue;

const ll MOD=998244353;
const ll mod=1000000007;
const ll INF=1e15;
const double DEL=1e-3;
vec dx={1,0,-1,0};
vec dy={0,1,0,-1};

#define REP(i,a,b) for(int i=(int)a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define ALL(a) a.begin(),a.end()
#define SORT(a) sort(ALL(a))
#define U_ERASE(V) V.erase(unique(ALL(V)), V.end());
#define ADD(a,b) a=(a+b)%mod
#define CHECK cout<<"arrived"<<endl

vec d[4];

int main(){
    ll N,W; cin>>N>>W;
    ll K;
    rep(i,N){
        ll w,v; cin>>w>>v;
        if(!i){
            d[0].pb(v);
            K=w;
        }
        else d[w-K].pb(v);
    }
    rep(i,4) {
        d[i].pb(INF);
        sort(ALL(d[i]));
        reverse(ALL(d[i]));
        d[i][0]=0;
    }
    rep(i,4){
        REP(j,1,d[i].size()) d[i][j]+=d[i][j-1];
    }
    /*rep(i,4){
        rep(j,d[i].size()) cout<<d[i][j]<<' ';
        cout<<endl;
    }*/
    ll ans=-INF;
    rep(i,d[0].size()) rep(j,d[1].size()) rep(k,d[2].size()) rep(l,d[3].size()) if(i*K+j*(K+1)+k*(K+2)+l*(K+3)<=W){
        ans=max(ans,d[0][i]+d[1][j]+d[2][k]+d[3][l]);
    }
    cout<<ans<<endl;

}

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

int main()
{
  int n,d,x,ans=0;
  cin>>n>>d>>x;
  vector<int> v(n);
  for(int &i:v)
  {
    cin>>i;
    for(int j=0;j*i+1<=d;j++)
      ans++;
  }
  cout<<ans+x<<"\n";
  
  
  
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define F first
#define S second
#define int long long
#define double long double
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> iP;
typedef pair<P,int> Pi;
typedef pair<P,P> PP;
double eps=1e-8;
int mod=1e9+7;
int inf=1LL<<55;

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

template <typename T>
int Count(const vector<T> &v, T l,T r){
  //counting [l,r]
  auto L = lower_bound(v.begin(), v.end(), l );
  auto R = upper_bound(v.begin(), v.end(), r );
  // [l,r) change upper -> lower
  return R-L;
}

signed main(){
  int n,a[100002],ans=0;
  cin>>n;
  a[0]=0;
  for(int i=1;i<=n;i++){
    cin>>a[i];
    ans+=abs(a[i-1]-a[i]);
  }
  a[n+1]=0;
  ans+=abs(a[n]);
  
  for(int i=1;i<=n;i++){
    cout<<ans-abs(a[i]-a[i-1])-abs(a[i+1]-a[i])+abs(a[i-1]-a[i+1])<<endl;
  }
  return 0;
}

Measured memory_bytes: 2048
from collections import deque
import sys
N, M = list(map(int, input().split()))
ans = [-1] * N
visited = [False] * N
dq = deque([0])
path = [[] for _ in range(N)]
for s in sys.stdin.readlines():
    a, b = list(map(lambda x: int(x)-1, s.split()))
    path[a].append(b)
    path[b].append(a)
while dq:
   i = dq.popleft()
   if visited[i]:
      continue
   visited[i] = True
   next_rs = path[i]
   for j in range(len(next_rs)):
      if not visited[next_rs[j]]:
         dq.append(next_rs[j])
         if ans[next_rs[j]] == -1:
            ans[next_rs[j]] = i
if sum(visited) == N:
   print('Yes')
   for i in range(N):
      if i == 0:
         continue
      else:
         print(ans[i]+1)
else:
   print(-1)

Measured memory_bytes: 119252
#include <bits/stdc++.h>
using namespace std;
int main(){
int N,K;
  cin>>N>>K;
  vector<int> S(N);
  for(int i=0;i<N;i++){
    cin>>S.at(i);
  }
  int sum=0;
  sort(S.begin(),S.end());
  for(int i=N-1;i>=N-K;i--){
    sum+=S.at(i);
  }
  cout<<sum<<endl;
}

Measured memory_bytes: 256
// 引用元：https://atcoder.jp/contests/aising2020/submissions/15191562

#include <bits/stdc++.h>

using namespace std;
typedef long long llong;

#define MAX 200001

int n;
string s;
llong pwm[MAX], pwp[MAX];
// memo用変数
int mem[MAX];

// カウントアップする関数
int get(int x)
{
    // memoの利用
    if (mem[x] != -1)
        return mem[x];
    // 0なら終了
    if (x == 0)
        return 0;
    // 再起で繰り返すたびにカウントアップ(memo化)
    return mem[x] = 1 + get(x % __builtin_popcount(x));
}

int main()
{
    cin >> n >> s;
    int cnt = count(s.begin(), s.end(), '1');
    int m = cnt - 1, p = cnt + 1;
    // popcount が0なら
    // 反転してpopcountが１のｎ桁で必ず割り切れるので
    // 桁数分1を出して終了
    if (m == -1)
    {
        for (int i = 0; i < n; i++)
            cout << 1 << endl;
        return 0;
    }
    // 法をpかmにしたときの2^nの合同式を解く
    pwm[0] = 1;
    pwp[0] = 1;
    for (int i = 1; i <= n; i++)
    {
        pwp[i] = (2 * pwp[i - 1]) % p;
        // m = 0ならpwmは０の除算になるので０にする
        if (m)
            pwm[i] = (2 * pwm[i - 1]) % m;
        else
            pwm[i] = 0;
    }
    // 法をpかmにしたときのsの合同式を解く(1)
    llong pv = 0, mv = 0;
    for (int i = 0; i < n; i++)
    {
        // += 2^n * bit
        pv += pwp[n - i - 1] * (s[i] == '1');
        // 余りを求める　a+b=a'+b'の性質を利用
        pv %= p;
        // m = 0ならmvは０の除算になるので０にする
        if (m)
        {
            mv += pwm[n - i - 1] * (s[i] == '1');
            mv %= m;
        }
    }
    memset(mem, -1, sizeof mem);
    for (int i = 0; i < n; i++)
    {
        // 1を反転するなら
        if (s[i] == '1')
        {
            // s[i]が１でmが０なら全桁０になるので、計算しない
            if (!m)
                cout << 0 << endl;
            else
            {

                // (1)の時点で一回操作をしてるのでその分をoffsetする
                // １が０になるのでsから２＾nを引く, マイナスにならないようｍを足す
                cout << 1 + get((mv - pwm[n - i - 1] + m) % m) << endl;
            }
        }
        // 0を反転するなら
        else
        {
            // 0が１になるのでsから２＾nを足す
            cout << 1 + get((pv + pwp[n - i - 1]) % p) << endl;
        }
    }
}

Measured memory_bytes: 7592
#include<cstdio>
const int MAXN=505;

int H,W,h,w;
int arr[MAXN][MAXN];

int main()
{
	scanf("%d%d%d%d",&H,&W,&h,&w);
	if(h==1&&w==1)
	{
		puts("No");
		return 0;
	}
	long long sum=0;
	int k=999999999/(h*w-1);
	{
		sum=0;
		for(int i=1;i<=H;i++)
			for(int j=1;j<=W;j++)
			{
				if(i%h==0&&j%w==0)
					arr[i][j]=-k*(h*w-1)-1;
				else
					arr[i][j]=k;
				sum+=arr[i][j];
			}
		if(sum>0)
		{
			puts("Yes");
			for(int i=1;i<=H;i++)
			{
				for(int j=1;j<=W;j++)
					printf("%d ",arr[i][j]);
				puts("");
			}
			return 0;
		}
	}
	puts("No");
	
	return 0;
}


Measured memory_bytes: 3840
#include<bits/stdc++.h>
using namespace std;
int main(void) {
  int n,k,ans=0;
  cin >> n >> k;
  int A[n];
  for(int i=0;i<n;++i) cin >> A[i];
  int backet[n];
  for(int i=0;i<n;++i) backet[i] = 0;
  for(int i=0;i<n;++i) {
    backet[A[i]]++;
  }
  sort(backet,backet+n,greater<int>());
  for(int i=0;i<k;++i) {
    ans += backet[i];
  }
  cout << n-ans << endl;
}

Measured memory_bytes: 1792
let n, m, q = Scanf.scanf "%d %d %d\n" (fun n m q -> n, m, q)

let a = Array.make q 0
let b = Array.make q 0
let c = Array.make q 0
let d = Array.make q 0

let rec f i =
  if i < q then (
      Scanf.scanf "%d %d %d %d\n" (fun w x y z ->
      a.(i) <- w - 1;
      b.(i) <- x - 1;
      c.(i) <- y;
      d.(i) <- z
    );
    f (i + 1)
  )

let rec g i j e ans =
  if j = n then (
      let rec h i ans =
        if i = q then ans
        else h (i + 1) (ans + if e.(b.(i)) - e.(a.(i)) = c.(i) then d.(i) else 0)
      in h 0 0
  ) else (
      let rec h i ans =
        if i = m + 1 then ans
        else (
            e.(j) <- i;
            h (i + 1) (max ans (g i (j + 1) e ans))
        )
      in h i 0
  )

let () =
  f 0;
  let ans = g 1 0 (Array.make n 0) 0 in
  Printf.printf "%d\n" ans


Measured memory_bytes: 5852
#include "bits/stdc++.h"
using namespace std;

int main() {
    int A, B, C;
    cin >> A >> B >> C;
    for(int i = 1; i <= 1 + B; i++){
        if(i * A % B == C) {
            puts("YES");
            return 0;
        }
    }
    puts("NO");
}

Measured memory_bytes: 256
import java.util.Scanner;
class Main {
  public static void main (String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int sum = 0;
    int number[] = new int[N];
    for(int k=0;k<N;k++) {
       number[k] = sc.nextInt();
    }
    for (int i=0;i<N;i++) {   
      for (int j=0;j<N;j++) {
        if (i<j) {
         int con = number[i]*number[j];
         sum += con;
        }
      }
    }
    System.out.println(sum);
  }
}

Measured memory_bytes: 21844
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <random>
#include <cstdio>
#include <cstring>
#include <cmath>

using namespace std;
using ll = long long;
using P = pair<ll, ll>;

ll N, T, A;
vector<ll> H;

void input() {
    cin >> N >> T >> A;
    H.resize(N);
    for (auto& h : H) {
        cin >> h;
    }
}

double diff(ll h) {
    return abs(double(A) - (double(T) - double(h) * 0.006));
}

ll solve() {
    ll best = 0;
    double minDiff = 9999;
    for (ll i = 0; i < N; i++) {
        auto d = diff(H[i]);
        if (i == 0 || d < minDiff) {
            minDiff = d;
            best = i;
        }
    }
    return best + 1;
}


int main() {
    input();
    
    cout << solve() << endl;
    
    return 0;
}



Measured memory_bytes: 888
n = int(input())

if n%10 == 2 or n%10 ==4 or n%10 ==5 or n%10 ==7 or n%10 ==9:
    print('hon')
elif n % 10 == 0 or n%10 ==1 or n%10 ==6 or n%10 == 8:
    print('pon')
else:
    print('bon')

Measured memory_bytes: 9168
#include<bits/stdc++.h>
using namespace std;
#define REP(i,m,n) for(int i = m; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a)  (a).rbegin(),(a).rend()
#define dup(x,y) (((x)+(y)-1) / (y)) //整数型のまま切り上げ演算する
#define PI 3.14159265359
typedef long long LL;
template<class T> inline void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> inline void chmin(T& a, T b) { if (a > b) { a = b; } }
template<class T> inline T gcd(T x, T y) { if (y == 0) { return x; } else if (x == 0) { return y; }return gcd(y, x % y); }
template<class T> inline T lcm(T x, T y) { return (x * y) / gcd(x, y); }
template<class T> inline vector<T> convert_to_binary_number(T x) { vector<T> binary_num; while (x != 1) { binary_num.push_back(x % 2); x /= 2; } binary_num.push_back(1); return binary_num; }
template<class T> inline void print_vector(vector<T> vec) { for (int i = 0; i < vec.size(); i++) { cout << vec[i] << " "; } cout << endl;}
vector<LL> make_divisors(LL n){vector<LL> divisors;for(int i = 1; i <= sqrt(n); i++) {if(n%i == 0){divisors.push_back(i);if(i != n/i){divisors.push_back(n / i);}}}return divisors;}
const LL MOD = 1e9 + 7;
const LL INF = 1LL << 60;

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

    int ans = 1;
    for (int i = 1; i < S.size(); i++)
    {
        if(S[i] != S[i-1]){
            ans++;
        }
    }
    cout << ans << endl;

    return 0;
}


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

int main(){
	int N, M, a[60][4] = {}, c = 0, b, min;
	char t;
	cin>>N>>M;
	for(int i = 1; i <= N; i++){
		for(int j = 1; j <= M; j++){
			cin>>t;
			if(t == 'W') a[i][0]++;
			if(t == 'B') a[i][1]++;
			if(t == 'R') a[i][2]++;
		}
	}
	min = N * M;
	
	c += M * 2 - a[1][0] - a[N][2];
	
	for(int k = 1; k <= N - 2; k++){
		for(int i = 2; i <= N - k; i++){
			b = 0;
			for(int j = 2; j <= N - 1; j++){
				if(i > j){
					b += M - a[j][0];
				} if( i + k > j && j >= i){
					b += M - a[j][1];
				}  if(j >= i + k){
					b += M - a[j][2];
				}
			}
			if(min >= b){
				min = b; 
			}
		}
	}
	
	c += min;
	
	cout<<c<<endl;
	
	return 0;
}


Measured memory_bytes: 3048
#include "bits/stdc++.h"
using namespace std;

int main(){
	string s;
	cin>>s;
	int a=s[0]-'0';
	int b=s[1]-'0';
	int c=s[2]-'0';
	int d=s[3]-'0';
	
	if(a+b+c+d==7){
		cout<<a<<"+"<<b<<"+"<<c<<"+"<<d<<"=7"<<endl;
		return 0;
	}
	if(a-b+c+d==7){
		cout<<a<<"-"<<b<<"+"<<c<<"+"<<d<<"=7"<<endl;
		return 0;
	}
	if(a+b-c+d==7){
		cout<<a<<"+"<<b<<"-"<<c<<"+"<<d<<"=7"<<endl;
		return 0;
	}
	if(a+b+c-d==7){
		cout<<a<<"+"<<b<<"+"<<c<<"-"<<d<<"=7"<<endl;
		return 0;
	}
	if(a-b-c+d==7){
		cout<<a<<"-"<<b<<"-"<<c<<"+"<<d<<"=7"<<endl;
		return 0;
	}
	if(a-b+c-d==7){
		cout<<a<<"-"<<b<<"+"<<c<<"-"<<d<<"=7"<<endl;
		return 0;
	}
	if(a+b-c-d==7){
		cout<<a<<"+"<<b<<"-"<<c<<"-"<<d<<"=7"<<endl;
		return 0;
	}
	if(a-b-c-d==7){
		cout<<a<<"-"<<b<<"-"<<c<<"-"<<d<<"=7"<<endl;
		return 0;
	}
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define int long long
#define ll long long
#define vec vector
#define vi vec<int>
#define vvi vec<vec<int>>
#define ALL(a) begin(a), end(a)
#define RALL(a) rbegin(a), rend(a)
#define SORT(a) stable_sort(ALL(a))
#define RSORT(a) stable_sort(RALL(a))
#define REV(a) reverse(ALL(a))
#define UNIQUE(a) a.erase(unique(ALL(a)), end(a))
#define lambda(i) [=](auto i)
#define compare(i, j) [=](auto i, auto j)
#define min_of(a) *min_element(ALL(a))
#define max_of(a) *max_element(ALL(a))
#define sum(a) accumulate(ALL(a), 0)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define SZ(a) (int)(a).size()
#define REP(i, n) for (decltype(+n) i = 0; i < (n); i++)
#define RREP(i, n) for (auto i = n - 1; i != static_cast<decltype(i)>(-1); i--)
#define FOR(i, a, b) for (auto i = (a); i < (b); i++)
#define RFOR(i, a, b) for (auto i = b - 1; i != a; i--)
#define EACH(i, a) for (auto&& i: (a))
using namespace std;

const int INF = 1e18;
const int MOD = 1e9 + 7;
int mod_add(int A, int B) { return (A + B) % MOD; }
int mod_sub(int A, int B) { return (A + MOD - B) % MOD; }
int mod_mul(int A, int B) { return ((A % MOD) * (B % MOD)) % MOD; }
int mod_bipow(int X, int Y) {
    if (Y == 0) return 1;
    else if (Y == 1) return X % MOD;
    else if (Y % 2 == 0) {
        int Z = mod_bipow(X, (int)(Y / 2));
        return mod_mul(Z, Z);
    } else {
        int Z = mod_bipow(X, (int)(Y / 2));
        return mod_mul(mod_mul(Z, Z), X);
    }
}
int mod_inv(int X) { return mod_bipow(X, MOD - 2); }
int mod_div(int A, int B) { return mod_mul(A, mod_inv(B)); }

int ceil_div(int X, int Y) {
  return (X - 1) / Y + 1;
}

struct vertex {
  vector<int> adj = vi(0);
};

struct union_find {
  vi data;
  union_find(int size) : data(size, -1) { }
  bool union_set(int x, int y) {
    x = root(x); y = root(y);
    if (x != y) {
      if (data[y] < data[x]) swap(x, y);
      data[x] += data[y]; data[y] = x;
    }
    return x != y;
  }
  bool find_set(int x, int y) {
    return root(x) == root(y);
  }
  int root(int x) {
    return data[x] < 0 ? x : data[x] = root(data[x]);
  }
  int size(int x) {
    return -data[root(x)];
  }
};

vi cum(vi V) {
  vi U(SZ(V));
  partial_sum(ALL(V), begin(U));
  return U;
}

void solve() {
  int n;
  int ans = 0;

  cin >> n;
  vector<pair<int, int>> xi(n);
  REP(i, n) {
    int x;
    cin >> x;
    xi[i] = mp(x, i);
  }
  SORT(xi);
  vi i_xi(n);
  REP(i, n)i_xi[xi[i].second] = i;

  // cout << ans << endl;
  REP(i, n) {
    if (i_xi[i] < n / 2) cout << xi[n / 2].first << endl;
    else cout << xi[n / 2 - 1].first << endl;
  }
}

signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout << fixed << setprecision(15);
  solve();
}


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

typedef long long ll;

int main() {
  string s; cin >> s;
  map<char,bool> m;
  for(char ch='a'; ch<='z'; ch++) m[ch]=false;

  if(s.length()!=26){
    for(int i=0; i<s.length(); i++){
      m[s[i]]=true;
    }
    cout << s;
    for(auto itr=m.begin(); itr!=m.end(); itr++){
      if(itr->second == false){
        cout << itr->first << endl;
        return 0;
      }
    }
  }
  else {
    string t;
    int n=0;
    for(int i=s.length()-1; i>0; i--){
      if(s[i]<s[i-1]) t.push_back(s[i]);
      else{
        t.push_back(s[i]);
        n=i;
        break;
      }
    }
    if(n==0){
      cout << "-1" << endl;
      return 0;
    }
    char mi='z';
    for(int i=0; i<t.length(); i++){
      if(s[n-1] < t[i]) mi = min(mi, t[i]);
    }

    for(int i=0; i<n-1; i++){
      cout << s[i];
    }
    cout << mi << endl;

  }
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();
		int t = sc.nextInt();
		int sum = 0;

		int a[] = new int[n];

		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}

		sc.close();

		sum += (a[0] - m);

		for (int i = 0; i < n - 1; i++) {
			int shortStudyTime = (a[i + 1] - a[i] - 2 * m);
			if (shortStudyTime > 0) {
				sum += shortStudyTime;
			}
		}

		int lastStudyTime = (t - a[n - 1] - m);

		if (lastStudyTime > 0) {
			sum += lastStudyTime;
		}

		System.out.println(sum);

	}

}


Measured memory_bytes: 26452
using System;
using System.Linq;

namespace id_0016cs
{
    class Program
    {
        static void Main(string[] args)
        {
            string line;
            double px= 0, py=0;
            double direction= 90.0;
            while( (line = Console.ReadLine()) != null)
            {
                var da = line.Split(',').Select(x => int.Parse(x)).ToArray();
                if(da[0] == da[1] && da[0] == 0)
                {
                    break;
                }
                px += Math.Cos(DegreeToRadian(direction))*((double)da[0]);
                py += Math.Sin(DegreeToRadian(direction))*((double)da[0]);
                direction -= (double)da[1];
            }
            Console.WriteLine("{0}", (int)px);
            Console.WriteLine("{0}", (int)py);
        }
        static double DegreeToRadian(double angle)
        {
            return (double)(angle * Math.PI / 180);
        }
    }
}



Measured memory_bytes: 9600
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define endl "\n"
#define se second
#define ls( s) (s&(-s))
#define ll long long
const int N = 3000300;
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
const int mod =    1e9+7;
int n,cnt0,cnt1,cnt2;
int arr[100005];
int main()
{ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

cin>>n;
int z=n/100;
int y=n%100;
//cout<<z<<" "<<y<<endl;
if(z*5>=y)
cout<<1;
else
cout<<0;



}

Measured memory_bytes: 256
#pragma region Macros
// ===========
// include
// ===========
#include <bits/stdc++.h>

using namespace std;

// ===========
// typedef
// ===========
typedef int64_t int64;
typedef vector<int64> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;

// ===========
// conversion
// ===========
inline int toInt(string s)
{
    int v;
    istringstream sin(s);
    sin >> v;
    return v;
}
template <class T>
inline string toString(T x)
{
    ostringstream sout;
    sout << x;
    return sout.str();
}

// ===========
// math
// ===========
template <class T>
inline T sqr(T x) { return x * x; }
inline int64 Factorial(int64 n) { return n == 0 ? 0 : (n == 1 ? 1 : Factorial(n - 1) * n); }



// ===========
// repetition
// ===========
#define rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = int(a), __length = int(b); i < __length; ++i)

void input(vector<int64> *vec, const int size)
{
    vec->resize(size);
    rep(i, size) { cin >> vec->at(i); }
}
void input(vector<string> *vec, const int size)
{
    vec->resize(size);
    rep(i, size) { cin >> vec->at(i); }
}

#pragma endregion //Macros

int H, W, K;

int count(VS &grid, int X, int Y)
{
    int count = 0;
    rep(y, H)
    {
        rep(x, W)
        {
            if( (X >> x & 1) && (Y >> y & 1) )
            {
                if( grid.at(y).at(x) == '#' )
                {
                    ++count;
                }
            }
        }
    }
    return count;
}

int main()
{
    cin >> H >> W >> K;

    VS grid;
    grid.resize(H);

    rep(i, H)
    {
        cin >> grid.at(i);
    }

    int ansCount = 0;

    int powH = pow(2, H);
    int powW = pow(2, W);

    rep(y, powH)
    {
        rep(x, powW)
        {
            if( count( grid, x, y ) == K )
            {
                ++ansCount;
            }
        }
    }
    cout << ansCount << endl;

    return 0;
}


Measured memory_bytes: 4100
#include<iostream>
using namespace std;
int main()
{
	int n,sum,i,j,k;
	while(cin>>n)
	{
		sum = 0;
		for(i = 0;i < 10;i++)
		{
			for(j = 0;j < 10;j++)
			{
				if((n-i-j < 19)&&(n-i-j > -1))
				{
					for(k = 0;k < 10;k++)
					{
						if((n-i-j-k >-1)&&(n-i-j-k)<10)
						{
							sum++;
						}
					}
				} 
			}
		}
		cout<<sum<<endl;
	}
	return 0;
}

Measured memory_bytes: 1160
from math import * 
import sys
input = sys.stdin.readline

def main():
    N, D, A = list(map(int, input().split()))
    XH = sorted([list(map(int, input().split())) for i in range(N)])

    t = 0
    q = []
    ans = 0
    for X, H in XH:
        while q and q[0][0] < X-D:
            x, c = q.pop(0)
            t -= c
        H -= A * t
        
        if H <= 0: continue 

        c = ceil(H/A)
        ans += c
        q.append((X+D, c))
        t += c   
    print(ans)
if __name__ == '__main__':
    main()


Measured memory_bytes: 65624
import java.util.*;

class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		
		String s = sc.nextLine();
		StringBuilder sb = new StringBuilder();
		for (int i=0; i<s.length(); i++) {
			char c = s.charAt(i);
			if (('a'<=c&&c<='z') || ('A'<=c&&c<='Z')) {
				sb.append(Character.isUpperCase(c)?(char)(c+32):(char)(c-32));
			}
			else sb.append(c);
		}
		System.out.println(sb);
	}
}


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

struct UnionFind
{
    vector<int> par;
    UnionFind(int n=0) : par(n, -1) {}
    int find(int x)
    {
        if(par.at(x) < 0) return x;
        return par.at(x) = find(par.at(x)); 
    }
    bool unite(int x, int y)
    {
        int rx = find(x);
        int ry = find(y);
        if(rx == ry) return false;
        if(par.at(rx) > par.at(ry)) swap(rx, ry);
        par.at(rx) += par.at(ry);
        par.at(ry) = rx;
        return true;
    }
    bool same(int x, int y) { return find(x) == find(y);}
    int size(int x) { return -par.at(find(x));}
};

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N, M, K;
    cin >> N >> M >> K;
    UnionFind uf(N);
    map<int, vector<int>> fr;
    for(int i=0; i<M; i++)
    {
        int x, y;
        cin >> x >> y;
        x--; y--;
        uf.unite(x, y);
        fr[x].push_back(y);
        fr[y].push_back(x);
    }
    map<int, vector<int>> mp;
    for(int i=0; i<K; i++)
    {
        int x, y;
        cin >> x >> y;
        x--; y--;
        mp[x].push_back(y);
        mp[y].push_back(x);
    }

    for(int i=0; i<N; i++)
    {
        int ans = uf.size(i) - fr[i].size() - 1;
        for(auto j : mp[i])
        {
            if(uf.same(i, j)) ans--;
        }
        if(i!=N-1) cout << ans << ' ';
        else cout << ans << '\n';
    }
    


    return 0;
}

Measured memory_bytes: 23160
#include<iostream>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<fstream>
#include<algorithm>
using namespace std;
using ll = long long;


int main(){
    ll n;
    cin >> n;
    ll sum = 0;
    ll temp=1e5;
    for(ll i=0;i<n-1;i++){
        ll x;
        cin >> x;
        sum+=min(x,temp);
        temp = x;
    }
    cout << sum+temp << endl;
    return 0;
}

Measured memory_bytes: 256
import 'dart:io';

void main() {
  int n = int.parse(stdin.readLineSync());
  List ai = stdin.readLineSync().split(" ").map((x) => int.parse(x)).toList();
  List sortA = ai..sort((b, a) => a.compareTo(b)); // 大きい順
  int diff = sortA[0] - sortA[n - 1];
  print(diff);
}


Measured memory_bytes: 13156
import java.util.LinkedList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		
		String S = sc.next();
		
		if (Integer.parseInt(S.substring(5, 7))>4) {
			System.out.println("TBD");
		} else if (Integer.parseInt(S.substring(5, 7))<4) {
			System.out.println("Heisei");
		} else {
			if (Integer.parseInt(S.substring(8))<=30) {
				System.out.println("Heisei");
			} else {
				System.out.println("TBD");
			}
		}
		 
	}

}


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

int main() {
  int N;
  cin >> N;
  
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  
  vector<int> B(N);
  for (int i = 0; i < N; i++) {
    B[A[i]-1] = i+1;    
  }
  
  for (int i = 0; i < N; i++) {
    cout << B[i] << " ";
  }
  cout << endl;
  
}

Measured memory_bytes: 1664
#!/usr/bin/python3
# vim: set fileencoding=utf-8:
import sys
input = sys.stdin.readline

A, B, C = [int(ele) for ele in input().split()]


def main():
    ans = "No"
    if A <= C <= B:
        ans = "Yes"

    print(ans)


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
        if i != n // i:
            divisors.append(n//i)
    return divisors


class Node():

    def __init__(self):
        self.idx = None
        self.left = None
        self.right = None
        self.parent = None
        return

    def pre_order(self):
        global pre_order_str
        pre_order_str += str(self.idx) + " "
        if self.left:
            self.left.pre_order()

        if self.right:
            self.right.pre_order()

    def in_order(self):
        global in_order_str

        if self.left:
            self.left.in_order()

        in_order_str += str(self.idx) + " "

        if self.right:
            self.right.in_order()

    def post_order(self):
        global post_order_str
        if self.left:
            self.left.post_order()

        if self.right:
            self.right.post_order()

        post_order_str += str(self.idx) + " "


class HeapHelper():
    """HeapContrler.
    完全二分木を二分ヒープで表現した配列 A に対して、
    HeapHelper.parent(idx) とするとそのノードの親の添字を返す
    存在しない場合は Falseを返す

    Returns:
        [type] -- [description]
    """

    def __init__(self):
        return

    @staticmethod
    def parent(i):
        if i == 1:
            return False

        return int(i/2)

    @staticmethod
    def left(i):
        l_idx = 2*i
        if H < l_idx:
            return False

        return l_idx

    @staticmethod
    def right(i):
        r_idx = 2*i + 1
        if H < r_idx:
            return False

        return r_idx


if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <numeric>
#include <set>
#include <unordered_set>
#include <queue>
#include <cmath>
#include <bitset>

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

using Graph = vector<vector<int>>;

// 深さ優先探索
vector<bool> seen;
void dfs(const Graph &G, int v) {
    seen[v] = true; // v を訪問済にする

    // v から行ける各頂点 next_v について
    for (auto next_v : G[v]) { 
        if (seen[next_v]) continue; // next_v が探索済だったらスルー
        dfs(G, next_v); // 再帰的に探索
    }
}

bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}

// a と b の最大公約数を返す関数
ll GCD(ll a, ll b) {
    if (b == 0) return a;
    else return GCD(b, a % b);
}

int main() {
  ll N;
  string S;
  cin >> S;
  N = S.length();
    
  if(S[N-1]=='s'){
    cout << S+"es" << endl;
  }else{
    cout << S+'s' << endl;
  }

}

Measured memory_bytes: 3624
#include <stdio.h>
int main(void)
{
          int fmat[9] ;
          int i , j;
          for( i = 0 ; i < 9 ; i ++ ) scanf("%d", &fmat[i]) ;
          int n ;
          scanf("%d" , &n) ;
          int numbers[n] ;
          for( i = 0 ; i < n ; i++) scanf("%d" , &numbers[i]) ;
          int flag[9] = {0,0,0,0,0,0,0,0,0} ;

          for(i = 0 ; i < 9; i++)
          {
                    if(flag[i] == 0)
                    {
                    for( j = 0 ; j < n ; j++)
                    {
                              if(fmat[i] == numbers[j]) flag[i] = 1 ;
                    }
                    }

          }
          if (flag[0] == 1 && flag[1] == 1 && flag[2] == 1 ||
                flag[3] == 1 && flag[4] == 1 && flag[5] == 1 ||
                flag[6] == 1 && flag[7] == 1 && flag[8] == 1 ||
               flag[0] == 1 && flag[3] == 1 && flag[6] == 1 ||
               flag[1  ] == 1 && flag[4] == 1 && flag[7] == 1 ||
               flag[2] == 1 && flag[5] == 1 && flag[8] == 1 ||
               flag[0] == 1 && flag[4] == 1 && flag[8] == 1 ||
               flag[2] == 1 && flag[4] == 1 && flag[6] == 1 )
          {
                    printf("Yes") ;
          }
          else printf("No") ;


}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <numeric>
#include <cmath>
#include <limits>
#include <bitset> 
#include <iterator> 
#include <map>
#include <queue>
#include <set>
#define rep(i,n) for(ll i=0;i<(n); ++i)
#define per(i,n) for(ll i=n-1;i>=0; --i)
#define all(x) (x).begin(),(x).end()
using namespace std;
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 long long INF = 1LL << 60;
typedef long long ll;
ll MOD = 1000000007;
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	ll n;
	cin >> n;
	vector <ll>a(n);
	rep(i, n)cin >> a[i];
	cout << accumulate(all(a), 0LL) - a.size() << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
string fun(string s, string t, ll m, ll n)
{
    ll dp[m+1][n+1];
    ll i,j;
    for(i=0;i<=m;i++)
    {
        for(j=0;j<=n;j++)
        {
            if(i==0 || j==0)
                dp[i][j]=0;
        }
    }
    for(i=1;i<=m;i++)
    {
        for(j=1;j<=n;j++)
        {
            if(s[i-1]==t[j-1])
                dp[i][j]=1+dp[i-1][j-1];
            else
                dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
        }
    }
    i=m;
    j=n;
    string st="";
    while(i>0 && j>0)
    {
        if(s[i-1]==t[j-1])
        {
            st+=s[i-1];
            i--;
            j--;
        }
        else if(dp[i][j-1]>dp[i-1][j])
            j--;
        else
            i--;
    }
    reverse(st.begin(),st.end());
    return st;
}
 
int main() {
   
   string s,t;
   cin>>s>>t;
   ll m=s.length();
   ll n=t.length();
   cout<<fun(s,t,m,n);
    
}

Measured memory_bytes: 73956
#include<stdio.h>
#include<stdlib.h>
typedef struct {
  int area;
  int key;
} Area;
  
int main(){
  int stack[20000];
  Area stack2[10000];
  int flag3=0,flag2=0,j,top=0,top2=0,sum=0,i=0,area,k=0,flag=0;
  char c;
  while(scanf("%c",&c)!=EOF){
    flag2=0;
    if(c=='\\'){
      flag3=1;
      stack[top]=i;
      top++;
    }
    else if(c=='_'){
  }
    else if(c=='/'){
      if(flag3==0){i++; continue;}
      if(top-1<0) {i++; continue;}
      area=i-stack[top-1];
      stack2[top2].key=stack[top-1];
      top--;
      if(flag==0){flag=1; i++; stack2[top2].area=area; top2++; continue;}
      if(top2-1<0){ i++; continue;}
      
      else{
	      for(k=0;k<=top2-1;k++){
		if(stack2[top2].key<=stack2[k].key){
		  if(flag2==0){j=k; flag2=1; stack2[j].key=stack2[top2].key;}
		  else stack2[j].area+=stack2[k].area;
		  
		}
	      }
	      if(flag2==0)
		{
	          stack2[top2].area=area;
	  
	          top2++;
		}
	      else
		{
		 stack2[j].area+=area;
     
		 top2=j+1;
		}
      }       
	      
  
	 
    
	            
    }   
  
    i++;
  }
  for(i=0;i<top2;i++) sum+=stack2[i].area;
  printf("%d\n%d",sum,top2);
  if(top2==0) printf("\n");
    if(top2!=0){
      printf(" ");
      for(i=0;i<top2;i++){
      if(i==top2-1)printf("%d\n",stack2[i].area);
      else printf("%d ",stack2[i].area);
  }
    }
  return 0;
} 



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

int main(){
	int x=0;
	int xmax=0;
	int N;
	string S;
	cin >> N;
	cin >> S;
	for(const auto& c : S){
		switch(c){
		case 'I':
			x++;
			break;
		case 'D':
			x--;
			break;
		}
		if(xmax<x){
			xmax=x;
		}
	}
	cout << xmax << endl;
	return 0;
}


Measured memory_bytes: 256
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

# 前からと後ろからでgreedyにcandに入れて両方の一致したところ
N, K, C = lr()
S = sr()

def choose(S):
    cand = []
    count = 0
    cur = 0
    while cur < len(S):
        if S[cur] == 'o':
            count += 1
            cand.append(cur)
            cur += C+1            
        else:
            cur += 1
        if count >= K:
            break
    return cand

cand1 = choose(S)
cand2 = choose(S[::-1])[::-1]
cand2 = [N-1-x for x in cand2]

for x, y in zip(cand1, cand2):
    if x == y:
        print(x+1)


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

int main() {
    int n,k;
    cin>>n>>k;
    int no[10]{};
    for (int i=0;i<k;i++) {
        int a;cin>>a;
        no[a]=1;
    }
    for (int i=n;;i++) {
        int t=i;
        int f=1;
        while (t) {
            if (no[t%10])
                f=0;
            t/=10;
        }
        if (f) {
            cout<<i<<endl;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 256
# coding: utf-8
import sys
# from operator import itemgetter
sysread = sys.stdin.readline
read = sys.stdin.read
sys.setrecursionlimit(10 ** 7)
#from heapq import heappop, heappush
#from collections import OrderedDict, defaultdict
#import math
#from itertools import product, accumulate, combinations, product
#import bisect# lower_bound etc
#import numpy as np
#from copy import deepcopy
#from collections import deque
#import numba

def run():
    S = input()
    T = input()

    ans = 0
    for s,t in zip(S, T):
        if s != t:
            ans += 1
    print(ans)

if __name__ == "__main__":
    run()

Measured memory_bytes: 9408
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(int i = 0; i < x; i++)
#define pb push_back
#define mp make_pair
#define eb emplace_back
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
const ll MOD = 1e9+7;
const int n_max = 1e5+10;

void print() {
    cout << endl;
}

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail) != 0) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
void print(vector<T> &vec) {
    for (auto& a : vec) {
        cout << a;
        if (&a != &vec.back()) cout << ' ';
    }
    cout << endl;
}

template <class T>
void print(vector<vector<T>> &df) {
    for (auto& vec : df) {
        print(vec);
    }
}

template<typename T>
void print(T &arr){
    ll sz = sizeof(arr)/sizeof(arr[0]);
    for(int i = 0;i < sz-1;i++){cout << arr[i] << ' ';}
    cout << arr[sz-1] << endl;
}

ll n = 1e5+10,m = 2e5+10;
ll INF = INT_MAX;
vector<ll> place(n,INF);
// bool ok = true;
vector<vector<Pll>> graph(n);
// template<class T>
bool dfs(int now){
    bool ok = true;
    // is_move[now] = 1;
    for(auto i : graph[now]){
        int to = i.first;
        ll dis = i.second;
        // if(to == pre)continue;
        if(place[to] == INF){
            place[to] = place[now] + dis;
            ok &= dfs(to);
        }
        else{
            if(place[to] != place[now] + dis){
                ok = false;
                break;
            }
        }
    }
    return ok;
}

int main(){
    cin >> n >> m;
    // vector<ll> l(m), r(m), d(m);
    // vector<vector<Pll>> graph(n);
    set<ll> st;
    rep(i,m){
        ll l,r,d;cin >> l >> r >> d;
        l--;r--;
        st.insert(l);
        st.insert(r);
        graph[l].emplace_back(Pll(r,d));
        graph[r].emplace_back(Pll(l,-d));
    }
    bool res = true;

    // clock_t start = clock();

    rep(i,n){
        // if(graph[i].size() == 0)continue;
        // print(i,is_move[i],place[i]);
        if(place[i] == INF){
            place[i] = 0;
            res &= dfs(i);
        }
        if(!res)break;
    }

    // clock_t end = clock();

    // const double time = static_cast<double>(end - start) / CLOCKS_PER_SEC * 1000.0;
    // printf("time %lf[ms]\n", time);
    cout << (res ? "Yes" : "No") << endl;
}

Measured memory_bytes: 21376
function main(input) {
  const N = parseInt(input, 10);
  const C = Math.floor(100 / 4);
  const D = Math.floor(100 / 7);
  let result = 'No';
  
  for(let i = 0; i <= C; i++) {
  	for(let j = 0; j <= D; j++) {
      if (N === (i * 4) + (j * 7)) {
        result = 'Yes';
      }
    }
  }
  
  console.log(result);
}

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

Measured memory_bytes: 29668