akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#include <set>
#include <iterator>
using namespace std;
// using namespace __gnu_pbds;


#define f first
#define s second
#define pb push_back
#define all(x) x.begin(),x.end()

#define ll long long int
#define vi vector<int>
#define vii vector<pair<int,int> >
#define pii pair<int,int>
#define plii pair<pair<ll, int>, int>
#define piii pair<pii, int>
#define viii vector<pair<pii, int> >
#define vl vector<ll>
#define vll vector<pair<ll,ll> >
#define pll pair<ll,ll>
#define pli pair<ll,int>
#define mp make_pair
#define ms(x, v) memset(x, v, sizeof x)
#define pr_vec(v) for(int i=0;i<v.size();i++) cout << v[i] << " " ;

#define f_in(st) freopen(st,"r",stdin)
#define f_out(st) freopen(st,"w",stdout)

#define INF (ll)1e17
#define matrix vector<vector<ll> >

#define fr(i, a, b) for(i=a; i<=b; i++)
#define fb(i, a, b) for(i=a; i>=b; i--)
#define ASST(x, l, r) assert( x <= r && x >= l )
#define maxbits 9
#define maxmask (1ll<<maxbits)
// typedef tree<pll, null_type, less<pll>, rb_tree_tag,
//              tree_order_statistics_node_update>
//     new_data_set;
const int  N=1e6 +10, M=(ll)1e9+1 ;
const int mod =(ll)1e9+7 ,sz=5, MAX=(ll)1e6+10;
string fir="Monocarp",sec="Bicarp";

vll g[N];

ll dist[N],vis[N];

typedef struct {
	ll x;
	ll y;
	ll id;
} pos_id;

bool cmpx(const pos_id& a,const pos_id& b){
	return a.x < b.x;
}


bool cmpy(const pos_id& a,const pos_id& b){
	return a.y < b.y;
}

void mst(ll src){
	for(ll i=1;i<N;i++)
		dist[i]=INF;

	set<pair<ll,ll> > s;

	dist[src]=0;
	s.insert({0,src});
	ll cost=0;

	while(!s.empty()){
		auto x=*(s.begin());
		s.erase(x);
		ll u=x.s;
		ll w=x.f;
		vis[u]=true;

		cost+=w;

		for(auto &it:g[u]){
			if(vis[it.f])
				continue;
			if(dist[it.f] > it.s){
				s.erase({dist[it.f],it.f});
				dist[it.f]=it.s;
				s.insert({it.s,it.f});
			}
		}
	}

	cout << cost ;
	return;
}

void work(){
	ll n;
	cin >> n;
	vector<pos_id> point(n);
	for(ll i=0;i<n;i++){
		ll u,v;
		cin >> u >> v;
		point[i]={u,v,i+1};
	}
	// return;
	sort(point.begin(),point.end(),cmpx);

	ll src;
	for(ll i=1;i<n;i++){
		ll u=point[i].id,v=point[i-1].id,w=point[i].x-point[i-1].x;
		g[u].pb({v,w});
		g[v].pb({u,w});
		src=u;
	}

	sort(point.begin(),point.end(),cmpy);

	for(ll i=1;i<n;i++){
		ll u=point[i].id,v=point[i-1].id,w=point[i].y-point[i-1].y;
		g[u].pb({v,w});
		g[v].pb({u,w});
	}

	mst(src);

}

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


	ll t;
	// cin >> t;
	t=1;
	while(t--){
	        work();
	
	}

	return 0;
}
	

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

ll pow10(int n){
  ll ret = 1;
  int i;
  REP(i,n) ret*=10;
  return ret;
}

int dfs(int cur, int n_3, int n_5, int n_7, ll n){
  if(n>N) return 0;
  int ret0,ret1,ret2,ret3;
  ret0 = (n_3 != 0 && n_5 != 0 && n_7 != 0);
  ret1 = dfs(cur+1,n_3+1,n_5,n_7,n+3*pow10(cur));
  ret2 = dfs(cur+1,n_3,n_5+1,n_7,n+5*pow10(cur));
  ret3 = dfs(cur+1,n_3,n_5,n_7+1,n+7*pow10(cur));
  return ret0 + ret1 + ret2 + ret3;
}

int main(void){
  cin >> N;
  cout << dfs(0,0,0,0,0) << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <set>
#include <sstream>
#include <bitset>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

typedef long long ll;

using namespace std;

int main() {
    
    int n;
    cin >> n;
    string s;
    cin >> s;
    
    int sume=0,sumw=0;
    FOR(i, 0, n){
        if(s[i]=='E'){
            sume++;
        }else{
            sumw++;
        }
    }
    
    vector<int> lw(n,0),re(n,0);
    
    if(s[0]=='E'){
        re[0] = sume-1;
    }else{
        re[0] = sume;
    }
    FOR(i, 1, n){
        if(s[i]=='E'){
            if(s[i-1]=='E'){
                lw[i] = lw[i-1];
                re[i] = re[i-1]-1;
            }else{
                lw[i] = lw[i-1]+1;
                re[i] = re[i-1]-1;
            }
        }else{
            if(s[i-1]=='E'){
                lw[i] = lw[i-1];
                re[i] = re[i-1];
            }else{
                lw[i] = lw[i-1]+1;
                re[i] = re[i-1];
            }
        }
    }
    vector<int> sum(n,0);
    FOR(i, 0, n){
        sum[i] = lw[i] +re[i];
    }
    
    int min = *min_element(sum.begin(),sum.end());
    
    cout << min << endl;
    
    
    return 0;
}


Measured memory_bytes: 4228
#include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
#define ll long long
#define pi pair<int,int>
#define pl pair<ll,ll>
#define pd pair<double,double>
#define ld long double
#define pld pair<ld,ld>
#define lg length()
#define sz size()
#define pb push_back
#define INF 1000000005
#define LINF 1000000000000000005

int n,a[100005][3],dp[100005][3],s[3][2];

int32_t main(){
    ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
    cin >> n;
    s[0][0]=1; s[0][1]=2;
    s[1][0]=0; s[1][1]=2;
    s[2][0]=0; s[2][1]=1;
    for(int i=1;i<=n;i++){
        for(int j=0;j<=2;j++){
            cin >> a[i][j];
            dp[i][j]=max(dp[i-1][s[j][0]],dp[i-1][s[j][1]])+a[i][j];
        }
    }
    cout << max(dp[n][1],max(dp[n][2],dp[n][0]));
}


Measured memory_bytes: 2560
(** val add : int -> int -> int **)

let rec add = ( + )

(** val sub : int -> int -> int **)

let rec sub = ( - )

module Nat =
 struct
  (** val div2 : int -> int **)

  let rec div2 = (fun x -> x / 2)
 end

(** val lower_bound_aux : (int -> bool) -> int -> int -> int **)

let rec lower_bound_aux p_dec x x0 =
  (fun fO fS n -> if n = 0 then fO () else fS (n-1))
    (fun _ ->
    x)
    (fun n0 ->
    if p_dec (add x (Nat.div2 (succ n0)))
    then lower_bound_aux p_dec x (Nat.div2 (succ n0))
    else lower_bound_aux p_dec (add (succ (Nat.div2 (succ n0))) x)
           (sub (succ n0) (succ (Nat.div2 (succ n0)))))
    x0

(** val lower_bound : (int -> bool) -> int -> int -> int **)

let lower_bound p_dec alpha beta =
  lower_bound_aux p_dec alpha (sub beta alpha)

let () =
  let n, a, b = Scanf.scanf "%d %d %d\n" (fun n a b -> n, a, b) in
  let hs = Array.init n (fun _ -> Scanf.scanf "%d\n" (fun h -> h)) in
  lower_bound
    (fun x -> Array.fold_left ( + ) 0 (Array.map (fun h -> max 0 ((h - b * x + a - b - 1) / (a - b))) hs) <= x)
    (Array.fold_left max 0 hs / a)
    ((Array.fold_left max 0 hs + b - 1) / b)
  |> Printf.printf "%d\n"


Measured memory_bytes: 11648
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<deque>


using namespace std;
using ll = long long;


int a, b;
int main(){
  cin >> a >> b;
  int c = 2 * b;
  if(a > c){
    cout << a - c << endl;
  }else{
    cout << 0 << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>]
#include <vector>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

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

    int ans; //(A - 1) * ans >= B -1;
    ans = (B - 1) / (A - 1);
    if ((B - 1) % (A - 1)) {
        ans++;
    }
    cout << ans << endl;

    return 0;
}

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

#define REP(i ,n) for(int i=0 ;i < n; i++)
#define REPB(i ,n) for(int i=n; i >= 0; i--)
#define FOR(i ,m ,n) for(int i=m; i < n; i++)
#define FORB(i, m, n) for(int i=m; i>= n; i--)
#define ll long long
#define pb push_back
#define popb pop_back
#define debug(i) cout << i << endl
using namespace std;
int main(){
  int x, a, b;
  cin >> x >> a >> b;

  string ans = "dangerous";

  if(b <= a) ans = "delicious";
  else if(b <= (a + x)) ans = "safe";

  cout << ans << endl;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
N = int(input())
digit_count = len(str(N))
if digit_count == 1:
    print(N)
elif (digit_count % 2 == 1):
    print(N - int(str(90) * (digit_count//2)))
else:
    total = 0
    for i in range(0, digit_count//2):
        total += 9*(100**i)
    print(total)

Measured memory_bytes: 3064
#include <cmath>
#include <vector>
#include <queue>
#include <iostream>
#include <bits/stdc++.h>
#define lli long long int
#define mp make_pair
#define pb push_back
using namespace std;

const lli mod = 998244353;

lli power(lli x, lli y) {
    // x %= mod;
    if (y == 0) return 1;
    // return ((y % 2 == 1 ? x : 1) * power(x * x, y / 2)) % mod;
    return ((y % 2 == 1 ? x : 1) * power(x * x, y / 2));
}

vector <long long int> primeNumbers;

void SieveOfEratosthenes(int n){
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime));
    for (int p=2; p*p<=n; p++){ 
        if (prime[p] == true) 
        { 
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
    for (int p=2; p<=n; p++){
      if (prime[p]){
        primeNumbers.push_back(p);
      }
    }        
}

#define MAXN 305
// vector < vector < int >  > v(MAXN);
// vector < vector < int >  > vnew(MAXN);
// int visit[MAXN];

int mat[MAXN][MAXN];

// void dfs(int index, int parent){
//   visit[index] = 1;
//   for(int i = 0;i<v[parent].size();i++){
//     int node = v[parent][i];
//     if(visit[node]) continue;
//     else if (!binary_search(v[index].begin(),v[index].end(),node)){
//       visit[node] = 1;
//       dfs(node,index);
//     }
//   }
// }
long long int preval[16];
void pre(){
  preval[0] = 1;
  preval[1] = 10;
  for(int i = 2;i<=15;i++){
    long long int val = (long long int)pow(10,i-1) - 1 + preval[i-1] + 10;
    preval[i] = val;
  }

  // for(int i = 0;i<=14;i++) cout<<preval[i]<<' ';
}

void solve(){
  int n,k;
  cin>>n>>k;
  int h[n];
  for(int i = 0;i<n;i++){
    cin>>h[i];
  }
  int dp[n];
  for(int i = 0;i<n;i++) dp[i] = INT_MAX;
  dp[0] = 0;
  for(int i = 1;i<n;i++){
    for(int j = i-1;j>-1 && j >= i-k;j--){
      dp[i] = min(dp[i],dp[j] + abs(h[i] - h[j]));
    }
  }
  // for(int i = 0;i<n;i++) cout<<dp[i]<<' ';
  //   cout<<endl;
  cout<<dp[n-1];

}
 
 
int main(){
  ios::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
  #ifndef ONLINE_JUDGE
      freopen("input.txt", "r", stdin);
      freopen("output.txt", "w", stdout);
  #endif
 
  int t;
  // cin>>t;
  // scanf("%d",&t);
  t = 1;
  pre();
  while(t--){
    // cout<<
    solve();
 
    if(t>0){
      cout<<endl;
      // printf("\n");
    } 
  }
 
 
  cerr << "Time : " << (double)clock() / (double)CLOCKS_PER_SEC << "s\n";
 
  return 0;
}


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

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

	int a, b;
	string s, t, u;
	cin >> s >> t;
	cin >> a >> b;
	cin >> u;
	if(s == u) {
		cout << a - 1 << " " << b << endl;
	}else if(u == t) {
		cout << a << " " << b - 1 << endl;
	}
}

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

const int N = 200005, S = 1000005, K = 30;

template <class T>
void read(T &x) {
	int sgn = 1;
	char ch;
	x = 0;
	for (ch = getchar(); (ch < '0' || ch > '9') && ch != '-'; ch = getchar()) ;
	if (ch == '-') ch = getchar(), sgn = -1;
	for (; '0' <= ch && ch <= '9'; ch = getchar()) x = x * 10 + ch - '0';
	x *= sgn;
}
template <class T>
void write(T x) {
	if (x < 0) putchar('-'), write(-x);
	else if (x < 10) putchar(x + '0');
	else write(x / 10), putchar(x % 10 + '0');
}

int n, ch[S][K], sz[S], cnt = 0, rt = 0;
string str[N];
char tmp[S];
long long ans = 0ll;

int newnode() {
	int x = ++cnt;
	for (int i = 0; i < K; i++) ch[x][i] = -1;
	sz[x] = 0;
	return x;
}
void insert() {
	int len = strlen(tmp), now = rt;
	for (int i = len - 1; i >= 0; i--) {
		if (ch[now][tmp[i] - 'a'] < 0) ch[now][tmp[i] - 'a'] = newnode();
		now = ch[now][tmp[i] - 'a'];
	}
	sz[now]++;
}

bool exist[K];
int node[S]; 
void update(int id) {
	for (int i = 0; i < K; i++) exist[i] = false;
	int len = str[id].size();
	node[len] = rt;
	for (int i = len - 1; i >= 0; i--) node[i] = ch[node[i + 1]][str[id][i] - 'a'];
	for (int i = 0; i <= len; i++) {
		for (int j = 0; j < K; j++) {
			if (!i || !exist[j]) continue;
			int trans = ch[node[i]][j];
			if (trans >= 0) ans += sz[trans];
		}
		if (i < len) exist[str[id][i] - 'a'] = true;
	}
}
void dfs(int u) {
	ans -= 1ll * sz[u] * (sz[u] + 1) / 2;
	for (int i = 0; i < K; i++) {
		if (~ch[u][i]) dfs(ch[u][i]);
	}
}

int main() {
	read(n);
	rt = newnode();
	for (int i = 0; i < n; i++) {
		scanf("%s", tmp);
		str[i] = string(tmp), insert();
	}
	for (int i = 0; i < n; i++) update(i);
	dfs(rt);
	write(ans), putchar('\n'); 
	return 0;
} 

Measured memory_bytes: 164996
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,a[50],ans=0,max=0;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	for(int i=0;i<n;i++){
		if(max<=a[i]){
			ans++;
			max=a[i];
		}
	}
	cout<<ans<<endl;
  return(0);
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define repd(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) repd(i, 0, n)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}

struct UnionFind
{
    vector<int> par, rank;

    UnionFind(int N) : par(N), rank(N)
    {
        rep(i, N) par[i] = i, rank[i] = 0;
    }

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

    void unite(int x, int y)
    {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry)
            return;
        if (rank[rx] < rank[ry])
        {
            par[rx] = ry;
        }
        else
        {
            par[ry] = rx;
            if (rank[rx] == rank[ry])
                rank[rx]++;
        }
    }

    bool same(int x, int y)
    {
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

typedef pair<int, int> P;

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

    UnionFind load(N), station(N);

    rep(i, K)
    {
        int p, q;
        cin >> p >> q;
        p--;
        q--;
        load.unite(p, q);
    }

    rep(i, L)
    {
        int p, q;
        cin >> p >> q;
        p--;
        q--;
        station.unite(p, q);
    }

    map<P, int> ans;

    rep(i, N) ans[P(load.root(i), station.root(i))]++;
    rep(i, N) cout << ans[P(load.root(i), station.root(i))] << endl;

    return 0;
}


Measured memory_bytes: 15104
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define _repargs(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _repargs(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p = 0) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template

// union find
class union_find {
public:
    int n;
    vector<int> parent, rnk, num;
    
    union_find(int n) : n(n), parent(n), rnk(n, 0), num(n, 1) {rep(i, n) parent[i] = i; }
    
    int root(int x){ return (parent[x] == x) ? x : root(parent[x]); }
    
    void unite(int x, int y){
        x = root(x);
        y = root(y);
        if (x == y) {
            return;
        }
        if (rnk[x] < rnk[y]) {
            parent[x] = y;
            num[y] += num[x];
        }
        else{
            parent[y] = x;
            num[x] += num[y];
            if (rnk[x] == rnk[y]) {
                rnk[x]++;
            }
        }
        n--;
    }
    
    bool same(int x, int y) {return root(x) == root(y);}
    
    int count(int x){ return num[root(x)]; }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    int N, M;
    cin >> N >> M;
    vector<vector<int>> L(N);
    union_find uf(M);
    rep(i, N){
        int K;
        cin >> K;
        vector<int> A(K);
        rep(j, K) cin >> A[j], A[j]--;
        L[i] = A;
        rep(j, 1, K){
            uf.unite(A[j - 1], A[j]);
        }
    }
    
    vector<int> cnt(M);
    
    rep(i, N){
        cnt[uf.root(L[i][0])]++;
    }
    
    rep(i, M){
        if(cnt[i] == N){
            output("YES");
            return 0;
        }
    }
    output("NO");
    
    
    
    return 0;
}

Measured memory_bytes: 7296
#include <stdio.h>
#include <string.h>
#include <math.h>

int main(void){
        int a, b;
        scanf("%d %d", &a, &b);
        int n, x;
        n = b - a;
        x = (1 + n) * n / 2     ;
        printf("%d\n",x-b);
}


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

int main()
{
    string s;
    cin >> s;
    deque<char> dS(s.size());
    for (int i = 0; i < s.size(); i++) dS[i] = s[i];

    int Q;
    cin >> Q;

    int rev = 0;

    for (int i = 0; i < Q; i++)
    {
        int t;
        cin >> t;
        if (t == 2)
        {
            int f;
            char c;
            cin >> f >> c;
            --f;
            if (rev) f = 1 - f;
            if (f == 0)
            {
                dS.push_front(c);
            }
            else
            {
                dS.push_back(c);
            }
        }
        else
        {
            rev = 1 - rev;
        }
    }
    if (rev) reverse(dS.begin(), dS.end());
    for (auto c : dS) cout << c;
    cout << endl;

    return 0;
}


Measured memory_bytes: 4028
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author dyominov
 */
public class Main {
  public static void main(String[] args) {
    InputStream inputStream = System.in;
    OutputStream outputStream = System.out;
    InputReader in = new InputReader(inputStream);
    PrintWriter out = new PrintWriter(outputStream);
    BFrog2 solver = new BFrog2();
    solver.solve(1, in, out);
    out.close();
  }

  static class BFrog2 {
    public void solve(int testNumber, InputReader in, PrintWriter out) {
      int n = in.nextInt();
      int k = in.nextInt();
      int[] arr = new int[n];
      for (int i = 0; i < n; i++) {
        arr[i] = in.nextInt();
      }
      int[] dp = new int[n];
      Arrays.fill(dp, Integer.MAX_VALUE);
      dp[0] = 0;
      dp[1] = Math.abs(arr[1] - arr[0]);
      for (int i = 1; i < n; i++) {
        for (int j = i - 1; j >= Math.max(0, i - k); j--) {
          dp[i] = Math.min(dp[i], dp[j] + Math.abs(arr[i] - arr[j]));
        }
      }
      out.println(dp[n - 1]);
    }

  }

  static class InputReader implements AutoCloseable {
    private BufferedReader reader;
    private StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
      //reader = new BufferedReader(new FileReader(stream), 32768);
      reader = new BufferedReader(new InputStreamReader(stream), 32768);
      tokenizer = null;
    }

    public String next() {
      while (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          tokenizer = new StringTokenizer(reader.readLine());
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
      return tokenizer.nextToken();
    }

    public int nextInt() {
      return Integer.parseInt(next());
    }

    public void close() {
    }

  }
}



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

int main() {
    int N,M;
    cin >>N>>M;
    vector<int>dataL(M);
    vector<int>dataR(M);
    for(int i=0;i<M;i++)cin >>dataL[i]>>dataR[i];
    sort(dataR.begin(),dataR.end());
    sort(dataL.begin(),dataL.end());
    reverse(dataL.begin(),dataL.end());
    int a= dataR[0]-dataL[0];
    if(a<0)cout<<0<<endl;
    else cout<<a+1<<endl;

}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rea(i, a, b) for (int i = (a); i < (b); i++)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((int)(x).size())
#define PRINT(V) for (auto v:(V)) {cerr << v << " ";} cerr << endl
#define dump(x) cerr << #x << " : " << (x) << endl
#define dump2(x, y) cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")" << endl
inline ll GCD(ll a, ll b){return b ? GCD(b, a % b) : a;}
const ll MOD = 1000000007;
const ll INF = 100000000000000000LL;
/* END OF TEMPLATE */

vll prime{2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997};
unordered_map<ll, ll> p;

void divcount(ll n){
    for(auto i: prime){
        ll m = n;
        while(m % i == 0){
            p[i]++;
            m /= i;
        }
    }
}

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    for(auto i: prime){
        p[i] = 0;
    }
    ll n;
    cin >> n;
    if(n == 1){
        cout << 1 << endl;
        return 0;
    }
    rea(i, 2, n+1){
        divcount(i);
    }
    ll ans = 1;
    for(auto i: prime){
        //dump2(i, p[i]);
        ans *= (p[i]+1);
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import collections

n = int(input())
V = list(map(int, input().split()))


V_e = V[1::2]
V_o = V[::2]

dic_e = collections.Counter(V_e)
dic_o = collections.Counter(V_o)

e_items = (sorted(dic_e.items(), key=lambda x: -x[1]))[:2]
o_items = (sorted(dic_o.items(), key=lambda x: -x[1]))[:2]



# dic_o を優先

tar_key_o = o_items[0][0]

if e_items[0][0] != tar_key_o:
    ans_o = (n//2 - e_items[0][1]) + (n//2 - o_items[0][1])

elif len(e_items) > 1 and e_items[1][0] != tar_key_o:
    ans_o = (n//2 - e_items[0][1]) + (n//2 - o_items[1][1])
else:
    ans_o = (n//2 - e_items[0][1]) + (n//2)

# dic_o を優先

tar_key_e = e_items[0][0]

if o_items[0][0] != tar_key_e:
    ans_e = (n//2 - o_items[0][1]) + (n//2 - e_items[0][1])

elif len(o_items) > 1 and o_items[1][0] != tar_key_e:
    ans_e = (n//2 - o_items[0][1]) + (n//2 - e_items[1][1])
else:
    ans_e = (n//2 - o_items[0][1]) + (n//2)



ans = min(ans_e,ans_o)
#print(ans_o,ans_e)
print(ans)


Measured memory_bytes: 19040
i = list(map(int, input().split()))

while (i[0] > 0 or i[2] > 0):
	i[2] = i[2] - i[1]
	if (i[2] <= 0):
		print('Yes')
		break
	i[0] = i[0] - i[3]
	if (i[0] <= 0):
		print('No')
		break
	

Measured memory_bytes: 9164
package main

import "fmt"

import "math"

func min(a int, b int) int {
	if a <= b {
		return a
	} else {
		return b
	}
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func main() {
	var n int
	fmt.Scan(&n)
	h := make([]int, n+2)
	dp := make([]int, n+2)

	for i := 0; i < n; i++ {
		fmt.Scan(&h[i])
	}

	for i := 1; i < n; i++ {
		dp[i] = int(math.Pow(10, 9))
	}

	for i := 0; i < n-1; i++ {
		dp[i+1] = min(dp[i]+abs(h[i]-h[i+1]), dp[i+1])
		dp[i+2] = min(dp[i]+abs(h[i]-h[i+2]), dp[i+2])
	}

	fmt.Println(dp[n-1])
}


Measured memory_bytes: 5504
#include <bits/stdc++.h>
using namespace std; 
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int N, K; cin >> N >> K; 
	int P[1010] = {}; 
	for(int i = 0; i < N; i++) cin >> P[i]; 
	sort(P, P + N); 
	int ans = 0; 
	for(int i = 0; i < K; i++) ans += P[i]; 
	cout << ans << "\n"; 
}


Measured memory_bytes: 3600
n=int(input())
import math
ans=10**40
for i in range(1,n//2+1):
	x=i
	y=n-i
	p=0
	for j in range((int(math.log(x,10)+10**-7)+1)):
		p+=x%10
		x=x//10
	for j in range((int(math.log(y,10)+10**-7)+1)):
		p+=y%10
		y=y//10
	ans=min(ans,p)
print(ans)



Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {

    private static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {

        int A = readInt();
        int B = readInt();
        int C = readInt();

        int K = readInt();

        int BIG = Math.max(A, Math.max(B, C));

        int ans;

        K = (int) Math.pow((double)2, (double)K);

        if(A == BIG){
            ans = A*K + B + C;
        }else if(B == BIG){
            ans = A + B*K + C;
        }else{
            ans = A + B + C*K;
        }

        System.out.println(ans);


    }

    private static int readInt(){
        return Integer.parseInt(sc.next());
    }

    private static long readLong(){
        return Long.parseLong(sc.next());
    }

}


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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX

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

ll add(ll pre, string s){
  ll ret = stol(s);
  REP(i, 1, s.size()){
    ll tmp = stol(s.substr(0, i));
    ret += (pre + tmp + add(pre + tmp, s.substr(i)));
  }

  return ret;
}

int main(){


  string s;
  cin >> s;

  cout << add(0, s) << endl;


  return 0;
}


Measured memory_bytes: 256
import math

N = int(input())
CSF = [()]
for _ in range(N-1):
    CSF.append(tuple(map(int, input().split())))
#print(CSF)

for start in range(1, N):
    time = CSF[start][0] + CSF[start][1]
    for transit in range(start+1, N):
        temp = math.ceil(time / CSF[transit][2]) * CSF[transit][2]
        time = max(temp, CSF[transit][1]) + CSF[transit][0]
    print(time)
print(0)


Measured memory_bytes: 42972
#include <bits/stdc++.h>
using namespace std;
using ull = unsigned long long;

int main() {
	int n;
	
	cin >> n;
	
	ull lm = 0, rm = 0;
	vector<ull> v;
	for(int i=0;i<n;i++){
		ull tmp;
		cin >> tmp;
		v.push_back(tmp);
	}
	ull max = *max_element(v.begin(), v.end());
	ull cand = 0;
	for(int i=0;i<n;i++){
		if(v[i] != max && abs(v[i]-max/2.0) < abs(cand-max/2.0)){
			cand=v[i];
		}
	}
	
	cout << max << " " << cand << endl;
	
	return 0;
}

Measured memory_bytes: 1400
<?php
class Path {
    var $sum;
    function __construct() {
        $this->sum = array_pad(array(), 4, 0);
        for ($i = 0; $i < 3; $i++) {
            fscanf(STDIN, "%d %d", $a, $b);
            $this->sum[$a - 1]++;
            $this->sum[$b - 1]++;
        }
        
    }
    function __invoke() {
        sort($this->sum);
        $str = implode("", $this->sum);
        echo $str === '1122' ? 'YES' : 'NO';
    }
}

$Path = new Path();
$Path();


Measured memory_bytes: 4728
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef struct {
    int ID;
    int U;
    int A;
    int P;
    int score;
} DATA;

int comp(const void *a, const void *b)
{
    int score;
    
    score = (*(DATA *)b).score - (*(DATA *)a).score;

    if (score != 0){
        return (score);
    }
    return ((*(DATA *)a).ID - (*(DATA *)b).ID);
}


int main(void)
{
    int n;
    int u[1001];
    DATA team[300];
    int i;
    int teams;
    
    while (1){
        memset(u, 0, sizeof(u));

        scanf("%d", &n);
        if (n == 0){
            break;
        }
        
        for (i = 0; i < n; i++){
            scanf("%d%d%d%d", &team[i].ID, &team[i].U, &team[i].A, &team[i].P);
            
            team[i].score = team[i].A * 1000000 + 100000 - team[i].P;
        }
        
        qsort(team, n, sizeof(DATA), comp);
#if 0
        for (i = 0; i < n; i++){
            printf(":%d %d %d %d %d\n", team[i].ID, team[i].U,team[i].A,team[i].P,team[i].score);
        }
#endif        
        teams = 0;
        for (i = 0; i < n; i++){
            if (teams < 10){
                if (u[team[i].U]++ < 3){
                    printf("%d\n", team[i].ID);
                    teams++;
                }
            }
            else if (teams < 20){
                if (u[team[i].U]++ < 2){
                    printf("%d\n", team[i].ID);
                    teams++;
               }
            }
            else if (teams < 26){
                if (u[team[i].U]++ < 1){
                    printf("%d\n", team[i].ID);
                    teams++;
                }
            }
        }
    }
    
    return (0);
}



Measured memory_bytes: 2044
#include <bits/stdc++.h>
//#include <ext/numeric>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#define oo 0x3f3f3f3f
#define OO 0x3f3f3f3f3f3f3f3f
#define popcount(n) __builtin_popcount(n)
#define popcountll(n) __builtin_popcountll(n)

using namespace std;
//using namespace __gnu_cxx;
using namespace __gnu_pbds;
template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef pair<int, int> ii;
typedef pair<long long, pair<int, int>> iii;
typedef pair<ii, ii> iiii;

const double PI = acos(-1.0), EPS = 1e-6;
const int N = 200005, M = 100005, mod = 998244353 , mxLog = 20;


int main() {
#ifndef ONLINE_JUDGE
//    freopen("input.txt", "rt", stdin);
//    freopen("output.txt", "w", stdout);
#endif
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0), cout.precision(6), cout << fixed;

    int n;
    cin >> n;
    int gcd = 0;
    for (int i = 0; i < n; ++i) {
        int x;
        cin >> x;
        gcd = __gcd(gcd, x);
    }

    cout << gcd << '\n';


    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; (i) < (int)(n); ++ (i))
#define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++ (i))
#define ALL(x) begin(x), end(x)
using namespace std;

template <int32_t MOD>
struct mint {
    int32_t value;
    mint() : value() {}
    mint(int64_t value_) : value(value_ < 0 ? value_ % MOD + MOD : value_ >= MOD ? value_ % MOD : value_) {}
    inline mint<MOD> operator + (mint<MOD> other) const { int32_t c = this->value + other.value; return mint<MOD>(c >= MOD ? c - MOD : c); }
    inline mint<MOD> & operator += (mint<MOD> other) { this->value += other.value; if (this->value >= MOD) this->value -= MOD; return *this; }
};

constexpr int MOD = 1e9 + 7;
mint<MOD> solve(int n, int m, vector<int> a) {
    vector<bool> b(n + 1);
    for (int a_i : a) {
        b[a_i] = true;
    }
    vector<mint<MOD> > dp(n + 1);
    dp[0] = 1;
    if (not b[1]) {
        dp[1] = 1;
    }
    REP3 (i, 2, n + 1) if (not b[i]) {
        dp[i] = dp[i - 1] + dp[i - 2];
    }
    return dp[n];
}

int main() {
    int n, m; cin >> n >> m;
    vector<int> a(m);
    REP (i, m) {
        cin >> a[i];
    }
    cout << solve(n, m, a).value << endl;
    return 0;
}


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
ll T[1010],A[1010];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	
	ll X=1,Y=1;
	FOR(i,N) {
		cin>>T[i]>>A[i];
		ll a = (X+T[i]-1)/T[i]*T[i];
		if(a/T[i]*A[i]>=Y) {
			X=a;
			Y=a/T[i]*A[i];
		}
		else {
			Y = (Y+A[i]-1)/A[i]*A[i];
			X=Y/A[i]*T[i];
		}
	}
	cout<<X+Y<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    vector<int> v(5);
    for (int i = 0; i < 5; i++)
    {
        scanf("%d", &v[i]);
    }

    int ans = (int)1e9 + 7;
    do
    {
        int tmp_ans = 0;
        for (int i = 0; i < 4; i++)
        {
            tmp_ans += v[i];
            if (tmp_ans % 10 != 0)
            {
                tmp_ans = (tmp_ans / 10 + 1) * 10;
            }
        }
        tmp_ans += v[4];
        ans = min(tmp_ans, ans);
    } while (next_permutation(v.begin(), v.end()));

    printf("%d\n", ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
#define rep(i,n) for (ll i = 0; i < (ll)(n); ++i)
#define rrep(i,j,n) for(ll i = (ll)(j); i < (ll)(n); i++)
#define mrep(i,n) for (ll i = (ll)(n-1); i > 0; i--)
#define be(v) (v).begin(), (v).end()
#define scout cout << fixed << setprecision(20) 
ll INF = 1LL << 60;
ll mod = 1e9 + 7;

int main() {
	int a,b,c; cin >> a >> b >> c;
	int n=max(a,max(b,c));
	if(n==a) cout << a*10+b+c << endl;
	else if(n==b) cout << b*10+a+c << endl;
	else cout << c*10 + a + b << endl;
}

Measured memory_bytes: 3592
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
    int n, k;
    long long ans = 0;
    cin >> n >> k;
    if (k > 0) {
        for (int b = k + 1; b <= n; b++) {
            ans += 1ll * (n / b) * (b - k) + max(0ll, 1ll + n % b - k);
        }
    } else {
        ans = 1ll * n * n;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<cstdio>

int main() {
    for(;;) {
    int x,y;
    scanf("%d %d",&x,&y);
    if(x == 0 && y == 0) {
        break;
    }
    else if(x <= y) {
        printf("%d %d\n",x,y);
    }
    else if(x >= y) {
        printf("%d %d\n",y,x);
    }
    }
    return 0;
}


Measured memory_bytes: 2656
import sys
from collections import deque

sys.setrecursionlimit(10**7)

V, E = map(int, input().split())
G = [[] for _ in range(V)]

for _ in range(E):
    s, t = map(int, input().split())
    G[s].append(t)

visited = [0]*V
ans = deque([])

def dfs(u):
    visited[u] = 1
    for i in G[u]:
        if visited[i] == 0:
                dfs(i)
    ans.appendleft(u)

for s in range(V):
    if visited[s] == 0:
        dfs(s)

for a in ans:
    print(a)


Measured memory_bytes: 9204
def main():
  a = int(input())
  b = int(input())
  c = int(input())
  d = int(input())
  e = int(input())
  k = int(input())

  counter = False
  antena = [a,b,c,d,e]
  for i in range(len(antena)-1):
    p = antena[i]
    for j in range(i, len(antena)):
      q = antena[j]
      if (q-p) > k:
        counter = True
    
  if counter:
    print(':(')
    
  else:
    print('Yay!')
    

main()

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

int main() {
  int n, m;
  cin >> n >> m;
  vector<pair<int, pair<int, int>>> a(m);
  vector<int> cnt(n + 1, 0);
  rep(i,m){
    cin >> a[i].second.first >> a[i].first;
    a[i].second.second = i;
  }
  sort(a.begin(), a.end());
  vector<pair<int, string>> ans(m);
  rep(i,m){
    cnt[a[i].second.first]++;
    stringstream ss;
    //0埋め
    ss << setw(6) << setfill('0') << a[i].second.first;
    ss << setw(6) << cnt[a[i].second.first];
    ans[i].first = a[i].second.second;
    ans[i].second = ss.str();
  }
  sort(ans.begin(), ans.end());
  rep(i, m) cout << ans[i].second << endl;
}

Measured memory_bytes: 11136
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<typename Q_temp>
using smaller_queue = priority_queue <Q_temp, vector<Q_temp>, greater<Q_temp> >;

const ll MOD = (ll) 998244353;
const int INF = (int) 1e9;
const ll LINF = (ll) 4e18;
const double PI = acos(-1.0);

#define REP(i,m,n) for(ll i = m; i < (ll)(n); ++i)
#define rep(i,n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbg2(x_) for(auto a_ : x_) cerr << a_ << " "; cerr << endl;
#define dbg3(x_ , sx_) rep(i, sx_) cerr << x_[i] << " "; cerr << endl;
vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

inline ll CEIL(ll a, ll b) {
    return (a + b - 1) / b;
}

void finish() {
    cout << -1 << endl;
    exit(0);
}

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(20) << setiosflags(ios::fixed);
    int n;
    cin >> n;
    int d[201][201];
    int V[201];
    rep(i, n) V[i] = -1;
    vector<int> E[201];

    rep(i, n) rep(j, n) {
        char c;
        cin >> c;
        if (c == '0') d[i][j] = (i == j ? 0 : INF);
        else {
            d[i][j] = 1;
            E[i].push_back(j);
        }
    }

    //二部グラフかどうか判定(BFS)
    queue<int> que;
    que.push(0);
    V[0] = 0;
    while (!que.empty()) {
        int q = que.front();
        que.pop();
        for (auto to : E[q]) {
            if (V[to] == -1) {
                V[to] = !V[q];
                que.push(to);
            } else if (V[to] == V[q]) {
                finish();
            }
        }
    }

    rep(k, n) rep(i, n) rep(j, n) {
        d[i][j] = min(d[i][k] + d[k][j], d[i][j]);
    }

    int ans = 0;
    rep(i, n) rep(j, n) ans = max(ans, d[i][j]+1);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 640
#include <algorithm>
#include <cstdint>
#include <iostream>
#include <vector>

using namespace std;

int dot(const vector<int>& as, const vector<int>& bs, int c)
{
    int ans = c;
    for (int i = 0; i < as.size(); i++)
    {
        ans += as[i] * bs[i];
    }
    return ans;
}

int main()
{
    int n, m, c;
    cin >> n >> m >> c;
    vector<int> bs(m);
    for (auto& b : bs)
    {
        cin >> b;
    }
    vector<vector<int>> as(n);
    for (auto& a : as)
    {
        a.resize(m);
        for (auto& aa : a)
        {
            cin >> aa;
        }
    }
    int ans = 0;
    for (int i = 0; i < n; i++)
    {
        if (dot(as[i], bs, c) > 0)
        {
            ans++;
        }
    }
    cout << ans << endl;
}

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

int main(){
    stack<int> s;
    stack<pair<int, int> > t;
    char c;
    int cnt = 0;
    int A = 0;
    int x;
    while(cin >> c){
        cnt++;
        if (c == '\\'){
            s.push(cnt);
        }
        else if (c == '/')
        {
            if (s.empty()) continue;
            else{
                x = 0;
                while (t.empty() == false && s.top() < t.top().first)
                {
                    x += t.top().second;
                    t.pop();
                }
                
                t.push(make_pair(s.top(), cnt - s.top() + x));
                A += cnt - s.top();
                s.pop();
                
            }
        }   
    }
    cout << A << endl;
    cout << t.size();
    stack<int> reverse;
    while(!t.empty()){
        reverse.push(t.top().second);
        t.pop();
    }
    while (!reverse.empty())
    {
        cout << " " << reverse.top();
        reverse.pop();
    }
    cout << endl;
}


Measured memory_bytes: 3160
#C - Attack Survival
N,K,Q = map(int,input().split())
A = list(int(input()) for i in range(Q))
score = [0]*(N)
for i in range(Q):
    score[A[i]-1] += 1
score = [(K-Q+j) for j in score]
for k in score:
    if k > 0:
        print('Yes')
    else:
        print('No')

Measured memory_bytes: 87208
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		sc.close();

		int ret = -1;
		for ( int i = 0 ; i <= 1100; i++ ) {
			if ( i * 8 / 100 == A && i * 10 / 100 == B ) {
				ret = i;
				break;
			}
		}
		System.out.println(ret);
	}
}


Measured memory_bytes: 22740
#include <cstdio>
int a,b,c;
int main() {
    scanf("%d%d%d",&a,&b,&c);
    if ((a==5&&b==7&&c==5)||(a==7&&b==5&&c==5)||
        (a==5&&b==5&&c==7))
        puts("YES");
    else 
        puts("NO");
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
using namespace std;
 
int main(void){
    int a, b;
    string op;

    while (cin >> a >> op >> b, op != "?")
        if (op == "+") cout << a + b << endl;
        else if (op == "-") cout << a - b << endl;
        else if (op == "*") cout << a * b << endl;
        else if (op == "/") cout << a / b << endl;
}

Measured memory_bytes: 1204
use std::cmp::{max, min};
fn main() {
    let v = read_vec::<i32>();
    let w = v[0];
    let h = v[1];
    let n = v[2];
    let xya = read_vec2::<i32>(n as u32);

    let mut x1 = 0;
    let mut y1 = 0;
    let mut x2 = w;
    let mut y2 = h;

    for p in xya {
        match p[2] {
            1 => x1 = max(p[0], x1),
            2 => x2 = min(p[0], x2),
            3 => y1 = max(p[1], y1),
            _ => y2 = min(p[1], y2),
        }
    }

    if x1 >= x2 || y1 >= y2 {
        println!("0");
    } else {
        println!("{}", (x2 - x1) * (y2 - y1));
    }
}

#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
#[allow(dead_code)]
fn yn(result: bool) {
    if result {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 4352
import numpy as np
from numba import *


N = int(input())
length = np.array(input().split(), np.int64)


length = np.sort(length)


def calc(length):
    cnt = 0
    
    for i in range(N):
        for j in range(i + 1, N):
            for k in range(j + 1, N):
                l1, l2, l3 = length[i], length[j], length[k]
                if (l1 != l2 and l1 != l3 and l2 != l3):
                    if (l1 + l2 > l3):
                        cnt += 1
    
    return (cnt)

ans = calc(length)
print(ans)


Measured memory_bytes: 91748
#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];
		
	int ans = 0;
	while (true) {

		bool even = true;
		for (int i = 0; i < n; i++) {

			if (a[i] % 2 != 0) even = false;
			a[i] /= 2;
			
		}
		if (!even) break;	
		ans++;
	}
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
int main(){
  int n,m; cin>>n>>m;
  vector<P> v;
  for(int i=0; i<m; ++i){
    int a,b; cin>>a>>b;
    v.push_back(P(b-1,a-1));
  }
  sort(v.begin(), v.end());
  set<int> remove_bridge;
  int ret=0;
  for(int i=0; i<m; i++){
    bool meet_needs =false;
    for(set<int>::iterator it=remove_bridge.begin(); it != remove_bridge.end(); ++it){
      if( *it >= v[i].second && *it+1 <= v[i].first){
        meet_needs = true; break;
      }
    }
    if( meet_needs) continue;
    else{
      remove_bridge.insert(v[i].first-1);
      ++ret;
    }
  }
  cout<<ret<<endl;
  return 0;
}

Measured memory_bytes: 1400
import sys
from operator import itemgetter
from collections import deque


scan = sys.stdin.readline


def main():
  n, m = map(int, scan().rstrip().split())
  a = list(map(int, scan().rstrip().split()))
  operations = [tuple(map(int, scan().rstrip().split())) for _ in range(m)]
  
  a.sort()
  operations.sort(key=itemgetter(1), reverse=True)
  
  a = deque(a)
  
  for b, c in operations:
    count = 0
    while count < b:
      if a[0] < c:
        a.append(c)
        count += 1
        a.popleft()
      else:
        print(sum(a))
        exit(0)

  print(sum(a))
  

if __name__ == "__main__":
  main()


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

#define ln                '\n'
#define all(dat)           dat.begin(), dat.end()
#define loop(i, to)        for (int i = 0; i < to; ++i)
#define cont(i, to)        for (int i = 1; i <= to; ++i)
#define circ(i, fm, to)    for (int i = fm; i <= to; ++i)
#define foreach(i, dat)    for (__typeof(dat.begin()) i = dat.begin(); i != dat.end(); ++i)

typedef long long          num;

using namespace std;

num n, ans;

int main() {
	ios::sync_with_stdio(0);
	cin >> n;
	for (int k = 0; n; n >>= 1, ++k) {
		ans += 1LL << k;
	}
	cout << ans << ln;
}

Measured memory_bytes: 256
#include <stdio.h>

#define MAX_NUM 1000000

int find(int num)
{
  int i;

  if(num < 2)
    return 0;
  else if(num == 2)
    return 1;

  if(num % 2 == 0)
    return 0;

  for(i = 3;  i * i <= num; i+=2)
    if(num % i == 0)
      return 0;

  return 1;
}

int main()
{
  int i;
  int n;
  int sum;
  int list[MAX_NUM] = {};

  for(i = 0; i < MAX_NUM; i++)
    if(find(i))
      list[i] = 1;

  while(scanf("%d", &n) != EOF)
    {
      sum = 0;
      for(i = 0; i <= n; i++)
	if(list[i])
	  sum++;

      printf("%d\n", sum);
    }

  return 0;
}

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

int N, num;

int main()
{
    cin >> N;

    while(N>0)
        if(N<6)
        {
            if(N>=3)
            {
                num++;
                break;
            }
            else
                break;
        }
        else
            N-=3, num++;

    cout << num;
    return 0;
}

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

int main() {
    int K, A, B;

    cin >> K >> A >> B;

    int l = A/K + (A%K == 0 ? 0 : 1);
    int r = B/K;

    if (l > r)
        cout << "NG\n";
    else
        cout << "OK\n";
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
#include<atcoder/all>

using namespace std;
using namespace atcoder;

int main(){
    long long N,D;
    cin>>N>>D;
    long long X[N],Y[N];
    for(int i=0;i<N;i++){
        cin>>X[i]>>Y[i];
    }

    two_sat ts(N);
    for(int i=0;i<N;i++){
        for(int j=i+1;j<N;j++){
            long long pat1=abs(X[i]-X[j]);
            long long pat2=abs(X[i]-Y[j]);
            long long pat3=abs(Y[i]-X[j]);
            long long pat4=abs(Y[i]-Y[j]);
            //cout<<i<<","<<j<<"---"<<pat1<<","<<pat2<<","<<pat3<<","<<pat4<<","<<D*D<<endl;
            if(pat1<D) ts.add_clause(i,true,j,true);
            if(pat2<D) ts.add_clause(i,true,j,false);
            if(pat3<D) ts.add_clause(i,false,j,true);
            if(pat4<D) ts.add_clause(i,false,j,false);
        }
    }

    if(ts.satisfiable()){
        cout<<"Yes"<<endl;
        vector<bool> v=ts.answer();
        for(int i=0;i<v.size();i++){
            if(!v[i]) cout<<X[i]<<endl;
            else cout<<Y[i]<<endl;
        }
    }
    else cout<<"No"<<endl;
}


Measured memory_bytes: 3760
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <queue>
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cassert>
#include <cctype>  // std::islower(), std::isupper(), std::tolower, std::toupper
#include <iomanip> // std::std::setprecision(X)
#include <limits>  //std::numeric_limits<int>::max(), min()

typedef long long ll;

int main (void) {

  int M; std::cin >> M;
  std::cout << 48-M << std::endl;
  return 0;
}


Measured memory_bytes: 256