akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define each(i, c) for (auto& i : c)
#define mkp(a, b) make_pair(a, b)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> Pll;
const ll MOD = 998244353;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << ": " << p.second << ")"; return os; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ", "; os << ")"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; each (i, m) os << i << ", "; os << "}"; return os; }

class modint {
  private:
    ll m_val;
    ll m_mod;
  public:
    constexpr modint() : m_val(0), m_mod() { m_mod = MOD; }
    constexpr modint(const ll x) : m_val(0), m_mod(0) { m_mod = MOD; m_val = x % m_mod; }
    constexpr modint(const ll x, const ll mod) : m_val(0), m_mod(0) { m_mod = mod; m_val = x % m_mod; }
    constexpr ll val() const { return m_val; }
    constexpr modint operator+(const modint &rhs) const { return modint(*this) += rhs; }
    constexpr modint operator-(const modint &rhs) const { return modint(*this) -= rhs; }
    constexpr modint operator*(const modint &rhs) const { return modint(*this) *= rhs; }
    constexpr modint operator/(const modint &rhs) const { return modint(*this) /= rhs; }
    constexpr modint &operator+=(const modint &rhs) {
      m_val += rhs.m_val;
      if (m_val >= m_mod) m_val -= m_mod;
      return *this;
    }
    constexpr modint &operator-=(const modint &rhs) {
      if (m_val < rhs.m_val) m_val += m_mod;
      m_val -= rhs.m_val;
      return *this;
    }
    constexpr modint &operator*=(const modint &rhs) {
      m_val = m_val * rhs.m_val % m_mod;
      return *this;
    }
    constexpr modint &operator/=(const modint &rhs) {
      *this *= rhs.inv();
      return *this;
    }
    constexpr modint pow(ll n) const {
      if (n == 0) return 1;
      modint o = pow(n >> 1);
      o *= o;
      if (n & 1) o *= *this;
      return o;
    }
    constexpr modint inv() const {
      return pow(m_mod - 2);
    }
    friend ostream& operator<<(ostream& os, const modint &a) { os << a.val(); return os; }
};

struct combination {
  vector<modint> fact, ifact;
  combination(ll n): fact(n+1), ifact(n+1) {
    fact[0] = 1;
    for (ll i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (ll i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  modint operator()(ll n, ll k) {
    if (k < 0 || k > n) return 0;
    return fact[n] * ifact[k] * ifact[n-k];
  }
};

int main() {
  ll n, m, k;
  cin >> n >> m >> k;

  vector<modint> sum(n+1);
  sum[0] = 1;
  for (ll i = 1; i <= n; ++i) {
    sum[i] = sum[i-1] * (m-1);
  }

  combination comb(200005);
  
  modint ans = 0;
  for (ll i = 0; i <= k; ++i) {
    ans += comb(n-1, i) * m * sum[n-i-1];
  }

  cout << ans << endl;

  return 0;
}



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

using namespace std;

#define range(i, m, n) for(int i = m; i < n; i++)
#define husk(i, m, n) for(int i = m; i > n; i--)

int n;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  vector<vector<int>> g(n);
  vector<int> x, y;
  range(i, 0, n - 1) {
    int u, v;
    cin >> u >> v;
    u--; v--;
    g[u].push_back(i);
    g[v].push_back(i);
    x.push_back(u);
    y.push_back(v);
  }
  vector<int> res(n - 1);
  vector<int> dep(n);
  vector<int> sub(n, 1);
  function<void(int, int, int)> dfs = [&](int v, int p, int cur) {
    if(~p) dep[v] = dep[p] + 1;
    for(int id : g[v]) {
      int u = x[id] + y[id] - v;
      if(u == p) continue;
      dfs(u, v, max(u, cur));
      if(u < cur) {
        sub[v] += sub[u];
        res[id] = sub[u];
      }
    }
  };
  dfs(0, -1, 0);
  range(i, 0, n - 1) if(dep[x[i]] > dep[y[i]]) swap(x[i], y[i]);
  function<void(int, int, int, int)> dfs2 = [&](int v, int big, int nxt, int id) {
    if(~id) {
      if(dep[nxt] > dep[big]) {
        res[id]--;
      }
    }
    for(int i : g[v]) {
      int u = y[i];
      if(u == v) continue;
      if(u > big) dfs2(u, u, big, -1);
      else if(v == big) {
        dfs2(u, v, max(u, nxt), i);
      } else dfs2(u, big, max(u, nxt), id);
    }
  };
  for(int i : g[0]) dfs2(y[i], y[i], 0, -1);
  range(i, 0, n) {
    int sum = 0;
    for(int id : g[i]) if(y[id] != i) sum += res[id];
    for(int id : g[i]) if(y[id] != i) res[id] = sum - res[id];
    sub[i] = sum;
  }
  int cur = 0;
  vector<int> ans(n);
  function<void(int)> dfs3 = [&](int v) {
    ans[v] = cur + dep[v] + sub[v];
    for(int id : g[v]) {
      if(y[id] == v) continue;
      cur += res[id];
      dfs3(y[id]);
      cur -= res[id];
    }
  };
  dfs3(0);
  range(i, 1, n) cout << ans[i] << " ";
  return 0;
}


Measured memory_bytes: 42216
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define SZ(x) ((int)x.size())
#define ALL(x) x.begin(),x.end()
#define L(i,u) for (register int i=head[u]; i; i=nxt[i])
#define rep(i,a,b) for (register int i=(a); i<=(b); i++)
#define per(i,a,b) for (register int i=(a); i>=(b); i--)
using namespace std;
typedef long double ld;
typedef long long ll;
typedef unsigned int ui;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
typedef vector<int> Vi;
template<class T> inline void read(T &x){
	x=0; char c=getchar(); int f=1;
	while (!isdigit(c)) {if (c=='-') f=-1; c=getchar();}
	while (isdigit(c)) {x=x*10+c-'0'; c=getchar();} x*=f;
}
template<class T> T gcd(T a, T b){return !b?a:gcd(b,a%b);}
template<class T> inline void umin(T &x, T y){x=x<y?x:y;}
template<class T> inline void umax(T &x, T y){x=x>y?x:y;}
mt19937 R(chrono::system_clock().now().time_since_epoch().count());

const int N = 266666;
int n,k,a[N],b[N];
int main() {
	read(n);read(k);rep(i,1,n)read(a[i]);
	while(k--){
		rep(i,1,n)b[i]=0;
		rep(i,1,n){
			int l=max(i-a[i],1),r=min(i+a[i],n);
		//	cerr<<l<<' '<<r<<endl;
			b[l]++;b[r+1]--;
		}
		rep(i,1,n)a[i]=b[i]+a[i-1];
	//	rep(i,1,n)printf("%d ",a[i]);puts("");
		bool ok=1;rep(i,1,n)ok&=a[i]==n;
		if(ok)break;
	}
	rep(i,1,n)printf("%d ",a[i]);
	return 0;
}


Measured memory_bytes: 5276
#include <stdio.h>

struct DICE {
int mark1,mark2,mark3,mark4,mark5,mark6;
};

void MoveDice(struct DICE *p,char c);

int main(){
struct DICE p;char compass;struct DICE *pp;
scanf("%d %d %d %d %d %d\n",&p.mark1,&p.mark2,&p.mark3,&p.mark4,&p.mark5,&p.mark6);
scanf("%c", &compass);
while(compass!='\n'){
MoveDice(&p,compass);
scanf("%c", &compass);
}
printf("%d\n",p.mark1);
return 0;
}

void MoveDice(struct DICE *p,char c){
int tmp;
tmp=p->mark1;
switch(c){
case 'W':
p->mark1=p->mark3;p->mark3=p->mark6;p->mark6=p->mark4;p->mark4=tmp;
break;
case 'E':
p->mark1=p->mark4;p->mark4=p->mark6;p->mark6=p->mark3;p->mark3=tmp;
break;
case 'N':
p->mark1=p->mark2;p->mark2=p->mark6;p->mark6=p->mark5;p->mark5=tmp;
break;
case 'S':
p->mark1=p->mark5;p->mark5=p->mark6;p->mark6=p->mark2;p->mark2=tmp;
break;
}
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n, m, k, ans = 0;
	cin >> n >> m >> k;
	long long A[n+1], B[m+1];
	A[0] = 0, B[0] = 0;
	cin >> A[1];
	for(int i=2; i<=n; ++i){
		cin >> A[i];
		A[i] = A[i-1] + A[i];
	}
	cin >> B[1];
	for(int i=2; i<=m; ++i){
		cin >> B[i];
		B[i] = B[i-1] + B[i];
	}
	for(int i=0; i<=n; ++i){
		int L = 0, R = m;
		while(L<=R){
			int mid=L+(R-L)/2;
			if(B[mid]+A[i]<=k){
				if(B[mid+1]+A[i]>k||mid==m){
					ans = max(ans, i+mid);
					L = R+1;
				}
				else{
					L=mid+1;
				}
			}
			else{
				R=mid-1;
			}
		}
	}
	cout << ans;
}


Measured memory_bytes: 6728
#!/usr/bin/env python3

# from numba import njit

# input = stdin.readline


def calcDistance(p1,p2):
  return (p1[0]-p2[0])**2 + (p1[1]-p2[1])**2

# @njit
def solve(n,d,a):
  res = 0
  zero = (0,0)
  for i in range(n):
    if calcDistance(a[i],zero) <= d**2:
        res += 1
  return res



def main():
  N,D = map(int,input().split())
  a = [tuple(map(int,input().split())) for _ in range(N)]
  print(solve(N,D,a))
  return

if __name__ == '__main__':
  main()


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

int main(){
  string a,b,c;
  cin >> a >> b >> c;
  if(a.at(a.size()-1)==b.at(0)&&b.at(b.size()-1)==c.at(0)){
    cout << "YES" << endl;
  }else{
    cout << "NO" <<endl;
  }
}

Measured memory_bytes: 256
N, K = map(int, input().split(' '))
if N%K == 0:
    print(0)
else:
    tmp = [abs(N - N//K*K)]
    while True:
        if abs(tmp[-1] - K) in tmp:
            break
        else:
            tmp.append(abs(tmp[-1] - K))
    print(min(tmp))

Measured memory_bytes: 9124
MAX = 60000
lst = [i for i in range(MAX)]
lst[0] = lst[1] = 0
for i in range(MAX):
  if lst[i] != 0:
    for j in range(i * 2, MAX, i):
      lst[j] = 0
while 0 == 0:
  try:
    n = int(input())
    i = n - 1
    j = n + 1
    while lst[i] == 0:
      i -= 1
    while lst[j] == 0:
      j += 1
    print(lst[i],lst[j])
  except EOFError:
    break


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

const int MAXN = 200005;

int a[MAXN], x;
int n, k;
int tmp[MAXN], tot = 0;

int main()
{
	scanf("%d%d", &n, &k);
	for (int i = 1; i <= n; i++) scanf("%d", &x), a[x]++;
	for (int i = 1; i <= n; i++)
		if (a[i] != 0)
			tmp[++tot] = a[i];
	sort(tmp+1, tmp+tot+1);
	if (tot <= k) {
		cout << 0 << endl;
	} else {
		int ans = 0;
		for (int i = 1; i <= tot-k; i++) {
			ans += tmp[i];
		}
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 1792
n = int(input())
l = list(map(int,input().split()))
dum = [0]*3
cnt = 0
for i in range(n):
    for j in range(i+1,n):
        for k in range(j+1,n):
           dum[0],dum[1],dum[2] = l[i],l[j],l[k]
           dum.sort()
           if dum[2]-(dum[1]+dum[0]) < 0 and (dum[0] != dum[1] and dum[1] != dum[2] and dum[2] != dum[0]):
               cnt += 1
print(cnt)

Measured memory_bytes: 9216
fun main() {
    val builder = StringBuilder()

    val n = readInputLine().toLong()
    val aArr = readInputLine().split(" ").map { it.toLong() }

    val cnt = mutableMapOf<Long, Long>()

    var ans = 0L

    for (i in 0 until n.toInt()) {
        val tmp = aArr[i] - (i + 1).toLong()
        ans += cnt[tmp] ?: 0L

        val addTmp = -aArr[i] - (i + 1).toLong()
        cnt[addTmp] = (cnt[addTmp] ?: 0L) + 1L
    }

    builder.appendln(ans)

    print(builder.toString())
}

fun readInputLine(): String {
    return readLine()!!
}


Measured memory_bytes: 81776
#include <stdio.h>

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


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

#define ull unsigned long long int
#define ll long long int
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define MOD (ull)(double)(1e9 + 7)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vll vector<ll>
#define pull pair<ull, ull>
#define m_p make_pair
#define debug(x) cout << #x << " " << x << endl

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	
	int tak = c / b + (c%b ? 1 : 0);
	int ak = a / d + (a%d ? 1 : 0);
	
	if(tak <= ak)cout << "Yes";
	else cout << "No";
}


Measured memory_bytes: 3668
#include <stdio.h>

int main(void){
	int m,n,M,N;
	int GCD,LCM;
	
	while(scanf("%d %d", &m,&n) != EOF){
	M=m,N=n;

	while(m!=n){
		if(m>n) m-=n;
		else n-=m;
	};
	GCD=m;
	LCM=GCD*(M/m)*(N/n);
	
	printf("%d %d\n",	GCD, LCM);
	};
	return (0);
}

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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);	
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll ,ll> 			pll;
typedef pair<ld,ld> 			pld;
typedef unordered_map<ll,ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5+7;
const ll 	MAX7 	= 	1e+7+7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e+9+7;
const ll 	N 		= 	2*1e6;

vll adj[N];ll visit[N]={};
int dx8[]={0,1,1,1,0,-1,-1,-1}, dy8[]={1,1,0,-1,-1,-1,0,1};
int dx4[]={0,1,0,-1}, dy4[]={1,0,-1,0};

// <------------- Declare Variables Here ------------> //

ll T=1;
ll n,x,y,m,k;
string s,t;
vll a,b,p,ans;
// <------------- Implement Functions Here ----------> //


// <------------- Start of main() -------------------> //

void MAIN() {
	cin >>n>>m;
	vll cnt(m+1);
	for(ll i=0;i<n;i++) {
		cin>>x;
		for(ll j=0;j<x;j++) {
			cin >> y;
			cnt[y]++;
		}
 	}
 	ll cou = 0;
 	for(ll i=0;i<=m;i++) cou+=(cnt[i]==n);
	cout<<cou;
}

int main() {
	fastio;randomINT;
	//cin>>T;
	while(T--) {
		MAIN();
	}
	return 0;
}



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

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

    cout << ans << endl;
}

Measured memory_bytes: 4772
#include<iostream>
#include<iomanip>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<regex> 
using namespace std;
 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return
#define C(i) cin>>i
#define C2(i,j) cin>>i>>j
#define C3(i,j,k) cin>>i>>j>>k
#define C4(i,j,k,m) cin>>i>>j>>k>>m
////////////////////////////////////////////////////////////

int main(){
	int a,b;
	string s;
	C3(a,b,s);

	rep(i,0,a){
		if(!isdigit(s[i]) ){
			No;
			ret 0;
		}
	}
	
	if(s[a] != '-'){
		No;
		ret 0;
	}

	rep(i,a+1,a+b+1){
		if(!isdigit(s[i])){
			No;
			ret 0;
		}
	}

	Yes;
	ret 0;
}

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

int main(){
  int a, b;
  cin >> a >> b;
  int ans;
  if(b<22){
    cout << 0 << endl;
    return 0;
  }
  if(b/10==2){
    for(int i=2; i<=b%10; i++){
      if(2*i<=a) ans++;
    }
    cout << ans << endl;
    return 0;
  }
  for(int i=2; i<b/10; i++){
    for(int j=2; j<10;j++){
      if(i*j<=a) ans++;
    }
  }
  for(int i=2; i<=b%10; i++){
      if((b/10)*i<=a) ans++;
    }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
 
using namespace std;
 
long long choose2(long long n) {
	return (n*(n-1)/2);
}
 
int main() {
	long long n;
	cin >> n;
	vector<int> s(n);
	map<int, int> cnt;
	long long total = 0;
 
	for (int i=0; i<n; i++) {
		cin >> s[i];
        s[i]--;
    }
 
	for (int i=0; i<n; i++)
		cnt[s[i]]++;
 
	for (int i=0; i<n; i++)
		total += choose2(cnt[i]);
 
	for (int i=0; i<n; i++) {
		long long ans = total;
		ans -= choose2(cnt[s[i]]);
		ans += choose2(cnt[s[i]]-1);
		cout << ans << endl;
	}
	return 0;
}

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

int main() {
  int N;
  int d[100];
  // 入力を配列に追加
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> d[i];
  }
  // setに配列の要素を追加
  set<int> ans;
  for (int i = 0; i < N; i++) {
    ans.insert(d[i]);
  }
  // 出力
  cout << ans.size() << endl;
  return 0;
}


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

#define rep(i,m,n) for(int (i)=(int)(m);i<(int)(n);++i)
#define rep2(i,m,n) for(int (i)=(int)(n)-1;i>=(int)(m);--i)
#define REP(i,n) rep(i,0,n)
#define REP2(i,n) rep2(i,0,n)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define all(hoge) (hoge).begin(),(hoge).end()
#define en '\n'
using ll = long long;
using ull = unsigned long long;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = (ll) 1e9 + 7;
//constexpr long long MOD = 998244353LL;
using ld=long double;
static const ld pi = 3.141592653589793L;
typedef vector<ll> Array;
typedef vector<Array> Matrix;


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

struct Edge {
	ll to, rev;
    long double cap;
	Edge(ll _to, long double _cap, ll _rev) {
	to = _to; cap = _cap; rev = _rev;
	}
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;

void add_edge(Graph& G, ll from, ll to, long double cap, bool revFlag, long double revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

void solve(){
	ll x,n;
	cin>>x>>n;
	Array p(n);
	REP(i,n) cin>>p[i];
	Array used(110,0);
	REP(i,n) used[p[i]]=1;

	ll mi=INF;
	ll ans=INF;

	rep(i,0,110){
		if(used[i]) continue;
		if(abs(i-x)<mi){
			mi=abs(i-x);
			ans=i;
		}
	}
	cout<<ans<<en;
}

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

	solve();
	//ll t;cin>>t;REP(i,t) solve();

    return 0;
}


Measured memory_bytes: 3660
#include<stdio.h>
int main(void){
 char s[100000];
  int count1=0,count2=0,i;
  scanf("%s\n",s);
  if(s[0]=='1'){
    count1++;
  }
    for(i=1;s[i]!='\0';i++){
      if(i%2!=0&&s[i]!='1'){
        count1++;
      }
      else if(i%2==0&&s[i]!='0'){
        count1++;
      }
    }
  if(s[0]=='0'){
    count2++;
  }
    for(i=1;s[i]!='\0';i++){
      if(i%2!=0&&s[i]!='0'){
        count2++;
      }
      else if(i%2==0&&s[i]!='1'){
        count2++;
      }
    }
 if(count1>=count2)
   printf("%d\n",count2);
 else if(count1<=count2)
   printf("%d\n",count1);

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <utility>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;

typedef vector<int> vi;
typedef pair<int,int> ii;
#define sz(a) int((a).size())
#define all(c) (c).begin(), (c).end()

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

	int n, q;
	scanf("%d%d", &n, &q);
	vector<tuple<int,int,int>> events;
	for (int i = 0; i < n; i++) {
		int s, t, x;
		scanf("%d%d%d", &s, &t, &x);
		events.push_back(make_tuple(s-x, 1, x));
		events.push_back(make_tuple(t-x, -1, x));
	}
	sort(all(events));

	set<int> blocks;
	int last = 0;
	for (int i = 0; i < q; i++) {
		int d;
		scanf("%d", &d);
		while (last < events.size() && get<0>(events[last]) <= d) {
			if (get<1>(events[last]) == 1)
				blocks.insert(get<2>(events[last]));
			else
				blocks.erase(get<2>(events[last]));
			last++;
		}
		printf("%d\n", blocks.empty()? -1 : *blocks.begin());
	}
}


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

const int MAXN = 200001;

pair <int, int> a[MAXN];

int mn[MAXN], mx[MAXN];
const int MOD = 1000 * 1000 * 1000 + 7;
ll p2[MAXN];
ll an[MAXN];
int f[MAXN];
int l[MAXN];


int main() {
	//freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
	ios_base::sync_with_stdio(false); cout.setf(ios::fixed); cout.precision(20);
	p2[0] = 1;
	for (int i = 1; i < MAXN; i++)
		p2[i] = (p2[i - 1] * 2ll) % MOD;
	for (int i = 0; i < MAXN; i++)
		f[i] = -1;
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i].first >> a[i].second;
	}
	sort(a, a + n);
	mx[0] = -MOD;
	mn[n] = MOD;
	for (int i = 0; i < n; i++) {
		mx[i + 1] = max(mx[i], a[i].second);
	}
	for (int i = n - 1; i >= 0; i--) {
		mn[i] = min(mn[i + 1], a[i].second);
	}
	for (int i = 0; i < n; i++) {
		int g1 = lower_bound(mx, mx + n, a[i].second) - mx - 1;
		int g2 = mn + n - upper_bound(mn, mn + n, a[i].second);
		f[g1] = max(f[g1], g2);
	}
	for (int i = n - 1; i >= 0; i--)
		f[i] = max(f[i], f[i + 1]);

	for (int i = n; i >= 0; i--) {
		l[i + 1] = f[n - i] + 1;
	}


	an[0] = 1;
	ll sm = 1;
	int p = 0;
	for (int i = 1; i <= n + 1; i++) {
		while (p < l[i]) {
			sm -= an[p++];
			sm %= MOD;
			if (sm < 0) sm += MOD;
		}
		an[i] = sm;
		sm = (sm + an[i]) % MOD;
	}

	cout << an[n + 1] << endl;
	return 0;
}

Measured memory_bytes: 8064
#include <iostream>
#include <vector>
#include <set>
#include <string>
#include <algorithm>
#include <math.h>
typedef long long ll;
using namespace std;

int main()
{
	int a, b;
	cin >> a >> b;
	if (b >= a) cout << a;
	else cout << a - 1;
}

Measured memory_bytes: 256
using System;

namespace abc_053_b
{
    class Program
    {
        static void Main(string[] args)
        {
            long a1 = -123232;
            string a = Console.ReadLine();
            for (long i = 0; i < a.Length; i++)
            {
                if (a.Substring((int)i, 1) == "A") { a1 = i-1; break; }
            }
            for (long i = a.Length; i > 0; i--)
            {
                if (a1 >=-1 && a.Substring((int)i - 1, 1) == "Z") { Console.WriteLine(i - a1-1); break; }

            }
            Console.ReadLine();
        }
    }
}


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

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

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

  map<string, int> mp;
  rep(i, n) {
    sort(s[i].begin(), s[i].end());
    mp[s[i]]++;
  }

  ll ans = 0;
  for (auto& p : mp) {
    int cnt = p.second;
    ans += (ll)cnt * (cnt - 1) / 2;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 18176
from collections import defaultdict

N,K,L=map(int,input().split())

class UnionFind(object):
  def __init__(self,n):
    self.table=[-1]*n
 
  def find(self,x):
    parent=self.table[x]
    if parent<0:
      return x
    else:
      root=self.find(parent)
      self.table[x]=root
      return root
 
  def union(self,a,b):
    root1=self.find(a)
    root2=self.find(b)
    if root1 != root2:
      if self.table[root1] != self.table[root2]:
        if self.table[root1] < self.table[root2]:
          self.table[root2]=root1
        else:
          self.table[root1]=root2
      else:
        self.table[root1]+=(-1)
        self.table[root2]=root1
      
ufK=UnionFind(N)
for i in range(K):
  p,q=map(int,input().split())
  ufK.union(p-1,q-1)

ufL=UnionFind(N)
for i in range(L):
  p,q=map(int,input().split())
  ufL.union(p-1,q-1)

KL=defaultdict(int)
ans=[]
for i in range(N):
  a=ufK.find(i)
  b=ufL.find(i)
  KL[(a,b)]+=1
for i in range(N):
  a=ufK.find(i)
  b=ufL.find(i)
  ans.append(KL[(a,b)])
  
print(*ans)


Measured memory_bytes: 41696
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <time.h>
#define ll long long
#define double long double
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl;
#define COYE cout<<"YES"<<endl;
#define COYe cout<<"Yes"<<endl;
#define COye cout<<"yes"<<endl;
#define CONO cout<<"NO"<<endl;
#define CONo cout<<"No"<<endl;
#define COno cout<<"no"<<endl;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define ALL(V) ((V).begin(),(V).end())
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define INF ((1LaL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MAX 5100000
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
using namespace std;

int main(){
  string S,T;
  cin>>S>>T;
  
  bool CAN=true;
  
  REP(i,S.size()){
    if(S.at(i)!=T.at(i)) CAN=false;
  }
  
  if(CAN) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 3624
class DiGraph:
    def __init__(self, n):
        self.n = n
        self.graph = [[] for _ in range(n)]
        self.rev = [[] for _ in range(n)]
        self.deg = [0 for _ in range(n)]

    def add_edge(self, fr, to):
        self.graph[fr].append(to)
        self.rev[to].append(fr)
        self.deg[to] += 1

    def scc_ids(self):
        group = [None for _ in range(self.n)]
        used = [0 for _ in range(self.n)]
        order = []
        for s in range(self.n):
            if not used[s]:
                stack = [s]
                used[s] = 1
                while stack:
                    node = stack.pop()
                    movable = False
                    for adj in self.graph[node]:
                        if not used[adj]:
                            movable = True
                            used[adj] = 1
                            stack.append(node)
                            stack.append(adj)
                            break
                    if not movable:
                        order.append(node)
        used = [0 for _ in range(self.n)]
        count = 0
        for s in order[::-1]:
            if not used[s]:
                stack = [s]
                group[s] = count
                while stack:
                    node = stack.pop()
                    used[node] = 1
                    for adj in self.rev[node]:
                        if not used[adj]:
                            group[adj] = count
                            stack.append(adj)
                count += 1
        return group, count


class TwoSAT:
    def __init__(self, n):
        self.n = n
        self.res = [0] * self.n
        self.scc = DiGraph(2 * n)

    def add_clause(self, i: int, f: bool, j: int, g: bool):  # (x_i = f) V (x_j = g)
        self.scc.add_edge(2 * i + (not f), 2 * j + g)
        self.scc.add_edge(2 * j + (not g), 2 * i + f)

    def satisfiable(self):
        group, cnt = self.scc.scc_ids()
        for i in range(self.n):
            if group[2 * i] == group[2 * i + 1]:
                return False
            self.res[i] = (group[2 * i] > group[2 * i + 1])
        return True

    def result(self):
        return self.res


N, D = map(int, input().split())
XY = [tuple(map(int, input().split())) for _ in range(N)]

ts = TwoSAT(N)

for i in range(N-1):
    x1, y1 = XY[i][0], XY[i][1]
    for j in range(i+1, N):
        x2, y2 = XY[j][0], XY[j][1]

        if abs(x1 - x2) < D:
            ts.add_clause(i, True, j, True)
        if abs(x1 - y2) < D:
            ts.add_clause(i, True, j, False)
        if abs(y1 - x2) < D:
            ts.add_clause(i, False, j, True)
        if abs(y1 - y2) < D:
            ts.add_clause(i, False, j, False)

if ts.satisfiable():
    print('Yes')
    res = ts.result()
    for i in range(N):
        print(XY[i][0 if res[i] else 1])
else:
    print('No')


Measured memory_bytes: 70456
from fractions import gcd
a, b, c, d = map(int, input().split())
cnt = 0
def lcm(x, y):
	return (x*y) // gcd(x,y)
e = lcm(c,d)
x = b//c + b//d - b//e
y = (a-1)//c + (a-1)//d - (a-1)//e
print (b-a+1-(x-y))


Measured memory_bytes: 5048
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())//vectorの降順ソート
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;
typedef tuple<ll, ll, ll> T;

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


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    int n,R=0,B=0;
    cin>>n>>s;
    REP(i,n){
        if(s[i]=='R')R++;
        else B++;
    }
    if(R>B) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

}


Measured memory_bytes: 256
a = input()
n = int(input())

hanten = -1
atama = ""
oshiri = ""
for i in range(n):
    List = list(input().split())
    if List[0] == "1":
        hanten = hanten * -1
    else:
        if List[1] == "1":
            if hanten == -1:
                atama = List[2] + atama
            else:
                oshiri = oshiri + List[2]
        else:
            if hanten == -1:
                oshiri = oshiri + List[2]
            else:
                atama = List[2] + atama

ans = atama + a + oshiri
if hanten == 1:
    ans = ans[::-1]

print(ans)

Measured memory_bytes: 4436
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define mp make_pair
#define fs first
#define fst first
#define sc second
#define snd second
#define sz(fst) (int)(fst).size()
#define forn(i, n) for (ll i = 0; i < ll(n); i++)
#define fornr(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define forab(i, a, b) for(int i = int(a); i < int(b); i++)
#define all(fst) fst.begin(), fst.end()

typedef long long ll;
typedef pair<int, int> pii;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef double dbl;
typedef long double ld;
typedef vector<int> vi;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll a, b, k;
    cin >> a >> b >> k;
    ll d = min(a, k);
    a -= d, k -= d;
    b -= min(b, k);
    cout << a << " " << b << "\n";
}

Measured memory_bytes: 256
n=int(input())
ans=0
a=0;b=0;ab=0
for i in range(n):
  s=input()
  ans+=s.count("AB")
  if s[0]=="B":
    b+=1
    if s[-1]=="A":
      ab+=1
      b-=1
  elif s[-1]=="A":
    a+=1
if a+b==0:
    print(ans+max(ab-1,0))
else:
    print(ans+min(a,b)+ab)


Measured memory_bytes: 44264
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define allin(a , x) for(auto a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<ll> vl;
typedef vector<pii> vpi;
typedef pair<ll,ll> pll;
typedef vector<string> vs;
typedef vector<pll> vpl;
typedef vector<int> vi;
template<class T1, class T2>
istream &operator>>(istream &in, pair<T1, T2> &P){
    in >> P.first >> P.second;
    return in;
}
template<class T1, class T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &P){
    out << "(" << P.first << ", " << P.second << ")";
    return out;
}
template<class T>
istream &operator>>(istream &in, vector<T> &arr){
    for(auto &x: arr) in >> x;
    return in;
}
template<class T>
ostream &operator<<(ostream &out, const vector<T> &arr){
    for(auto &x: arr) out << x << ' '; cout << "\n";
    return out;
}
template<class T>
istream &operator>>(istream &in, deque<T> &arr){
    for(auto &x: arr) in >> x;
    return in;
}
template<class T>
ostream &operator<<(ostream &out, const deque<T> &arr){
    for(auto &x: arr) out << x << ' '; cout << "\n";
    return out;
}
int32_t main(){
	char c;
	cin>>c;
	c++;
	cout<<c;	
}

Measured memory_bytes: 764
import java.util.*;

public class Main {

    long INF = Long.MAX_VALUE;
    long[][] dp;

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

    void solve() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long[] v = new long[N];
        for(int i= 0;i<N;i++){
            v[i] = sc.nextLong();
        }
        Arrays.sort(v);
        double ans = v[0];
        for(int i= 1;i<N;i++){
            ans = (ans+v[i])/2;
        }
        System.out.println(ans);
    }

}


Measured memory_bytes: 22996
#include <iostream>
#include <vector>

using namespace std;

class Edge {
public:
    int from, to, weight;
    Edge(int f, int t, int w) : from(f), to(t), weight(w) {}
};

int memo[100001] = {0};

inline int height(vector<vector<Edge>> &Graph, int parent) {
    if (memo[parent]) return memo[parent];
    int ret = 0;
    for (int i=0; i<(int)Graph[parent].size(); ++i) {
        ret = max(ret, Graph[parent][i].weight + height(Graph, Graph[parent][i].to));
    }
    return memo[parent] = ret;
}

inline int diameter(vector<vector<Edge>> &Graph, int parent) {
    int ret = 0;
    int h1 = 0, h2 = 0;
    for (int i=0; i<(int)Graph[parent].size(); ++i) {
        int h = Graph[parent][i].weight + height(Graph, Graph[parent][i].to);
        if (h1 < h) {
            h2 = h1;
            h1 = h;
        } else if (h2 < h) {
            h2 = h;
        }
        ret = max(ret, diameter(Graph, Graph[parent][i].to));
    }
    ret = max(ret, h1 + h2);
    return ret;
}

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

    int n, s, t, w;
    cin >> n;
    vector<vector<Edge>> Graph(n + 1);
    for (int i=1; i<=n-1; ++i) {
        cin >> s >> t >> w;
        Graph[s].push_back(Edge(s, t, w));
    }
    cout << diameter(Graph, 0) << endl;

    return 0;
}

Measured memory_bytes: 12748
#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n,l;
	cin>>n>>l;
	vector<int> a;
	int sum=0;
	for(int i=1;i<=n;i++)
	{
		a.push_back(abs(l+i-1));
	}
	vector<int> b=a;
	sort(a.begin(),a.end());
	int e=a[0];
	int x;
	for(int i=0;i<n;i++)
	{
		if(e==b[i])
		{
			x=i+1;
		}
	}
	for(int i=1;i<=n;i++)
	{
		if(x!=i)
		{
			sum+=(l+i-1);
		}
	}
	cout<<sum<<endl;
	
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;

class Myon
{
    public Myon() { }
    public static int Main()
    {
        cin = new Scanner();
        new Myon().calc();
        return 0;
    }

    static Scanner cin;

    // メンバ変数---
    long N;
    // -------------

    void calc()
    {
        N = cin.nextInt();
        long ret = ((N-1)*N)/2;
        write(ret);
    }

    void write(string v)
    {
        Console.WriteLine(v);
    }

    void write(int v)
    {
        Console.WriteLine(v);
    }

    void write(double v)
    {
        Console.WriteLine(v);
    }
    void write(long v)
    {
        Console.WriteLine(v);
    }

    int Pow(int x, int y)
    {
        return (int)Math.Pow(double.Parse(x.ToString()), double.Parse(y.ToString()));
    }

    double Pow(double x, double y)
    {
        return Math.Pow(x, y);
    }

    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return next();
            i = 0;
            return s[i++];
        }

        public int nextInt()
        {
            return int.Parse(next());
        }
        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt() + add;
            }
            return Array;
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong() + add;
            }
            return Array;
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }


        public double[] ArrayDouble(int N, double add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextDouble() + add;
            }
            return Array;
        }
    }
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MAXN 2001
#define rep(i,n) for (int i = 0; i < (n); ++i)
const ll mod = 1000000007;


int main() {
    ll n, k;
    cin >> n >> k;
    vector<int> A(n);

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


    int cnt_iso=0, cnt_rel=0;

    rep(i, n) {
        for(int j=i+1; j<n; ++j) {
            if(A[i] > A[j]) ++cnt_iso;
        }
    }

    rep(i, n) {
        for(int j=0; j<n; ++j) {
            if(A[i] > A[j]) ++cnt_rel;
        }
    }

    ll ans = 0;
    if (k>1) {
        ans += (k * cnt_iso) % mod;
        ll K = (k*(k-1))/2;
        K %= mod;
        ans += (K * cnt_rel);
        ans %= mod;
    } else {
        ans = cnt_iso;
    }

    cout << ans << endl;

}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb(x) push_back(x)
#define f(i,st,n) for(i=st;i<n;i++)
#define vec vector
#define mst(a,b) memset(a,b,sizeof(a))
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;  
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define mod 1000000007
#define sfl(x) scanf("%lld",&x)
#define pfl(x) printf("%lld\n",x)
#define pf(x) printf("%lld",x)
#define all(v) v.begin(),v.end()
#define mpr make_pair
#define fs first
#define se second
#define inf LLONG_MAX
#define nnf LLONG_MIN
 
 
 
ll gcd(ll a,ll b){
    if(a==0){
        return b;
    }                     
    return gcd(b%a,a);
}
ll power(ll x,ll y){            
    ll res=1;
    while(y>0){
        if(y%2==1){
            res=((res%mod)*(x%mod))%mod;
        }
        x=((x%mod)*(x%mod))%mod;
        y=y/2;
    }
    return res;
}
 
 struct custom_hash {
  static uint64_t splitmix64(uint64_t x) {
    // http://xorshift.di.unimi.it/splitmix64.c
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
  }

  size_t operator()(pair<uint64_t,uint64_t> x) const {
    static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x.first + FIXED_RANDOM)^(splitmix64(x.second + FIXED_RANDOM) >> 1);
  }
};

void get_time(auto start,auto end){
    double time_taken =  
      chrono::duration_cast<chrono::nanoseconds>(end - start).count(); 
  
    time_taken *= 1e-9;
    cout<<"\n";
    cout<<"Time taken : "<<fixed<<time_taken<<setprecision(6);
}

  


int main(){

   ios_base::sync_with_stdio(false);
   cin.tie(NULL);

  auto start = chrono::high_resolution_clock::now();

  
 

/* #ifndef ONLINE_JUDGE
    
   freopen("input.txt", "r", stdin);
   
   freopen("output.txt", "w", stdout);
   #endif*/

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

   vec<int>a(n);

  for(int i=0;i<n;i++){
    cin>>a[i];
  }

  vec<int>dp(k+1,0);

  for(int i=1;i<=k;i++){
    for(auto z:a){
      if(z<=i){
        if(dp[i-z]==0){
          dp[i]=1;
          break;
        }
      }
    }
  }

  if(dp[k]==1)cout<<"First";
  else cout<<"Second";
   
   


   



  auto end = chrono::high_resolution_clock::now();

  /*#ifndef ONLINE_JUDGE

   get_time(start,end); 

  #endif*/

    return 0;
 }

Measured memory_bytes: 3676
#include <bits/stdc++.h>
using namespace std;
long long n,k;

int main(){
  long long i=0,count=0,a,b;

  scanf("%lld%lld",&n,&k);

  if(k==0){
    for(b=1;b<=n;b++)count+=(n/b);
    k=1;//count+=n;
  }
  for(b=2;b<=n;b++){
    if(b>k){
    count += (n/b)*(b-k);

    if(n%b>=k)count += (n%b)-k+1;
    }
  }
  printf("%lld\n",count);
  return 0;
}


Measured memory_bytes: 256
x, n = map(int, input().split())

if n == 0:
    print(x)
else:
    p = list(map(int, input().split()))
    a = []
    for i in range(102):
        if all([j != i for j in p]):
            a.append(i)
    z = x
    ans = 0
    for i in a:
        if z > abs(x-i):
            z = abs(x-i)
            ans = i
    print(ans)

Measured memory_bytes: 9200
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <map>

using namespace std;

string s;

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> s;
    for (int i = 0; i < s.size(); )
    {
    	int j = i, p1 = i;
    	while (j < s.size() && s[j] == 'R') j++;
    	p1 = j - 1;
    	while (j < s.size() && s[j] == 'L') j++;
    	int c1 = p1 - i + 1, c2 = j - p1 - 1;
    	int d1 = c2 / 2 + (c1 + 1) / 2;
    	int d2 = c1 / 2 + (c2 + 1) / 2;
    	for (int k = i; k < p1; k++) cout << "0 ";
    	cout << d1 << " " << d2 << " ";
    	for (int k = p1 + 2; k < j; k++) cout << "0 ";
    	i = j;
    }
    
}


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

int main()
{
    string s;
    cin >> s;
    int sum = 0;
    for (int i = 0; i < s.size(); i++)
    {
        sum += s[i] - '0';
    }
    if (sum % 9 == 0)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3752
'use strict'
function Main(input) {
    input = input.split("\n")[0].split(' ').map(str => parseInt(str))

    const A = input[0]
    const B = input[1]

    let result = 0
    if(A >= 13){
      result = B
    }else if(A >= 6){
      result = B / 2
    }
    
    console.log(result)
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"))

Measured memory_bytes: 22076
#include <iostream>

using namespace std;
#define N 32
int i, j, n, curr, mx, v[N], b[N];
pair <int, int> a[N][N];

int check (){
    for (int it = 0; it < n; ++it)
    if (b[it]){
        for (int jt = 0; jt < v[it]; ++jt)
            if (b[a[it][jt].first] != a[it][jt].second)
            return 0;
    }
    return 1;
}

int main()
{
    cin >> n;
    for (i = 0; i < n; ++i){
        cin >> v[i];
        for (j = 0; j < v[i]; ++j){
            cin >> a[i][j].first >> a[i][j].second;
            --a[i][j].first;
        }
    }
    mx = 0;
    for (i = 0; i < (1 << n); ++i){
        curr = 0;
        for (j = 0; j < n; ++j){
            b[j] = ((i & (1 << j)) >> j);
            curr += b[j];
        }
        if (curr > mx){
            if (check ())
                mx = curr;
        }
    }
    cout << mx;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;

int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    int n;
    int constexpr N = 100009;
    vector<pair<int, int>> f[2] = {vector<pair<int, int>>(N), vector<pair<int, int>>(N)};
    for(int i = 0; i < N; ++i) f[0][i] = f[1][i] = {0, i};
    cin >> n;
    for(int i = 0, e; i < n; ++i) {
        cin >> e;
        f[i % 2][e].fi += 1;
    }
    sort(f[0].rbegin(), f[0].rend());
    sort(f[1].rbegin(), f[1].rend());
    if(f[0][0].se != f[1][0].se) cout << n - f[0][0].fi - f[1][0].fi << endl;
    else cout << min(n - f[0][0].fi - f[1][1].fi, n - f[0][1].fi - f[1][0].fi) << endl;
}

Measured memory_bytes: 1792
#include<stdio.h>
 
#define MAX 300
 
int main() {
    
    int h[MAX], w[MAX];
    int i = 0, j, a, b; 
     
    
    while(1) {
        scanf("%d %d", &h[i], &w[i]);
        if (h[i] == 0 && w[i] == 0) { 
            break; 
        }
        i++; 
    }
     
    for (j=0; j<i; j++) {
        for (a=0; a<h[j]; a++) {
            for (b=0; b<w[j]; b++) {
                printf("#");
            }
            printf("\n");
        }
        printf("\n");
    }
     
    
     
    return 0;
}



Measured memory_bytes: 2064
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
string s;
main()
{
	while(cin>>s,s!="#")
	{
		vector<string>ans;
		for(int i=0;i<1<<s.size();i++)
		{
			string t=s;
			int ap=0;
			bool flag=1;
			for(int j=0;flag&&j<s.size();j++)
			{
				if(i>>j&1&&s[j]<'z')t[j]++;
				if(t[j]>'a'&&~ap&1<<t[j]-'a')
				{
					ap|=1<<t[j]-'a';
					flag&=s[j]==t[j]-1;
				}
				else
				{
					flag&=s[j]==t[j];
				}
			}
			if(flag)ans.push_back(t);
		}
		sort(ans.begin(),ans.end());
		ans.erase(unique(ans.begin(),ans.end()),ans.end());
		cout<<ans.size()<<endl;
		if(ans.size()<=10)
		{
			for(string t:ans)cout<<t<<endl;
		}
		else
		{
			for(int i=0;i<5;i++)cout<<ans[i]<<endl;
			for(int i=5;i;i--)cout<<ans[ans.size()-i]<<endl;
		}
	}
}



Measured memory_bytes: 4068
#include <bits/stdc++.h>
#define f first
#define s second
#define INF 1e9
using namespace std;
typedef pair <double,int> P;
vector <P> G[10001];
 
int used[10001];
double prim(int start){
  double res=0;
  priority_queue <P> Q;
  Q.push(P(0,start));
  while(!Q.empty()){
    P t=Q.top();Q.pop();
    double cost=t.f;
    int pos=t.s;
    if(used[pos])continue;
    used[pos]=1;
    res+=cost;
    for(int i=0;i<G[pos].size();i++)Q.push(P(G[pos][i]));
    }
  return res;
}
 
int main(){
  int n,m;
  cin>>n>>m;
  complex <double>  p[10001];
  for(int i=0,a,b;i<n;i++)cin>>a>>b,p[i].real()=a,p[i].imag()=b;
 
  double sum=0;
  for(int i=0,a,b;i<m;i++){
    cin>>a>>b;
    a--,b--;
    G[a].push_back(P(abs(p[a]-p[b]),b));
    G[b].push_back(P(abs(p[a]-p[b]),a));
    sum+=abs(p[a]-p[b]);
  }
 
  double ans=0;
  for(int i=0;i<n;i++) if(!used[i]) ans+=prim(i);
  printf("%f\n",sum-ans);
  return 0;
}

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

int p[1 << 26], c[200009], a[26]; string S;

int main() {
	cin >> S;
	for (int i = 0; i < S.size(); i++) {
		a[S[i] - 'a'] ^= 1;
		for (int j = 0; j < 26; j++) c[i + 1] += (a[j] << j);
	}
	for (int i = 0; i < (1 << 26); i++) p[i] = (1 << 30);
	p[0] = 0;
	for (int i = 1; i <= S.size(); i++) {
		for (int j = 0; j < 26; j++) {
			int T = c[i];
			if ((c[i] / (1 << j)) % 2 == 0) T += (1 << j);
			else T -= (1 << j);
			p[c[i]] = min(p[c[i]], p[T] + 1);
		}
	}
	cout << max(1, p[c[S.size()]]) << endl;
	return 0;
}

Measured memory_bytes: 263556
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define PI pair<int,int>
#define ff first
#define ss second
#define endl '\n'
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL)
//#include "debug.cpp"
const int inf=1e9;
const int M=1e9+7;


int32_t main()
{
    boost;
	string s;
	cin>>s;
	for(int i=0;i<s.size();i++)
		cout<<"x";
	cout<<endl;	
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  #define int long
  int N,A,B,C,res=INT_MAX;
  cin>>N>>A>>B>>C;
  vector<int> l(N);
  for(int i=0;i<N;++i)cin>>l[i];
  
  int a,b,c;
  vector<int> m(3);
  for(int i=0;i<pow(4,N);++i){
    a=b=c=m[0]=m[1]=m[2]=0;
    for(int j=0;j<N;++j){
      switch((int)(i/pow(4,j))%4){
        case 0:
          a+=l[j];
          m[0]++;
          break;
        case 1:
          b+=l[j];
          m[1]++;
          break;
        case 2:
          c+=l[j];
          m[2]++;
        case 3:
        default:
          break;
      }
    }
    if(!(m[0]*m[1]*m[2]))continue;
    int res_t = labs(a-A)+labs(b-B)+labs(c-C)+10*(m[0]+m[1]+m[2]-3+(!m[0]+!m[1]+!m[2]));
    if(res_t<res){
      for(int k=0;k<N;++k)cerr<<"a,b,c: "<<a<<" "<<b<<" "<<c<<" m:"<<m[0]+m[1]+m[2]-3+(!m[0]+!m[1]+!m[2])<<" dif:"<<labs(a-A)+labs(b-B)+labs(c-C)<<"\n";
    }
    res=min(res,res_t);
  }
  cout<<res;
  return 0;
}

Measured memory_bytes: 256