akhauriyash/Code-Regression huggingface dataset:
#define LOCAL
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rrep(i, n) for(int i=(n-1); i>=0; --i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define ALL(v) (v).begin(), (v).end()
#define memr(dp, val) memset(dp, val, sizeof(dp))
using namespace std;
typedef long long ll;
static const int INTINF = (INT_MAX >> 1); // 10^9 + 10^7
static const ll LLINF = (LLONG_MAX >> 1);
static const int MAX = 1e5+1;
static const ll MOD = 1e9+7;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
string to_string(string s) { return '"' + s + '"'; }
string to_string(bool b) { return b ? "true" : "false"; }
template <size_t N> string to_string(bitset<N> bs) {
  string res;
  for (size_t i = 0; i < N; ++i) res += '0' + bs[i];
  return res;
}
string to_string(vector<bool> v) {
  string res = "{";
  for (bool e : v) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p);
template <class C> string to_string(C c) {
  string res = "{";
  for (auto e : c) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
void debug() { cerr << '\n'; }
template <class Head, class... Tail> void debug(Head head, Tail... tail) {
  cerr << '\t' << to_string(head), debug(tail...);
}
#ifdef LOCAL
#define DEBUG(...) cerr << "[" << #__VA_ARGS__ << "]:", debug(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

int main(int argc, const char * argv[]) {
	std::cout << std::fixed << std::setprecision(15);

	int N; cin >> N;

	vector<pair<double, double> > v(N);
	rep(i, N){
		double x, y; cin >> x >> y;
		v[i] = {x, y};
	}

	sort(ALL(v));
	double cnt = 0;
	double sum = 0;
	do{
		cnt++;
		rep(i, N){
			int tmp = i+1;
			if(tmp > N-1) break;
			pair<double, double> a = v[i], b = v[tmp];
			sum += sqrt(pow(b.first - a.first, 2) + pow(b.second - a.second, 2));
		}
	}while(next_permutation(ALL(v)));
	sum /= cnt;
	cout << sum << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ; //何もしない文
#endif

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size()) //unsignedのサイズをint型に変換
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    LL N,A,B; cin >>N>>A>>B;
    VL X(N); REP(i,N) cin >> X[i];

    LL ans = 0;
    REP(i,N-1)
    {
        if((X[i+1]- X[i]) * A > B) ans += B;
        else ans += (X[i+1]- X[i]) * A;
    }
    cout << ans << endl;

}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <string.h>
#include <set>
#include <map>
#include <unordered_map>
#include <assert.h>
#include <algorithm>
#include <queue>
#include <bitset>
#include <stack>
#include <chrono>
#include <random>
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define ll long long
#define INF 1000000000000000000
#define MOD 1000000007
#define rnd mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define uid uniform_int_distribution <int>
using namespace std;
// Read the question carefully and see all the given sample tests
// Think about the correctness before implementing

/*
 * if 4 needs to be necessary I should be able to form 
 * some subset whose sum < k and sum + 4 >= k
 * _ _ _ _ _ _ _ _ k _
 */
int main() {
	int n, k;
	cin >> n >> k;
	vector <int> A(n + 1);
	for (int i = 1; i <= n; i++) {
		cin >> A[i];
	}
	// Store dp[i][j], where i denotes till which index and j is the sum
	vector <vector<bool>> pre(n + 1, vector<bool>(k + 1, false));
	pre[0][0] = true;
	for (int i = 1; i <= n; i++) {
		for (int j = 0; j <= k; j++) {
			if (j >= A[i]) {
				pre[i][j] = pre[i][j] | pre[i - 1][j - A[i]];
			}
			pre[i][j] = pre[i][j] | pre[i - 1][j];
		}
	}
	vector <vector<bool>> suf(n + 2, vector<bool>(k + 1, false));
	suf[n + 1][0] = true;
	for (int i = n; i >= 1; i--) {
		for (int j = 0; j <= k; j++) {
			if (j >= A[i]) {
				suf[i][j] = suf[i][j] | suf[i + 1][j - A[i]];
			}
			suf[i][j] = suf[i][j] | suf[i + 1][j];
		}
	}
	int ans = 0;
	for (int i = 1; i <= n; i++) {
		if (A[i] >= k)	continue;
		bool ok = false;
		int l = k;
		for (int j = 0; j < k; j++) {
			if (pre[i - 1][j]) {
				// you want any sum posible from k - A[i] - j to k - 1 - j
				while(l > k - 1 - j) l--;
				while(l >= max(k - A[i] - j, 0) && !suf[i + 1][l]) l--;
				//cout << i << " " << j << " " << l << "\n";
				if (l >= max(k - A[i] - j, 0)) {
					//cout << i << "\n";
					ok = true;
					break;
				}
			}
		}
		ans += !ok;
	}
	cout << ans;
} 


Measured memory_bytes: 6912
#define _USE_MATH_DEFINES
#include <iomanip>
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <tuple>
#include <climits>
#include <algorithm>
#include <cmath>
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<double> VD;
typedef vector<LL> VLL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef vector<vector<long long>> VVLL;
typedef vector<vector<bool>> VVB;
typedef vector<vector<double>> VVD;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(a) (a).begin(),(a).end()

const int MOD = 1000000007;

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

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

void debug(VI &arr){
	int n=arr.size();
	rep(i,n){
		cout<<arr.at(i)<<endl;
	}
}

void debug(VVI &board){
	int h = board.size();
	int w = board.at(0).size();
	rep(i,h){
		rep(j,w){
			cout << board.at(i).at(j) << " ";
		}
		cout<<endl;
	}
}

void debug(VVLL &board){
	int h = board.size();
	int w = board.size();
	rep(i,h){
		rep(j,w){
			cout<<board.at(i).at(j)<<" ";
		}
		cout<<endl;
	}
}

LL gcd(LL a,LL b){
	return b==0?a:gcd(b,a%b);
}

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

int main(){
	//cout<<fixed;
	//cout<<setprecision(9)<<...
	int n;cin>>n;
	cout<<(n%2==0?n:2*n)<<endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <string>
#include <algorithm>
#include <ctype.h>
#include <vector>
using namespace std;

#define ll long long int

int main()
{
    int n, a, b;

    cin >> n;
    if (n == 1)
        cout << "Hello World" << endl;
    else
    {
        cin >> a >> b;
        cout << a + b << endl;
    }
}


Measured memory_bytes: 256
#define FNAME ""

#undef __STRICT_ANSI__

#include <bits/stdc++.h> 

using namespace std;

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

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
	#define eprintf(...) static_cast<void>(0)   
#endif

#ifdef _WIN32
	#define I64 "%I64d"
	#define U64 "%I64u"
#else
	#define I64 "%lld"
	#define U64 "%llu"
#endif

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

const int N = 2e5 + 100;

int p[N], rightMin[N], leftMax[N], isSorted[N];
int p2[N];

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n, k;
	cin >> n >> k;
	forn(i, n) {
		cin >> p[i];
	}
	stack<pii> s;
	s.push(mp(p[0], 0));
	forn(i, n) {
		leftMax[0] = -1;
	}
	forab(i, 1, n) {
		while(!s.empty() && s.top().fst < p[i]) {
			s.pop();
		}
		if (!s.empty()) {
			leftMax[i] = s.top().snd;
		}
		s.push(mp(p[i], i));
	}
	forn(i, n) {
		rightMin[i] = n;
	}
	stack<pii> s2;
	s2.push(mp(p[n - 1], n - 1));
	fornr(i, n - 1) {
		while(!s2.empty() && s2.top().fst > p[i]) {
			s2.pop();
		}
		if (!s2.empty()) {
			rightMin[i] = s2.top().snd;
		}
		s2.push(mp(p[i], i));
	}
	int ans = 1, cntSorted = 0;
	forn(i, n - 1) {
		if (p[i] < p[i + 1]) {
			isSorted[i] = 1;
		}
	}
	int sortedElements = 0;
	forn(i, k - 1) {
		sortedElements += isSorted[i];	
	}
	if (sortedElements == k - 1) {
		cntSorted++;
	}
	for (int i = 0; i + k < n; i++) {
		sortedElements -= isSorted[i];
		sortedElements += isSorted[i + k - 1];
		int sorted = 0;
		if (sortedElements == k - 1) {
			cntSorted++;
			sorted = 1;
		}
		if ((rightMin[i] < i + k || leftMax[i + k] > i) && (!sorted || cntSorted == 1)) {
			ans++;
		}
	}
	cout << ans << '\n';
	return 0;
}

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

int main(void)
{
  int A[3][3], N, b[100];
  int i, j, n;
  
  for (i = 0; i < 3; i++)
  {
    for (j = 0; j < 3; j++)
    {
      scanf("%d", &A[i][j]);
    }
  }
  scanf("%d", &N);
  for (n = 0; n < N; n++)
  {
    scanf("%d", &b[n]);
    for (i = 0; i < 3; i++)
    {
      for (j = 0; j < 3; j++)
      {
        if (b[n] == A[i][j])
        {
          A[i][j] = 0;
        }
      }
    }
  }
  
  for (i = 0; i < 3; i++)
  {
    if (A[i][0] + A[i][1] + A[i][2] == 0 || A[0][i] + A[1][i] + A[2][i] == 0)
    {
      printf("Yes\n");
      return 0;
    }
  }
  if (A[0][0] + A[1][1] + A[2][2] == 0 || A[0][2] + A[1][1] + A[2][0] == 0)
  {
    printf("Yes\n");
    return 0;
  }
  
  printf("No\n");
  
  return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<map>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main(){
    int n,m;
    cin>>n>>m;
    int64_t h[n];
    rep(i,n) cin>>h[i];
    int data[m][2];
    rep(i,m) rep(j,2) cin>>data[i][j];
    int good=0;
    bool hikui[n];
    rep(i,n) hikui[i]=true;
    rep(i,m){
        if(h[data[i][0]-1]>h[data[i][1]-1]){
            hikui[data[i][1]-1]=false;
        }
        else if(h[data[i][0]-1]<h[data[i][1]-1]){
            hikui[data[i][0]-1]=false;
        }
        else{
            hikui[data[i][0]-1]=false;
            hikui[data[i][1]-1]=false;
        }
    }
    rep(i,n){
        if(hikui[i]){
            good++;
        }
    }
    cout<<good<<endl;
}


Measured memory_bytes: 5208
#include <stdio.h>
main(void){
  
  int a=0;
  int W,H,x,y,r=0;
  
  scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
  
  if(x - r >= 0 && x + r <= W) {
    if(y - r >= 0 && y + r <= H){
      a = 1;
    }
  }
  else {
    a = 0;
  }
  if(a == 1) {
    printf("Yes\n");
  }
  else if(a == 0) {
    printf("No\n");
  }
  return 0;
}

Measured memory_bytes: 584
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
int main () {
ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin>>n;
    int x=n%10;
    if(x==2||x==5||x==4||x==7||x==9)
    cout<<"hon"<<endl;
    if(x==0||x==1||x==6||x==8)
    cout<<"pon"<<endl;
    if(x==3)
    cout<<"bon"<<endl;
    return 0;
}


Measured memory_bytes: 3652
#include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef vector<pair<ll,ll> > vp;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define MOD 1000000007;

int main(){
  ll n,all=0;cin>>n;
  vll h(n),kosuu(200001,0);
  rep(i,0,n){
    cin>>h[i];
    kosuu[h[i]]++;
  }
  rep(i,0,200001){
    if(kosuu[i]!=0){all+=(kosuu[i]*(kosuu[i]-1))/2;}
  }
  rep(i,0,n){
    ll tmp=kosuu[h[i]]-1;
    cout<<all-tmp<<endl;
  }
}



Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
struct edge
{
  ll to;
  ll cost;
  edge() {}
  edge(ll to, ll cost) : to(to), cost(cost){};
};
int main()
{
ll n;
cin >> n ;
vector<vector<edge>> g(n);
rep(i, n-1)
{
  ll a, b;
  cin >> a >> b ;
  ll c=0;
  g[a - 1].emplace_back(b - 1, c);
  g[b - 1].emplace_back(a - 1, c); //無向辺
}
ll a=1,b=2,c=3;
ll ev=1,od=0;
vector<ll> par(n);
vector<ll> res(n);
vector<bool> see(n);
queue<ll> q;
par[0]=-1;
see[0]=1;
res[0]=0;
q.push(0);
while(!q.empty()){
  auto p=q.front();
  see[p]=1;
  q.pop();
  for(auto r:g[p]){
    if(see[r.to]!=0)continue;
    par[r.to]=p;
    res[r.to]=res[p]+1;
    if(res[r.to]%2)od++;
    else ev++;
    q.push(r.to);
  }
}
vector<ll> ans(n,-1);
if(od>n/3&&ev>n/3){
  rep(i,n){
    if(res[i]%2){
      if(a>n) {ans[i]=c;c+=3;}
      else{ans[i]=a;a+=3;}
    }
    else{
      if(b>n) {ans[i]=c;c+=3;}
      else{ans[i]=b;b+=3;}
    }
  }
}
else if(od>n/3)
{
  rep(i,n){
    if(res[i]%2==0){ans[i]=c;c+=3;}
  }
  rep(i,n){
    if(res[i]%2==1&&c<=n){ans[i]=c;c+=3;}
    else if(res[i]%2==1&&a<=n){ans[i]=a;a+=3;}
    else if(res[i]%2==1){ans[i]=b;b+=3;}
  }
}
else
{
  rep(i,n){
    if(res[i]%2==1){ans[i]=c;c+=3;}
  }
  rep(i,n){
    if(res[i]%2==0&&c<=n){ans[i]=c;c+=3;}
    else if(res[i]%2==0&&a<=n){ans[i]=a;a+=3;}
    else if(res[i]%2==0){ans[i]=b;b+=3;}
  }
}

for(auto r : ans)cout << r << ' ';
cout << endl;
return 0;
}


Measured memory_bytes: 23268
#include<iostream>
#include <string>
#include<algorithm>
#include <vector>

using namespace std;

int main(){
  string s;
  int k,i,j;
  cin >> s;
  cin >> k;
  vector<string> v;
  for(i=0;i<s.size();i++){
    for(j=1;j<=k;j++){
      v.push_back(s.substr(i,j));
    }
  }
  sort(v.begin(),v.end());
  v.erase(unique(v.begin(),v.end()),v.end());
  cout << v[k-1] << endl;
  return 0;
}


Measured memory_bytes: 1660
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author champon
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(ll i=0; i<n; i++)
#define repr(i, s, e) for(ll i=s; i>=e; i--)
#define reps(i, s, e) for(ll i=s; i<=e; i++)
#define inf 1e18
#define all(v) v.begin(),v.end()
#define ceill(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
void ans(bool b){ cout << (b ? "Yes" : "No") << endl; }
void ans2(bool b){ cout << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b) a=b; return a<b; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a) a=b; return b<a; }
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    fill((T*)array, (T*)(array+N), val);
}
template<typename T> void vdeb(T v){
    cout << "#vector set debug" << endl;
    for(auto vv : v) cout << vv << " ";
    cout << endl;
}
template<typename T1, typename T2> void adeb(T1 arr[], T2 n){
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}
template<typename T1> void mdeb(T1 mp){
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};


class Math {
    ll mod = 1e9+7;
  public:
    template<typename T1, typename T2>
    ll gcd(T1 a, T2 b){
        if(b==0) return a;
        return gcd(b, a%b);
    }

    template<typename T1, typename T2>
    ll lcm(T1 a, T2 b){
        return a*(b/gcd(a, b));
    }

    template<typename T>
    int keta(T num){
        T k=0;
        while(num>0){
            num/=10;
            k++;
        }
        return k;
    }

    template<typename T1, typename T2>
    ll powmod(T1 num1, T2 num2){
        ll res = 1;
        while(num2 > 0){
            res *= num1;
            res %= mod;
            num2--;
        }
        return res%mod;
    }

    template<typename T1, typename T2>
    ll powl(T1 a, T2 b){
        ll res = 1;
        while(b > 0){
            res *= a;
            b--;
        }
        return res;
    }
};


class DSemiCommonMultiple {
public:
	void solve(std::istream& in, std::ostream& out) {
        int n;
        ll m;
        in >> n >> m;
        vector<ll> a(n);
        vector<ll> b(n);
        rep(i, n){
            in >> a[i];
            b[i] = a[i] / 2;
        }

        ll lcm_num = b[0];
        Math mt;
        reps(i, 1, n-1){
            lcm_num = mt.lcm(lcm_num, b[i]);
        }

        ll res = m / lcm_num;
        res = ceill(res, 2);

        rep(i, n){
            if(lcm_num / b[i] % 2 == 0){
                res = 0;
                break;
            }
        }

        out << res << endl;
	}
};


int main() {
	DSemiCommonMultiple solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 1792
x1, y1, x2, y2 = map(int, input().split())

dx = x2 - x1
dy = y2 - y1

x3 = x2 - dy
y3 = y2 + dx
x4 = x1 - dy
y4 = y1 + dx

print(x3, y3, x4, y4)

Measured memory_bytes: 2940
n = int(input())
candidates = {}
for i in range(n):
    now = input()
    if now in candidates:
        candidates[now] += 1
    else:
        candidates[now] = 1
winners = []
max_poll = 0
for key in candidates:
    if candidates[key] > max_poll:
        max_poll = candidates[key]
for key in candidates:
    if candidates[key] == max_poll:
        winners.append(key)
winners.sort()
for winner in winners:
    print(winner)

Measured memory_bytes: 32096
var sample_input = require('fs').readFileSync('/dev/stdin', 'utf8');
var n = parseInt(sample_input.split("\n")[0]);
var to_pay = 100000;
for(i=0;i<n;i++) {
  to_pay = Math.ceil(to_pay*1.05/1000)*1000;
}
console.log(to_pay);

Measured memory_bytes: 15492
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    char a1[4];
   cin>>a1;
    int a,b;
    a=((a1[2]-48)*10)+(a1[3]-48);
    b=((a1[0]-48)*10)+(a1[1]-48);

   if((a>=1&&a<=12)&&(b>=1&&b<=12))
    {
        cout<<"AMBIGUOUS"<<endl;
    }
   else if(a>=1&&a<=12)
    {
        cout<<"YYMM"<<endl;
    }
    else if(b>=1&&b<=12)
    {
        cout<<"MMYY"<<endl;
    }
    else
    {
        cout<<"NA"<<endl;
    }
return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#define f first
#define s second

using namespace std;

pair <int, pair <int, int> > q[1000001];
int n, m, a[500001], ans[1000001];
int st[5*500001], used[1000001];
int cmp(pair <int, pair <int, int> > a, pair <int, pair <int, int> > b)
{
    if (a.s.f != b.s.f)
        return a.s.f < b.s.f;
    return a.f < b.f;
}
void update(int v, int l, int r, int x, int d)
{
    if (l == r)
    {
        st[v] = d;
        return;
    }
    int mid = (l + r) / 2;
    if (x <= mid)
        update(v * 2, l, mid, x, d);
    else
        update(v * 2 + 1, mid + 1, r, x, d);
    st[v] = st[v * 2] + st[v * 2 + 1];
}
int Find(int v, int A, int B, int l, int r)
{
    if (l > B || r < A)
        return 0;
    if (A == l && B == r)
        return st[v];
    int mid = (A + B) / 2;
    return Find(v * 2, A, mid, l, min(mid, r)) + Find(v * 2 + 1, mid + 1, B, max(mid + 1, l), r);
}

int main()
{
    scanf("%d", &n);
    scanf("%d", &m);
    for (int i = 1; i <= n; i++)
        scanf("%d", &a[i]);
    for (int i = 1; i <= m; i++)
        scanf("%d %d", &q[i].f, &q[i].s.f), q[i].s.s = i;
    sort(q + 1, q + m + 1, cmp);
    int j = 1;
    for (int i = 1; i <= m; i++)
    {
        while(j <= q[i].s.f)
        {
            if (!used[a[j]])
            {
                update(1, 1, n, j, 1);
                used[a[j]] = j;
            }
            else
            {
                update(1, 1, n, used[a[j]], 0);
                update(1, 1, n, j, 1);
                used[a[j]] = j;
            }
            j++;
        }
        ans[q[i].s.s] = Find(1, 1, n, q[i].f, q[i].s.f);
    }
    for (int i = 1; i <= m; i++)
        printf("%d\n", ans[i]);

    return 0;
}

Measured memory_bytes: 19536
#include<cstdio>

using namespace std;

int n,a[100005],c,d;

int main () {
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
		if (a[i] % 4 == 0) c++;
		if (a[i] % 2 == 0) d++;
	}
	d -= c;
	if (d % 2 == 1) d--;
	if (n - c * 2 - 1 - d <= 0) printf("Yes\n");
	else printf("No\n");
	return 0;
}

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


using namespace std;

int main(){

	int x = 0;

	int max = x;

	int N;
	string S;

	cin >> N >> S;

	for(int i = 0;i < N;i++){
		if(S[i] == 'I'){
			x++;
		}
		if(S[i] == 'D'){
			x--;
		}
		if(x > max){
			max = x;
		}
	}

	cout << max;

    return 0;

}


Measured memory_bytes: 256
N, M = map(int, input().split())

H = list(map(int, input().split()))

ans = {}

for _ in range(M):
    a, b = map(int, input().split())
    if H[a-1] > H[b-1]:
        ans[str(b)] = 1
    elif H[b-1] > H[a-1]:
        ans[str(a)] = 1
    else:
        ans[str(a)] = 1
        ans[str(b)] = 1

print(N - len(ans))

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

using namespace std;

int n, a[105], dp[2][105];

int calcular(bool par, int i){
	if(i == n){
		return par;
	}
	if(!dp[par][i]){
    if(par){
			dp[par][i] = pow(3, n - i);
    }
    else {
			dp[par][i] = calcular(1, i + 1) + calcular(0, i + 1);
      if(a[i] & 1){
        dp[par][i] += calcular(1, i + 1);
      }
      else {
      	dp[par][i] += calcular(0, i + 1);
      }
    }
	}
	return dp[par][i];
}

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

	cin >> n;

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

	for(int i = 0; i < 2; i++){
    memset(dp[i], 0, sizeof(dp[i]));
	}

	cout << calcular(0, 0) << endl;

	return 0;
}


Measured memory_bytes: 256
N,A,B=map(int,input().split())

L=[]
for i in range(N):
    a,b,c=map(int,input().split())
    L.append([a,b,c])
#print(L)

dp=[[100000 for i in range(401)]for j in range(401)]
dp[0][0]=0

for n in range(N):
    for i in range(401):
        for j in range(401):
            if dp[400-i][400-j]<100000:
                if 400-i+L[n][0]<=400 and 400-j+L[n][1]<=400:
                    if dp[400-i+L[n][0]][400-j+L[n][1]]>dp[400-i][400-j]+L[n][2]:
                        dp[400-i+L[n][0]][400-j+L[n][1]]=dp[400-i][400-j]+L[n][2]
ans=100000
for i in range(1,401):
    for j in range(1,401):
        if i*B==j*A and ans>dp[i][j]:
            ans=dp[i][j]
if ans<100000:
    print(ans)
else:
    print(-1)
#print(dp)

Measured memory_bytes: 4840
#include <iostream>
#include <iterator>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <numeric>
#include <iomanip>
#include <limits>

using namespace std;

int main(){

    int ans=0;

    int n,r;

    cin>>n>>r;

    if(n>=10){
        ans=r;
    }
    else{
        ans=r+100*(10-n);
    }

    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int H;
		int W;
		int count;
		int[] detaH = new int[300];
		int[] detaW = new int[300];
		for (count = 0; true; count++) {
			H = sc.nextInt();
			W = sc.nextInt();
			if (H == 0 && W == 0) {
				break;
			}
			detaH[count] = H;
			detaW[count] = W;
		}
		for (int i = 0; i < count; i++) {
			for (int i2 = 0; i2 < detaH[i]; i2++) {
				if (i2 == 0 || i2 == detaH[i] - 1) {
					for (int i3 = 0; i3 < detaW[i]; i3++) {
						System.out.print("#");
					}
					System.out.print("\n");
				} else {
					for (int i3 = 0; i3 < detaW[i]; i3++) {
						if (i3 == 0 || i3 == detaW[i] - 1) {
							System.out.print("#");
						} else {
							System.out.print(".");
						}
					}
					System.out.print("\n");
				}
			}
			System.out.print("\n");
		}
		sc.close();
	}
}


Measured memory_bytes: 37176
//AnkitCode99 (DP)....
//every ups and downs matter!

#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr)
typedef long long int ll;

using namespace std;

const ll sz=1e5+5;

ll n,totW;
ll val[105],wt[105];
ll cache[105][sz];

ll dp(ll idx,ll wt_till_now)
{
	if(wt_till_now>totW)
		return -1e15;

	if(idx==n+1)
		return 0;
 	
 	ll &ans=cache[idx][wt_till_now];
 	if(ans!=-1)
 		return ans;

 	ans=max(dp(idx+1,wt_till_now),val[idx]+dp(idx+1,wt_till_now+wt[idx]));

 	return ans;
}

int main()
{
	fast;
	

	memset(cache,-1,sizeof cache);
	cin>>n>>totW;
	for(ll i=1;i<=n;i++)
	{
		cin>>wt[i]>>val[i];
	}

	cout<<dp(1,0);//for knapsack problem bottom-up is the only solution!

}//Goodbye...

Measured memory_bytes: 82304
# encoding: "utf-8"

class Stdin:
    @staticmethod
    def read_line(converter=str):
        return [converter(x) for x in input().split()]
    
    @staticmethod
    def read_lines(n, converter=str):
        result = list()
        for _ in range(n):
            result.append(Stdin.read_line(converter))
        return result
    
    @staticmethod
    def convert(data, converter):
        assert(len(data) == len(converter))
        return tuple(map(lambda x, f: f(x), data, converter))

    @staticmethod
    def convert_lines(datas, n, converter):
        return [converter(data, n, converter) for data in datas]


def count_and_drop(xs):
    cnt = 0
    key = xs[0]
    for x in xs:
        if x != key:
            break
        cnt += 1
    del xs[:cnt]
    return (key, cnt)


def main():
    _ = input()
    xs = Stdin.read_line(converter=int)
    xs.sort()
    ys = dict()
    while xs:
        key, cnt = count_and_drop(xs)
        ys[key] = cnt
    m = 0
    for x in ys.keys():
        temp = ys.get(x-1, 0) + ys.get(x, 0) + ys.get(x+1, 0)
        if m < temp:
            m = temp
    print(m)

if __name__ == "__main__":
    main()


Measured memory_bytes: 14300
N=int(input())
import itertools
A = list(map(int, input().split())) 

count=0
if len(A)<=2:
    print(0)
else:
    for ｔ in itertools.combinations(A, 3):
        if t[2]<t[0]+t[1] and t[1]<t[0]+t[2] and t[0]<t[1]+t[2] and t[0]!=t[1]!=t[2]!=t[0]:

            count+=1

    print(count)

Measured memory_bytes: 9360
package main

import "fmt"

func main(){
  var N int
  fmt.Scan(&N)
  S := make([]string, N)
  result := "Three"
  for i:=0;i<N;i++{
    fmt.Scan(&S[i])

  }
  for i:=0;i<N;i++{
    if S[i] == "Y"{
      result = "Four"
    }
  }
  fmt.Println(result)
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(), (c).end());
const long long MOD = 1e9 + 7;
typedef long long ll;

int main(){
	int a, b;
	cin >> a >> b;
	string ans = "Yes";
	if(a == 2 || b == 2)ans = "No";
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  rep(i, N) cin >> A[i];
  int cur = 0;
  for (auto a : A) {
    if (a == cur + 1) {
      cur++;
    }
  }
  cout << (cur>0 ? N - cur : -1)  << '\n';
  return 0;
}

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

#define mem(t, v)   memset ((t) , v, sizeof(t))
#define all(x)      x.begin(),x.end()
#define un(x)       x.erase(unique(all(x)), x.end())
#define sf(n)       scanf("%d", &n)
#define sff(a,b)    scanf("%d %d", &a, &b)
#define sfff(a,b,c) scanf("%d %d %d", &a, &b, &c)
#define sl(n)       scanf("%lld", &n)
#define sll(a,b)    scanf("%lld %lld", &a, &b)
#define slll(a,b,c) scanf("%lld %lld %lld", &a, &b, &c)
#define D(x)        cerr << #x " = " << (x) << '\n'
#define DBG         cerr << "Hi" << '\n'
#define pb          push_back
#define PI          acos(-1.00)
#define xx          first
#define yy          second
#define eps         1e-9

typedef unsigned long long int ULL;
typedef long long int LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;


inline int setBit(int N, int pos) { return N=N | (1<<pos); }
inline int resetBit(int N, int pos) { return N= N & ~(1<<pos); }
inline bool checkBit(int N, int pos) { return (bool)(N & (1<<pos)); }

//int fx[] = {+0, +0, +1, -1, -1, +1, -1, +1};
//int fy[] = {-1, +1, +0, +0, +1, +1, -1, -1}; //Four & Eight Direction

int main()
{
//    freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);

    string a, b;
    cin >> a >> b;
    sort(all(a));
    sort(all(b));
    reverse(all(b));
    if(a < b)
        puts("Yes");
    else
        puts("No");
    return 0;
}




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

using pii = pair<int,int>;
using ll = long long;
#define rep(i, j) for(int i=0; i < (int)(j); i++)
#define repeat(i, j, k) for(int i = (j); i < (int)(k); i++)
#define all(v) v.begin(),v.end()
#define debug(x) cerr << #x << " : " << x << endl

template<class T> bool set_min(T &a, const T &b) { return a > b  ? a = b, true : false; }
template<class T> bool set_max(T &a, const T &b) { return a < b  ? a = b, true : false; }
// vector
template<class T> istream& operator >> (istream &is , vector<T> &v) { for(T &a : v) is >> a; return is; }
template<class T> ostream& operator << (ostream &os , const vector<T> &v) { for(const T &t : v) os << "\t" << t; return os << endl; }
// pair
template<class T, class U> ostream& operator << (ostream &os , const pair<T, U> &v) { return os << "<" << v.first << ", " << v.second << ">"; }

const int INF = 1 << 30;
const ll INFL = 1LL << 60;


class Solver {
  public:
    bool solve() {
        int N; cin >> N;
        vector<int> X(N); cin >> X;
        vector<ll> group;
        ll m = 0;
        int pre = 0;
        int cnt = 0;
        rep(i, N) {
            cnt++;
            int now = X[i];
            m += now - pre - 1;
            if(m + 2 <= cnt) {
                group.push_back(cnt);
                cnt = 0;
                m = 0;
            }
            pre = now;
        }
        if(cnt) group.push_back(cnt);
        
        ll ans = 1;
        ll allcnt = 0;
        int i = 0;
        do {
            if(i < group.size()) allcnt += group[i];
            ans *= allcnt;
            ans %= 1000000000 + 7;
            allcnt--;
            i++;
        } while(allcnt);
        cout << ans << endl;
        return 0;
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    Solver s;
    s.solve();
    return 0;
}


Measured memory_bytes: 1276
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
  public static void main(String[] args) throws NumberFormatException, IOException {
    BufferedReader input = new BufferedReader(new InputStreamReader(System.in));

    final int datasetCount = Integer.valueOf(input.readLine());
    while (input.ready()) {
      final String[] datasetStr = input.readLine().split(" ");
      float[] lineAB = new float[datasetStr.length / 2];
      float[] lineCD = new float[datasetStr.length / 2];
      for (int i = 0; i < 4; i++) {
        lineAB[i] = Float.parseFloat(datasetStr[i]);
      }
      for (int i = 0; i < 4; i++) {
        lineCD[i] = Float.parseFloat(datasetStr[i + 4]);
      }

      System.out.println(isParallelStr(lineAB, lineCD));
    }
  }

  private static String isParallelStr(float[] lineAB, float[] lineCD) {
    if (isParallel(lineAB, lineCD)) {
      return "YES";
    }
    return "NO";
  }

  private static boolean isParallel(float[] lineAB, float[] lineCD) {
    final double slopeLineAB = getSlope(lineAB[0], lineAB[1], lineAB[2], lineAB[3]);
    final double slopeLineCD = getSlope(lineCD[0], lineCD[1], lineCD[2], lineCD[3]);
    return slopeLineAB == slopeLineCD;
  }

  private static double getSlope(float x1, float y1, float x2, float y2) {
    final double diff_X = x2 - x1;
    final double diff_Y = y2 - y1;
    if (diff_X == 0L) {
      return Double.MAX_VALUE;
    }
    final double slope = diff_Y / diff_X;
    return slope;
  }
}

Measured memory_bytes: 24596
import Control.Applicative ((<$>))
import Data.List

main :: IO ()
main = solve <$> map read <$> words <$> getLine >>= print

solve :: [Int] -> Int
solve xs
  | even s = s `div` 2
  | otherwise = (s + 3) `div` 2
  where
    [a, b, c] = sort xs
    s = 2*c-a-b


Measured memory_bytes: 508
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define sayyes cout<<"Yes"<<endl;
#define sayno cout<<"No"<<endl;
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
const int mod =1e9+7;

struct mint
{
    ll x;
    //constructor
    mint(ll y=0):x((y%mod+mod)%mod){}

    
    mint operator-() const{return mint(-x);}

    mint& operator+=(const mint a)
    {
        if((x+=a.x)>=mod) x-=mod;
        return *this;
    }

    mint& operator-=(const mint a)
    {
        if((x+=mod-a.x)>=mod)x-=mod;
        return *this;
    }

    mint& operator*=(const mint a)
    {
        (x*=a.x)%=mod;
        return *this;
    }

    mint operator+(const mint a)const{
        mint res(*this);
        return res+=a;
    }

    mint operator-(const mint a)const
    {
        mint res(*this);
        return res-=a;
    }

    mint operator*(const mint a)const
    {
        mint res(*this);
        return res*=a;
    }

    mint pow(ll t)const{
        if(t==0)return 1;
        mint a=pow(t/2);
        a*=a;
        if(t%2==1)a*=2;
        return a;
    }

    mint inv() const{
        return pow(mod-2);
    }

    mint& operator/=(const mint a)
    {
        return (*this)*=a.inv();
    }

    mint operator/(const mint a)const{
        mint res(*this);
        return res/=a;
    }

};

mint choose(int n, int a)
{
    mint x=1,y=1;
    rep(i,a)
    {
        x*=n-i;
        y*=i+1;
    }
    return x/y;
}

int main()
{
    ll n;
    ll k;
    cin>>n>>k;
    vector<int> a(n);
    rep(i,n)
    {
        cin>>a[i];
    }
    ll back=0;
    ll front=0;
    rep(i,n-1)
    {
        for(int j=i+1;j<n;j++)
        {
            if(a[i]>a[j])back++;
            else if(a[i]<a[j])front++;
        }
        
    }
    mint temp=k*(k+1)/2;
    mint temp2=k*(k-1)/2;
    mint backall=back*temp.x;
    mint frontall=front*temp2.x;
    mint ans=(backall+frontall);
    cout<<ans.x;
}


Measured memory_bytes: 256
# Tree - Rooted Trees
class Node:
    def __init__(self, idnty):
        self.id = idnty
        self.parent = None
        self.children = []
        self.depth = 0
    def __str__(self):
        prnt = self.parent.id if self.parent else -1
        typ = 'root'
        if self.depth > 0: typ = 'internal node'
        if self.depth > 0 and not self.children: typ = 'leaf'
        cld = [n.id for n in self.children]
        return 'node {0}: parent = {1}, depth = {2}, {3}, {4}'.format(self.id, prnt, self.depth, typ, cld)

n = int(input())
tr = [Node(i) for i in range(n)]
for _ in range(n):
    rl = list(map(int, input().split()))
    id, k = rl[0],rl[1]
    if k > 0:
        for i in rl[2:]:
            c = tr[i]
            c.parent = tr[id]
            c.depth += tr[id].depth + 1
            tr[id].children.append(c)
    else:
        p = tr[id].parent
        if p:
            tr[id].depth = p.depth + 1
for t in tr: print(t)


Measured memory_bytes: 55056
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n):
    res = [None] * n
    for i in range(n):
        res[i] = II()
    return res
def LIR(n):
    res = [None] * n
    for i in range(n):
        res[i] = LI()
    return res
def FR(n):
    res = [None] * n
    for i in range(n):
        res[i] = IF()
    return res
def LFR(n):
    res = [None] * n
    for i in range(n):
        res[i] = IF()
    return res
def LIR_(n):
    res = [None] * n
    for i in range(n):
        res[i] = LI_()
    return res
def SR(n):
    res = [None] * n
    for i in range(n):
        res[i] = S()
    return res
def LSR(n):
    res = [None] * n
    for i in range(n):
        res[i] = LS()
    return res
mod = 1000000007
inf = float('INF')

#solve
def solve():
    n = II()
    a = LI()
    q = II()
    bc = LIR(q)
    d = defaultdict(int)
    for i in a:
        d[i] += 1
    ans = 0
    for key, value in d.items():
        ans += key * value 
    for b, c in bc:
        x = d[b]
        ans -= x * b
        d[b] = 0
        d[c] += x
        ans += x * c
        print(ans)
    return


#main
if __name__ == '__main__':
    solve()


Measured memory_bytes: 97956
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <map>
#include <vector>
#include <cstring>
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 10;
const int mod = 1e9 + 7;
char s[maxn<<1];
int main(){
	int n;scanf("%d",&n);
	scanf("%s",s+1);
	int count = 0;
	ll ans=1;
	for(int i=1;i<=n;i++){
		ans=(ans*i)%mod;
	}
	for(int i=1;i<=2*n;i++){
		if(count&1){
			if(s[i]=='B'){
				if(count>0){
					
					ans=(ans*count)%mod;
					count--;
				}
				else{
					puts("0");
					return 0;
				}
			}
			else if(s[i]=='W'){
				count++;
			}
		}
		else{
			if(s[i]=='W'){
				if(count>0){
			
					ans=(ans*count)%mod;
					count--;
				}
				else{
					puts("0");
					return 0;
				}
			}
			else if(s[i]=='B'){
				count++;
			}
		}
	}
	if(count) ans=0;
	printf("%lld\n",ans%mod);
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const ll INF = 1e18;
const long double EPS = 1e-10;

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

  int res = 0, ans = 1;
  rep(i, n) {
    int cnt = 0, m = i + 1;
    while (m % 2 == 0) {
      cnt++;
      m /= 2;
    }
    if (cnt > res) {
      res = cnt;
      ans = i + 1;
    }
  }
  cout << ans << endl;


  
  return 0;
}

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

LL MOD = 1000000007;


int main(){
    LL n;
    cin >> n;
    vector<int> a(n);
    vector<int> b(n);

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

    sort(a.begin(),a.end());
    sort(b.begin(),b.end());

    LL left,right;

    if(n % 2 == 1){
        left = a[n/2];
        right = b[n/2];
    }else{
        left = a[n / 2 - 1] + a[n / 2];
        right = b[n / 2 - 1] + b[n / 2];
    }

    cout << right - left + 1 << endl;

    return 0;
}

Measured memory_bytes: 4848
// in the name of god
// author : esoheil84

#include <bits/stdc++.h>

using namespace std;

int ans;

int main() {
	int n, c;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> c;
		if (c & 1 && i & 1) ans++;
	}
	cout << ans;
}


Measured memory_bytes: 3564
#include<bits/stdc++.h>
using namespace std;
int main ()
{   int a[4];
    scanf("%d %d %d",&a[1],&a[2],&a[3]);
    sort(a+1,a+1+3);
    int k=0;
    if(a[1]==a[2])   k++;
    if(a[2]==a[3])  k++;
    if(k==1)   printf("Yes");
    else   printf("No");
     return 0;
 } 

Measured memory_bytes: 256
N, A, B = map(int, input().split())
if A == 0:
  print(0)
  exit()
if B == 0:
  print(N)
  exit()
t = int(N / (A + B))
diff = N - t * (A + B)
if diff > A:
  print(A * t + A)
else:
  print(A * t + diff)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define eb emplace_back
#define pb push_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define chmin(x,y) if(x>y)x=y
#define chmax(x,y) if(x<y)x=y
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef priority_queue<ll> PQ;
typedef priority_queue<ll,vector<ll>,greater<ll>> SPQ;
using vi=vector<ll>;
using vvi=vector<vector<ll>>;
using vc=vector<char>;
using vvc=vector<vector<char>>;
const ll inf=100100100100;
const int Inf=1001001001;
const int mod=1000000007;
const double pi=3.141592653589793;
const double mi=0.0000005;
int main(){
    double a,b,x;cin>>a>>b>>x;
    double k;
    double lb=0,ub=90;
    if(x/a<a*b/2)k=a*b*b/(x*2);
    else if(x/a==a*b/2)k=b/a;
    else k=(2*a*a*b-2*x)/(a*a*a);
    rep(j,1000000){
        double i=(lb+ub)/2;
        double t=tan(i*pi/180);
        if(t==k){
            cout<<fixed<<setprecision(11);
            cout<<i<<endl;
            return 0;
        }
        if(t>k)ub=i;
        else lb=i;
      if(j==999999){
        cout<<fixed<<setprecision(11);
        cout<<i<<endl;
      }
    }
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
using namespace std;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }

int main() {
    int N; cin >> N;
    vector<long long> A(N);
    for (int i = 0; i < N; ++i) cin >> A[i];

    long long res = A[0];
    for (int i = 0; i < N; ++i) {
        res = GCD(res, A[i]);
    }
    cout << res << endl;
}

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

int N;
int A[20];
int x[20][20];
int y[20][20];

int counter(int x) {
	if (x == 0) return 0;
	return counter(x >> 1) + (x & 1);
}

void solve() {
	cin >> N;
	for (int i = 1; i <= N; i++) {
		cin >> A[i];
		for (int j = 1; j <= A[i]; j++) {
			cin >> x[i][j] >> y[i][j];
		}
	}
	int ans = 0;
	for (int bits = 1; bits < (1 << N); bits++) {
		bool ok = true;
		for (int i = 1; i <= N; i++) {
			if (!(bits & (1 << (i - 1)))) continue;
			for (int j = 1; j <= A[i]; j++) {
				if (((bits >> (x[i][j] - 1)) & 1) ^ y[i][j]) ok = false;
			}
		}
		if (ok) ans = max(ans, counter(bits));
	}
	cout << ans << endl;
	return;
}

int main() {
	solve();
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <queue>
typedef long long ll;
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define mod 1000000007

int main(){
	int N;
	cin >> N;
	if(N >= 100 && N <= 111){
		cout << 111 << endl;
	}
	else if(N >= 112 && N <= 222){
		cout << 222 << endl;
	}
	else if(N >= 223 && N <= 333){
		cout << 333 << endl;
	}
	else if(N >= 334 && N <= 444){
		cout << 444 << endl;
	}
	else if(N >= 445 && N <= 555){
		cout << 555 << endl;
	}
	else if(N >= 556 && N <= 666){
		cout << 666 << endl;
	}
	else if(N >= 667 && N <= 777){
		cout << 777 << endl;
	}
	else if(N >= 778 && N <= 888){
		cout << 888 << endl;
	}else{
		cout << 999 << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>

#define rep(i, first, to) for(ll i = first; i < to; ++i)

using namespace std;
typedef long long ll;

int main() {
	ll n, a, b;

	cin >> n >> a >> b;

	if (a > b || (n == 1) && a < b) {
		cout << 0 << endl;
	} else {
		cout <<  (b * (n - 1) + 1 - (a * (n - 1) + b - a)) << endl; 
	}

}

Measured memory_bytes: 256
package main

import "fmt"

func gcd(a, b int) int {
	if a > b {
		a, b = b, a
	}
	for a != 0 {
		a, b = b%a, a
	}
	return b
}

func lcm(a, b int) int {
	return a / gcd(a, b) * b
}
func main() {
	var k int
	fmt.Scan(&k)
	var ans int
	for a := 1; a <= k; a++ {
		for b := 1; b <= k; b++ {
			for c := 1; c <= k; c++ {
				ans += gcd(gcd(a, b), c)
			}
		}
	}
	fmt.Println(ans)
}


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    string S, T, U;
    ll A, B;
    cin >> S >> T >> A >> B >> U;
    if (S == U) {
        cout << A - 1 << " " << B << '\n';
    } else {
        cout << A << " " << B - 1 << '\n';
    }
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,N) for (int i = 0; i < (N); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main(void){
  int a, b;
  cin >> a >> b;

  if (b % a == 0) cout << a + b << endl;
  else cout << b - a << endl;
}


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

string alphabet = "abcdefghijklmnopqrstuvwxyz";

int main(){
	string s;
	cin >> s;
	map<char,int> mp;
	rep(i,s.size()){
		mp[s[i]]++;
	}
	bool flag = true;
	rep(i,26){
		if(mp[alphabet[i]] == 0) flag = false;
	}
	
	if(!flag){
		rep(i,26){
			if(mp[alphabet[i]] == 0){
				cout << s + alphabet[i] << endl;
				return 0;
			}
		}
	}else{
		vector<int> d;
		rep(i,26){
			int id = s[i] - 'a';
			d.push_back(id);
		}
		
		if(!next_permutation(d.begin(),d.end())){
			cout << -1 << endl;
		}else{
			rep(i,26){
				if(alphabet[d[i]] != s[i]){
					cout << alphabet[d[i]] << endl;
					return 0;
				}else{
					cout << alphabet[d[i]];
				}
			}
		}
	}
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
//#define int long long
typedef long long ll;
const int MOD = 1000000007;
const int INF = 1010000000;
const double EPS = 1e-10;
using namespace std;
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 

signed main() {
  ll l;cin>>l;
  ll dp[200001][5];rep(i,5)dp[0][i] = 0;
  repd(i,1,l+1){
    ll a;cin>>a;
    dp[i][0] = dp[i-1][0]+a;
    dp[i][1] = min(dp[i-1][1]+(a==0 ? 2 : a % 2), dp[i][0]);
    dp[i][2] = min(dp[i-1][2]+((a+1) % 2), dp[i][1]);
    dp[i][3] = min(dp[i-1][3]+(a==0 ? 2 : a % 2), dp[i][2]);
    dp[i][4] = min(dp[i-1][4]+a, dp[i][3]);
  }
  cout << dp[l][4] << endl;
}


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

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

int main() {
    int n, p[20005], a[20005]{}, b[20005]{};
    cin >> n;
    REP(i,n)cin >> p[i];
    REP(i,n-1){
        a[p[i+1]-1] += i+1;
        b[p[i+1]-1] += i+1;
        
    }
    a[0] += 1;
    REP(i,n-1)a[i+1] += a[i]+1;
    b[n-1] += 1;
    REPR(i,n-2)b[i] += b[i+1]+1;
    REP(i,n)cout << a[i] << (i<n-1?" ":"\n");
    REP(i,n)cout << b[i] << (i<n-1?" ":"\n");
    return 0;
}


Measured memory_bytes: 896
#include"bits/stdc++.h"
using namespace std;
int main(){
	int n;
	cin>>n;
	long long ans=0;
	int a,b;
	cin>>a>>b;
	for(int i=0;i<=n;++i){
		int x=0;
		string s=to_string(i);
		for(int i=0;i!=s.size();++i)
			x+=stoi(s.substr(i,1));
		if(x>=a && x<=b)
			ans+=i;
	}
	cout<<ans;
}

Measured memory_bytes: 256