akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long N = sc.nextInt();
		long three = N/3*(N/3+1)/2*3;
		long five = N/5*(N/5+1)/2*5;
		long fifteen = N/15*(N/15+1)/2*15;
		System.out.println(N*(N+1)/2-three-five+fifteen);
	}

}

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

#define y1 dmytxdy
#define fi first
#define se second
#define mp make_pair

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef long double ld;

bool chkmin(int &x,int y){return x>y?x=y,1:0;}
bool chkmax(int &x,int y){return x<y?x=y,1:0;}

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

int n,m;
int a[105];

int main(){
	n=readint(); m=readint();
	int cnt=0;
	for(int i=1;i<=m;i++) a[i]=readint(),cnt+=a[i]&1;
	if(n==1) return printf("1\n1\n1\n"),0;
	if(m==1) return printf("%d\n2\n%d %d\n",n,1,n-1),0;
	if(cnt>2) return printf("Impossible\n"),0;
	int now=1;
	for(int i=1;i<=m;i++) if(a[i]&1) swap(a[i],a[now]),now=m-now+1;
	for(int i=1;i<=m;i++) printf("%d ",a[i]);
	printf("\n%d\n",m-(a[1]==1));
	if(a[1]!=1) printf("%d ",a[1]-1);
	for(int i=2;i<=m-1;i++) printf("%d ",a[i]);
	printf("%d\n",a[m]+1);
	return 0;
}

Measured memory_bytes: 256
class RoundRobbinQueue
  @quantum = 100
  @processes = [] #[[name, time]]
  @completed_processes = [] #[[name, elapsed]]
  @elapsed = 0

  def initialize(quantum, processes)
    @quantum = quantum
    @processes = processes
    @elapsed = 0
    @completed_processes = []
  end

  def execute_process
    length = @processes.length
    until @processes == []
      length = @processes.length
        if @processes[0][1] <= @quantum
          @elapsed += @processes[0][1]
          @completed_processes.push([@processes[0][0], @elapsed])
          @processes.delete_at(0)
        else
          @processes[0][1] -= @quantum
          @processes.push(@processes[0])
          @processes.delete_at(0)
          @elapsed += @quantum
        end
      end
      return @completed_processes
  end
end

input_values_nq = gets.chomp.split.map(&:to_i)
n = input_values_nq[0]
q = input_values_nq[1]
input_processes = []
n.times do
  input_value = gets.chomp.split
  input_value[1] = input_value[1].to_i
  input_processes.push([input_value[0], input_value[1]])
end
roundrobbinqueue = RoundRobbinQueue.new(q, input_processes)
output = roundrobbinqueue.execute_process
length = output.length
for i in 0..(length-1)
  print output[i][0]
  print " "
  print output[i][1]
  print "\n"
end

Measured memory_bytes: 20900
#include <bits/stdc++.h>
using namespace std;
const int N=1e5+50;
int gi(){
    char ch=getchar(); int x=0,q=0;
    while(ch<'0'||ch>'9') q=ch=='-'?1:q,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return q?-x:x;
}
int a[N],b[N],c[N],d[N],f[N],p,ans;
map<int,int>fa;
int find(int x){
    return x==f[x]?x:f[x]=find(f[x]);
}
int main(){
    int n=gi(),s=0;
    for (int i=1; i<=n; ++i)
	c[i]=a[i]=gi(),s^=a[i];
    c[n+1]=a[n+1]=s,s=0;
    for (int i=1; i<=n; ++i)
	d[i]=b[i]=gi(),s^=b[i];
    ++n,d[n]=a[n]=s;
    sort(c+1,c+n+1);
    sort(d+1,d+n+1);
    for (int i=1; i<=n; ++i)
	if (c[i]!=d[i])
	    return puts("-1"),0;
    for (int i=1; i<=n; ++i){
	if (a[i]!=b[i]&&i!=n) ++ans;
	if (i==n&&ans==0){
	    cout<<0; return 0;
	}
	if (a[i]!=b[i]||i==n){
	    if (!fa[a[i]]) fa[a[i]]=++p;
	    if (!fa[b[i]]) fa[b[i]]=++p;
	}
    }
    for (int i=1; i<=p; ++i) f[i]=i;
    for (int i=1; i<=n; ++i)
	if (a[i]!=b[i])
	    f[find(fa[a[i]])]=find(fa[b[i]]);
    for (int i=1; i<=p; ++i)
	if (find(i)==i)
	    ++ans;
    cout<<ans-1;
    return 0;
}


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

int main()
{
    int N;
    cin >> N;
    bool ok = false;
    for(int i = 1;i < 10;i++){
        for(int j = 1;j < 10;j++) if(i * j == N) {
            ok = true;
        }
    }
    puts(ok ? "Yes" : "No");
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
	int i,j,n,a[26],in2,max1,max2,i1,l;
	char in[1],i2;
	
	while(1)
	{
	scanf("%d",&n);
	if(n==0) break;
	l=0;
	for(i=0;i<=25;i++)
	{
		a[i]=0;
	}
	for(i=0;i<=n-1;i++)
	{
		scanf("%s",in);
		in2=in[0];
		a[in2-65]++;
		max1=0;
		for(j=0;j<=25;j++)
		{
			if(max1<=a[j])
			{
				max1=a[j];
				i1=j;
			}
		}
		max2=0;
		for(j=0;j<=25;j++)
		{
			if(max2<=a[j]&&j!=i1)
			{
				max2=a[j];
			}
		}
		if((max1-max2)>n-i-1&&l==0&&i!=n-1) l=i;
		
	}
	i2=i1;
	if(l!=0) printf("%c %d\n",i2+65,l+1);
	else if(l==0&&max1!=max2) printf("%c %d\n",i2+65,n);
	else printf("TIE\n");
	}
	return 0;
}

Measured memory_bytes: 616
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define P pair<int,int>
#define rep(i,n) for(int i=0;i<n;i++)
#define mod 1000000007;
//最大公約数
int gcd(int s,int b){
    if(b==0)return s;
    return gcd(b,s%b);
}
signed main(){
    int n,d;
    cin>>n>>d;
    d=d*2+1;
    int p=(n-n%d)/d;
    if(n%d==0){
        cout<<p<<endl;
        return 0;
    }
    cout<<p+1<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const long long LINF = 1e18;
const long long MOD = 1e9 + 7;

vector<long long> divisor(long long n){
    vector<long long> res;
    for(int i = 1; (long long)i * i <= n; i++){
        if(n % i == 0){
            res.push_back(i);
            if(i != n / i) res.push_back(n / i);
        }
    }
    sort(begin(res), end(res));
    return res;
}

signed main(){
    int n;
    ll k;
    cin >> n >> k;
    ll a[n];
    ll sum = 0;
    REP(i,n){
        cin >> a[i];
        sum += a[i];
    }
    vector<ll> div = divisor(sum);
    reverse(ALL(div));
    for(auto d : div){
        vector<ll> b;
        REP(i,n){
            if(a[i] % d == 0) continue;
            b.emplace_back(a[i] % d);
        }
        int m = b.size();
        sort(ALL(b));
        vector<ll> rb(m);
        REP(i,m){
            rb[i] = d - b[i];
        }
        ll sum[m + 1] = {}, rsum[m + 1] = {};
        REP(i,m){
            sum[i + 1] = sum[i] + b[i];
        }
        for(int i = m - 1; i >= 0; i--){
            rsum[i] = rsum[i + 1] + rb[i];
        }
        ll t = LINF;
        for(int i = 0; i <= m; i++){
            t = min(t, max(sum[i], rsum[i]));
        }
        if(t <= k){
            cout << d << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)

int a,b,c,x,y;
ll solve(){
   ll ans=0;

    if(a+b<=2*c)ans=x*a+y*b;
    else{
      ll m=min(x,y);
      ans=2*c*m+(x-m)*a+(y-m)*b;
      chmin(ans,ll(2*c*max(x,y)));
    }
   return ans;
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    cin>>a>>b>>c>>x>>y;
    cout<<solve()<<endl;
    return 0;
}

Measured memory_bytes: 256
using System;

public class Hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        getAns(n);
    }
    static void getAns(int n)
    {
        for (int i = 1; i * i <= n; i++)
            if (n % i == 0 && i < 10 && n / i < 10)
            {
                Console.WriteLine("Yes");
                return;
            }
        Console.WriteLine("No");
    }
}


Measured memory_bytes: 13140
#include<cstdio>
#include<iostream>
#include<string>
using namespace std;
unsigned ac, wa, tle, re;
char S[4];

int main(){
    unsigned N;
    scanf("%u\n", &N);
    for (unsigned i = 0; i < N; i++){
        scanf("%s", S);
        if(S[0] == 'A') ac++;
        else if(S[0] == 'W') wa++;
        else if(S[0] == 'T') tle++;
        else re++;
    }
    printf("AC x %u\nWA x %u\nTLE x %u\nRE x %u\n", ac, wa, tle, re);
	return 0;
}

Measured memory_bytes: 3820
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;

#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 1; i < n + 1; i++)
#define PI 3.14159265359
#define EPS 0.0000000001
#define MOD 1000000007
//cout << std::fixed << std::setprecision(15) << y << endl;


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

    if(A <= C && B >= C){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}

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

using ll = long long;
constexpr ll inf = static_cast<ll>(1e17);
constexpr ll mod = static_cast<ll>(1e9 + 7);

int n, m;
ll x[100005], y[100005];
ll sumX[100005], sumY[100005];
int main() {
	std::cin >> n >> m;
	for (int i = 0; i < n; i++)
		std::cin >> x[i];
	for (int i = 0; i < m; i++)
		std::cin >> y[i];

	sumX[n - 1] = x[n - 1];
	for (int i = n - 2; i >= 0; i--)
		sumX[i] = (sumX[i + 1] + x[i]) % mod;

	sumY[m - 1] = y[m - 1];
	for (int i = m - 2; i >= 0; i--)
		sumY[i] = (sumY[i + 1] + y[i]) % mod;

	ll X = 0, Y = 0;
	for (int i = 0; i < n; i++) {
		ll t = sumX[i];
		(t += mod - ((n - i)*x[i]) % mod) %= mod;
		(X += t) %= mod;
	}
	for (int i = 0; i < m; i++) {
		ll t = sumY[i];
		(t += mod - ((m - i)*y[i]) % mod) %= mod;
		(Y += t) %= mod;
	}
	std::cout << (X*Y) % mod << std::endl;
}


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

int main(){
    int flag=0;
    int n=0,p;
    string s,t;
    int ans=0;

    cin >>s>>t;

    for (int i = 0; i < s.length(); i++){
        n=0;
        for (int j = 0; j < s.length(); j++){
            
            p=(i+j)%s.length();
            
            if(s[p]==t[j])n++;
        }
        if(n==s.length())flag=1;
        
    }
    
    
    //cout << ans <<endl;
    //cout <<fixed<<setprecision(16)<< ans <<endl;

    if(flag==1)cout << "Yes" <<endl;
    else cout << "No" <<endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
string solve(bool a) { return ((a) ? "Yes" : "No"); }
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
template <class T, class U>ostream& operator<<(ostream& os, const pair<T, U>& p) {
	os << "(" << p.first << "," << p.second << ")";
	return os;
}
template <class T>ostream& operator<<(ostream& os, const vector<T>& v) {
	os << "{";
	rep(i, v.size()) {
		if (i) os << ",";
		os << v[i];
	}
	os << "}";
	return os;
}
template <class T, class U>istream& operator>>(istream& is, pair<T, U>& p) {
	is >> p.first >>p.second ;
	return is;
}
template <class T>istream& operator>>(istream& is,  vector<T>& v) {
	rep(i, v.size()) {
		is >> v[i];
	}
	return is;
}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	string s;
	vector<char> ans;
	cin >>s;
	rep(i,s.size()){
		switch (s[i])
		{
		case '0':
			ans.pb('0');
			break;
		
		case '1':
			ans.pb('1');
			break;
			case 'B':
			if(ans.size()!=0){
				ans.pop_back();
			}
		}
	}
	rep(i, ans.size()) { cout << ans[i]; }
	cout << endl;
}

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

typedef vector<int> vi;
typedef vector<double> vd;

double mypow(double b ,int e){
	  if(e == 0) return 1;
	  if(e%2==0)
			return mypow( b*b, e/2 );
	  else
			return mypow( b*b, e/2 ) * b;
}

int main(){


	  int N,M,L; cin >> N >> M >> L ;
	  if(N==1){
			cout << 1.0 << endl;
			return 0;
	  }
	  vector<vd> prob(N,vd(M+1,0.0));
	  vector<vd> dist(N,vd(M+1,0.0));

	  vd p(N),t(N),v(N);
	  for(int i=0; i<N; i++)	cin >> p[i] >> t[i] >> v[i];

	  // PRE PROCESS
	  for(int i=0; i<N; i++){
			dist[i][0] = (double)L / v[i];
			for(int j=1; j<=M; j++){
				  dist[i][j] = dist[i][j-1] + t[i];
			}
	  }
	  for(int i=0; i<N; i++)
			prob[i][0] = mypow((100-p[i])/100,M);
	  for(int i=0; i<N; i++){
			for(int j=1; j<=M; j++){
				  if(p[i] != 100)
						prob[i][j] = (prob[i][j-1] * (p[i]/100)) / ((100-p[i])/100);
				  else
						prob[i][j] = 1.0;
			}
	  }
	  double comb = 1;
	  for(int j=1; j<=M; j++){
			comb = comb * (M - j + 1) / j; 
			for(int i=0; i<N; i++){
				  prob[i][j] *= comb;
			}
	  }
	  
	  vector<vd> sum = prob;
	  for(int i=0; i<N; i++){
			for(int j=M-1; j>=0; j--){
				  sum[i][j] += sum[i][j+1];
				  if(sum[i][j] > 1) sum[i][j] = 1;
			}
	  }
	  /*
	  //DUMP
	  for(int i=0; i<N; i++){
			for(int j=0; j<=M; j++)
				  cout << dist[i][j] << " ";
			cout << endl;
	  }
	  	  //DUMP
	  for(int i=0; i<N; i++){
			for(int j=0; j<=M; j++)
				  cout << prob[i][j] << " ";
			cout << endl;
	  }
	  */
	  vector<vd> ans = prob;
	  for(int i=0; i<N; i++){
			for(int j=0; j<=M; j++){
				  for(int k=0; k<N; k++){
						if(i==k) continue;
						int id = upper_bound(dist[k].begin(),dist[k].end(), dist[i][j]) - dist[k].begin();
						if(id > M) ans[i][j] = 0.0;
						else 	   ans[i][j] *= sum[k][id];

				  }
			}
	  }
	  /*
	  //DUMP
	  for(int i=0; i<N; i++){
			for(int j=0; j<=M; j++)
				  cout << ans[i][j] << " ";
			cout << endl;
	  }
	  */
	  for(int i=0; i<N; i++){
			double tmp = 0.0;
			if(p[i] == 100) tmp = ans[i][M];
			else
				  for(int j=0; j<=M; j++)
						tmp += ans[i][j];
//			cout << tmp << endl;
			if(tmp > 1) tmp = 0;
			printf("%.10f\n",tmp);
	  }
						
}

Measured memory_bytes: 1428
N = int(input())
A1 = [[int(i) for i in input().split(" ")], [int(i) for i in input().split(" ")]]

sum_point = 0
tmp =0
for i in range(N):
    tmp = max(tmp, sum(A1[0][:i + 1]) + sum(A1[1][i:]))

print(tmp)


Measured memory_bytes: 3060
N = int(input())
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))

i = 0
AB_comb = [0] * N
for b in range(N):
    tmp = AB_comb[b - 1]
    while i < N and A[i] < B[b]:
        tmp += 1
        i += 1
    AB_comb[b] += tmp

i = 0
ABC_comb = [0] * N
for c in range(N):
    tmp = ABC_comb[c - 1]
    while i < N and B[i] < C[c]:
        tmp += AB_comb[i]
        i += 1
    ABC_comb[c] += tmp

print(sum(ABC_comb))


Measured memory_bytes: 23940
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>
#include<iomanip>

using namespace std;

typedef long long ll;

typedef std::pair<int, int> ipair;
bool lessPair(const ipair& l, const ipair& r){return l.second < r.second;}
bool morePair(const ipair& l, const ipair& r){return l.second > r.second;}

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;
}

const ll MOD = 1e9 + 7;
// const long long INF = 1LL<<60;
void add(long long &a, long long b) { a += b; if (a >= MOD) a -= MOD; }
void sub(long long &a, long long b) { a -= b; if (a < 0) a += MOD; }
void mul(long long &a, long long b) { a *= b; a %= MOD; }
ll llmin(ll a, ll b) { if (a < b) return a; else return b; }
ll llmax(ll a, ll b) { if (a < b) return b; else return a; }
ll llabs(ll a) { if (a >= 0) return a; else return - a; }
ll llmodpow(ll a, ll n) {
   if (n == 0) return 1;
   ll tmp = llmodpow(a, n / 2);
   mul(tmp, tmp);
   if (n & 1) mul(tmp, a);
   return tmp;
}

int main() {
   int x, a, b;
   cin >> x >> a >> b;
   if (abs(a - x) > abs(b - x)) cout << "B" << endl;
   else cout << "A" << endl;
   return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int sosuu(int);

int main(){
  int n,count=0,i;
  int S[10000];

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&S[i]);
    if(sosuu(S[i])==1)count=count+1;
  }
  printf("%d\n",count);
  return 0;
}

int sosuu(int S){
  int i;

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

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

  for(i=3;i<=S/i;i=i+2){
    if(S%i == 0)return 0;
  }
  return 1;
}
    
  



Measured memory_bytes: 2068
# -*- coding: utf-8 -*-

# Input Stdin
## 1 <= N <= 10^6

N = int(input())
sum_fizzbuzz = 0
for i in range(1, N + 1):
    fz = ''
    if i % 3 == 0:
        fz = fz + 'Fizz'
    if i % 5 == 0:
        fz = fz + 'Buzz'
    if fz == '':
        sum_fizzbuzz = sum_fizzbuzz + i

print(sum_fizzbuzz)

Measured memory_bytes: 9180
n = int(input())
A = list(map(int, input().split()))
ans = 1
flag = 0
zeroflag = 0
for a in A:
    if a == 0:
        print(0)
        exit()
for a in A:
    ans *= a
    if ans > pow(10, 18):
        print(-1)
        exit()
print(ans)


Measured memory_bytes: 84716
n = int(input())
cost = list(map(int, input().split(" ")))

dp = [None for i in range(n)]
dp[0] = 0
dp[1] = abs(cost[1] - cost[0])


for i in range(2, n):
     one_step_cost = abs(cost[i] - cost[i-1]) + dp[i-1]
     two_step_cost = abs(cost[i] - cost[i-2]) + dp[i-2]
     best_cost = min([one_step_cost, two_step_cost])
     dp[i] = best_cost


print(dp[n-1])

Measured memory_bytes: 13924
import java.util.Scanner;
import java.util.Arrays;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      	int n = sc.nextInt();
      	int[] a = new int[n];
      	for(int i = 0; i < n; i++)
          a[i] = sc.nextInt();
      	Arrays.sort(a);
      	int ali, bob;
      	ali = bob = 0;
      	for(int i = 0; i < n; i++)
        	if(i % 2 == 0)
            	ali += a[i];
      		else
              	bob += a[i];
        if(ali > bob)
            System.out.println(ali-bob);
        else
            System.out.println(bob-ali);
    }
}



Measured memory_bytes: 25172
#include<stdio.h>
int main(void)
{
    int a, b;
    scanf("%d %d", &a, &b);
    if (a > b)
        printf("a > b\n");
    else if (a < b)
        printf("a < b\n");
    else 
        printf("a == b\n");
    return 0;
}

Measured memory_bytes: 1744
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <algorithm>
#define MP make_pair
using ll = long long;
using namespace std;

int main()
{
  int N,A;
  cin >> N >> A;
  cout << N*N - A << endl;
  return 0;
}


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

#define sync ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define endl "\n"
#define ends ' '
#define die(x) return cout << x << endl, 0
#define all(v) v.begin(), v.end()
#define sz(x) (int)(x.size())
#define debug(x) cerr << #x << ": " << x << endl
#define debugP(p) cerr << #p << ": {" << p.first << ", " << p.second << '}' << endl
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const ll INF = 1e9, MOD = 1e6 + 7;
 
/////////////////////////////////////////////////////////////////////
 
const int N = 1e5 + 5;

ll toInt(string s) {
	ll ans = 0;
	for (char c : s) ans = (ans * 10 + c - '0');
	return ans;
}

int main() {
 
	sync;

	string s; cin >> s;
	ll ans = 0;
	for (int mask = 0; mask < (1 << (sz(s) - 1)); mask++) {
		int last = 0;
		ll tmp = 0;
		for (int i = 0; i < sz(s) - 1; i++) if (mask & (1 << i)) {
			tmp += toInt(s.substr(last, i - last + 1));
			last = i + 1;
		}
		tmp += toInt(s.substr(last, sz(s) - last));
		ans += tmp;
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n); for(long long i = 0;i < (n);i++)
using ll = long long;
using vl = vector<long long>;
using P = pair<long long,long long>;
 
int main(){
    double r; cin >> r;
    cout << 2*r*3.1415 << endl;
}

Measured memory_bytes: 3784
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Edge = int;
using Graph = vector<vector<ll>>;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
const ll MOD = 1000000007;
const ll nmax = 8;
const ll INF = 1e9;
bool graph[nmax][nmax];
vector<vector<ll>> dist = vector<vector<ll>>(nmax, vector<ll>(nmax, INF));
void warshall_floyd(ll n)
{
    for (size_t i = 0; i < n; i++)
    {
        for (size_t j = 0; j < n; j++)
        {
            for (size_t k = 0; k < n; k++)
            {
                dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]);
            }
        }
    }
}

class UnionFind
{
public:
    vector<ll> Parent;

    UnionFind(ll N)
    {
        Parent = vector<ll>(N, -1);
    }
    ll find(ll A)
    {
        if (Parent[A] < 0)
            return A;
        return Parent[A] = find(Parent[A]);
    }

    ll size(ll A)
    {
        return -Parent[find(A)];
    }

    bool Union(ll A, ll B)
    {
        A = find(A);
        B = find(B);
        if (A == B)
        {
            return false;
        }
        if (size(A) < size(B))
            swap(A, B);

        Parent[A] += Parent[B];
        Parent[B] = A;

        return true;
    }
};

ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}

ll lcm(ll a, ll b)
{
    ll g = gcd(a, b);
    return a / g * b;
}

ll mulMod(ll a, ll b)
{
    return (((a % MOD) * (b % MOD)) % MOD);
}

ll powMod(ll a, ll p)
{
    if (p == 0)
    {
        return 1;
    }
    else if (p % 2 == 0)
    {
        ll half = powMod(a, p / 2);
        return mulMod(half, half);
    }
    else
    {
        return mulMod(powMod(a, p - 1), a);
    }
}

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

void solve(long long N, std::vector<long long> a, std::vector<long long> b)
{
}

int main()
{
    long long N;
    scanf("%lld", &N);
    Graph G(N);
    vector<pair<int,int>> edge;
    for (int i = 0; i < N - 1; i++)
    {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        edge.emplace_back(a, b);
        G[a].push_back(b);
        G[b].push_back(a);
    }

    int K = 0;
    map<pair<int, int>, int> I;
    vector<int> cs(N, 0);
    vector<int> used(N, 0);

    queue<int> que;
    used[0] = 1;

    que.emplace(0);

    while (!que.empty())
    {
        int v = que.front();
        que.pop();
        int cur = 1;
        if (K < (int)G[v].size())
            K = G[v].size();
        for (auto &&pv : G[v])
        {
            if (used[pv])
                continue;
            if (cur == cs[v])cur++;
            cs[pv]=I[make_pair(v,pv)]=I[make_pair(pv,v)]=cur++;
            used[pv] = 1;
            que.emplace(pv);
        }
    }

    cout << K << endl;

    for (auto &&i : edge)
    {
        cout << I[i] << endl;
    }
    
    return 0;
}


Measured memory_bytes: 20724
#include <stdio.h>
#include <string.h>

int CHECK(char S[],int num);

int main(void){
   
   char S[20];
   
   scanf("%s",S);
   
   int moji = 0;
   while(1){
      if(S[moji] == '\0'){
         break;
      }
      moji++;
   }
   
   int i,j;
   char Temp[20];
   int temp = 0;
   int ans = 0;
   
   for(i = 0;i < moji;i++){
      for(j = 0;j < moji;j++){
         if(moji > i+j){
            strncpy(Temp,S+i,moji - i - j);
            Temp[moji - i - j] = '\0';
            //printf("%s\n",Temp);
            temp = CHECK(Temp,moji - i - j);
            if(temp > ans){
               ans = temp;
            }
         }
      }
   }
   
   printf("%d\n",ans);
   
   return 0;
}

int CHECK(char S[],int num){
   
   int i;
   int flag = 0;
   for(i = 0;i < num;i++){
      if(S[i] == 'A' || S[i] == 'C' || S[i] == 'G' || S[i] == 'T'){
         flag = 0;
      }
      else {
         flag = 1;
         break;
      }
   }
   
   if(flag == 0){
      return num;
   }
   else {
      return 0;
   }
   
   
}


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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pll;
typedef vector<bool> vb;
const ll oo = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define FORD(i,a,b) for (ll i = (b)-1; i >= (a); i--)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define TR(X) ({ if(1) cerr << "TR: " << (#X) << " = " << (X) << endl; })

const ll MOD = 1e6 + 3, N = MOD;
ll inv[N], fac[N], inv_fac[N];

ll exp_mod(ll a, ll n) {
	ll res = 1;
	for (; n; n /= 2) {
		if (n&1) res = res*a % MOD;
		a = a*a % MOD;
	}
	return res;
}

ll inv_mod(ll a) {
	return exp_mod(a,MOD-2);
}

void precalc() {
	inv[1] = 1;
	FOR(n,2,N) inv[n] = -(MOD/n)*inv[MOD%n] % MOD;

	fac[0] = 1;
	FOR(n,1,N) fac[n] = n*fac[n-1] % MOD;

	inv_fac[0] = 1;
	FOR(n,1,N) inv_fac[n] = inv[n]*inv_fac[n-1] % MOD;
}

ll solve(ll x, ll d, ll n) {
	if (d == 0) return exp_mod(x,n);
	if (x == 0) return 0;
	
	ll k = x*inv_mod(d) % MOD;
	if (k < 0) k += MOD;
	assert(k > 0);

	if (k+n-1 >= MOD) return 0;

	ll res = fac[k+n-1] * inv_fac[k-1] % MOD;
	res = res * exp_mod(d,n) % MOD;
	return res;
}

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

	ll tc; cin >> tc;
	while (tc--) {
		ll x, d, n;
		cin >> x >> d >> n;
		ll res = solve(x,d,n);
		if (res < 0) res += MOD;
		cout << res << endl;
	}

}



Measured memory_bytes: 24320
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int[] P = new int[M];
        int[] Y = new int[M];
        for (int i = 0; i < M; i++) {
            P[i] = sc.nextInt();
            Y[i] = sc.nextInt();
        }
        Map<Integer, Integer> map = new TreeMap<>();
        for (int i = 0; i < M; i++) {
            map.put(Y[i], i);
        }
        int[] counter = new int[N];
        int[] x = new int[M];
        for (int value : map.values()) {
            counter[P[value] - 1]++;
            x[value] = counter[P[value] - 1];
        }
        for (int i = 0; i < M; i++) {
            String res = String.format("%06d", P[i]) + String.format("%06d", x[i]);
            System.out.println(res);
        }
        sc.close();
    }
}

Measured memory_bytes: 155716
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<algorithm>
using namespace std;

typedef pair<int,int> pii;

int main(){
    int n;
    cin >> n;
    vector<int> v[n], deg(n, 0);
    vector<pii> vp;
    for(int i = 0; i < n-1; i++){
        int a, b;
        cin >> a >> b;
        a--, b--;
        v[a].push_back(b);
        v[b].push_back(a);
        vp.push_back({a,b});
        deg[a]++, deg[b]++;
    }
    int k = *max_element(deg.begin(), deg.end());
    cout << k << endl;
    int f;
    for(int i = 0; i < n; i++)  if(deg[i] == k) f = i;
    map<pii,int> col;
    queue<pii> q;
    q.push({0,f});
    vector<bool> vis(n, 0);
    vis[f] = true;
    while(!q.empty()){
        auto x = q.front();  q.pop();
        int now = 1;
        for(int child : v[x.second]){
            if(vis[child])  continue;
            vis[child] = true;
            if(now == x.first)  now++;
            col[{min(x.second,child),max(x.second,child)}] = now;
            q.push({now++, child});
        }
    }
    for(pii p : vp) cout << col[p] << endl;
    return 0;
}


Measured memory_bytes: 13428
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    string s;
    cin >> n >> s;
    int ans = 0;
    for (int i = 1; i < n; i++) //区切る位置
    {
        int cnt = 0;

        for (char c = 'a'; c <= 'z'; c++)
        {
            bool left = false, right = false;

            for (int j = 0; j < i; j++)
                if (s[j] == c)
                    left = true;

            for (int j = i; j < n; j++)
                if (s[j] == c)
                    right = true;

            if (left && right)
                cnt++;
        }

        if (ans < cnt) //数が一番多いものを保持してく
            ans = cnt;
    }

    cout << ans << endl;
}

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

using namespace std;

int main (){

  string s;
  int n;
  
  cin>>n;
  cin>>s;
  
  for(int i = 0 ; i < s.size() ; i++){
    if(s[i]+n > 'Z') {s[i] = 'A'+n-('Z'-s[i]+1);}
    else {s[i] += n;}
   
  }
  
  cout<<s<<endl;
}

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

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

	int n, m, x;
	cin >> n >> m >> x;
	int c[n+1];
	int a[n+1][m+1], sum[m+1], cost = 0, ans = oo;
	for(int i=0; i<n; i++){
		cin >> c[i];
		for(int j=0; j<m; j++){
			cin >> a[i][j];
			sum[j] = 0;
		}
	}

	map<int, int> mp;
	int i = 10000;
	bool ok = true;
	while(i--){
		int y = rand()%n;
		if(mp[y] != 5){
			ok = true;
			cost += c[y];
			for(int i=0; i<m; i++){
				sum[i] += a[y][i];
				if(sum[i] < x) ok = false;
				//cout << sum[i] << ' ';
			}
			//cout << endl << cost << endl;
			if(ok) ans = min(ans, cost);
			mp[y] = 5;
		}
		else{
			//cout << "else";
			if(mp.size() == n){
				mp.clear();
				for(int i=0; i<m; i++) sum[i] = 0;
				cost = 0;
			}
		}
	}

	if(ans == 1000000007) cout << "-1";
	else cout << ans;

	return 0;
}


Measured memory_bytes: 3668
// Problem : B - Magic 2
// Contest : AtCoder - M-SOLUTIONS Programming Contest 2020
// URL : https://atcoder.jp/contests/m-solutions2020/tasks/m_solutions2020_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

/*

WINNERS NEVER QUIT AND QUITTERS NEVER WIN!!

*/

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<long,long> pl;
typedef pair<ll,ll> pll;
typedef vector<long> vl;
typedef vector<bool> vb;
typedef vector<ll> vll;
typedef vector<vl> vvl;
typedef vector<vb> vvb;
typedef vector<vll> vvll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef unordered_map<ll,ll> umll;

#define FOR(i,a,b) for(long long i=a;i<b;++i)
#define REV(i,a,b) for(long long i=a;i>=b;i--)
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define ub upper_bound
#define lb lower_bound
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define tc ll tests;cin>>tests;while(tests--)
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define coutv(v) for(auto it: (v))cout<<it<<" ";newl;
#define cout2d(v) for(auto it: (v)) {for(auto j:it) cout<<j<<" ";newl;}
#define cinv(v,n) vll (v)(n);FOR(i,0,(n)){cin>>v[i];}
#define cinvg(v,n) (v).resize(n);FOR(i,0,(n)){cin>>v[i];}
#define cin2d(v,n,m) vvll (v)(n,vll(m,0));FOR(i,0,n){FOR(j,0,m){cin>>v[i][j];}}
#define cin2dg(v,n,m) (v).resize(n,vll(m));FOR(i,0,n){FOR(j,0,m){cin>>v[i][j];}}
#define newl cout<<"\n"
#define mod 1000000007
#define INF LLONG_MAX/2

int main()
{
    io;
    ll r,g,b,k;
    cin>>r>>g>>b>>k;
    while(g<=r && k>0)
    {
    	g*=2;
    	k--;
    }
    while(b<=g && k>0)
    {
    	b*=2;
    	k--;
    }
    if(b>g && g>r)
    {
    	cout<<"Yes";
    }
    else
    {
    	cout<<"No";
    }
    return 0;
}



Measured memory_bytes: 3644
n, d = input().split(' ')
n = int(n)
d = int(d)
d = d ** 2
ans = 0
for _ in range(n):
	x, y = input().split(' ')
	x = int(x)
	y = int(y)
	dx = x ** 2 + y ** 2
	if dx <= d:
		ans = ans + 1
print(ans)

Measured memory_bytes: 9144
#include<stdio.h>

int main(){
int a[10];
int i,n,m,b=0,c=1,d=2;

for(i=0;i<10;i++){
scanf("%d",&a[i]);
}

for(i=0;i<3;i++){
	for(n=i;n<10;n++){
		if(a[i]<a[n]){
			m=a[i];
			a[i]=a[n];
			a[n]=m;
		}
	}
}
	
printf("%d\n",a[b]);
printf("%d\n",a[c]);
printf("%d\n",a[d]);

		
    return 0;
}

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

class smart_sieve
{
    ll L, R, M;
    vector<int> small;
    vector<vector<ll>> large;
    vector<ll> aux;

public:
    smart_sieve(ll L, ll R): L(L), R(R), M(sqrt(R)+1)
    {
        small.resize(M);
        iota(small.begin(), small.end(), 0);
        large.resize(R-L);
        aux.assign(R-L, 1);

        for(ll i=2; i*i<R; i++)
        {
            if(small.at(i) < i) continue;
            small.at(i) = i;
            for(ll j=i*i; j<M; j+=i)
                if(small.at(j) == j) small.at(j) = i;
            
            for(ll j=(L+i-1)/i*i; j<R; j+=i)
            {
                ll k=j;
                do
                {
                    if(aux.at(j-L)*aux.at(j-L) > R) break;
                    large.at(j-L).push_back(i);
                    aux.at(j-L) *= i;
                    k /= i;
                } while (k%i == 0);
            }
        }
    }
    vector<ll> factor(ll n)
    {
        assert(L <= n && n < R);
        vector<ll> res = large.at(n-L);
        n /= aux.at(n-L);
        if(n >= M)
        {
            res.push_back(n);
            return res;
        }
        while(n > 1)
        {
            res.push_back(small.at(n));
            n /= small.at(n);
        }
        return res;
    }
};

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    cin >> N;
    vector<int> A(N);
    for(int i=0; i<N; i++) cin >> A[i];
    sort(A.begin(), A.end());

    const int MAX = 1e6+5;
    smart_sieve sieve(0, MAX);
    vector<bool> is_used(MAX, false);
    bool is_pc = true;
    for(int i=0; i<N; i++)
    {
        auto vec = sieve.factor(A[i]);
        set<ll> s(vec.begin(), vec.end());
        for(auto num : s)
        {
            if(is_used[num])
            {
                is_pc = false;
                break;
            }
            for(int j=num; j<MAX; j+=num)
            {
                if(is_used[j]) break;
                is_used[j] = true;
            }
        }
        if(!is_pc) break;
    }

    int sc = A[0];
    for(int i=1; i<N; i++)
    {
        sc = gcd(sc, A[i]);
    }

    if(is_pc) cout << "pairwise coprime\n";
    else if(sc == 1) cout << "setwise coprime\n";
    else cout << "not coprime\n";

    return 0;
}


Measured memory_bytes: 82372
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> pi;
int main(){
	int n;
	cin>>n;
	vector<pair<pi,int> >arr;
	for(int i=0; i<n; i++){
		int x,y;
		cin>>x>>y;
		arr.push_back(make_pair(pi(x,y),0));
	}
	for(int i=0; i<n; i++){
		int x,y;
		cin>>x>>y;
		arr.push_back(make_pair(pi(x,y),1));
	}
	sort(arr.begin(),arr.end());
	int ret = 0;
	int y_coord[505]={0};
	for(int i=0; i<arr.size(); i++){
		if(arr[i].second==0) y_coord[arr[i].first.second]++;
		else{
			int y = arr[i].first.second;
			for(int j=y-1; j>=0; j--){
				if(y_coord[j]){
					ret++;
					y_coord[j]--;
					break;
				}
			}
		}
	}
	cout<<ret;
}

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

int main(){
    int t;
    cin >> t;

    for(int j=0; j<t; j++){
        int n;
        cin >> n;

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

        string s;
        cin >> s;

        /* solve */
        bool flag = true;
        vector<long long int> xor_basis;

        for(int i=n-1; i>=0; i--){
            long long int b = a[i];

            for(long long int xb : xor_basis){
                b = min(b, b ^ xb);
            }

            if(b != 0){// b cannot be represented via already-existing bases
                if(s[i] == '0') xor_basis.push_back(b);
                if(s[i] == '1'){ flag = false; break; }
            }
        }
        if(flag == true)  cout << 0 << endl;
        if(flag == false) cout << 1 << endl;
    }
    return 0;
}

Measured memory_bytes: 3532
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
bool f(int n)
{
    if(n==0) return true;
    else if(n<0) return false;
    return f(n-4) || f(n-7);
}
 
int main()
{
   int n;cin>>n;
   cout<<(f(n) ? "Yes" : "No");
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){ 
    long long a,b,c,d;
    cin >> a >> b >> c >> d;
    if((b >0 && d >0) || (b<0 && d<0) ){
        cout << max(a*c,b*d) << endl;
    }else{
        if(d < 0 && b > 0){
            if(a < 0){
                cout << a*c << endl;
            }else{
               cout << d*a << endl;
            }
        }else if(d > 0 && b < 0){
            if(c < 0){
                cout << a*c << endl;
            }else{
                cout << b*c << endl;
            }
        }else if(d == 0 && b == 0){
            cout << a*c << endl;
        }else if(d == 0){
            if(a < 0){
                cout << a*c << endl;
            }else{
                cout << 0 << endl;
            }
        }else if(b == 0 ){
            if(c < 0){
                cout << a*c << endl;
            }else{
                cout << 0 << endl;
            }
        }
    }
}

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

int main(int argc, char const *argv[])
{
    int n;
    cin >> n;
    int ans = 0;
    vector<int> b(n-1);
    for(int i = 0; i < n-1; i++) {
        cin >> b[i];
    }
    for(int i = 0; i < n; i++) {
        if(i == 0){
            ans += b[i];
        } else if(i == n - 1) {
            ans += b[i-1];
        } else {
            ans += min(b[i], b[i-1]);
        }
    }
    cout << ans << endl;

    return 0;
}


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

int main(){
#ifdef LOCAL
    freopen("./input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    string s, t;
    cin >> s >> t;
    int cnt = 0;
    for (int i = 0; i < 3; i++) {
        if(s[i] == t[i])cnt ++;
    }
    cout << cnt << "\n";
    return 0;
}



Measured memory_bytes: 256
/*
for (int i = 0; i < N; ++i){}

// 各桁の和を計算する関数
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

sort(a, a + N, greater<int>());  // a[0:N] を大きい順にソート

int num[110] = {0};  // バケット
for (int i = 0; i < N; ++i) {
    num[d[i]]++;  // d[i] が 1 個増える
}

map<string, int> mp; // 連想配列 map<キー型, 値型> オブジェクト名
for (int i = 0; i < N; ++i) {
    auto itr = mp.find(s[i]);        // s[i] が設定されているか？
    if(itr != mp.end() ) {
         mp[s[i]] += 1;
    }
    else {
         mp[s[i]] += 1 ;
    }
}
stack<int> s;	//intをデータとするスタックを用意
s.push(1);		//{} -> {1}
printf("%d\n", s.top());	// 3
s.pop();

queue<int> que;	//intをデータとするキューを用意
que.push(1);		//{} -> {1}
printf("%d\n", que.front());	// 1
que.pop();
*/
typedef long long ll;
#include <iostream>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>

using namespace std;

// #define for(i,a,b) for (int i=(a);i<(b);++i)
#define rep(i,n) for(i,0,n)
 
int main() {
	// 入力
    int N, D, X;
    cin >> N >> D >> X;
    int A[N];
    for (int i = 0; i < N; ++i) cin >> A[i];
 
	// 解法
	int ans = X;
    for (int i = 0; i < N; ++i){
    	// cout << D/A[i] + 1 << " ";
    	ans += (D-1)/A[i]+1;
    }
	
    //出力
    cout << ans << endl;
}
 


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

int main() {
  long N, M;
  cin >> N >> M;
  vector<long> A(N);
  for (long i = 0; i < N; i++) cin >> A.at(i);

  long sum = accumulate(A.begin(), A.end(), 0L);

  long cnt = 0;
  for (long i = 0; i < N; i++) {
    if (A.at(i) >= sum * ((double) 1 / (4 * M))) cnt++;
  }

  cout << ((cnt >= M) ? "Yes" : "No") << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using itn = int;
using namespace std;
int GCD(int a, int b) {
	return b ? GCD(b, a%b) : a;
}
//sort(a, a + N, greater<int>())   // descend
//sort(a, a+N)                    //  ascend

using ll = long long;
using namespace std;

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

	if (x < a) cout << "0";
	else if (x >= a) cout << "10";
}


Measured memory_bytes: 256
import numpy as np

N, D = map(int, input().split())
X = []
for i in range(N):
    li = list(map(int,input().split()))
    X.append(li)

X = np.array(X)

cnt = 0
for i in range(N):
    for j in range(i,N):
        if i != j:
            distance = np.sqrt(np.power(X[i]-X[j], 2).sum())
            if distance.is_integer():
                cnt += 1

print(cnt)

Measured memory_bytes: 21644
a = list(map(int, list(input())))
size = len(a)

for i in range(2**(size-1)):
    op = [(i >> j) & 1 for j in range(size)][::-1]
    tmp = [k * (-1)**j for j, k in zip(op, a)]
    if sum(tmp) == 7:
        s = ''.join([('-' if j == 1 else '+') + str(k) for j, k in zip(op, a)])
        print(s[1:] + '=7')
        break

Measured memory_bytes: 3064
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
//#define cerr if(false) cerr
#ifdef DEBUG
#define show(...) cerr << #__VA_ARGS__ << " = ", debug(__VA_ARGS__);
#else
#define show(...) 42
#endif
using namespace std;
using ll = long long;
using pii = pair<int, int>;
template <typename T, typename S>
ostream &operator<<(ostream &os, pair<T, S> a) {
    os << '(' << a.first << ',' << a.second << ')';
    return os;
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> v) {
    for (auto x : v) os << x << ' ';
    return os;
}
void debug() {
    cerr << '\n';
}
template <typename H, typename... T>
void debug(H a, T... b) {
    cerr << a;
    if (sizeof...(b)) cerr << ", ";
    debug(b...);
}
int main(){
    int a, b;
    cin >> a >> b;
    for(int i = b - a + 1; i < a + b ; i++){
        cout << i << " ";
    }
}

Measured memory_bytes: 256
//gauravsinghh
#pragma GCC optimize("O3", "unroll-loops")
#pragma GCC target("avx2")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long int
#define ld long double
#define db double
#define pii pair<int,int>
#define pll pair<long long,long long>
#define sii set<int>
#define sll set<long long>
#define vii vector<int> 
#define vll vector<long long>
#define mii map<int,int>
#define mll map<long long, long long>
#define lob lower_bound
#define upb upper_bound
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define pf push_front
#define ins insert
#define mp make_pair
#define w(t) cin >> t;while(t--)
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define os cout<<" "
#define bitcount __builtin_popcount
#define gcd __gcd
#define endl "\n"
#define present(s,x) (s.find(x) != s.end()) 
#define cpresent(s,x) (find(all(s),x) != s.end()) 
#define ford(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++) 
#define fors(container, it, a, b) for(__typeof(container.begin()) it = a; it != b; it++) 
#define EPSILON 1e-9
#define PI 3.14159265358979323846
#define inf 1000000000
#define lim 100005
#define fbo find_by_order
#define ook order_of_key
#define sz(s) (int)s.size()
#define mem(n,m) memset(n,m,sizeof(n))
#define deb(x) cout << #x << " " << x << endl;
#define rep(i,n) for(ll i = 0; i < n; i++)
#define ren(i,n) for(ll i = n-1; i >= 0; i--)
#define all(x) x.begin(),x.end()
#define fo(i, a, b) for(ll i = a; i <= b; i++)
#define ffo(i, a, b) for(ll i = a; i >= b; i--)
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;
 
void io_set() {
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}
 
int main(){
    IOS
    //io_set();

    ll n, f = 0;
    cin >> n;
    ll pk = min(9ll, n);
    fo(i, 1, pk){
    	ll x = n/i;
    	if(n%i == 0){
    		if(i <=9 && n/i <=9){
    			f = 1;
    			break;
    		}
    	}
    }

    if(f){
    	cout << "Yes\n";
    }
    else{
    	cout << "No\n";
    }
    return 0;
} 

Measured memory_bytes: 256
#include <iostream>

int main(void){
    char a,b;
    std::cin >> a >> b;
    if(a == 'H'){
        if(b == 'H') {
            std::cout << 'H';
        }
        else std::cout << 'D';
    }
    else{
        if(b=='H') std::cout << 'D';
        else std::cout << 'H';
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,l,n,ll[10000]={};
	cin >> a >> b;
	for(int i=1;i<=a;i++){
		cin >>	l;
		ll[i]=ll[i-1]+l;
		if(ll[i]>b){
			n=i;
			break;
			}
	}
	cout << n << '\n';
return 0;
}	



Measured memory_bytes: 256
// ~/Remember,remember the 6th of March

#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
const double PI = acos(-1.0);
const double  EPS = 1e-9;
const ll MOD = 1e9 + 7;
using namespace std;
int main()
{
    int n;
    cin>>n;
    vector<int>arr(n+1),col(n+1),ans;
    for(int i=1; i<=n; i++)
        cin>>arr[i];
    for(int i=n; i>0; i--)
    {
        col[i]=arr[i];
        for(int j=i+i; j<=n; j+=i)
            col[i]^=col[j];
        if(col[i])
            ans.push_back(i);
    }
    cout<<ans.size()<<endl;
    for(int i=0; i<ans.size(); i++)
        if(ans[i])
            cout<<ans[i]<<" ";
    return 0;
}


Measured memory_bytes: 3064
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define pye cout << "yes" << endl;
#define pno cout << "no" << endl;
#define pYe cout << "Yes" << endl;
#define pNo cout << "No" << endl;
#define pYE cout << "YES" << endl;
#define pNO cout << "NO" << endl;
#define prin(num) cout << num << endl;
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define INF 1000000000
#define MOD 1000000007LL
#define MAX 200005
#define NIL -1
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef map<ll, ll> Map;

int main(void) {
    ll n;
    string w[100];
    cin >> n;
    char t;
    ll i;
    map<string, ll> mp;
    for(i=0; i<n; i++) {
        cin >> w[i];
        if(mp[w[i]]) {
            pNo
            return 0;
        }
        mp[w[i]]=1;
        
    }
    
    t=w[0][(ll)w[0].size()-1];
    for(i=1; i<n; i++) {
        if(w[i][0]!=t) {
            pNo
            return 0;
        }
        t=w[i][(ll)w[i].size()-1];
    }
    pYe
    
}


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

int main(){
    string s,ans;
    cin >> s;
    int n;
    n = s.size();
    rep(i,n) s[i] = 'x';
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 256