akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

vector<vector<int>> field(500, vector<int>(500, 0));

pair<int, int> origin = {0, 0};  // y, x

vector<int> solve(int T, int P) {
    int d, c;
    for (int r = 0; r < T; r++) {
        cin >> d >> c;
        if (d == 1) {  // 左右に折る
            for (int i = 0; i < c; i++) {
                int j = origin.first;
                while (field[j][origin.second + c - i - 1] >= 1) {
                    field[j][origin.second + i + c] += field[j][origin.second + c - i - 1];
                    field[j][origin.second + c - i - 1] = 0;
                    j++;
                }
            }
            origin.second += c;
        } else {  //上下に折る
            for (int i = 0; i < c; i++) {
                int j = origin.second;
                while (field[origin.first + c - i - 1][j] >= 1) {
                    field[origin.first + i + c][j] += field[origin.first + c - i - 1][j];
                    field[origin.first + c - i - 1][j] = 0;
                    j++;
                }
            }
            origin.first += c;
        }
    }

    int x, y;
    vector<int> ret;
    for (int r = 0; r < P; r++) {
        cin >> x >> y;
        ret.push_back(field[origin.first + y][origin.second + x]);
    }
    return ret;
}

int main() {
    int n, m, t, p;
    while (1) {
        for (int i = 0; i < field.size(); i++) {
            for (int j = 0; j < field[i].size(); j++) {
                field[i][j] = 0;
            }
        }
        origin.first = 0;
        origin.second = 0;
        cin >> n >> m >> t >> p;
        if (!n & !m & !t & !p) break;
        for (int i = 0; i < m; i++) {
            for (int j = 0; j < n; j++) {
                field[i][j] = 1;
            }
        }
        vector<int> ans = solve(t, p);
        for (auto &i : ans) {
            cout << i << endl;
        }
    }
}


Measured memory_bytes: 3704
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

int query(int x) {
	cout << x << endl;
	string s;
	cin >> s;
	if (s == "Vacant") {
		exit(0);
	}
	return s == "Male";
}

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);	

	int n;
	cin >> n;
	int t = query(0);
	int l = 0;
	int r = n;
	while (r - l > 1) {
		int m = (r + l) >> 1;
		if (query(m) ^ (m & 1) ^ t) {
			r = m;
		} else {
			l = m;
		}
	}
	assert(false);
}


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

double oddsequence(double a) {
  return a / 3.0;
}

double evensequence(double a) {
  return a * 2.0;
}

int main() {
  double a[11] = {0};
  double sum;
  while (cin >> a[1]) {
    for(int i=1;i<10;i++) {
      if((i + 2) % 2 == 0) { //i = even
        a[i+1] = oddsequence(a[i]);
      }
      else { //i = odd
        a[i+1] = evensequence(a[i]);
      }
    }
    for(int i=1;i<11;i++) {
      sum += a[i];
    }
    printf("%.8lf\n",sum);
    sum = 0;
  }
}

Measured memory_bytes: 0
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>
// #include <fstream>
#define int long long int
#define mod(x) ((x % MOD) + MOD) % MOD
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);--i)

#define ALL(c) (c).begin(),(c).end()
#define SIZE(c) (int)((c).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define SORT(c) sort(ALL(c))
#define LB(c,x) lower_bound(ALL(c),x)-(c).begin()
#define UB(c,x) upper_bound(ALL(c),x)-(c).begin()
#define COUNT(c,x) (int)(UB(c,x)-LB(c,x))
#define EXIST(s,e) (s).find(e)!=(s).end()

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

using namespace std;

typedef pair<int,int> P;
struct edge {
  int to, cost;
};

const int INF = 1e18;
const int MOD = 1e9+7;

template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i]; if (i < len - 1) s << " ";
  }
  return s;
}

int init_len(vector<int>& len, const string& str)
{
  int k = 0;
  set<char> st;
  rrep(i, 0, SIZE(str)) {
    st.insert(str[i]);
    if (SIZE(st) == 26) {
      k++;
      st.clear();
    }
    len[i] = k;
  }
  return k;
}


signed main()
{
  // string filename; cin >> filename;
  // ifstream in(filename);
  // cin.rdbuf(in.rdbuf());

  string A; cin >> A;

  vector<int> len(SIZE(A));
  int k = init_len(len, A);

  vector< vector<int> > p(26, vector<int>());
  rep(i, 0, SIZE(A)) {
    p[A[i]-'a'].push_back(i);
  }

  int now = 0;
  string ans = "";
  rep(i, 0, k+1) {
    debug(i)
    rep(c, 0, 26) {
      int lb = LB(p[c],now);
      if (lb == SIZE(p[c])) {
        ans += c + 'a';
        break;
      }
      int idx = p[c][lb];
      if (len[idx+1] + 1 == k - i) {
        ans += c + 'a';
        now = idx + 1;
        break;
      }
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3972
A, B, C, D = [int(x) for x in input().split()]

if B <=  C or D <= A:
    print(0)
elif A <= C and B <= D:
    print(B - C)
elif C <= A and D <= B:
    print(D - A)
elif C <= A and B <= D:
    print(B - A)
elif A <= C and D <= B:
    print(D - C)


Measured memory_bytes: 3060
// #define _CRT_SECURE_NO_WARNINGS
// #define _USE_MATH_DEFINES	// M_PI=3.1415...
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
#include <iomanip>	// 20桁出力 cout << setprecision(20) << double;
#include <queue>
#include <bitset>	// bitset<8> bs1(131uL); // 10000011 bs1[0]は1 01stringからビット集合生成可
#include <numeric>
#include <random>
#include <climits>  // A/Bを計算するときA==LLONG_MIN && B==-1のみ(1ull<<63)で代用
using namespace std;

typedef long long LL;
typedef pair<LL, LL> P;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VL;
typedef vector<VL> VVL;				// VVL v(100,VL(100,0));
typedef vector<pair<LL, LL> > VP;
typedef vector<string> VS;
typedef map<int, int> MAPII;
typedef multimap<int, char, greater<int> > MuMAPIC;
typedef multimap<int, string, greater<int> > MuMIS;
typedef pair<LL, pair<P, P> > PP;

#define INF 999999999999999997		// 少し加算したらオーバーフローする
#define MP make_pair
#define FAST_IO  cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(LL i=(a);i<(b);i++)
#define FOR_REV(i,a,b) for(int i=(a);i>=(b);i--)
#define FOR_ITR(d) for(auto itr=d.begin(),d_end=d.end();itr!=d_end;++itr)	// C++11
#define O(s) cout<<s<<endl;
#define SORTVL(v) sort(v.begin(), v.end());
#define SORTVL_GR(v) sort(v.begin(), v.end(), greater<LL>());

#define DUMP_VVI(b) if(dbgF){FOR(i,0,b.size()){FOR(j,0,b[i].size())printf("%d ",b[i][j]);puts("");}}
#define D_OUT(str,value) if(dbgF){cout<<str<<" : "<<value<<endl;}

template<class T>T IN() { T d; cin >> d; return d; }

LL gcd(LL a, LL b) { return (b > 0) ? gcd(b, a % b) : a; } // 最大公約数（Greatest Common Divisor）
LL lcm(LL a, LL b) { return a / gcd(a, b) * b; } // 最小公倍数（Least Common Multiple）
bool uruu(LL Y) { return (((Y % 4 == 0 && Y % 100 != 0) || Y % 400 == 0) ? true : false); } // うるう年判定
string Replace(string S, string from, string to) { auto p = S.find(from); while (p != string::npos) { S.replace(p, from.size(), to); p = S.find(from, p + to.size()); }return S; }
// 桁和
LL Ketawa_s(string s) { LL a = 0; FOR(i, 0, s.length())a += s[i] - '0'; return a; }
// 末尾数字で切り上げ
LL CeilLastNumber(LL n) { return ((n + (10 - 1)) / 10) * 10; }
//二項係数 nCk mod pを求める
const LL MAX = 510000, p = 998244353; LL fac[MAX], finv[MAX], inv[MAX];
/* 前処理 */void COM_init() { fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; FOR(i, 2, MAX) { fac[i] = fac[i - 1] * i % p; inv[i] = p - inv[p % i] * (p / i) % p; finv[i] = finv[i - 1] * inv[i] % p; } }
/* 主処理 */LL COM(int n, int k) { if (n < k) return 0; if (n < 0 || k < 0) return 0; return fac[n] * (finv[k] * finv[n - k] % p) % p; }

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

// -------------------------------------------------------------------------------

int main() {
	FAST_IO;
	bool dbgF = true; // for D_OUT(str, value)  ... cout<< str <<" : "<< value <<endl;

	LL N, R;
	cin >> N >> R;

	if (N > 10) {
		O(R);
	}
	else {
		O(R + 100 * (10 - N));
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MOD = pow(10, 9) + 7;
//const int MOD = 998244353;
//const int MOD = ;
int mod(int A, int M) {return (A % M + M) % M;}
const int INF = 1LL << 60;
template <class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template <class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
int divCeil(int A, int B) {return (A + (B - 1)) / B;}
int myctoi(char C) {return C - 48;}
char myitoc(int N) {return '0' + N;}

signed main()
{
  string S;
  cin >> S;
  int N = S.size();

  int ans = 0;
  for (int i = 0, j = N - 1; i < j; )
  {
    if (S.at(i) == S.at(j))
    {
      i++; j--;
      continue;
    }
    if (S.at(i) == 'x')
    {
      i++;
      ans++;
      continue;
    }
    if (S.at(j) == 'x')
    {
      j--;
      ans++;
      continue;
    }
    
    ans = -1;
    break;
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 512
/* it was worth becoming a chemist */
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef double db;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef pair<int, long long> pil;
typedef vector<int> vi;
typedef vector<long long> vll;

#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)x.size()
#define NAME "puts"
#define F first
#define S second

const db EPS = (db) 1e-9;
const int inf = 1e9;
const ll INF = (ll)1e18;
const int mod = 1e6 + 3;
const int MAXN = 1e5 + 5;

int n;
vi g[MAXN];
int res;
map<pair<int, int>, int> col;
set<int> s;
int a[MAXN], b[MAXN];

void dfs(int v, int p) {
	int ct = 0;
	for (auto to : g[v]) {
		if (to == p) continue;
		col[mp(v, to)] = ++ct;
		col[mp(to, v)] = ct;
		if (ct == col[mp(p, v)]) {
			col[mp(v, to)] = ++ct;
			col[mp(to, v)]= ct;
		}
		s.insert(col[mp(v, to)]);
		dfs(to, v);
	}
}

int main() {
	//freopen(NAME".in", "r", stdin);
	//freopen(NAME".out", "w", stdout);


	ios_base::sync_with_stdio(0);
	cin.tie(0);            	
	cout.tie(0);
	//~ cout << setprecision(6) << fixed;

	cin >> n;
	for (int i = 1; i < n; i++) {
		cin >> a[i] >> b[i];
		g[a[i]].pb(b[i]);
		g[b[i]].pb(a[i]);
	}
	dfs(1, 0);
	cout << sz(s) << '\n';
	for (int i = 1; i < n; i++) {
		cout << col[mp(a[i], b[i])] << '\n';
	}
	return 0;	
}    


Measured memory_bytes: 20480
import math
import sys

m=10**9 + 7 
sys.setrecursionlimit(1000010)
N=int(input())
A = list(map(int,input().split()))
# print(N,A)

next = 1
for x in A:
    if x == next:
        next = next +1 

if next == 1:
    print(-1)
else:
    print(N - next + 1)

Measured memory_bytes: 26140
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef queue<ll> ql;
typedef deque<ll> dql;
typedef priority_queue<ll/*, vl, greater<ll>*/> pql; //降順(/*昇順*/)
typedef set<ll> sl;
typedef pair<ll, ll> pl;
typedef vector<vl> vvl;
typedef vector<pl> vpl;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define rep2(i, n) for(ll i = 1; i <= ll(n); i++)
//#define rep(i, k, n) for(ll i = k-1; i < ll(n); i++)
//#define rep2(i, k, n) for(ll i = k; i <= ll(n); i++)
#define all(v) (v).begin(), (v).end()
bool chmin(ll &a, ll b) {if(b < a) {a = b; return 1;} return 0;}
bool chmax(ll &a, ll b) {if(b > a) {a = b; return 1;} return 0;}
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
const ll MAX = 1e9;
const char newl = '\n';

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

  ll n, num, ans=1;
  cin >> n;
  rep(_, n) {
    cin >> num;
    ans = lcm(ans,num);
  }
  cout << ans << newl;
  return 0;
}

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

int main() {
  int N;
  int i=0;
  string color;
  
  cin >> N;
  for(i=0;i<N;i++){
    cin >> color;
    if(color == "Y"){
      cout << "Four";
      break;
    }
  }
  if(i==N) cout << "Three";
}
  


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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,M=0; cin >> N;
    map<string,int> m;
    for (int i=0;i<N;++i){
        string S; cin >> S;
        ++m[S]; M=max(M,m[S]);
    }
    for (auto x:m) if (x.second==M){
        cout << x.first << endl;
    }
}

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

#define fs first
#define sc second
#define pb emplace_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

const int32_t inf = 1001001001;
const int64_t infll = 1001001001001001001ll;
const int dx[] = {0, -1, 1, 0, -1, 1, -1, 1}, dy[] = {-1, 0, 0, 1, -1, -1, 1, 1};

template <typename T> using vector2d = vector<vector<T>>;

// clang-format off
template <typename T> void sort(vector<T> &v) { sort(all(v)); }
ostream &operator<<(ostream &os, __int128_t value) { if (ostream::sentry(os)) { __uint128_t tmp = value < 0 ? -value : value; char buffer[64]; char *d = end(buffer); do { --d; *d = "0123456789"[tmp % 10]; tmp /= 10; } while (tmp != 0); if (value < 0) { --d; *d = '-'; } int len = end(buffer) - d; if (os.rdbuf()->sputn(d, len) != len) { os.setstate(ios_base::badbit); }} return os; }
istream &operator>>(istream &is, __int128_t &value) { string in; is >> in; value = 0; for (const char &c : in) { if ('0' <= c && c <= '9') value = 10 * value + (c - '0'); } if (in[0] == '-') value *= -1; return is; }
ostream &operator<<(ostream &os, __uint128_t value) { if (ostream::sentry(os)) { char buffer[64]; char *d = end(buffer); do { --d; *d = "0123456789"[value % 10]; value /= 10; } while (value != 0); int len = end(buffer) - d; if (os.rdbuf()->sputn(d, len) != len) { os.setstate(ios_base::badbit); }} return os; }
istream &operator>>(istream &is, __uint128_t &value) { string in; is >> in; value = 0; for (const char &c : in) { if ('0' <= c && c <= '9') value = 10 * value + (c - '0'); } return is; }
template <typename T> ostream &operator<<(ostream &os, vector<T> &v) { os << v[0]; for (int i = 1; i < v.size(); ++i) os << " " << v[i]; return os; }
template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &in : v) is >> in; return is; }
template <typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p) { os << p.fs << " " << p.sc; return os; }
template <typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.fs >> p.sc; return is; }

struct IoSetup { IoSetup(){ cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); cerr << fixed << setprecision(10); } } iosetup;

inline int64_t in() { int64_t x = 0; cin >> x; return x; }
template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
// clang-format on

int64_t gcd(int64_t a, int64_t b) {
  return b == 0 ? a : gcd(b, a % b);
}

signed main(int argc, char *argv[]) {
  int n = in(), k = in();
  vector<int> a(n);
  cin >> a;

  int GCD = a[0];
  for (auto i : a) GCD = gcd(GCD, i);

  for (int i = 0; i < n; ++i) {
    if (a[i] < k) continue;
    if ((a[i] - k) % GCD == 0) {
      cout << "POSSIBLE" << endl;
      return 0;
    }
  }

  cout << "IMPOSSIBLE" << endl;
}


Measured memory_bytes: 640
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void){
	long n, a, b;
	long ans;
	scanf("%ld%ld%ld", &n, &a, &b);
	if(a%2 == b%2){
		ans = (b-a)/2;
	}else{
		ans = a-1<n-b?a-1:n-b;
		ans += (b-a+1)/2;
	}
	printf("%ld\n", ans);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
						
#define fast_cin() ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define endl '\n'
#define int long long
				
int32_t main() {
	fast_cin();  
	string s, t;
	cin >> s >> t;
	int n = s.size(), m = t.size();
	int ans = n;
	for (int i = 0; i + m - 1 < n; ++i) {
		string now = s.substr(i, m);
		int cost = 0;
		for (int j = 0; j < m; ++j) {
			cost += (t[j] != now[j]);
		}
		ans = min(ans, cost);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3620
#include<iostream>
#include <string> 
#include <math.h> 
using namespace std;

int main()
{
	int n;
	int k;
	char s[100100];
	int ans = 0;

	cin >> n >> k;
	cin >> s;

	for (int i = 0; i < n; i++) {
		if (s[i] == s[i+1]) {
			ans = ans + 1;
		}
	}

	if (ans + 2 * k < n - 1) {
		ans = ans + 2 * k;
	}
	else {
		ans = n - 1;
	}

	cout << ans;
}

Measured memory_bytes: 888
n = int(input())
*x, = map(int, input().split())
*y, = map(int, input().split())

abs_xy = [abs(i-j) for i,j in zip(x,y)]

print(sum(abs_xy))
print((sum(d**2 for d in abs_xy)) ** 0.5)
print((sum(d**3 for d in abs_xy)) ** (1/3))
print(max(abs_xy))


Measured memory_bytes: 5648
#include <cstdio>
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <set>

#define ll long long
#define pll pair<ll, ll>

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

const int INF = 1111111111;
const double EPS = 1e-9;

using namespace std;

const int N = 111111;
int n;
int a[N];
int q;
int b[N], c[N];

void init()
{
	cin >> n;
	rep(i, n) cin >> a[i];
	cin >> q;
	rep(i, q) cin >> b[i] >> c[i];
}

int memo[N];

void solve()
{
	rep(i, n)
	{
		memo[a[i]]++;
	}

	ll sum = 0;

	rep(i, N)
	{
		sum += i * memo[i];
	}

	rep(i, q)
	{
		ll minus = b[i] * memo[b[i]];
		ll plus = c[i] * memo[b[i]];

		memo[c[i]] += memo[b[i]];
		memo[b[i]] = 0;

		sum += plus - minus;

		cout << sum << endl;
	}
}

int main()
{
	init();
	solve();
}


Measured memory_bytes: 4672
import java.util.Scanner;

public class Main {

    private static boolean containsC(String s) {
        String[] str = s.split("");
        int cCount = 0;
        for (int i = 2; i < str.length - 1; i++) {
            if ("C".equals(str[i])) {
                cCount++;
            }
        }
        return cCount == 1;
    }

    private static boolean isLowerCaseWoAAndC(String s) {
        String[] str = s.split("");
        for (int i = 1; i < str.length; i++) {
            if ("C".equals(str[i])) {
                continue;
            }
            if (str[i].equals(str[i].toUpperCase())) {
                return false;
            }
        }
        return true;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        if ("A".equals(s.substring(0, 1))
                && containsC(s)
                && isLowerCaseWoAAndC(s)) {
            System.out.println("AC");
            return;
        }
        System.out.println("WA");
    }

}


Measured memory_bytes: 23124
#define MOD 1000000007
#define PI 3.14159265358979323846
#define inf 100000000000000
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define ALL(V) V.begin(), V.end()
#define sz(V) (int)V.size()
//#define int long long
#define _ <<" "<<
#define forn(i, n)             for(int i = 0; i < n; i ++)
#define forn1(i, n)            for(int i = 1; i <= n; i ++)
#include <bits/stdc++.h>
 
 
using namespace std;
 
typedef long long int ll;
typedef vector <int> vi;
typedef vector<vi> vvi;
typedef pair <int, int> ii;
typedef pair<int, pair<int,int> > iii;
typedef vector<ii> vii;
#define int long long

int dp[1009][100009];

int h[1009];
int s[1009];
signed main() {
 
   
    
    ios::sync_with_stdio(0); cin.tie(0);
    cout.tie(0);
   // freopen("test.txt" ,"r", stdin);
    int n;cin>>n;

    int k;cin>>k;

    int a[n];
    forn(i,n)cin>>a[i];

    int cnt=0;
    forn(i,n){
        if(a[i] >= k)cnt++;
    }
    cout<<cnt;
 
}

Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int main(void){

	int num;
	cin >> num;
	cout << num << ":";
	for(int i = 2; i*i <= num; ++i){
		while(num % i == 0){
			num /= i;
			cout << " " << i;
		}
	}
	if(num != 1){
		cout << " " << num;
	}
	cout << endl;	

	return 0;
}

Measured memory_bytes: 1168
#include <iostream>
#include <string>
#include <set> 
#include <vector>
#include <algorithm>
#include <bitset>
#define ll long long
using namespace std;

int main(){
   int D,N;cin>>D>>N;
   if(N==100){
       if(D==0) cout<<101<<endl;
       if(D==1) cout<<10100<<endl;
       if(D==2) cout<<1010000<<endl;

       return 0;
   }
   int ans=1;
   for(int i=0 ;i<D;i++){
       ans =100*ans;
   }

   ans=N*ans;
   cout<<ans<<endl;
    return 0;

}

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

typedef long long ll;
#define Inf 1 << 20
#define MInf -(1 << 20)
 
#define REP(n) for(int i = 0;i < (int)(n);i++)
#define rep(i,n) for(int i = 0;i < (int)(n);i++)
#define Rep(i,n,m) for(int i = (int)(n); i < (int)(m);i++)
#define rrep(i,n) for(int i = (int)(n - 1); i > -1;i--)
#define RRep(i,n,m) for(int i = (int)(n - 1); i > (int)(m);i--)
#define trav(a, x) for(auto& a : x)
 
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V))
#define REVERSE(V) reverse(ALL(V))
#define RSORT(V) SORT(V);REVERSE(V)
 
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define yes(n) cout << ((n) ? "yes" : "no") << endl;


int main()
{
    int A,B,C,X;
    cin >> A >> B >> C >> X;
    int cou = 0;
    rep(a,A + 1)
    {
        rep(b,B+1)
        {
            rep(c,C+1)
            {
                int sum = 500 * a + 100 * b + 50 * c;
                if(sum == X)
                {
                    cou++;
                }
            }
        }
    }
    cout << cou << endl;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

#include<iostream>
#include<string>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<map>
#include<tuple>
#include<algorithm>
#include<numeric>
#include<math.h>

#define REPS(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define print(x) cout << #x << " = " << x << endl;

using namespace std;

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using vi = vector<int>;

const int mod = 1e9 + 7;
const long double pi = 3.141592653589793238462643383279502884197;
const long double eps = 1e-7;

int N;
ll a[10000], b[10000];

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

	ll minus = 0, plus2 = 0;
	for (int i = 0; i < N; i++) {
		ll c = a[i] - b[i];

		if (c > 0) { // マイナス操作が必要な回数
			minus += c;
		}
		else if (c < 0) { // プラス2操作が可能な回数
			plus2 += (-c) / 2;
		}	
	}

	// マイナス操作が必要な回数よりプラス2操作が可能な回数が多ければ
	// マイナス操作をすべて行ったあと、残りはすべてプラス1操作をすればよい
	if (minus <= plus2) printf("Yes\n");
	else printf("No\n");

	return 0;
}

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

void sort(vector<pair<int, int>>& a, int n)
{
    bool flag = 1;
    int h = n;
    while(flag == 1 || h != 1){
        flag = 0;
        if(h != 1) h = h / 1.3;
        for(int i = 0; i + h < n; i++){
            if(a[i].first > a[i+h].first){
                int kf = a[i].first,
                    ks = a[i].second;
                a[i].first  = a[i+h].first;
                a[i].second = a[i+h].second;
                a[i+h].first  = kf;
                a[i+h].second = ks;
                flag = 1;
            }
        }
    }
}

int main()
{
    int n, m;
    long long ans = 0;
    cin >> n >> m;
    vector<pair<int, int>> a(n);
    for(int i = 0; i < n; i++){
        scanf("%d%d", &a[i].first, &a[i].second);
    }
    sort(a, n);
    for(int i = 0; i < n && m > 0; i++){
        if(a[i].second <= m) {
            ans += (long long)a[i].first * a[i].second;
            m -= a[i].second;
        }
        else {
            ans += (long long)a[i].first * m;
            m = 0;
        }
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

int main(){
  int i,j;
  int n; cin >> n;
  vector<int> a(n);
  for(i=0;i<n;++i) cin >> a[i];
  for(i=a[0];i>0;--i){
    int work=0;
    for(j=0;j<n;++j){
      work+=a[j];
      work-=i;
      if(work<0) break;
    }
    if(work>=0) break;
  }
  cout << i << endl;
  return 0;
} 



Measured memory_bytes: 3100
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.BufferedReader;
 
public class Main{
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
 
        int[] data = new int[1000000];
        boolean[] isPrime = new boolean[1000000];
        //default???§false. ??´????°?????????°false,??´????°???§???????????????°true???¨??????.
        isPrime[0] = true;
        isPrime[1] = true;
        int count = 0;
        int max = (int)Math.sqrt(1000000);
         
        for(int i = 2; i < 1000000; i++){
 
            if(!isPrime[i]){
                count++;
                if(i <= max){
                    for(int j = i*i; j < 1000000; j+=i){
                        if(j <= 0) break;
                        isPrime[j] = true;
                    }
                }
            }
 
            data[i] = count;
        }
 
        String line;
 
        while( (line = br.readLine()) != null){
            System.out.println(data[Integer.parseInt(line)]);
        }
 
    }
}

Measured memory_bytes: 30044
#include <bits/stdc++.h>
#define ll long long int
#define F(i,j,k,in) for(int i=j;i<k;i+=in)
#define DF(i,j,k,in) for(int i=j;i>=k;i-=in)
#define foreach(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define PB push_back
#define ub upper_bound
#define lb lower_bound
#define ins insert
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
  double n,A[10001],m;
  cin>>n;
  cin>>m;
  double to=0;
  F(i,0,n,1)
  {
  cin>>A[i];
  to+=A[i];
  }
  double a=(1/(4*m))*to;
  ll coun=0;
  DF(i,n-1,0,1)
  {
      if(A[i]>=a)
      {
          coun++;
      }
  }
if(coun>=m)
cout<<"Yes"<<"\n";
else
cout<<"No"<<"\n";
return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <queue>
#include <tuple>
#include <cstring>
#include <cctype>
#include <ctype.h>

#define INF 100000000

using namespace std;

int main()
{
    int h, w;
    cin >> h >> w;
    string a[h + 2];
    for (int i = 0; i < h; i++)
    {
        cin >> a[i];
    }
    for (int i = 0; i < h + 2; i++)
    {
        for (int j = 0; j < w + 2; j++)
        {
            if (i == 0 || i == h + 1)
            {
                cout << '#';
            }
            else
            {
                cout << '#';
                cout << a[i-1];
                cout << '#';
                break;
            }
        }
        cout << "\n";
    }
    return 0;
}


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

string toNegabinary(long long value) {
	string result;
	
	if (value == 0) result = "0";

	while(value != 0) {
		int remainder = value % -2;
		value = value / -2;

		if(remainder < 0) {
			remainder += 2;
			value += 1;
		}

		result = to_string(remainder) + result;
	}

	return result;
}

int main(void) {
  long long n;
  cin >> n;
  
  cout << toNegabinary(n) << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);

        try{
            String s = scan.next();
            String t = scan.next();
            boolean b = true;
            for(int i = 0; i < s.length() && b; i++){
                b &= s.indexOf(s.charAt(i), i+1) == t.indexOf(t.charAt(i), i+1);
            }
            if(b){
                System.out.println("Yes");
            }else{
                System.out.println("No");
            }

        }finally{
            scan.close();
        }
    }
}


Measured memory_bytes: 27108
n,m,x,y = map(int,input().split())
l_x = list(map(int,input().split()))
l_y = list(map(int,input().split()))
xy = set(range(x+1,y+1))
z = set(range(max(l_x)+1,min(l_y)+1))
if len(xy&z) == 0 :print("War")
else:print("No War")

Measured memory_bytes: 3060
n = int(input())
c = input()

left = 0
right = len(c)-1
count = 0

while left < right:
    while c[left] != 'W':
        left += 1
        if left >= right:
            print(count)
            exit()
    while c[right] != 'R':
        right -= 1
        if left >= right:
            print(count)
            exit()
        
    count += 1
    left += 1
    right -= 1

print(count)



Measured memory_bytes: 67680
n,k = map(int, input().split())
snu = [0]*(n+1)
for i in range(k):
    d = int(input())
    a = list(map(int, input().split()))
    for su in a:
        if snu[su] == 0:
            snu[su] = 1
ans = snu.count(0) -1
print(ans)



Measured memory_bytes: 67524
#include <iostream>
#include <algorithm>
using namespace std;
const int maxn = 200;
int map[maxn][maxn];
int col[maxn * maxn];
int h,w,n;
int main(){
    scanf("%d %d",&h,&w);
    scanf("%d",&n);
    for (int i = 1; i <= n; i++)
        scanf("%d",&col[i]);
    int ptr = 1;
    for (int i = 1; i <= h; i++)
    {
        for (int j = 1; j <= w; j++)
        {
            if(col[ptr] <= 0)
                ptr++;
            if(i & 1){
                map[i][j] = ptr;
            }else{
                map[i][w + 1 - j] = ptr;
            }
            col[ptr]--;
        }   
    }
    for (int i = 1; i <= h; i++)
    {
        for (int j = 1; j <= w; j++)
        {
            if(j - 1)
                printf(" ");
            printf("%d",map[i][j]);
        }
        printf("\n");   
    }
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define MAXN 100005
#define mod 1000000007
#define inf LLONG_MAX/3
using namespace std;

typedef long long ll; 
typedef pair<ll,ll> pll;

ll power(ll x,ll y,ll m=mod)
{
  ll ans = 1;
  while(y>0)
  {
    if(y&1)
    {
      ans = (ans*x)%m;
    }
    x = (x*x)%m;  
    y /= 2;
  }
  return ans%m;
}

ll modInverse(ll a, ll m=mod) 
{ 
    ll m0 = m; 
    ll y = 0, x = 1; 
  
    if (m == 1) 
      return 0; 
  
    while (a > 1) 
    { 
        // q is quotient 
        ll q = a / m; 
        ll t = m; 
  
        // m is remainder now, process same as 
        // Euclid's algo 
        m = a % m, a = t; 
        t = y; 
  
        // Update y and x 
        y = x - q * y; 
        x = t; 
    } 
  
    // Make x positive 
    if (x < 0) 
       x += m0; 
  
    return x; 
}

vector<ll> dsu;

void make(ll i)
{
  dsu[i] = i;
}

ll find(ll i)
{
  return (dsu[i]==i)?i:dsu[i]=find(dsu[i]);
}

void uni(ll i,ll j)
{
  dsu[i] = j;
}

int main()
{
  // #ifndef ONLINE_JUDGE 
  // freopen("input.txt", "r", stdin); 
  // #endif
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  ll t=1;
  // cin>>t;
  while(t--)
  {
    ll n,m,k,i,j,ans=0;
    cin>>n>>m>>k;
    vector<ll> fr[n+1],ds[n+1];
    dsu.resize(n+1);
    for(i=1;i<=n;i++) make(i);
    for(i=1;i<=m;i++)
    {
      ll u,v;
      cin>>u>>v;
      fr[u].push_back(v);
      fr[v].push_back(u);
      u = find(u);
      v = find(v);
      if(u!=v)
        uni(u,v);
    }
    for(i=1;i<=k;i++)
    {
      ll u,v;
      cin>>u>>v;
      ds[u].push_back(v);
      ds[v].push_back(u);
    }
    map<ll,ll> sz;
    for(i=1;i<=n;i++)
    {
      sz[find(i)]++;
    }
    for(i=1;i<=n;i++)
    {
      ans = sz[find(i)] - fr[i].size() - 1;
      for(auto it: ds[i])
      {
        if(find(i) == find(it))
          ans--;
      }
      cout<<ans<<" ";
    }
  }
  return 0;
}


Measured memory_bytes: 17412
#include <bits/stdc++.h>
#define ll long long 
#define all(v) v.begin() , v.end()
#define pb push_back
#define f first
#define s second
#define mp make_pair
#define tr(con) for(auto it = con.begin(); it!= con.end() ; it++)
#define INF 1e9+7   // 1 * 10^9+ 7
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define fo(i,n) for(ll i=0;i<n;i++)
using namespace std;

int main(){
	
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
    int n; cin >> n ;
	int k; cin >> k;
	int h[n+1];
	//h[0]  = 0;
	rep(i,1,n) cin >> h[i];
	int val[n+1] ;
	for(int i=0;i<n+1;i++) val[i] = INF ;
	//val[0]=  0;
	val[1] = 0;
	val[2]= abs(h[2]-h[1]);
	rep(i,3,n){
		for(int j = i-1;j>=max(1,(int)i-k);j--){
		
				val[i] = min(val[i],abs(h[i]-h[j]) + val[j]);
			
			
		}
	}
	cout << val[n];
	return 0;
}



Measured memory_bytes: 1024
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 *                                                                       *
 *          Fortis Fortuna Adiuvat                                       * 
 *                          "Fortune Favours the bold"                   *
 *                                                                       *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define vll vector<int>
#define pb push_back
#define pll pair<int, int>
#define w(t) int t; cin >> t; while(t--)
#define print(x,y) cout << x << " " << y << endl
#define deb(x) cout << #x << " = " << x << endl
#define deb2(x, y) cout << #x << " = " << x << ", " << #y << " = " << y << endl
#define setbits(x) __builtin_popcountll(x)
#define endl "\n"

template <typename T>
void write(vector<T> &a) {        
    for(auto it = a.begin(); it != a.end(); it++)
        cout << *it << " ";
    cout << endl;}
void random(int nMin, int nMax, int n){
    srand(time(0));
    for(int i = 0; i < n; i++){
        double var = nMin + (int)((double)rand() / ((double)RAND_MAX+1) * (nMax-nMin+1));cout << var << " ";}cout << endl;
}
///////////Helper Functions///////////


////////////Main Method///////////////
int32_t main()
{
//////////////////////////////////////////////////////////
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    cout << setprecision(15);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    #endif
//////////////////// Code Here ///////////////////////////    
{
    int n; cin >> n ;
    string s; cin >> s; 

    int w = 0, ans = 0; 

    for(int i = 0; i < n; i++)
        w += s[i] == 'W' ;

    for(int i = 0; i < n-w; i++)
    {
        ans += s[i] == 'W' ;
    }
    cout << ans << endl;
}    
return 0 ;
}

Measured memory_bytes: 3732
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define REPr(i,n) for(int i=(n)-1;i>=0; --i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define FORqr(i, m , n) for(int i = (n);i >=(m);--i)
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)
#define SCLLD(n) scanf("%lld",&n)
#define SCLLD2(m,n) scanf("%lld%lld",&m,&n)
#define SCLLD3(m,n,k) scanf("%lld%lld%lld",&m,&n,&k)
#define PB push_back
#define MP make_pair
#define ARSCD(A,N) REP(i,N){SCD(A[i]);}
#define ARSCD1(A,N) FORq(i,1,N){SCD(A[i]);}
#define VSCD(v,N) REP(i,N){int (x); SCD(x); v.PB(x);}
#define VSCLLD(v,N) REP(i,N){long long (x); SCLLD(x); v.PB(x);}
#define PRINTD(n) printf("%d\n",n)
#define PRINTLLD(n) printf("%lld\n",n)
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x,S) (S.count(x) != 0)
#define M0(x) memset(x,0,sizeof(x))
#define FILL(x,y) memset(x,y,sizeof(x))
#define MM(x) memset(x,-1,sizeof(x))
#define ALL(x) (x).begin(),(x).end()
using namespace std;
typedef pair<int,int> PII;
typedef pair<long long,long long> PLL;
typedef vector<int> VI;
typedef vector < VI > VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
///////////////////////////////////////////////
const ll MOD = 1000000007;
ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
///////////////////////////////////////////////

int main(){
	int N,K;
	SCD2(N,K);

	static int a[102] = {};
	ARSCD1(a,N);

	static ll dp[100002] = {};
	static ll prev[100002] = {}; // sum

	dp[0] = 1;

	FORq(i,1,N){
		prev[0] = dp[0];
		FORq(j,1,K){
			prev[j] = (prev[j-1] + dp[j]) % MOD;
		}

		ll ret = 0;
		FORq(j,0,K){
			if (j - a[i] <= 0) dp[j] = prev[j];
			else dp[j] = prev[j] - prev[j-a[i]-1];

			if (dp[j] < 0) dp[j] += MOD;
		}
	}

	PRINTLLD(dp[K]);
}


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


#define M 1000000007
#define pb push_back
#define mp make_pair
#define s second
#define f first
#define mod 998244353
#define sz(v) (int)(v).size()

#define pii pair<int, int>
#define vi vector<int>
#define ll long long
#define fastio ios_base::sync_with_stdio(false);cin.tie(0)

ll add(ll a,ll b)
{
	a%=M;
	b%=M;
	ll p = (a+b)%M;
	return (p+M)%M;
}

ll mul(ll a,ll b)
{
	a%=M;
	b%=M;
	ll p = (a*b)%M;
	return (p+M)%M;
}


int main()
{
	fastio;
	ll i,n;
	string str1,str2,ans="";
	cin>>n;
	cin>>str1>>str2;
	for(i=0;i<n;i++)
	{
		ans+=str1[i];
		ans+=str2[i];
	}
	cout<<ans<<endl;
    return 0;
}





Measured memory_bytes: 3536
#include<iostream>
#include<sstream>
#include<vector>
#include<iterator>
#include<iomanip>
using namespace std;

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

    int even = N / 2;
    int odd = N - even;
    
    double ans = 1.0*odd / N;

    cout << fixed << setprecision(30) << ans << endl;

    return 0;
}


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

int main()
{
	int A, B, K, Ans[105], i, j;
	cin >> A >> B >> K;
	j = 1;
	if (A > B) {
		for (i = 0; i < B; i++) {
			if (A % (B - i) == 0 && B % (B - i) == 0) {
				Ans[j] = B - i;
				j += 1;
			}
		}
	}
	else {
		for (i = 0; i < A; i++) {
			if (A % (A - i) == 0 && B % (A - i) == 0) {
				Ans[j] = A - i;
				j += 1;
			}
		}
	}
	cout << Ans[K] << endl;
	return 0;
}

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

using namespace std;

int main(){
    int n;
    string s;
    cin>>n>>s;
    int res=0;
    for(int i=0;i<n-1;i++){
        if(s[i]==s[i+1])
            res++;
    }
    cout<<n-res<<endl;
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MOD = pow(10, 9) + 7;
//const int MOD = 998244353;
//const int MOD = ;
int mod(int A, int M) {return (A % M + M) % M;}
const int INF = 1LL << 60;
template<class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
int divCeil(int A, int B) {return (A + (B - 1)) / B;}
int myctoi(char C) {return C - '0';}
char myitoc(int N) {return '0' + N;}
#define FINALANS(A) {cout << A << endl; exit(0);}

signed main()
{
  int N, M;
  cin >> N >> M;
  vector<int> A(M), B(M), C(M);
  vector<vector<int>> d(N, vector<int>(N, INF));
  for (int i = 0; i < N; i++)
  {
    d.at(i).at(i) = 0;
  }
  for (int i = 0; i < M; i++)
  {
    int a, b, c;
    cin >> a >> b >> c;
    a--, b--;
    A.at(i) = a, B.at(i) = b, C.at(i) = c;
    d.at(a).at(b) = c;
    d.at(b).at(a) = c;
  }

  for (int k = 0; k < N; k++)
  {
    for (int i = 0; i < N; i++)
    {
      for (int j = 0; j < N; j++)
      {
        chmin(d.at(i).at(j), d.at(i).at(k) + d.at(k).at(j));
      }
    }
  }

  int ans = 0;
  for (int i = 0; i < M; i++)
  {
    if (d.at(A.at(i)).at(B.at(i)) < C.at(i))
      ans++;
  }
  cout << ans << endl;

  /*
  for (int i = 0; i < N; i++)
  {
    for (int j = 0; j < N; j++)
    {
      cerr << d.at(i).at(j) << " ";
    }
    cerr << endl;
  }
  */
}

Measured memory_bytes: 384
using System;

namespace A___Meal_Delivery
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ');
            var x = int.Parse(input[0]);
            var a = int.Parse(input[1]);
            var b = int.Parse(input[2]);
            var c = Math.Abs(a - x);
            var d = Math.Abs(b - x);
            if(c<d)
            {
                Console.WriteLine("A");
            }
            else
            {
                Console.WriteLine("B");
            }
        }
    }
}

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

const ll mod = 1e9 + 7;

int main() {
  ll h, w, n;
  cin >> h >> w >> n;
  map<pair<ll, ll>, ll> mp;
  for (int z = 0; z < n; z++) {
    int r, c;
    cin >> r >> c;
    mp[{r, c}] += 1;
    mp[{r, c-1}] += 1;
    mp[{r, c-2}] += 1;
    mp[{r-1, c}] += 1;
    mp[{r-1, c-1}] += 1;
    mp[{r-1, c-2}] += 1;
    mp[{r-2, c}] += 1;
    mp[{r-2, c-1}] += 1;
    mp[{r-2, c-2}] += 1;
  }
  ll ans[10] = {0};
  ans[0] = (h-2) * (w-2) ;
  for (auto &it : mp) {
    if (it.first.first >= 1 && it.first.first <= h-2 && it.first.second >= 1 && it.first.second <= w-2) {
      ans[it.second] += 1;
      ans[0] -= 1;
    }
  }
  for (int i = 0; i < 10; i++) {
    cout << ans[i] << '\n';
  }
  return 0;
}


Measured memory_bytes: 59772
#include <vector>
#include <iostream>
#include <cstdlib>

static const int INF = 1001001001;

using namespace std;

int main()
{
	long long x, y;

	cin >> x >> y;
	if (llabs(x) <= llabs(y)) {
		if (x >= 0 && y >= 0) {
			// (  0,  1) -> 1
			// (  3, 10) -> 7
			cout << llabs(y) - llabs(x) << endl;
		}
		else if (x >= 0 && y < 0) {
			// (  0, -1) -> 1+1
			// (  3,-10) -> 7+1
			// (  3, -3) -> 1
			cout << llabs(y) - llabs(x) + 1 << endl;
		}
		else if (x < 0 && y >= 0) {
			// ( -3, 10) -> 1+7
			cout << 1 + llabs(y) - llabs(x) << endl;
		}
		else { //x < 0 && y < 0
			// ( -3,-10) -> 1+7+1
			cout << 2 + llabs(y) - llabs(x) << endl;
		}
	} else {
		if (x >= 0 && y >= 0) {
			if (y == 0) {
				// (  1,  0) -> 1+1
				cout << 1 + llabs(x) - llabs(y) << endl;
			}
			else {
				// ( 10,  3) -> 1+7+1
				cout << 2 + llabs(x) - llabs(y) << endl;
			}
		}
		else if (x >= 0 && y < 0) {
			// ( 10, -3) -> 1+7
			cout << 1 + llabs(x) - llabs(y) << endl;
		}
		else if (x < 0 && y >= 0) {
			if (y == 0) {
				// ( -1,  0) -> 1
				cout << llabs(x) - llabs(y) << endl;
			}
			else {
				// (-10,  3) -> 7+1
				cout << llabs(x) - llabs(y) + 1 << endl;
			}
		}
		else {
			cout << llabs(x) - llabs(y) << endl;
		}
	}

	return 0;
}


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

int n,A[50];

bool solve(int i,int m){
    if (m==0){
        return true;
    }
    if (i>=n){
        return false;
    }
    bool ans= solve(i+1,m)||solve(i+1,m-A[i]);
    return ans;
    }

int main(){

    cin>>n;
    for(int i=0;i<n;i++){
        cin>>A[i];
        }
    int Q;
    cin>>Q;
    for(int i=0;i<Q;i++){
        int t;
        cin>>t;
        if(solve(0,t)){
            cout<<"yes"<<endl;
        }
        else cout<<"no"<<endl;
    }
}



Measured memory_bytes: 3108
h, w = map(int, input().split())

a = [list(input()) for i in range(h)]

a = [x for x in a if "#" in x]

aT = list(zip(*a))
aT = [x for x in aT if "#" in x]

a = list(zip(*aT))

for i in a:
    print("".join(i))


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

int main()
{
    int r; cin>>r;
    string s= "",t="";
    
    cin>>s>>t;

    string x = "";
    
    int l = 0;
    while (l<r)
    {
        x+= s[l];
        x+= t[l];
        
        l++;
    }
    cout<<x<<endl;
}

Measured memory_bytes: 256
def bubbleSort(a,n):
	cnt=0
	for i in range(n-1,0,-1):
		for j in range(i):
			if a[j]>a[j+1]:
				a[j],a[j+1]=a[j+1],a[j]
				cnt+=1
	return cnt	
	
n=int(input())
a=list(map(int,input().split()))
cnt=bubbleSort(a,n)
print(' '.join(map(str,a)))
print(cnt)


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

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

using namespace std;

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

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

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

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

    int n;
    cin >> n;
    int ans = 0;
    FOR(i,1,n+1){
        ans += i;
    }

    cout << ans << ENDL;
    
    return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define E "\n"

using namespace std;
const long long MOD = (long long)1e9 + 7;

int r;
double PI = 3.1415926;

int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> r;
    cout << PI * (r + r) << E;
    //system("pause");
    return 0;
}

Measured memory_bytes: 3800
/*
author:Manson
date:7.7.2018
theme:
*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int N = 1e5+5;
int a[N];

int GCD(int x, int y)
{
	int t;
	while(y > 0) {
		t = x % y;
		x = y;
		y = t;
	}
	return x;
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n,x;
	cin>>n>>a[0];
	for(int i = 1;i <= n;i++){
		cin>>a[i];
	}
	sort(a,a+n+1);
	int ans = a[1]-a[0];
	for(int i = 2;i <= n;i++){
		int d = a[i]-a[i-1];
		ans = GCD(ans,d);
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 892
//IN THE NAME OF GOD

#include <iostream>
using namespace std;
typedef long long int ll;
int a,b;
int bmm(int x,int y){
    if(!y)
        return x;
    return bmm(y,x%y);
}
int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin>>a>>b;
    if(b>a)
        swap(a,b);
    cout<<bmm(a,b)<<endl;
    return 0;
}

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

int main(void){
  int n,a,b; cin >> n >> a >> b;
  cout << min(a*n,b) << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> 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; }
template<typename T> T gcd(T a,T b){return b?gcd(b,a%b):a;}
const LL mod=1000000007;
const LL LINF=1LL<<62;
const int INF=1<<30;
int dx[]={1,0,-1,0,1,-1,1,-1};
int dy[]={0,1,0,-1,1,-1,-1,1};


int main(){
    int n;cin >> n;
    vector<P> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i].fs;
        a[i].sc = i;
    }
    sort(RALL(a));
    vector<vector<LL>> dp(n+1,vector<LL> (n+1,-LINF));
    dp[0][n - 1] = 0;
    for (int i = 0; i < n; i++) {
        for (int l = 0; l <= i; l++) {
            int r = n - (i - l) - 1;
            if(l + 1 <= n) chmax(dp[l+1][r], dp[l][r] + a[i].fs * abs(a[i].sc - l));
            if(r - 1 >= 0) chmax(dp[l][r-1], dp[l][r] + a[i].fs * abs(a[i].sc - r));
        }
    }
    LL ans = 0;
    for (int i = 1; i <= n; i++) {
        chmax(ans, dp[i][i-1]);
        chmax(ans, dp[i-1][i]);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 34672