akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ll              long long int
#define int             int
#define ff              first
#define ss              second
#define pb              emplace_back
#define mpair           make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define sbits(x)      __builtin_popcountll(x)
#define zbits(x)      __builtin_popcountlliltin_ctzll(x)
#define w(t)            int t;cin>>t;while(t--)
#define uset            unordered_set
#define forr(i, a, b)   for(int i =int(a);i<=int(b);i++)
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__,__VA_ARGS__)
    template <typename Arg1>
     void __f(const char* name,Arg1&& arg1){
        cout<<name<<" : "<<arg1<<std::endl;
     }
     template <typename Arg1, typename... Args>
     void __f(const char* names,Arg1&& arg1,Args&&... args){
        const char* comma = strchr(names+1 ,',');
        cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
     }
#else
#define trace(...)
#endif
/*     
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
*/
double pi = 2.0*acos(0);
void fast(){ios_base::sync_with_stdio(false);cin.tie(NULL);cout<<fixed<<setprecision(10);}
int max2(int a,int b){ if(a>b) return a;return b;}
int min2(int a,int b){ if(a<b)return a;return b;}
int max3(int a,int b,int c){ return max2(a,max2(b,c));}
int min3(int a,int b,int c){ return min2(a,min2(b,c));}

///////////////////////////////////////////////////////////////////////////////////////////////


void solve(){
       

       int n,m,x;
       cin>>n>>m>>x;
       ll v[n][m];
       ll cost[n];
       for(int  i =0;i<n;i++)
       {
          cin>>cost[i];
         for(int j = 0;j<m;j++)
         {
           cin>>v[i][j];
         }
       }
       int lim = (1<<n)-1;ll min_cost =1e18;
       for(int  i =0;i<=lim;i++)
       {
          
           bitset<13>b(i);
           ll cc[m]={0}; ll tot = 0;
           for(int j=0;j<n;j++)
           {
               if(b[n-1-j])
               {
                  tot+=cost[j];
                 for(int k = 0;k<m;k++)
                    cc[k]+=v[j][k];
               }
           }

           bool chk = true;
           for(int  j =0;j<m;j++)
             if(cc[j]<x)
             {
                chk = false;break;
             }

             if(chk && tot<min_cost)
                min_cost = tot;

       }
         
         if(min_cost< 1e18)
        cout<<min_cost<<endl;
         else
         cout<<-1<<endl;      
      
}


signed main(void)
{
      fast();
     // w(t)
      solve();

}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define push push_back
#define ii pair <int, int>
const int N = 2e5 + 7;
int n, a, b, c, d;
string s;
bool dp1[N], dp2[N];
signed main() {
    #ifdef HOME
    freopen("input.txt", "r", stdin);
    #else
    ios_base::sync_with_stdio(0); cin.tie(0);
    #endif
    cin >> n >> a >> b >> c >> d;
    cin >> s;
    --a; --b; --c; --d;
    if (c == d) {
        cout << "No\n";
        exit(0);
    }   

    dp1[a] = 1;
    for (int i = a + 1; i < n; ++i) {
        if (s[i] == '#') continue;
        if (i - 1 >= 0) dp1[i] |= dp1[i - 1];
        if (i - 2 >= 0) dp1[i] |= dp1[i - 2];
    }

    dp2[b] = 1;
    for (int i = a + 1; i < n; ++i) {
        if (s[i] == '#') continue;
        if (i - 1 >= 0) dp2[i] |= dp2[i - 1];
        if (i - 2 >= 0) dp2[i] |= dp2[i - 2];
    }

    if (!dp1[c] || !dp2[d]) {
        cout << "No\n";
        exit(0);
    }   

    if (d < c) {
        for (int i = b; i <= d; ++i) {
            if (dp2[i] && dp1[i - 1] && dp1[i + 1]) {
                cout << "Yes\n";
                exit(0);
            }   
        }   
        cout << "No\n";
    }
    else {
        cout << "Yes\n";
    }   
}   

Measured memory_bytes: 976
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
typedef long long ll;
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
using namespace std;
const ll MAX_N=50;
ll N;
typedef pair<ll,ll> P;
P pnt[MAX_N];
map<P,ll> mp;
ll par[MAX_N];
void init(ll n){
	REP(i,n)par[i]=i;
}
ll ufpar(ll v){
	if(par[v]==v)return v;
	return par[v]=ufpar(par[v]);
}
void unite(ll s,ll t){
	s=ufpar(s);
	t=ufpar(t);
	par[s]=t;
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>N;
	REP(i,N){
		ll x,y;
		cin>>x>>y;
		mp[P(x,y)]=i;
		pnt[i]=P(x,y);
	}
	ll ans=N;
	REP(i,N){
		FOR(j,i+1,N){
			init(N);
			P p(pnt[i].first-pnt[j].first,pnt[i].second-pnt[j].second);
			REP(k,N){
				P q(pnt[k].first+p.first,pnt[k].second+p.second);
				if(mp.find(q)!=mp.end()){
					unite(k,mp[q]);
				}
			}
			ll c=0;
			REP(k,N){
				if(ufpar(k)==k)c++;
			}
			ans=min(ans,c);
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define WHOLE(v) (v).begin(), (v).end()
#define REV_WHOLE(v) (v).rbegin(), (v).rend()
using i64 = int64_t;
using namespace std;
template<class F>auto recursive(F f){return[f](auto...a){return f(f,a...);};}
template<class I,class V=typename I::value_type>V sum_up(const I&l,const I&r){V v;for(I i=l;i!=r;i++)v=i==l?*i:v+*i;return v;}
template<class I,class T=iterator_traits<I>>I operator+(I it,int n){for(int i=0;i<n;i++)it++;return it;}
template<class I,class T=iterator_traits<I>>I operator-(I it,int n){for(int i=0;i<n;i++)it--;return it;}
template<class T>using rev_priority_queue=priority_queue<T,vector<T>,greater<T>>;
template<class T>using vector2d=vector<vector<T>>;
struct fixprec{int p;fixprec(int p):p(p){}};
ostream&operator<<(ostream&o,fixprec f){return o<<fixed<<setprecision(f.p);}
void R_YESNO(bool p){cout<<(p?"YES":"NO")<<endl;}
void R_YesNo(bool p){cout<<(p?"Yes":"No")<<endl;}
int main() {
    int N;
    cin >> N;
    vector<int> ans(N);
    for(int i = 1; i < N; i++) {
        int a;
        cin >> a;
        a--;
        ans[a]++;
    }
    for(int i = 0; i < N; i++) {
        cout << ans[i] << endl;
    }
    return 0;
}



Measured memory_bytes: 4000
/*
本宝的程序外人别想看！！

name: [夏宝宝]
run time：[] ms
compilation time: [] ms
output memory: [] MiB
where: []
state: []
*/
#include<bits/stdc++.h>
using namespace std;
const long long int mod=1e9+7;

inline int read()
{
	int s=0, w=1;

	char ch=getchar();

	while(ch<'0' || ch>'9')
	{
		if(ch='-')
		{
			w=-w;
		}

		ch=getchar();
	}

	while(ch>='0' && ch<='9')
	{
		s=(((s*10ll)%mod)+(ch-'0'))%mod;

		ch=getchar();
	}

	return s;
}

const long long int fac=3000005;
long long int sx, sy, tx, ty;
long long int fact[fac], fact_inv[fac];

int main()
{
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);
	
	cout.sync_with_stdio(false);
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	long long int pow(long long int a, long long int n);
	void mf();
	long long int c(long long int n, long long int k);
	
	mf();
	
	cin>>sx>>sy>>tx>>ty;
	
	long long int ans=0;
	
	for(int i=sx; i<=tx; i++)
	{
		ans+=c(i+ty+1, ty),ans%=mod;
		ans+=mod-c(i+(sy-1)+1, sy-1),ans%=mod;
	}
	
	cout<<ans<<endl;
	
	return 0;
}

long long int pow(long long int a, long long int n)
{
	if(n==0)
	{
		return 1;
	}
	
	if(n%2)
	{
		return ((a%mod)*(pow(a, n-1)%mod))%mod;
	}
	else
	{
		return pow((a*a)%mod, n/2)%mod;
	}
}

void mf()
{
	long long int v=1;
	
	fact[0]=1;
	
	for(int i=1; i<=fac; i++)
	{
		v*=i;
		v%=mod;
		fact[i]=v;
	}
	
	fact_inv[fac-1]=pow(fact[fac-1], mod-2);
	
	for(int i=fac-2; i>=0; i--)
	{
		fact_inv[i]=fact_inv[i+1]*(i+1)%mod;
	}
}

long long int c(long long int n, long long int k)
{
	long long int r=1;
	
	r*=fact[n];
	r*=fact_inv[k],r%=mod;
	r*=fact_inv[n-k],r%=mod;
	
	return r;
}

Measured memory_bytes: 47104
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<ll,ll,ll> T;
const long long INF = 1LL<<60;
const int MOD = 1000000000+7;
#define rev(s) (string((s).rbegin(), (s).rend()))
template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); };
// cout << fixed << setprecision(10) << ans << endl;
// *min_element(c + l, c + r) *max_element(c + l, c + r)
// int dx[8]={1,1,0,-1,-1,-1,0,1};
// int dy[8]={0,1,1,1,0,-1,-1,-1};
// int dx[4]={1,0,-1,0};
// int dy[4]={0,1,0,-1};
// struct Edge {
//   int to, id;
//   Edge(int to, int id): to(to), id(id) {}
// };

const int MAX = 1000010;
//const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
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;
    }
}

// 二項係数計算
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 modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

int main() {
  int N; cin >> N;
  COMinit();
  ll fst = 2 * modpow(9, N, MOD) % MOD;
  ll snd = modpow(8, N, MOD);
  ll sum = modpow(10, N, MOD);
  cout << ((sum + snd) % MOD - fst + MOD) % MOD << endl;
}

Measured memory_bytes: 27112
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> PI;
vector<int> g[100010];
int n,need,size[100010],par[100010];
bool vis[100010];
void dfs(int u,int dep){
	if(need!=0) return;
	vis[u]=true;
	if(u==n){
		need=dep;
		return;
	}
	for(int& v:g[u]){
		if(!vis[v]){
			dfs(v,dep+1);
		}
	}
}
void dfs2(int u,int fa){
	size[u]=1;
	par[u]=fa;
	for(int& v:g[u]){
		if(v==fa) continue;
		dfs2(v,u);
		size[u]+=size[v];
	}
}
int main(){
	int u,v;
	scanf("%d",&n);
	for(int i=1;i<n;i++){
		scanf("%d%d",&u,&v);
		g[u].push_back(v);
		g[v].push_back(u);
	}
	dfs(1,0);
	dfs2(1,-1);
	need--;
	u=n;
	for(int i=1;i<=need/2;i++){
		u=par[u];
	}
	int second=size[u]-1,first=n-1-size[u];
	puts(first>second?"Fennec":"Snuke");
	return 0;
}

Measured memory_bytes: 11264
h, w = map(int, input().split())
g = [[0] * w for _ in range(h)]#白が1、黒が０
for i in range(h):
    s = list(input())
    for j in range(w):
        if s[j] == '.':
            g[i][j] = 1
INF = 10**9
dp = [[INF] * w for _ in range(h)]
if g[0][0] == 0:
    dp[0][0] = 1
else:
    dp[0][0] = 0

for i in range(h):
    for j in range(w):
        for dx, dy in ((1, 0), (0, 1)):
            nx = j + dx
            ny = i + dy
            if ny >= h or nx >= w:
                continue
            add = 0
            if g[ny][nx] == 0 and g[i][j]  == 1:
                add = 1
            dp[ny][nx] = min(dp[ny][nx], dp[i][j] + add)
            
print(dp[h-1][w-1])




Measured memory_bytes: 9404
#include <iostream>

using namespace std;

int house[4][3][10];

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n;
	cin>>n;
	int b, f, r, v;
	for(int i=0; i<n; ++i) {
		cin>>b>>f>>r>>v;
		house[b-1][f-1][r-1]+=v;
	}
	for(int i=0; i<4; ++i) {
		if(i) cout<<"####################\n";
		for(int j=0; j<3; ++j) {
			for(int k=0; k<10; ++k) {
				cout<<' '<<house[i][j][k];
			}
			cout<<'\n';
		}
	}
	return 0;
}



Measured memory_bytes: 3124
a,b,c = gets.split.map(&:to_i)
if a == b && b == c && a%2 == 0
    puts -1
    exit
end
ans = 0
while a%2 == 0 && b%2 == 0 && c%2 == 0
    ans += 1
    a,b,c = (b+c)/2,(c+a)/2,(a+b)/2
end
puts ans

Measured memory_bytes: 1788
#include<stdio.h>

int main(){
    char str[4];
    char a[4]="ABC";
    char b[4]="ARC";
    scanf("%s",str);
    if(str[1]=='R'){
        printf("%s",a);
    }
    if(str[1]=='B'){
        printf("%s",b);
    }
}

Measured memory_bytes: 1680
#include <iostream>
#include <algorithm>
#include <cmath>
#include <climits>
#include <vector>
#include <cstring>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <string.h>
#include <iomanip>
using namespace std;
#define int long long
#define ull unsigned long long
#define F first
#define S second
#define nl "\n"
#define ld long double
#define div 1000000007
#define pi 3.14159265358979323846
#define pb push_back

void solve()
{
    int n;cin>>n;
    int x=ceil(n/1000.0);
    int rem=x*1000-n;
    cout<<rem<<nl;
}

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

    int t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 3752
#include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef vector<pair<ll,ll> > vp;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define drep(i,a,b) for(ll i=(a);i>(b);--i)
const int MOD = 1000000007;
const int MAX = 510000;

int main(){
  ll n,m,ans=0;cin>>n>>m;
  vll h(n+1,0);
  vb ok(n+1,true);
  rep(i,1,n+1){cin>>h[i];}
  rep(i,0,m){
    ll a,b;cin>>a>>b;
    if(h[a]>h[b]){ok[b]=false;}
    if(h[a]<h[b]){ok[a]=false;}
    if(h[a]==h[b]){ok[a]=false;ok[b]=false;}
  }
  rep(i,1,n+1){
    if(ok[i]){ans++;}
  }
  cout<<ans<<endl;
}




Measured memory_bytes: 4052
#[allow(unused_imports)]
use std::cmp;
use std::io::Write;

// Input macro from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
  (source = $s:expr, $($r:tt)*) => {
    let mut iter = $s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
  ($($r:tt)*) => {
    let s = {
      use std::io::Read;
      let mut s = String::new();
      std::io::stdin().read_to_string(&mut s).unwrap();
      s
    };
    let mut iter = s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
}

macro_rules! input_inner {
  ($iter:expr) => {};
  ($iter:expr, ) => {};

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

macro_rules! read_value {
  ($iter:expr, ( $($t:tt),* )) => {
    ( $(read_value!($iter, $t)),* )
  };

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

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

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

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

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

fn main() {
  let out = std::io::stdout();
  let mut out = std::io::BufWriter::new(out.lock());
  macro_rules! puts {
    ($($format:tt)*) => (write!(out,$($format)*).unwrap());
  }
  input! {
    n: usize,
    k: usize,
    p: [i64; n],
  }
  let mut sum = vec![0; n+1];
  for (i, &x) in p.iter().enumerate() {
    sum[i+1] = sum[i] + x + 1;
  }
  let mut max = 0;
  for i in k .. n + 1 {
    max = cmp::max(max, sum[i] - sum[i-k]);
  }

  puts!("{:.15}\n", max as f64 / 2.0);
}


Measured memory_bytes: 8444
import sys
import time
import math
st = time.perf_counter()
def inpl():
    return list(map(int, input().split()))
# ------------------------------

H, W, K = map(int, input().split())
c = []
for i in range(H):
	c.append(input())

ans = 0
for h in range(2**H):
	for w in range(2**W):
		kuro = 0
		for i in range(H):
			if (2 ** i) & h == 0: continue
			for j in range(W):
				if (2 ** j) & w == 0: continue
				if c[i][j] == '#':
					kuro += 1
		if kuro == K:
			ans += 1

print(ans)


# ------------------------------
ed = time.perf_counter()
print('time:', ed-st, file=sys.stderr)


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

typedef long long ll;

int main()
{
    ll sum=0;
    ll n,k;
    cin >> n >> k;
    if(k==0)
    {
        sum=n*n;
        cout << sum << endl;
        return 0;
    }
    for(int i=k+1;i<=n;i++)
    {
        int p=n/i;
        int res=n%i;
        if(res>=k)
            res=res-k+1;
        else
            res=0;
        sum+=(p*(i-k)+res);
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.lang.Math;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
  		
      	String s = sc.next();
      	List<Character> ss = new ArrayList<Character>();
      	int count = 0;
      
      	for(int i = 0;i < s.length();i++){
          	ss.add(s.charAt(i));
        }
      	
      	for(int i = 0; i < ss.size()-1;i++){
          if(ss.get(i) != ss.get(i+1)){
          	ss.remove(i);
            ss.remove(i);
            count += 2;
             
            if(i-2 >= -1) i -= 2;
            else i -=1;
          }
        }
          
        System.out.println(count);
	}
}


Measured memory_bytes: 40868
h, w = map(int, input().split())
aaa = [list(map(str, input().split())) for _ in range(h)]
for i, aw in enumerate(aaa):
    aw.insert(0, '#')
    aw.append('#')
    aaa[i] = aw
aaa.insert(0, ['#' * (w + 2)])
aaa.append(['#' * (w + 2)])

for aw in aaa:
    print(''.join(aw))


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

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

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

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

int main()
{
    ll K, X;
    cin >> K >> X;

    ll s = std::max(-1000000LL, X - K + 1);
    ll e = std::min(1000000LL, X + K - 1);
    for (ll i = s; i <= e; ++i)
    {
        cout << i << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
class Main {
	private static String[] ten = new String[100];
	public void kami() {
		Scanner sc = new Scanner(System.in);
		int x = 0;
		int m = sc.nextInt();
		int f = sc.nextInt();
		int r = sc.nextInt();
		while(m != -1 || f != -1 || r != -1){
			if(m <= 50 && f <= 50){
				if(m == -1 || f == -1){
					ten[x] = "F";
				}else if(m + f >= 80){
					ten[x] = "A";
				}else if(m + f >= 65){
					ten[x] = "B";
				}else if(m + f >= 50 || (m + f >= 30 && r >= 50)){
					ten[x] = "C";
				}else if(m + f >= 30){
					ten[x] = "D";
				}else if(m + f < 30){
					ten[x] = "F";
				}
			}
			x++;
			m = sc.nextInt();
			f = sc.nextInt();
			r = sc.nextInt();
		}
		for(int i = 0; i <= x-1; i++){
			System.out.println(ten[i]);
		}
	}

	public static void main(String[] args) {

		new Main().kami();
	}

}

Measured memory_bytes: 17776
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define PI 3.14159265359
#define INF 1000100100//000000000
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define P pair<int, int>
#define PP pair<P,P>
#define T tuple<int,int,int> 
using namespace std;
 
vector<vector<int> > s;
vector<int> c;

int score(vector<int> held){
    vector<int> ld(26,0);
    int ans=0;
    rep(i,held.size()){
        int t=held[i];
        ld[t]=i+1;
        ans+=s[i][t];
        rep(j,26){
            ans-=c[j]*(i+1-ld[j]);
        }
    }
    return ans;
}

int main(){
    int d; cin >> d;
    vector<int> cc(26);
    c=cc;
    rep(i,26) cin >> c[i];
    vector<vector<int> > ss(d);
    s=ss;
    rep(i,d)rep(j,26){
        int a; cin >> a;
        s[i].push_back(a);
    }
 
    //vector<int> ld(26,0);
    vector<vector<int> > ds(26);
    vector<int> days(0);

    rep(i,d){
        int now=-INF;
        int whatday;
        rep(j,26){
            vector<int> tmp=days;
            tmp.push_back(j);
            int sc=score(tmp);
            if(sc>now){
                whatday=j;
                now=sc;
            }
        }
        days.push_back(whatday);
    }
    rep(i,d) cout << days[i]+1 << endl;
return 0;
}

Measured memory_bytes: 3696
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#define initdp(a, b)  for (int i = 0; i <= a; i++)   for (int j = 0; j <= b; j++) dp[i][j] = -1;
#define fi first
#define se second
#define pb push_back
#define pii pair<int, int>
#define ll long long
#define pll pair<ll, ll>
#define all(arr) arr.begin(), arr.end()
#define rep(i, n) for (int i = 0; i < n; i++)
#define repd(i, n) for (int i = n - 1; i >= 0; i--)
#define fo(i, l, r) for (int i = l; i <= r; i++)
#define inf 1000000001
#define inf1 1000000000000000001
#define mod 1000000007
#define pie 3.14159265358979323846
#define N 1000005
#define mid(l, r) l + (r - l) / 2
#define vec vector<int>
#define vecl vector<ll>
#define yes cout << "YES" << endl;
#define no cout << "NO" << endl;
#define umapi unordered_map<ll, ll>
#define umapc unordered_map<char, int>
#define endl "\n"
using namespace std;
 
int n,k;
vec arr(2000005);

int check (int x) {
    int ans = 0;
    rep(i,n) {
        if(arr[i] <=x) {
            continue;
        }
        ans+= arr[i]/x;
    }

    return ans<=k;
}

void solve()
{
    cin>>n>>k;

    
    rep(i,n) {
        cin>>arr[i];
    }

    int l = 1, r= 1e9;
    int ans;
    while(l<=r) {
        int m = mid(l,r);
        if(check(m)) {
            ans = m;
            r= m-1;
        } else {
            l= m+1;
        }
    }

    cout<<ans<<endl;
    
    
}
 
 
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t = 1;
  //  cin >> t;
    while (t--)
    {
        solve();
    }
}

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

#include <set>
#include <map>
#include <iomanip>

using namespace std;

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

using ll = long long;

vector<vector<int>> node;
vector<ll> point;

void dfs(int p, ll x)
{
	for (auto v : node[p])
	{
		point[v] += x;

		dfs(v, point[v]);
	}
}

int main()
{
	ll N, Q;
	cin >> N >> Q;

	node.resize(N);
	point.resize(N, 0);

	rep(i, N - 1)
	{
		int a, b;
		cin >> a >> b;

		a--; b--;

		node[a].push_back(b);
	}

	rep(i, Q)
	{
		ll p, x;
		cin >> p >> x;

		p--;
		point[p] += x;
	}

	dfs(0, point[0]);

	rep(i, N)
	{
		if (i > 0)
		{
			cout << " ";
		}

		cout << point[i];
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 21120
#include<set>
#include<iostream>
#include<ctime>
#include<string>
#include<cstdlib>
#include<algorithm>
#include<random>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<functional>
#include<string.h>
#include<limits.h>
#define P pair<int,int>
using namespace std;

vector<P>V;
signed main() {
 	int a, b, n; cin >> a >> b >> n;
	for (int i = 0; i < n; i++) {
		int c, d; cin >> c >> d;
		V.push_back({ c,d });
	}
	V.push_back({ 0, 0 });
	sort(V.begin(), V.end(), greater<P>());
	int ans = 1 << 29;
	int MAX = 0;
	for (int i = 0; i < V.size(); i++) {
		ans = min(ans, MAX + V[i].first);
		MAX = max(MAX, V[i].second);
	}
	cout << ans << endl;
}

Measured memory_bytes: 3876
#include <bits/stdc++.h>
#include <stdio.h>
 
using namespace std;
 
#define int long long
#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define trav(i, a) for (auto &i: (a))
#define sz(x) (int)(x).size()
#define all(v) (v).begin(), (v).end()
#define fr(i, a, b) for (int i = (a); i <= (b); ++i)

void solve();

signed main () {
    clock_t beg = clock();
    cout << fixed << setprecision(15);
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    #ifdef LOCAL
    freopen("input.txt", "r", stdin);
    #endif 
    int t = 1; 
    // cin >> t;    
    int tt = t;
    while (t--) {
        // cout << "Case #" << tt - t << ": "; 
        solve();
    }
    cerr << "\nExecution time: " << (clock() - beg) / 1000 << '\n';
    return 0;
}
vector<int> a[15]; 
int n, m, x;
int c[15];
void solve() {  
    cin >> n >> m >> x;
    rep(i, 0, n) {
        cin >> c[i];
        rep(j, 0, m) {
            int lol;
            cin >> lol;
            a[i].push_back(lol);
        }
    }
    int mn = 1e18;
    for (int mask = 0; mask < (1 << n); ++mask) {
        vector<int> b(m, 0);
        int cost = 0;
        for (int i = 0; i < n; ++i) {
            if ((1 << i) & mask) {
                cost += c[i];
                for (int j = 0; j < m; ++j) {
                    b[j] += a[i][j]; 
                }
            }
        }
        bool ok = true;
        for (int j = 0; j < m; ++j) {
            if (b[j] < x)
                ok = false;
        }
        if (ok)
            mn = min(mn, cost);
    }
    if (mn == 1e18)
        cout << -1;
    else
        cout << mn;
}       
    

Measured memory_bytes: 3652
#include<bits/stdc++.h>
#define pi acos(-1)
#define ll long long
#define pii pair<ll,ll>
#define debug(a) cout<<a<<'\n'
#define maxn 100009 /// Look at me please ... that's what she said
#define MOD 1000000007
using namespace std;
const ll INF = 1e7 + 9;
vector<pii> adj[maxn];
int ans[maxn];
int vis[maxn];
int corpai[maxn];
void addedge(ll a,ll b,ll ind){
    adj[a].push_back({b,ind});
    adj[b].push_back({a,ind});
}
void dfs(ll x){
    // debug(x);
    vis[x]=1;
    int cont=1;
    for(auto e: adj[x]){
        if(cont==corpai[x])cont++;
        if(vis[e.first]==-1){
            ans[e.second]=cont;
            corpai[e.first]=cont;
            dfs(e.first);
            cont++;
        }
    }
}
int main(){
    ios::sync_with_stdio(false);
    //cin.tie(0); ///activate when submit
    memset(vis,-1,sizeof vis);
    memset(corpai,-1,sizeof corpai);
    int n;
    cin>>n;
    int grau[maxn];
    memset(grau,0,sizeof grau);
    int cont2=0;
    int nant=n;
    nant--;
    while(nant--){
        ll a,b;
        cin>>a>>b;
        a--;
        b--;
        addedge(a,b,cont2);
        grau[a]++;
        grau[b]++;
        cont2++;
    }
    // debug("oi");
    int menor=INF;
    int indr=-1;
    int ansq=-1;
    int maior=-1;
    for(int i=0;i<n;i++){
        if(grau[i]>maior){
            maior=grau[i];
            ansq=grau[i];
        }
        if(grau[i]<menor){
            menor=grau[i];
            indr=i;
        }
    }
    corpai[indr]=-1;
    // cout<<indr<<endl;
    dfs(indr);
    cout<<ansq<<endl;
    for(int i=0;i<n-1;i++){
        cout<<ans[i]<<endl;
    }
    return 0;
}    

Measured memory_bytes: 9856
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int A, B, C, D;
	cin >> A >> B >> C >> D;
	int big = max(A, C);
	int small = min(B, D);
	int ans = small - big;
	cout << max(ans, 0) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <numeric>
#include <cmath>
#include <limits>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
ll Max(ll(a), ll(b), ll(c)) {
	return max(max(a, b), c);
}
ll Min(ll(a), ll(b), ll(c)) {
	return min(min(a, b), c);
}

vector<int> a = { 1, 14, 32, 51, 51, 51, 243, 419, 750, 910 };
ll kai(vector<ll> A, ll key) {
	ll an = 0;
	rep(i, A.size()) {
		an += (A.at(i) - 1) / key;
	}
	return an;
}
// index が条件を満たすかどうか
bool isOK(int index,vector<ll> A, int K) {
	if (kai(A,index) <= K) return true;
	else return false;
}

// 汎用的な二分探索のテンプレ
int binary_search(ll MA,vector<ll> A,ll K) {
	int left = 0; //「index = 0」が条件を満たすこともあるので、初期値は -1
	int right = MA; // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()

	/* どんな二分探索でもここの書き方を変えずにできる！ */
	while (right - left > 1) {
		int mid = left + (right - left) / 2;

		if (isOK(mid, A,K)) right = mid;
		else left = mid;
	}

	/* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている */
	return right;
}


int main() {
	ll N,MA=0,K;
	cin >> N>>K;
	vector<ll> A(N);
	rep(i, N) {
		cin >> A.at(i);
		MA = max(MA, A.at(i));
	}
	int key = 0;
	int AN = binary_search(MA,A,K);
	cout << AN << endl;
}


Measured memory_bytes: 9468
#include<iostream>
#include<string>
using namespace std;
int main(){
  string t,h;
  int n,pt=0,ph=0;
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> t >> h;
    if(t==h)pt++,ph++;
    else if(t>h) pt+=3;
    else ph+=3;
  }
  cout << pt << " " << ph << endl;
}


Measured memory_bytes: 3224
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
#include<fstream>
#include<set>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define out(str) cout << str << endl
#define ALL(a) (a).begin(),(a).end()
#define INF (1<<29)

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

ll N,a,b;

int main(){
    cin>>N;
    for(ll i=sqrt(N);i>=1;i--){
        if(N%i==0){
            a=i;
            b=N/i;
            break;
        }
    }
    out(a+b-2);
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) 
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define SZ(x)  (int)x.size()
#define SP(x)  setprecision((int)x)


using namespace std ;
typedef long long ll;
using Graph = vector<vector<int>>;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef vector<string> vstr;
typedef pair<int, int> pii;
const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;} //最小公倍数

//-------------------------------------------------
// 
void yes(){
  cout <<"Yes"<<endl ;
}
void no(){
  cout <<"No"<<endl ;
}


//-------------------------------------------------
// メモ
/*






*/
//-------------------------------------------------


int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, m ;
  cin >> n >> m ;
  vvint ks(m) ;
  REP(i,m){
    int k ;
    cin >> k ;
    REP(j,k){
      int l ;
      cin >> l ;
      ks[i].PB(l-1) ;
    }
  }
  int ans = 0 ;
  
  vint p(n) ;
  
  REP(i,m){
    cin >> p[i] ;
  }
  
  for (int bitt = 0; bitt < (1 << 10); bitt++) {
    bitset<10> bits(bitt);
    if(bits[n]==1){
      break ;
    }
    int sum = 0 ;
    for(int j=0;j<m;j++){
      int cnt = 0 ;
      for(int x=0;x<SZ(ks[j]);x++){
        if(bits[ks[j][x]]){
          cnt++ ;
        }
      }
      if(cnt%2==p[j]){
        sum++ ;
      }
    }
    if(sum==m){
      ans++ ;
    }
  }
  
  cout << ans <<endl ;
  
  
  
  return 0 ;
}

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

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        int count = 0;
        for(int i = 0;i<s.length();i++){
            char ss = s.charAt(i);
            char tt = t.charAt(i);
            if(ss != tt)count++;
        }
        System.out.println(count);
    }
}

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


#define mp make_pair
#define pb push_back
#define rep(i,port,sail) for(i=port;i<=sail;i++)
const int N = 100010;
typedef long long ll;
ll v[N],dp[N],w[N];
int main()
{
	int n,i,j,k,t;
	ll W;
	cin>>n>>W;
	rep(i,1,n)cin>>w[i]>>v[i];
	ll mx = 0;
	rep(i,1,n)
	{
		for(int j=W;j>=w[i];j--)
		{
			dp[j]= max(dp[j],dp[j-w[i]]+v[i]);
			mx = max(mx,dp[j]);
		}
	}
	cout<<mx<<"\n";

	
	return 0;
}



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

#define ll long long
#define pb push_back
#define mp make_pair

using namespace std;

string s;

bool pol (string s) {
    string g = s;
    reverse(g.begin(), g.end());
    if (s == g) return true;
    else return false;
}

int main () {

    cin >> s;
    string fir = "", sec = "";
    int n = (int)s.size();
    for (int i = 0; i < ((n - 1)/2); i++) fir.pb(s[i]);
    for (int i = (n+3)/2 - 1; i < n; i++) sec.pb(s[i]);

    if (pol(s) && pol(fir) && pol(sec)) cout << "Yes";
    else cout << "No";

    return 0;
}


Measured memory_bytes: 256
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (const auto &e : vec) os << e << (&e == &vec.back() ? "" : " ");
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

class topological_sort {
private:
	int V;
	vector<vector<int>> edges;
	vector<int> used;
public:
	topological_sort(int n) :V(n), edges(n), used(n) {}
	topological_sort(vector<vector<int>> &edges) :V(edges.size()), used(edges.size()) { this->edges = edges; }

	void add_edge(int from, int to) { edges[from].emplace_back(to); }

	vector<int> build() {

		vector<int> res, in(V);
		for (int i = 0; i < V; i++) for (const auto &e : edges[i]) in[e]++;

		res.reserve(V);
		queue<int> que;
		for (int i = 0; i < V; i++) {
			if (in[i] == 0 && !used[i]) {
				used[i] = -1;
				que.emplace(i);
			}
		}
		while (!que.empty()) {
			int now = que.front();
			DMP(now, in);
			que.pop();
			res.emplace_back(now);
			for (const auto &e : edges[now]) {
				in[e]--;
				if (in[e] == 0) {
					if (used[e]) return vector<int>(); // unable to sort
					used[e] = now + 1;
					que.emplace(e);
				}
			}
		}

		return used;
	}

	int longest_path() {
		if (none_of(used.begin(), used.end(), [](int u) { return u > 0; })) build();
		return *max_element(used.begin(), used.end()) - 1;
	}

};

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int n, m;
	cin >> n >> m;

	topological_sort ts(n);
	vector<vector<int>> edges(n);
	for (int i = 0; i < n - 1 + m; i++) {
		int s, t;
		cin >> s >> t;
		s--, t--;
		ts.add_edge(s, t);
	}
	
	auto par = ts.build();
	for (const auto &e : par) {
		if (e == -1) cout << 0 << "\n";
		else cout << e << "\n";
	}

	return 0;
}

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

using namespace std;

const int sqrInf = (int)(1e9);

int dp[100];

int main()
{
    for(int i = 1; i <= 99; i ++)
        dp[i] = sqrInf;

    dp[0] = 0;
    for(int i = 0; i <= 99; i ++)
    {
        for(int j = 1; j <= 5; j ++)
        {
            int r = (i + j) % 100;
            dp[r] = min(dp[r], dp[i] + 1);
        }
    }

    int n;
    cin >> n;
    cout << (dp[n % 100] <= n / 100) << "\n";

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define endl "\n"
#define pb push_back
#define mp make_pair
#define int long long
#define mod 1000000007
#define DEBUG cout<<"Hello1\n";
#define all(v) (v).begin(),(v).end()
#define clr(x) memset(x,0,sizeof(x))
#define deb(...) debug(#__VA_ARGS__, __VA_ARGS__);
const int N = 1e6 + 5;
const double pi =  acosl(-1);
const long long inf = 1e18 + 5;
using namespace std;
template<typename T> void debug(string s, T x)
{
	cout << s << " = " << x << "\n";
}
template<typename T, typename... Args> void debug(string s, T x, Args... args)
{
	cout << s.substr(0, s.find(',')) << " = " << x << " | ";
	debug(s.substr(s.find(',') + 2), args...);
}
template<class T> void print_container(T &container)
{
	for (auto &t : container)
	{
		cout << t << " ";
	}
	cout << endl;
}
template<class T> void print_pair_container(T &container)
{
	for (auto &t : container)
	{
		cout << t.first << " " << t.second << endl;
	}
	cout << endl;
}
template<class T> void printArr(T &a, int n)
{
	for (int i = 0; i < n; i++)
	{
		cout << a[i] << " ";
	}
	cout << endl;
}
typedef long long ll;
typedef pair<int, int> pii;

//Template Ends
int n;
int a[N];

set<int> ms;


int spf[N];
void sieve()
{
	spf[1] = 1;
	for (int i = 2; i < N; i++)
		spf[i] = i;

	for (int i = 4; i < N; i += 2)
		spf[i] = 2;

	for (int i = 3; i * i < N; i++)
	{
		if (spf[i] == i)
		{
			for (int j = i * i; j < N; j += i)
				if (spf[j] == j)
					spf[j] = i;
		}
	}
}

// A O(log n) function returning primefactorization
// by dividing by smallest prime factor at every step
bool getFactorization(int x)
{
	set<int> factors;
	while (x != 1)
	{
		factors.insert(spf[x]);
		x = x / spf[x];
	}
	for (int x : factors) {
		if (ms.count(x)) {
			return 1;
		} else {
			ms.insert(x);
		}
	}
	return 0;
}

void solve()
{
	ll prod = 1, l = 1;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	sieve();

	bool common_found = false;
	for (int i = 0; i < n; i++) {
		if (getFactorization(a[i])) {
			common_found = 1;
			break;
		}
	}

	if (!common_found) {
		cout << "pairwise coprime";
	} else {
		ll g = a[0];
		for (int i = 0; i < n; i++) {
			g = __gcd(g, a[i]);
		}
		if (g == 1) {
			cout << "setwise coprime";
		} else {
			cout << "not coprime";
		}
	}


}

int32_t main()
{
	IOS;

	solve();

	return 0;
}




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

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

    stack<int> even, odd;
    for (int i = 1; i <= M; i++)
    {
        if (i % 2 == 0)
        {
            even.push(i);
        }
        else
        {
            odd.push(i);
        }
    }

    int start = 1;
    while (!even.empty())
    {
        cout << start << " " << start + even.top() << endl;
        even.pop();
        start++;
    }

    int end = N;
    while (!odd.empty())
    {
        cout << end - odd.top() << " " << end << endl;
        odd.pop();
        end--;
    }
}


Measured memory_bytes: 3976
#include<bits/stdc++.h>
#define inf 1<<29
#define linf 1e18
#define eps (1e-8)
#define mod 1000000007
#define pi M_PI
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define pd(a) printf("%.10f\n",(double)(a))
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(a)-1;(b)<=i;i--)
#define equals(a,b) (fabs((a)-(b))<eps)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<double,int> pdi;
typedef vector<int> vi;
typedef vector<pii> vpi;
const int dx[8]={1,0,-1,0,1,1,-1,-1};
const int dy[8]={0,1,0,-1,1,-1,1,-1};

int main()
{
  int n;
  int len[101];
  string s;
  int num[5]={5,7,5,7,7};
 
  while(1){
    cin>>n;
    if(n==0)break;
    for(int i=0;i<n;i++){
      cin>>s;
      len[i]=s.length();
    }
 
    int ans=0;
    for(int i=0;i<n;i++){
      int sum=0,c=0;
      for(int j=i;j<n;j++){
    sum+=len[j];
    if(sum==num[c]){
      sum=0;
      c++;
    }
    else if(num[c]<sum)break;
    if(c==5)break;
      }
      if(c==5){
    ans=i;
    break;
      }
    }
    cout<<ans+1<<endl;
  }
 
  return 0;
}

Measured memory_bytes: 3020
import java.util.Scanner;


public class Main {

    public static void main(String[] args) {

    	Main main=new Main();

    	main.run();

    }

    void run() {

    	Scanner sc=new Scanner(System.in);

    	int a=sc.nextInt();
    	int b=sc.nextInt();
    	int c=sc.nextInt();
    	
    	if(c>=a && c<=b) {
    		System.out.println("Yes");
    	}else {
    		System.out.println("No");
    	}
    }
}


Measured memory_bytes: 23764
from itertools import*
import math
from collections import*
from heapq import*
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf = 10**18
mod = 10**9+7
from functools import reduce
import sys
sys.setrecursionlimit(10**7)

n,a,b,c,d = map(int,input().split())
Max = 1005
#二項係数とその逆元テーブルを作る前処理
fac = [0]*(Max)
finv = [0]*(Max)
inv = [0]*(Max)
fac[0]=fac[1]=1
finv[0]=finv[1]=1
inv[1]=1
for i in range(2,Max):
        fac[i] = fac[i-1] * i % mod
        inv[i] = mod - inv[mod%i]*(mod//i)%mod
        finv[i] = finv[i-1]*inv[i]%mod
#O(1)でmod計算した組合せ数を計算
def C(n,r):
    if n < r:
        return 0
    if n < 0 or r < 0 :
        return 0
    return fac[n]*(finv[r]*finv[n-r]%mod)%mod
#mod計算した順列の計算
def P(n,r):
    if n < r:
        return 0
    if n<0 or r<0:
        return 0
    return (fac[n]*finv[n-r])%mod

#dp[i][j]:i人以下のグループだけでj人使っている場合の数
dp = [[0]*(n+1) for i in range(n+1)]
for i in range(n+1):
    dp[i][0]=1

for i in range(a,b+1):
    for j in range(1,n+1):
        dp[i][j] = dp[i-1][j]
        k = c
        while k <= j//i and k <= d:
            x = (fac[j] * finv[j - k * i] * finv[k] * pow(finv[i], k, mod)) % mod
            dp[i][j] += (dp[i - 1][j - k * i] * x) % mod
            k += 1
        dp[i][j] %= mod
print(dp[b][n])

Measured memory_bytes: 129756
/*
    ahuhu :((
*/
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <utility>
#include <queue>
#include <deque>
#include <string>
#include <cstring>
using namespace std;

#define SZ size()
#define BG begin()
#define ED end()
#define pb push_back
#define mp make_pair
#define st first
#define nd second
#define FOR(i, a, b)  for (int i = (a), _b = (b);  i< _b; ++i)
#define FORD(i, a, b) for (int i = (a), _b = (b); i >= _b; --i)
#define FORE(i, a, b) for (int i = (a), _b = (b); i <= _b; ++i)
#define openfile ({freopen(TASK".inp", "r", stdin); freopen(TASK".out", "w", stdout);})

typedef vector <int> VI;
typedef pair <int, int> II;
typedef long long LL;
typedef long double LD;

const int N = (int) (2505);
const int LOGN = log2(N) + 2;
const LL MOD = (LL) (1e9 + 7);
const LL INF = (LL) 1e18;
const double PI = 2 * acos(0);
const double EPS = 1e-9;

template <typename T> inline void read(T &n) {
    n = 0; char ch; bool neg = false;
    for (ch = getchar(); ch < '0' || ch > '9'; ch = getchar()) if (ch == '-') neg = !neg; n = ch - 48;
    for (ch = getchar(); ch >= '0' && ch <= '9'; ch = getchar()) n = (n << 1) + (n << 3) + ch - 48; if (neg) n = -n;
}
template <typename T> inline void writee(T n) { if (n > 9) writee(n / 10); putchar(n % 10 + 48); }
template <typename T> inline void write(T n) { if (n < 0) { putchar('-'); n = -n; } writee(n); }
template <typename T> inline void writeln(T x) { write(x); putchar('\n'); }
inline long long __lcm(long long a, long long b) { return a / __gcd(a, b) * b; }
inline long long power(long long a, long long n) {
    long long r = 1;
    while (n) {
        if (n & 1) r = r * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return r;
}
inline void add(int &a, const int& b) { a = (a + b) % MOD; }
inline void sub(int &a, const int& b) { a = (a - b + MOD) % MOD; }

char s[10];

int main() {
    ios_base :: sync_with_stdio(false); cin.tie(NULL);
    cin >> s + 1;
    int n = strlen(s + 1);
    for (int i = 1; i < n; i++)
        if (s[i] == 'A' && s[i + 1] == 'C') return cout << "Yes\n", 0;
    cout << "No\n";
    return 0;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.math.BigInteger;
import java.util.Scanner;

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

		int n = in.nextInt();
		for(int i=0;i<n;i++) {
			String a = in.next();
			String b = in.next();

			BigInteger aBig = new BigInteger(a);
			BigInteger bBig = new BigInteger(b);
			BigInteger ans = aBig.add(bBig);

			if(ans.toString().length() > 80) {
				System.out.println("overflow");
			} else {
				System.out.println(ans);
			}
		}
	}

}

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

using namespace std;

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

  int n;
  while(true){
      cin>>n;
      if(n==0) break;
      bool flag=true;
      std::vector<int> vote(26);
      for(int i=1;i<=n;i++){
          char c;cin>>c;
          vote[c-'A']++;
          std::vector<int> tmp;
          for(int i=0;i<26;i++) tmp.push_back(vote[i]);
          sort(tmp.rbegin(),tmp.rend());
          int ma=tmp[0],next=tmp[1];
          if(ma>next+(n-i)){
              for(int j=0;j<26;j++){
                  if(vote[j]==ma){
                      cout<<(char)('A'+j)<<" "<<i<<endl;
                      flag=false;
                  }
              }
              for(int j=1;j<=n-i;j++){
                  char gomi;cin>>gomi;
              }
              break;
          }
      }
      if(flag)cout<<"TIE"<<endl;
  }
}

Measured memory_bytes: 3160
#include <iostream>
#include <climits>
#include <cmath>
#include <vector>
#include <map>
#include <set>
 
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

#define MOD 1000000007LL

ll n;

int main()
{
  ull ans=1, ax;
  ull umax = (ull)1000000000LL*1000000000LL;
  ll a;
  bool ov=false;

  cin >> n;

  for (int i=0; i<n; i++) {
    cin >> a;
    ax = ans;
    ans *= a;
    if (ax != 0 && a != 0 && ans == 0) {
      ov = true;
      ans = 1;
    }
    if (ans > umax) {
      ov = true;
      ans = 1;
    }
  }

  if (ov && ans) {
    printf("-1\n");
  } else {
    cout << ans << endl;
  }
  return 0;
}
/*
  3,317,625,251,168,256,000
  */

Measured memory_bytes: 3632
#include<stdio.h>
#include<math.h>
int main(){

	double x1,y1,x2,y2;
	scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);
	printf("%f\n",sqrt(pow(x1-x2,2)+pow(y1-y2,2)));

	return 0;
}



Measured memory_bytes: 2108
def make_code(prifacture_num, city_num):
    s1 = str(prifacture_num)
    while len(s1) != 6:
        s1 = '0' + s1
    s2 = str(city_num)
    while len(s2) != 6:
        s2 = '0' + s2
    return s1 + s2


prifacture_cnt, city_cnt = map(int, input().split())
data = [list(map(int, input().split())) for i in range(city_cnt)]
city_data = []

for i in range(city_cnt):
    city_data.append([data[i][0], data[i][1], i])

city_data.sort()
city_code = []
prifacture = city_data[0][0]
cnt = 0
for city in city_data:
    if prifacture == city[0]:
        cnt+=1
        s = make_code(prifacture, cnt)
        city_code.append([city[2], s])
    else:
        cnt = 1
        prifacture = city[0]
        s = make_code(prifacture, cnt)
        city_code.append([city[2], s])

city_code.sort()
for num,code in city_code:
    print(code)


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

int main(){
    int a,b,c; cin >> a >> b >> c;
    int cnt=0;
    if(a%2==1&&b%2==1&&c%2==0){
        a++;
        b++;
        cnt++;
    }else if(a%2==1&&b%2==0&&c%2==1){
        a++;
        c++;
        cnt++;
    }else if(a%2==0&&b%2==1&&c%2==1){
        b++;
        c++;
        cnt++;
    }else if(a%2==0&&b%2==0&&c%2==1){
        a++;
        b++;
        cnt++;
    }else if(a%2==0&&b%2==1&&c%2==0){
        a++;
        c++;
        cnt++;
    }else if(a%2==1&&b%2==0&&c%2==0){
        b++;
        c++;
        cnt++;
    }
    int x=max(a,max(b,c));
    cnt+=(x-a)/2;
    cnt+=(x-b)/2;
    cnt+=(x-c)/2;
    cout << cnt << endl;
}

Measured memory_bytes: 256