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

using ll = long long;
using vint = vector<int>;
using vvint = vector<vint>;
using pint = pair<int, int>;
using vpint = vector<pint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
#define repi(n) for (int i = 0; i < n; i++)
#define repj(n) for (int j = 0; j < n; j++)
#define repk(n) for (int k = 0; j < n; k++)
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, a, b) for (auto i = a; i < b; i++)
#define repv(itr) for (auto&& v : itr)
#define swap(x, y)    \
  {                   \
    auto ___temp = x; \
    x = y;            \
    y = ___temp;      \
  }

const int dx[] = {-1, 0, 0, 1, -1, -1, 1, 1};
const int dy[] = {0, -1, 1, 0, -1, 1, -1, 1};
template <typename T>
T minptr(T begin, T end) {
  T re = begin;
  for (T i = begin + 1; i != end; i++) {
    if (*i < *re) re = i;
  }
  return re;
}
template <typename T>
T maxptr(T begin, T end) {
  T re = begin;
  for (T i = begin + 1; i != end; i++) {
    if (*i > *re) re = i;
  }
  return re;
}
int __vmax(int x) {
  return INT_MAX;
}
double __vmax(double x) {
  return 1e+300;
}
ll __vmax(ll x) {
  return LLONG_MAX;
}
int __vmin(int x) {
  return INT_MIN;
}
double __vmin(double x) {
  return -1e+300;
}
ll __vmin(ll x) {
  return LLONG_MIN;
}
template <typename T>
vector<T> lis(T begin, T end, bool allowequal = false, bool lds = false) {
  using V = typename iterator_traits<T>::value_type;
  int n = end - begin;
  vector<V> a(n, lds ? __vmin(*begin) : __vmax(*begin));
  vector<int> id(n);
  if (lds && allowequal) {
    for (int i = 0; i < n; i++) {
      id[i] = n - 1 -
              (lower_bound(a.rbegin(), a.rend(), begin[i]) - 1 - a.rbegin());
      a[id[i]] = begin[i];
    }
  } else if (lds) {
    for (int i = 0; i < n; i++) {
      id[i] = n - 1 -
              (upper_bound(a.rbegin(), a.rend(), begin[i]) - 1 - a.rbegin());
      a[id[i]] = begin[i];
    }
  } else if (allowequal) {
    for (int i = 0; i < n; i++) {
      id[i] = upper_bound(a.begin(), a.end(), begin[i]) - a.begin();
      a[id[i]] = begin[i];
    }
  } else {
    for (int i = 0; i < n; i++) {
      id[i] = lower_bound(a.begin(), a.end(), begin[i]) - a.begin();
      a[id[i]] = begin[i];
    }
  }
  int m = *maxptr(id.begin(), id.end());
  vector<T> re(m + 1);
  for (int i = n - 1; i >= 0; i--) {
    if (id[i] == m) re[m--] = begin + i;
  }
  return re;
}
template <typename T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}

int main() {
  int a, b, k;
  cin >> a >> b >> k;
  vint x;
  repi(min(a, b) + 1) {
    if (!i) continue;
    if (a % i == 0 && b % i == 0) x.push_back(i);
  }
  sort(x.begin(), x.end(), greater<int>());
  cout << x[k - 1] << endl;
}


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

int main(void)
{
	char s[1001];
	int i,a[4]={0},ns=0,we=0;
	scanf("%s",s);
	for(i=0;i<strlen(s);i++){
		if(s[i]=='N')a[0]++;
		else if(s[i]=='W')a[1]++;
		else if(s[i]=='S')a[2]++;
		else a[3]++;
	}
	for(i=0;i<4;i+=2)if(a[i]>0)ns++;
	for(i=1;i<4;i+=2)if(a[i]>0)we++;
	puts(ns%2||we%2?"No":"Yes");
	return 0;
}

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

int main() {
	string a, b; cin >> a >> b;
	if (a == "H") {
		cout << b << endl;
	} else {
		if (b == "H") {
			cout << "D" << endl;
		} else {
			cout << "H" << endl;
		}
	}
	return 0;
}

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

using namespace std;

#define loop(i, n) for(int i = 0;i < int(n);i++)
#define rloop(i, n) for(int i = int(n);i >= 0;i--)
#define range(i, a, b) for(int i = int(a);i <= int(b);i++)
#define SZ(c) int(c.size())
#define ALL(c) c.begin(), c.end()
#define RALL(c) c.rbegin(), c.rend()
#define PI acos(-1)
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define sfi1(v) scanf("%d",&v)
#define sfi2(v1, v2) scanf("%d %d",&v1,&v2)
#define sfi3(v1, v2, v3) scanf("%d %d %d",&v1,&v2,&v3)
#define sfll1(v) scanf("%I64d",&v);
#define sfll2(v1, v2) scanf("%I64d %I64d",&v1,&v2)
#define sfll3(v1, v2, v3) scanf("%I64d %I64d %I64d",&v1,&v2,&v3)
#define endl '\n'

typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
typedef long long ll;
typedef pair<int, int> pii;

const int N = 3e7;
char pat[N], str[N];
int f[N];

int PF(int len, char c) {
    while (len && pat[len] != c)
        len = f[len - 1];
    if (pat[len] == c)
        len++;
    return len;
}

void computeF() {
    f[0] = 0;
    int len = 0;
    if (*pat) {
        for (int i = 1; pat[i]; i++) {
            len = PF(len, pat[i]);
            f[i] = len;
        }
    }
}

vector<int> match() {
    vector<int> ind;
    int len = 0;
    for (int i = 0; str[i]; i++) {
        len = PF(len, str[i]);
        if (!pat[len])
            ind.push_back(i - len + 1), len = f[len - 1];
    }
    return ind;
}

int solve(const vi &v, int len, int c) {
    int ret = 0;
    vi good(c);
    rloop(i, SZ(v) - 1) {
        int cur = 1;
        if (v[i] + len < c)cur = good[v[i] + len] + 1;
        good[v[i]] = cur;
        ret = max(ret, cur);
    }
    return ret;
}

int main() {

#ifndef ONLINE_JUDGE
    //freopen("in.in", "r", stdin);
    //freopen("out.in", "w", stdout);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    string s, t;
    cin >> s >> t;
    while (SZ(s) < SZ(t))s += s;
    s += s;
    s += s;

    strcpy(str, s.c_str());
    strcpy(pat, t.c_str());
    computeF();
    vi cur = match();
    int best = solve(cur, SZ(t), SZ(s));

    s += s;
    s += s;
    strcpy(str, s.c_str());
    computeF();
    cur = match();
    if (solve(cur, SZ(t), SZ(s)) > best) {
        cout << -1 << endl;
    } else {
        cout << best << endl;
    }

    return 0;
}


Measured memory_bytes: 176420
import java.util.*;

public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		sc.close();
		int x = 0;
		int min = 753;
		for(i=0;i<s.length()-2;i++) {
			x=Math.abs(753-Integer.parseInt(s.substring(i,i+3)));
			if(x<min)min=x;
		}
		System.out.println(min);
	}
}


Measured memory_bytes: 21844
#include <iostream>
using namespace std;
int main(void){
    int a,b,c;
    cin>>a>>b>>c;
    if(a>b){swap(a,b);}
    if(a>c){swap(a,c);}
    if(c<b){swap(b,c);}
    if(a>b){swap(a,b);}
    cout<<a<<" "<<b<<" "<<c<<endl;
}



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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int n;
	cin>>n;
	map<int,int>m;
	for(int i=2,x;i<=n;++i){
		x=i;
		for(int j=2;j<=x;++j){
			while(x%j==0){
				++m[j];
				x/=j;
			}
		}
	}
	int ans=1,mod=1e9+7;
	for(auto&i:m){
		ans=(long)ans*(i.second+1)%mod;
	}
	cout<<ans<<"\n"s;
}

Measured memory_bytes: 256
from datetime import datetime as dt

def main():
    S = input()
    isYYMM = False
    isMMYY = False
    try:
        dt.strptime(S, '%y%m')
        isYYMM = True
    except ValueError:
        pass
    try:
        dt.strptime(S, '%m%y')
        isMMYY = True
    except ValueError:
        pass

    if isYYMM and isMMYY:
        print('AMBIGUOUS')
    elif isYYMM:
        print('YYMM')
    elif isMMYY:
        print('MMYY')
    else:
        print('NA')


main()


Measured memory_bytes: 4424
#include<stdio.h>
int main()
{
	int n, a, b, c, i;
	scanf("%d", &n);
	if (n == 2){
		scanf("%d %d", &a, &b);
		for (i = 1; i <= a || i <= b; i++){
			if (a%i == 0 && b%i == 0)
				printf("%d\n", i);
		}
	}
	else{
		scanf("%d %d %d", &a, &b, &c);
		for (i = 1; i <= a || i <= b ||i <= c; i++){
			if (a%i == 0 && b%i == 0 && c%i == 0)
				printf("%d\n", i);
		}
	}
	return 0;
}

Measured memory_bytes: 1024
/***********************
*  Author: xuziyuan    * 
***********************/

#include <bits/stdc++.h>

#define rt0 return 0
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define replet(c) for(char c='a';c<='z';c++)
#define LL long long
#define pii pair <int,int>
#define pb push_back
#define fi first
#define se second
#define mpr make_pair
#define sqr(a) ((a)*(a))

using namespace std;

const LL MOD=1e9+7; 

LL a,b,c;

int main()
{
	cin>>a>>b>>c;
	LL ans=0;
	ans+=min(a+b+1,c);
	ans+=b;
	cout<<ans<<endl;
	rt0;
}

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

struct UnionFind {
  vector<int> r;

  UnionFind(int N) {
    r = vector<int>(N, -1);
  }

  int getRoot(int x) {
    if (r[x] < 0) return x;
    return r[x] = getRoot(r[x]);
  }

  void unite(int x, int y) {
    int rx = getRoot(x);
    int ry = getRoot(y);
    if (rx == ry) return;

    r[rx] += r[ry];
    r[ry] = rx;
  }

  int size(int x) {
    return -r[getRoot(x)];
  }
};

int main() {
  int N,M,a,b,i,ans=0;
  cin>>N>>M;
  UnionFind UF(N);
  for (i=0;i<M;i++) {
    cin>>a>>b;
    UF.unite(a-1, b-1);
  }
  for (i=0;i<N;i++) {
    ans = max(ans, UF.size(i));
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 4100
#include <bits/stdc++.h>
using namespace std ;
#define An setprecision(16) 
int main(){
    int N;
    cin >> N;
    string S[N];
    for(int i=0;i<N;i++)cin >> S[i];
    sort(S,S+N);
    int count=1;
    for(int i=0;i<N-1;i++){
        if(S[i]!=S[i+1])count++;
    }
    cout << count << endl;
}

Measured memory_bytes: 9836
import fractions
 
n = int(input())
li = list(map(int,input().split()))
 
leftgcd = [0 for i in range(n)]
rightgcd = [0 for i in range(n)]
 
leftgcd[0] = li[0]
rightgcd[n - 1] = li[n - 1]
 
if n == 2:
  print(max(li[0], li[1]))
else:
  for j in range(1, n):
    leftgcd[j] = fractions.gcd(li[j], leftgcd[j - 1])
    rightgcd[n - 1 - j] = fractions.gcd(li[n - 1 - j], rightgcd[n - j])
 
  ans = max(leftgcd[n - 2], rightgcd[1])
  for k in range(1, n - 1):
    g = fractions.gcd(leftgcd[k - 1], rightgcd[k + 1])
    if g > ans:
      ans = g
  print(ans)

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

int main(){
	int x,m,ans=0;
	string s,str="";
	cin>>x;
	if(x<=599)
	cout<<"8"<<endl;
	else if(x<=799)
	cout<<"7"<<endl;
	else if(x<=999)
	cout<<"6"<<endl;
	else if(x<=1199)
	cout<<"5"<<endl;
	else if(x<=1399)
	cout<<"4"<<endl;
	else if(x<=1599)
	cout<<"3"<<endl;
	else if(x<=1799)
	cout<<"2"<<endl;
	else
	cout<<"1"<<endl;
	
	
}

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

const int vmax=1000010;
const int inf=1023456789;

int n,m;

struct node{int to,cost;};
vector<node> graph[vmax];

typedef tuple<int,int> state;
int dist[vmax];

void dijkstra(int n,int s){
	rep(i,n)dist[i]=inf;
	dist[s]=0;
	priority_queue<state,vector<state>,greater<state>> q;
	q.push(state(0,s));
	while(!q.empty()){
		int c,v;tie(c,v)=q.top();q.pop();
		for(auto &e:graph[v]){
			int nc=c+e.cost;
			int nv=e.to;
			if(dist[nv]>nc){
				dist[nv]=nc;
				q.push(state(nc,nv));
			}
		}
	}
	return;
}


const int mmax=20010;
int u[mmax],v[mmax],d[mmax],c[mmax];
int cmin[vmax];

int main(void){
	while(cin >> n >> m,n){
		rep(i,vmax) graph[i].clear(),cmin[i]=inf;

		rep(i,m) cin >> u[i] >> v[i] >> d[i] >> c[i],u[i]--,v[i]--;

		rep(i,m){
			graph[u[i]].push_back({v[i],d[i]});
			graph[v[i]].push_back({u[i],d[i]});
		}
		dijkstra(n,0);
		int ans=0;

		cmin[0]=0;
		rep(i,m){
			if(dist[v[i]]+d[i]==dist[u[i]])
				cmin[u[i]]=min(cmin[u[i]],c[i]);
			if(dist[u[i]]+d[i]==dist[v[i]])
				cmin[v[i]]=min(cmin[v[i]],c[i]);
		}
		rep(i,n) ans+=cmin[i];
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 34092
#include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>

#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,b,n) for(int i=b;i<n;i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;

const int INF=1<<29;
const double EPS=1e-9;

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

int main(){
	int n;
	int q;
	cin>>n;
	int A[20];
	rep(i,n){
		cin>>A[i];
	}
	sort(A,A+n);
	cin>>q;
	int M[200];
	rep(i,q){
		cin>>M[i];
	}
	int sum;
	bool flag[200] ={false};
	rep(i,1<<n){
		sum = 0;

		rep(j,n){
			if((i&(1<<j))){
				sum +=A[j];
				rep(k,q){
					if(flag[k])continue;
					if(sum==M[k]){
						flag[k] = true;
					}
				}
			}
		}
	}
	rep(i,q){
		if(flag[i]){
			cout <<"yes"<<endl;
		}else
			cout <<"no"<<endl;
	}
	return 0;
}

Measured memory_bytes: 1168
// clang-format off
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979;
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
bool odd(const int &n) { return n & 1; }
bool even(const int &n) { return ~n & 1; }
template<typename T> int len(const T &v) { return v.size(); }
template<typename T = int> T in() { T x; cin >> x; return x; }
template<typename T = int> T in(T &&x) { T z(forward<T>(x)); cin >> z; return z; }
template<typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &x : v) is >> x; return is; }
template<typename A, typename B> istream &operator>>(istream &is, pair<A, B> &p) { return is >> p.first >> p.second; }
template<typename T> ostream &operator<<(ostream &os, const vector<vector<T>> &v) { int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "" : "\n"); return os; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "" : " "); return os; }
template<typename A, typename B> ostream &operator<<(ostream &os, const pair<A, B> &p) { return os << p.first << ' ' << p.second; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
// clang-format on

main() {
  int n = in();
  vector<int> a(n);
  iota(all(a), 1);
  do { cout << a << endl; } while (next_permutation(all(a)));
}



Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << endl;
#define CFYN(n) cout << ( (n) ? "YES":"NO") << endl;
using ll = long long;
using ull = unsigned long long;

int main(void)
{
    IOS
    int n; cin >> n;
    cout << n * n * n << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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

using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1LL << 60;
#define int long long

const int MAX_N = 100010;


signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n;
	string s; cin >> s;
	if (n % 2 != 0) {
		cout << "No" << endl; return 0;
	}
	string tmp;
	for (int i = 0; i < n / 2; i++) {
		tmp += s[i];
	}
	string tmp2;
	for (int i = n / 2; i < n; i++) {
		tmp2 += s[i];
	}
	if (tmp == tmp2)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
    #define rep(i,n) for (int i = 0; i< (n); i++)
    using ll = long long;
    using namespace std;
     
    int main(void){
    	string a, b;
    	cin >> a >> b;
    	int n = stoi(a+b);
    	int k = 1;
    	while (k*k<=n){
    		if (k*k == n) {
    			cout << "Yes" << endl;
    			return 0;
    		}
    		k++;
    	}
    	cout << "No" << endl;
    	return 0;
    }

Measured memory_bytes: 3616
#include <algorithm>
#include <complex>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <thread>
#include <tuple>
#include <type_traits>
#include <vector>


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

using namespace std;
using ll = long long;

int main() {
    ios::sync_with_stdio(false);
    int n;
    int ac = 0;
    int wa = 0;
    int tle = 0;
    int re = 0;
    string s;

    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> s;
        if (s == "AC")
            ac++;
        else if (s == "WA")
            wa++;
        else if (s == "TLE")
            tle++;
        else
            re++;
    }

    printf("AC x %d\n", ac);
    printf("WA x %d\n", wa);
    printf("TLE x %d\n", tle);
    printf("RE x %d\n", re);
    return 0;
}


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

int main()
{
  uint64_t n, k;
  cin >> n >> k;
  uint bc[64] {};
  vector<uint64_t> a(n);
  for (auto i = 0; i < n; i++) {
    uint64_t x;
    cin >> x;
    a[i] = x;
    for (auto b = 0; b < 64; b++) {
      bc[b] += x & 1;
      x >>= 1;
    }
  }
  uint64_t v{0};
  for (auto s = 63; s >= 0; s--) {
    uint64_t u = 1ULL << s;
    if (v + u <= k && bc[s] * 2 <= n) {
      v += u;
    }
  }
  uint64_t ans{0};
  for (auto i = 0; i < n; i++) {
    ans += v ^ a[i];
  }
  cout << ans << endl;
}


Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
#define vi vector<int>
#define IP pair<int,P>
#define PI pair<P,int>
#define PP pair<P,P>
#define Yes(f){cout<<(f?"Yes":"No")<<endl;}
#define YES(f){cout<<(f?"YES":"NO")<<endl;}
int Madd(int x,int y) {return (x+y)%M;}
int Msub(int x,int y) {return (x-y+M)%M;}
int Mmul(int x,int y) {return (x*y)%M;}


bool is_prime(int x){
  if(x<2) return false;
  for(int i=2;i*i<=x;i++){
    if(x%i==0) return false;
  }
  return true;
}

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);


  int n;
  cin>>n;
  int ans=0;
  rep(_,n){
    int a;
    cin>>a;
    ans+=is_prime(a);
  }
  cout<<ans<<endl;

}


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

int main(void) {
    int64_t N;
    int64_t P;
    int64_t chk = LONG_MAX;
    int64_t cnt = 0;
    cin >> N;
    for(int i=1;i<=N;i++) {
        cin >> P;
        if(chk > P) {
            cnt++;
            chk = P;
        }
    }

    cout << cnt << "\n";
    return 0;
}


Measured memory_bytes: 256
#[allow(unused_imports)]
use itertools::Itertools;
#[allow(unused_imports)]
use itertools_num::ItertoolsNum;
#[allow(unused_imports)]
use std::cmp;
#[allow(unused_imports)]
use std::iter;
#[allow(unused_imports)]
use superslice::*;

fn run() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());

    let n: usize = sc.read();
    let a = sc.read_vec::<usize>(n);
    let b = sc.read_vec::<usize>(n);

    let a_sum = a.iter().sum::<usize>();
    let b_sum = b.iter().sum::<usize>();

    if a_sum > b_sum {
        println!("No");
        return;
    }

    let count_a = a
        .iter()
        .zip(b.iter())
        .map(|(&a, &b)| if a > b { 0 } else { (b - a + 1) / 2 })
        .sum::<usize>();
    let count_b = a
        .iter()
        .zip(b.iter())
        .map(|(&a, &b)| if a > b { a - b } else { 0 })
        .sum::<usize>();

    if cmp::max(count_a, 0) <= b_sum - a_sum {
        println!("Yes");
    } else {
        println!("No");
    }
}

fn main() {
    std::thread::Builder::new()
        .name("run".into())
        .stack_size(256 * 1024 * 1024)
        .spawn(run)
        .unwrap()
        .join()
        .unwrap();
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: std::ops::Deref<Target = str>>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn read_pairs<T: std::str::FromStr>(&mut self, n: usize) -> Vec<(T, T)> {
        (0..n).map(|_| (self.read(), self.read())).collect()
    }
    pub fn read_pairs_1_indexed(&mut self, n: usize) -> Vec<(usize, usize)> {
        (0..n)
            .map(|_| (self.read::<usize>() - 1, self.read::<usize>() - 1))
            .collect()
    }
    pub fn read_chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
    pub fn read_char_grid(&mut self, n: usize) -> Vec<Vec<char>> {
        (0..n).map(|_| self.read_chars()).collect()
    }
    pub fn read_matrix<T: std::str::FromStr>(&mut self, n: usize, m: usize) -> Vec<Vec<T>> {
        (0..n)
            .map(|_| (0..m).map(|_| self.read()).collect())
            .collect()
    }
}


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

using namespace std;
using ll = long long;

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

	int n, m;
	string s;
	cin >> n >> m >> s;
	n++;

	vector<int> pref(n + 1, 0);
	for (int i = 0; i < n; i++) {
		pref[i + 1] = pref[i] + (s[i] == '1');
	}

	vector<int> ans;
	bool ok = true;

	for (int i = n - 1; i;) {
		int L = 0, R = min(i, m) + 1;
		while (R - L > 1) {
			int mid = (L + R) / 2;
			int cnt = pref[i + 1 - mid] - pref[i - min(i, m)];
			(cnt ==  min(i, m) - mid + 1? R : L) = mid;
		}

		if (L) {
			ans.push_back(L);
			i -= L;
		} else {
			ok = false;
			break;
		}
	}

	if (!ok) {
		cout << "-1\n";
	} else {
		reverse(ans.begin(), ans.end());
		for (auto el : ans) {
			cout << el << ' ';
		}
	}
}

Measured memory_bytes: 4452
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

int main() {
double x=0.0,y=0.0,d=90;

	while (1){
		string s1, s2;
		getline(cin,s1 , ',');
		getline(cin, s2);
		if (s1 == "0"&&s2 == "0")
		break;
		double m = atof(s1.c_str());
		double r = atof(s2.c_str());
		x += cos(d/360.0*2.0*3.14159265)*m;
		y += sin(d / 360.0*2.0*3.14159265)*m;
		d-=r;
	}
	cout << (int)x << endl << (int)y<<endl;
}

Measured memory_bytes: 3468
#include <bits/stdc++.h>
using namespace std;
using pii=pair<int,int>;
using ll=long long;

#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define MOD 1000000007

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

int main() {
	string s;
	cin >> s;
	int n=s.length();
	bool flag = false;
	int maxi = 0;
	rep(i,10) for(int j=i+1; j<=n; j++) {
		//[i,j)
		flag = false;
		for(int k=i; k<j; k++) {
			if(s[k] == 'A' || s[k] == 'G' || s[k] == 'C' || s[k] == 'T') {
				if(k==j-1) flag = true;
				continue;
			}
			else break;
		}
		if(flag) chmax(maxi, j-i);
	}
	cout << maxi << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String[] args) {
    try {
      Scanner scn = new Scanner(System.in);

      int n = Integer.parseInt(scn.next());
      int i, a[] = new int[n], alice=0, bob=0;

      for(i=0; i<n; i++){
        a[i] = Integer.parseInt(scn.next());
      }

      Arrays.sort(a);

      for(i=n-1; i>=0; i=i-2){
        alice = alice+a[i];
      }
      for(i=n-2; i>=0; i=i-2){
        bob = bob+a[i];
      }

      System.out.println(alice-bob);
    }
    catch (Exception e) {
      
    }
  }
}

Measured memory_bytes: 21844
#include<iostream>
#include<map>
#include<sstream>
#include<string>
#include<algorithm>
using namespace std;

const int tablesize = 3000;

int main(){

    int n,p[3],count,psum;
    map<string,int> mp;
    const int defaultnum = mp["d"];
    int ok= (defaultnum == 10) ? 0 : 10;



    count = 0;

    cin >> n;

    for(int i=0;i<n;i++){
      cin >> p[0] >> p[1] >> p[2];
      sort(p,p+3);
      psum = p[0] + p[1] + p[2];
      string keystring="";
      stringstream ss;
      for(int j=0;j<3;j++){
        ss << p[j];
      }

      ss >> keystring;

      if(mp[keystring] == ok){
        count++;
      }
      else{
        mp[keystring] = ok;
      }

    }

    cout << count << endl;

    return 0;
}

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

int main(){
  int n,x;
  cin >> n >> x;
  int ans = 1;
  int d = 0;
  vector<int> L(n);
  for(int i = 0; i < n; i++){
    cin >> L[i];
    d += L[i];
    if( d <= x) ans++;
    else break;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<vector>
using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)
#define INF 300000

struct E
{
    int a,b,c,t;
    E(){};
    E(int a,int b,int c,int t):a(a),b(b),c(c),t(t){};
};
//E cs[700];
unsigned int d[150];

int main()
{
    int n,m,k,p,q,r;
    while(cin >> n >> m)
    {
        if(n==0 && m==0)break;
        vector<E> cs;   
        int ta,tb,tc,tt;
        rep(i,n)
        {
            cin >> ta>>tb>>tc >>tt;
            cs.push_back( E(ta,tb,tc,tt));
            cs.push_back( E(tb,ta,tc,tt));
        }

        cin >> k;
        rep(i,k)
        {
            memset(d,INF,150*sizeof(int));
            cin >> p >> q >>r;
            d[p] = 0;

            bool update = false;
            if(r==0)while(true)
            {
                update = false;
                rep(j,n*2)
                {
                   if(d[cs[j].a] != INF && d[cs[j].b] > d[cs[j].a] + cs[j].c)
                   {
                       update = true;
                       d[cs[j].b] =  d[cs[j].a] + cs[j].c;
                   }
                }
                if(!update) break;
            }
            if(r==1)while(true)
            {
                update = false;
                rep(j,n*2)
                {
                   if(d[cs[j].a] != INF && d[cs[j].b] > d[cs[j].a] + cs[j].t)
                   {
                       update = true;
                       d[cs[j].b] =  d[cs[j].a] + cs[j].t;
                   }
                }
                if(!update) break;
            }
            cout << d[q] << endl;
        }
        
    }

    return 0;
}

Measured memory_bytes: 1116
#include<bits/stdc++.h>
#define int long long
#define N 500005
using namespace std;
int q,n,d;
int suf[N],a[N],now[N];
signed main()
{
    scanf("%lld%lld",&n,&d);
    int nw=d;now[0]=d;
    for(int i=1;i<=n;i++)
    {
        scanf("%lld",&a[i]);
        if(abs(nw-a[i])<nw)nw=abs(nw-a[i]);
        now[i]=nw;
    }
    suf[n]=1;
    for(int i=n;i>=1;i--)
    {
        if(a[i]/2>=suf[i])suf[i-1]=suf[i];
        else suf[i-1]=suf[i]+a[i];
    }
    scanf("%d",&q);
    for(int i=1;i<=q;i++)
    {
        int p;scanf("%lld",&p);
        if(now[p-1]>=suf[p])puts("YES");
        else puts("NO");
    }
    return 0;
}


Measured memory_bytes: 13696
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<math.h>
#define ll long long
int mark[10];
using namespace std;
int main(){
    int n;
    string s,t,d;
    cin>>s>>t;
    n=s.size();
    //cout<<n<<endl;
    d=s;
    int p=n-1;
    //d=s.substr(0,n-1);
    for(int i=0;i<n;i++){
        if(d==t){ cout<<"Yes"<<endl;
                return 0;
        }
        else{d=d.substr(0,n-1);

            d=s[p--]+d;
        //cout<<d<<endl;
        }


    }
    cout<<"No"<<endl;


}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
void solve() {
	int n, k; cin >> n >> k;
	int a[114514]; for (int i = 0; i < n; i++)cin >> a[i];
	if (k >= n) { cout << "0\n"; return; }
	int a1[114514]; for (int i = 0; i < n - 1; i++)a1[i] = a[i + 1] - a[i];
	sort(a1, a1 + (n - 1));
	int ans = a[n - 1] - a[0];
	for (int i = 0; i < k - 1; i++) { ans -= a1[n - i - 2]; }
	cout << ans << endl;
}
int main() {
	int d; cin >> d; for (int i = 0; i < d; i++)solve();
}


Measured memory_bytes: 3800
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n = int(readline())
    ans = []
    for i in range(2, 10 ** 10):
        if i % 5 == 1:
            b = True
            for j in range(2, int(i ** 0.5) + 1):
                if i % j == 0:
                    b = False
                    break
            if b:
                ans.append(i)
                if len(ans) == n:
                    print(*ans)
                    exit()


if __name__ == '__main__':
    solve()


Measured memory_bytes: 39152
#include <bits/stdc++.h>
#include <random>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep1(i,n) for (int i = 1; i <= (n); ++i)




using namespace std;
using ll = long long;
using P = pair<int,int>;
using ull= unsigned long long;
const ll K_MAX=1e5+5;
const ll Lmax=ll(1e18);
const ll Nmax=1e9;
const ll INF=1e9;

// B貪欲法で決定する．
int main(){
  clock_t start = clock();
  int d;
  cin>>d;
  vector<int> c(26);
  vector<vector<int>> s(d,vector<int>(26));
  vector<int> last(26),last0(26);
  vector<int>c_inv(26); // iを選んだ際の1日での下がり幅
  

  ll c_tot=0;
  rep(i,26){
    cin>> c[i];
    c_tot+=c[i];
    last[i]=-1;
    last0[i]=-1;
  }
  rep(i,26){
    c_inv[i]=c_tot-c[i];
  }

  rep(i,d){//i日目
    rep(j,26){
      cin>>s[i][j];
    }
  }
  // ここまで入力．

  //貪欲法により，初期値t[i]を決める．
  vector<int> t(d);
  int maxloss, iml; // maxlossとその日付
  random_device rnd;
  maxloss=INF;
  rep(i,d){//i日目
   int maxs=-INF;
   int jm=0;

   rep(j,26){
     cin>>s[i][j];
     ll casej=s[i][j];
     rep(k,26){
       if(j!=k){
         casej-=c[k]*(i-last[k]);
       }
     }

     if(casej>maxs){
       maxs=casej;
       jm=j;
     }
   }

   if(maxs<maxloss){
     maxloss=maxs;
     iml=i;
   }
   
   last[jm]=i;
   t[i]=jm;
  }

int cicle=0;
int Ncicle=10000;
  ll sum;
  bool judge=true;
 while(judge){
   cicle++;
   t[iml]=rnd()%26;
   //cout<<t[iml]<<":";
   
   maxloss=INF;
   sum=0;

   rep(i,d){//i日目
     ll casei;
     last[t[i]]=i;
     casei= s[i][t[i]];
     rep(j,26){
       casei-=c[j]*(i-last[j]);
     }
     
     sum+= casei;
     
     if(casei<maxloss){
       maxloss=casei;
       iml=i;
     }
  }  
   clock_t end = clock();
   double time = static_cast<double>(end - start) / CLOCKS_PER_SEC * 1000.0;

   if(time>1950){
       judge=false;
   }

 }//while
  
  
  rep(i,d){
    cout<<t[i]+1<<endl;
  
   }
 // cout<<sum; //消すこと














}


Measured memory_bytes: 3716
#[allow(dead_code)]
fn scan<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

#[allow(dead_code)]
fn scan_split<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
        .map(|t| t.parse().ok().unwrap()).collect()
}

#[allow(dead_code)]
fn scan_split_with<T: std::str::FromStr>(ch: char) -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split(ch)
        .map(|t| t.parse().ok().unwrap()).collect()
}

#[allow(dead_code)]
fn scan_lines<T: std::str::FromStr>(n: usize) -> Vec<T> {
    (0..n).map(|_| scan::<T>()).collect()
}

#[allow(unused_macros)]
macro_rules! scan_as_tuple {
    ( $t:ty ) => {
        (scan::<$t>(),)
    };
    ( $( $t:ty ),* ) => {
        {
            let mut s = String::new();
            std::io::stdin().read_line(&mut s).ok();
            let v = s.trim().split_whitespace();
            let mut it = v;
            let ret = ( $(it.next().unwrap().parse::<$t>().ok().unwrap()),* );
            assert!(it.next() == None, "not all tokens consumed");
            ret
        }
    };
}

fn main() {
    let s = scan_split_with::<String>(',');
    println!("{} {} {}", s[0], s[1], s[2]);
}

Measured memory_bytes: 4352
EPS=1e-10
def crossP(aa,bb,cc,dd):
    a = (bb-aa).real
    b = (cc-dd).real
    c = (bb-aa).imag
    d = (cc-dd).imag
    e = (cc-aa).real
    f = (cc-aa).imag
    det = a*d - b*c
    if abs(det) <EPS:
        return(-9999+(-9999)*1j)
    x = (d*e-b*f)/det
    y = (-c*e+a*f)/det
    return(x+y*1j)

def rangeP(st):
    return((0.0<=st.real<=1.0) and (0.0<=st.imag<=1.0))

if __name__ == '__main__':
	n = int(input().strip())
	for i in range(n):
	    [xp1,yp1,xp2,yp2,xp3,yp3,xk,yk,xs,ys] = map(int, input().strip().split())
	    a = xp1+yp1*1j
	    b = xp2+yp2*1j
	    c = xp3+yp3*1j
	    k = xk+yk*1j
	    s = xs+ys*1j
	    shut = 0
	    if rangeP(crossP(a,b,k,s)):
	        shut += 1
	    if rangeP(crossP(b,c,k,s)):
	        shut += 1
	    if rangeP(crossP(c,a,k,s)):
	        shut += 1
	    if shut == 1:
	        print("OK")
	    else:
	        print("NG")

Measured memory_bytes: 7780
#include  <bits/stdc++.h>
using namespace std;
int f(long int n);
int main()
{
	long int s,i,j;
	cin>>s;
	int a[100000];
	a[1]=s;
		for(i=2;i<10000;i++)
		{
			a[i]=f(a[i-1]);
			for(j=1;j<i;j++)
			{
				if(a[i]==a[j])
				{
					cout<<i<<endl;
					return 0;
				}
				
			}
		}
}


int f(long int n){
	long int s;
		if(n%2==0)
		{
			s=n/2;
		}
		else
		{
			s=(3*n)+1;
		}
		return s;
		
}

Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
 
int mincost(int n ,int k,vector<int>&height)
{
     vector<int>dp(n,INT_MAX);
     dp[0]=0;
     dp[1] = abs(height[1]-height[0]);
     for(int i =2;i<n;i++)
     {  for(int j =i-1;j>=0&&j>=i-k;j--)
     
          dp[i] = min(dp[i],dp[j]+abs(height[i]-height[j]));
     }
    return dp[n-1];
}
int main(){
    int n,k ;
  cin>>n>>k;
  vector<int>height(n);
  for(int i=0;i<n;i++)
  {  cin>>height[i];
  }
  cout<<mincost(n,k,height)<<endl;
  
  return 0;
}

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

int main() {
	int pizza_A, pizza_B, pizza_AB, x, y,money=0;
	cin >> pizza_A >> pizza_B >> pizza_AB >> x >> y;

	int flag = 0,a,b;
	a = pizza_AB*2;
	b = pizza_A + pizza_B;
	
	if (a < b) {
		flag = 1;
	}

	if (flag) {
		if (x > y) {
			for (int i = y; i > 0; i--) {
				money = money + pizza_AB * 2;
			}
			if (pizza_AB * 2 * (x - y) > pizza_A*(x - y)) {
				money = money + pizza_A*(x - y);
			}
			else {
				money = money + pizza_AB * 2 * (x - y);
			}
		}
		if (x <= y) {
			for (int i = x; i > 0; i--) {
				money = money + pizza_AB * 2;
			}
			if (pizza_AB * 2 * (y - x) > pizza_B*(y - x)) {
				money = money + pizza_B*(y - x);
			}
			else {
				money = money + pizza_AB * 2 * (y - x);
			}
		}
	} else {
		money = pizza_A*x + pizza_B*y;
	}
	cout << money << endl;

	return 0;
}

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


class Program
{
    static void Main(string[] args)
    {
        // 入力
        var a = Console.ReadLine();
        var b = Console.ReadLine();
        var c = Console.ReadLine();
        //var n = int.Parse(Console.ReadLine());
        //int[] n = Console.ReadLine().Split().Select(int.Parse).ToArray();

        var teban = a[0];
        var anum = 1;
        var bnum = 0;
        var cnum = 0;
        var ans = "";
        while (ans == "")
        {
            if (teban == 'a')
            {
                if (anum == a.Length)
                {
                    ans = "A";
                }
                else
                {
                    teban = a[anum];
                    anum++;
                }
            }
            else if (teban == 'b')
            {
                if (bnum == b.Length)
                {
                    ans = "B";
                }
                else
                {
                    teban = b[bnum];
                    bnum++;
                }
            }
            else if (teban == 'c')
            {
                if (cnum == c.Length)
                {
                    ans = "C";
                }
                else
                {
                    teban = c[cnum];
                    cnum++;
                }
            }
        }

        // 出力
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 11092
import java.util.Scanner;
class Main{
 public static void main(String args[]){
   Scanner sc = new Scanner(System.in);
   long x = sc.nextLong();
	long money=100;
   for(int i=1;;i++ ){
     money*=1.01;
     if(money>=x){
       System.out.println(i);
     break;
     }
   }
 }
}


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

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n,k; cin>>n>>k;
    string s; cin>>s;
    vector<pair<int,int> > a;
    int akt=1;
    for(int i=1;i<n;i++)
    {
        if(s[i]==s[i-1]) akt++;
        else
        {
            int ile;
            if(s[i-1]=='0') ile=0;
            else ile=1;
            a.push_back({akt,ile});
            akt=1;
        }
    }
    int ile;
    if(s[n-1]=='0') ile=0;
    else ile=1;
    a.push_back({akt,ile});
    int res=0;
    n=a.size();
    int suma=0;
    ile=0;
    int i=0;
    int wsk=0;
    while(i<n)
    {
        //cout<<i<<" "<<suma<<endl;
        res=max(res,suma);
        if(ile<k || (ile==k && a[i].second==1))
        {
            suma+=a[i].first;
            if(a[i].second==0) ile++;
            i++;
            continue;
        }
        else if(ile==k)
        {

                suma-=a[wsk].first;
                if(a[wsk].second==0) {ile--; wsk++;}
                else
                {
                    wsk++;
                    suma-=a[wsk].first;
                    ile--;
                    wsk++;
                }

        }
    }
    res=max(res,suma);
    cout<<res<<endl;
    return 0;
}


Measured memory_bytes: 1528
import math

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

a = []
lis = []

for i in range(1, n+1):
    if(b[i-1] <= i):
        a.append(b[i-1])
        lis.insert(b[i-1]-1, b[i-1])
    else:
        break

if(a != b):
    print(-1)
else:
    for i in range(len(a)):
        print(lis[i])


Measured memory_bytes: 3064
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;
import java.util.ArrayList;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();
            TaskB.vertex[] cities = new TaskB.vertex[n];
            for (int i = 0; i < n; ++i)
                cities[i] = new TaskB.vertex();
            for (int i = 0; i < m; ++i) {
                int a = in.nextInt();
                int b = in.nextInt();
                cities[a - 1].vertices.add(b - 1);
                cities[b - 1].vertices.add(a - 1);
            }
            for (TaskB.vertex i : cities)
                out.println(i.vertices.size());
        }

        static class vertex {
            ArrayList<Integer> vertices = new ArrayList<>();

        }

    }
}



Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
int main(){
  char a;
  cin>>a;
  if(a=='a' || a=='i' || a=='u' || a=='e' || a=='o'){
    cout<<"vowel"<<'\n';
  }
  else{
    cout<<"consonant"<<'\n';
  }
  return 0;
}


Measured memory_bytes: 384
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#include <bits/stdc++.h>
using namespace std;
#define IO std::ios::sync_with_stdio(false)
#define ll long long
#define rep(i, l, r) for (int i = l; i <= r; i++)
#define per(i, l, r) for (int i = l; i >= r; i--)
#define mset(s, _) memset(s, _, sizeof(s))
#define pb push_back
#define pii pair <int, int>
#define mp(a, b) make_pair(a, b)
#define INF 0x3f3f3f3f

inline int read() {
  int x = 0, neg = 1; char op = getchar();
  while (!isdigit(op)) { if (op == '-') neg = -1; op = getchar(); }
  while (isdigit(op)) { x = 10 * x + op - '0'; op = getchar(); }
  return neg * x;
}
inline void print(int x) {
  if (x < 0) { putchar('-'); x = -x; }
  if (x >= 10) print(x / 10);
  putchar(x % 10 + '0');
}

signed main() {
  IO;
  int r;
  cin >> r;
   cout << 2 * acos(-1.0) * r << '\n';
  return 0;	
}

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

using namespace std;

#define N 200000

string str;
long long c[256];
int n;

long long nc2(long long n){
	return (n * (n - 1)) / 2;
}

int main(){
	long long ans;
	int i;

	ios::sync_with_stdio(false);

	cin >> str;
	n = (int)str.size();
	ans = nc2(n) + 1;

	for (i = 0; i < n; i++){
		c[(int)str[i]]++;
	}

	for (i = 'a'; i <= 'z'; i++){
		ans -= nc2(c[i]);
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 720
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#define int long long
using namespace std;
int a[114];
signed main() {
	int n, cnt = 0;
	cin >> n;
	for (int i = 0; i < n; i++)cin >> a[i];
	for (int i = 0; i < n; i++) {
		cnt += a[i];
	}
	if (cnt % 2 == 0) {
		cout << cnt / 2 << endl;
	}
	else {
		sort(a, a + n);
		for (int i = 0; i < n; i++) {
			if (a[i] % 2 == 0)continue;
			cnt -= a[i];
			if (cnt % 2 == 0)break;
		}
		cout << cnt / 2 << endl;
	}
}


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

int main(void)
{
    int N, L, temp, min = 101, sum = 0, index;

    scanf("%d %d", &N, &L);

    for (int i = 0; i < N; i++)
    {
        temp = abs(L + i);

        if (temp < min)
        {
            min = temp;
            index = i + 1;
        }
    }
    
    sum = ((L + (L + N - 1)) * N) / 2 - (L + index - 1);
    printf("%d", sum);

    return 0;
}

Measured memory_bytes: 128
n, k = map(int, input().split())
h = list(map(int, input().split()))

dp = [10**10]*n
dp[0] = 0

for i in range(1, n):
    for j in range(1,k+1):
        if i-j >= 0:
            dp[i] = min(dp[i], dp[i-j]+abs(h[i]-h[i-j]))
print(dp[-1])

Measured memory_bytes: 52448
#include<bits/stdc++.h>
using namespace std;
# define ll long long
# define pi 3.14159265359
# define str string
# define vll vector<ll>
# define vstr vector<str>
# define vpll vector<pair<ll,ll> >
//assign() assignes new value
//emplace(position,x) inserting
//erase(position) to remove an element
//swap() for swapping
//reverse(position,position) for reversing
# define pb push_back
# define popb pop_back
# define pf push_front
# define popf pop_front
# define sll set<ll>
//find()
//erase(x) removes element x
//erase(position,position)
# define qll queue<ll>
# define qstr queue<str>
//front(),back()
# define stll stack<ll>
# define ststr stack<str>
//top()
# define dll deque<ll>
//at()
# define mll map<ll,ll>
# define msl map<str,ll>
# define mls map<str,ll>
# define mstr map<str,str>
# define mcl map<char,ll>
# define pll pair<ll,ll>
# define f(x,y) for(int x=0;x<y;x++)
# define r(x,y) for(int x=y;x>=0;x--)
# define fr(x,y,z) for(int x=y;x<z;x++)
# define rr(x,y,z) for(int x=y;x>z;x--)
ll gcd(ll a, ll b){
    if(b == 0)
        return a;
    return gcd(b, a % b);
}
ll lcm(ll a, ll b){
    return (a*b)/gcd(a, b);
}
void print(vll a){
    for(int i=0;i<a.size();i++){
        cout<<a[i]<<' ';
    }
    cout<<endl;
}
vll inp(int n){
    vll a;
    ll x;
    f(i,n){
        cin>>x;
        a.pb(x);
    }
    return a;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t,n,i,j,k,l,c,c1,cnt,flag,m1,m,m2,maxi,mini,x,y,z;
    vll a,b;
    str s,s1,s2;
    cin>>n>>m;
    c=0;
    f(i,m){
        a.pb(0);
    }
    f(i,n){
        cin>>s;
        f(j,m){
            if(i==0 && j==0){
                a[0]=1;
            }
            else{
                if(s[j]=='.'){
                    if(j!=0){
                        a[j]=(a[j]+a[j-1])%1000000007;
                    }
                }
                else{
                    a[j]=0;
                }
            }
        }
    }
    cout<<a[m-1]<<endl;
}

Measured memory_bytes: 256