akhauriyash/Code-Regression huggingface dataset:
/*#include <functional>
#include <memory>
#include <utility>

template<typename T, typename Compare = ::std::less<T>>
class skew_heap {
    using value_type = T;
    using const_reference = const value_type &;
    using size_type = ::std::size_t;
    using value_compare = Compare;

    class node_type {
    public:
        ::std::unique_ptr<node_type> left, right;
        value_type value;

        explicit constexpr node_type(const value_type &_value = T()) : value(_value), left(nullptr), right(nullptr) {}
    };

    using pointer_type = ::std::unique_ptr<node_type>;

    pointer_type root;

    value_compare comp;

    size_type _size;

    pointer_type meld(pointer_type a, pointer_type b) {
        if (!a)return b;
        if (!b)return a;
        if (comp(a->value, b->value))a.swap(b);
        a->right = meld(::std::move(a->right), ::std::move(b));
        a->left.swap(a->right);
        return a;
    }

public:
    constexpr skew_heap() : root(nullptr), comp(), _size(1) {}

    explicit constexpr skew_heap(const value_compare &_comp) : root(nullptr), comp(_comp), _size(1) {}

    constexpr bool empty() const noexcept { return !_size; }

    constexpr size_type size() const noexcept { return _size; }

    constexpr const_reference top() const noexcept {
        return root->value;
    }

    void push(const_reference val) {
        root = meld(::std::move(root), ::std::make_unique<node_type>(val));
        ++_size;
    }

    void push(value_type &&val) {
        root = meld(::std::move(root), ::std::make_unique<node_type>(::std::move(val)));
        ++_size;
    }

    template<class... Args>
    void emplace(Args &&... args) {
        root = meld(::std::move(root), ::std::make_unique<node_type>(::std::forward<Args>(args)...));
        ++_size;
    }

    void pop() {
        root = meld(::std::move(root->right), ::std::move(root->left));
        --_size;
    }

    void meld(skew_heap &x) {
        _size += x.size();
        x._size = 0;
        root = meld(::std::move(root), ::std::move(x.root));
    }
};
*/
#include <bits/stdc++.h>

int main(){
    using namespace std;
    size_t Q;
    cin >> Q;
    //skew_heap<long, less<>> pq1;
    //skew_heap<long, greater<>> pq2;
    priority_queue<long, vector<long>, less<>> pq1;
    priority_queue<long, vector<long>, greater<>> pq2;
    long C{0};
    for(unsigned long i = 0, a, b, c; i < Q; ++i)if(cin >> c, c == 1) {
        cin >> a >> b;
        pq1.push(a);
        auto t = pq1.top();
        pq1.pop();
        C += b - a + 2 * t;
        pq2.push(t);
        if (pq1.size() < pq2.size()) {
            auto k = pq2.top();
            pq2.pop();
            C -= 2 * k;
            pq1.push(k);
        }
    }else cout << pq1.top() << " " << C + (pq1.size() != pq2.size()) * pq1.top() << endl;
    return 0;
}

Measured memory_bytes: 3828
let string_to_list str =
  let rec loop i limit =
    if i = limit then []
    else (String.get str i) :: (loop (i + 1) limit)
  in
  loop 0 (String.length str)

let fwd arr_length n = if n = (arr_length - 1) then 0 else n+1
let prev arr_length n = if n = 0 then arr_length - 1 else n-1
let flip c = if c = 'S' then 'W' else 'S'
let print_chars arr = Array.iter (fun x -> Printf.printf "%c" x) arr; Printf.printf "\n"
           
let fill arr arr_length n by =
  arr.(fwd arr_length n) <- 
    if (arr.(n) == 'S' && by = 'o') || (arr.(n) == 'W' && by = 'x') then
      arr.(prev arr_length n)
    else
      flip arr.(prev arr_length n)

let rec extend answers ans_length cursor ret = match answers with
  | [] -> ret
  | x::rest ->
     fill ret ans_length cursor x;
     extend rest ans_length (cursor+1) ret

let check arr arr_length by n =
  if (arr.(n) == 'S' && by = 'o') || (arr.(n) == 'W' && by = 'x') then
    arr.(fwd arr_length n) = arr.(prev arr_length n)
  else
    arr.(fwd arr_length n) <> arr.(prev arr_length n)

let make_list f t step =
  let rec make_list_inner c t lst =
    if c >= t then lst else make_list_inner (c+step) t (c::lst)
  in
  List.rev (make_list_inner f t [])

let check_all pos_ans length pairs =
  let checks = List.mapi (fun x y -> check pos_ans length y x) pairs in
  List.for_all (fun x -> x) checks

let array_make length a b =
  let ret = (Array.make length a) in
  ret.(length - 1) <- b;
  ret

let until list condition def =
  let rec aux list condition = match list with
    | [] -> def
    | x::rest ->
       let ret = Lazy.force x in
       if condition ret then ret else aux rest condition
  in
  aux list condition

let cross a b =
  List.flatten @@ List.map (fun x -> List.map (fun y -> (x,y)) b) a
  
let solve str =
  let str_list = (string_to_list str) in
  let length = List.length str_list in
  let trials = cross ['S'; 'W'] ['S'; 'W'] in
  until
    (List.map
       (fun x -> lazy (extend str_list length 0 (array_make length (fst x) (snd x))))
       trials
    )
    (fun x -> check_all x length str_list)
    [||]
  (*
  let pos_ans = extend str_list length 0 (array_make length 'S' 'S') in
  if check_all pos_ans length str_list then pos_ans else
    let pos_ans = extend str_list length 0 (array_make length 'S' 'W') in
    if check_all pos_ans length str_list then pos_ans else
      let pos_ans = extend str_list length 0 (array_make length 'W' 'W') in
      if check_all pos_ans length str_list then pos_ans else
        let pos_ans = extend str_list length 0 (array_make length 'W' 'S') in
        if check_all pos_ans length str_list then pos_ans else
          [||]
   *)
  
let () =
  let _ = read_int() in
  let str = read_line () in
  let ans = solve str in
  if ans = [||] then
    Printf.printf ("-1")
  else
    Array.iter (fun x -> Printf.printf "%c" x) ans;
  Printf.printf "\n"
;;


Measured memory_bytes: 18176
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<queue>
using namespace std;
#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

signed main()
{
	int N;
	cin >> N;
	vector<int>A(N),dam(N,0);
	int A0 = 0;
	rep(i, N)
	{
		cin >> A[i];
		if (i % 2 == 0)A0 += A[i];
		else A0 -= A[i];
	}
	dam[0] = A0;
	cout << dam[0] << " ";
	rep(i, N - 1)
	{
		dam[i + 1] = 2 * A[i] - dam[i];
		cout << dam[i + 1] << " ";
	}
}

Measured memory_bytes: 2944
n = int(input())
A = [int(input()) for _ in range(n)]

A.sort()
ans = sum(A)

if ans % 10 == 0:
    for i in range(n):
        if A[i] % 10 != 0:
            ans = ans - A[i]
            break
        if i == n - 1:
            ans = 0

print(ans)

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

int main(){
    int num = 0;
    cin >> num;
    
    int shou = 0;
    shou = num;
    
    int amari = 0;
    int sum = 0;
    
    while(shou > 0){
        amari = shou % 10;
        shou = shou / 10;
        sum += amari;
    }
    
    if(num % sum == 0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i=0; i<(ll)n; i++)
#define REPR(i, n) for(ll i=(ll)n-1; i>=0; i--)
#define FOR(i, m, n) for(ll i=(ll)m; i<(ll)n; i++)
#define FORR(i, m, n) for(ll i=(ll)m-1; i>=(ll)n; i--)
#define ALL(x) (x).begin(), (x).end()
#define ASC(v) sort(ALL(v));
#define DESC(v) sort(ALL(v), greater<int>());
#define UNIQ(a) sort(ALL(a));(a).resize(unique(ALL(a)) - a.begin());
#define PRINTD(x, d) cout << fixed << setprecision(d) << x << "\n";
#define DEBUG(x) cout<<#x<<": "<<x<<"\n"
const double PI = acos(-1);
ll lcm(ll a, ll b) { return a / __gcd(a, b) * b; }
bool isprime(int x){ int i; if(x<2)return 0; else if(x==2) return 1; if(x%2==0) return 0; for(i=3; i*i<=x; i+=2) if(x%i==0) return 0; return 1; }
int digsum(int n) { int r=0; while(n>0) { r+=n%10; n/=10; } return r; }
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }

int main(){
    ll N, M, X;
    cin >> N >> M >> X;
    vector<ll> A(M);
    REP(i, M) cin >> A[i];

    ll left = 0, right = 0;
    REP(i, M) {
        if (A[i] < X) left++;
        else right++;
    }
    ll res = min(left, right);

    cout << res << "\n";
}


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

int main()
{
    char a[15];
    int n;
    cin >> n;
    int b = 0,c = 0,d = 0,e = 0;
    while(n -- )
    {
        memset(a,'\0',sizeof(a));
        cin >> a;
        if(a[0] == 'B')
            b ++ ;
        if(a[strlen(a) - 1] == 'A')
            c ++ ;
        if(a[strlen(a) - 1] == 'A' && a[0] == 'B')
            d ++ ;
        for(int i = 0 ; i < strlen(a) ; i ++ )
        {
            if(a[i] == 'A' && a[i + 1] == 'B')
                e ++ ;
        }
    }
    int aa = min(b,c);
    if(b == d && c == d && d != 0)
        e -- ;
    cout << e + aa << endl;
    return 0;
}

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

int main( ) {
  int y,m,d;
  char c1,c2;
  cin >> y >> c1 >> m >> c2 >> d;
  
  if(m <= 4){
    cout << "Heisei" << endl;
  } else {
    cout << "TBD" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define PI 3.14159265
using namespace std;
int main(){
    long double a,b,x;
    cin>>a>>b>>x;
    /*int flag=0;
    if(a*a*b/2<x){
        x=a*a*b-x;
        flag=1;
        double temp=a;
        a=b;
        b=temp;
    }
    double ans=180*atan((a*b*b)/(2.0*x));
    ans=ans/pi;
    if(flag){
        ans=90-ans;
    }*/
    long double ans=0;
    if(a * a * b / 2.0 <= x) {
        ans = atan(2 * (a * a * b - x) / (a * a * a));
    } else {
        ans = PI / 2 - atan(2 * x / (a * b * b));
    }
    cout.precision(30);
    cout<<ans*180/PI<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

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

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

// Self settings
// clang-format off
#define MAX_N 100000
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
#define SLN(i,N) (i == N-1 ? "\n" : " ")
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
const ll MOD = 1e9+7;
const ll INF = 1LL << 60;
const int inf = 1 << 31;
// clang-format on

int N, K, Q;
int A[MAX_N];
int ANS[MAX_N + 1];

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

  cin >> N >> K >> Q;
  REP(i, Q) cin >> A[i];

  ll sum = 0;
  REP(i, Q) ANS[A[i]]++;

  for (int i = 1; i <= N; i++) {
    if (K - (Q - ANS[i]) <= 0) {
      cout << "No" << endl;
    }
    else {
      cout << "Yes" << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 1408
import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))

s = ins()
print(s.replace(",", " "))



Measured memory_bytes: 9108
#include <iostream>
#include<string>
#include<algorithm>
#include<queue>
#include<cmath>
#include<set>
typedef long long int ll;
using namespace std;

class myclass{
public:
    ll my_pow(ll x,ll n);
};

ll myclass::my_pow(ll x,ll n){
    if(n==0){
        return 1;
    }else if(n==1){
        return x;
    }else if(n%2 == 0){
        ll sq = my_pow(x,n/2);
        return (sq*sq) % 1000000007;
    }else{
        ll sq = my_pow(x,(n-1)/2);
        return ( ( (sq*sq)% 1000000007)*x ) %1000000007;
    }
    
}

int main(){
    ll prime = 1000000007;
    ll H,W,A,B;
    cin >> H >> W >> A >> B;
    //i = 1 ~ H+Wまで、(i!)および(i!)^-1を計算する
    ll fctr[200001];
    fctr[0]=1;
    ll inv_fctr[200001];
    for(int i=1;i<=200000;i++){
        fctr[i] = (fctr[i-1]*i) % prime;
    }
    myclass aho;
    inv_fctr[200000] = aho.my_pow(fctr[200000],1000000005);
    for(int i=199999;i>=1;i--){
        inv_fctr[i] = ( inv_fctr[i+1] * (i+1) ) % prime;
    }
    inv_fctr[0]=1;
    //計算終了
    ll ans = 0;
    for(int j=B+1;j<=W;j++){
        int a = j-1;
        int b = H-A-1;
        ll tmp1 = (((fctr[a+b]*inv_fctr[a])%prime)*inv_fctr[b])%prime;
        int c = W-j;
        int d = A-1;
        ll tmp2 = (((fctr[c+d]*inv_fctr[c])%prime)*inv_fctr[d])%prime;
        ll tmp = (tmp1*tmp2)%prime;
        ans = (ans+tmp)%prime;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3328
n, m = list(map(int, input().split()))
# lr_list = list()
l_list = list()
r_list = list()
for _ in range(m):
    l, r = list(map(int, input().split()))
    l_list.append(l)
    r_list.append(r)
    # lr_list.append(list(map(int, input().split())))

min_r = min(r_list)
max_l = max(l_list)
if max_l <= min_r:
    print(min_r - max_l + 1)
else:
    print(0)

Measured memory_bytes: 11056
#include <bits/stdc++.h>
#include <atcoder/all>
typedef long long ll;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REP2(i, a, b) for(int i = a;i <= b;i++)
#define REPR(i, a, b) for(int i = a; i >= b; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define MOD 1000000007
#define PI 3.14159265358979323846
#define vi vector<int>
#define vll vector<ll>
#define vi2 vector<vector<int>>
#define eb emplace_back
#define fi first
#define se second
#define ALL(v) v.begin(), v.end()
#define sz(x) int(x.size())
using namespace std;
using namespace atcoder;
using P = pair<ll,ll>;
const int dx[]{0, 1, 0, -1, -1, -1, 1, 1}, dy[]{1, 0, -1, 0, -1, 1, -1, 1};
#define INT(name) int name;cin >> name;
#define VEC(type,name,n) vector<type> name(n);REP(i,n) cin >> name[i];

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;
}

int main()
{
  ll N,Q;
  cin >> N >> Q;
  dsu d(N);
  REP(i, Q){
    ll t,u,v;
    cin >> t >> u >> v;
    if(t==0){
      d.merge(u,v);
    }else{
      if(d.same(u,v)){
        cout << 1 << endl;
      }else{
        cout << 0 << endl;
      }
    }
  }
}

Measured memory_bytes: 3960
#include <stdio.h>
#include <string.h>

int main(){
	int n, k, counter=1, count=0;
	scanf("%d", &n);
	scanf("%d", &k);
	do{
		if(counter+k<2*counter) counter+=k;
		else counter*=2;
		count++;
		//printf("counter2: %d\n", counter);
	}while(count<n);
	printf("%d\n", counter);
	
	return 0;
}

Measured memory_bytes: 128
import java.io.BufferedReader

fun main() {
    val br = System.`in`.bufferedReader()
    val a = br.readInt()
    print(a + a * a + a * a * a)
}

private const val SPACE_INT = ' '.toInt()
private const val ZERO_INT = '0'.toInt()
private const val NL_INT = '\n'.toInt()

private fun BufferedReader.readInt(): Int {
    var ret = read()
    while (ret <= SPACE_INT) {
        ret = read()
    }
    val neg = ret == '-'.toInt()
    if (neg) {
        ret = read()
    }
    ret -= ZERO_INT
    var read = read()
    while (read >= ZERO_INT) {
        ret *= 10
        ret += read - ZERO_INT
        read = read()
    }

    while (read <= SPACE_INT && read != -1 && read != NL_INT) {
        mark(1)
        read = read()
    }
    if (read > SPACE_INT) {
        reset()
    }
    return if (neg) -ret else ret
}

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

#define rep(i, n) for ( ll i = 0; i < (n); ++i )
#define reps(i, n) for ( ll i = 1; i <= (n); ++i )
#define _rep(i, n) for ( ll i = (n) - 1; i >= 0; --i )
#define _reps(i, n) for ( ll i = n; i > 0; --i )
#define all(x) (x).begin(), (x).end()
#define _all(x) (x).rbegin(), (x).rend()

using namespace std;
using ll =  long long;
using P = pair<ll, ll>;

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

	map<ll, ll> mp;
	rep( i, n ) {
		ll a;
		cin >> a;

		mp[a]++;
	}

	ll rem = 0;
	for ( const auto& tmp : mp ) {
		if ( tmp.second < tmp.first ) rem += tmp.second;
		if ( tmp.second > tmp.first ) rem += (tmp.second - tmp.first);
	}

	cout << rem << endl;

	return 0;
}


Measured memory_bytes: 6272
//"http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_9_C"???PriorityQueue???
//????£?5??????????????°0???
#include <iostream>
#include <queue>
#include <string>
using namespace std;

int main(){
    string command;
    int k;
    priority_queue<int> S;
    while(cin >> command && command != "end"){
        if(command == "insert"){
            cin >> k;
            S.push(k);
        }else if(command == "extract"){
            cout << S.top() << endl;
            S.pop();
        }
    }
}

Measured memory_bytes: 7056
#include <cstdio>
#define maxn 105
#define INF 2147483647
using namespace std;

int a[maxn];

int main(int argc, char** argv)
{
	int n, mx = -1;
	scanf("%d", &n);
	for(int i=0; i<n; i++)
	{
		scanf("%d", a + i);
		if(a[i] > mx) mx = a[i];
	}
	int ans = INF;
	for(int pos=1; pos<=mx; pos++)
	{
		int t = 0;
		for(int i=0; i<n; i++)
			t += (a[i] - pos) * (a[i] - pos);
		if(t < ans) ans = t;
	}
	printf("%d\n", ans);
	return 0;
}

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

using namespace std;

int main() {
	int n, a[101], sum = 0, m, p, x;

	cin >> n;
	for (int i = 1; i <= n; ++i) {
		cin >> a[i];
		sum += a[i];
	}

	cin >> m;
	while (m--) {
		cin >> p >> x;
		cout << sum - a[p] + x << endl;
	}

	return 0;
}

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

int main(){
  int N,i,j,countsub,count;
  count=0;
  countsub=0;
  cin >> N;
  vector<int> a(N);
  for(i=0;i<N;i++){
    cin >> a.at(i);
  }
  vector<int> b(N);
  for(j=0;j<100;j++){
  for(i=0;i<N;i++){
  if(a.at(i)%2==0){
    b.at(i)=0;
    a.at(i)=a.at(i)/2;
  }else{countsub+=1;
       }
  }
  if(countsub==0){
    count+=1;
  }else{break;
       }
  }
  cout << count <<endl;
  
}


Measured memory_bytes: 256
using System;
using System.Linq;

class Program
{
    static void Main()
    {
        int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int A = input[0];
        int B = input[1];
        int C = input[2];
        if (A == B && A != C)
        {
            Console.WriteLine(C);
        }
        else if (A != B && A == C)
        {
            Console.WriteLine(B);
        }
        else
        {
            Console.WriteLine(A);
        }
    }
}


Measured memory_bytes: 13396
#define _CRT_SECURE_NO_WARNINGS
#include<sstream>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<random>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())


class BIT {
	std::vector<int> bit;
public:
	BIT(int size) :bit(size + 1, 0) {}
	void add(int i, int x) {//i番目にx加える
		i++;//BIT添え字は1～ｎだから
		while (i<(int)bit.size()) {
			bit[i] += x;
			i += i&-i;
		}
	}
	int sum(int a)const {//[0,a]の和
		a++;
		int res = 0;
		while (0<a) {
			res += bit[a];
			a -= a&-a;
		}
		return res;
	}
	int sum(int a, int b)const {//[a,b]の合計
		return sum(b) - sum(a - 1);
	}
};



int ans[100000];


vector<pair<int,int>> query[100000];
vector<int> child[100000];
BIT bit(100000);



int N;
int x[100000];
int L, Q;

void dfs(int u) {
	for (auto p : query[u]) {
		ans[p.second] = bit.sum(p.first - 1) + 1;
	}

	bit.add(u, 1);
	for (int v : child[u]) {
		dfs(v);
	}
	bit.add(u, -1);
}


int main() {
	scanf("%d", &N);
	rep(i, N)scanf("%d", x + i);
	scanf("%d%d", &L, &Q);
	rep(i, Q) {
		int a, b;
		scanf("%d%d", &a, &b);
		a--; b--;
		if (a > b)swap(a, b);
		query[a].emplace_back(b, i);
	}
	rep(i,N-1) {
		if (query[i].empty() && child[i].empty())continue;
		int nxt = upper_bound(x, x + N, x[i] + L) - 1 - x;
		child[nxt].push_back(i);
	}
	dfs(N - 1);
	rep(i, Q)cout << ans[i] << endl;

	return 0;
}

Measured memory_bytes: 14848
n = gets.to_i
m = Array.new(n) { Array.new(n, 0) }
n.times do
  u, k, *v_arr = gets.split.map(&:to_i)
  for v in v_arr
    m[u-1][v-1] = 1
  end
end
for u in m
  puts u.join(' ')
end


Measured memory_bytes: 6984
#include<stdio.h>
int main()
{
  long i,n,l[87];
  
  scanf("%ld",&n);
  
   l[0]=2; l[1]=1;
   for(i=2;i<=n;i++)
      l[i]=l[i-2]+l[i-1];
   printf("%ld\n",l[n]);
   
   return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
struct Fast { Fast() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20);} } fast;

long long mod = 1000000007;

long long div(long long a, long long b, long long c){
    return b / c - (a - 1) / c;
}

void print_binary(long long a) {
    for (int i = 31; i >= 0; i--) {
        cout << (a >> i & 1);
    }
    cout << endl;
}


int main() {
    long long m1, m2, d1, d2;
    cin >> m1 >> d1 >> m2 >> d2;
    if (d2 == 1){
        cout << 1 << endl;
    }else{
        cout << 0 << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <cstdio>
#include <cstring>
using namespace std;

int64_t solve(int64_t a, int64_t b)
{
    // cout << a << " " << b << endl;

    if (a > b) return solve(b, a);
    // if (a == b) return a;
    if (a == 0) return -b;

    int64_t t = b / a;
    return solve(b - t * a, a) + t * a * 2;
}

int main()
{
    int64_t n, x; cin >> n >> x;

    cout << solve(x, n - x) + n << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using lint128 = __int128_t;
const lint mod = 998244353;
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountll((lint)(n))
#define fcout cout << fixed << setprecision(15)
#define highest(x) (63 - __builtin_clzl(x))
inline void YES(bool condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
inline void Yes(bool condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
inline void assert_NO(bool condition){ if(!condition){ cout << "NO" << endl; exit(0); } }
inline void assert_No(bool condition){ if(!condition){ cout << "No" << endl; exit(0); } }
inline void assert_minus_1(bool condition){ if(!condition){ cout << -1 << endl; exit(0); } }
lint power(lint base, lint exponent, lint module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ lint root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position mv[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); } string to_string(string x){ return x; }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++) ans += to_string(*i) + " "; if(!ans.empty()) ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
template<class T> T gcd_calc(T a, T b){ if(b){ return gcd_calc(b, a % b); }else{ return a; }}
template<class T> T gcd(T a, T b){ if(a < b) swap(a, b); return gcd_calc(a, b); }
template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct combination{ vector<lint> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } lint C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };
template<class itr> bool next_sequence(itr first, itr last, int max_bound){ itr now = last; while(now != first){ now--; (*now)++; if((*now) == max_bound){ (*now) = 0; }else{ return true; } } return false; }
template<class T> bool chmax(T &a, const T &b){ if(a < b){ a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b){ if(b < a){ a = b; return 1; } return 0; }
inline int at(lint x, int k){ return (x >> k) & 1; }
random_device rnd;
#define rep(i, n) for(int i = 0; i < n; i++)

int main(){
    lint X;
    cin >> X;
    lint coin_500 = X / 500;
    X -= coin_500 * 500;
    cout << coin_500 * 1000 + X / 5 * 5 << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
long long n, a[100006];
int main() {
	cin >> n; for (int i = 0; i < n; i++) cin >> a[i];
	long long m1 = 0, m2 = 0, c1 = 0, c2 = 0;
	for (int i = 0; i < n; i++) {
		c1 += a[i];
		if (i % 2 == 0 && c1 <= 0) { m1 += (1LL - c1); c1 = 1; }
		if (i % 2 == 1 && c1 >= 0) { m1 += (c1 + 1LL); c1 = -1; }
	}
	for (int i = 0; i < n; i++) {
		c2 += a[i];
		if (i % 2 == 1 && c2 <= 0) { m2 += (1LL - c2); c2 = 1; }
		if (i % 2 == 0 && c2 >= 0) { m2 += (c2 + 1LL); c2 = -1; }
	}
	cout << min(m1, m2) << endl;
	return 0;
}

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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define SZ(x) ((int)(x).size())
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 28;
const ll INF64 = 1ll << 55;
const int mod = 1000000007;
//const int mod = 998244353;

template <class T>inline bool chmin(T &a, const T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline bool chmax(T &a, const T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline void line_out(const vector<T> vec) {
  int n = SZ(vec);
  rep(i, n) {
    cout << vec[i];
    if(i < n-1) cout << " ";
  }
  cout << endl;
  return;
}

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
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};

// h(n, r) = c(n+r-1, r)
struct combination
{
  vector<mint> fact, ifact;
  combination(int n) : fact(n + 1), ifact(n + 1)
  {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i)
    fact[i] = fact[i - 1] * i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i)
    ifact[i - 1] = ifact[i] * i;
  }
  mint operator()(int n, int k)
  {
    if (k < 0 || k > n)
    return 0;
    return fact[n] * ifact[k] * ifact[n - k];
  }
};

int main()
{
  int n, k;
  cin >> n >> k;
  combination C(n*2);
  vector<ll> l(n+1), r(n+1);
  rep(i, n+1) {
    l[i] = r[i] = i;
  }
  reverse(ALL(r));
  rep(i, n) {
    l[i+1] += l[i];
    r[i+1] += r[i];
  }

  mint ans = 0;
  for(int d = k; d <= n+1; ++d) ans += r[d-1]-l[d-1]+1;
  cout << ans.x << endl;
}

Measured memory_bytes: 12764
n = int(input())
a = [int(input()) for i in range(n)]

x = 1
y = [0] * n

while y[x-1] != 2 and x != 2:
    y[x-1] += 1
    x = a[x-1]

if x == 2:
    print(y.count(1))
else:
    print(-1)


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

#define int long long

using namespace std;

int a[100001];
int d[100001];
vector <int> g[100001];

void dfs (int v, int par) {
	vector <int> qwe;
	for (auto to : g[v]) {
		if (to == par) continue;
		dfs (to, v);
		qwe.push_back (d[to]);
	}
	sort (qwe.begin (), qwe.end ());
	reverse (qwe.begin (), qwe.end ());
	for (int i = 0;i < qwe.size ();i ++) {
		d[v] = max (qwe[i] + i + 1, d[v]);
	}
}

 main () {
	int n, k = 0;
	cin >> n;
	for (int i = 2;i <= n;i ++) {
		cin >> a[i];
		g[i].push_back (a[i]);
		g[a[i]].push_back (i);
	}
	dfs (1, 0);
	cout << d[1];
	return 0;
}

Measured memory_bytes: 15104
#include <bits/stdc++.h>
using namespace std;
//型に気を付けよう
//a=61
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long  ll;
typedef long double  ld;
typedef pair<int,int> pairii;
const double pi=3.1415926535;
const ll  mod=1000000007;
//桁数指定　cout << fixed << setprecision(2)
int main() {
  int a,b,c,k;
  cin>>a>>b>>c>>k;
  if(a>=k)cout<<k<<endl;
  else if(a+b>=k)cout<<a<<endl;
  else{
    cout<<a-(k-(a+b))<<endl;
  }

}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
#define intt long long int
#define intu unsigned long long int
#define vi vector<int>
#define ii pair<int,int>
#define pb push_back
//#define mp make_pair
#define ff first
#define ss second
#define fast_io ios::sync_with_stdio(0);cin.tie(NULL);std::cout.tie(NULL);
# define PI           3.14159265358979323846 
#define all(a) a.begin(),a.end()
#define for0(i, n) for (int i = 0; i < n; i++)
#define for1(i, n) for (int i = 1; i <= n; i++)
#define loop(i,a,b) for (int i = a; i < b; i++)
#define bloop(i,a,b) for (int i = a ; i>=b;i--)
#define tc(t) int t; cin >> t; while (t--)
int mod = 1000000007;
int gcd(int a, int b) {return b ? gcd(b, a % b) : a;}
int lcm(int a, int b) {return a * b / gcd(a, b); }
intt bpow(intt a,intt b) 
{
  intt res = 1;
  while (b > 0) {
    if (b & 1)res = ((res%mod) * (a%mod))%mod;
      a = ((a%mod) * (a%mod))%mod;
      b >>= 1;
  }
  return res;
}
intt fact(intt n) { 
   if ((n==0)||(n==1))
      return 1; 
   else
      return n*fact(n-1);
}
void go()
{
#ifndef ONLINE_JUDGE
  freopen("inn.txt","r",stdin);
  freopen("ouut.txt","w",stdout);
  #endif
}
///////////U L R D
int dx[4]={0,-1,1,0};
int dy[4]={1,0,0,-1};


int main() 
{ 
    fast_io
    go();
    int n;cin>>n;
    if(n%2)
      cout << n/2+1 <<"\n";
    else
      cout << n/2 <<"\n";
}

/*!
    You are under no obligation to be the same person you were a minute ago,
    You have the right to grow !
*/




















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

typedef long long ll;
#define REP(i, n, m) for(int i = n; i < m; i++)
#define REPR(i, n, m) for(int i = n; i >= m; i--)
#define LREP(i, n, m) for(ll i = n; i < m; i++)
#define LREPR(i, n, m) for(ll i = n; i >= m; i--)

#define P pair<int, int >


const int INF = 1e9 + 1;
const int MOD = 1e9 + 7;



//---functions---//
int gcd(int a, int b){
    if(a < b) swap(a, b);
    return b?gcd(b, a%b):a;
}

int s2i(string num){stringstream ss; ss << num << flush; int n; ss >> n; return n;}
string i2s(int n){stringstream ss; ss << n << flush; return ss.str();}

bool firstCompare(const P& firstElof, const P& secondElof){
    return firstElof.first < secondElof.first;
}
bool secondCompare(const P& firstElof, const P& secondElof){
    return firstElof.second < secondElof.second;
}
//---------------//
//-----class-----//
class UnionFind{
    public:
        vector<ll> par; //parents
        vector<ll> siz; // sizes of set
        vector<ll> rank; // rank of each element 
    UnionFind(ll n): par(n), siz(n, 1LL), rank(n){
        LREP(i, 0, n) par[i] = i;
    }
    //initialization
    /*
    void init(ll n){
        par.assign(n);
        siz.assign(n, 1LL);
        rank.assign(n);
        LREP(i, 0, n) par[i] = i;
    }
    */

    // find the root of x
    ll find(ll x){
        if(par[x] == x) return x;
        else return par[x] = find(par[x]);
    }

    //Unite two set including x or y
    void unite(ll x, ll y){
        x = find(x);
        y = find(y);
        if(x == y) return;
        if(rank[x] < rank[y]){
            par[x] = y;
            siz[y] += siz[x];
        }else{
            par[y] = x;
            siz[x] += siz[y];
            if(rank[x] == rank[y]) rank[x]++;
        }
    }

    //Do x and y belong to the same set?
    bool issame(ll x, ll y){
        return find(x) == find(y);
    }

};

ll N;
int main(){
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    cin >> N;
    cout << (N - 1) * N / 2 << '\n';

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll n;
    cin>>n;
    vector<pair<ll,ll>> v(n);
    for(ll i=0;i<n;i++)
    cin>>v[i].second>>v[i].first;
    sort(v.begin(),v.end());
    ll t=0;
    bool flag=false;
    for(ll i=0;i<n;i++)
    {
        t+=v[i].second;
        if(v[i].first<t)flag=true;
    }
    if(flag)cout<<"No";
    else
    cout<<"Yes";
    return 0;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define LL               long long
#define PB               push_back
using namespace std;

int main(){
    int n,k;cin>>n>>k;
    int a[n];
    for (int i=0;i<n;i++)
        cin>>a[i];
    int dp[n]={0};
    for (int i=1;i<n;i++){
        int mn=INT_MAX;
        for (int j=i-1;j>=0 && j>=i-k;j--){
            int x=abs(a[i]-a[j])+dp[j];
            mn=min(mn,x);
        }
        dp[i]=mn;
    }
    cout<<dp[n-1];
}

Measured memory_bytes: 4400
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int z,s,k,counter=0;
    cin>>k>>s;
    for(int x=0;x<=k;x++)
        for(int y=0;y<=k;y++){
            z=s-(x+y);
            if((z>=0)&&(z<=k))
                counter+=1;
        }
    cout<<counter;
    return 0;
}


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

int main(){

  int a, b, c, n;
  int p[1111], m[1111], k[1111], q[1111];
  int data[333];

  while(cin >> a >> b >> c, a){
    for(int i=332;i;) data[i--] = 2;
    
    cin >> n;
    for(int i=0;i<n;i++) cin >> p[i] >> m[i] >> k[i] >> q[i];
    
    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++){
	if(q[j]) data[p[j]] = data[m[j]] = data[k[j]] = q[j];
	else{
	  if(data[p[j]] == 1 && data[m[j]] == 1) data[k[j]] = 0;
	  if(data[m[j]] == 1 && data[k[j]] == 1) data[p[j]] = 0;
	  if(data[p[j]] == 1 && data[k[j]] == 1) data[m[j]] = 0;
	}
      }
    }
    for(int i=1;i<=a+b+c;i++) cout << data[i] << endl;
  }
  
}

Measured memory_bytes: 1176
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep_inv(i, n, m) for(int i = (int)(n); i > (int)(m); i--)
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vc = vector<char>;
using vvl = vector<vl>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;

int main(){
  ll N;
  cin >> N;
  ll u, v, w;
  vector<vector<pll> > G(N + 1);
  rep(i, N - 1){
    cin >> u >> v >> w;

    G[u].push_back({v, w});
    G[v].push_back({u, w});
  }

  vl vis(N + 1, 0);
  vl dist(N + 1, (ll)pow(10, 16));
  priority_queue<pll, vpll, greater<pll> > que;
  dist[1] = 0;
  que.push({0, 1});

  while(!que.empty()){
    pll top = que.top();
    que.pop();
    vis[top.second] = 1;

    rep(i, G[top.second].size()){
      if(vis[G[top.second][i].first] == 1) continue;

      dist[G[top.second][i].first] = min(dist[G[top.second][i].first], dist[top.second] + G[top.second][i].second);
      que.push({dist[G[top.second][i].first], G[top.second][i].first});
    }
  }

  rep2(i, 1, N + 1) cout << dist[i] % 2 << endl;
  
  return 0;
}


Measured memory_bytes: 9472
//============================================================================
// Name        : hoba.cpp :)
// Author      : (O_O Diab) (Why_not) (el 3AQ)
// Version     :
// Copyright   : please, Don't touch me :(
// Description : problem in C++
// MAIN IDEA   :
//============================================================================
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define rw freopen("input.txt","r",stdin),freopen("output.txt","w",stdout);
#define pb push_back
#define F first
#define S second
#define pf push_front
#define lp(i,a,b) for (int i=a;i<=(int)b;++i)
#define lp2(i,a,b) for (int i=a;i>=b;--i)
#define f(x) return cout<<x<<"\n",0
#define pii pair<int,int>
#define pll pair<ll,ll>
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
#define p(x) cout<<#x<<" = { "<<x<<" } \n"
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define vll vector<pll>
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define EPS 1e-6
// to convert string to number use int a = stoi(string);
// to convert number to string use string s = to_string(int);
#define FAST ios::sync_with_stdio(0),ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define clr(c,x) memset(c,x,sizeof(c));
using namespace __gnu_pbds;
using namespace std;
const ll INFL = 0x3f3f3f3f3f3f3f3fLL;
const int dx[] = { 0, 1, 0, -1, 1, -1, 1, -1 };
const int dy[] = { 1, 0, -1, 0, 1, -1, -1, 1 };
const int N = 2e5 + 5, mod = (int) 1e9 + 7, INF = 0x3f3f3f3f;
int n;
int main() {
#ifdef ONLINE_JUDGE
	FAST
#endif
	cin >> n;
	int l = 1, r = 1e5, ans;
	while (l <= r) {
		ll mid = (l + r) >> 1;
		ll sum = mid * mid + mid;
		sum >>= 1;
		if (sum < n)
			l = mid + 1;
		else
			r = mid - 1, ans = mid;
	}
	f(ans);
	return 0;
}

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

bool judge(int n){
  bool ans = false;
  int count = 0;
  while(n>0){
    count++;
    n/=10;
  };
    
  if(count%2!=0)ans = true;
  return ans;
}

int main(){
    int n;
    cin >> n;
    int ct = 0;
    for(int i=1;i<=n;++i){
      bool tmp = judge(i);
      if(tmp)ct++;
    }
   cout << ct << endl;

    return 0;
}


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

 using namespace std;
 int main() {
   string S;
   cin >> S;
   if (S.at(0) == S.at(1)) {
     if (S.at(2) == S.at(3) && S.at(0) != S.at(2)) cout << "Yes" << endl;
     else cout << "No" << endl;
   }
   else if (S.at(0) == S.at(2)) {
     if (S.at(1) == S.at(3) && S.at(0) != S.at(1)) cout << "Yes" << endl;
     else cout << "No" << endl;
   }
   else if (S.at(0) == S.at(3)) {
     if (S.at(1) == S.at(2) && S.at(0) != S.at(1)) cout << "Yes" << endl;
     else cout << "No" << endl;
   }
   else cout << "No" << endl;
 }


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define pair pair<int,int>
#define ll long long
#define f first
#define se second
using namespace std;
double pi=acos(-1.0);
int main(){
 int n;
  scanf("%d",&n);
  double d[n];
  for(int i=0;i<n;i++)
    scanf("%lf",&d[i]);
  sort(d,d+n);
  double ans=d[0];
  for(int i=1;i<n;i++)
    ans=(ans+d[i])/2.0;
  printf("%.5lf",ans);
}

Measured memory_bytes: 256
n = int(input())
ans = [0 for _ in range(10050)]
for i in range(1,105):
	for j in range(1,105):
		for k in range(1,105):
			v = i*i+j*j+k*k+i*j+j*k+k*i;
			if v<10050:
				ans[v]+=1
for i in range(n):
	print(ans[i+1])

Measured memory_bytes: 9280
# coding: utf-8

import sys
import math
import collections
import itertools
import bisect
INF = 10 ** 13
MOD = 10 ** 9 + 7
def input() : return sys.stdin.readline().strip()
def gcd(x, y) : return x if y == 0 else gcd(y, x%y)
def lcm(x, y) : return (x * y) // gcd(x, y)
def I() : return int(input())
def LI() : return [int(x) for x in input().split()]
def RI(N) : return [int(input()) for _ in range(N)]
def LRI(N) : return [[int(x) for x in input().split()] for _ in range(N)]
def LS() : return input().split()
def RS(N) : return [input() for _ in range(N)]
def LRS(N) : return [input().split() for _ in range(N)]
def PL(L) : print(*L, sep="\n")
def YesNo(B) : print("Yes" if B else "No")
def YESNO(B) : print("YES" if B else "NO")

N, M, X = LI()
CA = LRI(N)

ans = INF
for bit in range(1 << N):
    Ms = [0] * M
    tmp = 0
    for i in range(N):
        if (bit >> i) & 1:
            for j in range(M):
                Ms[j] += CA[i][j+1]
            
            tmp += CA[i][0]
    
    flag = True
    for m in Ms:
        if m < X:
            flag = False
    
    if flag:
        ans = min(ans, tmp)

print("-1" if ans == INF else ans)


Measured memory_bytes: 68736
import math
def gcd(a,b):
  if a < b:
     a,b = b,a
  c = a%b
  if c == 0:
    return b
  return gcd(b,c)

A,B,C,D = map(int,input().split())
x = gcd(C,D)
count = 0
x = int(C*D/x)
a = (B//C)-((A-1)//C)
b = (B//D)-((A-1)//D)
c = (B//x)-((A-1)//x)
ans = B-A+1 - (a+b-c)
print(ans)

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

int a,b,c,d;

int main()
{
	scanf("%d%d%d%d",&a,&b,&c,&d);
	if(abs(a-c) <= d || (abs(a-b) <= d && abs(b-c) <= d)) printf("Yes\n");
	else printf("No\n");
 	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>


char *acl = "ACL";
int i, j;

int main()
{
    scanf("%d", &i);
    if (i > 0) {
        for (j = 0; j < i; j++) {
            printf("%s", acl);
        }
    }
    return 0;
}

Measured memory_bytes: 1688
using System;
using System.Linq;
using System.Collections.Generic;
using System.Numerics;
using static System.Console;

class Solver {
    Scanner sc = new Scanner();

    public void Solve() {
        var N = sc.nextInt();
        var a = sc.ArrayInt(N);
        Array.Resize(ref a, a.Length + 1);
        a[N] = -1;
        var lst = new List<int>();
        var bef = a[0];
        var cnt = 1;
        for (int i = 1; i <= N; i++) {
            if (bef == a[i]) {
                cnt++;
            } else {
                lst.Add(cnt);
                cnt = 1;
            }
            bef = a[i];
        }

        var ans = 0;
        foreach (var i in lst) {
            ans += i / 2;
        }
        WriteLine(ans);
    }


}



class Scanner {
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner() {
        s = new string[0];
        i = 0;
    }

    public string next() {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt() {


        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0) {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong() {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0) {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble() {
        return double.Parse(next());
    }

    public double[] ArrayDouble(int N, double add = 0) {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

class Program {
    static void Main(string[] args) {
        Solver s = new Solver();
        s.Solve();
    }
}

Measured memory_bytes: 13268
#include <bits/stdc++.h>
#define lli long long int
using namespace std;
#define mod 1000000007
#define MOD 1000000037
#define mod1 998244353
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 
#define INF 2e9
#define common cout << "Case #" << wi+1 << ": "  


int main()
{
    int n;
    cin >> n;
    vector<int>v(n);
    lli ans=0;
    for(int i=0;i<n;i++)
        cin >> v[i];
    int m=v[0];
    for(int i=1;i<n;i++)
    {
        if(v[i]>=m)
            m=v[i];
        else
            ans+=(m-v[i]);
    }
    cout << ans << endl;
}

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

using namespace std;

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

typedef long long int ll;


int main()
{
	ios_base :: sync_with_stdio(false);
	cin.tie(NULL);

	string str;
	cin >> str;

	int n = str.size();
	rep1(i , n)
	{
		if(i&1)
		{
			if(str[i-1] == 'L')
			{
				cout << "No";
				return 0;
			}
		}
		else 
		{
			if(str[i-1] == 'R')
			{
				cout << "No";
				return 0;
			}
		}
	}
	cout << "Yes";
	return 0;
}

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

#define MAX_N 100000
#define MAX_A 1000000000
#define INF 100000000000000
typedef long long Int;
int N;
Int A[MAX_N * 2 + 1];

bool C(int p, Int x){
	int lb, ub, mid;
	int ed = p + N;
	
	lb = p; ub = ed;
	while(ub - lb > 1){
		mid = (lb + ub) / 2;
		if(A[mid] - A[p] >= x) ub = mid;
		else lb = mid;
	}
	if(A[ub] - A[p] < x) return false;
	
	p = ub; lb = ub; ub = ed;
	while(ub - lb > 1){
		mid = (lb + ub) / 2;
		if(A[mid] - A[p] >= x) ub = mid;
		else lb = mid;
	}
	if(A[ub] - A[p] < x) return false;
	
	if(A[ed] - A[ub] < x) return false;
	
	return true;
}

Int Max(Int a, Int b){
	return (a > b)? a : b;
}

int main(){
	Int n, res, lb, ub, mid;
	scanf("%d", &N);
	for(int i = 0; i < N; i++){
		scanf("%lld", &n);
		A[i + 1] = A[i] + n;
	}
	for(int i = N + 1; i <= N * 2; i++){
		A[i] = A[i - 1] + A[i - N] - A[i - N - 1];
	}
	
	res = 0;
	for(int i = 1; i <= N; i++){
		lb = 0; ub = INF;
		while(ub - lb > 1){
			mid = (ub + lb) / 2;
			if(C(i - 1, mid)) lb = mid;
			else ub = mid;
		}
		
		res = Max(res, lb);
	}
	
	printf("%lld\n", res);
	
	return 0;
}

Measured memory_bytes: 2584
#include<iostream>
#include<cstdio>
#include<algorithm>
#define p 1000000007
using namespace std;
int n,lasa[101010],lasb[101010];
long long a[101010],A,B,sum[101101];
int main()
{
	scanf("%d%lld%lld",&n,&A,&B);
	if(A>B) swap(A,B);
	for(int i=1;i<=n;i++)
	{
		scanf("%lld",&a[i]);
		if(i>2&&a[i]-a[i-2]<A)
		{
			puts("0");
			return 0;
		}
	}
	lasa[1]=1;
	a[0]=-0x7f7f7f7f7f7f7f7f;a[n+1]=0x7f7f7f7f7f7f7f7f;
	for(int i=2;i<=n+1;i++)
	{
		if(a[i]-a[i-1]>=A)
			lasa[i]=lasa[i-1];
		else lasa[i]=i;
		lasb[i]=upper_bound(a,a+i+1,a[i]-B)-a-1;
	}
	sum[0]=1;
	for(int i=1;i<=n+1;i++)
	{
		int l=max(0,lasa[i-1]-1),r=lasb[i];
		long long x;
		if(l>r) x=0;
		else
		{
			if(l==0)
				x=sum[r];
			else x=(sum[r]-sum[l-1]+p)%p;
		}
		sum[i]=(sum[i-1]+x)%p;
	}
	printf("%lld\n",(sum[n+1]-sum[n]+p)%p);
	return 0;
}

Measured memory_bytes: 2560
#include<stdio.h>
int main()
{
	int n, m;
	scanf("%d %d", &n, &m);
	int i, j;
	int k[11], s[11][11];
	for (i = 0; i < m; i++)
	{
		scanf("%d", &k[i]);
		for (j = 0; j < k[i]; j++)
			scanf("%d", &s[i][j]);
	}
	int p[11];
	for (i = 0; i <m; i++)
		scanf("%d", &p[i]);
	int ans = 0;
	int q, max = 1;
	q = n;
	while (q > 0)
	{
		q--;
		max *= 2;
	}
	int w[11], r;
	for (i = 0; i < 11; i++)
		w[i] = 0;
	int count, x;
	for (q = 0; q < max; q++)
	{
		r = q;
		for (i = 0; i < n; i++)
		{
			w[i] = r % 2;
			r /= 2;
		}
		x = 0;
		for (i = 0; i < m; i++)
		{
			count = 0;
			for (j = 0; j < k[i]; j++)
				if (w[s[i][j] - 1] == 1)
					count++;
			count %= 2;
			if (p[i] != count)
			{
				x++;
				break;
			}
		}
		if (x == 0)
			ans++;
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 128