akhauriyash/Code-Regression huggingface dataset:
// Template from https://techracho.bpsinc.jp/jhonda/2019_08_05/78537

// input macro for competive-programming from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };

    ($iter:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, bytes) => {
        read_value!($iter, String).into_bytes()
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    use std::io::Read;
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();

    println!("{}", solve(&s));
}

macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}

test! {
r#"a b c"# => r#"ABC"#,
}

fn solve(src: &str) -> String {
    input! {
        source = src,
        a: String,
        b: String,
        c: String,
    }

    let mut ans = "".to_string();
    ans.push(a.to_uppercase().chars().nth(0).unwrap());
    ans.push(b.to_uppercase().chars().nth(0).unwrap());
    ans.push(c.to_uppercase().chars().nth(0).unwrap());

    ans.to_string()
}

Measured memory_bytes: 4352
# Allocation
from collections import deque

n, k = map(int, input().split())
W = [int(input()) for _ in range(n)]


def can_load(P):
    num_track = 1
    load = 0
    for w in W:
        if w > P:
            return False

        if load + w > P:
            if num_track == k:
                return False

            num_track += 1
            load = w

        else:
            load += w

    return True


def binary_search():
    top = 0
    bottom = sum(W)+1

    while top < bottom:
        mid = (top+bottom)//2

        if can_load(P=mid):
            bottom = mid
        else:
            top = mid + 1

    return top


print(binary_search())



Measured memory_bytes: 9972
#include "bits/stdc++.h"
using namespace std;
///////////////////////////////////////////
const long long int INF = 1LL<<60;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rep(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
#define p_queue(v) priority_queue<v, vector<v>, greater<v> >
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////

ll n,k;
Vi a;

vector<bool> bl;
deque<ll> tmp;
bool flg = false;
deque<ll> ck(ll num){
    deque<ll> v;
    if(bl[num]){
        v.pb(num);
        return v;
    }else{
        bl[num] = true;
        v = ck(a[num]);
        if(v[v.size()-1] == num){
            flg = true;
        }
        if(!flg)v.push_front(num);
        if(flg)tmp.push_front(num);
        return v;
    }
}

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(30);
    cin>>n>>k;
    a.resize(n);
    bl.resize(n,false);
    rep(i,n){
        cin>>a[i];
        a[i]--;
    }
    ll ans = 0;
    deque<ll> dq = ck(0);
    ll siz = dq.size();
    if(k<tmp.size()){
        ans = tmp[k];
    }else{
        k -= tmp.size();
        k %= siz;
        ans = dq[k];
    }
    print(ans+1);
    return 0;
}

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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { cout << #a << " = " << a << endl; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }

typedef long long ll;
int const inf = 1<<29;

void ng() {
  cout << 0 << endl;
  exit(0);
}

namespace math { namespace integer {

template<class value_type> value_type mod_mul(value_type x, value_type k, ll m) { if(k == 0) { return 0; } if(k % 2 == 0) { return mod_mul((x+x) % m, k/2, m); } else { return (x + mod_mul(x, k-1, m)) % m; } }
template<class value_type> value_type mod_pow(value_type x, value_type n, ll mod) { if(n == 0) { return 1; } if(n % 2 == 0) { return mod_pow(mod_mul(x, x, mod) % mod, n / 2, mod); } else { return mod_mul(x, mod_pow(x, n - 1, mod), mod); } }
template<class value_type> value_type extgcd(value_type a, value_type b, value_type& x, value_type& y) { value_type d = a; if(b != 0) { d = extgcd(b, a%b, y, x); y -= (a / b) * x;} else { x = 1, y = 0; } return d; }
template<class value_type> value_type mod_inverse(value_type x, ll mod) { return mod_pow(x, value_type(mod-2), mod); /* use fermat */ }
template<class value_type> value_type mod_inverse_composite_num_mod(value_type a, ll mod) { value_type x, y; extgcd(a, mod, x, y); return (mod + x % mod) % mod; }

}}
using namespace math::integer;

constexpr int MOD = 1e9+7;

int main() {

  int N; cin >> N;
  vector<int> A(N);
  rep(i, N) {
    scanf("%d", &A[i]);
  }

  int zcnt = 0;
  rep(i, N) {
    zcnt += A[i] == 0;
    if(zcnt > 1) ng();
    if(zcnt == 1 && (N & 1) == 0) ng();
  }

  if(zcnt < 1 && N % 2 == 1) ng();

  map<int, int> mp;

  rep(i, N) {
    mp[A[i]]++;
  }

  for(auto e: mp) {
    if((e.first == 0 && e.second != 1) || (e.first > 0 && e.second != 2)) ng();
  }

  ll ans = 1;

  rep(i, N / 2) {
    ans *= 2LL;
    ans %= MOD;
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3584
n,x = gets.chomp.split(" ").map(&:to_i)
a = gets.chomp.split(" ").map(&:to_i)
b = Marshal.load(Marshal.dump(a))
ans = 10**13
for i in 0..n-1
  for j in 0..n-1
    b[j] = [b[j],a[(j-i)%n]].min
  end
  ans = [ans,b.inject(:+)+x*i].min
end
puts ans

Measured memory_bytes: 1916
#include<iostream>
#include<fstream>
#include<vector>
#include<cstdio>

using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n)   REP(i,0,n)
#define fin cin
#define N 0
#define E 1
#define S 2
#define W 3
int score[255];

pair<int,int> trick(char led,int *val,char *suit,char dealer){
  bool flag=false;//if true trump

  rep(i,4){
    if ( led == suit[i]){flag=true;}
  }

  if (flag == false)led=dealer;

  int who=-1,ret=0;
  rep(i,4){
    if ( suit[i]==led && val[i]>ret)ret=val[i],who=i;
  }
  return make_pair( who,1);
}

void solve(vector<string> *data,char led){
  int ans[2]={0};
  int next=N;
  rep(i,13){
    char card[4];
    int val[4];
    rep(j,4){
      if ( isdigit(data[j][i][0] ))val[j]=data[j][i][0]-'0';
      else val[j]=score[data[j][i][0]];
      card[j]=data[j][i][1];
    }
    pair<int,int> ret=trick(led,val,card,card[next]);
    next=ret.first;
    ans[ret.first%2]+=ret.second;
  }

  if ( ans[0]>ans[1]){
    cout << "NS " << ans[0]-6<<endl;
  }else {
    cout << "EW " << ans[1]-6<<endl;
  }

}


main(){
  score['T']=10;
  score['J']=11;
  score['Q']=12;
  score['K']=13;
  score['A']=14;
  char a;
  while(cin>>a && a != '#'){
    vector<string> in[4];
    rep(i,4){
      rep(j,13){
        string t;
        cin>>t;
        in[i].push_back(t);
      }
    }
    solve(in,a);
  }

}

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

int main()
{
int a[3],k;

cin>>a[0]>>a[1]>>a[2]>>k; 
sort(a,a+3);

while(k--)
{
   
    a[2]*=2;
}
cout<<a[0]+a[1]+a[2]<<endl;
     
return 0;
}


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

#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define for1(i, n) for (int i = 1; i <= int(n); ++i)
#define ms(a, x) memset(a, x, sizeof(a))
#define F first
#define S second
#define all(x) (x).begin(),(x).end()
#define SZ(x) int(x.size())
#define pb push_back

using namespace std;
using ll=long long;
using pii= pair<int, int>;
mt19937 gen(chrono::steady_clock::now().time_since_epoch().count());

int dp[105][105];
void cmin(int& a,int b){
    if(b<a) a=b;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n,m;
    cin>>n>>m;
    vector<string> a(n);
    for(auto& it:a) cin>>it;
    ms(dp,0x3f);
    dp[0][0]=a[0][0]=='.'?0:1;
    forn(i,n) forn(j,m){
        if(i) cmin(dp[i][j],dp[i-1][j]+(a[i][j]!=a[i-1][j]));
        if(j) cmin(dp[i][j],dp[i][j-1]+(a[i][j]!=a[i][j-1]));
    }
    if(a[n-1][m-1]=='#') dp[n-1][m-1]++;
    cout<<dp[n-1][m-1]/2;
    return 0;
}



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

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

	for (int x = 0; x <= b * 100; x++)
	{
		if (x * 8 / 100 == a && x * 10 / 100 == b)
		{
			cout << x << endl;
			return 0;
		}
	}

	cout << -1 << endl;

	return 0;
}

Measured memory_bytes: 384
#include <iostream>
using namespace std;
 
int main()
{
    int debt = 100000;
    int n;
    cin >> n;
 
    for (int i = 0; i < n; ++i) {
        debt *= 1.05;
        debt += (debt % 1000 != 0)? 1000 : 0;
        debt -= debt % 1000;
    }
    cout << debt << endl;
 
    return 0;
}

Measured memory_bytes: 3076
#include <iostream>
#include <string>
#include <algorithm>
#define ERROR 1e-10
using namespace std;

void dict(string s[], double a[], int n) {
  for (int i = 0; i < n - 1; i++) {
    if (-ERROR < a[i] - a[i + 1] && a[i] - a[i + 1] < ERROR) {
      int t;
      for (int j = i; j < n - 1; j++) {
	if (!(-ERROR < a[j] - a[j + 1] && a[j] - a[j + 1] < ERROR)) {
	  t = j;
	  break;
	}
	if (j == n - 2) t = n - 1;
      }
      sort(s + i, s + t + 1);
    }
  }
}

void mysort(string s[], double a[], int n) {
  for (int i = 0; i < n; i++) {
    for (int j = i; j > 0; j--) {
      if (a[j - 1] < a[j]) {
	swap(a[j - 1], a[j]);
	string t = s[j - 1];
	s[j - 1] = s[j];
	s[j] = t;
      }
    }
  }
}

int main() {
  while (true) {
    int n;
    cin >> n;
    if (n == 0) return 0;

    string l[n];
    int p[n];
    double info[n][8];

    for (int i = 0; i < n; i++)
      cin >> l[i] >> p[i] >> info[i][0] >> info[i][1] >> info[i][2] >> info[i][3] >> info[i][4] >> info[i][5] >> info[i][6] >> info[i][7];

    double time[n];
    for (int i = 0; i < n; i++) {
      time[i] = info[i][0] + info[i][1] + info[i][2] + (info[i][3] + info[i][4]) * info[i][7];
    }

    double gain[n];
    for (int i = 0; i < n; i++)
      gain[i] = info[i][5] * info[i][6] * info[i][7] - p[i];
    
    double eff[n];
    for (int i = 0; i < n; i++)
      eff[i] = gain[i] / time[i];

    mysort(l, eff, n);
    dict(l, eff, n);
    
    for (int i = 0; i < n; i++)
      cout << l[i] << endl;
    cout << '#' << endl;
  }
}

Measured memory_bytes: 3212
#include <bits/stdc++.h>
using namespace std;
 
int main() {

  int N,C,K;

  cin >>  N >> C >> K;

  vector<int> T(N);

  for(int i=0;i<N;i++) cin >> T.at(i);
  
  sort(T.begin(),T.end());

  if(C==1){
    cout << N << endl;
    return 0;
  }//バスに一人しか乗れないとき

  int ans=0;

  for(int i=0;i<N;){
    int count=1;

    if(i==N-1){
      ans++; break;
    }

    while(T.at(i+count)<=T.at(i)+K){
      count++;
      if(count==C||i+count==N) break;
    }
    i+=count;
    ans++;
  }

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

Measured memory_bytes: 640
#include <bits/stdc++.h> 
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define size_of_array(array) (sizeof(array)/sizeof(array[0]))
#define MAX 100005
#define DEBUG 0 
#define LIMIT (LONG_MAX / 10)
#define POSITIVE_LAST_D (LONG_MAX % 10)
using ll =long long;
using namespace std;
using Graph=vector<vector<int>>;

int main(){
    ll h;
    cin>>h;

    ll cnt=1;
    ll temp=0;
    while(1){
        if(h==1){
            break;
        }
        h=h/2;
        temp++;
        cnt+=pow(2,temp);
    }
    cout<<cnt<<endl;
    
    return 0;
}



Measured memory_bytes: 256
from sys import stdin
# import math
# import numpy as np
# N = int(stdin.readline().rstrip().split()[0])
# A = [int(x) for x in stdin.readline().rstrip().split()]
# N, X = [int(x) for x in stdin.readline().rstrip().split()]
# S = [int(x) for x in stdin.readline().rstrip().split()]
A, B = [int(x) for x in stdin.readline().rstrip().split()]

if A == B:
  print(A*2)
elif A>B:
  print(2*A-1)
else:
  print(2*B-1)

Measured memory_bytes: 3060
h,w=map(int,input().split())
l=[[] for i in range(h)]
g=[]
r=[]
ans=[[] for i in range(h)]
for i in range(h):
    l[i]=list(input())
for i in range(h):
    if not all(l[i][j]=="." for j in range(w)):
        g.append(i)

for x in range(w):
    if not all(l[j][x]=="." for j in range(h)):
        
        r.append(x)
for i in g:
    for j in r:
        ans[i].append(l[i][j])
for i in g:
    print("".join(ans[i]))

    
               


Measured memory_bytes: 9212
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const ll MOD = 1e9+7;
ll LLINF = 1LL << 60;
int INF = INT_MAX;

int main(){
    ll n,m,x; cin>>n>>m>>x;
    vector<ll> price(n);
    vector<vector<ll>> a(n,vector<ll>(m,1));

    rep(i,0,n){
        cin>>price[i];
        rep(j,0,m){
            cin>>a[i][j];
        }
    }

    ll ans=INF;
    bool possible=false;
    rep(bit,0,1LL<<n){
        vector<ll> rikai(m,0);
        ll p=0;
        rep(i,0,n){
            if(bit & (1LL<<i)){
                rep(j,0,m){
                    rikai[j]+=a[i][j];
                }
                p+=price[i];
            }
        }
        bool ok=true;
        rep(i,0,m){
            if(rikai[i]<x) ok=false;
        }
        if(ok){
            possible=true;
            ans=min(ans,p);
        }
    }
    if(possible) cout<<ans<<endl;
    else cout<<-1<<endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define rt "\n"
#define sp " "
#define test1 cout << "test1" << endl;
#define test2 cout << "test2" << endl;
#define fixprecision(n) fixed; cout << setprecision(n)
#define kyopro ios::sync_with_stdio(false);cin.tie(NULL);
#define MOD 1000000007
#define rep(i, s, N) for(ll i{s}; i < N; i++)
using namespace std;
using ll = long long;
using iikae = ll&;
using ld = long double;
using P = pair<ll,ll>;

int main(){
  kyopro;
  ll A, P;
  cin >> A >> P;
  cout << (A*3 + P) / 2 << rt;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define UM unordered_map
#define ALL(a) (a).begin(), (a).end()
typedef vector<ll> vi;
typedef vector<vector<ll>> vvi;
typedef pair<ll, ll> pii;
const long long INF = 1LL << 58;
struct Edge
{
    ll s, t, d;
};
typedef vector<vector<Edge>> Graph;
typedef vector<pii> vpii;
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}

signed main()
{
    int N;
    cin >> N;
    int a, b;
    int num = 1;
    int ans = 0;
    a = 0;
    REP(i, N)
    {
        cin >> b;
        if (a == b)
            num++;
        else
        {
            ans += num / 2;
            num = 1;
        }
        a = b;
    }
    ans += num / 2;
    cout << ans << endl;
    //system("pause");
}

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

struct node{
  int key;
  struct node *parent,*left,*right;
};

struct node *root,*NIL;
void insert(int);
struct node* search(struct node*, int);
void delete(struct node*);
void Inorder(struct node*);
void Preorder(struct node*);


void insert(int);
int main(){
  int i,num,value;
  char command[10];
  struct node  *found;
  scanf("%d",&num);
  for(i=0;i<num;i++){
    scanf("%s",command);
    if(command[0]=='i'){           /*mean insert*/
      scanf("%d",&value);
      insert(value);
    }
    else if(command[0]=='f'){     /*mean find*/
      scanf("%d",&value);
      found=search(root,value);
      if(found!=NIL) printf("yes\n");
      else printf("no\n");
    }

    else if(command[0]=='d'){     /*mean delete*/
      scanf("%d",&value);
      delete(search(root,value));
    }
                       
    else if(command[0]=='p'){      /*mean print*/
      Inorder(root);
      printf("\n");
      Preorder(root);
      printf("\n");
    }
  }
  return 0;
}
    
void insert(int k){
  struct node *x=root,*y=NIL,*z;
  z=(struct node*)malloc(sizeof(struct node));
  z->key=k;
  z->left=NIL;
  z->right=NIL;
  while(x!=NIL){
    y=x;
    if(z->key < x->key)x=x->left;
    else x=x->right;
  }
  z->parent=y;
  if(y==NIL) root=z;
  else{
    if(z->key<y->key) y->left=z;
    else y->right=z;
  }
}
struct node* search(struct node* x, int value){
  while(x!=NIL && value!=x->key){
    if(value<x->key) x=x->left;
    else x=x->right;
  }
  return x;
}

void delete(struct node *x){
  struct node *y,*z;  /*y is delete object and z is its child*/
  if(x->left==NIL || x->right==NIL) y=x;
  else {
    y=x->right;
    while(y->left!=NIL) y=y->left;
  }
  
  if(y->left!=NIL) z=y->left;
  else z=y->right;
  if(z!=NIL) z->parent=y->parent;
  if(y->parent==NIL) root=z;
  else{
    if(y==y->parent->left) y->parent->left=z;
    else y->parent->right=z;
  }
  if(y!=x) x->key=y->key;
  free(y);
}

  
void Inorder(struct node *x){
  if(x==NIL) return;
  Inorder(x->left);
  printf(" %d",x->key);
  Inorder(x->right);
}



void Preorder(struct node *x){
  if(x==NIL) return ;
  printf(" %d",x->key);
  Preorder(x->left);
  Preorder(x->right);
}



Measured memory_bytes: 20524
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,S,H,J,I;
  cin >> N; 
   S = N / 1000;
   N = N % 1000;
   H = N / 100;
   N = N % 100;
   J = N / 10;
   I = N % 10;
  if (S == H && H == J ) {
    cout << "Yes" << endl;
   }
  else if (H ==J && J == I) {
    cout <<  "Yes" << endl;
   }
  else {
    cout << "No" << endl;
   }
}

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

using namespace std;

#define forn(i, x, n) for (int i = int(x); i <= int(n); ++i)
#define for1(i, n, x) for (int i = int(n); i >= int(x); --i)
#define F first
#define S second
#define pb push_back

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

const int N = 2e6 + 1;
const ll INF = 1e18 + 9;
const int B = 1e9 + 7;

int n, k;
vi g[N];
int ans = 0;

int dfs(int x, int p) {
    int mx = 0;
    for (auto to : g[x])
        mx = max(mx, dfs(to, x));
    if (x == 1) return 0;
    if (mx == k - 1) {
        if (p != 1) ++ans;
        return 0;
    }
    return mx + 1;
}

int main() {
    #ifdef black
    freopen("in", "r", stdin);
    #endif // black
    ios_base :: sync_with_stdio(0);
    cin.tie(0);

    cin >> n >> k;
    forn(i, 1, n) {
        int p;
        cin >> p;
        if (i == 1) {
            if (p != 1) ++ans;
            continue;
        }
        g[p].pb(i);
    }
    dfs(1, 1);
    cout << ans << "\n";

    return 0;
}


Measured memory_bytes: 54912
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<numeric>
#include<map>
#include<unordered_map>
#include<queue>
#include<deque>
 
using namespace std;
using ll=long long;
#define rep(i,n)  for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()
 
#define MOD 1000000007

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

    ll a[n];
    rep(i, n)cin >> a[i];

    ll cnt[100010] = {};
    ll ans = 1;
    rep(i, n){
        ll t = a[i];
        if(t == 0)ans = (ans*(3-cnt[0]))%MOD;
        else ans = (ans*(cnt[t-1]-cnt[t]))%MOD;
        cnt[t]++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 1792
#include <stdio.h>

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

using namespace std;

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

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

#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)

typedef long long ll;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    // input
    ll N, A_i, sum = 0, res = 0;
    cin >> N;
    map<ll, ll> mp;
    mp[0] = 1;

    for (ll i = 0; i < N; ++i) {
        cin >> A_i;
        sum += A_i;      // 累積和の計算
        res += mp[sum];  // key がなければ 0 を返す
        mp[sum]++;
    }

    cout << res << "\n";

    return 0;
}


Measured memory_bytes: 12800
#include<bits/stdc++.h>
#define ll long long 
#define ld long double
#define X first
#define Y second
#define pb push_back
#define max_el(x) max_element(x.begin(),x.end())-x.begin()
#define min_el(x) min_element(x.begin(),x.end())-x.begin()
#define mp make_pair
#define endl '\n'
#define fastread ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
// DONT USE MEMSET, USE VECTORS

ll mod = 1e9+7;

ll fpow(ll a, ll b, ll md){
	ll res = 1;
	a = (a%md);
	while(b>0){
		if(b%2==1){
			res = (res*a)%md;
		}
		b = b/2;
		a = (a*a)%md;
	}
	return res%md;
}

void solve(){
	int n;
	cin>>n;
	map<int,int> pf;
	for(int i=1;i<=n;i++){
		int p = i;
		for(int j=2;j*j<=p;j++){
			while(p%j == 0){
				pf[j] += 1;
				p/=j;
			}
		}
		if(p>1) pf[p] += 1;
	}	
	ll su = 1;
	for(auto x:pf){
		su *= x.Y+1;
		su %= mod;
		// cout<<x.X<<" "<<x.Y<<endl;
	}
	cout<<su<<endl;

}

int main(){
	fastread;
	int t = 1;
	// cin>>t;
	for(int i=1;i<=t;i++){
		// cout<<"Case #"<<i<<": ";
		solve();
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vi64 = vector<int64_t>;
using vvi64 = vector<vi64>;
#define rep(i, n) for (int64_t i = 0; i < (n); ++i)
#define repe(i, n) for (int64_t i = 0; i <= (n); ++i)
#define reps(i, s, n) for (int64_t i = (s); i < (n); ++i)
#define repse(i, s, n) for (int64_t i = (s); i <= (n); ++i)
#define repr(i, n) for (int64_t i = (n); i >= 0; --i)
#define all(xs) (xs).begin(), (xs).end()
#define pp_vec(xs) rep (i, (xs).size()) if { (i) cout << endl; cout << (xs)[i] << " "; };
const int64_t inf = (int64_t)1e18;
const int64_t mod = (int64_t)1e9 + 7;


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

  int N; cin >> N;
  vector<pair<string, int>> sp(N);
  vector<int> ans(N);
  rep (i, N) {
    string S; int P; cin >> S >> P;
    sp[i] = make_pair(S, -P);
    ans[i] = i;
  }
  sort(all(ans), [&](int i, int j){ return sp[i] < sp[j]; });
  rep (i, N) cout << ans[i] + 1 << endl;

  return 0;
}

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

const ll mx = 1e18;

int main(){
	int n;
	cin >> n; 	
  	ll ans = 1;
  	bool over = false;
  
   	rep(i, n){
    	ll a;
      	cin >> a;
      
      	if(a == 0){
        	cout << 0 << endl;
          	return 0;
        }
      
      	if(over || mx/ans < a){
			over = true;
        }
      
      	ans *= a;
    }
  
  	if(over) ans = -1;
  	cout << ans << endl;
}

Measured memory_bytes: 3604
S = input()
m = 999
for i in range(len(S) - 2):
    if abs(int(S[i]) * 100 + int(S[i + 1]) * 10 + int(S[i + 2]) - 753) < m:
        m = abs(int(S[i]) * 100 + int(S[i + 1]) * 10 + int(S[i + 2]) - 753)
print(m)


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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
 
#define nl '\n'
 
#define y1 aza_ibagaliev
 
#define f first
#define s second
	
#define ed end()
#define bg begin()
#define rbg rbegin()
 
#define rv reverse
#define mp make_pair
#define pb push_back
#define ppb pop_back
#define ppf pop_front
 
#define sz size()
#define all(x) x.bg, x.ed
 
#define pll pair < ll, ll >
#define pii pair < int, int >
 
#define sqr(x) ((x) * 1ll * (x))
#define sqrd(x) ((x) * 1.0 * (x))
 
#define speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
 
#define rnl cout << "----------------------------------------" << nl
 
#define bit __builtin_popcount
 
inline ll bip(ll x, ll n, ll mod){ll res=1;while(n){if(n & 1){res=(res*x)%mod;}x=(x*x)%mod;n>>=1;}return res;}
        	
const int ppr = 257;
const ll INF = 2e18;
const int inf = 2e9;
const int mod = 1e9 + 7;
const int N = 1e5 + 123;
const ld pi = 3.1741592653589793238462643;
 
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};

int n, k, a[N], dp[111][N], s[N];

main() {             	
//  freopen(".in", "r", stdin);
//  freopen(".out", "w", stdout);

//	srand(time(NULL));

	scanf("%d%d", &n, &k);

	for(int i = 1; i <= n; i++)
		scanf("%d", &a[i]);

	for(int i = 0; i <= a[1]; i++)
		dp[1][k - i] = s[k - i] = 1;
	for(int i = k; i >= 0; i--)
		s[i] += s[i + 1];
	for(int i = 2; i <= n; i++) {
		for(int j = k; j >= 0; j--) {
			int l = j, r = min(k, j + a[i]);
//			if(i == 2) cout << l << ' ' << r << ' ' << s[l] << ' ' << s
			dp[i][j] = (dp[i][j] + (s[l] - s[r + 1] + mod)) % mod;
		}
		for(int j = k; j >= 0; j--)
			s[j] = (s[j + 1] + dp[i][j]) % mod;
	}

/*	for(int j = 0; j <= k; j++, cout << nl)
		for(int i = 1; i <= n; i++)
			cout << dp[i][j] << ' ';
*/
	cout << dp[n][0];
     
    return 0;                                        
}            

Measured memory_bytes: 40832
#include <bits/stdc++.h>
using namespace std;
using lint = long long;

template <typename T>
vector<T> dijkstra(int s, vector<vector<pair<int, T>>> &G) {
    const T inf = numeric_limits<T>::max();
    using P     = pair<T, int>;
    int n       = G.size();
    vector<T> d(n, inf);
    priority_queue<P, vector<P>, greater<P>> q;
    d[s] = 0;
    q.emplace(d[s], s);
    while (!q.empty()) {
        P p = q.top();
        q.pop();
        int v = p.second;
        if (d[v] < p.first)
            continue;
        for (auto &e : G[v]) {
            int u = e.first;
            T c   = e.second;
            if (d[u] > d[v] + c) {
                d[u] = d[v] + c;
                q.emplace(d[u], u);
            }
        }
    }
    return d;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    lint h, w, k;
    cin >> h >> w >> k;
    lint x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    x1--, y1--, x2--, y2--;
    vector<vector<char>> c(h, vector<char>(w));
    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            cin >> c[i][j];
        }
    }
    lint n          = h * w;
    const int dx[4] = {-1, 1, 0, 0};
    const int dy[4] = {0, 0, -1, 1};
    auto inside     = [&](int y, int x) { return 0 <= y && y < h && 0 <= x && x < w; };
    auto idx        = [&](int r, int c) { return r * w + c; };
    const lint inf  = numeric_limits<lint>::max();
    using P         = pair<lint, int>;
    vector<lint> d(n, inf);
    priority_queue<P, vector<P>, greater<P>> q;
    d[idx(x1, y1)] = 0;
    q.emplace(d[idx(x1, y1)], idx(x1, y1));
    while (!q.empty()) {
        P p = q.top();
        q.pop();
        int v = p.second;
        if (d[v] < p.first)
            continue;
        int cx = v / w;
        int cy = v % w;
        for (int l = 0; l < 4; ++l) {
            int ny = cy;
            int nx = cx;
            for (int m = 0; m < k; ++m) {
                ny += dy[l];
                nx += dx[l];
                if (!inside(nx, ny))
                    break;
                if (c[nx][ny] == '@')
                    break;
                if (d[idx(nx, ny)] > d[v] + 1) {
                    d[idx(nx, ny)] = d[v] + 1;
                    if (nx == x2 && ny == y2) {
                        cout << d[idx(nx, ny)] << "\n";
                        return 0;
                    }
                    q.emplace(d[idx(nx, ny)], idx(nx, ny));
                } else if (d[idx(nx, ny)] <= d[v]) {
                    break;
                }
            }
        }
    }
    if (d[idx(x2, y2)] == inf) {
        cout << -1 << "\n";
    } else {
        cout << d[idx(x2, y2)] << "\n";
    }
    return 0;
}


Measured memory_bytes: 14024
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; (i) < (n); (i)++)
using namespace std;
using Graph = vector<vector<int>>;
using P = pair<long, long>;

long modpow(long a, long n, long mod) {
    long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

// a^{-1} mod を計算する
long modinv(long a, long mod) {
    return modpow(a, mod - 2, mod);
}

struct compare1 { 
    bool operator()(const pair<long, long>& value,  
                                const long& key) 
    { 
        return (value.first < key); 
    } 
    bool operator()(const long& key,  
                    const pair<long, long>& value) 
    { 
        return (key < value.first); 
    } 
}; 

int main()
{
    int N; cin >> N;
    int A[200005];
    REP(i, N) cin >> A[i];
    long freq[200005];
    REP(i, N+1) freq[i] = 0;
    REP(i, N) freq[A[i]]++;
    //REP(i, N) cout << freq[i] << " ";
    //cout << endl;
    long ans = 0;
    REP(i, N) ans += freq[i+1] * (freq[i+1] - 1) / 2;
    REP(i, N){
        if(freq[A[i]] != 0) cout << ans - freq[A[i]] * (freq[A[i]] - 1) / 2 + (freq[A[i]]-1)*(freq[A[i]]-2)/2 << endl;
        else cout << ans << endl;
    }

    return 0;
}



Measured memory_bytes: 4992
#include <bits/stdc++.h>
 using namespace std;
  int main()
{
	 long long X;
	 cin >> X;
	 long long P = 100, step = 0;
	 while (P < X)
	{
		 P += P / 100;
		 step++;
		
	}
	cout << step << endl;
	 return 0;
	
}


Measured memory_bytes: 3620
#include<iostream>
#include<cmath>
#include<vector>
#include<string>
typedef unsigned long long ull;
#define rep(i,a) for(int i=0;i<a;i++)
#define loop(i,a,b) for(int i=a;i<b;i++)
using namespace std;
const double eps = 1e-10;
const double pi = acos(-1);
const double inf = (int)1e8;

void solve(){
  vector<vector<char> > maze(8,vector<char>(8));
  rep(i,8)rep(j,8)cin>>maze[i][j];
  int rand = 0;
  
  rep(i,3){
    vector<vector<char> >  move(8,vector<char>(8));
    cout<<(rand+=90)<<endl;
    
    rep(i,8)rep(j,8)
	move[i][j]=maze[7-j][i];
    rep(i,8){
      rep(j,8)cout<<move[i][j];
      cout<<endl;
    }
    maze=move;
    //if(maze==move)cout<<"OK!"<<endl;
  }
}

int main(void){
  solve();
  return 0;
}

Measured memory_bytes: 1200
#include<bits/stdc++.h>
using namespace std;
string s;
bool isPalindrome(int l, int r) {
	while(l<=r) {
      	if (s[l] != s[r]) {
        	cout << "No";
          	return false;
        }
    	l++;
      	r--;
    }
  	return true;
}
int main() {
  	cin >> s;
  	int n = s.size();
  	int l = 0, r = s.size() - 1;
  	bool f = isPalindrome(l, r);
  	if (!f) return 0;
    l = 0, r = ((n - 1) / 2) - 1;
    f = isPalindrome(l, r);
	if (!f) return 0;
  	l = ((n + 3) / 2) - 1; r = s.size() - 1;
  	f =	isPalindrome(l,r);
  	if (!f) return 0;
  	cout << "Yes" << endl;
  
	return 0;
}

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

#define For(i, j, k) for(int i = j; i <= k; i++)
#define Forr(i, j, k) for(int i = j; i >= k; i--)

using namespace std;

typedef long long LL;

const int N = 2e5 + 10;
const int Mod = 1e9 + 7;

LL fac[N], rfac[N];

LL Pow(LL x, LL e){
	LL ret = 1;
	while(e){
		if(e & 1) ret = ret * x % Mod;
		x = x * x % Mod;
		e >>= 1;
	}
	return ret;
}

void init(int n){
	fac[0] = 1;
	For(i, 1, n) fac[i] = fac[i - 1] * i % Mod;
	rfac[n] = Pow(fac[n], Mod - 2);
	Forr(i, n, 1) rfac[i - 1] = rfac[i] * i % Mod;
}

int h, w, a, b;

LL C(int n, int m){
	return fac[n] * rfac[m] % Mod * rfac[n - m] % Mod;
}

int main(){
	
	scanf("%d%d%d%d", &h, &w, &a, &b);
	init(h + w);

	LL ans = 0;
	For(i, b + 1, w) ans = (ans + C(h - a + i - 2, i - 1) * C(a + w - i - 1, a - 1)) % Mod;
	printf("%lld\n", ans);

	return 0;
}

Measured memory_bytes: 3328
use proconio::input;

fn main() {
    input!(n: usize, a: [u32; n]);
    let two = a.iter().filter(|&x| x % 2 == 0).count();
    let four = a.iter().filter(|&x| x % 4 == 0).count();
    let sum = if two == four && 0 < four {
        two + four + 1
    } else {
        two + four
    };
    println!("{}", if n <= sum { "Yes" } else { "No" });
}


Measured memory_bytes: 3472
a = int(input())

if a >= 400 and 599 >= a:
  print(8)
elif a <= 799:
  print(7)
elif a <= 999:
  print(6)
elif a <= 1199:
  print(5)
elif a <= 1399:
  print(4)
elif a <= 1599:
  print(3)
elif a <= 1799:
  print(2)
else:
  print(1)

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

using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define fore(i,a) for(auto &i:a)

typedef pair <int, int> P;
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
const int  INF = 2147483647;
const ll INFL = 9223372036854775807;
const ll mod = 1000000007;







int main() {
	
	ll k, a, b;

	ll ans = 0;
	cin >> k >> a >> b;
	if ((b-a)<=2) {
		cout << k + 1 << endl;
		return 0;
	}

	k -= a - 1;
	ans = a;
	if (k <= 0) {
		cout << k + 1 << endl;
		return 0;
	}

	ans += k / 2 * (b - a);
	if (k % 2) ans++;

	cout << ans << endl;


	return 0;
	
}


Measured memory_bytes: 256
def prepare(n, MOD):
 
    # 1! - n! の計算
    f = 1
    factorials = [1]  # 0!の分
    for m in range(1, n + 1):
        f *= m
        f %= MOD
        factorials.append(f)
    # n!^-1 の計算
    inv = pow(f, MOD - 2, MOD)
    # n!^-1 - 1!^-1 の計算
    invs = [1] * (n + 1)
    invs[n] = inv
    for m in range(n, 1, -1):
        inv *= m
        inv %= MOD
        invs[m - 1] = inv
     
    return factorials, invs

  
MOD = 10**9+7
fact, fact_inv = prepare(2*10**5, MOD)


n = int(input())

if n < 3:
    print(0)
    exit()

m = n // 3
ans = 1

for i in range(2, m+1):
    x = n - 3*i
    ans += fact[i+x-1] * fact_inv[x] % MOD * fact_inv[i-1] % MOD
    ans %= MOD
print(ans)

Measured memory_bytes: 24604
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,x,y,w,w1,ma=-2e9,ma1=-2e9,mi=2e9,mi1=2e9;scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d%d",&x,&y);
		w=x+y,w1=x-y;
		ma=max(ma,w),mi=min(mi,w),ma1=max(ma1,w1),mi1=min(mi1,w1);
	}
	printf("%d",max(ma-mi,ma1-mi1));
	return 0;
}

Measured memory_bytes: 3820
#include <iostream>
#include <unordered_map>
#include <vector>

using namespace std;

// https://atcoder.jp/contests/abc128/tasks/abc128_c

int main() {
  int n, m;
  cin >> n >> m;
  unordered_map<int, vector<int>> mp;
  for (int i = 0; i < m; ++i) {
    int k;
    cin >> k;
    for (int j = 0; j < k; ++j) {
      int s;
      cin >> s;
      mp[i+1].emplace_back(s);
    }
  }
  vector<int> ptn(m);
  for (int i = 0; i < m; ++i) cin >> ptn[i];

  int ans = 0;
  // N個あるスイッチの全on/offをbit全探索
  for (int bit = 0; bit < (1 << n); ++bit) {
    vector<int> bits;
    for (int i = 0; i < n; ++i) {
      if (bit & (1 << i)) {
        bits.emplace_back(i+1);
      }
    }

    int total = 0;
    for (auto& [i, s] : mp) {
      int on = 0;
      for (auto e : bits) {
        // if (find(s.begin(), s.end(), e) != s.end()) ++on;
        for (auto b : s) {
          if (b == e) {
            ++on;
            break;
          }
        }
      }
      if (on % 2 == ptn[i-1]) ++total;
    }
    if (total == m) ++ans;
  }

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

Measured memory_bytes: 3604
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <chrono>
#include <random>
#include <cmath>
using namespace std;
using namespace __gnu_pbds;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define uid uniform_int_distribution<lli>
#define lli long long int
#define ff first
#define ss second
#define pb push_back
#define popf pop_front()
#define popb pop_back()
#define all(vec) vec.begin(), vec.end()
#define fol(i,a,b) for(int i=a;i<b;i++)
#define forr(x,arr) for(auto& x:arr)
#define sz(x) (x.size())
#define mod 1000000007
#define INF 1000000000000000010
#define vi vector<int>
#define vlli vector<lli>
#define endl "\n"
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef tree<lli,null_type,less<lli>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

template <class my>
inline my aabs (const my &a)   { return (a > 0)  ? a : -a;         }
inline lli gcd(lli a, lli b)   { return (b == 0) ? a : gcd(b,a%b); }
inline lli LSOne(lli k)        { return (k&(-k));                  }

void solve()
{
    lli n, m, t, k=0, q, temp=0, u=0, v=0, ans1=0, ans2=0, val=0, sum=mod;
    cin>>n;
    lli arr[n+5], brr[n+5];
    fol(i,1,n+1) cin>>arr[i];
    fol(i,1,n+1) arr[i]*=2;
    brr[0]=0;
    fol(i,1,n+1) brr[i]=arr[i]-brr[i-1];
    brr[0]=(brr[0]+brr[n])/2;
    fol(i,1,n) brr[i]=arr[i]-brr[i-1];
    fol(i,0,n) cout<<brr[i]<<" ";
    cout<<endl;


}

int main()
{
    fastio cout<<endl;
    cout << fixed << setprecision(7);
    int t=1;
    //cin>>t;
    while(t--)
        solve();
}

Measured memory_bytes: 2944
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <bitset> // bitset
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
using namespace std;

int main() {
  int N, M, X;
  cin >> N >> M >> X;
  vector<vector<int>> skill(N, vector<int>(M));
  vector<int> cost(N);
  for(int i=0; i < N; i++){
    cin >> cost.at(i);
    for(int j =0; j < M; j++){
      cin >> skill.at(i).at(j);
    }
  }
  int ans = 12345678;
  for(int k=0; k< 1<<N; k++){
    vector<int> level(M);
    int money =0;
    for(int i = 0; i < N; i++){
      if((k>>i)&1){
        money += cost.at(i);
        for(int j=0;j<M;j++){
          level.at(j) += skill.at(i).at(j);
        }
      }
    }
    bool ok = true;
    for(int i =0; i<M; i++){
      if(level.at(i) < X){
        ok = false;
      }
    }
    if(ok){
      ans = min(ans,money);
      
    }
  }
   if(ans == 12345678){
     cout << -1 << endl;
   }
    else{
  
  cout << ans << endl;
    }
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define FAST_INPUT ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long

using namespace std;

const int mod = 1e9 + 7;

void solve() {
	int h, w; cin >> h >> w;
	vector<string> grid(h);
	for (int i = 0 ; i < h; i++) {
		cin >> grid[i];
	}
	
	vector<vector<int>> dp(h, vector<int>(w, 0));
	dp[0][0] = 1;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (!i && !j) continue;
			if (grid[i][j] == '#') continue;
			if (i) dp[i][j] += dp[i - 1][j] % mod;
			if (j) dp[i][j] += dp[i][j - 1] % mod;
			dp[i][j] %= mod;
		}
	}


	cout << dp[h - 1][w - 1] << endl;
}

int main() {
    FAST_INPUT;

    solve();

    return 0;
}


Measured memory_bytes: 5248
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
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; }

#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { INIT(){
  cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;


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


  vector<int> cnt(N+1, 0);

  vector<int> L(M), R(M);
  REP(i, M){
    cin >> L[i] >> R[i];
    cnt[L[i]-1]++;
    cnt[R[i]]--;
  }

  REP(i, N){
    cnt[i+1] += cnt[i];
  }

  int ans = 0;
  REP(i, N){
    if(cnt[i] == M) ans++;
  }

  cout << ans << "\n";

  return 0;
}


Measured memory_bytes: 5504
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n=sc.nextInt(),sum=0;
    for(int i=1;i<=n;i++) {
    	for(int j=1;j<=n;j++) {
    		for(int k=1;k<=n;k++) {
    			int buff=GCD(i,j);
    			sum+=GCD(k,buff);
    		}
    	}
    }
    System.out.println(sum);
  }
	public static int GCD(int min,int max) {
		if(max%min==0)return min;
		else return GCD(max%min,min);
	}
}

Measured memory_bytes: 35816
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;


signed main() {
  int N, K; 
  cin >> N >> K;

  int g = (N+K-1)/K*K;
  chmin(N, abs(N-g));
  cout << N << endl;

  return 0;
}

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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a*b/gcd(a, b);
}

int main()
{
    cout << fixed << setprecision(15);
    ll N;
    cin >> N;

    map<ll, ll> M;
    REP(i, N){
        ll a;
        cin >> a;
        M[a]++;
    }
    ll ans = 0;
    for(auto iter=M.begin(); iter!=M.end(); iter++){
        if(iter->second % 2 == 1) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 9756
#include<bits/stdc++.h>
using namespace std;
/*#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
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<ll,ll> pl;
typedef pair<int,int> pii;

#define int ll
#define LOCAL 0
#define dbg(x) cout << #x << " is " << x << "\n"
#define gll(x) scanf("%d",&x)
#define gll2(x,y) scanf("%d%d",&x,&y)
#define gll3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define gllarr(arr,n) f(i,n) gll(arr[i]);
#define sz(x) ((int)x.size())
#define s(x) sort(x.begin(),x.end())
#define all(v) v.begin(),v.end()
#define rs(v) { s(v) ; r(v) ; }
#define r(v) {reverse(all(v));}
#define pb push_back
#define f(i,n) for(int i=0;i<n;i++)
#define fr(i,n) for(int i=n-1;i>=0;i--)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)

const ll mod = (ll)1e9 + 7;
const ll inf = (ll)1e16;
const ld eps = 1e-12;
const ll N = (int)1e5 + 5;
const ll LOGN = 19;
const ld PI = 3.14159265358979323846;
inline ll mul(ll a, ll b, ll m = mod) { return (ll)(a * b) % m;}
inline ll add(ll a, ll b, ll m = mod) { a += b; if(a >= m) a -= m; if(a < 0) a += m; return a;}
inline ll power(ll a, ll b, ll m = mod) { if(b == 0) return 1; if(b == 1) return (a % m); ll x = power(a, b / 2, m); x = mul(x, x, m); if(b % 2) x = mul(x, a, m); return x;}

void solve() {
    int r;
    cin>>r;
    cout<<2 * PI * r<<endl;
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    if (LOCAL) {
        freopen("C:\\Users\\Dishant\\Desktop\\Collection-DEV c++\\input.txt", "r", stdin);
        freopen("C:\\Users\\Dishant\\Desktop\\Collection-DEV c++\\output.txt", "w", stdout);
    }
    int t = 1;
    //cin>>t;
    for(int test = 1; test <= t; test++) {
        //cout<<"Case #"<<test<<": ";
        solve();
    }
    return 0;
}

Measured memory_bytes: 3792