akhauriyash/Code-Regression huggingface dataset:
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.stdio;


immutable int MOD = 10^^9+7;
immutable int MAX = 401;

void main() {
    auto s = readln.split.map!(to!int);
    auto N = s[0];
    auto K = s[1];
    auto A = readln.split.map!(to!long).array;
    auto B = readln.split.map!(to!long).array;

    auto p = new long[][](MAX, MAX);
    foreach (i; 0..MAX) {
        p[i][0] = 1;
        foreach (j; 1..MAX) {
            p[i][j] = p[i][j-1] * i % MOD;
        }
    }

    auto ps = new long[][](MAX, MAX+1);
    foreach (i; 0..MAX) {
        ps[i][0] = 1;
        foreach (j; 1..MAX) {
            ps[i][j] = (ps[i][j-1] + p[j][i]) % MOD;
        }
    }

    auto dp = new long[][](N+1, K+1);
    foreach (i; 0..N+1) fill(dp[i], 0);
    dp[0][0] = 1;

    foreach (i; 1..N+1) {
        foreach (j; 0..K+1) {
            foreach (k; 0..j+1) {
                auto wa = ps[j-k][B[i-1].to!int] - ps[j-k][A[i-1].to!int-1];
                dp[i][j] += dp[i-1][k] * wa % MOD;
                dp[i][j] %= MOD;
            }
        }
    }

    //dp.writeln;
    writeln((dp[N][K]+MOD)%MOD);
}


Measured memory_bytes: 6908
# AGC 012 A - AtCoder Group Contest
N = int(input())
an = list(map(int,input().split()))

lists = [[] for _ in range(N)]
an.sort(reverse=True)

for k in range(N):
    lists[k].append(an[2*k])
    lists[k].append(an[2*k+1])
                    
for i in range(N):
    lists[i].append(an[2*N-1+i])

sasa = 0
for j in range(N):
    sasa += lists[j][1]
print(sasa)

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

int main(){
  int64_t lenS,lenT;
  string S,T;
  cin >> lenS >> lenT >> S >> T;

  int64_t cand= lcm(lenS, lenT);
  int64_t Nmatch= gcd(lenS, lenT);
  int64_t fracS= lenS/ Nmatch;
  int64_t fracT= lenT/ Nmatch;

  bool satisfied= true;
  for(int64_t i=0; i<Nmatch; i++){
    satisfied&= (S.at(i* fracS)==T.at(i* fracT));
  }

  int64_t ans= satisfied ? cand
                         : -1;
  cout << ans << endl;
}

Measured memory_bytes: 3748
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <iostream>
using namespace std;
char s[10];
int main(){
	cin>>s+1;
	int ans = 0;
	for(int i = 1; i <= strlen(s+1); i++){
		if(s[i] == '-') ans--;
		else if(s[i] == '+')ans++;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF = 1e18+18;
const ll MAX = 400005;
const ll MOD = 1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;

/*long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}*/


int main(){
    ll N, K;
    cin>>N>>K;
    ll Sum=0;
  	if(K==0){
        Sum=N*N;
        cout<<Sum<<endl;
        return 0;
    }
    for(int b=K+1; b<=N; b++){
        Sum+=((N+1)/b)*(b-K);
        for(int i=K; i<=b-1; i++){
            if(((N+1)/b)*b+i>N){
                break;
            }
            Sum++;
        }
      	//cout<<Sum<<endl;

    }
    cout<<Sum<<endl;
}

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

int main()
{
    int n;
    cin>>n;
    vector<int>h(n+1,0),ans(n+1);
    for(int i = 1 ; i <= n ; i++)
        cin>>h[i];    
    ans[2] = abs(h[2] - h[1]);
    for(int i = 3 ; i <= n ; i++)
    {
        ans[i] = min((ans[i-1] + abs(h[i] - h[i-1])), (ans[i-2] + abs(h[i] - h[i-2])));
    }
    cout<<ans[n];
    return 0;
}

Measured memory_bytes: 1024
#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 = 1001001001;

int main(){
  int n,k;
  cin >> n >> k;
  vector<int> h(n);
  rep(i,n) cin >> h[i];
  int dp[100001];
  rep(i,100001) dp[i] = inf;
  dp[0] = 0; 

  
  rep(i,n) {
    for(int j = 1; j <= k; j++) {
      if(i+j >= n) continue;
      dp[i+j] = min(dp[i+j], dp[i] + abs(h[i+j]-h[i]));
    }
  }
  cout << dp[n-1] << endl;
}


Measured memory_bytes: 4048
#include <iostream>
#include <string>

using namespace std;

void failure () {
  cout << "No" << '\n';
  exit(0);
}

void success () {
  cout << "Yes" << '\n';
  exit(0);
}

const int MAX_N = 2e5 + 5;

int comp [MAX_N];

int main () {
  ios::sync_with_stdio(false);

  int n, a, b, c, d;
  cin >> n >> a >> b >> c >> d;
  a--; b--; c--; d--;

  string s;
  cin >> s;

  int hast = 0;
  for (int i = 0; i < n; i++) {
    if (i == 0 || (i == 1 && s[i - 1] == '#') ||
        (i >= 2 && s[i - 1] == '#' && s[i - 2] == '#')) {
      comp[i] = i;
    } else {
      comp[i] = comp[i - 1];
    }

    if (i >= 2 && s[i] == '.' && s[i - 1] == '.' && s[i - 2] == '.') {
      if (comp[i] == comp[a] && b <= i - 1 && i - 1 <= d && i <= c) {
        hast = 1;
      }
    }
  }

  if (comp[a] != comp[c]) failure();
  if (comp[b] != comp[d]) failure();
  if (c > d && !hast) failure();
  success();
}


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

int main() {
	int t;
	cin>>t;
	while(t--) {
		ll a,b,c,d;
		cin>>a>>b>>c>>d;
		if(d>c && b<a)
			cout<<-1<<"\n";
		else if(a<=b) {
			cout<<b<<"\n";
		}
		else {

			
			
			
				ll rem = a - b;
				//time = b;
				ll pp = (rem)%(c-d);
				ll pro = 0;
				if(pp != 0) {
					pro = (rem/(c-d)) + 1;
				}
				else {
					pro = rem/(c-d);
				}
				ll ans = b + pro*c;
				cout<<ans<<"\n";
			

		}
	}
	return 0;
}*/

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

int main() {

	double a,b,h,m;
	cin>>a>>b>>h>>m;
	double a1 = (h/6)*(3.14159265358979323846264338)+(m/(60*6))*(3.14159265358979323846264338);
	double a2 = (m/30)*(3.14159265358979323846264338);
	//cout<<a1*(180/3.14159265358979323846264338)<<" "<<a2*(180/3.14159265358979323846264338)<<" ";
	double diff;
	if(abs(a2 - a1) > 3.14159265358979323846264338)
		diff = 2*3.14159265358979323846264338 - abs(a2 - a1);
	else
		diff = abs(a2-a1);
	//cout<<(180/3.14159265358979323846264338)*diff<<" ";
	//cout<<setprecision(20)<<diff<<" ";
	//double prod = cos(diff);

	//double ans = pow(a,2) + pow(b,2) − 2*a*b*prod;
	cout<<setprecision(20)<<sqrt(a*a + b*b - 2*a*b*cos(diff));
	return 0;
}


/*
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
	ll t;
	cin>>t;
	while(t--) {
		ll n;
		cin>>n;
		n = 2*n;
		//cout<<M_PI<<" ";

		double ans = 1/(tan(3.141592653589/n));
		
		cout<<setprecision(20)<<ans<<"\n";
	}
	return 0;
}*/
/*
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

const int INF = 1000000000;
vector<vector<pair<int, int>>> adj;
vector<int> d;
vector<int> p;
void dijkstra(int s) {
    int n = adj.size();
    d.assign(n, INF);
    p.assign(n, -1);
    vector<bool> vis(n+1,false);

    d[s] = 0;
    using pii = pair<int, int>;
    priority_queue<pii, vector<pii>, greater<pii>> q;
    q.push({0, s});
    while (!q.empty()) {
        int v = q.top().second;
        int d_v = q.top().first;
        vis[v] = true;
        q.pop();
        if (d_v != d[v])
            continue;

        for (auto edge : adj[v]) {
            int to = edge.first;
            int len = edge.second;

            if (d[v] + len < d[to] && !vis[to]) {
                d[to] = d[v] + len;
                p[to] = v;
                q.push({d[to], to});
            }
        }
    }
    int check = 0;
    for(int i=2; i<n; i++) {
    	if(d[i] == INF) {
    		cout<<"No";
    		check = 1;
    		break;
    	}
    }
    
    if(check == 0) {
    	cout<<"Yes"<<"\n";
    	for(int i=2; i<n; i++) {
    		cout<<p[i]<<"\n";
    	}
    }
	
}

int main() {
	int n,m;
	cin>>n>>m;
	adj.resize(n+1);
	for(int i=0; i<m; i++) {
		int u,v;
		cin>>u>>v;
		adj[u].push_back(make_pair(v,1));
		adj[v].push_back(make_pair(u,1));
	}
	dijkstra(1);
	return 0;
}*/

Measured memory_bytes: 4144
n, m = map(int, input().split())
A = [0]*n
B = [0]*n
for i in range(n):
    A[i], B[i] = map(int, input().split())
C = [0]*m
D = [0]*m
for i in range(m):
    C[i], D[i] = map(int, input().split())

for i in range(n):
    d = [0]*m
    for j in range(m):
        d[j] = abs(A[i]-C[j])+abs(B[i]-D[j])
    print(d.index(min(d))+1)

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

#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
typedef pair<int,int> P;

//-----------------------------------------------------------------------

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

    int n;
    while(cin>>n,n){
        vector<P> vec;
        REP(i,2*n){
            int h,m,s;
            char c;
            cin>>h>>c>>m>>c>>s;
            int time=3600*h+60*m+s;
            vec.push_back(P(time,(i+1)%2));
        }
        sort(ALL(vec));

        int ans=0,cnt=0;
        REP(i,2*n){
            if(vec[i].second){
                cnt++;
                ans=max(ans,cnt);
            }else{
                cnt--;
            }
        }
        cout<<ans<<endl;
    }
}



Measured memory_bytes: 3568
n,m,c = $stdin.gets.split.map(&:to_i)
b = $stdin.gets.split.map(&:to_i)
result = 0
n.times do |i|
  sum = 0
  a = $stdin.gets.split.map(&:to_i)
  m.times do |j|
    sum += a[j]*b[j]
  end
  if sum + c > 0
    result += 1
  end
end
puts result

Measured memory_bytes: 3836
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n;
int ans;
int gx,gy,gz;

void dfs(int c,int x,int y,int z){
	ans=min(ans,abs(x-gx)+abs(y-gy)+abs(z-gz)+c);
	/*if(c<3){
		printf("%d %d %d %d\n",c,x,y,z);
	}
	*/
	if(c==10)return;
	if(z!=gz){
		dfs(c+1,n+1-y,x,z);
		dfs(c+1,y,n+1-x,z);
	}else{
		if(z+1<=n)dfs(c+1,x,y,z+1);
		if(z-1>=1)dfs(c+1,x,y,z-1);
	}
	if(y!=gy){
		dfs(c+1,n+1-z,y,x);
		dfs(c+1,z,y,n+1-x);
	}else{
		if(y+1<=n)dfs(c+1,x,y+1,z);
		if(y-1>=1)dfs(c+1,x,y-1,z);
	}
	if(x!=gx){
		dfs(c+1,x,n+1-z,y);
		dfs(c+1,x,z,n+1-y);
	}else{
		if(x+1<=n)dfs(c+1,x+1,y,z);
		if(x-1>=1)dfs(c+1,x-1,y,z);
	}


}

int main(void){
	int sx,sy,sz;
	scanf("%d",&n);
	scanf("%d%d%d",&sx,&sy,&sz);
	sx++;
	sy++;
	sz++;
	scanf("%d%d%d",&gx,&gy,&gz);
	gx++;
	gy++;
	gz++;
	ans=abs(sx-gx)+abs(gy-sy)+abs(sz-gz);
	dfs(0,sx,sy,sz);
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 3212
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,start,end) for(int i=start;i<=end;i++)
const int INF = 1001001001;
using namespace std;
typedef long long ll;

int main()
{
  ll N, M;
  ll res=0;
  cin >> N >> M;

  ll num = min(N,M/2);
  N -= num;
  M -= num*2;
  res += num;
  num = M/4;
  res += num;

  cout << res << endl;
}

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

int main() {
    int n; cin >> n;
    multimap<int, int> mp;
    rep(i,n) {
        int a, b;
        cin >> a >> b;
        mp.insert(make_pair(b, a));
    }
    ll cnt = 0;
    for (auto x : mp) {
        cnt += x.second;
        if (x.first < cnt) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

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

int main(){
  string s;
  cin >> s;
  vector<char> S;
  vector<char> T;
  for(int i = 0;i < s.size();i++){
    S.push_back(s.at(i));
    T.push_back(s.at(i));
  }
  int count_first = 0;
  for(int i = 1;i < s.size();i++){
    if(S[i-1] == S[i]){
      if(S[i] == '1'){
        S[i] = '0';
        count_first++;
      }
      else if(S[i] == '0'){
        S[i] = '1';
        count_first++;
      }
    }
  }
  int count_last = 0;
  for(int i = s.size();i > 0;i--){
    if(T[i] == T[i-1]){
      if(T[i-1] == '1'){
        T[i-1] = '0';
        count_last++;
      }
      else if(T[i-1] == '0'){
        T[i-1] = '1';
        count_last++;
      }
    }
  }
  cout << min(count_first,count_last) << endl;
}


Measured memory_bytes: 640
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int X = sc.nextInt();
        int[] x = new int[n];
        for (int i = 0; i < n ; i++) {
            x[i] = Math.abs(sc.nextInt() - X);
        }
//  全部の最大公約数がＤになるー
        if ( n > 1) {
            int g = gcd(x[0], x[1]);
            for (int i = 1; i < n - 1 ; i++) {
                 g = gcd(g, x[i + 1]);
            }
            System.out.println(g);
        } else {
            System.out.println(x[0]);
        }


    }
    static int gcd (int x, int y) {
        if(x < y) return gcd(y, x);
        if(y == 0) return x;
        return gcd(y, x % y);
    }

}




Measured memory_bytes: 49148
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/adaptor/indexed.hpp>

using namespace std;
using namespace boost::adaptors;
using namespace std::string_literals;
using ll = int64_t;
using vecint = vector<int>;
using vecll = vector<ll>;
using boost::irange;

int main()
{
  ll n,d,a;
  cin>>n>>d>>a;
  vector<tuple<ll,ll>> vt;
  for(auto&& i:irange(0l,n)) {
    ll x,h;
    cin>>x>>h;
    h = (h+a-1)/a;
    vt.emplace_back(x,h);
  }
  boost::sort(vt);
  queue<tuple<ll,ll>> bombs;
  ll cur_bombs = 0;
  ll ans = 0;
  for(auto&& i:irange(0l,n)) {
    ll x,h;
    tie(x,h) = vt[i];
    while (!bombs.empty()) {
      ll xo,bo;
      tie(xo,bo) = bombs.front();
      if (x - xo > 2*d) {
        bombs.pop();
        cur_bombs -= bo;
      } else {
        break;
      }
    }
    h -= cur_bombs;
    h = max(h, 0l);
    bombs.emplace(x,h);
    cur_bombs += h;
    ans += h;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 6764
n = int(input())
dat = []
for q in range(n):
    a, b = map(int, input().split())
    dat.append([a,b])
can = False
for i in range(2, n):
    if dat[i-2][0] == dat[i-2][1] and dat[i-1][0] == dat[i-1][1] and dat[i][0] == dat[i][1]:
        can = True
print("Yes" if can else "No")


Measured memory_bytes: 62360
// https://atcoder.jp/contests/

#include <bits/stdc++.h>
#define REP(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define REPR(i, n) for (int(i) = (n); (i) >= 0; (i)--)
#define FOR(i, m, n) for (int(i) = (m); (i) < (n); i++)
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;

bool in(int n, set<int> &d)
{
  while (0 < n)
  {
    if (0 < d.count(n % 10))
      return false;
    n /= 10;
  }
  return true;
}

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

  set<int> d;
  REP(i, k)
  {
    int di;
    cin >> di;
    d.insert(di);
  }

  while (!in(n, d))
  {
    n++;
  }

  cout << n << '\n';

  return 0;
}


Measured memory_bytes: 256
// https://beta.atcoder.jp/contests/abc110

#define SUBMIT

#include <bits/stdc++.h>
using namespace std;

int main() {
    int n, m, x, y;
    cin >> n >> m >> x >> y;
    vector<int> xs(n), ys(m);
    for (int i = 0; i < n; ++i) cin >> xs[i];
    for (int i = 0; i < m; ++i) cin >> ys[i];

    sort(xs.begin(), xs.end());
    sort(ys.begin(), ys.end());

    bool no_war = false;
    for (int i = x + 1; i <= y; ++i) {
        if (lower_bound(xs.begin(), xs.end(), i) != xs.end()) continue;
        if (upper_bound(ys.begin(), ys.end(), i - 1) != ys.begin()) continue;
        no_war = true;
        break;
    }

    if (no_war) cout << "No War" << endl;
    else cout << "War" << endl;
    return 0;
}

Measured memory_bytes: 256
/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>
#include <cstring>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
#include <stack>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type ---------- */
using ll = long long;
#define int ll
#define P pair<ll, ll>

/* ---------- Constants  */
const double PI = 3.141592653589793238462643383279;
const ll MOD = 1e9 + 7;
const int INF = 1LL << 55;

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */
signed main() {
    int N;
    cin >> N;
    bool all_minus = true;
    bool all_plus = true;
    vector<int> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
        if (A[i] < 0) all_plus = false;
        if (A[i] > 0) all_minus = false;
    }
    sort(A.begin(), A.end());

    vector<P> ans(N - 1);
    int ret;

    if (all_plus) {
        int tmp = A[0] - A[1];
        ans[0] = P(A[0], A[1]);
        for (int i = 2; i <= N - 2; i++) {
            ans[i - 1] = P(tmp, A[i]);
            tmp -= A[i];
        }
        ans[N-2] = P(A[N-1], tmp);
        ret = A[N-1] - tmp;
    } else if (all_minus) {
        int tmp = A[N-1] - A[N-2];
        ans[0] = P(A[N-1], A[N-2]);
        for (int i = 1; i <= N - 2; i++) {
            ans[i] = P(tmp, A[i-1]);
            tmp -= A[i-1];
        }
        ret = tmp;
    } else {
        int k;
        for (int i = 0; i < N; i++) {
            if (A[i] >= 0) {
                k = i;
                break;
            }
        }

        int tmp = A[0];
        int ans_idx = 0;
        for (int i = k; i <= N - 2; i++) {
            ans[ans_idx] = P(tmp, A[i]);
            tmp -= A[i];
            ans_idx++;
        }

        ans[ans_idx] = P(A[N-1], tmp);
        ans_idx++;
        tmp = A[N - 1] - tmp;
        for (int i = 1; i <= k - 1; i++) {
            ans[ans_idx] = P(tmp, A[i]);
            tmp -= A[i];
            ans_idx++;
        }

        ret = tmp;
    }

    cout << ret << endl;
    for (int i = 0; i < N - 1; i++) {
        cout << ans[i].first << " " << ans[i].second << endl;
    }

    return 0;
}

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

using namespace std;

int main() {
	int a, b;

	cin >> a >> b;

	if (a % 2 == 0 || b % 2 == 0) {
		cout << "No";
	}
	else {
		cout << "Yes";
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100005;
int A[MAXN];
long long int minval[MAXN], maxval[MAXN];
vector <int> G[MAXN];
bool dfs(int pos, int prev)
{
	bool is_leaf = true;
	long long int t1 = 0, t2 = 0, t3 = 0;
	for (int i = 0; i < G[pos].size(); ++i)
	{
		if(G[pos][i] != prev)
		{
			bool temp = dfs(G[pos][i],pos);
			if(!temp)
				return false;
			t1+=minval[G[pos][i]];
			t2+=maxval[G[pos][i]];
			t3 = max(t3, minval[G[pos][i]]);
			is_leaf = false;
		}
	}
	long long int temp = t1;
	if(is_leaf)
	{
		minval[pos] = maxval[pos] = A[pos];
		return true;
	}
	else
	{
		if(t1%2)
		{
			t1--;
			t3--;
			minval[pos]++;
		}
		minval[pos]+=max(2*t3 - t1,0ll);
		maxval[pos] = A[pos];
		if((temp - minval[pos])/2 + minval[pos] > A[pos])
			return false;
		if(t2 < A[pos])
			return false;
		return true;
	}
}
int main()
{
	int n;
	scanf("%d", &n);
	for (int i = 1; i <= n; ++i)
	{
		scanf("%d", &A[i]);
	}
	for (int i = 0; i < n-1; ++i)
	{
		int u,v;
		scanf("%d %d", &u, &v);
		G[u].push_back(v);
		G[v].push_back(u);
	}
	int root = 0;
	for (int i = 1; i <= n; ++i)
	{
		if(G[i].size() > G[root].size())
			root = i;
	}
	if(n == 2)
	{
		if(A[1] == A[2])
			printf("YES\n");
		else
			printf("NO\n");
		return 0;
	}
	bool ans = dfs(root,-1);
	// cout<<root<<"\n";
	// for (int i = 1; i <= n; ++i)
	// {
	// 	cout<<i<<": "<<minval[i]<<" "<<maxval[i]<<"\n";
	// }
	if(!ans || minval[root] != 0)
		printf("NO\n");
	else
	{
		long long int temp = 0;
		for (int i = 0; i < G[root].size(); ++i)
		{
			temp+=maxval[G[root][i]];
		}
		if(temp/2 < A[root])
			printf("NO\n");
		else
			printf("YES\n");
	}
	return 0;
}

Measured memory_bytes: 15616
#include <iostream>
using namespace std;
int main(void){
    
    while(1){
        int a, b;
        char op;
        cin >> a >> op >> b;
        if(op == '?') break;
        
        if(op == '+') cout << a + b << endl;
        if(op == '-') cout << a - b << endl;
        if(op == '*') cout << a * b << endl;
        if(op == '/') cout << a / b << endl;
    }
    
    
}



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

using namespace std;

const int N = 1e5+1;

int n;
int a[N];
vector<int> v;

int main(){
    ios_base::sync_with_stdio(false);
    cout.tie(0);
    cin.tie(0);
    cin >> n;
    for(int i = 0; i < n; ++i)
        cin >> a[i];
    for(int i = n-1; i >= 0; --i){
        int p = upper_bound(v.begin(), v.end(), a[i])-v.begin();
        if(p == v.size())
            v.push_back(a[i]);
        else v[p] = a[i];
    }
    cout << v.size() << '\n';
}


Measured memory_bytes: 1276
package main

import "fmt"

func main() {
	var s string
	fmt.Scanln(&s)
	fmt.Println(find(s))
}

func find(s string) string {
	chars := make([]bool, 26)
	nFound := 0

	for _, c := range s {
		if !chars[c-'a'] {
			nFound += 1
			chars[c-'a'] = true
		}
		if nFound == 26 {
			break
		}
	}

	if nFound < 26 {
		for idx, found := range chars {
			if !found {
				return string('a' + idx)
			}
		}
	}

	return "None"
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
typedef long long LL;
#define lowbit(x) (x)&(-(x))
using namespace std;
const int maxn=110000;
const int maxm=210000;
int a[maxn],san[maxn],b[maxn],op[maxn];
int n;
struct BIT
{
	int t[maxm];
	void add(int x,int v)
	{
		for(int i=x;i<=maxm;i+=lowbit(i)) t[i]+=v;
		return;
	}
	int ca(int x)
	{
		int res=0;
		for(int i=x;i>0;i-=lowbit(i)) res+=t[i];
		return res;
	}
}ch;
void Init()
{
	for(int i=1;i<=n;i++) san[i]=a[i];
	sort(san+1,san+n+1);
	int tot=unique(san+1,san+n+1)-(san+1);
	for(int i=1;i<=n;i++) a[i]=lower_bound(san+1,san+tot+1,a[i])-san;
	return;
}
LL check(int va)
{
	for(int i=1;i<=n;i++)
	{
		if(a[i]<va) op[i]=-1;
		else op[i]=1;
	}
	op[0]=0;
	for(int i=1;i<=n;i++) op[i]=op[i-1]+op[i];
	LL cnt=0;
	for(int i=n;i>=0;i--)
	{
		cnt+=(ch.ca(2*(n+1))-ch.ca(n+1+op[i]-1));
		ch.add(op[i]+n+1,1);
	}
	for(int i=0;i<=n;i++) ch.add(op[i]+n+1,-1);
	return cnt;
}
int main()
{
	scanf("%lld",&n);
	for(int i=1;i<=n;i++) scanf("%lld",&a[i]);
	Init();
	for(int i=1;i<=n;i++) b[i]=a[i];
	sort(b+1,b+n+1);
	int l=1,r=n,best=-1;
	LL all=1ll*n*(n-1)/2+n;
	LL pos=all/2+1;
	while(l<=r)
	{
		int mid=(l+r)/2;
		if(check(b[mid])>all-pos) best=mid,l=mid+1;
		else r=mid-1;
	}
	printf("%lld\n",san[b[best]]);
	return 0;
}

Measured memory_bytes: 2304
#include<stdio.h>

int main() {
   int K, A, B;
   int count = 0;

   scanf("%d", &K);
   scanf("%d %d", &A, &B);

   for(int i = A; i <= B; i++) {
      if(i % K == 0) {
         count++;
         break;
      }
   }

   if(count > 0) {
      printf("OK\n");
   }else {
      printf("NG\n");
   }
   return 0;
}

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

#define int long long
#define f first

#define s second
using namespace std;

template<typename T> using vc = vector<T>;
using pii=pair<int, int>;

void xmax(int & a, int b){
    a=max(a, b);
}
void xmin(int& a, int b){
    a=min(a, b);
}

void print(vc <int> & a, string s){
    cerr << s << " : ";
    for (int i=0; i<a.size(); i++){
        cerr <<a[i] << " ";
    }
    cerr << endl;
}

signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    #ifdef LOCAL_RUN
    freopen("input.txt", "r", stdin);
    int ttt;
    cin >> ttt;
    while(ttt--){
    #endif // LOCAL_RUN

    int w , h;
    cin >> w >> h;
    if (w==1 || h==1){
        cout << 1 << "\n";
    }else{
        int oddh = (h+1)/2;
        int evenh = h/2;
        int oddw = (w+1)/2;
        int evenw = w/2;
        cout << oddh*oddw + evenh*evenw << "\n";
    }

    #ifdef LOCAL_RUN
    }
    #endif // LOCAL_RUN
}


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

using namespace std;

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

const long long MOD = 1e9 + 7;
const int INF = 1e9;
const double EPS = 1e-9;

int main() {
  int X;
  cin >> X;
  X = abs(X);
  int ans = 1;
  while (ans * (ans + 1) < 2 * X) ans++;
  cout << ans << endl;
}

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

const int MAXN=200000+10;
int pp[MAXN]={0};
int main(){
	ios::sync_with_stdio(false);
	int n;
	while(cin>>n){
		for(int i=0;i<n;i++){
			cin>>pp[i];
		}
		int minv=pp[0],maxv=-1000000000;
		/**
			永远拿已知的最小值当成被减数  然后用后面的值减去当前的最小数 
		**/
		for(int i=1;i<n;i++){
			maxv=max(maxv,pp[i]-minv);//-2  -2  
			minv=min(minv,pp[i]);     //3  1
		}
		cout<<maxv<<endl;
	}
	
	return 0;
} 


Measured memory_bytes: 3900
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <random>

using namespace std;

const long long MOD = 998244353;

int main(){
    int n,t;
    cin >> n >> t;
    int from=-1, to=-1;
    int answer = 0;
    for(int i=0;i < n; i++){
        int osu = 0;
        cin >> osu;
        if(to < 0){
            from = osu;
            to = osu + t;
            continue;
        }
        if(to < osu){
            answer += to - from;
            from = osu;
            to = osu + t;
        } else {
            to = osu + t;
        }
    }
    answer += to - from;
    cout << answer << endl;
    return 0;
}


Measured memory_bytes: 256
#
# Written by NoKnowledgeGG @YlePhan
# ('ω')
#
#import math
#mod = 10**9+7
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""
 
def main():
  BTC = 380000.0
  n = int(input())
  ans = 0
  for _ in range(n):
    x,u = input().split()
    if u == 'JPY':
      ans += float(x)
    elif u == 'BTC':
      ans += float(x) * BTC
      
  print(ans)
    
    
    
    
    
if __name__ == '__main__':
  main()

Measured memory_bytes: 2940
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
#include <functional>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) (int)(x).size()
using namespace std;
using ll = long long;
constexpr int inf = 1000000000;
constexpr ll INF = 1000000000000000000;

int main() {
    int N, M;
    cin >> N >> M;
    vector<vector<int>> G(N);
    rep(i, M) {
        int a, b;
        cin >> a >> b;
        --a; --b;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    vector<int> dist(N, -1);
    dist[0] = 0;
    queue<int> q;
    q.push(0);
    while (!q.empty()) {
        int u = q.front();
        q.pop();
        for (auto v : G[u]) {
            if (dist[v] == -1) {
                dist[v] = dist[u] + 1;
                q.push(v);
            }
        }
    }
    cout << (dist[N - 1] - 2 ? "IMPOSSIBLE\n" : "POSSIBLE\n");
    return 0;
}


Measured memory_bytes: 16072
s=input()
n=len(s)
sa=s[:(n-1)//2]
sb=s[(n+1)//2:]
sar=""
sbr=""
for i in range(len(sa)):
    sar+=sa[len(sa)-i-1]
    sbr+=sb[len(sa)-i-1]
if sar==sa and sbr==sb and sa==sb:
    print("Yes")
    exit()
print("No")

Measured memory_bytes: 9044
L = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())
print(L[k-1])

Measured memory_bytes: 3060
#include<stdio.h>

int less(int a,int b){
  if(a<b) return a;
  else return b;
}

int main(void){
  int w,h,c,b;
  scanf("%d %d %d",&w,&h,&c);
  for(int i=1;i<=less(w,h);i++){
    if(w%i==0 && h%i==0){ b=i*i; }
  }
  printf("%d\n",c*(w*h/b));
  return 0;
}



Measured memory_bytes: 2120
#include<bits/stdc++.h>
using namespace std;
#define int long long
//#undef int
#define mk make_pair
#define pb push_back
typedef pair<int, int> pii;
const int mod = 1000000007;
const int INF = 1000000009;
const long long INFL = 1000000000000000018ll;

int N, x[200], y[200], h[200];

int abso(int a)
{
    if(a >= 0)return a;
    return -a;
}

signed main()
{
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> x[i] >> y[i] >> h[i];
    }
    for(int i = 0; i < 101; i++){
        for(int j = 0; j < 101; j++){
            bool flag = true;
            int H = INFL;
            for(int k = 0; k < N; k++){
                H = min(H, abso(i - x[k]) + abso(j - y[k]) + h[k]);
            }
            for(int k = 0; k < N; k++){
                if(abso(i - x[k]) + abso(j - y[k]) + h[k] > H){
                    if(h[k] != 0){
                        flag = false;
                    }
                }
            }
            if(flag){
                printf("%lld %lld %lld\n", i, j, H);
                break;
            }
        }
    }

    return 0;
}

/*
3 0 288
96 1 191
97 1 192


*/


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>
#define rep(i,x,n) for(int i=x;i<n;i++)
#define repd(i,x,n) for(int i=x;i<=n;i++)
#define pii pair<int,int>
#define pll pair<long long ,long long>
#define gbtb ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define MS0(X) memset((X), 0, sizeof((X)))
#define MSC0(X) memset((X), '\0', sizeof((X)))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define gg(x) getInt(&x)
using namespace std;
typedef long long ll;
inline void getInt(int* p);
const int maxn=1000010;
const int inf=0x3f3f3f3f;
/*** TEMPLATE CODE * * STARTS HERE ***/
ll n;
ll dp[maxn];
ll a[maxn];
ll k;
int main()
{
    gbtb;
    cin>>n>>k;
    repd(i,1,n)
    {
        cin>>a[i];
    }
    dp[1]=0;
    dp[0]=0;
    repd(i,2,n)
    {
        dp[i]=inf;
    }
    repd(i,2,n)
    {
        for(int j=i-1;j>=max(1ll,i-k);j--)
        {
            dp[i]=min(dp[i],dp[j]+abs(a[i]-a[j]));
        }
    }
    cout<<dp[n];
    return 0;
}

inline void getInt(int* p) {
    char ch;
    do {
        ch = getchar();
    } while (ch == ' ' || ch == '\n');
    if (ch == '-') {
        *p = -(getchar() - '0');
        while ((ch = getchar()) >= '0' && ch <= '9') {
            *p = *p * 10 - ch + '0';
        }
    }
    else {
        *p = ch - '0';
        while ((ch = getchar()) >= '0' && ch <= '9') {
            *p = *p * 10 + ch - '0';
        }
    }
}

Measured memory_bytes: 5124
#include <bits/stdc++.h>
#define MP std::make_pair
#define PB push_back
#define FI first
#define SE second
#define M 1000005
int n,m,cx=1,cy,sum[M],S[M],fa[M],Union[M];
std::vector <int> Edge[M];
int read(){
	char c=getchar();int ans=0;
	while (c<'0'||c>'9') c=getchar();
	while (c>='0'&&c<='9') ans=ans*10+c-'0',c=getchar();
	return ans;
}
void Write(int x){
	if (x<10) putchar(x^48);
	else Write(x/10),putchar((x%10)^48);
	return;
}
int find_Union(int x){return Union[x]==x?x:Union[x]=find_Union(Union[x]);}
void DFS(int x,int y){
	sum[x]=y;
	for (auto i:Edge[x])
		if (i!=fa[x]) fa[i]=x,DFS(i,-y),sum[x]+=sum[i];
	return;
}
int main(){
	n=read(),m=read(),std::iota(Union+1,Union+1+n,1);
	for (int i=1,x,y;i<=m;i++){
		x=read(),y=read();
		if (find_Union(x)==find_Union(y)) cx=x,cy=y;
		else Union[find_Union(x)]=find_Union(y),Edge[x].PB(y),Edge[y].PB(x);
	}
	DFS(cx,1);
	if (n==m){
		for (int i=cy;i;i=fa[i]) S[++*S]=sum[i];
		if (S[0]&1){
			if (sum[cx]&1) return !printf("-1");
			for (int i=cy;i;i=fa[i]) sum[i]-=sum[cx]/2;
		}
		else {
			if (sum[cx]) return !printf("-1");
			std::sort(S+1,S+1+*S);
			for (int i=cy;i;i=fa[i]) sum[i]-=S[*S/2];
		}
	}
	else if (sum[cx]) return !printf("-1");
	for (int i=1;i<=n;i++) sum[0]+=(sum[i]>0?sum[i]:-sum[i]);
	return Write(sum[0]),0;
}

Measured memory_bytes: 39516
#include <bits/stdc++.h>
using namespace std;
int main() {
	int d;
	cin>>d;
	if (d==25){
	    cout<<"Christmas"<<endl;
	} 
	else if (d==24){
	    cout<<"Christmas Eve"<<endl;
	} 
	else if (d==23){
	    cout<<"Christmas Eve Eve"<<endl;
	} 
	else if (d==22){
	    cout<<"Christmas Eve Eve Eve"<<endl;
	}
	return 0;
}


Measured memory_bytes: 3560
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//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; }

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
*/

int main(){
    int N; cin >> N;
    vector<int> v(N), c(N);
    for(int i=0; i<N; i++) cin >> v[i];
    for(int i=0; i<N; i++) cin >> c[i];

    int ans = 0;
    for(int i=0; i<N; i++){
        if(v[i]-c[i] > 0) ans += v[i]-c[i];
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF=1001001001;
vector<pair<int64_t,int64_t>>pppp(int64_t x){
  vector<pair<int64_t,int64_t>>p;
  for(int64_t i=2;i*i<=x;i++){
    int cnt=0;
    if(x%i==0){
    while(x%i==0){cnt++;x/=i;}
    p.push_back(make_pair(i,cnt));
    }
  }
  if(x!=1){p.push_back(make_pair(x,1));}
  return p; 
}
 
int main() {
 int N;
 cin>>N;
 vector<int64_t>t(N);
 for(int i=0;i<N;i++){
   cin>>t[i];
 }
 int64_t ans=1;
 for(int i=0;i<N;i++){
  ans=t[i]/__gcd(t[i],ans)*ans;
 }
 cout<<ans<<endl;
 return 0;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < n; i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main() {
    int N; cin >> N;
    vector<ll> T(N), A(N);
    REP(i, 0, N) cin >> T[i] >> A[i];

    ll t = T[0], a = A[0];
    REP(i, 1, N) {
        ll j = max((t + T[i] - 1) / T[i], (a + A[i] - 1) / A[i]);
        t = T[i] * j; a = A[i] * j;
    }

    cout << t + a << endl;
    return 0;
}

Measured memory_bytes: 3620
#include<cstdio>
#include<cmath>
using namespace std;
int n,ans[100001],cnt;
int main()
{
	scanf("%d",&n);if(!n) {printf("0\n");return 0;}
	for(bool flag=false;n;flag^=1) {
		int a=abs(n);
		if(a%2==1) {
			ans[++cnt]=1;
			if(!flag) --n;else ++n;
		}
		else ans[++cnt]=0;
		n/=2;
	}
	for(int i=cnt;i;--i) printf("%d",ans[i]);
	printf("\n");
	return 0;
}

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

using namespace std;

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);

	long long n, m;
	cin >> n >> m;
	long long a;
	long long s = 0;
	while(m--) {
		cin >> a;
		s += a;
	}
	cout << max(-1ll, n-s) << '\n';

	return 0;
} 



Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define repk(i,m,n) for(int i=m;i<n;i++)
#define IOS ios::sync_with_stdio(false);cin.tie(0);
#define F first
#define S second
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef long double ld;
using namespace std;
const int MOD1=1e9+7;
const int MOD2=998244353;
const ll INF=2*1e18;
const ld PI=3.14159265358979323846;
int main()
{
    ll k,a,b;
    cin>>k>>a>>b;
    for(int i=a;i<=b;i++)
    {
        if(i%k==0)
        {
            cout<<"OK";
            return 0;
        }
    }
    cout<<"NG";
}


Measured memory_bytes: 3620
import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.Stream;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        final int N = sc.nextInt();

        final int[] a = new int[3*N];
        for (int i = 0; i < 3*N; i++) {
            a[i] = sc.nextInt();
        }

        Arrays.sort(a);
        
        long ans = 0;
        for (int i = N; i < 3*N; i+=2) {
            ans += a[i];
        }

        System.out.println(ans);
    }
}


Measured memory_bytes: 95168
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include<algorithm>
#include<iomanip>
#include<math.h>
#include <stdlib.h>
#include <string.h>
using namespace std;




int main() {
	int n, m, x;
	cin >> n >> m >> x;
	int c[12];
	int a[12][12];

	int ans = INT32_MAX;
	for (int i = 0; i < n; i++) {
		cin >> c[i];

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

	}

	for (int i = 0; i < (1<< n); i++) {
		int cost = 0;
		int b[12] = { 0 };
		for (int j = 0; j < n; j++) {
			if (i&(1<<j)) {
				cost += c[j];

				for (int t = 0; t < m;t++) {
					b[t] += a[j][t];
				}
			}
			
		}
		bool ok = true;
		for (int l = 0; l < m; l++) {
			if (b[l] < x) {
				ok = false;
			}
		}
			if (ok) {
				ans = min(ans, cost);
			}
		
	}

	if (ans == INT32_MAX) {
		cout << "-1";
		return 0;
	}
	cout << ans;
	return 0;

}



Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define FORR(i, a, b) for (int i = b - 1; i >= a; --i)
#define SORT(v) sort(v.begin(), v.end())
#define SORTR(v) sort(v.rbegin(), v.rend())
#define REV(v) reverse(v.begin(), v.end())
#define ITER(v) for (auto itr = v.begin(), itr != v.end(); ++itr)
#define LB(v, x) lower_bound(v.begin(), v.end(), x) - v.begin()
#define UB(v, x) upper_bound(v.begin(), v.end(), x) - v.begin()
#define SZ(v) (int)v.size()
using namespace std;
using ll = long long;
using P = pair<int, int>;

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

    int H, W, A, B;
    cin >> H >> W >> A >> B;
    string s, t;
    REP(i, A) {
        s += '1';
        t += '0';
    }
    FOR(i, A, W) {
        s += '0';
        t += '1';
    }
    REP(i, B) cout << s << endl;
    FOR(i, B, H) cout << t << endl;

    return 0;
}


Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,i;
	string s;
	cin>>a>>b>>s;
	for(i=0;i<s.size();i++){
		if(i==a){
			if(s[i]!='-'){
				cout<<"No"<<endl;
				return 0;
			}
		}
		else if(!isdigit(s[i]))	{
			cout<<"No"<<endl;
			return 0;
		}
		
	}
	cout<<"Yes"<<endl;
	return 0;
} 

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<bits/stdc++.h>
#include<vector>
 
using namespace std;
int MOD=1000000007;
int main(){
    int N,ans=0,flag=0; cin >> N;
    int A[N+10];
    for(int i=0; i<N; i++){
        cin >> A[i];
    }
        while(1){
        for(int i=0; i<N; i++){
            if(A[i]%2!=0) flag=1;
            else A[i]/=2;
        }
        if(flag==1) break;
        ans+=1;
    }
    cout << ans << endl;
}


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

using ld = double;
using ll = long long;
using ull = unsigned long long;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;

const int SZ = 1 << 13;
char buff[SZ], *pos = buff + SZ - 1;
#define getchar() (++ pos == buff + SZ ? fread(pos = buff, 1, SZ, stdin), *pos : *pos)

inline ll read() {
	ll x = 0; int f = 1, c = getchar();
	for (;!isdigit(c); c = getchar()) if (c == '-') f = -f;
	for (; isdigit(c); c = getchar()) x = (x<<3) + (x<<1) + (c^48);
	return x * f;
}

const int N = 1 << 20;
int n, D;
ll dpL[N], dpR[N];
ll a[N];

int main() {
	n = read(), D = read();
	for (int i = 0; i < n; ++ i) a[i] = read();
	dpL[0] = a[0];
	for (int i = 1; i < n; ++ i) dpL[i] = min(a[i], dpL[i - 1] + D);
	dpR[n - 1] = a[n - 1];
	for (int i = n - 2; ~i; -- i) dpR[i] = min(a[i], dpR[i + 1] + D);
	ll res = 1LL * D * (n - 1);
	for (int i = 0; i < n; ++ i) res += a[i];
	for (int i = 1; i < n - 1; ++ i) res += min(dpL[i], dpR[i]);
	printf("%lld\n", res);
	return 0;
}


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

int main() {
  int n; cin>>n;
  double o=0, e=0;
  for(int i=1;i<=n;i++) {
    if(i&1) o++;
    else e++;
  }
  double ans = o/n;
  cout<<fixed<<setprecision(9)<<ans;
}

Measured memory_bytes: 3760
#include <iostream>
#include <iomanip>
#include <ios> 
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define sz(c) ((int)(c).size())

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
const int MAX=1e5+5;



int main(){
	int N,M;
	cin>>N>>M;
	int ct[MAX];
	rep1(i,N)ct[i]=0;
	rep(i,M){
		int a,b;
		cin>>a>>b;
		ct[a]++;
		ct[b]++;
	}
	bool ans=true;
	rep1(i,N)if(ct[i]%2==1)ans=false;
	
	if(ans)cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	
}

Measured memory_bytes: 640
#include <algorithm> //STLͨ���㷨
#include <cmath> //������ѧ����
#include <cstdio> //��������/�������
#include <iostream> //����������/���
#include <cstring> //�ַ�������
#include <string> //�ַ�����
#include <ctime> //�������ʱ��ĺ���
#define itn int
#define fro for
#define ll long long
#define reg register
#define inf 1234567890
#define rep(i,a,b,c) for (int i=a;i<=b;i+=c)
/*#include <bitset> //STLλ������
#include <cstype> //�ַ�����
#include <cerrno> //���������
#include <complex> //������
#include <clocale> //���屾�ػ�����
#include <cstdlib> //������������ڴ���亯��
#include <deque> //STL˫�˶�������
#include <exception> //�쳣������
#include <fstream> //�ļ�����/���
#include <functional> //STL�������㺯��(���������)
#include <limits> //�����������������ֵ����
#include <list> //STL�����б�����
#include <map> //STLӳ������
#include <iomanip> //����������/���
#include <ios> //��������/���֧��
#include <iosfwd> //����/���ϵͳʹ�õ�ǰ������
#include <istream> //����������
#include <ostream> //���������
#include <queue> //STL��������
#include <set> //STL��������
#include <sstream> //�����ַ�������
#include <stack> //STL��ջ����
#include <stdexcept> //��׼�쳣��
#include <streambuf> //�ײ�����/���֧��
#include <utility> //STLͨ��ģ����
#include <vector> //STL��̬��������
#include <cwchar.h>//���ַ�����������/���
#include <cwctype.h> //���ַ�����*/

using namespace std;

int ans;

int max(int x,int y){return x>y?x:y;}

int min(int x,int y){return x<y?x:y;}

int abs(int x){return x>0?x:-x;}

int gcd(int x,int y){return (!y)?x:gcd(y,x%y);}

void exgcd(int a,int b,int &d,int &x,int &y){if (!b){d=a,x=1,y=0;}else{exgcd(b,a%b,d,y,x);y-=x*(a/b);}}

int quick_power(ll a,int b){ll r=1;for (;b;b>>=1,a=a*a)if (b&1) r=r*a;return r;}

inline char read() {
	static const int IN_LEN = 1000000;
	static char buf[IN_LEN], *s, *t;
	return (s == t ? t = (s = buf) + fread(buf, 1, IN_LEN, stdin), (s == t ? -1 : *s++) : *s++);
}
template<class T>
inline void read(T &x) {
	static bool iosig;
	static char c;
	for (iosig = false, c = read(); !isdigit(c); c = read()) {
		if (c == '-') iosig = true;
		if (c == -1) return;
	}
	for (x = 0; isdigit(c); c = read()) x = x * 10 + (c ^ '0');
	if (iosig) x = -x;
}

char sr[10000000],z[20];int C=-1,Z=0;
void Ot(){fwrite(sr,1,C+1,stdout),C=-1;}
void print(int x){
	if (x<0) sr[++C]='-',x=-x;
    while(z[++Z]=x%10+48,x/=10);
    while(sr[++C]=z[Z],--Z);sr[++C]='\n';
}
//int find(int x){return fa[x]=fa[x]==x?x:find(fa[x]);}

//void add(int x,int y,int z){to[++cnt]=y;v[cnt]=z;Next[cnt]=head[x];head[x]=cnt;}
int main()
{
	int r,g,b,n,x;
	read(r);read(g);
	read(b);read(n);
	for (int i=0;i<=n;i++)
	{
		x=i*r;
		if (x>n) break;
		for (int j=0;j<=n;j++)
		{
			if (x>n) break;
			if ((n-x)%b==0) ans++;
			x+=g;
		}
	}
	cout<<ans;
	return 0;
}









Measured memory_bytes: 2304
#include <iostream>
#include <algorithm>
#define int long long
using namespace std;

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

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

	if (b[0] > x) b[0] = x;
	for (int i = 1; i < n; i++) {
		if (b[i - 1] + b[i] > x) b[i] = x - b[i - 1];
	}

	int ans = 0;
	for (int i = 0; i < n; i++) {
		ans += a[i] - b[i];
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1792
using System;

namespace atcoder8_25
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] S = Console.ReadLine().Split(' ');
            int N = int.Parse(S[0]);
            int i = int.Parse(S[1]);
            int ans = 0;

            ans = N - i + 1;

            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 11092
s = gets.chomp
case s
when "SUN"
  puts 7
when "MON"
  puts 6
when "TUE"
  puts 5
when "WED"
  puts 4
when "THU"
  puts 3
when "FRI"
  puts 2
when "SAT"
  puts 1
else
end

Measured memory_bytes: 1788
#!/usr/bin/env python3
#三井住友信託銀行プログラミングコンテスト2019 E

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
a = LI()
cnt = [0]*n
ans = 1
tmp = 3
for i in range(n):
    if a[i] == 0:
        ans *= tmp
        ans %= mod
        tmp -= 1
    else:
        ans *= cnt[a[i]-1]
        ans %= mod
        cnt[a[i]-1] -= 1
    cnt[a[i]] += 1
print(ans)

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

#ifdef DEBUG
#define PRINT(x)\
    cout<<"func "<<__func__<<": line "<<__LINE__<<": "<<#x<<" = "<<(x)<<endl;
#define PRINTA(a,first,last)\
    cout<<"func "<<__func__<<": line "<<__LINE__<<": "<<#a<<"["<<(first)<<", "<<(last)<<")"<<endl;\
    for (int _i=(first);_i<(last);++_i){cout<<#a<<"["<<_i<<"] = "<<(a)[_i]<<endl;}
#define PRINTP(p)\
    cout<<"func "<<__func__<<": line "<<__LINE__<<": "<<#p<<" = ("<<(p.first)<<", "<<(p.second)<<")"<<endl;
#define PRINTI(a,i)\
    cout<<"func "<<__func__<<": line "<<__LINE__<<": "<<#a<<"["<<#i<<"] = "<<#a<<"["<<(i)<<"] = "<<(a)[i]<<endl;
#else
#define PRINT(x)
#define PRINTA(a,first,last)
#define PRINTP(p)
#define PRINTI(a,i)
#endif

#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);--i)
#define REP(i,n) for (int i=0;i<(n);++i)
#define RREP(i,n) for (int i=(n)-1;i>=0;--i)
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define MOD 1000000007
//#define MOD 998244353

using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

template <class T, class U> void amax(T& x, U y) {if (x < y) x = y;}
template <class T, class U> void amin(T& x, U y) {if (x > y) x = y;}

template <class T>
using vec2 = vector<vector<T>>;

template <class T>
using vec3 = vector<vector<vector<T>>>;

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

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

    int N;
    cin >> N;
    int x = (N + 999) / 1000 * 1000;
    cout << (x - N) << endl;

    return 0;
}


Measured memory_bytes: 3636