akhauriyash/Code-Regression huggingface dataset:
use std::cmp::max;
use std::io::Write;

macro_rules! eprintln {
    ($($args:tt)*) => { let _ = writeln!(&mut std::io::stderr(), $($args)*); }
}

fn read_line() -> Vec<String> {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line).expect("Failed to read line");
    line.trim().split_whitespace().map(|s| s.to_string()).collect()
}

struct Reader { v: Vec<String>, n: usize }

impl Reader {
    fn new() -> Self { Reader { v: read_line(), n: 0 } }
    fn next<T>(&mut self) -> T where T: std::str::FromStr, T::Err: std::fmt::Debug {
        if self.n == self.v.len() { self.v = read_line(); self.n = 0; }
        self.n += 1;
        self.v[self.n-1].parse().expect(&self.v[self.n-1])
    }
    #[allow(dead_code)]
    fn nexts<T>(&mut self, n: usize) -> Vec<T>
    where T: std::str::FromStr, T::Err: std::fmt::Debug {
        let mut v = Vec::with_capacity(n);
        for _ in 0..n { v.push(self.next()); }
        v
    }
}

fn main() {
    let mut r = Reader::new();
    let n = r.next();
    let mut a = vec![0; n];
    let mut xy = Vec::new();
    for i in 0..n {
        a[i] = r.next();
        xy.push(vec![]);
        for j in 0..a[i] {
            let x: usize = r.next();
            let y: usize = r.next();
            xy[i].push((x-1, y));
        }
    }

    let mut ans = 0;
    for s in 0..(1 << n) {
        let mut ok = true;
        for i in 0..n {
            if ((s >> i) & 1) == 0 {
                continue;
            }
            for &(x, y) in xy[i].iter() {
                if ((s >> x) & 1) != y {
                    ok = false;
                }
            }
        }
        if ok {
            ans = max(ans, s.count_ones());
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <iostream>
#include <cstdio>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cstring>
#include <functional>
#include <cmath>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define rep1(i,n) for(int i=1;i<=(n);++i)
#define all(c) (c).begin(),(c).end()
#define fs first
#define sc second
#define pb push_back
#define show(x) cout << #x << " " << x << endl
struct edge{int to,cost;};
struct edge2{int from,to,cost;};
int N,M,h[200];
vector<edge> G[200];
vector<int> ash,vc[200];
int ord[200];
vector<edge2> es;
bool operator<(const edge2& a,const edge2& b){
	return a.cost<b.cost;
}
int par[200];
void init(int n){
	rep(i,n) par[i]=i;
}
int find(int x){
	if(x==par[x]) return x;
	return par[x]=find(par[x]);
}
bool same(int x,int y){
	return find(x)==find(y);
}
void unite(int x,int y){
	x=find(x),y=find(y);
	par[x]=y;
}
int main(){
	while(true){
		cin>>N>>M;
		if(N==0) break;
		rep(i,N) vc[i].clear();
		ash.clear();
		rep(i,N) G[i].clear();
		rep(i,N) cin>>h[i];
		rep(i,N) ash.pb(h[i]);
		sort(all(ash));
		ash.erase(unique(all(ash)),ash.end());
		rep(i,N){
			ord[i]=ash.end()-lower_bound(all(ash),h[i])-1;
			vc[ord[i]].pb(i);
		}
		rep(i,M){
			int a,b,c;
			cin>>a>>b>>c;
			a--,b--;
			G[a].pb(edge{b,c});
			G[b].pb(edge{a,c});
		}
		int k=ash.size();
		init(N);
		int last=-1;
		rep(i,k){
			for(int v:vc[i]){
				for(edge e:G[v]){
					int u=e.to;
					if(ord[u]<=i) unite(u,v);
				}
			}
			int x=-1;
			bool con=true;
			rep(j,N){
				if(ord[j]<=i){
					if(x==-1){
						x=find(j);
					}else if(x!=find(j)){
						con=false;
						break;
					}
				}
			}
			if(!con) last=i;
		}
		long long ans=0;
		bool first=true;
		init(N);
		for(int i=last+1;i<k;i++){
			if(first){
				first=false;
				es.clear();
				rep(j,N){
					if(ord[j]>i) continue;
					for(edge e:G[j]){
						if(ord[e.to]>i) continue;
						edge2 e2=edge2{j,e.to,e.cost};
						es.pb(e2);
					}
				}
				sort(all(es));
				for(edge2 e:es){
					int x=e.from,y=e.to,c=e.cost;
					if(!same(x,y)){
						unite(x,y);
						ans+=c;
					}
				}
			}else{
				es.clear();
				rep(j,N){
					if(ord[j]!=i) continue;
					for(edge e:G[j]){
						if(ord[e.to]>i) continue;
						edge2 e2=edge2{j,e.to,e.cost};
						es.pb(e2);
					}
				}
				sort(all(es));
				for(edge2 e:es){
					int x=e.from,y=e.to,c=e.cost;
					if(!same(x,y)){
						unite(x,y);
						ans+=c;
					}
				}
			}
		}
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 2548
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>

using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype
template <class T> int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }
#endif

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define popcount __builtin_popcount

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

template <class T> void max_swap(T& a, const T& b) { a = max(a, b); }
template <class T> void min_swap(T& a, const T& b) { a = min(a, b); }

const double EPS = 1e-10;
typedef long long ll;
typedef pair<int, int> pint;


int main()
{
	int e;
	while (scanf("%d", &e), e)
	{
		int res = e;

		int z_max = pow(e, 1.0 / 3) + 1;
		int y_max = (int)sqrt(e + 0.0) + 1;
		for (int z = 0; z <= z_max; ++z)
		{
			for (int y = 0; y <= y_max; ++y)
			{
				int x = e - (z*z*z + y*y);
				if (x >= 0)
					min_swap(res, x + y + z);
				else
					break;
			}
		}
		printf("%d\n", res);
	}
}

Measured memory_bytes: 896
#include<cstdio>
#include<cstring>
#include<cmath>
#include<bitset>
#include<iostream>
#include<algorithm>
#include<string>
#include<utility>
#include<tuple>
#include<vector>
#include<list>
#include<map>
#include<queue>
#include<stack>
#include<numeric>
#include<functional>
#include<iomanip>
#include<random>

#define IOS ios::sync_with_stdio(false),cin.tie(0)
#define REP(i,n) for(int i = 0;i < n;i++)
#define MEM(a,b) memset(a,b,sizeof(a))

using namespace std;

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

int gcd(int a, int b) {
	if (a < b)swap(a, b);
	int k = a % b;
	if (k == 1)return 1;
	if (k == 0)return b;
	int ans = gcd(b, k);
	return ans;
}

int d, g;
int c[13], p[13];
vector <int> unko;
int main() {
	IOS;
	cin >> d >> g;
	g = g / 100;
	unko.push_back(0);
	for (int i = 1; i <= d; i++) {
		cin >> p[i] >> c[i];
		unko.push_back(i);
		c[i] = c[i] / 100;
	}
	int sum, tmp, ans = 1145148;
	do {
		sum = 0;
		tmp = 0;
		for (int i = 1; i <= d; i++) {
			if (g - sum <= unko[i] * (p[unko[i]] - 1)) {
				if (g - sum <=  0)break;
				tmp += (g - sum) / unko[i];
				if ((g - sum) % unko[i] != 0)tmp++;
				break;
			}
			else {
				sum += unko[i] * p[unko[i]];
				tmp += p[unko[i]];
			}
			sum += c[unko[i]];
		}
		if (tmp < ans)ans = tmp;
	} while (next_permutation(unko.begin() + 1, unko.end()));

	cout << ans << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF=1e18;
const ll Maxn=2e5+10;
ll N,M,K;
ll a[Maxn],b[Maxn],prea[Maxn],preb[Maxn];
ll finds(ll nums){
    ll l=0,r=M;
    while(l<r){
        ll mid=(l+r)>>1;
        if(l==r-1){
            if(preb[r]<=nums){
                return r;
            }else{
                return l;
            }
        }
        if(preb[mid]>nums){
            r=mid-1;
        }else{
            l=mid;
        }
    }
    return l;
}
int main() {
    cin>>N>>M>>K;
    for(ll i=1;i<=N;i++)    cin>>a[i],prea[i]=prea[i-1]+a[i];
    for(ll i=1;i<=M;i++)    cin>>b[i],preb[i]=preb[i-1]+b[i];
    ll ans=0;
    for(ll i=0;i<=N;i++){
        ll pa=prea[i];
        if(prea[i]>K) break;
        ll bi=finds(K-pa);
        ans=max(ans,i+bi);
    }
    cout<<ans;
    return 0;
}


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

int main(){
  char S[5];
  cin >> S;
  int hard=0;
  if (S[0] == S[1]) hard=1;
  if (S[1] == S[2]) hard=1;
  if (S[2] == S[3]) hard=1;
  cout << ((hard==1) ? "Bad" : "Good") << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int h,w,i,j;
  cin>>h>>w;
  vector<string> a(h);
  vector<int> r,c;
  for(i=0;i<h;i++){
    cin>>a.at(i);
    for(j=0;j<w;j++) if(a.at(i).at(j)=='#') break;
    if(j==w) r.push_back(i);
  }
  r.push_back(h);
  for(j=0;j<w;j++){
    for(i=0;i<h;i++) if(a.at(i).at(j)=='#') break;
    if(i==h) c.push_back(j);
  }
  c.push_back(w);
  for(i=0;i<h;i++){
    if(*lower_bound(r.begin(),r.end(),i)!=i){
      for(j=0;j<w;j++) if(*lower_bound(c.begin(),c.end(),j)!=j) cout<<a.at(i).at(j);
      cout<<endl;
    }
  }
}

Measured memory_bytes: 3644
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
ll h,a;
int n;
int main(){
	cin>>h>>n;
	rep(i,n){
		cin>>a; h-=a;
	}
	if(h <= 0) puts("Yes"); else puts("No");
}


Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std; 
#define for_(i, s, e) for (int i = s; i < e; i++)
#define for__(i, s, e) for (ll i = s; i < e; i++)
#define SSTR(x) static_cast<std::ostringstream&>((std::ostringstream() << std::dec << x)).str()
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
#define endl '\n'

int n;
vector<vi> mat;
vector<vector<ll>> dp;
ll mod = 1e9+7;

ll solve(ll bm, int p) {
	if (p == n) return 1;
	if (dp[bm][p] != -1) return dp[bm][p];
	
	ll ans = 0;
	for_(i, 0, n) {
		ll v = 1LL << i;
		if ((bm & v) and mat[p][i]) ans += solve(bm - v, p+1);
	}
	ans %= mod;
	return dp[bm][p] = ans;
}

int main() {
	#ifndef ONLINE_JUDGE
	freopen("test.in", "r", stdin);
	#endif
	
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	cin >> n;
	mat.resize(n, vi(n)); dp.resize((1LL << (n+1)), vector<ll> (n, -1));
	for_(i, 0, n) for_(j, 0, n) cin >> mat[i][j];
	
	cout << solve((1LL << (n+1)) - 1, 0) << endl;

	return 0;
}


Measured memory_bytes: 822256
#include <stdio.h>
#include <math.h>

#define M_PI 3.141592653589793

int main(void) {

	int i, j, n;
	int num, mark_num;
	char mark;
	int temp[4][13] = { 0 };//S,H,C,D

	scanf("%d", &n);

	for (i = 0; i < n; i++) {
		(void)getchar();
		scanf("%c", &mark);
		scanf("%d", &num);
		if (mark == 'S') {
			temp[0][num - 1] = 1;
		}
		else if (mark == 'H') {
			temp[1][num - 1] = 1;
		}
		else if (mark == 'C') {
			temp[2][num - 1] = 1;
		}
		else if (mark == 'D') {
			temp[3][num - 1] = 1;
		}
		else {
			printf("error!!\n");
			return 0;
		}
	}

	for (i = 0; i < 4; i++) {
		for (j = 0; j < 13; j++) {
			if (temp[i][j] == 0) {
				switch (i) {
				case 0:printf("S %d\n", j + 1);		break;
				case 1:printf("H %d\n", j + 1);		break;
				case 2:printf("C %d\n", j + 1);		break;
				case 3:printf("D %d\n", j + 1);		break;
				}
			}
		}
	}



	return 0;

}

Measured memory_bytes: 2660
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
#define pb push_back
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define cotu cout
#define itn int
const int INF = 1e9 + 7;

int main(){
    int n; cin>>n;
    vi a(n),b(n),c(n);
    for(int i = 0; i < n; i++) cin>>a[i]>>b[i]>>c[i];
    for(int i = 1; i < n; i++){
        a[i]+=max(b[i-1],c[i-1]);
        b[i]+=max(a[i-1],c[i-1]);
        c[i]+=max(a[i-1],b[i-1]);

    }
    cout<<max({a[n-1], b[n-1], c[n-1]});
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
int a[10010];
int main(){
	int i,j,n,m,x,y;
	cin>>n>>m;
	for(i=1;i<=m;i++){
		cin>>x>>y;
		a[x]++;a[y]++;
	}
	for(i=1;i<=n;i++){
		cout<<a[i]<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
let () =
    try
        while true do
            let x, y   = Scanf.scanf "%d %d\n" (fun x y -> x, y) in
            let total  = x + y in
            let digits = (String.length (string_of_int total)) in
            Printf.printf "%d\n" digits ;
        done
    with
        End_of_file -> ()

Measured memory_bytes: 2352
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int a = in.nextInt();
		int b = in.nextInt();
		int c = in.nextInt();
		int x = in.nextInt();
		int ans = 0;
		for (int i = 0; i <= a; i++) {
			for (int j = 0; j <= b; j++) {
				for (int j2 = 0; j2 <= c; j2++) {
					int sum = (500 * i) + (100 * j) + (50 * j2);
					if (x == sum) {
						ans++;
					}
				}
			}
		}
		System.out.println(ans);
		in.close();
	}
}

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

using namespace std;
using ll = long long;

bool prime(int n){
    for (ll i = 2; i * i <= n; i++){
        if (n % i == 0){
            return 0;
        }
    }
    return 1;
}

void put(vector<int> &b, int n){
    b[1] ^= 1;
    for (ll i = 2; i * i <= n; i++){
        if (n % i == 0){
            b[i] ^= 1;
            if (n / i != i){
                b[n / i] ^= 1;
            }
        }
    }
}

int main()
{
    int n;
    cin >> n;
    vector<int> a(n + 1), b(n + 1);
    for (int i = 1; i <= n; i++){
        cin >> a[i];
    }
    vector<int> ans;
    for (int i = n; i >= 1; i--){
        if (i == 1 || prime(i)){
            if (b[i] != a[i]){
                b[1] ^= 1;
                ans.push_back(i);
            }
        }
        else if (!prime(i)){
            if (a[i] != b[i]){
                put(b, i);
                ans.push_back(i);
            }
        }
    }
        cout << ans.size() << endl;
        for (auto elem : ans){
            cout << elem << " ";
        }
    return 0;
}


Measured memory_bytes: 3064
#include <stdio.h>
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <string>
#include <utility>
#include <queue>
#include <unordered_set>
#include <set>
#include <unordered_map>
#include <cmath>
#include <iomanip>
using namespace std;
#define sL(i) i << 1
#define sR(i) i << 1 | 1
#define mp make_pair
#define pb push_back
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pair<int,int>, int> ppi;
const int MOD = 1e9 + 7;
const int INF = 2e9 + 5;

int n;
vector<int> primes;
int main(){
    cin.sync_with_stdio(0);
    cin.tie(0);
    cin >> n;
    for(int i = 2; i <= 55555; i++){
        if(i % 5 != 1) continue;
        bool prime = true;
        for(int j = 2; j*j <= i; j++){
            if(i % j == 0){
                prime = false;
                break;
            }
        }
        if(prime) primes.pb(i);
    }
    for(int i = 0; i < n; i++){
        cout << primes[i] << " ";
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint     = long long;
const lint inf = 1LL << 60;
const lint mod = 1000000007;

struct mint {
    lint v;
    lint _mod;
    mint() : v(0) {}
    mint(signed v, lint _mod = mod) : v(v), _mod(_mod) {}
    mint(lint t, lint _mod = mod) : _mod(_mod) {
        v = t % _mod;
        if (v < 0)
            v += _mod;
    }

    mint pow(lint k) {
        mint res(1), tmp(v);
        while (k) {
            if (k & 1)
                res *= tmp;
            tmp *= tmp;
            k >>= 1;
        }
        return res;
    }
    static mint add_identity() { return mint(0); }
    static mint mul_identity() { return mint(1); }
    mint inv() { return pow(_mod - 2); }

    mint &operator+=(mint a) {
        v += a.v;
        if (v >= _mod)
            v -= _mod;
        return *this;
    }
    mint &operator-=(mint a) {
        v += _mod - a.v;
        if (v >= _mod)
            v -= _mod;
        return *this;
    }
    mint &operator*=(mint a) {
        v = v * a.v % _mod;
        return *this;
    }
    mint &operator/=(mint a) { return (*this) *= a.inv(); }

    mint operator+(mint a) const { return mint(v) += a; };
    mint operator-(mint a) const { return mint(v) -= a; };
    mint operator*(mint a) const { return mint(v) *= a; };
    mint operator/(mint a) const { return mint(v) /= a; };

    mint operator-() const { return v ? mint(_mod - v) : mint(v); }

    bool operator==(const mint a) const { return v == a.v; }
    bool operator!=(const mint a) const { return v != a.v; }
    bool operator<(const mint a) const { return v < a.v; }
};
ostream &operator<<(ostream &os, mint m) { return os << m.v; }

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    lint n;
    cin >> n;
    vector<vector<mint>> dp(63, vector<mint>(3, 0));
    dp[0][0] = 1;
    for (int i = 1; i <= 62; ++i) {
        int bit  = n >> (62 - i) & 1;
        dp[i][0] = dp[i - 1][0];
        if (bit == 1)
            dp[i][1] += dp[i - 1][0]; // 0 0

        if (bit == 1)
            dp[i][2] += dp[i - 1][1]; // 1 1
        if (bit == 0)
            dp[i][0] += dp[i - 1][1]; // 1 1
        dp[i][1] += dp[i - 1][1];
        dp[i][2] += dp[i - 1][1];

        dp[i][2] += dp[i - 1][2] * 3;
    }
    cout << dp[62][0] + dp[62][1] + dp[62][2] << "\n";
    return 0;
}

Measured memory_bytes: 256
S = input()
T = input()

if len(S) < len(T):
    print("UNRESTORABLE")
    exit()

##一つ一つパターンマッチさせる

ls = len(S)
lt = len(T)
index = -1
for i in range(ls-lt+1):
    cnd = S[i:i+lt]
    flag = True
    for s,t in zip(cnd,T):
        if s != "?":
            if s != t:
                flag = False
                break

    if flag:
        index = i


if index == -1:
    print("UNRESTORABLE") 
else:
    tmp = S.replace("?","a")
    print(tmp[:index]+T+tmp[index+lt:])

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

#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define pb push_back
#define mod 1000000007
#define mp make_pair
#define fi first
#define se second
#define merge(a,b) a##b //concat a and b
#define mkstr(a) #a  //convert a to string a. a is not variable
#define flush fflush(stdout);
#define debug(x) cout<<#x<<endl;
#define debug1(x) cout<<x<<endl;
#define inf 1e18
#define endl "\n"
#define epsilon 1e-9

typedef long long int ll;
typedef long double   ld;
typedef unsigned long long int ull;

/************************************TEMPLATE**********************************/

ll modpower(ll x,ll y)
{
  ll res=1;
  x=x%mod;
  if(x==0) return 0;
  while(y>0)
  {
    if(y&1)
      res=(res*x)%mod;
    y=y>>1;
    x=(x*x)%mod;
  }
  return res;
}

/*************************************CODE*************************************/

int main()
{
  // freopen("input.txt","r",stdin);
  // freopen("output.txt","w",stdout);
  fastIO
  ll test_case=1;
  //cin>>test_case;
   while(test_case--)  {
    int n;
    cin>>n;
    long long int mx=0,ans_sum=0,x;
    for(int i=0;i<n;i++)	{
    	cin>>x;
    	mx=max(mx,x);
    	ans_sum+=mx-x;
    }
    cout<<ans_sum<<endl;
  }
  return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <algorithm>

using namespace std;

#define MAX 1000001

bool is_prime[MAX];

void Erathos() {
  fill(is_prime, is_prime + MAX, true);
  
  is_prime[0] = is_prime[1] = true;
  
  for(int i=2; i*i<=MAX; i++) {
    if(is_prime[i]) {
      for(int j=i*i; j<=MAX; j+=i) {
	is_prime[j] = false;
      }
    }
  }
}

bool dp[MAX];
int price[30];

int main() {
  
  Erathos();
  
  int n, x;
  
  while(cin >> n >> x && n+x) {
    fill(dp, dp + MAX, 0);
    
    for(int i=0; i<n; i++) {
      cin >> price[i];
    }
    
    dp[0] = 1;
    for(int i=1; i<=x; i++) {
      for(int j=0; j<n; j++) {
	if(i - price[j] >= 0) {
	  dp[i] = dp[i] | dp[i-price[j]];
	}
      }
    }
    
    int ans = 0;
    for(int i=0; i<=x; i++) {
      if(dp[i] && is_prime[i]) {
	ans = max(ans, i);
      }
    }
    
    if(ans) cout << ans << endl;
    else cout << "NA" << endl;
  }
    
  return 0;
}

Measured memory_bytes: 3112
#include <iostream>
#include <cmath>
#include <cstring>

using namespace std;

char s[100010];
int len;
int f;

int main(int argc, const char * argv[]) {
    cin >> s;
    len = (int) strlen(s);
    for (int i = 0; i < len; i++) {
        if (i + 1 < len && s[i] == s[i + 1]) {
            cout << i + 1 << " " << i + 2 << endl;
            f = 1;
            break;
        } else if (i + 2 < len && s[i] == s[i + 2]) {
            cout << i + 1 << " " << i + 3 << endl;
            f = 1;
            break;
        }
    }
    if (f == 0) {
        cout << "-1 -1" << endl;
    }
    return 0;
}

Measured memory_bytes: 384
n=int(input())
a=list(map(int,input().split()))

ans=0
MOD=10**9+7

for k in range(60):
    x0=0
    x1=0
    for i in range(n):
        cnt=(a[i]>>k)&1
        if cnt==0:
            x0+=1
        else:
            x1+=1

    tmp=1
    for j in range(k):
        tmp*=2
        tmp%=MOD

    su=(x0*x1)*tmp%MOD
    ans+=su
    ans%=MOD

print(ans)

Measured memory_bytes: 122808
package main

import (
	"fmt"
	"math"
)

//ワーシャルフロイド法
type edge struct {
	from int
	to   int
	cost int
}

var (
	d    [105][105]int
	used [105][105]int
	dist []edge
	n    int
	m    int
	inf  = int(math.Pow(10, 9))
)

func warshallFloyd() {
	for k := 0; k < n; k++ {
		for i := 0; i < n; i++ {
			for j := 0; j < n; j++ {
				if d[i][j] > d[i][k]+d[k][j] {
					d[i][j] = d[i][k] + d[k][j]
				}
			}
		}
	}
}

func main() {
	fmt.Scan(&n)
	fmt.Scan(&m)

	for i := 0; i < n; i++ {
		for j := 0; j < n; j++ {
			if i == j {
				d[i][j] = 0
			} else {
				d[i][j] = inf
			}
		}
	}
	for i := 0; i < m; i++ {
		var (
			x, y, c int
		)
		fmt.Scan(&x, &y, &c)
		x--
		y--
		d[x][y] = c
		d[y][x] = c
		var e edge
		e.from = y
		e.to = x
		e.cost = c
		dist = append(dist, e)
		e.from = x
		e.to = y
		e.cost = c
		dist = append(dist, e)
	}
	warshallFloyd()
	ans := 0
	for i := 0; i < len(dist); i++ {
		var flag = false
		for s := 0; s < n; s++ {
			for t := 0; t < n; t++ {
				if d[s][dist[i].from]+dist[i].cost+d[dist[i].to][t] == d[s][t] {
					flag = true
				}
			}
		}
		if !flag {
			ans++
		}
	}
	fmt.Println(ans / 2)
}

Measured memory_bytes: 2216
import java.util.*;
import static java.lang.System.*;
import static java.lang.Math.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(in);
int a=Integer.parseInt(sc.next());
int b=Integer.parseInt(sc.next());
int c=Integer.parseInt(sc.next());
int ans=0;
if(a<=c&&b<=c){ans+=a+b;}else
if(b<=a&&c<=a){ans+=c+b;}else
if(a<=b&&c<=b){ans+=a+c;}
out.println(ans);
}
}

Measured memory_bytes: 21972
#include<iostream>
using namespace std;
 
int main(){
  int w,a,b;
  cin >> w >> a >> b;
  int ans;
  if(b > (a + w)){
    ans = b - (a + w);
  }
  else if(a > (b + w)){
    ans = a - (b + w);
  }
  else{
    ans = 0;
  }
 
  cout << ans << endl;
  
  return 0;
}

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

int main() {
    long long X, K, D;
    cin >> X >> K >> D;
    X = abs(X);
    long long ans;
    if((X / D) > K){
        ans = X - D * K;
    }else{
        long long E = X / D;
        K -= E;
        X -= E * D;
        if(K % 2 == 0){
            ans = X;
        }else{
            ans = abs(X - D);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3616
#include <iostream>
#include <cstring>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <math.h>
#include <string>
#include <map>
#include <set>
#include <iomanip>
using namespace std;

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

int main()
{
    ll output=1;
    ll N;
    cin >> N;
    vector<ll> A(N);
    for (int i=0; i<N; i++){
        cin >> A[i];
        if (A[i]==0){
            cout << 0 << endl;
            return 0;
        }
    }
    for (int i=0; i<N; i++){
        ll pre=output;
        output=A[i]*pre;
        if (output>(ll)1e18){
            cout << -1 << endl;
            return 0;
        }
        if (output<pre){
            cout << -1 << endl;
            return 0;
        }
    }
    cout << output << endl;


    return 0;
}


Measured memory_bytes: 3952
a, b = map(str, input().split())
a = int(a)

if int(b[0])==0:
    if int(b[2])==0:
        b100 = int(b[3])
    else:
        b100 = int(b[2]+b[3])
else:
    b100 = int(b[0]+b[2]+b[3])
    
ab = str(a*b100)

if len(ab)>=3:
    print(ab[:-2])
else:
    print(0)


Measured memory_bytes: 9196
#include <bits/stdc++.h>
#include <algorithm>
#include <utility>
using namespace std;
int main(){
	int N, K; 
	cin >> N >> K; 
	int A[4010][4010] = {}; 
	for(int i = 0; i < N; i++){
		int x, y; 
		char c; 
		cin >> x >> y >> c; 
		if(c == 'B'){
			A[x % (K * 2) + 1][y % (K * 2) + 1] ++; 
			A[x % (K * 2) + K*2+1][y % (K * 2) + 1] ++; 
			A[x % (K * 2) + 1][y % (K * 2) + K*2+1] ++; 
			A[x % (K * 2) + K*2+1][y % (K * 2) + K*2+1] ++; 
		}
		else if(c == 'W'){
			A[x % (K * 2) + 1][y % (K * 2) + 1] --; 
			A[x % (K * 2) + K*2+1][y % (K * 2) + 1] --; 
			A[x % (K * 2) + 1][y % (K * 2) + K*2+1] --; 
			A[x % (K * 2) + K*2+1][y % (K * 2) + K*2+1] --; 
		}
	}
	int S[3010][3010] = {}; 
	for(int i = 1; i <= K * 3; i++){
		for(int j = 1; j <= K * 3; j++){
			S[i][j] = S[i-1][j] + S[i][j-1] - S[i-1][j-1] + A[i][j]; 
		}
	}
	int T[2010][2010] = {}; 
	for(int i = 1; i <= K * 2; i++){
		for(int j = 1; j <= K * 2; j++){
			T[i][j] = S[i+K-1][j+K-1] - S[i+K-1][j-1] - S[i-1][j+K-1] + S[i-1][j-1]; 
		}
	}
	int ans = -1145141919; 
	for(int i = 1; i <= K; i++){
		for(int j = 1; j <= K; j++){
			ans = max(ans, abs(T[i][j] + T[i+K][j+K] - T[i+K][j] - T[i][j+K])); 
		}
	}
	cout << (N + ans) / 2 << endl; 
}

Measured memory_bytes: 114176
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const static ll INF = 1e9;
const static ll MOD = 1e9+7;



 
int main(){
    ll X; cin >> X;
    ll ans = 2*(X / 11);
    ll rem = X % 11;
    if(rem == 0) ;
    else if(1 <= rem && rem <= 6) ans += 1;
    else ans += 2;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a) for(int i=0; i<(a); i++)
typedef long long ll;
template<typename T>
struct edge {
  int src, to;
  T cost;
  edge(int to, T cost) : src(-1), to(to), cost(cost) {}
  edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}
  edge &operator=(const int &x) {
    to = x;
    return *this;
  }
  operator int() const { return to; }
};
template<typename T>
using Edges = vector<edge<T>>;
template<typename T>
using WeightedGraph = vector<Edges<T>>;
using UnWeightedGraph = vector<vector<int>>;
template<typename T>
using Matrix = vector<vector<T>>;

/////////////////////////////////////////////////////////////////////

const ll inf = 1LL<<60;
const string yes = "Yes";

template<typename T>
struct Dijkstra {
  int n;
  WeightedGraph<T> es;
  vector<T> dist;
  vector<int> prev;
  Dijkstra(int _n, WeightedGraph<T> _es) {
    init(_n, _es);
  }
  void init(int _n, WeightedGraph<T> _es) {
    n = _n; es = _es;
  }
  void reset() {
    dist.assign(n, inf);
    prev.assign(n, -1);
  }
  void run(int s) {
    reset();
    dist[s] = 0;
    using P = pair<T, int>;
    priority_queue<P, vector<P>, greater<P>> pq;
    pq.push(P(0, s));
    while (!pq.empty()) {
      P p = pq.top(); pq.pop();
      T v = p.second;
      if (dist[v] < p.first) continue;
      for (int i=0; i<(int)es[v].size(); i++) {
        edge<T> e = es[v][i];
        if (dist[e.to] > dist[v] + e.cost) {
          dist[e.to] = dist[v] + e.cost;
          pq.push(P(dist[e.to], e.to));
          prev[e.to] = v;
        }
      }
    }
  }
  vector<int> getpath(int t) {
    vector<int> path;
    if (dist[t] == inf) return path;
    for (; t!=-1; t=prev[t]) path.push_back(t);
    reverse(path.begin(), path.end());
    return path;
  }
};

int main()
{
  ll n; cin >> n;
  ll m; cin >> m;
  WeightedGraph<ll> g(n);
  rep(i, m) {
    int a,b; cin>>a>>b; a--; b--;
    g[a].push_back(edge<ll>(b, 1));
    g[b].push_back(edge<ll>(a, 1));
  }
  Dijkstra<ll> dij(n, g);
  dij.run(0);
  cout << yes << endl;
  for (int i=1; i<n; i++) {
    cout << dij.prev[i]+1 << endl;
  }

  return 0;
}


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

int main(int argc, char const *argv[])
{
	long long r,d,x;
	cin>>r>>d>>x;
	for (int i = 0; i < 10; ++i)
	{
		x=x*r-d;
		cout<<x<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
            get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
            get!($($t),*)
        ).collect::<Vec<_>>()
    };
    ($t:ty ;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty ;; $n:expr) => {
        (0..$n).map(|_| get!($t ;;)).collect::<Vec<_>>()
    };
}

fn main() {
    let (X, Y) = get!(i64, i64);
    let ans = X + Y / 2;
    println!("{}", ans);
}

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

#define o cout<<"Hello did you expect this?"<<endl;
#define ll long long
#define pb push_back
#define mp make_pair//with Z
#define F first
#define S second

using namespace std;

const int N = 2e5 + 100;
const int mod = 1e9 + 7;

void hey () {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}
int a[100], b[100], c[100], d[100];
int ans = 0;
vector<int> arif;
int n, m, q;
void rec() {
	if (arif.size() == n) {
		int check = 0;
		for (int i = 1; i <= q; i++) {
			if (arif[b[i] - 1] - arif[a[i] - 1] == c[i]) {
				check += d[i];
			}
		}
		ans = max(ans, check);
	} else {
		if (arif.size() == 0) {
			arif.pb(1);
			rec();
			arif.pop_back();
		} else {
			for (int i = arif[arif.size() - 1]; i <= m; i++) {
				arif.pb(i);
				rec();
				arif.pop_back();
			}
		}

	}
}
int main () {
	hey();
	cin >> n >> m >> q;
	for (int i = 1; i <= q; i++) {
		cin >> a[i] >> b[i] >> c[i] >> d[i];
	}
	rec();
	cout << ans;
}




Measured memory_bytes: 3676
#include <cmath>
#include <cstdio>
#include <vector>
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;

const int N = 4e7 + 10; 

typedef  long long ll;

long long M = 1e9 + 7;

int a[505];
int b[505];

bool check (int i , int j , int k){
    if ((a[j] - a[i]) * (a[k] - a[i]) + (b[j] - b[i]) * (b[k] - b[i]) < 0 && (a[j] - a[i]) * (b[k] - b[i]) - (a[k] - a[i]) * (b[j] - b[i]) != 0) return true;
    return false;
}

int main(){
    string st;
    cin>>st;
    int n = st.length();
    for (int i = 0 ; i < n; i++){
        cout<<"x";
    }
    puts("");
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <climits>
#include <stack>
#include <queue>
#include <string>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>
#include <random>
#include <iomanip>
#include <limits>
 
using namespace std;
 
typedef long long ll;
 
typedef pair<ll,ll> P;
long long int INF = 1e18;
double Pi = 3.141592653589;
ll mod = 1000000007;
// memset(a,0,sizeof(a)); →全部０にする
 
vector<int> G[100005];
std::vector<P> tree[100010];
 
int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
 
#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define re(i,a,b) for(i=a;i<=b;i++)
 
ll i,j,k,l,ii,jj;
ll n,m,a,b,c,d,ans=INF,num,sum;
ll x[100005],y[100005];
 
int main(){
	cin>>n;
	for(i=0;i<=20000;i++){//9nokazu
		if(9*i>n)continue;
		a = i;
		b = (n - 9*i)/6;
		c = n - 9*a - 6*b;
		num = 0;
		while(a >= 1){
			num += a%9;
			a = a/9;
		}
		while(b >= 1){
			num += b%6;
			b = b/6;
		}
		ans = min(ans,num+c);
	}
	p(ans);
	return 0;

}

Measured memory_bytes: 4992
n = int(input())
a = list(map(int,input().split()))

left = [0]*n
right = [0]*n
from fractions import gcd
for i in range(1,n):
  left[i] = gcd(left[i-1],a[i-1])
  right[n-i-1] = gcd(right[n-i],a[n-i])

ans = 1
for i in range(n):
  g = gcd(left[i],right[i])
  ans = max(ans,g)
print(ans)

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

using namespace std;

typedef long long ll;

const int MAXN = 1e6;

int n, k;

ll memo[MAXN];
ll arr[MAXN];

ll dp(int pos){
  if(pos == n-1) return 0;
  if(memo[pos]!=-1) return memo[pos];

  ll ans = 1e10;
  for(int i=1;i<=k;++i){
    int next_pos = pos + i;
    if(next_pos >= n) break;
    ans = min(ans, abs(arr[pos] - arr[next_pos]) + dp(next_pos));
  }
  return memo[pos] = ans;
}


int main(){
  cin >> n >> k;
  for(int i=0;i<n;++i) cin >> arr[i];
  memset(memo, -1, sizeof(memo));
  cout << dp(0) << endl;
}

Measured memory_bytes: 15232
#include<stdio.h>
#include<algorithm>
using namespace std;
typedef long long lld;
typedef pair<int,int> pii;

lld n,m,fin;
int main(){
    scanf("%lld%lld",&n,&m);
    if(n==1&&m==1){fin=1;}
    else if(n==1||m==1){fin=n+m-3;}
    else{fin=(n-2)*(m-2);}
    printf("%lld\n",fin);
    return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
#define REPi(i, a, b) for(int i=int(a); i<int(b); i++)
#define MEMS(a,b) memset(a,b,sizeof(a))
#define mp make_pair
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; }
const ll MOD = 1e9+7;

int main(){
    int N;
    cin >> N;
    vector<int> P(N);
    vector<int> Q(N);
    REP(i,N){
        int p, q;
        cin >> p;
        P[i] = p;
    }
    REP(i,N){
        int  q;
        cin >> q;
        Q[i] = q;
    }

    vector<int> v(N);
    iota(v.begin(), v.end(), 1);       // v に 1, 2, ... N を設定
    int cnt = 0;
    ll a = 10000;
    ll b = 0;
    do {
        REP(i,N){
            if(v[i] != P[i]) break;
            if(i == N-1) a = cnt;
        }
        REP(i,N){
            if(v[i] != Q[i]) break;
            if(i == N-1) b = cnt;
        }
        cnt++;
    } while( next_permutation(v.begin(), v.end()) );     // 次の順列を生成

    ll ans = abs(a-b);

    cout << ans << endl;

    return 0;
}


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

#define rep(i,a,b) for(int i=a;i<b;i++)
#define repd(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
using namespace std;
void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60; const ll MOD = 1000000007;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }

//---------------------------------------------------------------------------------------------------
void _main() {
    ll N, K; cin >> N >> K;
    vector<bool> a(N);
    rep(i, 0, K) {
        ll d; cin >> d;
        rep(j, 0, d) {
            ll a_;
            cin >> a_;
            a[a_-1] = true;
        }
    }
    ll count = 0;
    rep(i, 0, N) {
        if (!a[i]) count++;
    }
    cout << count << endl;
}

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

add_1 = x2-x1
add_2 = y2-y1

x3, y3 = x2-add_2, y2+add_1
x4, y4 = x3-add_1, y3-add_2

print(x3, y3, x4, y4)

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;

/* short */
#define pb push_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)

/* REPmacro */
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORR(i, a, b) for(int i = (a); i >= (b); i--)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOREACH(x, a) for(auto x : a)

/* exchange */
#define CHMIN(a, b) (a) = min((ll)(a), (ll)(b))
#define CHMAX(a, b) (a) = max((ll)(a), (ll)(b))

/* function */
#define IN(x) cin >> x
#define DEBUG(x) cerr << (x) << " "
#define LN() cerr << "\n"
#define PRINT(x) cout << (x) << endl
#define BR cout << endl

/* const */
const int ARRAY = 100005;
const int INF = 1001001001; // 10^9
const ll LINF = 1001001001001001001; // 10^18
const int MOD = 1e9 + 7;

ll N = 0;
ll K, X;
ll t;
ll ret = 0;
ll A = 0, B = 0, C = 0;
string s;


void input() {
  IN(K);
  IN(X);
}

void solve() {
  PRINT((K*500>=X)?"Yes":"No");
}

int main(void){
  input();
  solve();
}


Measured memory_bytes: 256
#include<stdio.h>

int main()
{
    int n;
    int count;
    scanf("%d", &n);
    if (n % 2 == 0)
    {
        printf("%f\n",1./2.);
    }
    else{
        count = (n - 1) / 2 + 1;
        printf("%f\n", (float)count / (float)n);
    }
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h> 
using namespace std;
using ll = long long;
template<typename T> using v2 = vector<vector<T>>;
template<typename T> inline v2<T> fill(int r, int c, const T& t){ return v2<T>(r, vector<T>(c, t)); }
#define F first
#define S second

const int MOD = 1e9+7;
inline int add(int a, int b){ return (a+b)%MOD; }
inline int sub(int a, int b){ return ((a-b)%MOD + MOD)%MOD; }
inline int mul(int a, int b){ return ((ll)a*b)%MOD; }
int pwr(int a, int b){
    if(!b) return 1;
    int temp = pwr(a, b/2);
    if(b%2) return mul(mul(temp, temp), a);
    return mul(temp, temp);
}
inline int dvd(int a, int b){ return mul(a, pwr(b, MOD-2)); }

void solve(){
    int n, k;
    cin >> n >> k;

    vector<int> amt(k+1);
    for(int i = k; i > 0; --i){
        amt[i] = pwr(k/i, n);
        for(int j = 2*i; j <= k; j+=i){
            amt[i] = sub(amt[i], amt[j]);
        }
    }

    int ans = 0;
    for(int i = 1; i <= k; ++i) ans = add(ans, mul(i, amt[i]));
    cout << ans << '\n';
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <math.h> 

int main()
{
	int H, N;
	int sum = 0;
	std::cin >> H >> N;
	for (int i = 0; i < N; ++i)
	{
		int t;
		std::cin >> t;
		sum += t;
	}
	if (sum >= H)
	{
		std::cout << "Yes\n";
	}
	else
	{
		std::cout << "No\n";
	}
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
int main(){
  int n,x0=0,y0=0,t0=0,x,y,t;
  scanf("%d",&n);
  int i,d,dt,ans=1;
  for(i=0;i<n;i++){
    scanf("%d%d%d",&t,&x,&y);
    d=abs(x-x0)+abs(y-y0);
    dt=t-t0;
    if(dt<d||(dt-d)%2==1){
      ans=0;
      break;
    }
    else{
      x0=x;
      y0=y;
      t0=t;
    }
  }
  puts(ans?"Yes":"No");
}

Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Diagnostics;

class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }

    Scanner cin;
    Func cin2;
    void calc()
    {
        cin = new Scanner();
        cin2 = new Func();
        int N=cin.nextInt();
        int[] a=cin.ArrayInt(N,0);
        int max=1;
        int min=2000001;
        int ans=0;
        for(int i=0;i<N;i++)
        {
            if(a[i]<=min){ans++;min=a[i];}
        }
        Console.WriteLine(ans);
    }
}



class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

class Answer
{
    public void Int2DArrayAns(int[,]x,char c)
    {
        for(int i=0;i<x.GetLength(0);i++)
        {
            for(int j=0;j<x.GetLength(1)-1;j++)
            {
                Console.Write(x[i,j]);
                Console.Write(c);
            }
            Console.WriteLine(x[i,x.GetLength(1)-1]);
        }
    }
    public void Char2DArrayAns(char[,]x,char c)
    {
        for(int i=0;i<x.GetLength(0);i++)
        {
            for(int j=0;j<x.GetLength(1)-1;j++)
            {
                Console.Write(x[i,j]);
                Console.Write(c);
            }
            Console.WriteLine(x[i,x.GetLength(1)-1]);
        }
    }
}

class Func
{
    public long GCDLong(long a, long b)
    {
        while(a!=0)
        {
          long t=a;
          a=b%a;
          b= t;
        }
      
        return b;        
    }
}

Measured memory_bytes: 31452
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <iomanip>
#include <complex>
#include <bitset>
#include <stack>
using namespace std;
 
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define repl(i,s,n) for(int i=s; i<=n; ++i)
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define ktya(x) sort(all(x))
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 1e18
#define INFLL 1000000000000000007LL
#define SIZE 200105
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define mind(a,b) (a>b?b:a)
#define maxd(a,b) (a>b?a:b)
#define PI (acos(-1))
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
typedef pair<int,ll> pill; typedef pair<ll,int> plli; 
typedef pair<double, int> pdi;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
typedef complex<double> P;
ll MOD = 1000000007;
// ll MOD=998244353;
typedef ll Weight;
struct Edge {
	int src, dst;
	Weight weight;
};
bool operator < (const Edge &e, const Edge &f) {
	return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
	e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
ll powMod(ll x, ll k, ll m) {//x^k (mod n)
	if (k == 0)     return 1;
	if (k % 2 == 0) return powMod(x*x % m, k/2, m);
	else            return x*powMod(x, k-1, m) % m;
}
int N,M;
vi PP;

int invmap[114514];
map<int,int> mm;
vi datas; 
ll dp[1111][(1<<12)+1];
int main(){
	cin>>N>>M;
	rep(i,M+2)rep(j,(1<<N))dp[i][j]=1e10;
	dp[0][0]=0;
	rep(i,M){
		int a,b;
		cin>>a>>b;
		int num=0;
		rep(j,b){
			int x;
			cin>>x;x--;
			num+=(1<<x);
		}
		//cout<<num<<endl;
		rep(j,(1<<N)){
			dp[i+1][j]=dp[i][j];
		}
		rep(j,(1<<N)){
			dp[i+1][j|num]=min(dp[i+1][j|num],dp[i][j]+a);
		}
	}
	ll ans=dp[M][(1<<N)-1];
	if(ans==1e10)ans=-1;
	cout<<ans<<endl;
}



Measured memory_bytes: 33024
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <tuple>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

int n, k, q;
int a[2010];

int solve() {
    vector<int> vec;
    vec.push_back(0);
    for (int i = 0; i < n; i++) vec.push_back(a[i]);
    sort(ALL(vec));
    UNIQ(vec);
    int res = inf;
    for (int th : vec) {
        vector<int> cand;
        int idx = 0;
        while (idx < n) {
            int c = 0;
            vector<int> seg;
            while (idx+c<n && a[idx+c] > th) {
                seg.push_back(a[idx+c]);
                c++;
            }
            sort(ALL(seg));
            for (int i = 0; i <= (int)seg.size()-k; i++) {
                cand.push_back(seg[i]);
            }
            idx += c;
            while (idx < n && a[idx] <= th) idx++;
        }
        if ((int)cand.size() < q) break;
        sort(ALL(cand));
        res = min(res, cand[q-1] - cand[0]);
    }
    return res;
}

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

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

    input();
    cout << solve() << endl;
}


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

int main()
{
  int n,m,x,y,z=0;
  cin >> n>> m;
  if (n>=m)
  x=n,y=m;
  else
  x=m,y=n;
  for (int i=0;i<x;i++)
  {
      z=(10*z)+y;
  }
  cout << z;
  
  return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    readLine()?.let {
        val loop = it.toLong()
        var sum = 0L

        for (a in 1..loop) {
            for (b in 1..loop) {
                for (c in 1..loop) {
                    sum += gcd(a, gcd(b, c))
                }
            }
        }
        println(sum)
    }
}

/** 最大公約数 ユークリッド互除法 */
fun gcd(a: Long, b: Long): Long {
    return if (a % b == 0L) {
        b
    } else {
        gcd(b, a % b)
    }
}

Measured memory_bytes: 34496
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int n, k;
    cin >> n >> k;
    int ans = 0;
    while(n){
        ans++;
        n /= k;
    }
    cout << max(ans, 1) << "\n";
    return 0;
}

Measured memory_bytes: 256