akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
const int N = 501010;
int n,i,l,r,m,ans;
int a[N],b[N];
int main()
{
	scanf("%d",&n);
	for (i=1;i<=2*n-1;i++)
	scanf("%d",&a[i]);
	l=1;r=2*n-1;
	while (l<=r)
	{
		m=(l+r)>>1;
		ans=-1;
		for (i=1;i<=2*n-1;i++)
		if (a[i]<=m) b[i]=0;else b[i]=1;
		
		for (i=0;i<n-1;i++)
		{
		
			if (b[n-i]==b[n-i-1]) 
			{
				ans=b[n-i];
				break;
			}
			
			if (b[n+i]==b[n+i+1]) 
			{
				ans=b[n+i];
				break;
			}
		}
		
		if (ans==-1)
		{
			ans=b[n]^((n-1)%2);
		}
	//	printf("%d %d\n",m,ans);
		if (ans==0) r=m-1;else l=m+1;
	}
	printf("%d\n",l);
} 



Measured memory_bytes: 1792
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>

using namespace std;


int main(){

	int a,b,c,ans = -1,left,right;

	scanf("%d %d %d",&a,&b,&c);

	for(int loop = 0; loop < 60; loop++){
		left = (a+b)*loop,right = (a+b)*loop+a;
		for(int k = 0; 60*k+c <= right; k++){
			if(left <= 60*k+c && right >= 60*k+c){
				ans = 60*k+c;
				break;
			}
		}
		if(ans != -1)break;
	}

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

	return 0;
}

Measured memory_bytes: 2724
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;

    // 整数スキャン（複数）
    /*
    int x;
    scanf("%d",&x);
    int y;
    scanf("%d",&y);
    int z;
    scanf("%d",&z);

    // n個の整数のスキャン
    /*
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    */

    // 文字列スキャン
    /*
    string s;
    cin >> s;
    */

    // n個の文字列スキャン
    /*
    vector<string> slist;
    rep(i,n){
        string s;
        cin >> s;
        slist.push_back(s);
    }
    */

int main() {
    int a,b,c;
    cin >> a >> b >> c;
    ll ans = 0;
    if(a%2==1||b%2==1||c%2==1){
        cout << ans << endl;
        return 0;
    }
    if(a==b&&b==c){
        puts("-1");
        return 0;
    }

    while(true){
        if(a%2==1||b%2==1||c%2==1)break;
        int aa = b/2 + c/2;
        int bb = c/2 + a/2;
        int cc = a/2 + b/2;
        a=aa; b=bb; c=cc;
        ans++;
    }

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


Measured memory_bytes: 256
#![allow(unused_imports)]
use std::io::*;
use std::fmt::*;
use std::str::*;
use std::cmp::*;
use std::collections::*;

pub trait InputValue {
    fn parse(s: &str) -> Self;
}

pub fn read<T: InputValue>() -> T {
    let mut buf = String::new();
    let _ = stdin().read_line(&mut buf);
    T::parse(&buf.trim())
}

pub fn readn<T: InputValue>(n: usize) -> Vec<T> {
    let mut vec = vec![];
    for _ in 0..n {
        vec.push(read());
    }
    vec
}

pub fn readnc<T: InputValue>() -> Vec<T> {
    let mut vec = vec![];
    let line: String = read();
    for token in line.split_whitespace() {
        vec.push(T::parse(token));
    }
    vec
}

macro_rules! parse_single_value {
    ($($t:ty),*) => {
        $(
            impl InputValue for $t {
                fn parse(s: &str) -> $t { s.parse().unwrap() }
            }
        )*
	}
}
parse_single_value!(i32, i64, f32, f64, usize, String);

macro_rules! parse_tuple {
	($($t:ident),*) => {
		impl<$($t),*> InputValue for ($($t),*) where $($t: InputValue),* {
			fn parse(s: &str) -> ($($t),*) {
				let mut tokens = s.split_whitespace();
				let t = ($($t::parse(tokens.next().unwrap())),*);
				t
			}
		}
	}
}
parse_tuple!(A, B);

// ===

fn main() {
    let n: usize = read();
    let mut a: Vec<i32> = readnc();

    a.sort();

    let u = a[n-1];
    let mut v = 0;
    for i in 0..n-1 {
        let diff = min(u-a[i], a[i]);
        let best = min(u-v, v);
        if best < diff {
            v = a[i];
        }
    }
    println!("{} {}", u, v);
}


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

int main() {
    int T;  cin >> T;
    for (int _ = 0; _ < T; ++_) {
        int n, m, a, b;  cin >> n >> m >> a >> b;
        cout << floor_sum(n, m, a, b) << endl;
    }
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define inf 0x7fffffff
#define RG register
#define int long long
#define maxn 1000005
#define maxm 205
using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;
inline ll read(){
    ll x = 0, f = 1;
    char ch = getchar();
    while(ch > '9' || ch < '0') {if(ch == '-') f = -1;ch = getchar();}
    while(ch >= '0' && ch <= '9'){x = x *10 + ch -'0';ch = getchar();}
    return x * f;
}
 
int n, m, k, po[2][maxn];
int qpow(int a, int b){
	int ans = 1, base = a;
	while(b){
		if(b & 1) ans = 1ll * ans * base % mod;
		base= 1ll * base * base % mod;
		b >>= 1;
	}
	return ans;
}
int fac[maxn], inv[maxn], ans;
int C(int n, int m){return 1ll * fac[n] * inv[m] % mod *inv[n - m] % mod;}
signed main(){
	int i, j, x, l, r, mid;
	fac[0] = po[0][0] = po[1][0] = 1;
	for(i = 1;i <= maxn - 5;i++) fac[i] = 1ll * fac[i - 1] * i % mod, po[0][i] = po[0][i - 1] * 2ll % mod, po[1][i] = po[1][i - 1] * 3ll % mod;
	inv[maxn - 5] = qpow(fac[maxn - 5], mod - 2);
	for(i = maxn - 6;i >= 0;i--) inv[i] = 1ll * inv[i + 1] * (i + 1) % mod; 
	n = read(), m = read(), k = read();
	int las = 1;
	for(i = 0;i <= m + k;i++){
		ans = (ans + 1ll * C(n + i - 1, n - 1) * po[1][m + k -i] % mod * las % mod) % mod;
		if(i + 1 <= m && i + 1 <= k) las = las * 2ll % mod;
		else{
			if(i + 1 <= k) las = ((las * 2ll - C(i, m)) % mod + mod) % mod; 
			else if(i + 1 <= m) las = ((las * 2ll - C(i, i - k)) % mod + mod) % mod;
			else las = (((las * 2ll - C(i, i - k)) % mod + mod - C(i, m) ) % mod + mod ) % mod;
		}
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 35016
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>

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

    std::map<int, int> m;
    for (int i = 0; i < N; i++) {
        int K; std::cin >> K;
        for (int j = 0; j < K; j++) {
            int a; std::cin >> a;
            m[a]++;
        }
    }

    int ans = 0;
    for (auto x : m) if (x.second == N) ans++;
    std::cout << ans << std::endl;

	return 0;
}

Measured memory_bytes: 3620
#include <stdio.h>

int main(){


  int i,j,N,A[100],v,k;

  scanf("%d ",&N);

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

    scanf("%d",&A[i]);

  }
  
  for(k=0;k<N;k++){
    if(k==N-1)
    printf("%d\n",A[k]);
    else printf("%d ",A[k]);
  }

      
  for(i=1;i<=N-1;i++){
    v=A[i];
    j=i-1;
    while(j>=0 && A[j] > v){
      A[j+1]=A[j];
      j--;
    }    
    A[j+1]=v;
    for(k=0;k<N;k++){
      if(k==N-1)
	printf("%d\n",A[k]);
      else printf("%d ",A[k]);
    }
  }

  return 0;
}
  
  
    
  



Measured memory_bytes: 2144
import java.util.Scanner;
import java.util.ArrayList;
import java.util.List;
import java.io.*;

public class Main {

	public static void main(String[] args) {
		int pA = 0, pB = 0;

		Scanner scan = new Scanner(System.in);
		int num = Integer.parseInt(scan.nextLine());
		int cnt = 0;
		while (cnt < num) {
			String tmp = scan.nextLine();
			String a = tmp.split(" ")[0];
			String b = tmp.split(" ")[1];
			int turncnt = 0;
			cnt++;
			if(a.equals(b)){
				pA++;
				pB++;
				continue;
			}
			while (true) {
				char[] cA = a.toCharArray();
				char[] cB = b.toCharArray();

				if (turncnt == a.length() || turncnt == b.length()) {
					if(cA.length > cB.length){
						pA += 3;
					}else if(cA.length < cB.length){
						pB += 3;
					}
					break;
				}

				if (cA[turncnt] > cB[turncnt]) {
					pA += 3;
					break;
				} else if (cA[turncnt] < cB[turncnt]) {
					pB += 3;
					break;
				}
				turncnt++;
			}
		}
		System.out.println(pA + " " + pB);
	}

}



Measured memory_bytes: 30944
#create environment
import math
x = []
ans = 0
#input1 N, D (numeric)
N, D = map(int, input().split())
#input2
for i in range(N):
  a = list(map(int, input().split()))
  x += [a]
#make combination
for i in range(N):
  for j in range(i+1, N):
    square = 0
    obj_num = 0
    for k in range(D):
      square += (x[i][k] - x[j][k])**2
    obj_num = math.sqrt(square)
    if obj_num == round(obj_num):
      ans += 1    
#print
print(ans)

Measured memory_bytes: 3064
#include<stdio.h>
int main(void){

int x;
int i=0;
int num=0;

scanf("%d",&x);
while(x>0){





if(x==0){break;}


 

            
  

 printf("Case %d: %d\n",i=i+1,x);scanf("%d",&x);



        } 
               
                
return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rng(i, a, b) for (int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define gnr(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define per(i, b) gnr(i, 0, b)
#define bg begin()
#define ed end()
#define all(x) x.bg, x.ed
#define vi vector<int>
template <class t, class u>
bool chmax(t &a, u b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class t, class u>
bool chmin(t &a, u b)
{
    if (b < a)
    {
        a = b;
        return true;
    }
    return false;
}

signed main()
{
    int n;
    cin>>n;
    n = 100000-n;
    cout << n % 1000 << endl;
    return 0;
}

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

int main(){
  int n;
  double d;
  cin >> n >> d;
  double x[n],y[n];
  rep(i,n)cin >> x[i] >> y[i];

  int ans=0;
  double dis=d*d;
  rep(i,n){
    if(dis>=x[i]*x[i]+y[i]*y[i])ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 6896
A = int(input())
B = int(input())
C = int(input())
X = int(input())

a_max = X // 500
b_max = X // 100
c_max = X // 50

a_range = A
if A > a_max:
  a_range = a_max
b_range = B
if B > b_max:
  b_range = b_max
c_range = C
if C > c_max:
  c_range = c_max

count = 0

for i in range(c_range+1):
  for j in range(b_range+1):
    for k in range(a_range+1):
      if k * 500 + j * 100 + i * 50 == X:
        count += 1

print(count)

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

namespace AtCoder
{
    class Program
    {
        static void Main()
        {
            Solve();

            Console.ReadKey();
        }

        static void Solve()
        {
            var N = IO.GetInt();
            var a = IO.GetIntList();
            var ans = a.Sum() - N;
            
            Console.WriteLine(ans);
        }
    }


    static class IO
    {
        static public string GetString() { return Console.ReadLine(); }
        static public int GetInt() { return int.Parse(Console.ReadLine()); }
        static public long GetLong() { return long.Parse(Console.ReadLine()); }
        static public List<string> GetStringList() { return Console.ReadLine().Split(' ').ToList(); }
        static public List<int> GetIntList() { return Console.ReadLine().Split(' ').Select(int.Parse).ToList(); }
        static public List<long> GetLongList() { return Console.ReadLine().Split(' ').Select(long.Parse).ToList(); }
        static public List<double> GetDoubleList() { return Console.ReadLine().Split(' ').Select(double.Parse).ToList(); }
        static public void WriteStrings<T>(IEnumerable<T> values) { foreach (var o in values) { Console.Write(o + " "); } }
    }
}

Measured memory_bytes: 13284
#include <iostream>
#include <list>
#include <string>
#include <algorithm>
#include <stdio.h>
using namespace std;
int main() {
	long int N, X = 0; scanf("%ld", &N);
	char S[20];
	list<int> V;
	for (int i = 0; i < N; i++) {
		scanf("%s", S);
		if (S[0] == 'i') {
			scanf("%ld", &X);
			V.push_front(X);
		}
		else if (S[6] == 'F') {
			V.pop_front();
		}
		else if (S[6] == 'L') {
			V.pop_back();
		}
		else if (S[0] == 'd') {
			cin >> X;
			for (list<int>::iterator it = V.begin(); it != V.end(); it++) {
				if (*it == X) {
					V.erase(it);
					break;
				}
			}
		}
	}
	int i = 0;
	for (list<int>::iterator it = V.begin(); it != V.end(); it++) {
		if (i++) printf(" ");
		printf("%d", *it);
	}
	cout << endl;
}



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

#define MP make_pair
#define PB push_back
#define ALL(x)      (x).begin(),(x).end()
#define REP(i,n)    for(int i=0;i<(n);i++)
#define REP1(i,n)   for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n)   for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;

const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;

const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};


void solve(long long N, std::vector<long long> s){
    LL ans = accumulate(ALL(s), 0LL);
    sort(ALL(s));

    if(ans % 10 != 0) {
        cout << ans << endl;
        return ;
    }

    REP(i, N) {
        if((ans - s[i]) % 10 != 0){
            cout << ans - s[i] << endl;
            return;
        }
    }

    cout << 0 << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> s(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&s[i]);
    }
    solve(N, std::move(s));
    return 0;
}


Measured memory_bytes: 256
m,M,X,Y,x,y,i,j;
main(){
while(scanf("%d%d",&x,&y),x||y){
m=x*x+y*y,M=90000;
for(i=150;i;i--)for(j=i+1;j<=150;j++)if(m==i*i+j*j&&x<i)M=i*i+j*j,X=i,Y=j;else if(m<i*i+j*j&&M>=i*i+j*j)M=i*i+j*j,X=i,Y=j;
printf("%d %d\n",X,Y);
}
}

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

void call(int n)
{
	int i = 1;
	do
	{
		int x = i;
		if (x % 3 == 0) {
			cout << " " << i;
		}
		else
		{
			do
			{
				if (x % 10 == 3) {
					cout << " " << i;
					break;
				}
				else
				{
					x /= 10;
				}
			} while (x != 0);
		}
	} while (++i<=n);
	cout << endl;
}

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

	return 0;
}


Measured memory_bytes: 3104
package main

import "fmt"

func main() {
	var n, m int
	fmt.Scanf("%d", &n)
	fmt.Scanf("%d", &m)

	wanums := make([]int, 1000010)
	acresults := make([]bool, 100010)

	for i := 1; i <= n; i++ {
		wanums[i] = 0
		acresults[i] = false
	}

	var ans1 int
	var ans2 int

	for j := 1; j <= m; j++ {
		var a int
		var b string
		fmt.Scanf("%d", &a)
		fmt.Scanf("%s", &b)

		if acresults[a] {
			continue
		}

		if b == "AC" {
			acresults[a] = true
			ans1++
			ans2 += wanums[a]
		}
		if b == "WA" {
			wanums[a]++
		}
	}
	fmt.Printf("%d %d\n", ans1, ans2)
}

Measured memory_bytes: 10752
#include<bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define ll long long int
void findAns()
{
    int a, b, c;
    cin >> a >> b >> c;
    int k;
    cin >> k;


    if (c > b and b > a)
    {
        cout << "Yes";
        return;
    }
    if (b <= a)
    {
        while (b <= a and k > 0)
        {
            b = b * 2;
            k--;
        }
    }

    if (c <= b)
    {
        while (c <= b and k > 0)
        {
            c = c * 2;
            k--;
        }
    }

    if (c > b and b > a)
    {
        cout << "Yes";
        return;
    }
    else
    {
        cout << "No";
        return;
    }


}

int main()
{
// #ifndef ONLINE_JUDGE
//     freopen("in.txt", "r", stdin);
//     freopen("t.txt", "w", stdout);
// #endif

    FAST;


    ll  t = 1;
    // cin >> t;

    while (t--) findAns();

    return 0;
}



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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------


void solve() {
    int i,j,k,l,r,x,y; string s;
    int N,K;
    bool exit = false;
    
    cin>>N>>K;
    if(N%K==0){
        cout<<"0"<<endl;
    }else{
        cout<<"1"<<endl;
    }    
    /*cin>>N;
    vector<ll> V;
    FOR(x,N+1) {
            FOR(y,N+1) {
                    ll ret=1;
                    FOR(i,x) ret*=2;
                    FOR(i,y) ret*=5;
                    V.push_back(ret);
            }
    }
    sort(ALL(V));
    FORR(v,V) cout<<v<<endl;*/
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
using namespace std;
const int D_MAX_V=2102;
const int D_v_size=2102;
struct D_wolf{
	int t,c,r;
	D_wolf(){t=c=r=0;}
	D_wolf(int t1,int c1,int r1){
		t=t1;c=c1;r=r1;
	}
};
vector<D_wolf>D_G[D_MAX_V];
int D_level[D_MAX_V];
int D_iter[D_MAX_V];

void add_edge(int from,int to,int cap){
	D_G[from].push_back(D_wolf(to,cap,D_G[to].size()));
	D_G[to].push_back(D_wolf(from,0,D_G[from].size()-1));
}
void D_bfs(int s){
	for(int i=0;i<D_v_size;i++)D_level[i]=-1;
	queue<int> Q;
	D_level[s]=0;
	Q.push(s);
	while(Q.size()){
		int v=Q.front();
		Q.pop();
		for(int i=0;i<D_G[v].size();i++){
			if(D_G[v][i].c>0&&D_level[D_G[v][i].t]<0){
				D_level[D_G[v][i].t]=D_level[v]+1;
				Q.push(D_G[v][i].t);
			}
		}
	}
}
int D_dfs(int v,int t,int f){
	if(v==t)return f;
	for(;D_iter[v]<D_G[v].size();D_iter[v]++){
		int i=D_iter[v];
		if(D_G[v][i].c>0&&D_level[v]<D_level[D_G[v][i].t]){
			int d=D_dfs(D_G[v][i].t,t,min(f,D_G[v][i].c));
			if(d>0){
				D_G[v][i].c-=d;
				D_G[D_G[v][i].t][D_G[v][i].r].c+=d;
				return d;
			}
		}
	}
	return 0;
}
int max_flow(int s,int t){
	int flow=0;
	for(;;){
		D_bfs(s);
		if(D_level[t]<0)return flow;
		for(int i=0;i<D_v_size;i++)D_iter[i]=0;
		int f;
		while((f=D_dfs(s,t,99999999))>0){flow+=f;}
	}
	return 0;
}
int main(){
	int a;
	while(scanf("%d",&a),a){
		for(int i=0;i<2102;i++){
			D_G[i].clear();
			D_iter[i]=D_level[i]=0;
		}
		int n;scanf("%d",&n);
		map<int,int>c;
		for(int i=0;i<n;i++){
			int b;scanf("%d",&b);
			c[b]=i;
		}
		int s=2100;
		int t=2101;
		for(int i=0;i<n;i++)add_edge(s,i,1);
		for(int i=0;i<a;i++){
			int m;scanf("%d",&m);
			for(int j=0;j<m;j++){
				int p;scanf("%d",&p);
				if(c.count(p)){
					add_edge(c[p],i+n,1);
				}
			}
		}
		for(int i=0;i<a;i++)add_edge(i+n,t,1);
		printf("%d\n",max_flow(s,t));
	}
}

Measured memory_bytes: 1268
//keep trying :)
#include <bits/stdc++.h>
#define float long double
#define int long long
#define ll long long
#define PB push_back
#define MP make_pair
#define ss second
#define ff first
#define PI 3.14159265
#define inf 9*(1e18)
#define fastrack ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;
void PT(int a);
void PT1(int a);
const int M = 5*(1e5) + 7, mod = 1e9 + 7;
int z[M];

signed main(){
    fastrack;
    //int tt; cin >> tt; while(tt--)
    {
        string s, t;
        cin >> s >> t;
        int l = s.length();
        int ans = 0;
        for(int i = 0; i < l; i++){
            ans += (s[i] != t[i]);
        }
        cout << ans << "\n";
    }
    return 0;
}

void PT(int a){
    cout << a << "\n";
}

void PT1(int a){
    cout << a << " ";
}


Measured memory_bytes: 3796
#include <iostream>
#include <string.h>
using namespace std;

int main(void)
{
  int a[50] = {0};
  char s[50];
  bool f = false;
  cin >> s;
  for ( int i=0; s[i]!='\0'; i++ ) {
    a[s[i]-'a']++;
    if ( a[s[i]-'a'] > 1 ) {
      f = true;
    }
  }
  if ( ! f ) {
    cout << "yes" << endl;
  } else {
    cout << "no" << endl;
  }
  return 0;
}

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

using namespace std;
using ll = long long;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
int gcd(int a, int b){ return (b == 0) ? a : gcd(b, a % b); }
template<typename S, typename T> ostream& operator<<(ostream &os, const pair<S, T> &p){ cout << "[" << p.first << ", " << p.second << "]"; return os; }

#define Sq(x) (x)*(x)
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Reverse(c) reverse(Range(c))
#define Unique(a) a.erase(unique(Range(a)), a.end())
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) { for(const auto &e : xs) cout << e << " "; cout << "\n"; }
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")
#define vc vector
#define Mini(a, x) a = min(a, x)
#define Maxi(a, x) a = max(a, x)

// constexpr int MOD = 1e9+7;

int main(void){
    Cin(int, n);
    Cinm(int, n, d);
    Cin(int, m);
    Rep(m){
        Cin(int, t);
        if(d[t] == 0){
            Cout("NO"); return 0;
        }
        d[t] --;
    }
    Cout("YES");
}





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

// ?????¬???????????¬??????
#pragma region MACRO
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define PED cout << "\n"
#define rep(i,n) for(int i=0; i<(int)n; ++i)
#define REP(i,x,n) for(int i=x; i<(int)n; ++i)
#define repi(i,n) for(int i=0; i<=(int)n; ++i)
#define REPI(i,x,n) for(int i=x; i<=(int)n; ++i)
#define ILP while(true)
#define FOR(i,c) for(__typeof((c).begin())!=(c).begin(); i!=(c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define mp make_pair
#pragma endregion

// ???
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
typedef pair<string, int> psi;
typedef pair<int, string> pis;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long double> vld;
typedef vector<long> vl;
typedef vector<long long> vll;
typedef vector<string> vs;
#pragma endregion

// Effective std
#pragma region ESTD
template<typename C, typename T> int count(C& c, T t) { return count(ALL(c), t); }
template<typename C, typename F> int count_if(C& c, F f) { return count_if(ALL(c), f); }
template<typename C, typename T> void erase(C& c, T t) { remove(ALL(c), t), c.end(); }
template<typename C> void remove(vector<C>& c, unsigned int index) { c.erase(c.begin()+index); }
template<typename C, typename T, typename U> void replace(C& c, T t, U u) { replace(ALL(c), t, u); }
template<typename C, typename F, typename U> void replace_if(C& c, F f, U u) { (ALL(c), f, u); }
template<typename C> void reverse(C& c) { reverse(ALL(c)); }
template<typename C> void sort(C& c) { sort(ALL(c)); }
template<typename C, typename Pred> void sort(C& c, Pred p) { sort(ALL(c), p); }
#pragma endregion

// ?????°
#pragma region CONST_VAL
constexpr int PI = (2*acos(0.0));
constexpr int EPS = (1e-9);
constexpr int MOD = (int)(1e9+7);
constexpr int INF = 100000000;
#pragma endregion


int main()
{
    int n;
    cin >> n;
    vector<string> u(n);
    rep(i,n) cin>>u[i];
    int m;
    cin >> m;
    int f = 0;
    rep(i,m) {
        string s;
        cin >> s;
        auto it = find(ALL(u), s);
        if(it==u.end()) {
            cout << "Unknown " << s << endl;
        }
        else {
            if(f==0) {
                cout << "Opened by " << s << endl;
                f = 1;
            }
            else {
                cout << "Closed by " << s << endl;
                f = 0;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 3152
#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)
#define all(x) (x).begin(),(x).end()
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;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
int main()
{
    int N, M;
    cin >> N >> M;

    vector<vector<int>> G(N);

    rep(i, M) {
        int u, v;
        cin >> u >> v;
        u--; v--;
        G[u].push_back(v);
    }

    int S, T;
    cin >> S >> T;
    S--; T--;

    queue<P> que;
    vector<vector<ll>> dis(3, vector<ll>(N, INF));
    dis[0][S] = 0;
    que.push({0, S}); //0 ~ 2, V
    while (!que.empty()) {
        int path = que.front().first, v = que.front().second;
        que.pop();
        int topath = (path + 1) % 3;
        for (auto to : G[v]) {
            if (dis[topath][to] == INF) {
                dis[topath][to] = dis[path][v] + 1;
                que.push({topath, to});
            }
        }
    }
    
    cout << (dis[0][T] == INF ? -1 : dis[0][T] / 3) << endl;
    return 0;
}

Measured memory_bytes: 11912
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
int n;
struct node{
	int num,p;
	string s;
} pool[105];
bool cmp(const node &a,const node &b){
	if(a.s!=b.s)	return a.s<b.s;
	return a.p>b.p;
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)	cin>>pool[i].s>>pool[i].p;
	for(int i=1;i<=n;i++)	pool[i].num=i;
	sort(pool+1,pool+1+n,cmp);
	for(int i=1;i<=n;i++)	cout<<pool[i].num<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
using namespace std;
#define ll long long
#define MOD 998244353
#define MAX 350
inline int read()
{
	int x=0;bool t=false;char ch=getchar();
	while((ch<'0'||ch>'9')&&ch!='-')ch=getchar();
	if(ch=='-')t=true,ch=getchar();
	while(ch<='9'&&ch>='0')x=x*10+ch-48,ch=getchar();
	return t?-x:x;
}
int fpow(int a,int b)
{
	int s=1;
	while(b){if(b&1)s=1ll*s*a%MOD;a=1ll*a*a%MOD;b>>=1;}
	return s;
}
int n,m,tot,a[MAX][MAX],s[MAX];
int p[MAX][MAX];bool vis[MAX];
void Insert(int x)
{
	for(int i=1;i<=m;++i)
		if(a[x][i])
		{
			if(vis[i])
			{
				for(int j=1;j<=m;++j)a[x][j]^=p[i][j];
				continue;
			}
			++tot;vis[i]=true;
			for(int j=1;j<=m;++j)p[i][j]=a[x][j];break;
		}
}
int main()
{
	n=read();m=read();
	for(int i=1;i<=n;++i)
		for(int j=1;j<=m;++j)
			a[i][j]=read();
	for(int i=1;i<=n;++i)Insert(i);
	int ans=1ll*(fpow(2,n)-fpow(2,n-tot)+MOD)*fpow(2,m-1)%MOD;
	printf("%d\n",ans);
	return 0;
}


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

const double EPS = 1e-8;
const double INF = 1e12;

//point
typedef complex<double> P;
namespace std {
	bool operator < (const P& a, const P& b) {
		return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
	}
	bool cmp_y(const P &a, const P &b){
		return a.imag() != b.imag() ? a.imag() < b.imag() : a.real() < b.real();
	}
}
double cross(const P& a, const P& b) {
	return imag(conj(a)*b);
}
double dot(const P& a, const P& b) {
	return real(conj(a)*b);
}
int ccw(P a, P b, P c) {
  b -= a; c -= a;
  if (cross(b, c) > 0)   return +1;       // counter clockwise
  if (cross(b, c) < 0)   return -1;       // clockwise
  if (dot(b, c) < 0)     return +2;       // c--a--b on line
  if (norm(b) < norm(c)) return -2;       // a--b--c on line
  return 0;								  // a--c--b on line
}

// line
struct L : public vector<P> {
	L(const P& a, const P& b) {
		push_back(a); push_back(b);
	}
};

// polygon
typedef vector<P> G;

P extreme(const vector<P> &po, const L &l) {
  int k = 0;
  for (int i = 1; i < po.size(); ++i)
    if (dot(po[i], l[1]-l[0]) > dot(po[k], l[1]-l[0])) k = i;
  return po[k];
}

enum { OUT, ON, IN };
int contains(const G& po, const P& p) {
  bool in = false;
  for (int i = 0; i < po.size(); ++i) {
  	P a = po[i] - p, b = po[(i+1)%po.size()] - p;
    if (imag(a) > imag(b)) swap(a, b);
    if (imag(a) <= 0 && 0 < imag(b))
      if (cross(a, b) < 0) in = !in;
    if (cross(a, b) == 0 && dot(a, b) <= 0) return ON;
  }
  return in ? IN : OUT;
}

double area2(const G& po) {
	double A = 0;
  	for (int i = 0; i < po.size(); ++i) 
    	A += cross(po[i], po[(i+1)%po.size()]);
	//????????????????????????????????¨????????????
  	return A/2;
}

bool isconvex(const G &p) {
	int n = p.size();
	if(cross(p[0]-p[n-1],p[n-2]-p[n-1]) < 0) return false;
	for(int i = 1; i < n-1; ++i) {
		if(cross(p[i+1]-p[i],p[i-1]-p[i]) < 0) return false;
	}
	return true;

}

G convex_hull(G ps) {
  int n = ps.size(), k = 0;
  sort(ps.begin(), ps.end(), cmp_y);
  G r(2*n);
  for(int i = 0; i < n; i++){
    while(k>1 && cross(r[k-1]-r[k-2],ps[i]-r[k-2]) < -EPS)k--;
    r[k++] = ps[i];
  }
  for(int i = n-2, t = k; i >= 0; i--){
    while(k>t && cross(r[k-1]-r[k-2],ps[i]-r[k-2]) < -EPS)k--;
    r[k++] = ps[i];
  }
  r.resize(k-1);
  return r;
}
	
int main() {
	int n;
	cin >> n;
	G po;
	for(int i=0; i<n; ++i) {
		double x, y;
		cin >> x >> y;
		P p(x, y);
		po.push_back(p);
	}
	G ans = convex_hull(po);
	cout << ans.size() << endl;
	for(int i=0; i<ans.size(); ++i) {
		cout << ans[i].real() << " " << ans[i].imag() << endl;
	}
}

Measured memory_bytes: 9268
#include <stdio.h>

int main(void){
	int h, w, n;
	int x, y, a, tx, ty;

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

    x = y = 0;
	for(int i=0; i < n; i++) {
        scanf("%d%d%d", &tx, &ty, &a);
		switch(a) {
		case 1:   if(x < tx)  x = tx;     break;
		case 2:   if(w > tx)  w = tx;     break;
		case 3:   if(y < ty)  y = ty;     break;
		case 4:   if(h > ty)  h = ty;     break;
		default:  break;
		}
        if(x >= w || y >= h){
            printf("0");
            return 0;
        }
	}
    printf("%d", (w-x)*(h-y));

	return 0;
}


Measured memory_bytes: 128
(let* ((n (read))
       (l (make-array n
                      :initial-contents (loop :repeat n :collect (read))))
       (left (make-array (+ n 1)
                         :initial-element 1
                         :element-type 'fixnum))
       (right (make-array (+ n 1)
                          :initial-element 1
                          :element-type 'fixnum)))
  (loop :as i
          :below n
        :do
           (setf (aref left (+ i 1)) (max (aref left i)
                                          (aref l i))))
  (loop :as i
        :downfrom n :to 1
        :do
           (setf (aref right (- i 1)) (max (aref right i)
                                           (aref l (- i 1)))))
  (loop :as i
          :below n
        :do
           (format t "~A~%" (max (aref left i)
                                 (aref right (+ i 1))))))

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

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

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <numeric>
#include <array>
#include <cmath>
#include <memory>
using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl

//for簡易表記(引数ミス防止)
#define FOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define DEFOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin)-1; (LoopVariable) >= (numberOFend); (LoopVariable)--)
#define REP(LoopVariable,numberOFend) for(long long int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)

using llint = long long int;

constexpr long long int linf = numeric_limits<long long int>::max()-5;
constexpr int inf= numeric_limits<int>::max()-5;
constexpr long long int mod = 1000000007;

int main(){

    llint n,m;
    cin>>n>>m;
    llint result=((n)*(n-1))/2;
    result+=((m)*(m-1))/2;
    cout << result << endl;
    return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/adaptor/indexed.hpp>

using namespace std;
using namespace boost::adaptors;
using ll = int64_t;
using vecint = vector<int>;
using vecll = vector<ll>;
using boost::irange;

int main()
{
  string s;
  cin>>s;
  string ev = "LUD";
  string od = "RUD";
  bool ok = true;
  int n = s.size();
  for (int i : irange(0, n)) {
    if (i % 2) {
      if (ev.find(s[i]) == string::npos) ok = false;
    } else {
      if (od.find(s[i]) == string::npos) ok = false;
    }
  }
  if (ok) {
    cout<<"Yes"<<endl;
  } else {
    cout<<"No"<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
  public static void main(String ...args) {
    final Scanner scanner = new Scanner(System.in);
    final int num = scanner.nextInt();
    final int result = multipleOf2and(num);
    System.out.println(result);
  }

  private static int multipleOf2and(final int num) {
	return (num % 2 == 0) ? num : num * 2;
  }
}


Measured memory_bytes: 21972
// 2010/12/22 Tazoe

#include <iostream>
using namespace std;

int main()
{
	while(true){
		int w;
		cin >> w;
		if(w==-1)
			break;

		int ryokin;
		if(w<=10)
			ryokin = 1150;
		else if(w<=20)
			ryokin = 1150+(w-10)*125;
		else if(w<=30)
			ryokin = 1150+10*125+(w-20)*140;
		else
			ryokin = 1150+10*125+10*140+(w-30)*160;

		cout << 4280-ryokin << endl;
	}

	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define REP(i,n,N) for(int i=n;i<(int)N;i++)
#define ck(n,a,b) ((a)<=(n)&&(n)<(b))
#define p(s) cout<<(s)<<endl
#define F first
#define S second
typedef long long ll;
using namespace std;

int ind, N;
string S;

ll dfs(){
	if(S[ind] == '['){
		vector<ll> v;
		ind++;
		while(1){
			if(S[ind] == ']') break;
			v.push_back(dfs());
		}
		ind++;
		sort(v.begin(), v.end());
		ll ret = 0;
		REP(i,0,v.size()/2 + 1) ret += v[i];
		return ret;
	}else if(isdigit(S[ind])){
		ll ret = 0;
		while(isdigit(S[ind])){
			//cout<<"---"<<S[ind]<<endl;
			ret = ret*10LL + (ll)(S[ind] - '0');
			//cout<<"> "<<ret<<endl;
			ind++;
		}
		//cout<<"prev_ret: "<<ret<<endl;
		ret = ret/2+1;
		//cout<<"ret: "<<ret<<endl;
		return ret;
	}
	return 999999999;
}

int main() {
	cin>>N;
	REP(i,0,N){
		cin>>S;
		ind = 0;
		cout<<dfs()<<endl;
	}
	return 0;
}

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

using namespace std;

template <long long Mod> struct ModInt { /* {{{ */
  long long v;
  constexpr ModInt(const long long x = 0) {
    v = x % Mod;
    if (v < 0) {
      v += Mod;
    }
  }
  constexpr ModInt operator+(const ModInt rhs) const { return ModInt(*this) += rhs; }
  constexpr ModInt operator-(const ModInt rhs) const { return ModInt(*this) -= rhs; }
  constexpr ModInt operator*(const ModInt rhs) const { return ModInt(*this) *= rhs; }
  constexpr ModInt operator/(const ModInt rhs) const { return ModInt(*this) /= rhs; }
  const ModInt &operator+=(const ModInt rhs) {
    v += rhs.v;
    if (v >= Mod) {
      v -= Mod;
    }
    return *this;
  }
  constexpr ModInt &operator-=(const ModInt rhs) {
    if (v < rhs.v) {
      v += Mod;
    }
    v -= rhs.v;
    return *this;
  }
  constexpr ModInt &operator*=(const ModInt rhs) {
    v = v * rhs.v % Mod;
    return *this;
  }
  constexpr ModInt &operator/=(ModInt rhs) {
    long long exp = Mod - 2;
    while (exp) {
      if (exp & 1) {
        *this *= rhs;
      }
      rhs *= rhs;
      exp >>= 1;
    }
    return *this;
  }
  friend ostream &operator<<(ostream &s, ModInt<Mod> m) {
    s << m.v;
    return s;
  }
  friend istream &operator>>(istream &s, ModInt<Mod> m) {
    s >> m.v;
    return s;
  }
}; /* }}} */

const int mod = 1e9 + 7;
using modint = ModInt<mod>;

int main() {
  int N;
  string S1, S2;
  cin >> N >> S1 >> S2;
  modint ans;
  bool last_vert;
  int i;
  if (S1[0] == S2[0]) {
    ans = 3;
    last_vert = true;
    i = 1;
  } else {
    ans = 6;
    last_vert = false;
    i = 2;
  }
  while (i < N) {
    if (S1[i] == S2[i]) {
      if (last_vert) {
        ans *= 2;
      }
      last_vert = true;
      i++;
    } else {
      if (last_vert) {
        ans *= 2;
      } else {
        ans *= 3;
      }
      last_vert = false;
      i += 2;
    }
  }
  cout << ans << endl;

  return 0;
}
/* vim:set fdm=marker: */


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

int main(void)
{
    string S;
    cin >> S;

    string ans;
    if (S == "Sunny")
        ans = "Cloudy";
    else if (S == "Cloudy")
        ans = "Rainy";
    else
        ans = "Sunny";

    cout << ans << endl;

    return 0;
}


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

int main() {
  int n,m,x;
  cin>>n>>m>>x;
  vector<vector<int>> v(n,vector<int>(m+1));
 
  rep(i,n){
    rep(j,m+1){
      cin>>v.at(i).at(j);
    }
  }
  int c=0;
  rep(i,n){c+=v.at(i).at(0);}
 
  rep(tmp,1<<12){
    bitset<12> b(tmp);
    vector<int> vec(m+1,0);
   
    rep(j,m+1){
       rep(i,n){
        vec.at(j)+=b[i]*v.at(i).at(j);
      }
    }
    bool bo=true;
    rep(j,m){
      if(vec.at(j+1)<x){
        bo=false;break;}
    }
    if(bo){c=min(c,vec.at(0));}
    if(tmp==(1<<12)-1&&bo==false){c=-1;}
  }
  
  cout<<c;
}



Measured memory_bytes: 3632
#include "bits/stdc++.h"
#define rep(i, j) for (int i = 0; i < j; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using ull = unsigned long long;

int gcd(int x, int y);
int fac(ll n, vector<int> num);

const int INF = 1001001001;

//mint�p�̕ϐ� (10��9��)
const int mod = 1000000007;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x = 0) :x((x% mod + mod) % mod) {}
    mint operator-() const { return mint(-x); }
    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 { return mint(*this) += a; }
    mint operator-(const mint a) const { return mint(*this) -= a; }
    mint operator*(const mint a) const { return mint(*this) *= 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 { return mint(*this) /= a; }
};
istream& operator>>(istream & is, const mint & a) { return is >> a.x; }
ostream& operator<<(ostream & os, const mint & a) { return os << a.x; }

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

/*���C�u�����ő����*/
//���[�O���b�h�̌ݏ��@
int gcd(int x, int y) {
    int num[3];
    num[0] = (x > y) ? x : y;
    num[1] = (x <= y) ? x : y;
    num[2] = num[0] % num[1];

    while (num[2]) {
        num[0] = num[1];
        num[1] = num[2];
        num[2] = num[0] % num[1];
    }

    return num[1];
}

/*�f��������*/
//���색�C�u����
int fac(ll n, vector<int> num) {
    ll kazu = n;
    for (int i = 2; i <= sqrt(n); i++) {
        while (1) {
            if (kazu % i != 0) break;

            kazu /= i;
            num[i]++;
        }
    }
    if (kazu == n && n != 1) return 1;
    int ans = 0;
    if (kazu != 1) ans++;
    for (int i = 2; i <= sqrt(n); i++) {
        for (int j = 1; j <= num[i]; j++) {
            num[i] -= j;
            ans++;
        }
    }
    return ans;
}

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

using namespace std;

int main(void) {

    int a, b;
    cin>>a>>b;
    string s;
    cin>>s;
    /*if(a <= 5 && b <= 5) {
        int ns = s.size();
        std::size_t found = s.find("-");
        if (found!=std::string::npos) {
            int na = found;
            int nb = ns-found-1;
            for(int i = 0; i < na; ++i) {
                if(s[i] < '0' || s[i] > '9') {
                    cout<<"No";
                    return 0;
                }
            }
            for(int i = na+1; i < ns; ++i) {
                if(s[i] < '0' || s[i] > '9') {
                    cout<<"No";
                    return 0;
                }
            }
            cout<<"Yes";
        }
        else {
            cout<<"No";
        }
    }
    else {
        cout<<"No";
    }
    */
    int flag = 1;
    for(int i = 0; i < a+b+1; ++i) {
        if(i <= a-1 || i >= a+1) {
            if(s[i] < '0' || s[i] > '9') {
                flag = 0;
                break;
            }
        }
        else
        if((i == a) && s[i] != '-') {
            flag = 0;
            break;
        }
    }
    if(flag)    cout<<"Yes";
    else        cout<<"No";

    return 0;
}


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

using namespace std;

int main(){
    int k;
    string s;

    cin >> k;
    cin >> s;

    if(s.size() <= k){
        cout << s << endl;
    }else{
        for(int i=0; i<k; i++)cout << s.at(i);
        cout << "..." << endl;
    } 
}

Measured memory_bytes: 3644
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cctype>
#include<map>
#include<cstring>

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

using namespace std;
using ll = long long int;

const int inf = 1001001000;
const long long int Inf = 1001001001001001000;



void print(vector<vector<int>> a){
	for (int i = 0; i < a.size(); i++)
	{
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<vector<long long int>> a){
	for (int i=0;i<a.size();i++){
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(vector<long long int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(set<int> a){
	for (auto x:a)
		cout << x << " ";
	cout << endl;
}


int main()
{
	int n, m;
	cin >> n >> m;
	priority_queue<ll> a;
	rep(i, n) {
		ll b;
		cin >> b;
		a.push(b);
	}
	rep(i, m)
	{
		ll t = a.top();
		a.pop();
		t = t / 2;
		a.push(t);
	}
	ll ans = 0;
	rep(i, n){
		ans += a.top();
		a.pop();
	}
	cout << ans << endl;
	return 0;
}

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

under_zero_count = sum([i < 0 for i in A])

ans = 0
if under_zero_count % 2 == 0:
    for i in range(N):
        ans += abs(A[i])
    print(ans)
else:
    abs_list = []
    for i in range(N):
        abs_list.append(abs(A[i]))
    print(sum(abs_list) - min(abs_list)*2)


Measured memory_bytes: 14412
#include<stdio.h>
#include<string.h>
int main(void){
	char rareru[101],rareru2[101];
	char ru[101];
	scanf("%100s",rareru);
	scanf("%100s",ru);
	strcpy(rareru2,rareru);
	strcat(rareru,rareru2);
	if(strstr(rareru,ru)!=NULL){
		printf("Yes\n");
	}else{
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 2752