akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define LLI long long int
#define FOR(v, a, b) for(LLI v = (a); v < (b); ++v)
#define FORE(v, a, b) for(LLI v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define REV(v, a, b) for(LLI v = (a); v >= (b); --v)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define ITR(it, c) for(auto it = (c).begin(); it != (c).end(); ++it)
#define RITR(it, c) for(auto it = (c).rbegin(); it != (c).rend(); ++it)
#define EXIST(c,x) ((c).find(x) != (c).end())
#define fst first
#define snd second
#define popcount __builtin_popcount
#define UNIQ(v) v.erase(unique(ALL(v)), v.end())
#define bit(i) (1LL<<i)
#define sz(v) ((LLI)(v).size())

#ifdef DEBUG
#include <misc/C++/Debug.cpp>
#else
#define dump(...) ((void)0)
#endif

#define gcd __gcd

using namespace std;
template <class T> constexpr T lcm(T m, T n){return m/gcd(m,n)*n;}

template <typename I> void join(ostream &ost, I s, I t, string d=" "){for(auto i=s; i!=t; ++i){if(i!=s)ost<<d; ost<<*i;}ost<<endl;}
template <typename T> istream& operator>>(istream &is, vector<T> &v){for(auto &a : v) is >> a; return is;}
template <typename T, typename U> istream& operator>>(istream &is, pair<T,U> &p){is >> p.first >> p.second; return is;}

template <typename T, typename U> bool chmin(T &a, const U &b){return (a>b ? a=b, true : false);}
template <typename T, typename U> bool chmax(T &a, const U &b){return (a<b ? a=b, true : false);}
template <typename T, size_t N, typename U> void fill_array(T (&a)[N], const U &v){fill((U*)a, (U*)(a+N), v);}

const LLI mod = 1000003;

LLI power(LLI n, LLI p, LLI m){
  LLI ret = 1;
  while(p>0){
    if(p&1) (ret *= n) %= m;
    (n *= n) %= m;
    p /= 2;
  }
  return ret;
}

LLI mod_inv(LLI n, LLI p){return power(n,p-2,p);}

template <LLI mod> class Combination{
public:
  vector<LLI> facto = {1};
  vector<LLI> ifacto = {1};

  LLI factorial(LLI i){
    if(i < 0) throw exception();
    if(facto.size() <= i) facto.resize(i+1, -1);
    if(i == 0) return facto[0] = 1;
    LLI j = i;
    for(;j>=0;--j) if(facto[j] != -1) break;
    for(LLI k=j+1; k<=i; ++k) (facto[k] = facto[k-1] * k) %= mod;
    return facto[i];
  }

  LLI factorial_inverse(LLI i){
    if(i < 0) throw exception();
    if(ifacto.size() <= i) ifacto.resize(i+1, -1);
    if(ifacto[i] != -1) return ifacto[i];
    return ifacto[i] = mod_inv(factorial(i), mod);
  }

  LLI P(LLI n, LLI k){
    if(n < k or n < 0 or k < 0) return 0;
    return (factorial(n) * factorial_inverse(n-k)) % mod;
  }

  LLI C(LLI n, LLI k){
    if(n < k or n < 0 or k < 0) return 0;
    return (P(n,k) * factorial_inverse(k)) % mod;
  }

  LLI H(LLI n, LLI k){
    return C(n+k-1, k);
  }
};

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

  Combination<mod> com;

  int Q; cin >> Q;
  while(Q--){
    LLI x,d,n; cin >> x >> d >> n;
    
    LLI ans = 0;

    if(d == 0){
      ans = power(x,n,mod);
    }else if(n >= mod){
      ans = 0;
    }else{
      LLI k = x*mod_inv(d,mod)%mod;

      ans = com.P(k+n-1,n)*power(d,n,mod)%mod;
    }
    
    cout << ans << endl;
  }
  
  return 0;
}


Measured memory_bytes: 46340
#!/usr/bin/env python3
import sys
import itertools

def solve(N: int, d: "List[int]"):
    dd = list(itertools.combinations(d,2)) 
    answer = 0
    for ddd in dd:
        answer += ddd[0]*ddd[1]
    print(answer)

    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    d = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, d)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include<cstdio>

using namespace std;

int main(void){
	int in[100],data,ans[100],cnt,work=0;
	int i,j;	//ループカウンタ

	for(i=0;i<100;i++){
		ans[i]=0;
		in[i]=0;
	}

	for(i=0;i<100;i++){
		if(scanf("%d",&data)==EOF)	break;	//EOF=Ctrl+z
		in[data]++;
	}
	
	for(i=1;i<100;i++)
		if(in[work]<in[i])	work=i;
	
	ans[0]=work;
	cnt=0;
	for(i=1;i<100;i++){
		if(in[work]==in[i] && i!=work){
			cnt++;
			ans[cnt]=i;
		}
	}

	for(i=0;i<=cnt-1;i++){
		for(j=1;j<=cnt;j++){
			if(ans[i]>ans[j]){
				work=ans[i];
				ans[i]=ans[j];
				ans[j]=work;
			}
		}
	}
	
	for(i=0;i<=cnt;i++)
		printf("%d\n",ans[i]);

	return 0;
}

Measured memory_bytes: 0
import java.util.*;

public class Main {
	
	//parent = (i-1)/2
	//left child = (2*i) + 1
	//right child = (2*i) + 2
	
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int length = in.nextInt();
		int[] heap = new int[length];
		for (int i = 0; i < length; i++) {
			heap[i] = in.nextInt();
		}
		
		for (int i = 0; i < length; i++) {
			int data = heap[i];
			System.out.print("node " + (i + 1) + ": key = " + data + ", ");
			double parent = ((double) i - 1)/2;
			if (parent >= 0) {
				System.out.print("parent key = " + heap[(int) parent] + ", ");
			}
			int left = 2*i + 1;
			if (left < length) {
				System.out.print("left key = " + heap[left] + ", ");
			}
			int right = 2*i + 2;
			if (right < length) {
				System.out.print("right key = " + heap[right] + ", ");
			}
			System.out.println();
			
		}
		
	}

}


Measured memory_bytes: 27024
#include <bits/stdc++.h>
using namespace std;
vector <string> str;
vector <int> cnt;
string key;
int pos;
 
bool check(string a,int x,int y){
  int ima=pos,i=0,j=0;
  if(cnt[x]<=cnt[y]&&pos!=1) return 0;
  while(key[ima]==a[i])ima++,i++;
  if((key[ima]=='.'||!key[ima])&&a[i]==':') {
    pos=ima+1;
    return 1;
  }
  return 0;
}
 
string bnf(){
  int idx=0;
  int par=0;
  while(pos<(int)key.size()){
    while(idx<(int)str.size()&&!check(str[idx],idx,par))idx++;
    if(idx==(int)str.size()) return "no such property";  
    par=idx;
  }
 
 
  if(str[idx][str[idx].size()-1]==':') return "object";
  string ans="string \"";
  int f=0;
  for(int i=0;i<str[idx].size();i++){
    if(str[idx][i]==':') f=1;
    else if(f==1&&str[idx][i]==' ')f=2;
    else if(f==2) ans+=str[idx][i];
  }
  ans+="\"";
  return ans;
}
 
int main(){
  cin>>key;
  string a;
  getline(cin,a);
  while(getline(cin,a))str.push_back(a);
  for(int i=0;i<str.size();i++){
    int j=0;
    while(str[i][j]==' ') j++;
    cnt.push_back(j+1);
    str[i]=str[i].substr(j,str[i].size()-j);
  }
  pos=1;
  cout << bnf()<<endl;
  return 0;
}

Measured memory_bytes: 1312
/**
 *
 * @author p2.revelation
 */
class Main {

    public static void main(String[] a) {
        int i, j;
        for (i = 1; i < 10; i++) {
            for (j = 1; j < 10; j++) {
                System.out.print(i + "x" + j + "=" + i*j + "\n");

            }
        }
    }
}

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

int main() {
    string S;
    cin >> S;
    int cnt0 = 0, cnt1 = 0;
    for (int i = 0; i < S.length(); i++) {
        if ((i % 2 == 0 && S[i] == '0') || (i % 2 == 1 && S[i] == '1')) {
            cnt0++;
        }
        if ((i % 2 == 0 && S[i] == '1') || (i % 2 == 1 && S[i] == '0')) {
            cnt1++;
        }
    }
    cout << min(cnt0, cnt1) << endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>

#define MOD 1000000007
using ll = long long;
using namespace std;

int main() {
    int N;
    cin >> N;
    if (N % 2 == 0) {
        cout << N << endl;
    }
    else {
        cout << N * 2 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
int main(){
    int k;
    cin >> k;
    ll max_lunlun = 3234566667;

    queue<ll>que;
    FOR(i,1,10){
        que.push(i);
    }

    FOR(i,1,100001){
        ll new_lunlun;
        ll tmp = que.front();
        if(i == k){
            cout << tmp << endl;
            return 0;
        }
        que.pop();
        int x = tmp%10;
        if(x!=0)
            que.push(tmp*10+x-1);

        que.push(tmp*10+x);

        if(x!=9)
            que.push(tmp*10+x+1);
    }

    return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
#include<map>
#include<iomanip>
#include<queue>

using namespace std;

int main(){
	int n,x,t;
	cin >> n >> x >> t;
	int ans=(n+x-1)/x*t;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3612
#import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
def pri(x): print('\n'.join(map(str, x)))

S = input()

if S == 'ABC':
    print('ARC')
else:
    print('ABC')


Measured memory_bytes: 9236
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#define Rep(i, n) for(int i=0;i<n;++i)
#define rep(i, n) for(int i=1;i<=n;++i)
#define ll long long int
#define INF 1e9
#define LINF 1e18
#define MOD 1000000007
#define PI 3.14159265359
#define eps 1e-10
#define All(a) (a).begin(), (a).end()

using namespace std;
using P = pair<ll, ll>;
 
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};

/**
 * Usage:
 * 
 * G[from].push_back(Edge(to, weight));
 * using Graph = vector<vector<Edge>>;
 * 
 */ 
struct Edge {
  int to;     
  ll weight; 
  Edge(int t, ll w) : to(t), weight(w) { }
};

template<typename T>
void printv(vector<T>& v) {
  if (v.size() == 0) {
    cout << "\n";
    return;
  }

  Rep(i, v.size()) {
    cout << v[i] << ((i + 1 < v.size()) ? ' ' : '\n');
  }
}



int H, W, N;

int main () {
  cin >> H;
  cin >> W;
  cin >> N;

  int m = max(H, W);
  int ans = (N % m == 0) ? (N / m) : (N / m) + 1; 

  cout << ans << "\n";
}

Measured memory_bytes: 256
x=int(input())

ans=0

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

min=x-1
for i in range(2,x+1):
        a=i*i
        while a <= x:
            b=x-a
            if b <= min and b >= 0:
                min=b
                ans=a
                
            a *=i
print(ans)     

Measured memory_bytes: 3060
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<stdlib.h>
#include<iostream>
using namespace std;
int main(void)
{
	int i,j,k=0,n,m;
	char a[6];
	for(i=0;i<6;i++)
	{
		scanf("%c",&a[i]);
		if(a[i]=='1')
		k++;
	}
	printf("%d",k);
	return 0;
}

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

int main() {
  int N, M;
  cin >> N >> M;
  vector<vector<int>> circuit(M, vector<int>());
  for (int i{}; i < M; ++i) {
    int k;
    cin >> k;
    for (int j{}; j < k; ++j) {
      int s;
      cin >> s;
      --s;
      circuit[i].push_back(s);
    }
  }
  vector<int> p(M);
  for (int i{}; i < M; ++i) {
    cin >> p[i];
  }

  int ans{};
  for (int i{}; i < (1 << N); ++i) {
    vector<int> switches(N);
    for (int j{}; j < N; ++j) {
      switches[j] = !!(i & (1 << j));
    }
    bool bingo{true};
    for (int j{}; j < M; ++j) {
      int on{};
      for (const auto &s : circuit[j]) {
        on += switches[s];
      }
      if (on % 2 != p[j]) {
        bingo = false;
        break;
      }
    }
    if (bingo) ++ans;
  }

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long MOD = 1000000007;

void solve(long long N, std::string S){
    map<char, ll> cnt;
    for(int i = 0; i < (int)N; ++i) cnt[S[i]] += 1;
    ll ans = 1;
    for(auto i: cnt){
        //cout << i.first << " " << i.second << endl;;
        (ans *= (i.second + 1)) %= MOD;
    }
    cout << (ans - 1 + MOD) % MOD << endl;
    //cout << (ans - 1) % MOD << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::string S;
    std::cin >> S;
    solve(N, S);
    return 0;
}


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

using namespace std;

#define ll long long
#define ull unsigned long long
#define pl pair<ll, ll>
#define vll vector<ll>
#define pll vector<pair<ll, ll>>
#define f(i,a, b) for (int i = a; i < b; i++)
#define mod 1000000007
#define mp make_pair
#define pb push_back
#define ld float
#define fd(i,a, b) for (ll i = a; i >= b; i--)

/*  #include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
     typedef tree<ll ,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;*/


ll modpow(ll a,ll b){
 ll res=1;
 while(b>0)
{
    if(b&1)res=(res*a)%mod;
    b=b>>1;
    a=(a*a)%mod;

}
return res;
}
int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
int h,n;
cin>>h>>n;
int aa[n][2];
int mx=0;
f(i,0,n) {cin>>aa[i][0]>>aa[i][1]; mx=max(aa[i][0],mx); }
int to=h+mx+1;
int dp[to];
f(i,0,to)dp[i]=INT_MAX;
dp[0]=0;
f(i,1,to){
  f(j,0,n){
    if(i-aa[j][0]>=0 && dp[i-aa[j][0]]!=INT_MAX){
        dp[i]=min(dp[i-aa[j][0]]+aa[j][1],dp[i]);
    }
  }

}
mx=INT_MAX;
f(j,h,to)mx=min(dp[j],mx);
cout<<mx;

}


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

using namespace std;

int main(int qtd, char* nome[])
{
    int a, b;
    cin >> a >> b;
    int coins = 0, t = 2;
    while(t--){
        if (a >= b){
            coins += a;
            a--;
        }
        else{
            coins += b;
            b--;
        }
    }

    cout << coins << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <tuple>
#include <bitset>
#include <memory>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cfloat>
#include <cassert>
#include <random>

struct Range {
	long long int from, to;
};
long long int power(long long int base, int exp) {
	switch (exp) {
	case 0: return 1LL;
	case 1: return base;
	default: return power(base * base, exp / 2) * power(base, exp % 2);
	}
}
long long int k_th_element(const long long int N, const long long int K) {
	if (K > (N + 1) / 2) return -1;
	std::vector<Range> result;
	for (long long int exp = 1; exp <= N; exp *= 3) {
		result.push_back(Range{ N / exp / 3 + 1, N / exp });
	}
	for (auto& r : result) {
		if (r.from % 2 == 0) ++r.from;
		if (r.to % 2 == 0) --r.to;
	}
	long long int min = 1LL, max = N;
	while (min < max) {
		auto mid = (min + max) / 2;
		long long int count = 0, exp = 1;
		for (auto i = 0; i < result.size(); ++i) {
			if (mid >= result[i].from * exp) {
				count += (std::min(result[i].to, mid / exp) - result[i].from) / 2 + 1;
			}
			exp *= 2;
		}
		if (count < K) min = mid + 1;
		else max = mid;
	}
	return max;
}
int main() {
	int c; std::cin >> c;
	for (auto i = 0; i < c; ++i) {
		long long int n, k; std::cin >> n >> k;
		std::cout << k_th_element(n, k) << '\n';
	}
}


Measured memory_bytes: 3164
#include <iostream>
#include <set>

using namespace std;

int d[114514];

int main()
{
	int k;
	cin >> k;
	d[1] = 1;
	set<pair<int, int>> q;
	q.insert(make_pair(1, 1));
	while (q.begin()->second) {
		int u = q.begin()->second;
		q.erase(q.begin());
		for (int i = 0; i < 2; i++) {
			int v = (i ? u + 1 : u * 10) % k;
			if (d[v] && d[v] <= d[u] + i)
				continue;
			d[v] = d[u] + i;
			q.insert(make_pair(d[v], v));
		}
	}
	cout << *d << endl;
	return 0;
}


Measured memory_bytes: 2944
def resolve():
    import sys
    input = sys.stdin.readline
    # row = [int(x) for x in input().rstrip().split(" ")]
    # n = int(input().rstrip())
    # s = input().rstrip()

    h, w = [int(x) for x in input().rstrip().split(" ")]

    print("".join(["#" for _ in range(w+2)]))

    for i in range(h):
        print("#"+input().rstrip()+"#")

    print("".join(["#" for _ in range(w+2)]))

if __name__ == "__main__":
    resolve()


Measured memory_bytes: 62300
#include <iostream>
#include <utility>
#include <vector>
#include <queue>
#include <stack>
#include <array>
#include <algorithm>
#include <numeric>
#include <limits>
#include <string>
#include <regex>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <map>
using namespace std;
using ll = long long;

class UnionFind{
public:
    ll *par, *rank, *size;
    UnionFind(ll n){
        par = new ll[n];
        rank = new ll[n];
        size = new ll[n];
        for (int i = 0; i < n; i++) {
            par[i] = i;
            rank[i] = 0;
            size[i] = 1;
        }
    }
    ll root(ll x) {return par[x] == x ? x : par[x] = root(par[x]);}
    ll get_size(ll x) {return size[root(x)];}
    bool connected(ll x, ll y) {return root(x) == root(y);}
    void unite(ll x, ll y){
        ll rx = root(x);
        ll ry = root(y);
        if(rx == ry) return;
        if(rank[rx] < rank[ry]) {
            par[rx] = ry;
            size[ry] += size[rx];
        }
        else {
            par[ry] = rx;
            size[rx] += size[ry];
            if(rank[rx] == rank[ry]) rank[rx]++;
        }
        return;
    }
};

int main()
{
    ll N, K, L;
    cin >> N >> K >> L;
    UnionFind road(N), rail(N);
    for (int i = 0; i < K; i++) {
        ll p, q;
        cin >> p >> q;
        road.unite(p - 1, q - 1);
    }
    for (int i = 0; i < L; i++) {
        ll r, s;
        cin >> r >> s;
        rail.unite(r - 1, s - 1);
    }
    vector<pair<ll, ll> > v;
    map<pair<ll, ll>, ll> m;
    for (int i = 0; i < N; i++) {
        v.push_back(make_pair(road.root(i), rail.root(i)));
        if (m.count(v[i]) == 0) m[v[i]] = 1;
        else m[v[i]] += 1;
    }
    for (int i = 0; i < N; i++) {
        if (i != N - 1) printf("%lld ", m[v[i]]);
        else printf("%lld\n", m[v[i]]);
    }
    return 0;
}


Measured memory_bytes: 24300
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;

int main() {

    int n, k; cin >> n >> k;
    int ans = 0;
    for (int i = 0; i < n; i++) {
        int x; cin >> x;
        ans += 2 * min(x, k - x);
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
/*#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

#include <boost/rational.hpp>
*/
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
using ll = long long;
using ld = long double;
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define rep3(i, n) for (ll i = 1; i < (ll)(n+1); i++)
#define rep4(i, s, n) for (ll i = (s); i < (ll)(n+1); i++)
#define repr(i,n) for (ll i = (n-1); i>=0;i--)
#define repr3(i,n) for(ll i = (n);i>0;i--)
#define stlen(s) ll s.size()-1
#define all(v) v.begin(), v.end()
#define cout(n) cout<<std::fixed<<std::setprecision(n)
using Graph = vector<vector<int>>;
#define INF1  INT_MAX;
#define INF2  LLONG_MAX;
#define PI  3.14159265358979323846;
#define MOD 1000000007;
/*
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部長が32の浮動小数点数型
using Real32 = mp::number<mp::cpp_dec_float<32>>;
// 仮数部長が1024の浮動小数点数型
using Real1024 = mp::number<mp::cpp_dec_float<1024>>;
// 有理数型
using Rat = boost::rational<Bint>;
*/
ll GCD(ll a,ll b){
  ll r = a % b;
  if(r==0){
    return b;
  }
  else{
    return GCD(b,r);
  }

}

int main() {

int A,B,C;
cin>>A>>B>>C;
int gcd=GCD(A,B);
if(C%gcd==0){
    cout<<"YES"<<endl;
}
else{
    cout<<"NO"<<endl;
}




return 0;
}

Measured memory_bytes: 256
import numpy as np
N, M, X = list(map(int, input().split()))
datas = []
for i in range(N):
    datas.append(np.array(list(map(int, input().split()))))

minv = np.inf
zeros = np.zeros(M+1)

for i in range(2**N):
    tmp = zeros.copy()
    for j in range(N):
        if (i >> j) & 1:
            tmp += datas[j]
            if np.all(tmp[1:len(tmp)] >= X):
                c = np.sum(tmp.T[0])
                if c < minv:
                    minv = c
                break
ret = int(minv) if minv != np.inf else -1
print(ret)

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

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

    double count = 0;
    for(int i = 1; i <= N; i++){
        if(i % 2 != 0) count++;
    }
    
    double ans = count / (double)N;
    printf("%.10lf\n",ans);
}

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

int main(){
    int m,nl,ns;
    while(cin>>m>>ns>>nl,m){
        vector<int> p(m);
        for(int i=0;i<m;i++) cin>>p[i];
        int res=0;
        int gap=0;
        for(int i=0;i<=10000;i++){
            int mi=1000000;
            int ma=0;
            int cnt=0;
            for(int j=0;j<m;j++){
                if(i<=p[j]){
                    cnt++;
                    mi=min(mi,p[j]);
                }
                else{
                    ma=max(ma,p[j]);
                }
            }
            int ga=mi-ma;
            if(ns<=cnt && cnt<=nl){
                if(gap<ga){
                    res=cnt;
                    gap=ga;
                }
                else{
                    res=max(cnt,res);
                }
            }
        }

        cout<<res<<endl;

    }
    return 0;

}

Measured memory_bytes: 3052
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
  vector<int> a(10000,-1),b(10000,-1);
  int n=0;
  while(a[n]!=0&&a[n]!=0){
    cin>>a[n]>>b[n];
    if(a[n]==0&&b[n]==0)continue;
    if(b[n]==min(a[n],b[n]))swap(a[n],b[n]);
    n++;
  }
  rep(i,n)cout<<a[i]<<" "<<b[i]<<endl;
}
       

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

int main() {
    string s;
    cin >> s;
    bool ans = true;
    for(int i = 0; i < s.length()/2; i++){
        if(s.at(i) != s.at(s.length() - 1 - i)){
            ans = false;
        }    
    }
    if(ans){
        for(int i = 0; i < (s.length() - 1)/4; i++){
            if(s.at(i) != s.at((s.length() - 1)/2 - 1 - i)){
                ans = false;
            }
        }
    }
    cout << ((ans) ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
//Heaplax
//别让自己后悔
#include<bits/stdc++.h>
#define N 100005
#define int long long
#define LOG(x) cerr<<#x<<" = "<<x<<endl
#define add_edge(u,v) nxt[++cnt]=head[u],head[u]=cnt,to[cnt]=v
#define open(x) freopen(#x".in","r",stdin),freopen(#x".out","w",stdout)
char ch;bool fs;void re(int& x)
{
	while(ch=getchar(),ch<33);
	if(ch=='-')fs=1,x=0;else fs=0,x=ch-48;
	while(ch=getchar(),ch>33)x=x*10+ch-48;
	if(fs)x=-x;
}
using namespace std;
const int mod=1000000007;
int n,A,B,s[N];
struct BIT
{
	int s[N];
	int top,st[N+N];
	void add(int x,int y)
	{
		++x;
		st[++top]=x;
		for(;x<N;x+=x&-x)
			s[x]=(s[x]+y)%mod;
	}
	int ask(int x)
	{
		++x;
		int res=0;
		for(;x;x-=x&-x)
			res=(res+s[x])%mod;
		return res;
	}
	void clear()
	{
		for(;top;--top)
			for(int i=st[top];i<N;i+=i&-i)
				s[i]=0;
	}
	int query(int a,int b)
	{
		if(a>b)return 0;
		else return (ask(b)-ask(a-1)+mod)%mod;
	}
}a,b;
main()
{
	re(n),re(A),re(B);
	for(int i=1;i<=n;++i)re(s[i]);
	a.add(0,1);
	b.add(0,1);
	for(int i=1,ea=1,eb=1;i<=n;++i)
	{
		while(s[i]-s[ea]>=A)++ea;
		while(s[i]-s[eb]>=B)++eb;
		int fai=a.query(0,ea-1),fbi=b.query(0,eb-1);
		int faii=(a.query(i-1,i-1)-b.query(eb,i-2)+mod)%mod;
		int fbii=(b.query(i-1,i-1)-a.query(ea,i-2)+mod)%mod;
		// LOG(i);
		// LOG(fai);LOG(fbi);
		// LOG(faii);LOG(fbii);
		if(s[i]-s[i-1]<B)a.clear();
		if(s[i]-s[i-1]<A)b.clear();
		a.add(i-1,(faii-a.query(i-1,i-1)+mod)%mod);
		b.add(i-1,(fbii-b.query(i-1,i-1)+mod)%mod);
		a.add(i,fai);b.add(i,fbi);
	}
	printf("%lld\n",(a.query(n,n)+b.query(n,n))%mod);
}
/*
f[i]表示当前X集合的最后一个数是a[i]的方案数

*/


Measured memory_bytes: 5760
#include <iostream>
#include <vector>
using namespace std;
int main() {
	int N, K, Q, A;
	cin >> N >> K >> Q;
	vector<int> right(N, 0);
	for (int i = 0; i < Q; i++) {
		cin >> A;
		right[A - 1]++;
	}
	for (int i : right) cout << (K - Q + i > 0 ? "Yes" : "No") << endl;
}

Measured memory_bytes: 1024
A11, A12, A13 = map(int, input().split())
A21, A22, A23 = map(int, input().split())
A31, A32, A33 = map(int, input().split())
N = int(input())
lb = []
for i in range(N):
  lb.append(int(input()))
res = "No"

for i in range(N):
  if A11 == lb[i]:
    A11 = 0
  if A12 == lb[i]:
    A12 = 0
  if A13 == lb[i]:
    A13 = 0
  if A21 == lb[i]:
    A21 = 0
  if A22 == lb[i]:
    A22 = 0
  if A23 == lb[i]:
    A23 = 0
  if A31 == lb[i]:
    A31 = 0
  if A32 == lb[i]:
    A32 = 0
  if A33 == lb[i]:
    A33 = 0
    
if A11 + A12 + A13 == 0 or A21 + A22 + A23 == 0 or A31 + A32 + A33 == 0 or A11 + A21 + A31 == 0 or A12 + A22 + A32 == 0 or A13 + A23 + A33 == 0 or A11 + A22 + A33 == 0 or A13 + A22 + A31 == 0:
    res = "Yes"
    
print(res)

Measured memory_bytes: 3064
N = int(input())
H = [0] + list(map(int, input().split()))

DP = [0] * (N+1)
for i in range(2, N+1):
  dp = DP[i-1] + abs(H[i-1] - H[i])
  if i > 2:
    dp = min(dp, DP[i-2] + abs(H[i-2] - H[i]))
  DP[i] = dp
print(DP[N])


Measured memory_bytes: 13928
import java.io.*;
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        final int D = Integer.parseInt(sc.next());
        final int N = Integer.parseInt(sc.next());

        out.println(N == 100 ? (int)Math.pow(100, D) * (N + 1) : (int)Math.pow(100, D) * N);
        
        out.flush();
    }
}

Measured memory_bytes: 23764
#include<stdio.h>

int main(void)
{
	int N;
	scanf("%d", &N);
	for(int i = 1; i <= 9; i++)
		if((N%i == 0) && (1<=N/i && N/i<=9))
		{
			printf("Yes\n");
			return 0;
		}
	printf("No\n");
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn=2e5+5;

set<string>s;
vector<ll>ans;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int k;
	cin>>k;
	queue<string>q;
	for(int i=1;i<=9;i++)
    {
        q.push(to_string(i));
    }
    while(s.size()<=5e5)
    {
        string now=q.front();
        s.insert(now);
        char w=now.back();
        q.pop();
        if(w!='0'&&w!='9')
        {
            q.push(now+w);
            w--;
            q.push(now+w);
            w+=2;
            q.push(now+w);
        }
        else if(w=='0')
        {
            q.push(now+w);
            w++;
            q.push(now+w);
        }
        else
        {
            q.push(now+w);
            w--;
            q.push(now+w);
        }


    }
    for(auto &v:s)
    {
        ans.push_back(stoll(v));
    }
    sort(ans.begin(),ans.end());
    cout<<ans[k-1]<<'\n';









}


Measured memory_bytes: 128776
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i, n) for(int i=(n); i>=0; --i)
#define FOR(i, n, m) for(int i=(m), i##_len=(n); i<i##_len; ++i)
#define EACH(i, v) for(const auto& i : v)
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
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 (b<a) { a=b; return 1; } return 0; }
template<class Value>using vec = vector< Value >;
using ll = long long;
using P = pair< long long, long long >;
#define fi first
#define se second
#define el endl
#pragma endregion


void Main();
void solve(long long a);

int main(){
    std::cin.tie(nullptr);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}

void Main(){
    long long a;
    scanf("%lld",&a);
    solve(a);
}

void solve(long long a){
    cout << a+a*a+a*a*a << el;
}



Measured memory_bytes: 3684
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
using namespace std;
typedef pair<int, int> P;

signed main(){
	string s;
	cin >> s;
	cout << s.substr(0, 4) << " " << s.substr(4) << endl;
}

Measured memory_bytes: 764
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
//    String s=sc.next();
    long x=sc.nextInt();
//    int a=sc.nextInt();
//    int b=sc.nextInt();
    x=x%2==0?x:x*2;
    System.out.println(x);
  }
}

Measured memory_bytes: 21844
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>

using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORIT(it, c) for (__typeof((c).begin())it = (c).begin(); it != (c).end(); it++)
#define MEMSET(v, h) memset((v), h, sizeof(v))

int n, m;
int field[110][110];
int map[110][110];
int temp[110][110];
int diffx;
int diffy;

void Rotate() {
  REP(y, m) {
    REP(x, m) {
      temp[y][x] = map[x][m - y - 1];
    }
  }
  memcpy(map, temp, sizeof(map));
  REP(y, m) {
    REP(x, m) {
      if (map[y][x] != -1) { diffx = x; diffy = y; return; }
    }
  }
}

int main() {
  while (scanf("%d %d", &n, &m), n|m) {
    pair<int, int> ans = make_pair(100000, 100000);
    REP(y, n) {
      REP(x, n) {
        scanf("%d", &field[y][x]);
      }
    }
    REP(y, m) {
      REP(x, m) {
        scanf("%d", &map[y][x]);
      }
    }
    REP(i, 4) {
      Rotate();
      REP(sy, n) {
        if (sy + m > n) { continue; }
        REP(sx, n) {
          if (sx + m > n) { continue; }
          REP(y, m) {
            REP(x, m) {
              if (map[y][x] != -1 &&
                  field[sy + y][sx + x] != map[y][x]) { goto next; }
            }
          }
          ans = min(ans, make_pair(sy + diffy, sx + diffx));
next:;
        }
      }
    }
    if (ans.first >= n) {
      printf("NA\n");
    } else {
      printf("%d %d\n", ans.second + 1, ans.first + 1);
    }
  }
}

Measured memory_bytes: 1032
#include <iostream>

using namespace std;

int main()
{
	int a, b;
	cin >> a >> b;
	
	if(a % 2 == 0 || b % 2 == 0) {
		cout << "No" << endl;
	}
	else {
		cout << "Yes" << endl;
	}
	
	return 0;
}

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

#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define ALL(x) (x).begin(), (x).end()

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 1e15;
const ll MOD = 1e9 + 7;

int main() {
  ll h, w;
  cin >> h >> w;
  vector<vector<ll>> a(h, vector<ll>(w));
  vector<pair<P, P>> ans;

  REP(i, h) REP(j, w) { cin >> a[i][j]; }

  REP(i, h) REP(j, w - 1) {
    if (a[i][j] % 2 != 0) {
      a[i][j + 1]++;
      ans.emplace_back(P(i, j), P(i, j + 1));
    }
  }

  REP(i, h - 1) {
    if (a[i][w - 1] % 2 != 0) {
      a[i + 1][w - 1]++;
      ans.emplace_back(P(i, w - 1), P(i + 1, w - 1));
    }
  }

  cout << ans.size() << endl;

  REP(i, ans.size()) {
    cout << ans[i].first.first + 1 << " " << ans[i].first.second + 1 << " "
         << ans[i].second.first + 1 << " " << ans[i].second.second + 1 << endl;
  }

  return 0;
}

Measured memory_bytes: 8432
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n,m;
  cin >> n >> m ;

  int p[m],y[m];

  map<int,int> mp;

  for (int i = 0 ; i < m ; i ++)
    {
      cin >> p[i] >> y[i];
    }

  long long py[m];
  for (int i = 0 ; i < m ; i ++)
    {
      py[i] = p[i]*100000000000 + y[i];
    }

  sort(py,py+m);

  int cnt = 1;
  int prepi = 0;
  for (int i = 0 ; i < m ; i ++)
    {
      int pi = py[i] / 100000000000;
      if (prepi != pi){
	cnt = 1;
	prepi = pi;
      }

      int key = py[i] % 100000000000;
      int value = cnt;
      
      mp[key] = value;
      cnt ++;
    }

  for (int i = 0 ; i < m ; i ++)
    {
      printf("%06d", p[i]);
      printf("%06d\n", mp[y[i]]);
    }
}


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

int main() {
	int N;
	string S;
	set<string> r;

	cin >> N;
	rep(i,N) {
		cin >> S;
		r.insert(S);
	}

	cout << r.size() << endl;
}

Measured memory_bytes: 19248
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  int n;
    cin >> n;

  int ans=0, l, r;
    for(int i=0; i<n; i++){
      cin >> l >> r;
      ans += r-l+1;
    }
    cout << ans << endl;

}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	static Scanner sc = new Scanner(System.in);
	static int l = sc.nextInt();
	static int a = sc.nextInt();
	static int b = sc.nextInt();
	static int c = sc.nextInt();
	static int d = sc.nextInt();


	public static void main(String[] args) {
		int j = 0;
		int m = 0;
			if (a % c == 0) {
				j = a / c;
			} else {
				j = a / c + 1;
			}

			if (b % d == 0) {
				m = b / d;
			} else {
				m = b / d + 1;
			}

		System.out.println(l - Math.max(j, m));

	}

}


Measured memory_bytes: 26172
/*
[agc025] D - Choosing Points
*/

#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;

const int MAX_N = 300;

int N;
int D[2];
int color[2 * MAX_N][2 * MAX_N][2];

int calc_color(int x, int y, int d) {
    if (d % 2 == 1) {
        return (x + y) % 2;
    }
    if (d % 4 == 2) {
        return x % 2;
    }
    return calc_color(x / 2, y / 2, d / 4);
}

void solve() {
    int cnt[2][2];
    memset(cnt, 0, sizeof(cnt));

    for (int i = 0; i < 2 * N; i++) {
        for (int j = 0; j < 2 * N; j++) {
            for (int k = 0; k < 2; k++) {
                color[i][j][k] = calc_color(i, j, D[k]);
            }
            int c0 = color[i][j][0];
            int c1 = color[i][j][1];
            cnt[c0][c1]++;
        }
    }

    int ans_c0, ans_c1;
    for (int c0 = 0; c0 < 2; c0++) {
        for (int c1 = 0; c1 < 2; c1++) {
            if (cnt[c0][c1] >= N * N) {
                ans_c0 = c0;
                ans_c1 = c1;
            }
        }
    }

    int cnt_found = 0;
    for (int i = 0; i < 2 * N; i++) {
        for (int j = 0; j < 2 * N; j++) {
            if (color[i][j][0] == ans_c0 && color[i][j][1] == ans_c1) {
                cout << i << " " << j << endl;
                cnt_found++;
                if (cnt_found >= N * N) {
                    return;
                }
            }
        }
    }
}

int main() {
    cin >> N >> D[0] >> D[1];

    solve();

    return 0;
}


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

const int MAX = 10000001;
char p[MAX];
vector<char> P;

void f(){
	for(int i=2 ; i < MAX ; i++ ) p[i] = 1;
	for(int i=2 ; i+i < MAX ; i++ ){
		if( p[i] ){
			for(int j=i+i ; j < MAX ; j += i ){
				p[j] = 0;
			}
		}
	}
	for(int i=2 ; i < MAX ; i++ ){
		if( p[i] ) P.push_back( i );
	}
}

int main(){
	int n;
	f();
	while( cin >> n , n ){
		int ans=0;
		for(int a=2 ; a < n ; a++ ){
			if( p[a] ){
				int b = n - a;
				if( a > b ) break;
				if( p[b] ) ans++;
			}
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 0
import Control.Applicative ((<$>), (<*>))
import Control.Monad
import Data.List

main :: IO ()
main = do
  solve <$> getl (map read . words) <*> getl (map read . words) >>= print

solve :: [Int] -> [Int] -> Int
solve [k, t] cs = f 0 0 scs
  where
    scs = sort cs
    f n r [] = r
    f n r (x:xs) = if n+1 >= x then f (n+x) 0 xs else f (n+x) (x-n-1) xs

getl :: (String -> a) -> IO a
getl f = f <$> getLine


Measured memory_bytes: 1020
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1e9;
const ll MOD = 1e9 + 7;



int main(){
    int n, m;
    cin >> n >> m;
    int ac = 0, pe = 0;
    vector<int> v(n+1), u(n+1);
    rep(i, m){
        int p;
        string s;
        cin >> p >> s;
        if(s == "AC" && !v[p]){
            v[p] = 1;
            pe += u[p];
            ac++;
        }
        else if(s == "WA") u[p]++;
    }
    cout << ac << " " << pe << endl;
}

Measured memory_bytes: 1024
import java.util.*;
public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String N = sc.nextLine();
        int min;
        int anc = 0;
        for(int i = 0;i < N.length();i++){
            min = (int)N.charAt(i);
          	min -=48;
            anc += min;
        }
        if(anc%9 == 0){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 41520
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <unordered_map>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <assert.h>
#include <unordered_map>
#include <fstream>
#include <time.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef pair<int,int> pii;
typedef vector<P> vpl;
typedef tuple<ll,ll,ll> tapu;
#define rep(i,n) for(int i=0; i<(n); i++)
#define REP(i,a,b) for(int i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 2020000;
ll dy[8] = {1,-1,0,0,1,-1,1,-1};
ll dx[8] = {0,0,1,-1,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T> inline void print(T &a){
    rep(i,a.size()) cout << a[i] << " ";
    cout << "\n";
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << "\n";}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << "\n";
}
const int mod = 1e9 + 7;
//const int mod = 998244353;

int main(){
	ll n,m; cin >> n >> m;
    string s; cin >> s;
    vvl G(n);
    rep(i,m){
        ll u,v; cin >> u >> v; u--; v--;
        G[u].push_back(v);
        G[v].push_back(u);
    }
    queue<ll> q;
    vvl num(n,vl(2,0));
    set<ll> se;
    rep(i,n){
        for(auto v : G[i]){
            num[i][s[v]-'A']++;
        }
        if(!num[i][0] || !num[i][1]){
            q.push(i);
            se.insert(i);
        }
    }
    while(!q.empty()){
        ll u = q.front(); q.pop();
        int t = s[u] - 'A';
        for(auto v : G[u]){
            num[v][t]--;
            if(num[v][t] <= 0){
                if(se.find(v) == se.end()){
                    q.push(v);
                    se.insert(v);
                }
            }
        }
    }
    rep(i,n){
        if(se.find(i) != se.end()) continue;
        for(auto v : G[i]){
            if(se.find(v) == se.end()){
                puts("Yes");
                return 0;
            }
        }
    }
    puts("No");
}

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

int main(){
    int N;
    cin >> N;
    int A[N-1];
    int B[N];
    for(int i=0; i<N-1; i++){
        cin >> A[i];
    }
    for(int i=0; i<N; i++){
        B[i]= 0;
    }
    for(int i=0; i<N-1; i++){
        B[A[i]-1]++;
    }
    for(int i=0; i<N; i++){
        cout << B[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 5196
#include <iostream>
#include <math.h>
#include <queue>
#include <algorithm>
#include <map>
#include <set>
#include <cstdlib>
#include <unordered_map>
#include <numeric>
#include <functional>
#include <limits.h>
#include <utility>
#include <stack>

using namespace std;

#define fs first
#define sc second

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

const ll mod = 1000000007;
ll fact[200200];
ll invfact[200200];

inline ll take_mod(ll a){
    return (a % mod + mod) % mod;
}

inline ll add(ll a, ll b){
    return take_mod(a+b);
}

inline ll sub(ll a, ll b){
    return take_mod(a-b);
}


inline ll mul(ll a, ll b){
    return take_mod(a * b);
}

inline ll powMod(ll x, ll n){
    ll res = 1LL;
    while(n > 0){
        if(n & 1) res = mul(res, x);
        x = mul(x, x);
        n >>= 1;
    }
    return res;
}

ll mod_inv(ll x){
    return powMod(x, mod-2);
}

// nは上限
void make_fact(ll n){
    fact[0] = 1;
    ll res = 1;
    for(int i = 1; i <= n; i++){
        fact[i] = res;
        res = mul(res, i+1);
    }
}

// nは上限
void make_invfact(ll n){
    invfact[0] = 1;
    invfact[n] = mod_inv(fact[n]);
    for(int i = n-1; i >= 1; i--){
        invfact[i] = mul(invfact[i + 1], i + 1);
    }
}

ll perm(ll n, ll k){
    return mul(fact[n], invfact[n-k]);
}

ll comb(ll n, ll k){
    return mul(mul(fact[n], invfact[n-k]), invfact[k]);
}

vector<int> edge[101000];
int root2 = -1;

int dfs2(int s, int prev){
    if(edge[s].size() == 1){
        return s;
    }
    else{
        for(auto v: edge[s]){
            if(v != prev){
                return dfs2(v, s);
            }
        }
    }
    return -1;
}

int dfs(int s, int prev){
    int need = edge[s].size() - 1;
    int res = 0;
    if(s != prev){
        need--;
    }

    for(auto v: edge[s]){
        if(v == prev){
            continue;
        }
        int tmp = dfs(v, s);
        if(tmp > 0){
            need--;
        }
        res += tmp;
    }
    if(need > 0){
        res += need;
        if(root2 == -1){
            root2 = dfs2(s, prev);
        }
    }
    return res;
}

int main(){
    int N;
    cin >> N;
    for(int i = 0; i < N-1; i++){
        int a, b;
        cin >> a >> b;
        edge[a].push_back(b);
        edge[b].push_back(a);
    }

    int root = -1;
    for(int i = 0; i < N; i++){
        if(edge[i].size() == 1){
            root = i;
            break;
        }
    }
    dfs(root, root);
    if(root2 == -1){
        cout << 1 << endl;
    }
    else {
        cout << dfs(root2, root2) + 1 << endl;
    }


    return 0;
}

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

public class Main {
	void run() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		for(int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		Arrays.sort(a);
		int b = (n-1) % 2;
		int ans = 0;
		for(int i = n-1; i >= 0; i--) {
			if(i % 2 == b) {
				ans += a[i];
			}else {
				ans -= a[i];
			}
		}
		System.out.println(ans);
		
		sc.close();
	}

	void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

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

Measured memory_bytes: 22228
#include <bits/stdc++.h>
using namespace std;
int k[200001]={0,0};
int main()
{
    int n,num;
    cin>>n;
	for(int i=2;i<=n;i++)
	{
		cin>>num;
		k[num]++;
	}
	for(int i=1;i<=n;i++)
	{
		cout<<k[i]<<endl;
	}
	return 0;
}

Measured memory_bytes: 4332
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
 
#define mod 1000000007
#define FOR(x,to) for(int x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define long long long
inline int rei(){int x;cin>>x;return x;}
inline long rel(){long x;cin>>x;return x;}
inline string res(){string x;cin>>x;return x;}
//------------------------------------------------------- 
long DP[3000*3000];
void Calc(){
	int N = rei();
	string S = res();
	DP[0] = 1;
	for(int i=0;i<N-1;i++){
		if(S[i] == '<'){
			long sum = 0;
			for(int j=0;j<=i;j++){
				DP[i*3000+j] %= mod;
				sum += DP[i*3000+j];
				sum %= mod;
				DP[(i+1)*3000+j+1] = sum;
			}
		}
		else{
			long sum = 0;
			for(int j=i;j>=0;j--){
				DP[i*3000+j] %= mod;
				sum += DP[i*3000+j];
				sum %= mod;
				DP[(i+1)*3000+j] = sum;
			}
		}
	}
	long ans = 0;
	for(int i=0;i<N;i++){
		ans += DP[(N-1)*3000+i];
	}
	ans %= mod;
	cout << ans << endl;
}
int main(int argc,char** argv){
	ios::sync_with_stdio(false), cin.tie(0);
	cout.tie(0); Calc(); return 0;
}

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

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;
typedef pair<int, int> P;
const long long INF = 1LL << 60;

int main()
{
    int N, M;
    cin >> N >> M;

    vector<P> pref(M), order(M);
    rep(i, M) {
        cin >> pref[i].first >> pref[i].second;
        order[i].first = pref[i].first;
        order[i].second = pref[i].second;
    }

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

    int cnt = 1;
    int kind = pref[0].first;
    map<P, int> match;
    match[pref[0]] = cnt;
    cnt++;
    repd(i, 1, M) {
        if (kind != pref[i].first) {
            kind = pref[i].first;
            cnt = 1;
        }
        match[pref[i]] = cnt;
        cnt++;
    }

    rep(i, M) {
        printf("%06d%06d\n", order[i].first, match[order[i]]);
    }
    
    return 0;
}

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

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define st first
#define nd second
#define endl '\n'
#define what_is(x) cerr << #x << " is " << x << endl;
#define what_is_v(x) cerr << #x << " is "; for(auto&e: (x)) cerr << e << ' '; cerr << '\n'; //vector, set
#define what_is_a(x, n) cerr << #x << " is "; for(int i=0;i<n;i++) cerr << x[i] << ' '; cerr <<  '\n'; //n first element of array
#define cerr_pair(x) '{' << x.st << ", " << x.nd << '}'
#define pwhat_is(x) cerr << #x << " is " << cerr_pair(x) << endl;
#define pwhat_is_v(x) cerr << #x << " is "; for(auto&e: (x)) cerr << cerr_pair(e) << ' '; cerr << '\n'; //vector, set
#define pwhat_is_a(x, n) cerr << #x << " is "; for(int i=0;i<n;i++) cerr << cerr_pair(x[i]) << ' '; cerr <<  '\n'; //n first element of array
#define int long long
// #define pow mypow

typedef pair<int,int> pii;
const int N = 1e5+5;
const int L = 100+5;
const int K = 3;
const int INF = 1e9+5;
const int MOD = 1e9+7;

string n;
int k;
int f[L][4];
int32_t main()
{
	IOS
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	cin >> n >> k;
	int stored_k = k;
	f[0][0] = 1; //else = 0
	int len = n.length();
	for(int i=1; i<=len; i++){
		for(int j=0; j<=K; j++){
			if (j == 0) f[i][0] = 1;
			else f[i][j] = 9*f[i-1][j-1] + f[i-1][j];
		}
	}
	int ans = 0;
	for(int i=0; i<len; i++){
		int d = n[i] - '0';
		for(int l=0; l<d; l++){  // left_most
			if (l==0) ans += f[len-i-1][k];
			else if(k) ans += f[len-i-1][k-1];
		}
		k -= (d > 0);
		if (k < 0) break;
	}
	int cnt_non_zeroes = 0;
	for(int i=0; i<len; i++) cnt_non_zeroes += (n[i] != '0');
	ans += (cnt_non_zeroes == stored_k);
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 256
function Main(input) {
  input = input.split("\n");

  X = parseInt(input[0]);

  let current = 100;
  let year = 0;

  while (current < X) {
    year++;

    current = parseInt(current * 1.01);
  }

  console.log(year);
}

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


Measured memory_bytes: 29892