akhauriyash/Code-Regression huggingface dataset:
#![allow(unused_imports)]

use text_io::*;
use proconio::*;
use std::collections::*;
use std::process::exit;
use std::cmp::*;
use itertools::Itertools;

fn main() {
    let mut n:usize=read!();
    let mut m:usize=read!();
    let mut v=[0;33];
    for i in 0..n {
        let mut k:usize=read!();
        for j in 0..k {
            let mut a:usize=read!();
            v[a]+=1;
        }
    }
    let mut ans=0;
    for i in 0..33 {
        if v[i]==n {ans+=1; }
    }
    println!("{}",ans);
}

Measured memory_bytes: 2148
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner ob=new Scanner(System.in);
long n=ob.nextInt();
double d=ob.nextDouble();
int k=0;
for(int t=1;t<=n;t++)
{
long  x=ob.nextLong();
long y=ob.nextLong();
double ans=Math.sqrt((((x)*(x))*(1.0))+(((y)*(y))*(1.0)));

if(ans<=d){k++;}
}
        System.out.println(k);
       /* int n=ob.nextInt();
        if (n>=30) {
            System.out.println("YES");
        }
        else {
            System.out.println("NO");
        } */
    }

}


Measured memory_bytes: 49128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
typedef vector <ll> vll;
typedef pair <ll, ll> pll;
#define pb push_back
#define mp make_pair
#define MAX 1000000
#define mod 1000000007
#define all(_) _.begin(), _.end()
#define F first
#define S second

int main()
{
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL), cout.tie(NULL);
    ll n, i, l, r;
    cin >> n;
    vll a(n), b(n);
    for(i = 0; i < n; i++)
        cin >> a[i];
    for(i = 0; i < n; i++)
        cin >> b[i];
    vll c(a);
    sort(all(c));
    map <ll, ll> m;
    for(i = 0; i < n; i++)
        m[c[i]] = i;
    vll tree(2 * n, 0);
    ll aa = 0;
    for(i = 0; i < n; i++)
    {
        r = m[a[i]];
        ll ans = 0;
        for(l = n, r += n; l < r; l >>= 1, r >>= 1)
        {
            if(l & 1)
                ans = max(ans, tree[l++]);
            if(r & 1)
                ans = max(ans, tree[--r]); 
        }
        ans += b[i];
        aa = max(aa, ans);
        l = m[a[i]];
        for(tree[l += n] = ans; l > 1; l >>= 1)
            tree[l >> 1] = max(tree[l], tree[l ^ 1]);
    }
    cout << aa << endl;
    return 0;
}

Measured memory_bytes: 20608
#include <bits/stdc++.h>
using namespace std;
using ll  = long long;
using pll = pair<ll, ll>;
using vl  = vector<ll>;
using vvl = vector<vl>;
#define rng(i,a,b) for(int i = (a); i < (b); ++i)
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define DEBUG(x) cerr<<__LINE__<<": "<<#x<<" = "<<x<<"\n"

template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}

const int INF = 1e9;
int N, K;
bool ok;
vvl edges;
vl mns, mxs;

bool isFixed(int node) {
    return mns[node] == mxs[node];
}
bool isFree(int node) {
    return mxs[node] == INF;
}
bool isFloating(int node) {
    return !isFixed(node) and !isFree(node);
}

void dfs(int parent, int pre) {
    for (auto child : edges[parent]) {
        if (child == pre) continue;
        if (isFixed(parent) and isFixed(child)) {
            if (abs(mxs[parent] - mxs[child]) != 1) {
                ok = false;
                return;
            }
        }
        chmax(mns[child], mns[parent] - 1);
        chmin(mxs[child], mxs[parent] + 1);

        dfs(child, parent);

        if (mxs[child] % 2 == mxs[parent] % 2 or
             mxs[child] < mns[parent]-1 or mxs[parent] < mns[child]-1) {
            ok = false;
            return;
        }
        chmax(mns[parent], mns[child] - 1);
        chmin(mxs[parent], mxs[child] + 1);
    }
}


int main() {
    cin >> N;
    ok = true;
    edges.resize(N);
    mxs.assign(N, INF);
    mns.assign(N, -INF);
    rep(i,N-1) {
        int a, b; cin >> a >> b;
        a--; b--;
        edges[a].push_back(b);
        edges[b].push_back(a);
    }
    cin >> K;
    int parent = 0, pre = -1;
    rep(i,K) {
        int v, p; cin >> v >> p;
        v--;
        mns[v] = mxs[v] = p;
        parent = v;
    }

    dfs(parent, pre);
    dfs(parent, pre);

    if (!ok) {
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << endl;
    rep(node, N) {
        cout << mxs[node] << endl;
    }
    return 0;
}


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

int main()
{
  ll n;
  string s;
  cin >> n >> s;

  vector<ll> c(n + 1, 0);

  for (ll i = 0; i < n; i++)
  {
    c[i + 1] = c[i];
    if (s[i] == 'W')
    {
      c[i + 1]++;
    }
  }

  ll ans = n;
  for (ll i = 1; i < n + 1; i++)
  {
    ans = min(ans, c[i - 1] + (n - i) - (c[n] - c[i]));
  }
  cout << ans << endl;
}


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

int main()
{
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if ((a + b) > (c + d)) {
    cout << "Left" << endl;
  } else if ((a + b) < (c + d)) {
    cout << "Right" << endl;
  } else {
    cout << "Balanced" << endl;
  }

}

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

const int nm = 2e5;
int n, a[nm], b[nm];

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

	sort(a, a + n);
	sort(b, b + n);

	if (n & 1) {
		cout << b[n / 2] - a[n / 2] + 1 << endl;
	} else {
		cout << b[n / 2 - 1] + b[n / 2] - a[n / 2 - 1] - a[n / 2] + 1 << endl;
	}

}


Measured memory_bytes: 5200
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
           
            int A = sc.nextInt();
            int B = sc.nextInt();
            
            if (A-B >= 0) {
                if (A <= 8) {
                    System.out.println("Yay!");
                } else {
                    System.out.println(":(");
                }
            }
    
            else if (B <= 8) {
                System.out.println("Yay!");
            }
            else {
                System.out.println(":(");
            }
        
    }
}


Measured memory_bytes: 21076
#include <cstdio>
#include <cctype>
#include <algorithm>
#define repu(i,x,y) for (int i=x; i<=y; ++i)
#define repe(i,x) for (edge *i=fst[x]; i; i=i->nxt)
using namespace std;

int n,f[100100];
struct edge
{
    int v;
    edge *nxt;
} pool[100100],*tp=pool,*fst[100100];

int getint()
{
    char ch;
    while (!isdigit(ch=getchar()));
    int x=ch-'0';
    for (; isdigit(ch=getchar()); x=x*10+ch-'0');
    return x;
}

void dfs(int x)
{
    repe(i,x)
        dfs(i->v);
    static int a[100100];
    int tot=0;
    repe(i,x)
        a[++tot]=f[i->v];
    sort(a+1,a+1+tot);
    repu(i,1,tot)
        f[x]=max(f[x],a[i]+tot-i+1);
}

int main()
{
    n=getint();
    repu(i,2,n)
    {
        int x=getint();
        *tp=(edge){i,fst[x]},fst[x]=tp++;
    }
    dfs(1);
    printf("%d\n",f[1]);
    return 0;
}

Measured memory_bytes: 7552
#include <bits/stdc++.h>
using namespace std;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;}
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;
#define Add(x, y) x = (x + (y)) % mod
#define Mult(x, y) x = (x * (y)) % mod



signed main(){

    int N, A, B, C, D; cin >> N >> A >> B >> C >> D;
    A--; B--; C--; D--;
    string S; cin >> S;
    int A0 = A, B0 = B, C0 = C, D0 = D;

    
    bool f = true;
    while(A < C){
        if(S[A + 1] == '.') A++;
        else if(A + 2 < N && S[A + 2] == '.') A += 2;
        else{
            f = false;
            break;
        }
    }
    while(B < D){
        if(S[B + 1] == '.') B++;
        else if(B + 2 < N && S[B + 2] == '.') B += 2;
        else{
            f = false;
            break;
        }
    }
    if(D0 < C0){
        bool tmp = false;
        FOR(i, B0, D0 + 1) if(i > 0 && i + 1 < N){
            if(S[i - 1] == '.' && S[i] == '.' && S[i + 1] == '.') tmp = true;
        }
        if(!tmp) f = false;
    }
    Ans(f, "Yes", "No");

    return 0;
}


Measured memory_bytes: 592
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define eb emplace_back
#define f first
#define s second
#define ll long long int
#define ull unsigned long long int
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define mod 1000000007
int main()
{
    fast;
    int n;
    cin>>n;
    int a[n+2];
    for(int i=0;i<n;i++)cin>>a[i];
    int dp[n+3]={0};
    dp[n-1]=0;
    dp[n-2]=abs(a[n-1]-a[n-2]);
    for(int i=n-3;i>=0;i--)
    {
        dp[i]=min(dp[i+1]+abs(a[i]-a[i+1]), dp[i+2]+abs(a[i]-a[i+2]));
    }
    cout<<dp[0]<<"\n";
return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define MAX_N 100001
int par[MAX_N];
int size[MAX_N];
int id[MAX_N];
bool flg=false;

void init(){
  for(int i=0;i<MAX_N;i++){
    par[i]=i;
    size[i]=1;
    id[i]=-1;
  }
}

int find(int x){
  if(par[x]==x)return x;
  return par[x]=find(par[x]);
}

void unite(int a,int b){
  a=find(a);
  b=find(b);
  if(a==b)return;
  if(size[a]>size[b])swap(a,b);
  par[a]=b;

  if(id[a]!=-1&&id[b]!=-1&&id[a]!=id[b])flg=true;
  
  if(id[a]!=-1){
    id[b]=id[a];
  }
}

int N,M,K;
int main(){
  init();
  
  scanf("%d %d %d",&N,&M,&K);
  for(int k=1;k<=K;k++){
    int type,x,y;
    scanf("%d %d %d",&type,&x,&y);
    if(type==1){
      unite(x,y);
    }else if(type==2){
      x=find(x);
      if(id[x]!=-1&&id[x]!=y)flg=true;
      id[x]=y;
    }
    if(flg){
      cout<<k<<endl;
      break;
    }
  }
  if(!flg){
    cout<<0<<endl;
  }
  return 0;
}

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

int main(){
  int height,weigh;
  while(1){
    cin >> height >> weigh;
    if(height == 0 && weigh == 0)break;
    for(int i = 0; i < height; i++){
      for(int j = 0; j < weigh; j++)cout << '#';
      cout << '\n';
    }
    cout << '\n';
  }
  return 0;
}


Measured memory_bytes: 3072
#include <bits/stdc++.h>
using namespace std;
int main() {
    int a, b; 
    cin >> a >> b; 

    bool yes = false; 
    for (int c = 1; c <= 3; c++)  {
        if (a * b * c % 2) yes = true; 
    }

    yes ? cout << "Yes\n" : cout << "No\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct Dice {
	int V[6];
	void role(char c) {
		int a;
		if (c == 'E') {
			a = V[0];
			V[0] = V[3];
			V[3] = V[5];
			V[5] = V[2];
			V[2] = a;
		}
		if (c == 'N') {
			a = V[0];
			V[0] = V[1];
			V[1] = V[5];
			V[5] = V[4];
			V[4] = a;
		}
		if (c == 'S') {
			a = V[0];
			V[0] = V[4];
			V[4] = V[5];
			V[5] = V[1];
			V[1] = a;
		}
		if (c == 'W') {
			a = V[0];
			V[0] = V[2];
			V[2] = V[5];
			V[5] = V[3];
			V[3] = a;
		}
		if (c == 'R') {
			a = V[1];
			V[1] = V[2];
			V[2] = V[4];
			V[4] = V[3];
			V[3] = a;
		}
		if (c == 'L') {
			a = V[1];
			V[1] = V[3];
			V[3] = V[4];
			V[4] = V[2];
			V[2] = a;
		}
	}
	int top() {
		return V[0];
	}
	int right() {
		return V[2];
	}
	int left() {
		return V[3];
	}
	int front() {
		return V[1];
	}
	int back() {
		return V[4];
	}
	int bottom() {
		return V[5];
	}
};

bool same(Dice a, Dice b) {
	for (int i = 0; i < 6; i++) if (a.V[i] != b.V[i])
		return false;
	return true;
}

int main() {

	Dice d[100];
	int n;
	//cin >> n;
	n = 2;

	for (int i = 0; i < n; i++)
		for (int j = 0; j < 6; j++)
			cin >> d[i].V[j];

	bool b = false;

	for (int i = 0; i < 4; i++) {
		d[1].role('N');
		for (int j = 0; j < 4; j++) {
			d[1].role('R');
			if (same(d[0], d[1])) {
				b = true;
				break;
			}
		}
	}

	d[1].role('E');
	for (int i = 0; i < 4; i++) {
		d[1].role('R');
		if (same(d[0], d[1])) {
			b = true;
			break;
		}
	}

	d[1].role('W');
	d[1].role('W');
	for (int i = 0; i < 4; i++) {
		d[1].role('R');
		if (same(d[0], d[1])) {
			b = true;
			break;
		}
	}

	if (b)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

}


Measured memory_bytes: 3104
#include <bits/stdc++.h>
#define MAX 7368800
using namespace std;

int main(int argc, char const *argv[])
{
	int n, m;
	while(1)
	{
		cin >> m >> n;
		int memo[MAX]={};
		if(n==0&&m==0) break;
		while(1)
		{
			if(memo[m]==0)
			{
				if(n==0) break;
				--n;
				for (int i = 0; i < MAX; i+=m) memo[i] = 1;
			}
			++m;
		}
		cout << m << endl;
	}
	return 0;
}


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

#define ll long long

int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    cin >> n;
    int arr[n]={};
    for(int i=0; i<n-1; i++){
        int x;
        cin >> x;
        arr[x-1]++;
    }

    for(int i=0; i<n; i++) cout << arr[i] << "\n";

    return 0;
}

Measured memory_bytes: 4428
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define EPS (1e-10)
#define equals(a, b) (fabs((a)-(b)) < EPS)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
  
int main() {
  int N;
  cin >> N;
  vi A(N);
  int acc = 0;
  rep(i,N) {
    cin >> A[i];
    acc += A[i];
  }
  vp c;
  rep(i,N) {
    c.emplace_back(abs(acc-A[i]*N),i);
  }
  sort(rng(c));
  cout << c[0].second << endl;
  return 0;
}

Measured memory_bytes: 3616
#include "iostream"
#include "algorithm"
#include "cstring"
#include "cstdio"
#include "cmath"
#include "vector"
#include "map"
#include "set"
#include "queue"
using namespace std;
#define MAXN 200006
#define int long long
#define rep(i, a, b) for (int i = (a), i##end = (b); i <= i##end; ++i)
#define per(i, a, b) for (int i = (a), i##end = (b); i >= i##end; --i)
#define pii pair<int,int>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define all(x) (x).begin() , (x).end()
#define mem( a ) memset( a , 0 , sizeof a )
#define P 1000000007
typedef long long ll;
int n;
int res = 0;
void solve() {
    cin >> n;
    int r = n - 1;
    for( int i = 1 ; i * i <= r ; ++ i ) if( r % i == 0 ) {
        ++ res;
        if( i * i != r ) ++ res;
    }
    for( int i = 2 ; i * i <= n ; ++ i ) if( n % i == 0 ) {
        int t = n;
        while( t % i == 0 ) t /= i;
        if( t % i == 1 ) ++ res;
    }
    cout << res << endl;
}
signed main() {
//    freopen("2.in","r",stdin);
//    freopen("fuckout","w",stdout);
//    int T;cin >> T;while( T-- ) solve();
    solve();
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<algorithm>
#include<string>
#include<stdbool.h>
#include<iostream>
#include<queue>
using namespace std;
bool judge(long long int n, long long  int a, long long int b)
{
	if (n < 1 || a<1 || b<1) return false;
	if (a > b) return false;
	if (n == 1 && a != b) return false;
	return true;
}
int main()
{
	long long int n, a, b, ans = 0,s,e;
	scanf("%lld %lld %lld", &n, &a, &b);
	if (judge(n, a, b))
	{

		if (a == b) ans = 1;
		else {
			s = a * (n - 1) + b;
			e = a + b * (n - 1);
			ans = e - s + 1;
		}
	}
	printf("%lld\n", ans);
	getchar();getchar();return 0;
}

Measured memory_bytes: 256
// warm heart, wagging tail,and a smile just for you!
//
//                            ▒█████▒▒
//                             ██████████▒
//                             ▒████████████▒
//                            ██████████████████
//                           ████████████████████▒
//                          ▒██████████████████████▒
//                          ▒███████████████████████
//                      ▒████▒▒▒▒▒▒█████████████████▒
//                    ███▒▒▒▒▒▒██████████████████████▒▒▒
//                  ▒██▒▒███████████████████████▒▒▒▒▒██████
//                 ▒█████████████████████████▒▒▒▒▒▒█████████▒
//                 ▒█████████████████████▒▒▒▒▒▒██████████████
//                  ▒████         ████▒▒▒▒▒████         ████▒
//              ▒█████▒    ████    ▒▒▒▒███████    ████    ██████▒
//            ▒██▒▒▒▒▒    ██████    █████████    ██████    ██▒▒▒██▒
//           █████████   ████████   █████████   ████████   ▒▒▒▒█████
//          ▒█████████    ██████    ████████▒    ██████    █████████
//          ▒██████████    ████    █████▒▒▒▒▒▒    ████    ██████████
//           ████████████        ▒▒▒▒▒▒▒████████        ███████████▒
//       ▒██████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒███████████████████████████████████▒
//     ███▒▒▒▒▒▒▒▒▒▒▒▒█████████████████████████████████████████▒▒████████▒
//   ▒▒▒▒▒▒▒▒▒██████████████                         ███████▒▒▒▒███████████
//   █████████████████████████                     ███████▒▒▒██████████████▒
//   █████████████████████████████             ███████▒▒▒██████████████████▒
//   ██████████████████████████████████████████████████████████████████████
//    ██████████████████████████████████████████████████████████████████▒
//      ▒█████████████████▒▒▒▒▒▒▒██████████████████████████████████▒▒▒
//
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i = (b-1);i>=(a);--i)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

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

  string s,t;
  cin >> s >> t;

  int ans = 0;
  REP(i,3) if(s[i]==t[i]) ans++;

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
import bisect
n,q = map(int,input().split())
l = [list(map(int,input().split())) for i in range(n)]
l = sorted(l,key = lambda x: x[2])
d = [int(input()) for i in range(q)]

ans = [-1]*q
skip = [-1]*q
for s,t,x in l:
    le = bisect.bisect_left(d,s-x)
    ri = bisect.bisect_left(d,t-x)
    while le < ri:
        if skip[le] == -1:
            ans[le] = x
            skip[le] = ri
            le += 1
        else:
            le = skip[le]

for i in ans:
    print(i)


Measured memory_bytes: 74256
#include<cstdio>
#include<string>
#include<iostream>

using namespace std;

int main()
{
    int n;
    cin >> n;
    int cnt = 0;
    for(int i = 1; i<=n; ++i)
    {
        int v;
        cin >> v;
        if(i&1 && v&1)cnt++;
    }
    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 3640
function main()
	N=parse(Int,readline())
	M=Dict{String,Int}()
	m=0
	for i=1:N
		s=readline()
		t=get(M,s,0)+1
		M[s]=t
		m=max(m,t)
	end
	ans=String[]
	for (k,v)=M
		if v==m
			push!(ans,k)
		end
	end
	sort!(ans)
	println.(ans)
end
main()


Measured memory_bytes: 157108
#include <iostream>
using namespace std;
int main(){
int code[256]={0};
char st[30];
bool diff=true;
cin >> st;
for(int i=0;i<30;i++){
if(st[i]==0)break;
code[st[i]]++;
if (code[st[i]]>1)diff=false;
}
cout<<(diff?"yes":"no")<<endl;
return 0;}

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

using namespace std;

const int MAX = 1e6;
const int INF = 2e9;
typedef long long ll;

int comb(int n, int r) {

    if (n < r) {
        return 0;
    } 

    if(n==r || r == 0) {
        return 1;
    }

    int x = 1;
    int y = 1;
    for (int i = 0; i < r; ++i)
    {
        x = x * (n - i);
        y = y * (i + 1);
    }

    return x / y;
}


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

    int n, m;
    cin >> n >> m;

    cout << comb(n, 2) + comb(m, 2);


    return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define all(c) begin(c), end(c)
#define range(i,a,b) for(int i = a; i < (int)(b); i++)
#define rep(i,b) range(i,0,b)
#define eb emplace_back
typedef long long ll;
auto const inf = numeric_limits<ll>::max()/4;

using Weight = ll;
using Capacity = int;
struct Edge {
    int src, dst; Weight weight;
    Edge(int s, int d, int w) : src(s), dst(d), weight(w) {}
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;
using Array = vector<Weight>;
using Matrix = vector<Array>;

vector<Weight> dijkstra(const Graph &g, int s){
    const Weight inf = numeric_limits<Weight>::max()/4;
    typedef tuple<Weight,int> State;
    queue<State> q;
    vector<Weight> dist(g.size(), inf);
    dist[s] = 0; q.emplace(0,s);
    while (q.size()) {
        Weight d; int v;
        tie(d,v) = q.front(); q.pop(); d *= -1;
        /* if(v == t) return d; */
        if (dist[v] < d) continue;
        for(auto & e : g[v]){
            if (dist[e.dst] > dist[v] + e.weight) {
                dist[e.dst] = dist[v] + e.weight;
                q.emplace(-dist[e.dst], e.dst);
            }
        }
    }
    return dist;
}


int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    int V,E,r;
    while(cin >> V >> E >> r){
        Graph g(V);
        rep(i,E){
            int a,b,c;
            cin >> a >> b >> c;
            g[a].eb(a,b,c);
        }
        vector<Weight> dist = dijkstra(g,r);
        for(int i = 0; i < (int)dist.size(); i++){
            if(dist[i] == inf) cout << "INF";
            else cout << dist[i];
            cout << endl;
        }
    }
}

Measured memory_bytes: 18740
/*
Written By mafailure
*/
//In the name of God
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional> // for less
using namespace std;
using namespace __gnu_pbds;
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"
#define int long long 
// int dx[]={-1,1,0,0}; int dy[]={0,0,1,-1};
// int dx[]={2,2,-2,-2,1,1,-1,-1}; int dy[]={1,-1,1,-1,2,-2,2,-2};
const long long mod = 1e9 + 7;
const double eps=1e-9;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> ii;
typedef vector< pair< int, int > > vii;
typedef map<int, int> mii;
typedef pair<int, ii> pip;
typedef pair<ii, int> ppi;
#define arrinp(arr,init,final,size,type) type* arr=new type[size];for(int i=init;i<final;i++)cin>>arr[i];
#define cr2d(arr,n,m,t) t**arr=new t*[n];for(int i=0;i<n;i++)arr[i]=new t[m];
#define w(t) int t;cin>>t; while(t--)
#define takeInp(n) int n;cin>>n;
#define fr(i,init,final) for(int i=init;i<final;i++)
#define frr(i,init,final) for(int i=init;i>=final;i--)
#define Fr(i,final) for(int i=0;i<final;i++)
#define Frr(i,first) for(int i=first;i>=0;i--)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define debug(x) cerr<<">value ("<<#x<<") : "<<x<<endl;
#define setb __builtin_popcount
#define lsone(n) (n&(-n))
#define rlsone(n) (n&(n-1))
#define clr(a,b) memset(a,b,sizeof(a))
const int inf= INT_MAX;
//struct point_i{int x,y;};
struct point_i{int x,y;
point_i(){ x=0; y=0;}
point_i(int x_,int y_){x=(x_);y=(y_) ;}
};

struct point 
{
	float x,y;
	point (){x=y=0.0;}
	point (float x_,float y_){x=(x_); y=(y_);}
	bool operator < (point other) const{
	  if(fabs(x-other.x)>eps)return x<other.x;
	  return y<other.y;
		
		}
	bool operator == (point other) const {
		return fabs(other.x-x)<=eps&& fabs(other.y-y)<=eps;
		}
	
} ;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>  ordered_set; 
vi init(string s)
{
	istringstream sin(s);
	int n;
	vi arr;
	while(sin>>n)arr.push_back(n);
	return arr;
}
int power(int x, int y)
{ 
	if(y==0)return 1;
	int u=power(x,y/2);
	u=(u*u)%mod;
	if(y%2)u=(x*u)%mod;
	return u;
    
}
int gcd(int a,int b)
{
	if(a<b)return gcd(b,a);
	return (b==0?a:(a%b?gcd(b,a%b):b));
}
int gcd_e(int a,int b,int &x,int &y)
{
	
	if(b==0){x=1; y=0; return a;}
	int x1,y1;
	int p=gcd_e(b,a%b,x1,y1);
	x=y1;
	y=x1-(a/b)*y1;
	return p;
}
signed main()
{
	IOS
	int s;
	cin>>s;
	int dp[s+1];
	if(s<3){cout<<0<<endl; return 0;}
	if(s==3){cout<<1<<endl; return 0;}
	dp[0]=1; dp[1]=dp[2]=0;
	
	fr(i,3,s+1)
	{
		dp[i]=0;
		fr(j,3,i+1)
		{
			 dp[i]=(dp[i-j]+dp[i])%mod;
		}
	}
	cout<<dp[s]<<endl;
	
	
}



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


int n;
int a,b;
long c;
int q;
int k;
int x,y;
long ans[100001];
bool used[100001];
vector<pair<int,long>>v[100001];


void dfs(int s,int p,long d){
    ans[s]=d;
	for(int i=0;i<(int)v[s].size();i++){
	    if(v[s][i].first!=p)dfs(v[s][i].first,s,d+v[s][i].second);
	}
}
int main(){
	cin>>n;
	rep(i,n-1){
		cin>>a>>b>>c;
		v[a].push_back({b,c});
		v[b].push_back({a,c});
	}
	cin>>q>>k;
	for(int i=1;i<=n;i++)ans[i]=10000000000000000;
	dfs(k,0,0)
	rep(i,q){
		cin>>x>>y;
		cout<<ans[x]+ans[y]<<endl;
	}
	return 0;
}


Measured memory_bytes: 17408
//#pragma GCC optimize ('O3')
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;
#define mp make_pair
#define f first
#define s second
#define pb push_back

const int N = 3e5 + 5;
const int M = 5e5 + 5;
const int OO = 1e9;
const int mod = 1e9 + 7;

int n,cnt[4];
string s,x[] = {"AC", "WA", "TLE", "RE"};

void init() {}

int main() {

    ios_base::sync_with_stdio(false);
    cin.tie(0);

    cin >> n;

    for (int i = 0; i < n; ++i) {
        cin >> s;
        for (int j = 0; j < 4; ++j) {
            if(s==x[j]) ++cnt[j];
        }
    }

    for (int j = 0; j < 4; ++j) {
        cout << x[j] << " x " << cnt[j] << '\n';
    }

    return 0;
}

Measured memory_bytes: 3656
import java.util.*;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int M = sc.nextInt();

        ArrayList<Long> bc = new ArrayList<>();

        for (int i=0; i<N; i++){
            bc.add(sc.nextLong());
        }

        long[][] tmpBC = new long[M][2];

        for (int i=0; i < M; i++){
            tmpBC[i][0] = sc.nextInt();
            tmpBC[i][1] = sc.nextLong();
        }
        sc.close();

        Arrays.sort(tmpBC, Comparator.comparing((long[] arr) -> arr[1]).reversed());

//        for (int z=0; z<M; z++){
//            System.out.println("tmpB["+z+"]:"+ tmpBC[z][0]+" tmpC["+z+"]:"+ tmpBC[z][1]);
//        }

        int count=0;
        END: for (int i=0; i<M; i++){
            for (int j=0; j<tmpBC[i][0]; j++){
                bc.add(tmpBC[i][1]);
                count++;
                if(count >= N){
                    break END;
                }
            }
        }

        Collections.sort(bc, Comparator.reverseOrder());

        long result=0;
        for (int i=0; i<N; i++){
            result += bc.get(i);
        }

        System .out.println(result);

    }
}

Measured memory_bytes: 121088
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <numeric>
#include <ctime>
#include <complex>
#include <bitset>
#include <random>
#include <climits>
#include <stack>

using namespace std;

typedef long long ll;
typedef long double ld;

#define int ll
#define double ld
#define loop(i, n) for(int i = 0; i < (int)n; ++i)
#define loop1(i, n) for(int i = 1; i <= (int)n; ++i)
#define F first
#define S second
#define pb push_back
#define pi pair <int, int>
#define all(x) begin(x), end(x)
#define ti tuple <int, int, int>
#define Point Vect
#define no {cout << "NO\n"; return;}
#define yes {cout << "YES\n"; return;}
#define mkp make_pair
#define mkt make_tuple
#define cerr if(0) cerr

const int N = 60;

vector <pi> g[N];
int path[N];

bool dfs(int v, int p, int fin, int num) {
    if (v == fin)
        return true;
    for (pi pa : g[v])
        if (pa.F != p && dfs(pa.F, v, fin, num)) {
            path[num] = path[num] ^ (1ll << pa.S); return true;
        }
    return false;
}

void solve() {
    int n; cin >> n;
    loop(i, n - 1) {
        int u, v;
        cin >> u >> v;
        g[u].pb({ v, i });
        g[v].pb({ u, i });
    }
    int m; cin >> m;
    loop(i, m) {
        int u, v;
        cin >> u >> v;
        dfs(u, u, v, i);
    }
    int ans = 0;
    loop(mask, (1ll << m)) {
        int ed = 0, sz = 0;
        loop(bit, m)
            if (mask & (1ll << bit)) {
                ++sz; ed |= path[bit];
            }
        int cur = 1;
        loop(bit, n - 1)
            if (!(ed & (1ll << bit)))
                cur <<= 1;
        ans += cur * (sz % 2 ? -1 : 1);
    }
    cout << ans;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //int t; cin >> t; loop(i, t)
    solve();
    return 0;
}

Measured memory_bytes: 3620
/**
 * Martin Leshko (leshko.martin@gmail.com)
 */

#include <bits/stdc++.h>

using namespace std;

#define psb push_back

#define forn(i, n) for (int i = 0; i < (int)(n); i++)
#define for1n(i, n) for (int i = 1; i <= (int)(n); i++)
typedef long long ll;
typedef pair<int, int> pii;
#define what_is(x) cerr << #x << " is " << x << endl;
#define remplir(a, z) memset(a, z, sizeof(a))
#define all(x) (x).begin(), (x).end()

void faststdio()
{
#ifndef abacaba
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
#endif
}

vector<string> p = {"Sunny", "Cloudy", "Rainy", "Sunny", "Cloudy", "Rainy"};

int main()
{
	faststdio();
	string s;
	cin >> s;
	cout << *(++find(p.begin(), p.end(), s));
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string.h>
#include<string>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<vector>
#include<queue>
#include<map>
#include<set>
using namespace std;
#define lowbit(x) (x)&(-x)
#define rep(i,a,b) for (int i=a;i<=b;i++)
#define per(i,a,b) for (int i=a;i>=b;i--)
#define maxd 1000000007
typedef long long ll;
const int N=100000;
const double pi=acos(-1.0);

int read()
{
	int x=0,f=1;char ch=getchar();
	while ((ch<'0') || (ch>'9')) {if (ch=='-') f=-1;ch=getchar();}
	while ((ch>='0') && (ch<='9')) {x=x*10+(ch-'0');ch=getchar();}
	return x*f;
}

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

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <cstdio>
             
int main() { 
    double r, l, area = 0.0;
             
    std::cin >> r;
    l = 2 * M_PI * r;
    area = M_PI * r * r;
             
    printf("%f %f\n", area, l);
    return 0;
}

Measured memory_bytes: 1232
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define fs first
#define sc second
#define task "test"
using namespace std;
const ll N = 100 + 9;
const ll inf = 1e9 + 7;
typedef pair<ll,ll> LL;

ll h1,h2,m1,m2,p1,p2,k;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    if (fopen(task".inp", "r")){
        freopen(task".inp", "r", stdin);
        //freopen(task".out", "w", stdout);
    }
    cin>>h1>>m1>>h2>>m2>>k;
    p1 = h1*60 + m1;
    p2 = h2*60 + m2;
    cout<<max(0ll,p2 - p1 - k);
}


Measured memory_bytes: 3652
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
using P   = pair<ll, ll>;
using mat = vector<vector<ll>>;

void IOS() { ios::sync_with_stdio(false), cin.tie(0); }

const ll INF = 1e16;
const ll MOD = 1e9 + 7;
const ld EPS = 1e-12;

template <typename T>
void dump(T x) { cout << x << endl; }
void dumpf(ld x, int t) { cout << setprecision(t) << fixed << x << endl; }
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
	fill((T *)array, (T *)(array + N), val);
}
inline ll mod(ll a, ll b) {
	if (a > 0) return a % b;
	if (a % b == 0) return 0;
	ll x = -a / b + 1;
	a += x * b;
	return a % b;
}
ll powm(ll a, ll b, ll c) {
	if (b == 0)
		return 1;
	else if (b % 2 == 0) {
		ll d = powm(a, b / 2, c);
		return (d * d) % c;
	} else
		return (a * powm(a, b - 1, c)) % c;
}
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

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

vector<P> g[114514];
int c[114514]	 = {};
bool used[114514] = {};

void dfs(int i, ll sum) {
	used[i] = true;
	c[i]	= sum % 2 == 0 ? 1 : 0;
	//cout << sum << " " << c[i] << endl;
	for (int j = 0; j < g[i].size(); j++) {
		int to  = g[i][j].first;
		ll cost = g[i][j].second;
		if (!used[to]) {
			//cout << to << " " << cost << endl;
			dfs(to, cost + sum);
		}
	}
}

int main() {
	IOS();
	ll n;
	cin >> n;
	for (int i = 0; i < n - 1; i++) {
		ll a, b, c;
		cin >> a >> b >> c;
		g[a].push_back(P(b, c));
		g[b].push_back(P(a, c));
	}
	dfs(1, 0);
	for (int i = 1; i <= n; i++) {
		dump(c[i]);
	}
	return 0;
}

Measured memory_bytes: 10240
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
#include<limits.h>
#include<unordered_map>
#include<unordered_set>
#include<deque>
#include<cstdio>
typedef long long int ll;
using namespace std;
#define FOR(i,a,n) for(ll i=(ll)a;i<(ll)n;++i)
#define TFOR(i,n)FOR(i,0,n)
#define ALL(x) x.begin(),x.end()
const int INF = 1LL << 30;
const ll LLINF = 1LL << 60;
int main() {
	ll nowmax = 1;
	ll N, ans = 0;
	cin >> N;
	TFOR(i, N) {
		ll n; cin >> n;
		if (i == 0)ans += (n - 1);
		else {
			ans += (n - 1) /(nowmax+1);
			if ((n - 1) / (nowmax + 1 )== 0)nowmax =max(nowmax,n);
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
//                             In The Name Of Allah                                           
//                             	Mohammad Hosseini
#include <bits/stdc++.h>
#define	ss second
#define ff first
#define use_fast ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define ret(n) return cout << n, 0
#define se(n) cout << setprecision(n) << fixed
#define pb push_back
//#define int long long
#define ld long double
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC optimize("no-stack-protector,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std; 

const int N = 3e5 + 100, OO = 1e9, T = 4500 + 100, M = 1e9 + 7, P = 6151, SQ = 280, lg = 30;
typedef pair <int, int> pii;
vector <int> v[N];
int cnt = 0;

bool dfs(int x, int y) {
	bool b = false;
	for(auto u : v[x]) 
		if(u != y)
			b |= dfs(u, x);
	if(b == false)
		return true;
	cnt++;
	return false;
}

int32_t main() {
	use_fast;
	int n;
	cin >> n;
	for(int i = 0; i < n - 1; i++) {
		int x, y;
		cin >> x >> y;
		v[x].pb(y);
		v[y].pb(x);
	}
	dfs(1, 0);
	if(n % 2 == 0 && cnt == n / 2)
		cout << "Second" << endl;
	else
		cout << "First" << endl;
	return 0;
}
/*
be carefull :
1- if not solve after 20 min, read again twice
2- after submit read the code again
3- fun with contest
4- uploaded by ubuntu 20.04 
5- ...
*/



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

//const long double PIL = 3.141592653589793238462643383279502884L;
//const double PI = 3.14159265358979323846;

#define sz(a) int((a).size())
#define all(c) (c).begin(), (c).end()
#define what_is(x) cerr << #x << " is " << x << endl;

using ll = long long;
using ii = pair<int,int>;
using vi = vector<int>;
using vll = vector<long long>;
using vii = vector<pair<int,int>>;

int main() {
	//~ ios::sync_with_stdio(0);
	//~ cin.tie(0);
	int n; scanf("%d", &n);
	vll ps(n+1);
	for (int i = 1; i <= n; i++) {
		scanf("%lld", &ps[i]);
		ps[i] += ps[i-1];
	}
	ll m = ps[n] / 2;
	auto it = lower_bound(all(ps), m);
	ll d = abs(*it - (ps[n] - *it));
	if (it != ps.begin()) {
		--it;
		d = min(d, abs(*it - (ps[n] - *it)));
	}
	printf("%lld\n", d);
}


Measured memory_bytes: 1792
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _0235
{
    class Program
    {
        static Dictionary<int, Dictionary<int, int>> bridges;

        static void Main(string[] args)
        {
            while (true)
            {
                int n = RInt();
                if (n == 0) break;
                Init(n);

                int AllTime = GetAllTime(0, 1);
                int LongestTime = GetLongestTime(0, 1, 0);
                Console.WriteLine(AllTime * 2 - LongestTime);
            }

        }

        private static void Init(int n)
        {
            bridges = new Dictionary<int, Dictionary<int, int>>();
            for (int i = 1; i <= n; i++) { bridges.Add(i, new Dictionary<int, int>()); }
            for (int i = 0; i < n - 1; i++)
            {
                int[] vs = RArInt();
                bridges[vs[0]].Add(vs[1], vs[2]);
                bridges[vs[1]].Add(vs[0], vs[2]);
            }
        }

        private static int GetAllTime(int parentID, int ID)
        {
            int res = 0;
            foreach (var child in bridges[ID].Where(x => x.Key != parentID))
            {
                if (bridges[child.Key].Count(x => x.Key != ID) > 0)
                {
                    res += bridges[ID][child.Key] + GetAllTime(ID, child.Key);
                }
            }
            return res;
        }

        private static int GetLongestTime(int parentID, int ID, int time)
        {
            int maxTime = time;
            foreach (var child in bridges[ID].Where(x => x.Key != parentID))
            {
                if (bridges[child.Key].Count(x => x.Key != ID) > 0)
                {
                    maxTime = Math.Max(maxTime, bridges[ID][child.Key] + GetLongestTime(ID, child.Key, time));
                }
            }
            return maxTime;
        }

        static string RSt() { return Console.ReadLine(); }
        static int RInt() { return int.Parse(Console.ReadLine().Trim()); }
        static long RLong() { return long.Parse(Console.ReadLine().Trim()); }
        static double RDouble() { return double.Parse(Console.ReadLine()); }
        static string[] RArSt(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); }
        static int[] RArInt(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }
        static long[] RArLong(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); }
        static double[] RArDouble(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); }
        static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); }
    }
}



Measured memory_bytes: 14204
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)

	sum := 0

	for i := 1; i <= n; i++ {
		if i%3 == 0 {
		} else if i%5 == 0 {
		} else {
			sum += i
		}
	}
	fmt.Println(sum)
}

Measured memory_bytes: 1752
#include<bits/stdc++.h>
#define F first
#define S second
#define INF 1<<28
using namespace std;

int c, n, s, d;
typedef pair < int, int > P;
typedef pair < int, P > PP;
vector < P > vec[111];

int solve(){

  int dist[111][11]; for(int i=0;i<111;i++)for(int j=0;j<11;j++) dist[i][j] = INF;
  priority_queue < PP, vector<PP>, greater<PP> > que;

  dist[s][c] = 0;
  que.push( PP(0, P(s, c)) ); //Now_cost, Now_node, Now_ticket

  while(!que.empty()){
    PP p = que.top(); que.pop();
    int cost = p.F, now = p.S.F, tic = p.S.S;

    //if(dist[now][tic] < cost) continue;
    for(int i=0;i<vec[now].size();i++){
      P to = vec[now][i];
      if(dist[to.S][tic] > dist[now][tic] + to.F){
	dist[to.S][tic] = dist[now][tic] + to.F;
	que.push( PP(dist[to.S][tic], P(to.S, tic)) );
      }
      if(tic && dist[to.S][tic-1] > dist[now][tic] + to.F/2){
	dist[to.S][tic-1] = dist[now][tic] + to.F/2;
	que.push( PP(dist[to.S][tic-1], P(to.S, tic-1)) );
      }
    }
  }
  
  int ans = INF;
  for(int i=0;i<=c;i++){ ans = min(ans, dist[d][i]); } //cout << ans << endl; }
  return ans;
}

int main(){

  int m, a, b, p;

  
  while(cin >> c >> n >> m >> s >> d){
    if((c|n|m|s|d) == 0) break;
    for(int i=0;i<111;i++) vec[i].clear();
    for(;m--;){
      cin >> a >> b >> p;
      vec[a].push_back(P(p, b)); //[now] P(cost, next);
      vec[b].push_back(P(p, a));
    }
    
    cout << solve() << endl;
  }
  
}

Measured memory_bytes: 1244
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;
double a,b,x,p,t,V,pi=acos(-1);
int main(){
	cin>>a>>b>>x;
	V=a*a*b;
	if(x*2.0<=V){
		p=2.0*x/b/a;
		t=atan(b/p)*180/pi;
	}else{
		p=2.0*(V-x)/a/a;
		t=atan(p/a)*180/pi;
	}
	printf("%.10f",t);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define PI 3.141592653589793238462
using namespace std;
typedef long long ll;
typedef double db;
ll a[200005];
int main(){
    ll n,k;cin>>n>>k;
    for(ll i=1;i<=n;i++){
        cin>>a[i];
    }
    for(ll i=k+1;i<=n;i++){
        if(a[i]>a[i-k]){
            cout<<"Yes"<<endl;
        }
        else cout<<"No"<<endl;
    }
}

Measured memory_bytes: 5212
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#define int long long
#define endl '\n'
#define INF 1000000000000000000
#define EPS 1e-10
#define PI 3.141592653589793238
#define all(a) a.begin(),a.end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define pb push_back
#define double long double
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<P, ll> PP;
typedef complex<double> com;
template<class T, class S> bool chmax(T &a, const S &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T, class S> bool chmin(T &a, const S &b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll n, ll m) { return (m ? gcd(m, n%m) : n); }
ll lcm(ll n, ll m) { return n / gcd(n, m)*m; }


signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	//modcalc();

	int n;
	cin >> n;
	vector<int> p;
	for (int i = 2; i*i <= n; i++) {
		if (n%i == 0) {
			p.pb(i);
			if (i != n / i) p.pb(n / i);
		}
	}
	p.pb(n);
	int ans = -1;
	for (int i = 1; i*i <= n - 1; i++) {
		if ((n - 1)%i == 0) {
			ans += 2;
			if (i*i == n - 1) ans--;
		}
	}
	for (int i : p) {
		int m = n;
		while (m%i == 0) {
			m /= i;
		}
		if (m%i == 1) ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
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; }
typedef long long ll;
const ll MOD=1e+9+7;
struct mint{
  ll x;
  mint(ll x=0):x(x%MOD){}
  mint& operator+=(const mint a){
    if((x+=a.x)>=MOD) x-=MOD;
    return *this;
  }
  mint& operator-=(const mint a){
    if((x += MOD-a.x)>=MOD) x-=MOD;
    return *this;
  }
  mint& operator*=(const mint a){
    (x*=a.x)%=MOD;
    return *this;
  }
  mint operator+(const mint a) const{
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const{
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const{
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const{
    if(!t) return 1;
    mint a = pow(t>>1);
    a*=a;
    if(t&1) a*=*this;
    return a;
  }
  
  //for prime mod
  mint inv() const{
    return pow(MOD-2);
  }
  mint& operator/=(const mint a){
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const{
    mint res(*this);
    return res/=a;
  }
};


int main()
{
  int n; cin >> n;
  mint dp[110][4][4][4];

  rep(i,n+1) rep(j,4) rep(k,4) rep(l,4) dp[i][j][k][l].x = 0;
  dp[0][3][3][3].x = 1;

  // dp[i][j][k][l]
  rep(i,n) {
    rep(j,4) {
      rep(k,4) {
	rep(l,4) {
	  rep(m,4) {
	    if(m == 2) {
	      if((k == 0 && l == 1) || (k == 1 && l == 0) || (j == 0 && k == 1) || (j == 0 && l == 1)) continue;
	    }
	    else if(m == 1) {
	      if(k == 0 && l == 2) continue;
	    }
	    dp[i+1][k][l][m] += dp[i][j][k][l];
	  }
	}
      }
    }
  }

  mint res;
  rep(j,4) rep(k,4) rep(l,4) res += dp[n][j][k][l];
  cout << res.x << "\n";
  
  return 0;
}


Measured memory_bytes: 256
#include <climits>
#include <iostream>
#include <numeric>
#include <vector>

int main() {
  int n;
  std::cin >> n;

  std::vector<int> b(n - 1);
  for (auto&& bi : b) std::cin >> bi;

  std::vector<int> a(n, INT_MAX);
  for (int i = 0; i < n - 1; ++i) {
    if (a[i] > b[i]) a[i] = b[i];
    a[i + 1] = b[i];
  }
  const auto sum = std::accumulate(a.begin(), a.end(), 0);
  std::cout << sum << std::endl;
}

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

using namespace std;

#define IO ios_base::sync_with_stdio(0);cin.tie(0);

int main()
{
  IO;
  int n; cin >> n;
  if (n % 10 == 9 || n / 10 == 9)
  cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
}

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

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define ALL(v) v.begin(),v.end()
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cout<<v[i]<<" "

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<int, int> P;
struct Edge{ll from, to, cost;};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

ll modpow(ll a, ll n, ll mod){
  ll res=1;
  while(n>0){
    if(n&1) res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll modinv(ll a, ll mod){
  return modpow(a, mod-2, mod);
}

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}


/**************************************
** A main function starts from here  **
***************************************/
int main(){
  int N;
  cin >> N;
  llvec v(N,0);
  rep(i, N)cin >>v[i];
  sort(ALL(v), [](ll a, ll b){return a>b;});
  long double ans = 0;
  rep(i, N-1){
    ans += v[i]/pow(2, i+1);
  }
  ans += v[N-1]/pow(2, N-1);

  cout << ans;
  return 0;
}


Measured memory_bytes: 256