akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<functional>
#include<string>
#include<iomanip>
#include<map>
#include<utility>
#include<string>
#include<unordered_map>
#include<queue>

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

using namespace std;

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

int gcd(int a, int b){return b ? gcd(b, a%b) : a;}

int main(){
    int n, x;
    cin >> n >> x;
    vector<int> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    sort(a.begin(), a.end());
    int ans = 0;
    for(int i = 0; i < n; i++){
        if(x < a[i]){
            cout << ans << endl;
            return 0;
        }
        x -= a[i];
        ans++;
    }
    if(x != 0) cout << ans-1 << endl;
    else cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
////////////////////////////////////////////////
int main()
{
    int a, b;
    cin >> a >> b;
    if (a - 2 * b > 0)
        cout << a - 2 * b << endl;
    else
        cout << 0 << endl;
}

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

#define step(i, s, n, d) for(int i=s; i<n; i+=d)
#define FOR(i,s,n) step(i,s,n,1)
#define rep(i,n) FOR(i,0,n)
#define gets(x) x; cin >> x;
#define puts(x) x; cout << x << endl;
#define list_input(x, n) x[n]; rep(i,n){ gets(x[i]);}
#define ll long long

int main(){
  int n, result=0;
  cin >> n;
  int score[n];
  list_input(score, n)
  sort(score, score+n);
  rep(i, n){
    result += score[i];
  }
  if (result%10 == 0) {
    rep(i, n){
      if (score[i]%10 != 0) {
        result -= score[i];
        break;
      }
    }
  }
  if (result%10 == 0) {
    puts(0)
  }else{
    puts(result)
  }
}

Measured memory_bytes: 256
/*
* @Author: _dp95
* @Date:   2020-04-04 09:52:35
*/
#include "bits/stdc++.h"
using namespace std ;

#define timesaver ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long ll ;
typedef long double ldb ;

#define mp make_pair
#define pb push_back
#define F first
#define S second
#define nl '\n'

#define all( x ) x.begin(),x.end() 
#define sz( x ) ( int )( x ).size( )
#define mem( a, val ) memset(a, val, sizeof( a ) )
#define deci( x ) cout<<fixed<<setprecision( x );
#define bitcount( x ) __builtin_popcountll( x )

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

const int MAX = 2*1000*1000 + 10 ;
const ll INF = 1e18 ;
const int MOD = 1e9 + 7 ;

vector< ll > v[MAX] ;
ll n, x, y, dp[MAX][2] ;

void dfs( ll x, ll p ){
    for( ll i : v[x] ){
        if( i != p )
            dfs( i, x ) ;
    }
    dp[x][0] = dp[x][1] = 1 ;
    for( ll i : v[x] ){
        if( i == p )
            continue ;
        dp[x][0] = ( dp[x][0]%MOD * (dp[i][0]+dp[i][1])%MOD )%MOD ;
        dp[x][1] = ( dp[x][1]%MOD * dp[i][0]%MOD )%MOD ;
    }
}

signed main( ){
  timesaver ;
  cin >> n ;
  for( ll i = 1 ; i < n ; i++ ){
    cin >> x >> y ;
    v[x].pb(y);
    v[y].pb(x);
  }
  dfs( 1, 1 ) ;
  cout << (dp[1][0]+dp[1][1])%MOD << nl ;
}

Measured memory_bytes: 57984
#include <iostream>
#include<vector>
#include <math.h>
#include<stdio.h>
#include <climits>
#include<algorithm>
#include<string>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define LL  long long 
#define Pi 3.14159265358979;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int i = 0, j = 0,k = 0;//ループ用配列
	int eigo_zentai[26] = {}, eigo_zen[26] = {}, eigo_go[26] = {};
	string  s;
	int n;
	int count = 0;
	int ans = 0;



	cin >> n >> s;
	rep(i, n) {
		eigo_zentai[s[i] - 97]++;
	}

	rep(i, n) {
		count = 0;
		rep(k, 26) {
			eigo_zen[k] = 0;
			eigo_go[k] = 0;
		}
		rep(j, n) {
			if (i <= j)eigo_zen[s[j] - 97]++;
			else eigo_go[s[j] - 97]++;
		}
		rep(k, 26) {
			if ((eigo_zen[k]>=1 and eigo_go[k]) >= 1)count++;
		}
		if (ans < count)ans = count;
	}



	/*rep(i, 26) {
		cout << eigo[i] << "\n";
		if(eigo[i] >= 2)count++;
	}
	*/
	cout << ans << "\n";
}


Measured memory_bytes: 256
import bisect

N = int(input())
L = list(map(int,input().split()))

L.sort()
ans = 0

for i in range(N-2):
    for j in range(i+1,N-1):
        bottom = L[i]+L[j]
        ind = bisect.bisect_left(L,bottom)
        ans += ind - j - 1

print(ans)

Measured memory_bytes: 3188
// #include <bits/stdc++.h>
#include <iostream>
#include <map>
#include <cmath>
#include <ios>
#include <iomanip>
#include <algorithm>
#include <queue>
#include <stack>
#include <numeric>
// #include <windows.h>
using namespace std;
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;
template<class T> using VVV = V<VV<T>>;
template<class T1, class T2> using P = pair<T1, T2>;
using I = int;
using D = double;
using B = bool;
using C = char;
using S = string;
using LL = long long;
using LD = long double;
using ULL = unsigned long long;
using PII = P<I, I>;
using VPII = V<PII>;
using PLL = P<LL, LL>;
using VPLL = V<PLL>;
using VI = V<I>;
using VVI = VV<I>;
using VLL = V<LL>;
using VVLL = VV<LL>;
using VC = V<C>;
using VVC = VV<C>;
using VS = V<S>;
using VVS = VV<S>;
using VB = V<B>;
using VVB = VV<B>;
#define REP(type, i, n) for (type i = 0; i < (type)(n); ++i)
#define REP2(type, i, m, n) for (type i = (m); i < (type)(n); ++i)
#define REPR(type, i, n) for (type i = (n)-1; i >= 0; --i)
#define REPR2(type, i, m, n) for (type i = (n)-1; i >= (m); --i)
#define REPx(x, a) for(auto x : a)
#define ALL(a) a.begin(), a.end()
#define SORT(a) sort(ALL(a))
#define SORTR(a, type) sort(ALL(a), greater<type>())
#define SORTF(a, comp) sort(ALL(a), comp)
#define REVERSE(a) reverse(ALL(a))
#define SIZE(a, type) ((type)(a).size())
#define bit_search(bit, n) REP(LL, bit, 1LL<<(n))
#define bit_check(bit, i) ((bit>>(i)) & 1)
#define setpre(n) fixed << setprecision((n))
#define UNIQUE(a) do {SORT(a); (a).erase(unique(ALL(a)), (a).end());} while(0)
#define MAX(a) *max_element(ALL(a))
#define MIN(a) *min_element(ALL(a))
#define bisect_left(a, x) (lower_bound(ALL(a), (x)) - a.begin())
#define bisect_right(a, x) (upper_bound(ALL(a), (x)) - a.begin())
#define INPUT(a) REPx(&x, a) cin >> x;
#define INPUT2(a) REPx(&x, a) INPUT(x);
#define INPUTP(a) REPx(&x, a) cin >> x.first >> x.second;
#define ENDL cout << endl;

const int INF = 2e9;
// const LL INF = 9e18;
const LL MOD = 1e9+7;

template<class T> using PRIORITY_QUEUE = priority_queue< T, V<T>, greater<T> >;
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;}
template<class T> inline void debug1(V<T> A){REP(int, i, SIZE(A, int)){if (A[i] == INF) cout << "I ";else cout << A[i] << " ";}ENDL}
template<class T> inline void debug2(VV<T> A){REP(int, i, SIZE(A, int)){REP(int, j, SIZE(A[i], int)){if (A[i][j] == INF) cout << "I "; else cout << A[i][j] << " ";}ENDL}}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, a, b;
  string s;
  cin >> n >> a >> b >> s;
  int yes = 0, rank = 0;
  REP(int, i, n)
  {
    if (s[i] == 'c') cout << "No" << endl;
    else if (s[i] == 'a')
    {
      if (yes < a+b)
      {
        cout << "Yes" << endl;
        ++yes;
      }
      else cout << "No" << endl;
    }
    else
    {
      ++rank;
      if (yes < a+b && rank <= b)
      {
        cout << "Yes" << endl;
        ++yes;
      }
      else cout << "No" << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 3772
#![allow(non_snake_case)]
#![allow(unused_macros)]
#![allow(unused_imports)]

use proconio::marker::Usize1;
use proconio::{fastout, input};
use std::vec::*;

macro_rules! echo {
  {$x:expr} => {println!("{}", $x)}
}

macro_rules! chmax {
  {$x:expr, $y:expr} => {
    $x = std::cmp::max($x, $y)
  }
}

macro_rules! chmin {
  {$x:expr, $y:expr} => {
    $x = std::cmp::min($x, $y)
  }
}

#[allow(unused_variables)]
#[fastout]
fn main() {
  let n: usize;
  let a: Vec<usize>;
  input! {
    n: usize,
    a: [usize; n]
  }
  let mut nanachi = a.clone();
  nanachi.sort();
  nanachi.dedup();
  let mut aa = vec![false; nanachi.len()];
  for i in a.into_iter().map(|x| nanachi.binary_search(&x).unwrap()) {
    aa[i] = !aa[i];
  }
  echo!(aa.into_iter().filter(|&x| x).count());
}


Measured memory_bytes: 5020
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,u,v;
int main()
{
	cin>>n;
	ll sum=0;
	for(ll i=1;i<=n;i++) sum=sum+(ll)(n-i+1)*i;
	for(int i=1;i<n;i++)
	{
		cin>>u>>v;
		if(u>v) swap(u,v);
		sum-=(ll)u*(n-v+1);
	}
	cout<<sum<<endl;
}

Measured memory_bytes: 3576
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define sp(n) cout << fixed << setprecision(n)
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; }
typedef long long ll;
using namespace std;
const ll mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};
// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&t=1619
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};
int main(void){
    ll n,k;cin>>n>>k;
    combination c(2000);
    rep(i,k+1){
        if(i==0)continue;
        mint res=c(k-1,i-1);
        ll rest=n-k-(i-1);
        res*=c(rest+i,i);
        cout<<res.x<<endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
 
const int N = 1e5;
const int INF = 1e9;
const int MOD = 1e9 + 7;
 

 
int main() {
    int n;
    cin >> n;
    int a[n], b[n], c[n - 1];
    for (int& x : a)
        cin >> x;
    for (int& x : b)
        cin >> x;
    for (int& x : c)
        cin >> x;
    int ans = 0, pre = -1;
    for (int i = 0; i < n; i++) {
        ans += b[a[i] - 1];
        if (a[i] == pre + 1)
            ans += c[pre - 1];
        pre = a[i];
    }
    cout << ans;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  while (1){
    vector<string> S;
    while (1){
      string T;
      cin >> T;
      if (T == "."){
        break;
      }
      S.push_back(T);
    }
    int N = S.size();
    if (N == 0){
      break;
    }
    map<char, int> size;
    map<char, map<int, int>> array;
    int ans = 0;
    for (int i = 0; i < N; i++){
      int sz = S[i].size();
      int equal_pos = -1;
      for (int j = 0; j < sz; j++){
        if (S[i][j] == '='){
          equal_pos = j;
        }
      }
      if (equal_pos == -1){
        char array_name = S[i][0];
        int array_size = stoi(S[i].substr(2, S[i].size() - 3));
        size[array_name] = array_size;
      } else {
        stack<char> st1;
        int index1 = 0;
        for (int j = 0; j < equal_pos; j++){
          if (isalpha(S[i][j])){
            st1.push(S[i][j]);
          }
          if (isdigit(S[i][j])){
            index1 = index1 * 10 + S[i][j] - '0';
          }
        }
        stack<char> st2;
        int index2 = 0;
        for (int j = equal_pos; j < sz; j++){
          if (isalpha(S[i][j])){
            st2.push(S[i][j]);
          }
          if (isdigit(S[i][j])){
            index2 = index2 * 10 + S[i][j] - '0';
          }
        }
        while (st1.size() > 1){
          char array_name = st1.top();
          st1.pop();
          if (!array[array_name].count(index1)){
            ans = i + 1;
            break;
          } else {
            index1 = array[array_name][index1];
          }
        }
        while (!st2.empty()){
          char array_name = st2.top();
          st2.pop();
          if (!array[array_name].count(index2)){
            ans = i + 1;
            break;
          } else {
            index2 = array[array_name][index2];
          }
        }
        if (ans > 0){
          break;
        }
        char array_name = st1.top();
        if (index1 >= size[array_name]){
          ans = i + 1;
          break;
        } else {
          array[array_name][index1] = index2;
        }
      }
    }
    cout << ans << endl;
  }
}


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

const int INF = 1e9;
int d,n;
int a[110],e[110],r[110];
int memo[110][110];

inline int rec(int hp, int exp){
  if(hp==0)return 0;
  if(memo[hp][exp]>=0)return memo[hp][exp];

  int res = INF;
  for(int i=0;i<n;i++){
    if(exp>=r[i]){
      int nhp = max(0,hp-a[i]), nexp = min(100,exp+e[i]);
      if(hp == nhp && exp == nexp)continue;
      res = min(res, rec(nhp, nexp) + 1 );
    }
  }
  return memo[hp][exp] = res;
}

int main(){
  while(scanf("%d%d",&d,&n), d){
    for(int i=0;i<n;i++)scanf("%d%d%d",a+i,e+i,r+i);

    memset(memo,-1,sizeof(memo));
    int ans = rec(d,0);
    if(ans==INF)puts("NA");
    else printf("%d\n",ans);
  }
}

Measured memory_bytes: 1260
#include <stdio.h>

int main(void){
	int x;
	int y;
	int r;
	int tmp;
	scanf("%d %d",&x,&y);

	if(y>=x){
		tmp = x;
		x = y;
		y = tmp;
	}

	while(1){
	r = x%y;
	if(r==0){
 		printf("%d\n", y);
 		break;
	}
	x = y;
	y=r;
	}


	return 0;
}


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

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

	if (a[a.length() - 1] == b[0] && b[b.length() - 1] == c[0]) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
}


Measured memory_bytes: 764
a, b = map(int, input().split())
point = [13,1,2,3,4,5,6,7,8,9,10,11,12]
alice = point[a-1]
bob = point[b-1]
if alice > bob:
    print('Alice')
elif alice < bob:
    print('Bob')
else:
    print('Draw')


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define int long long
using namespace std;
const int N_MAX=100000;
int N,M;
int memo[N_MAX];
vector<vector<int>> graph;
int dfs(int i){
	if(graph[i].size()==0) return 0;
	if(memo[i]>0) return memo[i];
	int ret=0;
	REP(j,graph[i].size()){
		ret=max(ret,dfs(graph[i][j])+1);
	}
	return memo[i]=ret;
}
signed main(){
	cin>>N>>M;
	graph.resize(N);
	REP(i,M){
		int a,b; cin>>a>>b;
		a--;b--;
		graph[a].push_back(b);
	}
	int ans=0;
	REP(i,N) ans=max(ans,dfs(i));
	cout<<ans<<endl;
}

Measured memory_bytes: 8576
#include<stdio.h>

int main(void){
	
	int N,A[100],i,s,flag=1,count=0;
	
	scanf("%d",&N);
	for(i=0;i<N;i++){scanf("%d",&A[i]);}
	
	while(flag==1){
		flag = 0;
		for(i=N-1;i>0;i--){
			
			if(A[i]<A[i-1]){
				
				s = A[i];
				A[i] = A[i-1];
				A[i-1] = s;
				flag=1;
				count ++;
				
			}
			
		}
		
	}
	
	for(i=0;i<N;i++){printf("%d",A[i]);if(i != N-1)printf(" ");}
	printf("\n%d\n",count);
	
	return 0;}

Measured memory_bytes: 604
#include<bits/stdc++.h>
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma comment(linker, "/stack:200000000")
using namespace std;
#define F first
#define S second
#define EB emplace_back
#define MP make_pair
#define all(o) (o).begin(), (o).end()
#define mset(m,v) memset(m,v,sizeof(m))
#define fr(i,n) for(lli i=0;i<(n);++i)
#define rep(i,a,b) for(lli i=a;i<=b;++i)
#define per(i,a,b) for(lli i=a;i>=b;i--)
#define remin(a,b) (a=min((a),(b)))
#define remax(a,b) (a=max((a),(b))) 
#define sz(x) (lli)(x).size()
#define endl '\n'
typedef long long lli;        typedef long double ld;
typedef pair<lli,lli> ii;     typedef vector<lli> vi;
typedef vector<ii> vii;       typedef vector<vi> graph;
long long MOD=1000000007;     long double EPS=1e-9;
#ifndef ONLINE_JUDGE
#define debarr(a,n)cerr<<#a<<":";for(int i=0;i<n;i++)cerr<<a[i]<<" ";cerr<<endl;
#define debmat(mat,row,col)cerr<<#mat<<":\n";for(int i=0;i<row;i++){for(int j=0;j<col;j++)cerr<<mat[i][j]<<" ";cerr<<endl;}
#define pr(...)dbs(#__VA_ARGS__,__VA_ARGS__)
template<class S,class T>ostream &operator<<(ostream &os,const pair<S,T> &p){return os<<"("<<p.first<<","<<p.second<<")";}
template<class T>ostream &operator<<(ostream &os,const vector<T> &p){os<<"[";for(auto&it:p)os<<it<<" ";return os<<"]";}
template<class T>ostream &operator<<(ostream &os,const set<T>&p){os<<"[";for(auto&it:p)os<<it<<" ";return os<<"]";}
template<class T>ostream &operator<<(ostream &os,const multiset<T>&p){os<<"[";for(auto&it:p)os<<it<<" ";return os<<"]";}
template<class S,class T>ostream &operator<<(ostream &os,const map<S,T>&p){os<<"[";for(auto&it:p)os<<it<<" ";return os<<"]";}
template<class T>void dbs(string str,T t){cerr<<str<<":"<<t<<"\n";}
template<class T,class...S>void dbs(string str,T t,S... s){int idx=str.find(',');cerr<<str.substr(0,idx)<<":"<<t<<",";dbs(str.substr(idx+1),s...);}
#else
#define pr(...){}
#define debarr(a,n){}
#define debmat(mat,row,col){}
#endif
lli binpow(lli b,lli p,lli mod){lli ans=1;b%=mod;for(;p;p>>=1){if(p&1)ans=ans*b%mod;b=b*b%mod;}return ans;}

void pre(){

}

void solve(){
    lli a,b;cin>>a>>b;
    cout<<a/(__gcd(a,b))*b<<endl;
}

signed main(){
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    //cout<<fixed<<setprecision(15);
    //clock_t begin = clock();
    pre();lli _t=1;//cin>>_t;
    for(lli i=1;i<=_t;i++){
        //cout<<"Case #"<<i<<": ";
        solve();
    }
    // clock_t end = clock();double elapsed_secs = double(end - begin) / CLOCKS_PER_SEC;cerr << elapsed_secs;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	static Scanner sc = new Scanner(System.in);
	static int n;
	static int count = 0;
	static Pair pair;
	static int num[][]=new int[100][10];

	public static void main(String[] args) {
		read();
		pair = new Pair(0, 0);
		for (int i = 0; i < n; i++) {
			dfs(i,0);
		}

	}
	public static void read(){
		n = sc.nextInt();
		for(int i = 0;i<n;i++){
			for(int j=0;j<10;j++){
				num[i][j]=sc.nextInt();
			}
		}
	}
	public static void dfs(int i,int j) {
		if (count >= 10) {
			System.out.println("YES");
			init();
			return;
		}
		count++;

		int nextNum = num[i][j];
		//?????£?????????????????????
		if (nextNum < pair.left && nextNum < pair.right) {
			System.out.println("NO");
			init();
			return;
		}
		
		//?????£????????\???
		if (nextNum > pair.left && nextNum > pair.right) {
			// ?????????????°???????
			if (nextNum - pair.left <= nextNum - pair.right) {
				pair.left = nextNum;
				dfs(i,++j);
				return;
			} else {
				// ????????????????????°????????£??????
				pair.right = nextNum;
				dfs(i,++j);
				return;
			}
		}
		// ?????£??????????????\?????????
		if (nextNum < pair.left || nextNum < pair.right) {
			if (nextNum > pair.left) {
				pair.left = nextNum;
				dfs(i,++j);
				return;
			} else {
				pair.right = nextNum;
				dfs(i,++j);
				return;
			}
		}

	}

	public static void init() {
		count = 0;
		pair.left = 0;
		pair.right = 0;
	}

}

class Pair {
	int left;
	int right;

	Pair(int a, int b) {
		left = a;
		right = b;
	}

}

Measured memory_bytes: 18632
x=input()
y=int(x[:4])
z=int(x[5:7])
zz=int(x[8:10])
zzz=z*100+zz

if y<2019:
  print("Heisei")
elif y>2019:
  print("TBD")
else:
  if zzz<=430:
    print("Heisei")
  else:
    print("TBD")

Measured memory_bytes: 3060
def ri():
    return map(int, raw_input().split())

n,m = ri()
students = [ri() for _ in range(n)]
checkpoints = [ri() for _ in range(m)]
for a,b in students:
    idx = -1
    dist = 10**9
    for i,(c,d) in enumerate(checkpoints):
        tmp = abs(c-a) + abs(d-b)
        if tmp < dist:
            dist = tmp
            idx = i
    print idx + 1


Measured memory_bytes: 2568
#include <bits/stdc++.h>
#define fastIO (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define precise(i) fixed << setprecision(i)
using namespace std;

int main() {
    fastIO;
    int H, W;
    cin >> H >> W;

    int h, w;
    cin >> h >> w;
    if (h == H || w == W)
        cout << 0;
    else
        cout << (H - h) * (W - w);
}

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

// typedef
// -----------------------------------------------------------------------------
typedef long long ll;
typedef long double ld;

// container util
// -----------------------------------------------------------------------------
#define ALL(c)  (c).begin(),(c).end()
#define SZ(c) ((ll)(c).size())
#define MAX(c) *max_element(ALL(c))
#define MIN(c) *min_element(ALL(c))
#define SORT(c) sort((c).begin(),(c).end())

// repetition
// -----------------------------------------------------------------------------
#define FOR(i, a, b) for(ll i= (a); i < (ll)(b); ++i)
#define REP(i, n) FOR(i, 0, n)

// constant
// -----------------------------------------------------------------------------
const int INF = 1e9;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
const double PI = acos(-1.0);

// debug
// -----------------------------------------------------------------------------
#define DUMP(x)  cerr << #x << " = " << (x) << endl


int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);
    ll a; cin >> a;
    ll ans = a + 1 * pow(a, 2) + 1 * pow(a, 3);
    cout << ans << "\n";
}

Measured memory_bytes: 4012
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define de(c) cout << #c << " = " << c << endl
#define dd(c) cout << #c << " = " << c << " "
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
mt19937 mrand(random_device{}());
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

int T;
string str;

int main(int argc, char const *argv[])
{
#ifdef indiewar
    freopen("in.txt","r",stdin);
//    freopen("out.txt","w",stdout);
#endif
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
//    cin >> T;
    T =1;
    while(T--)
    {
        cin >> str;
        ll ans = 0;
        int le = str.size();
        per(i,0,le)
        {
            int tmp = (str[i]-'0');
            if(tmp > 11-tmp)
            {
                if(i != 0)
                {
                    per(j,0,i)
                    {
                        str[j]++;
                        if(str[j] - '0' == 10)
                        {
                            str[j] = '0';
                            if(j == 0)
                            {
                                ans++;
                            }
                        }
                        else
                        {
                            break;
                        }
                    }
                    ans += 10 - tmp;
                }
                else
                {
                    ans += 11 - tmp;
                }
            }
            else if(tmp == 5)
            {
                if(i != 0)
                {
                    if(str[i-1] - '0' < 5)
                    {
                        ans += 5;
                    } else
                     {
                        ans += 5;
                        per(j,0,i)
                        {
                            str[j]++;
                            if(str[j] - '0' == 10)
                            {
                                str[j] = '0';
                                if(j == 0)
                                {
                                    ans++;
                                }
                            }
                            else
                            {
                                break;
                            }
                        }
                    }

                }
                else
                {
                    ans += 5;
                }
            }
            else
            {
                ans += tmp;
            }
//            ans += min(str[i]-'0',11-str[i]+'0');
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 1948
/*
sonu_verma1
*/
#include <bits/stdc++.h>
// For policy based data structure
/*#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp> */
using namespace std;
/*using namespace __gnu_pbds; 
typedef tree<int, null_type, less<int>, rb_tree_tag, 
             tree_order_statistics_node_update> 
    new_data_set;*/
 
#define MD 1000000007
#define X first
#define Y second
#define pb push_back
#define debug(val, ch) cout <<val <<ch
#define FOR(i, st, en, ch) for(register int i = (st); i <= (en) ; i += (ch))
#define RFOR(i, st, en, ch) for(register int i = (st); i >= (en) ; i -= (ch))
#define REP(i, j) FOR(i, 0, j, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
 
typedef long long int ll;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<int, bool> pib;
typedef pair<bool, int> pbi;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)
int fun(vector<int>&vis,vector<int>adj[],int i)
{
    if(vis[i]!=-1)
        return vis[i];
    int ans=0;
    for(int it:adj[i])
    {
        ans=max(ans,fun(vis,adj,it)+1);
    }
    vis[i]=ans;
    return ans;
}
/*********************************************************************/
void test(int r)
{
    int n,m;
    cin>>n>>m;
    vector<int>adj[n+1];
    int i,j;
    for(i=0;i<m;i++)
    {
        int u,v;
        cin>>u>>v;
        adj[u].pb(v);
    }
    vector<int>vis(n+1,-1);
    int ans=0;
    for(i=1;i<=n;i++)
    {
            ans=max(ans,fun(vis,adj,i));
    }
    cout<<ans<<endl;    
    

}
/***********************************************************************/
int main()
{
    fast();
    int t=1,r;
    // cin>>t;
    for(r=1;r<=t;r++)
        test(r);
    return 0;
}

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

#define FOR( i, m, n )  for( int (i) = (m); (i) < (n); (i)++ )
#define REP( i, n )     FOR( i, 0, n )
#define ALL( a )        (a).begin(), (a).end()             

int main(void){
    int n; cin >> n;
    vector<int> s(n);
    REP( i, n ) cin >> s[i];
    
    int q, sum = 0; cin >> q;
    int key;
    REP( i, q ){
        cin >> key;
        int j = 0;
        while( j != n ){
            if( key == s[j] ){
                sum++;
                break;
            }
            j++;
        }
    }
    
    cout << sum << endl;
}


Measured memory_bytes: 3100
#include <stdio.h>
#include <math.h>
int main(){
  double A, B, H, M, Hd, Md, dd, C;
  scanf("%lf %lf %lf %lf", &A, &B, &H, &M);
  Hd = (H/6)*M_PI + (M/360)*M_PI;
  Md = (M/30)*M_PI;
  dd = Hd - Md;
  C = sqrt(pow(A,2) + pow(B,2) - 2*A*B*cos(dd));
  printf("%.9lf", C);
  return 0;
}

Measured memory_bytes: 2540
#pragma region
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 
#include <stack>
#include <set>
#include <list>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define rrep(i, s) for (int(i) = (s) - 1; (i) >= 0; --(i))
#define all(x) x.begin(),x.end()
#pragma endregion

#pragma region GCD
int gcd(int a, int b)
{
	if (a%b == 0)return b;
	return gcd(b, a%b);
}
#pragma endregion
#pragma region LCM
int lcm(int a, int b)
{
	return (a*b) / gcd(a, b);
}
#pragma endregion

int main()
{
	int n; cin >> n;
	vector<ll> a(n), b(n);
	rep(i, n)cin >> a[i] >> b[i];
	ll cnt = 0;
	rrep(i, n)
	{
		a[i] += cnt;
		if (a[i] == 0)continue;
		cnt += ((a[i] - 1) / b[i] + 1)*b[i] - a[i];
	}
	cout << cnt << endl;
}

Measured memory_bytes: 1792
// includes {{{
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<random>
#include<cassert>
#include<bitset>
#include<cstdlib>
// #include<deque>
// #include<multiset>
// #include<cstring>
// #include<bits/stdc++.h>
// }}}
using namespace std;
using ll = long long;

string s[] = {"SUN","MON","TUE","WED","THU","FRI","SAT"};
int main() {
  std::ios::sync_with_stdio(false), std::cin.tie(0);
  string t;
  cin >> t;
  int i = 0;
  while(1) {
    if(s[i] == t) break;
    i++;
  }
  int cnt = 1;
  while(1) {
    if(s[(i+cnt)%7] == "SUN") break;
    cnt++;
  }
  cout << cnt << endl;
  return 0;
}


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

int main()
{
    int h,a;
    cin >> h >> a;
    cout << (h%a==0 ? h/a : h/a+1) << endl;
    return 0;
}

Measured memory_bytes: 256
// import chie template :) {{{
import std.stdio, std.algorithm, std.array, std.string, std.math, std.conv,
    std.range, std.container, std.bigint, std.ascii, std.typecons;

// }}}
// nep.scanner {{{
class Scanner
{
    import std.stdio : File, stdin;
    import std.conv : to;
    import std.array : split;
    import std.string : chomp;

    private File file;
    private char[][] str;
    private size_t idx;

    this(File file = stdin)
    {
        this.file = file;
        this.idx = 0;
    }

    private char[] next()
    {
        if (idx < str.length)
        {
            return str[idx++];
        }

        char[] s;
        while (s.length == 0)
        {
            s = file.readln.chomp.to!(char[]);
        }

        str = s.split;
        idx = 0;

        return str[idx++];
    }

    T next(T)()
    {
        return next.to!(T);
    }

    T[] nextArray(T)(size_t len)
    {
        T[] ret = new T[len];

        foreach (ref c; ret)
        {
            c = next!(T);
        }

        return ret;
    }

    void scan()()
    {
    }

    void scan(T, S...)(ref T x, ref S args)
    {
        x = next!(T);
        scan(args);
    }
}
// }}}

void main()
{
    auto cin = new Scanner;
    int a, b;
    cin.scan(a, b);

    if (a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0) {
        writeln("Possible");
    } else {
        writeln("Impossible");
    }
}


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

// L=a+b+c, max(abc) -> AM・GM不等式

int main()
{
    int L;
    double ans;
    cin >> L;
    ans = (double)(L * L * L) / 27;
    cout << fixed << setprecision(12) << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<set>

using namespace std;

int main()
{
	int A, B, C, D;
	cin >> A >> B >> C >> D;

	cout << min(A, B) + min(C, D) << endl;

}


Measured memory_bytes: 3620
package main

import (
	"bufio"
	"os"
	"strconv"
	"fmt"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextInt() int {
	scanner.Scan()
	i, e := strconv.Atoi(scanner.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func binarySearch(target int, ints []int) bool {
	low := 0
	high := len(ints)-1
	for low <= high {
		mid := (low + high)/2
		guess := ints[mid]
		if guess == target {
			return true
		}
		if guess > target {
			high = mid - 1
		} else {
			low = mid + 1
		}
	}
	return false
}

func main() {
	scanner.Split(bufio.ScanWords)
	n := nextInt()
	a := make([]int, n)
	for i :=range a {
		a[i] = nextInt()
	}
	q := nextInt()
	for i :=0; i < q; i++ {
		k := nextInt()
		if binarySearch(k, a) {
			fmt.Println(1)
		} else {
			fmt.Println(0)
		}
	}
}


Measured memory_bytes: 5840
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<sstream>
#include<string>
#include<numeric>
using namespace std;
typedef long long ll;
//ll mod = 1e9+7;
ll mod = 998244353;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main(){
    ll n, m;
    cin >> n >> m;
    ll gcd_num = m / n;
    ll ans = 0;
    while(1) {
        if ( ( m - n * gcd_num ) % gcd_num == 0 ) {
            cout << gcd_num << endl;
            return 0;
        }
        --gcd_num;
    }
    return 0;
}


Measured memory_bytes: 256
N = int(input())
A = [0]*N
X = []
for i in range(N):
    A[i] = int(input())
    t = []
    for j in range(A[i]):
        t.append(tuple(map(int, input().split())))
    X.append(t)
    
ans = 0
for i in range(2**N):
    Flg = True
    cnt = 0
    for j in range(N):
        if((i>>j)&1): 
            for m in range(A[j]):
                x, y = X[j][m]
                if((i>>(x-1))&1 != y):
                    Flg = False
                    break
    if(Flg):
        ans = max(ans, bin(i).count("1"))
print(ans)

Measured memory_bytes: 3064
#include<cstdio>
#include<cstring>
using namespace std;
char ch[150];
int a,cnt=0;
int main()
{
	scanf("%s",ch);
	int len=strlen(ch);
	for(int i=0;i<len;i++){
		if(ch[i]=='C'){
			a=i;
			break;
		}
		else cnt++;
		if(cnt==len){
			printf("No");
			return 0;
		}
	}
	cnt=0;
	for(int i=a;i<=len;i++){
		if(ch[i]=='F') {
			printf("Yes");
			return 0;
		}
		else cnt++;
		if(cnt==len-a+1){
			printf("No");
			return 0;
		}
	}
}

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

using namespace std;

int mod = 998244353;

int add() { return 0; }
template<typename... M> int add(int a, M... b) {
  int x = add(b...);
  return a + x - mod * (a + x >= mod);
}

int mul() { return 1; }
template<typename... M> int mul(int a, M... b) {
  return int(1ll * a * mul(b...) % mod);
}

int pwr(int a, long long x) {
  return (x ? mul(pwr(mul(a, a), x >> 1), (x & 1 ? a : 1)) : 1);
}

int dvd(int a, int b) {
  return mul(a, pwr(b, mod - 2));
}

int sub(int a, int b) {
  return a - b + mod * (a < b);
}

void inc(int& a, int b) {
  a = add(a, b);
}

void dec(int& a, int b) {
  a = sub(a, b);
}

vector<int> fact = {1}, invf = {1};
int C(int n, int k) {
  if (n < k or 0 > k) return 0;
  while (fact.size() <= n) {
    fact.push_back(mul(fact.back(), fact.size()));
    invf.push_back(dvd(1, fact.back()));
  }
  return mul(fact[n], invf[k], invf[n - k]);
}

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

  long long n;
  int x;
  cin >> n >> x >> mod;
  long long ans = 0;
  int cnt = 0;
  vector<long long> pr = {0};
  vector<int> used(mod, -1);
  while (cnt < n and used[x] == -1) {
    used[x] = cnt++;
    pr.push_back(pr.back() + x);
    x = mul(x, x);
  }
  if (cnt == n) cout << pr.back();
  else cout << pr[used[x]] + (pr[cnt] - pr[used[x]]) * ((n - used[x]) / (cnt - used[x])) + pr[used[x] + ((n - used[x]) % (cnt - used[x]))] - pr[used[x]];

  return 0;
}


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

#define fastio                  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define input_output            freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); 

#define ll                      long long
#define read1(x)                 cin>>x
#define read2(x,y)               cin>>x>>y
#define pii                     pair<int, int>
#define pli                     pair<ll, int>
#define pil                     pair<int, ll>
#define pll                     pair<ll, ll>
#define vi                      vector<int>
#define vll                     vector<ll>
#define vb                      vector<bool>
#define vd                      vector<double>
#define vs                      vector<string>
#define ff                      first
#define ss                      second
#define pb                      push_back
#define ppb                     pop_back
#define pf                      push_front
#define ppf                     pop_front
#define vpii                    vector<pii>
#define umap                    unordered_map
#define uset                    unordered_set
#define clr(a,b)                memset(a,b,sizeof a)
#define all(ds)                 ds.begin(), ds.end()
#define rev(ds)                 ds.rbegin(), ds.rend()
#define asc(A)                  sort(A.begin(), A.end())
#define dsc(A)                  sort(A.begin(), A.end(), greater<int>())
#define gcd(x,y)                __gcd(x,y)
#define clr(a,b)                memset(a,b,sizeof a)
#define fr(i, n)                for(int i=0; i<n;++i)
#define fr1(i, n)               for(int i=1; i<=n; ++i)
#define rfr(i, n)               for(int i=n-1; i>=0; --i)
#define printVector(v)          for(int i= 0;i<v.size();i++) {cout<<v[i]<<" ";} cout<<endl;
#define precise(x)              cout<<fixed<<setprecision(x)
#define inf                     10000000000000

 

ll lcm(ll a, ll b) {return (a*b)/__gcd(a, b); }
ll power(ll x, ll y, ll m) { if(!y) return 1; ll p=power(x, y>>1, m)%m; p=p*p%m; return (y&1)?(x*p)%m:p;}
ll modInverse(ll a, ll m){ return power(a, m-2, m); }
bool isPrime(ll num){bool flag=true;for(ll i =2;i<=num/2;i++){if(num%i==0) {flag=false; break;} }return flag;}
ll sumofdigits(ll n){ll c=0;while(n>0){c++;n/=10;}return c;}
bool sortinrev(const pair<int,int>&a,const pair<int,int>&b) {return a.first > b.first; }
bool sortbysec(const pair<int,int> &a, const pair<int,int> &b) {return a.second < b.second; }

//const double PI= 2*acos(0.0);
// const long long MOD= 1000000007;



void solve(){
    string s, t;
    cin>>s>>t;

    int maxMatch = 0;
    fr(k, s.size()){
    	int match = 0;
    	if(k+t.size()-1 > s.size()-1)break;
    	for(int j = 0; j < t.size(); ++j){
    		if(t[j] == s[k+j])match++;
    	}
    	maxMatch = max(maxMatch, match);
    }
    cout<<t.size()-maxMatch<<endl;
}
int main()
{
#ifndef ONLINE_JUDGE  
    input_output  
#else   
    fastio
#endif

    int t =1 ;
    // cin>>t;
    while(t--){
        solve();
    }

    return 0;
}

Measured memory_bytes: 3632
#include <cstdio>

int main()
{
	int k;
	scanf("%d", &k);
	long long n = 7;
	int a= -1;
	int i;
	for (i = 0; i < k; i++) {
		if (n % k == 0) {
			a = i + 1;
			break;
		} else {
			n = (n * 10 + 7) % k;
		}
	}
	printf("%d\n", a);

	return 0;
}

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

int main(){
    int count=1;
    while(true){
        int x;
        cin >> x;
        if(x==0){
            break;
        }
        cout << "Case" << " " << count << ":" << " " << x << endl;
        count++;
    }
}



Measured memory_bytes: 3072
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <utility>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <assert.h>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <unordered_map>
using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(bool x) {cerr << (x ? "true" : "false");}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}

template<typename T, typename V> void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";} void _print() {cerr << "]\n";}
template <typename T, typename... V>void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifdef HOME
#warning CHECK int:ll::INT_MAX:LLONG_MAX
#define maxn 20
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define maxn 2000006
#define gcd __gcd
#define debug(x...)
#endif

#define ff first
#define endl '\n'
#define ss second
#define inf 0x3f3f3f3f
#define MOD 1000000007
#define f(i,x,n) for(int i=x;i<=n;i++)
#define fr(i,x,n) for(int i=x;i>=n;i--)
struct _ { ios_base::Init i; _() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); } } _;

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


int main() {

	long long n, m, x; cin >> n >> m >> x;
	vector<vector<long long>> mat(n, vector<long long>(m + 1, 0));

	long long min_cost = MOD;
	for (long long i = 0; i <= n - 1; i++) {
		cin >> mat[i][0];
		for (long long j = 1; j <= m; j++) cin >> mat[i][j];
	}

	for (long long mask = 0; mask < (1ll << n); mask++) {
		vector<long long> alg(m + 1, 0);
		long long cost = 0;
		for (long long j = 0; j <= n - 1; j++) {
			if (mask & (1ll << j)) {
				cost += mat[j][0];
				for (long long k = 1; k <= m; k++) alg[k] += mat[j][k];
			}
		}

		bool flg = true;
		for (long long i = 1; i <= m; i++) if (alg[i] < x) {flg = false; break;}

		if (flg) min_cost = min(min_cost, cost);
	}
	if (min_cost == MOD) cout << -1;
	else cout << min_cost;

	return 0;
}


Measured memory_bytes: 3668
//author : raghav_0901
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define int long long int
#define f(i,s,e) for(int i=s;i<e;++i)
#define fr(i,s,e) for(int i=s;i>=e;i--)
#define all(x) (x).begin(),(x).end()
#define all_r(x) (x).rbegin(),(x).rend()
#define _in(v) for(auto &x:v) cin>>x;
#define ffr(i,s,e,f) for(int i=s;i>=e && f;i--)
#define ff(i,s,e,f) for(int i=s;i<e && f;++i)
#define mem(arr,val) memset(arr, val, sizeof(arr));
#define _out(v) for(auto x:v)cout<<x<<' ';cout<<'\n';
#define ARENA ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
 
const double lim = 1000000000;
const int mod = 1e9+7;

typedef vector<double> vec;
typedef pair<double,double> pr;

//-----------------------------------------functions---------------------------------------------------------------------------------
/*double gcd(double a,double b) { return b?gcd(b,a%b):a;}
double lcm(double a,double b){return a*b/gcd(a,b);}
inline double n_sum(double n){return (n*(n+1))/2;}
double power(double a,double b){double res=1;assert(b>=0);for(;b;b>>=1){if(b&1)res=res*a;a=a*a;}return res;}
double powmod(double a,double b){double res=1;a%=mod;assert(b>=0);for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
double gcdExtended(double a,double b,double &x,double &y){if(a==0){x=0;y=1;return b;}double x1,y1,gcd=gcdExtended(b%a,a,x1,y1);x=y1-((b/a)*x1);y=x1;return gcd;}
double modInv(double a,double m){double x,y;gcdExtended(a,m,x,y);return (x%m + m)%m;}
double divM(double a,double b){return (modInv(b,mod)*(a%mod))%mod;}*/
//------------------------------------------------------------------------------------------------------------------------------------
int n,k;

void _main()
{   
    cin>>n>>k;int ans=0;
    int beg=0,back=n;
    f(i,1,n+2)
    {
        if(i>=k)
            {ans+=(back-beg+1);ans%=mod;}
        beg+=i;back+=(n-i);
    }
    cout<<ans<<endl;
    return;
} 

signed main(void)
{
    ARENA
    int t=1,i;//cin>>t;
    f(i,1,t+1)
    {
        //cout<<"case #"<<i<<": ";
        _main();
    }
    return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define x first
#define y second
#define pb push_back
#define mk make_pair
#define all(a) a.begin(), a.end()
#define len(a) (int)a.size()

using namespace std;

typedef long long ll;
typedef vector <int> vi;
typedef pair <int, int> pii;

int main(){
	int n;
	cin >> n;
	cout << n + n*n + n*n*n << endl;
	
	return 0;
}


Measured memory_bytes: 3608
n, k = map(int, input().split())
sunuke = list(range(1, n+1))

for i in range(k):
  d = int(input())
  A = list(map(int, input().split()))
  for d in range(d):
    for a in A:
      if a in sunuke:
        sunuke.remove(a)
    
print(len(sunuke))

Measured memory_bytes: 9188
import java.util.Scanner;

public class Main {

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

//   void main() {
//       Scanner sc = new Scanner(System.in);
//       while(true) {
//           int n = sc.nextInt();
//           if(n==0) break;
//           char[][] c = new char[n][n];
//           for(int i=0;i<n;i++) {
//               String s = sc.next();
//               c[i] = s.toCharArray();
//           }
//           for(int i=0;i<n;i++) {
//               for(int j=0;j<n;j++) {
//                   System.out.print(c[i][j] + " ");
//               }
//               System.out.println();
//           }
//       }
//   }

   
   void main() {
	   Scanner sc = new Scanner(System.in);
	   int N = sc.nextInt();
	   int W = sc.nextInt();
	   int[] v = new int[N+1];
	   int[] w = new int[N+1];
	   for(int i=1;i<=N;i++) {
		   v[i] = sc.nextInt();
		   w[i] = sc.nextInt();
	   } 
	   
	   int[][] dp = new int[N+1][W+1];
	   for(int i=1;i<=N;i++) {
		   for(int j=1;j<=W;j++) {
			   if(w[i]<=j) {
				   dp[i][j] = Math.max(dp[i-1][j], dp[i-1][j-w[i]] + v[i]);
			   }else {
				   dp[i][j] = dp[i-1][j];
			   }
		   }
	   }
	   System.out.println(dp[N][W]);
   }
}


Measured memory_bytes: 31044
#include<iostream>

using namespace std;

const int MAXN = 1005, INF = 2e9;
int d[MAXN][MAXN];

int main()
{
	int n, m;
	cin >> n >> m;
	for(int i = 0; i < n; i++)
		for(int j = 0; j < n; j++)
			d[i][j] = INF;
	for(int i = 0; i < n; i++)
		d[i][i] = 0;
	for(int i = 0; i < m; i++)
	{
		int x, y, w;
		cin >> x >> y >> w;
		d[x][y] = w;
	}
	for(int k = 0; k < n; k++)
		for(int i = 0; i < n; i++)
			for(int j = 0; j < n; j++)
				if(d[i][k] < INF && d[k][j] < INF)
					d[i][j] = min(1ll * d[i][j], 1ll * d[i][k] + d[k][j]);
	for(int i = 0; i < n; i++)
		if(d[i][i] < 0)
		{
			cout << "NEGATIVE CYCLE" << endl;
			return 0;
		}
	for(int i = 0; i < n; i++, cout << endl)
		for(int j = 0; j < n; j++)
		{
			if(d[i][j] == INF)
				cout << "INF";
			else
				cout << d[i][j];
			if(j < n - 1)
				cout << ' ';
		}
	return 0;
}

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

using namespace std;

#define sz(v)           ((int)((v).size()))
#define clr(v, d)       memset(v, d, sizeof(v))
#define rep(i, v)       for(int i=0; i<sz(v); ++i)
#define lp(i, n)        for(int i=0; i<(int)(n); ++i)
#define lpi(i, j, n)    for(int i=(j); i<(int)(n); ++i)
#define lpd(i, j, n)    for(int i=(j); i>=(int)(n); --i)
#define INF             1000000000

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;

const int N = 1e5+5;

void init()
{
	std::ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
}

int main()
{
	init();
	int a;
	cin >> a;
	cout << a*a;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <queue>
using namespace std;
typedef long long ll;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int dy[] = {1, 0, -1, 0};
const int dx[] = {0, 1, 0, -1};
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> v;
    for(int i = 0; i < n; i++)
    {
        int x; cin >> x;
        v.push_back(x);
    }
    int q;
    cin >> q;
    for(int i = 0; i < q; i++)
    {
        int k;
        cin >> k;
        if(binary_search(v.begin(), v.end(), k)) cout << 1 << endl;
        else cout << 0 << endl;
    }
    return 0;
}




Measured memory_bytes: 3568