akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const double PI=3.14159265358979;
const ll INF= pow(10,18);
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main() {
  ll s,w;
  cin >> s >> w;
  if(s>w){
    cout << "safe" << endl;
  }
  else{
    cout << "unsafe" << endl;
  }
}

Measured memory_bytes: 3636
N = int(input())
A = list(map(int, input().split()))

sorted_A = sorted(A, reverse=True)

alice = 0
bob = 0
for index, point in enumerate(sorted_A):

  # Alice
  if (index + 1) % 2 != 0:
    alice = alice + point
  
  # Bob
  else:
    bob = bob + point
 
answer = alice - bob

print(answer)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define rev(v) reverse(v.begin(), v.end())
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
#define uniq(a) sort(all(a));(a).resize(unique(all(a)) - a.begin());
#define dab(v) for(auto i:v) cout << i << ' ' << endl;
#define vin(v) for (ll i = 0; i < v.size(); ++i) cin >> v[i];
#define vin2(v, w) for (ll i = 0; i < v.size(); ++i) cin >> v[i] >> w[i];
template<class T> bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T& a, const T& b) { if (a > b) { a = b; return 1; } return 0; }
int dx[] = { 0, 0, -1, 1 };
int dy[] = { 1, -1, 0, 0 };
int gcd(int a, int b) { if (a % b == 0) { return(b); } else { return(gcd(b, a % b)); } }

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//cout << fixed << setprecision(18);
	
	char chr;
	cin >> chr;
	if(chr <= 'z' && chr >= 'a')cout << "a";
	else cout << "A";
	return 0;
}

Measured memory_bytes: 3652
<?php
while (True) {  
  fscanf(STDIN, "%d %d", $h, $w);
  if ($h === 0 && $w === 0) {
    break;
  }
  if ($h > 2 && $w > 2) {
    echo str_repeat("#", $w)."\n";
    for ($i = 0; $i < $h - 2; $i++) {
      echo "#".str_repeat(".", $w - 2)."#\n";
    }
    echo str_repeat("#", $w)."\n";
  }
  echo "\n";
  unset($h);
  unset($w);
}


Measured memory_bytes: 9224
#include <bits/stdc++.h>
#define pii pair<int,int>
#define mp make_pair
#define ll long long

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

using namespace std;

//int c=0;
int maxHappy(vector<vector<int>> &a,vector<vector<int>> &dp,int n,int i,int j)
{
	if(i>=n)
	{
		return 0;
	}
	if(dp[i][j]!=-1)
	{
		//c++;
		return dp[i][j];
	}
	int m=0;
	for(int k=0;k<3;k++)
	{
		if(k!=j)
		{
			m=max(m,a[i][k]+maxHappy(a,dp,n,i+1,k));
		}
	}
	return dp[i][j]=m;
}

int main()
{
	fastio
	int n,i,j;
	cin>>n;
	vector<vector<int>> a(n,vector<int>(3));
	vector<vector<int>> dp(n,vector<int>(4,-1));
	for(i=0;i<n;i++)
	{
		for(j=0;j<3;j++)
		{
			cin>>a[i][j];
		}
	}
	int ans=0;
	ans=maxHappy(a,dp,n,0,3);
	//cout<<c<<" "<<ans;
	cout<<ans;
}

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

using ll = long long;
using ull = unsigned long long;

const double PI = acos(-1);
const int inf = 2e9;
const ll INF = 2e18;
const ll MOD = 1e9+7;

#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
#define REP(i,n) for (int i = 0; i<n; i++)
#define ALL(a) begin(a), end(a)

int main (void) {
    int N;
    cin >> N;
    vector<bool> a(N+10);
    REP(i,N) {
        int t;
        cin >> t;
        if (t) a[i+1] = true;
        else a[i+1] = false;
    }
    vector<int> num(N+10,0);
    vector<int> ans;
    for (int i=N; i>=1; i--) {
        if ((num[i]%2 && a[i]) || (num[i]%2 == 0 && !a[i])) {
            // 置かない

        }
        else if ((num[i]%2 && !a[i]) || (num[i]%2 == 0 && a[i])) {
            // 置く
            for (int j=1; j*j <= i; j++) {
                if (i % j == 0) {
                    num[j]++;
                    if (j*j != i) {
                        num[i/j]++;
                    }
                }
            }
            ans.pb(i);
        }
    }
    for (int i=1; i<=N; i++) {
        if (a[i]) {
            if (num[i]%2 == 0) {
                cout << -1 << endl;
                return 0;
            }
        }
        else {
            if (num[i]%2) {
                cout << -1 << endl;
                return 0;
            }
        }
    }
    cout << ans.size() << endl;
    
    REP(i,ans.size()) {
        cout << ans[i] << " \n"[i==ans.size()-1];
    }
    
 
    return 0;
}

Measured memory_bytes: 2428
using System;

namespace A___Where_s_Snuke
{
    class Program
    {
        static void Main (string[] args)
        {
            var input = Console.ReadLine ().Split (' ');
            var h = int.Parse (input[0]);
            var w = int.Parse (input[1]);
            var str = "";
            for (var i = 0; i < h; i++)
            {
                input = Console.ReadLine ().Split (' ');
                for (var j = 0; j < w; j++)
                {
                    if (input[j] == "snuke")
                    {
                        str = ($"{Convert.ToChar(j+65)}{i+1}");
                    }
                }
            }
            Console.WriteLine (str);
        }
    }
}

Measured memory_bytes: 13268
#include<bits/stdc++.h>
#define mod 1e9L + 7
using namespace std;

using ll = long long;


void add_self(int& a, int b)
{
  a += b;
  if(a > mod)
    a -= mod;
}

int main()
{
  int n;
  scanf("%d", &n);
  int a[n][n];
  for(int i = 0; i < n; i++)
  {
    for(int j = 0; j < n; j++)
    {
      scanf("%d", &a[i][j]);
    }
  }
  vector<int> dp(1 << n);
  // dp[i][j] will store the numbers of ways in which we can assign j people from i persons
  
  dp[0] = 1;
  for(int mask = 0; mask < (1 << n) - 1; mask++)
  {
    int person = __builtin_popcount(mask);
    for(int j = 0; j < n; j++)
    {
      if(a[person][j] && !(mask & (1 << j)))
      {
        add_self(dp[mask | (1 << j)], dp[mask]);
      }
    }
  }

  printf("%d", dp[(1 << n) - 1]);
  
  return 0;
}


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

using namespace std;

int x;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie();
    cout.tie();

    cin >> x;

    if (x < 1200) {
        cout << "ABC" << endl;
    } else {
        cout << "ARC" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<stack>
#include<random>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<double,double> pdd;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef set<int> si;
typedef map<int, int> mii;

using namespace std;

typedef long long ll;
typedef double db;
typedef vector<int> vint;
typedef vector<ll> vll;

int main(){
    int n,g=0,k=0;
    cin>>n;
     vi a(n);

    for(int i=0; i<n; i++){
        cin>>a[i];
        if(a[i]%2==0)g++;
        if(a[i]%2==1)k++;
    }

    int ans=0;
    ans=pow(3,n)-pow(2,g);
    cout<<ans<<endl;


    return 0;
}

Measured memory_bytes: 640
#include <stdio.h>

int a[100000];
int b[100000];
int cnt=0;
int main(void)
{
	while(1){
		scanf("%d %d",&a[cnt],&b[cnt]);
		if((a[cnt]==0)&(b[cnt]==0)) break;
		cnt++;//0,0も入ってしまってる
	}//配列添字maxとcnt同じ
	int p,c;
	for(p=0;p<cnt;p++){
		if(a[p]>b[p]){
			c=a[p];
			a[p]=b[p];
			b[p]=c;
		}
		printf("%d %d\n",a[p],b[p]);
	}
	
	
	
	return 0;
}

Measured memory_bytes: 620
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQG = priority_queue<T, vector<T>, greater<T> >;
const int INF = 0xccccccc;
const ll LINF = 922337203685477580LL;
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);}
template<typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) { return is >> p.first >> p.second;}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) { return os << p.first << ' ' << p.second;}

const int N = 110;
const int K = 1e5+10;

//head

int n, k;
int a[N];
int win[K];

int dfs(int i) {
  if(win[i] != -1) return win[i];
  int &res = win[i] = 0;
  rep(j, n) {
    if(i-a[j] >= 0 and dfs(i-a[j]) == 0) res = 1;
  }
  return res;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> k;
  rep(i, n) cin >> a[i];
  memset(win, -1, sizeof(win));
  win[0] = 0;
  cout << (dfs(k)?"First":"Second") << endl;
  //rep(i, 10) cout << i << ' ' << win[i] << endl;
}

Measured memory_bytes: 8700
#include <queue>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <string>
#include <vector>
#include <map>

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vint;
typedef vector<string> vstr;
typedef pair<ll, ll> pint;
unsigned long long inf = (1LL << 62);
ll mod = 1000000007;

//bool operator< (pint a, pint b) {
	//return a.second < b.second;

//}



ll gcd(ll a, ll b) {

	if (b == 0)
		return a;

	return gcd(b, a % b);


}

ll max(ll a, ll b) {
	if (a < b) {
		return b;
	}
	else
		return a;

}

ll min(ll a, ll b) {
	if (a < b)
		return a;

	return b;
}




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

vector<pint> list;










void floyd(int N, ll** d) {

	rep(k, N+1){
		rep(i, N+1) {
			if (d[i+1][k+1] == inf) continue;
			rep(j, N+1) {
				if (d[j+1][k+1] == inf) continue;

				d[i+1][j+1] = min(d[i+1][j+1], d[i+1][k+1] + d[j+1][k+1]);

			}

		}
	}




}


ull modpow(ull a, ull b) {
	ll retval = 0;

	if (b == 0) { return 1; }

	else if (b % 2 == 0) {
		retval = modpow(a, b / 2) % mod;
		return (retval * retval) % mod;
	}

	else {
		
		return ((a % mod) * modpow(a, b - 1)) % mod;
	}
}

ull modkaijou(ull a) {

	if (a == 1 || a == 0) { return 1; }

	ll retval = 1;

	for (ull i = a; i >= 1; i--) {
		retval = (retval * (i % mod)) % mod;
	}

	return retval % mod;
}

ull modcomb(ull a, ull b) {

	if (a == 0 || b == 0) return 1;

	return (((modkaijou(a) * modpow(modkaijou(a-b), mod - 2)) % mod) * modpow(modkaijou(b), mod - 2)) % mod;
}


vector<pint> query;

stack<int> to_1;


class DisjointSet {
public:
	vector<int> p, rank, num;


	DisjointSet() {}

	DisjointSet(int size) {
		rank.resize(size, 0);
		p.resize(size, 0);
		num.resize(size, 0);
		rep(i, size) { p[i] = i; rank[i] = 0; num[i] = 1; }
	}

	bool same(int x, int y) {

		return findSet(x) == findSet(y);

	}

	void unite(int x, int y) {
		link(findSet(x), findSet(y));
	}

	void link(int x, int y) {
		if (rank[x] > rank[y]) {

			p[y] = x;
			num[x] += num[y];

		}

		else {
			p[x] = y;
			num[y] += num[x];
			if (rank[x] == rank[y]) {

				rank[y]++;
			}

		}


	}


	ll NumberOfElements(int x) {

		return num[findSet(x)];

	}


	int findSet(int x) {
		if (x != p[x]) {
			p[x] = findSet(p[x]);
			num[x] = 1;
		}

		return p[x];
	}



};



ll s[100005], t[100005], anslist[100005];

ll b[100], a[100];



ll dfs(ll N, ll X) {

	if (X <= 0)
		return 0;
	if (N == 0) {
		return 1;
	}

	else if (X >= b[N - 1] + 2 && X < b[N]) {

		return a[N - 1] + 1 + dfs(N - 1, X - b[N - 1] - 2);
	}

	else if (X > 0 && X < b[N - 1] + 2) {
		return dfs(N - 1, X - 1);
	}

	else {
		return a[N];
	}

}





int main() {
	ll N, X;

	cin >> N >> X;

	b[0] = 1;
	a[0] = 1;

	rep(i, 50) {
		a[i + 1] = 2 * a[i] + 1;
		b[i + 1] = 2 * b[i] + 3;
	}
	
	cout << dfs(N, X) << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <chrono>
#include <random>
#include <cassert>

std::mt19937 rng((int) std::chrono::steady_clock::now().time_since_epoch().count());

int main() {
	std::ios_base::sync_with_stdio(false); std::cin.tie(NULL);
	int n;
	std::cin >> n;
	std::vector<long long> a(n+1, 0);
	for(int i = 0; i <= n; i++) {
		std::cin >> a[i];
	}
	auto sum = a;
	for(int i = n; i > 0; i--) {
		sum[i-1] += sum[i];
	}
	sum.push_back(0);
	long long rest = 1;
	long long ans = 0;
	for(int i = 0; i <= n; i++) {
		ans += rest;
		rest -= a[i];
		//std::cout << "at " << i << " rest is " << rest << '\n';
		if(rest < 0) {
			std::cout << "-1\n";
			return 0;
		}
		rest = std::min(2 * rest, sum[i+1]);
	}
	std::cout << ans << '\n';
}

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

int B(int x){
  if(x%2>0){
    return 0;
  }else if(x%4>0){
    return 1;
  }
  return 2;
}

int main(){
  int N,x;
  cin >> N;
  vector<int> D(3,0);
  for(int i=0;i<N;i++){
    cin >> x;
    D[B(x)] ++;
  }
  if(D[0]>D[2]+1){
    cout << "No" << endl;
    return 0;
  }else if(D[0]==D[2]+1&&D[1]>0){
    cout << "No" << endl;
    return 0;
  }
  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
using namespace std;
typedef long long ll;

int main() {
  ll A, B, C, K;
  cin >> A >> B >> C >> K;
  ll ret = 0;
  ret += min(K, A);
  K = max(0ll, K-A);
  if (K > 0) {
    K = max(0ll, K-B);
    if (K > 0) {
      ret -= min(K, C);
    }
  }

  cout << ret << endl;
  return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define mod 998244353
#define MOD 1000000007
#define inf 0x3f3f3f3f
#define linf 0x3f3f3f3f3f3f3f3fll
typedef long long ll;
typedef pair<int,int> pii;
typedef unsigned long long ull;
ll h;
int n;
int main()
{
	scanf("%lld%d",&h,&n);
	ll sum=0;
	for(int i=0;i<n;i++)
	{
		ll x;
		scanf("%lld",&x);
		sum+=x;
	}
	if(sum>=h)printf("Yes\n");
	else printf("No\n");
	return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout<<setprecision(32);

	int n;
	cin>>n;
	vector<int> a(n);
	for(int i = 1; i <= n; i++){
		int x; cin>>x;
		a[x - 1] = i;
	}
	for(auto x : a){
		cout<<x<<" ";
	}
	cout<<endl;

	return 0;
}

Measured memory_bytes: 1280
using System;
public class Hello
{public static void Main()
{
  string[] a=Console.ReadLine().Split(' ');
  int A = int.Parse(a[0]);
  int B = int.Parse(a[1]);
  int C = int.Parse(a[2]);//delicious cookie number
  int n = 0;
  if(A+B>=C)Console.WriteLine(B+C);
  else Console.WriteLine(B+C-(C-(A+B+1)));
}
}

Measured memory_bytes: 13140
use proconio::*;
#[allow(unused_imports)]
use proconio::marker::*;

#[fastout]
#[allow(non_snake_case)]
fn main() {
    let mut flag = false;
    let mut ans = 1;
    let bound = 10u128.pow(18u32);
    input! {
        N: usize, A: [u128; N],
    }
    for a in A.iter() {
        ans *= a;
        if ans > bound {
            flag = true;
        }
        if *a == 0 {
            flag = false;
        }
    }
    if flag {
        println!("-1");
    } else {
        println!("{}", ans);
    }
}


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

int main()
{
  int N; cin >> N;
  vector<int> A(3), B(3);
  cin >> A[0] >> A[1] >> A[2];
  cin >> B[0] >> B[1] >> B[2];

  vector<long long> dp1(N + 1, 0);
  for (int i = 0; i < N; i++)
  {
    for (int p = 0; p < 3; p++)
    {
      if (A[p] >= B[p]) continue;
      if (i + A[p] <= N) {
        dp1[i + A[p]] = max(dp1[i + A[p]], dp1[i] - A[p] + B[p]);
      }
    }
  }
  long long maxget = 0;
  for (int i = 0; i <= N; i++) maxget = max(maxget, dp1[i]);

  long long now = N + maxget;
 
  vector<long long> dp2(now + 1, 0);
  for (int i = 0; i < now; i++)
  {
    for (int p = 0; p < 3; p++)
    {
      if (B[p] >= A[p]) continue;
      if (i + B[p] <= now) {
        dp2[i + B[p]] = max(dp2[i + B[p]], dp2[i] - B[p] + A[p]);
      }
    }
  }
  maxget = 0;
  for (int i = 0; i <= now; i++) maxget = max(maxget, dp2[i]);
  cout << now + maxget << endl;
}

Measured memory_bytes: 195584
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n
    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.parents[x] > self.parents[y]:
            x, y = y, x
        self.parents[x] += self.parents[y]
        self.parents[y] = x
    def size(self, x):
        return -self.parents[self.find(x)]
    def same(self, x, y):
        return self.find(x) == self.find(y)
    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]
    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]
    def group_count(self):
        return len(self.roots())
    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}
    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

def main():
    n, frnd, blck = map(int, input().split())
    blst = [set() for i in range(n)]
    flst = [set() for i in range(n)]
    uf = UnionFind(n)
    for _ in range(frnd):
        a, b = map(int, input().split())
        a -= 1
        b -= 1
        flst[a].add(b)
        flst[b].add(a)
        uf.union(a, b)
    for _ in range(blck):
        c, d = map(int, input().split())
        c -= 1
        d -= 1
        blst[c].add(d)
        blst[d].add(c)
    for i in range(n):
        ans = uf.size(i) - len(flst[i]) - 1
        for v in blst[i]:
            if uf.same(i, v):
                ans -= 1
        print(ans, end="")
        if i < n:
            print(" ", end="")

if __name__ == "__main__":
    main()

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

dp = [[0] * (n+1) for _ in range(n+1)]

p = []
for i in range(n):
    p.append((a[i], i))
p.sort(key=lambda x: -x[0])

for i in range(n):
    pi = p[i][1]
    for l in range(i+1):
        r = i - l
        dp[i+1][l+1] = max(dp[i+1][l+1], dp[i][l] + (pi-l)*a[pi])
        dp[i+1][l] = max(dp[i+1][l], dp[i][l] + ((n-r-1)-pi)*a[pi])

ans = 0
for i in range(n+1):
    ans = max(ans, dp[n][i])

print(ans)


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

int main() {
  int d,g;
  cin>>d>>g;
  g/=100;
  int p[15],c[15],sum[15];
  for (int i=0; i<d; i++) {
    cin>>p[i]>>c[i];
    c[i]/=100;
    sum[i]=(i+1)*p[i]+c[i];
  }
  int ans=1e9;
  for (int i=0; i<(1<<d); i++) {
    int add=0,cnt=0;
    for (int j=0; j<d; j++) {
      if (i&(1<<j)) {
	add+=sum[j];
	cnt+=p[j];	
      }
    }
    if (add>=g) {
      ans=min(ans,cnt);
      continue;
    }
    for (int j=d-1; j>=0; j--) {
      if (!(i&(1<<j))) {
	if (add+sum[j]-c[j]<=g) break;
	else {
	  cnt+=(g-add+j+1-1)/(j+1);
	  ans=min(ans,cnt);
	  break;
	}
      }
    }
  }
  cout<<ans<<endl;     
  return 0;
}





Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	int a,b,c=0,i,j;
	getline(cin,s);
	for(i=0;i<s.size();i++)
	{
		if(s[i]==' ')
		{
			if(s[i-1]==s[i+1]) c++;
		}
	}
	if(c==2) cout<<"YES";
	else cout<<"NO";
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TOPSIC
{
    class Program
    {
        static void Main(string[] args)
        {
          //入力値をスペース区切りで配列に格納
            string[] inputStr = Console.ReadLine().Split(' ');

            int N = int.Parse(inputStr[0]);
            int K = int.Parse(inputStr[1]);

            int ans1 = N;
            int ans = 0;

            while (true)
            {
                ans1 = ans1 / K;
                ans++;

                if (ans1 == 0)
                {
                    Console.WriteLine(ans);
                    break;
                }

            }

        }
    }
}


Measured memory_bytes: 11092
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        int n = Integer.parseInt(sc.next());
        
        double a = 0;
        for(int i = 1; i <= n; i++){
            if(i%2 == 1){
                a++;
            }
        }
        
        double d = a/n;
        System.out.println(d);
    }
}

Measured memory_bytes: 23636
//　input:3 4
//　output：積が奇数なら Odd と、 偶数なら Even と出力せよ。

function Main(input) {
    // 1行目がinput[0], 2行目がinput[1], …に入る
    input = input.split(" ");

    var a = input[0];
    var b = input[1];

    var res = a * b % 2 === 0 ? 'Even' : 'Odd';

    //出力
    console.log(res);
}

//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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



Measured memory_bytes: 3088
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 9999999

using namespace std;

typedef pair<int, int> P;

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

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



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


void solve(long long N){
  cout << N/3 << "\n";
}

// Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
  long long N;
  scanf("%lld",&N);
  solve(N);
  return 0;
}


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

int main(){
  int n,m;
  cin >> n >> m;
  vector<int> x(m);
  for(int i=0; i<m; ++i){
    cin >> x[i];
  }
  sort(x.begin(), x.end());
  vector<int> kyori(m-1);
  for(int i=0; i<m-1; ++i){
    kyori[i] = x[i+1] - x[i];
  }
  sort(kyori.begin(), kyori.end());
  int sum=0;
  for(int i=0; i<m-n; ++i){
    sum += kyori[i];
  }
  cout << sum << endl;
  return 0;
}


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

int top,stack[1000];

void push(int);
int pop();

int main(){
  int a,b;
  top = 0;
  char s[1000];

  while(scanf("%s",s) != EOF){
    if(s[0] =='+'){
      a = pop();
      b = pop();
      push(a + b);
    }

    else if(s[0]=='-'){
      b = pop();
      a = pop();
      push(a-b);
    }

    else if(s[0]=='*'){
      a = pop();
      b = pop();
      push(a*b);
    }

    else {
      push(atoi(s));
    }
  }

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

  return 0;

}

void push(int x){
  stack[++top] = x;
}

int pop(){
  top--;
  return stack[top+1];
}



Measured memory_bytes: 2108
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){
    int n,m;
    int ans=0;
    cin >> n >> m;
    vector<vector<int>> s(m);
    vector<int> p(m);
    rep(i,m){
        int k;
        cin >> k;
        rep(j,k){
            int a;
            cin >> a;
            a--;
            s.at(i).push_back(a);
        }
    }
    rep(i,m) cin >> p[i];
    
    rep(bit,1<<n){
        vector<int> cnt(m);
        bool ok=true;
        rep(i,m){
            rep(j,s[i].size()){
                if(bit>>s[i][j]&1){
                    cnt[i]++;
                }
            }
        }
        rep(i,m){
            if(cnt[i]%2 != p[i]) ok = false;
        }
        if(ok) ans++;
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
    int N;
    cin >> N;
    if (N == 25) cout << "Christmas" << endl;
    else if (N == 24) cout << "Christmas Eve" << endl;
    else if (N == 23) cout << "Christmas Eve Eve" << endl;
    else if (N == 22) cout << "Christmas Eve Eve Eve" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
#include <iomanip>
#include <set>
#include <stack>
#include <cassert>
#include <functional>
#include <random>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<vvvl> vvvvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vvb> vvvb;
typedef vector<vvvb> vvvvb;
typedef vector<string> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef pair<ll, ll> PL;
typedef vector<PL> vpl;
typedef vector<vector<PL>> vvpl;
typedef vector<vvpl> vvvpl;
const int INF = 1001001001;
const ll LINF = 1e17;
const double pi = 3.1415926535897932;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define RFOR(i, a, b) for(ll i = (a); i > b; i--)
#define rep(i, n) for(ll i = 0; i < n; i++)
#define rrep(i, n) for(ll i = n-1; i > -1; i--)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second
#define pb push_back
#define epb emplace_back
#define ALL(X) (X).begin(),(X).end()

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};
bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};
bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};
bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    sort(ALL(vec));
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}

inline ll popcnt(ll x){return __builtin_popcountll((unsigned long long)x);};
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
//friend bool operator<(const stc& lhs, const stc& rhs){
//    return std::tie(lhs.l, lhs.r) < std::tie(rhs.l, rhs.r);
//}



int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    ll N; cin >> N;
    vl L(N); rep(i, N) cin >> L[i];
    sort(ALL(L));
    ll ans = 0;
    rep(i, N) FOR(j, i+1, N){
        ll a = L[i], b = L[j];
        auto lidx = upper_bound(ALL(L), max(b-a, a-b)) - L.begin();
        auto ridx = lower_bound(ALL(L), a+b) - L.begin();
        ans += ridx-lidx;
        if(lidx <= i) ans--;
        if(ridx > j) ans--;
    }
    cout << ans/3 << endstr;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = s; i < (int)(n); i++)
#define out(x) cout << x << endl
#define INF 1000000;
#include <map>
#include <math.h>
 
using ll = long long;
using namespace std;
 
 
int main(){
    ll n; cin >> n;
    vector<int> a(202000,0);
    rep(i, n-1){
        int boss;
        cin >> boss;
        a.at(boss-1)++;
    }
    rep(i, n) cout << a.at(i) << endl;
}



Measured memory_bytes: 4052
use std::io::stdin;
use std::str::FromStr;
use std::collections::HashMap;

fn read_line<T>() -> Vec<T>
where
    T: FromStr,
    <T as std::str::FromStr>::Err: std::fmt::Debug,
{
    let mut s = String::new();
    stdin().read_line(&mut s).ok();
    s.trim()
        .split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect()
}

fn main() {
    let in_vec: Vec<usize> = read_line();
    let n = in_vec[0];
    let m = in_vec[1];

    let h: Vec<usize> = read_line();

    let mut link_map: HashMap<usize, Vec<usize>> = HashMap::new();
    for _i in 0..m {
        let in_vec: Vec<usize> = read_line();
        let a = in_vec[0];
        let b = in_vec[1];
        if link_map.contains_key(&(a - 1)) {
            (*(link_map.get_mut(&(a - 1)).unwrap())).push(b - 1);
        } else {
            link_map.insert(a - 1, vec![b - 1]);
        }
        if link_map.contains_key(&(b - 1)) {
            (*(link_map.get_mut(&(b - 1)).unwrap())).push(a - 1);
        } else {
            link_map.insert(b - 1, vec![a - 1]);
        }
    }

    let mut res = 0;
    'outer: for key in 0..n {
        if link_map.contains_key(&key) {
            let key_hight = h[key];
            let val = link_map.get(&key).unwrap();
            for &val_i in val.iter() {
                let val_height = h[val_i];
                if key_hight <= val_height {
                    continue 'outer;
                }
            }
            res += 1;
        } else {
            res += 1;
        }
    }

    println!("{}", res);
}


Measured memory_bytes: 11520
#include <iostream>
#include <cstdio>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <stdlib.h>
#include <functional>
#include <string>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <nmmintrin.h>
#include <chrono>
const double EPS = 1e-8;
#define Scan(a) int a;scanf("%d", &a);
#define ScanS(a) char a[500];scanf("%s", a);
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) ((a) <= (x) && (x) <= (b))
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define MODU 1000000007
#define bitcheck(a,b)   ((a >> b) & 1LL)
#define bitset(a,b)      ( a |= (1LL << b))
#define bitunset(a,b)    (a &= ~(1LL << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
#ifdef _MSC_VER
#define __builtin_popcount _mm_popcnt_u32
#define __builtin_popcountll _mm_popcnt_u64
#endif
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*)array, (T*)(array + N), val);
}

pii Dir[8] = {
	{ 0 ,1 },{ -1 ,0 },{ 1 ,0 },{ 0 ,-1 },
	{ 1 ,1 },{ 1 ,-1 },{ -1 ,1 },{ -1 ,-1 }
};


pii operator+(pii obj, pii obj2) {
	return MP(obj.first + obj2.first, obj.second + obj2.second);
}
pii operator-(pii obj, pii obj2) {
	return MP(obj.first - obj2.first, obj.second - obj2.second);
}

struct Edge {
	int from, to, weight;
};

typedef vector<vector<Edge>> Graph;
struct UnionFind {
	vector<int> data;
	UnionFind(int size) : data(size, -1) { }
	bool unionSet(int x, int y) { //ｘの入ってる集合と yの入ってる集合を併合
		x = root(x); y = root(y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
		return x != y;
	}
	bool findSet(int x, int y) { //xとyが同じ集合に入っているかどうかを判定
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	bool isroot(int x) {
		return data[x] < 0;
	}
	int size(int x) {
		return -data[root(x)];
	}
};
int main() {
	int n;

	cin >> n;
	map<int, int> cou;
	REP(i, n) {
		int a;
		scanf("%d", &a);

		cou[a - 1]++;
		cou[a]++;
		cou[a + 1]++;
	}

	int Max = 0;
	for (auto itr : cou) {
		Max = max(Max, itr.second);
	}
	cout << Max << endl;
	return 0;
}

Measured memory_bytes: 4736
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define all(a) (a).begin(), (a).end()

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

using ll = long long;

ll N;
ll a[60], S, ans;

int main()
{
  std::cin >> N;

  rep( i, N )
    std::cin >> a[i];

  {
    bool fl = true;
    rep( i, N )
    {
      fl &= a[i] < N;
    }

    if( fl )
    {
      std::cout << 0 << std::endl;

      return 0;
    }
  } 

  while( true )
  {
    bool fl = true;

    S = 0;

    rep( i, N )
      S += a[i]/N;

    rep( i, N )
    {
      ll c = a[i]/N;
      a[i] = a[i]-c*N+(S-c);
      fl &= a[i] < N;
    }

    ans += S;

    if( fl )
      break;
  }

  std::cout << ans << std::endl;

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<functional>
#include<cmath>
#include<set>
#include<random>
#include<stdio.h>
#include<map>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const long long mod = 1000000007;
const int inf = 1145141919;
typedef pair<int, int> P;
typedef pair<P, int>PP;
typedef pair<int, char>PC;
struct edge { int to, cost; };

int a[200005];
int rwa[200005];
int lsm[200005], lsM[200005],rsm[200005],rsM[200005];



signed main() {
	int n; cin >> n; rep(i, n)cin >> a[i];
	rep(i, n)rwa[i + 1] = a[i];
	rep(i, n)rwa[i + 1] += rwa[i];

	int kyokai = 1, las = 1;//[0~kyokai-1,kyokai~las]
	lsm[las] = min(a[0], a[1]); lsM[las] = max(a[0], a[1]);
	while (las < n) {
		las++;
		while (kyokai<las&&abs(rwa[kyokai] - (rwa[las + 1] - rwa[kyokai])) > abs(rwa[kyokai + 1] - (rwa[las + 1] - rwa[kyokai + 1])))kyokai++;
		lsm[las] = min(rwa[kyokai],rwa[las+1]-rwa[kyokai]);
		lsM[las]=max(rwa[kyokai], rwa[las + 1] - rwa[kyokai]);
	}
	kyokai = n - 2, las = n - 2;
	rsm[las] = min(a[n - 1], a[n - 2]); rsM[las] = max(a[n - 1], a[n - 2]);
	while (las > 0) {
		las--;
		while (kyokai>las&&abs(rwa[n]-rwa[kyokai+1]-rwa[kyokai+1]+rwa[las]) > abs(rwa[n] - rwa[kyokai] - rwa[kyokai] + rwa[las]))kyokai--;
		rsm[las] = min(rwa[n] - rwa[kyokai+1] ,rwa[kyokai+1]- rwa[las]);
		rsM[las]=max(rwa[n] - rwa[kyokai + 1], rwa[kyokai + 1] - rwa[las]);
	}
	int ans = 1ll<<61;
	for (int j = 2; j <= n - 2; j++) {
	//[0~j-1],[j~n]
		ans = min(ans, max(lsM[j - 1], rsM[j]) - min(lsm[j - 1], rsm[j]));
	}
	cout << ans << endl;
}

Measured memory_bytes: 9600
(defn ColorfulTransceivers [a b c d]
  (if (or (>= d (Math/abs (- c a)))
    (and (>= d (Math/abs (- b a))) 
      (>= d (Math/abs (- c b))))) 
  "Yes" 
  "No"))
(println (ColorfulTransceivers (int (read)) (int (read)) (int (read)) (int (read))))

Measured memory_bytes: 67284
N,*A=$<.map &:to_i
r=s=0
A.map{|a|
	if r>0
		if a>0
			a+=r
			s+=a/2
			r=a%2
		else
			r=0
		end
	else
		s+=a/2
		r=a%2
	end
}
p s

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

int main()
{
  int a, b, c, d;

  cin  >> a >> b >> c >> d;

  while(a > 0 && c > 0){
    a -= d;
    c -= b;
  }

  if(c > 0){
    cout << "No" << endl;
  }
  else{
    cout << "Yes" << endl;
  }

  return 0; 
}

Measured memory_bytes: 3592
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
//    return *(long long*)a - *(long long*)b;
}
//  qsort(A, b, sizeof(int), compare_int);

int main()
{
 
  int a, b, c, d, e, X, Y;
  //  double  c;
  int  A[101][101]={};
  int  B[100001]={};
//  int  B[100003]={};
  int  L[1003]={};

  int  flag[103]={};

//  long long  a, b, c, d, X, Y;
char s[100001]={};
  long long JPY;
  double BTC;
char t[100001]={};
//  int N, M;
//  int A[1000000001]={};
//  long long  C[101]={};
  int i,j,k;
//  int flag=0;
  double tmp=0;
//  int min=1000000;
  long long min=100000001;
  int len=0;
  int cnt=0;
  int cnt0=0;
  int cnt1=0;
  int num=0;
//  double ans=0.0;
  long long ans[100001]={};
  int max=0;
  int sum=0;
//  char alp[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};

  //  a=0;
//  scanf("%lld %lld", &a, &b);
  scanf("%d%d%d", &a,&b, &c);
  for(i=0;i<a+1;i++){
    for(j=0;j<b;j++){
      if(i==0)  scanf("%d", &B[j]);
      else  scanf("%d", &A[i-1][j]);
    }
  }
  for(i=0;i<a;i++){
    for(j=0;j<b;j++){
      sum=sum+A[i][j]*B[j];
    }
    if(sum>-c) cnt++;
    sum=0;
  }      
  
 printf("%d\n", cnt);


  //    if(max < cnt - max)  printf("Yes\n");
//    else  
  
return 0;
}


Measured memory_bytes: 640
// Problem : B - Count ABC
// Contest : AtCoder Beginner Contest 150
// URL : https://atcoder.jp/contests/abc150/tasks/abc150_b
// Memory Limit : 1024.000000 MB 
// Time Limit : 2000.000000 milisec 
// Powered by CP Editor (https://github.com/coder3101/cp-editor)

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using ld = long double;
#define all(x) (x).begin(),(x).end()
#define io() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
int main () {
	int n;
	cin >> n;
	string s;
	cin >> s;
	int ans = 0;
	for (int i = 0; i < s.length()-2;i++)
		ans += s.substr(i,3) == "ABC";
	printf ("%d\n",ans);
	return 0;
}

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

char c;

int main() {
    cin >> c;

    if (c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o') {
        cout << "vowel" << endl;
    } else {
        cout << "consonant" << endl;
    }
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
#  = input()
#  = int(input())
x1, x2, x3, x4, x5  = map(int, input().split())
#  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

li = [x1, x2, x3, x4, x5]
print(li.index(0)+1)


Measured memory_bytes: 9472
#include <iostream>

using namespace std;

long long num[110000];

int main() {
	int N;
	long long K;
	cin >> N >> K;

	for(int i = 0; i < N; i++) {
		int a, b;
		cin >> a >> b;
		num[a] += b;
	}
	

	int i = 0;
	long long cnt = 0;
	while(cnt < K) {
		cnt += num[i];
		i++;
	}
	cout << (i-1) << endl;

	return 0;
}


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

typedef long long ll;

int main(){
	ll n,m,a,b,p,q;
	cin >> n >> m >> a >> b >> p >> q;
	
	if(a == 1 && b == 1){
		ll x = m/(p+q);
		if(x >= n)cout << m-n*(p+q) << endl;
		else cout << min ( m-x*(p+q) , (x+1)*(p+q)-m ) << endl;
	}
	else {
		vector<ll> vec;
		ll s = 1 , t = 1;
		for(int i = 0 ; i < n ; i ++){
			vec.push_back(p*s+q*t);
			if(p*s+q*t > m)break;
			s *= a;
			t *= b;
		}
		int N = vec.size();
		vector<ll> A,B;
		A.push_back(0);
		for(int i = 0 ; i < N/2 ; i ++){
			int x = A.size();
			for(int j = 0 ; j < x ; j ++){
				A.push_back(vec[i]+A[j]);
			}
		}
		B.push_back(0);
		for(int i = N/2 ; i < N ; i ++){
			int x = B.size();
			for(int j = 0 ; j < x ; j ++){
				B.push_back(vec[i]+B[j]);
			}
		}
		sort(B.begin(),B.end());
		B.erase(unique(B.begin(),B.end()),B.end());
		ll ret = m;
		for(int i = 0 ; i < A.size() ; i ++){
			int x = upper_bound(B.begin(),B.end(),m-A[i])-B.begin();
			if(x < B.size())ret = min ( ret , A[i]+B[x]-m );
			x --;
			ret = min ( ret , m-A[i]-B[x] );
		}
		cout << ret << endl;
	}
}

Measured memory_bytes: 27636
#include<bits/stdc++.h>
using namespace std;
//#define Fast ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
typedef vector<int>Vl;
typedef pair<int,int>PII;
typedef vector<PII>Vll;
typedef vector<pair<int,pair<int,int> > >Vlll;
typedef priority_queue<int>PQL;
typedef map<int,int>M;
#define S second
#define F first
#define mp make_pair
#define ms(x,y) memset(x,y,sizeof(x))
#define pb push_back
#define sl(n) cin>>n
#define pl(n) cout<<n
const int mod=1e9+7;
const int sze=1e5+2;
//const int inf=1e19;
void solve(){
 int n,k;
 sl(n);sl(k);
 int h[n];
 for(auto &it:h)sl(it);
 sort(h,h+n);
 int ans=0;
 for(int i=0;i<n-k;i++){
	 ans+=h[i];
 }
 cout<<(ans)<<endl;
 
}

signed main(){
   int test=1;
   //sl(test);
   while(test--){
      solve();

   }
  return 0;
}


Measured memory_bytes: 1792
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <queue>
#include <vector>
#include <functional>
#include <map>
#include <set>
#include <cmath>
#include <string>
#define SIZE 200005
#define INF 1000000005LL

using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

int n;
ll K;
int dp[102][10005];
P W[102];

int main()
{
	int w;
	scanf("%d %d",&n,&w);
	int f,s;
	for(int i=1;i<=n;i++){
		scanf("%d %d",&f,&s);
		W[i].first = f;W[i].second=s;
	}
	for(int i=0;i<=n;i++)dp[i][0]=0;
	for(int i=0;i<=w;i++)dp[0][i]=0;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=w;j++){
			if(j-W[i].second <0){
				dp[i][j] = dp[i-1][j];
			}else{dp[i][j] = max(dp[i-1][j-W[i].second] + W[i].first,
					dp[i-1][j]);
			}
		}
	}

	printf("%lld\n",dp[n][w]);
	return 0;
}



Measured memory_bytes: 6656
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
using namespace std;

int main(){
    string S;
    cin >> S;
    int l = S.length();

    if(l==2) cout << S << endl;
    else {
        reverse(S.begin(), S.end());
        cout << S << endl;
    }
    return 0;



}

Measured memory_bytes: 764
#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

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


static const int MAX = 100;
static const long long INF = 1 << 29;

int m;
long long dist[MAX][MAX];

int main()
{
  while (cin >> m) {
    if (m == 0) break;
    for (int i = 0; i < MAX; ++i) {
      for (int j = 0; j < MAX; ++j) {
	dist[i][j] = INF;
      }
    }

    for (int i = 0; i < m; ++i) {
      int u, v, d;
      cin >> u >> v >> d;
      dist[u][v] = d;
      dist[v][u] = d;
      dist[u][u] = 0;
      dist[v][v] = 0;
    }

    for (int k = 0; k < MAX; ++k)
      for (int i = 0; i < MAX; ++i)
	for (int j = 0; j < MAX; ++j)
	  ChangeMin(dist[i][j], dist[i][k] + dist[k][j]);

    long long minDist = INF;
    int minPlace = -1;
    for (int i = 0; i < MAX; ++i) {
      if (dist[i][i] >= INF) continue;
      long long tmpDist = 0;
      for (int j = 0; j < MAX; ++j) {
	if (dist[j][j] >= INF) continue;
	tmpDist += dist[i][j];
	//cout << i << ", " << j << ": " << dist[i][j] << endl;
      }
      if (ChangeMin(minDist, tmpDist)) {
	minPlace = i;
      }
    }
    cout << minPlace << " " << minDist << endl;
  }
}


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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    set<ll> a{1, 9, 7, 4}, b;
    rep(i, 4) {
        ll temp;
        cin >> temp;
        b.insert(temp);
    }
    if(a == b) cout << "YES";
    else cout << "NO";
    cout << endl;
    return 0;
}


Measured memory_bytes: 3588
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)

using namespace std;

typedef long long int lli;

bool check(string &s) {
    int size = s.size() / 2;
    REP (i, 0, size) {
        if (s[i] != s[s.size() - 1 - i]) return false;
    }
    return true;
}

int main() {
    string s;
    cin >> s;
    int n = s.size();
    if (s.find("x") == string::npos) {
        if (check(s)) {
            cout << 0 << endl;
        } else {
            cout << -1 << endl;            
        }
        return 0;
    }
    if (check(s)) {
        cout << 0 << endl;
        return 0;
    }
    string ss = "";
    REP (i, 0, n) {
        if (s[i] != 'x') {
            ss += s[i];
        }
    }
    if (!check(ss)) {
        cout << -1 << endl;
        return 0;
    }

    int ans = 0;
    int l = 0, r = n - 1;
    while (l <= r) {
        if (s[l] == s[r]) {
            l++;
            r--;
            continue;
        }
        if (s[l] == 'x') l++;
        if (s[r] == 'x') r--;
        ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 512