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

int main(){
  int N,A,B;
  string S;
  cin >> N >> A >> B >> S;
  int count=0,globalcount=0;
  for(int i=0;i<N;i++){
    if(S.at(i)=='a'){
      if(count<A+B){
        cout << "Yes" << endl;
        count++;
      }
      else{
        cout << "No" << endl;
      }
    }
    else if(S.at(i)=='b'){
      if(count<A+B && globalcount<B){
        cout << "Yes" << endl;
        count++;
        globalcount++;
      }
      else{
        cout << "No" << endl;
      }
    }
    else{
      cout << "No" << endl;
    }
  }
}

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

typedef struct {
  int time,out;
} set;

int cmp( const void *p, const void *q ) {
    return ((set*)p)->out - ((set*)q)->out;
}


int main(){
  int i,j,k=0;
  int N;
  scanf("%d",&N);
  set A[N];
  for(i=0;i<N;i++){
    scanf("%d %d",&A[i].time,&A[i].out);
  }
  qsort(A,sizeof(A)/ sizeof(set),sizeof(set),cmp);
  
  for(i=0;i<N;i++){
    k+=A[i].time;
    if(A[i].out < k){
      puts("No");
      return 0;
    }
  }
  puts("Yes");
  return 0;
}

Measured memory_bytes: 3324
#define _USE_MATH_DEFINES
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define rep0(a,b) for(int a=0;a<b;a++)
#define rep1(a,b) for(int a=1;a<=b;a++)
#define repp(a,b,c) for(int a=b;a<c;a++)
#define rev(a,b,c) for(int a=b;a>=c;a--)
#define in insert
#define len length()
#define si size()
#define lb lower_bound
#define ub upper_bound
#define beg begin()
#define end end()
#define vec vector<ll>
#define se set<ll>
#define mults multiset<ll>
#define F first
#define S second
#define pr(a) cout<<a
#define pr2(a,b) cout<<a<<" "<<b
#define get(a) cin>>a
#define nextl cout<<endl
# define M_PI           3.14159265358979323846
const ll mod = 1000000007;
const ll maxn = 500005;
const ll mm = 1e+18;
ll power(ll x, ll y)
{
    ll res = 1;
    x = x % mod;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % mod;
        y = y>>1;
        x = (x*x) % mod;
    }
    return res;
}
ll ncr(ll n, ll k)
{
    ll C[k+1];
    memset(C, 0, sizeof(C));

    C[0] = 1;

    for (ll i = 1; i <= n; i++)
    {
        for (ll j = min(i, k); j > 0; j--)
            C[j] = (C[j] + C[j-1])%mod;
    }
    return C[k];
}
void solve()
{
     double a,b,x;
     cin>>a>>b>>x;
     float ok1=a*a*b;
     float ok2=x;
     if(2*ok2>=ok1){float ok3=(ok1-ok2)/(a*a*a);
     ok3*=2;
     //cout<<ok3<<endl;
     float ans=atan(ok3)*180/M_PI;
             printf("%0.6f",ans);
     }
     else{
        float ok3=2*x/(a*b*b);
        float ans=atan(ok3)*180/M_PI;
        float ans1=90-ans;
        printf("%0.6f",ans1);
     }
}
int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;
   // cin>>t;
    while(t--){
        solve();
      //  nextl;
    }
    return 0;
}


Measured memory_bytes: 256
fn main() {
    proconio::input! {
        n: usize,
        mut h: i32,
        ab: [(i32,i32);n],
    }
    let m = ab.iter().max_by_key(|ab| ab.0).unwrap().0;
    let mut t: Vec<i32> = ab.iter().map(|ab| ab.1).filter(|&b| b > m).collect();
    t.sort_unstable();
    let mut k = 0;
    while let Some(b) = t.pop() {
        k += 1;
        h -= b;
        if h <= 0 {
            break;
        }
    }
    if h > 0 {
        k += (h + m - 1) / m;
    }
    println!("{}", k);
}


Measured memory_bytes: 4796
using System;
using System.Collections.Generic;
using System.Linq;

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = ReadLong();
            var x = new long[N];
            var y = new long[N];
            for (int i = 0; i < N; i++)
            {
                var input = ReadArrayLong();
                x[i] = input[0];
                y[i] = input[1];
            }
            var len = new List<long[]>();
            for (int i = 0; i < N; i++)
            {
                for (int j = 0; j < N; j++)
                {
                    var xL = x[i] - x[j];
                    var yL = y[i] - y[j];
                    if (!(xL == 0 && yL == 0)) len.Add(new long[] { xL, yL });
                }
            }
            len = len.Distinct().ToList();
            var ans = N;
            for (int i = 0; i < len.Count(); i++)
            {
                var costs = N;
                for (int j = 0; j < N; j++)
                {
                    var xP = x[j] - len[i][0];
                    var yP = y[j] - len[i][1];
                    for (int k = 0; k < N; k++)
                    {
                        if (k == j) continue;
                        if (xP == x[k] && yP == y[k])
                        {
                            costs--;
                            break;
                        }
                    }
                }
                if (costs < ans) ans = costs;
            }

            Console.WriteLine(ans);
            Console.ReadLine();
        }

        static string Read() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Read()); }
        static long ReadLong() { return long.Parse(Read()); }
        static int[] ReadArrayInt() { return Read().Split(' ').Select(s => int.Parse(s)).ToArray(); }
        static long[] ReadArrayLong() { return Read().Split(' ').Select(s => long.Parse(s)).ToArray(); }
    }
}

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

#define ll unsigned long long

using namespace std;

vector < pair <int, int> > v;

int main()
{
    int n,k,res = 0,x;
    cin >> n;
    for(int i = 0; i < n; i++)
    {
        cin >> x;
        v.push_back({x, i + 1});
    }
    sort(v.begin(), v.end());
    for(int i = 0; i < n; i++)
    {
        cout << v[i].second << ' ';
    }
}


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

int main() {
  ll n;
  cin >> n;
  vector<ll> t(n), a(n);
  for (int i = 0; i < n; i++)
    cin >> t[i] >> a[i];

  ll T = 1;
  ll A = 1;
  for (int i = 0; i < n; i++) {
    ll x = T / t[i];
    ll y = A / a[i];
    if (T % t[i] != 0) x++;
    if (A % a[i] != 0) y++;
    ll co = max(x, y);
    T     = co * t[i];
    A     = co * a[i];
  }
  cout << T + A << endl;
}

Measured memory_bytes: 256
#define errOut(s) \
  { std::cerr << __LINE__ << ":" << #s << ":" << (s) << std::endl; }

#include <bits/stdc++.h>
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Weverything"
//#include <boost/multi_array.hpp>
//#include <boost/optional.hpp>
//#include <boost/range/adaptors.hpp>
//#include <boost/range/algorithm.hpp>
//#include <boost/range/irange.hpp>
#pragma clang diagnostic pop

using namespace std;

int64_t solve(int64_t /*n*/, std::vector<int64_t> as) {
  int64_t maximum = -1;
  int64_t ret = 0;
  for (auto a : as) {
    maximum = std::max(a, maximum);
    if (a < maximum) {
      ret += maximum - a;
    }
  }
  return ret;
}

int main() {
  std::cin.tie(nullptr);
  std::ios::sync_with_stdio(false);
  int64_t n;
  std::cin >> n;
  std::vector<int64_t> as(n);
  for (int i = 0; i < n; i++) {
    std::cin >> as[i];
  }
  auto const res = solve(n, std::move(as));
  std::cout << res << std::endl;
  return 0;
}


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


using namespace std;


const int MOD = 1e9 + 7;
const int N = 1e5;
const long long INF = 1e9;


int main() {
    int n;
    string s;
    cin >> n >> s;
    char c = s[0];
    int ans = 1;
    for (int i = 1; i < n; i++) {
        if (s[i] != c) {
            ans++;
            c = s[i];
        }
    }
    cout << ans;
}


Measured memory_bytes: 512
#include <stdio.h>

#define MYSCAN scanf

int main(void){
	int n, p;
	int flag;
	int i, j;
	int tmp;

	while (1){
		MYSCAN("%d", &n);
		if (n == 0){ break; }

		p = 0;
		if (n % 2 == 0){ n--; }
		for (i = n; i > 2; i -= 2){
			flag = 1;
			tmp = i / 2;
			// iテ」ツ?古ァツエツ?ヲツ閉ーテ」ツ?凝」ツ?ゥテ」ツ??」ツ?凝」ツδ?」ツつァテ」ツδε」ツつッ
			for (j = 3; j < tmp; j += 2){
				if (i % j == 0){
					flag = 0;
					break;
				}
			}

			// iテ」ツ?古ァツエツ?ヲツ閉ーテ」ツ??」ツ?」テ」ツ?淌」ツつ?
			if (flag == 1){
				// テ・ツ??」ツつ暗」ツつ?テ」ツ?、テ・ツケツエテ、ツクツ凝」ツ??」ツ?」テ」ツ?淌」ツつ嘉・ツ?コテ・ツ環?
				if (i == p - 2){
					printf("%d %d\n", i, p);
					break;
				}
				// テ」ツ?敕」ツ??」ツ?佚」ツつε」ツ?ェテ」ツ?凝」ツ?」テ」ツ?淌」ツつ嘉ィツ?ェテ・ツ按?」ツ?古・ツ??」ツ?ォテ」ツ?ェテ」ツつ?
				p = i;
			}
		}
	}
	
	return 0;
}

Measured memory_bytes: 1028
N = int(input())
a = 0
w = 0
t = 0
r = 0
l = []
for i in range(N):
    l.append(input())
for i in range(N):
    if 'AC'==l[i]:
        a += 1
    elif 'WA'==l[i]:
        w += 1
    elif 'TLE'==l[i]:
        t += 1
    else:
        r += 1

print('AC x '+str(a))
print('WA x '+str(w))
print('TLE x '+str(t))
print('RE x '+str(r))

Measured memory_bytes: 16316
#include<stdio.h>
#include<ctype.h>

int main (void){
	
	char ch;
	int i=0,t;
	char str[1200] = {};
	
	while(1){
		
		scanf("%c",&ch);
		if(islower((int)ch) != 0){
		ch = toupper(ch);
		}else if(isupper((int)ch) != 0){
		ch = tolower(ch);
		}else{
			;
		}
		str[i] = ch;
		i++;
	if( ch == '\n') break;
	}
	
	printf("%s",str);
return 0;
}

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

#define PI 3.14159265359
#define rep(i,a,n) for(int i=a;i<(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define descSort(a) sort(a.begin(),a.end(),std::greater<int>())
using namespace std;
typedef long long ll;
const ll INF = 1e9 + 7;

int main(void){
    int n;
    cin>>n;
    map<ll,ll> mp;
    rep(i,0,n){
        ll a;
        cin>>a;
        mp[a]++;
    }

    ll ans=0;
    for(auto i:mp){
        if(i.second<i.first)ans+=i.second;
        else if(i.second>i.first)ans+=i.second-i.first;
    }
    cout<<ans<<endl;

    return 0;
}



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

using namespace std;

const int N = 6e5 + 5;

char s[N];
int p[N], from[N], last[N];
int dig[N];

int main() {
  int n;
  scanf("%d", &n);
  scanf("%s", s);
  int len = strlen(s);
  int pw = 1;
  fill(last, last+len, 0);
  for (int i = 0; i < n; ++i) {
    bool swapped = false;
    for (int j = 0; j < pw; ++j) {
      dig[j] = 0;
      dig[pw + j] = 1;
      dig[pw * 2 + j] = 2;
    }
    for (int j = 0; j < len; ++j) {
      if (s[j] == 'S') {
        swapped = !swapped;
      } else {
        int add = 0;
        for (int k = 0; k < 3; ++k) {
          int now = k * pw + last[j];
          if (swapped) {
            if (dig[now] == 1)
              add = k;
            if (dig[now] == 0)
              dig[now] = 2;
            else if (dig[now] == 1)
              dig[now] = 0;
            else
              dig[now] = 1;
          } else {
            if (dig[now] == 2)
              add = k;
            dig[now] = (dig[now] + 1) % 3;
          }
        }
        last[j] += add * pw;
      }
    }
    for (int j = 0; j < pw; ++j) {
      int now = p[j];
      for (int k = 0; k < 3; ++k) {
        int cur = j + k * pw;
        if (swapped && dig[cur] != 0) {
          dig[cur] = 3 - dig[cur];
        }
        p[cur] = now + dig[cur] * pw;
      }
    }
    pw *= 3;
  }
  for (int i = 0; i < pw; ++i) {
    printf("%d%c", p[i], i+1 == pw ? '\n' : ' ');
  }
  return 0;
}


Measured memory_bytes: 9132
#include<bits/stdc++.h>
#define watch(x) cout<<(#x)<<" is "<<(x)<<endl
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define pb push_back
#define pq priority_queue
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define elif else if

using namespace std;
using ll=long long;
using ull=unsigned long long;
using ld=long double;
using pll=pair<ll,ll>;
using pss=pair<string,string>;
using pdd=pair<ld,ld>;
using graph=vector<vector<int>>;
using wgraph=vector<vector<pll>>;

const ll MOD=1000000007;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int ex[8]={1,1,0,-1,-1,-1,0,1};
const int ey[8]={0,1,1,1,0,-1,-1,-1};
const ld E=1e-9;

template<class T> void chmin(T &a, T b){a=min(a, b);}
template<class T> void chmax(T &a, T b){a=max(a, b);}

ll abs1(ll a){if(a>=0)return a;else return -a;}
ll pow1(ll a,ll b,ll p=LLONG_MAX){
  ll ret=1;
  while(b!=0){
    if((b&1)==1)ret*=a;a*=a;
    if(a>=p)a%=p;if(ret>=p)ret%=p;
    b=b>>1;
  }
  return ret;
}
int digit(ll a,ll b=10){int i=0;while(a!=0){a/=b;i++;}return i;}
ll gcd1(ll a,ll b){
  if(a==0 || b==0)return 0;
  ll n;while(a%b!=0){n=a%b;a=b;b=n;}return b;
}
ll solveLinear(ll n,ll m,ll c){
  if(n==0 && m==0)return 0;
  ll a[100],b[100];a[0]=n;b[0]=m;int i=1;
  while(b[i-1]!=0){a[i]=b[i-1];b[i]=a[i-1]%b[i-1];i++;}
  n=i;if(c%a[n-1]!=0)return 0;
  ll x=c/a[n-1],y=0;
  for(i=1;i<n;i++){ll cnt=x;x=y;y=cnt-(a[n-i-1]/b[n-i-1])*y;}
  return x;
}
ll modRev(ll a,ll p=MOD){
  a%=p;ll n=solveLinear(a,p,1);
  n%=p;if(n<0)return n+p;
  return n;
}
ll fact(ll n,ll p=MOD){
  if(n<0)return 0;
  ll ret=1;for(int i=1;i<=n;i++){ret=ret*i;if(ret>=p)ret%=p;}
  return ret;
}
ll perm(ll n,ll k,ll p=MOD){
  if(n<0 || k<0 || n<k)return 0;
  ll ret=1;rep(i,k){ret=ret*(n-i);if(ret>=p)ret%=p;}
  return ret;
}
ll binom(ll n,ll k,ll p=MOD){
  return (perm(n,k,p)*modRev(fact(k)))%p;
}
int bis(vector<int> v,int key){
  int left=-1,right=v.size();
  while(abs1(right-left)>1){
    int mid=left+(right-left)/2;
    if(v[mid]<=key)left=mid;
    else right=mid;
  }
  return left;
}

int main(){
  int i,j,k,cnt=0;
  int n,m;
  cin>>n>>m;
  ll x[n],y[m];
  rep(i,n)cin>>x[i];
  rep(i,m)cin>>y[i];
  for(i=1;i<n;i++){
    x[i-1]=x[i]-x[i-1];
  }
  for(i=1;i<m;i++){
    y[i-1]=y[i]-y[i-1];
  }
  n--;m--;
  ll ax=0,ay=0;
  ll sx[n],sy[m];
  sx[0]=x[0];
  sy[0]=y[0];
  for(i=1;i<n;i++)sx[i]=(sx[i-1]+(i+1)*x[i])%MOD;
  for(i=1;i<m;i++)sy[i]=(sy[i-1]+(i+1)*y[i])%MOD;
  rep(i,n){
    ax=(ax+sx[i])%MOD;
  }
  rep(i,m){
    ay=(ay+sy[i])%MOD;
  }
  cout<<(ax*ay)%MOD<<endl;
}


Measured memory_bytes: 3328
from itertools import permutations

N, M, R = [int(n) for n in input().split()]
r = [int(n)-1 for n in input().split()]
d = [[100000000]*N for n in range(N)]

for i in range(N):
  d[i][i] = 0

for m in range(M):
  A, B, C = [int(n) for n in input().split()]
  A-=1
  B-=1
  d[A][B] = C
  d[B][A] = C

for k in range(N):
  for i in range(N):
    for j in range(N):
      d[i][j] = min(d[i][k]+d[k][j], d[i][j])

res = 1000000000
for perm in permutations(range(R)):
  s = 0
  for i in range(R-1):
    s += d[r[perm[i]]][r[perm[i+1]]]
  res = min(s, res)

print(res)

Measured memory_bytes: 49624
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll mod=1000000007;
const int MAX_N = 1000;         // n の最大値
 
// nCk を取得
double nCk(int n, int k) {
double res=1.0;
for(int i=0; i<n; i++){
res*=0.5;}
for(int i=0; i<k; i++){
res*=(double)(n-i);
res/=(double)(k-i);
}
return res;}
 
int main() {
ll x,y;
cin>>x>>y;
if(x==1&&y==1){
cout << 1000000 << endl;}
else if(x==1&&y==2){
cout << 500000 << endl;}
else if(x==1&&y==3){
cout << 400000 << endl;}
else if(x==2&&y==1){
cout << 500000 << endl;}
else if(x==2&&y==2){
cout << 400000 << endl;}
else if(x==2&&y==3){
cout << 300000 << endl;}
else if(x==3&&y==1){
cout << 400000 << endl;}
else if(x==3&&y==2){
cout << 300000 << endl;}
else if(x==3&&y==3){
cout << 200000 << endl;}

else if(x==1){
cout << 300000 << endl;}
else if(x==2){
cout << 200000 << endl;}
else if(x==3){
cout << 100000 << endl;}
else if(y==1){
cout << 300000 << endl;}
else if(y==2){
cout << 200000 << endl;}
else if(y==3){
cout << 100000 << endl;}
else {
cout << 0 << endl;}}

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

using namespace std;

int main(int argc, const char *argv[]) {
  int k;
  cin >> k;
  string ans;
  string s = "ACL";
  for (int i = 0; i < k; ++i) {
    ans += s;
  }

  cout << ans << '\n';
  return 0;
}

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

using namespace std;

using ll = long long;

const long long MOD = 1e9+7;

#define ALL(A) A.begin(),A.end()

void ALLIN1_NUMBER(vector<ll>& V)
{
    for(auto& x : V)
    {
        cin >> x;
    }
}

void ALLOUT_NUMBER(vector<ll> V)
{
    ll N = V.size();
    for(ll i=0;i<N;i++)
    {
        cout << V[i];
        if(i<N-1) cout << ' ';
    }
    cout << endl;
}

class Mll
{
    public:
    ll x;

    Mll() : x(0){}
    Mll(ll x=0) : x((x%MOD+MOD)%MOD){}

    Mll operator-() const
    {
        return Mll(-x);
    }

    Mll& operator+=(const Mll& A)
    {
        if((x += A.x) >= MOD) x -= MOD;
        return *this;
    }
    Mll& operator-=(const Mll& A)
    {
        if((x += MOD - A.x) >= MOD) x -= MOD;
        return *this;
    }
    Mll& operator*=(const Mll& A)
    {
        (x *= A.x) %= MOD;
        return *this;
    }
    
    Mll operator+(const Mll& A)
    {
        Mll res(*this);
        return res+=A;
    }
    Mll operator-(const Mll& A)
    {
        Mll res(*this);
        return res-=A;
    }
    Mll operator*(const Mll& A)
    {
        Mll res(*this);
        return res*=A;
    }
    
    Mll pow(ll t) const // t乗
    {
        if(t==0) return 1;
        Mll A = pow(t>>1);
        A *= A;
        if(t&1) A *= *this;
        return A;
    }

    // for prime mod
    Mll inv() const
    {
        return pow(MOD-2);
    }
    Mll& operator/=(const Mll& A)
    {
        return (*this) *= A.inv();
    }
    Mll operator/(const Mll& A) const
    {
        Mll res(*this);
        return res/=A;
    }

    friend ostream& operator<<(ostream& os, const Mll& M)
    {
        os << M.x;
        return os;
    }
};

vector<Mll> ALLIN_MLL(ll N)
{
    vector<ll> numbers_ll(N);
    ALLIN1_NUMBER(numbers_ll);

    vector<Mll> numbers_Mll;
    for(ll i=0;i<N;i++)
    {
        Mll add(numbers_ll[i]);
        numbers_Mll.push_back(add);
    }

    return numbers_Mll;
}

template<class T>
void OUT0(T N)
{
    cout << N << endl;
}

static const double pi = acos(-1.0);

double Cos(double D)
{
    return cos(pi/180 * D);
}

int main()
{
    ll N; string S;
    cin >> N >> S;

    ll i=0,j=N-1;

    ll ans = 0;

    for(;i<N;i++)
    {
        if(S[i]=='W')
        {
            for(;j>i;j--)
            {
                if(S[j]=='R')
                {
                    ans++;
                    j--;
                    break;
                }
            }
        }
    }

    cout << ans << endl;

    return 0;
}

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

int main(){
	int n;cin>>n;
	double x;string ss;
	double ans=0;
	for(int i=0;i<n;i++){
        cin>>x>>ss;
        if(ss[0]=='J') ans+=x;
        else ans+=380000*x;
	}
	printf("%.6f\n",ans);
	return 0;
}





Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<utility>
#include<iostream>
#include<queue>
#include<math.h>

using namespace std;
typedef long long ll;
 
#define REP(i,n) for(int i=0;i<(int)(n);i++)

int main()
{
    int h,w;
    int a[505][505]={};
    int ki[505]={};
    int movey1[250000]={};
    int movex1[250000]={};
    int movey2[250000]={};
    int movex2[250000]={};
    long int poi=0;
    REP(i,505)REP(j,505)a[i][j]=810;
    scanf("%d %d\n",&h,&w);
    REP(i,h)REP(j,w)
    {
        scanf("%d",&a[i][j]);
        if(a[i][j]%2==1)ki[i]++;
    }
    REP(i,h)
    {
        REP(j,w-1)
        {
            if(a[i][j]%2==1)
            {
                a[i][j]--;
                a[i][j+1]++;
                movey1[poi]=i;
                movex1[poi]=j;
                movey2[poi]=i;
                movex2[poi]=j+1;
                poi++;
            }
        }
    }
    REP(i,h-1)
    {
        if(ki[i]%2==1)
        {
            ki[i]--;
            ki[i+1]++;
            movey1[poi]=i;
            movex1[poi]=w-1;
            movey2[poi]=i+1;
            movex2[poi]=w-1;
            poi++;
        }
    }
    printf("%ld\n",poi);
    REP(i,poi)printf("%d %d %d %d\n",movey1[i]+1,movex1[i]+1,movey2[i]+1,movex2[i]+1);
    return 0;
}

Measured memory_bytes: 7040
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

#define SORT(c) sort((c).begin(),(c).end())
#define ANS(ans) cout<<(ans)<<endl;


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



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

	REP(i, b) {
		if ((i + 1)*a%b == c) {
			ANS("YES");
			return 0;
		}
	}

	ANS("NO");

	return 0;
}



Measured memory_bytes: 256
A, B, C, K = map(int, input().split())
P = 0
S = 0
while S==0:
    P += A
    K -= A
    if K < 0:
        P -= abs(K)
        break
    elif K == 0:
        break

    K -= B
    if K <= 0:
        break

    P -= C
    K -= C
    if K <= 0:
        P += abs(K)
        break
    S=1
print(P)





Measured memory_bytes: 9188
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
typedef long long ll;
ll M = 998244353;
vector<ll> fac(200005);
vector<ll> ifac(200005);

//べき乗高速化
ll mpow(ll x, ll n){
	ll ans = 1;
	while(n != 0){
		if (n&1) ans = ans * x % M;
		x = x*x % M;
		n  = n >> 1;
	}
	return ans;
}

//aCbを計算
ll comb(ll a, ll b){
	if (a == 0 && b == 0) return 1;
	if (a < b || a < 0){
		return 0;
	}
	ll temp = ifac[a-b] * ifac[b] % M;
	return temp * fac[a] % M;
}

int main(){
	ll n,m,k;
	cin >> n >> m >> k;
	fac[0] = 1;
	ifac[0] = 1;
	for(ll i = 0; i<= 200000; i++){
		fac[i+1] = fac[i]*(i+1) % M; // n!(mod M)
		ifac[i+1] = ifac[i]*mpow(i+1, M-2) % M; // k!^{M-2} (mod M) ←累乗にmpowを採用
	}
	ll ans = 0;
	rep(i,k+1){
		ll temp =m*mpow(m-1,n-i-1);
		temp %= M;
		temp *= comb(n-1,i);
		ans += temp;
		ans %= M;
	}
	if(ans < 0){
		ans += M;
	}
	cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6280
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

a,b,c,k = iim()
k = k%2
print(int((a-b)*(-1)**k))

Measured memory_bytes: 3060
N = int(input())
P = [tuple(map(int, input().split())) for _ in range(N)]
ans = 0
for i in range(N):
    for j in range(i + 1, N):
        ans += ((P[i][0] - P[j][0]) ** 2 + (P[i][1] - P[j][1]) ** 2) ** 0.5

print(2 * ans / N)


Measured memory_bytes: 3060
#include<iostream>
#include<string>
#include<algorithm>
#include<map>

using namespace std;

int main()
{
	int i,n;
	cin >> n;
	string str;
	map<string, int> count;

	for(i=0; i<n; i++){
		cin >> str;
		if(str == "AC")
			count["AC"]++;
		else if(str == "WA")
			count["WA"]++;
		else if(str == "TLE")
			count["TLE"]++;
		else if(str == "RE")
			count["RE"]++;
	}
	cout <<"AC x " << count["AC"] << endl;
	cout <<"WA x " << count["WA"] << endl;
	cout <<"TLE x " << count["TLE"] << endl;
	cout <<"RE x " << count["RE"] << endl;
}



   // AC, WA, TLE, RE のいずれか


Measured memory_bytes: 3212
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		int N = int.Parse(Console.ReadLine());
		int[]A = new int[N];
		if(N==3){
			A[0]=2;
			A[1]=5;
			A[2]=63;
		} else if(N==4){
			A[0]=2;
			A[1]=5;
			A[2]=20;
			A[3]=63;
		} else {
			for(var i=0;i<(N-1)/8;i++){
				A[i*8] = (i+1)*12+2;
				A[i*8+1] = (i+1)*12+3;
				A[i*8+2] = (i+1)*12+4;
				A[i*8+3] = (i+1)*12+6;
				A[i*8+4] = (i+1)*12+8;
				A[i*8+5] = (i+1)*12+9;
				A[i*8+6] = (i+1)*12+10;
				A[i*8+7] = (i+1)*12+12;
			}
			if(N%8==1){
				A[N/8*8] = 12;
			} else if(N%8==2){
				A[N/8*8] = 12;
				A[N/8*8+1] = 6;
			} else if(N%8==3){
				A[N/8*8] = 12;
				A[N/8*8+1] = 8;
				A[N/8*8+2] = 4;
			} else if(N%8==4){
				A[N/8*8] = 12;
				A[N/8*8+1] = 9;
				A[N/8*8+2] = 6;
				A[N/8*8+3] = 3;
			} else if(N%8==5){
				A[N/8*8] = 12;
				A[N/8*8+1] = 10;
				A[N/8*8+2] = 9;
				A[N/8*8+3] = 3;
				A[N/8*8+4] = 2;
			} else if(N%8==6){
				A[N/8*8] = 12;
				A[N/8*8+1] = 10;
				A[N/8*8+2] = 9;
				A[N/8*8+3] = 6;
				A[N/8*8+4] = 3;
				A[N/8*8+5] = 2;
			} else if(N%8==7){
				A[N/8*8] = 12;
				A[N/8*8+1] = 10;
				A[N/8*8+2] = 9;
				A[N/8*8+3] = 8;
				A[N/8*8+4] = 4;
				A[N/8*8+5] = 3;
				A[N/8*8+6] = 2;
			} else if(N%8==0){
				A[N/8*8-8] = 12;
				A[N/8*8-7] = 10;
				A[N/8*8-6] = 9;
				A[N/8*8-5] = 8;
				A[N/8*8-4] = 6;
				A[N/8*8-3] = 4;
				A[N/8*8-2] = 3;
				A[N/8*8-1] = 2;
			}
		}
		Console.Write(A[0]);
		for(var i=1;i<N;i++){
			Console.Write(" "+A[i]);
		}
	}
}

Measured memory_bytes: 13308
#include <iostream>
#include <string>

using namespace std;

int main() {
  string S;
  cin >> S;
  bool a = false, b = false, c = false;
  
  for(int i=0;i<3;i++)
  {
    if(S[i] == 'a')a = true;
    else if(S[i] == 'b')b = true;
    else if(S[i] == 'c')c = true;
  }
  string ans;
  if(a && b && c)ans = "Yes";
  else ans = "No";
  
  cout << ans << endl;
}

Measured memory_bytes: 256
//BIRDS SET FREE
#include<bits/stdc++.h> 
using namespace std;                          //31 July 1999
#pragma GCC optimize("O3")
typedef long long ll;
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define vec(i, a)  for( auto i=a.begin();i != a.end(); ++i)
#define all(x) x.begin(), x.end()
#define sz(x) (ll)(x).size()
#define fill(a)  memset(a, 0, sizeof (a))
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define endl '\n'
#define sp '\t'
#define fast  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define in  freopen("input.txt","r",stdin);
#define out freopen("output.txt","w",stdout);
#define rocket in out 
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    err(++it, args...); }
typedef long double ld;
typedef std::pair<ll, ll> pii;
typedef std::vector<ll> vi;
const ll MOD = 10e9 + 7;
const ll N=10e6;
ll n_bits(ll n ) { ll x= __builtin_popcount(n) ; return x ;}
ll least_bits(ll n ) { ll x= __builtin_ffs(n) ; return x ;}
ll gcd(ll x, ll y) { ll n=__gcd(x,y); return n;}
ll binpow(ll a, ll b, ll m=MOD) 
{
    a%=m;
    ll res=1;
    while (b>0) 
    {
        if (b&1)    res=res*a%m;
        a=a*a%m,b>>=1;
    }
    return res;
}
void I(vi &v, int n)
{
    ll a;
    rep(i,0,n)    cin>>a,v.pb(a);
}
void O(vi &v, int n)
{

    rep(i,0,n)    cout<<v[i]<<" ";
    cout<<endl;
}
ll get_second( pair<string, ll> i ){ return i.second; }
int main()
{    
    #ifndef ONLINE_JUDGE
    rocket
    #endif
    fast
    ll t=1;
    //cin>>t;
    while(t--)
    {    
        ll temp = 0 , flag = 0 , diff = 0 , sum = 0 , result = 0 , ct = 0 , cnt = 0 , found = 0;
        ll a = 0 , b = 0 , c = 0 , n = 0 , m = 0 , k = 0 , x = 0 , y = 0 ; 
        set<ll> s1;
        map<ll,ll> mapp;
        vi v,v1,v2;
        string s;
        //transform( mapp.begin(), mapp.end(), v1.begin(), get_second );
        cin >> n ;
        n = n % 10 ;
        if( n == 2 || n == 7 || n == 5  || n == 4  || n == 9 ) cout << "hon" ;
        else if( n == 1 || n == 8 || n == 6  || n == 0 ) cout << "pon" ;
        else cout << "bon" ; 
        cout<<endl;
    }
    return 0;
}

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

int main(){

	int N, i;
	int *a, *b, *c;
	
	cin >> N;
	
	a = new int[N];
	b = new int[N];
	c = new int[N];

	for( i=0;i<N;i++ ){
		cin >> a[i] >> b[i] >> c[i];
	}

	for( i=0;i<N;i++ ){
		int a2 = a[i] * a[i];
		int b2 = b[i] * b[i];
		int c2 = c[i] * c[i];

		if( a2 == b2 + c2 || b2 == a2 + c2 || c2 == a2 + b2 ){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1188
n = int(input())
n_list = [[] for _ in range(n+1)]
l_list = [0 for _ in range(n-1)]
for i in range(n-1):
    a,b = [int(_) for _ in input().split()]
    n_list[a].append((b,i))
    n_list[b].append((a,i))
# print(n_list)
k = 0
for i in range(n+1):
    k = max(k, len(n_list[i]))
# print(k)
c_list = []
for i in range(1, k+1):
    c_list.append(i)
# print(c_list)
todo = [(1,0,0)]
seen = [1]
while len(todo) != 0:
    p_from, c_from, before = todo.pop()
    i = 0
    for t in n_list[p_from]:
        p, l = t
        if p == before:
            continue
        else:
            while c_list[i] == c_from:
                i += 1
            color = c_list[i]
            i += 1
            todo.append((p,color,p_from))
            l_list[l] = color
            seen.append(p)
        # print(todo)
    # print(seen)
# print(l_list)
print(k)
for i in l_list:
    print(i)

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

string judge(int alice, int bob){
  if(alice == bob){
    return "Draw";
  }
  else if(alice > bob){
    return "Alice";
  }
  else{
    return "Bob";
  }
}

int main(int argc, char const *argv[]) {
  /* code */
  int A, B;
  cin >> A >> B;

  if(A == 1){
    A += 13;
  }
  if(B == 1){
    B += 13;
  }

  cout << judge(A,B) << endl;

  return 0;
}


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

int main()
{
	int N, W;
	cin >> N >> W;
	uint64_t **r = new uint64_t*[N];
	for(int n=0; n<N; n++){
		r[n] = new uint64_t[W+1];
	}

	int w0, v0;
	cin >> w0 >> v0;

	int wi;
	for(wi=0; wi<w0; wi++){
		r[0][wi] = 0;
	}
	for(;wi<W+1; wi++){
		r[0][wi] = v0;
	}

	for(int n=1; n<N; n++){
		int wn, vn, w;
		cin >> wn >> vn;
		for(w=0; w<wn; w++){
			r[n][w] = r[n-1][w];
		}
		for(;w<W+1; w++){
			r[n][w] = max(r[n-1][w], r[n-1][w-wn] + vn);
		}
	}

	cout << r[N-1][W];

	return 0;
}


Measured memory_bytes: 78592
import bisect

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
 
A.sort()
C.sort()
 
ans = 0
for i in range(N):
    a = bisect.bisect_left(A, B[i])
    c = bisect.bisect_right(C, B[i])
    ans += a*(N-c)
print(ans)
    

Measured memory_bytes: 23232
def actual(N, S):
    counter_dict = dict(AC=0, WA=0, TLE=0, RE=0)

    for judge_result in S:
        counter_dict[judge_result] += 1

    return '\n'.join((f'{k} x {v}' for k, v in counter_dict.items()))

N = int(input())
S = [input() for _ in range(N)]

print(actual(N, S))

Measured memory_bytes: 16228
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <cmath>
#include <map>
#include <climits>
#include <cassert>
#include <algorithm>
#include <utility>

using namespace std;
using Int = long long int;
using UInt = unsigned long long int;
using VI = vector<long long int>;
using VVI = vector<vector<long long int> >;


int main(void) {
    string s;
    cin >> s;
    Int cPosi = s.find('C');
    Int fPosi = s.rfind('F');
    if (cPosi == -1 || fPosi == -1) {
        cout << "No" << endl;
    } else if (cPosi < fPosi) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 3648
N = int(input())
A = list(map(int,input().split()))
M = 1000
S = 0
for i in range(N-1):
  M+=S*A[i]
  S = 0
  if A[i+1]>=A[i]:
    tmp=M//A[i]
    M -= tmp*A[i]
    S+=tmp
M+=S*A[-1]
S = 0
print(M)



Measured memory_bytes: 9160
//hinagata.cpp
//作成日
//更新日
//目的
//手段
/*includes*/
#include <bits/stdc++.h>
/*namespace*/
using namespace std;
using ll= long long;
/*define macro*/
#define REP(i,n) for(ll i=0;i<(n);i++)
#define REPi(i,a,b) for(ll i=(a);i<(b);i++)
#define REPRi(i,a,b) for(ll i=(a);i>(b);i--)
#define ALL(x) (x).begin(),(x).end()

int main(){
    ll N,K;
    cin>>N>>K;
    vector<ll> H(N);
    REP(i,N){
        cin>>H[i];
    }
    //inputend
    sort(ALL(H),greater<ll>());
    if(K>=N){
        cout<<0<<endl;
        return 0;
    }else{
        REP(i,K){
            H[i]=0;
        }
        ll ok=0;
        ll sum=accumulate(ALL(H),ok);
        cout<<sum<<endl;
    }
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
using lint = long long;
constexpr lint MOD = 1000000007;

string S;
int N;
lint dp[100001][3];
lint ans;

int main()
{
    cin >> S;
    N = S.size();
    ans = 0;
    memset(dp, 0, sizeof(dp));

    lint type = 1;
    REP(i, N)
    {
        if (S[i] == '?') {
            dp[i + 1][0] = (dp[i][0] * 3 + type) % MOD;
            dp[i + 1][1] = (dp[i][1] * 3 + dp[i][0]) % MOD;
            dp[i + 1][2] = (dp[i][2] * 3 + dp[i][1]) % MOD;
            type = type * 3 % MOD;
        }
        if (S[i] == 'A')
        {
            dp[i+1][0] = (dp[i][0] + type) % MOD;
            dp[i+1][1] = dp[i][1];
            dp[i+1][2] = dp[i][2];
        }
        // else dp[i+1][0] = dp[i][0];
        if (S[i] == 'B')
        {
            dp[i+1][0] = dp[i][0];
            dp[i+1][1] = (dp[i][0] + dp[i][1]) % MOD;
            dp[i+1][2] = dp[i][2];
        }
        if (S[i] == 'C')
        {
            dp[i+1][0] = dp[i][0];
            dp[i+1][1] = dp[i][1];
            dp[i+1][2] = (dp[i][1] + dp[i][2]) % MOD;
        }
    }
    cout << dp[N][2] << endl;
}


Measured memory_bytes: 2816
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <set>
#include <map>
using namespace std;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))
#define rep(i,a,b) for(int (i)=int(a);(i)<int(b);(i)++)
#define rrep(i,a,b) for(int (i)=int(a);(i)>=int(b);(i)--)

#define put(a) cout << (a) << endl
#define puts(a) cout << (a) << " "

#define llint long long int

#define INF (long long)(1e9+1)
#define MOD (long long)(1e9+7)
#define INF64 (long long)(1e18+1)

#define F first
#define S second

#define Pii  pair<int,int>
#define Pll  pair<long long,long long>
#define Piii pair<int,pair<int,int>>
#define Plll pair<long long,pair<long long,long long>>

#define Vll(a,b,c)    vector<vector<long long>> (a)((b),vector<long long>((c))
#define Vlll(a,b,c,d) vector<vector<vector<long long>>> (a)((b),vector<vector<long long>>((c),vector<long long>((d)))

#define MAX_N 1000000

int main (void)
{
  //INPUT
  llint N;
  cin >> N;


  //SOLVE
  llint ans;
  ans = N*N*N;

  //OUTPUT
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        long a;
        long b;
        long k;
		Scanner sc = new Scanner(System.in);
        // 整数の入力
		a = sc.nextLong();
        b = sc.nextLong();
        k = sc.nextLong();
        if (a <= k) {
            long wka = a;
            a = 0;
            k = k - wka;
        }
        else {
            a = a - k;
            k = 0;
        }
        if (b <= k) {
            b = 0;
            k = k - b;
        }
        else {
            b = b - k;
            k = 0;
        }
        System.out.println(a + " " + b);
	}
}

Measured memory_bytes: 22868
/**
 * @param {String} input
 */
function Main(input){
	var letterMap = {};
	while( input ){
		var letter = input.charAt(0);
		if(letterMap[letter]){
			return "no";
		}
		letterMap[letter] = true;
		input = input.slice( 1 );
	}
    return "yes"; 
}
console.log(Main(require("fs").readFileSync("/dev/stdin", "utf8")));


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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n)-1; i >= 0; i--)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define rrep1(i,n) for(int i = (n); i > 0; i--)

#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>

#define MOD 1000000007
#define INF 1000000000000000LL

using namespace std;

#define MAXN 200001
vector<ll>counter(MAXN);
vector<ll> g[MAXN];

void dfs(int pre, int c, int count){
  //cout<<pre<<' '<<c<<' '<<count<<' '<<counter[c]<<endl;
  counter[c] += count;
  for(auto to: g[c]){
    if(to==pre)continue;
    dfs(c, to, counter[c]);
  }
}

int main(){
  ll n, q;cin>>n>>q;
  rep(i, n-1){
    ll a,b;cin>>a>>b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  rep(i, q){
    ll p,x;cin>>p>>x;
    counter[p]+=x;
//cout<<p<<','<<x<<endl;
  }

//  rep1(i, n)cout<<counter[i]<<' ';cout<<endl;

  dfs(-1, 1, 0);

  rep1(i, n)cout<<counter[i]<<' ';

  return 0;
}

Measured memory_bytes: 24320
#include<iostream>
#include<algorithm>
#include<vector>

using namespace std;

int main() {
	int N, M;
	cin >> N >> M;
	vector<int> yakusu;
	for (int i = 1; i * i <= M; i++) {
		if (M % i == 0) {
			if (i * i != M)yakusu.push_back(i), yakusu.push_back(M / i);
			else yakusu.push_back(i);
		}
	}
	sort(yakusu.begin(), yakusu.end());
	for (int i = 0; i < yakusu.size(); i++) {
		if (yakusu[i] >= N) {
			cout << M / yakusu[i] << endl;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 384
import sys
sys.setrecursionlimit(1000000)
n,m,k=map(int,input().split())
class UnionFind(object):
    def __init__(self, N):
        self.parent = [i for i in range(N)]
        self.size = [1 for i in range(N)]
 
    def merge(self, a, b):
        if self.issame(a,b):
            return
        pa = self.root(a)
        pb = self.root(b)
        self.parent[pa] = pb
        self.size[pb] += self.size[pa]
    
    def root(self, x):
        p = self.parent[x]
        if p == x:
            return x
        else:
            r = self.root(p)
            self.parent[x] = r
            return r
    def issame(self, x, y):
        return self.root(x) == self.root(y)
    def getsize(self, x):
        return self.size[self.root(x)]
uf=UnionFind(n)
ans=[0]*n
for i in range(m):
    a,b=map(int,input().split())
    uf.merge(a-1,b-1)
    ans[a-1]-=1;ans[b-1]-=1
for i in range(k):
    c,d=map(int,input().split())
    if uf.issame(c-1,d-1):
        ans[c-1]-=1;ans[d-1]-=1
for i in range(n):
    ans[i]=uf.getsize(i)+ans[i]-1
print(*ans)


Measured memory_bytes: 41384
#include <iostream>
#include <cstdio>
#include <bits/stdc++.h>
using namespace std;
long long a[10003],b[10003];
long long dp[10004];
int main()
{
    long long h,n;
    cin>>h>>n;
    for(int i=1;i<=n;i++)
        cin>>a[i]>>b[i];
        for(int j=1;j<=10000;j++)
        dp[j]=999999999;
    for(int i=1;i<=n;i++)
      for(int j=a[i];j<=10000;j++)
      {dp[j]=min(dp[j],dp[j-a[i]]+b[i]);}
      long long ans=dp[h];
      for(int i=h+1;i<=10000;i++)
      {
          if(dp[i]<=ans)
            ans=dp[i];
      }
      cout<<ans;
    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;
const int INF = 1001001001;

int main(){
    int x;
    cin >> x;
    if(x >= 30) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3592
/*input
4 5
1 1 1 1
*/
 
 
#include <bits/stdc++.h>
 
using namespace std;
 
#define ld long double
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define vpll vector < pair<long long,long long> >
#define fill(a,val)  memset(a,val, sizeof (a))
#define sort_unique(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define mp make_pair
#define pb push_back
#define f first
#define se second
#define all(cont) cont.begin(), cont.end()
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MAX   1e9
#define MIN  -1e9
typedef map<long long int, long long int> mpi;
typedef set<long long int> seti;
typedef multiset<long long int> mseti;
typedef priority_queue<long long int> pq;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define rep(i, n)    for(long long int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(ll i = a; i <= (n); ++i)
#define repD(i, a, n)  for(ll i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define tr(c,i) for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++)
#define repn(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define PI 3.14159265
#define dbg(x) cerr << "\n" << (#x) << " = " << (x) << endl ;
//#define cerr if(false)cerr
 
#define mod 998244353
 
struct node{
    ll val;
};
struct Interval {int start, end;};
bool compare(struct node n1, struct node n2) {
    return (n1.val < n2.val);
}
 
 
 ll gcd(ll a, ll b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b);  
      
} 





 
ll isitpossible(ll* a, ll mid, ll n, ll k){
	ll req = 0;
	rep(i,n){
		double numer = 1.0*a[i];
		double val = numer/mid;
		req+=ceil(val)-1;
	}
	if(req<=k)
		return 1;
	else
		return 0;
}

int main() 
{ 
  	ll n,k; cin>>n>>k;
  	ll a[n];
  	ll l=0, r=INT_MIN;
  	rep(i,n){
  		cin>>a[i];
  		r = max(r,a[i]);
  	}

  	while(l<r){
  		ll mid = (r+l)/2;
  		if(isitpossible(a,mid,n,k))
  			r=mid;
  		else
  			l=mid+1;

  		//cout<<l<<" "<<r<<endl;
  	}
  	cout<<max(r,1LL)<<endl;
    return 0; 
} 
 

Measured memory_bytes: 5180
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int,int> P;
 
const int INF = 1e9;
const int mod = 1e9+7;
 
int main()
{
    int n,k;
    cin >> n >> k;

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

    sort(a.rbegin(),a.rend());
    for(int i = 0; i < k; i++) n -= a[i];

    cout << n << endl;

    return 0;
}

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

using namespace std;

int n;
int main(){
  cin >> n;
  cin.ignore();


  long long sum = 0ll;
  for (int i = 1; i <= n; i++){
    if(i % 3 == 0) continue;
    if(i % 5 == 0) continue;
    sum += (long long) i;
  }

  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 3624
#include <algorithm>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>

using namespace std;

typedef long long ll;
// constexpr ll MOD = 998244353;
constexpr ll MOD = 1000000007;

// struct UnionFind {
//     vector<int> par;
    
//     UnionFind(int N): par(N) {
//         for (int i=0;i<N;i++) par[i] = i;
//     }

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

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

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

int main(void) {
    int N;
    vector<int> A(110,0), B(110,100001);
    cin >> N;
    for (int i=0;i<N-1;i++) cin >> B[i];
    A[0] = B[0];
    for (int i=1;i<N;i++) {
        A[i] = min(B[i-1],B[i]);
    }
    cout << accumulate(A.begin(), A.end(), 0) << endl;

    return 0;
}


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

using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	
	long long x, y;
	
	cin>>x>>y;
	
	int sol = 0;
	
	while (x <= y)
	{
		++sol;
		x *= 2;
	}
	
	cout<<sol<<'\n';
}


Measured memory_bytes: 256
/*
 * AOJ #2400 You Are the Judge
 */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef struct team_t {
  int tid, nsolved, penalty;
  int *nwrong;
} team_t;

int compareTeams(const void *a, const void *b)
{
  const team_t *x = a, *y = b;
  return y->nsolved != x->nsolved ? y->nsolved - x->nsolved :
         x->penalty != y->penalty ? x->penalty - y->penalty : x->tid - y->tid;
}

int main()
{
  int t, p, r, i;
  int tid, pid, tm;
  static char msg[] = "CORRECT";
  team_t *team;
  while (1) {
    scanf("%d%d%d", &t, &p, &r);
    if (t == 0) { break; }

    team = malloc(sizeof(team_t) * (t + 1));
    for (tid = 1; tid <= t; tid++) {
      team[tid].tid = tid;
      team[tid].nsolved = 0;
      team[tid].penalty = 0;
      team[tid].nwrong = malloc(sizeof(team[tid].nwrong[0]) * (p + 1));
      for (pid = 1; pid <= p; pid++) {
        team[tid].nwrong[pid] = 0;
      }
    }

    for (i = 0; i < r; i++) {
      scanf("%d%d%d%s", &tid, &pid, &tm, msg);
      if (team[tid].nwrong[pid] < 0) { continue; }
      if (strcmp(msg, "CORRECT") == 0) {
        team[tid].nsolved++;
        team[tid].penalty += team[tid].nwrong[pid] * 1200 + tm;
        team[tid].nwrong[pid] = -1;
      } else {
        team[tid].nwrong[pid]++;
      }
    }
    qsort(team + 1, t, sizeof(team[0]), compareTeams);

    for (i = 1; i <= t; i++) {
      printf("%d %d %d\n", team[i].tid, team[i].nsolved, team[i].penalty);
    }

    for (tid = 1; tid <= t; tid++) { free(team[tid].nwrong); }
    free(team);
  }
  return 0;
}

Measured memory_bytes: 0
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define ArraySizeOf(array)     (sizeof(array) / sizeof(array[0]))
#define res(i,n) for(int i=n;;i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define REV(i,n) for(int i=n-1;i>0;i--)
#define req(i,n,m) for(int i=n;i<m;i++)
#define REQ(i,n,m,l) for(int i=n;i<m;i+=l) 
#define _GLIBCXX_DEBUG
int INF = 1e9 + 7;
long double PI = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998626034825342117;
unsigned NthDayOfWeekToDay(unsigned n, unsigned dow, unsigned dow1)
{
    unsigned day;
    if (dow < dow1) dow += 7;
    day = dow - dow1;
    day += 7 * n - 6;
    return day;
}
signed gcd(long long x, long long y) {
    if (y == 0)return x;
    return gcd(y, x % y);
}
signed lcm(long long x, long long y) {
    return x / gcd(x, y) * y;
}
unsigned DayToWeekNumber(unsigned day)
{
    return (day - 1) / 7 + 1;
}
unsigned AnotherDayOfWeek(unsigned day, unsigned day0, unsigned dow0)
{
    return (dow0 + 35 + day - day0) % 7;
}
using namespace std;
int main() {
    vector<int>A(6);
    rep(i, 6)cin >> A[i];
    sort(A.begin(), A.end());
    int a = 0;
    int b = 0;
    int c = 0;
    int d = 0;
    rep(i, 6) {
        if (A[i] == 1)a++;
        else if (A[i] == 2)b++;
        else if (A[i] == 3)c++;
        else d++;
    }
    if (a == 0 || b == 0 || c == 0 || d == 0) {
        cout << "NO" << endl;
        return 0;
    }
    if (a == 3 || b == 3 || c == 3 || d == 3) {
        cout << "NO" << endl;
        return 0;
    }
    cout << "YES" << endl;
}

Measured memory_bytes: 3128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(int i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(int i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define uniq(x) (x).erase(unique((x).begin(), (x).end()), (x).end())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N, K;
    cin >> N >> K;
    vector<pair<int, int>> g;
    int mv = ((N - 1) * (N - 2) / 2);
    int f, t;
    
    if (mv < K) {
        cout << -1 << endl;
        return 0;
    }
    
    reps(i, 1, N) {
        g.emplace_back(0, i);
    }
    
    f = 1;
    t = 2;
    
    rep(i, mv - K) {
        g.emplace_back(f, t);
        t++;
        
        if (t == N) {
            f++;
            t = f + 1;
        }
    }
    
    cout << sz(g) << endl;
    
    rep(i, sz(g)) {
        cout << (g[i].first + 1) << " " << (g[i].second + 1) << endl;
    }
    
    return 0;
}

Measured memory_bytes: 384