akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cstring>
#include<map>
#include<set>
#include<deque>
#include<cassert>

using namespace std;

#define sz(x) (int)(x.size())
#define fi(a,b) for(int i=a;i<b;++i)
#define fj(a,b) for(int j=a;j<b;++j)
#define fo(a,b) for(int o=a;o<b;++o)
#define fdi(a,b) for(int i=a-1;i>=b;--i)
#define fdj(a,b) for(int j=a-1;j>=b;--j)
#define fdo(a,b) for(int o=a-1;o>=b;--o)
#define pb push_back
#define mp make_pair
typedef pair<int, int> pii;
typedef long long ll;
/////////////////////////////////

int const N = 1e5 + 41;
int const M = 241;

int n, m;
int a[N];
int k, b[N];
vector<int> ansa, ansb;

void bad(){
	printf("Impossible\n");
	exit(0);
}

void solve(){
	if(m == 1){
		ansa.pb(a[0]);
		if(a[0] == 1){
			ansb.pb(1);
		}else{
			ansb.pb(a[0] - 1);
			ansb.pb(1);
		}
		return;
	}
	vector<int> o, e;
	fi(0, m) if(a[i] % 2 == 0) e.pb(a[i]);
	else o.pb(a[i]);
	if(sz(o) > 2) bad();
	if(sz(o)){
		ansa.pb(o[0]);
	}
	fi(0, sz(e)) ansa.pb(e[i]);
	if(sz(o) > 1) ansa.pb(o.back());
	ansb.pb(ansa[0] + 1);
	fi(1, sz(ansa)){
		ansb.pb(ansa[i]);
	}
	--ansb.back();
	if(ansb.back() == 0) ansb.pop_back();
}

int main(){
#ifdef _DEBUG
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif

	scanf("%d %d",&n,&m);
	fi(0, n) scanf("%d",&a[i]);

	solve();

	fi(0, sz(ansa)) printf("%d ",ansa[i]);
	printf("\n");
	printf("%d\n",sz(ansb));
	fi(0, sz(ansb)) printf("%d ",ansb[i]);

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {
    public static void main(final String[] args) {
        Scanner scan = new Scanner(System.in);
        int[] antenna = new int[5];
        for (int i = 0; i < 5; i++) {
            antenna[i] = scan.nextInt();
        }
        int k = scan.nextInt();
        String ans = "Yay!";
        x: for (int i = 0; i < 5; i++) {
            for (int j = 0; j < 5 - j; j++) {
                if (Math.abs(antenna[i] - antenna[j]) > k) {
                    ans = ":(";
                    break x;
                }
            }
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 21716
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <math.h>
#include <cmath>
#include <ctime>
#include <stdlib.h>

using namespace std;

#define int long long
#define endl "\n"
#define all(v)  v.begin(),v.end()
#define fir first
#define sec second
#define m_p make_pair
#define m_t make_tuple
#define rep(i,n)  for(int i=0; i<(int) (n); i++)
typedef pair<int, int> P;

const double pai = 3.1415926535897;
const int mod = 1000000007;
const int INF = 1000000021;
const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];


//x未満の要素数を返す二分探索関数
int b_s(vector<int>& vec, int xx) {
	return lower_bound(all(vec), xx) - vec.begin();
}
template<typename T>void vecout(vector<T>& vec) { for (T t : vec) cout << t << " "; cout << endl; }
template<typename TT>void vecin(vector<TT>& vec) {
	for (int i = 0; i < vec.size(); i++) {
		cin >> vec[i];
	}
}

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

//n個を1個以上のx組のグループに分ける重複組み合わせはcom(n-1,x-1)
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
long long modpow(int a, int n) {
	int res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

bool chmax(int& xx, int yy) {
	if (xx < yy) {
		xx = yy;
		return true;
	}
	return false;
}
bool chmin(int& xx, int yy) {
	if (xx > yy) {
		xx = yy;
		return true;
	}
	return false;
}
int gcd(int xx, int yy) {
	int p = xx;
	int q = yy;
	if (q > p)swap(p, q);
	while (p % q != 0) {
		p %= q;
		swap(p, q);
	}
	return q;
}
int lcm(int xx, int yy) {
	return xx * yy / gcd(xx, yy);
}
bool prime(int xx) {
	if (xx <= 1) {
		return 0;
	}
	for (int i = 2; i * i <= xx; i++) {
		if (xx % i == 0) {
			return 0;
		}
	}
	return 1;
}



signed main() {
	int n,a,b=0,c=0;
	cin >> n;
	map<int, int>ma;
	rep(i, n) {
		cin >> a;
		if (!ma.count(a)) {
			ma[a] = 1;
		}
		else {
			ma[a]++;
		}
	}
	for (auto p : ma) {
		int k = p.first;
		int v = p.second;
		if (v >= 4) {
			b = k;
			c = k;
		}
		else if (v >= 2) {
			c = b;
			b = k;
		}
	}
	cout << b * c << endl;
}

Measured memory_bytes: 9756
#include<cstdio>
int n, a[200];
int main() {
    scanf ("%d\n", &n);
   
    int cmin=100;
    for (int i=0;i<n;i++) {
        scanf("%d", &a[i]);
        int c=0;
        while (a[i]%2==0) {
            a[i]/=2;
            c++;
        }  
    if (c<cmin) cmin=c;
    }    
    printf("%d\n", cmin);
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
int main()
{
    int A,B;
    cin >> A>>B;
    
    string ans;
    if(A==B) ans="Draw";
    else if (A==1) ans="Alice";
    else if (B==1) ans="Bob";
    else{
        if(A>B) ans="Alice";
        else ans="Bob";
    }

    cout << ans << endl;


   return 0;
}


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

class Program
{
    static void Main()
    {
        StringBuilder ans = new StringBuilder();
        short[] l = Console.ReadLine().Split(' ').Select(short.Parse).ToArray();
        int c = l[1];
        int[] cans = new int[c + 1];
        
        for (int i = 0; i < l[0]; i++)
        {
            short[] o = Console.ReadLine().Split(' ').Select(short.Parse).ToArray();
            int a = 0;

            for (int j = 0; j < c; j++)
            {
                cans[j] += o[j];
                a +=  o[j];
                ans.Append(o[j] + " ");
            }

            cans[c] += a;
            ans.Append(a + "\r\n");
        }
        for (int i = 0; i < c; i++)
        {
            ans.Append(cans[i] + " ");
        }
        ans.Append(cans[c] + "\r\n");

        Console.Write(ans);
    }
}

Measured memory_bytes: 9808
#include <iostream>

using namespace std;

int main(){
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if (abs(a-c) <= d || (abs(a-b) <= d && abs(b-c) <= d)){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=tf-8
#

"""
"""

from collections import defaultdict
from itertools import accumulate
import bisect

import sys
input = sys.stdin.readline

def solve(a):
    b = a.copy()
    b.reverse()
    c = list(accumulate(b))
    ans = 0
    modulo = 10**9 + 7
    n = len(a)
    for i, aa in enumerate(a[:-1]):
        cc = c[n-2-i] % modulo
        ans = (ans + (aa*cc%modulo))%modulo
    #print(a,b,c)
    print(ans)

            

def main():
    _ = input()
    a = list(map(int,input().split()))
    solve(a)


if __name__ == "__main__":
    main()

Measured memory_bytes: 106096
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
long int n;
int count(long int num);
int is(long int num);

int main(void){
  int ans;
  scanf("%ld",&n);
  if(n<357){
    printf("0\n");
    return 0;
  }
  ans+=count(0);
  printf("%d\n",ans);
  return 0;
}

int count(long int num){
  int ret=0;
  if(num<=n){
    if(is(num)){
      ret++;
    }
    ret+=count(num*10+3);
    ret+=count(num*10+5);
    ret+=count(num*10+7);
  }
  return ret;
}

int is(long int num){
  int tmp,f1=0,f2=0,f3=0;
  while(num!=0){
    tmp=num%10;
    num=num/10;
    if(tmp==3){
      f1=1;
    }else if(tmp==5){
      f2=1;
    }else if(tmp==7){
      f3=1;
    }
  }
  if(f1*f2*f3==1)
    return 1;
  else
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef pair<int,int> P;
#define fi first
#define se second
#define all(v) (v).begin(),v.end()
set<string> c;
const ll inf=(1e18);
const ll mod=1000000007;
const ll mod2=998244353;
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
//ios_base::sync_with_stdio(false);
//cin.tie(NULL);
class UF{
public:
	vector<int> par,num;
	int find(int v){
		return (par[v]==v)? v: (par[v]=find(par[v]));
	}
	explicit UF(int N):par(N),num(N,1){
		iota(par.begin(),par.end(),0);
	}
	void unite(int u,int v){
		u=find(u),v=find(v);
		if(u==v)return ;
		if(num[u]<num[v])swap(u,v);
		num[u] += num[v];
		par[v] = u;
	}
	bool same(int u,int v){
		return find(u) == find(v);
	}
	bool ispar(int v){
		return v=find(v);
	}
	int size(int v){
		return num[find(v)];
	}
};
// 頂点a, bをつなぐコストcostの（無向）辺
struct Edge{
int a, b, cost;
  // コストの大小で順序定義
  bool operator<(const Edge& o) const {
    return cost < o.cost;
  }
};

// 頂点数と辺集合の組として定義したグラフ
struct Graph{
  int n;  // 頂点数
  vector<Edge> es;  // 辺集合
  // クラスカル法で無向最小全域木のコストの和を計算する
  // グラフが非連結のときは最小全域森のコストの和となる
  int kruskal() {
    // コストが小さい順にソート
    sort(es.begin(), es.end());
    UF uf(n);
    int min_cost = 0;
    for(int ei=0;ei<es.size();ei++){
      Edge& e = es[ei];
      if (!uf.same(e.a, e.b)) {
        // 辺を追加しても閉路ができないなら、その辺を採用する
        min_cost += e.cost;
        uf.unite(e.a, e.b);
      }
    }
    return min_cost;
  }
};
// 標準入力からグラフを読み込む
Graph input_graph() {
  Graph g;
  cin >> g.n;
  vector<P> x(g.n),y(g.n);
   for(int i=0;i<g.n;i++){
        cin>>x[i].fi>>y[i].fi;
        x[i].se=i;y[i].se=i;
    }
    sort(all((x)));sort(all(y));
  for(int i=0;i<g.n-1;i++) {
       g.es.push_back(Edge{x[i].se,x[i+1].se,abs(x[i].fi-x[i+1].fi)});
       g.es.push_back(Edge{y[i].se,y[i+1].se,abs(y[i].fi-y[i+1].fi)}); 
  }
  return g;
}
int main(){
  Graph g = input_graph();
  cout << g.kruskal() << endl;
  return 0;
}

Measured memory_bytes: 6516
// D - Static Sushi O(N) 500
#include <iostream>
using namespace std;
using ll=long long;

int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ll N,C;
  cin>>N>>C;
  ll x[N+2],v[N+2],sz[N+2],nz[N+2],sj[N+2],nj[N+2];
  for (int i=0; i<N+2; i++) {
    x[i]=v[i]=sz[i]=nz[i]=sj[i]=nj[i]=0;
  }
  for (int i=1; i<=N; i++) {
    cin>>x[i]>>v[i];
  }
  for (int i=1; i<=N; i++) {
    sj[i]=sj[i-1]+v[i];
    sz[i]=max(sz[i-1],sj[i]-x[i]);
  }
  for (int i=N; i>=1; i--) {
    nj[i]=nj[i+1]+v[i];
    nz[i]=max(nz[i+1],nj[i]-(C-x[i]));
  }
  ll ans=0;
  for (int i=1; i<=N; i++) {
    ans=max(ans,sz[i]);
    ans=max(ans,sj[i]+nz[i+1]-2*x[i]);
  }
  for (int i=N; i>=1; i--) {
    ans=max(ans,nz[i]);
    ans=max(ans,nj[i]+sz[i-1]-2*(C-x[i]));
  }
  cout<<ans<<endl;
  return 0;
}


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

ll inf=9223372036854775806;

int main()
{
	//freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(false); cin.tie(0);
	int s,i,j,k,ans=1;
	bool a[1000000],q=false;
	fill(a,a+1000000,false);
	cin>>s;
	a[s]=true;
	while (q==false){
		ans++;
		if (s%2==0){
			s/=2;
			if (a[s]==true){
				q=true;
			}
			else {
				a[s]=true;
			}
		}
		else {
			s=3*s+1;
			if (a[s]==true){
				q=true;
			}
			else {
				a[s]=true;
			}
		}
	}
	cout<<ans;
	return 0;
}

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

bool checkprime(int n)
{
  int i,c=0;
  for(i=1; i*i<=n; i++)
  {
    if(n%i==0)c++;
  }
  if(c==1)return true;
  else return false;
}


int main()
{
 int n, i,ans;
 cin>>n;
 for(i=n; ; i++)
 {
  if(checkprime(i)){
    ans=i;break;
  }
 }
 cout<<ans<<endl;
}

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

s = sum(A)
l = 0
for i in range(N):
  l += A[i]
  if l>= s/2:
    ans = min([abs(l-A[i]-sum(A[i:])),abs(l-sum(A[i+1:]))])
    print(round(ans))
    break


Measured memory_bytes: 31424
#include <bits/stdc++.h>
using namespace std;
const int inf = (1 << 30) - 1;

int main()
{
  int N; cin >> N;
  vector<int> H(N);
  for (int i = 0; i < N; i++) cin >> H[i];

  int ans = 0, max = -1;
  for (int i = 0; i < N; i++) {
    if (H[i] >= max) {
      ans++;
      max = H[i];
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)

	n := getNextInt(scanner)

	for i := 1; i <= n; i++ {
		if int(float64(i)*1.08) == n {
			fmt.Println(i)
			return
		}
	}

	fmt.Fprintln(writer, ":(")
	writer.Flush()
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <queue>
#include <cmath>
#include <algorithm>
#include <string>

using namespace std;

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

Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		String s = scan.next();
		String t = scan.next();
		
		int a = scan.nextInt();
		int b = scan.nextInt();
		
		String u = scan.next();
		
		if (u.equals(s)) {
			System.out.println((a-1) + " " + b);
		} else if (u.equals(t)) {
			System.out.println((a) + " " + (b-1));
		}
		
	}

}

Measured memory_bytes: 21716
#include <cstdio>
#include <algorithm>
#include <queue>

using namespace std;

const int maxn=1e5+1e2;

struct edge
{
	int v,next;
}e[maxn*2];

int col[maxn],ance[maxn],s[maxn],hea=1,tail=0,head[maxn],cnt=0,tem[maxn];

queue <int> q1,q2;

void insert(int t1,int t2)
{
	e[++cnt].v=t2;
	e[cnt].next=head[t1];
	head[t1]=cnt;
}

void dfs(int x,int fa)
{
	ance[x]=fa;
	for(int i=head[x];i;i=e[i].next)
	{
		if(e[i].v==fa)continue;
		dfs(e[i].v,x);
	}
}

int getint()
{
	char ch;int b=1;
	for(ch=getchar();ch>'9'||ch<'0';ch=getchar())if(ch=='-')b=-1;
	int num=ch-'0';
	for(ch=getchar();ch>='0'&&ch<='9';ch=getchar())num=num*10+ch-'0';
	return num*b;
}

int main()
{
	int n=getint();
	for(int i=1;i<n;i++)
	{
		int t1=getint(),t2=getint();
		insert(t1,t2);
		insert(t2,t1);
	}
	dfs(1,0);
	int now=n;
	while(now)
	{
		tem[++tail]=now;
		now=ance[now];
	}
	for(int i=1;i<=tail;i++)s[i]=tem[tail-i+1];
	int now1=0,now2=0;
	while(hea<=tail)
	{
		col[s[hea]]=1;
		q1.push(s[hea]);
		hea++;
		if(hea<=tail)
		{
			col[s[tail]]=2;
			q2.push(s[tail]);
			tail--;
		}
	}
	while(!q1.empty())
	{
		int t=q1.front();q1.pop();
		now1++;
		for(int i=head[t];i;i=e[i].next)
		{
			if(!col[e[i].v])
			{
				col[e[i].v]=1;
				q1.push(e[i].v);
			}
		}
	}
	while(!q2.empty())
	{
		int t=q2.front();q2.pop();
		now2++;
		for(int i=head[t];i;i=e[i].next)
		{
			if(!col[e[i].v])
			{
				col[e[i].v]=2;
				q2.push(e[i].v);
			}
		}
	}
	//printf("%d %d\n",now1,now2);
	if(now1>now2)printf("Fennec");
	else printf("Snuke");
}

Measured memory_bytes: 7296
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <numeric>

using namespace std;
using ll = long long;
using ull = unsigned long long;

#define REP(i,n) for(long long i = 0; i < (n); i++)
#define FOR(i, m, n) for(long long i = (m);i < (n); ++i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SPEED cin.tie(0);ios::sync_with_stdio(false);

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;

const ll MOD = (ll)1e9 + 7;
const ll MOD2 = 998244353;
const ll HIGHINF = (ll)1e18;
const ll LOWINF = (ll)1e15;
const long double PI = 3.1415926535897932384626433;

template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const multiset<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "{" << obj.first << ", " << obj.second << "}"; return o;}
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
void print(void) {cout << endl;}
template <class Head> void print(Head&& head) {cout << head;print();}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head << " ";print(forward<Tail>(tail)...);}
template <class T> void chmax(T& a, const T b){a=max<T>(a,b);}
template <class T> void chmin(T& a, const T b){a=min<T>(a,b);}
void YN(bool flg) {cout << ((flg) ? "YES" : "NO") << endl;}
void Yn(bool flg) {cout << ((flg) ? "Yes" : "No") << endl;}
void yn(bool flg) {cout << ((flg) ? "yes" : "no") << endl;}

int main() {
    ll N,M; cin >> N >> M;
    V<ll> a(N+1,0);
    for(int i = 0; i < M; ++i){
        int t; cin >> t;
        a[t] = -1;
    }
    a[0] = 1;
    for(int i = 0; i < N; ++i){
        if(i+1<=N&& a[i] != -1 && a[i+1] != -1) (a[i+1] += a[i]) %= MOD;
        if(i+2<=N&& a[i] != -1 && a[i+2] != -1) (a[i+2] += a[i]) %= MOD;
    }
   
    cout << a[N] << endl;

    return 0;
}



Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int n,x,c1,c2,c4;
int main(){
	scanf("%d",&n);
	for (int i=1;i<=n;i++){
		scanf("%d",&x);
		if (x&1) c1++;
		else if (x%4) c2++;
		else c4++;
	}
	puts(c4>=c1+(c2!=0)-1?"Yes":"No");
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define LL long long

LL a[100000];
int n;

int main(){
  cin>>n;
  REP(i,n)
    cin>>a[i];
  REP(i,n){
    if(a[i]%2!=0){
      cout<<"first"<<endl;
      return 0;
    }
  }
  cout<<"second"<<endl;
  return 0;
}


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

int selectionSort(int ary[], int num);

void printArray(int ary[], int num){
    for (int i=0; i<num; i++){if(i==num -1) cout << ary[i] << endl; else cout << ary[i] << ' ';}
}

int main(){
    int n, a[100];
    cin >> n;
    for(int i=0; i<n; i++){cin >> a[i];}
    int count = 0;
    count = selectionSort(a, n);
    printArray(a, n);
    cout << count << '\n';

    return 0;
}
int selectionSort(int ary[], int num){
    int count=0;
    int minj;
    for(int i=0; i<num; i++){
        minj = i;
        for (int j=i; j<num; j++){
            if (ary[minj] > ary[j]){
                minj = j;
            }
        }
        if (minj != i){
            swap(ary[i], ary[minj]);
            count ++;
        }
    }
    return count;
    
}


Measured memory_bytes: 3096
#include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <random>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#define reppl(i,n,m) for (long long i = m; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PL = pair<long long, long long>;
using Pxy = pair<double, double>;
using T = tuple<int, int, bool>;
const int INF = 1001001007;
const int mod = 1000000007;
const int MOD = 998244353;
const ll inf = 1e18;
template <typename AT>
void printvec(vector<AT> &ar){
    rep(i,ar.size()-1) cout << ar[i] << " ";
    cout << ar[ar.size()-1] << endl;
}
template <typename Q>
void printvvec(vector<vector<Q>> &ar){
    rep(i,ar.size()){
        rep(j,ar[0].size()-1) cout << ar[i][j] << " ";
        cout << ar[i][ar[0].size()-1] << endl;
    }
}
template <typename S>
bool range(S a, S b, S x){
    return (a <= x && x < b);
}

int main() {
    int n; cin >> n;
    int ans = 0;
    rep(i,n){
        int a; cin >> a;
        if (i % 2 == 0 && a % 2 == 1) ans++; 
    }
    cout << ans << endl;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
 
using namespace std;
using ll = long long;
// #define int ll
using PII = pair<int, int>;
 
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
 
template<typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }

template<typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts) { 
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type
fill_v(T &t, const V &v) { t=v; }
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t, const V &v ) { for(auto &e:t) fill_v(e,v); }

template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')'; return out;
}
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
  for(T& x: vec) {is >> x;} return is;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'['; for(T i: a) {out<<i<<',';} out<<']'; return out;
}

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; // DRUL
const int INF = 1<<30;
const ll LLINF = 1LL<<60;
const int MOD = 1000000007;

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

  int n;
  cin >> n;
  if(n == 1) cout << "Hello World" << endl;
  else {
    int a, b;
    cin >> a >> b;
    cout << a + b << endl;
  }

  return 0;
}


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

int main(){
  long long sum=0, b_cnt=0;
  string color;
  cin >> color;
  for(int i=0; i<color.size(); i++){
    if(color[i] == 'W'){
      sum += b_cnt;
    } else {
      ++b_cnt;
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
typedef vector<string> vstring;
#define _GLIBCXX_DEBUG
#define vpush(a,x) a.push_back(x);
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
const int INF = 1 << 30;
const int dx[] = {1,0,-1,0,1,1,-1,-1};
const int dy[] = {0,-1,0,1,1,-1,-1,1};
#define stp(x)  setprecision(x)
int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ll n,m;
  cin>>n>>m;
  if(n>=m){
    cout<<m/2<<'\n';
  }
  else{
    int count=n;
    m-=n*2;
    cout<<count+m/4<<'\n';
  }
  return(0);
}


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

int main(){
    int N;
    cin >> N;
    map <string,int> table;
    int max_count = -1;
    rep(i,N) {
        string s;
        cin >> s;
        if (table.count(s)){
            table[s] += 1;
        } else {
            table[s] = 1;
        }
        max_count = max(max_count,table[s]);
    }
    for (auto t : table){
        if (t.second == max_count){
            cout << t.first << endl;
        }
    }
}

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



typedef long long ll;
int N, x;
int A[101010];
//-----------------------------------------------------------------
int main() {
	cin >> N >> x;
	rep(i, 0, N) scanf("%d", &A[i]);

	ll ans = 0;

	if (x < A[0]) {
		ans += A[0] - x;
		A[0] = x;
	}

	rep(i, 1, N) {
		ll sm = 0;
		sm += A[i - 1];
		sm += A[i];

		if (x < sm) {
			ll d = sm - x;
			ans += d;
			A[i] -= d;
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 640
#include<iostream>
using namespace std;
int main()
{
	int a[5],n,i;
	for(i=1;i<=4;i++)
	cin >>a[i];
	if((a[1]+a[2])>(a[3]+a[4])) cout <<"Left";
	if((a[1]+a[2])<(a[3]+a[4])) cout <<"Right";
	if((a[1]+a[2])==(a[3]+a[4])) cout <<"Balanced";
}

Measured memory_bytes: 256
import math
import collections
 
N = int(input())
prime_number = False
ans = 0
 
def trial_division(n):
    #素因数を格納するリスト
    factor = []
    #2から√n以下の数字で割っていく
    tmp = int(math.sqrt(n)) + 1
    for num in range(2,tmp):
        while n % num == 0:
            n //= num
            factor.append(num)
    #リストが空ならそれは素数
    if not factor:
      global prime_number
      prime_number = True
      return
    else:
        factor.append(n)
        return factor

list_num = trial_division(N)

if N == 1:
  ans = 0
elif prime_number:
  ans = 1
else:
  if 1 in list_num:
    prime_list = list_num[:-1]
  else:
    prime_list = list_num
  counter = collections.Counter(prime_list)
  for key,val in counter.items():
    temp = val
    for i in range(1,val+1):
      if temp-i > 0:
        temp -= i
        ans += 1
      elif temp-i == 0:
        temp -= i
        ans += 1
        break
      else:
        break
    
print(ans)

Measured memory_bytes: 9516
#include <cassert>
#include <cmath>
#include <iostream>
#include <queue>
#include <string>
#include <sstream>
#include <vector>
 
using namespace std;
 
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int n;
  cin >> n;

  double result;
  for (auto i = 0; i < n; i++) {
    string s;
    cin >> s;
    result += 1.0 / stoi(s);
  }

  cout << 1.0 / result;

  return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<math.h>
using namespace std;

/*
    数え上げが基本
    底が10の対数を使って入力した数が何桁あるかを調べる
    桁数によって何個数え上げればいいのかを個別で計算
 */

int main(){
    int N,tmp;
    int ans=0;
    cin >> N;
    float x=log10(N);
    for(int i=0;i<=5;i++){
        if(x>=i){
            tmp=i;
        }
    }
    if(tmp%2!=0){
        for(int i=0;i<=(tmp-1)/2;i++){
            ans+=9*pow(10,2*i);
        }
    }else{
        if(tmp!=0){
            for(int i=0;i<tmp/2;i++){
                ans+=9*pow(10,2*i);
            }
            ans+=N-pow(10,tmp)+1;
        }else{
            ans+=N;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <string>
#include <map>
#include <utility>
#include <set>
#include <unordered_map>

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define IPSILON 1e-9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main(){
  int N;
  cin >> N;
  cout << pow(N,3) << endl;
}


Measured memory_bytes: 888
'use strict'

var mod = 1e9 + 7

function solve(H, W, M) {
  var dp = new Array(H).fill(0).map(e => new Array(W).fill(1))
  for (var i = 0; i < H; i++) {
    for (var j = 0; j < W; j++) {
      if (i === 0 && j === 0) {
        dp[i][j] = 1
        continue
      }
      if (M[i][j] === '#') {
        dp[i][j] = 0
        continue
      }
      var left = (j-1) >= 0 ? dp[i][j-1] : 0
      var up = (i-1) >= 0 ? dp[i-1][j] : 0
      dp[i][j] = (left + up) % mod
    }
  }
  return dp[H-1][W-1] % mod
}

function main(input) {
  var lines = input.split("\n")
  var HW = lines[0].split(' ').map(i => parseInt(i))
  var H = HW[0]
  var W = HW[1]
  var M = lines.slice(1)
  var ans = solve(H, W, M)
  console.log(ans)
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 28720
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
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 (b<a) {a=b; return 1;} return 0;}

int n;

void dfs(ll x, int used, int& cnt) {
    if (x > n) return;
    if (used == 0b111) cnt++;
    dfs(x * 10 + 3, used | 0b001, cnt);
    dfs(x * 10 + 5, used | 0b010, cnt);
    dfs(x * 10 + 7, used | 0b100, cnt);
}

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

    cin >> n;
    int cnt = 0;
    dfs(0, 0, cnt);
    cout << cnt << endl;
}

Measured memory_bytes: 256
#define LOCAL
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rrep(i, n) for(int i=(n-1); i>=0; --i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define ALL(v) (v).begin(), (v).end()
#define memr(dp, val) memset(dp, val, sizeof(dp))
using namespace std;
typedef long long ll;
static const int INTINF = (INT_MAX >> 1); // 10^9 + 10^7
static const ll LLINF = (LLONG_MAX >> 1);
static const int MAX = 1e5+1;
static const ll MOD = 1e9+7;
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; }
string to_string(string s) { return '"' + s + '"'; }
string to_string(bool b) { return b ? "true" : "false"; }
template <size_t N> string to_string(bitset<N> bs) {
  string res;
  for (size_t i = 0; i < N; ++i) res += '0' + bs[i];
  return res;
}
string to_string(vector<bool> v) {
  string res = "{";
  for (bool e : v) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p);
template <class C> string to_string(C c) {
  string res = "{";
  for (auto e : c) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
void debug() { cerr << '\n'; }
template <class Head, class... Tail> void debug(Head head, Tail... tail) {
  cerr << '\t' << to_string(head), debug(tail...);
}
#ifdef LOCAL
#define DEBUG(...) cerr << "[" << #__VA_ARGS__ << "]:", debug(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

int main(int argc, const char * argv[]) {
  std::cout << std::fixed << std::setprecision(15);

  int N; cin >> N;
  int ans = 0;
  rep2(i, 1, N+1){
    if(i % 2 == 0) continue;
    int cnt = 0;
    for(int j=1; j * j <= i; j++){
      if(i % j == 0){
        if(j == i / j){
          cnt++;
        }
        else{
          cnt += 2;
        }
      }
    }
    if(cnt == 8){
      ans++;
    }
  }
  cout << ans << endl;
}  


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;


class Program
{
    public static long Read()
    {
        return long.Parse(Console.ReadLine());
    }

    public static long[] Reads()
    {
        return Console.ReadLine().Split().Select(long.Parse).ToArray();
    }


    public static void Main()
    {
        var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);

        var input = Reads();
        var a = input[0];
        var b = input[1];
        var c = input[2];
        if (b / a >= c)
            Console.WriteLine(c);
        else
            Console.WriteLine(b / a);


        Console.Out.Flush();
    }
}


Measured memory_bytes: 13396
import sys
input = sys.stdin.readline

A, B = map(int, input().split())
res = 0
if A in (1,2,3):
    res += (4-A)*100000
if B in (1,2,3):
    res += (4-B)*100000
if (A,B) == (1,1):
    res += 4*100000

print(res)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
typedef long long     ll;
#define fast          ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define fr            first
#define sc            second
#define com(i,n)      for(int i=0;i<n;i++)
#define dom(i,n)      for(int i=1;i<=n;i++)
#define mom(i,n)      for(int i=n;i>=0;i--)
#define sortI(a,n)    sort(a,a+n)
#define sortD(a,n)    sort(a,a+n,greater<int>())
#define sortvi(a)     sort(a.begin(),a.end())
#define sortvd(a)     sort(a.begin(),a.end(),greater<int>())
#define sumall(a,x)   accumulate(a.begin(),a.end(),x)
#define pi            3.14159265358979323846264338327950
using namespace std;
int main()
{
    int n,k,sum=0;
    cin>>n>>k;
    int a[n];
    com(i,n)
    {
         cin>>a[i];
    }
    sort(a,a+n);
    com(i,k) sum+=a[i];
    cout << sum << endl;
}


Measured memory_bytes: 3628
#include<iostream>
#include<string>
using namespace std;
struct Dice{
  int s[6];
  void roll(char c){
    int b;
    if(c=='E'){
      b=s[0];
      s[0]=s[3];
      s[3]=s[5];
      s[5]=s[2];
      s[2]=b;
    }
    if(c=='W'){
      b=s[0];
      s[0]=s[2];
      s[2]=s[5];
      s[5]=s[3];
      s[3]=b;
    }
    if(c=='N'){
      b=s[0];
      s[0]=s[1];
      s[1]=s[5];
      s[5]=s[4];
      s[4]=b;
    }
    if(c=='S'){
      b=s[0];
      s[0]=s[4];
      s[4]=s[5];
      s[5]=s[1];
      s[1]=b;
    }
    if(c=='R'){
      b=s[1];
      s[1]=s[2];
      s[2]=s[4];
      s[4]=s[3];
      s[3]=b;
    }    
  }
  int top() {
    return s[0];
  }
  int right(){
    return s[2];
  }
  int left(){
    return s[3];
  }
  int front(){
    return s[1];
  }
};
int main(){
  Dice d;
  for(int i=0;i<6;i++) cin >> d.s[i];
  int n;cin >> n;
  while(n--){
    int a,b;cin >> a >> b;
    if(d.left()==a) d.roll('E');
    if(d.right()==a) d.roll('W');
    while(d.top()!=a) d.roll('N');
    while(d.front()!=b) d.roll('R');
    cout << d.right() << endl;
  }
  return 0;
}


Measured memory_bytes: 3064
import java.util.*;
import java.lang.*;
import java.io.*;
class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		int S = Integer.parseInt(br.readLine());
		int hour = S / 3600;
		int a = S % 3600;
		int min = a / 60;
		int sec = a % 60;
		System.out.println(hour + ":" + min + ":" + sec);
	}
}

Measured memory_bytes: 24348
#include<bits/stdc++.h>
#define ll long long
#define rep(i, n) for(int i=0; i<n; i++)
#define REP(i, n) for(int i=0; i<=n; i++)
#define repr(i, n) for(int i=n; i>0; i--)
#define REPR(i, n) for(int i=n; i>=0; i--)
const ll INF = 1e18;
const int INT_INF = 1e9;
const ll MOD = 1e9+7;
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; }
using namespace std;

int N, d;
set<int> s;

int main() {
    cin >> N;
    rep(i, N) {
        cin >> d;
        s.insert(d);
    }

    cout << s.size() << endl;
}


Measured memory_bytes: 256
import sys
from scipy.special import comb
import functools
import operator

"""def sum(l):
    result = functools.reduce(operator.mul, l)
    return result"""

readline = sys.stdin.readline
readlines = sys.stdin.readlines
ns = lambda: readline().rstrip() # input string
ni = lambda: int(readline().rstrip()) # input int
nm = lambda: map(int, readline().split()) # input multiple int 
nl = lambda: list(map(int, readline().split())) # input multiple int to list

N, P = nm()
A = nl()
even = 0
odd = 0
for a in A:
    if a % 2 == 0:
        even += 1
    else:
        odd += 1
if P == 0:
    ans = sum([comb(even, i, exact=True) for i in range(0, even+1)]) * sum([comb(odd, i, exact=True) for i in range(0, odd+1, 2)])
else:
    ans = sum([comb(even, i, exact=True) for i in range(0, even+1)]) * sum([comb(odd, i, exact=True) for i in range(1, odd+1, 2)])
print(ans)

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

int main(){
  int N; cin >> N;
  int color[9]={};
  int a;
  for(int i=0; i<N; i++){
    cin >> a;
    if(a<3200){
      color[a/400]++;
    }else{
      color[8]++;
    }
  }
  int result=0;
  for(int i=0; i<8; i++){
    result+=(color[i]>0?1:0);
  }
  cout << result+(result==0&&color[8]>0?1:0) << " " << result+color[8] << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String s = sc.nextLine();
		int[] a = new int[s.length()];

		int current = 0;
		for (int i = 0; i < s.length(); i++) {
			if (s.charAt(i) == 'R') {
				current++;
			} else if (current > 0) {
				a[i] += current / 2;
				a[i - 1] += (current - 1) / 2 + 1;
				current = 0;
			}
		}

		current = 0;
		for (int i = s.length() - 1; i >= 0; i--) {
			if (s.charAt(i) == 'L') {
				current++;
			} else if (current > 0) {
				a[i] += current / 2;
				a[i + 1] += (current - 1) / 2 + 1;
				current = 0;
			}
		}

		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < a.length; i++) {
			sb.append(a[i]);
			sb.append(" ");
		}
		System.out.println(sb.toString());
	}
}


Measured memory_bytes: 30584
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;
using static System.Console;
using System.Numerics;
using System.Text.RegularExpressions;

namespace atcorder2
{
    class Program
    {
        public static long Read()
        {
            return long.Parse(Console.ReadLine());
        }

        public static long[] Reads()
        {
            return Console.ReadLine().Split().Select(long.Parse).ToArray();
        }


        public static long Gcd(long x,long y)
        {
            if (x < y) Gcd(y, x);
            while (y > 0)
            {
                var z = x;
                x = y;
                y = z % y;
            }
            return x;
        }

        public static long Lcm(long x,long y)
        {
            return x * y / Lcm(x, y);
        }

        public static bool IsLowercaseAlphabet(char target)
        {
            return new Regex("^[a-z]+$").IsMatch(target.ToString());
        }

        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            
            var q = Reads();
            var n = q[0];
            var m = q[1];
            var x = q[2];
            var c = new long[n];
            var a = new long[n][];
            for (int i = 0; i < n; i++)
            {
                q = Reads();
                c[i] = q[0];
                a[i] = new long[m];
                for (int j = 0; j < m; j++)
                {
                    a[i][j] = q[j + 1];
                }
            }

            var bit = new long[n];
            for (int i = 0; i < n; i++)
            {
                bit[i] = (long)Math.Pow(2, i);
            }

            var s = 0;
            var cost = new List<long>();
            for (int i = 0; i < (long)Math.Pow(2,n); i++)
            {
                var memo = new long[m];
                long t = 0;
                for (int j = 0; j < n; j++)
                {
                    if ((i & bit[j]) != 0)
                    {
                        t += c[j];
                        for (int k = 0; k <m ; k++)
                        {
                            memo[k] += a[j][k];
                        }
                    }
                }
                var f = true;
                for (int j = 0; j < m; j++)
                {
                    if (x > memo[j]) f = false;        
                }
   
                if (f) cost.Add(t);
            }
            WriteLine(cost.Count!=0?cost.Min():-1);
      



            Console.Out.Flush();
        }
    }
}



Measured memory_bytes: 19756
#include<bits/stdc++.h>
using namespace std;
int main()
{
    double t,m,n,i,j;
    vector<long long int> ara;
    string str1,str;
    cin>>t;
    cout<<fixed<<setprecision(20)<<(2*3.141592653589793238*t)<<endl;
    return 0;
}


Measured memory_bytes: 3780
#include <bits/stdc++.h>
#define ll long long int 
using namespace std;

int main() {
   unsigned long long int n,d;
   cin>>n>>d;
       unsigned long long int u=0,h,m=123456,y=0,j,i;
       if(d-n>=2019)
       m=0;
       else{
       for(i=n;i<=d;i++)
       {
           for(j=i+1;j<=d;j++)
           {
             h=(i*(j));
           h%=2019;
           m=min(m,h);
             
           }
       }
       }
       cout<<m<<endl;
   
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <utility>
#define maxn 1005
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int n,a[maxn];
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
	}
	int cnt = 0;
	for(int i=1;i<n;i++){
		int mini = i;
		for(int j=i+1;j<=n;j++){
			if(a[mini] > a[j]) mini = j;
		}
		swap(a[i],a[mini]);
		if(a[i] != a[mini]) cnt++;
	}
	for(int i=1;i<=n;i++){
		printf("%d%c",a[i],i == n ? '\n':' ');
	}
	printf("%d\n",cnt);
	return 0;
}



Measured memory_bytes: 3180
#include <iostream>
#include<list>
using namespace std;
int main(void){
    // Your code here

int K;
cin>>K;
 string myints[9] = {"1","2","3","4","5","6","7","8","9"};
  std::list<string> l (myints, myints + 9);


string ans;
while(K--){
    ans= l.front();
	string temp(ans);
    l.pop_front();
   char c= ans[ans.length()-1];
    if(c!='0')
    {temp+=(c-1);
    l.push_back(temp);
    }
	temp=ans;
  
     temp+=(c);
    l.push_back(temp);
   
    temp=ans;
   
    if(c!='9'){
    temp+=(c+1);
    l.push_back(temp);
    }
    }
       
cout<<ans;    
}



Measured memory_bytes: 9216
use proconio::{input, fastout};
use std::collections::HashMap;

#[fastout]
fn main() {
    input! {
        n: usize,
        ax: [i64; n]
    }


    let mut l = HashMap::new();
    let mut r = HashMap::new();

    for (i, &a) in ax.iter().enumerate() {
        (*l.entry(i as i64 + a).or_insert(0)) += 1;
        (*r.entry(i as i64 - a).or_insert(0)) += 1;
    }

    let mut ans: i64 = 0;
    for (key, &lvalue) in l.iter() {
        
        if let Some(&rvalue) = r.get(key) {
            ans += lvalue * rvalue;
        }
    }

    println!("{}", ans);
}

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

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

int main() {
    int h, w;
    cin >> h >> w;

    string s[h];
    for (int i = 0; i < h; i++) cin >>s[i];

    int tx, ty;
    bool ok;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (s[i][j] == '.') continue;

            ok = false;
            for(int k = 0; k < 4; k++) {
                tx = i + dx[k];
                ty = j + dy[k];
                if (tx < 0 || tx >= h) continue;
                if (ty < 0 || ty >= w) continue;
                if (s[tx][ty] == '#') ok = true;
            }
            if (!ok) {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	string s, t, u;
	cin >> s >> t >> u;
	string ans = "";
	ans += char(s[0] - 32);
    ans += char(t[0] - 32);
	ans += char(u[0] - 32);
	cout << ans << endl;
	return 0;
}



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

const ll N = 1e2 + 8;
const ll W = 1e5 + 8;

ll n, w;
struct item {
    ll w, v;
};
vector <item> a;

ll dp[W][N] {};

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    ///freopen("input.in", "r", stdin);
    ///freopen("output.out", "w", stdout);
    cin >> n >> w;
    a.resize (n + 1);
    for (ll i = 1; i <= n; ++i)
        cin >> a[i].w >> a[i].v;
    dp[a[1].w][1] = a[1].v;
    for (ll k = 1; k <= n; ++k) {
        for (ll x = 0; x <= w; ++x) {
            if (x - a[k].w >= 0)
                dp[x][k] = max ({dp[x][k], dp[x - a[k].w][k - 1] + a[k].v});
            dp[x][k] = max (dp[x][k], dp[x][k - 1]);
        }
    }
    cout << dp[w][n] << '\n';
    return 0;
}


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

struct Edge {
  int v, w, c;
};

typedef vector<vector<Edge> > Graph;

struct State {
  int v, prev, speed, f;
  double w;
  bool operator < (const State &s) const {
    return w > s.w;
  }
};

const int MAXN = 31;
const int MAXS = 31;
const double inf = 1.0 / 0.0;
int n, m, s, g;
Graph G;
double cost[MAXN][MAXN][MAXS][2];

void solve() {
  try {
    priority_queue<State> que;
    que.push((State){s, n, 1, 0, 0.0});
    fill(cost[0][0][0], cost[MAXN][0][0], inf);
    cost[s][n][1][0] = 0.0;
    while(que.size()) {
      const State s = que.top();
      que.pop();
      if(cost[s.v][s.prev][s.speed][s.f] < s.w) continue;
      if(s.v == g && s.f) throw s.w;
      for(int i = 0; i < G[s.v].size(); ++i) {
        const Edge &e = G[s.v][i];
        if(e.v == s.prev) continue;
        if(e.c < s.speed) continue;
        for(int nspeed = max(0, s.speed-1);
            nspeed <= min(30, s.speed+1); ++nspeed) {
          const State t = {e.v, s.v, nspeed, s.speed == 1, 
                           s.w + (double)e.w / (double)s.speed};
          if(cost[t.v][t.prev][t.speed][t.f] <= t.w) continue;
          cost[t.v][t.prev][t.speed][t.f] = t.w;
          que.push(t);
        }
      }
    }
    throw -1.0;
  } catch(const double res) {
    if(res == -1) printf("unreachable\n");
    else printf("%.10f\n", res);
  }
}

int main() {
  while(cin >> n >> m && (n|m)) {
    cin >> s >> g; --s; --g;
    G = Graph(n);
    for(int i = 0; i < m; ++i) {
      int x, y, d, c;
      cin >> x >> y >> d >> c;
      --x; --y;
      G[x].push_back((Edge){y, d, c});
      G[y].push_back((Edge){x, d, c});
    }
    solve();
  }
  return 0;
}

Measured memory_bytes: 2712
#include<bits/stdc++.h>
using namespace std;
int main()
{
	char a,b,c,d,e,f;
     cin>>a>>b>>c>>d>>e>>f;
	 if (a==f&&b==e&&c==d) cout<<"YES"<<endl;
	 else cout<<"NO"<<endl;
	 return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define ve vector
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)

int main(){
    int n;
    cin >> n;
    string s = "ACL", ans = "";
    rep(i,n){
        ans += s;
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3600