akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<cstdlib>
#include<cmath>
#include<numeric>
#include<iomanip>
using namespace std;
using ll =long long;
const int MOD = 1000000007;


int main() {
	ll N, K;
	cin >> N >> K;
	map<ll, ll>A;
	vector<ll>d;
	ll tmp;
	ll c;
	for (int i = 0; i < K; i++) {
		cin >> c;
		d.push_back(c);
		for (int j = 0; j < d[i];j++) {
			cin >> tmp;
			A[tmp-1]++;
		}
	}
	ll count = 0;
	for (int i = 0; i < N; i++) {

		if (A[i] == 0) {

			count++;

		}
	}
	cout << count;
}

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

int main(){
  string s;
  cin >> s;
  sort(s.begin(), s.end());

  bool backet[100100] = {false};

  for(int i = 0; i < s.size(); i++){
    backet[s[i]] = true;
  }

  for( char c = 'a'; c <= 'z'; c++ ){
    if(!backet[c]){
      cout << c << endl;
      return 0;
    }
  }
  cout << "None" << endl;
}


Measured memory_bytes: 512
#include <iostream>
using namespace std;
int main() {
    int n;
    char s;
    bool ans[4]={false,false,false,false};
    cin >> n;
    for(int i=0; i<n; i++){
        cin>>s;
        if(s=='P')ans[0]=true;
        else if(s=='W')ans[1]=true;
        else if(s=='G')ans[2]= true;
        else if(s=='Y')ans[3]=true;
    }
    int count=0;
    for(int i=0; i<4; i++){
        if(ans[i])count++;
    }
    if(count==3)cout<<"Three\n";
    else    cout << "Four\n";
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

#include <bits/stdc++.h>
using namespace std;

bool f[1000006];

int main()
{
    int n,x=0,k=1;
    cin >> n;
    while(true){
        x=x*10+7;
        x%=n;
        if(x==0) break;
        if(f[x]) break;
        f[x]=true,k++;
    }
    if(x) cout<< -1 <<endl;
    else cout<< k <<endl;
    return 0;
}

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

int main() { 
    int n,x;
    cin >> n >> x;
    vector<int> m(n);
    rep(i, n){
        cin >> m[i];
    }

    int a = 0;//最低限の消費量
    rep(i, n){
        a += m[i];
    }

    int b = 0;//余り
    b = x - a;
    int min = *min_element(m.begin(),m.end());//最小値
    int cnt = b / min;

    cout << n + cnt << endl;
}


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

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

    double n;
    cin >> n;

    bool flag = false;
    double ans = 0;
    for(double i = 1; i <= 50000; i++){
        if(floor(i * 1.08) == n){
            flag = true;
            ans = i;
            break;
        }
    }
    
    if(flag) cout << ans << endl;
    else cout << ":(" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <math.h>
using namespace std;
int64_t luka_num(int num) {
    if (num == 0) {
        return 2;
    } else if (num == 1) {
        return 1;
    }

    return luka_num(num -1) + luka_num(num -2);
}
int main() {
    int64_t X;
    cin >> X;
    vector<int64_t>vec(86);
    vec[0] = 2;
    vec[1] = 1;
    for (int i=2; i <= X; i++) {
        vec[i] = vec[i-1] + vec[i-2];
    }

    cout << vec[X] << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <string>
#include <stdio.h>
#include <set>
#include <map>
#include <algorithm>
#include <queue>
#include <vector>
#define ll long long
#define pb push_back
#define mp make_pair
#define f first
#define s second

using namespace std;

const int inf = 1e9 + 7;
const long long INF = 1e18 + 7;
const int maxn = 2000 + 7;

int n, m, d[maxn];
map < pair < int, int >, int > mk;
vector < int > way[maxn];
bool used[maxn];
vector < pair < int, int > > g[maxn];

int main(){
	ios_base::sync_with_stdio(NULL);
	cin.tie(0);
	cout.tie(0);
	cin >> n >> m;
	for (int i = 1; i <= m; i++){
		int x, y, w;
		cin >> x >> y >> w;
		g[x].pb(mp(y, w));
		g[y].pb(mp(x, w));	
		mk[mp(x, y)] = mk[mp(y, x)] = i;
	}
	for (int i = 1; i <= n; i++){
		for (int j = 1; j <= n; j++)
			d[j] = inf, way[j].clear();
		d[i] = 0;
		queue < int > q;
		q.push(i);
		while (!q.empty()){
			int v = q.front();
			q.pop();
			for (auto to : g[v]){
				if (d[to.f] > d[v] + to.s){
					d[to.f] = d[v] + to.s;
					way[to.f] = way[v];
					way[to.f].pb(mk[mp(v, to.f)]);
					q.push(to.f);
				}   
			}
		}
		for (int i = 1; i <= n; i++){
			for (int x : way[i]){
				used[x] = 1;
			}
		}
	}
	int cnt = 0;
	for (int i = 1; i <= m; i++)
		if (!used[i])
			cnt++;
	cout << cnt;
	return 0;
} 

Measured memory_bytes: 512
while True:
    try:
        a, b, c = map(int, input().split())
    except:
        break

    if a < 1868 or (a==1868 and b<10 and c<8):
        print("pre-meiji")
    elif a < 1912 or (a==1912 and b<8 and c<30):
        print("meiji %d %d %d" % (a-1867, b, c))
    elif a < 1926 or (a==1926 and c<25):
        print("taisho %d %d %d" % (a-1911, b, c))
    elif a < 1989 or (a==1989 and b<2 and c<8):
        print("showa %d %d %d" % (a-1925, b, c))
    else:
        print("heisei %d %d %d" % (a-1988, b, c))

Measured memory_bytes: 7556
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int N;
int m = 998244353;
struct R {
    int X;
    int D;
};
vector<R> v;
int A[200010];
vector<ll> mm(200010, -1);
vector<ll> X;
ll solve(int k) {
    if (k == N) return 1;
    if (mm[k] != -1) return mm[k];
    ll res = solve(k+1)+solve(A[k]+1);
    res %= m;
    return mm[k] = res;
}
int W[500];
void update(int i) {
    int k = 450;
    W[i/k] = max(W[i/k], A[i]);
}
int query(int l, int r) {
    int k = 450;
    int ll = l/k, rr = r/k;
    int res = A[l];
    if (ll == rr) {
        for (int i = l+1; i <= r; i++) {
            res = max(res, A[i]);
        }
        return res;
    }
    for (int i = l+1; i/k == ll; i++) {
        res = max(res, A[i]);
    }
    for (int i = rr*k; i <= r; i++) {
        res = max(res, A[i]);
    }
    for (int i = ll+1; i < rr; i++) {
        res = max(res, W[i]);
    }
    return res;
}
int main () {
    cin >> N;
    for (int i = 0; i < N; i++) {
        int X, D;
        cin >> X >> D;
        R E;
        E.X = X, E.D = D;
        v.push_back(E);
    }
    sort(v.begin(), v.end(), [](auto x, auto y) {
        return x.X < y.X;
    });
    for (auto a: v) {
        X.push_back(a.X);
    }
    A[N-1] = N-1;
    for (int i = N-2; i >= 0; i--) {
        auto g = lower_bound(X.begin(), X.end(), v[i].X+v[i].D);
        g--;
        if (g == X.begin()+i) {
            A[i] = i;
        }
        else {
            A[i] = query(i+1, g-X.begin());
        }
        update(i);
    }
    cout << solve(0) << endl;
}

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

int main()
{
    long long s;
    cin >> s;
    int ans = 11111110;
    while (s >= 100)
    {
        int r = s % 1000;
        ans = min(ans, abs(r - 753));
        s /= 10;
    }
    cout << ans << endl;
    return 0;
}

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

using tpl = tuple<char, int>;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

void fastStream(){cin.tie(0);std::ios_base::sync_with_stdio(0);}

ll N, A, B;

int main(){


    cin >> N >> A >> B;


    if(A + B - 1 > N){
        cout << -1 << endl;
        return 0;
    }

    deque<ll> dq;
    for(ll i = 0; i < A; i++)
        dq.push_back(i * B + B - 1);
    for(ll i = 0; i < B - 1; i++)
        dq.push_back(A * B - 2 - i);


    vector<ll> seq;
    for(ll i = 0; i < A; i++){
        for(ll j = B - 1; j >= 0; j--){
            ll left = N - (ll)seq.size();
            if(left == (ll)dq.size()){
                for(ll d : dq){
                    seq.push_back(d);
                }
                break;
            }
            else{
                const ll a = i * B + j;
                seq.push_back(a);
                if(a == dq[0]){
                    dq.pop_front();
                }
            }
            if((ll)seq.size() == N) break;
        }
        if((ll)seq.size() == N) break;
    }

    if((int)seq.size() < N) {
        cout<< -1 << endl;
        return 0;
    }
    
    vector<pll> v;
    for(ll i = 0; i < (ll)seq.size(); i++){
        v.push_back(make_pair(seq[i], i));
    }

    sort(v.begin(), v.end());

    vector<ll> anss(N);

    for(ll i = 0; i < (ll)v.size(); i++){
        anss[v[i].second] = i + 1;
    }
    for(ll a : anss){
        cout << a << " ";
    }
    cout << endl;
    
    

    return 0;
}


Measured memory_bytes: 16488
#include <stdio.h>
int main(void){
    int x,a,b;
    scanf("%d %d %d",&x,&a,&b);
    if(a>=b){
        printf("delicious");
    }else{
        if(b>a+x){
            printf("dangerous");
        }else{
            printf("safe");
        };
    };
};


Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <cstdlib>
#include <cmath> 
using ll = long long;
using namespace std;
ll ans;
#define rep(i,n) for(int i=0;i<n;i++)
string S;
int ctoi(char c){
	return c-'0';
}
int main(){
	int N;cin>>N;
  	int W[N];
	int all;all=0;
  	rep(i,N){
    	cin>>W[i];
      	all+=W[i];
    }  	
  	int half;half=0;
	int dif;dif=0;
  	dif=all;
  	rep(i,N){
      	if(dif-2*W[i]<0){
        	if(dif+dif-2*W[i]<=0){
            	cout<<dif<<endl;
              	return 0;
            }else{
            	cout<<2*W[i]-dif<<endl;
              	return 0;
            }
        }else if(dif-2*W[i]==0){
            	cout<<0<<endl;
          	return 0;
        }else{
        	dif-=2*W[i];
        }
    }
  	
  
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h> //strcmp、strncmp関数を使うために必要
int main(){
  char *s = "Sunny";
  char *c = "Cloudy";
  char *r = "Rainy";
  char w[10];
  scanf("%s",w);
  if(strcmp(w,s) == 0) printf("Cloudy");
  else if(strcmp(w,c) == 0) printf("Rainy");
  else printf("Sunny");
}

Measured memory_bytes: 128
//#i#include "pch.h"
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <limits.h>
#include <string>
#include <stack>
#include <deque>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <time.h>
#include <cassert>
#include <stdio.h>

typedef long long ll;
typedef std::pair<int, int> Pii;
typedef std::pair<long long, long long> Pll;
typedef std::pair<double, double> Pdd;

#define rip(i, n, s) for (int i = (s);i < (int)( n ); i++)
#define mapa make_pair
#define all(a) a.begin(), a.end()
#define MM << " " <<

template<typename T>
using MaxHeap = std::priority_queue<T>;
template<typename T>
using MinHeap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

template<typename T>
inline bool chmax(T &a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
template<typename T>
inline bool chmin(T &a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}

template<typename T>
std::vector<T> vec(int len, T elem) { return std::vector<T>(len, elem); }
template<typename T>
void vdeb(std::vector<T> &da) {
	for (int i = 0;i < da.size();i++) {
		if (i == da.size() - 1) std::cout << da[i];
		else std::cout << da[i] << ' ';
	}
	std::cout << std::endl;
}
template<typename T>
void vdeb(std::vector<std::vector<T>> &da) {
	for (int i = 0;i < da.size();i++) vdeb(da[i]);
	std::cout << std::endl;
}

using namespace std;

int h,w;



int main(){
	cin >> h >> w;
	vector<vector<int>> da(h+1, vector<int>(w+1,1)), dp(h+1, vector<int>(w+1)), dpv(h+1, vector<int>(w+1)), dph(h+1, vector<int>(w+1));
	rip(i,h,0) rip(j,w,0) cin >> da[i+1][j+1];
	rip(i,h,0){
		rip(j,w,0){
			if(da[i+1][j+1]) continue;
			dp[i+1][j+1] = min({dp[i][j], dpv[i][j+1], dph[i+1][j]}) + 1;
			dph[i+1][j+1] = dp[i+1][j] + 1;
			dpv[i+1][j+1] = dp[i][j+1] + 1;
		}
	}
	int ans = 0;
	rip(i,h,0) rip(j,w,0) chmax(ans, dp[i+1][j+1]);
	cout << ans*ans << endl;
}


Measured memory_bytes: 33672
using System;

namespace abc089_a
{
    class program
    {
        static void Main(string[] args)
        {
            ChangeLocalDebugInput();

            int N = int.Parse(Console.ReadLine());
            Console.WriteLine(N / 3);
        }


        [System.Diagnostics.Conditional("LOCAL_DEBUG")]
        static void ChangeLocalDebugInput()
        {
            Console.SetIn(new System.IO.StreamReader("../../stdin.txt"));
        }
    }
}


Measured memory_bytes: 13140
#include <iostream>
#include <algorithm>

using namespace std;

int const NMAX = 100;
int v[1 + NMAX + 1];

int main() {

  int n, p, ans = 0;
  cin >> n;
  n *= 2;
  for(int i = 1;i <= n;i++){
    cin >> v[i];
  }
  sort(v+1, v+n+1);
  for(int i = 1;i <= n;i+=2){
    ans += v[i];
  }
  cout << ans;
  return 0;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(x) (x).begin(),(x).end()
const long long MOD=1e9+7;
// const long long MOD=998244353;
const int INF=1e9;
const long long IINF=1e18;
const int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
const char dir[4]={'D','R','U','L'};
#define LOCAL

template<typename T>
istream &operator>>(istream &is,vector<T> &v){
    for (T &x:v) is >> x;
    return is;
}
template<typename T>
ostream &operator<<(ostream &os,const vector<T> &v){
    for (int i=0;i<v.size();++i){
        os << v[i] << (i+1==v.size()?"": " ");
    }
    return os;
}
template<typename T,typename U>
ostream &operator<<(ostream &os,const pair<T,U> &p){
    cout << '(' << p.first << ',' << p.second << ')';
    return os;
}
template<typename T,typename U>
ostream &operator<<(ostream &os,const map<T,U> &m){
    os << '{';
    for (auto itr=m.begin();itr!=m.end();++itr){
        os << '(' << itr->first << ',' << itr->second << ')';
        if (++itr!=m.end()) os << ',';
        --itr;
    }
    os << '}';
    return os;
}
template<typename T>
ostream &operator<<(ostream &os,const set<T> &s){
    os << '{';
    for (auto itr=s.begin();itr!=s.end();++itr){
        os << *itr;
        if (++itr!=s.end()) os << ',';
        --itr;
    }
    os << '}';
    return os;
}

void debug_out(){cerr << '\n';}
template<class Head,class... Tail>
void debug_out(Head&& head,Tail&&... tail){
    cerr << head;
    if (sizeof...(Tail)>0) cerr << ", ";
    debug_out(move(tail)...);
}
#ifdef LOCAL
#define debug(...) cerr << " ";\
cerr << #__VA_ARGS__ << " :[" << __LINE__ << ":" << __FUNCTION__ << "]" << '\n';\
cerr << " ";\
debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

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

template<class T1,class T2> inline bool chmin(T1 &a,T2 b){
    if (a>b){a=b; return true;} return false;
}
template<class T1,class T2> inline bool chmax(T1 &a,T2 b){
    if (a<b){a=b; return true;} return false;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll A,V,B,W,T; cin >> A >> V >> B >> W >> T;
    ll D=abs(A-B);
    cout << (D<=(V-W)*T?"YES":"NO") << '\n';
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) FOR(i,0,b)
#define INF mugen
#define dump(x) cerr<<#x<<"="<<x<<endl
#define all(a) (a).begin(),(a).end()
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<vii> viii;
typedef pair<int,int> P;
template <class T> void chmin(T & a, T const & b) { if (b < a) a = b; }
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
using ll = long long;
const ll mod = LLONG_MAX;

//O(√n)
bool isPrime(int n) {
for (int i = 2; i * i <= n; i++) {
    if (n % i == 0) return false;
}
return n != 1;
}


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

  for(int i=2;i<=55555;i++){
    if(isPrime(i)&&i%5==1){
      cout<<i;
      n--;
      if(n==0)cout<<endl;
      else cout<<' ';
    }
    if(n==0)return 0;
  }

}


Measured memory_bytes: 256
#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) {
    ll X;
    cin >> X;
    if(X == 7 || X == 5 || X == 3) cout << "YES";
    else cout << "NO";
    cout << endl;
    return 0;
}


Measured memory_bytes: 3584
#include<bits/stdc++.h>
#define FOR(i ,n ,m) for(int i = n ; i <= m; ++i)
typedef long long ll;
using namespace std;

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

  string ans;

  for(int i=0; i<s.size(); ++i) {
    int a = (int)s[i] + n;
    if(a>90) ans.push_back((char)(a - 26));
    else ans.push_back((char)a);
    }
  cout << ans << endl;
  return 0;
}

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

bool search_key(int key, int X[], int N){
    for(int i=0;i<N;i++){
        if(key == X[i]){
            return false;
        }
    }
    return true;
}

int main(){
    int N,M;
    int X[100],A[100];
    scanf("%d",&N);
    for(int i=0;i<N;i++){
        scanf("%d",&X[i]);
    }
    scanf("%d", &M);
    for(int i=0;i<M;i++){
        scanf("%d",&A[i]);
    }
    for(int j=0;j<M;j++){
        if(search_key(X[A[j]-1]+1,X,N) && X[A[j]-1]+1<2020){
            X[A[j]-1] += 1;
        }
    }
    for(int i=0;i<N;i++){
        printf("%d\n",X[i]);
    }
    return 0;
}


Measured memory_bytes: 3216
//#pragma  GCC optimize("Ofast")

//#ifdef  DEBUG
//#define _GLIBCXX_DEBUG
//#endif

// -Ofast
// -O3
// -O2
// -fsanitize=address
// -fsanitize=undefined

// add_compile_options()

#include <iostream>
#include <map>
#include <vector>
#include <set>
#include <stack>
#include <bitset>
#include <queue>
#include <algorithm>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#include <iomanip>
#include <unordered_map>
#include <cmath>
#include <cassert>
#include <random>
using namespace std;
//using namesparsace __gnu_pbds;

mt19937 rnd;

void solve();

int main()
{
    srand(time(0));
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
#ifdef DEBUG
    freopen("input.txt", "r", stdin);
#endif
    solve();
    return 0;
}

#define int long long

int max(int a, int b) {
    return a > b ? a : b;
}

const int maxN = 1e5 + 10, inf = 1e18;

bool cmp(int a, int b) {
    return a > b;
}

int n, m, v, p, a[maxN], ans, pref[maxN];

int f(int l, int r, int e) {
    int len = r - l + 1;
    return len * e - (pref[r + 1] - pref[l]);
}

void solve() {
    cin >> n >> m >> v >> p;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    sort(a, a + n, cmp);
    for (int i = 1; i <= n; i++) {
        pref[i] = pref[i - 1] + a[i - 1];
    }
    ans = p;
    for (int i = n - 1; i >= p; i--) {
        int cur = a[i] + m;
        if (cur < a[p - 1]) continue;
        int e = v - (p - 1) - (n - i);
        if (e <= 0) {
            ans = i + 1;
            break;
        } else {
            if (f(p - 1, i - 1, cur) >= e * m) {
                ans = i + 1;
                break;
            }
        }
    }
    cout << ans;
}

Measured memory_bytes: 1920
N, Q = map(int, input().split())
S = input()
acc = [0] * (N+1)
for i in range(0, N):
    acc[i+1] = acc[i] + (i+1 < N and S[i+1] == "C" and S[i] == "A")
for i in range(Q):
    l, r = map(int, input().split())
    print(acc[r-1] - acc[l-1])


Measured memory_bytes: 7748
#include <iostream>
#include <map>
using namespace std;
#define debug(x) std::cerr << #x << " = " << (x) << std::endl
typedef long long LL;
const int MAXN = 3e2+17;
LL dis[MAXN][MAXN],n;
bool can[MAXN][MAXN];
map<pair<int,int > ,int > mp;
LL func()
{
	LL ret = 0;
	for (int k = 0; k < n; ++k)
	{
		for (int i = 0; i < n; ++i)
		{
			for (int j = i+1; j < n; ++j)
			{
				if(dis[i][j]>dis[i][k]+dis[k][j]) return -1;
				if(dis[i][j]==dis[i][k]+dis[k][j]&&k!=j&&k!=i)
				{
					// debug(i);
					// debug(j);
					// cerr<<endl;
					can[i][j] = true;
				}
			}
		}
	}
	for (int i = 0; i < n; ++i)
	{
		for (int j = i+1; j < n; ++j)
		{
			if(!can[i][j])
				ret += dis[i][j];
		}
	}
	return ret;
}
int main(int argc ,char const *argv[])
{
	#ifdef noob
	freopen("Input.txt","r",stdin);freopen("Output.txt","w",stdout);
	#endif
	cin>>n;
	for (int i = 0; i < n; ++i)
	{
		for (int j = 0; j < n; ++j)
		{
			can[i][j] = false;
			cin>>dis[i][j];
		}
	}
	cout<<func()<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>

int main(){

	int h, w, i, e;

	scanf("%d", &h);
	scanf("%d", &w);

	while (h != 0 && w != 0){

		for (i = 0; i<h; i++){

			for (e = 0; e<w; e++){

				if (e % 2 == 0 && i % 2 == 0 || e % 2 == 1 && i % 2 == 1){

					printf("#");

				}

				else{

					printf(".");

				}

			}
			printf("\n");
		}


		printf("\n");
		scanf("%d", &h);
		scanf("%d", &w);
	}

	return 0;
}

Measured memory_bytes: 572
#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define WHATIS(x) cout << #x << " is " << x << endl;
#define ERROR(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<ll, II> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << *it << " = " << a << endl;
    err(++it, args...);
}

const ll MODBASE = 1000000007LL;
const int MAXN = 100010;
const int MAXM = 100010;
const int MAXK = 510;
const int MAXQ = 200010;

int n, m;
II res[MAXN];
vector<II> a[MAXN];

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    cin >> n >> m;
    FOR(i,1,m) {
        int u, v;
        cin >> u >> v;
        a[u].emplace_back(II(v, i));
    }
    FOR(i,1,n) sort(ALL(a[i]));
    FOR(i,1,n) {
        FOR(j,0,SZ(a[i])-1) {
            int cs = a[i][j].SE;
            int k = j + 1;
            res[cs] = II(i, k);
        }
    }
    FOR(i,1,m) printf("%06d%06d\n", res[i].FI, res[i].SE);
    return 0;
}

Measured memory_bytes: 7808
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#define maxn 500005
using namespace std;
int main() 
{
	char s[maxn];
	cin >> s;
	int res = strlen(s);
	int a = res;
	for (int i = 0;i < strlen(s);i++) 
	{
		if (s[i] != s[i - 1])
			res = min(res, max(i, a - i));
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

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

  string str;
  cin >> str;

  int i,j,k;
  cin >> k;

  std::vector<string> S;
  for(int i = 0;i <= str.size();i++){
    for(int j = 1;j <= str.size();j++){
      if (j <= k){
      S.push_back(str.substr(i,j));
      }
      else {
        break;
      }
    }
  }
  sort(S.begin(),S.end());
  S.erase(unique(S.begin(),S.end()),S.end());
  cout << S[k] <<endl;
  return 0;
}


Measured memory_bytes: 1660
n,m = map(int,input().split())
h = [None] + list(map(int,input().split()))
road = [[] for _ in range(n+1)]
count = 0
for _ in range(m):
    a,b = map(int,input().split())
    road[a].append(b)
    road[b].append(a)
for i in range(1,n+1):
    max_hight = 0
    for j in road[i]:
        max_hight = max(max_hight, h[j])
    if h[i]>max_hight:
        count += 1

print(count)

Measured memory_bytes: 29208
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import math

n = int(input())
i = input().split(' ')
a = list(map(lambda e:int(e), i))

step = 0
es = list(filter(lambda e:e%2==0, a))
os = list(filter(lambda e:e%2!=0, a))

def power_exponent(z):
    step = 0
    while z%2==0:
        step = step+1
        z = z/2
    return step

if len(es) == 0:
    pass
else:
    for e in es:
        step = step + power_exponent(e)
print(step)


Measured memory_bytes: 4212
A,B,K=map(int,input().split())
ks=[]
for i in range(K):
    if (A+i)<=B:
        ks.append(A+i)
    if A<=(B-i):
        ks.append(B-i)
new_ks=list(set(ks))
new_ks.sort()
for i in range(len(new_ks)):
    print(new_ks[i])

Measured memory_bytes: 3060
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {
		// TODO ?????????????????????????????????????????????
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = br.readLine();
		int henkan = Integer.parseInt(line);

		int hour = henkan / 3600;
		int minute = henkan % 3600 / 60;
		int second = henkan % 3600 % 60;

		System.out.println(hour + ":" + minute + ":" + second);
	}
}

Measured memory_bytes: 24324
# ABC047D - 高橋君と見えざる手 / An Invisible Hand (ARC063D)
def main():
    N, T, *A = map(int, open(0).read().split())
    cur, cand = A[0], []
    for i in A:
        if i < cur:
            cur = i
        else:
            cand += [i - cur]
    x = max(cand)
    ans = len([1 for i in cand if i == x])
    print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 14052
import java.util.*;


public class Main {
  static int N, K;
  static int[] D;

  public static boolean isOK(int n) {
    while(n > 0) {
      int d = n % 10;
      for(int i = 0 ; i < K; i++) {
        if(D[i] == d) return false;
      }
      n /= 10;
    }
    return true;
  }

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

    N = sc.nextInt();
    K = sc.nextInt();

    D = new int[K];
    for(int i = 0; i < K; i++) {
      D[i] = sc.nextInt();
    }

    int n = N;
    while(!isOK(n)) n++;

    System.out.println(n);
  }
}


Measured memory_bytes: 9296
#include "bits/stdc++.h"
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
int main() {
	int N, H;
	cin >> N >> H;
	vector<P> v;
	for (int i = 0; i < N; i++) {
		int a, b;
		cin >> a >> b;
		v.push_back(P(a, -b));
	}
	sort(v.rbegin(), v.rend());
	vector<int> b;
	for (int i = 1; i < N; i++) if (-v[i].second > v[0].first) b.push_back(-v[i].second);
	sort(b.rbegin(), b.rend());
	int ans = 0;
	for (int i = 0; i < b.size(); i++) {
		H -= b[i];
		ans++;
		if (H <= 0) break;
	}
	if (H > 0) {
		int l = 0, r = H;
		while ((r - l) > 1) {
			int m = (l + r) / 2;
			if (H <= (LL)v[0].first*m + (-v[0].second - v[0].first)) r = m;
			else l = m;
		}
		ans += r;
	}
	cout << ans << endl;
}

Measured memory_bytes: 1908
#include <stdio.h>

int main(){
    int H, W, i, j;
    
    while(1){
        scanf("%d %d", &H, &W);
        if(H > 300 || W > 300){
            printf("error\n");
            return 0;
        }
        
        if(H == 0 && W == 0) break;
    
        for(i = 0; i < H; i++){
            for(j = 0; j < W; j++){
                printf("#");
            }
            printf("\n");
        }
        printf("\n");
    }
        
        return 0;
}

Measured memory_bytes: 572
#include <iostream>
#include <vector>

using namespace std;

int main(void){

    int A, B, C;

    cin >> A >> B >> C;
    if(A == B){
        cout << C << endl;
    }else if(A == C){
        cout << B << endl;
    }else{
        cout << A << endl;
    }
    
    return 0;
}

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

using namespace std;

#define fin cin
#define fout cout
//ifstream fin("x.in"); ofstream fout("x.out");

const int nmax = 1e5;

int v[nmax + 1];
bool viz[nmax + 1], f[nmax + 1];
vector< int > comp;
vector< int > g[nmax + 1];

void dfs (int nod) {
    viz[ nod ] = 1;
    comp.push_back( nod );
    f[ v[ nod ] ] = 1;

    for (auto i : g[ nod ])
        if (viz[ i ] == 0)
            dfs( i );
}

int main() {
    fin.sync_with_stdio(false); fin.tie(); fout.tie();

    int n, m;
    fin >> n >> m;
    for (int i = 1; i <= n; ++ i) {
        fin >> v[ i ];
    }

    for (int i = 1; i <= m; ++ i) {
        int x, y;
        fin >> x >> y;
        g[ x ].push_back( y );
        g[ y ].push_back( x );
    }

    int ans = 0;
    for (int i = 1; i <= n; ++ i) {
        if (viz[ i ] == 0) {
            comp.clear();
            dfs( i );

            for (auto j : comp) {
                ans += f[ j ];
            }

            for (auto j : comp) {
                f[ v[ j ] ] = 0;
            }
        }
    }

    fout << ans << "\n";
    return 0;
}



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

using namespace std;
typedef long long ll;
typedef vector<ll> vl ;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;

#define rep(i,N) for(int i=0; i < (int)N; i++)
#define all(v) (v).begin(),(v).end()

const int INF = 1001001001;

int main(){
	int n; cin >> n;
	vl a(n);
	
	rep(i,n){
		cin >> a[i];
	}
	map<ll, ll> s;
	ll ans = 0;
	rep(i,n){
		s[a[i]+i] ++;
	}
	rep(i, n){
		ans += s[i-a[i]];
	}
	
	cout << ans <<endl;
}

Measured memory_bytes: 27456
#include <iostream>
 int main() {
  int n, m;
  long long int s = 10000000;
  long long int g = -10000000;
  long long int d = 0;
  std::cin >> n;
   for (int i = 1; i <= n; i++) {
    std::cin >> m;
    d += m;
     if (m <= s) {
      s = m;
     }
     if (m >= g) {
      g = m;
    }
    }   
    std::cout << s << " " << g << " " << d <<std::endl;



 return 0;


}
    
    


Measured memory_bytes: 3080
#include <iostream>
using namespace std;
int main()
{
    int h,a;
    int count=0;
    cin >> h;
    cin >> a;
    int arr[a];
    for(int i=0;i<a;i++)
    {
        cin >> arr[i];
    }
    int i=0;
    while(h>0 && i<a)
    {
        h-=arr[i];
        count++;
        i++;
    }
    if(h>0)
        cout << "No" <<endl;
    else
        cout << "Yes" <<endl;
}


Measured memory_bytes: 640
"use strict";
function I(t,i){this._s=t.split("\n"),this._c=0,this._l=0,this._f=i||Number}I.prototype.a=function(t){var i=this._s[this._l];if(i){var s=i.trim().split(" "),h=s[this._c];return this._c++,s.length===this._c&&(this._c=0,this._l++),t?t(h):this._f(h)}},I.prototype.l=function(t){var i=this._s[this._l];if(i)return this._c=0,this._l++,i.split(" ").map(t||this._f)},module.exports=I;

function main(input) {
  var o = new I(input);
  var n = o.a();
  var s = [];
  for (var i = 0; i < n; i++) {
    s.push(o.a(String));
  }

  var a = 0, b = 0, c = 0;
  for (var i = 0; i < n; i++) {
    if (s[i][0] === "B" && s[i][s[i].length - 1] === "A") {
      c += 1;
    } else if (s[i][0] === "B") {
      b += 1;
    } else if (s[i][s[i].length - 1] === "A") {
      a += 1;
    }
  }

  var base = 0;
  s.forEach(x => {
    for (var i = 0; i < x.length - 1; i++) {
      if (x.slice(i, i + 2) === "AB") {
        base += 1;
      }
    }
  });

  if (a === 0 && b === 0) {
    console.log( base + ( c - 1 > 0 ? c - 1: 0));
  } else if (a === 0 || b === 0) {
    console.log(base + c);
  } else {
    console.log(base + Math.min(a, b) + c);
  }
}


main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 10152
import collections

# Iterative Algorithm (xgcd)
def iterative_egcd(a, b):
    x,y, u,v = 0,1, 1,0
    while a != 0:
        q,r = b//a,b%a; m,n = x-u*q,y-v*q # use x//y for floor "floor division"
        b,a, x,y, u,v = a,r, u,v, m,n
    return b, x, y
 
# Recursive Algorithm
def recursive_egcd(a, b):
    """Returns a triple (g, x, y), such that ax + by = g = gcd(a,b).
       Assumes a, b >= 0, and that at least one of them is > 0.
       Bounds on output values: |x|, |y| <= max(a, b)."""
    if a == 0:
        return (b, 0, 1)
    else:
        g, y, x = recursive_egcd(b % a, a)
        return (g, x - (b // a) * y, y)
 
egcd = iterative_egcd  # or recursive_egcd(a, m)
 
def modinv(a, m):
    g, x, y = egcd(a, m) 
    if g != 1:
        return None
    else:
        return x % m
 
def conv(n,a):
    ret = 1
    for i in range(1,a+1):
        ret *= n-a+i
        ret //= i
    return ret
        
n,a,b = map(int, input().split(' '))
v = map(int, input().split(' '))

v = sorted(v, reverse=True)
select = v[:a]
result1 = sum(select)/len(select)

result2 = 0
v_cnt = collections.Counter(v)
for i in range(a,b+1):
    select = v[:i]
    if result1 == sum(select)/len(select):
        select = collections.Counter(select)
        buf = 1
        for v_ in v_cnt:
            buf *= conv(v_cnt[v_],select[v_])
        result2 += buf
print('%.6f'%result1)
print(result2)

Measured memory_bytes: 3316
<?php
$input=explode(' ',trim(fgets(STDIN)));

for ( $i = 1; $i <= $input[0] ; $i++)
{
    $number[$i] = $i ;
    // 正規表現にマッチしたすべての文字列を抽出
    preg_match_all("([0-9])", $i , $sum);
    // 各位の和を配列に格納
    $arrSum[$i] = array_sum($sum[0]);
}

for ( $i = 1; $i <= $input[0] ; $i++)
{
    // 条件に当てはまる元の数字を$output配列に格納する
    if ( $arrSum[$i] >= $input[1] && $arrSum[$i] <= $input[2]  )
    {
        $output[$i] = $i;
    }
}

echo array_sum($output)."\n";
?>

Measured memory_bytes: 8052
"""
AtCoder :: Beginner Contest 172 :: C :: Tsundoku
https://atcoder.jp/contests/abc172/tasks/abc172_c

"""
import sys
from collections import deque


def solve(A, B, K):
    """Solve puzzle."""
    time_read = 0

    # Read as many books as you can from A
    a_books_read = []
    while A:
        if A[0] + time_read <= K:
            time_read += A[0]
            a_books_read.append(A[0])
            A.popleft()
        else:
            break

    # Then read as many books as you can from B
    b_books_read = []
    while B:
        if B[0] + time_read <= K:
            b_books_read.append(B[0])
            time_read += B[0]
            B.popleft()
        else:
            break

    max_books = len(a_books_read) + len(b_books_read)

    # One at a time, put the last read book from A back and
    # see how many more books from B you can read.
    while a_books_read:
        time_read -= a_books_read[-1]
        a_books_read.pop()
        while B:
            if B[0] + time_read <= K:
                b_books_read.append(B[0])
                time_read += B[0]
                B.popleft()
            else:
                break
        max_books = max(max_books, len(a_books_read) + len(b_books_read))

    return max_books


def main():
    """Main program."""
    N, M, K = (int(i) for i in sys.stdin.readline().split())
    A = deque(int(i) for i in sys.stdin.readline().strip().split())
    B = deque(int(i) for i in sys.stdin.readline().strip().split())
    print(solve(A, B, K))


if __name__ == '__main__':
    main()


Measured memory_bytes: 39616
#include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
bool check(int n)
{
	int ans=0;
	while(n)
	{
		n/=10;
		ans++;
	}
	if(ans%2) return true;
	return false;
}
int main()
{
	int n;scanf("%d",&n);
	int ans=0;
	for(int i=1;i<=n;i++)
	{
		if(check(i)) ans++;
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 256
<?php
fscanf(STDIN, '%d %d', $a, $b);
if($a >= 13) {
    echo $b, PHP_EOL;
} elseif($a >= 6 && $a <= 12) {
    echo $b / 2, PHP_EOL;
} else {
    echo 0, PHP_EOL;
}

Measured memory_bytes: 4856
import std.algorithm, std.array, std.container, std.range;
import std.numeric, std.math, std.bigint, std.random;
import std.string, std.uni, std.regex, std.conv;
import std.bitmanip, core.bitop;
import std.stdio, std.typecons;

void main()
{
  auto w = readln.chomp;
  auto r = 0;

  for (;;) {
    auto t = readln.chomp;
    if (t == "END_OF_TEXT") break;
    auto ti = t.split;
    r += ti.count!(a => icmp(a, w) == 0);
  }

  writeln(r);
}

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

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
  
    if (a + b > c + d) {
      cout << "Left" << endl;
    } else if (a + b < c + d) {
      cout << "Right" << endl;
    } else {
      cout << "Balanced" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-8;

//int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	cin>>N;
	set<int>s;
	for(int i=0;i<N;i++){
		cin>>M;
		s.insert(M);
	}
	if(s.size()==N)cout<<"YES\n";
	else cout<<"NO\n";
}

Measured memory_bytes: 9600
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <list>
#include <numeric>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;

int a, b, c,d;
string s, t;

int main()
{
	cin >> a>>b>>c>>d;
   int x;
	 x= d ==1? 1: 0;

	
	
	cout << x<< endl;
}


Measured memory_bytes: 256
n,k = map(int,input().split())
li = [int(x) for x in input().split()]

dp = [10**8] * n

for i in range(n):
    if i == 0:
        dp[0] = 0
    elif i < k-1:
        temp = []
        for j in range(i):
            s = abs(li[i] - li[i-j-1]) + dp[i-j-1]
            temp.append(s)
        else:
            dp[i] = min(temp)
    elif i >= k-1:
        temp = []
        for j in range(k):
            s = abs(li[i] - li[i-j-1]) + dp[i-j-1]
            temp.append(s)
        else:
            dp[i] = min(temp)
            
print(dp[-1])


Measured memory_bytes: 52448
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    get!($($t),*)
        ).collect::<Vec<_>>()
    };
    ($t:ty |) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty | $n:expr) => {
        (0..$n).map(|_| get!($t |)).collect::<Vec<_>>()
    };
}

macro_rules! tern {
    ($condition: expr, $_true: expr, $_false: expr) => {
        if $condition {
            $_true
        } else {
            $_false
        }
    };
}

fn main() {
    let a = get!(usize);
    let s = get!(String);
    if a >= 3200 {
        println!("{}", s);
    } else {
        println!("red");
    }
}


Measured memory_bytes: 4352
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int p = sc.nextInt();

		int sum = a * 3 + p;

		System.out.println(sum / 2);

		sc.close();

	}
}

Measured memory_bytes: 35780
import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    // 整数の入力
    int a = sc.nextInt();
    int b = sc.nextInt();
    
    int answer = a * b;
    
    if (answer % 2 == 0) {
      System.out.println("Even");
    } else {
      System.out.println("Odd");
    }
  }
}

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

count = 0
for a in A:
    cal = 0
    for i in range(M):
        cal += a[i]*b[i]
    if cal+C > 0:
        count += 1

print(count)

Measured memory_bytes: 3064
#!/usr/bin/env python3

import sys
sys.setrecursionlimit(300000)

def solve(n, k, d, A):
    s = set()
    for aa in A:
        for a in aa:
            s.add(a)
    ret = 0
    for i in range(1, n + 1):
        if not i in s:
            ret += 1
    print(ret)
    return


def main():
    n, k = map(int, input().split())
    d = []
    a = []
    for i in range(k):
        d.append(int(input()))
        a.append(list(map(int, input().split())))
    solve(n, k, d, a)

if __name__ == '__main__':
    main()


Measured memory_bytes: 67600
#include <iostream>
#include <algorithm>
#include <map>
#include <utility>
#include <vector>
#include <cstdio>
#include <iomanip>
#include <cmath>
#include <cstdlib>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i <= n; i++) 

int main() {
    string s;
    cin >> s;
    int q;
    cin >> q;
    string t;
    rep(i,q) {
        int ty;
        cin >> ty;
        if (ty==1) {
            swap(s,t);
        } else {
            int f;
            cin >> f;
            string c;
            cin >> c;
            if(f==1) {
                t += c;
            } else {
                s += c;
            }
        }
        
    }
    reverse(t.begin(), t.end());
    cout << t + s << endl;
    return 0;

}

Measured memory_bytes: 1312
#include <bits/stdc++.h>
#define fo(a,b,c) for (a=b; a<=c; a++)
#define fd(a,b,c) for (a=b; a>=c; a--)
#define min(a,b) (a<b?a:b)
#define max(a,b) (a>b?a:b)
#define ll long long
//#define file
using namespace std;

int a[200001][2],ls[100001],A[100001],B[100001],C[100001],fa[100001],n,m,i,j,k,l,len;
ll f[100001],sum[100001];
bool bz[100001];

void New(int x,int y) {++len;a[len][0]=y;a[len][1]=ls[x];ls[x]=len;}
bool cmp(int x,int y) {return C[x]>C[y];}
int gf(int t) {if (fa[t]==t) return fa[t];fa[t]=gf(fa[t]);return fa[t];}
namespace G{
	int a[200001][2],ls[100001],b[100001],len,i,j,k,l,x,y;
	
	void New(int x,int y) {++len;a[len][0]=y;a[len][1]=ls[x];ls[x]=len;}
	void work()
	{
		fo(i,1,n) b[i]=i;
		sort(b+1,b+n+1,cmp);
		fd(l,n,1)
		{
			bz[b[l]]=1;
			for (i=ls[b[l]]; i; i=a[i][1])
			if (bz[a[i][0]])
			{
				x=gf(b[l]),y=gf(a[i][0]);
				if (x!=y)
				fa[fa[y]]=fa[x],::New(x,y),::New(y,x);
			}
		}
	}
}
void dfs(int Fa,int t)
{
	int i;
	
	f[t]=9223372036854775807ll,sum[t]=B[t];
	for (i=ls[t]; i; i=a[i][1])
	if (a[i][0]!=Fa)
	dfs(t,a[i][0]),sum[t]+=sum[a[i][0]];
	
	f[t]=sum[t]+C[t];
	for (i=ls[t]; i; i=a[i][1])
	if (a[i][0]!=Fa)
	f[t]=min(f[t],sum[t]-sum[a[i][0]]+max(C[t],f[a[i][0]]));
}

int main()
{
	#ifdef file
	freopen("arc098F.in","r",stdin);
	#endif
	
	scanf("%d%d",&n,&m);
	fo(i,1,n) scanf("%d%d",&A[i],&B[i]),A[i]=max(A[i],B[i]),fa[i]=i,C[i]=A[i]-B[i];
	fo(i,1,m) scanf("%d%d",&j,&k),G::New(j,k),G::New(k,j);
	
	G::work();
	dfs(0,G::b[1]);
	printf("%lld\n",f[G::b[1]]);
	
	fclose(stdin);
	fclose(stdout);
	return 0;
}

Measured memory_bytes: 16260
import sys
from collections import Counter
readline = sys.stdin.buffer.readline
MOD = 10**9+7

def main():
    N, M = map(int, readline().split())
    load = [0]*N
    for _ in range(M):
        a, b = map(int, readline().split())
        load[a-1]+=1
        load[b-1]+=1
    for i in range(N):
        print(load[i])




if __name__ == '__main__':
    main()

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

#define ll long long

ll fun(int N,int M,int A,int B){
  ll ans=0;
  for(int i=0;i<N;i++){
    ans += (A*i+B) /M;
  }
  return ans;
}

int main(){
  ll N,M,A,B;
  ll ans = 0;
  int T;
  cin >> T;
  for(int i=0;i<T;i++){
    cin >> N >> M >> A >> B;
    cout << atcoder::floor_sum(N,M,A,B) << endl;
  }
  return 0;
}

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

using namespace std;
string s;
bool ispal(int p1,int p2)
{
    for(int i=p1;i<(p1+p2)/2;i++){
        if(s[i]!=s[p2-i-1+p1])
            return false;
    }
    return true;
}
int main()
{
    cin>>s;
    if(s.size()%2==0)
        cout<<"No";
    else if(!ispal(0,s.size()))
        cout<<"No";
    else if(!ispal(0,s.size()/2) || !ispal(s.size()/2+1,s.size()))
        cout<<"No";
    else
        cout<<"Yes";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define maxn 100
typedef long long ll;
int main(void)
{
    int m,n;
    cin>>n>>m;
    int ans = 0;
    ans += (n>1)?(n-1)*n/2:0;
    ans += (m>1)?m*(m-1)/2:0;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn=55;
int n,m,a[maxn],b[maxn],c[maxn],d[maxn];
inline int myabs(int a){
	return a>0?a:-a;
}
inline int mht(int A,int B,int C,int D){
	return myabs(A-C)+myabs(B-D);
}
int main(){
	scanf("%d%d",&n,&m);
	for(register int i=1;i<=n;i++) scanf("%d%d",&a[i],&b[i]);
	for(register int i=1;i<=m;i++) scanf("%d%d",&c[i],&d[i]);
	int minn,minx,temp;
	for(register int i=1;i<=n;i++){
		minx=3e8;
		for(register int j=1;j<=m;j++){
			temp=mht(a[i],b[i],c[j],d[j]);
			if(temp<minx){
				minx=temp;minn=j;
			}
		}
		printf("%d\n",minn);
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int limit = sc.nextInt();
    int max =0;
    int result=1;
    for(int i=1; i<=limit; i++){
        int tmp =i;
        int cnt=0;
        while(true){
            if(tmp%2!=0){
                break;
            }
            tmp=tmp/2;
            cnt++;
        }
        if(cnt>max){
            max =cnt;
            result=i;
        }
    }
    System.out.println(result);
  }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int main(){
    vi a(5);
    rep(i, 5) cin >> a[i];
    int k;
    cin >> k;
    sort(all(a));
    if(a.back() - a[0] > k) cout << ":(" << endl;
    else cout << "Yay!" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cmath>

using namespace std;

int main(){
    int N,M,sum=0,num=0,i;
    cin >>N>>M;
    int A[N];
    for(i=0;i<N;i++){
        cin >>A[i];
        sum=sum+A[i];
    }
    for(i=0;i<N;i++){
        if(A[i]>=ceil((double)sum/(4*M)))num++;
    }
    if(num>=M) cout <<"Yes"<<endl;
    else cout <<"No"<<endl;

    return 0;
}

Measured memory_bytes: 256