akhauriyash/Code-Regression huggingface dataset:
#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 (int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define DEFOR(LoopVariable,numberOFbegin,numberOFend) for (int LoopVariable = (numberOFbegin)-1; (LoopVariable) >= (numberOFend); (LoopVariable)--)
#define REP(LoopVariable,numberOFend) for(int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)

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(){

    int n,x;
    cin >> n>>x;
    vector<int> v(n);
    REP(i,n){scanf("%d",&v[i]);}
    long long int result=0,eat;
    FOR(i,1,n){
        if(v[i]+v[i-1]>x){
            eat= min(v[i], v[i] + v[i - 1]-x);
            result += eat;
            v[i] -= eat;
        }

        if(v[i]+v[i-1]>x){
            eat=min(v[i-1], v[i] + v[i - 1]-x);
            result += eat;
            v[i - 1] -= eat;
        }

    }
    cout << result << endl;

    return 0;
}

Measured memory_bytes: 640
#pragma region _head

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
#include<iomanip>
#include<queue>
#include<stack>
#include<numeric>
#include<utility>
#include<regex>

void Init() {
	std::cin.tie(0); std::ios::sync_with_stdio(false);
	struct Init_caller { Init_caller() { Init(); } }caller;
}

#pragma region _define

#define int LL
#define f(i,a,b) for(LL i=a;i<b;i++)
#define f_vI(v,n) f(i,0,n)cin>>v[i]
#define f_v2I(v1,v2,n) f(i,0,n)cin>>v1[i]>>v2[i]
#define f_v3I(v1,v2,v3,n) f(i,0,n)cin>>v1[i]>>v2[i]>>v3[i]
#define f_vO(v,n) f(i,0,n)cout<<v[i]<<endl
#define ei else if
#define all(a) a.begin(),a.end()
#define size(s) ((LL)s.size())
#define F first
#define S second
#define check() cout<<"! ! !"
#define endl "\n"
#define _y() cout<<"Yes"<<endl
#define _Y() cout<<"YES"<<endl
#define _n() cout<<"No"<<endl
#define _N() cout<<"NO"<<endl
#define INT_INF 1<<29
#define LL_INF 1LL<<60
#define MOD 1000000007

#pragma endregion

#pragma region _using

using namespace std;

using LL = long long;
using st = string;
using vi = vector<LL>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vd = vector<double>;
using vvd = vector<vd>;
using vvvd = vector<vvd>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<st>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvvb = vector<vvb>;
using qi = queue<LL>;
using qc = queue<char>;
using qs = queue<st>;
using si = stack<LL>;
using sc = stack<char>;
using ss = stack<st>;
using pi = pair<LL, LL>;
using ppi = pair<pi, LL>;
using mll = map<LL, LL>;
using mcl = map<char, LL>;
using vpi = vector<pi>;
using vppi = vector<ppi>;

#pragma endregion

struct edge {
	int from, to, cost;
};

void y_n(bool p) {
	p ? _y() : _n();
}

void Y_N(bool p) {
	p ? _Y() : _N();
}

LL gcd(LL a, LL b) {
	LL r;
	while ((r = a % b) != 0) {
		a = b;
		b = r;
	}
	return b;
}
LL lcm(LL a, LL b) {
	return (a / gcd(a, b) * b);
}

//素数判定
bool is_prime(int n) {
	for (int i = 2; i*i <= n; i++) {
		if (n % i == 0) {
			return false;
		}
	}
	return true;
}

//階乗計算
LL factorial(LL n) {
	LL a = 1, ret = 1;
	while (a < n) {
		a++;
		ret *= a;
		ret %= MOD;
	}
	return ret;
}


#pragma endregion 


/*****************************************************************************/
signed main(void) {
	int n, m;
	cin >> n >> m;
	vi a(m), b(m), c(m);
	f(i, 0, m) {
		int x, y, z;
		cin >> x >> y >> z;
		x--; y--; z *= (-1);
		a[i] = x; b[i] = y; c[i] = z;
	}
	vi d(n, LL_INF);
	d[0] = 0;
	f(j, 0, n - 1) {
		f(i, 0, m) {
			if (d[a[i]] == LL_INF)continue;
			if (d[b[i]] > d[a[i]] + c[i]) {
				d[b[i]] = d[a[i]] + c[i];
			}
		}

	}
	int ans = d[n - 1] * -1;
	vb neg(n, false);
	f(i, 0, n) {
		f(j, 0, m) {
			if (d[a[j]] == LL_INF)continue;
			if (d[b[j]] > d[a[j]] + c[j]) {
				d[b[j]] = d[a[j]] + c[j];
				neg[b[j]] = true;
			}
			if (neg[a[j]]) {
				neg[b[j]] = true;
			}
		}
	}
	if (neg[n - 1]) {
		cout << "inf";
	}
	else {
		cout << ans;
	}
	return 0;
}

Measured memory_bytes: 256
using System;

namespace ABC115_D___Christmas
{
    class Program
    {
        static long[] burger;
        static long[] patty;
        static void Main(string[] args)
        {
            var NX = Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
            var N = NX[0];
            var X = NX[1];

            burger = new long[N + 1];
            burger[0] = 1;
            for (int i = 1; i < N + 1; i++) burger[i] = burger[i - 1] * 2 + 3;

            patty = new long[N + 1];
            patty[0] = 1;
            for (int i = 1; i < N + 1; i++) patty[i] = patty[i - 1] * 2 + 1;

            Console.WriteLine(Eat(N, X));
        }

        static long Eat(long N, long X)
        {
            if (N == 0) return X == 1 ? 1 : 0;
            if (X <= burger[N - 1] + 1) return Eat(N - 1, X - 1);
            if (X == burger[N]) return patty[N];
            return 1 + patty[N - 1] + Eat(N - 1, X - 2 - burger[N - 1]);
        }
    }
}


Measured memory_bytes: 11220
using System;


namespace ConsoleApplication13
{
    class Program
    {
        static void Main(string[] args)
        {
            int i = 1;
            int x;
            while (true)
            {
                string s = Console.ReadLine();
                x = int.Parse(s);
                if (x == 0) break;

                if (0 < x)
                {
                    Console.WriteLine("Case"+" "+ i + ":"+" " + x);
                    i++;

                }

            }

        }
    }
}

Measured memory_bytes: 9348
import java.util.*;
import java.io.*;

public class Main {

	static ArrayList<int[]> a;
	static int n;
	static int[][] dp;

	public static int dp(int idx, int v) {
		if (idx == a.size()) {
			int u = n - v;
			return u * (u - 1) / 2 + v * (v - 1) / 2;
		}
		if (dp[idx][v] != -1) {
			return dp[idx][v];
		}
		return dp[idx][v] = Math.min(dp(idx + 1, v + a.get(idx)[1]), dp(idx + 1, v + a.get(idx)[2]));
	}

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		n = sc.nextInt();
		int m = sc.nextInt();
		boolean[][] adjMatrix = new boolean[n][n];
		while (m-- > 0) {
			int u = sc.nextInt() - 1;
			int v = sc.nextInt() - 1;
			adjMatrix[u][v] = adjMatrix[v][u] = true;
		}
		int[] clr = new int[n];
		boolean valid = true;
		a = new ArrayList<int[]>();
		for (int i = 0; i < clr.length; i++) {
			
			if (clr[i] == 0) {
				int[] cnt = { 0, 0, 0 };
				Queue<Integer> q = new LinkedList<Integer>();
				q.add(i);
				clr[i] = 1;
				cnt[1]++;
				while (!q.isEmpty()) {
					int cur = q.poll();
					for (int j = 0; j < n; j++) {
						if (cur == j)
							continue;
						if (!adjMatrix[cur][j]) {
							if (clr[j] == 0) {
								clr[j] = 3 - clr[cur];
								cnt[clr[j]]++;
								q.add(j);
							} else if (clr[cur] == clr[j]) {
								valid = false;
								
							}
						}
					}
				}
				a.add(cnt);
			}
		}
		if (valid) {
			dp = new int[a.size()][n + 1];
			for (int[] x : dp)
				Arrays.fill(x, -1);
			pw.println(dp(0, 0));
		} else {
			pw.println(-1);
		}
		pw.close();

	}

	static class Scanner {
		BufferedReader br;
		StringTokenizer st;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public int[] nextIntArr(int n) throws IOException {
			int[] arr = new int[n];
			for (int i = 0; i < n; i++) {
				arr[i] = Integer.parseInt(next());
			}
			return arr;
		}

	}

}


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

using namespace std;

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

int main(){
    string s,p;
    cin >> s >> p;
    while(s.size() <= 300)s += s;
    
    bool ans = false;
    int n = s.size(), m = p.size();
    rep(i,n-m){
        string tmp = s.substr(i, m);
        if(tmp == p){
            ans = true;
            break;
        }
    }

    cout << ((ans)? "Yes" : "No") << endl;

    return 0;
}


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

#define rep(i,n)	for(int i=0;i<(n);i++)

int main( void ) {

	long a,b;
	cin >>a>>b;
	double a1,b1;
	a1 = a;
	b1 =b;
	double ans  = a1/b1;
	cout << a/b <<" "<< a%b <<" ";
	printf("%.8lf",ans);
    return 0;
}



Measured memory_bytes: 3224
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mod 1000000007
#define ff first
#define ss second
using namespace std;
/*ll power(ll x,ll y)
{
    ll res=1;
    while(y>0)
    {
        if(y%2==1)
            res=(res*x)%mod;
        x=(x*x)%mod;
        y=y/2;
    }
    return res;
}*/
int main()
{
cout.precision(15);
cout.setf(ios::floatfield,ios::fixed);
ll n,i;
cin>>n;
double d=0,c;
for(i=0;i<n;i++)
{
    cin>>c;
    d=d+((double)1/c);
}
d=1.0/d;
cout<<d<<endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int a[1000006], b[1000006];
int main(){
    int n, m, c = 0, l;
    cin >> n >> m;
    for (int i = 1; i <= m; ++ i){
        cin >> a[i];
        if (a[i] % 2){
            l = i;
            ++ c;
        }
    }
    if (n == 1){
        cout << 1 << endl << 1 << endl << 1 << endl;
        return 0;
    }
    if (n % 2 == 1 && c > 1 || n % 2 == 0 && c > 2){
        cout << "Impossible" << endl;
        return 0;
    }
    if (c == 0){
        for (int i = 1; i <= m; ++ i)
            cout << a[i] << " ";
        cout << endl << m + 1 << endl;
        cout << a[1] - 1 << " ";
        for (int i = 2; i <= m; ++i)
            cout << a[i] << " ";
        cout << 1 << endl;
    }
    else if (c == 1){
        cout << a[l] << " ";
        b[1] = a[l];
        for (int i = 1, c = 1; i <= m; ++ i)
            if (a[i] % 2 == 0){
                cout << a[i] << " ";
                b[++ c] = a[i];
            }
        cout << endl << m + (b[1] != 1)<< endl;
        if (b[1] != 1)
            cout << b[1] - 1 << " ";
        for (int i = 2; i <= m; ++ i)
            cout << b[i] << " ";
        cout << 1 << endl;
    }
    else if (c == 2){
        cout << a[l] << " ";
        b[1] = a[l];
        for (int i = 1, c = 1; i <= m; ++ i)
            if (a[i] % 2 == 0){
                cout << a[i] << " ";
                b[++ c] = a[i];
            }
        for (int i = 1; i <= m; ++ i)
            if (a[i] % 2 && i != l){
                cout << a[i] << " ";
                b[m] = a[i];
            }
        cout << endl << m - 1 + (b[1] != 1) + (b[m] != 1) << endl;
        if (b[1] != 1)
            cout << b[1] - 1 << " ";
        cout << 2 << " ";
        for (int i = 2; i < m; ++ i)
            cout << b[i] << " ";
        if (b[m] != 1)
            cout << b[m] - 1 << " ";
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 2304
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_s = lambda: readline().rstrip().decode('utf-8')
in_nl = lambda: list(map(int, readline().split()))
in_nl2 = lambda H: [in_nl() for _ in range(H)]
in_map = lambda: [s == ord('.') for s in readline() if s != ord('\n')]
in_map2 = lambda H: [in_map() for _ in range(H)]
in_all = lambda: map(int, read().split())


def main():

    N = in_n()
    A = in_nl()

    ans = 0
    mod = 10**9 + 7
    sum_a = sum(A)
    tsum = [0] * (N + 1)

    for i in range(N):
        tsum[i + 1] = tsum[i] + A[i]

    for i in range(N):
        ans += A[i] * (sum_a - tsum[i + 1])
        ans %= mod

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 92728
from collections import Counter

N = int(input())
V = list(map(int, input().split(" ")))

even, odd = [sorted(Counter(V[i::2]).items(), key=lambda x: x[1], reverse=True) + [[None, 0]] for i in range(2)]
# print(even, odd)
if even[0][0] == odd[0][0]:
	print(min(N-even[0][1]-odd[1][1], N-even[1][1]-odd[0][1]))
else:
	print(N-even[0][1]-odd[0][1])

Measured memory_bytes: 20572
#include <iostream>
#include <cmath>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <iomanip>

using namespace std;

double gyaku(double x) {
    return 1.0 / x;
}

int main() {
    int n;
    cin >> n;
    vector<int> a;
    int temp;

    for (int i = 0; i < n; i++) {
        cin >> temp;
        a.push_back(temp);
    }

    double wa = 0;

    for (int i = 0; i < n; i++) {
        wa += gyaku(a[i]);
    }

    cout << setprecision(100) <<gyaku(wa);
    
    return 0;
}

Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
for i in range(1,10):
  for j in range(1,10):
    if i*j == N:
      print("Yes")
      exit()
      
print("No")

Measured memory_bytes: 5148
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
    string S;
    cin >> S;
    for ( int i = 0; i < S.size()-1; i++ ) {
        if ( S[i] == S[i+1] ) {
            cout << i+1 << " " << i+2 << "\n";
            return 0;
        } else if ( i < S.size()-2 && S[i] == S[i+2] ) {
            cout << i+1 << " " << i+3 << "\n";
            return 0;
        }
    }
    cout << "-1 -1\n";
    return 0;
}


Measured memory_bytes: 512
#!/usr/bin/env python

from collections import deque
import itertools as it
import sys
import math

sys.setrecursionlimit(1000000)

INF = 10 ** 18
MOD = 10 ** 9 + 7

N, Q = map(int, raw_input().split())
S = raw_input()
cnt = [0] * (N + 1)
for i in range(N - 1):
    cnt[i + 2] = cnt[i + 1]
    if S[i] == 'A' and S[i + 1] == 'C':
        cnt[i + 2] += 1
for _ in range(Q):
    l, r = map(int, raw_input().split())
    ans = cnt[r] - cnt[l - 1]
    if cnt[l] != cnt[l - 1]:
        ans -= 1
    print ans

Measured memory_bytes: 8552
while 1:
    n = int(input())
    if n == 0:break
    y = int(input())
    b = [tuple(map(int, input().split())) for _ in range(n)]
    p = [((1 + b[i][1] / 100 * y) if b[i][2] == 1 else ((1 + b[i][1] / 100) ** y)) for i in range(n)]
    print(b[p.index(max(p))][0])


Measured memory_bytes: 5720
use proconio::{input, fastout};
use proconio::marker::{Chars};
use proconio::marker::Usize1;
use std::cmp::*;

macro_rules! debug {
      ($($a:expr),*) => {
          eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
      }
  }

#[fastout]
fn main() {
    input!{
        mut a: [usize;3],
    }

    a.sort();
    let mut ans = 0;
    for i in 0..2 {
        ans += a[i+1] - a[i];
    }

    println!("{}", ans);

}


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

///******************************** C o n t a i n e r ********************************///

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

///*********************************** C o n s t ***********************************///

const int       N=1e6+3;
const double    PI = acos(-1);
const ll        MOD=1000000007;                 ///1e9+7
ll dx[] = {+1, 0, -1, 0, +1, +1, -1, -1};       ///first 4 for adjacent
ll dy[] = {0, +1, 0, -1, +1, -1, +1, -1};
ll dx8[]= {+1, +1, -1, -1, +2, +2, -2, -2};    ///knights move
ll dy8[]= {+2, -2, +2, -2, +1, -1, +1, -1};

///********************************** M a r c o ***********************************///

#define pb push_back
#define F first
#define S second
#define test int tc; cin>>tc; while(tc--)
#define forn(i,n) for(i=0;i<n;i++)
#define rforn(i,n) for(i=n-1;i>=0;i--)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define sz(x) x.size()
#define el <<'\n'
#define sp <<' '
#define print(a) {for(auto x:a)cout<<x<<" ";cout<<endl;}
#define mem(a,b) memset(a, b, sizeof(a))
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) (a)*(a)

#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);

///*********************************** F u n c t i o n ***********************************///

ll powmod(ll a,ll b){ll p=MOD;a%=p;if(!a) return 0;ll pr=1;while(b>0){if(b&1){pr*=a;pr%=p;--b;}a*=a;a%=p;b/=2;}return pr;}
ll modinverse(ll a){return powmod(a,MOD-2);}
bool isPrime(ll n){ if(n<=1)return false;if(n<=3)return true;if(n%2==0 or n%3==0)return false;for(ll i=5;i*i<=n;i+=6){if(n%i==0 or n%(i+2)==0)return false;}return true;}
void seive(bool a[]){ll mx=sqrt(N),ii,jj;for(ii=3;ii<=mx;ii+=2)if(!a[ii])for(jj=ii*ii;jj<=N;jj+=2*ii)a[jj]=true;}
void numofdiv(ll a[]){ll mx=sqrt(N),ii,jj;for(ii=1;ii<=mx;ii++){for(jj=ii*ii;jj<=N;jj+=ii){if(jj==ii*ii) a[jj]++; else a[jj]+=2;}}}
void sumofdiv(ll a[]){ll mx=sqrt(N),ii,jj;for(ii=1;ii<=mx;ii++){for(jj=ii*ii;jj<=N;jj+=ii){if(jj==ii*ii) a[jj]+=ii; else a[jj]+=ii+jj/ii;}}}

///**************************************************** C o d e ****************************************************///
///-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=///


void _case()
{
    ll n;
    cin>>n;
    cout<<n*n*n el;
}

main()
{
    fastio();
    _case();

}


///Thank you.


///Brainless_Loco Terminates Here!


Measured memory_bytes: 3640
#include <iostream>
#include <sstream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>
#include <iomanip>
#include <cstdlib>
#include <climits>
#include <set>
using namespace std;

//関数getinputdata宣言
vector<vector<string>> getinputdata();
vector<vector<int>> getinputdata2();
vector<vector<double>> getinputdata3();

void abc128_a(vector<vector<string>> v) {

    int a = atoi(v[0][0].c_str());
    int p = atoi(v[0][1].c_str());
    
    cout << ((a*3)+p)/2<<endl;



}

int main() {

    vector<vector < string>> vec_arr_result;
    //    vector<vector<int>> vec_arr_result;
    vec_arr_result = getinputdata();

    abc128_a(vec_arr_result);

    return 0;
}

//関数getinputdata実装

vector<vector<double>> getinputdata3() {

    string str;
    string ret;
    stringstream ss;
    vector<string> v1;
    vector<vector<double>> vec_arr;

    //標準入力から入力がある間ループ処理でvector配列にデータ格納
    while (getline(cin, str)) {

        v1.push_back(str);

    }

    //stringstreamを利用してvector配列v1をスペースで分解処理
    for (string s : v1) {

        vector<double> array_data;
        ss << s;

        while (!ss.eof()) {

            ss >> ret;

            array_data.push_back(atof(ret.c_str()));
        }

        //vector配列に追加
        vec_arr.push_back(array_data);

        //バッファクリア
        ss.str("");
        //ストリームクリア
        ss.clear(stringstream::goodbit);

    }

    return vec_arr;
}

//関数getinputdata実装

vector<vector<int>> getinputdata2() {

    string str;
    string ret;
    stringstream ss;
    vector<string> v1;
    vector<vector<int>> vec_arr;

    //標準入力から入力がある間ループ処理でvector配列にデータ格納
    while (getline(cin, str)) {

        v1.push_back(str);

    }

    //stringstreamを利用してvector配列v1をスペースで分解処理
    for (string s : v1) {

        vector<int> array_data;
        ss << s;

        while (!ss.eof()) {

            ss >> ret;

            array_data.push_back(atoi(ret.c_str()));
        }

        //vector配列に追加
        vec_arr.push_back(array_data);

        //バッファクリア
        ss.str("");
        //ストリームクリア
        ss.clear(stringstream::goodbit);

    }

    return vec_arr;


}

//関数getinputdata実装

vector<vector < string >> getinputdata() {

    string str;
    string ret;
    stringstream ss;
    vector<string> v1;
    vector<vector < string>> vec_arr;

    //標準入力から入力がある間ループ処理でvector配列にデータ格納
    while (getline(cin, str)) {

        v1.push_back(str);

    }

    //stringstreamを利用してvector配列v1をスペースで分解処理
    for (string s : v1) {

        vector<string> array_data;
        ss << s;

        while (!ss.eof()) {

            ss >> ret;

            array_data.push_back(ret);
        }

        //vector配列に追加
        vec_arr.push_back(array_data);

        //バッファクリア
        ss.str("");
        //ストリームクリア
        ss.clear(stringstream::goodbit);

    }

    return vec_arr;

}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		while (sc.hasNext()) {
			int ci = 0;
			int cj = 0;
			char[] s = sc.next().toCharArray();
			for (int i = 0; i < s.length - 2; ++i) {
				if (s[i] == 'I' && s[i + 1] == 'O' && s[i + 2] == 'I') ++ci;
				if (s[i] == 'J' && s[i + 1] == 'O' && s[i + 2] == 'I') ++cj;
			}
			System.out.println(cj);
			System.out.println(ci);
		}
	}

}

Measured memory_bytes: 12000
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>

using namespace std;

#define mod 1000000007

int n;

int main()
{
	int a, b;
	cin >> n >> a >> b;
	if(abs(a - b) % 2 == 0) cout << "Alice" << endl;
	else cout << "Borys" << endl;
	return 0;
}

Measured memory_bytes: 256
MOD = 10 ** 9 + 7
def pow(n, k)
  k %= (MOD - 1)
  return 1 if k.zero?
  return pow(n, k - 1) * n % MOD if k.odd?
  return (pow(n, k / 2) ** 2) % MOD
end
def max(a,b); a > b ? a : b; end
  
N = gets.to_i
ab0 = 0
a0 = 0
b0 = 0
dp = Hash.new(0)

N.times.each do
  a,b = gets.split.map(&:to_i)
  if a.zero? && b.zero?
    # どの魚とも仲が悪い
    ab0 += 1
  elsif a.zero?
    # b == 0の魚と仲が悪い
    a0 += 1
  elsif b.zero?
    # a == 0 の魚と仲が悪い
    b0 += 1
  else
    # a/bでグループ分け
    # -b/aのグループと仲が悪い
    dp[a.to_r / b] += 1
  end
end

# a=b=0は無視して、仲が悪いグループのどちらかを選ぶ組み合わせを選ぶ方法から何も選ばない組み合わせを引く
ans = 1
used = {}

if a0.zero? || b0.zero?
  ans = ans * pow(2, max(a0, b0)) % MOD
else
  ans = ans * (pow(2, a0) + pow(2,b0) - 1) % MOD
end
dp.keys.each do |k|
  next if used[k]
  used[k] = true
  if dp[-1/k] > 0
    ans = ans * (pow(2, dp[k]) + pow(2, dp[-1/k]) - 1) % MOD
    used[-1/k] = true
  else
    ans = ans * pow(2, dp[k]) % MOD
  end
end
# 最後にどの魚とも仲が悪いグループを足して終り
puts (ans - 1 + ab0 ) % MOD 


Measured memory_bytes: 47196
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h, w;
    cin >> h >> w;
    vector<string> s(h);
    rep(i,h) cin >> s[i];
    P cur = P(0, 0);
    s[0][0] = '.';
    while(true){
        if(cur == P(h-1, w-1)) break;
        int y = cur.first, x = cur.second;
        int ny = y+1, nx = x+1;
        if(ny < h && s[ny][x] == '#'){
            cur = P(ny, x);
            s[ny][x] = '.';
        }
        else if(nx < w && s[y][nx] == '#'){
            cur = P(y, nx);
            s[y][nx] = '.';
        }
        else break;
    }
    if(cur != P(h-1, w-1)){
        cout << "Impossible" << endl;
        return 0;
    }
    rep(i,h)rep(j,w){
        if(s[i][j] == '#'){
            cout << "Impossible" << endl;
            return 0;
        }
    }
    cout << "Possible" << endl;
    return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize ("Ofast")
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
using namespace __gnu_pbds;
using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<long long,long long> ii; 	
typedef complex<long double> com;

const ll mod = 1e9+7;
const ld PI = 3.14159265358979323846;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ld a,b,h,m;
	cin >> a >> b >> h >> m;
	h = h*60+m;
	ld d1 = ld(360)/ld(720)*h;
	ld d2 = ld(360)/ld(60)*m;
	ld ad = abs(d1-d2) * PI / 180;
	ld ans = sqrtl(a*a+b*b-ld(2)*a*b*cos(ad));
	cout << fixed << setprecision(60) << ans << endl;
} 

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

int main() {
	ios_base::sync_with_stdio(false);

	int n;
	cin >> n;
	vector<int> h(n);
	for (int i = 0; i < n; i++) {
		cin >> h[i];
	}
	vector<int> dp(n, 0);
	dp[1] = abs(h[1] - h[0]);
	for (int i = 2; i < n; i++) {
		dp[i] = min(abs(h[i] - h[i - 1]) + dp[i - 1], abs(h[i] - h[i - 2]) + dp[i - 2]);
	}
	cout << dp[n - 1];

	return 0;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using ll = long long;
using namespace std;

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

    int p[n + 1];
    int count = 0;
    for(int i = 1; i <= n; i++) {
        cin >> p[i];
        if(p[i] != i) {
            count++;
        }
    }

    if(count <= 2) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}

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

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(S: str, T: str):
    if T in (S + S):
        print(YES)
    else:
        print(NO)


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    T = next(tokens)  # type: str
    solve(S, T)

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
def solve():
    N, K = map(int, input().split())
    ans = 0
    
    for i in range(1, N+1):
        count = 0
        while i * 2 ** count < K:
            count += 1
        ans += (1 / N) * (1 / 2 ** count)
    
    print(ans)

if __name__ == '__main__':
    solve()

Measured memory_bytes: 2940
#include<iostream>
#include<cmath>
#include<vector>
#include<algorithm>
using namespace std;
struct Point { long double px, py; };
Point Minus(Point a, Point b) { Point O; O.px = a.px - b.px; O.py = a.py - b.py; return O; }
long double dot(const Point& a, const Point& b) { return a.px * b.px + a.py * b.py; }
long double crs(const Point& a, const Point& b) { return a.px * b.py - a.py * b.px; }
int contain(vector<Point> v, Point p) {
	bool in = false;
	for (int i = 0; i < v.size(); ++i) {
		Point a = Minus(v[i], p), b = Minus(v[(i + 1) % v.size()], p);
		if (a.py > b.py) swap(a, b);
		if (a.py <= 0 && 0 < b.py)
			if (crs(a, b) < 0) in = !in;
		if (crs(a, b) == 0 && dot(a, b) <= 0) return 1;
	}
	return in ? 2 : 0;
}
int main() {
	int n; cin >> n;
	for (int i = 0; i < n; i++) {
		Point p1, p2, p3, p4, p5;
		cin >> p1.px >> p1.py >> p2.px >> p2.py >> p3.px >> p3.py >> p4.px >> p4.py >> p5.px >> p5.py;
		vector<Point>C = { p1,p2,p3 };
		bool G1 = contain(C, p4), G2 = contain(C, p5);
		if (G1 ^ G2 == true)cout << "OK" << endl;
		else { cout << "NG" << endl; }
	}
	return 0;
}

Measured memory_bytes: 3208
import sys

def main():
    input = sys.stdin.readline
    S = int(input())

    x1 = 0
    y1 = 0

    if S == 10**18:
        x2 = 10**9
        y2 = 0
        x3 = 0
        y3 = 10**9
    else:
        x2 = 10**9
        y2 = 1
        y3 = S // 10**9 + 1
        x3 = 10**9 * y3 - S

    print('{} {} {} {} {} {}'.format(x1, y1, x2, y2, x3, y3))


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
package main

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

func main() {
	var n, m int
	fmt.Scan(&n, &m)
	xs := make([]int, n+1)
	for i := range xs {
		xs[i] = 1
	}
	sc := bufio.NewScanner(os.Stdin)
	var a int
	for i := 0; i < m; i++ {
		sc.Scan()
		a, _ = strconv.Atoi(sc.Text())
		xs[a] = 0
	}

	f2 := 1
	f1, f0 := xs[1], xs[0]
	for i := 2; i <= n; i++ {
		f2 = (f1*xs[i-1] + f0*xs[i-2]) % 1000000007
		f1, f0 = f2, f1
	}
	fmt.Println(f2)
}


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

int main() {
	int N ;
  	cin >> N ;
  	int Sen , Hyaku , Ju , Ichi ;
    Sen = N / 1000 ;
    N = N % 1000 ;
    Hyaku = N / 100 ;
    N = N % 100 ;
    Ju = N / 10 ;
    N = N % 10;
    Ichi = N ;
    if(Sen == Hyaku && Hyaku == Ju){
    	cout << "Yes" << endl;
    }else if(Hyaku == Ju && Ju == Ichi){
        cout << "Yes" << endl;
    }else{
    	cout << "No" << endl;
    }
}


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

int main() {
	int n, l;
	cin >> n >> l;
	vector<string> vec(n);
	for (int i=0; i<n; i++) {
		cin >> vec[i];
	}

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

	for (int i=0; i<n; i++) {
		cout << vec[i];
	}
}

Measured memory_bytes: 3600
use std::io::prelude::*;

fn input<T: std::str::FromStr>() -> T {
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

#[allow(dead_code)]
fn with_stdout_lock<F: FnOnce(std::io::BufWriter<std::io::StdoutLock>)>(f: F) {
    let out = std::io::stdout();
    let w = std::io::BufWriter::new(out.lock());
    f(w);
}

#[allow(unused_macros)]
macro_rules! debug {
    ($var:expr) => {
        match &$var { v => eprintln!(concat!(stringify!($var), "={:?}"), v) }
    };
    ($var:expr, $($vars:expr),*) => {
        match &$var { v => eprint!(concat!(stringify!($var), "={:?} "), v) }
        debug!($($vars),*);
    };
}

fn main() {
    let s: Vec<char> = input::<String>().chars().collect();

    let mut ans = 0;
    let mut prev = String::new();
    let mut i = 0;
    while i < s.len() {
        if prev.len() != 1 {
            prev.clear();
            prev.push(s[i]);
            ans += 1;
        } else {
            let mut si = String::new();
            si.push(s[i]);
            while i < s.len() && prev == si {
                i += 1;
                if i < s.len() {
                    si.push(s[i]);
                }
            }
            if prev != si {
                ans += 1;
            }
            prev = si;
        }
        i += 1;
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <stdio.h>

int main(void){
    char S[3], T[3];

    scanf("%s%s", S, T);

    int i;

    int count = 0;

    for(i = 0; i < 3; i ++){
        if(S[i] == T[i]){
            count ++;
        }
    }
    printf("%d\n", count);
}

Measured memory_bytes: 128
#include<iostream>
#include<tuple>
#include<vector>
#include<algorithm>
#include<cmath>

using std::begin;
using std::end;

int concat(int m, int n) {
  int d{1};
  for(int i{n}; i > 0; i /= 10, d *= 10);

  return m * d + n;
}

int main(int, char**) {
  int n;
  std::vector<int> v;
  std::cin >> n;

  for(int i{0}; i < n; ++i) {
    int t;
    std::cin >> t;
    v.push_back(t);
  }

  std::vector<int> candidates;
  std::vector<int> rs;

  for(int i{0}; i < n/2; ++i) {
    for(int j{0}; j < n/2; ++j) {
      if(i != j)
        rs.push_back(concat(v[i], v[j]));
    }
  }
  std::sort(begin(rs), end(rs));
  for(int i{0}; i < 3; ++i) {
    candidates.push_back(rs[i]);
  }
  rs.clear();

  for(int i{0}; i < n/2; ++i) {
    for(int j{n/2}; j < n; ++j) {
      if(i != j)
        rs.push_back(concat(v[i], v[j]));
    }
  }
  std::sort(begin(rs), end(rs));
  for(int i{0}; i < 3; ++i) {
    candidates.push_back(rs[i]);
  }
  rs.clear();

  for(int i{n/2}; i < n; ++i) {
    for(int j{0}; j < n/2; ++j) {
      if(i != j)
        rs.push_back(concat(v[i], v[j]));
    }
  }
  std::sort(begin(rs), end(rs));
  for(int i{0}; i < 3; ++i) {
    candidates.push_back(rs[i]);
  }
  rs.clear();

  for(int i{n/2}; i < n; ++i) {
    for(int j{n/2}; j < n; ++j) {
      if(i != j)
        rs.push_back(concat(v[i], v[j]));
    }
  }
  std::sort(begin(rs), end(rs));
  for(int i{0}; i < 3; ++i) {
    candidates.push_back(rs[i]);
  }
  rs.clear();

  std::sort(begin(candidates), end(candidates));
  // for(int e: candidates) {
  //   std::cout << e << std::endl;
  // }
  std::cout << candidates[2] << std::endl;

  return 0;
}


Measured memory_bytes: 68660
#include<iostream>
#include<cstdio>
#include<math.h>
#include<algorithm>

int main(){
    int A1,A2,A3;
    scanf("%d%d%d",&A1,&A2,&A3);
    int array[]={A1,A2,A3};
    std::sort(array,array+3);
    int B1=array[0];
    int B2=array[1];
    int B3=array[2];
    std::cout<<B3-B1<<"\n";
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB push_back
#define INF INT_MAX/3
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define CLR(a) memset(a,0,sizeof(a))

typedef long long int ll;

using namespace std;

bool istr(vector<int> b){
    REP(i,b.size()){
	if(b[i] != (i+1)) return false;
    }
    return true;
}

int main(){
    while(true){
	int n;
	vector<int> b;
	cin >> n;
	if(n == 0) break;
	REP(i,n){
	    int temp;
	    cin >> temp;
	    b.PB(temp);
	}
	int ans = 0;
	while(!istr(b)){
	    int cnt = 0;
	    ans++;
	    if(ans >= 10000) break;
	    REP(i,b.size()) {
		b[i]--;
		cnt++;
	    }
	    RREP(i,b.size()) {
		if(b[i] == 0) b.erase(b.begin()+i);
	    }
	    b.PB(cnt);
	}
	if(ans >= 10000) ans = -1;
	cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 1240
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int b,c,i,j,n,sum=0,pro,minn=INT_MAX,maxn=INT_MIN,ans=0;
    cin>>n;
    vector<long long int > count(n+1,0);
    vector<long long int> arr(n);
    for(int i=0; i<n; ++i)
    {
        cin >> arr[i];
        count[arr[i]]++;
    }
    for(int i=1; i<=n; ++i)
    {
        ans+= (count[i]*(count[i]-1))/2;
    }
    for(int i=0; i<n; ++i)
    {
        if (count[arr[i]]<2)
            cout << ans <<endl;
        else
            cout << ans - count[arr[i]]+1 <<endl;
    }
    return 0;

}


Measured memory_bytes: 5760
#include<iostream>

using namespace std;
int main()
{
int a,b,x;
cin>>a;
cin>>b;

if(a>b)
{
x=a;
a--;
}
else{
x=b;
b--;
}

if(a>b){
    x=x+a;
    a--;
}
else{
    x=x+b;
    b--;
}

cout<<x<<endl;
return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,m;
    cin >> n >> m;
    int a[n];
    int sumvote=0;
    for(int i=0;i<n;i++){
        scanf("%d",&a[i]);
        sumvote+=a[i];
    }
    double ave = 1.0*sumvote/4/m;
    int ret=0;
    for(int i=0;i<n;i++){
        if(a[i]>=ave)
            ret++;
    }

    if(ret>=m)
        cout << "Yes";
    else
        cout << "No";
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
  string s;
  cin>>s;
  int count=0,max=0;
  int i;
  i=0;
  while(i<s.length())
  {
      if(s[i]=='A'||s[i]=='C'||s[i]=='G'||s[i]=='T')
      {
          count++;
      }
      else
      {
          if(count>max)
          {
              max = count;
              count=0;
          }
      }
      i++;
  }
  if(count>max){
      max = count;
  }
  cout<<max<<"\n";
 return 0; 
}

Measured memory_bytes: 256
//div 3 c
#include<bits/stdc++.h> 
using namespace std; 
#define ll long long int
int main()
{
	ll x;
	cin>>x;
	ll x1,x2,x3;
	x3= x%5;
	x2= ((x-x3)/5)%100;
	x1= (( ((x-x3)/5) - x2)/100);
	cout<<(x+500*x1-x3)<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define mod (int)(1e9+7)
#define inf (int)(3e18+7)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(v) v.begin(),v.end()
#define mkp make_pair
#define mkt make_tuple
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;

bool prime(int x) {
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0)return false;
	}
	return x > 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1) * x % mod;
}
int mod_pow(int x, int y, int mod_) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % mod_;
		}
		x = x * x % mod_;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x)* mod_pow(kai(x - y), mod - 2, mod) % mod * mod_pow(kai(y), mod - 2, mod) % mod;
}
/*--------Library Zone!--------*/

int n, a, b, c, d;
signed main() {
	string s;
	cin >> n >> a >> b >> c >> d >> s;
	a--; b--; c--; d--;
	for (int i = a; i < c; i++) {
		if (s[i] == '#' && s[i + 1] == '#') {
			cout << "No" << endl; return 0;
		}
	}
	for (int i = b; i < d; i++) {
		if (s[i] == '#' && s[i + 1] == '#') {
			cout << "No" << endl; return 0;
		}
	}
	if (c > d) {
		for (int i = b - 1; i < d; i++) {
			if (s[i] == '.' && s[i + 1] == '.' && s[i + 2] == '.') {
				cout << "Yes" << endl;
				return 0;
			}
		}
		cout << "No" << endl;
	}
	else cout << "Yes" << endl;
}


Measured memory_bytes: 640
implicit none
integer :: a,b,c,d,e,f,n_a,i,j,k,l,S,T
double precision :: youeki, yousitu,noudo,Li

read(5,*) a,b,c,d,e,f
youeki=0
yousitu=0
noudo=0
S=0
T=0
Li=0
n_a=int(f/(100*a))

do i=0, 5+n_a
do j=0, 5+int((f-100*i*a)/(100*b))
do k=0, 5+int((f-100*i*a-100*j*b-k*c)/d)
do l=0, 5+int((f-100*i*a-100*j*b-k*c)/d)
    S=100*a*i+100*b*j+c*k+d*l
    T=c*k+d*l
    if (S/=0) then
        Li=100.0*T/S
    endif
    if (S<=f .and. Li<=100.0*e/(100.0+e) .and. Li>=noudo) then
        noudo=Li
        youeki=S
        yousitu=T
    endif


end do
end do
end do
end do

write(6,'(i0," "i0)') int(youeki),int(yousitu)
end 


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main
{
    public static void main(String[] args)
    {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task
    {
        public void solve(int testNumber, Scanner in, PrintWriter out)
        {
            int N = in.nextInt();
            int M = in.nextInt();
            int X = in.nextInt();
            int[][] books = read(in, N, M + 1);
            int minCost = Integer.MAX_VALUE;
            for (int combination = 0; combination < 1 << N; combination++)
            {
                int knoweldge[] = new int[M];
                int cost = 0;
                for (int book = 1; book <= N; book++)
                {
                    boolean isTaken = CPUtils.getIthBitFromInt(combination, book) != 0;
                    for (int algo = 1; algo <= M && isTaken; algo++)
                    {
                        knoweldge[algo - 1] += books[book - 1][algo];
                    }
                    cost += isTaken ? books[book - 1][0] : 0;
                }
                int cnt = 0;
                for (int i = 0; i < knoweldge.length; i++)
                {
                    cnt += knoweldge[i] >= X ? 1 : 0;
                }
                if (cnt == M)
                {
                    minCost = Math.min(minCost, cost);
                }
            }
            out.println(minCost == Integer.MAX_VALUE ? -1 : minCost);
        }

        private int[][] read(Scanner in, int n, int m)
        {
            int[][] books = new int[n][m];
            for (int i = 0; i < n; i++)
            {
                for (int j = 0; j < m; j++)
                {
                    books[i][j] = in.nextInt();
                }
            }
            return books;
        }

    }

    static class CPUtils
    {
        public static int getIthBitFromInt(int bits, int i)
        {
            return (bits >> (i - 1)) & 1;
        }

    }
}



Measured memory_bytes: 28420
// #pragma comment(linker, "/stack:200000000")
// #pragma GCC optimize("Ofast,no-stack-protector")
// #pragma GCC target("avx")

// timus 219263UI
//    (><)

#include <iostream>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <ctime>
#include <queue>
#include <vector>
#include <sstream>
#include <iomanip>
#include <cstdlib>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <unordered_map>

using namespace std;

typedef long long ll;

#define y1 needtrainharder
#define f first
#define s second
#define gg exit(0)
#define sz() size()
#define pb emplace_back
#define mp make_pair
#define skip continue
#define all(x) x.begin(), x.end()
#define alln(x, y) x, x + y
#define boost ios_base::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL)
#define file(s) if(fopen(task".in", "r"))freopen(s".in","r",stdin),freopen(s".out","w",stdout);
#define task "sorting"

const int inf = 1e9 + 5;  
const ll infll = 1e18 + 5ll;  
const long double eps = 1e-15;
const int maxn = 1e5 + 100;
const int maxlog = 21;
const int P = 97;
const int mod = 1e9 + 7;

int main() { 
  boost; 
  srand(time(NULL));
  file(task);  

  int a, b;
  cin >> a >> b;
  if ( a == b )
    cout << -1,gg;
  if ( a % b != 0 )
    cout << a,gg;
  if ( (a * 2) % b != 0 )
    cout << a * 2,gg;
  if ( (a * 3) % b != 0 )
    cout << a * 3,gg;
  cout << -1;
  
  return 0; 
}
/*





*/

Measured memory_bytes: 512
N, A, B = map(int, input().split())

if (A-B) % 2 == 0:
    # (A-B) / 2 とはお互いの距離の半分
    print((B-A) // 2)
else:
    ans = min((B+A-1) // 2, (2*N-A-B+1) // 2)
    print(ans)


Measured memory_bytes: 2940
#include <iostream>

using namespace std;

int main (void)
{
   int n;
   int p[50];
   int judge = 0;

   cin >> n;
   
   for(int i = 0; i < n; i++){
      cin >> p[i];
      
      if (p[i] != i + 1){
         judge++;
      }
   }

   if(judge <= 2) {
      cout << "YES" << endl;
   }

   else {
      cout << "NO" << endl;
   }

   return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<math.h>
#include<algorithm> 
#define rep(i,n) for (int i = 0; i < (n) ; ++i)
using namespace std;
using ll = long long ;
using P = pair<int, int> ;
#define PI 3.14159265358979323846264338327950
#define INF 1e18
vector<int> mx = {1,0,-1,0} ;
vector<int> my = {0, 1, 0, -1} ;


int main () {
    ll h ;
    cin >> h ;
    double num = 0 ;
    while(h > 1){
        h /= 2 ;
        num++ ;
    }
    num++ ;
    ll ans = ll(pow(2, num)) - 1 ;
    cout << ans << endl ;
}

Measured memory_bytes: 4116
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iostream>
#include <map>
#include <set>
#include <string>

#define FOR(i, n) for (int i = 0; i < n; i++)
#define FORN(i, n, s) for (int i = s; i < n; i++)
#define OUT(s) cout << s << endl;
#define IN(a) cin >> a;
#define PACK(a, n) \
  for (int i = 0; i < n; i++) cin >> a[i];
#define PACKN(a, n, s) \
  for (int i = s; i < n; i++) cin >> a[i];
#define LIST(a, n) \
  for (int i = 0; i < n; i++) cout << "[" << i << "] " << a[i] << endl;

using namespace std;

int main() {
  int T, X;
  IN(T >> X);
  OUT((double)T / X);
  return 0;
}

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

using namespace std;

#define S scanf
#define P printf
#define G getline
#define SZ size()
#define C clear()
#define B begin()
#define F front()
#define T top()
#define E end()
#define EM empty()
#define V vector
#define Q queue
#define DQ deque
#define PQ priority_queue
#define ST stack
#define FI first
#define SE second
#define PI acos(-1)
#define PS push
#define PP pop()
#define PSF push_front
#define PSB push_back
#define PPF pop_front()
#define PPB pop_back()
#define MP make_pair
#define LL long long int
#define ULL unsigned long long int
#define PII pair<int,int>
#define PSI pair<string,int>
#define PIS pair<int,string>
#define PLI pair<long long int,int>
#define PLL pair<long long int,long long int>
#define MII map<int,int>
#define MSI map<string,int>
#define MIS map<int,string>
#define MLI map<long long int,int>
#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)





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




MSI mp;
V<string>v;

int main()
{
    FAST();

//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);

    int i,n;
    string s;
    cin >> n;
    for(i=0; i<n; i++)
    {
        cin >> s;
        sort(s.B,s.E);
        if(mp[s] == 1)
        {
            v.PSB(s);
        }
        mp[s]++;
    }
    n=v.SZ;
    LL x,ans=0;
    for(i=0; i<n; i++)
    {
        x=mp[v[i]];
        ans+=((x*(x-1))/2);
    }
    cout << ans;
    return 0;
}


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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

int main()
{
    ll i,j;
    ll n,m;
    cin >> n >> m;
    ll sum = 0;
    for(i = 0;i < m;++i){
        ll a;
        cin >> a;
        sum += a;
    }
    if(sum <= n){
        cout << n-sum << endl;
    }else{
        cout << -1 << endl;
    }
    return 0;
}

Measured memory_bytes: 3592
#include <iostream>
#include <algorithm>
#include <map>
#include <vector> 

using namespace std;

const int N=15;
typedef long long ll; 

int n,m,x;
int cost[N];
int w[N][N];
int v[N];
int mincost=0x3f3f3f3f;
int sumcost=0;

void dfs(int u)
{
	if(u==n) return;
	
	sumcost+=cost[u];
	for(int i=0;i<m;i++) v[i]+=w[u][i];
	bool flag=1;
	for(int i=0;i<m;i++) if(v[i]<x) flag=0;
	if(flag)
		if(sumcost<mincost) mincost=sumcost;
	dfs(u+1);
	sumcost-=cost[u];
	for(int i=0;i<m;i++) v[i]-=w[u][i]; 
	
	dfs(u+1);
}

int main()
{
//	freopen("input.txt","r",stdin);
	
	cin>>n>>m>>x;
	for(int i=0;i<n;i++)
	{
		cin>>cost[i];
		for(int j=0;j<m;j++) cin>>w[i][j];
	}
	dfs(0);
	if(mincost==0x3f3f3f3f) cout<<"-1";
	else cout<<mincost;

	return 0;
}

Measured memory_bytes: 3164
#include <bits/stdc++.h>
#include "atcoder/all"

using namespace std;

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

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

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

    ll N, Q;
    cin >> N >> Q;
    atcoder::dsu uf(N + 5);
    REP(_, Q) {
        ll a, b, c;
        cin >> a >> b >> c;
        if (a == 0) {
            uf.merge(c, b);
        }
        else {
            cout << (ll) uf.same(b, c) << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3904