akhauriyash/Code-Regression huggingface dataset:
//Let's join Kaede Takagaki Fan Club !!
//明日は高垣楓さんの誕生日！おめでとうございます！！！
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target ("avx")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
#define all(x) x.begin(),x.end()
template<class T>
void dmp(T a){
	rep(i,a.size()) cout << a[i] << " ";
	cout << endl;
}
template<class T>
bool chmax(T&a, T b){
	if(a < b){
		a = b;
		return 1;
	}
	return 0;
}
template<class T>
bool chmin(T&a, T b){
	if(a > b){
		a = b;
		return 1;
	}
	return 0;
}
template<class T>
void g(T &a){
	cin >> a;
}
template<class T>
void o(const T &a,bool space=false){
	cout << a << (space?' ':'\n');
}
//ios::sync_with_stdio(false);
const ll mod = 1000000007;//998244353
template<class T>
void add(T&a,T b){
	a+=b;
	if(a >= mod) a-=mod;
}
ll gcd(ll a, ll b){
	if(a < b) swap(a, b);
	if(b == 0) return a;
	else return gcd(b, a%b);
}
ll specific(ll h, ll w, ll dif, ll k){
	ll ans = 0;
	ll DH = gcd(h, dif);
	for(ll i=1;i<h;i++){
		if(dif * i > 450000LL) break;
		ll lb = 0, ub = w-dif;
		chmin(ub, (450000LL-dif*i) / h + 1LL);
		chmax(ub, 1LL);
		while(ub-lb > 1){
			ll mid = (lb+ub)/2;
			ll S = 1LL * h * (mid+dif) - 1LL * (h-i) * (dif);
			S += 2;
			S -= gcd(i, mid) + gcd(h-i, mid+dif) + DH;
			if(S <= 2*k) lb = mid;
			else ub = mid;
		}
		ans += ub-1;
	}
	return ans;
}
ll calc(ll w, ll h, ll k){
	ll ret = 0;
	for(int i=0;i<=w-2;i++){
		ret += specific(h, w, i, k) * (i==0?1LL:2LL);
	}
	return ret;
}
int main(){
	ios::sync_with_stdio(false);
	int w, h, k;
	cin >> w >> h >> k;
	ll ans = calc(w, h, k) + calc(h, w, k);
	ans <<= 1;
	cout << ans << '\n';
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int main()
{
   long long int n,r,x;
    cin>>n>>r;
    if(n<10)
    {
        cout<<r+100*(10-n)<<endl;
    }
    else
    {
        cout<<r<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
N = int(input())
XYHs = [list(map(int, input().split())) for _ in range(N)]

for Cx in range(100 + 1):
    for Cy in range(100 + 1):
        flg = True
        H = -1
        max_H = float('inf')
        for x, y, h in XYHs:
            CF = abs(x - Cx) + abs(y - Cy)
            if h == 0:
                max_H = min(max_H, CF)
            else:
                t = h + CF
                if H == -1:
                    H = t
                elif H != t:
                    flg = False
                    break
        if flg and H <= max_H:
            print(Cx, Cy, H)
            exit()

Measured memory_bytes: 3064
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
int main()
{
	char a[4];
	scanf("%s",a);
	int star=0;
	int end=2;
	while(star <= end)
	{
		if(a[star]!=a[end])
			break;
		star++;
		end--;
	}
	if(star<=end)
		printf("No");
	else
		printf("Yes");
	return 0;
}

Measured memory_bytes: 128
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
#include <complex>
#include <cmath>
#include <array>
#include <numeric>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
//#define mod 998244353
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pint> vpint;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=100050;
//↑templete
int main() {
	int N,K,Q;
	cin>>N>>K>>Q;
	int A[SIZE]={};
	for(int i=0;i<Q;i++){
		int a;
		cin>>a;
		a--;
		A[a]++;
	}
	for(int i=0;i<N;i++){
		if(A[i]>Q-K)
			cout<<"Yes"<<endl;
		else
			cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int n;
  cin>>n;
  int x;
  cin>>x;
  int a[111];
  int sum=0;
  for(int i=0;i<n;i++){
    cin>>a[i];
    sum+=a[i];
  }
  if(sum==x)cout<<n<<endl;
  else if(sum<x)cout<<n-1<<endl;
  else{
  sort(a,a+n);
  int cnt=0;
  for(int i=0;i<n;i++){
    if(x>=a[i]){
      cnt++;
      x-=a[i];
    }
  }
  cout<<cnt<<endl;
  }
  return 0;
}


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

int dp[3010][3010];

int main(){
    string s,t;
    cin>>s>>t;
    for(int i=0;i<=s.size();++i){
        dp[i][0]=0;
    }
    for(int i=1;i<=t.size();++i){
        dp[0][i]=0;
    }
    for(int i=1;i<=s.size();++i){
        for(int j=1;j<=t.size();++j){
            if(s[i-1]==t[j-1]){
                dp[i][j]=dp[i-1][j-1]+1;
            }else{
                dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
            }
        }
    }
    string ans="";
    int i=s.size(),j=t.size();
    while(i>0&&j>0){
        if(dp[i][j]==dp[i-1][j]){
            --i;
        }else if(dp[i][j]==dp[i][j-1]){
            --j;
        }else{
            ans=s[i-1]+ans;
            --i; --j;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 35584
#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-1; i >= 0; i--)
#define all(x) x.begin(), x.end()
using ll = long long;
using pii = pair<int, int>;
const int mod = 1e9+7;

int main() {
    string s, t;
    cin >> s >> t;
    int _s = s.size(), _t = t.size();
    if (_s < _t) {
        cout << "UNRESTORABLE" << endl;
        return 0;
    }
    priority_queue<string, vector<string>, greater<string>> ans;
    for (int i = 0; i + _t <= _s; i++) {
        string x = s;
        bool flag = false;
        for (int j = 0; j < _t; j++) {
            if (s[i + j] != t[j] && s[i + j] != '?') {
                flag = true;
                break;
            } else {
                x[i + j] = t[j];
            }
        }
        if (flag) continue;
        for (int k = 0; k < _s; k++) {
            if (x[k] == '?') {
                x[k] = 'a';
            }
        }
        ans.push(x);
    }
    if (ans.empty()) {
        cout << "UNRESTORABLE" << endl;
        return 0;
    } else {
        cout << ans.top() << endl;
        return 0;
    }
}

Measured memory_bytes: 3636
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;

#define ran 111111
#define lim 11111111

int n, m;
vector<int> e[ran];
pair<int, int> v[ran];
bool flag;

bool merge(pair<int, int> &a, pair<int, int> b) {
	if (b.first <= -lim) return true;
	b.first--; b.second++;
	if (a.first <= -lim) {
		a=b; return true;
	}
	if (a.first % 2 != b.first % 2) return false;
	a.first = max(a.first, b.first);
	a.second = min(a.second, b.second);
	return a.first <= a.second;
}

void _dfs(int cur, int par) {
	for(int i=0;i<(int)e[cur].size();i++) {
		int nxt = e[cur][i];
		if(nxt == par) continue;
		
		merge(v[nxt], v[cur]);
		_dfs(nxt, cur);
	}
}

void dfs(int cur, int par) {
	for(int i=0;i<(int)e[cur].size();i++) {
		int nxt = e[cur][i];
		if (nxt==par) continue;
		
		dfs(nxt, cur);
		if (!flag) return;
		if (!merge(v[cur], v[nxt])) {
			flag = false;
			return;
		}
	}
}

int main() {
	scanf("%d", &n);
	for(int i=1;i<n;i++) {
		int x, y; scanf("%d%d", &x, &y);
		e[x].push_back(y);
		e[y].push_back(x);
	}
	for(int i=1;i<=n;i++)
		v[i] = make_pair(-lim, lim);
	scanf("%d", &m);
	for(int i=0;i<m;i++) {
		int x, y; scanf("%d%d", &x, &y);
		v[x] = make_pair(y, y);
	}
	
	flag = true;
	dfs(1, -1);
	
	if (flag) {
		v[1] = make_pair(v[1].first, v[1].first);
		_dfs(1, -1);
	}
	
	if (!flag) puts("No");
	else {
		puts("Yes");
		for(int i=1;i<=n;i++)
			printf("%d\n", v[i].first);
	}
	
	return 0;
}

Measured memory_bytes: 15232
#define _USE_MATH_DEFINES
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cctype>
#include<climits>
#include<cmath>
#include<cstdio>
#include<deque>
#include<list>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<map>
#include<queue>
#include<vector>
using namespace std;

int main() {
	string s[11] = {
		"light fly",
		"fly",
		"bantam",
		"feather",
		"light",
		"light welter",
		"welter",
		"light middle",
		"middle",
		"light heavy",
		"heavy",
	};
	int a[12] = { 0,48,51,54,57,60,64,69,75,81,91,INT_MAX };

	for (double b; cin >> b;)
		for (int i = 0; i < 11; i++)
			if (a[i] < b&&b <= a[i + 1]) {
				cout << s[i] << endl;
				break;
			}

	return 0;
}

Measured memory_bytes: 1228
#include <iostream>
#include <string>
#include <sstream>
#include <cmath>
#include <iomanip>
#include <algorithm>
#include <list>
#include <stack>
#include <queue>
#include <vector>
#include <deque>

using namespace std;

int main(){
	int n;
	int s[100001];
	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> s[i];
	}
	int q;
	cin >> q;
	int count = 0;
	for (int i = 0; i < q; i++){
		int t;
		cin >> t;
		int left = 0, right = n;
		while (left < right){
			int mid = (left + right) / 2;
			if (s[mid] == t){
				count++;
				break;
			}
			else if (t < s[mid]){
				right = mid;
			}
			else{
				left = mid + 1;
			}
		}
	}
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 1548
#include <bits/stdc++.h>
using namespace std;
//#define int long long
template<typename T> inline bool chmax(T& a,T b) { if (a < b) { a = b; return true; } return false; }
template<typename T> inline bool chmin(T& a,T b) { if (a > b) { a = b; return true; } return false; }

signed main() {
    int N;
    cin >> N;
    vector<pair<int, int>> A;
    for (int i = 0; i < N; i++) {
        int a; cin >> a;
        A.emplace_back(a, i);
    }
    sort(A.begin(), A.end());
    for (auto p : A) cout << p.second+1 << endl;
    return 0;
}

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

int main(){
    int H, W;
    cin >> H >> W;
    char C[H][W];
    rep(i, H){
        rep(j, W){
            cin >> C[i][j];
        }
    }
    rep(i, 2*H){
        rep(j, W){
            cout << C[i/2][j];
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using u32 = uint32_t;
using vi = vector<int>;    using vvi = vector<vi>;
using vb = vector<bool>;   using vvb = vector<vb>;
using vl = vector<ll>;     using vvl = vector<vl>;
using vd = vector<double>; using vvd = vector<vd>;

#define MAXC(c, x) (c = max(c, x))
#define MINC(c, x) (c = min(c, x))

#define REP(i,n) for(auto i = 0 * (n), i##_len = (n); i < i##_len; ++i)
#define ALL(c) (c).begin(), (c).end()
#define FOR(i,s,n) for(ll i=s, i##_len=(ll)(n); i<i##_len; ++i)
#define TEN(x) ((ll)1e##x)
const ll mod = TEN(9) + 7;

// Union find : O(α(V))
// verified : 
class UnionFind {
	typedef ll U;
	// v[i] : i番目の頂点が根 ? i番目の頂点の属する木のサイズ * -1
	//                       : i番目の頂点の親のindex
	vector<ll> v;
public:
	UnionFind(U n) : v(n, -1) {}
	U find(U x) { return v[x] < 0 ? x : (v[x] = find(v[x])); }
	bool same(U x, U y) { return find(x) == find(y); }
	U size(U x) { return (U)-v[find(x)]; }
	void unite(U x, U y) {
		x = find(x); y = find(y);
		if (x != y) {
			if (-v[x] < -v[y]) swap(x, y);
			v[x] += v[y];
			v[y] = x;
		}
	}
};

int main() {
	#ifdef INPUT_FROM_FILE
	ifstream cin("sample.in");
	ofstream cout("sample.out");
	#endif
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(50);

	ll n; cin >> n;
	vl a(n); REP(i, n) cin >> a[i];
	sort(ALL(a));
	ll idx = 0, cur = a[0];
	FOR(i, 1, n) {
		if (cur * 2 < a[i]) {
			idx = i;
			cur += a[i];
		} else {
			cur += a[i];
		}
	}
	cout << n - idx << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <array>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include <set>
#include <math.h>
#include <queue>
#include <stdio.h>
#include <sstream>
using namespace std;
using i64 = int64_t;
#define rep(i, n) for(int i=0;i<n;++i)
#define rep2(i, x, n) for(int i=x;i<n;++i)

int main()
{   
    int a,b,c,x;
    cin >> a >> b >> c >> x;

    int cnt = 0;
    rep(i,a+1)
        rep(j,b+1)
            rep(k,c+1)
            {
                if(500*i+100*j+50*k==x)
                    cnt++;
            }
    cout << cnt << endl;
    return 0;
}

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

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



Measured memory_bytes: 3088
#include<stdio.h>
int main(void)
{
	int a,b,c;
	scanf("%d %d %d",&a,&b,&c);
		if(a+b==c){
			printf("Yes\n");
		}
		else if(a+c==b){
			printf("Yes\n");
		}
		else if(b+c==a){
			printf("Yes\n");
		}
		else{
			printf("No\n");
		}
	return 0;
}

Measured memory_bytes: 128
//*in the name of GOD*\\

#include <bits/stdc++.h>

using namespace std;

typedef long long int ll;
typedef long double ld;
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

int main(){
  string s;
  cin >> s;
  int ans = 0;
  for(int i = 0 ; i < s.size(); i++)
    if(s[i] == '1')
      ans++;
  cout << ans;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include <unordered_map>
//#include"testlib.h"
#define endl "\n"
#define all(v) v.begin(),v.end()
#define allr(s) s.rbegin(),s.rend()
#define RT(s) return cout<<s,0
#define watch(x) cout << (#x)<<" = "<<x<<endl
#define sz(s)    (int)(s.size())
#define PI acos(-1)
#define EPS 1e-8
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
int dy[] = { 1, -1, 0, 0, -1, 1, 1, -1 };
int dx[] = { 0, 0, 1, -1, 1, -1, 1, -1 };
void file() {
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
#else
	//freopen("street.in", "r", stdin);
	//freopen("out.txt", "w", stdout);
#endif
}
void fast() {
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
}
ll mx = 1e18;
bool overFlow(ll a, ll b) {
	return !(a <= mx / b);
}
int main() {
//	file();
	fast();
	ll a;
	long double x;
	cin >> a >> x;
	ll ans = a * x;
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3748
#include <iostream>
#include <cmath>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)

int isSquare(int n) {
  for(int i=0;i<=sqrt(n)+1;i++) {
    if(i*i==n) return 1;
  }
  return 0;
}

int main() {
  int n,d;
  int** x;
  int dist2,ans;
  cin >> n >> d;

  x = new int*[n];
  rep(i,n) x[i] = new int[d];

  rep(i,n) {
    rep(k,d) {
      cin >> x[i][k];
    }
  }

  ans = 0;
  rep(i,n-1) {
    for(int j=i+1;j<n;j++) {
      dist2 = 0;
      rep(k,d) dist2 += pow(x[i][k] - x[j][k],2);
      if(isSquare(dist2)) ans++;
    }
  }

  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//cout << fixed << setprecision(17) << res << endl;
 
int main() {
    ll n;
    cin >> n;
    vector<ll> A(n);
    for (auto & a : A) cin >> a;
    ll res = 1;
    for (auto a : A) {
        if (a == 0) {
            cout << 0 << endl;
            return 0;
        }
    }
    for (auto a : A) {
        if (res > (1000000000000000000/a)) {
            cout << -1 << endl;
            return 0;
        }
        res *= a;
        if (res > 1000000000000000000) {
            cout << -1 << endl;
            return 0;
        }
    }
    cout << res << endl;
}


Measured memory_bytes: 4052
import java.io.*;
import java.util.*;
import java.lang.*;

class Main {
    public static void main(String [] args){
        Scanner scan = new Scanner(System.in);
        
        while(true){
            String s = scan.next();
            
            if(s.equals("-")){
                break;
            }
            
            int m = scan.nextInt();
            
            for(int i = 0; i < m; ++i){
                int h    = scan.nextInt();
                String t = s.substring(0, h);
                String b = s.substring(h);
                
                s = b + t;
            }
            
            System.out.println(s);
        }
    }
}


Measured memory_bytes: 26392
A = int(input())
AB_list = [list(map(int, input().split())) for _ in range(A)]
#AB_list = sorted(AB_list,key=lambda a :(-a[1],-a[0]))
AB_list = sorted(AB_list,key=lambda a :(a[1],a[0]))
#sum = AB_list[0][0]
sumab = 0
#print(AB_list)

for i,ab in enumerate(AB_list):
    if i == 0:
        if ab[1] >= ab[0]:
            sumab = ab[0]
            continue
        else:
            print('No')
            exit(0)

    if sumab + ab[0] <= ab[1]:
        sumab += ab[0]
        #print(ab)
        #print(sumab,'presum','next1',i)
    else:
        #print(ab)
        #print(sumab,'presum','next2',i)
        print('No')
        exit(0)

print('Yes')

Measured memory_bytes: 67900
#include <bits/stdc++.h>
using namespace std;
#define rep(i,cc,n) for(int i=cc;i<n;++i)
#define lrep(i,cc,n) for(long long i=cc;i<n;++i)
#define rrep(i,cc,n) for(long i=cc;i>n;--i)
#define pii pair<int, int>
#define pll pair<long long, long long>

using ll = long long;
const ll inf = 1001001001;
ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }
int main(){
    ll a, b;
    cin >> a >> b;

    ll c = gcd(a, b);
    ll d =sqrt(c) +2;
    ll ans = 1;

    lrep(i, 2, d){
        ll e = c;
        while(c%i==0){
            c /= i;
        }
        if(e > c)ans++;
    }
    if(c!=1)ans++;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <regex>
#include <stack>
#include <queue>
#include <vector>
#define MAX_N 100
#define INF 10000000

using namespace std;


int n;
string s,S="CODEFESTIVAL2016";
int a[200000];

void solve() {
	int a = 0;
	for (int i = 0; i < 16; i++) {
		if (s[i] != S[i]) a++;
	}
	cout << a << endl;
}

int main() {
	cin >> s;
	solve();
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
//#include <unistd.h>
//#include <iostream>
 
using namespace std;
 
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl;
#define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}
typedef long long ll;
#define int ll
 
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
const long double pi = 3.1415926535897932384626433832795028841971L;
#define Sp(p) cout<<setprecision(25)<< fixed<<p<<endl;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
const ll MOD = 1000000007;
//const ll MOD = 998244353;
// #define mp make_pair
//#define endl '\n'

ll gcd(ll a, ll b) {
  if (b > a) {
    swap(a, b);
  }
  ll r = a%b;
  while (r != 0) {
    a = b;
    b = r;
    r = a%b;
  }
  return b;
}

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


signed main() {
  fio();
  int n, m;
  cin >> n >> m;
  vl a(n);
  rep (i, n) {
    cin >> a[i];
  }

  ll g = 1, g2 = 1;
  rep (i, n) {
    g = lcm(g, a[i]);
    g2 = lcm(g2, a[i] / 2);
    if (g > inf or g <= 0) {
      g = inf;
    }
    if (g2 > inf or g2 <= 0) g2 = inf;
  }

  if (g2 > m) {
    cout << 0 << endl;
    return 0;
  }
  
  rep (i, n) {
    if (g2 % a[i] == 0) {
      cout << 0 << endl;
      return 0;
    }
  }

  ll ans = 1;
  m -= g2;
  ans += m / g;
  cout << ans << endl;
}


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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long long n,x,i,j,k,cnt=0;
    cin>>n>>x;
    long long a[n];
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    if(a[0]>x)
	 {
	 	cnt+=a[0]-x;
	 	a[0]=x;
	 }
    for(i=1;i<n;i++)
    {
        if(a[i-1]+a[i]>x)
        {
            cnt+=a[i-1]+a[i]-x;
            a[i]-=(a[i-1]+a[i]-x);
        }
    }
    cout<<cnt<<endl;

}


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

int main(){
  int n,i,sum=0;
  cin>>n;
  int a[n],b[n-1];
  for(i=0;i<n-1;i++){
    cin>>b[i];
  }
  a[0]=b[0];
  a[n-1]=b[n-2];
  for(i=1;i<=n-2;i++){
    a[i]=min(b[i-1],b[i]);
  }
  for(i=0;i<n;i++){
    sum+=a[i];
  }
  cout<<sum;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll modn=1e9+7;
int h,w;
string s[1005];
ll dp[1005][1005];
int main(){
	ll n,m,a,b,ans=0;
	cin>>h>>w;
	for(int i=1;i<=h;i++){
		cin>>s[i];
		s[i].insert(0,"0");
	}
	dp[1][1]=1;
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			if(i==1 and j==1)continue;
			if(s[i][j]!='#')dp[i][j]=(dp[i-1][j]+dp[i][j-1])%modn;
		}
	}
	cout<<dp[h][w]<<'\n';
	return 0;
}

Measured memory_bytes: 9216
import itertools
from math import sqrt
N=int(input())

def distance(x1,y1,x2,y2):
    return sqrt( (x2-x1)**2+(y2-y1)**2)
L=[]
for i in range(N):
    x,y=map(int, input().split())
    L.append((x,y))

ans=0
count=0
for T in itertools.permutations(L):
    
    for i,t in enumerate(T):
        if i==0:
            prex,prey=t
            continue
        x,y=t
        ans+=distance(prex,prey,x,y)
        prex=x
        prey=y
    count+=1

print(ans/count)


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

int main(){
    int N, M ,C;
    cin >> N >> M >> C;
    
    vector<int> B(M);
    for(int i = 0; i < M; i++){
        cin >> B.at(i);
    }

    vector<vector<int>> A(N, vector<int>(M));
    for(int i = 0; i < N; i++){
        for(int j = 0; j < M; j++){
            cin >> A.at(i).at(j);
        }
    }

    int count = 0;
    for(int i = 0; i < N; i++){
        int res = C;
        for(int j = 0; j < M; j++){
            res += A.at(i).at(j) * B.at(j);
        }
        if(res > 0){
            count++;
        }
    }

    cout << count << endl;
}

Measured memory_bytes: 256
import java.util.*;
import java.util.Scanner;

public class Main {

    public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
       String[] arrA = sc.next().split("");
        long result = 0;
        String a = "";
        for(String b : arrA){
          if(!a.equals(b)){
            a = b;
            result ++;
         }

        }

        System.out.println(result);
    }
}


Measured memory_bytes: 32524
n,Y = map(int,input().split())
for x in range(n+1):
    for y in range(n+1):
        if 10000*x + 5000*y + 1000*(n-(x+y)) == Y and n-(x+y) >= 0:
            print(x,y,n-(x+y))
            exit()
print("-1 -1 -1")

Measured memory_bytes: 3060
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <bitset>

using namespace std;
typedef pair<int, int> Pi;
typedef long long ll;
#define pii Pi
#define pll PL
#define Fi first
#define Se second
#define pb(x) push_back(x)
#define sz(x) ((int)(x).size())
#define rep(i, n) for(int i=0;i<n;i++)
#define all(x) (x).begin(), (x).end()
typedef tuple<int, int, int> t3;
typedef pair<ll, ll> PL;

int A[100010];

void solve(){
	int n; scanf("%d", &n);
	for(int i=1;i<=n;i++)scanf("%d", A+i);
	int p[100010] = {}, z = 0;
	for(int i=1, now=-1;i<=n;i++){
		if(now < A[i])p[++z] = A[i], now = A[i];
	}
	int B[100010];
	for(int i=1;i<=n;i++)B[i] = A[i];
	map <int, ll> M;
	sort(A+1, A+1+n);
	for(int i=z, j=n, t = 0;i;i--){
		ll now = (ll)t * (p[i] - p[i-1]);
		while(j && A[j] >= p[i-1])now += A[j] - p[i-1], --j, t++;
		M[p[i]] = now;
	}
	for(int i=1;i<=n;i++){
		if(M.find(B[i]) != M.end())printf("%lld\n", M[B[i]]), M.erase(B[i]);
		else puts("0");
	}
}

int main(){
	int Tc = 1; //scanf("%d", &Tc);
	for(int tc=1;tc<=Tc;tc++){
		//printf("Case #%d: ", tc);
		solve();
	}
	return 0;
}

Measured memory_bytes: 8448
#include<bits/stdc++.h>
#define Tp template<typename Ty>
#define Ts template<typename Ty,typename... Ar>
#define Reg register
#define RI Reg int
#define Con const
#define CI Con int&
#define I inline
#define W while
#define N 100000
#define add(x,y) (e[++ee].nxt=lnk[x],++d[e[lnk[x]=ee].to=y])
using namespace std;
int n,m,ee,d[N+5],lnk[N+5];struct edge {int to,nxt;}e[2*N+5];
int tot;I void DFS(CI s,CI x,CI y,CI lst=0)
{
	if(lst&&s==x) return;if(s==y) return (void)(++tot);
	for(RI i=lnk[s];i;i=e[i].nxt) e[i].to^lst&&(DFS(e[i].to,x,y,s),0);
}
int main()
{
	RI i,x,y,f=0,t=0;for(scanf("%d%d",&n,&m),i=1;i<=m;++i) scanf("%d%d",&x,&y),add(x,y),add(y,x);
	for(x=y=0,i=1;i<=n;++i) if(d[i]&1) return puts("No"),0;else d[i]>=6?f=1:d[i]==4&&(++t,(x?y:x)=i);
	if(f||t>=3) return puts("Yes"),0;if(t^2) return puts("No"),0;
	return DFS(x,x,y),puts(tot==2?"Yes":"No"),0;
}

Measured memory_bytes: 7628
masks = []
for _ in range(int(input())):
    k, *b = map(int, input().split())
    mask = 0
    for i in range(k):
        mask += 1 << b[i]
    masks.append(mask)
x = 0
MASK = (1<<64) - 1
def test(i):
    global x
    print(+((x & (1 << i)) > 0))
def Set(i):
    global x
    global masks
    x |= masks[i]
def clear(i):
    global x
    global masks
    x = (x | masks[i]) ^ masks[i]
def flip(i):
    global x
    global masks
    x ^= masks[i]
def all(i):
    global x
    global masks
    print(+(x & masks[i] == masks[i]))
def any(i):
    global x
    global masks
    print(+(x & masks[i] > 0))
def none(i):
    global x
    global masks
    print(+(x & masks[i] == 0))
def count(i):
    global x
    global masks
    print(bin(x & masks[i]).count('1'))
def val(i):
    global x
    global masks
    print(x & masks[i])
    
f = [test, Set, clear, flip, all, any, none, count, val].__getitem__
for _ in range(int(input())):
    op, *i = map(int, input().split())
    f(op)(*i)


Measured memory_bytes: 5628
nl = sorted(list(map(int, input().split())))
d1 = nl[2]-nl[0]
d2 = nl[2]-nl[1]
ans=d1//2+d2//2
if d1%2!=0 and d2%2!=0:
    ans+=1
elif d1%2!=0 or d2%2!=0:
    ans+=2
print(ans)

Measured memory_bytes: 3060
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#include<iostream>
#define pb push_back
#define mkp make_pair
using namespace std;

const int maxn = 200005;
typedef long long ll;

int n;
string s="CODEFESTIVAL2016";
int main()
{
    string t;
    cin>>t;
    int cnt = 0;
    for(int i=0;i<t.size();i++)
        if(t[i]!=s[i])
            cnt++;
    printf("%d\n",cnt);
}


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

int main(){
    int N,a=0,A[101];
    
    cin >> N;
    for (int i=0;i<N;i++) cin >> A[i];

    int flag = 1;
    while (flag){
        flag = 0;
        for (int j=N-1;j>0;j--){
            if (A[j]<A[j-1]){
                int tmp = A[j];
                A[j] = A[j-1];
                A[j-1] = tmp;
                flag = 1;
                a++;
            }    
        }
    }

    for (int i=0;i<N;i++){
        if(i>0) cout << " ";
        cout << A[i];
    }
    cout << endl << a << endl;

    return 0;
}


Measured memory_bytes: 3116
#include <iostream>
#include <vector>
#include <algorithm>
#include <bitset>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <ctime>
#include <queue>

using namespace std;

typedef long long ll;
typedef long double ld;
#define fastInp cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);

const ll SIZE = 1000, INF = 1e9 * 1e9, MOD = 1e9 + 7;

vector<ll> vec;

bool check(int m) {
	vector<pair<ll, ll>> s;
	s.push_back({ 0, 0 });

	for (int i = 1; i < vec.size(); i++) {
		if (vec[i] > vec[i - 1]) {
			continue;
		}
		else {
			while (s.back().first > vec[i]) s.pop_back();

			if (s.back().first < vec[i]) {
				s.push_back({ vec[i], 2 });
				if (m == 1) return false;
				continue;
			}
			if (s.back().first == vec[i]) {
				ll pr = vec[i];
				while (s.size() >= 1 && s.back().second == m && s.back().first == pr) {
					s.pop_back();
					pr--;
				}
				if (pr <= 0) return false;
				if (s.back().first == pr) s.back().second++;
				else {
					if (m == 1) return false;
					s.push_back({ pr, 2 });
				}
			}
		}
	}
	return true;
}

signed main() {
	fastInp;

	ll n;
	cin >> n;
	vec.resize(n);
	for (int i = 0; i < n; i++) cin >> vec[i];

	ll l = 0, r = INF;
	while (r - l > 1) {
		ll mid = (l + r) / 2;
		if (check(mid)) {
			r = mid;
		}
		else {
			l = mid;
		}
	}
	
	cout << r;
	return 0;
}

Measured memory_bytes: 4784
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <deque>
#include <queue>//for queue and priority_queue
#include <fstream>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <set>
#include <map>
#include <list>
#define endl "\n"
typedef long long ll;
using namespace std;
void Lancer() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); }
bool isPrime(ll n){
	if (n == 2 || n == 3 || n == 5)
		return true;
	else if (n % 2 == 0 || n % 3 == 0 || n % 5 == 0 || n == 1)
		return false;
	else {
		for (int i = 5; i <= sqrt(n); i += 2){
			if (n%i == 0)
				return false;
		}
		return true;
	}
}

char arr[107][107];
int main(){
	Lancer();
	ll n;
	bool ok = true;
	cin >> n;
	vector<string> vec(n);
	for (int i = 0; i < n; i++)
		cin >> vec[i];
	for (int i = 0; i < n; i++){
		bool ch = true;
		string a=vec[i], b;
		if (i > 0){
			b = vec[i - 1];
			if (b[b.length() - 1] != a[0]) ch = false;
		}
		for (int j = i - 1; j >= 0; j--){
			if (vec[i] == vec[j]){
				ch = false;
				break;
			}
		}
		if (!ch){
			ok = false;
			break;
		}
	}
	if (ok) cout << "Yes";
	else cout << "No";
	cout << endl;
	return 0;
}


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

int main(void) {
  int H1, M1, H2, M2, K;
  cin >> H1 >> M1 >> H2 >> M2 >> K;
  int diff = (H2 - H1) * 60 + M2 - M1;
  cout << diff - K << endl;
  return 0;
}

Measured memory_bytes: 3620
#pragma GCC target ("avx2")
#pragma GCC optimize "trapv"
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
#define input(a,n) for(ll i1=0;i1<n;i1++)cin>>a[i1]
#define ll long long
#define pi 2 * acos(0.0)
#define usll unordered_set<ll>
#define sll set<ll>
#define vll vector<ll>
#define mll map<ll,ll>
#define pll pair<ll,ll>
#define umll unordered_map<ll,ll>
#define S second
#define sz size()
#define all(v) v.begin(),v.end()
#define Y cout<< "YES"<< "\n"
#define N cout<< "NO"<< "\n"
#define F first
#define mp make_pair
#define pb push_back
#define pf push_front
#define ld long double
#define mod 1000000007
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n;
    cin>>n;
    ll a[n],p[n],ans=0;
    for(ll i=0;i<n;i++)
    {
        cin>>a[i];
    }
    p[n-1]=a[n-1];
    for(ll i=n-2;i>=0;i--)
    {
        p[i]=(p[i+1]%mod+a[i]%mod)%mod;
    }
    for(ll i=0;i<n-1;i++)
    {
       ans=((ans%mod)+((p[i+1]%mod)*(a[i]%mod))%mod)%mod;
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 6784
import java.util.Scanner;

public class Main {
	static int[] mcxi = {1,10,100,1000};
	
	static int kchange(char a) {
		if(a=='m')return 3;
		if(a=='c')return 2;
		if(a=='x')return 1;
		else return 0;
	}
	
	static String rechange(int sum) {
		String ans = "";
		if(sum>=1000) {
			if(sum/1000>=2)
				ans += String.valueOf(sum/1000);
			ans += "m";
			sum = sum%1000;
		}
		if(sum>=100) {
			if(sum/100>=2)
				ans += String.valueOf(sum/100);
			ans += "c";
			sum = sum%100;
		}
		if(sum>=10) {
			if(sum/10>=2)
				ans += String.valueOf(sum/10);
			ans += "x";
			sum = sum%10;
		}
		if(sum>=2)
			ans += String.valueOf(sum);
		if(sum>=1)
			ans += "i";
	
		return ans;
	}
	
	static int change(String str) {
		char[] s = new char[str.length()];
		for(int j=0;j<str.length();j++) {
			s[j] = str.charAt(str.length()-j-1);
		}
					
		int sum = 0;
		int m = 0;
		int keta = 0;
		int b = 0;
		for(int j=0;j<str.length();j++) {
			if(s[j]=='i' || s[j]=='x' || s[j]=='c' || s[j] == 'm') {
				if(b>=1) {
					sum += keta*1;
					b = 0;
				}
				keta = mcxi[kchange(s[j])];
				b++;
				
			}
			if('1'<= s[j] && s[j] <= '9') {
				int g = (int)s[j]-'0';
				sum += keta*g;
				b = 0;
			}
			if(j==str.length()-1 && b==1)
				sum += keta*1;
		}
		return sum;
	}
	
	public static void main(String[] args) {
		try(Scanner sc = new Scanner(System.in)){
			int sum = 0;
			while(sc.hasNext()) {
				int n=sc.nextInt();
				if(n==0) break;
				
				for(int i=0;i<n;i++) {
					String str = sc.next();
					sum = change(str);
					str = sc.next();
					sum += change(str);
					
					System.out.println(rechange(sum));
				}
			}
		}
	}
}


Measured memory_bytes: 38584
#include <stdio.h>

int gcd(int a, int b){
  if(b==0)
    return a;
  else
    return gcd(b,a%b);  
}

int main(){
  int a, b;
  scanf("%d %d",&a,&b);
  if(a<b)
    printf("%d\n",gcd(b,a));
  else
    printf("%d\n",gcd(a,b));
  return 0;
}

Measured memory_bytes: 592
#define _CRT_SECURE_NO_WARNINGS
#include"bits/stdc++.h"
#ifdef _DEBUG
#define DBG(n) n
#else
#define DBG(n)
#endif
#define INF         1e9
#define INFLL       1e18
#define EPS         1e-9
#define REP(i,n)    for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)   for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)   for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)  for(ll i=(n);i>0;--i)
#define REPC(i,obj) for(auto i:obj)
#define ALL(obj)    (obj).begin(),(obj).end()
#define SETP(n)     cout << fixed << setprecision(n)
using namespace std;
using ll = long long;
template<typename T = ll>inline T in() { T ret; cin >> ret; return ret; }

signed main()
{
	string str = in<string>();
	if (str.length() == 2) {
		cout << str << endl;
	} else {
		REPR(i, 3) {
			cout << str[i];
		}
		cout << endl;
	}
}

Measured memory_bytes: 256
# ABC073-C
N =int(input())
A = []
for i in range(N):
    A.append(int(input()))
A.sort()
for i in range(N-1):
    if A[i] == A[i+1]:
        A[i] = 0
        A[i+1] = 0
A = set(A)
if 0 in A:
    print(len(A) - 1)
else:
    print(len(A))

Measured memory_bytes: 13256
#include "bits/stdc++.h"
using namespace std;

#define mod 1000000007
#define INF (int) 1e9 + 5

#define add emplace
#define pb push_back
#define eb emplace_back
#define all(x) begin(x), end(x)
#define len(x) ((int)(x).size())
#define exist(a, x) (a.find(x) != end(a))
#define log(x) cout << (x) << endl;
#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define rrep(i,a,b) for(int i=(int)(a);i>=(int)(b);--i)
#define loop(i,a,b) for(int i=(int)(a);i<(int)(b);++i)

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using pi = pair<int,int>;
using vpi = vector<pi>;
using vvi = vector<vi>;
using vstr = vector<string>;


int main() {
	int n,k; cin>>n>>k;
	vi a(n), dp(n,INF);
	rep (i, n) cin >> a[i];

	dp[0] = 0;
	for (int i=0; i<n; ++i) {
		for (int j = i+1; j <= i + k; ++j) if (j < n) {
			dp[j] = min( dp[j], dp[i] + abs(a[i] - a[j]) );
		}
	}

	cout << dp[n-1] << endl;
	return 0;
}



Measured memory_bytes: 1024
n=int(input())
p=list(map(int, input().split()))
ans=0
for i in range(1, n-1):
    if p[i-1]<p[i]<p[i+1]:
        ans=ans+1
    elif p[i+1]<p[i]<p[i-1]:
        ans=ans+1

print(ans)


Measured memory_bytes: 38384
from collections import deque

n = int(input())
rg = [[] for _ in range(n)]
ret_dict = dict()
ls = []

for _ in range(n-1):
    a, b = map(int, input().split())
    rg[a-1].append(b-1)
    rg[b-1].append(a-1)
    ls.append((a-1, b-1))


deq = deque()
deq.append((0, 0))

visited = set()
visited.add(0)

ret = 0

while deq:
    head, color = deq.pop()
    n_color = 1
    for item in rg[head]:
        if item not in visited:
            visited.add(item)
            if n_color == color:
                n_color += 1
            ret = max(ret, n_color)
            deq.append((item, n_color))
            ret_dict[(min(head, item), max(head, item))] = n_color
            n_color += 1


print(ret)
for item in ls:
    print(ret_dict[item])


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

int main(){
  int N,Y,y;
  cin >> N >> Y ;
  y=Y/1000;
  int a,b,c;
  if((y-N)%9==0) b=0;
  if((y-N)%9==4) b=1;
  if((y-N)%9==8) b=2;
  if((y-N)%9==3) b=3;
  if((y-N)%9==7) b=4;
  if((y-N)%9==2) b=5;
  if((y-N)%9==6) b=6;
  if((y-N)%9==1) b=7;
  if((y-N)%9==5) b=8;
  if(y-N-4*b<0)
    goto NG;
  else
    a=(y-N-4*b)/9;
  if(N-a-b<0)
    goto NG;
  else
    c=N-a-b;
  cout << a << " " << b << " " << c << endl;
  return 0;
  NG:cout << "-1 -1 -1" << endl;
  return 0;
}

Measured memory_bytes: 256
use proconio::{input, fastout};
use std::cmp::*;

macro_rules! debug {
      ($($a:expr),*) => {
          eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

#[fastout]
fn main() {
    input!{
        k: usize,
    }

    let even = k/2;
    let mut odd = k/2;
    if k%2!=0 {
        odd = k / 2 + 1;
    }

    println!("{}", even*odd);

}


Measured memory_bytes: 2196
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include<cstring>
#include <math.h>
#include <queue>
typedef long long ll;
using namespace std;

int main()
{
    char a[6];
    cin>>a;
    if(a[2]==a[3]&&a[4]==a[5])
    {
        cout<<"Yes";
    }
    else
    {
        cout<<"No";
    }
    return 0;
}



Measured memory_bytes: 256
package main

import "fmt"

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

const mod = 1000000007

func modfact(n int) int {
	r := 1
	for i := 0; i < n; i++ {
		//r = ((n - i) * (r % mod)) % mod
		r = ((n - i) * r) % mod
	}
	return r
}

func main() {
	var n, m int
	fmt.Scan(&n, &m)
	if abs(n-m) >= 2 {
		fmt.Println(0)
		return
	}
	if m > n {
		n, m = m, n
	}
	// fmt.Println("n!", modfact(n))
	// fmt.Println("m!", modfact(m))
	ans := (modfact(n) * modfact(m)) % mod
	if n == m {
		ans = (ans * 2) % mod
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
 
void __print(int x) {cout << x;}
void __print(long x) {cout << x;}
void __print(long long x) {cout << x;}
void __print(unsigned x) {cout << x;}
void __print(unsigned long x) {cout << x;}
void __print(unsigned long long x) {cout << x;}
void __print(float x) {cout << x;}
void __print(double x) {cout << x;}
void __print(long double x) {cout << x;}
void __print(char x) {cout << '\'' << x << '\'';}
void __print(const char *x) {cout << '\"' << x << '\"';}
void __print(const string &x) {cout << '\"' << x << '\"';}
void __print(bool x) {cout << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cout << '{'; __print(x.first); cout << ','; __print(x.second); cout << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __print(i); cout << "}";}
void _print() {cout << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cout << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cout << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
 
#define int long long int
#define fi first
#define se second
#define FIO {ios::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr);}
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define all(x) (x).begin(), (x).end()
#define pow10(n) stoll("1"+string(n,'0'))
//fill(all(arr),1)
//if(map.count(key)){}
//bitset<20>(n);
//int mini=min({a,b,c,d,e});
 
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef long double ld;

int32_t main(){
  FIO
  int n,k,d,b;
  cin>>n>>k;
  int have[n];
  memset(have,0,sizeof(have));
  forn(i,k){
    cin>>d;
    forn(j,d){cin>>b;have[b-1]=1;}
  }  
  int cnt=0;
  forn(i,n)
  {
  //  cout<<have[i];
    if(have[i]!=1){cnt++;}
  }
  cout<<cnt;
  return 0;
}

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

const int INF = 1 << 25;
const int M_LIMIT = 100;

int main()
{
	int n, m, k;
	int cost[ M_LIMIT + 1 ][ M_LIMIT + 1 ];
	int time[ M_LIMIT + 1 ][ M_LIMIT + 1 ];
	while( cin >> n >> m && ( n || m ) ){
		for( int i = 0; i < M_LIMIT + 1; ++i ){
			for( int j = 0; j < M_LIMIT + 1; ++j ){
				cost[ i ][ j ] = time[ i ][ j ] = INF;
			}
		}
		for( int i = 0; i < M_LIMIT + 1; ++i ){
			cost[ i ][ i ] = time[ i ][ i ] = 0;
		}
		for( int i = 0; i < n; ++i ){
			int a, b, c, t;
			cin >> a >> b >> c >> t;
			cost[ a ][ b ] = cost[ b ][ a ] = c;
			time[ a ][ b ] = time[ b ][ a ] = t;
		}
		for( int p = 1; p <= m; ++p ){
			for( int i = 1; i <= m; ++i ){
				for( int j = 1; j <= m; ++j ){
					cost[ i ][ j ] = min( cost[ i ][ j ], cost[ i ][ p ] + cost[ p ][ j ] );
					time[ i ][ j ] = min( time[ i ][ j ], time[ i ][ p ] + time[ p ][ j ] );
				}
			}
		}
		cin >> k;
		for( int i = 0; i < k; ++i ){
			int p, q, r;
			cin >> p >> q >> r;
			cout << ( r == 0 ? cost[ p ][ q ] : time[ p ][ q ] ) << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1236
#include <stdio.h>

void selectionSort(int *A, int N){
	int i, minj, j, temp, count=0, m;
	for(i=0;i<N;i++){
		minj = i;
		for(j=i;j<N;j++){
			if(A[j] < A[minj]){
				minj = j;
			}
		}
		if(i != minj){
			temp = A[i];
			A[i] = A[minj];
			A[minj] = temp;
			count++;
		}
	}
	for(m=0; m<N; m++){
		printf("%d", A[m]);
	if(m < N-1){
			printf(" ");
	}else printf("\n");
	}
	printf("%d\n", count);
}

int main(void){
	int N, i;
	scanf("%d",&N);
	int A[N];
	for(i=0;i<N;i++){
		scanf("%d", &A[i]);
	}
	selectionSort(A, N);

	
	return 0;
}


Measured memory_bytes: 1964
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
const long long int INF = 1e18;
const long long int mod = 1e9+7;
typedef pair<ll,ll> pairs;
typedef vector<pairs> p;


ll gcd(ll A,ll B){
    if (A%B==0)return(B);
    else return(gcd(B,A%B));
}

ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

vector<vector<ll>> combination(ll n, ll r){
    vector<vector<ll>> v(n + 1, vector<ll>(n + 1, 0));
    for(ll i=0;i<v.size();++i){
        v[i][0] = 1;
        v[i][i] = 1;
    }
    for(ll i=1;i<v.size();++i){
        for(ll j=0;j<i;++j){
            v[i][j] = (v[i - 1][j - 1] + v[i - 1][j]);
        }
    }
    return v;
}

bool kai(string S){
    bool flag = true;
    for(ll i=0;i<S.size()/2;++i){
        if(S[i] != S[S.size()-i-1]){
            flag = false;
            break;
        }
    }
    return flag;
}
// ---------------------------------------------

int main(){
    ll n, k;
    cin>>n>>k;
    vector<ll> d(k);
    vector<bool> tf(10, false);
    for(ll i=0;i<k;++i){
        cin>>d[i];
        tf[d[i]] = true;
    }

    for(ll i=n;i<1000000;++i){
        string t = to_string(i);
        bool flag = true;
        for(ll j=0;j<t.size();++j){
            if(tf[t[j]-'0'] == true){
                flag = false;
                break;
            }
        }
        if(flag == true){
            cout<<i<<endl;
            return 0;
        }
    }

    return 0;
}

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

public class Main{
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    int N = Integer.parseInt(in.readLine());
    int[] a = new int[N];
    for(int i=0;i<N;i++){
      a[i] = Integer.parseInt(in.readLine());
    }
    int pointer = 0;
    int counter = 0;
    for(int i=0;i<N;i++){
      pointer = a[pointer]-1;
      counter++;
      if(pointer==1){
        System.out.println(counter);
        return;
      }
    }
    System.out.println(-1);
  }
}


Measured memory_bytes: 32600
#include <iostream>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <fstream>
#include <bitset>
#include <queue>
#include <stack>
#include <deque>
#include <complex>
#include <iomanip>
#include <stdio.h>
#include <string.h>
#include <random>
#include <functional>

using std::cin;
using std::cout;
using std::cerr;
using std::endl;

using std::map;
using std::set;
using std::bitset;
using std::vector;
using std::string;
using std::multimap;
using std::multiset;
using std::deque;
using std::queue;
using std::stack;
using std::pair;
using std::iterator;

using std::sort;
using std::stable_sort;
using std::reverse;
using std::max_element;
using std::min_element;
using std::unique;
using std::ios_base;
using std::swap;
using std::fill;

using std::setprecision;
using std::fixed;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef string S;

ll min(ll a, ll b) {return a < b ? a : b;}
ll min(int a, ll b) {return a < b ? a : b;}
ll min(ll a, int b) {return a < b ? a : b;}
ll min(int a, int b) {return a < b ? a : b;}

ll max(ll a, ll b) {return a > b ? a : b;}
ll max(int a, ll b) {return a > b ? a : b;}
ll max(ll a, int b) {return a > b ? a : b;}
ll max(int a, int b) {return a > b ? a : b;}

namespace MySpace{

};

#define F(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define fi first
#define se second
#define re return
#define all(x) (x).begin(), (x).end()

int n, m;
vector<int> graph[500000];
string s;

int cntA[500000], cntB[500000];
int marked[500000];
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> m >> s;
    for (int i = 0; i < m; i++)
    {
        int v, u;
        cin >> v >> u, v--, u--;
        graph[v].push_back(u);
        graph[u].push_back(v);
        if (s[v] == 'A') cntA[u]++; else cntB[u]++;
        if (s[u] == 'A') cntA[v]++; else cntB[v]++;
    }
    vector<int> q;
    for (int i = 0; i < n; i++) if (!cntA[i] || !cntB[i]) q.push_back(i), marked[i] = 1;
    for (int i = 0; i < q.size(); i++)
    {
        if (s[q[i]] == 'A') for (auto v : graph[q[i]]) {cntA[v]--; if (!marked[v] && !cntA[v]) q.push_back(v), marked[v] = 1;}
        if (s[q[i]] == 'B') for (auto v : graph[q[i]]) {cntB[v]--; if (!marked[v] && !cntB[v]) q.push_back(v), marked[v] = 1;}
    }
    if (q.size() == n)
    {
        cout << "No";
    }
    else
    {
        cout << "Yes";
    }
}


Measured memory_bytes: 23244