akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<math.h>
#include<bitset>
using namespace std;
using ll=long long;
using ld=long double;
using pint=pair<int,int>;
using pll=pair<ll,ll>;
#define LONG_INF 9223372036854775807
#define INF 1000000000LL
#define EPS 1e-10
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define dump(a) rep(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define all(v) v.begin(),v.end()
#define pb push_back


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

    float H, A;
    cin >> H >> A;
    cout << ceil(H/A) << endl;

    return 0;
}

Measured memory_bytes: 256
// Sky's the limit :)
#include<bits/stdc++.h>
using namespace std;
#define int long long

signed main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    
    //int t = 1; cin >> t; while(t--)
    {
        string s;
        cin >> s;
        if(s[0] == s[1] && s[1] == s[2])
            cout << "No\n";
        else
            cout << "Yes\n";
    }
    
    cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
    return 0;
}



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

int N, a, state, need, num, removed;
vector<int> as;

int main() {
    cin >> N;

    for (int i = 1; i <= N; ++i) {
        cin >> a;
        as.push_back(a);
    }

    sort(as.begin(), as.end());
    as.push_back(0);

    for (int x: as) {
        if (x != state) {
            if (num < need) {
                removed += num;
            } else if (num > need) {
                removed += min(num, num - need);
            }

            state = x;
            need = x;
            num = 0;
        }

        ++num;
    }

    cout << removed << endl;
}


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

int main() {
    string s;
    cin >> s;
    string key = "keyence";
    rep(i, 7) {
        string head = key.substr(0, i);
        string tail = key.substr(i, key.size() - i);
        string shead = s.substr(0, i);
        string stail = s.substr(s.size() - tail.size(), tail.size());
        if (head == shead && tail == stail) {
            cout << "YES" << endl;
            return 0;
        }
    }

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define P pair<int,int>
using ll=int64_t;
using namespace std;
#define ketasuu(n) fixed<<setprecision(n)
#define btoe(p) p.begin(),p.end()
#define etob(p) p.rbegin(),p.rend()




int main(){
    string s,t; cin>>s>>t;
    int n=s.length();
    bool ok=false;
    rep(i,n){
        bool che=true;
        rep(j,n){
            if(s[(i+j)%n]!=t[j]){
                che=false;
            }
        }
        if(che) ok=true;
    }
    cout<<(ok?"Yes": "No")<<endl;
}   

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

int main(void)
{
  int N;
  cin >> N;
  vector<int> d;
  int num = 0;
  for (int i = 0; i < N; ++i)
  {
    cin >> num;
    d.push_back(num);
  }
  sort(d.begin(), d.end());
  d.erase(unique(d.begin(), d.end()), d.end());

  cout << d.size() << endl;

  return 0;
}

Measured memory_bytes: 256
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int count = 0;
    for (int i = 1; i < n; i++) {
      int a = i;
      for (int j = 1; i * j < n; j++) {
        int b = j;
        if (n - a * b > 0) {
          int c = n - a * b;
          count++;
        }
      }
    }
    System.out.println(count);
  }
}

Measured memory_bytes: 35848
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>

using std::cin;
using std::cout;
using std::endl;

using std::string;
using std::pair;

using std::vector;

int N;
vector<int> A;
vector<int> B;
vector<int> C;

int main(){
    scanf("%d",&N);
    //cin >> N;
    A=vector<int>(N);
    for(int i=0;i<N;i++){
        scanf("%d",&A[i]);
        //cin >> A[i];
    }
    B=vector<int>(N);
    for(int i=0;i<N;i++){
        scanf("%d",&B[i]);
        //cin >> B[i];
    }
    C=vector<int>(N);
    for(int i=0;i<N;i++){
        scanf("%d",&C[i]);
        //cin >> C[i];
    }

    std::sort(A.begin(),A.end());
    std::sort(B.begin(),B.end());
    std::sort(C.begin(),C.end());

    long ans=0;

    vector<long> ans_b(N);
    auto low=std::lower_bound(A.begin(),A.end(),B[0]);
    ans_b[0]=low-A.begin();
    for(int i=1;i<N;i++){
        low=std::lower_bound(low,A.end(),B[i]);
        ans_b[i]=low-A.begin() + ans_b[i-1];
    }

    low=std::lower_bound(B.begin(),B.end(),C[0]);
    if(low!=B.begin()){
        ans+=ans_b[low-B.begin()-1];
    }
    for(int i=1;i<N;i++){
        low=std::lower_bound(low,B.end(),C[i]);
        if(low!=B.begin()){
            ans+=ans_b[low-B.begin()-1];
        }
    }

    printf("%ld\n",ans);
    //cout << ans << endl;
    return 0;
}



Measured memory_bytes: 2176
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()
#ifdef _DEBUG_
	#define debug(...) printf(__VA_ARGS__)
#else
	#define debug(...) (void)0
#endif
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
 
const int MAXN = 100000 + 10;
 
int a[MAXN], b[MAXN];
int h, w, n;
ll ans[10];
map<PII, bool> is;
 
int check(int x, int y) {
	if(x<=1 || x>=h || y<=1 || y>=w)	return false;
	int cnt = 0;
	for(int dx=-1; dx<=1; dx++) {
		for(int dy=-1; dy<=1; dy++) {
			if(is[MP(x+dx,y+dy)])	cnt++;
		}
	}
	return cnt;
}
 
int main() {
	scanf("%d%d%d", &h, &w, &n);
	for(int i=0; i<n; i++) {
		scanf("%d%d", a+i, b+i);
		is[MP(a[i], b[i])] = true;
	}
 
	for(int i=0; i<n; i++) {
		for(int dx=-1; dx<=1; dx++) {
			for(int dy=-1; dy<=1; dy++) {
				ans[check(a[i]+dx, b[i]+dy)]++;
			}
		}
	}
 
	ll sum = 0;
	for(int i=1; i<=9; i++) {
		assert(ans[i]%i == 0);
		ans[i] /= i;
		sum += ans[i];
	}
	ans[0] = 1ll*(h-2)*(w-2) - sum;
 
	for(int i=0; i<=9; i++)	printf("%lld\n", ans[i]);
    
    return 0;
}


Measured memory_bytes: 157312
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

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

    string s;
    cin >> s;

    for (int i = 0; i < n; i++) {
        s[i] = s[i] == 'R' ? 0 : s[i] == 'G' ? 1 : 2;
    }

    ll r = 0;

    vector<int> a[3];
    for (int h = 0; h < 3; h++) {
        a[h] = vector<int>(n + 1, 0);
    }
    for (int i = 0; i < n; i++) {
        for (int h = 0; h < 3; h++) {
            a[h][i + 1] = a[h][i] + (s[i] == h);
        }
    }
    for (int i = 0; i < n; i++) {
        int h = s[i], h0 = (h + 1) % 3, h1 = (h + 2) % 3;
        int t0 = a[h0][i], t1 = a[h0][n] - t0;
        int s0 = a[h1][i], s1 = a[h1][n] - s0;
        r += t0 * s1 + s0 * t1;

        for (int j1 = i + 1; j1 < n; j1++) {
            int j0 = i - (j1 - i);
            if (j0 < 0) break;
            if (s[j0] == h0 && s[j1] == h1) r--;
            if (s[j0] == h1 && s[j1] == h0) r--;
        }
    }

    cout << r << endl;

    return 0;
}

Measured memory_bytes: 3640
#pragma GCC optimize("O3")
//#pragma GCC target("avx2")
//#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << "\n";
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (ll i = (m); i < (n); ++i)
#define REVFOR(i, m, n) for (ll i = (n - 1); i >= (m); --i)
#define REP(i, n) FOR(i, 0, n)
#define REVREP(i, n) REVFOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

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

    int n, m; cin >> n >> m;

    vector<bool> v1(n), v2(n);
    REP(i, m) {
        int a, b; cin >> a >> b;
        --a; --b;

        if (a == 0) v1[b] = true;
        if (b == n - 1) v2[a] = true;
    }

    REP(i, n) {
        if (v1[i] && v2[i]) {
            print("POSSIBLE");
            return 0;
        }
    }

    print("IMPOSSIBLE");

}

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

int main() {
    int k, x;
    cin >> k >> x;
    for (int i=x-(k-1); i<=x+(k-1); i++) cout << i << endl;
    return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

/* include ***********************/
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>

/* define *************************/
//for
#define REP(i,n) for(int i=0,i##_len=(int)(n);i<i##_len;i++)
#define REPS(i,n) for(int i=1,i##_len=(int)(n);i<=i##_len;i++)
#define RREP(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define RREPS(i,n) for(int i=(int)(n);i>0;i--)
#define FOR(i,s,n) for(int i=(int)(s),i##_len=(int)(n);i<i##_len;i++)
#define RFOR(i,s,n) for(int i=(int)(s)-1,i##_len=(int)(n);i>=i##_len;i--)

//printf
#define PRINTD(d) printf("%d\n",(d))
#define PRINTL(d) printf("%lld\n",(d))

//memset
#define m0(s) memset(s,0,sizeof(s))
#define ml(s) memset(s,63,sizeof(s))
#define fill(s,c) memset(s,c,sizeof(s))

#define INF 1e9
#define MOD 1000000007

typedef long long ll;
typedef unsigned long long ull;

int cost[] = { 0,2,5,5,4,5,6,3,7,6};
int use[10];
int ansUse[10];
int n, m;
int a[9];

int diff[4][2] = {
	{ 0, -1 },
	{ -1, 0 },
	{ 1, 0 },
	{ 0, 1 },
};

int Min(int a, int b) {
	return (a)<(b) ? (a) : (b);
}
int Max(int  a, int  b) {
	return (a) > (b) ? (a) : (b);
}
void Swap(int *a, int *b) {
	int tmp = *a;
	*a = *b;
	*b = tmp;
}



int main() {
	char s[11];
	scanf("%s", s);
	char str[] = "2019/04/30";

	REP(i, 11) {
		if (s[i] < str[i]) {
			puts("Heisei");
			return 0;
		}
		if (s[i] > str[i]) {
			puts("TBD");
			return 0;
		}
	}
	puts("Heisei");
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <utility>
#include <algorithm>
#include <map>
#include <cassert>
using namespace std;
#define REPP(i,a,b) for(int i = (a); i < (b); ++i)
#define REP(i,a) for(int i = 0; i < (a); ++i)
#define PER(i,a) for(int i = (a) - 1; i >= 0; --i)
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define MP make_pair

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

const int maxn = 2e5 + 5;
int n, a[maxn], h[maxn];
ll tree[maxn];

ll query(int x) {
    ll res = 0;
    while (x) {
        res = max(res, tree[x]);
        x -= x & (-x);
    }
    return res;
}

void update(int x, ll val) {
    while (x <= n) {
        tree[x] = max(tree[x], val);
        x += x & (-x);
    }
}

int main() {
    scanf("%d", &n);
    REP(i, n) scanf("%d", h + i);
    REP(i, n) scanf("%d", a + i);
    ll ans = 0;
    REP(i, n) {
        ll x = query(h[i]);
        update(h[i], x + a[i]);
        ans = max(ans, x + a[i]);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3328
import java.util.*;

public class Main {
    public static void main(String args[]) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        int k = scanner.nextInt();
        Set<Integer> set = new HashSet<>();
        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= m; j++) {
                int val = i * (m - j) + j * (n - i);
                set.add(val);
            }
        }

        if (set.contains(k)) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 57812
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset

#include <math.h>
#include <stdlib.h>


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

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; }

//INT_MAX	2,147,483,647 = 2*1.0e9

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

  int ans = h[0];
  for(int i = 0; i < N-1; i++){
    if(h[i] < h[i+1]) ans += (h[i+1]-h[i]);
  }

  cout << ans << endl;

  return 0;
}


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

int main() {
  char x, y;
  cin >> x >> y;
  if (x < y) {
    cout << "<" << endl;
  }
  else if (x > y) {
    cout << ">" << endl;
  }
  else {
    cout << "=" << endl;
  }
  return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include <stdio.h>
using namespace std;

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

int max=0;
int val=0;
for(int i=0;i<n;i++){
  if(s[i]=='D')val--;
  else {val++; if(max<val) max=val;}
}

cout <<max<<endl;
}


Measured memory_bytes: 256
N = int(input())
d_list = []

for d in range(N):
    d = int(input())
    d_list.append(d)

d_list.sort()
tmp_d = -1
mochi_count = 0
for i in range(N):
    if tmp_d == d_list[i]:
        continue
    else:
        tmp_d = d_list[i]
        mochi_count += 1

print(mochi_count)

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

int main() {
  int N,K,A;
  cin >> N >> K;
  A = 1;
  for(int i=0;i<N;i++){
    if(A>=K){
      A+=K;
    }
    else{
      A*=2;
    }
  }
  cout << A ;
}


Measured memory_bytes: 256
n = int(input())
a_list = list(map(int, input().split()))

my_dict = dict()
k_dict = dict()

for i in range(len(a_list)):
    if a_list[i] in my_dict:
        my_dict[a_list[i]] = my_dict[a_list[i]] + 1
    else:
        my_dict[a_list[i]] = 1
    k_dict[i] = a_list[i]

num_c = 0

for item in my_dict:
    num = my_dict[item]
    num_c += ((num * (num - 1)) // 2)

for i in range(n):
    if k_dict[i] in my_dict:
        num = my_dict[k_dict[i]]
        num_1 = num - 1
        print(num_c - ((num * (num - 1)) // 2) + ((num_1 * (num_1 - 1)) // 2))


Measured memory_bytes: 108368
# https://atcoder.jp/contests/abc063/submissions/5323989 参照

def func(idx, points, N, lst_s, dp):
    # base case
    if idx == N:
        if points % 10 == 0:
            return 0
        else:
            return points
    
    # check memo
    if dp.get((idx, points)) is not None:
        return dp[(idx, points)]
    
    # recursive
    ret = max(
        func(idx = idx + 1, points = points, N = N, lst_s = lst_s, dp = dp), 
        func(idx = idx + 1, points = points + lst_s[idx], N = N, lst_s = lst_s, dp = dp)
        )
    dp[(idx, points)] = ret

    return ret


N = int(input())
lst_s = [int(input()) for _ in range(N)]
dp = {}
ans = func(0, 0, N, lst_s, dp)
print(ans)

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

int main(int argc, char *argv[], char *envp[]){
	int N;
	string s;
	cin >> N >> s;
	for(int i=0; i<s.size(); ++i){
		s[i] = (s[i] + (N % ('Z' - 'A' + 1)) );
		//s[i] = s[i] + N ;
		if(s[i] > 'Z') {
			s[i] = s[i] - ('Z' - 'A' + 1);
		}
	}
	cout << s << endl;
	return 0;
}


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

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

    int sum0 = 0;
    int sum1 = 0;
    rep(i, S.length()) {
        if (S[i] == '0') sum0++;
        else sum1++;
    }

    cout << 2 * min(sum0, sum1) << endl;

    return 0;
}

Measured memory_bytes: 512
while True:
    h,w = map(int, input().split())
    if h == 0 and w == 0: break
    for j in range(h):
        for i in range(w):
            if i == 0 or j == 0 or i == w-1 or j == h-1:
                print("#", end="")
            else:
                print(".", end="")
        print()
    print()



Measured memory_bytes: 7000
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>

using namespace std;

using P = pair<int, int>;

// Hamiltom Path
int main() {
  int N, M;
  cin >> N >> M;
  vector<vector<int>> graph(N, vector<int>());
  for (int i = 0; i < M; i++) {
    int A, B;
    cin >> A >> B;
    A--;
    B--;
    graph[A].push_back(B);
    graph[B].push_back(A);
  }
  deque<P> q;
  int u = 0;
  int v = graph[0][0];
  q.push_front(make_pair(u, v));
  vector<int> visited(N, 0);
  visited[u] = 1;
  visited[v] = 1;
  while (true) {
    bool flag = false;
    for (int i = 0; i < graph[u].size(); i++) {
      int uu = graph[u][i];
      if (visited[uu] == 0) {
        q.push_front(make_pair(uu, u));
        u = uu;
        visited[u] = 1;
        flag = true;
        break;
      }
    }
    for (int j = 0; j < graph[v].size(); j++) {
      int vv = graph[v][j];
      if (visited[vv] == 0) {
        q.push_back(make_pair(v, vv));
        v = vv;
        visited[v] = 1;
        flag = true;
        break;
      }
    }
    if (!flag) break;
  }
  cout << q.size() + 1 << endl;
  auto init = q.front();
  cout << init.first + 1 << ' ';
  while (q.size() != 0) {
    auto x = q.front();
    q.pop_front();
    cout << x.second + 1 << ' ';
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 7552
fun main(args: Array<String>) {
        var result: String = "Good"
        val n = readNext()
        if(n[0] == n[1] ||
                n[1] == n[2] ||
                n[2] == n[3]) {
            result = "Bad"
        }
        println(result)
    }


    fun readNext(): String {
        return readLine()!!
    }

Measured memory_bytes: 31780
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pii pair<int, int>
#define F first
#define S second
#define pb push_back
#define pp pop_back

const ll P = 998244353LL;
const int N = 202020;

using namespace std;

ll n, m, k;
ll f[N], po[N], inv[N];

ll pow(ll a, ll b){
	if(!b) return 1LL;
	ll u = pow(a, b/2);
	u = (u*u)%P;
	if(b&1) u = (u*a)%P;
	return u;
}

int main(){

	cin >> n >> m >> k;

	f[0] = 1;
	po[1] = m;
	for(ll i=1; i<=n; i++) f[i] = (f[i-1]*i)%P;
	for(int i=0; i<=n; i++) inv[i] = pow(f[i], P-2LL);
	for(int i=2; i<=n; i++) po[i] = (po[i-1]*(m-1))%P;

	ll ans = 0;

	for(ll i=n; i>=n-k; i--){

		ll nCr = (inv[i-1]*inv[n-i])%P;
		nCr = (nCr*f[n-1])%P;

		nCr = (nCr*po[i])%P;

		ans = (ans+nCr)%P;
	}

	cout << ans << endl;

	return 0;
}


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

int main(){
    int n;
    cin>>n;
    vector<int>a(n);
    int m=0;
    for(int i=0; i<n; i++){
        cin>>a.at(i);
    }
    sort(a.begin(),a.end());
    for(int i=1; i<n; i++){
        if(a.at(i)==a.at(i-1)) {
            cout<<"NO"<<endl;
            return 0;
        }
    }
    cout<<"YES"<<endl;
}

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

int main() {
    std::ios::sync_with_stdio(false);
    int n, k;
    std::cin >> n >> k;
    std::vector<double> bulbs(n);
    for (auto& v: bulbs) {
        std::cin >> v;
    }
    ;
    for (int i = 0; i < k; ++i) {
        bool is_changed = false;
        std::vector<std::pair<double, int>> points;
        for (int j = 0; j < n; ++j) {
            points.push_back({j - bulbs[j] - .5, -1});
            points.push_back({j, 0});
            points.push_back({j + bulbs[j] + .5, 1});
        }
        std::sort(begin(points), end(points));
        int cur = 0;
        for (auto p: points) {
            auto typ = p.second;
            auto coord = p.first;
            cur += typ;
            if (typ == 0 && bulbs[coord] != -cur) {
                bulbs[coord] = -cur;
                is_changed = true;
            }
        }
        if (!is_changed) {
            break;
        }
    }
    for (auto& v: bulbs) {
        std::cout << v << " ";
    }
    std::cout << std::endl;
    return 0;
}


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


int main() {
  int x;
  cin >> x;

  if (x >= 30) cout << "Yes" << endl;
  else cout << "No" << endl;
}

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

using ll = long long;

int main() {
    ll n;
    while(cin >> n, n) {
        ll a = 1LL << 52;
        for(int i = 51; i >= 0; --i) {
            char b; cin >> b;
            a |= (ll)(b == '1') << i;
        }

        ll ex = 0, sig = a;
        while(n > 0 && a != 0) {
            const ll cnt = min(n, ((1LL << 53) - sig + a - 1) / a);
            sig += a * cnt;
            while(sig >= 1LL << 53) {
                ex += 1;
                sig >>= 1;
                a >>= 1;
            }
            n -= cnt;
        }

        cout << bitset<64>((ex << 52) | (sig & ((1LL << 52) - 1))) << endl;
    }
}



Measured memory_bytes: 3104
import numpy as np


def b_frog2():
    N, K = map(int, input().split())
    h = np.array(list(map(int, input().split())))

    c = np.zeros(N, dtype=int)
    c[0] = 0
    for i in range(1, N):
        j = max(0, i-K)
        c[i] = np.min(abs(h[i] - h[j:i]) + c[j:i])

    print(c[-1])


##########
if __name__ == "__main__":
    b_frog2()


Measured memory_bytes: 22884
//#pragma GCC optimize ("O3")
//#pragma GCC target ("sse4")
//#pragma comment(linker, "/stack:200000000")
// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
// #pragma GCC optimize ("unroll-loops")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#include <ext/rope>

typedef long long ll;
using namespace __gnu_pbds;
using namespace std;
using namespace __gnu_cxx;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define len(v) ((int)v.size())
#define all(v) v.begin(), v.end()

template < typename T > using oset = tree < T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update >;
template < typename T > using MinPriorityQueue = priority_queue < T, vector < T >, greater < T > >;
template<typename T> void print_ans(T ans) {cout << ans << "\n"; exit(0);}

ll mod=1e9+7;

void io(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);    
    #ifdef LOCAL
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
}

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
template<class T>
T rand(T a, T b) {
    return uniform_int_distribution<T>(a, b)(rng);
}

const int N = 2e5 + 5;


int main(){
    io();
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    sort(a,a+n);
    ll sum = 0;
    ll ans = 1e18;
        for(int j=1;j<=100;j++){
            sum = 0;
            for(int i=0;i<n;i++){
             sum += 1LL*(a[i]-j)*(a[i]-j);
            }
            ans = min(ans, sum);
        }
    

    cout<<ans;
    



}

Measured memory_bytes: 256
//Link : https://codeforces.com/contest/1253

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 200005
/*
#include <limits.h>
INT_MAX
LLONG_MAX
*/

bool vis[N];
int c[N],sz[N];
vector<int> adj[N];

int getSize(int node,int par) {
  sz[node] = 1;
  for(int ch : adj[node]) {
    if(vis[ch] || ch==par) {
      continue;
    }
    getSize(ch,node);
    sz[node] += sz[ch];
  }
  return sz[node];
}

int getCentroid(int allSz,int node,int par) {
  int maxSubSize = allSz - sz[node];
  for(int ch : adj[node]) {
    if(vis[ch] || ch==par) {
      continue;
    }
    maxSubSize = max(maxSubSize, sz[ch]);
    int ret = getCentroid(allSz,ch,node);
    if(ret!=-1) {
      return ret;
    }
  }
  if(maxSubSize*2<= allSz) {
    return node;
  } else {
    return -1;
  }
}

bool isPainted[N];
ll all[N];
void paintAll(int node,int par,int ad) {
  bool painted = false;
  if(!isPainted[c[node]]) {
    painted = true;
    isPainted[c[node]] = true;
    all[c[node]] += ad*sz[node];
  }
  for(int ch : adj[node]) {
    if(vis[ch] || ch==par) {
      continue;
    }
    paintAll(ch,node,ad);
  }
  if(painted) {
    isPainted[c[node]] = false;
  }
}


ll out[N];

void paintColor(int node,int par,ll weight) {
  bool painted = false;
  if(!isPainted[c[node]]) {
    painted = true;
    isPainted[c[node]] = true;
    out[c[node]] += (ll)(weight-all[c[node]])*sz[node];
  }
  for(int ch : adj[node]) {
    if(vis[ch] || ch==par) {
      continue;
    }
    paintColor(ch,node,weight);
  }
  if(painted) {
    isPainted[c[node]] = false;
  }
}

int csz[N];
void solveCentroid(int centroid) {
  int size = getSize(centroid,0);
  out[c[centroid]] += 1;
  int tmpSize = size-1;
  vis[centroid] = true;
  int ad = 1;
  isPainted[c[centroid]] = true;
  for(int ch : adj[centroid]) {
    if(vis[ch]) {
      continue;
    }
    int u = getSize(ch,centroid);
    csz[ch] = u;
    out[c[centroid]] += (ll)u*ad;
    ad += u;
    paintAll(ch,centroid,1);
  }
  for(int ch : adj[centroid]) {
    if(vis[ch]) {
      continue;
    }
    int u = csz[ch];
    paintAll(ch,centroid,-1);
    paintColor(ch,centroid,size - u);
  }
  isPainted[c[centroid]] = false;
  for(int ch : adj[centroid]) {
    if(vis[ch]) {
      continue;
    }
    int size = getSize(ch,centroid);

    int cent = getCentroid(size,ch,centroid);
    assert(cent!=-1);
    solveCentroid(cent);
  }
}

void solve() {
  int n;
  scanf("%d ", &n);
  for(int i=1;i<=n;++i) {
    scanf("%d ", &c[i]);
  }
  for(int i=0;i<n-1;++i) {
    int x,y;
    scanf("%d %d ", &x,&y);
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  int size = getSize(1,0);
  int cent = getCentroid(n,1,0);
  solveCentroid(cent);
  for(int i=1;i<=n;++i) {
    printf("%lld\n", out[i]);
  }
}

int main() {
    //freopen("input.txt","r",stdin);
    solve();
    return 0;
}


Measured memory_bytes: 36188
import java.io.{BufferedReader, InputStream, InputStreamReader}
import java.util.StringTokenizer

import scala.collection.mutable
import scala.util.Sorting
import math.{abs, max, min}

object Main {
  val MOD = 1000000007
  def solve(): Unit = {
    val sc = new InputReader(System.in)
    val N = sc.nextInt()
    val d = Array.ofDim[Int](N, N)
    for {
      i <- 0 until N
      j <- 0 until N
    } d(i)(j) = sc.nextInt()

    def calc: Option[Long] = {
      var ok = true
      var sum: Long = 0
      for {
        i <- 0 until N - 1
        j <- i + 1 until N
      } {
        var duplicate = false
        (0 until N) foreach { k =>
          if (k != i && k != j) {
            if (d(i)(k) + d(k)(j) == d(i)(j)) {
              duplicate = true
            } else {
              ok &= d(i)(k) + d(k)(j) > d(i)(j)
            }
          }
        }
        if (!duplicate) sum += d(i)(j)
      }

      if (ok) Some(sum) else None
    }

    val ans = (calc getOrElse -1).toString

    println(ans)
  }


  def main(args: Array[String]): Unit = {
    solve()
  }


  class InputReader(val stream: InputStream) {
    private val reader = new BufferedReader(new InputStreamReader(stream), 32768)
    private var tokenizer: StringTokenizer = null

    def next: String = {
      while (tokenizer == null || !tokenizer.hasMoreTokens)
        tokenizer = new StringTokenizer(reader.readLine)
      tokenizer.nextToken
    }

    def nextInt(): Int = next.toInt
    def nextLong(): Long = next.toLong
    def nextChar(): Char = next.charAt(0)
  }
}


Measured memory_bytes: 39380
#include<stdio.h>
int main()
{
    int a,b,x,y;
    while(scanf("%d %d",&a,&b)!=EOF)
    {
        x=0;
        y=a+b;
        while(y!=0)
        {
            y=y/10;
            x++;
        }

        printf("%d\n",x);
    }


    return 0;
}



Measured memory_bytes: 2028
#include<bits/stdc++.h>
using namespace std;
bool cmp(int a,int b)
{
return a>b;
}
int main(){
	int num;
	cin>>num;
	int a[num],Alice=0,Bob=0;
	for(int i=0;i<num;i++){
		cin>>a[i];
	}
	sort(a,a+num,cmp);
	for(int i=0;i<num;i+=2){
		Alice+=a[i];
		if(i+1<num) Bob+=a[i+1];		
	}
	cout<<Alice-Bob<<endl;	
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>

#define MAX 200

int main()
{
	int i=0,len;
	char str[MAX];

	fgets(str, MAX+1, stdin);
	len = strlen(str);

	while (i<len)
	{
		if (*(str + i) >= 'a'&&*(str + i) <= 'z')
		{
			*(str + i) -= 32;
		}
		++i;
	}
	
	printf("%s", str);

	return 0;
}


Measured memory_bytes: 524
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <iostream>
#include <vector>
#include <queue>
#include <unordered_map>
#include <random>
#include <stack>
#include <set>
#include <unordered_set>

#define bug(x) cout<<"zdongdebug1: "<<x<<endl;
#define bug2(x, y) cout<<"zdongdebug2: "<<x<<" "<<y<<endl;
#define bug3(x, y, z) cout<<"zdongdebug3: "<<x<<" "<<y<<" "<<z<<endl;
using namespace std;
typedef long long ll;
const int maxn = 105;
const int mod = 1000000007;

int main() {
#ifdef suiyuan2009
  freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
  //freopen("/Users/suiyuan2009/CLionProjects/icpc/output.txt", "w", stdout);
#endif
  int n,m;
  unordered_set<int>st;
  cin>>n>>m;
  for(int i=0;i<m;i++){
    int d;
    cin>>d;
    for(int j=0;j<d;j++){
      int x;
      cin>>x;
      st.insert(x);
    }
  }
  cout<<n-st.size()<<endl;
  return 0;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
using namespace std;

typedef long long ll;
typedef double db;
typedef long double ldb;

template<class T> inline void checkmin(T &a,const T &b){if(b<a) a=b;}
template<class T> inline void checkmax(T &a,const T &b){if(b>a) a=b;}

const int inf=1e9+10;
const int maxn=15;
const int mod=2e5;

int dp[maxn][maxn],k,tot[maxn];

int add(int &a,int b){
	a=(a+b)%mod;
}

int main(){
	cin>>k;
	for(int t=0;t<10;t++) dp[1][t]=1;
	for(int i=1;i<=10;i++){
		for(int t=0;t<10;t++){
			if(t-1>=0) add(dp[i+1][t-1],dp[i][t]);
			if(t+1<=9) add(dp[i+1][t+1],dp[i][t]); 
			add(dp[i+1][t],dp[i][t]);
		}
		for(int t=1;t<10;t++){
			add(tot[i],dp[i][t]);
		}
		add(tot[i],tot[i-1]);
	}
	int len=1,sum=0;
	for(;;){
		for(int t=1;t<10;t++){
			sum+=dp[len][t];
		}
		if(sum>=k) break;
		len++;
	}
//	cout<<len<<endl;
	int mini=0,maxi=9;
	dp[len][0]=tot[len-1];
	string ans="";
	for(int i=len;i>=1;i--){
		for(int t=mini;t<=maxi;t++){
			if(dp[i][t]>=k){
				mini=max(0,t-1);
				maxi=min(9,t+1);
				ans+=char('0'+t);
				break;
			}
			else{
				k-=dp[i][t];
			//	cout<<i<<" "<<t<<" "<<mini<<" "<<maxi<<" "<<dp[i][t]<<" "<<k<<endl;
			}
		}
	}
	cout<<ans;
	return 0;
}


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

int mod = 1000000007;
int64_t large = 9223372036854775807;

int main()
{
    int N;
    cin >> N;
    vector<int> monster(N + 1);
    vector<int> list(N);
    for (int i = 0; i < N + 1; i++)
        cin >> monster[i];

    for (int i = 0; i < N; i++)
        cin >> list[i];

    int64_t ans = 0;

    for (int i = 0; i < N; i++)
    {
        int tmp;
        tmp = min(list[i], monster[i]);
        ans += tmp;
        list[i] -= tmp;
        monster[i] -= tmp;
        tmp = min(list[i], monster[i + 1]);
        ans += tmp;
        list[i] -= tmp;
        monster[i + 1] -= tmp;
    }

    cout << ans;
}

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

int main(){
    string s;
    cin >> s;
    s += (char)('a' -1);
    vector<bool> used(256, false);
    for(int i=0; i<(int)s.length(); i++) used[s[i]] = true;

    while(s != ""){
        bool found = false;
        for(int i=s.back()+1; i<='z'; i++){
            if(!used[i]){
                s.pop_back();
                s += (char)i;
                found = true;
                break;
            }
        }
        if(found) break;
        used[s.back()] = false;
        s.pop_back();
    }
    if(s == ""){
        cout << -1 << endl;
    }else{
        cout << s << endl;
    }
    return 0;
}


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

#define endl "\n"

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

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

//container util
//------------------------------------------
#define pb push_back
#define paired make_pair
#define ALL(a) (a).begin(),(a).end()
#define PRINT(V) for (auto v : (V)) cout << v << " "
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())

//constant
//------------------------------------------
const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

//math
//------------------------------------------
int QP(int a,int b){int ans=1;do{if(b&1)ans=1ll*ans*a%MOD;a=1ll*a*a%MOD;}while(b>>=1);return ans;}
int QP(int a,int b,int MOD){int ans=1;do{if(b&1)ans=1ll*ans*a%MOD;a=1ll*a*a%MOD;}while(b>>=1);return ans;}
int GCD(int a,int b){return b?GCD(b,a%b):a;}

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

//grobal variable
//------------------------------------------
int N,M;
VI Vec;

//動的計画法で役に立つ関数
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; }

//最大公約数と最小公倍数
ll gcd(ll a, ll b) {
    if(b==0)return a;
    return gcd(b, a%b);
}

ll lcm(ll a, ll b) {
  ll g = gcd(a, b);
  return a/g*b;
}

vector<vector<long long> > comb(int n) {
  vector<vector<long long> > v(n + 1,vector<long long>(n + 1, 0));
  for (int i = 0; i < v.size(); i++) {
    v[i][0] = 1;
    v[i][i] = 1;
  }
  for (int j = 1; j < v.size(); j++) {
    for (int k = 1; k < j; k++) {
      v[j][k] = (v[j - 1][k - 1] + v[j - 1][k]);
    }
  }
  return v;
}

int main() 
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    int N,A,B;cin >> N >> A >> B;

    cout << min(B, N*A) << endl;
  
    return 0;
}



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[] takoyakis = new int[n];
		for(int i = 0; i < n; i++){
			takoyakis[i] = sc.nextInt();
		}
		int sum = 0;
		for(int i = 0; i < n; i++){
			for(int k = i + 1; k < n; k++){
				sum += takoyakis[i] * takoyakis[k];
			}
		}
		System.out.println(sum);
	}
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
int main(){
  int d,n;
  long long int sum;
  cin >> d >> n;
  if(n == 100){
    sum = pow(100,d) * 101;
    cout << sum;
    return 0;
  }
      sum = pow(100,d) * n;
      cout << sum ;
      return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys


def solve(N: int, A: "List[int]", B: "List[int]"):
    ans = 0

    # Bを配る
    for i in range(N):
        # A[i] に対してB[i]を配る
        # モンスターのほうが多い
        if(B[i] <= A[i]):
            ans += B[i]
            A[i] -= B[i]
            B[i] = 0
        # 勇者のほうが多い
        else:
            ans += A[i]
            B[i] -= A[i]
            A[i] = 0

        # A[i+1]に対して配る
        # モンスターのほうが多い
        if(B[i] <= A[i+1]):
            ans += B[i]
            A[i+1] -= B[i]
            B[i] = 0
        # 勇者のほうが多い
        else:
            ans += A[i+1]
            B[i] -= A[i+1]
            A[i+1] = 0

    print(ans)

    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [ int(next(tokens)) for _ in range(N+1) ]  # type: "List[int]"
    B = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, A, B)

if __name__ == '__main__':
    main()


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

bool valid(string line){
  string t[3] = {"the", "this", "that"};
  for ( int i = 0; i < 3; i++ ){
    if ( line.find(t[i]) != string::npos ) return true;
  }
  return false;
}

void move(string &line){
  for ( int i = 0; i < line.size(); i++ ){
    if ( line[i] == 'a' ) line[i] = 'z';
    else if ( 'b' <= line[i] && line[i] <= 'z' ){
      line[i] = (char)(line[i]-1);
    }
  }
}
main(){
  string line;
  while(1){
    getline(cin, line);
    if ( cin.eof() ) break;
    while(1){
      if ( valid(line) ) {
	cout << line << endl;
	break;
      }
      move(line);
    }
  }
}

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

using namespace std;

long long inf=1000000007;

long long modpow(long long n,long long p,long long mod);

int main(){
	long long n;
	cin>>n;
	vector<long long> hoge(n);
	for(long long i=0;i<n;i++) cin>>hoge.at(i);

	long long money=1000;

	for(long long i=0;i<n;i++){
		if(i==n-1 || hoge.at(i)>=hoge.at(i+1)) continue;

		long long kabu=money/hoge.at(i);
		money-=kabu*hoge.at(i);
		money+=kabu*hoge.at(i+1);
	}

	cout<<money<<endl;

	return 0;
}

long long modpow(long long n,long long p,long long mod){
	if(p==0) return 1;
	if(p%2==0) return (modpow(n,p/2,mod)*modpow(n,p/2,mod))%mod;
	if(p%2==1) return (modpow(n,p-1,mod)*n)%mod;
	cerr<<"ERROR"<<endl;
	return 1;
}


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

#pragma GCC optimize "O3"
#define rep(i,a,n) for(long long i=a; i<n; i++)
typedef long long ll;
typedef pair<int,int> P;
const ll MOD = (int)1e9+7;
const ll INF = MOD*MOD;
const double EPS = 1e-9;
const ll powll = 1LL<<1;

/*
while(!frag && cin >> a >>b, a|b)
*/

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

    rep(i,0,n){
        if(a[i] < a[i+1]){
            f[i] = 1;
        }else{
            f[i] = -1;
        }
        //cout << f[i] << "\n";
    }

    ll m = 1000;
    ll stk = 0;
    rep(i,0,n){
        if(i != n-1){
            if(f[i] == 1){
                stk += m/a[i];
                m -= m/a[i]*a[i];
            }else if(f[i]==-1){
                m += stk*a[i];
                stk = 0;
            }
        }else{
            m += stk*a[i];
            stk = 0;
        }
        // cout << m << " " << stk << "\n";
    }
    cout << m << "\n";
}

Measured memory_bytes: 3632
//dlang template---{{{
import std.stdio;
import std.conv;
import std.string;
import std.array;
import std.algorithm;

// MIT-License https://github.com/kurokoji/nephele
class Scanner
{
  import std.stdio : File, stdin;
  import std.conv : to;
  import std.array : split;
  import std.string;
  import std.traits : isSomeString;

  private File file;
  private char[][] str;
  private size_t idx;

  this(File file = stdin)
  {
    this.file = file;
    this.idx = 0;
  }

  this(StrType)(StrType s, File file = stdin) if (isSomeString!(StrType))
  {
    this.file = file;
    this.idx = 0;
    fromString(s);
  }

  private char[] next()
  {
    if (idx < str.length)
    {
      return str[idx++];
    }

    char[] s;
    while (s.length == 0)
    {
      s = file.readln.strip.to!(char[]);
    }

    str = s.split;
    idx = 0;

    return str[idx++];
  }

  T next(T)()
  {
    return next.to!(T);
  }

  T[] nextArray(T)(size_t len)
  {
    T[] ret = new T[len];

    foreach (ref c; ret)
    {
      c = next!(T);
    }

    return ret;
  }

  void scan()()
  {
  }

  void scan(T, S...)(ref T x, ref S args)
  {
    x = next!(T);
    scan(args);
  }

  void fromString(StrType)(StrType s) if (isSomeString!(StrType))
  {
    str ~= s.to!(char[]).strip.split;
  }
}
//}}}

void main() {
  Scanner sc = new Scanner;
  int N;
  sc.scan(N);
  if (N == 1) {
    writeln("Hello World");
  } else if (N == 2) {
    int A, B;
    sc.scan(A, B);

    writeln(A + B);
  }
}


Measured memory_bytes: 256
s = list(input())
s.pop(-1)
while len(s) > 0:
  if len(s) % 2 == 1:
    s.pop(-1)
    continue
  n = len(s)//2
  a = "".join(s[:n])
  b = "".join(s[n:])
  if a == b:
    print(len(s))
    exit()
  s.pop(-1)

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n, 0);
  rep(i, n) cin >> a.at(i);

  // どの整数が条件を満たすか先に調べる
  vector<int> f(1e6 + 1, 0);
  for (int x : a) {
    if (f.at(x) != 0) {
      f.at(x) = 2;
      continue;
    } else {
      for (int j = x; j < 1e6 + 1; j += x) {
        f.at(j)++;
      }
    }
  }

  int ans = 0;
  for (int x : a) {
    if (f.at(x) == 1) ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 7904
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            //[summary]C - Dice and Coin
            var line = ReadLine();
            int n = line[0];
            int k = line[1];

            //int型のまま計算すると、小数点以下が計算できない
            double dices = n;
            double sum = 0;

            //サイコロの面ごとに勝つ確率を計算
            for(int i = 1; i <= n; i++)
            {
                int score = i;
                int coin = 0;

                while (score < k)
                {
                    score *= 2;
                    coin++;
                }

                double coins = Math.Pow(2, coin);
                double probability = 1 / dices / coins;
                sum += probability;
            }

            Console.WriteLine(sum);
        }

        static List<int> ReadLine()
        {
            var line = Console.ReadLine();
            var array = line.Split(' ');

            return array.Select(x => int.Parse(x)).ToList();
        }
    }
}

Measured memory_bytes: 11220
N = int(input())
xys = [[] for _ in range(N)]
for i in range(N):
    A = int(input())
    for j in range(A):
        x,y = map(int,input().split())
        xys[i].append((x-1,y))

ans = 0
for b in range(1<<N):
    cnt = bin(b).count('1')
    if cnt <= ans: continue
    for i in range(N):
        if b&(1<<i):
            for x,y in xys[i]:
                if y==1 and b&(1<<x): continue
                if y==0 and b&(1<<x)==0: continue
                break
            else:
                continue
            break
    else:
        ans = cnt
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <bitset>


typedef long long ll;
#define fi first
#define se second
const ll mod = 1000000007;
//              123456789

using namespace std;

///////////////////////////////////////////////
//
//
///////////////////////////////////////////////

////////////////////////////////////////////////
////////////////////////////////////////////////

int N;
int M;

int a;
int b;

int num[111];

int main(){
  
  cin>>N>>M;
  
  int i;
  
  for( i = 0; i < M; i++ ){
    cin>>a>>b;
    num[a-1]++;
    num[b-1]++;
  }
  
  for( i = 0; i < N; i++ ){
    cout<<num[i]<<endl;
  }
  
  
 
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;


using namespace std;

#define debug(x) cout << '>' << #x << ':' << x << endl;
#define loop(i,n) for(int i=0;i<(int)(n);i++)
#define foi(i,k,n) for(int i=(k); i<(int)(n); i+=1)
#define fod(i,n,k) for(int i=k; i>=(int)n; i-=1)
#define fast_io ios_base::sync_with_stdio(false) , cin.tie(NULL);
#define all(x) x.begin(), x.end()
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define endl "\n"

#define int long long
#define INF 0x3f3f3f3f
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007

#define fir first
#define sec second
#define pb push_back
#define mp make_pair

typedef long long llint;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<llint> VL;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int,int> MII;
typedef set<int> SI;
string tostr(int n) {stringstream rr;rr<<n;return rr.str();}
llint toint(string s) {stringstream ss(s); llint x; ss >> x; return x;}
//typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
//gp_hash_table<string, llint> table;


//int mpow(llint base, llint exp) {
  //base %= MOD;
  //llint result = 1;
  //while (exp > 0) {
    //if (exp & 1) result = ((llint)result * base) % MOD;
    //base = ((llint)base * base) % MOD;
    //exp >>= 1;
  //}
  //return result;
//}


//void makegraph(int n, int m){
	//int i, u, v;
	//while(m--){
		//cin>>u>>v;
		//u--, v--;
		//g[u].pb(v);
		//g[v].pb(u);
	//}
//}

//void dfs(int u, int par){
	//for(int v:g[u]){
		//if (v == par) continue;
		//dfs(v, u);
	//}
//}


// ------------------------------------------------------------------ILB----------------------------------------------------------------  //



void solve(){
	int h, w, k, ans = 0;
	cin >> h >> w >> k;
	char mat[h][w];
	
	loop(i, h) loop(j, w) cin >> mat[i][j];
	
	for(int i = 0; i < (1 << (h + w)); ++i){
		int mask = i;
		set <int> r, c;
		int rc = 0, cc = 0;
		
		while(mask && (rc < h)){
			if((mask&1)){
				r.insert(rc);
			}
			mask >>= 1;
			rc++;
		}
		
		while(mask && (cc < w)){
			if((mask&1)){
				c.insert(cc);
			}
			mask >>= 1;
			cc++;
		}
		
		int count = 0;
		
		loop(x, h){
			loop(y, w){
				if(r.count(x)) continue;
				if(c.count(y)) continue;
				
				count += (mat[x][y] == '#');
			}
		}
		
		if(count == k) { 
			ans++; 
			//debug(i); 
		}
	}
	
	cout << ans;
}


 //1 0 0 0 0 

int32_t main() {
	fast_io;
    int t = 1;
    //cin >> t;
    //int xx = 0
    while(t--) {
		//xx++;
		//cout << "Case ";
      solve();
    }
    return 0;
}



Measured memory_bytes: 3644
L = int(input())

edges = []
v = 1
m = 1
while m <= L//2:
    edges.append((v, v+1, 0))
    edges.append((v, v+1, m))
    v += 1
    m *= 2

wt = m
for d in range(v-1):
    if L & (1<<(v-2-d)):
        edges.append((v-1-d, v, wt))
        wt += (1<<(v-2-d))

print(v, len(edges))
for u, v, w in edges:
    print(u, v, w)


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

using namespace std;
typedef long long ll;

int main(void)
{   string S;
    cin >>S;
    string P = S;
    reverse(S.begin(),S.end());

    int lim = S.length()/2;

    int count =0;
    for(int i=0;i<lim;i++){
        if(S.at(i)!=P.at(i)){
            count++;
        }
    }

    cout<<count<<endl;

    return 0;
}

Measured memory_bytes: 256