akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include <set>
#include <cassert>
#include<cmath>
#include<climits>
#include<iomanip>
using namespace std;
#define MOD 1000000007
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
const long long INF = 1LL << 60;
 
 
template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
 
class UnionFind {
	vector<int> data;
public:
	UnionFind(int size) : data(size, -1) { }
	bool unionSet(int x, int y) {
		x = root(x); y = root(y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
		return x != y;
	}
	bool findSet(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};
 
int find(vector<long long> &arr, long long obj) {
	if (arr[arr.size() - 1] < obj)return arr.size()-1;
	if (arr[0] > obj)return -1;
 
	int min = 0; int max = arr.size() - 1;
	for (int i = 0; i < arr.size(); i++) {
		if (arr[min+(max-min) / 2] > obj) {
			max = min + (max - min) / 2;
		}
		else {
			min = min + (max - min) / 2;
		}
		if (max - min == 1) {
			return min;
		}
	}
 
 
}
 
//約数求める //約数
void divisor(ll n,vector<ll> &ret) {
	for (ll i = 1; i * i <= n; i++) {
		if (n % i == 0) {
			ret.push_back(i);
			if (i * i != n) ret.push_back(n / i);
		}
	}
	sort(ret.begin(), ret.end());
	
}
//階乗
long long factorial(long long n, long long mod) {
	long long ret = 1;
	for (long long i = 1; i <= n; i++) {
		ret = (ret * i) % mod;
	}
	return ret;
}
//モジュラ逆数
long long inv_mod(long long n, long long mod) {
	long long a = n % mod, b = mod - 2, ret = 1;
	while (b > 0) {
		if (b & 1) ret = (ret * a) % mod;
		a = (a * a) % mod;
		b >>= 1;
	}
	return ret;
}
 
long long nPr(long long n, long long r, long long mod) {
	long long ret = 1;
	for (long long i = n; i >= n - r + 1; i--) {
		ret = ret * (i % mod) % mod;
	}
	return ret;
}
 
long long nCr(long long n, long long r, long long mod) {
	return nPr(n, r, mod) * inv_mod(factorial(r, mod), mod) % mod;
}
 
ll gcd(ll m, ll n){
	if (n == 0)return m;
	return gcd(n, m%n);
}//gcd
 
 
 
int main() {
 
	ll l;
	cin >> l;
    l--;
	ll temp = 2;
	int n = 1;
	vector < pair<pair<ll, ll>, ll>> m;
		while (temp - 1 <= l) {
 
			m.push_back(make_pair(make_pair(n, n + 1), temp/2));
			m.push_back(make_pair(make_pair(n, n + 1), 0));
			temp *= 2;
			n++;
 
		}
		temp /= 2;
	
	ll now = temp - 1;
	for (int i = n - 2; i >= 0; i--) {
		if (l - now >= (ll)pow(2, i)) {
			m.push_back(make_pair(make_pair(i + 1, n), now + 1));
			now += (ll)pow(2, i);
		}
	}
	cout << n << ' ' << m.size() << endl;
	for (int i = 0; i < m.size(); i++) {
		cout << m[i].first.first << ' ' << m[i].first.second << ' ' << m[i].second << endl;
	}
 
	return 0;
}

Measured memory_bytes: 256
import numpy as np

x,y = map(int, input().split())

def is_integer_num(n):
    if isinstance(n, int):
        return True
    if isinstance(n, float):
        return n.is_integer()
    return False

a = np.array([[1, 1], [2, 4]])
b = np.array([x, y])
c = np.linalg.solve(a, b)[0]
d = np.linalg.solve(a, b)[1]

def is_integer_num(n):
    if isinstance(n, int):
        return True
    if isinstance(n, float):
        return n.is_integer()
    return False

if c < 0 or d < 0:
    print('No')
else:
    if is_integer_num(c) and is_integer_num(d):
        print('Yes')
    else:
        print('No')

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

using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define REP(i, l, n) for(int i=(l), i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back

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

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

char alpha[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};

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

int main(){
    int n; cin >> n;
    int ans = 0;
    vector<ll> lis(n);
    REP(i, 0, n){cin >> lis[i];}
    REP(i, 0, n-2){
        REP(l, i+1, n-1){
            REP(k, l+1, n){
                vector<int> mid(3, 0);
                mid[0] = lis[i];
                mid[1] = lis[l];
                mid[2] = lis[k];
                sort(ALL(mid));
                if(mid[0] + mid[1] > mid[2] && mid[0] != mid[1] && mid[1] != mid[2]){
                    ans++;
                }
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3620
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <vector>

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP


typedef ::std::int_fast64_t i64;
typedef ::std::uint_fast64_t u64;
typedef ::std::int_fast32_t i32;
typedef ::std::uint_fast32_t u32;

namespace tools {
  template <typename T>
  void read(::std::istream& is, ::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    vector.reserve(size);
    ::std::copy_n(::std::istream_iterator<T>(is), size, ::std::back_inserter(vector));
  }
  template <typename T>
  void read(::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    ::tools::read(::std::cin, vector, size);
  }

  template <typename T, ::std::size_t N>
  void read(::std::istream& is, ::std::array<T, N>& array) {
    ::std::copy_n(std::istream_iterator<T>(is), N, array.begin());
  }
  template <typename T, ::std::size_t N>
  void read(::std::array<T, N>& array) {
    ::tools::read(::std::cin, array);
  }
}

#endif

// main.cpp

int main() {
  i64 N;
  std::cin >> N;

  for (i64 h = 1; h <= 3500; ++h) {
    for (i64 n = 1; n <= 3500; ++n) {
      const i64 numerator = N * h * n;
      const i64 denominator = 4 * h * n - N * n - N * h;
      if (denominator == 0) continue;
      if (numerator % denominator != 0) continue;
      const i64 w = numerator / denominator;
      if (w <= 0 || 3500 < w) continue;

      std::cout << h << ' ' << n << ' ' << w << std::endl;
      return 0;
    }
  }

  return EXIT_FAILURE;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <climits>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;

const int INF = 1e9;
const long long LINF = 1e18;
const double PI=3.14159265358979323846;

typedef priority_queue<int, vector<int>, greater<int>> priority_queue_asc;

template <typename T>
T gcd(T a, T b) {
    if (a < b) {
        swap(a, b);
    }

    T r = a % b;
    while (r != 0) {
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

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

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

    const int M = 10e6 + 5;
    vector<int> cnt(M, 0);

    for (auto a : A) {
        if (cnt[a] >= 2) {
            continue;
        }

        for (int i = a; i < M; i += a) {
            ++cnt[i];
        }
    }

    int ans = 0;
    for (auto a : A) {
        if (cnt[a] < 2) {
            ++ans;
        }
    }

    cout << ans << endl;

    return 0;
}


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

int main(){
  int a,b,c;
  cin>>a>>b>>c;
  int ans=0;
  for(int i=a;i<=b;i++){
    if(i%c==0){
      ans++;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3616
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long
int A[200010], B[200010];
signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    int N; cin >> N;
    
    rep(i, N) cin >> A[i];
    rep(i, N) B[A[i] - 1] = i;
    set<int> st;
    st.insert(-1);
    st.insert(N);
    int ans = 0;
    rep(i, N) {
        auto itr = st.lower_bound(B[i]);
        int r = *itr;
        itr--;
        int l = *itr;
        ans += (r - B[i]) * (B[i] - l) * (i + 1);
        //cout << r << " " << l << endl;
        st.insert(B[i]);
    }
    cout << ans << endl;



    return 0;
}


Measured memory_bytes: 12800
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <utility>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;

int main(){
    ll n;
    cin >> n;
    string ans = "No";
    rep(i, n / 4 + 1){
        rep(j, n / 7 + 1){
            if(i * 4 + j * 7 == n) ans = "Yes";
        }
    }
    cout << ans << endl;
}
   

Measured memory_bytes: 256
#include<iostream>
using namespace std;
long long int gcd(long long int a, long long int b) {
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
int main() {
    long long int a, b;
    cin>>a>>b;
    cout<< ((a*b)/gcd(a, b));
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


int main() {
    ll N;
    cin >>N;
    ll cnt=0;
    ll now=0;
    map<ll,bool>m;
    rep(i,N){
        ll a;
        cin>>a;
        if(a>=3200){
            cnt++;
        }else{
            a/=400;
            if(m[a]==0){
                now++;
                m[a]=1;
            }
        }
        
    }
    cout <<max(now,1LL) <<" "<<now+cnt << endl;


    return 0;
    

}

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

int main() {
    int n,k,sum = 0;
    cin >> n >> k;
    for(int i = 0; i < n; i++){
        int x;
        cin >> x;
        if(k-x < x){
            sum += k-x;
        }else{
            sum += x;
        }
    }
    cout << sum * 2 << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
using namespace std;
using ll = long long;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;

int main() {

    int n, cnt = 0;
    cin >> n;

    vector<int> a(n);
    REP(i, n) {
        cin >> a[i];
        if(a[i] != i+1) cnt++;
    }

    if(cnt == 0 || cnt == 2) cout << "YES" << endl;
    else cout << "NO" << endl;
    
    
    

    return 0;

}

Measured memory_bytes: 256
N, P = map(int, input().split())
A = list(map(int, input().split()))
for i in range(N):
  A[i] = A[i] % 2

def ncr(n, r, p):
  num = den = 1
  for i in range(r):
    num = (num * (n - i)) % p
    den = (den * (i + 1)) % p
  return (num * pow(den, p - 2, p)) % p
p=10**9+7
odd = sum(A)
even = N- odd

ans = 0
if P == 0:
  c = 0
  for i in range(0, odd+1, 2):
    c += ncr(odd, i, p)
  ans += pow(2, even) * c

else:
  c = 0
  for i in range(1, odd+1, 2):
    c += ncr(odd, i, p)
  ans += pow(2, even) * c
    
print(ans)

Measured memory_bytes: 38256
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#define SF scanf
#define PF printf
#define MAXN 2010
#define INF 0x3FFFFFFF
using namespace std;
char s[MAXN*3],s1[MAXN];
int pre[MAXN*3],nl[MAXN*3],nr[MAXN*3],ans=INF,len;
vector<pair<int,int> > add;
void prepare(){
	nl[0]=-INF;
	for(int i=1;i<=len*3;i++){
		nl[i]=nl[i-1];
		if(s[i]=='1')
			nl[i]=i;
	}
	nr[len*3+1]=INF;
	for(int i=len*3;i>=1;i--){
		nr[i]=nr[i+1];
		if(s[i]=='1')
			nr[i]=i;
	}
	for(int i=1;i<=len*3;i++)
		pre[i]=pre[i-1]+s[i]-'0';
}
int findl(int x){
	return min(INF,x-nl[x]);
}
int findr(int x){
	return min(INF,nr[x]-x);	
}
int main(){
	SF("%s",s1+1);
	SF("%s",s+1);
	len=strlen(s+1);
	for(int i=len+1;i<=len*3;i++)
		s[i]=s[(i-1)%len+1];
	prepare();
	for(int i=1;i<=2*len+1;i++){
		add.clear();
		int sum=0;
		for(int j=1;j<=len;j++){
			if(s1[j]!=s[i+j-1]){
				sum++;
				int r=j+len;
				int l=j+i-1;
				if(l>r)
					swap(l,r);
				if(pre[r]-pre[l-1]==0)
					add.push_back(make_pair(findl(l),findr(r)));
			}
		}
		add.push_back(make_pair(0,0));
		sort(add.begin(),add.end());
		int adds=INF,maxv=0;
		for(int i=int(add.size()-1);i>=0;i--){
			if(add[i].first!=INF&&maxv!=INF)
				adds=min(adds,maxv*2+add[i].first*2);
			maxv=max(maxv,add[i].second);
			if(maxv==INF)
				break;
		}
		if(adds!=INF)
			ans=min(ans,adds+abs(len+1-i)+sum);
	}
	if(ans==INF)
		ans=-1;
	PF("%d",ans);
}

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

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

typedef long long ll;

const int INF = 1 << 30;
const ll LLINF = 1LL << 62;

int mod = 1000000007;

int main(void){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll K; cin >> K;
  ll A[K]; rep(i, K) cin >> A[i];
  if(A[K-1] != 2) cout << -1 << endl;
  else{
    ll dlim = 2, ulim = 3;
    for(int i = K-2; i >= 0; i--){
      dlim = dlim + ((A[i] - dlim%A[i]) % A[i]);
      ulim = ulim - (ulim%A[i]);
      if(dlim > ulim){cout << -1 << endl; return 0;}
      ulim = ulim + A[i] - 1;
    }

    cout << dlim << " " << ulim << endl;
  }
  return 0;
}


Measured memory_bytes: 4400
#include<iostream>
#include<vector>
#include<queue>
#include<algorithm>
#include<string>
#include<utility>
using namespace std;

int main(){
    int n,m;
    cin >> n >> m;
    long long a,b,c;
    priority_queue<pair<int,int>> q;

    for (int i = 0; i < n; i++)
    {
        cin >> a;
        q.push(make_pair(a,1));
    }

    for (int i = 0; i < m; i++)
    {
        cin >> b >> c;
        q.push(make_pair(c,b));
    }

    long long sum = 0;
    for (int i = 0; i < n; i++)
    {
        pair<int,int> p = q.top();
        q.pop();
        sum += p.first;
        
        if(p.second > 1){
            p.second --;
            q.push(p);
        }
    }
    cout << sum << endl;   
}


Measured memory_bytes: 2420
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
#define ll long long
#define lld long double
#define mod 1000000007
#define rep(i,n)    for(ll i=0;i<n;++i)
#define forup(i,a,b)    for(ll i=a;i<=b;++i)
#define all(v)    v.begin(),v.end()
#define inf 1000000010
#define pii pair<ll,ll>
#define vl vector<ll>
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define MAXN 200000
#define bsze 555
#define endl '\n'
#define sz(v) (ll)v.size()
#define flush fflush(stdout)
#define fast  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
using namespace __gnu_pbds;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> order_set;
ll power(ll x,ll y, ll md){ll res = 1;x%=md;while(y>0){if(y&1)res = (res*x)%md;x = (x*x)%md;y = y>>1;}return res%md;}
int main(){
    string s;
    cin>>s;
    unordered_set<string> st;
    int i=0;
    if(s.length()==1){
        cout<<1<<endl;
        return 0;
    }
    int ans=0;
    string pre="",curr="";
    int cnt=1;
    while(i<s.length()){
        curr+=s[i];
        if(pre!=curr){
            // cout<<curr<<endl;
            pre = curr;
            curr="";
            ans++;
        }
        i++;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 644
#include<stdio.h>
int main()
{

        long long int n;
        int m,i,sum=0,z;
        scanf("%lld %d",&n,&m);
        int ar[m];
        for(i=0; i<m; i++)
        {
            scanf("%d",&ar[i]);
            sum+=ar[i];
        }
        z = n - sum;
        if(z<0)printf("-1");
        else printf("%d",z);
        return 0;

    }


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

int main()
{
	string a;
	cin >> a;
	for (int i = 0; i < a.size()-1; ++i)
		if(a[i]==a[i+1])
	{
		cout << "Bad";
		return 0;
	}
		cout << "Good";
	return 0;
}


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

int main(){
	int a,n;
	cin >> n;
	unordered_map<int,int> num;

	for(int i = 0; i < n; ++i){
		cin >> a;
		for(int j = a - 1; j <= a + 1; ++j){
			auto itr = num.find(j);
			if(itr != num.end()){
				++(itr->second);
			} else{
				num[j] = 1;
			}
		}
	}

	int out=0;
	for(auto& n : num){
		if(n.second > out){
			out = n.second;
		}
	}
	cout << out << endl;

	cin >> n;
	return 0;
}

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

#define int long long
#define debug(x) cout<<#x<<" "<<x<<endl;

const int N=1e6+5;
const double eps=1e-9;
const int INF=1e18;

signed main()
{
    //freopen("a.in","r",stdin);
    //freopen("a.out","w",stdout);
    int a,b,c;
    cin>>a>>b>>c;
    swap(a,b);swap(a,c);
    cout<<a<<" "<<b<<" "<<c<<endl;
    return 0;
}

//Created Time  :2020/4/4 20:00:15


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#include <sstream>
#include <climits>
#include <map>
#include <stack>
using namespace std;
#define M_PI 3.141592
#define toRad 2.0*M_PI/360.0
#define inin(x) int x;cin>>x;
#define all(x) x.begin(),x.end()
#define debug(x) cout<<#x<<" "<<x<<endl;
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define pri_max 60000
typedef pair<int, int> pii;
/*
bool memo[pri_max] = {};
vector<int> pri;
void calc()
{
	for (int i = 2; i < pri_max; i++)
	{
		if (memo[i] == false)
		{
			pri.push_back(i);
			for (int l = i; l < pri_max; l += i)
			{
				memo[l] = true;
			}
		}
	}
}*/
int main()
{
	int n;
	while (cin >> n)
	{
		int ans = 1;
		for (int i = 1; i <= n; i++)
		{
			ans += i;
		}
		cout << ans << endl;
	}
}

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

using namespace std;

#define REP(i,m) for(long long i=0; i<m; i++)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define INF 1000000000
#define INFL 10000000000000000LL
#define ALL(v) v.begin(),v.end()
#define pb push_back
#define ll long long int
#define P pair<ll, ll>


int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if(a+b >= c) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


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

a = h[0]
cnt = 0
ans = 0
for i in range(1, n):
    if h[i] <= a:
        cnt += 1
        a = h[i]
    else:
        ans = max(ans, cnt)
        a = h[i]
        cnt = 0
ans = max(ans, cnt)
print(ans)

Measured memory_bytes: 20404
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
#define rep(i, j) for (long long i = 0; i < j; i++)
#define int long long
#define gcn(N) \
    int N;     \
    cin >> N;
#define debug(var)                  \
    do {                            \
        std::cout << #var << " : "; \
        view(var);                  \
    } while (0)
template <typename T>
void view(T e)
{
    std::cout << e << std::endl;
}
template <typename T>
void view(const std::vector<T>& v)
{
    for (const auto& e : v) {
        std::cout << e << " ";
    }
    std::cout << std::endl;
}
template <typename T>
void view(const std::vector<std::vector<T>>& vv)
{
    for (const auto& v : vv) {
        view(v);
    }
}

using namespace std;
/*


*/

signed main()
{
    gcn(N);
    int b, pre_b, ans = 0;
    rep(i, N - 1)
    {
        cin >> b;
        if (i != 0) {
            ans += min(b, pre_b);
        } else {
            ans += b;
        }
        pre_b = b;
    }
    ans += b;
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>  // g++ -std=c++14 -o a a.cpp

using namespace std;

typedef pair<int, int> P;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;

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

__attribute__((constructor)) void initial() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

const long double PI = 3.14159265358979323846;

int main() {
    long double R;
    long double two = 2.0;
    cin >> R;
    cout << setprecision(8);
    cout << (R * PI * two) << endl;
}


Measured memory_bytes: 3804
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <fstream>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    string s, t;
    cin >> s >> t;
    cout << t << s;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = 1000000007;

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

	if (1 <= x && x <= 6) {
		cout << 1 << endl;
		return 0;
	}

	if (x % 11 == 0) a = (x / 11) * 2;
	else a = (x / 11 + 1) * 2;
	if ((x - 6) % 11 == 0) b = ((x - 6) / 11) * 2 + 1;
	else b = ((x - 6) / 11 + 1) * 2 + 1;
	cout << min(a, b) << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int w,h,x,y,r;
  cin>>w>>h>>x>>y>>r;
  if(x-r>=0&&x+r<=w&&y-r>=0&&y+r<=h){
      cout<<"Yes"<<endl;
    }
  else{
    cout<<"No"<<endl;
  }
  
}



Measured memory_bytes: 3112
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
typedef long long ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1e9 + 7;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<class T>
istream& operator >> (istream& is, vector<T>& v)
{
	for (auto &i : v) is >> i;
	return is;
}
template<class T>
ostream& operator<<(ostream& os, vector<T>& v)
{
	const string delimiter = "\n";
	REP(i, v.size())
	{
		os << v[i];
		if (i != v.size() - 1) os << delimiter;
	}
	return os;
}
/*--------------------template--------------------*/

int main()
{
	cin.sync_with_stdio(false); cout << fixed << setprecision(10);
	ll n, k; cin >> n >> k;
	ll lb = -1, ub = 2e18 + 1;
	while (ub - lb > 1)
	{
		ll mid = (ub + lb) / 2;
		ll rem = mid;
		REP(i, n - 1)
		{
			rem -= (rem - 1) / k + 1;
		}
		if (rem > 0) ub = mid;
		else lb = mid;
	}
	cout << lb << endl;
	return 0;
}


Measured memory_bytes: 3220
#include <iostream>
#include <limits>
#include <queue>
#include <vector>

template<typename D>
struct link
{
  D destination;
  int length;
};

struct node
{
  int name;
  std::vector<link<node*>> links;
  int distance_from_root{std::numeric_limits<int>::max()};
};

void solve(std::vector<node>& nodes, node& root)
{
  std::queue<node*> queue;

  root.distance_from_root = 0;
  queue.push(&root);

  while (!queue.empty()) {
    auto* target = queue.front();
    queue.pop();

    for (const auto& link : target->links) {
      auto* neighbor = link.destination;
      const auto d = target->distance_from_root + link.length;
      if (neighbor->distance_from_root <= d) continue;
      neighbor->distance_from_root = d;
      queue.push(neighbor);
    }
  }
}

std::string distance_string(int distance)
{
  return distance == std::numeric_limits<int>::max()
      ? "INF"
      : std::to_string(distance);
}

int main()
{
  int node_count, link_count, root_name;
  std::cin >> node_count >> link_count >> root_name;

  std::vector<node> nodes(node_count);
  for (int i = 0; i < link_count; ++i) {
    int s, t, d;
    std::cin >> s >> t >> d;
    auto& n = nodes.at(s);
    n.name = s;
    n.links.push_back(link<node*>{&nodes.at(t), d});
  }

  solve(nodes, nodes.at(root_name));

  for (const auto& n : nodes) {
    std::cout << distance_string(n.distance_from_root) << std::endl;
  }
}



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

int main()
{
  int n,x,ans=0;
  cin>>n;
  while(n--)
  {
  	cin>>x;
  	ans+=x;
  }
  if(ans&1)
  cout<<"NO\n";
  else
  cout<<"YES\n";
  return 0;
}

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

max_cnt = 0
for i in range(N):
    max_cnt += A[i] if B[i] - A[i] >= 0 else B[i]
    B[i] -= A[i]
    if B[i] > 0:
        max_cnt += min(A[i+1],B[i])
        A[i+1] = max(0,A[i+1]-B[i])

print(max_cnt)


Measured memory_bytes: 18624
#include <bits/stdc++.h>
using namespace std;
// types
typedef long long ll; 
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> pii;
// IO
#define fo(i, n) for (int i = 0; i < n; i++)
#define fo1(i, n) for (int i = 1; i <= n; i++)
#define sc(n) scanf("%d", &n) 
#define sca(a, n) fo(i, n) sc(a[i])
#define pd(a) printf("%d ", a)
#define pld(a) printf("%d\n", a)
#define pda(a, n) fo(i, n) pd(a[i])
#define pl printf("\n")
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b) 
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
// math
const ll mod = 1e9+7;
template<typename T> T gcf(T a, T b) {return (b == 0) ? a : gcf(b, a%b);} 
template<typename T> T lcm(T a, T b) {return (a*b)/gcf(a, b);}
template<typename T> T sumTo(T x) {return x * (x+1) / 2;}
template<typename T> T sumSquaresTo(T x) {return x * (x+1) * (2*x+1) / 6;}
template<typename T> T ceilDiv(T n, T d) {return (n+d-1)/d;}

vector<bool> binaryBackwards(ll n) {
    // returns binary representation of the vector backwards
    vector<bool> ans;
    while (n > 0) {
        ans.push_back(n%2);
        n /= 2;
    }
    return ans;
}

ll emod(ll base, ll exponent) {
    vector<bool> bb = binaryBackwards(exponent);
    ll ans = 1;
    ll bp = base % mod;
    for (int i = 0; i < bb.size(); i++) {
        if (bb[i]) {
            ans *= bp;
            ans %= mod;
        }
        bp = (bp * bp) % mod;
    }
    return ans;
}


void solve() {
    int n, k; cin >> n >> k;
    k = min(k, n-1);
    ll ans = 1;
    ll nCr = 1;
    ll mCr = 1;
    int top = n;
    fo1(i, k) {
        nCr *= top;
        mCr *= top-1;
        top--;
        nCr %= mod;
        mCr %= mod;
        nCr *= (emod(i, mod-2));
        mCr *= (emod(i, mod-2));
        nCr %= mod;
        mCr %= mod;
        ans += (nCr * mCr) % mod;
        ans %= mod; 
    }
    cout << ans;
}

int main() {
    int t = 1;
    //scanf("%d", &t);
    while (t--) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 256
N = int(input())

xy = [list(map(int, input().split())) for _ in range(N)]
Ns = [i for i in range(N)]
from itertools import permutations
from math import factorial, sqrt
ans = 0
for lis in permutations(Ns):
    tmp = 0
    for i in range(1, N):
        x1, y1 = xy[lis[i-1]]
        x2, y2 = xy[lis[i]]
        tmp += sqrt((x2-x1)**2+(y2-y1)**2)
    ans += tmp

print(ans/factorial(N))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long N,a,b,c;
	cin>>N>>a>>b;
	long long cnt=0;
	if(N%(a+b)==0){
		cnt=N/(a+b);
		cout<<a*cnt<<endl;
	}
	else {
		cnt=N/(a+b);
		long long ans=cnt*a;
		ans+=min(N-(cnt*(a+b)+1)+1,a);
		cout<<ans<<endl;
	}

	return 0;
}

Measured memory_bytes: 256
N,a,b = map(int,input().split())
sub = b-a
if(sub%2==0):
    print(sub//2)
else:
    bsub = N - b
    asub = a -1
    if(bsub < asub):
        ans = (N - (a + bsub + 1))//2 + bsub + 1
        print(ans)
    else:
        ans = ((b - (asub + 1)) - 1) // 2 + asub + 1
        print(ans)


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

int main()
{
    int t[5];
    cin >> t[0];
    cin >> t[1];
    cin >> t[2];
    cin >> t[3];
    cin >> t[4];

    // 一番小さいやつ
    int min_i = 0;
    for (int i = 1; i < 5; i++) {
        if (t[min_i] % 10 == 0 || (t[i] % 10 != 0 && t[min_i] % 10 > t[i] % 10)) {
            min_i = i;
        }
    }

    int res = 0;
    for (int i = 0; i < 5; i++) {
        if (i == min_i) {
            continue;
        }
        float _t = (float)t[i] / 10;
        res += ceil(_t) * 10;
    }
    res += t[min_i];

    printf("%d", res);

}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
#include <string>
#include <bitset>
#include <queue>
#include <tuple>
#include <cmath>
#include <map>
#include <cstring>

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

using namespace std;

using ll = long long;
using ull = unsigned long long;

using Pint = pair<int, int>;
using Pll  = pair<ll, ll>;
using Pull = pair<ull, ull>;

#define eb emplace_back
#define pb push_back
#define mp make_pair
#define mt make_tuple

#define F first
#define S second

#define rep( i, n ) for ( int i = 0; i < (int)( n ); ++i )
#define reps( i, n ) for ( int i = 1; i <= (int)( n ); ++i )
#define rrep( i, n ) for ( int i = (int)( ( n ) - 1 ); i >= 0; --i )
#define rreps( i, n ) for ( int i = (int)( ( n ) ); i > 0; --i )
#define arep( i, v ) for ( auto &&i : ( v ) )

template<typename T> T gcd( const T a, const T b ) { return ( b ? gcd( b, a % b ) : a ); }

#define ALL( c ) ( c ).begin(), ( c ).end()
#define RALL( c ) ( c ).rbegin(), ( c ).rend()
#define UNIQUE( c ) ( c ).erase( unique( ( c ).begin(), ( c ).end() ), ( c ).end() )

constexpr ll MOD = 1000000007LL;

#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev

template<typename T = ll> class UnionFind {
public:
	UnionFind( T n ) { rep( i, n ) { par.resize( n ); siz.resize( n ); par[i] = i; siz[i] = 1; } }
	T find( T x ) { if ( x == par[x] ) return ( x ); else return( par[x] = find( par[x] ) ); }
	void unite( T x, T y ) { T xx = find( x ); T yy = find( y ); if ( xx == yy ) return;
		if ( siz[xx] <= siz[yy] ) swap( xx, yy ); par[yy] = xx; siz[xx] += siz[yy]; }
private:
	vector<T> par, siz;
};

template<typename T = ll> T power( T a, T b, T m = MOD ) {
	T res = 1;
	while ( b > 0 ) { if ( b & 1 ) res = res * a % m;
		a = a * a % m; b >>= 1; }
	return ( res );
}

/*
constexpr ll MAX = 500010;
ll fact[MAX];
ll inv[MAX];
ll inv_fact[MAX];

template<typename T> void initComb( T n, T m = MOD )
{
	fact[0] = fact[1] = inv_fact[0] = inv_fact[1] = 1;
	inv[1] = 1;
	for ( int i = 2; i < n; i++ ) {
		fact[i] = ( fact[i - 1] * i ) % m;
		inv[i] = m - inv[m % i] * ( m / i ) % m;
		inv_fact[i] = inv_fact[i - 1] * inv[i] % m;
	}
}

template<typename T> T comb( T n, T r, T m = MOD )
{
	if ( n < r ) return ( 0 );
	if ( n < 0 || r < 0 ) return ( 0 );
	return ( fact[n] * ( inv_fact[r] * inv_fact[n - r] % m ) % m );
}
*/

void replace( string &s, string t, string r ) {
	string::size_type p = 0;
	while ( ( p = s.find( t, p ) ) != string::npos ) {
		s.replace( p, t.length(), r );
		p += r.length();
	}
}


int main()
{
	string s1, s2;
	cin >> s1 >> s2;

	s1 += s2;
	ll ab = atoi( s1.c_str() );

	bool flg = false;
	for ( int i = 1; i * i <= ab; i++ )
	{
		if ( i * i == ab )
		{
			flg = true;
			break;
		}
	}

	cout << ( flg ? "Yes" : "No" ) << endl;
	return ( 0 );
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <iomanip>
#include <climits>
#include <functional>
#include <cassert>
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<string> VS;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<PII> VPI;
typedef vector<PLL> VPL;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define pf push_front
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ub upper_bound
#define lb lower_bound

int main(){
  int N;
  cin>>N;
  VL X(N),Y(N);
  VL A(N),B(N);
  rep(i,N) cin>>X[i]>>Y[i];
  rep(i,N){
    A[i]=X[i]+Y[i];
    B[i]=X[i]-Y[i];
  }
  sort(all(A));
  sort(all(B));
  cout<<max(A[N-1]-A[0],B[N-1]-B[0])<<endl;
}


Measured memory_bytes: 9472
/*

Coded by peyha X

*/

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

string s, ans = "";

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	cin >> s;
	
	int n = s.size();
	
	for(int i = 0; i < n; i++)
	{
		ans += 'x';
	}
	
	cout << ans << '\n';
	
	
	
}


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

int main(){
	int 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(x==500*i+100*j+50*k) cnt++;
			}
		}
	}
	cout << cnt << endl;
}

Measured memory_bytes: 256
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = || -> String {
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
 
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
 
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
    
    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
 
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
 
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [$t:tt]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };
 
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
 
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
 
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
 
fn main() {
    use std::collections::HashSet;
    input! { n: usize, m: usize, a: [[usize1]; n] }
    let mut counts = vec![0;m];
    for arr in a {
        for i in arr {
            counts[i] += 1;
        }
    }
    let mut ret = 0;
    for (i,_) in counts.iter().enumerate() {
        if counts[i] == n {ret+=1;}
    }
    println!("{}", ret);
}

Measured memory_bytes: 4352
import math

a = int(input())
x = []
y = []
total_dis = 0
count = 0
for i in range(a):
  n, m = map(int, input().split())
  x.append(n)
  y.append(m)

for i in range(a):
  x_1 = x[i]
  y_1 = y[i]
  for j in range(a):
    dis = math.sqrt((x_1 - x[j])**2 + (y_1 - y[j])**2)
    count += 1
    total_dis += dis


print(total_dis/(count/a))
 
  
  

  

Measured memory_bytes: 3316
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>
#include <tuple>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

ll sq(ll num) { return num*num; }
ll mod_pow(ll x, ll n) {
	if (n == 0)return 1;
	if (n == 1)return x%MOD;
	ll res = sq(mod_pow(x, n / 2));
	res %= MOD;
	if (n % 2 == 1) {
		res *= x;
		res %= MOD;
	}
	return res;
}
ll mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

int n;
ll a[10000];

int main(){
	cin >> n;
	int ans = 0;
	rep(i,n){
		cin >> a[i];
		while(a[i]%2 == 0){
			a[i] /= 2;
			ans++;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define int long long
int inf = 10e17;
#define mod 1000000007

bool vis[200005];
vector<int> vec[2000005], v1;
int child[2000005];
int parent[2000005];
int div1[100005];
int min_indx[900005];
int count1 = 0;
int height = 0;
int max_indx[200005];
void dfs(int node)
{

    vis[node] = 1;
    // cout << node << "\n";
    min_indx[count1] = node;
    max_indx[node] = min(max_indx[node], count1);
    count1++;

    //  count1++;
    child[node] = height++;
    for (int i = 0; i < vec[node].size(); i++)
    {
        if (!vis[vec[node][i]])
        {
            dfs(vec[node][i]);
            min_indx[count1] = node;
            max_indx[node] = min(max_indx[node], count1);
            count1++;
        }
    }
    height--;
}

int MAXN = 200005;
int LOGMAXN = (int)log2(200005) + 1;
int M[200005][60];
void process2(int A[], int N)
{
    int i, j;

    //initialize M for the intervals with length 1
    for (i = 0; i < N; i++)
        M[i][0] = i;
    //compute values from smaller to bigger intervals
    for (j = 1; 1 << j <= N; j++)
        for (i = 0; i + (1 << j) - 1 < N; i++)
            if (A[M[i][j - 1]] < A[M[i + (1 << (j - 1))][j - 1]])
                M[i][j] = M[i][j - 1];
            else
                M[i][j] = M[i + (1 << (j - 1))][j - 1];
}
//int parent[200005];
vector<int> vec1;
//bool vis[200005];
//int hei[200005];
int lev[200005];
int dis[200005];
bool cmp(pair<int, int> &a,
         pair<int, int> &b)
{
    return a.second < b.second;
}
int32_t main()
{
    // ios_base::sync_with_stdio(false);
    // cin.tie(NULL);
    //  int t;
    int n;
    cin >> n;
    int x1 = 0, y1 = 0;
    int t1 = 0;
    bool flag = 0;
    for (int i = 0; i < n; i++)
    {
        int t, x, y;
        cin >> t >> x >> y;
        int p1 = fabs(x - x1);
        int p2 = fabs(y - y1);
        int p3 = t - t1;
        if (p3 < p1 + p2)
        {
            flag = 1;
           // cout << "tree"
             //    << "\n";
        }
        else
        {
            if ((p3 - p1 - p2) % 2)
                flag = 1;
        }
        x1 = x;
        y1 = y;
        t1 = t;
       // cout << flag << "\n";
    }
    if (flag)
        cout << "No"
             << "\n";
    else
    {
        cout << "Yes"
             << "\n";
    }

    return 0;
}


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

int main(){
    int total=0;
    int total_ashi=0;
    int fool=0;
    cin>>total>>total_ashi;
    for(int i=0;i<=total;i++){
        if((4*i+2*(total-i))==total_ashi){
            cout<<"Yes\n";
            fool++;
        }
    }
    if(fool<=0){
        cout<<"No\n";
    }
}
                                                        
                                                        

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



int main() {

    int N;
    int A[100001];
    cin >> N;
    for (int i = 0; i < N + 1; i++) cin >> A[i];
    //今の深さの点の数
    long long now = 1;
    //int mae = 0;
    long long ans = 0;
    //末端の数
    long long sum = 0;
    //分岐した回数
    long long route = 1;
    
    for (int i = 0; i < N + 1; i++)
    {
        sum += A[i];
    }
    
    //cout << sum << endl;
    for (int i = 0; i < N + 1; i++)
    {
        //cout << now <<route<< endl;
        ans += now;
        //cout << now<< " ";
        now -= A[i];
        sum -= A[i];
        now = min(now * 2, sum);
        
        //cout << now << endl;
        if (i != N && now <= 0)
        {
            cout << -1 << endl;
            return 0;
        }
        else if (i == N && now != 0)
        {
            cout << -1 << endl;
            return 0;
        }
        
        /*
        //できるだけ早く分岐しておく
        int a = now;
        if (i != N && now <= 0)
        {
            cout << -1 << endl;
            return 0;
        }
        else if (i == N && now != 0)
        {
            cout << -1 << endl;
            return 0;
        }
        else if (route < sum)
        {
            if (route + a <= sum)
            {
                now += a;
                route += a;
            }
            else
            {
                now += sum - route;
                route += sum - route;
            }
           
        }*/

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

Measured memory_bytes: 3972
num = int(input())
xs = list(map(int, input().split()))
ys = list(map(int, input().split()))

mh = sum(abs(x-y) for x, y in zip(xs, ys))
ec = pow(sum(abs(x-y)**2 for x, y in zip(xs, ys)), 1/2)
p3 = pow(sum(abs(x-y)**3 for x, y in zip(xs, ys)), 1/3)
cv = max(abs(x-y) for x, y in zip(xs, ys))

print(round(mh, 8))
print(round(ec, 8))
print(round(p3, 8))
print(round(cv, 8))


Measured memory_bytes: 5648
#include <bits/stdc++.h>
 
using namespace std;
 
#define fi first
#define se second
#define pb push_back
#define mp make_pair
 
typedef pair<int, int> ii;
#define int long long
const int N = 1e5 + 5;
 
int n, a[N], mul = 1;
 
const int mod = 998244353;
 
signed main() {
    cin.tie(0), ios::sync_with_stdio(0);
    cin >> n;
    for(int i = 1; i <= n; i++)
        cin >> a[i];
    sort(a + 1, a + 1 + n);
    for(int i = 0; i < n; i++)
        mul = (1ll * mul * __gcd(i, a[i + 1])) % mod;
    cout << mul;
}

Measured memory_bytes: 1024
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<ctime>
#include<map>
#include<bitset>
#include<set>
#define LL long long
#define mp(x,y) make_pair(x,y)
#define pll pair<long long,long long>
#define pii pair<int,int>
#define rand() rand()*rand()
using namespace std;
inline LL read()
{
	LL f=1,x=0;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int stack[20];
inline void write(int x)
{
	if(x<0){putchar('-');x=-x;}
    if(!x){putchar('0');return;}
    int top=0;
    while(x)stack[++top]=x%10,x/=10;
    while(top)putchar(stack[top--]+'0');
}
inline void pr1(int x){write(x);putchar(' ');}
inline void pr2(int x){write(x);putchar('\n');}
const int MAXN=205;
const int MAXM=100005;
const int mod=1e9+7;

int pow_mod(int a,int b)
{
	int ret=1;
	while(b)
	{
		if(b&1)ret=1LL*ret*a%mod;
		a=1LL*a*a%mod;b>>=1;
	}
	return ret;
}
int pre[2*MAXM],inv[2*MAXM];
int n,m,a[MAXN];
int f[MAXN][MAXM];
void add(int &x,int y){x+=y;if(x>=mod)x-=mod;}
int dfs(int x,int u)
{
	if(x>n)return u;
	int ls=x;
	while(a[x]>u&&x<=n)x++;
	int ad=x-ls;//目前有多少个可以插的
	if(x>n)return 1LL*u*pre[x-ls]%mod; 
	if(f[x][u]!=-1)return 1LL*pre[n-x+1+ad]*inv[n-x+1]%mod*f[x][u]%mod;
	int ret=0;
	for(int i=x;i<=n;i++)
	{
		int nxt=u%a[i];
		add(ret,1LL*pre[n-i+(i-x)]*inv[n-i]%mod*dfs(i+1,nxt)%mod);
	}
	f[x][u]=ret;
	return 1LL*pre[n-x+1+ad]*inv[n-x+1]%mod*ret%mod;
}
int main()
{
	pre[0]=1;
	for(int i=1;i<2*MAXM;i++)pre[i]=1LL*pre[i-1]*i%mod;
	inv[2*MAXM-1]=pow_mod(pre[2*MAXM-1],mod-2);
	for(int i=2*MAXM-2;i>=0;i--)inv[i]=1LL*inv[i+1]*(i+1)%mod;
	n=read();m=read();
	memset(f,-1,sizeof(f));
	for(int i=1;i<=n;i++)a[i]=read();
	sort(a+1,a+1+n);reverse(a+1,a+1+n);
	pr2(dfs(1,m));
	return 0;
}



Measured memory_bytes: 81792
program DISCO2020yD
integer::M
integer(16)::d,c
integer(16)::bonus
integer(16)::ans
read*,M
ans=0
bonus=0
do i=1,M
  read*,d,c
  bonus=bonus+d*c
  ans=ans+c
end do
print"(i0)",ans+(bonus-1_16)/9_16 -1_16
end


Measured memory_bytes: 640
#include "bits/stdc++.h"
// #include <boost\version.hpp>
#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 SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define pb(a) push_back(a)
#define INF 1145141919
#define MINF -1145141919

using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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



int solve(int n,vi l, vi r) {
	int ans = 0;
	FOR(i, 0, n) {
		int tmp = 1;
		tmp += (r[i] - l[i]);
		ans += tmp;
	}
	return ans;
}
int main() {
	int N;
	vi l;
	vi r;
	cin >> N;
	FOR(i, 0, N) {
		int tl, tr;
		cin >> tl >> tr;
		l.pb(tl);
		r.pb(tr);
	}
	cout << solve(N, l, r) << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
using namespace std;
using int64 = long long;
using vint = vector<int>;
#define Rep(i, n) for (int i = 0; i < (n); ++i)
#define InitRep(i, init, n) for (int i = (init); i < (n); ++i)
#define RepLong(i, n) for (int64 i = 0; i < (n); ++i)
#define InitRepLong(i, init, n) for (int64 i = (init); i < (n); ++i)
#define RepItr(it, itBegin, itEnd) for (auto it = (itBegin); it != (itEnd); ++it)

int main()
{
	int r;
	cin >> r;
	cout << (r * r) << endl;

	return 0;
}

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

int main() {
	ll N, K;
	cin >> N >> K;

	vector<ll>h(N);
	for (ll i = 0; i < N; i++) cin >> h[i];

	sort(h.begin(), h.end());

	ll ans = 1e18;

	for (ll i = 0; i + K <= N; i++) {
		ll Q = h[i];
		ll W = h[i + K - 1];

		ans = min(ans, W - Q);
	}

	cout << ans << endl;
}

Measured memory_bytes: 4012