akhauriyash/Code-Regression huggingface dataset:
//Coded by Abhijay Mitra
#include <iostream>
#include <stdlib.h>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <numeric>
#include <vector>
#include <iterator> 
#include <map>
#include <set>
#include <climits>
#include <queue>
#include <cmath>
#include <stack>
#include <cctype>
#include <bitset>
// #include <bits/stdc++.h>
#define double long double
#define int long long int
#define ll int
#define ibs ios_base::sync_with_stdio(false)
#define cti cin.tie(0)
#define bp __builtin_popcount
#define pb push_back
#define res(v) v.resize(unique(v.begin(), v.end()) - v.begin());
#define cnt_res(v) std::distance(v.begin(),std::unique(v.begin(), v.end())); 
#define timer cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
using vi = std::vector<int>;
using vvi = std::vector<vi>;
using pii = std::pair<int,int>;
using vpii = std::vector<pii>;
using vvpii = std::vector<vpii>;
#define mp         make_pair
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define per(i,b,a) for (int i = b; i >= a; i--)
#define all(x)     x.begin(), x.end()
using namespace std;
const int N=2e6+10;
const int inf = /*0x3f3f3f3f*/1e18+10;
// const ll M = 998244353 ; // Mulo
// const int M = 1e9+7 ; // Mulo
const double Pi = 3.14159265;
#define F first
#define S second
int t;
void solve(){
    int a,v,b,w;
    cin>>a>>v>>b>>w>>t;
    if(b==a){
        cout<<"YES";return;
    }
        if(v==w){cout<<"NO";return;}

    if(b>a){
        if(a+v*t>=b+w*t){
        cout<<"YES";return;
    }
    cout<<"NO";return;
    }
    if(b<a){
if(a-v*t<=b-w*t){
        cout<<"YES";return;
    }
    cout<<"NO";return;
    }
    cout<<"NO";return;
}
int32_t main()
{
  ibs;cti;
  solve()
  /*,cout<<"\n"*/;
  // cout<<"\n";
  int xx=0;
  // int t;cin>>t;while(t--){/*xx++;cout<<"Case "<<xx<<":\n"*/;solve();cout<<"\n";}
  return 0;
}

Measured memory_bytes: 3656
//   PIGMEISTER™   //

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ull unsigned long long
#define sidha(i,x,n) for(ll i=(ll)(x);i<(ll)(n);i++)
#define ulta(i,x,n) for(ll i=(ll)(x);i>=(ll)(n);i--)
#define mi map<ll,ll>
#define vi vector<ll>
#define si set<ll>
#define pi pair<ll,ll>
#define vp vector<pair<ll,ll>>
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sab(a) a.begin(),a.end()
#define bas(a) a.rbegin(),a.rend()
#define modinv(x) powah(x,mod-2)
#define ncr(n,r) (((fact[n]*modinv(fact[n-r]))%mod*modinv(fact[r]))%mod)
#define factorial fact.pb(1);sidha(i,1,MAX)fact.pb((fact[i-1]*i)%mod)
#define test ll t;cin>>t;while(t--)
#define jaldi ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define endl '\n'
//#define mod (ll)1000000007
#define mod (ll)998244353
#define MAX 200005
ll powah(ll, ll);

int main()
{
    jaldi;

    ll n, ans = 0;
    cin >> n;
    vi v(n), freq(MAX, 0);
    sidha (i, 0, n) {
        cin >> v[i];
        freq[v[i]]++;
    }
    sidha (i, 0, MAX)
        ans += (freq[i]*(freq[i]-1))/2;
    sidha (i, 0, n)
        cout << ans - freq[v[i]] + 1 << endl;
    
    return 0;
}

ll powah(ll x, ll y) { 
    ll res = 1;
    x = x % mod;
    while (y > 0) { 
        if (y & 1) 
            res = (res*x) % mod; 
        y = y>>1;
        x = (x*x) % mod; 
    } 
    return res; 
}

Measured memory_bytes: 5760
#include<iostream>
#include <stdlib.h>
#include <algorithm>
#include <string>
typedef long long int ll;
using namespace std;
int main(){
int N;
int S;
cin >> N >> S;
if(N%S==0){
	cout << 0 << endl;
}else{
	cout << 1 << endl;
}
}

Measured memory_bytes: 256
//Author:- Yatin Patel
//Mail:- yatinpatel.gt@gmail.com

#include <bits/stdc++.h>
#define FILEIN ifstream fin;fin.open("input.txt");
#define FILEOUT ofstream fout;fout.open("output.txt");

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

#define FAST ios::sync_with_stdio(false);ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

#define ll long long
#define ld long double
#define pb push_back
#define ff first
#define ss second

#define precision(x,d) cout<<fixed<<setprecision(d)<<x
#define minQueue priority_queue<ll,vector<ll>,greater<ll> >
#define maxQueue priority_queue<ll,vector<ll>,less<ll> > 

#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define RFOR(i,a,b) for(ll i=a;i>b;i--)
#define FILL(a,b) memset((a),(b),sizeof((a)))

#define MOD 1000000007
#define INF LONG_MAX
#define MINF LONG_MIN

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

ll power(ll x, unsigned ll y){
    if (y == 0)
        return 1;
    else if (y%2 == 0)
        return power(x, y/2)*power(x, y/2);
    else
        return x*power(x, y/2)*power(x, y/2);
}

//#define fin cin
//#define fout cout

int main(){

    FAST;
    ll a,b;
    cin>>a>>b;
    if(b%a==0){
        cout<<a+b;
    }
    else{
        cout<<b-a;
    }

    return 0;
}






Measured memory_bytes: 256
//https://atcoder.jp/contests/abc162/tasks/abc162_a
#include <bits/stdc++.h>
#if LOCAL
#include "dump.hpp"
#else
#define dump(...)
#endif
using namespace std;
using ll=long long;
const ll LINF = 0x1fffffffffffffff;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
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;}
int main() {
  string N; cin>>N;
  bool ans=false;
  for(auto& c:N){
    if(c=='7') ans=true;
  }
  cout<<(ans?"Yes":"No")<<endl;
  return 0;
}

Measured memory_bytes: 3628
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQG = priority_queue<T, vector<T>, greater<T> >;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {return a < b && (a = b, true);}
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {return a > b && (a = b, true);}
template<typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) { return is >> p.first >> p.second;}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) { return os << p.first << ' ' << p.second;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    string s;
    cin >> s;
    
    int q;
    cin >> q;
    while(q--) {
        int k;
        cin >> k;
        
        ll D = 0, M = 0, DM = 0;
        ll ans = 0;
        rep(i, n) {
            switch(s[i]) {
                case 'D':
                    D++;
                    break;
                case 'M':
                    M++;
                    DM += D;
                    break;
                case 'C':
                    ans += DM;
                    break;
            }
            if(i >= k-1) {
                switch(s[i-k+1]) {
                    case 'D':
                        --D;
                        DM -= M;
                        break;
                    case 'M':
                        --M;
                        break;
                }
            }
        }
        cout << ans << '\n';
    }
}

Measured memory_bytes: 4244
#include<bits/stdc++.h>
#define lb long double
#define eps 1e-10
#define N 110
using namespace std;
struct Po{lb x,y;}a[N];
int n;
void get(Po &x){scanf("%Lf %Lf",&x.x,&x.y);}
Po operator -(Po x,Po y){return (Po){x.x-y.x,x.y-y.y};}
lb operator *(Po x,Po y){return x.x*y.y-x.y*y.x;}
int pa(int x){if (x<0)x+=n;if (x>=n)x-=n;return x;}
int main(){
	scanf("%d",&n);
	for (int i=0;i<n;i++)get(a[i]);
	for (int i=0;i<n;i++)if ((a[pa(i+1)]-a[i])*(a[pa(i-1)]-a[i])<-eps){puts("0");return 0;}
	puts("1");
	return 0;
}


Measured memory_bytes: 3236
/**********************************JAI SAI RAM*****************************************/
//HELP IN CODEFORCES ROUND 638 DIV 2

#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
typedef long long int ll;
ll P=1000000007;
ll MAX=P*(P-7);
ll MIN=-1*MAX;
const int sizes=100001;
const int BLK = 1200;

int main()
{
    ll i,j,k,l,m,n,o,p,q,r,s,t;
    cin>>n;
    vector<pair<ll,ll>> v;
    for(i=0;i<=1000;i++)
    {
        v.push_back({i*i*i*i*i,i});
        v.push_back({-1*(i*i*i*i*i),-1*i});
    }
    ll flag=0;
    for(i=0;i<v.size();i++)
    {
        for(j=0;j<v.size();j++)
        {
            if(v[i].first-v[j].first==n)
            {
                  cout<<v[i].second<<" "<<v[j].second<<endl;
                  return 0;    
            }
            if(v[j].first-v[i].first==n)
            {
                 cout<<v[j].second<<" "<<v[i].second<<endl;
                 return 0;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
#define repr(i, a, b) for (int i = a; i < b; i++)
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;

int main(){
    ll n,ans=0;
    cin >> n;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    for(ll i=0;i<n;i++){
        ans++;
        while(i+1<n&&a[i]==a[i+1]) i++;
        if(i==n-1) break;
        if(a[i]>a[i+1]){
            while(i+1<n&&a[i]>=a[i+1]) i++;
        }else{
            while(i+1<n&&a[i]<=a[i+1]) i++;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,m=0,t=0;
	for (int i=1;i<=3;i++)
	{   cin>>n;
		if (n==5) m++;if (n==7) t++;
	}
	if (t==1&&m==2) cout<<"YES"; 
	else cout<<"NO";
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<iomanip>
#include <string>
#include <cstdio>
#include<stdio.h>
#include <cstring>
#include <algorithm>
#include <queue>
#define ll long long
using namespace std;int stop;
int n,m;
int dx[4] = {-1,1,0,0};
int dy[4] = {0,0,-1,1};
int black;
int map[1002][1002];
bool isfull[1002][1002];
struct Node
{
    int x,y;
    int step;
    Node(int a,int b,int c){
        x=a,y=b,step = c;
    }
};

int check(int x,int y,int k){
    int sum = 0;
    for(int i=0;i<4;i++){
        if(map[x+dx[i]][y+dy[i]] == 999999){
            map[x+dx[i]][y+dy[i]] = k;
            sum++;
        }
    }
    return sum;
}

int main(){
    int i,j,k,x;
    char ch;
    queue<Node>q;
    scanf("%d %d",&n,&m);
    for(i=1;i<=n;i++){
        for(j=1;j<=m;j++){
            cin>>ch;
            if(ch == '#'){
                map[i][j] = 0;
                black++;
                q.push(Node(i,j,0));
            }else{
                map[i][j] = 999999;
            }
        }
    }
    if(black == n*m){
        printf("0\n");
        return 0;
    }
    
    int ans = 0;
    while (!q.empty())
    {
        Node u = q.front();q.pop();
        for(k=0;k<4;k++){
            if(map[u.x + dx[k]][u.y+dy[k]] == 999999){
                map[u.x + dx[k]][u.y+dy[k]] = 0;
                q.push(Node(u.x + dx[k],u.y+dy[k],u.step+1));
                ans = max(ans,u.step+1);
            }
        }
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 16272
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
#define int long long
#define ull unsigned long long
#define ld long double
#define rep(a) rep1(i,a)
#define rep1(i,a) rep2(i,0,a)
#define rep2(i,b,a) for(int i=(b); i<((int)(a)); i++)
#define rep3(i,b,a) for(int i=(b); i>=((int)(a)); i--)
#define all(a) a.begin(),a.end()
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define sz(a) ((int)a.size())
#define pow2(x) (1ll<<(x))
#define ceiling(a,b) (((a)+(b)-1)/(b))
#define print0(a) cout << (a) << ' '
#define print1(a) cout << (a) << '\n'
#define print2(a,b) cout << (a) << ' ',print1(b)
#define print3(a,b,c) cout << (a) << ' ',print2(b,c)
#define print4(a,b,c,d) cout << (a) << ' ',print3(b,c,d)
#ifdef i_am_noob
#define debug(a) print2(#a,a)
#else
#define debug(a) 
#endif
#define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
 
using namespace std;
using namespace __gnu_pbds;
 
const int Mod=1000000007,Mod2=998244353;
const int MOD=Mod2;
 
inline int add(int a, int b){return (a+b>=MOD?a+b-MOD:a+b);}
inline int sub(int a, int b){return (a+MOD-b>=MOD?a-b:a+MOD-b);}
int Pow(int a, int b){
	if(!b) return 1;
	int tmp=Pow(a*a%MOD,b>>1);
	return (b&1?tmp*a%MOD:tmp);
}
inline int inverse(int n){return Pow(n,MOD-2);}

const int maxn=100005;
//i_am_noob
int a,b,k;

signed main(){
	ios_base::sync_with_stdio(0),cin.tie(0);
	cin >> a >> b >> k;
	rep3(i,max(a,b),1){
		if(b%i==0&&a%i==0){
			k--;
			if(k==0){
				print1(i);
				return 0;
			}
		}
	}
	return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <map>
#include <list>
#include <cmath>
using namespace std;
typedef long long ll;
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define mp make_pair
#define pb push_back
const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = 1e9+7;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	char s[n];
	for (int i = 0; i < n; i++) cin >> s[i];

	char slime = '0';
	int ans = 0;
	for (int i = 0; i < n; i++) {
		if (slime != s[i]) {
			ans++;
			slime = s[i];
		}
	}
	cout << ans << endl;
    return 0;
}


Measured memory_bytes: 384
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    String T = sc.next();
    String tmp ="";
    for(int i = 0;i<200;i++){
      tmp = S.substring(0,1);//先頭を後ろにやっても変わんない
      S = S.substring(1,S.length())+tmp;

      if(S.equals(T)){
        System.out.println("Yes");
        return;
      }
    }
    System.out.println("No");
    
  }
  

  
}

Measured memory_bytes: 22996
#include<bits/stdc++.h>
using namespace std;
signed main(){
  string t;
  int sum=0,j=0;
  cin>>t;
  for(int i=0;i<t.size();i++){
    if(t[i]=='?'){
      t[i]='D';
    }
  }
  cout<<t<<"\n";
}

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

#define times(n, i)      uptil(0, n, i)
#define rtimes(n, i)     downto((n) - 1, 0, i)
#define upto(f, t, i)    for(int _##i = (t), i = (f); i <= _##i; i++)
#define uptil(f, t, i)   for(int _##i = (t), i = (f); i <  _##i; i++)
#define downto(f, t, i)  for(int _##i = (t), i = (f); i >= _##i; i--)
#define downtil(f, t, i) for(int _##i = (t), i = (f); i >  _##i; i--)
typedef long double ld;
#define long long long

#if defined(EBUG) && !defined(ONLINE_JUDGE)
    #define debug true
    #define ln << endl
#else
    #define debug false
    #define ln << '\n'
#endif
#define tb << '\t'
#define sp << ' '

int Sc[100001], Tc[100001];

signed main() { // long: 64bit
    if(!debug) {
        cin.tie(0);
        ios::sync_with_stdio(0);
    }

    Sc[0] = Tc[0] = 0;

    int s = 0;
    while(true) {
        char c = getchar();
        if(c == 'A') {
            Sc[s+1] = Sc[s] + 1;
        } else if(c == 'B') {
            Sc[s+1] = Sc[s] + 2;
        } else break;
        s++;
    }

    int t = 0;
    while(true) {
        char c = getchar();
        if(c == 'A') {
            Tc[t+1] = Tc[t] + 1;
        } else if(c == 'B') {
            Tc[t+1] = Tc[t] + 2;
        } else break;
        t++;
    }
    
    int Q;
    scanf("%d",&Q);
    times(Q, i) {
        int A, B, C, D;
        scanf("%d%d%d%d",&A,&B,&C,&D);
        if((Sc[B] - Sc[A-1]) % 3 == (Tc[D] - Tc[C-1]) % 3)
            printf("YES\n");
        else
            printf("NO\n");
    }

    return 0;
}


Measured memory_bytes: 1536
#include<bits/stdc++.h>
#include<iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <queue>
#include <deque>
#include <map>
#include <stack>
#include<bitset>
#include<list>
#include<cassert>
#include<numeric>

using namespace std;

const long long N = 1000 * 100 + 5;
long long c[N], n, cnt = 0, is, bi, nbi;
vector < long long > graph[N];
bool mark[N], b;
void dfs(long long v)
{
	mark[v] = 1;
	for (auto u : graph[v])
	{
		if (c[u] == c[v])
		{
			b = 0;
		}
		if (!mark[u])
		{
			c[u] = 1 - c[v];
			dfs(u);
		}
	}
	return;
}
void dfs2()
{
	memset(c , -1 , sizeof c);
	for(long long i = 0; i < n; i++)
	{
		if(!mark[i])
		{
			cnt++;
			b = 1;
			c[i] = 1;
			if(graph[i].size())
			{
				dfs(i);
				if(b)
				{
					bi++;
				}
				else
				{
					nbi++;
				}
			}
			else
			{
				is++;
			}
		}
	}
	return;
}
int main()
{
	long long m;
	cin >> n >> m;
	for (long long i = 0; i < m; i++)
	{
		long long u, v;
		cin >> u >> v;
		graph[u - 1].push_back(v - 1);
		graph[v - 1].push_back(u - 1);
	}
	dfs2();
	cout << (bi + nbi) * (bi + nbi) + bi * bi + 2 * n * is - is * is << endl;
}


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

int main() {

  int w, h;
  while( cin >> h >> w, w+h ) {
    char room[101][101];
    int t = 0;
    int now_x = 0, now_y = 0;

    for(int i=0; i<h; i++) {
      for(int j=0; j<w; j++) {
	cin >> room[i][j];
      }
    }

    while(1) {
      if( room[now_y][now_x] == '.' ) break;
      char c = room[now_y][now_x];
      if( c == '>' ) now_x++;
      if( c == '<' ) now_x--;
      if( c == 'v' ) now_y++;
      if( c == '^' ) now_y--;
      t++;
      if( t > w * h ) break;
    }

    if( t > w * h ) cout << "LOOP" << endl;
    else cout << now_x << " " << now_y << endl;
  }
}

Measured memory_bytes: 1168
#pragma GCC optimize("O3")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds; 

#define int long long
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define f first
#define s second
#define sz(x) (int)x.size()
#define endl '\n'
#define forn(i,n) for(int i=0;i<n;++i)
#define fore(i,l,r) for(int i=int(l);i<=int(r);++i)
#define rep(i,begin,end) for(__typeof(end) i=(begin);i!=(end);i++)
#define fill(a,value) memset(a,value,sizeof(a));
#define gcd(a,b) __gcd((a),(b))
#define watch1(x) cout << (x) << endl
#define watch2(x,y) cout << (x) << " " << (y) << endl
#define watch3(x,y,z) cout << (x) << " " << (y) << " " << (z) << endl
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long ll;
typedef long double ld; 
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef tree<pii,null_type,less<pii>,rb_tree_tag,tree_order_statistics_node_update> oset;

const int mod = 1e9 + 7;
const int inf = 1e18;
const int N = 20;

int i,j,k,n,m,x,a[20][20],c[20];

void solve(){
    cin>>n>>m>>x;
    for(i=0;i<n;++i){
        cin>>c[i];
        for(j=0;j<m;++j){
            cin>>a[i][j];
        }
    }
    int cost=inf;
    for(i=0;i<(1<<n);++i){
        int ans=0,ok=1;
        vi skill(m);
        for(j=0;j<n;++j){
            if(i&(1<<j)){
                ans+=c[j];
                for(k=0;k<m;++k){
                    skill[k]+=a[j][k];
                }
            }
        }
        for(j=0;j<m;++j){
            ok&=(skill[j]>=x);
        }
        if(ok)
            cost=min(cost,ans);
    }
    if(cost==inf)
        cout<<-1;
    else
        cout<<cost;
}

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

Measured memory_bytes: 3660
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cmath>
#include <queue>

typedef long long ll;
using namespace std;

int main() {

    int N, L;
    cin >> N >> L;

    int sum = 0;
    int min = 10000;
    for (int i = 1; i <= N; i++) {
        int temp = L + i - 1;
        if (abs(min) > abs(temp)) min = temp;
        sum += L + i - 1;
    }
    sum -= min;
    cout << sum << '\n';

}


Measured memory_bytes: 256
#include <stdio.h>
int main()
{
	int i, j;
	int x;
	scanf("%d", &x);
	int flag;
	
	int cnt = 0;
	for (i = 2; i <= 1000000; ++i) {
		flag = 0;
		for (j = 2; j < i; ++j) {
			if (i % j == 0) {
				flag = 1;
				break;
			}
		}
		if (flag==0&&x == i) {
			printf("%d\n", x);
			return 0;
		}
		else if (flag==0&&x < i) {
			printf("%d\n", i);
			return 0;
		}
	}
	return 0;
}


Measured memory_bytes: 128
import numpy as np

n, k = map(int, input().split())
a = np.array(list(map(int, input().split())))

L = len(f'{10**12:b}')
dp = np.full((L+1, 2), -1, dtype=np.int64)
dp[0, 0] = 0
for i in range(L):
    d = 1 << (L-i-1)
    cnt = np.count_nonzero(a & d)
    val0 = d * cnt
    val1 = d * (n - cnt)

    if dp[i, 1] != -1:
        dp[i+1, 1] = max(dp[i+1, 1], dp[i, 1] + max(val0, val1))
    if dp[i, 0] != -1:
        if k & d:
            dp[i+1, 1] = max(dp[i+1, 1], dp[i, 0] + val0)
    if dp[i, 0] != -1:
        if k & d:
            dp[i+1, 0] = max(dp[i+1, 0], dp[i, 0] + val1)
        else:
            dp[i+1, 0] = max(dp[i+1, 0], dp[i, 0] + val0)

print(max(dp[L, 0], dp[L, 1]))


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

string s;
string dream = "dream";
int dream_size = dream.size();
string dreamer = "dreamer";
int dreamer_size = dreamer.size();
string erase = "erase";
int erase_size = erase.size();
string eraser = "eraser";
int eraser_size = eraser.size();

int main() {
  cin >> s;
  bool b = true;
  int s_size = s.size();

  int offset = 0;
  string initial;

  while (offset != s_size) {
    initial = s[offset];
    if (initial == "e") {
      if (s.substr(offset, 6) == "eraser") {
        offset += 6;
        continue;
      }
      if (s.substr(offset, 5) == "erase") {
        offset += 5;
        continue;
      }
    }
    if (initial == "d") {
      if (s.substr(offset, 7) == "dreamer") {
        if (s.substr(offset + 5, 6) == "eraser") {
          offset += 11;
          continue;
        }
        if (s.substr(offset + 5, 5) == "erase") {
          offset += 10;
          continue;
        }
        offset += 7;
        continue;
      }
      if (s.substr(offset, 5) == "dream") {
        offset += 5;
        continue;
      }
    }
    b = false;
    break;
  }

  if (b == false) {
    cout << "NO" << endl;
  }

  if (b == true) {
    cout << "YES" << endl;
  }
  return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <string.h>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <stdio.h>
#include <vector>
#define int long long
#define endre getchar();getchar();return 0
#define moder 1000000007
#define inf 1000000000000000000
#define rep(i,n) for(int i=0;i<n;i++)
#define P pair<int,int>
#define all(v) v.begin(),v.end()
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x%mod;
		}
		x = x * x%mod;
		y >>= 1;
	}
	return res;
}
int kai(int x) {
	if (x == 0)return 1;
	return (kai(x - 1)*x) % moder;
}

int comb(int x, int y) {
	return kai(x)*mod_pow(kai(x - y), moder - 2, moder) % moder*mod_pow(kai(y), moder - 2, moder) % moder;
}
struct edge { int to, cost; };
int dx[5] = { 0,1,0,-1 }, dy[5] = { 1,0,-1,0 };
/*--------Library Zone!--------*/


signed main() {
	int x, y;
	cin >> x >> y;
	if (abs(x - y) <= 1)cout << "Brown" << endl;
	else cout << "Alice" << endl;
	endre;
}


Measured memory_bytes: 256
#pragma warning(disable : 4996)
#include <bits/stdc++.h>
extern "C" {
#include <quadmath.h>
}
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pld;
// https://atcoder.jp/contests/abc170/tasks/abc170_d
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    ll ans = 0;
    ll n;
    ll m = 0;
    cin >> n;
    vector<ll> v(n);
    for(int i = 0;i<n;i++){
        cin >> v[i];
        m = max(m, v[i]);
    }
    sort(all(v));
    vector<ll> dp(m+2);
    for (auto x : v){
        for (int i = x; i <= m; i += x){
            dp[i]++;
        }
    }
    for (auto x : v){
        if (dp[x] == 1)
            ans++;
    }
    cout << ans;

	return 0;
}

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

int main() {
	int n;
	cin >> n;
	vector<ll> l(n);
	rep(i,n) cin >> l[i];

	int ans = 0;
	for (int i=0;i<n;i++) 
		for (int j=i+1;j<n;j++)
			for (int k=j+1;k<n;k++) {
				if (l[i]!=l[j] && l[j]!=l[k] && l[k]!=l[i]) {
					if (l[i]+l[j]>l[k] && l[j]+l[k]>l[i] && l[k]+l[i]>l[j]) ans++;
				}
			}

	cout << ans << endl;

	return 0;
}


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

typedef vector<int> veci;
typedef pair<int, int> pii;
typedef vector<pii> vecii;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef vector<ll> vecl;
typedef vector<pll> vecll;
#define EPS (1e-9)
#define INF (1e9 + 7)
#define fi first
#define se second
#define endl '\n'

int gcd (int a, int b) {
    int tmp;
    while (b) {
        tmp = a % b;
        a = b;
        b = tmp;
    }
    return a;
}

void solve() {
    int n, m;
    cin >> n >> m;

    int maxi = m/n;
    for (int i=maxi; i>0; --i) {
        if ((m-(n*i))%i==0) {
            cout << i << endl;
            return;
        }
    }
}

int main(int argc, char* argv[]) {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
#ifdef LOCAL_TEST
    (void)argc;
    const string strpath = string(argv[0]) + string("-test.in");
    freopen(strpath.c_str(), "r", stdin);
    int tcs;
    cin >> tcs;
    while (tcs-- > 0)
#endif
    solve();
}


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

int main(){
    int x,y;
    char op;
    cin>>x>>op>>y;
    while(1){
        if(op=='?'){
            break;
        }
        switch(op){
            case '+':cout<<x+y<<endl;break;
            case '-':cout<<x-y<<endl;break;
            case '*':cout<<x*y<<endl;break;
            case '/':cout<<x/y<<endl;break;
        }
        cin>>x>>op>>y;
    }
    return 0;
}


Measured memory_bytes: 3096
import sys
from collections import deque
from itertools import groupby
def input(): return sys.stdin.readline().rstrip()

def main():
    _, K = map(int, input().split())
    S = input()

    ans = 0
    l = 0
    que = deque()
    que_sum = 0
    for k, v in groupby(S):
        if k == '0':
            l0 = len(tuple(v))
            que_sum += l0
            que.append(l + l0)
            if len(que) > K:
                que_sum -= que.popleft()
        else:
            l = len(tuple(v))
            que_sum += l
        if que_sum > ans:
            ans = que_sum
    print(ans)

if __name__ == '__main__':
    main()

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

int main(){
	int n,k;
	cin>>n>>k;
	vector<int>arr(n);
	for(int i=0; i<n; i++) cin>>arr[i];
	sort(arr.begin(),arr.end());
	vector<int>::iterator it = lower_bound(arr.begin(),arr.end(),k);
	cout<<n-(int)(it-arr.begin());
}


Measured memory_bytes: 3760
#include<iostream>
#include<stdio.h>
#include<string.h>
using namespace std;

int main(void){
    int ans = 0;
    string s, t;
    cin >> s >> t;

    for(int i = 0; i < s.size(); i++){
        if(s[i] != t[i]) ans++;
    }

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

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

#define IOS cin.tie(0);ios::sync_with_stdio(false)

#define ll      long long
#define Fi      first
#define Se      second
#define Pb      push_back
#define vi      vector<int>
#define vs      vector<string>
#define vp      vector<pair<int,int>>
#define vvi     vector<vector<int>>
#define vvp     vector<vector<pair<int,int>>>
using Graph  =  vector<vector<int>>; //Caution!! Segmentation Fault!! Don't forget to add +1!

#define sz(x) (int)x.size()
#define all(v) v.begin(),v.end()
#define output_s(s) printf("%s\n",(s).c_str())

#define rep(i,n)        for(int i=0;i<(int)(n);i++)
#define Rep(i,n,m)      for(int i=(int)(n);i<(int)(m);i++)
#define RepS(i,n,m)     for(int i=(int)(n);i<=(int)(m);i++)
#define RRepS(i,n,m)    for(int i=(int)(n);i>=(int)(m);i--)
#define SRepS(i,n,m)     for(int i=(int)(n);i*i<=(int)(m);i++)
#define RepA(x)         for(auto &item:(x))

void CINT(){} //@shibh308's template
template<class Head,class... Tail> void CINT(Head&& head,Tail&&... tail){cin>>head; CINT(move(tail)...);}    
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)
#define VCIN(x) for(auto &item:x) cin>>item

void OUT(){}
template<class Head,class...Tail> void OUT(Head&& head,Tail&&...tail){cout<<head<<(sizeof...(tail)?' ':'\n'); OUT(move(tail)...);}
#define COUT(...) OUT(__VA_ARGS__)

template<typename TypeInt>TypeInt GCD(TypeInt a,TypeInt b){return a%b==0?b:GCD(b,a%b);} //最大公約数
template<typename TypeInt>TypeInt LCM(TypeInt a,TypeInt b){return a*b/GCD(a,b);} //最小公倍数
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;}
template<class T>bool comp(T a,T b){return abs(a)<abs(b);} //比較関数

void YES(bool f){printf(f?"YES\n":"NO\n");}
void Yes(bool f){printf(f?"Yes\n":"No\n");}
void Possible(bool f){printf(f?"Possible\n":"Impossible\n");}
void POSSIBLE(bool f){printf(f?"POSSIBLE\n":"IMPOSSIBLE\n");}

//----------------------library------------------------//

//const int dx[4]={1,0,-1,0};
//const int dy[4]={0,1,0,-1};
const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};
const int NMAX = 200;
const int INF = 1e9;
const int MOD = 1e9+7;
bool flag;

//----------------------Global-------------------------//

signed main(){
    LCIN(x);
    ll ans;
    ans=x/11*2+(x%11+5)/6;
    printf("%lld\n",ans);

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int f[10],flag[10];
int n;

int find( int a)
{
	if (a >= 1 && a <= 399) return 1;
	if (a >= 400 && a <= 799) return 2;
	if (a >= 800 && a <= 1199) return 3;
	if (a >= 1200 && a <= 1599) return 4;
	if (a >= 1600 && a <= 1999) return 5;
	if (a >= 2000 && a <= 2399) return 6;
	if (a >= 2400 && a <= 2799) return 7;
	if (a >= 2800 && a <= 3199) return 8;
	return 9;
}

int main()
{
	int a;
	while (scanf("%d", &n) == 1) {
		memset(f, 0, sizeof(f));
		int ans = 0,t1=0,ans2=0;
		for (int i = 1; i <= n; i++) {
			scanf("%d", &a);
			if (find(a) == 9) {
				t1++;
			}
			else
			{
				if (f[find(a)] == 0) {
					ans++;
					f[find(a)] = 1;
				}
			}
		}
		ans2 = ans + t1;
		if (ans == 0) ans = 1;
		printf("%d %d\n", ans,ans2);
	}
	return 0;
}


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

#define rep(i, j) for (int i = 0; i < j; i++)
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;

int main() {

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;

    int n;
    string s;
    cin >> n >> s;

    vvi dp(10, vi(n, 0));
    rep(i, n) {
        dp[s[i] - '0'][i] = 1;
        if (i > 0) {
            rep(k, 10) {
                dp[k][i] += dp[k][i - 1];
            }
        }
    }

    int ans = 0;
    rep(i, 10) {
        int ii = lower_bound(all(dp[i]), 1) - dp[i].begin();
        if (ii == n) continue;
        rep(j, 10) {
            int xx = 1 + (i == j);
            int jj = lower_bound(dp[j].begin() + ii + 1, dp[j].end(), dp[j][ii] + 1) - dp[j].begin();
            if (jj == n) continue;
            rep(k, 10) {
                xx += (j == k);
                int yy = 1 + (j == k);
                auto it = lower_bound(dp[k].begin() + jj + 1, dp[k].end(), dp[k][jj] + 1);
                if (it != dp[k].end()) {
                    //cout << i << ":" << ii << " " << j << ":" << jj << " " << k << " " << (it != dp[k].end()) << endl;
                    ans++;
                }
            }
        }
    }

    cout << ans << endl;

    /*
    s1.insert(s[0]);
    for(int i = 1; i < n; i++) {
        mp1[s[i]] = s1.size();
        s1.insert(s[i]);
    }

    s2.insert(s[1]);
    for(int i = 2; i < n; i++) {
        mp2[s[i]] = s2.size();
        s2.insert(s[i]);
    }

    for(auto& p: mp1) {
        cout << (char)p.first << " " << p.second << endl;
    }
    cout << " -- " << endl;
    for(auto& p: mp2) {
        cout << (char)p.first << " " << p.second << endl;
    }
    cout << " -- " << endl;

    int ans = 0;
    for(auto& p1: mp2) {
        int tmp = 0;
        for (auto& p2: mp1) {
            tmp += p2.second;
        }
        ans += p1.second * tmp;
    }
    */

    return 0;
}


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

const double PI = acos(-1);
const double EPS = 1e-15;
using ll = long long;
using ull = unsigned long long;
const int inf = 2e9;
const ll INF = 2e18;
const ll MOD = 1e9+7;
const ll MOD1 = 998244353;
typedef pair<ll,ll> P;

#define rep(i,a,b) for (int i = (a); i < (b); i++)
#define rrep(i,a,b) for (int i = (a); i >= (b); i--)
#define REP(i,n) rep(i,0,n)
#define RREP(i,n) rrep(i,n,0)
#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
//#define mp make_pair

ll n,m;
vector<P> G[100010];
ll ds[100010];
ll dt[100010];
int bit[200010];
map<ll,int> mp;
map<int,ll> mp1;
ll ans[100010];
vector<ll> work;

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

  cin >> n >> m;
  REP(i,m) {
    ll a,b,c;
    cin >> a >> b >> c;
    G[a].pb({b,c});
    G[b].pb({a,c});
  }
  fill(ds, ds + n, INF);
  fill(dt, dt + n, INF);

  priority_queue<P,vector<P>,greater<P>> pq1,pq2;
  pq1.push({0LL,0LL});
  pq2.push({0LL,n-1});

  ds[0] = 0;
  dt[n-1] = 0;

  while (!pq1.empty()) {
    P p = pq1.top();
    pq1.pop();
    ll v = p.second;
    if (ds[v] < p.first) continue;
    for (int i = 0; i < G[v].size(); i++) {
      P e = G[v][i];
      if (ds[e.fi] > ds[v] + e.se) {
        ds[e.fi] = ds[v] + e.se;
        pq1.push(P(ds[e.fi], e.fi));
      }
    }
  }

  while (!pq2.empty()) {
    P p = pq2.top();
    pq2.pop();
    ll v = p.second;
    if (dt[v] < p.first) continue;
    for (int i = 0; i < G[v].size(); i++) {
      P e = G[v][i];
      if (dt[e.fi] > dt[v] + e.se) {
        dt[e.fi] = dt[v] + e.se;
        pq2.push(P(dt[e.fi], e.fi));
      }
    }
  }

  priority_queue<pair<ll,ll>,vector<pair<ll,ll>>,greater<pair<ll,ll>>> P;
  priority_queue<pair<pair<ll,ll>,int>,vector<pair<pair<ll,ll>,int>>,greater<pair<pair<ll,ll>,int>>> Q;

  REP(i,n) {
    P.push({ds[i],dt[i]});
  }
  sort(dt,dt+n);
  int num = 1;
  REP(i,n) {
    work.pb(dt[i]);
  }

  int q;
  cin >> q;
  REP(i,q) {
    ll fs, ft;
    cin >> fs >> ft;
    Q.push({{fs,ft},i});
    work.pb(ft);
  }
  sort(work.begin(),work.end());
  REP(i,sz(work)) {
    if (!mp.count(work[i])) mp[work[i]] = num++;
  }

  int cnt = 0;
  while (!Q.empty()) {
    ll lim = Q.top().fi.fi;
    while (!P.empty() && P.top().fi <= lim) {
      ll tmp = mp[P.top().se];
      P.pop();
      cnt++;
      while (tmp <= num) {
        bit[tmp]++;
        tmp += tmp & -tmp;
      }
    }
//    cout << "------------" << endl;
//    cout << cnt << endl;
    while (!Q.empty() && Q.top().fi.fi == lim) {

      ll tmp = mp[Q.top().fi.se] - 1;
      int id = Q.top().se;
      //cout << id << " " << tmp << " ";
      ans[id] += cnt;
      while (tmp > 0) {
        ans[id] -= bit[tmp];
        tmp -= tmp & -tmp;
      }
      //cout << ans[id] << endl;
      Q.pop();
    }
  }

  REP(i,q) {
    cout << ans[i] << endl;
  }

  return 0;
}



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

using namespace std;

typedef long long int ll;

#define fin(ans) cout << (ans) << endl;

int main()
{
  ll n, m;        cin >> n >> m;
  if(n < 9&&m < 9)
  {
    fin("Yay!");
  }
  else
  {
    fin(":(");
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
typedef long long ll;

using namespace std;

int main() {
    ll a[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    ll k;
    cin>>k;
    cout<<a[k-1];
    
}

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

using namespace std;
using VI = vector<int>;
using VPI = vector<pair<int, int>>;
using LL = long long;

#define FOR(a,n) for(int i=a;i<n;i++)
#define rFOR(a,n) for(int i=n-1;i>=a;i--)
#define IN(n,a) for(int i=0;i<n;i++) cin>>a[i]
#define pIN(n,t) for(int i=0;i<n;i++){int a,b; cin>>a>>b; t.emplace_back(a,b);}
#define SORT(a) sort(a.begin(), a.end())
#define ALL(a) a.begin(), a.end()

int main()
{
	LL h,ans = 0,value = 1;
	cin >> h;

	while (h >= value)
	{
		ans += value;
		value = value * 2;
	}
	cout << ans;
}

Measured memory_bytes: 256
var
	i,j,h,w,n,a,c,t:Longint;
	u:array[1..100]of Longint;
begin
	t:=1;
	read(h,w,n,a);
	if h*w=n then begin
		for i:=1 to h do begin
			if i mod 2=1 then begin
				for j:=1 to w do begin
					writeln(t);
					inc(t);
				end;
			end else begin
				for j:=w downto 1 do begin
					u[j]:=t;
					inc(t);
				end;
				for j:=1 to w do writeln(u[j]);
			end;
		end;
		exit;
	end;
	for i:=1 to h do begin
		if i mod 2=1 then begin
			for j:=1 to w do begin
				writeln(t);
				inc(c);
				if a=c then begin
					read(a);
					c:=0;
					inc(t);
				end;
			end;
		end else begin
			for j:=w downto 1 do begin
				u[j]:=t;
				inc(c);
				if a=c then begin
					read(a);
					c:=0;
					inc(t);
				end;
			end;
			for j:=1 to w do writeln(u[j]);
		end;
	end;
end.


Measured memory_bytes: 128
import itertools
import copy

n = int(input())
indexes = [_ for _ in range(1, n+1)]

def ifCorrect(data, fakes):
    answer_sheet = [1 for i in range(n+1)]
    answer_sheet[0] = -1
    for i in fakes:
        answer_sheet[i] = 0

    #このあたりで、fakeでない人の情報とも比較して、正直者の証言がそれらのリストと合致しているかを確認すれば良い
    for i in range(len(data)):
        for j in data[i]:
            if not i in fakes and not answer_sheet[j[0]] == j[1]:
                return False
                    
    return True

data = [[] for _ in range(n+1)]
for i in range(n):
    id = int(input())
    for _ in range(id):
        x, y = map(int, input().split(" "))
        data[i+1].append([x,y])

fakePersonCount = 0
flag = True
while fakePersonCount <= n and flag:
    comb = itertools.combinations(indexes, fakePersonCount)
    for fakePeople in comb:
        if ifCorrect(data, fakePeople):
            print(n - fakePersonCount)
            flag = False
            break
    fakePersonCount += 1

if flag:
    print(0)

#[[], [[2, 1], [3, 0]], [[3, 1], [1, 0]], [[1, 1], [2, 0]]]

Measured memory_bytes: 3440
// https://atcoder.jp/contests/dp/tasks/dp_a

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define pb push_back
#define vb vector<bool>
#define vi vector<int>
#define vll vector<ll>
#define pll pair<ll, ll>
#define MOD 1000000007
#define MAX_TIME 1e9
#define nl "\n"
#define sp " "
#define gcd __gcd
#define pf printf
#define sf scanf
#define se(a) a.begin(),a.end()
#define fill(a,n) for(int i = 0; i < n; i++)cin>>a[i]


ll solve(int n,vi h){
    vll dp(n,MOD);
    dp[0] = 0;
    for(int i = 0; i < n; i++){
        if(i + 1< n) dp[i+1] = min(dp[i+1],dp[i]+abs(h[i]-h[i+1]));
        if(i + 2< n) dp[i+2] = min(dp[i+2],dp[i]+abs(h[i]-h[i+2]));

    }
    return dp[n-1];
}

int main()
{
    int n;
    cin>>n;
    vi h(n,0);
    fill(h,n);
    cout<<solve(n,h)<<nl;    
}

Measured memory_bytes: 4836
package main

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

func main() {
  var n,m int = NextInts()
  var pp []bool = make([]bool,n)
  pp[0] = true
  var nn []int = make([]int,n)
  for i:=0;i<n;i++ { nn[i] = 1 }
  for i:=0;i<m;i++ {
    var x,y int = NextInts()
    x,y = x-1,y-1
    if pp[x] { pp[y] = true }
    nn[x]--
    nn[y]++
    if nn[x] == 0 { pp[x] = false }
  }
  var s int
  for i:=0;i<n;i++ {
    if pp[i] { s++ }
  }
  fmt.Println(s)
}

var reader = bufio.NewReaderSize(os.Stdin,1000000)
func NextLine() string {
  var line,buffer []byte
  var isPrefix bool = true
  var err error
  for ;isPrefix; {
    line,isPrefix,err = reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer,line...)
  }
  return string(buffer)
}
func NextInts() (int,int) {
  var x,y int
  var s []string = strings.Split(NextLine()," ")
  x,_ = strconv.Atoi(s[0])
  y,_ = strconv.Atoi(s[1])
  return x,y
}

Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define mod 1000000007
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int N,i;
	cin>>N;
	string s1,s2,s3;
	cin>>s1;
	if(N%2==0)
    {
        for(i=0;i<N/2;i++) s2+=s1[i];
        for(i=N/2;i<N;i++) s3+=s1[i];
        if(s2==s3) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
    else cout<<"No"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using P = pair<int, int>;
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};


int main(){
    int n;
    cin >> n;
    vector<int> a(n+2);
    int sum = 0;
    rep(i, n) {
        cin >> a[i+1];
    }
    rep(i, n+1) {
        sum += abs(a[i]-a[i+1]);
    }
    
    
    rep(i, n) {
        int ans = sum;
        ans -= abs(a[i+1]-a[i]);
        ans -= abs(a[i+1]-a[i+2]);
        ans += abs(a[i]-a[i+2]);
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 1664
#include <iostream>
#include <string>
using namespace std;
int main(){
long long int n,s;
cin >> n;
s=n;
long long int ans=0;
while(1){
  if(s==0) break;
  ans+=(s%10);
  s/=10;
}
if(n%ans==0) cout <<"Yes"<<endl;
else cout <<"No"<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll          long long int
#define pb          push_back
#define pll         pair<ll,ll>
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mode        998244353
#define mod         1000000007
#define inf         1000000000000000000LL
#define vl          vector<ll>
#define F           first
#define S           second
#define db          long double
#define sz(x)       (ll)x.size()
#define fix(n)      cout<<fixed<<setprecision(n)
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define all(x)      x.begin(),x.end()
#define mset(x)     memset(x,0,sizeof x)
#define pi          3.1415926535897932

inline ll _xor(ll a, ll b) {  return (a^b);  }

void solve()
{
       ll n, k, cur=0;
       cin>>n>>k;
       ll a[n+1];
       rep(i,1,n+1) cin>>a[i];
       for(ll i=50; i>=0; i--)
       {
              ll cnt=0;
              for(ll j=1; j<=n; j++)
              {
                     if((a[j]>>i)&1) cnt++;
              }
              if(cnt*2<n && (cur + (1LL<<i) <= k) ) // if i-th bit is set in less than half of the numbers than we set try to set this bit in X if possible
                     cur += (1LL<<i);
       }
       ll ans=0;
       for(ll i=1; i<=n; i++) ans=ans+_xor(cur,a[i]);
       cout<<ans;
}

int main() {
	ll T = 1;
	speed_up
	//cin>>T;
	while(T--)
	    solve();
	return 0;
}


Measured memory_bytes: 1024
#include "cstdio"

int A[100004];

int gcd (int x,int y)
{
    return y==0?x:gcd(y,x%y);
}

int max(int x,int y)
{
    return x>y?x:y;
}

int main()
{
    int n,k,m,g;
    while (scanf ("%d%d",&n,&k) != EOF)
    {
        for (int i=0;i<n;i++)
        {
            scanf ("%d",&A[i]);
        }
        m = g = A[0];
        for (int i=1;i<n;i++)
        {
            m = max(m,A[i]);
        }
        for (int i=1;i<n;i++)
        {
            g = gcd(g,A[i]);
        }
        if (m < k)
        {
            printf ("IMPOSSIBLE\n");
            continue;
        }
        if (k%g == 0)
        {
            printf ("POSSIBLE\n");
        }
        else
        {
             printf ("IMPOSSIBLE\n");
        }
    }
    return 0;
}


Measured memory_bytes: 512
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int main()
{
	int a, b, c, x = 0;
	scanf("%d %d %d", &a, &b, &c);

	while(!(a == b && b == c)) {
		++x;
		if(a == b) {
			if(a < c) {
				a++, b++;
			} else {
				c += 2;
			}
		} else if(b == c) {
			if(a < b) {
				a += 2;
			} else {
				b++, c++;
			}
		} else if(c == a) {
			if(a < b) {
				a++, c++;
			} else {
				b += 2;
			}
		} else {
			if(a < b && a < c) {
				a += 2;
			} else if(b < a && b < c) {
				b += 2;
			} else if(c < a && c < b) {
				c += 2;
			}
		}
	}
	printf("%d\n", x);
	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

int main() {
  int n, s;
  while (~scanf("%d", &n) && n>0) {
    int i, sum = 0, largest = 0, smallest = 1000, avg;

    for (i=0; i<n; i++) {
      scanf("%d", &s);
      sum += s;
      if(largest < s) largest = s;
      if(smallest > s) smallest = s;
    }

    sum -= (largest + smallest);
    avg = sum / (n-2);
    printf("%d\n", avg);

  }
  
  return 0;
}

Measured memory_bytes: 600
N, M = [int(_) for _ in input().split()]
A = [int(_) for _ in input().split()]

from itertools import accumulate

from collections import defaultdict

ts = defaultdict(int)

ts[0] = 1

t = 0
for a in A:
    t = (t + a) % M
    ts[t] += 1

result = 0

for t in ts:
    result += ts[t] * (ts[t] - 1) // 2

print(result)



Measured memory_bytes: 62576
#import<atcoder/all>
using namespace std;int n,m,i;vector<int>a,b;int main(){cin>>n>>m;for(;n--;a.push_back(i))cin>>i;for(;m--;b.push_back(i))cin>>i;for(int i:atcoder::convolution(a,b))cout<<i<<' ';}

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


int main() {

    int n;
    cin >> n;
    vector<string> s(n);
    rep(i, n) cin >> s[i];

    map<string, ll> sums;

    rep(i, n) {
        sort(s[i].begin(), s[i].end());
        if(sums.count(s[i]) == 0) {
            sums[s[i]] = 1;
        } else {
            sums[s[i]]++;
        }
    }

    ll ans = 0;

    for(auto itr = sums.begin(); itr != sums.end(); ++itr) {
        if(itr->second > 1) {
            ll tmp = itr->second - 1;
            ans += (tmp * (tmp + 1) / 2);
        }
    }

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


Measured memory_bytes: 13996