akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<cstdlib>
#include<utility>
#include<vector>
using namespace std;
typedef long long LL;
const int MaxN = 1e5;

int n;

struct NODE{
	int cost, u, v;
};

NODE box[MaxN + 5][3];
struct XX{
	int x, y;
	int p;
}a[MaxN + 5];

vector<NODE> que;

bool cmp1(XX x, XX y){
	return x.x < y.x;
}
bool cmp2(XX x, XX y){
	return x.y < y.y;
}
bool cmp3(NODE x, NODE y){
	return x.cost < y.cost;
}
int fa[MaxN + 5];
int find(int x){
	if(fa[x] == x) return x;
	else return fa[x] = find(fa[x]);
}
int main(){
	while(~scanf("%d", &n)){
		for(int i = 1; i <= n; i++){
			scanf("%d %d", &a[i].x, &a[i].y);
			a[i].p = i;
		}
		sort(a + 1, a + 1 + n, cmp1);
		for(int i = 2; i <= n; i++){
			int len = min(abs(a[i].x - a[i - 1].x), abs(a[i].y - a[i - 1].y));
			NODE temp;
			temp.cost = len, temp.u = a[i - 1].p, temp.v = a[i].p;
			que.push_back(temp);
		}
		sort(a + 1, a + 1 + n, cmp2);
		for(int i = 2; i <= n; i++){
			int len = min(abs(a[i].x - a[i - 1].x), abs(a[i].y - a[i - 1].y));
			NODE temp;
			temp.cost = len, temp.u = a[i - 1].p, temp.v = a[i].p;
			que.push_back(temp);
		}
		int len = que.size();
		sort(que.begin(), que.end(), cmp3);
		for(int i = 1; i <= n; i++) fa[i] = i;
		LL tot = 0;
		for(int i = 0; i < len; i++){
			int u = que[i].u, v = que[i].v, cost = que[i].cost;
			if(find(u) != find(v)){
				fa[find(u)] = find(v);
				tot += cost;
			}
		}
		printf("%lld\n", tot);
	}
	return 0;
}



Measured memory_bytes: 6004
#include<iostream>
#include<string>
using namespace std;
int main(){
    string s,ord,p;
    int q,a,b;
    cin >> s >> q;
    for (int i = 0;i < q;i++){
        cin >> ord >> a >> b;
        if (ord == "print"){
            cout << s.substr(a,b - a + 1) << endl;
        }else if (ord =="reverse"){
                string t = s.substr(a,b - a + 1);
                int n = t.size();
                for (int i = 0;i < n;i++) s[i+a] = t[n-i-1];
        }else if (ord == "replace"){
            cin >> p;
            s = s.replace(a,b - a + 1,p);
        }
    }
    return 0;
}


Measured memory_bytes: 3184
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <tuple>
#include <numeric>
using namespace std;

#if 0
#define DEBUG(x) do{cerr << #x << "=" << x << endl;}while(0);
#else
#define DEBUG
#endif


tuple<double,double> intersect(int a, int b, int c, int d){
    tuple<double,double> point;
    point = make_tuple(  (double)(d-b)/(a-c), (double)(a*d-b*c)/(a-c) );
    return point;
}

long long gcd(long long a, long long b){
  long long r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}

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

int main(){
	long long a,b,c,d;
    cin>>a>>b>>c>>d;


    long long cd = lcm(c, d);
    long long num_div_a_c = (a-1) / c;
    long long num_div_b_c = b / c;
    long long num_div_a_d = (a-1) / d;
    long long num_div_b_d = b / d;
    long long num_div_a_cd = (a-1) / cd; // a以上は含むことに注意
    long long num_div_b_cd = b / cd;

    DEBUG(num_div_a_c);
    DEBUG(num_div_b_c);
    DEBUG(num_div_a_d);
    DEBUG(num_div_b_d);
    DEBUG(num_div_a_cd);
    DEBUG(num_div_b_cd);

    long long ans = (b - a + 1) // 総数
                  - num_div_b_c + num_div_a_c // Cで割り切れる個数を引く
                  - num_div_b_d + num_div_a_d // Dで割り切れる個数を引く
                  + num_div_b_cd - num_div_a_cd; // CでもDでも割り切れる個数を足して引きすぎを相殺

    cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>

using namespace std;

const int MAX_V = 1e5 + 10;

vector<int> G[MAX_V];
int V;
bool visited[MAX_V]; 
vector<int> ans;
int degree[MAX_V];

void bfs(int s){
	queue<int> q;
	q.push(s);
	visited[s] = true;
	while(!q.empty()){
		int u = q.front(); q.pop();
		ans.push_back(u);
		for (int i = 0; i < G[u].size(); ++i)
		{
			int v = G[u][i];
			degree[v]--;
			if (degree[v] == 0 && !visited[v]){
				visited[v] = true;
				q.push(v);
			}
		}
	}
}


void topologicalSort(){
	fill(degree, degree + V, 0);

	for (int u = 0; u < V; ++u)
	{
		for (int i = 0; i < G[u].size(); ++i)
		{
			int v = G[u][i];
			degree[v]++;
		}
	}

	for (int u = 0; u < V; ++u)
		if (degree[u] == 0 && !visited[u]) bfs(u);
}

int main(int argc, char const *argv[])
{
	int E;
	cin >> V >> E;

	fill(visited, visited + V, false);

	for (int i = 0; i < E; ++i)
	{
		int s, t;
		cin >> s >> t;
		G[s].push_back(t);
	}

	topologicalSort();

	for (int i = 0; i < ans.size(); ++i) cout << ans[i] << endl;
	return 0;
}


Measured memory_bytes: 6056
#include <bits/stdc++.h>
#define int long long
#define zmrl(x) (int)((x).size())
#define ahen(x) (x).begin(), (x).end()
#define pb push_back
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    string s; cin>>s;
    if (s.back() == 's') s += "es";
    else s.pb('s');
    cout << s << '\n';
    return 0;
}

Measured memory_bytes: 3656
// AOJ 3032 Combine Two Elements
// 2018.3.29 bal4u

#include <stdio.h>
#include <string.h>

//#define getchar_unlocked()  getchar()
int in()	/* 整数値の入力 */
{
	int n = 0, c = getchar_unlocked();
	do n = 10*n + (c & 0xf), c = getchar_unlocked(); while (c >= '0');
	return n;
}

#define MAX 1604
int  hi[MAX], to[MAX][MAX];
char seen[MAX];
int  match[MAX];

int bpm(int u);
int bipartiteMatching(int m, int n)
{
	int u, max;

	memset(match, -1, (m+n)*sizeof(int));
	max = 0;
	for (u = 0; u < m; u++) {
		memset(seen, 0, m+n);
		if (bpm(u)) max++;
	}
	return max;
}

int bpm(int u)
{
	int i, v;

	for (i = 0; i < hi[u]; i++) {
		v = to[u][i];
		if (seen[v]) continue;
		seen[v] = 1;
		if (match[v] < 0 || bpm(match[v])) {
			match[u] = v, match[v] = u;
			return 1;
		}
	}
	return 0;
}

#define ABS(a)  ((a)>=0?(a):-(a))

typedef struct { int a, b; } T;
T u[802]; int us;
T v[802]; int vs;

int main()
{
	int N, A, B, A2, i, j, a, b, d, ans;

	N = in(), A = in(), B = in(), A2 = A<<1;
	ans = 0, us = vs = 0;
	for (i = 0; i < N; i++) {
		a = in(), b = in();
		d = ABS(a-b);
		if (d <= A || (B <= d && d <= A2)) { ans++; continue; }
		if (a >= b) u[us].a = a, u[us++].b = b;
		else        v[vs].a = a, v[vs++].b = b;
	}

	for (i = 0; i < us; i++) for (j = 0; j < vs; j++) {
		a = u[i].a + v[j].a;
		b = u[i].b + v[j].b;
		d = ABS(a-b);
		if (d <= A || (B <= d && d <= A2)) to[i][hi[i]++] = us+j;
	}

	ans += bipartiteMatching(us, vs);
	printf("%d\n", ans);
	return 0;
}



Measured memory_bytes: 3280
//http://tutuz.hateblo.jp/entry/2018/07/16/135300
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)

ll n,k;
ll solve(){
   ll ans=0;
   for(int b=1;b<=n;b++){
       ans+=max(0ll,b-k)*(n/b)+max(0ll,n%b-k+1);
   }
   if(k==0)ans=n*n;

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

    cin>>n>>k;
    cout<<solve()<<endl;
    return 0;
}

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


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

using namespace std;

int main()
{
	int h, w;
	string s[52][52];

	cin >> h >> w;

	for (int i = 1; i <= h; ++i)
	{
		string t;
		cin >> t;
		for (int j = 1; j <= w; ++j)
		{
			s[i][j] = t[j-1];
		}
	}

	for (int i = 1; i <= h; ++i)
	{
		for (int j = 1; j <= w; ++j)
		{
			if (s[i][j] == "#") 
			{
				if (s[i - 1][j] != "#" && s[i][j - 1] != "#" && s[i][j + 1] != "#" && s[i + 1][j] != "#") 
				{
					cout << "No" << endl;
					return 0;
				}
			}
		}
	}

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

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

int main() {
 long long w,h,x,y;
    cin >> w >> h >> x >> y;
    
    
    if(x == (double)w*0.5 && (double)y == h*0.5) {
     cout << (double)w*h*0.5 << ' ' << 1;
    }
    else {
     cout << (double)w*h*0.5 << ' ' << 0;}
}

Measured memory_bytes: 3788
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define REPR(i, n) for(int i = (n); i >= 0; i--)
#define FOR(i, m, n) for(int i = (m); i < (n); i++)
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << #x << ": " << x << endl;

using namespace std;
typedef long long ll;

signed main() {
  int n;
  cin >> n;
  ll a[n], cnt[n + 1] = {0}, sum = 0;

  for(int i = 0; i < n; i++) {
    cin >> a[i];
    cnt[a[i]]++;
  }

  for(int i = 1; i <= n; i++) sum += cnt[i] * (cnt[i] - 1) / 2;

  REP(i, n) { cout << sum - cnt[a[i]] + 1 << endl; }

  return 0;
}


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

int main() {
  int N;
  cin >> N;
  bool flag = false;
  for(int i = 0; i <= N/4; i++) {
    for(int j = 0; j <= N/7; j++) {
      if(N == i*4 + j*7) flag = true;
    }
  }
  cout << (flag ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
function Main(input) {
    // 1行目がinput[0], 2行目がinput[1], …に入る
    //tmp = input.split(" ");
    input = Number(input);
    if(input <= 999){
        answer = "ABC"
    }else{  
        answer = "ABD"
    }
    console.log(answer);
    
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
#include <bits/stdc++.h>
 
#define pb push_back
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define ll long long
#define ii pair<int,int>
#define vi vector<int>
#define vll vector<ll>
#define vii vector<ii>
#define debug cout << "Ok" << endl;

using namespace std;

void solve(){

	return;
}
 
int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	int aux,n;
	map<int,int>ma;
	bool t=false;
	int v[3][3];

	for(int i=0;i<3;i++){
		for(int j=0;j<3;j++){
			cin >> v[i][j];
		}
	}
	
	cin >> n;
	while(n--){
		cin >> aux;
		ma[aux]++;
	}

	for(int i=0;i<3;i++){
		if(ma[v[i][0]] == true and ma[v[i][1]] == true and ma[v[i][2]] == true) t=true;
		if(ma[v[0][i]] == true and ma[v[1][i]] == true and ma[v[2][i]] == true) t=true;
	}
	if(ma[v[0][0]] == true and ma[v[1][1]] == true and ma[v[2][2]] == true) t=true;
	if(ma[v[0][2]] == true and ma[v[1][1]] == true and ma[v[2][0]] == true) t=true;

	cout << ( t ? "Yes": "No") << endl;
	return 0;
}

Measured memory_bytes: 3628
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <complex>
#include <cstdio>
#include <string>
#include <vector>
#include <bitset>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>

#define isNum(a) (a >= '0' && a <= '9')
#define SP putchar(' ')
#define EL putchar('\n')
#define File(a) freopen(a ".in", "r", stdin), freopen(a ".out", "w", stdout)

template<class T>
void read(T&);
template<class T>
void write(const T&);

typedef long long ll;
typedef const long long & cll;
typedef const int & ci;
typedef std::pair<int, int> pii;
const int iinf = 2147483647;
const ll llinf = 9223372036854775807ll;
using std::min;
using std::max;
using std::abs;
using std::sort;

int main () {
  int a, b, c;
  read(a), read(b), read(c);
  std::cout.precision(10);
  if (2.0 * c / a / b < a) {
    std::cout << std::fixed << std::atan(a * 1.0 * b * b / 2 / c) / std::acos(-1) * 180 << std::endl;
  } else {
    std::cout << std::fixed << std::atan((b * 2 - 2.0 * c / a / a) / a) / std::acos(-1) * 180 << std::endl;
  }
  return 0;
}

template<class T>
inline void read(T &Re) {
  T k = 0;
  char ch = getchar();
  int flag = 1;
  while (!isNum(ch)) {
    if (ch == '-') {
      flag = -1;
    }
    ch = getchar();
  }
  while (isNum(ch)) {
    k = (k << 1) + (k << 3) + ch - '0';
    ch = getchar();
  }
  Re = flag * k;
}
template<class T>
inline void write(const T &Wr) {
  if (Wr < 0) {
    putchar('-');
    write(-Wr);
  } else {
    if (Wr < 10) {
      putchar(Wr + '0');
    } else {
      write(Wr / 10);
      putchar((Wr % 10) + '0');
    }
  }
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string>
#include<utility>
#include<iostream>
#include<queue>
#include<math.h>
#include<algorithm>
#include<vector>
#include<map>
#include<stack>
#include<bitset>

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

int main(){
    ll n;
    ll a[200005]={};
    ll sum =0;
    scanf("%lld",&n);
    REP(i,n){
        scanf("%lld",&a[i]);
        sum += a[i];
    }
    ll ans;
    ll hog=0;
    ll min = 11145141919;
    REP(i,n){
        hog+=a[i];
        if(sum/2>=hog)ans=sum-hog-hog;
        else ans = hog*2-sum;
        if(min>ans)min=ans;
    }
    printf("%lld\n",min);
    return 0;
}

Measured memory_bytes: 1792
#include <iomanip>
#include <iostream>
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
using namespace std;

int main(void) {
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  string S;
  cin >> S;
  int ans = 0;
  for (int i = 0; i < S.size(); ++i) {
    int last = S.size() - i;
    if (3 <= last && S[i] == 'A' && S[i + 1] == 'B' && S[i + 2] == 'C') ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,b,a) for(int i=b;i>=a;i--)
#define fori(a) for(auto i : a )
#define all(a) begin(a), end(a)
#define set(a,b) memset(a,b,sizeof(a))
#define sz(a) a.size()
#define pi 3.14159
#define ll long long
#define ull unsigned long long
#define pb push_back
#define PF push_front //deque
#define mp make_pair
#define pq priority_queue
#define mod 1000000007
#define f first
#define s second
#define pii pair< int, int >
#define vi vector<int>
#define vpii vector<pii>
#define debug(v) for(auto i:v) cout<<i<<" ";
#define tc int t; cin >> t; while(t--)

using namespace std;
string repeat(string s, int n) {
    string s1 = "";
    for (int i=0; i<n;i++)
        s1+=s;
    return s1;
}
string getString(char x) {
    string s(1, x);
    return s;
}

void optimizeIO(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
int gcd(int a, int b){
    if (a == 0)  return b;
    return gcd(b % a, a);
}
void  solve(){
	int a,b,x;
  cin>>a>>b>>x;
  if(x<=a+b && x>=a){
    cout<<"YES\n";
  }
  else{
    cout<<"NO\n";
  }
}
int main(){
    optimizeIO();
    // tc
    { solve();
    }
}


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

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
#define rep(i, s, n) for(int i = (int)(s); i < (int)(n); i++)

ll INF = 1ll << 60;

void chmin(int &a, int b){
  if(a > b)
    a = b;
}
void chmax(int &a, int b){
  if(a < b)
    a = b;
}

void llchmin(ll &a, ll b){
  if(a > b)
    a = b;
}
void llchmax(ll &a, ll b){
  if(a < b)
    a = b;
}

int main(){
  ll n;
  cin >> n;
  int l = 1;
  ll n26 = 26;
  ll num = n;
  vector<char> ans(0);
  
  while(true){
    if(num > n26){
      num -= n26;
      l++;
      n26 *= 26;
    }
    else
      break;
  }
  
  num--;
  
  rep(i, 0, l){
    char al = 'a';
    al += num%26;
    num /= 26;
    ans.push_back(al);
  }
  
  reverse(ans.begin(), ans.end());
  
  rep(i, 0, ans.size())
    cout << ans[i];
  cout << endl;
  
}

Measured memory_bytes: 3616
#include <iostream>

using namespace std;

int main() {
    int n;  scanf("%d", &n);
    int k;  scanf("%d", &k);
    int x;  scanf("%d", &x);
    int y;  scanf("%d", &y);
    cout << (n * x) - (n - k < 0 ? 0 : n - k) * (x - y) << endl;
    return 0;
}

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

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define MIN(a) *min_element(all(a))
#define MAX(a) *max_element(all(a))
#define SUM(a) accumulate(all(a), 0LL)
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define FOR(i, m, n) for(int (i)=(m); (i)<(n); i++)
#define FORR(i, m, n) for(int (i)=(n)-1; (i)>=(m); i--)
#define debug(x) cerr << #x << " = " << x << endl
//#define int long long

typedef long long ll;
//ll const MOD = 998244353;
ll const MOD = 1e9+7;
int const inf = 1e9;
ll const INF = 1e18;

inline void ios_(){cin.tie(0); ios::sync_with_stdio(false);}
template<typename T> int size(const T& a){return (int)a.size();}
template<typename T> T Div(T a, T b){return (a + b - 1) / b;}
template<typename T> bool chmin(T& a, const T& b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, const T& b){if(a < b){a = b; return true;} return false;}


ll BinarySearch(ll ng, ll ok, function<bool(ll)> judge){
    while(abs(ok - ng) > 1){
        ll mid = (ok + ng) / 2;
        if(judge(mid)) ok = mid;
        else ng = mid;
    }
    return ok;
}

signed main(){
    ll n, m;
    cin >> n >> m;
    vector<ll> v(n);
    for(auto& i : v) cin >> i;

    sort(all(v));

    auto fn = [&](ll x){
        ll cnt = 0;
        REP(i, n){
            ll a = v[i];
            cnt += distance(lower_bound(all(v), x - a), v.end());
        }
        return cnt <= m;
    };

    auto gn = [&](ll x){
        ll cnt = 0;
        REP(i, n){
            ll a = v[i];
            cnt += distance(lower_bound(all(v), x - a), v.end());
        }
        return cnt >= m;
    };

    ll x = BinarySearch(0, 200010, fn);
    ll y = BinarySearch(200010, 0, gn);

    vector<ll> sum(n+1, 0);
    RREP(i, n){
        sum[i] = sum[i+1] + v[i];
    }

    ll ans = 0, cnt = 0;
    REP(i, n){
        int p = lower_bound(all(v), x - v[i]) - v.begin();
        ans += sum[p] + v[i] * (n - p);
        cnt += n - p;
    }

    ans += y * (m - cnt);
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {
	public static void main(String[]args){
		Scanner scan = new Scanner(System.in);
		while(scan.hasNext()){
			int a = scan.nextInt();
			int b = scan.nextInt();
			int count = String.valueOf(a + b).length();


			System.out.println(count);
		}
	}
}

Measured memory_bytes: 26368
#include<bits/stdc++.h>
#define PI 3.141592653589
#define ll long long
using namespace std;

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

  vector<double> v(n);
  for(int i=0; i<n; ++i) cin >> v[i];

  sort(v.begin(), v.end());
  
  double ans = v[0], res;


  for(int i=0; i<n-1; ++i){
    ans = (ans + v[i+1]) / 2;
  }

  cout << fixed << setprecision(10) << ans;
  return 0;
}

Measured memory_bytes: 256
n, k = map(int, input().split())
s = input()

start = [0]
for i in range(n - 1):
    if s[i] != s[i + 1]:
        start.append(i + 1)
x = [0] * (len(start))
for i in range(len(start)):
    if s[start[i]] == "1":
        if i + 2 * k + 1 >= len(start):
            x[i] = n - start[i]
        else:
            x[i] = start[i + 2 * k + 1] - start[i]
    else:
        if i + 2 * k >= len(start):
            x[i] = n - start[i]
        else:
            x[i] = start[i + 2 * k] - start[i]
print(max(x))

Measured memory_bytes: 46448
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int f[11][11],b[11];
int main()
{
	int n,m,i,j,k,ans=0;cin>>n>>m;int lim=(1<<n);
	for (i=1;i<=m;i++)
	{
		cin>>k;
		for (j=1;j<=k;j++) cin>>f[i][j];
	}
	for (i=1;i<=m;i++) cin>>b[i];
	for (i=0;i<lim;i++)
	{
		int flg=1;
		for (j=1;j<=m;j++)
		{
			int t=b[j];
			for (k=1;k<=n && f[j][k];k++)
			{
				t^=((i>>(f[j][k]-1))&1);
			}
			if (t) {flg=0;break;}
		}
		if (flg) ans++;
	}
	cout<<ans;
}


Measured memory_bytes: 256
import java.util.Scanner

object Main extends App{
  val sc = new Scanner(System.in)
  // val n = sc.nextLong()
  // val s = sc.nextLine()
  // val str = sc.next()

  val n = sc.nextInt()
  sc.nextLine()
  val ss = new Array[String](n)
  for(i <- 0 until n)
    ss(i) = sc.nextLine()

  val dp = new Array[Int](26)
  for(c <- ss(0))
    dp(c.toInt - 97) += 1

  for(i <- 1 until n){
    val now = ss(i)
    for(j <- 0 until 26){
      val tmp = now.count(_ == (97+j).toChar)
      dp(j) = Math.min(dp(j), tmp)
    }
  }

  var ans = ""
  for(i <- 0 until 26){
    ans += (i+97).toChar.toString * dp(i)
  }
  println(ans)
}


Measured memory_bytes: 25776
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
    ll n, y;
    cin >> n >> y;
    for (ll i = 0; i <= n ; i++){
        for (ll j = 0; j <= n ; j++){
            ll p = n - i - j;
            if (p < 0) continue;
            else{
                ll q = i * 10000 + j * 5000 + p * 1000;
                if(q == y){
                    cout << i << ' ' << j << ' ' << p << endl;
                    return 0;
                }
            }
        }
    }
    cout << -1 << ' ' << -1 << ' ' << -1 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <set>
#include <deque>
#include <utility>

int main(){
  int X, Y, Z, K;
  scanf("%d", &X);
  scanf("%d", &Y);
  scanf("%d", &Z);
  scanf("%d", &K);
  std::vector<long long > A(X), B(Y), C(Z);
  for (int i=0; i<X; i++){
    scanf("%lld", &A[i]);
  }
  for (int i=0; i<Y; i++){
    scanf("%lld", &B[i]);
  }
  for (int i=0; i<Z; i++){
    scanf("%lld", &C[i]);
  }
  std::vector<long long > BC;
  for (int i=0; i<Y; i++){
    for (int j=0; j<Z; j++){
      BC.push_back(B[i]+C[j]);
    }
  }
  std::sort(BC.begin(), BC.end());
  std::sort(A.begin(), A.end(), std::greater<int>());
  
  long long min = 1;
  long long max = 2e18;
  while(max-min>1){
    long long mid = (min+max)/2;
    int count = 0;
    for (int i=0; i<X; i++){
      auto itr = std::lower_bound(BC.begin(), BC.end(), mid-A[i]);
      count += BC.end()-itr;
    }
    if (count<K){
      max=mid;
    } else {
      min=mid;
    }
  }
  long long thresh = min - 2;
  //printf("thresh=%lld\n", thresh);
  std::vector<long long > ans;
  for (int i=0; i<X; i++){
    auto itr = std::lower_bound(BC.begin(), BC.end(), thresh-A[i]);
    while(itr!=BC.end()){
      ans.push_back(A[i]+(*itr));
      itr++;
    }
  }
  std::sort(ans.begin(), ans.end(), std::greater<long long >());
  for (int i=0; i<K; i++){
    printf("%lld\n", ans[i]);
  }
  return 0;
}
 

Measured memory_bytes: 535008
N = int(input())
buffet = [int(i) for i in input().split()]
satisfaction_level_B = [int(i) for i in input().split()]
satisfaction_level_C = [int(i) for i in input().split()]
result = 0

for i in range(N):
    result += satisfaction_level_B[buffet[i] - 1]
    if i > 0:
        if buffet[i] - buffet[i - 1] == 1:
            result += satisfaction_level_C[buffet[i - 1] - 1]
print(result)

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

int main(){
  int n,x,y;
  cin >> n >> x >> y;
  int ans[n];
  rep(i,0,n) ans[i]=0;

  rep(i,1,n+1)rep(j,1,n+1){
    if(i<j){
      int dis;
      dis = min({j-i, abs(j-x)+abs(i-y)+1, abs(i-x)+abs(j-y)+1});
      ans[dis]++;
    }
  }

  rep(i,1,n) cout << ans[i] << endl;

  return 0;
}

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

int main()
{
    int N;
    cin >> N;
    vector<string> s(N);
    vector<int> t(N);
    for (int i = 0; i < N; i++)
    {
        cin >> s[i] >> t[i];
    }

    string X;
    cin >> X;
    int ans = 0;
    bool sleep = false;
    for (int i = 0; i < N; i++)
    {
        if (sleep)
        {
            ans += t[i];
        }
        if (s[i] == X)
        {
            sleep = true;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		final Scanner sc = new Scanner(System.in);
		String s = sc.next();
		char cash = s.charAt(0);
		int ans = 0;
		for(char c: s.toCharArray()) {
			if(c!=cash) {
				ans++;
				cash = c;
			}
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 25684
N,Q=map(int,input().split())
S=input()
lc=[0 for i in range(N)]
for i in range(N-1):
    if S[i:i+2]=="AC":
        lc[i+1]=lc[i]+1
    else:
        lc[i+1]=lc[i]
llr=[]
for i in range(Q):
    llr.append(list(map(int,input().split())))
for i in range(Q):
    print(lc[llr[i][1]-1]-lc[llr[i][0]-1])


Measured memory_bytes: 30664
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a, b)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

ll D, c[33], s[444][33], t[444];
set<ll> s1[33], s2[33];

vector<ll> score(ll t[]) {
    ll last[33] = {}, i, j, sc = 0;
    vector<ll> v;
    v.pb(0);
    for (i = 1; i <= D; i++){
        sc += s[i][t[i]];
        last[t[i]] = i;
        for (j = 1; j <= 26;j++)
            sc -= c[j] * (i - last[j]);
        v.pb(sc);
    }
    return v;
}

ll cost(ll k, ll dis){
    return k * dis * (dis - 1) / 2;
}

int main(){
    ll i, j;
    cin >> D;
    for (i = 1; i <= 26;i++)
        cin >> c[i];
    for (i = 1; i <= D;i++)
        for (j = 1; j <= 26;j++)
            cin >> s[i][j];
    // for (i = 1; i <= D;i++){
    //     ll ma = -1e9, p = -1;
    //     for (j = 1; j <= 26; j++){
    //         if(c[j]*(i-last[j])+s[i][j]>ma){
    //             ma = c[j] * (i - last[j]) + s[i][j];
    //             p = j;
    //         }
    //     }
    //     t[i] = p;
    //     last[p] = i;
    // }
    for (i = 1; i <= 26;i++){
        s1[i].insert(D + 1);
        s2[i].insert(0);
    }
    for (i = 1; i <= D;i++){
        cin >> t[i];
        s1[t[i]].insert(i);
        s2[t[i]].insert(-i);
    }
    ll sc = score(t)[D];
    ll M;
    cin >> M;
    ll d, q;
    for (i = 0; i < M; i++){
        cin >> d >> q;
        ll bq = t[d];
        ll b = *s1[bq].upper_bound(d);
        ll a = *s2[bq].upper_bound(-d);
        sc -= s[d][bq];
        sc += s[d][q];
        ll l = d + a, r = b - d;
        sc += cost(c[bq], l);
        sc += cost(c[bq], r);
        sc -= cost(c[bq], l + r);
        s1[bq].erase(d);
        s2[bq].erase(-d);
        b = *s1[q].upper_bound(d);
        a = *s2[q].upper_bound(-d);
        l = d + a, r = b - d;
        sc -= cost(c[q], l);
        sc -= cost(c[q], r);
        sc += cost(c[q], l + r);
        s1[q].insert(d);
        s2[q].insert(-d);
        t[d] = q;
        cout << sc << endl;
    }
}

Measured memory_bytes: 3756
#include <bits/stdc++.h>   
#define rep(i, n) for(long long int i = 0; i < n; i++)
#define _rep(i, m, n) for(long long int i = m; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll mod = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
     
ll gcd(ll A, ll B){
    if(B == 0)return A;
    return gcd(B, A % B);
}
ll lcm(ll A, ll B){
    return A * B / gcd(A, B);
}
template <typename T>
T pow(T a, ll n, T e = 1) {
    T ret = e;
    while (n) {
        if (n & 1) ret *= a;
        a *= a;
        n >>= 1;
    }
    return ret;
}
 
template <int mod>
struct ModInt {
    int x;
    ModInt() : x(0) {}
    ModInt(long long x_) {
        if ((x = x_ % mod + mod) >= mod) x -= mod;
    }
    ModInt& operator+=(ModInt rhs) {
        if ((x += rhs.x) >= mod) x -= mod;
        return *this;
    }
    ModInt& operator-=(ModInt rhs) {
        if ((x -= rhs.x) < 0) x += mod;
        return *this;
    }
    ModInt& operator*=(ModInt rhs) {
        x = (unsigned long long)x * rhs.x % mod;
        return *this;
    }
    ModInt& operator/=(ModInt rhs) {
        x = (unsigned long long)x * rhs.inv().x % mod;
        return *this;
    }
 
    ModInt operator-() const { return -x < 0 ? mod - x : -x; }
    ModInt operator+(ModInt rhs) const { return ModInt(*this) += rhs; }
    ModInt operator-(ModInt rhs) const { return ModInt(*this) -= rhs; }
    ModInt operator*(ModInt rhs) const { return ModInt(*this) *= rhs; }
    ModInt operator/(ModInt rhs) const { return ModInt(*this) /= rhs; }
    bool operator==(ModInt rhs) const { return x == rhs.x; }
    bool operator!=(ModInt rhs) const { return x != rhs.x; }
    ModInt inv() const { return pow(*this, mod - 2); }
 
    friend ostream& operator<<(ostream& s, ModInt<mod> a) {
        s << a.x;
        return s;
    }
    friend istream& operator>>(istream& s, ModInt<mod>& a) {
        s >> a.x;
        return s;
    }
};
 
using mint = ModInt<1000000007>;
using Graph = vector<vector<int>>;
Graph G;
/*------------------------------------------------------------------*/
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int n; cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];

    vector<ll> dp(85);
    dp[0] = 1000;

    _rep(i, 1, n){
        dp[i] = dp[i - 1];
        rep(j, i){
            ll num = dp[j] / a[j];
            ll cost = dp[j] + (a[i] - a[j]) * num;
            dp[i] = max(dp[i], cost);
        }
    }
    cout << dp[n - 1] << endl;   
}

Measured memory_bytes: 3616
/* Look for:
* the exact constraints (multiple sets are too slow for n=10^6 :( )
* special cases (n=1?)
* 1LL<<i and not 1<<i
* overflow (ll vs int?)
* array bounds
* if you have no idea just guess the appropriate well-known algo instead of doing nothing :/
*/

// Author:: Subash Singha Roy
// Institution:: Jalpaiguri Government Engineering College

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define dd double
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define mod (ll)(998244353)
#define fr(i,a,b) for(ll i=a;i<b;i++)
#define frr(i,a,b) for(ll i=a-1;i>=b;i--)
#define tc(t) int t;cin >>t;while(t--)
#define pb emplace_back
#define ee emplace
#define rr return 0
#define mp make_pair
#define pr  pair <ll,ll>
#define ff first
#define ss second
#define pie 3.1415926535
#define inf 999999999999999999
ll mult(ll a,ll b, ll p=mod){return ((a%p)*(b%p))%p;}
ll add(ll a, ll b, ll p=mod){return (a%p + b%p)%p;}
ll fpow(ll n, ll k, ll p = mod) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n%p; n = n * n%p;} return r;}
ll inv(ll a, ll p = mod) {return fpow(a, p - 2, p);}
bool sa(const pair<ll,ll> &a,const pair<ll,ll> &b){return (a.second<b.second);}
bool fd(const pair<ll,ll> &a,const pair<ll,ll> &b){return (a.first>b.first);}
bool sd(const pair<ll,ll> &a,const pair<ll,ll> &b){return (a.second>b.second);}
ll dx[4]={0,0,1,-1};
ll dy[4]={1,-1,0,0};
bool valid(ll x,ll y,ll n,ll m){
    if(x<0 || y<0){
       return false;
   }
   else if(x>=n || y>=m){
       return false;
   }
   else
   return true;
}
dd ans;
ll n;
dd a[3005];
// void func(ll ind, ll head, dd curr){
//     if(ind==n){
//         if(head>(n/2)){
//             ans+=curr;
//         }
//         return;
//     }
//     func(ind+1,head,curr*(1.0-a[ind]));
//     func(ind+1,head+1,(curr*a[ind]));
//     return;
    
// }

int main(){
    fio
    cin>>n;
    ans=0.0;
    fr(i,0,n){
        cin>>a[i];
    }
    dd dp[3005][3005];
    memset(dp,0.0,sizeof(dp));
    dp[0][0]=1.0;
    fr(i,1,n+1){
        for(ll j=0;j<=i;j++){
            if(j==0){
                dp[i][j]=dp[i-1][j]*(1.0-a[i-1]);
                
            }
            else if(j==i){
                dp[i][j]=dp[i-1][j-1]*a[i-1];
            }
            else{
                dp[i][j]=dp[i-1][j-1]*a[i-1]+dp[i-1][j]*(1.0-a[i-1]);
            }
        }
    }
    for(ll j=0;j<=n;j++){
        if(j>n/2){
            ans+=dp[n][j];
        }
    }
    cout<<fixed<<setprecision(15)<<ans<<"\n";
    rr;
}

Measured memory_bytes: 70784
H, W = map(int, input().split())
a = [input() for _ in range(H)]
row = [False] * H
col = [False] * W
for i in range(len(row)):
  for j in range(len(col)):
    if a[i][j] == '#':
      row[i] = col[j] = True

for i in range(len(row)):
  if row[i]:
    for j in range(len(col)):
      if col[j]:
        print(a[i][j], end = '')
    print()

Measured memory_bytes: 4468
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

n, m = map(int, input().split())
graph = [0] + [[] for _ in range(n)]
for _ in range(m):
    a, b = map(int, input().split())
    graph[a].append(b)
    graph[b].append(a)

for v in graph[1:]:
    print(len(v))


Measured memory_bytes: 62164
#include <stdio.h>
#include <string.h>
#include <iostream>
#define Re register int

const int MAXV=100000;
int N,W,w[105],v[105],f[MAXV+5],ans;

template <typename T> inline void read(T &var)
{
	T x=0; int w=0; char ch=0;
	while (!isdigit(ch)) w|=ch=='-',ch=getchar();
	while (isdigit(ch)) x=x*10+ch-'0',ch=getchar();
	var=w?-x:x;
}
int main(int argc, char const *argv[])
{
	read(N),read(W); memset(f,0x3F,sizeof(f));
	for (Re i=1; i<=N; ++i)
		read(w[i]),read(v[i]); f[0]=0;
	for (Re i=1; i<=N; ++i)
		for (Re j=MAXV; j>=v[i]; --j)
		{
			f[j]=std::min(f[j],f[j-v[i]]+w[i]);
			if (f[j]<=W) ans=std::max(ans,j);
		}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 640
using System;
using System.Text;
using System.Collections.Generic;
using static System.Math;
using System.Linq;
using static System.Array;

namespace ConsoleApp2
{
    class Program
    {
        static long mod = 1000000007;
        static Node[] Nodes;
        static bool[] Used;
        static void Main(string[] args)
        {
            var NK = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            var N = NK[0];
            var K = NK[1];
            Nodes = new Node[N+1];
            Used = new bool[N + 1];

            for (int i = 1; i <= N; i++)
            {
                Nodes[i] = new Node();
            }

            for (int i = 0; i < N-1; i++)
            {
                var AB = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
                var A = AB[0];
                var B = AB[1];

                Nodes[A].AddAdj(B);
                Nodes[B].AddAdj(A);
            }
            long ans = 1;
            WFS();
            for (int i = 1; i <= N; i++)
            {
                var tmp = K - (Nodes[i].one + Nodes[i].sec);
                ans *= tmp;
                ans %= mod;
            }

            Console.WriteLine(ans);
        }

        static void WFS()
        {
            var que = new Queue<long>();
            que.Enqueue(1);
            Nodes[1].one = 0;
            Nodes[1].sec = 0;
            Used[1] = true;

            while (que.Count > 0)
            {
                var tmp2 = que.Dequeue();
                var top = Nodes[tmp2];
                Used[tmp2] = true;
                var count = 0;
                foreach (var item in top.adj)
                {
                    var tmp = Nodes[item];
                    if (!Used[item])
                    {
                        tmp.one = 1;
                        tmp.sec = count + top.one;
                        que.Enqueue(item);
                        count++;
                    }
                }
            }
        }
    }

    class Node
    {
        public List<long> adj;
        public long one = 0;
        public long sec = 0;

        public Node()
        {
            adj = new List<long>();
        }

        public void AddAdj(long node)
        {
            adj.Add(node);
        }
    }
}


Measured memory_bytes: 38824
n = int(input())
a = list(map(int, input().split()))

a_min = min(a)
a_max = max(a)

ans = 200**2 * 105
for b in range(a_min, a_max+1):
    cost = 0
    for i in range(n):
        cost += (a[i] - b) ** 2
    ans = min(ans, cost)

print(ans)


Measured memory_bytes: 3060
# AGC 015: A – A+...+B Problem
N, A, B = [int(s) for s in input().split()]

if A > B or (N == 1 and A != B):
    print(0)
elif A == B or B - A == 1:
    print(1)
else:
    print(B * (N - 2) - A * (N - 2) + 1)

Measured memory_bytes: 3060
#include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>

using namespace std;

int main(int argc, char *argv[])
{
  string s, t;
  cin >> s;
  cin >> t;
  int dp[3003][3003];

  std::fill(dp[0], dp[0] + 3003, 0);
  for (int i = 1; i <= s.size(); i++) {
    std::fill(dp[i], dp[i] + 300, 0);
    for (int j = 1; j <= t.size(); j++) {
      if (s[i-1] == t[j-1]) {
        dp[i][j] = dp[i-1][j-1] + 1;
      } else {
        dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
      }
    }
  }

  int i = s.size(), j = t.size();
  string ret = "";
  while (i > 0 && j > 0) {
    if (s[i-1] == t[j-1]) {
      ret += s[i-1];
      i--, j--;
    } else if (dp[i][j-1] > dp[i-1][j]) {
      j--;
    } else {
      i--;
    }
  }

  reverse(ret.begin(), ret.end());
  puts(ret.c_str());

  return 0;
}


Measured memory_bytes: 35456
#include "bits/stdc++.h"

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

const ll INF = 1LL << 60;
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

#define int long long

inline void my_io() {

	std::ios::sync_with_stdio(false);

	std::cin.tie(0);

	cout << fixed << setprecision(16);

	//cout << setprecision(10) << scientific << ans << endl;
}

signed main() {
	ll n;

	cin >> n;

	vector<ll> v(n);

	ll sum = 0;

	REP(i, n) {
		cin >> v[i];
		sum = (sum ^ v[i]);
	}

	if (sum == 0) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 1024
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<vector>
#include<set>
#include<unordered_set>
#include<map>
#include<unordered_map>
#include<string>

using namespace std;
int solve()
{
	int a;
	scanf("%d",&a);
	cout << a << endl;
	return 0;
}
int main(){
	int a,b;
	scanf("%d %d",&a,&b);
	printf("%d\n",a*b);
	return 0;
}

Measured memory_bytes: 3760
//includes
#include<iostream>
#include<vector>
#include<set>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<string>
#include<stack>
#include<map>
#include<queue>
#include<iomanip>
#include<numeric>
#include<assert.h>
#include<cstring>
#include<unordered_map>
#include<bitset>

//macros and consts
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(),(a).end()
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define FORE(i,a) for(auto &i : a)
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define accm accumulate
#define Fi first
#define Se second
#define INF 1e9
#define llINF (1LL<<60)
#define mINF -1e9
#define mllINF -(1LL<<60)
#define endl "\n"
#define CONT continue
#define BRK break
#define modulo(n, m) (((n)%(m)+(m))%m)

//shorter types
using namespace std;
using ll = long long;
using vi = std::vector<int>;
using vc = std::vector<char>;
using vll = std::vector<long long>;
using vs = std::vector<string>;
using Mi = map<int,int>;
using Mll = map<ll,ll>;
using UMi = unordered_map<int,int>;
using UMll = unordered_map<ll,ll>;
using Pi = pair<int,int>;
using Pll = pair<ll,ll>;
using vPi = vector<Pi>;
using vPll = vector<Pll>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<ll>>;
using vvc = vector<vector<char>>;
using vvs = vector<vector<string>>;
using pqgi = priority_queue<int,vector<int>,greater<int>>;
using pqsi = priority_queue<int,vector<int>,less<int>>;
using pqgll = priority_queue<int,vector<int>,greater<int>>;
using pssll = priority_queue<int,vector<int>,less<int>>;
template<class T>
using vec = vector<T>;

//here begins your code
signed main(){
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  int K,X;
  cin >> K >> X;

  if(K * 500 >= X){
  	cout <<"Yes" << endl;
  }
  else{
  	cout << "No" << endl;
  }
  //check types
  //do not eb if you resize
  //resize before you access by idx
  return 0;
} 

Measured memory_bytes: 256
#include<cstdio>
#include<set>
#include<string>
using namespace std;
multiset<string>s;
int main(){
	int aa,bb,cc,p=0;
	scanf("%d%d%d",&aa,&bb,&cc);
	p=aa+bb+cc;
	for(;aa--;)s.insert("a");
	for(;bb--;)s.insert("b");
	while(cc--)s.insert("c");
	while(--p){
		auto st=(*s.begin())+*(--s.end());
		s.erase(s.begin());
		s.erase(--s.end());
		s.insert(st);
	}
	puts((*s.begin()).c_str());
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
       
    while(true){
        int a= sc.nextInt();
        String op = sc.next();
        int b= sc.nextInt();
        switch(op){
            case "+":
            System.out.println(a+b);
            break;
            case "-":
            System.out.println(a-b);
            break;
            case "*":
            System.out.println(a*b);
            break;
            case "/":
            System.out.println(a/b);
            break;
            default:
            return;
        }
    }
    }
}


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

using QWORD = unsigned long long;
using SQWORD = long long;
using DWORD = unsigned int;
using SDWORD = int;
using WORD = unsigned short;
using SWORD = short;
using DOUBLE = double;
using FLOAT = float;

#define MIN_SDWORD (-2147483648)
#define MAX_SDWORD (2147483647)
#define ArrayLength(a)  (sizeof(a) / sizeof(a[0]))

static inline QWORD MAX(QWORD a, QWORD b) { return a > b ? a : b; }
static inline DWORD MAX(DWORD a, DWORD b) { return a > b ? a : b; }
static inline SDWORD MAX(SDWORD a, SDWORD b) { return a > b ? a : b; }
static inline QWORD MIN(QWORD a, QWORD b) { return a < b ? a : b; }
static inline DWORD MIN(DWORD a, DWORD b) { return a < b ? a : b; }
static inline SDWORD MIN(SDWORD a, SDWORD b) { return a < b ? a : b; }

#define BYTE_BITS   (8)
#define WORD_BITS   (16)
#define DWORD_BITS  (32)
#define QWORD_BITS  (64)

using M_BOOL = bool;
#define M_TRUE (true)
#define M_FALSE (false)

static void printMatrix(DWORD **p, DWORD dwSize)
{
    printf("---\n");
    for (DWORD i = 0; i < dwSize; i++) {
        for(DWORD j = 0; j < dwSize; j++) {
            printf("%5d", p[i*dwSize + j]);
        }
        cout << endl;
    }
    printf("---\n");
}

int main()
{
    DWORD dwInput_N, dwInput_M, dwInput_Q;
    char str[200];

    cin.getline(str, sizeof(str));
    dwInput_N = atoi(strtok(str, " "));
    dwInput_M = atoi(strtok(NULL, " "));
    dwInput_Q = atoi(strtok(NULL, " "));

    /* input train */
    static DWORD aadwTrainMap[501][501];
    for (DWORD dwIdx = 0; dwIdx < dwInput_M; dwIdx++) {
        cin.getline(str, sizeof(str));
        WORD wCity_L, wCity_R;

        wCity_L = atoi(strtok(str, " "));
        wCity_R = atoi(strtok(NULL, " "));
        aadwTrainMap[wCity_L][wCity_R]++;
    }

    /* calc camsum(Row, Col) */
    for (DWORD dwRow = 1; dwRow <= dwInput_N; dwRow++) {
        DWORD dwSum = 0;
        for (DWORD dwCol = 1; dwCol <= dwInput_N; dwCol++) {
            dwSum += aadwTrainMap[dwRow][dwCol];
            aadwTrainMap[dwRow][dwCol] = dwSum + aadwTrainMap[dwRow-1][dwCol];
        }
    }

    /* input question */
    for (DWORD dwIdx = 0; dwIdx < dwInput_Q; dwIdx++) {
        DWORD dwAnswer;
        cin.getline(str, sizeof(str));
        WORD wBegin = atoi(strtok(str, " "));
        WORD wEnd   = atoi(strtok(NULL, " "));

        dwAnswer= (aadwTrainMap[wEnd][wEnd]
                    - aadwTrainMap[wBegin-1][wEnd]
                    - aadwTrainMap[wEnd][wBegin-1]
                    + aadwTrainMap[wBegin-1][wBegin-1]);
        printf("%d\n", dwAnswer);
    }

    return 0;

}


Measured memory_bytes: 1920
#include <iostream>
#include <vector>
#include <bitset>
#include <cmath>

using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const ll MASK = (1 << 18) - 1;
ll ends;
ll n, a, b, c;

ll dp[50][2][(1 << 18)];
ll cl;
int main()
{
    cin >> n >> a >> b >> c;
    cl = (1 << c) + (1 << (b + c)) + (1 << (a + b + c));
    dp[0][0][(1 << 0)] = 1;
    //cout << cl << endl;
    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= 10; j++)
        {
            for (int mask = 0; mask < (1 << 18); mask++)
            {
                long long news = ((mask << j) & MASK);
                news |= 1;
                //cout << mask << " " << j << " " << news << endl;
                dp[i][1][news] += (dp[i - 1][1][mask]);
                if ((news & cl) == cl)
                    dp[i][1][news] += dp[i - 1][0][mask];
                dp[i][1][news] %= MOD;
                if ((news & cl) != cl)
                    dp[i][0][news] += dp[i - 1][0][mask];
                dp[i][0][news] %= MOD;
                if (dp[i][0][news] != 0 || dp[i][1][news] != 0)
                {
                    ;//cout << i << " " << news << " - " << dp[i][0][news] << " " << dp[i][1][news] << endl;
                }
            }
        }
    }
    ll ans = 0;
    for (int i = 0; i < (1 << 18); i++)
    {
        ans += dp[n][1][i];
    }
    ans %= MOD;
    cout << ans;
}


Measured memory_bytes: 166144
str=input()

N=len(str)

def kaibun(STR):
  n=len(STR)
  for i in range(int((n+1)/2)):
    if STR[i]==STR[n-1-i]:
      pass
    else:
      return False
  return True

if(kaibun(str) and kaibun(str[0:int((N-1)/2)]) and kaibun(str[int((N+3/2)-1):N-1])):
    print("Yes")
else:
    print("No")





Measured memory_bytes: 9144
#include <stdio.h>

int main()
{
	int i, N, M, A[200001], B[200001];
	long long K;
	scanf("%d %d %lld", &N, &M, &K);
	for (i = 1; i <= N; i++) scanf("%d", &(A[i]));
	for (i = 1; i <= M; i++) scanf("%d", &(B[i]));
	
	int j, max = 0;
	long long sum = 0;
	for (i = 1; i <= N; i++) sum += A[i];
	for (i = N, j = 0; i >= 0; sum -= A[i--]) {
		for (; j < M && sum + B[j+1] <= K; sum += B[++j]);
		if (sum <= K && i + j > max) max = i + j;
	}
	printf("%d\n", max);
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 3276
#include <iostream>
#include <cmath>
#include <algorithm>
#include <cstdio>
#include <sstream>
#include <string>
#include <map>
#include <set>
using namespace std;

#define loop(i,a,b) for(int i=(a);i<int(b);i++)
#define rep(i,b) loop(i,0,b)
#define all(c) (c).begin(), (c).end()

using namespace std;

int main(){
    int a,b,c;
    cin>>a>>b>>c;
    puts((a && b) || c ? "Open" : "Close");
}

Measured memory_bytes: 1108
#include"bits/stdc++.h" 
using namespace std;
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
typedef long long int ll;
vector<int>u;
vector<int>w;
vector<int>::iterator it;
priority_queue<int>pq;
const int N=1e5+10;
/*--------------------------hbp16@hbp16-Inspiron-3543:-$------------------------------*/
int main(int argc, char const *argv[])
{
	ll n;
	cin>>n;
	ll x[n];
	ll hash[n+1];
	ll res=0;
	memset(hash,0,sizeof(hash));

	for(ll i=0;i<n;i++)
	{
		cin>>x[i];
		hash[x[i]]++;
	}

	for(ll i=0;i<=n;i++)
	{
		res += 1ll*hash[i]*(hash[i]-1)/2;
	}
	for(ll i=0;i<n;i++)
	{
		cout<<(res-hash[x[i]]+1)<<endl;
	}

	return 0;
}

Measured memory_bytes: 5760
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

var sc = bufio.NewScanner(os.Stdin)

const inf = 1 << 60

func ri() (n int) {
	sc.Scan()
	b := sc.Bytes()
	x := 1
	if b[0] == 45 {
		x *= -1
		b = b[1:]
	}
	for _, v := range b {
		n = n*10 + int(v-48)
	}
	return n * x
}

func main() {
	sc.Split(bufio.ScanWords)
	n, k := ri(), ri()
	v := make([]int, n)
	for i := 0; i < n; i++ {
		v[i] = ri()
	}
	ans := 0
	for l := 0; l <= n && l <= k; l++ {
		for r := 0; r+l <= n && r+l <= k; r++ {
			d := k - (l + r)
			a := make([]int, l+r)
			a = append(a, v[:l]...)
			a = append(a, v[n-r:]...)
			sort.Ints(a)
			tmp := 0
			for _, aa := range a {
				if aa < 0 && d != 0 {
					d--
					continue
				} else {
					tmp += aa
				}
			}
			if tmp > ans {
				ans = tmp
			}
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 1792