akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Text;

namespace AtTest.ABC_112
{
  class D
  {
    static void Main(string[] args)
    {
      Method(args);
      Console.ReadLine();
    }

    static void Method(string[] args)
    {
      long[] nm = ReadLongs();
      long n = nm[0];
      long m = nm[1];
      if (n == 1)
      {
        Console.WriteLine(m);
        return;
      }
      long max = m / n;
      for (long i = max; i >= 1; i--)
      {
        if (m % i == 0)
        {
          Console.WriteLine(i);
          return;
        }
      }
    }

    private static string Read() { return Console.ReadLine(); }
    private static int ReadInt() { return int.Parse(Read()); }
    private static long ReadLong() { return long.Parse(Read()); }
    private static double ReadDouble() { return double.Parse(Read()); }
    private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
    private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
    private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
  }
}

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

#define   int  long long 

using namespace std;

int fun(int a,int b,int c){
    int d = (max(a,max(b,c)) - min(a,min(b,c))); 
    return  d; 
}

int solve(int w,int h){
    int  ans = min(w,h) ; 
    for (int i=1,j=w-1;i<=j;i++,j--){
        int a = i*h;
        int b = (h/2) * j; 
        int c = (h * w) - a - b ; 
        ans = min(ans,fun(a,b,c));
    }
    return ans ;
}

signed main()
{
    int w,h;
    cin>>w>>h;
    if (w%3==0 or h%3==0) {
      cout << 0 << endl;
      return 0;
    }
    int ans1= solve(w,h);
    int ans2= solve(h,w);
    cout << min(ans1,ans2) << endl; 
    return 0;
}


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

template <typename InputIterator>
typename InputIterator::value_type summation(InputIterator first,
                                             InputIterator last) {
  return std::accumulate(first, last, typename InputIterator::value_type());
}
template <typename T>
std::istream &operator>>(std::istream &stream, std::vector<T> &v);
template <typename T1, typename T2>
std::istream &operator>>(std::istream &stream, std::pair<T1, T2> &p);
template <typename T>
std::istream &operator>>(std::istream &stream, std::vector<T> &v) {
  for (auto &i : v) {
    stream >> i;
  }
  return stream;
}
template <typename T1, typename T2>
std::istream &operator>>(std::istream &stream, std::pair<T1, T2> &p) {
  stream >> p.first >> p.second;
  return stream;
}

int main() {
  int n, k;
  std::cin >> n >> k;
  std::string s;
  std::cin >> s;

  s[k - 1] = static_cast<char>(s[k - 1] - 'A' + 'a');
  std::cout << s << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
        int input, h, m, s;

        scanf("%d\n", &input);

        h = input / 3600;
        input = input % 3600;
        m = (input) / 60;
        s = (input) % 60;

        printf("%d:%d:%d\n", h, m, s);

        return 0;
}

Measured memory_bytes: 2708
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

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 ll mod=1e9+7;

int main()
{
    ll a,b,c,d;
    cin >> a >> b >> c >> d;
    ll dx=c-a;
    ll dy=d-b;
    ll x=c;
    ll y=d;
    x+=-dy;
    y+=dx;
    cout << x << " " << y;
    cout << " ";
    x+=-dx;
    y+=-dy;
    cout << x << " " << y << endl;
    return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int h, w;
vector<string> a;

bool can(int x, int y, vector<vector<int>> &dist) {
  return x >= 0 && x < h && y >= 0 && y < w && dist[x][y] == -1;
}

int vectormax(vector<vector<int>> dist) {
  int ans = 0;
  for (int i = 0; i < dist.size(); i++) {
    ans = max(ans, *max_element(dist[i].begin(), dist[i].end()));
  }
  return ans;
}

int main() {
  cin >> h >> w;
  a.resize(h);
  for (int i = 0; i < h; i++) {
    cin >> a[i];
  }
  queue<pair<int, int>> que;
  vector<vector<int>> dist(h, vector<int>(w, -1));

  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      if (a[i][j] == '#') {
        dist[i][j] = 0;
        que.push(make_pair(i, j));
      }
    }
  }

  while (!que.empty()) {
    pair<int, int> temp = que.front();
    que.pop();

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

    for (int i = 0; i < 4; i++) {
      int x, y;
      x = temp.first + dx[i];
      y = temp.second + dy[i];
      if (can(x, y, dist)) {
        dist[x][y] = dist[temp.first][temp.second] + 1;
        que.emplace(make_pair(x, y));
      }
    }
  }

  cout << vectormax(dist) << endl;
}


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

int main(){
  vector<int> vc;
  int n;
  int p;
  cin >> n;
  for(int i=0;i<n;i++){
    int x;
    cin >> x;
    vc.push_back(x);
    p = p + x;
  }

  // int sum=0;
  int s1=0;
  int s2=0;
  for (int i=0; i < n; i++){
    s1 = s1 + (vc[i] - p/n) * (vc[i] - p/n);
    s2 = s2 + (vc[i] - (p/n+1)) * (vc[i] - (p/n+1));
  }
  if (s1 < s2){
    cout << s1 << endl;
  }else{
    cout << s2 << endl;
  }
}


Measured memory_bytes: 256
#include <cstdio>
int main()
{
	int n;
	while(~scanf("%d", &n))
		if(n/1000 == (n/100) % 10 && (n/100) % 10 == (n/10) % 10)			
                printf("Yes");
		else if((n/100) % 10 == (n/10) % 10 && (n/10) % 100 == n % 10)
			printf("Yes");
		else
				printf("No");
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main(){
    int a[5];
    int ans=0;
    int MIN=10;
    for(int i=0;i<5;i++){
        cin >> a[i];
        ans+=(((a[i]+9)/10)*10);
        if(a[i]%10!=0)MIN=min(a[i]%10,MIN);
    }
    cout << ans-(10-MIN) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i,a,b) for(int64_t i=(a);i<(b);++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int64_t i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+(b),(a).begin()+(c) // [b,c) イテレータ
#define INF 1000000000000000
#define MOD 1000000007
using PII = pair<int64_t, int64_t>;
using VI = vector<int64_t>;
using VVI = vector<VI>;
using VS = vector<string>;
using VP = vector<PII>;
using i64 = int64_t;
template<typename T> void invec(vector<T> &A){for(T& a:A) cin >> a;} 

struct edge {int to, cost;};
template <typename T>bool chmin(T &a, const T& b) {if (a > b) {a = b; return true;} return false;}
// dijjkstra(グラフ、始点)
VI dijkstra(vector<vector<edge>> &G, int s){   
    int V = G.size();
    VI d(V, INF); // d[i] = 頂点 s から i への最短距離
    d[s] = 0;
    // 最悪計算量 O(ElogV) ．0≤E≤O(V²)。全て正の距離の場合．
    priority_queue<PII, VP, greater<PII>> q; //firstは最短距離，secondは頂点番号
    q.emplace(0, s);
    while(!q.empty()){
        PII p = q.top(); q.pop();
        int v = p.second;
        if (d[v] < p.first) continue;
        for (edge e: G[v])
            if (chmin(d[e.to], d[v] + e.cost))
                q.emplace(d[e.to], e.to);
    }
    return d;
}

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

int N, X, Y; cin >> N >> X >> Y;

vector<vector<edge>> G(N+1); //有向グラフ
for(int i = 1; i < N; ++i){
    G[i].push_back(edge{i+1, 1});
    G[i+1].push_back(edge{i, 1});
}
G[X].push_back(edge{Y, 1});
G[Y].push_back(edge{X, 1});

VVI dist(N+1);
rep(i, 1, N) dist[i] = dijkstra(G, i);
VVI dcnt(N+1, VI(N+1, 0));
rep(i, 1, N) rep(j, i+1, N+1) ++dcnt[i][dist[i][j]];

cout << N << "\n";
rep(k, 2, N){
    int cnt = 0;
    rep(v, 1, N){
        cnt += dcnt[v][k];
    }
    cout << cnt << "\n";
}



return 0;
}
// コンテスト前はtemplate振り返り。
// 書いて考える．場合分け．情報整理．
// 問題文から考える。自分ができることから考える。
// 単純に分かる量から．愚直解を実装して研究．
// 境界，出力文字列 チェック．行末にスペース入れない．
// 可読性優先．高速化次点．
// まずは全探索，分割，次にDP(小さい問題から大きな問題)
// 制限を見る．境界に注意．求めたい量の変域．動かせる量．
// 偶奇，逆から，ソート，出現回数，出現位置，DP， 余事象，包除
// データ構造． 問題の特徴量．単調性→二分探索。逆から考える。
// 存在判定：構成方法，入力の特徴
// 構築問題。極端解を試す。
// 例外を十分に含む一般化．想像力の限界
// 小さい系から例示
// 代数的処理．前処理によるクエリ高速化．
// 始めは過剰に例示・場合分けしてもいい．各場合を確実に対処．
// 自明な例から処理，除外．
// 小数のときは，精度の設定する．doubel 変数に数値を入力するときは 123. とする．
// コーナーケース。境界値。数表出力プログラム作る
// 実行エラー：vector添え字超え．0割り．



Measured memory_bytes: 63104
#include <iostream>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <random>
#include <string>
#include <bitset>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <cstring>
#include <cstdlib>
#include <cctype>

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


llong pow(int x, int n){
    llong ans = x;
    if (n == 0) return 1;

    for(int i = 0; i < n - 1; i++) {
        ans *= x;
    }

    return ans;
}


void swap(int *X, int *Y){
    int t = *X; *X = *Y; *Y = t;
}


string toUpper(string s) {
    string t = s;
    REP(i, s.size()) {
        t[i] = toupper(s[i]);
    }
    return t;
}


string toLower(string s) {
    string t = s;
    REP(i, s.size()) {
        t[i] = tolower(s[i]);
    }
    return t;
}

int main() {
    string s;
    llong k;
    cin >> s >> k;
    if (k == 1 || s.size() == 1) {
        cout << s[0] << endl;
        return 0;
    }

    llong cnt = 0;
    int i = 0;
    char tmp;
    while(true) {
        if (s[i] == '1') {
            ++cnt;
            ++i;
        } else {
            tmp = s[i];
            break;
        }
    }

    if (k <= cnt) {
        cout << 1 << endl;
    } else {
        cout << tmp << endl;
    }

    return 0;
}

Measured memory_bytes: 256
/*******************************\
   Name:    REAJUL HAQUE REAYZ  |
   School:  COMILLA UNIVERSITY  |
            CSE (5TH BATCH)     |
********************************/
#include<bits/stdc++.h>
#define pi acos(-1.0)
#define pb push_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define mem(x,y) memset(x , y , sizeof(x))
using namespace std;
typedef long long ll;
typedef pair < int , int > pii;
typedef pair < ll , ll > pll;
const ll MOD = 1000000007;
const int MAX = 100005;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    int d, n;
    cin>>d>>n;
    if(n<100){
        if(d==0) cout<<n<<endl;
        if(d==1) cout<<n<<"00"<<endl;
        if(d==2) cout<<n<<"0000"<<endl;
        return 0;
    }
    if(d==0) cout<<101<<endl;
    if(d==1) cout<<10100<<endl;
    if(d==2) cout<<1010000<<endl;
	return 0;
}


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

int main() {
  int n;
  cin >> n;
  for(int i=1;i<10;i++){
    for(int j=1;j<10;j++){
      if(n==i*j){
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
}


Measured memory_bytes: 3636
#include <iostream>
#include <iomanip>
#include <vector>
#include <valarray>
#include <map>
#include <set>
#include <list>
#include <queue>
#include <stack>
#include <bitset>
#include <utility>
#include <numeric>
#include <algorithm>
#include <functional>
#include <complex>
#include <string>
#include <sstream>

#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cmath>

using namespace std;

#define all(c) c.begin(),c.end()
#define repeat(i,n) for(int i=0;i<static_cast<int>(n);i++)
#define debug(x) #x << "=" << (x)
#define dump(x) cerr << debug(x) << " (L:" << __LINE__ << ")"<< endl

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<string> vs;

template<typename T>
ostream& operator<<(ostream& os, const vector<T>& vec){
    os << "[";
    for(int i = 0; i < vec.size(); i++){
        os << vec[i] << ",";
    }
    os << "]";
    return os;
}

template<typename T>
T input(){
    T t;
    cin >> t;
    return t;
}

template<typename T>
vector<T> input(const int N){
    vector<T> v(N);
    repeat(i,N) cin >> v[i];
    return v;
}

long long gcd(long long a, long long b){
    if(b == 0){
        return a;
    }
    return gcd(b, a % b);
}

long long lcm(long long a, long long b){
    return (a / gcd(a, b)) * b;
}

long long mul(const long long& a, const long long& b, const long long& mod) {
    return ((a % mod) * (b % mod)) % mod;
}

long long power(const long long& x, const long long& y, const long long& mod) {
    if (y == 0) {
        return 1;
    } else if (y == 1) {
        return x % mod;
    } else {
        long long value = power(x, y / 2, mod);
        if (y % 2 == 0) {
            return mul(value, value, mod);
        } else {
            return mul(value, value, mod) * x % mod;
        }
    }
}

long long div(const long long& a, const long long& b, const long long& mod) {
    return mul(a, power(b, mod - 2, mod), mod);
}

map<long long, long long> factorials;
long long factorial(const long long& n, const long long& mod) {
    if (n == 0 || n == 1) {
        return 1;
    }
    if (factorials[n] != 0) {
        return factorials[n];
    }
    factorials[n] = n * factorial(n - 1, mod) % mod;
    return factorials[n] % mod;
}

long long combination(const long long& n, const long long& x, const long long& mod) {
    long long numerator = 1;
    long long denominator = 1;
    repeat(i, x) {
        numerator *= (n - i) % mod;
        numerator %= mod;
        denominator *= (i + 1) % mod;
        denominator %= mod;
    }
    return div(numerator, denominator, mod);
}

int main(){
    int N;
    cin >> N;
    vi position(N);
    repeat (i, N) {
        cin >> position[i];
    }
    sort(position.begin(), position.end());

    int distance = 0;
    repeat(i, N - 1) {
        distance += position[i + 1] - position[i];
    }
    cout << distance << endl;
    return 0;
}


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

int main()
{

	int n,sum=0;
	double ans;
	cin >> n;
	for (int i = 1;i <= n;i++) {
		if (i % 2 == 1) sum++;
	}
	ans = sum / (double)n;
	cout << ans << endl;
		return 0;
}

Measured memory_bytes: 256
def prime_factorizarion(n):
	arr = []
	temp = n
	for i in range(2, int(n**0.5)+1):
		if temp%i==0:
			cnt=0
			while temp%i==0:
				cnt+=1
				temp//=i
			arr.append([i,cnt])
	
	if temp!=1:
		arr.append([temp,1])
	
	if arr==[]:
		arr.append([n,1])
	
	return arr

def modInv(a,mod):
    return pow(a,mod-2,mod)

def nCr(n,r,mod):
    r=min(r,n-r)
    if r==0:
        return 1
    if r==1:
        return n
    numer=1
    denom=1
    for i in range(r):
        numer=(n-i)*numer%mod
        denom=(i+1)*denom%mod
    return numer*modInv(denom,mod)%mod

mod=10**9+7
N,M=map(int,input().split())

if M==1:
    print(1)
    exit()

prime_divisors=prime_factorizarion(M)
ans=1
for prime,num in prime_divisors:
    ans=(ans*nCr(num+N-1,num,mod))%mod
print(ans)

Measured memory_bytes: 3188
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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; }

class union_find {
    private:
        vector<int> par;
        vector<int> ran;
        vector<ll> size;
    public:
        union_find(int n);
        int find(int x);
        void unite(int x, int y);
        bool same(int x, int y);
        ll show_size(int x);
};

union_find::union_find(int n){
    par.resize(n);
    ran.resize(n);
    size.resize(n);
    rep(i,n) par[i] = i;
    rep(i,n) ran[i] = 0;
    rep(i,n) size[i] = 1;
};

int union_find::find(int x) {
    if(par[x] == x) return x;
    else return par[x] = find(par[x]);
};

void union_find::unite(int x, int y) {
    x = find(x);
    y = find(y);
    if(x == y) return;
    ll t = show_size(x)+show_size(y);
    size[x] = size[y] = t;
    if(ran[x] < ran[y]){
        par[x] = y;
        //size[y] += size[x];
    }
    else{
        par[y] = x;
        //size[x] += size[y];
        if(ran[x] == ran[y]) ran[x]++;
    }
};

ll union_find::show_size(int x) {
    if(par[x] == x) return size[x];
    return show_size(par[x] = find(par[x]));
}

bool union_find::same(int x, int y) {
    return (find(x) == find(y));
};

int main(int argc, char const *argv[]) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, q;
	cin >> n >> q;
	union_find uf(n);
	rep(i,q){
		int c, x, y;
		cin >> c >> x >> y;
		if(c) cout << (uf.same(x,y) ? 1 : 0) << endl;
		else uf.unite(x,y);
	}
    return 0;
}



Measured memory_bytes: 3364
#include<iostream>
#include <iomanip>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<tuple>
#include<list>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define INF (1 << 30) - 1
#define LLINF (1LL << 61) - 1
// #define int ll
using namespace std;
const int MOD = 1000000007;
const int MAX = 510000;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    string s,t;
    cin>>n>>s>>t;
    ll dp[60];
    rep(i,60) dp[i]=LLINF;
    if(s[0]==t[0]){
        dp[0]=3;
        rep2(i,1,n+1){
        if(s[i]==t[i] &&  s[i-1]==t[i-1]){
            dp[i]=dp[i-1]*2%MOD;
        }
        else if(s[i]==t[i]){
            dp[i]=dp[i-1];
        }
        else if(s[i-2]==t[i-2]){
            dp[i]=dp[i-2]*2%MOD;
        }
        else{
            dp[i]=dp[i-2]*3%MOD;
        }
    }
    }
    else{
        dp[1]=6;
        rep2(i,2,n+1){
        if(s[i]==t[i] &&  s[i-1]==t[i-1]){
            dp[i]=dp[i-1]*2%MOD;
        }
        else if(s[i]==t[i]){
            dp[i]=dp[i-1];
        }
        else if(s[i-2]==t[i-2]){
            dp[i]=dp[i-2]*2%MOD;
        }
        else{
            dp[i]=dp[i-2]*3%MOD;
        }
    }
    }
    cout<<dp[n-1]<<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);
      
      double H =sc.nextDouble();
      double A =sc.nextDouble();
        
      //切り上げ
      System.out.println((int)Math.ceil(H /A));      
        
    }
}

Measured memory_bytes: 23124
h, w = map(int, input().split())
dat = []
for i in range(h):
    dat.append(input())

def find_black(x,y):
    m_x = [ 0, 1,0,-1]
    m_y = [-1,0,1,0]
    #print("{0},{1}: come".format(x, y))

    for ii in range(len(m_x)):
        nx, ny = (x + m_x[ii]), (y + m_y[ii])
        #print("is black:{0},{1} = # {2},{3}".format(nx, ny, w,h ))
        if (0 <= nx < w) and (0 <= ny < h):
            if dat[ny][nx] == "#":
                #print("YES")
                return True
    return False

c = True
for i in range(h):
    for j in range(w):
        if dat[i][j] == "#":
            #print("{0},{1} = #".format(j, i))
            if find_black(j, i) is False:
                c = False

print("Yes" if c else "No")

Measured memory_bytes: 40796
#include<iostream>
#include<math.h>
#include<algorithm>

typedef long long ll;

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

#define debug(x) cout << #x << "=" << x << endl;

using namespace std;

int main(void){

    int N = log2(10000000000);

    int a[N];

    REP(i,N){
        a[i] = pow(2,i);
    }

    sort(&a[0], &a[N], greater<int>());

    int n;
    cin >> n;
    int arr[n];

    REP(i,n){
        cin >> arr[i];
    }

    int cnt = 0;

    REP(i,n){
        REP(j,N){
            if(a[j] == 1) break;
            if(arr[i] % a[j] == 0) {
                cnt += (int)log2(a[j]);
                break;
            }
        }
    }

    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repf(i,a,b) for (int i = (a); i < (b); i++)
#define repi(i,a,b) for (int i = (a); i <= (b); i++)
#define repr(i,a,b) for (int i = (a); i >= (b); i--)
#define all(x) (x).begin(),(x).end()
#define debug(x)  cout << #x << " = " << (x) << endl;
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<string>;
using tiii = tuple<int, int, int>;

int main() {
  int N, D, X; cin >> N >> D >> X;
  vi A(N); rep(i,N) cin >> A.at(i);
  
  int choco = 0;
  rep(i,N) {
    choco += (D-1)/A.at(i) + 1;
  }
  
  choco += X;
  cout << choco << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args) {
		new Main().execute();
	}

	public void execute() {
		Scanner sc = new Scanner(System.in);
		final String s = sc.next();
		final int K = sc.nextInt();
		
		HashSet<String> subStrings = new HashSet<>();
		for(int i=0; i<s.length(); i++) {
			for(int j=1; j<=K; j++) {
				subStrings.add(s.substring(i, Math.min(i+j, s.length())));
			}
		}
		
		String [] substr = subStrings.toArray(new String[subStrings.size()]);
		Arrays.sort(substr);
		System.out.println(substr[K-1]);
		
		sc.close();
	}

}


Measured memory_bytes: 23380
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner reader = new Scanner(System.in);
		int N = reader.nextInt();
		int[] arr = new int[N];
		for (int i = 0; i < N; i++) {
			arr[i] = reader.nextInt();
		}
		reader.close();
		int tmp = arr[0];
		for (int i = 1; i < N; i++) {
			tmp = gcd(tmp, arr[i]);
		}
		System.out.print(tmp);
	}

	private static int gcd(int x, int y) {

	   if (y > x) {
	   	int tmp = y;
	     y = x;
	     x = tmp;
	   }
	   int next;
	   while ((next = x % y) != 0) {
	     x = y;
	     y = next;

	   }
	   return y;
	 }
}



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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define F first
#define S second
#define vi vector
#define FOR(i,n) for(int i=0;i<n;i++)
#define FORE(i,a,b) for(int i=a;i<=b;i++)
#define FORR(i,a,b) for(int i=a;i>=b;i--)
#define mod 1000000007
#define pb push_back
#define ll long long int
#define db double
#define all(v) v.begin(),v.end()
#define inf 10000000000


using namespace std;

/*

ll expo(ll n){
    ll t;
    if(n==0)return 1;
    else if(n==1) return 2;
    t=expo(n/2);
    if(n%2){
        return t*t*2;
    }
    else return t*t;
}

//ffrom geek for geek
ll exponentMod(ll A, ll B, ll C)  
{  
    if (A == 0)  
        return 0;  
    if (B == 0)  
        return 1;  
    ll y;  
    if (B % 2 == 0) {  
        y = exponentMod(A, B / 2, C);  
        y = (y * y) % C;  
    }  
    else {  
        y = A % C;  
        y = (y * exponentMod(A, B - 1, C) % C) % C;  
    }  
  
    return (ll)((y + C) % C);  
}

*/
/*
class dsu{
public:    
vi<ll> v;


void init(ll n){
    v.assign(n+1,-1);
}

 
ll dsufind(ll x){
    if(v[x]<0){
        return x;
    }
    v[x]=dsufind(v[x]);
    return v[x];
}
 
void dsujoin(ll x,ll y){
    x=dsufind(x);
    y=dsufind(y);
    
    if(x==y)
    return;
    if(v[x]>v[y])swap(x,y);
    v[y]+=v[x];
    v[x]=y;
}

};
*/



int main(){
    IOS;
    ll t;
    t=1;
   //cin>>t;
    while(t--){
      ll a,b,c,d;
      cin>>a>>b>>c>>d;
      cout<<max({a*c,a*d,b*c,b*d});
    }    
    return 0;
} 

Measured memory_bytes: 3648
#include<iostream>
#include<string>

using namespace std;

string S,T;

int main(void) {
    cin>>S>>T;

    for(int i = 0;i < 3;i++) {
        if(S[i] != T[2-i]) {
            cout<<"NO"<<endl;

            return 0;
        }
    }

    cout<<"YES"<<endl;

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
    int n, x, y, b, p, i, wa1, wa2;
    scanf("%d",&n);
    for (i = 1; i <= n; i++) {
        scanf("%d %d %d %d", &x, &y, &b, &p);
        wa1 = x*b + y*p;
        if (b >= 5 && p >= 2) {
            wa1 =4*wa1/5;
        }
        else {
            if (b < 5) {
                b = 5;
            }
            if (p < 2) {
                p = 2;
            }
            wa2 = 4*(x*b + y*p)/5;
        	if (wa1 > wa2) {
            wa1 = wa2;
            
       	 	}	
        }
        	printf("%d\n", wa1);
    	
    }
    return 0;
}

Measured memory_bytes: 600
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<vector>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<numeric>
#include<cctype>
using namespace std;

void sout(string* a, string* b) {
	if (*a > * b) {
		string c = *a;
		*a = *b;
		*b = c;
	}
}
int combination(int n, int k) {
	if (n > k && k > 0) {
		return (combination(n - 1, k) + combination(n - 1, k - 1));
	}
	else
		return 1;
}


int main() {
	int a, b, c, x;
	cin >> a >> b >> c;
	int s = max(a, b);
	s = max(s, c);
	a = abs(s - a);
	b = abs(s - b);
	c = abs(s - c);
	x = (a + b + c) / 2;
	if ((a + b + c) % 2 == 1)
		x += 2;
	cout << x << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
static const int MAX = 100;
static const int INFTY = (1<<21);
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;

int n, M[MAX][MAX];

// プリムのアルゴリズム（厳密解法)
int prim(){ 
    int u,minv;
    int d[MAX],p[MAX],color[MAX];

    for(int i=0;i<n;i++){
        d[i] = INFTY; 
        p[i] = -1;
        color[i] = WHITE;
    }
    d[0] = 0;

    while(1){
        minv = INFTY;
        u = -1;
       // 最適点(コスト最小点)を探す
        for(int i=0;i<n;i++){
            if(minv > d[i] && color[i] != BLACK){
                u = i;
                minv = d[i];
            }
        }
        if(u == -1) break; // uに対しての辺がなかった場合
        color[u] = BLACK;
        
        // 次点の捜索
        for(int v = 0;v<n;v++){
            if(color[v] != BLACK && M[u][v] != INFTY){
                if(d[v] > M[u][v]){
                    d[v] = M[u][v];
                    p[v] = u;
                    color[v] = GRAY;
                }
            }
        }
    }
    int sum =0;
    for(int i=0;i<n;i++){
        if(p[i] != -1) sum +=M[i][p[i]];
    }
    return sum;
} 

int main(){
    cin >> n;

    for(int i=0;i<n;i++){
        for(int j =0;j<n;j++){
            int e; cin >> e;
            M[i][j] = (e== -1) ? INFTY : e;
        }
    }
    cout << prim() << endl;
    return 0;
}



Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> P;

const int MAX_N = 1e5 + 1;
const int MAX_M = 2 * 1e5 + 2;

bool is_checked[MAX_N];
int parent[MAX_N], dist[MAX_N];
vector<P> graph[MAX_N];

bool bfs(int root) {
    queue<P> Q;
    Q.push(P(root, 0));
    while (!Q.empty()) {
        P now = Q.front();
        Q.pop();
        int node = now.first, cost = now.second;
        if (dist[node] == 0) dist[node] = cost;
        else if (dist[node] != cost) {
            return false;
        }
        if (is_checked[node]) continue;
        
        for (int i = 0; i < graph[node].size(); i++) {
            if (is_checked[graph[node][i].first]) {
                if (dist[graph[node][i].first] != graph[node][i].second + cost) {
                    return false;
                }
            }
            else Q.push(P(graph[node][i].first, graph[node][i].second + cost));
        }
        is_checked[node] = true;
    }
    return true;
}

int main() {
    int N, M, L, R, D;
    cin >> N >> M;
    for (int i = 0; i < M; i++) {
        cin >> L >> R >> D;
        parent[R] = L;
        graph[L].push_back(P(R, D));
    }
    for (int i = 1; i <= N; i++) {
        if (parent[i] == 0 && !is_checked[i]) {
            if (!bfs(i)) {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    for (int i = 1; i <= N; i++) {
        if (!is_checked[i]) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


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

int main() {
	vector<int>a(3, 0);
	for (int i = 0, tmp; i < 2; i++) {
		cin >> tmp; tmp--; a[tmp]++;
	}
	for (int i = 0; i < 3; i++) {
		if (a[i] == 0)cout << i + 1 << endl;
	}

	return 0;
}

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

using namespace std;

struct Job {
    int days, payment;
    friend istream& operator>>(istream& in, Job& job) {
        in >> job.days >> job.payment;
        return in;
    }
    bool operator<(const Job& o) const {
        return days < o.days;
    }
};

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    vector<Job> jobs(n);
    for (Job& job : jobs) {
        cin >> job;
    }
    sort(jobs.begin(), jobs.end());
    long long sum = 0;
    multiset<int> payments;
    auto it = jobs.begin();
    for (int i = 1; i <= m; ++i) {
        while (it != jobs.end() && it->days <= i) {
            payments.insert(it->payment);
            ++it;
        }
        if (!payments.empty()) {
            int payment = *payments.rbegin();
            payments.erase(payments.find(payment));
            sum += payment;
        }
    }
    cout << sum << endl;
    return 0;
}


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

a = [int(x) for x in input().split()]

baisuu=[0]*(10**6+1)

for i in a:
	if baisuu[i]>=1:
		baisuu[i]=2
		continue

	for j in range(i,10**6+1,i):
		baisuu[j]+=1

ans=0

for i in a:
	if baisuu[i]==1:
		ans+=1

print(ans)

Measured memory_bytes: 31996
N, M = list(map(int, input().split()))
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]

for oh in range(N-M+1):
    for ow in range(N-M+1):
        match = True
        for ih in range(M):
            for iw in range(M):
                if A[oh+ih][ow+iw]!=B[ih][iw]:
                    match = False
                    break
            if not match: break
        if match:
            print('Yes')
            exit()
print('No')

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define rep(i,n) for(int i=0;i<n;i++)
#define mod 1000000007 // 10^9+7
#define INF 99999999999 //10^12-1
#define dev 998244353 //tenka1
#define P pair<int,int>
#define F first
#define S second
int n,cnt=0;
int a[200000],b[200000];
signed main(){
    cin>>n;
    rep(i,n+1)cin>>a[i];
    rep(i,n)cin>>b[i];
    rep(i,n){
        if(a[i]>b[i]){
            cnt+=b[i];
            b[i]=0;
            continue;
        }
        else if(a[i]>0){
            cnt+=a[i];
            b[i]-=a[i];
            int p=min(a[i+1],b[i]);
            a[i+1]-=b[i];
            cnt+=p;
        }
        else{
            int p=min(a[i+1],b[i]);
            a[i+1]-=b[i];
            cnt+=p;
        }
    }
    cout<<cnt<<endl;
    return 0;
}


Measured memory_bytes: 1792
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int a = in.nextInt();
        int b = in.nextInt();
        int c = in.nextInt();
        int d = in.nextInt();
        int e = in.nextInt();
        int f = in.nextInt();

        boolean water[] = new boolean[3001];
        Arrays.fill(water, false);
        water[0] = true;
        int wi = 0;
        while (wi <= 3000) {
            if (water[wi] == false) {
                wi++;
                continue;
            }

            if (wi + 100 * a <= 3000) {
                water[wi + 100 * a] = true;
            }
            if (wi + 100 * b <= 3000) {
                water[wi + 100 * b] = true;
            }

            wi++;
        }

        boolean sugur[] = new boolean[3001];
        Arrays.fill(sugur, false);
        sugur[0] = true;
        int si = 0;
        while (si <= 3000) {
            if (sugur[si] == false) {
                si++;
                continue;
            }

            if (si + c <= 3000) {
                sugur[si + c] = true;
            }
            if (si + d <= 3000) {
                sugur[si + d] = true;
            }
            
            si++;
        }

        double max = -1;
        int maxw = 0;
        int maxs = 0;
        for (int i = 0; i <= 3000; i++) {
            for (int j = 0; j <= 3000; j++) {
                if (water[i] && sugur[j]) {
                    double concentration = (double)j / ((double)i + j);
                    if (concentration > max && i / 100 * e >= j && i + j <= f) {
                        max = concentration;
                        maxw = i;
                        maxs = j;
                    }
                }
            }
        }
        System.out.println((maxw + maxs) + " " + maxs);
    }
}

Measured memory_bytes: 38628
package main

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

func main() {
	n := readInt64()
	k := int(readInt64())
	a := readInt64Slice(n)

	for i := 0; i < k; i++ {

		b := make([]int64, n+1)
		for j := int64(0); j < n; j++ {
			l := max(0, j-a[j])
			r := min(n, j+a[j]+1)
			b[l]++
			b[r]--
		}

		for j := int64(0); j < n; j++ {
			if j == 0 {
				continue
			}
			b[j] += b[j-1]
		}

		// if reflect.DeepEqual(a, b[0:n]) {
		// 	break
		// }

		a = b[0:n]

		count := int64(0)
		for _, v := range a {
			if v != n {
				break
			}
			count++
		}

		if count == n {
			break
		}

	}

	s := fmt.Sprint(a)
	fmt.Println(string([]rune(s)[1 : len(s)-1]))

}

var (
	scanner *bufio.Scanner
)

func init() {
	scanner = bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
}

func readInt64() int64 {
	var t string

	if scanner.Scan() {
		t = scanner.Text()
	}

	n, err := strconv.ParseInt(t, 10, 64)
	if err != nil {
		log.Fatal(err)
	}

	return n

}

func readInt64Slice(n int64) []int64 {
	s := make([]int64, n)
	var t string

	for i := 0; i < int(n); i++ {
		if scanner.Scan() {
			t = scanner.Text()
		}

		num, err := strconv.ParseInt(t, 10, 64)
		if err != nil {
			log.Fatal(err)
		}
		s[i] = num
	}

	return s
}

func max(x, y int64) int64 {
	if x > y {
		return x
	}
	return y
}

func min(x, y int64) int64 {
	if x < y {
		return x
	}
	return y
}


Measured memory_bytes: 18032
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007
#define MOD 1000000007
#define EPS 1e-10
#define MAX_N 100100
#define MAX_M 100100

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;
typedef pair<P, char> PC;
typedef pair<ll, string> PLS;

ll n, l;
ll a[100100];

ll sum[100100];

int main(){
	ll ans = 0;
	cin >> n >> l;
	REP(i, n)cin >> a[i];
	ll pos = 0;
	REP(i, n){
		if (i == n - 1){
			if (a[i] < a[i - 1]){
				sum[i] = sum[i - 1] + l - a[i];
				ans = max(ans, sum[i]);
			}
			else{
				for (int j = i; j >= pos; j--){
					sum[j] = l - a[j];
					if (j != i){
						if (j == pos&&pos != 0){
							sum[j] += max(sum[j + 1], sum[j - 1]);
						}
						else sum[j] += sum[j + 1];
						if (j == pos)ans = max(ans, sum[j]);
					}
				}
			}
		}
		else{
			if (a[i] > a[i + 1]){
				for (int j = i; j >= pos; j--){
					sum[j] = l - a[j];
					if (j == pos&&pos != 0){
						sum[j] += max(sum[j + 1], sum[j - 1]);
					}
					else if (j != i)sum[j] += sum[j + 1];
					if (j == pos)ans = max(ans, sum[j]);
				}
				pos = i + 1;
			}
		}
	}
	//REP(i, n){
	//	cout << sum[i] << endl;
	//}
	cout << ans << endl;
}

Measured memory_bytes: 4656
#include <algorithm>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <set>
#include <stdio.h>
#include <string>
#include <utility>
#include <vector>

using namespace std;

int main() {
  long long n, m;
  cin >> n >> m;
  long long ans;
  if (n > 1 && m > 1) {
    ans = (m - 2) * (n - 2);
  }
  if (n == m && n == 1) {
    ans = 1;
  }
  if (n == 1 && m > 1) {
    ans = m - 2;
  }
  if (m == 1 && n > 1) {
    ans = n - 2;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
//#define f first
#define s second
#define int long long
#define vi vector<int>
#define pi pair<int,int>
const int mod = (int)1e9+7;
const int N = (int)1e5+7;

int32_t main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;
   // cin >> t;
    int c = 1;
    while(t--)
    {
      double a;
      cin >> a;
      cout<<fixed<<setprecision(8);
          cout<<(((int)a+1)/2)/a<<"\n";
     
    }  
 
}


Measured memory_bytes: 256
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    void solve(Scanner sc, PrintWriter pw) {
        int N = sc.nextInt();
        int[] sticks = new int[N];
        for (int i = 0; i < N; i++) {
            sticks[i] = sc.nextInt();
        }
        Arrays.sort(sticks);
        int result = 0;
        for (int i = 0; i < N; i++) {
            for (int j = i + 1 ; j < N; j++) {
                for (int k = j + 1; k < N; k++) {
                    if (sticks[i] == sticks[j] || sticks[j] == sticks[k]) {
                        continue;
                    }
                    if (sticks[i] + sticks[j] > sticks[k])  {
                        result++;
                    }
                }
            }
        }
        pw.println(result);
    }
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        new Main().solve(sc, pw);
        pw.flush();
        pw.close();
        sc.close();
    }
}


Measured memory_bytes: 36476
#include<iostream>
#include<climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;


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

	int N, M;
	cin >> N >> M;
	vector<set<int>> st(N + 1);
	REP(i, M) {
		int a, b;
		cin >> a >> b;
		st[a].insert(b);
		st[b].insert(a);
	}
	for (auto it = st[1].begin();it != st[1].end();it++) {
		if (st[N].find(*it) != st[N].end()) {
			cout << "POSSIBLE\n";
			return 0;
		}
	}
	cout << "IMPOSSIBLE\n";

	return 0;
}

Measured memory_bytes: 28416
// inputに入力データ全体が入る
  function Main(input) {
  	// 1行目がinput[0], 2行目がinput[1], …に入る
  	input = input.split(" ");
    var maxNum = [];
    
    maxNum.push(parseInt(input[0]) + parseInt(input[1]));
    maxNum.push(parseInt(input[0]) - parseInt(input[1]));
    maxNum.push(parseInt(input[0]) * parseInt(input[1]));
    
    console.log(maxNum.reduce((a,b)=>a>b?a:b));
  }
  //*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
  Main(require("fs").readFileSync("/dev/stdin", "utf8"));


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

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

    int len = s.size();
    int z = 0;
    int i = 0;
    while(z==0 && i<len) {
        if(i%2==1 && s.at(i)=='R') z++;
        else if(i%2==0 && s.at(i)=='L') z++;

        i++;
    }
    if(z==0) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

    return 0;
}

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

int main(){
  int dice[6],i,dif[6],len;
  string str;
  /********サイコロの目の入力*********/
  for(i = 0 ; i < 6 ; i++)
    {
      cin >> dice[i];
    }
  cin >> str;
  len = str.size();
  for ( int j = 0 ; j < len ; j++){
    if(str[j] == 'S')
      {
	dif[0] = dice[4];
	dif[1] = dice[0];
	dif[2] = dice[2];
	dif[3] = dice[3];
	dif[4] = dice[5];
	dif[5] = dice[1];
      }
    else if (str[j] == 'W')
      {
	dif[0] = dice[2];
	dif[1] = dice[1];
	dif[2] = dice[5];
	dif[3] = dice[0];
	dif[4] = dice[4];
	dif[5] = dice[3];
      }
    else if(str[j] == 'E')
      {
	dif[0] = dice[3];
	dif[1] = dice[1];
	dif[2] = dice[0];
	dif[3] = dice[5];
	dif[4] = dice[4];
	dif[5] = dice[2];
      }
    else if (str[j] == 'N')
      {
	dif[0] = dice[1];
	dif[1] = dice[5];
	dif[2] = dice[2];
	dif[3] = dice[3];
	dif[4] = dice[0];
	dif[5] = dice[4];
      }
    
    for( i = 0 ; i < 6 ; i++)
      {
	dice[i] = dif[i];
      }
  }
  cout << dice[0] << endl;
  return 0;
}

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

    int main (){
    string s;
    cin >> s;
    int cunt=0;
  for(int i=1;i<s.size();i++){
        if(s[i]==s[i-1]){
            if(s[i]=='0'){
                s[i]='1';
            }
            else{
                s[i]='0';
            }
        cunt++;
        }
    }
        cout << cunt << endl;
        return 0;
    }

Measured memory_bytes: 3736
#include<stdio.h>
int main()
{
	char c;
	long long a, b;
	while(~scanf("%lld %c %lld", &a, &c, &b))
	{
		if(c == '+') printf("%lld\n", a+b);
		else printf("%lld\n", a-b);
	}
	
	return 0;
}

Measured memory_bytes: 128
#include <iostream>

using namespace std;

int zettaiti(int x) {
	if (x < 0) return -x;
	else return x;
}

int main() {
	int a[5], k;
	bool flg = true;

	cin >>a[0] >> a[1] >> a[2] >> a[3] >> a[4]>>k;

	for (int i = 0; i < 5; i++) {
		for (int j = 0; j < 5; j++) {
			if (zettaiti(a[j] - a[i]) > k) {
				flg = false;
				break;
			}
		}
		if(!flg) flg = false;
	}

	if (flg) cout << "Yay!";
	else cout << ":(";
	
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main(){
  int s;
  cin >> s;
  vector<int> a(1000000);
  a[1] = s;
  int i = 1;
  int j;
  while(1){
    if(a[i]%2==0) a[i+1]=a[i]/2;
    else a[i+1]=3*a[i]+1;
    i++;
    for(j=1;j<i;j++){
      if(a[j] == a[i]){
        cout << i << "\n";
        return 0;
      }
    }
  }
}

Measured memory_bytes: 4096
n = int(input())
if n == 1:
    print(1)
else:
    L = [None] * 100
    L[0] = 2
    L[1] = 1
    for i in range(2, 87):
        L[i] = L[i-1] + L[i-2]
        if i == n: 
            print(L[i])
            exit()

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main{

	    public static void main(String[] args){
	        Scanner scan = new Scanner(System.in);
	        int n = scan.nextInt();
	        int m = scan.nextInt();
	        int l = scan.nextInt();
	        long[][] array_A = new long[n][m];
	        long[][] array_B = new long[m][l];
	        long[][] array_C = new long[n][l];

	        for(int i=0; i<n; i++){
	            for(int j=0; j<m; j++){
	                array_A[i][j] = scan.nextInt();
	            }
	        }

	        for(int i=0; i<m; i++){
	            for(int j=0; j<l; j++){
	                array_B[i][j] = scan.nextInt();
	            }
	        }

	        for(int i = 0; i<n; i++){
	            for(int j=0; j<l; j++){
	                for(int k = 0; k<m; k++){
	                    array_C[i][j] += array_A[i][k]*array_B[k][j];
	                }
	            }
	        }

	        for(int i = 0; i<n; i++){
	            System.out.print(array_C[i][0]);
	            for(int j=1;j<l;j++){
	                System.out.print(" "+array_C[i][j]);
	        }
	        System.out.println();
	        }

	    }
	}

Measured memory_bytes: 53864
import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def main(N, M, K, X, A):
    def compute_perm(A):
        P = np.arange(N - 1)
        for i in A:
            P[i - 2], P[i - 1] = P[i - 1], P[i - 2]
        return P

    def power(P, K):
        Q = P.copy()
        x = np.arange(len(P), dtype=np.int32)
        while K:
            if K & 1:
                x = x[Q]
            Q = Q[Q]
            K >>= 1
        return x

    P = compute_perm(A)
    P = power(P, K)
    D = X[1:] - X[:-1]
    D = D[P]
    ret = np.zeros(N, np.int64)
    ret[0] = X[0]
    ret[1:] = np.cumsum(D) + X[0]
    return ret

signature = '(i8,i8,i8,i8[:],i4[:])'
if sys.argv[-1] == 'ONLINE_JUDGE':
    from numba.pycc import CC
    cc = CC('my_module')
    cc.export('main', signature)(main)
    cc.compile()

from my_module import main

N = int(readline())
X = np.array(readline().split(), np.int64)
M, K = map(int, readline().split())
A = np.array(readline().split(), np.int32)

x = main(N, M, K, X, A)
print('\n'.join(map(str, x.tolist())))

Measured memory_bytes: 40184
//Littleboy123 Template 1.6
#include <bits/stdc++.h>
using namespace std;

//pragmas
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
*/

typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;

const long double pi = acos(-1.0);

#define FOR(a,b,c) for(ll (a)=(b);(a)<(c);++(a))
#define FORE(a,b,c) for(ll (a)=(b);(a)<=(c);++(a))
#define FORN(a,b,c) for(ll (a)=(b);(a)>(c);--(a))
#define FORNE(a,b,c) for(ll (a)=(b);(a)>=(c);--(a))
#define COUT(n) printf("%d\n", (n))
#define COUTLL(n) printf("%lld\n", (n))
#define CIN(n) scanf("%d", &(n))
#define CINLL(n) scanf("%lld", &(n))
#define MEM(a,b) memset((a), (b), sizeof((a)))
#define MAX(a,b) (a) = max((a), (b))
#define MIN(a,b) (a) = min((a), (b))
#define nl '\n'
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back

void init(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
}

void infile(){
	freopen("input.in", "r", stdin);
}

void outfile(){
	freopen("output.out", "w", stdout);
}

ll modex(ll a, ll b, ll mod){
	if(b == 0)
		return 1;
	if(b == 1)
		return a;
	ll tmp = modex(a, b/2, mod);
	tmp = (tmp * tmp) % mod;
	if(b & 1)
		tmp = (tmp * a) % mod;
	return tmp;
}

//End of template

int n, k;
ll arr[100005];
ll memo[100005];

ll dp(int pos){
	if(pos == n-1){
		return 0;
	}
	if(memo[pos] != -1){
		return memo[pos];
	}
	ll ans = INT_MAX;
	FOR(i, pos+1, min(pos+k+1, n)){
		ans = min(ans, abs(arr[i]-arr[pos]) + dp(i));
	}
	return memo[pos] = ans;
}

int main(){
	init();

	cin >> n >> k;
	MEM(memo, -1);
	FOR(i, 0, n){
		cin >> arr[i];
	}
	cout << dp(0) << nl;
	return 0;	
}

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

int main(){
    string s;
    cin >> s;
    int memo1, memo2;
    for(int i = 0;i < s.size();i++){
        if(s.at(i) == 'A'){
            memo1 = i;
            break;
        }
    }
    for(int i = s.size() - 1;i > -1;i--){
        if(s.at(i) == 'Z'){
            memo2 = i;
            break;
        }
    }
    cout << memo2 - memo1 + 1 << endl;
}

Measured memory_bytes: 640