akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef  long long int ll;
#define rep(i, n) for (int i = 0; i < (n); i++)
int n, m;
string a[51];
string b[51];


int main() {
    ios::sync_with_stdio(false);
    
    cin >> n >> m;
    
    rep(i, n) cin >> a[i];
    rep(i, m) cin >> b[i];
    
    bool ans = false;
    
    for (int i = 0; i <= n-m; i++) {
        for (int j = 0; j <= n-m; j++){
            bool subSame = true;
            
            for (int k = i; k < i+m; k++) {
                for (int l = j; l < j+m; l++) {
                    //printf("%d %d\n", k, l);
                    if (a[k][l] != b[k-i][l-j]) {
                        subSame = false;
                    }
                }
            }
            
            //
            if (subSame == true) {
                cout << "Yes\n";
                return 0;
            }
        }
        
    }
    cout << "No\n";
    return 0;
    
    
    return 0;
}







Measured memory_bytes: 256
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>

using namespace std;

#define FOR(i, a, b) for(int (i)=(a);(i)<(b);(i)++)
#define IFOR(i, a, b) for(int (i)=(a);(i)<=(b);(i)++)
#define RFOR(i, a, b) for(int (i)=(a);(i)>=(b);(i)--)
#define REP(i, n) FOR((i), 0, (n))

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template<class T>
void print_container(T &container, string delim=" ") {
    bool first = true;
    for(auto &t: container){
        if(!first){
            cout << delim;
        }
        first = false;
        cout << t;
    }
    cout << endl;
}

int main() {
    int n;
    cin >> n;
    vector<int> a(n), b(n), c(n);
    REP(i, n){
        cin >> a[i];
        a[i]--;
    }
    REP(i, n){
        cin >> b[i];
    }
    REP(i, n-1){
        cin >> c[i];
    }
    int ans = 0;
    REP(i, n){
        ans += b[a[i]];
        if(i >= 1 && (a[i] == a[i-1]+1))
            ans += c[a[i]-1];
    }
    cout << ans << endl;
    return 0;
}

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

template<class T> struct WeightedUnionFind {
    int sz;
    vector<int> data;
    vector<T> potential;

    WeightedUnionFind (int sz, T id = 0)
        : sz(sz), data(sz, -1), potential(sz, id) { }

    bool unite (int x, int y, T w) {
        w += (weight(x) - weight(y));
        x = root(x); y = root(y);
        if (x == y) return false;
        if (data[x] > data[y]) { swap(x, y); w = -w; }
        data[x] += data[y];
        data[y] = x;
        potential[y]= w;
        sz--;
        return true;
    }

    bool is_same (int x, int y) { return root(x) == root(y); }

    int root (int x) {
        if (data[x] < 0) return x;
        int r = root(data[x]);
        potential[x] += potential[data[x]];
        return data[x] = r;
    }

    T weight (int x) { root(x); return potential[x]; }

    T diff (int x, int y) { return weight(y) - weight(x); }

    int size () { return sz; }

    int size (int x) { return -data[root(x)]; }

};


int main() {
    int n, m;
    cin >> n >> m;
    WeightedUnionFind<int> uf(n, 0);
    
    bool ok = true;
    for (int _ = 0; _ < m; _++) {
        int l, r, d;
        cin >> l >> r >> d;
        l--; r--;
        if (!uf.unite(l, r, d)) {
            if (uf.diff(l, r) != d) ok = false;
        }
    }
    
    cout << (ok ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#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 FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll mod = 1000000007;
//const ll mod = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

struct UnionFind {
public:
  vector<ll> par; 
  vector<ll> siz; 

    
  UnionFind(ll sz_): par(sz_), siz(sz_, 1) {
    for (ll i = 0; i < sz_; ++i) par[i] = i; 
  }
  void init(ll sz_) {
    par.resize(sz_);
    siz.resize(sz_, 1);
    for (ll i = 0; i < sz_; ++i) par[i] = i;
  }

  ll root(ll x) { 
    while (par[x] != x) {
      x = par[x] = par[par[x]];
    }
    return x;
  }

  bool merge(ll x, ll y) {
    x = root(x);
    y = root(y);
    if (x == y) return false;
    if (siz[x] < siz[y]) swap(x, y);
    siz[x] += siz[y];
    par[y] = x;
    return true;
  }

  bool issame(ll x, ll y) {
    return root(x) == root(y);
  }

  ll size(ll x) {
    return siz[root(x)];
  }
};

int main() {
  ll n, m;
  cin >> n >> m;
  UnionFind uf(2 * n);
  rep(i, m) {
    ll a, b;
    cin >> a >> b;
    a--, b--;
    uf.merge(a, b + n);
    uf.merge(a + n, b);
  }

  rep(i, n) {
    if (uf.issame(i, n + i)) {
      cout << n * (n - 1) / 2 - m << endl;
      return 0;
    }
  }
  ll cnt = 0;
  rep(i, n) {
    if (uf.issame(0, i)) cnt++;
  }
  cout << cnt * (n - cnt) - m << endl;




  
  return 0;
}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define REP(i,n) for(int i=(0);i<(n);i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long long ll;
typedef double ld;

template<class T> inline void read(T &x){
	int f=0;x=0;char ch=getchar();
	for(;!isdigit(ch);ch=getchar())f|=(ch=='-');
	for(;isdigit(ch);ch=getchar())x=x*10+ch-'0';
	if(f)x=-x;
}

const int N=500005,M=2000005,inf=1e9;
namespace G{
	struct edge{int v,f,c,p;};
	vector<edge> e[N];
	int d[N],r[N],in[N],n,m,s,t;
	void init(int _n,int _s,int _t){
		n=_n,s=_s,t=_t,m=0;
	}
	void add(int a,int b,int c,int t=0){
		e[a].pb((edge){b,0,c,e[b].size()});
		e[b].pb((edge){a,0,t*c,e[a].size()-1});
	}
	int bfs(){
		static int q[N]; int l=0,r=0;
		fill(d+1,d+n+1,0),d[s]=1;
		for(l=r=0,q[r++]=s;l<r;){
			int u=q[l++];
			REP(i,e[u].size()){
				edge &v=e[u][i];
				if(!d[v.v]&&v.f<v.c){
					d[q[r++]=v.v]=d[u]+1;
					if(v.v==t)return 1;
				}
			}
		}
		return 0;
	}
	int dfs(int u,int a){
		if(u==t)return a;
		int res=0; in[u]=1;
		for(int &k=r[u];k<e[u].size();k++){
			edge &v=e[u][k];
			if(v.f<v.c&&d[v.v]==d[u]+1&&!in[v.v]){
				int now=dfs(v.v,min(a,v.c-v.f));
				v.f+=now,e[v.v][v.p].f-=now,res+=now;
				if(!(a-=now))break;
			}
		}
		return in[u]=0,res;
	}
	int flow(){
		int res=0;
		while(bfs()){
			fill(r+1,r+n+1,0);
			res+=dfs(s,inf);
		}
		return res;
	}
}
int A[N],B[N],x[N],y[N];
int n,cnt,a,b,s,t,ans;

int main(){
	read(n);
	rep(i,1,n)read(x[i]),++x[i];
	rep(i,1,n)read(y[i]),++y[i];
	rep(i,1,n)if(!A[i]){
		++cnt;
		for(int p=i;!A[p];p=x[p])
			A[p]=cnt;
	}
	rep(i,1,n)if(!B[i]){
		++cnt;
		for(int p=i;!B[p];p=y[p])
			B[p]=cnt;
	}
	s=++cnt,t=++cnt;
	G::init(t,s,t);
	rep(i,1,n){
		a=x[i],b=y[i];
		if(a==i&&b==i)	continue;
		ans++;
		if(a==i)		G::add(s,B[i],1);
		else if(b==i)	G::add(A[i],t,1);
		else if(a==b)	G::add(A[i],B[i],1,1);
		else			G::add(A[i],B[i],1);
	}
	printf("%d\n",ans-G::flow());
	return 0;
}

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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(ll i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 100010

signed main()
{
    double a, b;
    cin >> a >> b;
    a += b;
    a /= 2.0;
    printf("%lld\n", static_cast<ll>(ceil(a)));
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>

int main()
{
	int n;
	scanf("%d", &n);

	unsigned long *a = new unsigned long[n];
	int i;
	for (i = 0; i < n; i++) {
		scanf("%ld", &a[i]);
	}
	int count = 0;
	for (i = 0; i < n; i++) {
		while ((a[i] & 0x1) == 0) {
			count++;
			a[i] >>= 1; 
		}
	}
	delete[] a;
	printf("%d\n", count);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define FASTINOUT ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const ll mod = 1e9+7;
const int N=2e5+9;
int main()
{
    FASTINOUT;
    int a,b,c;
    cin>>a>>b>>c;
    if (c>=a&&c<=b)
        cout<<"Yes\n";
    else
        cout<<"No\n";
    return 0;
}


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

int main(){
  int n,x;
  cin >> n >> x;
  int a[n];
  for(int i = 0; i < n; i++){
    cin >> a[i];
    x -= a[i];
  }
  sort(a,a+n);
  cout << n + (x / a[0]) << endl;
}


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

template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { os << "{"; for (typename vector<T>::const_iterator vi = v.begin(); vi != v.end(); ++vi) { if (vi != v.begin()) os << ", "; os << *vi; } os << "}"; return os; }
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { os << '(' << p.first << ", " << p.second << ')'; return os; }

void dbg_out() { cerr << endl; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); }

#ifdef NEAL
#define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
#else
#define dbg(...)
#endif


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

    int A, B, M;
    cin >> A >> B >> M;
    vector<int> a(A), b(B);

    for (int i = 0; i < A; i++)
        cin >> a[i];

    for (int j = 0; j < B; j++)
        cin >> b[j];

    int best = *min_element(a.begin(), a.end()) + *min_element(b.begin(), b.end());

    for (int i = 0; i < M; i++) {
        int x, y, c;
        cin >> x >> y >> c;
        x--; y--;
        best = min(best, a[x] + b[y] - c);
    }

    cout << best << '\n';
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;
int INF = 1000000009;
void comb(vector<vector<ll>> &v)
{
  for (int i = 0; i < v.size(); i++)
  {
    v[i][0] = 1;
    v[i][i] = 1;
  }
  for (int k = 1; k < v.size(); k++)
  {
    for (int j = 1; j < k; j++)
    {
      v[k][j] = (v[k - 1][j - 1] + v[k - 1][j]);
    }
  }
}
int main()
{
  int n,p;
  cin >> n >> p;
  vector<int> a(n);
  ll cnt0 = 0;
  ll cnt1 = 0;
  vector<vector<ll>> v(n + 1, vector<ll>(n + 1, 0));
  comb(v);
  rep(i, n)
  {
    cin >> a[i];
    if(a[i]%2){
      cnt1++;
    }else{
      cnt0++;
    }
  }
  ll ans = 0;
  ll tmp0 = 0;
  ll tmp1 = 0;
  tmp0 = 1LL << cnt0;
  for(int i = 0;i <= cnt1;i+=2){
    tmp1 += v[cnt1][i];
  }
  ans += tmp0 * tmp1;
  if(p == 1){
    ans = (1LL << n) - ans;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
function main(input: string) {
  const arrInput: string[] = input
    .split("\n")[0]
    .split(" ")
    .sort();
  if (arrInput[0] === "5" && arrInput[1] === "5" && arrInput[2] === "7") {
    console.log("YES");
  } else {
    console.log("NO");
  }
}

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


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

using namespace std;

const int P = 1000000007;

long long dp[2005];

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

	dp[0] = 1;	
	for(int i = 0; i <= s; ++i) {
		for(int j = 3; j <= i; ++j) {
			dp[i] = (dp[i] + dp[i - j]) % P;	
		}
	}

	cout << dp[s] << '\n';

	return 0;
}


Measured memory_bytes: 3648
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <cstring>

int main(){
	int N;
	scanf("%d", &N);

	char map[100][100+1];
	memset(map, 0, sizeof(map));

	int tmp;
	for (int i = 1; i < N + 1; i++) {
		scanf("%d", &tmp);
		for (int j = 0; j < 100; j++) {
			map[j][i] = (j < tmp) ? 1 : 0;
		}
	}

	int count = 0;
	for (int i = 0; i < 100; i++) {
		for (int j = 0; j < N; j++) {
			if (map[i][j] == 0 && map[i][j + 1] == 1) count++;
		}
	}

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

	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <climits>
#include <algorithm>
#include <vector>

using namespace std;

int main() {

	int n, k;
	cin >> n >> k;

	vector<int> h(n+k+1);
	vector<int> dp(n +k+ 1, INT_MAX);

	for (int i = 1; i <= n; i++)
		cin >> h[i];

	dp[1] = 0;

	int min = INT_MAX;
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= k; j++) {
			if (dp[i+j] > dp[i] + abs(h[i] - h[i+j]))
				dp[i+j] = dp[i] + abs(h[i] - h[i+j]);
		}
	}

	cout << dp[n] << endl;

}

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

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

  long long int ans=0;
  rep(i,1,n+1){ans+=n-i;}

  cout<<ans<<endl;

  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int d = Integer.parseInt(sc.next());
        int g = Integer.parseInt(sc.next());
        int[] p = new int[d];
        int[] c = new int[d];
        for(int i=0;i<d;i++){
            p[i] = Integer.parseInt(sc.next());
            c[i] = Integer.parseInt(sc.next());
        }
        sc.close();
        int sum;
        int minval = Integer.MAX_VALUE;
        int count,index = -1;
        for(int i=0;i<1<<d;i++){
            sum = count = 0;
            index = -1;
            for(int j=0;j<d;j++){
                if(((i>>d-1-j)&1)==1){
                    sum+=p[j]*100*(j+1)+c[j];
                    count+=p[j];
                }else{
                    index = j;
                }
            }
            if(sum<g && index>=0){
                int point = 100*(index+1);
                int need = (g-sum+point-1)/point;
                if(need >= p[index]){
                    continue;
                }else{
                    count+=need;
                }
            }
            minval = Math.min(count,minval);
        }
        System.out.println(minval);
    }

}

Measured memory_bytes: 23892
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

template<class T>
constexpr T INF = ::numeric_limits<T>::max() / 2 - 170;

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    if(b < a) swap(a, b);
    if(c < b) swap(b, c);
    if(b < a) swap(a, b);
    int ans = 0;
    ans += c-b, a += c-b; b = c;
    if((c-a)%2) ans += (c-a)/2+2;
    else ans += (c-a)/2;
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define lli long long int
#define lld long double
#define REP(i,s,n) for(lli i=s;i<n;i++)
#define RREP(i,s,n) for(lli i=s;i>=n;i--)
#define MOD 1000000007
#define NUM 2520
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define INF (1LL<<50)

lli dp[60][3000];

signed main(){

	lli n,a;
	cin>>n>>a;

	dp[0][0]=1;

	REP(i,0,n){
		lli x;
		cin>>x;
		for(lli j=n;j>0;j--){
			REP(k,0,2700){
				dp[j][k+x] += dp[j-1][k];
			}
		}
	}

	lli ans = 0;
	REP(i,1,n+1){
		ans+=dp[i][i*a];
	}

	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 1408
package main

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

func stdioText(s *bufio.Scanner) string {
	s.Scan()
	return s.Text()
}

func stdioNum(s *bufio.Scanner) int {
	num, _ := strconv.Atoi(stdioText(s))
	return num
}

func stdioNums(s *bufio.Scanner) []int {
	var nums []int
	for _, v := range strings.Split(stdioText(s), " ") {
		i, _ := strconv.Atoi(v)
		nums = append(nums, i)
	}
	return nums
}

func main()  {
	s := bufio.NewScanner(os.Stdin)
	nums := stdioNums(s)
	fmt.Println(nums[2] / nums[0] * nums[1])
}


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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr(i,n) for(int i=(int)(n-1);i>=0;i--)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout << #x" = " << x << endl
#define print(x) cout << x << endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<int, P> PIP;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;
typedef set<int> S;

#define INF INT_MAX/3
#define MAX_N 1000000001


int main(){
  cin.sync_with_stdio(false);
  int e;
  while(cin >> e, e) {
    int mini = INF;
    int i = 0;
    while(e >= i * i * i) {
      int tmp = e - i * i * i;
      int j = 0;
      while(tmp >= j * j) minch(mini, i + j + (tmp - j * j)), j++;
      i++;
    }
    cout << mini << endl;
  }

  return 0;
}

Measured memory_bytes: 3004
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <set>
#include <deque>
#include <utility>

int main(){
  int N, M;
  scanf("%d", &N);
  scanf("%d", &M);
  std::string s;
  std::cin >> s;
  int pos = N;
  bool ng = false;
  std::vector<int> ans;
  while(pos>0 && !ng){
    int next=std::max(0, pos-M);
    while(next<pos){
      if (s[next]=='0') break;
      next++;
    }
    if (next==pos) {
      ng=true;
      break;
    }
    ans.push_back(pos-next);
    pos=next;
  }
  //printf("ans.size()=%d\n", ans.size());
  std::reverse(ans.begin(), ans.end());
  if (ng){
    printf("-1\n");
  } else {
    for (int p : ans){
      printf("%d\n", p);
    }
  }
  return 0;
  
}
 

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

#define int long long
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}

int N;
int x[100];
int M;
int a[10],b[10],c[10];

int dp[10][110][110];
int dfs(int k,int l,int r){
    if(r-l==1){
        return x[l]==a[k];
    }
    int &ret=dp[k][l][r];
    if(ret!=-1)return ret;

    ret=0;
    for(int i=l+1;i<r;i++){
        ret|=dfs(b[k],l,i)&dfs(c[k],i,r);
    }
    return ret;
}

signed main(){
    cin>>N;
    rep(i,N)cin>>x[i];
    cin>>M;
    rep(i,M)cin>>a[i]>>b[i]>>c[i],b[i]--,c[i]--;

    memset(dp,-1,sizeof(dp));
    cout<<(dfs(0,0,N)?"Yes":"No")<<endl;
    return 0;
}

Measured memory_bytes: 4020
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>
#define int long long
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);

using namespace std;
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << endl;
  err(++it, args...);
}
int max(int a , int  b){
  if(a > b) return a;
  else return b;

}
int min(int a , int b){
  if(a < b) return a;
  else return b;
}
bool cmp(pair < int , string >   a , pair < int , string >   b){
  if(a.first < b.first ) return true;
  else return false;
}
long long binpow(long long a, long long b, long long m) {
    a %= m;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
int limit = 1e18;
int32_t main(){  
  fast;
  int n;
  cin >> n;
  vector <int > a(n);
  int val = 1;
  int f=0;
  for(int i = 0 ; i < n ; i++) cin >> a[i];
    
  sort(a.begin(),a.end());
  for(int i = 0 ; i < n ; i++){
    if(val ==0) continue;
    if(a[i] > (limit/val)) {
      f++;
      break;
    }
    val*=a[i];
  }
  if(f) cout << "-1\n";
  else cout << val << "\n";
  return 0;
} 


/*

WB14D0028763

  4
3 5 7
1111
4 4 10
0110
4 3 4
1010
4 3 4
1100

111



3
3 5 4
101

2*k1 <=k2 
11111
8 10
11111 0 
5 5 05
111
k2 k2 k2 

10 12
126


3 

00001110000

000111000111
1111100
1110011

11101 10 01 00
0
k1 k1 k2 

*/
/*
1
[-5,3,-5],-3,1]

[-2,4,2,5,-5]
5
0 -1 2 -1 3
*/

Measured memory_bytes: 3976
//#include "pch.h"
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>

#include <vector>
#include <set>
#include <map>
#include <iostream>
#include <utility>
#include <queue>
#include <algorithm>
#include <functional>
#include <string>
#include <bitset>

#define ll long long
#define fri(n) for(i=0;i<(n);i++)
#define frj(n) for(j=0;j<(n);i++)
#define min(p,q) ((p)<(q)?(p):(q))
#define max(p,q) ((p)>(q)?(p):(q))
#define INF 1000000000000000000//10^18
#define INFINT 2000000001//2*10^9+1
#define MOD 1000000007
#define MODANOTHER 998244353
#define PI acos(-1)

using namespace std;




int main(void)
{
	//変数の宣言
	char s[15];

	//よく使う変数
	int i,j,k,l;
	int flag=0;
	int ans=0;
	int count=0;
	int temp=0;
	int temp1=0;
	int temp2=0;
	int max=0;
	int min=INFINT;
	int len=0;
	int sum=0;
	int ok=0;
	int ng=0;



	//データの読み込み


	scanf("%s",&s);
//	scanf_s("%s",&s,15);

/*	for(i=0;i<n;i++){
//		scanf("%d",&p[i]);
		scanf_s("%d",&p[i]);
	}*/

	//	printf("nは%dです\n", n);
	//	printf("データの読み込み終了\n");
	//実際の処理

	len=strlen(s);
	temp=0;
	for(i=0;i<len;i++){
		if(s[i]=='A'||s[i]=='C'||s[i]=='G'||s[i]=='T'){
			temp++;
		}else{
			ans=max(ans,temp);
			temp=0;
		}	
	}
	ans=max(ans,temp);

	//	printf("計算部分終了\n");

	//出力

	printf("%d",ans);

/*	printf("\n");
	for(i=1;i<=n;i++){
		for(j=i;j<=n;j++){
			printf("hanten[%d][%d]={%d,%d}\n",i,j,hanten[i][j][0],hanten[i][j][1]);
		}
	}*/
	
	//	printf("結果の出力終了\n");

	return 0;
}



Measured memory_bytes: 256
#include<stdio.h>

int main()
{
  int n, a, b, i, s=0;
  scanf("%d", &n); 
  for(i=0; i < n; i++){
    scanf("%d %d", &a, &b);
    s += b - a + 1;
  }
  printf("%d\n", s);
  return 0;
}

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

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rept(i,n) for(int (i)=0;(i)<=(int)(n);(i)++)
#define reps(i,s,n) for(int (i)=(s);(i)<(int)(n);(i)++)
#define repst(i,s,n) for(int (i)=(s);(i)<=(int)(n);(i)++)
#define repr(i,n) for(int (i)=(n);(i)>=0;(i)--)
#define each(itr,v) for(auto (itr):(v))
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp(x,y) make_pair((x),(y))
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln "\n"
#define dbg(x) cout<<#x" = "<<(x)<<ln

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<int> > mat;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const int inf = (int)1e9;
const ll linf = (ll)1e18;
const int mod = (int)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

ll x, y, r = linf;

int main() {
	cin >> x >> y;
	if (x<=y) chmin(r, y-x);
	if (-x<=y) chmin(r, y+x+1);
	if (x<=-y) chmin(r, -y-x+1);
	if (-x<=-y) chmin(r, -y+x+2);
	cout << r << ln;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main () {
  int H, W;
  cin >> H >> W;
  vector<vector<int>> data(H + 2, vector<int> (W + 2, 0));
  char a;
  for(int i = 0; i < H; i++) {
    for(int j = 0; j < W; j++) {
      cin >> a;
      if(a == '#') data.at(i + 1).at(j + 1) = 1;
    }
  }
  for(int i = 0; i < H; i++) {
    for(int j = 0; j < W; j++) {
      if(data.at(i + 1).at(j + 1) == 1) {
        if(data.at(i).at(j + 1) == 1) continue;
        if(data.at(i + 2).at(j + 1) == 1) continue;
        if(data.at(i + 1).at(j) == 1) continue;
        if(data.at(i + 1).at(j + 2) == 1) continue;
        cout << "No" << endl;
        return 0;
      }
    }
  }
  cout << "Yes" << endl;
  return 0;
}


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

#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 debug(x) cout << #x << "=" << (x) << endl;
const ll MOD=1e9+7;
#define itn int
#define tin int
#define nit int
#define tni int
#define nti int
#define fro for
#define ofr for
#define ccin cin

template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<typename T> void fail(T v){cout << v << endl;exit(0);}
//template end

void solve(){
  ll K,A,B;
  cin>>K>>A>>B;
  K-=A;
  if(K<=0)fail(1);
  if(A<=B)fail(-1);
  cout<<1+(K+A-B-1)/(A-B)*2<<endl;
  
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  solve();
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <utility>
#include <algorithm>
#include <numeric>
#define load ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
#define ll long long
#define ull unsigned long long

const int INF = 1e9 + 5;


int main()
{
	load;
	int n, w;
	cin >> n >> w;
	vector<int> val(n);
	vector<int> weight(n);
	for(int i =0; i<n;i++){
		cin >> weight[i] >> val[i];
	}
	vector<vector<ll>> dp(n+1, vector<ll>(w+1));
	for (int i=0; i<=n; i++){
		for (int j=0; j<=w;j++){
			if (j==0 || i ==0){
				dp[i][j] = 0;
				continue;
			}
			if (j >= weight[i-1]){
				dp[i][j] = max(val[i-1] + dp[i-1][j-weight[i-1]], dp[i-1][j]);
			}else{
				dp[i][j] = dp[i-1][j];
			}
		}
	}
	cout << dp[n][w] << endl;

}


Measured memory_bytes: 80256
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <cstring>
#define rep(i, N) for (int i = 0; i < (int)N; i++)
using namespace std;
typedef long long ll;
const ll LLINF = 9223372036854775807;
const int MOD = 1000000007;

int main() {
  int A, B; cin >> A >> B;
  string result;
  if (A%3==0 || B%3==0 || (A+B)%3==0) result = "Possible";
  else result = "Impossible";
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int A,B,ans=0;
int main(){
  cin >> A >> B;
  for(int i=A;i<=B;i++){
    stringstream ss;
    ss << i;
    string s=ss.str();
    if(s[0]==s[4] && s[1]==s[3]) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
/* ***********************************************
Author        :BPM136
Created Time  :7/21/2019 9:01:07 PM
File Name     :B.cpp
************************************************ */

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<iomanip>
#include<bitset>
#include<queue>
#include<ctime>
#include<set>
#include<map>
#include<list>
#include<vector>
#include<cassert>
#include<string>
#include<cinttypes>
#include<cstdint>
#include<array>
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define USE_CIN_COUT ios::sync_with_stdio(0)

using namespace std;

typedef long long ll;
typedef double db;
typedef long double ld;
typedef unsigned int ui;
typedef unsigned long long ull;

int const N = 400005;

int a[N];
int nxt[N], last[N], link[N];
bool vis[N];

int main() {
	USE_CIN_COUT;
	int n;
	ll m;
	cin >> n >> m;
	for (int i = 1; i <= n; ++i)
		cin >> a[i];
	for (int i = n; i >= 1; --i) {
		nxt[i] = last[a[i]];
		last[a[i]] = i;
		link[i] = nxt[i] == 0 ? i : link[nxt[i] + 1];
	}
	if (link[1] == 0) 
		return 0;
	auto ans = vector<int>();
	int pos = 1;
	while (vis[pos] == 0) {
		// cerr << pos << '\n';
		vis[pos] = 1;
		ans.push_back(pos);
		if (pos) {
			// cerr << pos << ' ' << link[pos] << ' ' << a[link[pos]] << ' ' << last[a[link[pos]]] << '\n';
			pos = last[a[link[pos]]];
		}
		++pos;
		if (pos > n)
			pos = 0;
	}
	// cerr << '?';
	if (m > SZ(ans)) {
		int k = 0;
		// cerr << "??" << '\n';
		while (k < SZ(ans) && ans[k] != pos) 
			++k, --m;
		if (k == SZ(ans))
			while (1);
		m = (m - 1) % (SZ(ans) - k) + k;
	} else
		--m;
	// cerr << "???" << m << ' ' << SZ(ans) << '\n';
	// cerr << ans[m - 1] << '\n';
	// cerr << link[ans[m - 1]] << '\n';
	// for (int i = 0; i <= n; ++i)
	//     cerr << link[i] << ' ';
	// cerr << '\n';
	for (int i = link[ans[m]]; i; i = link[i + 1]) {
		// cerr << i << '\n';
		cout << a[i] << ' ';
	}
	cout << '\n';
    return 0;
}


Measured memory_bytes: 7668
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = 1'000'000'007;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

vector<int> powerArray(int p, int n) {
	vector<int> power(n + 1); power[0] = 1;
	for (int i = 0; i < n; i++)
		power[i + 1] = power[i] * p;
	return power;
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, K; cin >> N >> K;

	vector<int> pow2 = powerArray(2, 10);
	vector<int> sum = pow2;

	rep(i, 1, 9)sum[i + 1] += sum[i];


	int k = 1;

	vector<int> a, b;

	for (int i = 1; i <= N; i++) {
		rep(j, 0, 10) {
			if (i & (1 << j)) {
				if (pow2[j] == i)continue;
				a.emplace_back(i);
				b.emplace_back(pow2[j]);
			}
		}
	}

	cout << a.size() << endl;
	rep(i, 0, a.size()) {
		cout << a[i] << " " << b[i] << endl;
	}

	rep(_, 0, K) {
		int out = 1;
		int k = 1;

		bool yes = false;
		int ans = 0;
		rep(j, 0, 10) {
			if ((1 << j) > N)continue;
			cout << (1 << j) <<endl;
			string s; cin >> s;
			if (s == "Yes") {
				yes = true;
				break;
			}
			else if (s == "Near") {
				ans |= (1 << j);
			}
		}
		if (yes)continue;

		cout << ans << endl;
		string s; cin >> s;
		
	}

	return 0;
}


Measured memory_bytes: 3312
let () = print_endline @@ Scanf.scanf "%d\n" @@ function
  | 1 -> Scanf.scanf "%d\n" @@ fun a ->
      if a mod 2 = 0 then "second" else "first"
  | n ->
      let as_ = Array.init n @@ fun _ -> Scanf.scanf "%d\n" @@ fun a -> a mod 2 = 0 in
      Array.sort (fun i j -> compare j i) as_;
      if
        Array.fold_left ( && ) true as_
      then "second"
      else "first"


Measured memory_bytes: 5504
#include <iostream>

using namespace std;

int bitcount(uint64_t b) {
    b = (b & 0x55555555) + (b >> 1 & 0x55555555);
    b = (b & 0x33333333) + (b >> 2 & 0x33333333);
    b = (b & 0x0f0f0f0f) + (b >> 4 & 0x0f0f0f0f);
    b = (b & 0x00ff00ff) + (b >> 8 & 0x00ff00ff);
    return (b & 0x0000ffff) + (b >> 16);
}

int main()
{
	int N, A[20], x[20][20], y[20][20];
	cin >> N;
	for(int n=0; n<N; n++){
		cin >> A[n];
		for(int a=0; a<A[n]; a++){
			cin >> x[n][a] >> y[n][a];
		}
	}

	int res = 0;
	for(uint64_t bf=0; bf<(0x01ULL << N); bf++){
		bool sat = true;
		for(int n=0; n<N; n++){
			if(bf & (0x01ULL << n)){
				for(int a=0; a<A[n]; a++){
					if(((bf >> (x[n][a]-1)) & 0x01ULL) ^ y[n][a]){
						sat = false;
					}
				}
			} else {
				continue;
			}
		}
		if(sat){
			res = max(res, bitcount(bf));
		}
	}

	cout << res;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <queue>
#include <string>
#include <algorithm>
#include <cmath>
#include <climits>
#define REP(i, n) for(int i=0; i<(n); i++)
#define FOR(i, a, n) for(int i=(a); i<(n); i++)
using namespace std;

int main(){
    string s;
    cin >> s;
    string ans;
    if(s[0] != '9' && s[1] != '9') ans = "No";
    else ans = "Yes";
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>

using namespace std;

#define rep(i,a,n) for(int (i)=a;(i)<(int)(n);(i)++)
#define rrep(i,a,n) for(int (i)=(n)-1;(i)>=a;(i)--)
#define all(x) (x).begin(),(x).end()

typedef long long ll;

const int INF = 1e9;

int main() {
	while (true) {
			int h,w;
			cin >> h >> w;
			if (h == 0 and w == 0) {
					return 0;
			}
			rep(i,0,h) {
					rep(j,0,w) {
						if (i == 0 or i == h - 1 or j == 0 or j  == w - 1)
							cout << "#";
						else
							cout << ".";
					}
					cout << endl;
			}
			cout << endl;
	}	
}

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

int main(){

int W, A, B;
cin >> W >> A >> B;
int ans;
		ans = max(A, B) - (min(A, B) + W); 

  if(ans <= 0){
  cout << 0 << endl; 
  }else{
cout << ans << endl;
  }
  }


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

int main(void) {
    int N;
    std::cin >> N;
    int d = N % 10;
    string ans;
    switch (d) {
        case 2:
        case 4:
        case 5:
        case 7:
        case 9:
            ans = "hon";
            break;
        case 3:
            ans = "bon";
            break;
        default:
            ans = "pon";
            break;
    }
    cout << ans << "\n";
    return 0;
}


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

template <typename T>
class BinaryTree{
  private:
    struct TreeNode{
      T value;
      TreeNode* left, *right, *parent;
    };

    struct Tree{
      TreeNode* root;
      TreeNode* nil;
    };

    Tree self;

    TreeNode* makeNode(T v, TreeNode* l, TreeNode* r, TreeNode* p){
      TreeNode* newNode = new TreeNode;
      newNode->left = l;
      newNode->right = r;
      newNode->parent = p;
      newNode->value = v;
      return newNode;
    }

  public: 
    BinaryTree(){
      self.nil = makeNode(0, nullptr, nullptr, nullptr);
      self.root = self.nil;
    } 
    
    TreeNode* newNode(T v){
      return makeNode(v, self.nil, self.nil, self.nil);
    }

    void insert(T value){
      TreeNode* z = newNode(value);
      TreeNode* y = self.nil;
      TreeNode* x = self.root;
      while ( x != self.nil ){
        y = x;
        if ( z->value < x->value )
          x = x->left;
        else
          x = x->right;
      }
      z->parent = y;


      if ( y == self.nil )
        self.root = z;
      else if ( z->value < y->value )
        y->left = z;
      else 
        y->right = z;
    }

    bool find(T value){
      return find(value, self.root);
    }

    bool find(T value, TreeNode* node){
      if (node == self.nil)
        return false;
      if (node->value == value) return true;
      if (value < node->value)
        return find(value, node->left);
      else
        return find(value, node->right);
    }

    void printInorder(TreeNode* root){
      if (root == self.nil) return;
      printInorder(root->left);
      printf(" %d", root->value);
      printInorder(root->right);
    }

    void printPreorder(TreeNode* root){
      if (root == self.nil) return;
      printf(" %d", root->value);
      printPreorder(root->left);
      printPreorder(root->right);
    }

    void print(void){
      printInorder(self.root);
      printf("\n");
      printPreorder(self.root);
      printf("\n");
    }
};

int main(){
  BinaryTree<int> bTree;
  string str;
  int n;
  cin >> n;
  for (int i=0;i<n;i++){
    cin >> str;
    if (str == "insert"){
      int value;
      cin >> value;
      bTree.insert(value);
    }
    else if (str == "find"){
      int value;
      cin >> value;
      cout << ((bTree.find(value))?"yes":"no") << endl;
    }
    else if (str == "print")
      bTree.print();
  }
  return 0;
}



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

int main() {
  int N, A;
  cin >> N >> A;
  
  int B = 0;
  vector<int> vec(A);

  for (int i = 0;i < A;i++) {
    cin >> vec.at(i);
  }
  for (int i = 0;i < A;i++) {
    B += vec.at(i);
  }
  
  if (N <= B) {
  cout << "Yes" << endl;
  }
  else {
  cout << "No" << endl;
  }
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main () {
	int n; cin >> n;
	vector<int> a;
	int tbc = 0;
	for (int i=0; i<n; i++) {
		int x; cin >> x;
		a.push_back(x);
		tbc += x;
	}
	int k[3];
	k[0] = tbc/n-1;
	k[1] = tbc/n;
	k[2] = tbc/n+1;
	int mi = 1e9;
	for (int j=0; j<3; j++) {
		int s = 0;
		for (int i=0; i<n; i++) {
			s += (a[i]-k[j])*(a[i]-k[j]);
		}
		mi = min(mi, s);
	}
	cout << mi;
	return 0;
}

Measured memory_bytes: 3632
s=input()
n=len(s)+1
a,b=[0]*n,[0]*n
temp=0
for i,val in enumerate(s):
    if val=="<": temp+=1
    else: temp=0
    a[i+1]=temp
temp=0
for i,val in enumerate(s[::-1]):
    if val==">": temp+=1
    else: temp=0
    b[n-i-2]=temp
ans=0
for i,j in zip(a,b): ans+=max(i,j)
print(ans)

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

int main() {
    int a,b,c,d,e,k;
    cin >> a >> b >> c >> d >> e >> k;
    if(e-a > k) cout << ":(" << endl;
    else cout << "Yay!" << endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {

  public static void main(String[] args) { 
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();

      int[][] fs = new int[n][10];
      for(int i = 0; i < n; i++)
        for(int j = 0; j < 10; j++)
          fs[i][j] = sc.nextInt();

      int[][] ps = new int[n][11];
      for(int i = 0; i < n; i++)
        for(int j = 0; j < 11; j++)
          ps[i][j] = sc.nextInt();

      long max = Long.MIN_VALUE;
      for(int i = 1; i < (1 << 10); i++) {
          long profit = 0;
          for(int j = 0; j < n; j++) {
              int cnt = 0;
              for(int k = 0; k < fs[j].length; k++)
                if((fs[j][k] & (i >> k)) == 1) cnt++;
              profit += ps[j][cnt];
          }
          max = Math.max(max, profit);
      }
      System.out.println(max);
  }
}

Measured memory_bytes: 25968
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

//code by lynmisakura.wish to be accepted!
#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>

#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>

/***************************/
using namespace std;

typedef long long ll;
typedef vector<ll> vi;
typedef vector<long long> vl;
typedef pair<ll, ll> pi;
typedef vector<pair<ll, ll>> vpi;


#define itn ll
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ss second
#define ff first
#define dup(x,y) ((x) + (y) - 1)/(y)
#define mins(x,y) x = min(x,y)
#define maxs(x,y) x = max(x,y)
#define all(x) (x).begin(),(x).end()
#define Rep(n) for(ll i = 0;i < n;i++)
#define rep(i,n) for(ll i = 0;i < n;i++)
#define flush fflush(stdout)
#define rrep(i,n) for(ll i = n - 1;i >= 0;i--)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define ioboost cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20)
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll qp(ll a, ll b) { ll ans = 1; do { if (b & 1)ans = 1ll * ans*a; a = 1ll * a*a; } while (b >>= 1); return ans; }
ll qp(ll a, ll b, ll mo) { ll ans = 1; do { if (b & 1)ans = 1ll * ans*a%mo; a = 1ll * a*a%mo; } while (b >>= 1); return ans; }

#define _GLIBCXX_DEBUG
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

class ESecondSum {
public:
    static constexpr int kStressIterations = 0;
    static void generateTest(std::ostream& test) {
    }

    //w < x < i < y < v 0,1,2,3
    long long find_(multiset<ll>& S,int ope,long long i){
        auto itr = S.lower_bound(i);
        --itr;--itr;
        rep(j,ope) {
            ++itr;
        }
        return *itr;
    }
    void solve(std::istream& cin, std::ostream& cout) {
        int n;cin >> n;
        vector<ll>p(n),q(n+1,0);
        for (ll i = 0; i < n; ++i) {
            cin >> p[i];
            q[p[i]] = i+1;
        }

        ll ans = 0;

        multiset<ll> S;
        rep(i,2){
            S.insert(0);
            S.insert(n+1);
        }
        for(ll i = n;i >= 1;i--){
            ll w = find_(S,0,q[i]);
            ll x = find_(S,1,q[i]);
            ll y = find_(S,2,q[i]);
            ll v = find_(S,3,q[i]);

            ans += i*((x - w)*(y - q[i]) + (v - y)*(q[i] - x));
            S.insert(q[i]);
        }
        cout << ans;
    }
};

int main() {
	ESecondSum solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

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

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

  int A, B, C;
  cin >> A >> B >> C;
  bool ok = false;

  for(int i = 1; i <= 100; i++){
    if((A * i) % B == C){
      ok = true;
    }
  }
  if(ok){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;

using namespace std;
using Graph = vector<vector<Int>>;

const double pi = M_PI;
const Int MOD = 1000000007;

int main() {
    int n;
    cin >> n;
    vector<string> s1, ans;
    map<string, int> s2;
    for (int i = 0; i < n; i++) {
        string a;
        cin >> a;
        s1.push_back(a);
        if (!s2.insert({a, 1}).second) {
            s2[a]++;
        }
    }

    int m = 0;
    for (auto itr = s2.begin(); itr != s2.end(); itr++) {
        m = max(m, itr->second);
    }

    for (auto itr = s2.begin(); itr != s2.end(); itr++) {
        if (itr->second == m) {
            ans.push_back(itr->first);
        }
    }

    sort(ans.begin(), ans.end());
    for (auto e : ans) {
        cout << e << endl;
    }

    return 0;
}


Measured memory_bytes: 28400
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

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

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

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

fn main() {
    input! {
        n: i64,
        l: i64,
    }
    let mut ans = 0;
    let total = (0..n).map(|i| l + i as i64).sum::<i64>();
    let mut min_d = std::i64::MAX;
    for i in 0..n {
        let apple = l + i;
        let d = apple.abs();
        if min_d > d {
            min_d = d;
            ans = total - apple;
        }
    }
    println!("{}", ans);
}

Measured memory_bytes: 4352