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

pair<ll, ll> mininarray(vector<ll> a, int n) {
  ll mina = 1000000000;
  int ind = 0;
  rep(p,n){
    if(a.at(p) != 0){
      if(mina > a.at(p)) {
        mina = a.at(p);
        ind = p;
      }
    }
  }
  
  return make_pair(mina,ind);
}

int main(){
  int n; cin >> n;
  vector<ll> a(n);
  rep(i,n) cin >> a.at(i);

  pair<ll, ll> minind;
  ll mina,inda;

  bool flag = 1;
  while(flag) {
    flag = 0;
    minind = mininarray(a,n);
    mina = minind.first;
    inda = minind.second; 
    rep(i,n){
      if(i != inda) {
        a.at(i) = a.at(i) % mina;
        if(a.at(i) != 0) flag = 1;
      }
     // cout << a.at(i) << ' ';
    }
   // cout << endl;
  }

  cout << mina << endl;
}



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

int main(){
  int N,M;
  cin>>N>>M;
  int K;
  int temp;
  map<int,int>mp;
  for (int i=0;i<N;i++){
    cin >> K;
    for (int j=0;j<K;j++){
      cin>> temp;
      mp[temp]++;
    }
  }
  int ans=0;
  for (int i=1;i<M+1;i++){
    if (mp[i]==N){
      ans++;
    }
  }
  cout<<ans<<endl;
  return 0;
}

     
    

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define USE_LLONG_AS_INT
#ifdef USE_LLONG_AS_INT
#define int long long
#define inf (1ll<<60)
#else
#define inf (1<<30)
#endif
#define rep(i,n) for(int i=0;i<(n);i++)
#define Rep(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a,b) for(int i=(a);i<=(b);i++)
#define rev(i,n) for(int i=(n)-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define vs vector<string>
#define pb push_back
#define eb emplace_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;
// const int mod=998244353;
const string sp=" ";

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

void run(){
    int n,k;
    cin>>n>>k;
    vi p(n);
    rep(i,n)cin>>p[i];
    SORT(p);
    cout<<accumulate(p.begin(),p.begin()+k,0ll)<<endl;
}

Measured memory_bytes: 3652
import java.util.*;
import java.util.regex.Pattern;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n=sc.nextInt(),a=sc.nextInt(),b=sc.nextInt(),c=sc.nextInt(),d=sc.nextInt();
        String s=sc.next();
        boolean ans=true;
        String reg=Pattern.quote("...");
        if(s.substring(Math.min(a-1,b-1),Math.max(c,d)).replaceAll("##", "").length()!=s.substring(Math.min(a-1,b-1),Math.max(c,d)).length())ans=false;
        if(a>b&&c<d||a<b&&c>d){
            if(s.substring(Math.max(a-2,b-2),Math.min(c+1,d+1)).replaceAll(reg,"").length()==s.substring(Math.max(a-2,b-2),Math.min(c+1,d+1)).length())ans=false;
        }
        System.out.println(ans?"Yes":"No");
    }
}

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

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

int main(){
	int h,w,n,y0,x0;
	string s1,s2;
	cin>>h>>w>>n>>y0>>x0>>s1>>s2; y0--; x0--;

	bool ok=true;
	int t=0,b=h,l=0,r=w;
	for(int i=n-1;i>=0;i--){
		if(s2[i]=='U') b=min(b+1,h);
		if(s2[i]=='D') t=max(t-1,0);
		if(s2[i]=='L') r=min(r+1,w);
		if(s2[i]=='R') l=max(l-1,0);

		if(s1[i]=='U') t=min(t+1,h);
		if(s1[i]=='D') b=max(b-1,0);
		if(s1[i]=='L') l=min(l+1,w);
		if(s1[i]=='R') r=max(r-1,0);

		if(t>=b || l>=r) ok=false;
	}
	if(!(t<=y0 && y0<b && l<=x0 && x0<r)) ok=false;

	puts(ok?"YES":"NO");

	return 0;
}


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

typedef long long ll;

const ll MOD = 998244353;
ll N;
vector<ll> Inv, Pow2, Fact, InvFact;
ll Res;

int main() {
  cin >> N;
  Res = 1;
  for (ll i = 0; i < N; ++i) (Res *= 3) %= MOD;
  Inv.resize(N + 1);
  Inv[1] = 1;
  for (ll i = 2; i <= N; ++i) {
    Inv[i] = MOD - MOD / i * Inv[MOD % i] % MOD;
  }
  Pow2.resize(N + 1);
  Fact.resize(N + 1);
  InvFact.resize(N + 1);
  Pow2[0] = Fact[0] = InvFact[0] = 1;
  for (ll i = 1; i <= N; ++i) {
    Pow2[i] = 2 * Pow2[i - 1] % MOD;
    Fact[i] = i * Fact[i - 1] % MOD;
    InvFact[i] = Inv[i] * InvFact[i - 1] % MOD;
  }
  for (ll k = N / 2 + 1; k <= N; ++k) {
    (Res += MOD - 2 * Pow2[N - k] * Fact[N] % MOD * InvFact[k] % MOD *
                      InvFact[N - k] % MOD) %= MOD;
  }
  cout << Res << endl;
  return 0;
}


Measured memory_bytes: 312704
#include <stdio.h>
int main()
{
   int r,c,i,j;
   int a[100+1][100+1];

   scanf("%d %d",&r,&c);

   if(r<1||100<r||c<1||100<c)
   {
       return 1;
   } 

   for(i=0;i<=r;i++)
   {
       for(j=0;j<=c;j++)
       {
           a[i][j]=0;
       }
   }
   for(i=0;i<r;i++)
   {
       for(j=0;j<c;j++)
       {
           scanf("%d",&a[i][j]);
       }
   }
   for(i=0;i<r;i++)
   {
       for(j=0;j<c;j++)
       {
           a[i][c]+=a[i][j];
       }
   }
   for(j=0;j<c;j++)
   {
       for(i=0;i<r;i++)
       {
           a[r][j]+=a[i][j],a[r][c]+=a[i][j];
       }
   }
   for(i=0;i<=r;i++)
   {
       for(j=0;j<=c;j++)
       {
           printf("%d",a[i][j]);
           if(j!=c) putchar(' ');
       }

       putchar('\n');
   }

   return 0;
}


Measured memory_bytes: 2052
#include <cstdio>
#include <vector>

using std::vector;

int main(){
	int n,k;
	scanf("%d%d",&k,&n);
	if(k%2==0){
		printf("%d ",k>>1);
		for(int i=2;i<=n;++i)
			printf("%d ",k);
	}
	else{
		vector<int> vec(n,k+1>>1);
		for(int i=0,lim=n>>1;i<lim;++i){
			if(vec.back()==1)
				vec.pop_back();
			else{
				--vec.back();
				while(vec.size()<n) vec.push_back(k);
			}
		}
		for(int i=0;i<vec.size();++i)
			printf("%d ",vec[i]);
	}
	return 0;
}

Measured memory_bytes: 3456
H, W, K = map(int, input().split(' '))
ls,result = [], 0

for i in range(H):
    ls.append(input())

for i in range(1 << H):
    for j in range(1 << W):
        cnt = 0
        for s in range(H):
            if i >> s & 1:
                continue
            for t in range(W):
                if j >> t & 1:
                    continue
                if ls[s][t] == '#':
                    cnt += 1
        if cnt == K:
            result += 1
print(result)

Measured memory_bytes: 9208
#include "bits/stdc++.h"
#pragma GCC optimize("Ofast")

// Begin {{{
using namespace std;

#ifndef DEBUG
#define dump(...)
#endif

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class T>
inline vector<T> make_v(const T &initvalue, size_t sz) {
    return vector<T>(sz, initvalue);
}

template <class T, class... Args>
inline auto make_v(const T &initvalue, size_t sz, Args... args) {
    return vector<decltype(make_v<T>(initvalue, args...))>(sz, make_v<T>(initvalue, args...));
}

constexpr int INF = 0x3f3f3f3f;
constexpr int64_t LINF = 0x3f3f3f3f3f3f3f3fLL;

constexpr size_t    operator""_sz(unsigned long long value) { return value; };
constexpr intmax_t  operator""_im(unsigned long long value) { return value; };
constexpr uintmax_t operator""_um(unsigned long long value) { return value; };
// }}} End

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

    size_t N;
    cin >> N;

    intmax_t res = 0;
    for (size_t i = 0; i < N; ++i) {
        intmax_t a; cin >> a;
        res += __builtin_ctz(a);
    }

    cout << res << "\n";

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define pb push_back
#define mp make_pair
#define IOS ios_base::sync_with_stdio(false),cin.tie(0);
#define F first
#define S second
using namespace std;
typedef long long ll;
ll a,b,c,d;
const ll maxn=200005;
const ll mod=1e9+7;
typedef pair<ll,ll> pii;
ll num[100005];
ll n,k,x,y;

string s;
int main()
{
    //IOS
    while(cin>>n)
    {
        ll sum=0;
        rep1(i,n) cin>>num[i];
        for(int i=2;i<n;i++)
        {
            if(num[i-1]<num[i]&&num[i]<num[i+1]) sum++;
            if(num[i-1]>num[i]&&num[i]>num[i+1]) sum++;
        }
        cout<<sum<<"\n";
    }


}


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

const int mod = 1e9+7;

int n, c[26];
char a[100005];

int main()
{
    scanf("%d%s",&n,a);
    for(int i=0;i<n;i++) {
        c[a[i]-'a']++;
    }
    int ans = 1;
    for(int i=0;i<26;i++) {
        ans = 1ll * ans * (c[i] + 1) % mod;
    }
    ans = (ans + mod - 1) % mod;
    printf("%d\n" ,ans);
}


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

public class Main {

    private final static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    private final static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));

    private static class Point {
        public int x, y;
        public char color;

        public Point(int x, int y, char color){
            this.x = x;
            this.y = y;
            this.color = color;
        }
    };

    public static void main(String[] args) throws IOException {

        int N = Integer.parseInt(br.readLine());
        List<Point> arr = new ArrayList<>();

        for(int i = 0; i < N; i++) {
            StringTokenizer st = new StringTokenizer(br.readLine(), " ");
            int a = Integer.parseInt(st.nextToken());
            int b = Integer.parseInt(st.nextToken());
            Point p = new Point(a, b, 'r');
            arr.add(p);
        }

        for(int i = 0; i < N; i++){
            StringTokenizer st = new StringTokenizer(br.readLine(), " ");
            int a = Integer.parseInt(st.nextToken());
            int b = Integer.parseInt(st.nextToken());
            Point p = new Point(a, b, 'b');
            arr.add(p);
        }

        arr.sort((Point o1, Point o2) -> {
            if(o1.x != o2.x){
                return Integer.compare(o1.x, o2.x);
            }
            if(o1.y != o2.y){
                return Integer.compare(o1.y, o2.y);
            }
            return 0;
        });

        int answer = 0;
        List<Point> reds = new ArrayList<>();
        for(Point p : arr){
            if(p.color == 'b'){
                Point maximumYRed = null;
                for(Point red : reds){
                    if(red.y < p.y && (maximumYRed == null || maximumYRed.y < red.y)){
                        maximumYRed = red;
                    }
                }

                if(maximumYRed != null) {
                    answer += 1;
                    reds.remove(maximumYRed);
                }
            }else{
                reds.add(p);
            }
        }

        bw.write(String.format("%d\n", answer));
        bw.flush();
    }
}


Measured memory_bytes: 26580
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
//#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
const int64 INF = 1LL << 58;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

ll beki(int a, int n){
    if(n == 0) return 1;
    ll ans = beki(a, n / 2);
    ans = ans * ans;
    if(n % 2 == 1) ans = ans * a;
    return ans;
}

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

    int N, K;cin >> N >> K;
    vei h(N); rep(i,N) cin >> h[i];
    int cnt = 0;
    rep(i,N) {
        if(h[i] >= K) cnt++;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define watch(x) cout<<(#x)<<" is "<<(x)<<endl
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define pb push_back
#define pq priority_queue
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define elif else if

using namespace std;
using ll=long long;
using ull=unsigned long long;
using ld=long double;
using pll=pair<ll,ll>;
using pss=pair<string,string>;
using pdd=pair<ld,ld>;
using graph=vector<vector<int>>;
using wgraph=vector<vector<pll>>;

const ll MOD=1000000007;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int ex[8]={1,1,0,-1,-1,-1,0,1};
const int ey[8]={0,1,1,1,0,-1,-1,-1};
const ld E=1e-9;

template<class T> void chmin(T &a, T b){a=min(a, b);}
template<class T> void chmax(T &a, T b){a=max(a, b);}

ll abs1(ll a){if(a>=0)return a;else return -a;}
ll pow1(ll a,ll b,ll p=LLONG_MAX){
  ll ret=1;
  while(b!=0){
    if((b&1)==1)ret*=a;a*=a;
    if(a>=p)a%=p;if(ret>=p)ret%=p;
    b=b>>1;
  }
  return ret;
}
int digit(ll a,ll b=10){int i=0;while(a!=0){a/=b;i++;}return i;}
ll gcd1(ll a,ll b){
  if(a==0 || b==0)return 0;
  ll n;while(a%b!=0){n=a%b;a=b;b=n;}return b;
}
ll solveLinear(ll n,ll m,ll c){
  if(n==0 && m==0)return 0;
  ll a[100],b[100];a[0]=n;b[0]=m;int i=1;
  while(b[i-1]!=0){a[i]=b[i-1];b[i]=a[i-1]%b[i-1];i++;}
  n=i;if(c%a[n-1]!=0)return 0;
  ll x=c/a[n-1],y=0;
  for(i=1;i<n;i++){ll cnt=x;x=y;y=cnt-(a[n-i-1]/b[n-i-1])*y;}
  return x;
}
ll modInv(ll a,ll p=MOD){
  a%=p;ll n=solveLinear(a,p,1);
  n%=p;if(n<0)return n+p;
  return n;
}
ll fact(ll n,ll p=MOD){
  if(n<0)return 0;
  ll ret=1;for(int i=1;i<=n;i++){ret=ret*i;if(ret>=p)ret%=p;}
  return ret;
}
ll perm(ll n,ll k,ll p=MOD){
  if(n<0 || k<0 || n<k)return 0;
  ll ret=1;rep(i,k){ret=ret*(n-i);if(ret>=p)ret%=p;}
  return ret;
}
ll binom(ll n,ll k,ll p=MOD){
  return (perm(n,k,p)*modInv(fact(k)))%p;
}
int bis(vector<int> v,int key){
  int left=-1,right=v.size();
  while(abs1(right-left)>1){
    int mid=left+(right-left)/2;
    if(v[mid]<=key)left=mid;
    else right=mid;
  }
  return left;
}

int main(){
  ll i,j,cnt=0;
  int n,m;
  cin>>n>>m;
  int p[m];
  bool x[m],acflg[n];
  rep(i,n)acflg[i]=0;
  string s[m];
  rep(i,m){
      cin>>p[i]>>s[i];
      p[i]--;
      if(s[i]=="AC")x[i]=1;
      else x[i]=0;
  }
  int ac=0,pena[n];
  for(i=0;i<n;i++)pena[i]=0;
  for(i=m-1;i>=0;i--){
      if(x[i]){
          if(!acflg[p[i]]){
              ac++;
            acflg[p[i]]=1;
          }
          else{
              pena[p[i]]=0;
          }
      }
      if(!x[i] && acflg[p[i]])pena[p[i]]++;
  }
  int pe=0;
  for(i=0;i<n;i++){
      pe+=pena[i];
  }
  cout<<ac<<" "<<pe<<endl;
}


Measured memory_bytes: 6656
#include <bits/stdc++.h>
#define ld long double
#define int long long
#define fi first
#define se second
using namespace std;
const int N = 20 + 12;
const int inf = 2e9;


string s[N];
int t[N];

void run() {
    int i, j, k, n, need, cnt, ans = 0;
    t[0] = 1;
    for (int i = 1; i <= 6; ++i)
        t[i] = t[i - 1] * 2;
    cin >> n >> k >> need;
    for (i = 0;  i< n; ++i)
        cin >> s[i];
    for (i = 0; i < t[n]; ++i)
    for (j = 0; j < t[k]; ++j) {
        cnt = 0;
        for (int l = 0; l < n; ++l)
        for (int p = 0; p < k; ++p) {
            if ((i & t[l]) == 0 && (j & t[p]) == 0 && s[l][p] == '#')
                ++cnt;
        }
        if (cnt == need)
            ++ans;
    }
    cout << ans;
}

signed main() {
    #ifdef local
        freopen("input.txt", "r", stdin);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int test;
    run();
}


Measured memory_bytes: 3664
import java.text.*;
import java.util.*;

public class Main
{
    public static void main(String[] args)
    {
        new Main().doit();
    }

    private void doit()
    {
        Scanner sc = new Scanner(System.in);
        final int N = sc.nextInt();
        this.title = sc.next();
        int count = 0;
        for(int i = 0; i < N; ++i)
        {
            final String old = sc.next();
            if(this.creatable(old))
            {
                ++count;
            }
        }
        System.out.println(count);
    }

    private boolean creatable(final String old)
    {
        for(int bi = old.indexOf(title.charAt(0)); bi != -1; bi = old.indexOf(title.charAt(0), bi + 1))
        {
            for(int dif = 1; dif <= (old.length() - bi - 1) / (title.length() - 1); ++dif)
            {
                for(int ti = 1; ti < title.length(); ++ti)
                {
                    if(title.charAt(ti) != old.charAt(bi + dif * ti))
                    {
                        break;
                    }
                    else if(ti == title.length() - 1)
                    {
                        return true;
                    }
                }
            }
        }
        return false;
    }

    private String title;
}

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

int main() {
    ll A, B, T;
    cin >> A >> B >> T;
    cout << B * (T / A) << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,x,y) for(ll i=x; i<=y; i++)
#define BIT(t) ((long long 1) << t)
#define PER(i,y,x) for(ll i=y; i>=x; i--)
#define vll vector<ll>
#define vvll vector<vector<ll>>
using namespace std;
typedef long long ll;
ll const MAX = 2e5 + 5;
vll a(MAX), b(MAX);
priority_queue<pair<ll,ll>> pq;
ll nnn;
ll af(ll x){
	return x % nnn + 1;
}
ll bef(ll x){
	x--;
	if(x == 0){
		return nnn;
	}else{
		return x;
	}
}

int main(){
	ll n;
	cin >> n;
	nnn = n;
	REP(i,1,n){
		cin >> a[i];
	}
	REP(i,1,n){
		cin >> b[i];
		pq.push({b[i],i});
	}
	ll ans = 0;
	while(!pq.empty()){
		pair<ll,ll> tp = pq.top();
		pq.pop();
		ll pos = tp.second; ll val = tp.first;
		//cout << val << " " << pos << endl;
		if(val == a[pos]){
			continue;
		}
		ll ttl = b[af(pos)] + b[bef(pos)];
		ll able = val / ttl;
		if(able == 0){
			cout << -1 << endl;
			return 0;
		}else if(val - able * ttl > a[pos]){
			//cout << able << " ? " << ttl << " " << af(pos) << " " << bef(pos) << endl;
			ans += able;
			b[pos] = val - able * ttl;
			pq.push({b[pos], pos});
		}else{
			if((val - a[pos]) % ttl == 0 ){
				//cout << pos << " ! " << val << endl;
				ll tmp = (val -a[pos]) /ttl;
				b[pos] = a[pos];
				ans += tmp;
			}else{
				cout << -1 << endl;
				return 0;
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 9456
from itertools import zip_longest
s = input()
sum = 0
gap_cnt = len(s) - 1
for i in range(2**gap_cnt):
  operators = [" "] * gap_cnt
  for j in range(gap_cnt):
    if((i>>j) &1):
      operators[gap_cnt-1-j] = "+"
  formula = ""
  for p_s,p_o in zip_longest(s,operators,fillvalue=" "):
    formula += (p_s+p_o)
  #if formula.find("+") == -1:
    #sum += int(formula.replace(" ",""))
  #else:
  sum += eval(formula.replace(" ",""))
print(sum)

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
#include<map>

using namespace std;

int main()
{
	string s,t;
	cin >> s;
	cin >> t;
	
	if(t.substr(0,s.length()) == s) cout << "Yes" << endl;
	else cout << "No" << endl;
 

	return 0;

}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int,int> pii;
typedef long long ll;
const long long MOD=1000000007;
#define rep(i,n) for(long long i=0;i<(n);i++)
#define rep2(i,m,n) for(int i=m;i<n;i++)
#define ALL(v) v.begin(), v.end()
#define pb push_back



ll gcd(ll a , ll b){
    ll bigger=max(a,b);
    ll smaller=min(a,b);
    if (bigger%smaller==0){
        return smaller;
    }
    else {
        return gcd(smaller, bigger%smaller);
    }

}



ll mypower(ll x, ll n){
    ll answer=1;
    rep(i,n){
        answer*=x;
    }
    return answer;
}

    






int main(){

    ll n;
    cin>>n;

    ll keta=1;
    ll tmpsum=0;

    while (tmpsum<n){
        tmpsum+=mypower(26,keta);
        keta++;
    }

    keta--;

    ll mysum=0;

    for (ll i=1;i<=keta-1;i++){
        mysum+=mypower(26,i);
    }

    mysum=n-mysum-1;
  

    rep(i,keta){
        ll tmp=mysum/mypower(26,keta-1-i);
        cout<<(char)('a'+tmp);
        mysum-=mypower(26,keta-1-i)*tmp;
    }
  
  	cout<<endl;


    


}

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

int main() {
  int H, A;
  cin >> H >> A;

  int B = 0;
  for (int i = 0; i < 10000; i++) {
    if (H > 0) {
      H -= A;
      B++;
    }
    else break;
  }

  cout << B << endl;
}


Measured memory_bytes: 3608
def main():
    n, m, cx, cy = [int(s) for s in input().split()]
    x = [int(s) for s in input().split()]
    y = [int(s) for s in input().split()]

    mx = max(cx, *x)
    my = min(cy, *y)

    if mx < my:
        print('No War')
    else:
        print('War')

main()


Measured memory_bytes: 3060
import sys
#import cython

def main():
    read = lambda: sys.stdin.readline().rstrip()
    
    N, M, X  = map(int,read().split())
    A = [list(map(int,read().split())) for i in range(N)]

    pattern = []
    ans = []
    for i in range(2**(N)):
        tmp = [1]*N
        for j in range(N):
            if i >> j & 1:
                tmp[j] = 0
        tab = [0]*(M)
        tot = 0
        for j in range(N):
            for k in range(M):
                tab[k] += A[j][k+1]*tmp[j]
            tot += A[j][0]*tmp[j]
        if min(tab) >= X:
            ans.append(tot)
    
    print(min(ans) if ans != [] else -1)

 
if __name__ == "__main__":
    main()

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

#define NEW(p,n){p=malloc((n)*sizeof(p[0]));if(p==NULL){printf("not enough memory\n");exit(1);};}
//pの型の変数n個の要素分のメモリを確保し、そのアドレスをpに代入するマクロ

#define INFTY 999999

typedef long* vector;
typedef vector* matrix;
typedef matrix* tmatrix;

//0-c-1の添字のものを作る(初期値0)
vector create_vector(int c){
    vector v;
    NEW(v,c);
    for(int i=0;i<c;i++){
        v[i]=0;
    }
    return v;
}

//0-b-1,0-c-1の添字のものを作る
matrix create_matrix(int b, int c){
    matrix M;
    NEW(M,b);
    for(int i=0;i<b;i++){
        M[i]=create_vector(c);
    }
    return M;
}

//0-a-1,0-b-1,0-c-1の添字のものを作る
tmatrix create_tmatrix(int a, int b, int c){
    tmatrix T;
    NEW(T,a);
    for(int i=0;i<a;i++){
        T[i]=create_matrix(b,c);
    }
    return T;
}

//サイズcのベクトルのメモリ解法
void free_vector(vector v, int c){
    free(v);
    return;
}

//サイズb,cのmatrixのメモリ解法
void free_matrix(matrix M, int b, int c){
    for(int i=0;i<b;i++){
        free_vector(M[i],c);
    }
    free(M);
    return;
}

//サイズa,b,cのtmatrixのメモリ解法
void free_tmatrix(tmatrix T, int a, int b, int c){
    for(int i=0;i<a;i++){
        free_matrix(T[i],b,c);
    }
    free(T);
    return;
}


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

    vector x=create_vector(n+1);
    for(int i=1;i<=n;i++){
        scanf("%ld", &x[i]);
    }

    //T[a][b][c]=xの先頭a個の中から、b枚選んで合計cにする組み合わせ総数
    //0~a~n-1,1~b~n,0~c~na
    tmatrix T=create_tmatrix(n+1,n+1,n*50+1);
    //long T[n+1][n+1][n*a+1];
    T[0][0][0]=1;
    for(int i=1;i<=n;i++){
        for(int j=0;j<=n;j++){
            for(int k=0;k<=n*50;k++){
                if(x[i]>k){
                    T[i][j][k]=T[i-1][j][k];
                }
                else{
                    if((k-x[i])>=0&&(j-1)>=0){
                        T[i][j][k]=T[i-1][j][k]+T[i-1][j-1][k-x[i]];
                    }
                }
            }
        }
    }

    long ans=0;
    for(int i=1;i<=n;i++){
        ans+=T[n][i][i*a];
    }

    printf("%ld\n",ans);
    
    return 0;
    
}




Measured memory_bytes: 51072
#include<bits/stdc++.h>
using namespace std;
#define nn 500008
#define int long long 
int a[nn];int n;
signed main(){
	scanf("%lld",&n);for(int i=1;i<=n*3;i++) scanf("%lld",&a[i]);
	sort(a+1,a+n*3+1);reverse(a+1,a+n*3+1);
	
	int ans=0;
	for(int i=1;i<=n;i++) ans+=a[i*2];cout<<ans;
	
	return 0;
}

Measured memory_bytes: 2560
#include <stdio.h>
#include <string.h>
#define T 1000003
char Hash[T][12];

int getChar(char string){
  if(string=='A')return 1;
  else if(string=='C')return 2;
  else if(string=='G')return 3;
  else if(string=='T')return 4;
  else return 0;
}

int h1(int key){
  return key%T;
}

int h2(int key){
  return 1+key%T;
}

int generateKey(char str[]){
  int i,char_value=0,rate=1;
  for(i=0;i<strlen(str);i++){
    char_value+=rate*getChar(str[i]);
    rate*=5;
  }
  return char_value;
}

void insert(char str[],int key){
  int h_number,i=0;
  while(1){
    h_number=(h1(key)+i*h2(key))%T;
    //元からあったとき
    if(strcmp(Hash[h_number],str)==0)break;
    //添字の部分に何もなかったとき(代入コピー操作)
    if(strlen(Hash[h_number])==0){
      strcpy(Hash[h_number],str);
      break;
    }
    i++;
  }
}

int find(char str[],int key){
  int h_number,i=0;
  while(1){
    h_number=(h1(key)+i*h2(key))%T;
    if(strcmp(Hash[h_number],str)==0)return 1;//match
    else if(strlen(Hash[h_number])==0)break;
    i++;
  }
  return 0;//Not match
}

int main(void){
  int i,n,key;
  char str[12],command[6];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s%s",command,str);
    key=generateKey(str);
    if(command[0]=='i')insert(str,key);
    else{
      if(find(str,key)==1)printf("yes\n");
      else printf("no\n");
    }
  }
  return 0;
}



Measured memory_bytes: 13412
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef long double ld;
const double pi=acos(-1.0);
const ll mod=pow(10,9)+7;
const ll INF=pow(2,31)-1;
using str=string;
typedef pair<int,int> P;
typedef vector<int> vi;

ll gcd(ll a,ll b){
    ll v0=a,v1=b,v2=a%b;
    while(v2!=0){
        v0=v1;
        v1=v2;
        v2=v0%v1;
    }
    return v1;
}

ll lcm(ll a,ll b){
    return (a*b/gcd(a,b));
}

int main(){
    int n,k;
    cin >> n >> k;
    vector<int> h(n);
    rep(i,n){
        cin >> h[i];
    }
    sort(h.begin(),h.end(),greater<int>());
    ll ans=0;
    for(int a=k;a<h.size();a++){
        ans+=h[a];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
package main

import (
	"fmt"
	"strings"
)

type ll int64


func main() {

	var S string
	fmt.Scan(&S)
	ss := strings.Split(S, "") //[]stringに一文字ずつ格納

	isYes := true
	for i:=0;i<len(ss)-1 ; i++ {
		if ss[i+1] == ss[i] {
			isYes = false
		}
	}

	if isYes {
		fmt.Println("Good")
	}else {
		fmt.Println("Bad")
	}




}



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

int main() {
	
	int n, x, f;

	cin >> n;

	for (int i = 1; i <= n; i++) {

		if (i % 3 == 0) {
			cout << " " << i;
		}
		else {
			x = i;
			f = 0;
			for (int j = 1;; j++) {
				if (x % 10 == 3) {
					f = 1;
				}
				x /= 10;
				if (x == 0) {
					break;
				}
			}
			if (f == 1) {
				cout << " " << i;
			}
		}

	}

	cout << "\n";

	return 0;

}

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

int main() {

    string s, t, u;
    int a, b;
    cin >> s >> t;
    cin >> a >> b;
    cin >> u;
    if (u == s) --a;
    if (u == t) --b;

    cout << a << " " << b << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
int x,y,ans;
scanf("%d%d",&x,&y);
if( (x==4||x==6||x==9||x==11) && (y==4||y==6||y==9||y==11))printf("Yes\n");
else if( (x==1||x==3||x==5||x==7||x==8||x==10||x==12) && (y==1||y==3||y==5||y==7||y==8||y==10||y==12))printf("Yes\n");
else printf("No\n");
return 0;
}

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

int main() {
  string a, b, c;
  cin >> a >> b;
  c = a + b;
  int result = stoi(c);
  int i = 1;

  for (; i * i <= result; i++) {
      if (i * i == result) {
          cout << "Yes" << endl;
          break;
      }
  }
  if (i * i > result) {
    cout << "No" << endl;
    }
}

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

#define REP(i,n) for(long long i=0; i < (n); ++i)
#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(long long i = (m); i < (n); ++i)

using ll = long long;
#define INF 1e9


int main(){
  ll N;
  cin >> N;
  int ans = INF;
  FOR(i, 1, sqrt(N)+1){
    if(N % i == 0){
      int d = log10(N / i)+1;
      ans = min(ans, d);
    }
  }
  cout << ans << endl;
  return 0;
}


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

int main(){
  // ll a,b;
  // cin>>a>>b;
  // ll z=floor(a*b);
  // cout<<(long long int)z<<endl;
  ll n;
  cin>>n;
  ll a=1,temp;
  ll s=1000000000000000000;
  ll arr[n];
  bool flag=false;
  for (int i = 0; i < n; ++i)
  {
    cin>>arr[i];
    if(arr[i]==0){
      flag=true;
    }
  }
  for (int i = 0; i < n; ++i)
  {
    if(arr[i]>s/a){
      if(flag)
        cout<<"0"<<endl;
      else
        cout<<"-1"<<endl;
      return 0;
    }
    else{
      a*=arr[i];
    }
    // cout<<a<<endl;
  }
  cout<<a<<endl;
  
  return 0;
    
}


Measured memory_bytes: 4420
#include "bits/stdc++.h"
using namespace std;
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define RFOR(i,n1,n2) for(ll i=((ll)(n1)-1);i>=(ll)(n2);i--)
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
#define IOS cin.tie(0),ios::sync_with_stdio(false)
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
template<typename T1, typename T2> inline bool chmin(T1& a, T2 b) { if (a > b) { a = b; return 1; }return 0; }
template<typename T1, typename T2> inline bool chmax(T1& a, T2 b) { if (a < b) { a = b; return 1; }return 0; }
template<class Type>struct is_vector : std::false_type {};
template<class ValueType, class Alloc>struct is_vector<std::vector<ValueType, Alloc>> : std::true_type {};
template <typename T> inline ostream& operator << (ostream& out, const vector<T>& v) {
    if (v.empty())return out;
    constexpr bool is_vector_v = is_vector<T>::value;
    if (is_vector_v)for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? "\n" : "");
    else for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? " " : "");
    return out;
}
inline void put() {}
template<class T> inline void put(const T& first) { std::cout << first << "\n"; }
template<class T, class... N> inline void put(const T& first, const N& ... rest) { std::cout << first << " "; put(rest...); }
inline void putn() {}
template<class T, class... N> inline void putn(const T& first, const N& ... rest) { std::cout << first << "\n"; putn(rest...); }

constexpr int t = 80*160*2;
using bt = bitset<t>;
bt d[83][83] = {};

int main() {
    IOS;
    int h, w;
    cin >> h >> w;
    vector<vector<ll>> a(h, vector<ll>(w));
    vector<vector<ll>> b(h, vector<ll>(w));
    vector<vector<ll>> c(h, vector<ll>(w));
    REP(i, h) {
        REP(j, w) {
            cin >> a[i][j];
        }
    }
    REP(i, h) {
        REP(j, w) {
            cin >> b[i][j];
            c[i][j] = a[i][j] - b[i][j];
            c[i][j] = abs(c[i][j]);
        }
    }
    int dx[2] = { 0,1 };
    int dy[2] = { 1,0 };
    d[0][0][c[0][0]+t/2] = 1;
    REP(i, h) {
        REP(j, w) {
            REP(k, 2) {
                ll ny = i + dy[k];
                ll nx = j + dx[k];
                if (ny < h && nx < w) {
                    bt temp = (d[ny][nx]<<c[ny][nx])|(d[ny][nx]>>c[ny][nx]);
                    d[ny][nx] |= (d[i][j]<<c[ny][nx])|(d[i][j]>>c[ny][nx]);
                }
            }
        }
    }
    int res = INT_MAX;
    REP(i, t) {
        if (d[h - 1][w - 1][i+t/2]) {
            res = i;
            break;
        }
    }
    put(res);
    return 0;
}


Measured memory_bytes: 22016
using System;

namespace AtCoder.ABC._123
{
    class a
    {
        static void Main(string[] args)
        {
            int[] antenna = new int[5];
            var line = "";
            for (var i = 0; i < 5; i++)
            {
                line = Console.ReadLine().Trim();
                antenna[i] = int.Parse(line);
            }
            line = Console.ReadLine().Trim();
            var k = int.Parse(line);
            for(var i = 0; i < 5; ++i)
            {
                for(var j = i + 1; j < 5; ++j)
                {
                    if (antenna[j] - antenna[i] > k)
                    {
                        Console.WriteLine(":(");
                        return;
                    }
                }
            }
            Console.WriteLine("Yay!");
        }
    }
}


Measured memory_bytes: 11092
n,k = map(int,input().split())
s = input()
l = list(s)
s_list = []
count = 1
if n >=2:
  for i in range(1,n):
    if s[i] != s[i-1]:
      s_list.append(count)
      count = 1
    else:
      count += 1
    if i == n-1:
      s_list.append(count)
  sum_s = [0,s_list[0]]
  for i in range(1,len(s_list)):
    sum_s.append(sum_s[-1] + s_list[i])
  if s[0] == "1":
    result = []
    for i in range(1,len(sum_s)):
      if i % 2 == 1:
        result.append(sum_s[min(len(sum_s)-1,i+2*k)] - sum_s[i-1])
      else:
        result.append(sum_s[min(len(sum_s)-1,i+2*k-1)] - sum_s[i-1])

  else:
    result = []
    for i in range(1,len(sum_s)):
      if i % 2 == 1:
        result.append(sum_s[min(len(sum_s)-1,i+2*k-1)] - sum_s[i-1])
      else:
        result.append(sum_s[min(len(sum_s)-1,i+2*k)] - sum_s[i-1])

if n == 1:
  print(1)
else:
  print(max(result))  
    

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

int main(int argc, char const *argv[]) {
    int n;
    int cnt=0;
    int eqCnt=0;
    bool flg=false;
    vector<long long> a;
    long long maximam=0;
    cin >> n;
    for (int i = 0; i < n; i++) {
        long long tmp;
        cin >> tmp;
        a.push_back(tmp);
    }
    for (int i = 0; i < n; i++) {
        if (a.at(i) != maximam) {
            if (a.at(i) % 2 == 1) {
                cout << "first" << endl;
                return 0;
            }
        }
    }
    cout << "second" << endl;

    return 0;
}


Measured memory_bytes: 1400
N=int(input())
L=list(map(int, input().split()))

count = 0
for i in range(N):
    for j in range(i+1, N):
        for k in range(j+1, N):
            temp = sorted([L[i], L[j], L[k]])
            if temp[0]==temp[1] or temp[1]==temp[2]:
                continue
            if (temp[0]+temp[1])>temp[2] and (temp[1]+temp[2])>temp[0] and (temp[2]+temp[0])>temp[1]:
                count += 1
print(count)


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

template <typename T> T load() { T r; cin >> r; return r; }
template <typename T> vector<T> loadMany(int n) { vector<T> rs(n); generate(rs.begin(), rs.end(), &load<T>); return rs; }

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	auto n = load<int>();
	auto b = loadMany<int>(n-1);
	auto a = vector<int>(n, numeric_limits<int>::max());
	for (auto i=0; i+1<n; ++i) {
		a[i] = min(a[i], b[i]);
		a[i+1] = min(a[i+1], b[i]);
	}
	cout << accumulate(a.begin(), a.end(), 0) << '\n';
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] times = new int[n + 1];
		int[] velocities = new int[n + 2];
		for (int i = 1; i <= n; i++) {
		    times[i] = sc.nextInt();
		}
		for (int i = 1; i <= n; i++) {
		    velocities[i] = sc.nextInt();
		}
		for (int i = n; i >= 1; i--) {
		    velocities[i] = Math.min(velocities[i], velocities[i + 1] + times[i]);
		}
		for (int i = 1; i <= n; i++) {
		    velocities[i] = Math.min(velocities[i], velocities[i - 1] + times[i]);
		}
		double total = 0;
		for (int i = 1; i <= n; i++) {
		    if (velocities[i - 1] < velocities[i]) {
		        if (velocities[i + 1] < velocities[i]) {
		            total += bothCalc(times[i], velocities[i - 1], velocities[i], velocities[i + 1]);
		        } else {
		            total += leftCalc(times[i], velocities[i - 1], velocities[i]);
		        }
		    } else {
		        if (velocities[i + 1] < velocities[i]) {
		            total += rightCalc(times[i], velocities[i], velocities[i + 1]);
		        } else {
		            total += velocities[i] * times[i];
		        }
		    }
		}
		System.out.println(total);
    }
    
    static double leftCalc(double time, double min, double max) {
        return (2 * time - (max - min)) / 2 * (max - min) + min * time;
    }

    static double rightCalc(double time, double max, double min) {
        return leftCalc(time, min, max);
    }
    
    static double bothCalc(double time, double left, double max, double right) {
        if (left > right) {
            return bothCalc(time, right, max, left);
        }
        if (max - left + max - right <= time) {
            return leftCalc(max - left, left, max) + rightCalc(time - (max - left), max, right);
        }
        return leftCalc(right - left, left, right) + Math.pow(time - (right - left), 2) / 4 + right * (time - (right - left));
    }
    
    
}



Measured memory_bytes: 23764
#include <iostream>
#include <algorithm>
#include <map>

using namespace std;

int n,a[100100];
map<int,bool> pos;
int main()
{
	cin >> n;
	for(int i=1;i<=n;i++) 
	{
		cin >> a[i];
		if(i%2==0) pos[a[i]] = false;
		else pos[a[i]] = true;
	}
	sort(a+1,a+n+1);
	int ans=0;
	for(int i=1;i<=n;i++)
	{
		bool stat = false;
		if(i%2==1) stat = true;
		if(pos[a[i]]!=stat) ans++;
	}
	cout << ans/2 << endl;
	return 0;
}

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

using namespace std;

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)

using ll = long long;
using P = std::tuple<int,int>;

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


namespace tottori{
    // until C++17
    template <typename T, size_t N>
    constexpr size_t size(const T (&array)[N]){
        return N;
    }
};

template <typename T>
T expt(T a, T n, T mod = std::numeric_limits<T>::max()){
    T res = 1;
    while(n){
        if(n & 1){res = res * a % mod;}
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

template <typename T>
T inverse(T n, T mod){
    return expt(n, mod-2, mod);
}

ll fact[200200], inv[200200];

// nPr
template <typename T>
T nPr(T n, T r, T mod = std::numeric_limits<T>::max()){
    if(n < r){return 0;}
    return fact[n] * inv[r] % mod;
}

// nCk
template <typename T>
T nCk(T n, T k, T mod = std::numeric_limits<T>::max()){
    if(n < 0 || k < 0){return 0;}
    if(n < k){return 0;}
    return fact[n] * inv[k] % mod * inv[n-k] % mod;
}

template <typename T>
T nHk(T n, T k, T mod = std::numeric_limits<T>::max()){
    if(n == 0 && k == 0){return 1;}
    return nCk(n+k-1, k);
}

void initFactAndInv(ll mod){
    fact[0] = 1;
    inv[0] = 1;

    for(int i=1;i<tottori::size(fact);i++){
        fact[i] = fact[i-1] * i % mod;
        inv[i] = inverse(fact[i], mod);
    }
}

const ll MOD = 1e9 + 7;
int buckets[100100];

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

    initFactAndInv(MOD);

    ll N;
    std::cin >> N;

    int x1, x2;
    for(int i=1;i<=N+1;++i){
        int a;
        std::cin >> a;

        if(buckets[a] > 0){
            x1 = buckets[a];
            x2 = i;
        }
        buckets[a] = i;
    }

    ll B = x2 - (x1 + 1);
    
    for(ll i=1;i<=N+1;++i){
        // std::cout << "0: " << nCk(N - 1, i, MOD) << std::endl;
        // std::cout << "1: " << (nCk(N - 1, i - 1, MOD) * 2) << std::endl;
        // std::cout << "2: " << (-nCk(N - 1 - B, i - 1, MOD)) << std::endl;
        // std::cout << "3: " << nCk(N - 1, i - 2, MOD) << std::endl;        
        
        ll res;
        res = nCk(N - 1, i, MOD);
        res = (res + nCk(N - 1, i - 1, MOD) * 2 % MOD) % MOD;
        res = (res - nCk(N - 1 - B, i - 1, MOD)) % MOD;
        res = (res + MOD) % MOD;
        res = (res + nCk(N - 1, i - 2, MOD)) % MOD;
        std::cout << res << std::endl;
    }
}


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

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

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

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

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

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

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

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

fn main() {
    input! {
        e1: usize,
        e2: usize,
        e3: usize,
    }

    if e1 * e2 * e3 == 175 {
        println!("YES");
    } else {
        println!("NO");
    }
}

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


int main(){
  vector<int> A(4,0);
  int a,b;
  cin>>a>>b;
  A[a]=1;A[b]=1;
  for(int i=1;i<=3;i++){
    if(A[i]==0) cout<<i<<endl;
  }
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#define MAX 100000

struct NODE {
	int parent;
	int childL;
	int siblingR;
};

struct NODE Tree[MAX];

int Dep(int id) {
	int cnt = 0;
	for (int i = id; Tree[i].parent != -1; i = Tree[i].parent) {
		cnt++;
	}
	return cnt;
}


int main() {
	int N;
	int id, deg;
	int child, childR;
	char type[30];
	for (int i = 0; i < MAX; i++) {
		Tree[i].parent = -1; Tree[i].childL = -1; Tree[i].siblingR = -1;
	}
	scanf("%d", &N);
	for (int i = 0; i < N; i++) {
		scanf("%d %d", &id, &deg);
		for (int j = 0; j < deg; j++) {
			if (j == 0) {
				scanf("%d", &child);
				Tree[id].childL = child;
				Tree[child].parent = id;
			}
			else {
				scanf("%d", &childR);
				Tree[child].siblingR = childR;
				Tree[childR].parent = id;
				child = childR;
			}
		}
	}
	for (int i = 0; i < N; i++) {
		if (Tree[i].parent == -1)strcpy(type, "root");
		else if (Tree[i].childL == -1)strcpy(type, "leaf");
		else strcpy(type, "internal node");
		printf("node %d: parent = %d, depth = %d, %s, [", i, Tree[i].parent, Dep(i), type);
		for (int j = Tree[i].childL; j != -1; j = Tree[j].siblingR) {
			printf("%d", j);
			if (Tree[j].siblingR != -1)printf(", ");
		}
		printf("]\n");
	}

	return 0;
}



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

int main()
{

	int 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 };

	int s;
	cin >> s;

	cout << a[s - 1] << endl;

	cin.get();
    cin.get();
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(vec) vec.begin(),vec.end()
using namespace std;
using ll=int_fast64_t;
using P=pair<ll,ll>;
const ll INF=1LL<<30;
const ll LINF=1LL<<61;
const double EPS=1e-9;
const int MOD=1e9+7;
int main(){
    int n;cin>>n;
    vector<ll> a(n);
    map<ll,ll> mp;
    for(int i=0;i<n;i++){
        cin>>a[i];
        mp[a[i]]++;
    }
    ll ans=0;
    sort(all(a));
    reverse(all(a));
    for(int i=0;i<n;i++){
        if(mp[a[i]]==0)continue;
        for(ll j=0LL;j<=60LL;j++){
            ll s=(1LL<<j)-a[i];
            if(s<0LL)continue;
            if(mp.count(s)){
                if(mp[s]>0){
                    if(mp[s]==1&&s==a[i])continue;
                    ans++;
                    mp[s]--;
                    break;
                }
            }
        }
        mp[a[i]]--;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 14336
n, k, c = map(int, input().split())
s = input()
s2 = s
s += "x"*c
s2 = "x"*c+s2
k2 = k
kans = k
left = []
i = 0
while i < n:
  if s[i] == "o":
    left.append(i+1)
    i += c
  i += 1

right = []
i = len(s2)-1
while i >= c:
  if k2 == 0:
    break
  if s2[i] == "o":
    right.append(i+1-c)
    k2 -= 1
    i -= c
  i -= 1
if len(left) == kans:
  ans = sorted(list(set(left) & set(right)))
  for i in ans:
    print(i)
else:
  exit()

Measured memory_bytes: 105580
#include <stdio.h>
 
const char* dates[7] = { "sat", "sun", "mon", "tue", "wed", "thu", "fri" };
 
int main(void) {
  int date;
  scanf("%d", &date);
  printf("%s\n", dates[(((date - 9) % 7) + 7) % 7]);
  return 0;
}


Measured memory_bytes: 2688
A, B, C, X, Y = map(int, input().split())
price = 0
min_num = min([X,Y])
if A/2 + B/2 > C:
    X -= min_num
    Y -= min_num
    if X == 0:
        print(min([min_num *2* C + B * Y, (Y+min_num)*2*C]))
    else:
        print(min([min_num *2* C + A * X, (X+min_num)*2*C]))
else:
    print(A*X+ B*Y)

Measured memory_bytes: 3064
b0=input().split()
towns=int(b0[0])
k=int(b0[1])
 
al=[int(i)-1 for i in input().split()]
 
rt=[-1 for x in range(towns)]
rt[0]=0
now=0
for x in range(1,300000000):
  now=al[now]
  if rt[now]!=-1:
    stp=x
    break
  else:
    rt[now]=x

ll=stp-rt[now]
k2=k-rt[now]
 
if k<rt[now]:
  print(rt.index(k)+1)
else:
  print(rt.index(k2%ll+rt[now])+1)

Measured memory_bytes: 32192
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(int (i)=(n);(i)>=0;(i)--)
#define INF (1ll<<60)
typedef long long lint;
const lint MOD =1000000007;

int main(){
string s;
lint a=0,b=0,c,K,count=0,count1=0;
  cin >>s>>K;
  if(s[0]!=s[s.size()-1]){
    rep(i,s.size()-1){
     if(s[i]==s[i+1])count1++;
     else {count+=(count1+1)/2;
      count1=0;
     }
    }
    count+=(count1+1)/2;
     cout<<K*count;
     return 0;
  }else {
    rep(i,s.size()-1){
        if(s[i]==s[i+1])a++;
        else break;
    }
      repm(i,s.size()-1){
        if(s[i]==s[i-1])b++;
        else break;
    }
    if(a==(s.size()-1)){
        c=(s.size()*K)/2;
        cout<<c;
        return 0;
    }else {
        repp(i,a+1,s.size()-b){
             if(s[i]==s[i+1])count1++;
     else {count+=(count1+1)/2;
      count1=0;
        }
        }
      c=(a+b+2)/2;
      c*=(K-1);
      c+=(b+1)/2+count*K+(a+1)/2;
      if(s.size()==1){
          c=K/2;
          }
      cout <<c;
      return 0;
  }
}
}
 



  


Measured memory_bytes: 256