akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <cmath>
#include <queue>
#include <set> 
#include <string>
#include <string.h>
#include <stdio.h> 
#include <stack>
#define rep(N) for(int i=0;i<N;i++)
#define repj(N) for(int j=0;j<N;j++)
#define ll long long
#define pii pair<int,int>
const int N=100005;
int a[N];
using namespace std;

int main()
{
	int n,s=0,s2=0,s1=0,s0=0;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		s=0;
		cin>>a[i];
		while(a[i] % 2==0)
		{
			a[i]/=2;
			s++;
		}
		if(s>=2) 
		{
			s2++;
			a[i]=2;
		}
		else if(s==1)
		{
			s1++;
			a[i]=1;
		}
		else
		{
			s0++;
			a[i]=0;
		}
	}
	int f=0;
	if(s1)
	{
		f=1;
	}
//	cout<<s2<<" "<<s1<<"  "<<s0<<"  "<<f<<endl;	
	if(s2+1-f>=s0)
	{
		cout<<"Yes"<<endl;
	}
	else
	{
		cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main()
{
  int n;
  cin>>n;
  int x[n];
  int y[n];
  int a[n];
  for(int i=0;i<n;i++)
    cin>>x[i];
  for(int i=0;i<n;i++)
  {
    cin>>y[i];
    a[i]=abs(x[i]-y[i]);
  }

  double d1=0,d2=0,d3=0,di=0;
  for(int i=0;i<n;i++)
    d1+=a[i];
  for(int i=0;i<n;i++)
    d2+=a[i]*a[i];
  d2=sqrt(d2);
  for(int i=0;i<n;i++)
    d3+=a[i]*a[i]*a[i];
  d3=pow(d3,1.0/3);
  for(int i=0;i<n;i++)
    if(di<a[i]) di=a[i];

  cout<<fixed<<d1<<endl<<d2<<endl<<d3<<endl<<di<<endl;
}

Measured memory_bytes: 3436
#include <iostream>
#include <vector>

using namespace std;

const int MOD = 1000000007;

int main(){
    const int maxSize = 20000001;
	vector<long long> inv(maxSize);
	vector<long long> fact(maxSize);
	vector<long long> factInv(maxSize);
	for(int i=0;i<2;i++) inv[i] = fact[i] = factInv[i] = 1;
	for(int i=2;i<maxSize;i++){
		inv[i] = inv[MOD % i] * (MOD - MOD / i) % MOD;
		fact[i] = fact[i-1] * i % MOD;
		factInv[i] = factInv[i-1] * inv[i] % MOD;
	}
	auto comb = [&](int n, int r){
		if(n < r || r < 0) return 0LL;
		return fact[n] * factInv[n-r] % MOD * factInv[r] % MOD;
	};
    auto perm = [&](int n, int r){
        if(n < r || r < 0) return 0LL;
        return fact[n] * factInv[n-r] % MOD;
    };
    int H, W, K;
    while(cin >> H >> W >> K){
        long long res = K;
        for(int i=0;i<K;i++){
            long long add = 0;
            add += inv[H+W] * (W + H) % MOD;
            add += 2 * inv[H+W] * i % MOD * inv[H+W-1] % MOD * W % MOD * H % MOD;
            add = (add * (K-i)) % MOD;
            res = (res + add) % MOD;
        }
        res = res * perm(H+W, K) % MOD;
        cout << res << endl;
    }
}

Measured memory_bytes: 468992
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define ii pair<int,int>
#define iii pair<ii,int>
#define vii vector<pair<int,int> >
#define vi vector<int>
#define vvi vector<vector<int> >
#define vs vector<string>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define nu 100000
#define mod 1000000007
#define inf pow(10,8)
#define h pow(10,-8)
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)

vi par(nu), dist(nu, 0);

int root(int x)
{
	if (x != par[x])
	{
		int p = par[x];
		par[x] = root(p);
		dist[x] += dist[p];
	}

	return par[x];
}

int main()
{
	fastio;

	int n, m, l, r, d;
	cin >> n >> m;
	

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

	for (int i = 0; i < m; ++i)
	{
		cin >> l >> r >> d;
		l--;
		r--;

		int rl = root(l);
		int rr = root(r);

		if (rl == rr)
		{
			if (dist[r]-dist[l] != d)
			{
				cout << "No";
				return 0;
			}
		}
		else
		{
			par[rr] = rl;
			dist[rr] = dist[l] + d - dist[r];
		}
	}

	// for (int i = 0; i < n; ++i)
	// {
	// 	cout << dist[i] << ' ' << par[i]+1 << ' ' << root(i)+1 << '\n';
	// }
	cout << "Yes";
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <numeric>
#include <iomanip>
#include <tuple>

using namespace std;

int main(){
   long long a,b;
   cin>>a>>b;
   string ans;
   if(a*b<=0)ans="Zero";
   else if(a>0 && b>0)ans="Positive";
   else {
       if((b-a)%2==0)ans="Negative";
       else ans="Positive";
   }
   if(a==b && a!=0)ans="positive";
   cout<<ans<<endl;
}

   


Measured memory_bytes: 256
f = [0 for i in range(64)]
n = int(input())
mod = int(1e9+7)
x = map(int, input().split())
for i in range(n):
    for num in x:
        for j in range(61):
            if num & (1<<j) != 0:
                f[j] += 1
ans = 0
for i in range(64):
    cur = (1<<i) % mod
    ans += cur * (f[i]) * (n-f[i])
    ans = ans % mod
print(int(ans)) 

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

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);
bool check(int s) {
	string t = to_string(s);
	rep(i, 0, t.length() - 1) {
		if (t[i] != t[i + 1] - 1)return false;
	}
	return true;
}
signed main() {
	int n; cin >> n; vector<int>v(n); rep(i, 0, n)cin >> v[i];
	vector<int>ans;
	rep(i, 0, n) {
		rep(j, i + 1, n) {
			int tmp = v[i] * v[j];
			if (check(tmp))ans.push_back(tmp);
		}
	}
	if (ans.empty())cout << -1 << endl;
	else cout << *max_element(ans.begin(), ans.end()) << endl;

	return 0;
}

Measured memory_bytes: 3252
#include <iostream>
#include <iomanip>
#include <limits>
using namespace std;

int main() {
	int L;
	cin >> L;
	long double L_length;
	L_length = (double)L / 3.0000000000000;

	cout << fixed << setprecision(6)<<L_length * L_length*L_length;
	
	return 0;
}

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

public class Main {

  public static void main(String[] args) {
    new Main().run();
  }

  public void run() {

    try(BufferedReader in = new BufferedReader(new InputStreamReader(System.in))) {

      String line = in.readLine();

      if(line.equals("1"))
        System.out.println("Hello World");
      else {
        int a = Character.getNumericValue(in.readLine().charAt(0));
        int b = Character.getNumericValue(in.readLine().charAt(0));
        System.out.println(a+b);
      }
    }
    catch(IOException e) {
      System.err.println(e);
    }
  }
}

Measured memory_bytes: 21076
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define show(x) {for(auto i: x){cout << i << " ";} cout<<endl;}
#define showm(m) {for(auto i: m){cout << m.x << " ";} cout<<endl;}
typedef long long ll;
typedef pair<int, int> P;
ll gcd(int x, int y){ return y?gcd(y, x%y):x;}
ll lcm(ll x, ll y){ return (x*y)/gcd(x,y);}


int main()
{
    string s;
    cin >> s;
    if (s == "AAA" || s == "BBB") cout << "No" << endl;
    else cout << "Yes" << endl;
}



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

using namespace std;
using ll = long long;

int main(){
	ios_base::sync_with_stdio(false);
	ll n;
	cin >> n;
	for(ll i = 1; i <= 3500; ++i){
		for(ll j = i; j <= 3500; ++j){
			ll l = j, r = 3500;
			while(l < r){
				const ll k = l + (r - l) / 2;
				const ll x = 4 * i * j * k;
				const ll y = (n * j * k) + (n * i * k) + (n * i * j);
				if(x < y){
					l = k + 1;
				}else{
					r = k;
				}
			}
			const ll k = l;
			const ll x = 4 * i * j * k;
			const ll y = (n * j * k) + (n * i * k) + (n * i * j);
			if(x == y){
				cout << i << " " << j << " " << k << endl;
				return 0;
			}
		}
	}
	return 0;
}



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

signed main(){
  string s;cin>>s;
  int now=0,ans=0;
  for(int i=0;i<s.size();i++){
    if(s[i]=='T'){
      if(now==0)ans++;
      else now--;
    }
    else now++;
  }
  cout<<now+ans<<endl;
}


Measured memory_bytes: 640
export class Main {
  static main(input): string {
    const tmp: string[] = input.split("\n");
    const n: number = parseInt(tmp[0]);
    const a: number[] = tmp[1].split(" ").slice(0, n).map(t => parseInt(t));
    let prevM: number = 0;
    let t: number = 1;
    for (let i = 0; i < n; ++i) {
      prevM += t * a[i];
      t *= -1;
    }
    const result: number[] = [];
    result.push(prevM);
    for (let i = 0; i < n - 1; ++i) {
      const m: number = (a[i] - prevM / 2) * 2;
      result.push(m);
      prevM = m;
    }
    return `${result.join(" ")}`;
  }
}
console.log(Main.main(require("fs").readFileSync("/dev/stdin", "utf8")));

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

using namespace std;
const int mod = 1e9+7;
const int N = 2005;

int n, m;
char mat[N][N];
int cnt[N][N];

int main() {
	scanf("%d %d", &n, &m);
	for(int i = 0; i < n; i++) scanf(" %s", mat[i]);

	for(int i = 0; i < n; i++) {
		for(int j = 0; j < m; j++) {
			if(mat[i][j] == '#') continue;
			int k = j;
			while(k + 1 < m and mat[i][k + 1] == '.') k++;
			for(int w = j; w <= k; w++) {
				cnt[i][w] += k - j + 1;
			}
			j = k;
		}
	}
	for(int j = 0; j < m; j++) {
		for(int i = 0; i < n; i++) {
			if(mat[i][j] == '#') continue;
			int k = i;
			while(k + 1 < n and mat[k + 1][j] == '.') k++;
			for(int w = i; w <= k; w++) {
				cnt[w][j] += k - i;
			}
			i = k;
		}
	}

	int ans = 0;
	for(int i = 0; i < n; i++) for(int j = 0; j < m; j++)
		ans = max(ans, cnt[i][j]);
	
	printf("%d\n", ans);
}


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

#define ll long long
#define pb push_back
#define INF 1e9+7
#define cases int t;cin>>t;while(t--)
#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 ff first
#define ss second

#define test4(x,y,z,a) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<"		a is "<<a<<endl;
#define test3(x,y,z) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<endl;
#define test2(x,y) cout<<"x is "<<x<<"		y is "<<y<<endl;
#define test1(x) cout<<"x is "<<x<<endl;

ll pp(ll n){
	n*=(n-1);
	n/=2;
	return n;
}

int main(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	
	ll n;
	cin>>n;
	ll a[n];
	map<ll,ll> mp;
	rep(i,0,n){
		cin>>a[i];
		mp[a[i]]++;
	}
	ll sum=0,p;
	for(auto i:mp){
		p=pp(i.ss);
		sum+=p;
	}
	rep(i,0,n){
		sum-=pp(mp[a[i]]);
		sum+=pp(mp[a[i]]-1);

		cout<<sum<<'\n';
		sum-=pp(mp[a[i]]-1);
		sum+=pp(mp[a[i]]);
	}
	
	
	
	
	return 0;
}

Measured memory_bytes: 13060
/// Kazuki Hoshino


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
#define inf 1000000000
#define mod 1000000007
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define rep1(i, a, b) for(int i =a; i >=b; i--)
#define f first
#define ss second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
//#define endl '\n'
typedef tree<
int,
null_type,less<int>,
rb_tree_tag,tree_order_statistics_node_update>
ordered_set;

ld n,a[1000],av,cur=10000000,ans;



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

//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);

cin >> n ;
rep(i,1,n){
       cin >> a[i];
       av+=a[i];
}
av/=n;
rep(i,1,n){
       if(abs(av-a[i])<cur){
              ans=i-1;
              cur = abs(av-a[i]);
       }
}
cout << ans << endl;






return 0;}
///....


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

int n;
const int ans[] = {0, 11, 31, 41, 61, 71, 101, 131, 151, 181, 191, 211, 241, 251, 271, 281, 311, 331, 401, 421, 431, 461, 491, 521, 541, 571, 601, 631, 641, 661, 691, 701, 751, 761, 811, 821, 881, 911, 941, 971, 991, 1021, 1031, 1051, 1061, 1091, 1151, 1171, 1181, 1201, 1231, 1291, 1301, 1321, 1361, 1381};

int main() {
	for (scanf("%d", &n); n; --n)
		printf("%d ", ans[n]);
	return 0;
}


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

int main(){
	int w, h, n;
	int w2 = 0, h2 = 0;

	scanf("%d%d%d", &w, &h, &n);
	for (int i = 0; i < n; i++){
		int x, y, a;
		scanf("%d%d%d", &x, &y, &a);

		switch(a){
			case 1:
				if (w2 < x) w2 = x;
				break;
			case 2:
				if (w > x) w = x; 
				break;
			case 3:
				if (h2 < y) h2 = y;
				break;
			case 4:
				if (h > y) h = y;
				break;
		}
	}

	if ((w - w2) < 0 || (h - h2) < 0){
		printf("0\n");
	}else{
		printf("%d\n", (w - w2) * (h - h2));
	}
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k;
  cin >> n >> k;
  int a[n],b[n],c=0;
  for(int i=0;i<n;i++){
    cin >> a[i];
    b[i]=min(a[i],k-a[i])*2;
    c+=b[i];
  }
  cout << c;
}

Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <assert.h>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;
typedef long long ll;
typedef long double ld;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define sz(x) ((int)(x).size())
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ld> vld;
typedef vector<vector<int>> vvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<ld>> vvd;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;


int main() {
    cout << setprecision(30);
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);

    ll n;
    cin >> n;
    vl a(n);
    for (ll i = 0; i < n; ++i) {
        cin >> a[i];
    }
    ll ans = 1;
    set<pll> kek;

    for (ll i = 0; i < n; ++i) {
        auto it = kek.lower_bound({a[i], 0});
        if (it == kek.end()) {
            kek.insert({a[i], 1});
            continue;
        }
        pll lol = {a[i], it->second + 1};
        ans = max(ans, lol.second);
        kek.insert(lol);
        auto ti = kek.find(lol);
        while (ti != kek.begin()) {
            if (prev(ti)->second <= lol.second) {
                kek.erase(prev(ti));
            } else {
                break;
            }
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 7168
from heapq import heappush, heappop
import sys

input = sys.stdin.readline

def Dijkstra_heap(s, edge):
    d = [10 ** 20] * n
    used = [False] * n
    d[s] = 0
    used[s] = True
    edgelst = []
    for i, j in edge[s]:
        heappush(edgelst, i+j*(10**6))
    while edgelst:
        edgemin = heappop(edgelst)
        v = edgemin % (10**6)
        if used[v]: continue
        d[v] = edgemin // (10**6)
        used[v] = True
        for e in edge[v]:
            if not used[e[0]]:
                heappush(edgelst, e[0]+(e[1]+d[v])*(10**6))
    return d

n, m, s, t = map(int, input().split())
Yen = [[] for _ in range(n)]
Snk = [[] for _ in range(n)]

for _ in range(m):
    u, v, a, b = map(int, input().split())
    u, v = u-1, v-1 
    Yen[u].append((v, a))
    Yen[v].append((u, a))
    Snk[u].append((v, b))
    Snk[v].append((u, b))

cos1 = Dijkstra_heap(s-1, Yen)
cos2 = Dijkstra_heap(t-1, Snk)

ans = 0
ANS = []
ANS_append = ANS.append
for yen,snk in zip(cos1[::-1], cos2[::-1]):
  tmp = 10**15-(yen+snk)
  ans = max(ans, tmp)
  ANS_append(ans)
print(*ANS[::-1], sep='\n')

Measured memory_bytes: 82184
n = gets.to_i
a = gets.split(" ")
for i in 0...n
    a[i] = a[i].to_i
end

min, max, sum = a[0], a[0], a[0]
for i in 1...n
    if (a[i] < min)
        min = a[i]
    end
    if (a[i] > max)
        max = a[i]
    end
    sum += a[i]
end
puts("#{min} #{max} #{sum}")



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

using namespace std;

int selectionSort(vector<int>& A, int N) // N個の要素を含む0-オリジンの配列A
{
    int sum = 0;
    for(int i = 0; i < N; i++){
	int minj = i;
	for(int j = i; j < N; j++){
	    if(A.at(j) < A.at(minj)){
		minj = j;
	    }
	}
	if(i != minj) sum++;
	swap(A.at(i), A.at(minj));
    }
    return sum;
}

int main()
{
    int N;
    cin >> N;
    vector<int> A(N);
    for(int i = 0; i < N; i++){
	cin >> A.at(i);
    }
    int n = selectionSort(A, N);
    string sep = "";
    for(int a: A){
	cout << sep << a;
	sep = " ";
    }
    cout << endl << n << endl;
}



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

#define si(a) scanf("%d",&a)
#define sl(a) scanf("%lld",&a)
#define sd(a) scanf("%lf",&a)
#define sc(a) scahf("%c",&a);
#define ss(a) scanf("%s",a)
#define pi(a) printf("%d\n",a)
#define pl(a) printf("%lld\n",a)
#define pc(a) putchar(a)
#define ms(a) memset(a,0,sizeof(a))
#define repi(i, a, b) for(register int i=a;i<=b;++i)
#define repd(i, a, b) for(register int i=a;i>=b;--i)
#define reps(s) for(register int i=head[s];i;i=Next[i])
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define pii pair<int,int>
#define mii unordered_map<int,int>
#define msi unordered_map<string,int>
#define lowbit(x) ((x)&(-(x)))
#define ce(i, r) i==r?'\n':' '
#define pb push_back
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define INF 0x3f3f3f3f
#define pr(x) cout<<#x<<": "<<x<<endl
using namespace std;

inline int qr() {
    int f = 0, fu = 1;
    char c = getchar();
    while (c < '0' || c > '9') {
        if (c == '-')fu = -1;
        c = getchar();
    }
    while (c >= '0' && c <= '9') {
        f = (f << 3) + (f << 1) + c - 48;
        c = getchar();
    }
    return f * fu;
}

ll x, k, d;

int main() {
    sl(x), sl(k), sl(d);
    x = abs(x);
    ll f = x / d;
    if (f >= k) {
        pl(x - k * d);
        return 0;
    }
    if ((k - f) & 1)pl((f + 1) * d - x);
    else
        pl(x - f * d);
    return 0;
}

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


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

    int n, a, b;
    string s;
    cin >> n >> a >> b;
    cin >> s;

    int num = 0;
    int foreign = 0;
    rep(i, s.length()){
        if(s[i] == 'a'){
            if(num < a+b){
                num++;
                ans(true);
                continue;
            }
        }else if(s[i] == 'b'){
            foreign++;
            if(num < a+b && foreign <= b){
                num++;
                ans(true);
                continue;
            }
        }
        ans(false);
    }

    return 0;
}


Measured memory_bytes: 848
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define MAX_N 100000
#define MAX_M 100000
const int MAX = 10000000;
const int MOD = 1000000007;
#define vec vector<int>
#define vecll vector<ll>
#define vecllvec vector<vector<ll>>
#define vecb vector<bool>
#define vecbvecb vector<vector<bool>>
#define vecst vector<string>
#define vecch vector<char>
#define vecf vector<float>
#define vecvec vector<vector<int>>
#define vecHvec vector<vector<char>>
#define all(x) (x).begin(),(x).end()
const int INF = 1e9;
#define PI 3.141592653589793
// cout << setprecision(15) << std::fixed;

int main() {
  int n,w;
  cin>>n>>w;
  vecll we(n),va(n);
  for(int i=0;i<n;i++){
    cin>>we[i]>>va[i];
  }
  vecllvec dp(n+1,vecll(w+1,0));
  for(int i=0;i<n;i++){
    for(int j=0;j<=w;j++){
      if(we[i]<=j){
        dp[i+1][j]=max(dp[i][j-we[i]]+va[i],dp[i][j]);
      }
      else{
        dp[i+1][j]=dp[i][j];
      }
    }
  }
  cout<<dp[n][w]<<endl;
}


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

int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	int ans = -1;
	ans = abs(a[0] - (a[a.size() - 1]));
	cout << ans << endl;

	return 0;
}

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

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

  if (4 * x >= y && (4 * x - y) % 2 == 0 && y >= 2 * x && (y - 2 * x) % 2 == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

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

vii G;

vii dist(2);

void dfs(int now, int par, int d, int idx) {
	dist[idx][now] = d;
	for (int ch: G[now]) {
		if (ch == par) continue;
		dfs(ch, now, d + 1, idx);
	}
}

signed main() {
	fio();
	int n, u, v;
	cin >> n >> u >> v;
	u--; v--;
	G.resize(n);
	rep (i, 2) dist[i].resize(n);

	rep (i, n - 1) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}

	dfs(u, -1, 0, 0);
	dfs(v, -1, 0, 1);

	//DEBUG_MAT(dist);

	int mi = 0;
	rep (i, n) {
		if (dist[0][i] < dist[1][i]) {
			chmax(mi, dist[1][i]);
		}
	}

	cout << mi - 1 << endl;
}

Measured memory_bytes: 12544
#include<bits/stdc++.h>
#include<stdio.h>
using namespace std;
using ll = long long;
using ld = long double;
long double pi = 2*acos(0.0);

void solve() {
    ll a, b, h, m;
    cin >> a >> b >> h >> m;
    h %= 12; m %= 60;
    ld am = m * 6, ah = h * 30 + (ld)m / 2, diff = am - ah;
    if(diff < 0) diff = -diff;
    if(diff > 180) diff = 360 - diff;
    cout << setprecision(20) << sqrt(a * a + b * b - (2 * a * b * cos((pi * diff) / 180)));
}

int main() {
    ios_base :: sync_with_stdio(false); 
    cin.tie(NULL);
    ll t = 1;
    //cin >> t;
    while(t--) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 4136
#include<iostream>
#include<string>
#include<queue>
using namespace std;

int main()
{
    int n, q;                               //プロセス数n, クオンタムq
    int sum = 0;                            //処理時間の合計sum
    string str;                             //プロセス名str
    int ms;                                 //秒数ms

    queue<string> que1;
    queue<int> que2; 

    cin >> n >> q;

    for( int i = 0; i < n; i++ )            //入力とキューへの格納
    {
        cin >> str >> ms;
        que1.push(str);
        que2.push(ms);
    }

    while( que2.empty() == 0 )              //que2が空でない限り、回し続ける。
    {
        str = que1.front();
        ms = que2.front();
        if( ms - q > 0 )
        {
            sum += q;
            que1.pop();
            que2.pop();
            que1.push(str);
            que2.push(ms-q);
        }
        else
        {
            sum += ms;
            cout << que1.front() << " " << sum << endl;
            que1.pop();
            que2.pop();
        }
    }
    return 0;
}


Measured memory_bytes: 5660
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import bisect
import re
import queue
from collections import Counter
from collections import defaultdict
from functools import lru_cache


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def float():
        return float(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def map_float():
        return [float(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [input() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [int(input()) for i in range(n)]


class Math():
    @staticmethod
    def PI():
        return math.acos(-1)

    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def roundUp(a, b):
        return -(-a // b)

    @staticmethod
    def toUpperMultiple(a, x):
        return Math.roundUp(a, x) * x

    @staticmethod
    def toLowerMultiple(a, x):
        return (a // x) * x

    @staticmethod
    def nearPow2(n):
        if n <= 0:
            return 0
        if n & (n - 1) == 0:
            return n
        ret = 1
        while(n > 0):
            ret <<= 1
            n >>= 1
        return ret

    @staticmethod
    def sign(n):
        if n == 0:
            return 0
        if n < 0:
            return -1
        return 1

    @staticmethod
    def isPrime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True

    @staticmethod
    def divisor(n):
        i = 1
        table = []
        while i * i <= n:
            if n % i == 0:
                table.append(i)
                table.append(n // i)
            i += 1
        table = list(set(table))
        return table


class PriorityQueue:
    def __init__(self, l=[]):
        self.__q = l
        heapq.heapify(self.__q)
        return

    def push(self, n):
        heapq.heappush(self.__q, n)
        return

    def pop(self):
        return heapq.heappop(self.__q)

    def list(self):
        return self.__q

    def length(self):
        return len(self.__q)


sys.setrecursionlimit(1000000)
MOD = int(1e09) + 7
INF = int(1e30)


def main():
    # sys.stdin = open("Sample.txt")
    N = Scanner.int()
    P = tuple(Scanner.map_int())
    Q = tuple(Scanner.map_int())
    perm = list(itertools.permutations([i + 1 for i in range(N)]))
    print(abs(perm.index(P) - perm.index(Q)))
    return


if __name__ == "__main__":
    main()


Measured memory_bytes: 46572
package main

import (
    "fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	target := make([]int, n)
	for i := range target {
		fmt.Scan(&target[i])
	}
	
	printSlice(target)
	
	insertSort(target)
}

func insertSort(data []int) {
    for i := 1; i < len(data); i++ {
        v := data[i]
        j := i - 1
        for j >= 0 && data[j] > v{
            data[j+1] = data[j]
            j--
        }
        data[j + 1] = v
        printSlice(data)
    }
}

func printSlice(input []int) {
    for i, v := range input {
        if i == len(input) - 1 {
            fmt.Printf("%d\n", v)
        } else {
            fmt.Printf("%d ", v)
        }
    }
}


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

int main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    #ifdef DEBUG
        freopen("in.txt", "r", stdin);
    #endif
    
    int n, k; cin >> n >> k;
    string s; cin >> s;
    s[k - 1] += 32;
    cout << s << '\n';
    
    return 0;
}


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

int main() {
    int n;
    string s;
    cin >> n >> s;
    auto a = vector<bool>(10, false);
    auto b = vector<bool>(100, false);
    auto c = vector<bool>(1000, false);
    for (auto x : s) {
        int k = x - '0';
        for (int i = 0; i <= 9; i++) {
            for (int j = 0; j <= 9; j++) {
                if (a[i] && b[10 * i + j]) c[100 * i + 10 * j + k] = true;
            }
            if (a[i]) b[10 * i + k] = true;
        }
        a[k] = true;
    }
    int ans = 0;
    for (auto x : c) {
        if (x) ans++;
    }
    cout << ans << endl;
}


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

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

using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;

int main() {
  int A, B, C;
  cin >> A >> B >> C;

  bool can = false;
  rep(i, B) {
    if (A * (i + 1) % B == C) {
      can = true;
      break;
    }
  }

  string res = (can) ? "YES" : "NO";
  cout << res << endl;
}

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

int main() {
    ll n,m;
    cin >> n >> m;
    if(n>m/2){//many S
        cout << m/2 << endl;
    }
    else{ //many c
        cout << n+(m-2*n)/4 << endl;
    }
	return 0;
}

Measured memory_bytes: 256
from collections import deque
import sys
def input():return sys.stdin.readline().strip()
def main():
    H, W = map(int, input().split())
    sh, sw = map(int, input().split())
    sh -= 1; sw -= 1
    start = (sh+2)*(W+4) + 2 + sw
    dh, dw = map(int, input().split())
    dh -= 1; dw -= 1
    goal = (dh+2)*(W+4) + 2 + dw

    field = "#"*(W+4)*2
    field += "##" + "####".join([ input() for _ in range(H)]) + "##"
    field += "#"*(W+4)*2

    move = [-1, 1, -(W+4), W+4]
    ex_left = [-2*(W+4)-2, -(W+4)-2, -2, (W+4)-2, 2*(W+4)-2, -(W+4)-1, (W+4)-1]
    ex_right = [-2*(W+4)+2, -(W+4)+2, +2, (W+4)+2, 2*(W+4)+2, -(W+4)+1, (W+4)+1]
    ex_up = [-2*(W+4)-2, -2*(W+4)-1, -2*(W+4), -2*(W+4)+1, -2*(W+4)+2, -(W+4)-1, -(W+4)+1]
    ex_down = [2*(W+4)-2, 2*(W+4)-1, 2*(W+4), 2*(W+4)+1, 2*(W+4)+2, (W+4)-1, (W+4)+1]

    INF = 10 ** 18
    num = [INF] * (H+4) * (W+4)
    warped = [False] * (H+4) * (W+4)

    def bfs(s):
        q = deque()
        num[s] = 0
        q.append((s, 0))
    
        while q:
            now, cost = q.popleft()

            # warpしたものの既に来ていた場合はスルー
            if cost > num[now]:
                continue
            else:
                num[now] = cost

            if now == goal:
                return

            for i, dx in enumerate(move):
                nx = now + dx
                if field[nx] == "." and num[nx] == INF:
                    q.appendleft((nx, cost))
                    num[nx] = cost

                elif field[nx] == "#":
                    if i == 0:
                        ex = ex_left
                    elif i == 1:
                        ex = ex_right
                    elif i == 2:
                        ex = ex_up
                    else:
                        ex = ex_down

                    for dx2 in ex:
                        nx2 = now + dx2
                        if field[nx2] == "." and num[nx2] == INF and not warped[nx2]:
                            q.append((nx2, cost+1))
                            warped[nx2] = True
    
    bfs(start)

    if num[goal] == INF:
        print(-1)
    else:
        print(num[goal])

    
    # for i in range(0, (H+4)*(W+4), W+4):
    #     print(field[i:i+W+4])
    
    # print(start)
    # print(start//(W+4), start%(W+4))
    # print(goal)
    # print(goal//(W+4), goal%(W+4))
    


if __name__ == "__main__":
    main()

Measured memory_bytes: 32020
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long a,b;
  cin >> a >> b;
  if(a > 0)cout << "Positive" << endl;
  else if(b < 0){
    if((abs(a - b)+1) % 2)cout << "Negative" << endl;
    else cout << "Positive" << endl;
    
  }else cout << "Zero" << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        
        int[] as = new int[n];
        int[] bs = new int[n];
        int[] cs = new int[n - 1];
        
        for (int i = 0; i < n; i ++) {
            as[i] = s.nextInt();
        }
        
        for (int i = 0; i < n; i ++) {
            bs[i] = s.nextInt();
        }
        
        for (int i = 0; i < n - 1; i ++) {
            cs[i] = s.nextInt();
        }
        
        
        int points = 0;
        
        for (int i = 0; i < n; i ++) {
            points += bs[as[i] - 1];
            if (i > 0 && as[i] == as[i - 1] + 1) {
                points += cs[as[i - 1] - 1];
            }
        }
        
        System.out.println(points);
    }
    
}


Measured memory_bytes: 21844
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n,m,r = LI()
    v = [[] for i in range(n)]
    for i in range(m):
        a,b,c = LI()
        v[a].append((b,c))
    d = [float("inf")]*n
    d[r] = 0
    for i in range(n):
        update = 0
        for x in range(n):
            dx = d[x]
            for y,c in v[x]:
                nd = dx+c
                if nd < d[y]:
                    d[y] = nd
                    update = 1
        if not update:
            break
    else:
        print("NEGATIVE CYCLE")
        return
    for i in d:
        if i == float("inf"):
            print("INF")
        else:
            print(i)
    return

#Solve
if __name__ == "__main__":
    solve()



Measured memory_bytes: 6572
def Yes():
    print("Yes")
    exit()

A1 = list(map(int, input().split(" ")))
A2 = list(map(int, input().split(" ")))
A3 = list(map(int, input().split(" ")))

a1 = [False,False,False]
a2 = [False,False,False]
a3 = [False,False,False]

N  = int(input())

for i in range(0,N):
    b = int(input())
    
    for j in range(0,3):
        if A1[j] == b:
            a1[j] = True
                
    for j in range(0,3):
        if A2[j] == b:
            a2[j] = True
                
    for j in range(0,3):
        if A3[j] == b:
            a3[j] = True  

# print(a1)
# print(a2)
# print(a3)

if sum(a1) == 3 or sum(a2) == 3 or sum(a3) == 3:
    Yes()
    
for n in range(0,3):
    if a1[n] == True and a2[n]== True and a3[n] == True:
        Yes()

if (a1[0] == True and a2[1] == True and a3[2] == True) or (a3[0] == True and a2[1] == True and a1[2] == True):
    Yes()
    
print("No")

Measured memory_bytes: 3064
import sys
if sys.argv[-1] == 'ONLINE_JUDGE':
    import os, zlib, base64
    open('solve.pyx', 'wb').write(zlib.decompress(base64.b85decode("c${TYO>cuR480@qAH2g<SksD5J4|Tok8~W85Fi=^lxC{7Uq74hU0=X{&(AMTO53&2Xd%xxXSJz7>bCE!gI2XS<-(vOg8X%LXU;vhylGT3lX}ZdrAE@IQs{2RE9GR(EkmL<t_%ZNs1oq^`kGMW(1(Ga6!i>F7X}`H7r5y^)s+#F<9Kdtv{BTL6HF9?=_=i%VE`DDGzbO~GDv*+Uh77|Wh7Au1V>|0yp(l`$OpW=ry#82-wQ%&5*=L<I3nkS91mLMeyjnxoC_Mo3uVbQ@U1`8@2@<^5lK3Aat{slZ0e;f-VC71YKCFZGT@9(su?&&4({63n|X#@)0TYNZqu@}piynS!l;c`8{%8;w6tA`FP1qj<+5Xskk~=E1`badh}FFHdOq<Z@*POwP?JBF$%S|<lLNOc5Aw%s(BC5>_v-Un{8mi7T;8d_YO*KO;Xw>(82E=B9iEFXbHIzhll}vB`qr2")))
    os.system('cythonize -i -3 -b solve.pyx')
import solve

Measured memory_bytes: 9800
import Data.List
main = do
  [n,l] <- map (read::String->Int) . words <$> getLine
  let apples = take n [l..]
  print $ sum [applePie|let x = minimumAbs apples, applePie<-delete x apples]

--リストの中で絶対値が一番小さい値を返す
minimumAbs = foldl1 minAbs 
minAbs x y
  |(abs x) < (abs y) = x
  |otherwise         = y

Measured memory_bytes: 3908
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string>
#include <utility>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define loop(i, x, n) for (int i = (x); i < (n); i++)
#define all(v) (v).begin(), (v).end()
#define int long long
using namespace std;
const int MOD = 1e9 + 7;
const int INF = 1e18;
template<typename T> void cmax(T &a, T b) { a = max(a, b); }
template<typename T> void cmin(T &a, T b) { a = min(a, b); }

signed main() {
  int n, m;
  cin >> n >> m;
  vector<int> x(m), y(m);
  rep(i, m) {
    cin >> x[i] >> y[i];
    x[i]--;
    y[i]--;
  }
  vector<int> red(100005, 0), num(100005, 1);
  red[0] = 1;
  rep(i, m) {
    if (red[x[i]]) {
      red[y[i]] = 1;
    }
    num[x[i]]--;
    num[y[i]]++;
    if (num[x[i]] == 0) red[x[i]] = 0;
  }
  int ans = 0;
  rep(i, n) ans += red[i] == 1;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3328
#include <cstdio>
#include <cmath>

using namespace std;

int main() {

	int a, b;
	int ans;
	
	scanf("%d", &a);
	scanf("%d", &b);
	
	if(b % a == 0){
		ans = a+b;
	}else{
		ans = b-a;
	}
	
	printf("%d\n", ans);
	
	return 0;
	
}


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

void swap(int * a, int * b) {
    int tmp = *a;
    *a = *b;
    *b = tmp;
}

int main(void) {
  int a;
  int b;
  int c;
  cin >> a >> b >> c;

  if (a > b) swap(&a, &b);
  if (b > c) swap(&b, &c);
  if (a > b) swap(&a, &b);

  cout << a << " " << b << " " << c << endl;
  return 0;
}



Measured memory_bytes: 3092
#include <iostream>

using namespace std;

int main() {
  int A, B, C;
  cin >> A >> B >> C;
  const char* result = "No";
  if (((A == B) && (A != C)) ||
      ((B == C) && (B != A)) ||
      ((C == A) && (C != B))) {
    result = "Yes";
  }
  cout << result << endl;
  return 0;
}


Measured memory_bytes: 256
(N, D) = [int(n) for n in input().split()]

ans = 0
D2 = D ** 2
for _ in range(N):
    (x, y) = [int(n) for n in input().split()]
    d2 = x ** 2 + y ** 2
    if d2 <= D2:
        ans += 1
print(ans)

    


Measured memory_bytes: 9184
N, K = map(int, input().split(' '))
points = [tuple(map(int, input().split(' '))) for _ in range(N)]
points.sort()

ans = float('inf')
for i in range(N):
    for j in range(i + K - 1, N):
        xmin, xmax = points[i][0], points[j][0]
        que = []
        for k in range(N):
            if xmin <= points[k][0] <= xmax:
                que.append(points[k][1])
        if len(que) >= K:
            que.sort()
            for k in range(len(que) - K + 1):
                ans = min(ans, (max(que[k: k + K]) - min(que[k: k + K])) * (xmax - xmin))
print(ans)

Measured memory_bytes: 43612
#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 2e9
#define MOD 1e9+7;
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long LL;
typedef vector<int> VI;
typedef vector<string> VS;

int main(){
  int N, temp, chk = 1;
  cin >> N;
  VI A(N);
  REP(i, N){
    cin >> temp;
    if (temp % 2 == 0){
      if (!(temp % 3 == 0 || temp % 5 == 0)){
        chk = 0;
      }
    }
  }
  if (chk){
    cout << "APPROVED" << endl;
  }
  else {
    cout << "DENIED" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pair<int, int>> vpii;
typedef pair<int, int> pii;
#define PB push_back
#define EB emplace_back
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

vi v;
int main(){
	int m, k; scanf("%d%d", &m, &k);
	if(m==0){
		if(k==0) printf("0 0\n");
		else printf("-1\n");
	}else if(m==1){
		if(k==0) printf("0 0 1 1\n");
		else printf("-1\n");
	}else{
		int mm = 1<<m;
		if(k < mm){
			REP(i, mm) if(i!=k) v.EB(i);
			v.EB(k);
			for(int i=mm-1; i>=0; i--) if(i!=k) v.EB(i);
			v.EB(k);
			REP(i, mm*2){
				if(i) printf(" ");
				printf("%d", v[i]);
			}
			printf("\n");
		}else{
			printf("-1\n");
		}
	}
}


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

ll solve(ll ai, ll aj, ll bi, ll bj) {
    if (aj > bj) {
        swap(ai, bi);
        swap(aj, bj);
    }
    ll s = 1;
    rep(i, 30) s *= 3;
    ll dist = abs(ai - bi) + abs(aj - bj);
    ll res = dist;
    while (1) {
        s /= 3;
        if (s <= 0) break;
        ll nai = ai / s, nbi = bi / s;
        if (nai != nbi) break;
        ll naj = aj / s, nbj = bj / s;
        if (nai % 3 == 1 && abs(naj - nbj) > 1) {
            ll up = s * nai - 1;
            ll bot = s * (nai + 1);
            ll loss = min(ai,bi) - up;
            loss = min(loss, bot - max(ai, bi));
            res = dist + loss * 2;
            break;
        }
    }
    return res;
}

int main(){
    int q;
    cin >> q;
    rep(qi, q) {
        ll ai, aj, bi, bj;
        cin >> ai >> aj >> bi >> bj;
        ai--; aj--;
        bi--; bj--;
        ll ans = 0;
        ans = max(ans, solve(ai, aj, bi, bj));
        ans = max(ans, solve(aj, ai, bj, bi));
        cout << ans << endl;
    }
    return 0;
}


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

using namespace std;

#define po pop_back
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define PI 3.14159265
#define posib "POSSIBLE"
#define imposib "IMPOSSIBLE"

typedef long long ll;

const ll max_n = 1e6 + 10 , Mod = 1e9 + 7 , inf = 1e18;
bool flag = true;
ll table[max_n][2];
ll n , m , a , b;

void read_input(){
        cin >> n >> m;
        for(int i = 1 ; i <= m ; i++){
                cin >> a >> b;
                if(a == n)
                        table[b][1] = 1;
                if(b == n)
                        table[a][1] = 1;
                if(a == 1)
                        table[b][0] = 1;
                if(b == 1)
                        table[a][0] = 1;
        }
}

void solve(){
        for(int i = 2 ; i < n ; i++){
                if(table[i][0] == 1 && table[i][1] == 1){
                        flag = false;
                        break;
                }
        }
}

void output(){
        if (flag)
                cout << imposib << '\n';
        else
                cout << posib << '\n';
}

int main(){
        IOS;
        read_input();
        solve();
        output();
        return 0;
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
const int maxn = 1e6;
int a[maxn];
int main() {
    int n;
    cin >> n;
    int sum = 0;
    for(int i = 0; i < n; i++) {
        cin >> a[i];
        sum += a[i];
    }
    int avg = floor(1.0 * sum / n + 0.5);
    int ans = 0;
    for(int i = 0; i < n; i++)
        ans += (a[i] - avg) * (a[i] - avg);
    cout << ans; 
}

Measured memory_bytes: 256
n=gets.chomp.chars.last.to_i
if n == 2 || n == 4 || n == 5 || n == 7 || n == 9
  puts 'hon'
elsif n == 0 || n == 1 || n == 6 || n == 8
  puts 'pon'
elsif n == 3
  puts 'bon'
end

Measured memory_bytes: 14312
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>


using namespace std;

bool greater_num(const pair<int, long long> prev, const pair<int, long long> next){
    return prev.second > next.second;
}


int main(void)
{
    int cards_count;
    int changes_count;
    vector<long long> card_nums;
    vector<pair<int, long long> > replace_data;

    cin >> cards_count >> changes_count;

    for(int i = 0; i < cards_count; i++){
        long long num;
        cin >> num;

        card_nums.push_back(num);
    }

    for(int i = 0; i < changes_count; i++){
        int rep_count;
        long long rep_num;

        cin >> rep_count >> rep_num;
        replace_data.push_back(make_pair(rep_count, rep_num));
    }

    sort(replace_data.begin(), replace_data.end(), greater_num);
    sort(card_nums.begin(), card_nums.end());

    long long sum = 0;
    int j = 0;
    for(int i = 0; i < cards_count; i++){
        if(card_nums[i] < replace_data[j].second){
            sum += replace_data[j].second;
            replace_data[j].first--;
        }else{
            sum += card_nums[i];
        }
        
        if(replace_data[j].first == 0){
            j++;
        }
    }


    cout << sum << endl;


    return 0;
}

Measured memory_bytes: 3188