akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <cstdlib> 
using namespace std;
int main(int argc, char const *argv[])
{
	long n;
	cin>>n;
	vector<long> v(n+1,INT_MAX);
	vector<long> dp(n+1,0);
	for(int i=1;i<n+1;i++){

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

		if(i==1){
			dp[i]=0;
		}
		else{
			dp[i]=min(abs(v[i]-v[i-1])+dp[i-1],abs(v[i]-v[i-2])+dp[i-2]);
		}
	}
	cout<<dp[n]<<"\n";
	return 0;
}

Measured memory_bytes: 1792
n,k=map(int,input().split())
l=[0,1]
a=[1]
kl=[]
mod=998244353
for i in range(k):
    kl.append(list(map(int,input().split())))
for i in range(1,n):
    ans=0
    for li,re in kl:
        ans-=l[max(i-re,0)]
        ans+=l[max(i-li+1,0)]
        ans%=mod
    a.append(ans)
    l.append((l[-1]+ans)%mod)

#print(*a)
#print(*l)
print(a[-1])

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

using namespace std;

int main() {
#ifdef  DEBUG
  ifstream in("input.txt");
  cin.rdbuf(in.rdbuf());
#endif  // for local.
  int a, b, c;
  cin >> a >> b >> c;
  if (a + b + c > 21) {
    cout << "bust";
  } else {
    cout << "win";
  } cout << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <cassert>
#include <memory>
#include <stack>
#include <set>
#include <map>

#define INF 1000000000
#define MOD 1000000007
typedef long long ll;
typedef unsigned long long ull;
using namespace std;

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

  ll N, M; cin>>N>>M;
  vector<ll> xs(M);
  for(ll i = 0; i<M; i++) {
    cin >> xs[i];
  }
  sort(xs.begin(), xs.end());

  vector<ll> diffs;
  for(int i=1; i<M; i++) {
    diffs.push_back(xs[i] - xs[i-1]);
  }
  sort(diffs.begin(), diffs.end());

  ll ans = 0;
  for(int i=0; i < M - N; i++) {
    ans += diffs[i];
  }
  cout << ans << endl;
}


Measured memory_bytes: 2168
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt" > "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\b.answer"
int main() {
	vector<int>hs{ 60,80,100,120,140,160 };
	vector<int>ws{ 2,5,10,15,20,25 };
	vector<int>ms{ 600,800,1000,1200,1400,1600 };
	while (1) {
		int N; cin >> N;
		if (!N)break;
		int ans = 0;
		for (int i = 0; i < N; ++i) {
			int x, y, h, w; cin >> x >> y >> h >> w;
			int l = x + y + h;
			auto it = lower_bound(hs.begin(), hs.end(), l);
			auto jt = lower_bound(ws.begin(), ws.end(),w);
			int num = max(it - hs.begin(), jt - ws.begin());
			if (num == 6)continue;
			else ans += *(ms.begin() + num);
		}
		cout << ans << endl;
	}
	
	return 0;
}

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

#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
#define LOWER(a,x) lower_bound(ALL(a), x) - a.begin() - 1;
#define COUNT(a,x)  upper_bound(ALL(a), x) - lower_bound(ALL(a), x);
#define MCOUNT(a,x,y) upper_bound(ALL(a), y) - lower_bound(ALL(a), x);
#define INF 111111111111111111
#define MOD 1000000007
#define pb push_back
#define F first
#define S second
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
ll n = 0, m = 0, ans = 0, sum = 0, cnt = 0, tmp = 0, ma = 0, mi = 0;
string s;
bool flag, ok;
ll dx[4] = { 1,-1,0,0 }, dy[4] = { 0,0,1,-1 };
ll ddx[8] = { 1,-1,0,0,1,1,-1,-1 }, ddy[8] = { 0,0,1,-1,1,-1,1,-1 };
#pragma endregion
#define MAX 111111


ll dp[2][111][333];
int main(void) {
  vll v, w;
  cin >> n >> m;
  FOR(i, 0, n) {
	cin >> tmp;
	w.pb(tmp);
	cin >> tmp;
	v.pb(tmp);
  }

  FOR(i, 0, n) {
	FOR(j, 1, i + 2) {
	  FOR(k, 0, 3 * n + 1) dp[i % 2][j][k] = dp[(i + 1) % 2][j][k];
	}
	FOR(j, 1, i + 2) {
	  FOR(k, w[i] - w[0], 3 * n + 1) {
		dp[i % 2][j][k] = max(dp[i % 2][j][k], dp[(i + 1) % 2][j - 1][k - (w[i] - w[0])] + v[i]);
	  }
	}
	cnt++;
  }

  FOR(i, 1, n + 1) {
	FOR(j, 0, 3 * n + 1) {
	  if (w[0] * i + j <= m)ans = max(ans, dp[(cnt % 2) + 1][i][j]);
	}
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 768
#define _GLIBCXX_DEBUG //エラーを出すためのおまじない
#include <bits/stdc++.h>
using namespace std;
#define coYES cout << "YES" << endl
#define coNO cout << "NO" << endl
#define coYes cout << "Yes" << endl
#define coNo cout << "No" << endl
#define coyes cout << "yes" << endl
#define cono cout << "no" << endl
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  string s, t;
  cin >> s >> t;
  sort(s.begin(), s.end());
  sort(t.begin(), t.end());
  reverse(t.begin(), t.end());
  if (s < t) {
    coYes;
  }
  else {
    coNo;
  }
}


Measured memory_bytes: 3608
s = int(input())
a = [s]
def f(n):
    if n % 2 == 0:
        return n // 2
    elif n % 2 == 1:
        return 3*n + 1

count = 1

while True:
    count += 1
    n = f(a[-1])
    if n in a:
        break
    else:
        a.append(n)

print(count)

Measured memory_bytes: 3060
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <functional>
#include <map>
#include <set>
#define Rep(i, n) for(int i=0;i<n;++i)
#define rep(i, n) for(int i=1;i<=n;++i)
#define ll long long int
#define INF 100000000
#define INFLL 100000000000
#define MOD 1000000007
#define PI 3.14159265359
#define All(a) (a).begin(), (a).end()

using namespace std;
using P = pair<ll, ll>;
 
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};

struct Edge {
  int to;     
  ll weight; 
  Edge(int t, ll w) : to(t), weight(w) { }
};

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

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


int N;
int h[110];

int main () {
  cin >> N;

  Rep(i, N) cin >> h[i];

  int ans = 0;

  while (true) {
    bool flg = true;
    bool down_flg = false;

    Rep(i, N) {
      if (h[i] > 0) {
        flg = false;
        down_flg = true;
      }

      if (down_flg && (h[i] == 0)) {
        break;
      }

      if (down_flg) {
        h[i]--;
      }
    }

    if (flg) {
      break;
    }

    ++ans;
  }

  cout << ans << "\n";
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<functional>
#include<cmath>
using namespace std;
int main(void)
{
    int i,n,s[1000],sum;
    double m,a2,a1,s2;
    while(1)    {
        scanf("%d",&n);
        if(n==0)    break;
        for(i=0;i<n;i++) scanf("%d",&s[i]);
        sum=0;
        for(i=0;i<n;i++) sum+=s[i];
        m=(double)sum/n;
        s2=0.0;
        for(i=0;i<n;i++) s2+=((double)s[i]-m)*((double)s[i]-m);
        a2=s2/n;
        a1=sqrt(a2);
        printf("%.8lf\n",a1);
    }
    return 0;
}


Measured memory_bytes: 2720
#include<stdio.h>

int main(){
  int n, a[1024], v;
  int i, j;

  scanf("%d", &n);

  for(i=0; i<n; i++){
    scanf("%d", &a[i]);
  }

  for(i=1; i<n; i++){
    for(j=0; j<n; j++){
      if(j==n-1){
        printf("%d", a[j]);
      }else{
        printf("%d ", a[j]);
      }
    }
    printf("\n");
    
    v=a[i];
    j=i-1;
    while(j>=0 && a[j]>v){
      a[j+1]=a[j];
      j--;
    }
    a[j+1]=v;
    
  }
  for(j=0; j<n; j++){
    if(j==n-1){
        printf("%d", a[j]);
    }else{
      printf("%d ", a[j]);
    }
  }
  printf("\n");
  
  return 0;
}

Measured memory_bytes: 608
//ABC 120 D;
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
const int maxn=100010;
struct EDGE{
	int u,v;
}e[maxn];

ll sz[maxn],p[maxn],ans[maxn];

inline int read(){
	int x=0,f=1;
	char ch=getchar();
	while(!isdigit(ch)){
		if(ch=='-') f=-1;
		ch=getchar();
	}
	while(isdigit(ch)){
		x=x*10+ch-'0';
		ch=getchar();
	}
	return x*f;
}

int get_set(int x){
	if(x!=p[x]) p[x]=get_set(p[x]);
	return p[x];
}

int main(){
	//freopen("","r",stdin);
	//freopen("","w",stdout);
	int n,m;
	cin>>n>>m;
	for(int i=1;i<=m;i++){
		e[i].u=read();
		e[i].v=read();
	}
	ans[m]=(ll)(n-1)*n/2;
	for(int i=1;i<=n;i++)
		p[i]=i,sz[i]=1;
	for(int i=m;i>=1;i--){
		int u=get_set(e[i].u),v=get_set(e[i].v);
		if(u==v) ans[i-1]=ans[i];
		else{
			ans[i-1]=ans[i]-sz[u]*sz[v];
			p[u]=v;
			sz[v]+=sz[u];
		}
	}
	for(int i=1;i<=m;i++)
		cout<<ans[i]<<endl;
	return 0;
}

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

int main() {
  int64_t n;
  cin >> n;
  
  int64_t s = sqrt(n);
  //cout << h << endl;
  
  int64_t x, y;
  for (int64_t i = s; i > 0; i--) {
    //cout << i << endl;
    if (!(n % i)) {
      x = i;
      y = n / i;
      break;
    }
  }
  //cout << x << y << endl;
  
  int64_t ans = (x - 1) + (y - 1);
  cout << ans << endl;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"bufio"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)
func scanInt() int {
	sc.Scan()
	a,_ := strconv.Atoi(sc.Text())
	return a
}

func scanText() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	sc.Split(bufio.ScanWords)
	
	n := scanInt()
	ans := 0

	for i := 1; i < n; i++ {
		ans+=i
	}

	fmt.Println(ans)
}


Measured memory_bytes: 640
#include<iostream>

using namespace std;

int h, w, cnt;
char fields[101][101];

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

void dfs(int y, int x, char now){
  fields[y][x]=' ';
  for(int i=0;i<4;i++){
    int ny=y+dy[i], nx=x+dx[i];
    if(0<=y&&y<=h-1&&0<=x&&x<=w-1&&fields[ny][nx]==now)dfs(ny, nx, now);
  }
}

int main(){
  while(1){
    cin >> h >> w;
    if(h==0 && w==0)break;
    cnt=0;
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
        cin >> fields[i][j];
      }
    }
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
        if(fields[i][j]!=' '){
          cnt++;
          dfs(i, j, fields[i][j]);
        }
      }
    }
    cout << cnt << endl;
  }
}


Measured memory_bytes: 3748
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#define rep(i, n) for(int i = 0; (i) < (n); (i)++)

using namespace std;

int main() {
    int a,b,c;
    cin >> a >> b >> c;
    int t=0,cnt=0,ans=0;
    while(t < c) {
        t += a;
        cnt++;
        if(cnt == 7) {
            cnt = 0;
            t += b;
        }
        ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3076
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef pair<string , int> s_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#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 rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define puf push_front
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
//#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
const int64 INF = 1LL << 58;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
template<typename T> void remove(T & vector, unsigned int index){vector.erase(vector.begin() + index);}

ll beki(ll a, ll n){
    if(n == 0){
        return 1;
    }
    ll ans = beki(a, n / 2);
    ans = ans * ans;
    if(n % 2 == 1){
        ans = ans * a;
    }
    return ans;
}

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

    ll N; cin >> N;
    if(N == 0) cout << 0 << endl;

    ll val = 1;
    vei ans;
    while(N != 0) {
        if((abs(N) % ((2 * abs(val))) != 0)) {
            ans.pub(1);
            N -= val;
        }
        else ans.pub(0);
        val *= -2;
    }
    for(int i = ans.size() - 1; i >= 0; i--) cout << ans[i];
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
    int n;
    cin >> n ;
    
    int a[n+1];
    
    for(int i = 1; i <= n; i++){
        cin >> a[i]  ;
    
}
    for(int i = 1; i <=n-1; i++){
        cout << a[n-i+1] <<" " ;
        
    }
        cout << a[1] << endl;
}


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

int main(){
  int n;
  cin >> n;
  vector<pair<pair<string,int>,int>> a(n);
  for(int i=0;i<n;i++){
    int x;
    cin >> a.at(i).first.first >> x;
    a.at(i).first.second=100-x;
    a.at(i).second=i+1;
  }
  
  sort(a.begin(),a.end());
  
  for(int i=0;i<n;i++)
    cout << a.at(i).second << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <complex>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

const double EPS = 1e-10;
const double INF = 1e12;
#define EQ(n,m) (abs((n)-(m)) < EPS)
typedef complex<double> P;
typedef vector<P> VP;
struct C{
    P p;
    double r;
    C(const P& p, const double& r) : p(p), r(r) {}
    C(){}
};

VP crosspointCC(C a, C b){
    VP ret;
    double dist = abs(b.p-a.p);
    P dir = a.r*(b.p-a.p)/abs(b.p-a.p);
    if(EQ(dist, a.r+b.r) || EQ(dist, abs(a.r-b.r))){
        ret.push_back(a.p +dir);
    }else if(abs(a.r-b.r) < dist && dist < a.r+b.r){
        double cos = (a.r*a.r +dist*dist -b.r*b.r)/(2*a.r*dist);
        double sin = sqrt(1 -cos*cos);
        ret.push_back(a.p +dir*P(cos, sin));
        ret.push_back(a.p +dir*P(cos, -sin));
    }
    return ret;
}

int main(){
    while(1){
        int n;
        cin >> n;
        if(n==0) break;

        vector<C> c(n);
        for(int i=0; i<n; i++){
            double x,y;
            scanf("%lf,%lf", &x, &y);
            c[i] = C(P(x, y), 1);
        }

        VP cand;
        for(int i=0; i<n; i++){
            cand.push_back(c[i].p);
            for(int j=i+1; j<n; j++){
                VP cp = crosspointCC(c[i], c[j]);
                cand.insert(cand.end(), cp.begin(), cp.end());
            }
        }

        int ans = 0;
        for(int i=0; i<(int)cand.size(); i++){
            int sub = 0;
            for(int j=0; j<n; j++){
                if(abs(c[j].p -cand[i]) < 1+EPS) sub++;
            }
            ans = max(ans, sub);
        }
        cout << ans << endl;
    }
    return 0;
}



Measured memory_bytes: 3296
#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define ll long long int
#define pb push_back
using namespace std;
const int N= 1e6 + 10;

int main(){ 
  fast;
  char a, b, c, d;
  string s = "+-";
  int t = 0, n, m;
  cin >> a >> b >> c >> d;
  for(int  i = 0; i < 2; i++){
      t = 0;
        if(i == 0)
          t = a - '0' + b - '0';
        if(i == 1)
          t = a - b;
    for(int j = 0; j < 2; j++){
      n = t;
      //cout << n << " ";
      if(j == 0)
          n += (c - '0');
        if(j == 1)
          n -= (c - '0');
      for(int k = 0; k < 2; k++){
        m = n;
       //cout << m << " ";
        if(k == 0)
          m += d - '0';
        if(k == 1)
          m -= (d - '0');
        if(m == 7){
          return cout << a << s[i] << b << s[j] << c << s[k] << d << "=7", 0;
        }
      }
    }
  }



  
  return 0;
}
    


Measured memory_bytes: 256
#!/usr/bin python3
# -*- coding: utf-8 -*-

import numpy as np

def main():
    N, K = map(int, input().split())
    h = list(map(int, input().split()))
    INF = 10**10
    #dp[i]　iの位置に到達する最小の値
    dp = [INF]*N
    dp[0] = 0
    dp = np.array(dp)
    h = np.array(h)
    for i in range(N):
        T = min(N,i+K+1)
        dp[i+1:T] = np.minimum(dp[i+1:T], dp[i] + abs(h[i+1:T]-h[i]))
#    print(dp[N-1])
    print(dp[N-1])

if __name__ == '__main__':
    main()

Measured memory_bytes: 22832
#include<stdio.h>
#include<string.h>
#include<ctype.h>
int main()
{
	char ch,c, sh[26] = { 'a', 'b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
	int counter[26] = { 0 };
	while (scanf("%c", &c) != EOF){
		ch=tolower(c);
		if (islower(ch)){
			int num = ch - 'a';
			counter[num]++;
		}
	}
	for (int i=0; i < 26; i++){
		printf("%c : %d\n",sh[i],counter[i]);
	}
	return 0;
}

Measured memory_bytes: 2652
#include <bits/stdc++.h>
using namespace std;
int main(){
  	ios_base::sync_with_stdio(0);
  	cin.tie(0);
    int n;
    vector<int> seq(3);
    cin >> n;
    for(auto &x : seq){
        cin>>x;
    }
    vector<string> choice(n);
    for(auto &x : choice){
        cin>>x;
    }
    string ans;
    function<bool(int)> solve = [&](int i){
        if(seq[0]<0 || seq[1]<0 || seq[2]<0) return false;
        if(i==n) return true;

        ans.push_back(choice[i][0]);
        seq[choice[i][0] - 'A']++;
        seq[choice[i][1] - 'A']--;

        if(solve(i+1)){
            return true;
        }

        ans.pop_back();
        seq[choice[i][0] - 'A']--;
        seq[choice[i][1] - 'A']++;

        ans.push_back(choice[i][1]);
        seq[choice[i][0] - 'A']--;
        seq[choice[i][1] - 'A']++;

        if(solve(i+1)){
            return true;
        }
        
        ans.pop_back();
        seq[choice[i][0] - 'A']++;
        seq[choice[i][1] - 'A']--;

        return false;
    };
    if(solve(0)){
        cout<<"Yes\n";
        for(const auto &c : ans){
            cout<<c<<"\n";
        }
    }
    else{
        cout<<"No\n";
    }
}

Measured memory_bytes: 16048
#include <stdio.h>

int main(void)
{
    int cost;
    //printf("cost: ");
    if (scanf("%d", &cost) == EOF)
    {
        printf("INPUT ERROR");
    }

    int change = (10000 - cost) % 1000;
    printf("%d", change);
    //printf("change: %d\n", change);
    return 0;
}


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

int main()
{
    //freopen("input.txt", "r", stdin);

    int n, k;
    cin >> n >> k;
    int a[n];
    for (int i = 0; i < n; i++)
        cin >> a[i];
    int dp[n];
    dp[0] = 0;

    for (int i = 1; i < n; i++) {
        dp[i] = dp[i - 1] + abs(a[i] - a[i - 1]);
        int j = i - 1;
        while (j >= max(i - k, 0)) {
            dp[i] = min(dp[i], dp[j] + abs(a[i] - a[j]));
            j--;
        }
    }
    cout << dp[n - 1] << "\n";
}


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

int main(){
  vector<vector<int>> c(3, vector<int>(3));
  for ( int i = 0; i < 3 ; i++){
    for ( int j = 0; j < 3; j++){
      cin >> c.at(i).at(j);
    }
  }
  
  int sum = 0;
  int ref = 0;
  
  for (int i = 0; i < 3; i++){
    for(int j = 0; j < 3; j++){
      if(i == j){
        sum += c.at(i).at(j);
        ref += c.at(i).at(j);
       }
      else sum+= c.at(i).at(j);
      
    }   
  }
  
  
  if ( (sum == 0 && ref ==0 ) || sum % ref == 0) cout << "Yes";
  else cout << "No";
}


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();
		long k = sc.nextLong();
		int a[] = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt() - 1;
		}
		int dist[] = new int[n];
		boolean visited[] = new boolean[n];
		int i = 0, count = 0;
		int loop = -1, loopL = 0, distFromZ = 0;
		while (true) {
			if (!visited[i]) {
				visited[i] = true;
				dist[i] = count++;
				i = a[i];
			} else {
				distFromZ = dist[i];
				loopL = count - dist[i];
				dist[i] = count - dist[i];
				loop = i;
				break;
			}
		}
		if (k >= distFromZ) {
			k -= distFromZ;
			k = k % loopL;
			i = loop;
			while (k != 0) {
				i = a[i];
				k--;
			}
			System.out.println(i + 1);
		} else {
			i = 0;
			while (k != 0) {
				i = a[i];
				--k;
			}
			System.out.println(i + 1);
		}
	}
}


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

int main() {
  int x, count;
  cin >> x;
  if (x < 2) {
    cout << 1;
  }else if (x < 4) {
    cout << 2;
  }else if (x < 8) {
    cout << 4;
  }else if (x < 16) {
    cout << 8;
  }else if (x < 32) {
    cout << 16;
  }else if (x < 64) {
      cout << 32;
   }else {
      cout << 64;
   }
}

Measured memory_bytes: 3616
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>

//#define int long long
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(a) (a).begin(), (a).end()
#define PB push_back
#define MP make_pair
#define FST first
#define SND second
#define SZ(a) (signed)((a).size())
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort((c).begin(), (c).end())

using namespace std;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;

const int MOD = 1000000007;
const char ENDL = '\n';

#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")"  << " " << __FILE__ << endl;

signed main(void) {
    ios::sync_with_stdio(false);
    cout.setf(ios::fixed, ios::floatfield);
    cout.precision(10);
    cin.tie(0);

    int n, x;
    cin >> n >> x;

    if (x == 1 || x == 2 * n - 1) {
        cout << "No" << ENDL;
        return 0;
    }


    VI ans(2 * n - 1, 0), vec;


    if (n == x) {
        FOR(i, 1, 2 * n) {
            ans[i - 1] = i;
        }
    } else if (x == 2) {
        for (int i = 1; i <= 2 * n - 1; ++i) {
            if (i < x - 1 || x + 2 < i) {
                vec.PB(i);
            }
        }
        ans[n - 2] = x + 1;
        ans[n - 1] = x - 1;
        ans[n] = x;
        ans[n + 1] = x + 2;
    } else {
        for (int i = 1; i <= 2 * n - 1; ++i) {
            if (i < x - 2 || x + 1 < i) {
                vec.PB(i);
            }
        }
        ans[n - 3] = x - 1;
        ans[n - 2] = x + 1;
        ans[n - 1] = x;
        ans[n] = x - 2;
    }

    int j = 0;
    REP(i, 2 * n - 1) {
        if (ans[i] == 0) {
            ans[i] = vec[j++];
        }
    }

    cout << "Yes" << ENDL;
    REP(i, 2 * n - 1) {
        cout << ans[i] << ENDL;
    }

    return 0;
}

Measured memory_bytes: 3188
n = int(input())
mod = 10 ** 9 + 7

if n < 3:
  print(0)
  exit()
  
elif n < 6:
  print(1)
  exit()

memo = [0, 0, 0, 1, 1, 1]

for i in range(6, n+1):
  memo.append((memo[i-1] + memo[i-3]) % mod)
print(memo[-1])

Measured memory_bytes: 9116
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <set>
#include <stdio.h>
using namespace std;

int main() {
	string s; cin >> s;
	string t; cin >> t;

	int answer = 0;
	for (int i = 0; i < s.size(); i++) {
		if (s.at(i) != t.at(i)) answer++;
	}
	cout << answer << endl;
}

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

int main () {
  int n;
  cin >> n;
  int h[n];
  for (int i = 0; i < n; i++) {
    cin >> h[i];
  }
  long long ans = 0;
  for (int num = 0; num <= 100; num++) {
    bool ok = false;
    for (int i = 0; i < n; i++) {
      if (h[i] == 0) {
        ok = false;
      }
      else {
        if (ok == false) {
          ans++;
          ok = true;
        }
        h[i]--;
      }
    }
  }
  cout << ans << endl;
}

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

using namespace std;

template <class T> using V = vector<T>;

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

using ll = long long;
using vll = V<ll>;

#define FOR(i,a,b) for(ll i=(a);i<(b);i++)

void Solve();

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

/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/

void Solve(){
  ll n;
    cin>>n;
  vll A(n);
  ll ans=1LL<<60;
  FOR(i,0,n){
    cin>>A[i];
    if(i>0){
      A[i]+=A[i-1];
    }
  }

  FOR(i,0,n){
    ll a=abs(2*A[i]-A[n-1]);
    chmin(ans,a);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 1792
import java.util.*;
import java.math.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		List<Integer> list = new ArrayList<>();

		Double t = new Double(sc.next());
		Double x = new Double(sc.next());
		double result = t/x;

		System.out.println(result);

	}}




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

int main(){
  int n,a;
  cin >> n >> a;
  vector<vector<ll>> b(n+1,vector<ll>(2501));
  b[0][0]=1;
  rep(i,n){
    int x;
    cin >> x;
    for(int j=n;j>=0;j--){
      rep(k,2501){
        if(b[j][k]!=0){
          if(k+x<=2500){
            b[j+1][k+x]+=b[j][k];
          }
        }
      }
    }
  }
  ll ans=0;
  for(int i=1;i<=n;i++){
    ans+=b[i][i*a];
  }
  cout << ans;
  return 0;
}

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


int main() {
  int A[5],index=0,max=10,sum=0;
  for(int i=0;i<5;i++) cin >> A[i];

  for(int i=0;i<5;i++){
    if(max > A[i]%10 && A[i]%10 != 0){
      max = A[i]%10;
      index = i;
    }
  }


  for(int i=0;i<5;i++){
    if(i == index)continue;
    if(sum % 10 != 0) sum += (10- sum%10);
    sum += A[i];
  }
  if(sum % 10 != 0) sum += (10- sum%10);
  sum += A[index];
  cout << sum << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
using Int = long long;
const char newl = '\n';


template<typename T> void drop(const T &x){cout<<x<<endl;exit(0);}

//INSERT ABOVE HERE
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(0);

  using D = long double;
  const D PI = asinl(1)*2;
  D x;
  cin>>x;
  x*=PI/180;

  const D EPS = 1e-10;
  D s=0,t=0;
  for(int i=1;;i++){
    s+=cos(x*i);
    t+=sin(x*i);
    if(abs(s)<EPS and abs(t)<EPS) drop(i);
  }
  return 0;
}


Measured memory_bytes: 4116
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_macros)]
#![allow(unused_imports)]

use std::cmp::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
    ($iter:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    }
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
macro_rules! chmax {
    ($x:expr, $e:expr) => {
        $x = max($x, $e);
    };
}
macro_rules! chmin {
    ($x:expr, $e:expr) => {
        $x = min($x, $e);
    };
}

const INF: i64 = 1 << 60;

fn main() {
    input!{
        N: usize,
        W: usize,
        wv: [(usize, usize); N],
    }
    let mut dp = vec![vec![INF; 100000 + 10]; N + 10];
    dp[0][0] = 0;
    for i in 1..(N+1) {
        let (wi, vi) = wv[i-1];
        for v in 0..100001 {
            if v >= vi {
                chmin!(dp[i][v], dp[i-1][v-vi] + wi as i64);
            }
            chmin!(dp[i][v], dp[i-1][v]);
        }
    }
    let mut ans = 0;
    for v in 0..100001 {
        if dp[N][v] <= W as i64 {
            ans = v;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 116988
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iterator>
#include <fstream>
#include <cstddef>
#include <cstring>

using namespace std;

typedef pair<int, int> P;
typedef long long ll;
#define PB push_back
#define rep(i, a) for(int i = 0; i < a; i++)
#define all(v) v.begin(),v.end()
#define FF first
#define SS second
#define mp make_pair
#define INT int_64
const ll INF = (1<<30);
const ll NEGA=-INF*10000; 


ll ans = 0;
int p[200000];
int n,m;
int cnt=0;

int main() 
{
   int a,b,c,d;
   cin>>a>>b>>c>>d;
   if(abs(a-c)<=d) puts("Yes");
   else if(abs(a-b)<=d&&abs(c-b)<=d) puts("Yes");
   else puts("No");
   return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

int main(){
  int H,W;
  cin >> H >> W;
  char c[100][100];
  REP(i,H) REP(j,W) cin >> c[i][j];
  string ans = "Yes";
  REP(i,H) REP(j,W) {
    if(i==0 && j==0 && c[i][j]=='#' && c[i+1][j]=='.' && c[i][j+1]=='.') ans = "No";
    else if(i==0 && c[i][j]=='#' && c[i][j-1]=='.' && c[i][j+1]=='.' && c[i+1][j]=='.') ans = "No";
    else if(j==0 && c[i][j]=='#' && c[i-1][j]=='.' && c[i+1][j]=='.' && c[i][j+1]=='.') ans = "No";
    else if(c[i][j]=='#' && c[i-1][j]=='.' && c[i+1][j]=='.' && c[i][j+1]=='.' && c[i][j-1]=='.') ans = "No";
  }
  cout << ans << endl;
}


Measured memory_bytes: 764
#include <stdio.h>

int main(void)
{

	int n, l;

	scanf("%d %d", &n, &l);
	// l+i-1

	int sum = n * (l + l + n - 1) / 2;
	if (l <= 0 && l + n - 1 >= 0)
	{
	}
	else
	{
		if (l > 0)
		{
			sum = sum - l;
		}
		else
		{
			sum = sum - (l + n - 1);
		}
	}
	printf("%d", sum);

	return 0;
}


Measured memory_bytes: 128
N = int(input())
S = list(input())


dl = {}
dr = {}
acc = 0
for i, s in enumerate(S):
    dl[i] = acc
    if s == 'W':
        acc += 1

acc = 0
for i, s in enumerate(S[::-1]):
    dr[N - i - 1] = acc
    if s == 'E':
        acc += 1

result = N
for i in range(N):
    if result > dl[i] + dr[i]:
        result = dl[i] + dr[i]
print(result)


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

int main() {
    ios::sync_with_stdio(false), cin.tie(nullptr);
    int n, m;
    cin >> n >> m;
    array<int, 2> s, e;
    cin >> s[0] >> s[1] >> e[0] >> e[1];
    s[0]--, s[1]--, e[0]--, e[1]--;
    vector<string> a(n);
    vector<vector<int>> dis(n, vector<int>(m, int(1e9)));
    dis[s[0]][s[1]] = 0;
    for (auto& st : a)
        cin >> st;
    deque<array<int, 2>> q;
    q.push_back(s);
    while (q.size()) {
        array<int, 2> cur = q.front();
        q.pop_front();
        for (int i = -2; i <= 2; i++) {
            for (int j = -2; j <= 2; j++) {
                if (i == 0 && j == 0) continue;
                int ni = cur[0] + i, nj = cur[1] + j;
                if (ni < 0 || ni >= n || nj < 0 || nj >= m || a[ni][nj] == '#') continue;
                if (abs(i) + abs(j) == 1) {
                    if (dis[cur[0]][cur[1]] < dis[ni][nj]) {
                        dis[ni][nj] = dis[cur[0]][cur[1]];
                        q.push_front({ni, nj});
                    }
                } else {
                    if (dis[cur[0]][cur[1]] + 1 < dis[ni][nj]) {
                        dis[ni][nj] = dis[cur[0]][cur[1]] + 1;
                        q.push_back({ni, nj});
                    }
                }
            }
        }
    }
    cout << (dis[e[0]][e[1]] >= int(1e9) ? -1 : dis[e[0]][e[1]]) << '\n';
    return 0;
}

Measured memory_bytes: 8728
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        int x = sc.nextInt();
        if (k * 500 >= x) {
            System.out.println("Yes");
        }  else {
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 21844
// Input macro
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! stdin {
    () => {{
        use std::io::Read;
        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }};
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

// Test Code
macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}

test! {
    // テストコードをここにコピペする
    r"3 4
" => r"Even",

r"1 21
" => r"Odd"
}

fn main() {
    println!("{}", solve(&stdin!()));
}

fn solve(src: &str) -> &str {
    input! {
        source = src,
        n: i32,    // 問題に合わせて記述
        m: i32,
    }
    if (n*m)%2==0 {
        return "Even"
    } else {
        return "Odd"
    };
    // 問題を解くコード
}


Measured memory_bytes: 4352
<?php
$C=str_split(fgets(STDIN));
foreach($C as $c){
	$n=ord($c);
	if($n<65)echo $c;
	elseif($n<91)echo chr($n+32);
	elseif($n<97)echo $c;
	elseif($n<123)echo chr($n-32);
	else echo $c;
}

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

int main() {
  int s1s2s3,s1,s2,s3;
  
      
  cin>>s1s2s3;
  
  s1= s1s2s3%10;
    s2= (s1s2s3-s1)/10%10;
    s3= (s1s2s3-s2*10-s1)/100;
    
  cout<< s1+s2+s3 << endl;

}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
C - Build Stairs
https://atcoder.jp/contests/abc136/tasks/abc136_c

"""
import sys


def solve(N, stairs):
    stairs[0] -= 1
    for pos in range(1, N):
        if stairs[pos] < stairs[pos-1]:
            return 'No'
        if stairs[pos] >= stairs[pos-1] + 1:
            stairs[pos] -= 1
    return 'Yes'


def main(args):
    N = int(input())
    stairs = [int(h) for h in input().split()]
    ans = solve(N, stairs)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])


Measured memory_bytes: 14396
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
using namespace std;
constexpr int kMod = 1000000007;
typedef long long LL;

int N, K;
vector<vector<int>> G;

LL dfs(int v, int p, int d, LL c) {
  LL ans = c;
  c = (d == 0) ? K - 1 : K - 2;
  for (int u : G[v]) {
    if (u == p) continue;
    ans *= dfs(u, v, d + 1, c);
    ans %= kMod;
    --c;
  }
  return ans;
}

int main() {
  cin >> N >> K;
  G.resize(N);
  for (int i = 0; i < N-1; ++i) {
    int a, b; cin >> a >> b; --a, --b;
    G[a].push_back(b);
    G[b].push_back(a);
  }

  cout << dfs(0, -1, 0, K) % kMod << endl;
}


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


using namespace std;

using ll   = long long;
using ii   = pair   < int , int >;
using i3   = pair   < int , ii  >;
using li   = pair   < ll  , int >;
using lii  = pair   < ll  , ii  >;
using pll  = pair   < ll  , ll  >;
using vi   = vector < int       >;
using vl   = vector < ll        >;
using vii  = vector < ii        >;
using vli  = vector < li        >;
using vpll = vector < pll       >;
using vi3  = vector < i3        >;
using vlii = vector < lii       >;


const int N = 2e5 + 5;
const ll INF = 1e17 + 7;
const double eps = 1e-9 , PI = acos(-1);



int n , m;


void solve(int testCase){

    scanf("%d" , &n);

    int mn = 2e9;
    int ans = 0;

    for(int i = 0 ; i < n ; i ++){
            int x; scanf("%d" , &x);

            mn = min(mn , x);

            if(x <= mn)ans ++;
    }

    printf("%d\n" , ans);


}

main(){

    int t = 1;
    // scanf("%d" , &t);

    for(int testCase = 1 ; testCase <= t ; testCase ++){
            solve(testCase);
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <list>
#include <string>
#include <math.h>
#include <set>
#include <string>
#include <sstream>
#include <malloc.h>
using namespace std;
int cost = 10000000;
void dfs(int A,int B,int C,int N,vector<int> height,vector<int> group)
{
	if(group.size()==N)
	{
		int a = 0;
		int b = 0;
		int c = 0;

		int tc = 0;

		int as = 0;
		int bs = 0;
		int cs = 0;

		for(int i=0; i<N; i++)
		{
			switch(group[i])
			{
				case 0:
					as++;
					a+=height[i];
					break;
				case 1:
					bs++;
					b+=height[i];
					break;
				case 2:
					cs++;
					c+=height[i];
					break;
			}
		}
		if(as==0 || bs==0 || cs==0)
		{
			return;
		}
		tc = abs(a-A)+abs(b-B)+abs(c-C)+10*(as+bs+cs-3);

		if(tc<=::cost)
		{
			::cost=tc;
		}

		return;
	}

	for(int i=0; i<4; i++)
	{
		vector<int> newgroup(group.size());
		copy(group.begin(),group.end(),newgroup.begin());
		newgroup.push_back(i);
		dfs(A,B,C,N,height,newgroup);
	}

}
int main()
{
	int N,A,B,C;
	cin>>N>>A>>B>>C;
	vector<int> height(N);
	for(int i=0; i<N; i++)
	{
		cin>>height[i];
	}
	vector<int> group(0);
	dfs(A,B,C,N,height,group);
	cout<<::cost<<endl;
	//全数探索
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF 1145141919364364
#define all(vec) vec.begin(),vec.end()
#define ggr getchar(); getchar();return 0;
#define ll long long
#define P pair<int,int>
#define S second
#define F first
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}

int kai(int x) {
	if (x == 1)return 1;
	return kai(x - 1)*x%mod;
}

int mod_pow(int x, int y, int moder) {
	int res = 1;
	while (y > 0) {
		if (y & 1)res = res * x%moder;
		x = x * x%moder;
		y >>= 1;
	}
	return res;
}

int comb(int x, int y) {
	if (y > x)return 0;
	if (x == y)return 1;
	return kai(x)* mod_pow(kai(x - y), mod - 2, mod) % mod * mod_pow(kai(y), mod - 2, mod) % mod;
}

string s;
int a, b;

signed main() {
	cin >> s;
	rep(i, s.size()) {
		a++;
		if (s[i] == 'o')b++;
	}
	if (15 - a + b >= 8)cout << "YES" << endl;
	else cout << "NO" << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <queue>
#include <cmath>
#include <string>
#include <iterator>
#include <map>
#include <set>
#include <iomanip>
#include <vector>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using Graph = vector<vector<int>>;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
#define INF 100000000
#define MAX 200001
#define MOD 1000000007
ll fac[MAX], finv[MAX], inv[MAX];
const int MX = 1000005;

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

    for(int c=0;c<min(100,k);c++){
        vector<int> b(n + 1, 0);
        for(int i=0;i<n;i++){
            int l = max(0,i-a[i]);
            int r = min(n-1,i+a[i])+1;
            b[l] += 1;
            b[r] -= 1;
        }
        a[0] = b[0];
        for(int i=1;i<n;i++){
            b[i] += b[i-1];
            a[i] = b[i];
        }
    }
    for (int i = 0; i < n; i++)
    {
        cout << a[i] << ' ';
    }
    cout << endl;
}

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

int main() {
	int N, a;
	cin >> N;
	deque<int> dq;
	if (N % 2) {
		cin >> a;
		dq.push_front(a);
	}
	for (int i = 0;i < N / 2;i++) {
		cin >> a;
		dq.push_back(a);
		cin >> a;
		dq.push_front(a);
	}
	for (int i = 0;i < N;i++) {
		cout << dq.front();
		if (i == N - 1)cout << endl;
		else cout << " ";
		dq.pop_front();
	}
}

Measured memory_bytes: 2944
#include<iostream>

using namespace std;

string s;
int main()
{
    int n;
    cin>>n;
    n = n % 10;
    if(n == 3) puts("bon");
    else if(n == 0 || n == 1 || n == 6 || n == 8) puts("pon");
    else puts("hon");
    return 0;
}

Measured memory_bytes: 3120
a,b = map(int,input().split())
price = 0
if a == 1 and b ==1:
  price +=400000
if a == 1:
  price +=300000
elif a ==2:
  price +=200000
elif a ==3:
  price +=100000
else:
  pass
if b == 1:
  price +=300000
elif b ==2:
  price +=200000
elif b ==3:
  price +=100000
else:
  pass
print(price)

Measured memory_bytes: 3064
// $%U%$ $%Y%$-$%M%$-$%D%$ $%h%$:$%m%$

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

string n;
int k;

ll memo[102][8][2];
bool memod[102][8][2];
ll f(int p, int kl, bool ma){
	if(!kl)return 1;
	if(p>=(int)n.size())return 0;
	if(memod[p][kl][ma])return memo[p][kl][ma];
	memod[p][kl][ma]=1;
	if(ma){
		if(n[p]!='0')memo[p][kl][ma]=f(p+1,kl-1,1);
		else memo[p][kl][ma]=f(p+1,kl,1);
		if(n[p]>'1')memo[p][kl][ma]+=f(p+1,kl-1,0)*(n[p]-'1');
		if(n[p]!='0')memo[p][kl][ma]+=f(p+1,kl,0);
	} else {
		memo[p][kl][ma]=9*f(p+1,kl-1,0)+f(p+1,kl,0);
	}
	return memo[p][kl][ma];
}

int main(){
	cin.tie(0);
	ios_base::sync_with_stdio(0);
	cin>>n>>k;
	cout<<f(0,k,1)<<endl;
	return 0;
}



Measured memory_bytes: 256
#include <stdio.h>

int res[1010][1010];

int main(){
    int h, w, a, b;
    scanf("%d%d%d%d", &h, &w, &a, &b);

    for(int i = 0; i < b; i++){
        for(int j = 0; j < a; j++) res[i][j] = 1;
    }

    for(int i = b; i < h; i++){
        for(int j = a; j < w; j++){
            res[i][j] = 1;
        }
    }

    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++) printf("%d", res[i][j]);
        printf("\n");
    }
}

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

int main(){
    long long int x,n,i=0;
    cin >> x;
    n = 100;
    i=0;
    while(1){           // n<x instead of 1
        n += n/100;
        i++;
        if(n>=x)        
        break;
    }
    cout << i;
    return 0;
}

Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define loop(n)      for(int i=0;i<(n);i++)
#define lp(x,s,e)    for(int x=(s);x<(e);x++)
#define lpe(x,s,e)    for(int x=(s);x<=(e);x++)
#define endl '\n'
using namespace std;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
   int n;
   cin>>n;
   int a[n-1];
   int freq[200009]={0};
   lp(i,0,n-1){
   cin>>a[i];
   freq[a[i]]++;}
   lpe(i,1,n)
   cout<<freq[i]<<endl;}


Measured memory_bytes: 5200
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<cctype>
#include<climits>
#include<bitset>
#include<bits/stdc++.h>
#define ld long double
#define ll long long int
#define ull unsigned long long int
#define rep(i,n) for(i=0;i<n;i++)
#define fin(ans) cout<<(ans)<<endl
#define INF INT_MAX
#define vvi vector<vector<int> >
#define vvc vector<vector<char> >
#define vvs vector<vector<string> >
#define P 1000000007
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 LLINF=1LL<<60;
//set<int>::iterator it;



int main(void){ios::sync_with_stdio(false);cin.tie(0);
//////////////////////////////////////////////////////
	
	int i,j,r,g,b,n,ans=0;
	cin>>r>>g>>b>>n;
	for(i=0;i<=9000;i++){
		for(j=0;j<=9000;j++){
			if((n-(i*r+j*g))%b==0&&(n-(i*r+j*g))/b>=0){
				ans++;
//				cout<<i<<j<<endl;
			}
		}
	}
	
	
	cout<<ans<<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 n = sc.nextInt();
      int[] d = new int[n];
      for(int i = 0;i < n;i++)d[i] = sc.nextInt();
      Arrays.sort(d);
      System.out.println(d[n/2]-d[n/2-1]);
    }
}

Measured memory_bytes: 52568
#include <iostream>

int main()
{
    int64_t A;
    std::string B;
    std::cin >> A >> B;

    int64_t B_num = 0;
    int64_t rate = 100;
    for (unsigned i = 0; i < B.size(); ++i)
    {
        if (B[i] == '.')
            continue;

        int64_t a = B[i] - '0';
        B_num += a * rate;
        rate /= 10;
    }

    A = (A * B_num) / 100;
    std::cout << A;
}

Measured memory_bytes: 3620