akhauriyash/Code-Regression huggingface dataset:
N, X = map(int, input().split()) 
a, p = [1], [1]
for i in range(N):
    a.append(a[i] * 2 + 3)
    p.append(p[i] * 2 + 1)

def f(N, X):
    if N == 0:
        return 0 if X <= 0 else 1
    elif X <= 1 + a[N-1]:
        return f(N-1, X-1)
    else:
        return p[N-1] + 1 + f(N-1, X-2-a[N-1])
print(f(N, X))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define SZ(v) int((v).size())
#define ALL(vec) begin(vec), end(vec)
typedef long long i64;
template<typename T> inline bool uax(T &x, T y) {return (y > x) ? x = y, true : false;}
template<typename T> inline bool uin(T &x, T y) {return (y < x) ? x = y, true : false;}
#ifdef Rahul
# define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); \
  stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#else
# define error(...) 42;
#endif
string to_string(char c) { return "'" + string(1, c) + "'";}
string to_string(string s) { return '"' + s + '"';}
string to_string(const char* s) { return to_string((string) s);}
template<typename A> string to_string(A);
template<typename A, typename B> string to_string(pair<A, B> p){
  return "(" + to_string(p.first) + ": " + to_string(p.second) + ")";}
template<typename A> string to_string(A v) {bool f = false; string r = "{"; 
  for (auto x: v) {if (f) r += ", "; r += to_string(x); f = true;} return r += "}";}
template<typename A> string to_string(vector<vector<A>> v) {string r; 
  for (auto x: v) r += "\n" + to_string(x); return r;}
int Nerr;
template<typename A> string to_string(A *p) {return to_string(vector<A>(p, p + Nerr));}
void err(istream_iterator<string>) { cerr << endl; }
template<typename T,typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " =: " << to_string(a) << "; "; err(++it, args...); }
template<typename T> void kek(T ans) {cout << ans << endl; exit(0);}
#define Lu(...) [&] (auto &&u) { return __VA_ARGS__; }
#define Luv(...) [&] (auto &&u, auto &&v) { return __VA_ARGS__; }
int const MOD = 1e9 + 7;
i64 const INF = 1e18 + 42;
/***********************************************************************/
int32_t main() {
  cin.tie(nullptr) -> sync_with_stdio(false);
  
  int k; cin >> k;
  string s; cin >> s;
  if (SZ(s) > k) {
    s.resize(k);
    s += "...";
  }
  kek(s);
}


Measured memory_bytes: 3652
#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <cmath>

using namespace std;

int main()
{
    int a,b,c;
    while (~scanf("%d%d%d",&a,&b,&c)){
        int cnt5=0;
        int cnt7=0;
        if (a==5) cnt5++;
        if (a==7) cnt7++;
        if (b==5) cnt5++;
        if (b==7) cnt7++;
        if (c==5) cnt5++;
        if (c==7) cnt7++;
        if (cnt5==2&&cnt7==1)
            printf("YES\n");
        else
            printf("NO\n");
    }
    return 0;
}


Measured memory_bytes: 256
# URL : https://atcoder.jp/contests/abc178/tasks/abc178_b

def Yes(f): print('Yes' if f else 'No')
def YES(f): print('YES' if f else 'NO')
def ispow(x): return int(x ** 0.5) ** 2 == x


res = -float('inf')
# n = int(input())
# a, b = map(int, input().split())
# a, b, c = map(int, input().split())
a, b, c, d = map(int, input().split())

for i in (a, b):
    for j in (c, d):
        res = max(res, i * j)
print(res)


Measured memory_bytes: 61752
using LIB;
using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {
        int c = 1;
        while (true)
        {
            int n = io.r<int>();
            if (n == 0) { break; }
            io.w("Case " + c.ToString() + ": " + n.ToString());
            c++;
        }
        io.wflush();
    }
}

namespace LIB
{
    public class io
    {
        private const int WMAX = 1000;
        private static StringBuilder S = new StringBuilder();
        public static T r<T>() { return util.parse<T>(r()); }
        public static T[] r<T>(char s = ' ') { return r().Split(s).Select(util.parse<T>).ToArray(); }
        public static T[] r<T>(int l) { T[] r = new T[l]; for (int i = 0; i < l; i++) { r[i] = r<T>(); } return r; }
        public static T[][] r<T>(int l, char s = ' ') { T[][] r = new T[l][]; for (int i = 0; i < l; i++) { r[i] = r<T>(s); } return r; }
        private static string r() { return Console.ReadLine(); }
        public static void w(object v, bool lf = true) { S.Append(util.parse<string>(v)); if (lf == true) { S.Append('\n'); } if (S.Length >= WMAX) { wflush(); } }
        public static void wflush() { Console.Write(S.ToString()); S.Length = 0; }
    }
    public class util
    {
        public static T parse<T>(object value) { return (T)(Convert.ChangeType(value, typeof(T))); }
    }
    public class memo<Key, Result>
    {
        private Dictionary<Key, Result> R;
        public memo() { R = new Dictionary<Key, Result>(); }
        public Result exec(Key k, Func<Key, Result> f) { Result r; if (R.ContainsKey(k)) { r = R[k]; } else { r = f(k); R.Add(k, r); } return r; }
    }
}

Measured memory_bytes: 9976
#include <bits/stdc++.h>
#define ll long long
#define lsb(x) (x & -x)

using namespace std;

const int MOD = 1000000007;

int main() {
    ios::sync_with_stdio(false);

    cin.tie(0);
    cout.tie(0);
    //freopen("a.in", "r", stdin);

    int n;
    cin >> n;
    vector<vector<int>> a(n + 1, vector<int> (n + 1, 0));
    for(int i = 1; i <= n; i ++)
        for(int j = 1; j <= n; j ++)
            cin >> a[i][j];

    vector<int> dp((1 << n), 0);
    dp[0] = 1;
    for(int mask = 0; mask + 1 < (1 << n); mask ++) {
        int nbits = 0;
        for(int i = 0; i < n; i ++)
            if(mask & (1 << i))
                nbits ++;

        for(int i = 1; i <= n; i ++) {
            if(mask & (1 << (i - 1)))
                continue;
            if(!a[nbits + 1][i])
                continue;

            dp[mask ^ (1 << (i - 1))] += dp[mask];
            if(dp[mask ^ (1 << (i - 1))] >= MOD)
                dp[mask ^ (1 << (i - 1))] -= MOD;
        }
    }

    cout << dp[(1 << n) - 1];

    return 0;
}


Measured memory_bytes: 8448
import Data.List
import qualified Data.ByteString.Char8 as B

main = do
    n<-readLn::IO Int
    as<-sort.unfoldr (B.readInt.B.dropWhile(==' '))<$>B.getLine::IO[Int]
    --
    putStrLn.unwords.map show $ solve n as

solve _ [a,b] = [b,a]
solve n as =
    if abs (half - fromIntegral a1) < abs (half - fromIntegral a2)
        then [al, a1]
        else [al, a2]
    where
        (ai, al:_) = splitAt (n-1) as
        half = fromIntegral al / 2.0
        (ale', a1:_) = partition (\a-> fromIntegral a <= half) ai
        a2 = last ale'


Measured memory_bytes: 17788
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <set>
#include <queue>

#define FOR(idx, begin, end) for(int idx = (int)(begin); idx < (int)(end); ++idx)

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

using namespace std;
typedef long long lint;

const int MOD = 1000000007, INF = 1111111111;
const double EPS = 1e-9;


int main() {

	cin.tie(0);
	
	vector<int> alphabet(26);

	string w;
	cin >> w;
	
	FOR(i, 0, w.length()) {
		
		if ('a' <= w[i] && w[i] <= 'z') {
			alphabet[w[i]-'a']++;
		}
	}

	FOR(i, 0, 26) {
		DMP(alphabet[i]);
		if (alphabet[i] % 2 == 1) {
			cout << "No";
			return 0;
		}
	}

	cout << "Yes";

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>
#include<limits.h>

using namespace std;
typedef long long ll;
typedef pair<int,int> PI;
typedef pair<int,pair<int,int>> PII;
static const int IINF=INT32_MAX;
static const ll LINF=INT64_MAX;
static const ll mod=1e9+7;
static const int dx[4]={1,-1,0,0};
static const int dy[4]={0,0,1,-1};

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

int N,T;
vector<PI> V;

int dp[3005][6005];
int ans;

int main(){
    cin>>N>>T;
    for(int i=0;i<N;++i){
        int a,b;
        cin>>a>>b;
        V.push_back(PI(a,b));
    }
    sort(V.begin(),V.end());
    for(int i=0;i<N;++i){
        PI v=V[i];
        for(int j=0;j<T;++j){
            chmax(dp[i+1][j],dp[i][j]);
            chmax(dp[i+1][j+v.first],dp[i][j]+v.second);
            chmax(ans,dp[i+1][j]);
            chmax(ans,dp[i+1][j+v.first]);
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 69760
package main

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

var sc = bufio.NewScanner(os.Stdin)

const inf = 1 << 60
const mod int = 1e9 + 7

func ri() (n int) {
	sc.Scan()
	for _, v := range sc.Bytes() {
		n = n*10 + int(v-48)
	}
	return
}

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func main() {
	sc.Split(bufio.ScanWords)
	n := ri()

	w := make([]int, n)
	for i := 0; i < n; i++ {
		w[i] = ri()
	}

	ans := inf
	for i := 0; i < n; i++ {
		l, r := 0, 0
		for j := 0; j < i; j++ {
			l += w[j]
		}
		for j := i; j < n; j++ {
			r += w[j]
		}
		if diff := abs(l - r); diff < ans {
			ans = diff
		}
	}
	fmt.Println(ans)
}


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

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()

int main() {
    int N, A;
    cin >> N;
    bool even = true;
    REP(i, N) {
        cin >> A;
        even &= A % 2 == 0;
    }
    if (even) cout << "second" << endl;
    else      cout << "first"  << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<vector>
#include<deque>

#define MN 100009

using namespace std;

typedef struct TOWN{
  int x, y, i;
}Town;

typedef struct COST{
  int p[2];
  int c;
}Cost;

int N;
long x[MN], y[MN];
vector<Cost> cost;
vector<Town> town;
vector<int> number[MN];
int iv[MN];
long total = 0;

bool comp(const Cost &l, const Cost &r){
  return l.c < r.c;
}

bool compX(const Town &l, const Town &r){
  return l.x==r.x ? l.i < r.i : l.x < r.x;
}

bool compY(const Town &l, const Town &r){
  return l.y==r.y ? l.i < r.i : l.y < r.y;
}

void printTown(){
  cout << "print town" << endl;
  for( int i = 0; i < N; i++ ){
	cout << town[i].x << "," << town[i].y << ":" << town[i].i << endl;
  }
}

void print(){
  int N2 = (N-1)*2;
  cout << "print cost" << endl;
  for( int i = 0; i < N2; i++ ){
	cout << cost[i].p[0] << "," << cost[i].p[1] << ":" << cost[i].c << endl;
  }
}

int main(){
  cin >> N;
  int N2 = (N-1)*2;
  cost.resize(N2);
  town.resize(N);
  for( int i = 0; i < N; i++ ){
	cin >> town[i].x >> town[i].y;
	town[i].i = i;
	iv[i] = i;
	number[i].push_back(i);
  }
  //printTown();
  sort(town.begin(), town.end(), compX);
  for( int i = 0; i < N-1; i++ ){
	cost[i].p[0] = town[i].i;
	cost[i].p[1] = town[i+1].i;
	cost[i].c = town[i+1].x-town[i].x;
  }
  //printTown();
  sort(town.begin(), town.end(), compY);
  //printTown();
  for( int i = 0; i < N-1; i++ ){
	cost[i+N-1].p[0] = town[i].i;
	cost[i+N-1].p[1] = town[i+1].i;
	cost[i+N-1].c = town[i+1].y-town[i].y;
  }
  //print();
  sort(cost.begin(), cost.end(), comp);
  //print();
  int k = 1;
  int p0, p1, vn, vn2;
  for( int i = 0; i < N2; i++ ){
	p0 = cost[i].p[0];
	p1 = cost[i].p[1];
	//cout << p0 << "," << p1 << ":" << cost[i].c << endl;
	vn = iv[p0]>iv[p1] ? iv[p0] : iv[p1];
	vn2 = iv[p0]<=iv[p1] ? iv[p0] : iv[p1];
	if( iv[p0] == iv[p1] ){ continue; }
	int l = number[vn2].size();
	for( int j = 0; j < l; j++ ){
	  int tmp = number[vn2].at(j);
	  iv[tmp] = vn;
	  number[vn].push_back(tmp);
	}
	number[vn2].clear();
	number[vn2].shrink_to_fit();
	k++;
	total += cost[i].c;
	if( k >= N ){ break; }
  }
  cout << total << endl;
  return 0;
}

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

typedef long long int ll;

vector<string> ans;
vector<ll> a, m;

void dfs(ll n,ll q,ll d = 0,ll t = 0)
{
    if(d == n){
        for(ll i = 0;i < q;i++){
            if(t == m[i]){
                ans[i] = "yes";
            }
        }
        return;
    }
    d++;
    dfs(n, q, d, t);
    t += a[d - 1];
    dfs(n, q, d, t);

    return;
}

int main()
{
    ll n, q;
    cin >> n;
    a.resize(n);
    for(ll i = 0;i < n;i++){
        cin >> a[i];
    }
    cin >> q;
    m.resize(q);
    ans.resize(q);
    for(ll i = 0;i < q;i++){
        cin >> m[i];
        ans[i] = "no";
    }

    dfs(n, q);

    for(ll i = 0;i < q;i++){
        cout << ans[i] << endl;
    }
    
    return 0;
}



Measured memory_bytes: 3184
import Control.Monad

main = do
    (h:w:_) <- (fmap read . words) <$> getLine
    input <- replicateM h getLine
    let matrix = replicate (w+2) '.':(map (\xs->'.':(xs++".")) input)++[replicate (w+2) '.']
    let answer = and [ check matrix i j | i<-[1..h], j<-[1..w] ]
    if (answer)
        then putStrLn "Yes"
        else putStrLn "No"

check :: [String] -> Int -> Int -> Bool
check str i j
    | (str!!i)!!j == '.' = True
    | otherwise = or [(str!!i')!!j' == '#' | (i',j')<-[(i-1,j),(i+1,j),(i,j-1),(i,j+1)]]

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

int main(){
    int H, W;
    vector<pair<int, int> > d;
    while (true)
    {
        cin >> H >> W;
        if(H==0 && W==0) break;
        else d.push_back(make_pair(H, W));
    }

    for (int i = 0; i < d.size(); i++)
    {
        for (int j = 0; j < d.at(i).first; j++)
        {
            for (int k = 0; k < d.at(i).second; k++)
            {
                if((j+k) % 2 == 0) cout << "#";
                else cout << ".";
            }
            cout << endl;
        }
        cout << endl;
    }
    
    
}


Measured memory_bytes: 3100
#include <queue>
#include <string>
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
#include  <vector>
#define clr(a, b) memset(a, b, sizeof(a))
#define inf 0x3f3f3f3f

using namespace std;

typedef long long ll;
const int maxn = 200005;

int n, m;
ll k;

ll s1[maxn], s2[maxn];

int find(ll x) {
    int l = -1, r = m + 1;
    while (l < r - 1) {
        int mid = (l + r) >>1 ;
        if (x + s2[mid] <= k)
            l = mid;
        else
            r = mid;
    }
    return l;
}

int main() {
    // freopen("test.in", "r", stdin);
    // freopen("test.out", "w", stdout);
    cin >> n >> m >> k;
    int t;
    for (int i = 1; i <= n; i++)
        cin >> t, s1[i] = s1[i - 1] + t;
    for (int j = 1; j <= m; j++)
        cin >> t, s2[j] = s2[j - 1] + t;
    int res = 0, maxm = 0;
    for (int i = 0; i <= n; i++) {
        if (s1[i] > k) break;
        maxm = i;
        int pos = find(s1[i]);
        maxm += pos;
        res = max(maxm, res);
    }
    cout << res;
}

Measured memory_bytes: 6752
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, N) for (int i = 0; i < (int)N; ++i)
#define all(a) (a).begin(), (a).end()

int H, W, N;
vector<vector<int>> ans;

struct elem {
  int n, v;
  elem(int n, int v) : n(n), v(v){};
};
vector<elem> b;

int main() {
  cin >> H >> W >> N;
  ans.resize(H, vector<int>(W, 0));
  rep(i, N) {
    int a;
    cin >> a;
    b.emplace_back(a, i + 1);
  }

  int k = 0;
  rep(i, H) rep(j, W) {
    int y = i;
    int x = (i % 2 == 0 ? j : W - 1 - j);
    if (b[k].n == 0) k++;
    ans[y][x] = b[k].v;
    b[k].n--;
  }

  rep(i, H) {
    rep(j, W) {
      if (j != 0) cout << " ";
      cout << ans[i][j];
    }
    cout << endl;
  }

  return 0;
}


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

typedef long long ll;
typedef pair<ll,ll> pi;
typedef vector <ll> vi;
typedef vector <pi> vpi;
#define f first
#define s second
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
#define aFOR(i,x) for (auto i: x)
#define mem(x,i) memset(x,i,sizeof x)
#define fast ios_base::sync_with_stdio(false),cin.tie(0)
#define INF (ll)1e12
#define maxn 301

ll dist[maxn][maxn];
ll N,M,L;

ll dist2[maxn][maxn];

int main(){
	fast;
	
	cin>>N>>M>>L;
	
	FOR(i,1,N){
		FOR(j,1,N){
			dist[i][j] = dist2[i][j] = INF;
		}
	}
	FOR(i,0,M-1){
		ll a,b,c;
		cin>>a>>b>>c;
		dist[a][b] = dist[b][a] = min(dist[a][b],c);
	}
	
	FOR(k,1,N){
		FOR(i,1,N){
			FOR(j,1,N){
				if (i == j) dist[i][j] = 0;
				else dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
			}
		}
	}
	
	FOR(i,1,N){
		FOR(j,1,N){
			if (dist[i][j] <= L) dist2[i][j] = dist2[j][i] = 1;
		}
	}
	
	FOR(k,1,N){
		FOR(i,1,N){
			FOR(j,1,N){
				if (i == j) dist2[i][j] = 0;
				else dist2[i][j] = min(dist2[i][j], dist2[i][k] + dist2[k][j]);
			}
		}
	}
	
	int Q;
	cin>>Q;
	FOR(i,0,Q-1){
		int a,b;
		cin>>a>>b;
		if (dist2[a][b] == INF) cout<<-1<<'\n';
		else cout<<dist2[a][b] - 1<<'\n';
	}
	
}



Measured memory_bytes: 1920
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<vector>
#include<queue>
#include<stack>
#include<cmath>
using namespace std;
struct node{
	int start;
	int end;
}a[100005];
int cmp(node x,node y){
	if(x.end==y.end)return x.start<y.start;
	return x.end<y.end;
}
int cmp1(node x,node y){
	if(x.start==y.start)return x.end<y.end;
	else return x.start<y.start;
}
int n,m,ans=0,vis[100005],t[100005],l[100005],r[100005],x[100005];
int f[400005];
int lowbit(int x){
	return x&(-x);
}
void update(int x,int y){
	for(int i=x;i<=m*4;i+=lowbit(i)){
	    f[i]=max(f[i],y);
    }
} 
int ask(int y){
	int ans=0,ans1=0;
	for(int i=y;i>=1;i-=lowbit(i))ans=max(ans,f[i]);
	return ans;
}
int main(){
    scanf("%d%d",&m,&n);
    for(int i=1;i<=n;i++){
    	scanf("%d%d",&a[i].start,&a[i].end);
    	a[i].end--;
	}
	sort(a+1,a+n+1,cmp1);
	for(int i=1;i<=n;i++){
		if(a[i].start!=1)x[i]=ask(a[i].start-1)+1;
		x[i]=max(x[i],1);
		update(a[i].end,x[i]);
	}
	printf("%d\n",x[n]);
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
    return 0;
}


Measured memory_bytes: 3328
//#pragma GCC optimize "trapv"
#include<bits/stdc++.h>
#define ll long long int
#define fab(a,b,i) for(int i=a;i<b;i++)
#define pb push_back
#define db double
#define mp make_pair
#define endl "\n"
#define f first
#define se second
#define all(x) x.begin(),x.end()
#define MOD 1000000007
#define quick ios_base::sync_with_stdio(false);cin.tie(NULL)
using namespace std;
int h,w;
ll dp[1005][1005];
int main()
{ quick;

    cin>>h>>w;
    vector<string> v(h);
    fab(0,h,i)
    cin>>v[i];
    fab(0,w,i)
    {
        if(v[0][i]=='#')
            break;
        dp[0][i]=1;
    }
    fab(0,h,i)
    {
        if(v[i][0]=='#')
            break;
        dp[i][0]=1;
    }
    fab(1,h,i)
    {
        fab(1,w,j)
        {
            if(v[i][j]=='#')
                continue;
            dp[i][j]=dp[i-1][j]+dp[i][j-1];
            dp[i][j]%=MOD;

        }
    }
    cout<<dp[h-1][w-1]<<endl;

 cerr << "time taken : " << (float)clock() / CLOCKS_PER_SEC << " secs" << endl;
    return 0;
}

Measured memory_bytes: 12672
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <utility>
#include <cmath>
#include <iomanip>

using namespace std;
typedef long long ll;
typedef pair<int, int> ii;

const ll MOD = 1e9+7;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP2(i,s,e) for(int i=(int)(s);i<(int)(e);++i)
#define RREP(i,s,e) for(int i=(int)(s);i>=(int)(e);--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin(),ie=(c).end();i!=ie;++i)
#define ALL(c) (c).begin(), (c).end()

std::vector<std::vector<long long>> comb(long long n, long long r) {
    std::vector<std::vector<long long>> v(n+1, std::vector<long long>(n+1, 0));
    for (int i = 0; i < n+1; i++) {
        v[i][0] = 1;
        v[i][i] = 1;
    }
    for (int i = 1; i < n+1; i++) {
        for (int j = 1; j < i; j++) {
            v[i][j] = (v[i-1][j-1] + v[i-1][j]) % MOD;
        }
    }
    return v;
}


int main() {
    int n, b;
    cin >> n >> b;
    int r = n - b;

    vector<vector<ll>> v = comb(2001, 2001);

    REP2(i, 1, b+1) {
        cout << (v[r+1][i] * v[b-1][i-1]) % MOD << endl;
    }

    return 0;
}


Measured memory_bytes: 31744
n = int(input())
A = list(map(int,input().split()))
ans = 0
cnt = 0
for j in range(31):
  cnt = 0
  for i in range(n):  
    if A[i]%2:
      break
    else:
      A[i] = A[i]/2
      cnt +=1
    if cnt ==n:
      ans +=1
print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <string>
#include <string.h>
#include <algorithm>
using namespace std;
char a[105][105];
int dir[4][2]={1,0,-1,0,0,1,0,-1};
int w,h;
int ans=0;
void dfs(int x,int y ,char s);
int main()
{
   while(cin >> h >>w &&(h||w))
   {
       for(int i=0;i<h;i++)
        for(int j=0;j<w;j++)
        cin >> a[i][j];
    for(int i=0;i<h;i++)
        for(int j=0;j<w;j++)
        {
            if(a[i][j]!='.')
            {
                dfs(i,j,a[i][j]);
                ans++;
            }
        }
        cout << ans << endl;
        ans=0;
   }
   return 0;
}
void dfs(int x,int y ,char s)
{
    int nx,ny;
    for(int k=0;k<4;k++)
    {
        nx=x+dir[k][0];
        ny=y+dir[k][1];
        if(nx>=0&&nx<h&&ny<w&&ny>=0&&a[nx][ny]==s)
        {
            a[nx][ny]='.';
            dfs(nx,ny,s);
        }
    }
}



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

#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define REP(i, n)  FOR(i, 0, n)
#define ASC(c) sort((c).begin(), (c).end())
#define DESC(c) sort((c).begin(), (c).end(), greater<int>())

#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

typedef long long ll;
typedef unsigned long long ull;
struct edge { int u, v; ll w; };
 
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int main() {
    int n; cin >> n;
    vector<int> a(n), tmp(n);
    REP(i, n)  {
        cin >> a[i];
        tmp[i] = a[i];
    }
    DESC(tmp);

    REP(i, n) {
        if (a[i] == tmp[0]) cout << tmp[1] << endl;
        else cout << tmp[0] << endl;
    }
}


Measured memory_bytes: 3200
#include <bits/stdc++.h>
#include <vector>
#include <numeric>
#define PI 3.14159265358979323846
#define MAXINF (1e18L)
#define INF (1e9L)
#define EPS (1e-9)
#define MOD ((ll)(1e9+7))
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define pb push_back
#define fi first
#define se second
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
template<class T> inline bool chmin(T& a, T b){return a>b ? a=b, true : false;}
template<class T> inline bool chmax(T& a, T b){return a<b ? a=b, true : false;}
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;

vector<vector<pll>> m;
vector<int> ans;
int N;

void dfs(int from, int to, ll dist){
    if((dist & 1) == 0) ans[to] = 0;
    for(auto i : m[to]){
        if(i.fi != from) dfs(to, i.fi, dist + i.se);
    }
}

int main(void)
{
    cin >> N;
    m.assign(N, vector<pll>());
    REP(i, N-1){
        int f,t,w;
        cin >> f >> t >> w;
        f--;t--;
        m[f].pb(pll(t,w));
        m[t].pb(pll(f,w));
    }

    ans.assign(N, 1);
    // queue<pll> q;
    // q.push(pll(0,0));
    // while(!q.empty()){
    //     auto f = q.front();q.pop();
    //     if((f.se & 1) == 0)ans[f.fi] = 0;
    //     for(auto i : m[f.fi]){
    //         if(ans[i.fi] == 0) continue;
    //         q.push(pll(i.fi, f.se + i.se));
    //     }
    // }

    dfs(-1, 0, 0);

    REP(i, N){
        pr(ans[i]);
    }
}

Measured memory_bytes: 9600
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline

n = int(input())
x = list(map(int, input().split()))

ans = 1000000000
for i in range(101):
    sum = 0
    for j in x:
        sum += pow(j - i, 2)
    ans = min(ans, sum)

print(ans)


Measured memory_bytes: 8984
#include <iostream>
#include <cmath>
#include <cstring>
#include <string>

using namespace std;

#define MAXN 100005

int h[MAXN], dp[MAXN];

int solve(int n) {
	if(n == 1) return 0;
	if(dp[n] != -1) return dp[n];
	dp[n] = solve(n - 1) + abs(h[n] - h[n - 1]);
	if(n > 2) {
		dp[n] = min(dp[n], solve(n - 2) + abs(h[n] - h[n - 2]));
	}
	return dp[n];
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int n;
	cin >> n;
	for(int i = 1; i <= n; i++) {
		cin >> h[i];
	}
	memset(dp, -1, sizeof(dp));
	cout << solve(n) << '\n';
	
	return 0;
}

Measured memory_bytes: 9048
#include <cstdio>
#include <algorithm>
#include <vector>
#define file(x) freopen(#x".in", "r", stdin), freopen(#x".out", "w", stdout)

inline int read()
{
	int data = 0, w = 1; char ch = getchar();
	while (ch != '-' && (ch < '0' || ch > '9')) ch = getchar();
	if (ch == '-') w = -1, ch = getchar();
	while (ch >= '0' && ch <= '9') data = data * 10 + (ch ^ 48), ch = getchar();
	return data * w;
}

const int N(5010), Mod(1e9 + 7);
struct edge { int next, to; } e[N << 1];
int head[N], e_num, f[N][N], g[N], size[N], n;
inline void add_edge(int from, int to)
{
	e[++e_num] = (edge) {head[from], to};
	head[from] = e_num;
}

void dfs(int x, int fa)
{
	static int tmp[N];
	size[x] = 1; int *fx = f[x]; fx[1] = 1;
	for (int i = head[x]; i; i = e[i].next)
	{
		int to = e[i].to; if (to == fa) continue;
		dfs(to, x);
		for (int j = 0; j <= size[x]; j++)
			for (int k = 0; k <= size[to]; k++)
				tmp[j + k] = (tmp[j + k] + 1ll * fx[j] * f[to][k]) % Mod;
		size[x] += size[to], std::copy(tmp + 1, tmp + size[x] + 1, fx + 1);
		std::fill(tmp + 1, tmp + size[x] + 1, 0);
	}
	fx[0] = 0;
	for (int i = 1; i <= size[x]; i++)
		fx[0] = (fx[0] - 1ll * fx[i] * g[i] % Mod + Mod) % Mod;
}

int main()
{
	n = read(), g[0] = 1;
	for (int i = 1, a, b; i < n; i++)
		a = read(), b = read(), add_edge(a, b), add_edge(b, a);
	for (int i = 2; i <= n; i += 2) g[i] = 1ll * g[i - 2] * (i - 1) % Mod;
	dfs(1, 1); printf("%d\n", Mod - f[1][0]);
	return 0;
}


Measured memory_bytes: 97280
#include <iostream>
#include <queue>

using namespace std;

static const int N = 200010;
int n, k, a[N], cnt[N];
priority_queue <int, vector<int>, greater<int> > que;

int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; ++ i) cin >> a[i], ++ cnt[a[i]];
  for (int i = 1; i <= n; ++ i) if (cnt[i]) que.push(cnt[i]);
  int ans = 0;
  while (que.size() > k)
    ans += que.top(), que.pop();
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 2936
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
char ch[10006][11];
int min(int a,int b)
{
	if(a>b)return b;
	return a;
}
int main(){
 	int sum=0,a=0,b=0,s=0,n;
 	cin>>n;
 	for(int i=0;i<n;++i)
 	{
 		cin>>ch[i];
 		if(ch[i][0]=='B')b++;
 		if(ch[i][strlen(ch[i])-1]=='A')a++;
 		if(ch[i][0]=='B'&&ch[i][strlen(ch[i])-1]=='A')s++;
 		for(int j=0;j<strlen(ch[i]);++j)
 		{
 			if(ch[i][j]=='A'&&ch[i][j+1]=='B')sum++;
		 }
	 }
	 if(s!=0&&s==b&&s==a)sum+=s-1;
	 else sum+=min(a,b);
	 cout<<sum;
}

Measured memory_bytes: 384
#include "bits/stdc++.h"
using namespace std;
const int year1=372;
const int day1=1440;
class logdata
{
	public:
	int day;
	int date;
	int visitor;
	logdata()
	{}
	logdata(string m,string t,string v)
	{
		visitor=stoi(v);
		int big=(m[0]-'0')*10+(m[1]-'0');
		int little=(m[3]-'0')*10+(m[4]-'0');
		day=(big-1)*31+little;
		big=(t[0]-'0')*10+(t[1]-'0');
		little=(t[3]-'0')*10+(t[4]-'0');
		date=big*60+little;
	}
};
logdata IO[1000];
bool inroom[1000];//誰が部屋にいるか
int during[1000];//goddessと一緒にいた時間
string indata[4];

//IO[index-1]からIO[index]までの経過時間を求める
int keika(int index)
{
	int diffday=IO[index].day-IO[index-1].day;
	int difftime=IO[index].date-IO[index-1].date;
	return diffday*day1+difftime;
}

int main()
{
	int n;
	while(1)
	{
		cin>>n;
		if(n==0)
			break;
		for(int i=0;i<n;i++)
		{
			for(int j=0;j<4;j++)
				cin>>indata[j];
			IO[i]=logdata(indata[0],indata[1],indata[3]);
			if(i>0)
			{
				if(IO[i].day<IO[i-1].day)
					IO[i].day+=((IO[i-1].day-IO[i].day)/year1+1)*year1;
			}
		}
		//input end
		fill(during,during+1000,0);
		fill(inroom,inroom+1000,false);
		for(int i=0;i<n;i++)
		{
			//goddessがいるなら部屋にいる人の時間を加算する
			if(inroom[0])
			{
				int k=keika(i);
				for(int j=1;j<1000;j++)
				{
					if(inroom[j])
						during[j]+=k;
				}
			}
			//部屋にいる人
			inroom[IO[i].visitor]^=true;//反転
		}
		sort(during,during+1000);
		reverse(during,during+1000);
		cout<<during[0]<<endl;
	}
	return 0;
}


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

using namespace std;
using LL = long long;
using P = pair<int, int>;
using Tapris = tuple<int, int, int>;

#define REP(i, n) for(LL i = 0; i < n; ++i)
#define FOR(i, a, n) for(LL i = a; i < n; ++i)
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e15;
const int MOD = 1e9 + 7;

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

//#define int long long

/*************** using variables ***************/
string s;
map<char, int> mp;
/**********************************************/

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

    cin >> s;
    REP(i, s.size()) mp[s[i]]++;

    int pnum = s.size()/2 - mp['p'];
    cout << pnum << endl;

}


Measured memory_bytes: 512
use std::collections::HashMap;

 fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);
    let n:u32 = sc.read();
    let mut smap:HashMap<u32,u32> = HashMap::new();
    let mut hmap:HashMap<u32,u32> = HashMap::new();
    let mut cmap:HashMap<u32,u32> = HashMap::new();
    let mut dmap:HashMap<u32,u32> = HashMap::new();

    for _ in 0..n {
        match sc.read::<String>().as_str(){
            "S" => {smap.insert(sc.read(),0);},
            "H" => {hmap.insert(sc.read(),0);},
            "C" => {cmap.insert(sc.read(),0);},
            "D" => {dmap.insert(sc.read(),0);},
            _ => {println!("error")},
        }
    }
    for i in 1..14 {
        if !smap.contains_key(&i){
            println!("{} {}", 'S', i);
        }
    }
    for i in 1..14 {
        if !hmap.contains_key(&i){
            println!("{} {}", 'H', i);
        }
    }
    for i in 1..14 {
        if !cmap.contains_key(&i){
            println!("{} {}", 'C', i);
        }
    }
    for i in 1..14 {
        if !dmap.contains_key(&i){
            println!("{} {}", 'D', i);
        }
    }
}

use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;
 
struct Scanner<'a> {
    cin: StdinLock<'a>,
}
 
impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }
 
    fn read1<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }
 
    fn read<T: FromStr>(&mut self) -> T {
        self.read1().unwrap()
    }
}



Measured memory_bytes: 1072
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define sc scanf
#define pr printf
#define rep(i,x,y) for(int i = x;i <= y;i++)
#define rvp(i,x,y) for(int i = y;i >= x;i--)
#define ios ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

int main()
{
	int k,x;
	while(~sc("%d%d",&k,&x))
	{
		int l = max(x-k+1,-1000000),r = min(x+k-1,1000000);
		rep(i,l,r) pr("%d ",i);
		puts("");
	}
	return 0;
}

Measured memory_bytes: 256
n=int(input())
if n==1:
  print(0)
else: 
  L=list(map(int,input().split()))
#a,b=map(int,input().split())
  A=[0 for i in range(n-1)] 
#l = [int(input()) for i in range(N)]
  B=[0 for i in range(n-1)] 
  for i in range(n-1):
    A[i]=L[i]-L[i+1]

  for i in range(n-1):
    if A[i]>=0:
      B[i]=B[i-1]+1
    else:
      B[i]=0

  print(max(B))

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

int main(){
    int W, H, x, y, r;
    cin >> W >> H >> x >> y >> r;

    if(x-r < 0 || x+r > W || y-r < 0 || y+r > H) cout << "No" << endl;
    else cout << "Yes" << endl;

    return 0;
}


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

int main() {
	std::cout << std::fixed << std::setprecision(6);
	double W, H, x, y;
	cin >> W >> H >> x >> y;
	double ans = W / 2 * H;
	cout << ans<<" ";
	if (W / 2 == x && H / 2 == y)cout << 1;
	else cout << 0;


}

Measured memory_bytes: 256
def main():
    buf = input()
    N = int(buf)
    buf = input()
    buflist = buf.split()
    W = list(map(int, buflist))
    minimum = int(1e9)+7
    for i in range(1, N):
        diff = abs(sum(W[0:i]) - sum(W[i:N]))
        if diff < minimum:
            minimum = diff
    print(minimum)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define mod 1000000007
#define MOD(x) ((x)%mod)
#define pii pair<int,int>
#define mp(a,b) make_pair(a,b)
using namespace std;
int n;
char a[200005];
int s[200005];
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf(" %c",&a[i]);
		if(a[i]=='#')
			s[i]=s[i-1]+1;
		else
			s[i]=s[i-1];
	}
	int ans=2e6;
	for(int i=0;i<=n;i++)
		ans=min(ans,s[i]+(n-i)-(s[n]-s[i]));
	printf("%d",ans);
	return 0;
}



Measured memory_bytes: 1280
import java.util.*;

public class Main {

    public static void main(String[] args) {
	// write your code here
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int y = sc.nextInt();
        int z = sc.nextInt();
        System.out.println(""+z+" "+x+" "+y);
    }
}


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

vector<int> factor(int n) {
    vector<int> res;
    for (int i = 2; i * i <= n; i++) {
        while (n % i == 0) {
            res.push_back(i);
            n /= i;
        }
    }
    if (n != 1) res.push_back(n);
    return res;
}

main()
{
    int n;
    cin >> n;
    unordered_map<int, int> pr;
    for (int i = 2; i <= n; i++) {
        vector<int> kek = factor(i);
        for (int j : kek) {
            pr[j]++;
        }
    }
    int ans = 1;
    int mod = 1000000007;
    for (pair<int, int> pa : pr) {
        ans *= pa.second + 1;
        ans %= mod;
    }
    cout << ans;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define maxs(a, b) a = max(a, b)
#define mins(a, b) a = min(a, b)
using namespace std;
typedef long long ll;
typedef pair<double, int> P;
const ll linf = (1ll << 61);
const int inf = 1001001001;
const int mod = 1000000007;

template<typename T>
map<T, ll> factorize(T x) {
	map<T, ll> res;
	for (ll i = 2; i * i <= x; i++) {
		while (x % i == 0) {
			x /= i;
			res[i]++;
		}
	}
	if (x != 1) res[x]++;
	return res;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll n;
	cin >> n;
	map<ll, ll> mp = factorize(n);
	ll ans = 0;
	for (auto& c : mp) {
		int k = -1;
		for (int i = 1; i * (i + 1) / 2 <= c.second; ++i) {
			k = i;
		}
		if (k == -1) continue;
		ans += k;
	}
	cout << ans << endl;
 	return 0;
}


Measured memory_bytes: 3656
#include <cstdio>
#include <queue>

using namespace std;

struct task {
	char name[10];
	int runtime = 0;
	int time = 0;
};

void rotate(queue <task> &tasks) {
	task hold;
	hold = tasks.front();
	tasks.pop();
	tasks.push(hold);
	hold = tasks.front();
}


int main() {
queue <task> tasks;
queue<task>finished;
task process;
int quantum = 0;
int carry = 0;
int size = 0;

scanf("%d %d", &size, &quantum);
for (int i = 0; i < size; i++) {
	scanf("%s %d", &process.name, &process.runtime);
	tasks.push(process);
}

bool back=false;
int total=0;
while (!tasks.empty()) {
	task t=tasks.front();
	carry = t.runtime - quantum;
	if (carry <= 0) {
		carry=t.runtime;
		back=false;
	} else {
		carry=quantum;
		back=true;
	}
	t.runtime-=carry;
	total+=carry;
   	tasks.pop();
	if(back){
		tasks.push(t);
	}else{
		t.time=total;
		finished.push(t);
		 printf("%s %d\n", t.name, t.time);
	}
	}


}



Measured memory_bytes: 3612
import sys

s_args = sys.stdin.read().splitlines()

#n = int(s_args[0])
a = [int(s_a) for s_a in s_args[1].split(' ')]

lsb = [ai & -ai for ai in a]
#print(lsb)
print(min(lsb).bit_length() - 1)


Measured memory_bytes: 2940
N, K = map(int, input().split())
A = list(map(int, input().split()))
mod = 1000000007
plus = []
minus = []
ans = 1
lp = 0
lm = 0
lz = 0
for k in range(N):
  if A[k] > 0:
    plus.append(A[k])
    lp += 1
  elif A[k] < 0:
    minus.append(A[k])
    lm += 1
  else:
    lz += 1
plus.sort(reverse = True)
minus.sort()
def main(mp, mm, plus, minus):
  mod = 1000000007
  ans = 1
  for k in range(mp):
    ans = ans * plus[k] % mod
  for k in range(mm):
    ans = ans * minus[k] % mod
  print(ans)
  exit()
if lz + K > N:
  print(0)
  exit()
elif lp == 0: 
  if K % 2 == 1:
    if lz > 0:
      print(0)
      exit()
    else:
      for k in range(K):
        ans = ans * minus[- k - 1] % mod
      print(ans)
      exit()
  else:
    main(0, K, plus, minus)
elif lm == 0:
  main(K, 0, plus, minus)
p = 0
m = 0
for _ in range(K):
  if plus[p] >= -1 * minus[m]:
    p += 1
    if p == lp:
      m = K - p
      break
  else:
    m += 1
    if m == lm:
      p = K - m
      break
if m % 2 == 0:
  main(p, m, plus, minus)
else:
  if p == lp:
    if m != lm:
      main(p - 1, m + 1, plus, minus)
    else:
      if lz > 0:
        print(0)
        exit()
      else:
        main(p, m, plus, minus)
  elif m == lm:
    main(p + 1, m - 1, plus, minus)
  elif p == 0:
    main(p + 1, m - 1, plus, minus)
  else:
    if plus[p] * plus[p - 1] > minus[m - 1] * minus[m]:
      main(p + 1, m - 1, plus, minus)
    else:
      main(p - 1, m + 1, plus, minus)

Measured memory_bytes: 31684
#include<iostream>

using namespace std;

int main(){
  int M1,D1,M2,D2;
      cin>>M1>>D1>>M2>>D2;              //外部入力読み込み方法

  if (D2==1){
    cout <<1 ;
     } 
   else{
    cout << 0;
   }

 return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

int main() {
    int a,b;cin>>a>>b;
    string s;cin>>s;
    for(int i=0;i<a;i++){
        if(s[i]=='-'){cout<<"No"<<endl;return 0;}
    }
    if(s[a]!='-'){
        cout<<"No"<<endl;return 0;
    }
    for(int i=a+1;i<a+b+1;i++){
        if(s[i]=='-'){cout<<"No"<<endl;return 0;}
    }
    cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <iomanip>
using ll = long long;
using uint = unsigned int;
using graph = std::vector<std::vector<ll>>;
using wGraph = std::vector<std::vector<std::pair<ll,ll>>>;
#define rep(i,n) for (int i=0; i < int(n); i++)

using namespace std;
ll MOD7 = 1000000007;
ll MOD9 = 1000000009;
vector<ll> InputVec(ll N){
    vector<ll> A(N);
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }
    return A;
}
void OutputVec(vector<ll> A){
    for (int i = 0; i < A.size(); ++i) {
        cout << A[i] << ",";
    }
    cout << endl;
}
vector<vector<ll>> InputVec2d(ll H,ll W){
    vector<vector<ll>> A(H);
    for (int yi = 0; yi < H; ++yi) {
        A[yi] = vector<ll>(W);
    }
    for (int yi = 0; yi < H; ++yi) {
        for (int xi = 0; xi < W; ++xi) {
            cin >> A[yi][xi];
        }
    }
    return A;
}
vector<vector<char>> InputVec2dStr(ll H,ll W){
    vector<vector<char>> A(H);
    for (int yi = 0; yi < H; ++yi) {
        A[yi] = vector<char>(W);
    }
    for (int yi = 0; yi < H; ++yi) {
        string S;
        cin >> S;
        for (int xi = 0; xi < W; ++xi) {
            A[yi][xi] = S[xi];
        }
    }
    return A;
}
void OutputVec2d(vector<vector<ll>> A){
    for (int yi = 0; yi < A.size(); ++yi) {
        for (int xi = 0; xi < A[yi].size(); ++xi) {
            cout << A[yi][xi] << ",";
        }
        cout << endl;
    }
}
graph InputGraph(ll N,ll M){
    graph G(N);
    for (int i = 0; i < M; ++i) {
        ll a,b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    return G;
}
graph InputDGraph(ll N,ll M){
    graph G(N);
    for (int i = 0; i < M; ++i) {
        ll a,b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
    }
    return G;
}
void OutputGraph(graph G){
    for (int i = 0; i < G.size(); ++i) {
        cout << i << ":";
        for (int j = 0; j < G[i].size(); ++j) {
            cout << G[i][j]<< ",";
        }
        cout << endl;
    }
}
void OutputAnswerBool(bool b,bool isUpperCase = false){
    if(b){
        if(isUpperCase){
            cout << "YES" << endl;
        }else{
            cout << "Yes" << endl;
        }
    }else{
        if(isUpperCase){
            cout << "NO" << endl;
        }else{
            cout << "No" << endl;
        }
    }
}

int main() {
    ll X;
    cin >> X;
    ll sum = 0;
    for (int i = 0; i <= X; ++i) {
        sum += i;
        if(sum >= X){
            cout << i << endl;
            return 0;
        }
    }
}


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

#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define repd(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define forr(i,a,b) for(ll i=(a);i<=(b);i++)
#define ford(i,a,b) for(ll i=(a);i>=(b);i--)
#define all(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define size(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 10000007 //10^9+7
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define MAXR 100000 //10^5:最大のrange(素数列挙などで使用)



int main(void) {
    long int N,i,j;
    cin >> N;
    long int n[200510];
    long int m[200510];
    for(i=0;i<N-1;++i){
       cin >> n[i];
      
    }
     for(i=0;i<N-1;++i){
     
       m[n[i]-1]++;
    }
    for (j=0;j<N;++j){
        
         cout << m[j] << "\n";
    

    }   
    
  return 0;
}

Measured memory_bytes: 6716
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

A,B = [int(i) for i in input().split()]
a,b = prime_factorize(A),prime_factorize(B)

data = set(a) & set(b)
data.add(1)

print(len(data))

Measured memory_bytes: 3064
#ifdef __GNUC__ 
#pragma GCC optimize(2)
#endif

#include <cassert>
#include <iostream>
#include <functional>
#include <iomanip>
#include <set>
#include <unordered_map>
#include <map>
#include <queue>
#include <stack>
#include <complex>
#include <vector>
#include <deque>
#include <algorithm>
#include  <cstring>
#include <string>
#include <cmath> 
#include <random>

#pragma warning(disable: 4996)

using namespace std;
 
namespace Bigcat {
	template <typename T> inline void max_s(T&a, const T&b) { a = max(a, b); }
	template <typename T> inline void min_s(T&a, const T&b) { a = min(a, b); }

	template <typename T>  void sort_v(T & x) { sort(x.begin(), x.end()); }
	template <typename T>  void erase_dup(T & x) { x.erase(unique(x.begin(), x.end()), x.end()); }    // erase duplicate
	template <typename T, typename V>  int pos_l(const T & x, const V & v) { return lower_bound(x.begin(), x.end(), v) - x.begin(); }
	template <typename T, typename V>  int pos_u(const T & x, const V & v) { return upper_bound(x.begin(), x.end(), v) - x.begin(); }

	inline unsigned rand_g() {
		static mt19937 mt_rand((int)time(0));
		return mt_rand();
	}
	using LL = long long;
	using VI = vector<int>;
	using VVI = vector< VI >;
	using VL = vector<LL>;
	using PII = pair<int, int>;
	using VPII = vector< PII >;
}
#define Rep(i, a) for(int i = 0; i < (int)(a); i++)
#define Loop(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define Loop_r(i, n) for(int i = (int)(n) - 1; i >= 0; i--)

    using namespace Bigcat;
const LL base = LL(1e9 + 7);
const LL INFL =  1LL << 62;
const int INF = 1 << 30 ;
const int MAX = int ( 2e5 + 100 ) ;

struct Node {
	int x, y, w;
};
bool operator < (const Node & n0, const Node & n1) {
	return n0.x< n1.y;
}
int cc[26];

void solve1() {

	LL result = 0;
	int n;

	cin >> n;
	string s;
	cin >> s;
	Rep(i, n) {
		cc[s[i] - 'a'] ++;
	} 
	LL t = 1;
	Rep(i, 26) {
		t *= cc[i] + 1;
		t %= base;
	}

	result = t - 1 + base;
	result %= base;

	cout << result << endl;

}
void solve() {
	int t = 1;
	//cin >> t;
#ifdef _DEBUG
	cerr << " now base "<< base << endl;
#endif
	for (int i = 0; i < t; ++i) {
 #ifdef _DEBUG
    cerr<<" tasks: " << i+1<<endl;
#endif       
		solve1();
	}
    int x = 1;
}

void io_init() {
   	const int inId = 0;
	const int outId = 0;
	if (inId>0) {
		cerr << "redirect stdin to input " << inId << endl;
		string s = "input";
		s += to_string(inId);
		s += ".txt";
		auto r = freopen(s.c_str(), "r", stdin);
		if (r == nullptr) {
			cerr << "invalid input file " << s << endl;;
			r = freopen("CON", "r", stdin); // to do  con??
		}
	}
	if (outId>0) {
		cerr << "redirect stdout to stdout " << outId << endl;
		string s = "stdout";
		s += to_string(outId);
		s += ".txt";
		auto r = freopen(s.c_str(), "w", stdout);
		if (r == nullptr) {
			cerr << "invalid output file " << s << endl;;
			r = freopen("CON", "w", stdout);
		}
	}
}

int main(int argc,  char * argv[]) {
    
#ifdef _DEBUG    
	if (argc ==1) {
		io_init();
	}
#endif
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); // close sync between cout and printf
	cout.precision(11); 
    
	solve();
}


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

int main(){
    int x;
    cin>>x;
    if(400<=x &&x<=599)cout<<"8\n";
    else if(x<=799)cout<<"7\n";
    else if(x<=999)cout<<"6\n";
    else if(x<=1199)cout<<"5\n";
    else if(x<=1399)cout<<"4\n";
    else if(x<=1599)cout<<"3\n";
    else if(x<=1799)cout<<"2\n";
    else if(x<=1999)cout<<"1\n";


}
                                                 
                                                 

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

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = long long;
using pll = pair<ll,ll>;
constexpr ll INF = (1LL<<60);
constexpr ll MOD = (1e9+7);
//constexpr ll MOD = (998244353);
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;}
void dump(){cerr<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cerr<<h<<", ";dump(forward<Ts>(t)...);}
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T>vector<T> vec(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto vec(size_t a, Ts... ts){return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...));}
template<class T>vector<T> _vec(size_t a,T v){return vector<T>(a,v);}
template<class T, class... Ts>auto _vec(size_t a, Ts... ts){return vector<decltype(_vec<T>(ts...))>(a, _vec<T>(ts...));}

signed main(){

  ll x;
  cin>>x;

  for(ll i=0;i<=1000000;++i){
    ll mn = 100*i;
    ll mx = 105*i;
    if(mn<=x&&x<=mx){
      cout<<1<<endl;
      return 0;
    }
  }
  cout<<0<<endl;

}

Measured memory_bytes: 256