akhauriyash/Code-Regression huggingface dataset:
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;


int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(12);


    int n;
    cin >> n;
    vector<long long> A(n + 1);
    for (int i = 0; i <= n; ++i) {
        cin >> A[i];
    }

    vector<long long> mins(n + 2, 0);
    mins[n] = A[n]; 
    for (int i = n - 1; i >= 0; --i) {
        mins[i] = (mins[i + 1] + 1) / 2 + A[i];
        // cout << i << " :: " << mins[i] << endl;
    }

    bool ok = true;
    for (int i = 0; i <= n; ++i) {
        long long MAX = 1LL << min(i, 61);
        if (mins[i] > MAX) {
            ok = false;
            break;
        }
    }
    vector<long long> sums(n + 2, 0);
    for (int i = 0; i <= n; ++i) {
        sums[i + 1] = sums[i] + A[i];
    }

    if (ok) {
        long long res = 0;
        long long cnt = 1;
        res += 1;
        if (A[0] > 0) {
            assert(A[0] == 1);
            cnt -= 1;
        }
        for (int i = 1; i <= n; ++i) {
            res += A[i];
            long long ncnt = cnt * 2 - A[i];
            cnt = min(ncnt, sums[n + 1] - sums[i + 1]);
            res += cnt;
        }
        cout << res << '\n';
    } else {
        cout << -1 << '\n';
    }

    return 0;
}

Measured memory_bytes: 5544
#include <iostream>
#include <numeric>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
int Max(int(a), int(b), int(c)) {
	return max(max(a, b), c);
}
int Min(int(a), int(b), int(c)) {
	return min(min(a, b), c);
}





int main() {

	ll an = 0;
	ll N;
	cin >> N;
	vector<ll> a(N);

	rep(i, N) {
		cin >> a.at(i);
	}
	rep(i, N - 1) {
		if (a.at(i) == a.at(i + 1)) {
			a.at(i + 1) = -1;
			an++;
		}
	}
	cout << an << endl;


}

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

#define fi first
#define se second
#define mkp std::make_pair

typedef std::pair <int, int> pii;

const int kN = 1e5 + 5;

int n, fa[kN];
std::queue <pii> que;
std::set <int> E[kN];
std::map <int, int> cnt[kN];
int Find(int x) { return fa[x] == x ? x : fa[x] = Find(fa[x]); }
bool Merge(int u, int v) {
	u = Find(u), v = Find(v);
	if(u == v) return false;
	if(E[u].size() < E[v].size()) std::swap(u, v);
	for(auto i : E[v]) if(i != u) {
		E[u].insert(i); ++cnt[u][i];
		if(cnt[u][i] >= 2) que.push(mkp(u, i));
		E[i].erase(v); --cnt[i][v];
		E[i].insert(u); ++cnt[i][u];
	}
	fa[v] = u;
	return true;
}
bool Solve() {
	int res = n - 1;
	while(!que.empty()) {
		pii cur = que.front(); que.pop();
		res -= Merge(cur.fi, cur.se);
	}
	return !res;
}

int main() {
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i) fa[i] = i;
	for(int i = 1; i < 2 * n - 1; ++i) {
		int u, v; scanf("%d%d", &u, &v);
		E[u].insert(v); E[v].insert(u);
		++cnt[u][v]; ++cnt[v][u];
		if(cnt[u][v] >= 2) {
			que.push(mkp(u, v));
		}
	}
	printf(Solve() ? "YES\n" : "NO\n");
	return 0; 
}

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

using namespace std;

bool aaaaa[1000000000];

int main(){
	int n, q;
	int number = 0;
	vector<int> fsr; //最初の数列
	cin >> n;

	for(int i = 1; i <= n; i++){
		int a;
		cin >> a;
		aaaaa[a] = true;
	}

	cin >> q;
	for(int i = 1; i <= q; i++){
		int a;
		cin >> a;
		if(aaaaa[a])
			number++;
	}

	cout << number << "\n";
}


Measured memory_bytes: 6344
import sys
input = sys.stdin.readline

def main():
    c11, c12, c13 = map(int, input().split())
    c21, c22, c23 = map(int, input().split())
    c31, c32, c33 = map(int, input().split())
    ans = "No"
    for a1 in range(0, min([c11, c12, c13]) + 1):
        b1 = c11 - a1
        b2 = c12 - a1
        b3 = c13 - a1
        a2 = c21 - b1
        a3 = c31 - b1
        if c22 == a2 + b2 and c23 == a2 + b3 and c32 == a3 + b2 and c33 == a3 + b3:
            ans = "Yes"
            break
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
<?php
  list($n, $m, $c) = explode(" ", trim(fgets(STDIN)));
  $b = explode(" ", trim(fgets(STDIN)));
  $ans = 0;
  for($i=0; $i<$n; $i++){
    $a = explode(" ", trim(fgets(STDIN)));
    $sum = 0;
    for($j=0; $j<$m; $j++){
      $sum+=$a[$j]*$b[$j];
    }
    if($sum + $c > 0){
      $ans ++;
    }
  }

  echo $ans;

Measured memory_bytes: 16160
#include "bits/stdc++.h"
#pragma GCC optimize("Ofast")

// Begin {{{
using namespace std;

#ifndef DEBUG
#define dump(...)
#endif

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class T>
inline vector<T> make_v(const T &initvalue, intmax_t sz) {
    return vector<T>(sz, initvalue);
}

template <class T, class... Args>
inline auto make_v(const T &initvalue, intmax_t sz, Args... args) {
    return vector<decltype(make_v<T>(initvalue, args...))>(sz, make_v<T>(initvalue, args...));
}

constexpr int INF = 0x3f3f3f3f;
constexpr int64_t LINF = 0x3f3f3f3f3f3f3f3fLL;
// }}} End

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int m1, d1, m2, d2; cin >> m1 >> d1 >> m2 >> d2;
    cout << (m1 != m2 ? 1 : 0) << "\n";

    return 0;
}


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

int main() {
#ifdef LOCAL_EXEC
//    freopen("sample.in", "r", stdin);
#else
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#endif

  ll a, b, v, w, t;
  cin >> a >> v >> b >> w >> t;
  if (w > v || t*(v - w) < abs(a - b)) cout << "NO\n";
  else cout << "YES\n";

	return 0;
}

Measured memory_bytes: 3648
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long;

const int N = 2e5 + 5;
int n;
// dp[i]: the maximum beauty value that you can achieve with flower [1, i]
ll dp[N];
ll h[N];
ll a[N];

void maximize(ll& a, ll b) {
    if (a < b) a = b;
}

struct SegmentTree {
    vector<ll> tree;
    int len;

    explicit SegmentTree(): len(0) {}

    void pushup(int i) {
        tree[i] = max(tree[i << 1], tree[i << 1 | 1]);
    }

    void build(int n) {
        len = n;
        tree.assign(len << 1, 0ll);
    }
    
    void update(int pos, ll new_val) {
        tree[pos + len - 1] = new_val;
        for (pos += len - 1; pos; pos >>= 1) maximize(tree[pos], new_val);
    }

    ll query(int l, int r) const {
        if (l > r) return 0;
        ll ans = 0;
        for (l += len - 1, r += len; l < r; l >>= 1, r >>= 1) {
            if (l & 1) maximize(ans, tree[l++]);
            if (r & 1) maximize(ans, tree[--r]);
        }
        return ans;
    }

    void debug() const {
        for (auto it : tree) printf("%lld ", it);
        putchar('\n');
    }

    void clear() {
        tree.clear();
    }
};

void solve() {
    SegmentTree st;
    st.build(n);
    memset(dp, 0, sizeof dp);
    ll ans = 0;
    for (int i = 0; i < n; ++i) {
        dp[i] = a[i]; // choose only this
        ll max_dp = st.query(1, h[i] - 1);
        maximize(dp[i], max_dp + a[i]);
        st.update(h[i], dp[i]);
        maximize(ans, dp[i]);
    }
    printf("%lld\n", ans);
}

int main() {
    while (~scanf("%d", &n)) {
        for (int i = 0; i < n; ++i) {
            scanf("%lld", h + i);
        }
        for (int i= 0; i < n; ++i) {
            scanf("%lld", a + i);
        }
        solve();
    }
    return 0;
}

Measured memory_bytes: 8064
#include<bits/stdc++.h>
#ifdef LOCAL
#include "lib/debug.hpp"
#else
#define debug(...) 1
#endif
#define ALL(a) (a).begin(), (a).end()
#define rep(i, n) REP(i, 0, (n))
#define repc(i, n) REPC(i, 0, (n))
#define REP(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define REPC(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define REPCM(i, n, m) for (int i = (int)(n); i >= (int)(m); i--)
using namespace std;
using ll = int_fast64_t;
using pr = pair<ll, ll>;
using vll = vector<ll>;
using vpr = vector<pr>;
template<class T> inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } else return false; }
template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; }

void answer() {
  ll n; cin >> n;
  map<string, int> memo;
  int maxv = 0;
  rep(i,n) {
    string s; cin >> s;
    memo[s]++;
    chmax(maxv, memo[s]);
  }
  vector<string> vec;
  for(auto m : memo) if(m.second == maxv) vec.emplace_back(m.first);
  sort(ALL(vec));
  for(auto v : vec) cout << v << "\n";
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  answer();
  return 0;
}

Measured memory_bytes: 25840
import java.util.*;
public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
Scanner kb=new Scanner(System.in);
int n=kb.nextInt();
ArrayList<Integer> al=new ArrayList<Integer>(n);
for(int i=0;i<n;i++){
	al.add(kb.nextInt());
}
for(int i=n-1;i>=0;i--){
	System.out.printf("%d",al.get(i));
	if(i!=0){
    System.out.print(" ");	
	}
}
System.out.println("");	
	}

}

Measured memory_bytes: 26524
#include<stdio.h>
#include<string.h>
char s[100001];
int main(void)
{
	int i,j,l,n,m[30];
	char t[30]={'a','b','c','d','e','f','g','h','i',
				'j','k','l','n','m','o','p','q','r',
				's','t','u','v','w','x','y','z'};
	scanf("%s",s);
	n=strlen(s);
	for(i=0;i<26;i++){
		l=0;
		for(j=0;j<n;j++){
			if(t[i]==s[j]){
				l=1;
				break;
			}
		}
		if(l==0){
			l=2;
			printf("%c\n",t[i]);
			break;
		}
	}
	if(l!=2) printf("None\n");
	return 0;
}

Measured memory_bytes: 256
// https://atcoder.jp/contests/abc162/tasks/abc162_b

#include "algorithm"
#include "bitset"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "map"
#include "numeric"
#include "queue"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define rep1(i, to) for (ll i = 1; i <= (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define unless(cond) if (!(cond))
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;

template <typename T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

template <typename T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}

const ll INF = 1e18;

void solve();

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

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

void solve() {
  ll N;
  cin >> N;

  ll res = 0;

  rep1(num, N) {
    if (num % 3 == 0 || num % 5 == 0) continue;
    res += num;
  }

  cout << res << "\n";
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define ll long long
#define N 100010
#define M 1010

using namespace std;


int read() {
	int s = 0, f = 0; char ch = getchar();
	while (!isdigit(ch)) f |= (ch == '-'), ch = getchar();
	while (isdigit(ch)) s = s * 10 + (ch ^ 48), ch = getchar();
	return f ? -s : s;
}

int main() {
	int x= read();
	if (x >= 30) puts("Yes");
	else puts("No");
}

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

#define rep(a,b) for(int a = 0;a < b;a++)
#define REP(i, x, n) for(int i = x; i < n; i++)
#define P(a) cout << a << endl
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define ssort(v) sort(v.begin(),v.end())
#define rev(v) reverse(v.begin(),v.end())
#define vP(v) for(int i = 0;i < v.size();i++){cout << v[i];if(i != v.size()-1)cout << endl;}
#define vcin(v,n) rep(i,n){int a;cin >> a;v.pb(a);}

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int dx[] = { 1, -1 , 0 , 0 };
int dy[] = { 0,  0,  1, -1 };
ll MOD = 1000000007;

void solve(){
	string s;
	cin >> s;
	string ans = "";
	for(int i = 0;i < s.length();i+=2){
		ans = ans + s[i];
	}
	P(ans);
}

int main() {
	solve();
	return 0;
}


Measured memory_bytes: 640
//submitted by Himj
#include<bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define pb push_back
#define fi first
#define se second
#define fr(i,s,e) for(i=s;i<e;i++)
#define ms(arr,val) memset(arr,val,sizeof(arr))
using namespace std;

const int mxn=2e5+1;

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

  int t=1;
  //cin>>t;
    while(t--){
      ll n,i,ans=0;
      cin>>n;
      ll a[n],b[n],c[n];
      pair<ll,ll> loser[n];
      fr(i,0,n)
      cin>>a[i];
      fr(i,0,n)
      {
        cin>>b[i];
        loser[i]={a[i]-b[i],i};
      }
      ll sub=0;
      fr(i,0,n)
      {
        c[i]=a[i];
        if(a[i]<b[i])
        {
          c[i]=b[i];
          sub+=b[i]-a[i];
        }
      }
      //cout<<sub<<" ";
      sort(loser,loser+n);
      reverse(loser,loser+n);
      fr(i,0,n)
      {
        //cout<<loser[i].fi<<" ";
        if(sub==0 or loser[i].fi<=0)
          break;
        ll temp=min(sub,loser[i].fi);
        sub-=temp;
        c[loser[i].se]=a[loser[i].se]-temp;
      }
    //  cout<<sub<<" ";
      if(sub)
      {
        cout<<-1;
        return 0;
      }
      fr(i,0,n)
      ans+=(c[i]!=a[i]);
      cout<<ans;

      
       
    }
  return 0;
  }



Measured memory_bytes: 4096
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<cstdlib>
#include<cmath>
#include<numeric>
#include<iomanip>
#include<functional>
#include<cstdlib>
#include<queue>
#include<deque>
const double PI = acos(-1);
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
using ll =long long;
const int mod = 1000000007;

//map<string>a
class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% mod + mod) % mod) {}
	mint operator-() const {
		return mint(-x);
	}
	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;
	}

	friend ostream& operator<<(ostream & os, const mint & m) {
		os << m.x;
		return os;
	}
};
int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}
//組み合わせ
void recursive_comb(vector<int> indexes, int s, int rest, std::function<void(vector<int>)> f) {
	if (rest == 0) {
		f(indexes);
	}
	else {
		if (s < 0) return;
		recursive_comb(indexes, s - 1, rest, f);
		indexes[rest - 1] = s;
		recursive_comb(indexes, s - 1, rest - 1, f);
	}
}

// nCkの組み合わせに対して処理を実行する
void foreach_comb(int n, int k, std::function<void(vector<int>)> f) {
	vector<int>indexes(k);
	recursive_comb(indexes, n - 1, k, f);
}

ll gcd(ll a, ll b) {
	if (a % b == 0) {
		return b;
	}
	else {
		return gcd(b, a % b);
	}
}
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
};

int main() {
	int x[5];
	rep(i, 5)cin >> x[i];
	rep(i, 5) {

		if (x[i] == 0) {
			cout << i + 1;
			return 0;

		}

	}
}

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

using namespace std;

int n,ans,pre[120000];
char s[120000];

int main(){
    scanf("%s",s+1); n=strlen(s+1);
    pre[1]=1;
    for (int i=2;i<=n;i++)
        if (s[i]==s[i-1]) pre[i]=pre[i-1]; else pre[i]=i;
    for (int i=1;i<=n;i++)
        if (n-pre[i]+1>=i) ans=i;
    printf("%d\n",ans);

    return 0;
}


Measured memory_bytes: 768
#include <iostream>
#include <climits>
#include <stack>
#include <queue>
#include <string>
#include <random>
#include <utility>
#include <cmath>
#include <string.h>
#include <iomanip>
#include <stdlib.h>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
long long int INF = 1e18;
double Pi = 3.141592653589;
const int mod = 1000000007;
// memset(a,0,sizeof(a)); →全部０にする
 
struct edge{int to,cost;};
vector<int> G[100005];
 
int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
 
std::vector<P> tree[100010];
ll i,j;

ll n,m,ans;
ll a,b,c;

int main(){
	cin>>n>>m;
	if(m>n)swap(n,m);
	if(n==1 && m==1)ans=1;
	else if(m==1) ans=n-2;
	else ans=(n-2)*(m-2);


	
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 4992
ans=Array.new(10){ Array.new(1001){0}}
ans[0][0]=1

0.upto(100) do |i|
    1000.downto(0) do |j|
        9.downto(1) do |k|
           break if j-i<0
            ans[k][j]+=ans[k-1][j-i]
        end
    end
end

while gets do
    n,s=$_.split(nil).map(&:to_i)
    break if n==0 && s==0
    puts ans[n][s]
end

Measured memory_bytes: 6176
from collections import deque


def main():
    S = deque(list(input()))
    Q = int(input())
    count = 0
    for _ in range(Q):
        query = list(input().split())
        if query[0] == "1":
            count += 1
        if query[0] == "2":
            if count % 2 == 0:
                if query[1] == "1":
                    S.appendleft(query[2])
                elif query[1] == "2":
                    S.append(query[2])
            else:
                if query[1] == "1":
                    S.append(query[2])
                elif query[1] == "2":
                    S.appendleft(query[2])
    if count % 2 == 0:
        ans = "".join(S)
        print(ans)
    else:
        S.reverse()
        ans = "".join(S)
        print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 74344
#pragma GCC optimize("O2")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx2")
#pragma GCC optimize("Os")
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);
#define FO cout.tie(NULL);
#define FI cin.tie(NULL);
#define IN cin>>
#define OUT cout<<
#define loop(i,a,n) for(int i=a; i<n; i++)
#define rloop(i,a,n) for(int i=a; i>=n; i--)
#define endl "\n";
#define pb push_back
#define mp make_pair
#define set_bits(a) __builtin_popcountll(a)
#define ll long long int
#define ld long double
#define vll vector<long long int>
#define pll pair<long long int, long long int>
#define mod 1000000007
#define M 998244353
using namespace std;
ll gcd(ll a, ll b)
{
    return (b?gcd(b,a%b):a);
}
ll P(ll B, ll power, ll modulo)
{
    ll ans=1LL;
    while(power>0LL)
    {
        if(power%2LL==1LL)
        {
            ans=(ans*B)%modulo;
        }
        B=(B*B)%modulo;
        power/=2LL;
    }
    return ans;
}
bool isPrime(ll n)
{
    if(n<=1LL)
    {
        return false;
    }
    if(n<=3LL)
    {
        return true;
    }
    if(n%2==0LL || n%3==0LL)
    {
        return false;
    }
    for(ll i=5LL; (i*i)<=n; i+=6LL)
    {
        if(n%i==0LL || n%(i+2LL)==0LL)
        {
            return false;
        }
    }
    return true;
}
void vok()
{
    FAST
    FO
    FI
}
int main()
{
    vok();
    ll n,k;
    IN n>>k;
    vll a(n);
    bitset<50> b[n];
    loop(i,0,n)
    {
        IN a[i];
        bitset<50> temp(a[i]);
        b[i]=temp;
    }
    bitset<50> ans(0);
    rloop(i,49,0)
    {
        int countt=0;
        loop(j,0,n)
        {
            if(b[j][i])
            {
                countt++;
            }
          	//cout<<"";
        }
        ans[i]=1;
        if((countt*2)<n && ans.to_ullong()<=k)
        {
            //Do Nothing
        }
        else
        {
            ans[i]=0;
        }
    }
    ll fans=0LL;
    ll X=ans.to_ullong();
    loop(i,0,n)
    {
      	//cout<<"";
        fans+=(X^a[i]);
    }
    OUT fans<<endl
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define what_is(x) cerr << #x << " is " << x << endl;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define st first
#define nd second
#define endl '\n'

typedef long long ll;
typedef pair<int,int> pii;
const int N = 1e5+5;
const int INF = 1e9;
const int MOD = 1e9+7;

string s;

int main()
{
	IOS
	//freopen("input.txt", "r", stdin);
	cin >> s;
	if (s == "Sunny") cout << "Cloudy\n";
	else if (s == "Cloudy") cout << "Rainy\n";
	else cout << "Sunny\n";
	return 0;
}


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

int main(){
    int n, k, i, s = 0;
    cin >> n >> k;
    int a[n];
    for(i=0; i<n; i++){
        cin >> a[i];
    }
    sort(a, a+n);
    for(i=n-k; i<n; i++){
        s += a[i];
    }
    cout << s;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
char s[6000];
int n,K;
bool del[40020];
struct String{
	int a[5010],len;
	bool operator < (const String &A) const{
		int i,L=min(len,A.len);
		for (i=1;i<=len;i++)
			if (a[i]!=A.a[i])
			  return a[i]<A.a[i];
		return len<A.len;
	}
}S[30010];
bool cmp(int x1,int x2){
	int i;
	if (S[x1].len!=S[x2].len) return 0;
	for (i=1;i<=S[x1].len;i++) 
		if (S[x1].a[i]!=S[x2].a[i]) return 0;
	return 1;
}
int main(){
	cin>>s; scanf("%d",&K);
	int Len=strlen(s),k,i,j;
	for (k=1;k<=min(K,Len);k++)
		for (i=0;i<=Len-k;i++){
			n++; S[n].len=k;
			for (j=i;j<=i+k-1;j++)
				S[n].a[j-i+1]=(int)s[j];
	}
	sort(S+1,S+n+1);
	for (i=1;i<=n;i++)
		for (j=1;j<i;j++)
			if (cmp(i,j)){
				del[i]=1; break;
			}
	k=0;
	for (i=1;i<=n;i++){
		if (!del[i]) k++;
		if (k==K){
			for (j=1;j<=S[i].len;j++)
			  cout<<(char)S[i].a[j];
			break;
		}
	}
}

Measured memory_bytes: 489728
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
 
// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
//const int mod = 17;

struct mint {
  ll x; // typedef long long ll;
  //std::cout << "initial x:" << x << std::endl;
  mint(ll x=0):x((x%mod+mod)%mod){
      //std::cout << x << std::endl;
  }
  mint operator-() const { return mint(-x);}
  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;
  }
};
// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};
 
 
int main() {
    
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  sort(a.begin(), a.end());
 
  combination c(n+5);
 
  mint ans = 0;
  rep(ri,2) {
    rep(i,n) {
      mint now = c(i,k-1);
      if (ri == 1) now = -now;
      ans += now*a[i];
    }
    reverse(a.begin(), a.end());
  }

  cout << ans.x << endl;
  return 0;
}

Measured memory_bytes: 5040
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
using System.Threading;
static class Program{
	const int mod=(int)1e9+7;
	const double eps=1e-11;
	static void Main(){
		Sc sc=new Sc();
		var s=sc.La;
		var h=new long[(int)s[2]+1];
		var d=new long[(int)s[2]+2];
		long p=s[1],ans=p;
		d[p]=ans;
		h[p]=1;
		var g=s[0];
		for(int i = 2;i<=s[0];i++) {
			p*=p;
			p%=s[2];
			if(p==0){break;}
			else if(h[p]!=0){
				g-=i;
				var m=i-h[p];
				ans+=(ans-d[p]+p)*(g/m);
				g-=g/m*m;
				for(int k = (int)g;k>=0;k--) {
					ans+=p;
					p*=p;
					p%=s[2];
				}
				break;
			}
			h[p]=i;
			ans+=p;
			d[p]=ans;
		}
		Console.WriteLine("{0}",ans);
	}
}
public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),int.Parse);}
	public int[] Ia3(int a){return Array.ConvertAll((Console.ReadLine()+" "+a.ToString()).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),long.Parse);}
	public long[] La3(int a){return Array.ConvertAll((Console.ReadLine()+" "+a.ToString()).Split(),long.Parse);}
	public double[] Da2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),double.Parse);}}
	public double[] Da3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),double.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}

Measured memory_bytes: 29036
from collections import deque

N, K = map(int, input().split())

v = [[] for i in range(N)]
for _ in range(N-1) :
    a, b = map(int, input().split())
    v[a-1].append(b-1)
    v[b-1].append(a-1)
    
MOD = 10 ** 9 + 7

dp = [0] * N
visited = [False] * N
queue = deque([0])

ret = 1
while queue :
    cur = queue.popleft()
    visited[cur] = True
    nvisited = 0
    
    for nex in v[cur] :
        if visited[nex] :
            nvisited += dp[nex] + 1
            dp[cur] += 1
            dp[nex] += 1
        else :
            queue.append(nex)
               
    if nvisited >= K :
        ret = 0
        break
    else :
        ret *= (K-nvisited)
        ret %= MOD

print(ret)

Measured memory_bytes: 67104
#include<bits/stdc++.h>
#define pb push_back
#define ef(i,u) for(int i=b[u];i;i=nxt[i])
#define rep(i,a,b) for(int i=a;i<=b;++i)
#define per(i,b,a) for(int i=b;i>=a;--i)
#define gcd(a,b) __gcd(a,b)
#define MEM(a,x) memset(a,x,sizeof(a))
#define VI vector<int>
#define PII pair<int,int>
#define ull unsigned long long
#define ll long long
#define fi first
#define se second
#define INF 0x3f3f3f3f
using namespace std;
const int N=2e5+5;
template<class T>inline void read(T &res)
{
char c;T flag=1;
while((c=getchar())<'0'||c>'9')if(c=='-')flag=-1;res=c-'0';
while((c=getchar())>='0'&&c<='9')res=res*10+c-'0';res*=flag;
}
int a,b,c,k;
int main(){
    cin>>a>>b>>c>>k;
    int ans=0;
    ans+=min(k,a);k-=min(k,a);
    k-=min(k,b);
    ans-=min(k,c);
    cout<<ans<<'\n';
	return 0;
}


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

#define         pb         push_back
#define         sf(x)      scanf("%d",&x)
#define         sfl(x)     scanf("%lld",&x)
#define         pf(x)      printf("%d\n",x)
#define         pfl(x)     printf("%lld\n",x)
#define         endl       '\n'
#define         pii        pair<int,int>
#define         mapii      map<int,int>
#define         mapll      map<ll,ll>
#define         mapci      map<char,int>
#define         mapcl      map<char,ll>
#define         mapsi      map<string,int>
#define         mapsl      map<string,ll>
#define         pll        pair<ll,ll>
#define         vi         vector<int>
#define         vl         vector<ll>
#define         vd         vector<double,double>
#define         all(c)     c.begin(),c.end()
#define         F          first
#define         S          second
#define         mp         make_pair
#define        ftc(x)      cerr << #x << ": " << x << " " << endl;
#define         PI         acos(-1)
#define         lcm(a,b)   ((a*b)/__gcd(a,b))
#define        optimize    ios_base::sync_with_stdio(false);cin.tie(NULL);
#define        sqr(a)       ((a)*(a))

int main()
{

ll i,j,k,l,m,n,q,p1,p2,q1,q2,x,ans,l1,l2,l3,l4,l5,l6,l7,l8;


string s;
cin >> n  >> q;

l = q*q;
ans = 0;
for(i=0;i<n;i++)
{
    cin >>l1>>l2;

    m = (l1*l1) + (l2*l2);
    if(m <= l)ans++;
}

cout << ans << endl;


}


Measured memory_bytes: 3624
from collections import defaultdict
N=int(input())
A=list(map(int,input().split()))

MOD=10**9+7

primes=[]
is_prime=[True]*(10**3)
for i in range(2,10**3):
    if not is_prime[i]: continue
    primes.append(i)
    for j in range(2*i,10**3,i):
        is_prime[j]=False

LCM=defaultdict(int)
for n in A:
    for p in primes:
        tmp=0
        while n%p==0:
            tmp+=1
            n//=p
        LCM[p]=max(LCM[p],tmp)
    if n!=1:
        LCM[n]=max(LCM[n],1)
l=1
for p,n in LCM.items():
    l=l*pow(p,n,MOD)%MOD

ans=0
for a in A:
    ans+=l*pow(a,MOD-2,MOD)
    ans%=MOD

print(ans)

Measured memory_bytes: 45148
def count(n, x):
    c = 0
    for i in range(1, n-1):
        for j in range(i+1, n,):
            for k in range(j+1, n+1):
                s = i + j + k
                if s == x:
                    c += 1
                    break
                elif s > x: break
    return c

while True:
    p = map(int, raw_input().split())
    if p == [0, 0]: break
    print count(*p)

Measured memory_bytes: 4228
#include <iostream>
#include <algorithm>
#include <vector>
#define rip(i, n, s) for (int i = (s);i < (int)( n ); i++)
typedef long long ll;
using namespace std;
const int MAX_N = 200200;
int c[MAX_N];
ll ans[MAX_N], lam[MAX_N], co[MAX_N];
ll cal(ll x){
    return x*(x+1)/2;
}
int dfs2(vector<vector<int>> &da, vector<bool> &used, int now){
    ll tmp = lam[c[now]];
    lam[c[now]] = 0;
    rip(i, da[now].size(),0){
        if(used[da[now][i]]) continue;
        used[da[now][i]] = true;
        co[now] += dfs2(da, used, da[now][i]);
        ans[c[now]] += cal(co[da[now][i]]-lam[c[now]]);
        lam[c[now]] = 0;
    }
    ++co[now];
    lam[c[now]] = tmp + co[now];
    return co[now];
}
int main(){
    ll n; cin >> n;
    rip(i,n,0) cin >> c[i], --c[i];
    vector<vector<int>> da(n, vector<int>(0));
    rip(i,n-1,0){
        int a,b; cin >> a >> b;
        --a;--b;
        da[a].push_back(b);
        da[b].push_back(a);
    }
    vector<bool> used(n, false);
    used[0] = true;
    dfs2(da, used,0);
    rip(i,n,0){
        ans[i] += cal(n - lam[i]);
    }
    rip(i,n,0){
        printf("%lld\n", n*(n+1)/2 - ans[i]);
    }
}


Measured memory_bytes: 35096
#include <bits/stdc++.h>
using namespace std;
template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }
#define pb push_back
#define mp make_pair
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i,n) for(int i = n - 1; i >= 0; --i)
#define Rep(i, a, n) for(int i = (a); i <=(n); ++i)
#define repst(i, n) for(auto it = n.begin(); it != n.end(); ++it)
#define Repr(i, a, n) for(int i = (n); i >= (a); --i)
typedef long long ll;
 
const int inf = int(1e9);
const int mod = 256;
const int N = 1e6 + 555;


void solve()
{
	int n, a, b;
	cin >> n >> a >> b;
	cout << min(a * n, b);
}
int main()
{
	Red;
	solve();
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstdint>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <array>
#include <vector>
#include <unordered_map>
#include <unordered_set>

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

    int v[N];
    for (int i = 0; i < N; ++i) {
        std::cin >> v[i];
    }

    std::sort(v, v + N);

    double mixed = (v[0] + v[1]) / 2.0;
    for (int i = 2; i < N; ++i) {
        mixed = (mixed + v[i]) / 2.0;
    }

    std::printf("%lf\n", mixed);

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>

using namespace std;

int main() {
	string s;
	int n;

	cin >> n;

	int a[n];
	int zero_count[n];


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

	if (a[n - 1] == 0) {
		zero_count[n - 1] = 1;
	} else {
		zero_count[n - 1] = 0;
	}

	for (int i = n - 2; i >= 0; i--) {
		if (a[i] == 0) {
			zero_count[i] = zero_count[i + 1] + 1; 
		} else {
			zero_count[i] = 0;
		}
	}
	
	long long count = 0;

 	for (int i = 0; i < n; i++) {
		count++;
		int val = a[i];
		int j = i + 1;
		while(j < n) {
			if (zero_count[j] > 0) {
				count += zero_count[j];
				j +=  zero_count[j];

				continue;
			} 
			if ((val & a[j]) != 0) {
				break;
			}
			val = val | a[j];
			count ++;
			j++;
			
		}
	}

	cout << count << endl;


	return 0;
}

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

using namespace std;

int main()
{
    cout<<setprecision(10);
    int n;
    cin>>n;

    vector<double>a(n);

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

    double x=0.0;

    sort(a.begin(),a.end());

    x+=(a[0]+a[1])/2.0;

    for(int i=2;i<n;i++)
    {
        x=(x+a[i])/2;
    }
    cout<<fixed<<x<<endl;

}


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

long calc(long n,vector<long>&dp,long mod){
    if(n<3)return 0;
    if(dp[n]!=0)return dp[n];
    for(int i=3;i<=n;i++){
        
        if(n!=i)dp[n] += calc(n-i,dp,mod);
        else dp[n]++;
        dp[n] %= mod;
    }
    dp[n]%=mod;


    return dp[n];
}

int main(){
    long s;
    cin >> s;
    long const mod = 1e9+7;
    vector<long>dp(s+1);
    if(s>=3)dp[3] = 1;

    cout << calc(s,dp,mod)<<endl;
    
}

Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>

using namespace std;


int main() { 
    string s, t;
    cin >> s >> t; 
    int x = stoi(s + t);
    for (int i = 1; i <= 1000; i++) { if (i*i == x) { puts("Yes"); return 0; } }
    puts("No");
}

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

using namespace std;

double mod = 1e9 + 7;
#define REP(i, n)  for(int i = 0; i < (int)n; ++i)
#define REP1(i, n)  for(int i = 1; i < (int)n; ++i)


int main() {
    long N = 0, M = 0, sum = 0;
    cin >> N;
    REP(i, N+1) {
        sum += i;
        if (sum >= N) {
            M = i;
            break;
        }
    }
    cout << M << endl;
}

Measured memory_bytes: 256
from collections import defaultdict
n=int(input())
a=list(map(int,input().split()))
b=[0]
for i in a:b.append(b[-1]+i)
d=defaultdict(int)
for i in b:d[i]+=1
ans=0
for i in set(b):ans+=d[i]*(d[i]-1)//2
print(ans)

Measured memory_bytes: 47484
#include <bits/stdc++.h>
using namespace std;
const int INF=999999999;

int main() {
 string w;
 cin>>w;
 vector<int>t(26);
 for(int i=0;i<w.size();i++){
   t.at(w.at(i)-'a')++;
 }
 bool d=true;
 for(int i=0;i<t.size();i++){
   if(t.at(i)%2!=0){d=false;}
 }
 if(d){cout<<"Yes"<<endl;}
 else{cout<<"No"<<endl;}
 return 0;}

Measured memory_bytes: 256
home = [[[0 for r in range(10)] for f in range(3)] for b in range(4)]
n = int(raw_input())
for i in range(n):
    b, f, r, v = map(int, raw_input().split())
    home[b-1][f-1][r-1] += v

for i in range(4):
    for j in range(3):
        print "",
        print " ".join(map(str, home[i][j]))
        if j == 2 and i != 3:
            print "#" * 20


Measured memory_bytes: 4648
#include <bits/stdc++.h>
#define owo(i,a, b) for(int i=(a);i<(b); ++i)
#define uwu(i,a, b) for(int i=(a)-1; i>=(b); --i)
#define senpai push_back
#define ttgl pair<int, int>
#define ayaya cout<<"ayaya~"<<endl
 
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
gpu_hash_map<int, int> mp;*/
using ll = long long;
using ld = long double;
const ll MOD = 1000000007;
const ll root = 62;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
ll binpow(ll a,ll b){ll res=1;while(b){if(b&1)res=(res*a)%MOD;a=(a*a)%MOD;b>>=1;}return res;}
ll modInv(ll a){return binpow(a, MOD-2);}
const double PI = acos(-1);
const double eps = -1e6;
const int INF = 0x3f3f3f3f;
const int NINF = 0xc0c0c0c0;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const ll NINFLL = 0xc0c0c0c0c0c0c0c0;
const int mxN = 100001;
int n;
int arr[mxN];
vector<ttgl> ans;
int neg, posi;
int main() {
    //freopen("greedy.in", "r", stdin);
    //freopen("greedy.out", "w", stdout);
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    cin.tie(0)->sync_with_stdio(0);
    cin>>n;
    owo(i, 0, n) {
        cin>>arr[i];
        if(arr[i]<0) {
            neg++;
        }else posi++;
    }
    sort(arr, arr+n);
    if(neg==0) {
        neg++;
        posi--;
    }else if(posi==0) {
        posi++;
        neg--;
    }
    int nn = neg;
    if(neg>0&&posi>0) {
        while(neg<n-1) {
            ans.senpai({arr[0], arr[neg]});
            arr[0]-=arr[neg];
            neg++;
        }
        int idx = 0;
        while(idx<nn) {
            ans.senpai({arr[n-1], arr[idx]});
            arr[n-1]-=arr[idx];
            idx++;
        }
    }
    cout<<arr[n-1]<<"\n";
    for(auto p: ans) {
        cout<<p.first<<" "<<p.second<<"\n";
    }
    return 0;
}

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

using namespace std;

int main(){

	int n;
	do{
		cin >> n;
	}
	while(n< 100 || n > 999);
	string s = to_string(n);
	for(int i = 0; i < 3; i++){
		if (s[i]=='7')
		{
			cout << "Yes\n";
			return 0;
		}
	}
	cout << "No\n";
	return 0;
}


Measured memory_bytes: 3696
use std::io;
use std::collections::HashMap;

fn read_line() -> String {
    let mut line = String::new();

    io::stdin().read_line(&mut line)
        .expect("Failed to read line");
    return line;
}
fn to_i(s: &str) -> i64 {
    return s.trim().parse()
        .expect("Please type a number!");
}
fn read_nums() -> Vec<i64>
{
    let line = read_line();
    let items: Vec<&str> = line.split(' ').collect();

    let mut nums: Vec<i64> = Vec::new();

    for item in items {
        nums.push(to_i(item));
    }
    return nums;
}


fn main() {
    //println!("start");
    let nkq = read_nums();
    let n = nkq[0];
    let k = nkq[1];
    let q = nkq[2];

    let mut aa = Vec::<i64>::with_capacity(n as usize);
    for i in 0..n {
        aa.push(0);
    }

    for i in 0..q {
        let ai = read_nums()[0] -1;
        aa[ai as usize] += 1;
    }

    for i in 0..n {
        if k-q+aa[i as usize]>0 {
            println!("Yes");
        } else {
            println!("No");
        }
    }


    
    
    
    
}   

Measured memory_bytes: 4732
#include<bits/stdc++.h>
using namespace std;
int main () {
  int N, M;
  cin >> N >> M;
  N *= 2;
  vector<int>b(N);
  for (int i = 0; i < N; i ++) cin >> b[i];
  sort(b.begin(), b.end());
  int ma = N / 2;
  int mi = 0;
  while(ma != mi) {
    int mu = (ma + mi) / 2;
    mu *= 2;
    bool can = true;
    for (int i = mu; i < N; i ++) {
      if (b[i] + b[N - i + mu - 1] < M) can = false;
    }
    if (can) ma = mu / 2;
    else mi = mu / 2 + 1;
    //cout << ma << ' ' << mi << endl;
  }
  ma *= 2;
  //cout << ma << endl;
  int a = b[0] + b[ma - 1];
  for (int i = 0; i < ma; i ++) {
    if (b[i] + b[ma - i - 1] > a) a = b[i] + b[ma - i - 1];
  }
  if (ma == 0) a = 0;
  int an = b[ma] + b[N - 1];
  for (int i = ma; i <= N - 1; i ++) {
    if (b[i] + b[ma + N - i - 1] > an) an = b[i] + b[ma + N - i - 1];
  }
  if (ma == N) an = M;
  int ans = max(a, an - M);
  cout << ans << endl;
}
  
  



Measured memory_bytes: 1024
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.stream.IntStream;

public class Main {

    public static void main(String[] args) throws Exception {
        Io.write(IntStream.range(1, Io.read() + 1).sum());
    }
}

class Io {

    /**
     * 標準入力から1行ずつ受け取る
     * @return
     * @throws IOException
     */
    public static int read() throws IOException
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line = br.readLine();

        br.close();
        return Integer.parseInt(line);
    }

    /**
     * 標準出力
     * @param ans
     */
    public static void write(int ans)
    {
        System.out.println(ans);
    }
}


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

int main(){
  int a,b;
  cin >> a >> b;
  string s(b, '0'+a);
  string t(a, '0'+b);
  if (a >= b) cout << t << endl;
  else cout << s << endl;
  return 0;
}

Measured memory_bytes: 256
#Dictionary
import collections
N = int(input().strip())
q = collections.deque()
for i in range(N):
    order = input().strip().split(" ")
    q.append(order)
dct = set()
while len(q):
    order = q.popleft()
    if order[0] == 'insert':
        newword = order.pop()
        dct.add(newword)
    else:
        word = order.pop()
        if word in dct:
            print("yes")
        else:
            print("no")         


Measured memory_bytes: 301524
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const int iinf = 1 << 28;
const long long llinf = 1ll << 60;
const double PI = 3.14159265;


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

    return 0;
}


Measured memory_bytes: 1792
#include <stdio.h>//160441128 ??????????£?
int main (void)
{
	int card[4][13],kazu;
	char ata;
	int a,b,c,d,e,sri;
	

	for(a=0;a<4;a++)//???????????????????????????
	{
		for(b=0;b<13;b++)
		{
			card[a][b]=0;
		}
	}

	scanf("%d",&kazu);

	for(c=0;c<kazu*2;c++)//??????????????\???
	{
		scanf("%c %d",&ata,&sri);

		if(ata=='S')
		{
			card[0][sri-1]=1;
		}
		if(ata=='H')
		{
			card[1][sri-1]=1;
		}
		if(ata=='C')
		{
			card[2][sri-1]=1;
		}
		if(ata=='D')
		{
			card[3][sri-1]=1;
		}
		
	}
	

	for(d=0;d<4;d++)//????????????
	{
		for(e=0;e<13;e++)
		{ 
			if(card[d][e]==0)
			{
				if(d==0)
				{
					printf("S %d\n",e+1);
				}

				else if(d==1)
				{
					printf("H %d\n",e+1);
				}

				else if(d==2)
				{
					printf("C %d\n",e+1);
				}

				else if(d==3)
				{
					printf("D %d\n",e+1);
				}
			}
		}
	}

	
		return 0;
}


		

Measured memory_bytes: 596
//
//AtCoder Beginner Contest 133
//B - Good Distance
//

#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <functional>
#include <cassert>

using namespace std;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define SIZE(x) (int)(x).size()
#define SIZEL(x) (ll)(x).size()
#define MSG(a) cout << #a << " " << a << endl;

using ll = long long;
using ld = long double;

const double PI = 3.14159265358979323846;

ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }            //最小公倍数

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

    vector<vector<int>> a(n, vector<int>(d));
    REP(i, n) {
        REP(j, d) {
            cin >> a[i][j];
        }
    }
    int ans = 0;
    REP(i, n) {
        FOR(j, i+1, n-1){
            int sum = 0;
            REP(k, d){
                sum+=pow(a[j][k]-a[i][k],2);
            }
            int tmp = sqrt(sum);
            if (tmp*tmp==sum) ans++;
        }
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
n = gets.to_i
l = gets.chop.split.map(&:to_i)

mod = 10**9+7

ones = [0]*60
n.times do |i|
    x = l[i]
    60.times do |j|
        ones[j] += (x>>j)&1
    end
end

ans = 0
60.times do |i|
    ans += ((n-ones[i])*ones[i]*2**i)%mod
end
puts ans%mod

Measured memory_bytes: 42840
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <math.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int A, B, H, M;
  cin >> A >> B >> H >> M;
  long double rad = (M*6.0 - (H*30.0 + M*0.5)) * M_PI / 180.0;
  long double ans;
  ans = sqrt(A*A + B*B - 2*A*B*cos(rad));
  cout << fixed << setprecision(10) << ans << endl;

  return 0;
}

Measured memory_bytes: 3540
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		long[] a = new long[N];
		for( int i=0; i<N; i++ ){
			a[i] = sc.nextLong();
		}
		long maxium = a[0];
		for( int i=1; i<N; i++ ){
			if( maxium - a[i] >=2 ){
				System.out.println("No");
				break;
			}else{
				maxium = Math.max(maxium,a[i]);
			}
			if( i==N-1 ){
				System.out.println("Yes");
			}
		}
		if( N==1 ){
			System.out.println("Yes");          
        }          
	}
}


Measured memory_bytes: 60960
#include <iostream>

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

    int total = 0;
    for (int i = 0; i < n; ++i)
    {
        int l, r;
        std::cin >> l >> r;
        total += r - l + 1;
    }
    std::cout << total << std::endl;
    return 0;
}


Measured memory_bytes: 504