akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) Rep(i, 0, n)
#define all(a) (a).begin(), (a).end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;

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

    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    vector<int> b = a;
    sort(all(b));
    int fir = b[n - 1], sec = b[n - 2];
    rep(i, n)
    {
        if (a[i] == fir)
            cout << sec << endl;
        else
            cout << fir << endl;
    }
}

Measured memory_bytes: 4736
import java.util.*;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		long x = sc.nextLong();
		long y = sc.nextLong();
		
		if(Math.abs(x - y) < 2){
			System.out.println("Brown");
		}
		else{
			System.out.println("Alice");
		}
		
		sc.close();
	}
}

Measured memory_bytes: 23252
import java.util.*
 
fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val a = sc.nextInt()
    val b = sc.nextInt()
    val c = sc.nextInt()
    val n = sc.nextInt()
    var ans = 0
    for (ai in 0..n) {
        for (bi in 0..n) {
            val sumAB = ai * a + bi * b
            val rem = n - sumAB
            if (rem >= 0 && rem % c == 0) {
                ans++
            }
        }
    }
    println(ans)
}

Measured memory_bytes: 31140
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;

int main() {
  int n, a[300001] = {0};
  cin >> n;
  for (int i = 0; i < 3 * n; i++) cin >> a[i];
  sort(a, a + 3 * n, greater<int>());
  long long res = 0;
  for (int i = 1; i < 2 * n; i += 2) res += a[i];
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
int main()
{
   int n,l;
   string str[107];
   cin>>n>>l;
   for(int i=0;i<n;i++)
   {
       cin>>str[i];
   }
   sort(str,str+n);
   for(int i=0;i<n;i++)
   {
       cout<<str[i];
   }
   cout<<endl;
}


Measured memory_bytes: 3660
#include <iostream>
#include <string>
int I[4];

bool f(int i, int s, std::string str) {
  if (i == 4)
    if (s == 7) { std::cout << str << "=7" << std::endl; return true; }
    else return false;
  if (f(i+1, s + I[i], str + '+' + std::to_string(I[i])) 
      || f(i+1, s - I[i], str + '-' + std::to_string(I[i]))) return true;
  return false;
}

int main() {
  char t;
  for (int i = 0; i < 4; i++) {
    std::cin >> t;
    I[i] = t - '0';
  }
  f(1, I[0], std::to_string(I[0]));
}


Measured memory_bytes: 256
n, m, l = gets.split.map(&:to_i)
A = n.times.map{gets.split.map(&:to_i)}
B = m.times.map{gets.split.map(&:to_i)}
n.times{|i| puts l.times.map {|j| m.times.map{|k| A[i][k] * B[k][j]}.inject(&:+)}.join(' ')}


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

using namespace std;

int gcd(int x, int y){
    return y ? gcd(y,x % y) :x;
}

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

   vector<int> a(n);
   for(int i = 0; i < n; i++){
       cin >> a.at(i);
   }

   vector<int> l(n), r(n);
   for(int i = 0; i < n - 1; i++){
       l.at(i + 1) = gcd(l.at(i),a.at(i));
   }
   for(int i = n - 1; i >= 1; i--){
       r.at(i - 1) = gcd(r.at(i),a.at(i));
   }
   int ans = 1;
   for(int i = 0; i < n; i++){
       ans = max(ans,gcd(r.at(i),l.at(i)));
   }
   cout << ans << endl;
   return 0;
}

Measured memory_bytes: 1408
#include "bits/stdc++.h"
using namespace std;

#define MAX 200000
#define SENTINEL 2000000000
typedef long long llong;

int L[MAX/2+2],R[MAX/2+2];

llong merge(int A[],int n,int left,int mid,int right){
	int i,j,k;
	llong cnt=0;
	int n1=mid-left;
	int n2=right-mid;
	for ( i = 0; i < n1; ++i) {
		L[i]=A[left+i];
	}
	for ( i = 0; i < n2; ++i) {
		R[i]=A[mid+i];
	}
	L[n1]=R[n2]=SENTINEL;
	i=j=0;
	for (int k = left; k < right; ++k) {
		if(L[i]<=R[j]){
			A[k]=L[i++];
		}else{
			A[k]=R[j++];
			cnt+=n1-i;//mid-1+j-k
		}
	}
	return cnt;
}
llong mergeSort(int A[],int n,int left,int right){
	int mid;
	llong v1,v2,v3;
	if(left+1<right){
		mid=(left+right)/2;
		v1=mergeSort(A,n,left,mid);
		v2=mergeSort(A,n,mid,right);
		v3=merge(A,n,left,mid,right);
		return v1+v2+v3;
	}else return 0;
}

int main(){
	int A[MAX],n,i;
	cin>>n;
	for ( i = 0; i < n; ++i) {
		cin>>A[i];
	}
	llong ans=mergeSort(A,n,0,n);
	cout<<ans<<endl;
	return 0;
}

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

#define for_(i,a,b) for(int i=(a);i<(b);++i)

typedef pair< int, int > pii;

int main() {
	int n;
	
	while (cin >> n, n) {
		vector< pii > vp;
		
		int st = -1, prv = -1;
		
		for_(i,0,n) {
			int a;
			cin >> a;
			
			if (prv != a - 1) {
				if (st != -1) vp.push_back(pii(st, prv));
				st = a;
			}
			
			prv = a;
		}
		
		vp.push_back(pii(st, prv));
		
		int m = vp.size();
		
		for_(i,0,m) {
			if (vp[i].first == vp[i].second) cout << vp[i].first;
			else cout << vp[i].first << "-" << vp[i].second;
			cout << (i < m - 1 ? " " : "\n");
		}
	}
}

Measured memory_bytes: 1196
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<stack>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

int main()
{
	int a,b,c,x,r=0;
	cin>>a>>b>>c>>x;
	for(int i=0;i<=a;i++)
		for(int j=0;j<=b;j++)
			for(int k=0;k<=c;k++)
			{
				if(x==(500*i+100*j+50*k))r++;
			}
	cout<<r<<endl;

}


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

long long N;


bool isInt(double num) {
	long long numLong = (long long)num;

	if(numLong >= 1 && numLong - 0.0001 < num && numLong + 0.0001 > num) {
		return true;
	}
	numLong++;
	if(numLong >= 1 && numLong - 0.0001 < num && numLong + 0.0001 > num) {
		return true;
	}
	return false;

}

long long solve(long long num) {
	long long ans = 0;
	for(long long x = 1; x * x <= num; x++) {
		for(long long y = 1; x * x  + y * y + x * y <= num; y++) {
			long long b = x + y;
			long long c = x * x + y * y + x * y - num;
			
			//for(long long z = 1; x*x + y*y + z*z + x*y + y*z + z*x <= num; z++) {
			//	if(x*x + y*y + z*z + x*y + y*z + z*x == num) {
			//		ans++;
			//	}

			//}

			
			double z1 = (-1 * b + sqrt(b*b - 4*c))/2;
			double z2 = (-1 * b - sqrt(b*b - 4*c))/2;

			if(isInt(z1) || isInt(z2)) {
				ans++;
			}


		}
	}
	return ans;
}

int main(){
	cin >> N;

	for(long long i = 1; i <= N; i++) {
		cout << solve(i) << endl;
	}
}

Measured memory_bytes: 3576
#include<cmath>
#include<cstring>
#include<cstdio>
#include<queue>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
const int inf = 0x3f3f3f3f;
const int mod = (1 ? 1e9 + 7 : 998244353);
const int dx[] = { -1,0,1,0 }, dy[] = { 0,1,0,-1 };
ll a, b, c, d, e, f, n, T;




int main()
{
	ios::sync_with_stdio(false); cin.tie(0);
	cin >> a;
	if (a >= 30)cout << "Yes" << endl;
	else cout << "No" << endl;
}



Measured memory_bytes: 3644
import sys

sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

T = list(input())

L = len(T)
for i in range(L):
    s = T[i]
    if s == "?":
        T[i] = "D"

print("".join(T))


Measured memory_bytes: 10896
#include <iostream> 
#include <algorithm>
#include <vector>
#include <set>
using namespace std;


int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	multiset<int> s;

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

	for (int i = 0; i < n; i++) {
		auto it = s.lower_bound(a[i]);
		if (it == s.begin()) {
			//cout << "insert: " << a[i] << endl;
			s.insert(a[i]);
		} else {
			it --;
			//cout << "delete: " << *(it) << endl;
			//cout << "new: " << a[i] << endl;

			s.erase(it);
			s.insert(a[i]);
		}

	}
	cout << s.size() << endl;


	return 0;

}

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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))

using namespace std;

using i32 = int;
using i64 = long long;
using u64 = unsigned long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vu64 = vector<u64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
inline u64 xorshift() { static u64 x = 88172645463325252ull; x = x ^ (x << 7); return x = x ^ (x >> 9); }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T power(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
template <typename T, typename S> istream& operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
template <typename T, typename S> ostream& operator<<(ostream &os, pair<T, S> &p) { os << p.first << ' ' << p.second; return os; }

void solve() {
  int H, W, K;
  cin >> H >> W >> K;
  vstr s(H);
  rep(i, H) cin >> s[i];
  vector<vi32> ans(H, vi32(W));
  int c = 1, index = 1;
  rep(j, W) {
    int cnt = 0;
    rep(i, H) if (s[i][j] == '#') cnt++;
    if (cnt == 0) {
      c++;
      continue;
    }
    bool first = true;
    rep(i, H) {
      if (s[i][j] == '#') {
        if (first) {
          first = false;
        } else {
          index++;
        }
      }
      rep(k, c) {
        ans[i][j - k] = index;
      }
    }
    index++;
    c = 1;
  }
  rep(i, H) rep(k, c) {
    ans[i][W - k - 1] = ans[i][W - c];
  }
  rep(i, H) cout << ans[i] << endl;
}


Measured memory_bytes: 1280
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <utility>
#include <cmath>
#include <limits>

int tsurai(const std::vector<int> &s, const std::vector<int> &t) {
  std::vector<int> u, v;
  for (size_t i=0; i<s.size(); ++i) {
    if (s[i] == 0) u.push_back(i);
    if (t[i] == 0) v.push_back(i);
  }

  if (u.size() != v.size()) {
    return std::numeric_limits<int>::max();
  }

  int res=0;
  for (size_t i=0; i<u.size(); ++i) {
    //fprintf(stderr, "%d, %d\n", u[i], v[i]);
    res += std::abs(u[i]-v[i]);
  }

  return res;
}

int main() {
  int N, M;
  scanf("%d %d", &N, &M);

  std::vector<int> b(N), c(N), p(M);
  for (int i=0; i<N; ++i) {
    scanf("%d", &b[i]);
    c[i] = b[i] ^ 1;
  }

  for (int i=0; i<M; ++i)
    scanf("%d", &p[i]);

  std::vector<int> pb, pc;
  for (int i=0; i<M; ++i) {
    for (int j=0; j<p[i]; ++j) {
      pb.push_back(i&1);
      pc.push_back(pb.back()^1);
    }
  }

  int res=std::numeric_limits<int>::max();
  for (const auto &bc: {b, c})
    for (const auto &pbc: {pb, pc})
      res = std::min(res, tsurai(bc, pbc));

  printf("%d\n", res);
  return 0;
}

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

int main(){
    int n, m;
    cin >> n >> m;
    
    vector<int> food(m);
    
    for (int i = 0; i < n; i++) {
        int k;
        cin >> k;
        for (int j = 0; j < k; j++) {
            int a;
            cin >> a;
            food.at(a - 1)++;
        }
    }
    
    int count = 0;
    for (int i = 0; i < m; i++) {
        if (food.at(i) == n) {
            count++;
        }
    }
    
    cout << count << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#define ll long long
#define inf 0x3f3f3f3f
#define maxn 200010
inline ll read()
{
	ll x=0; char c=getchar(),f=1;
	for(;c<'0'||'9'<c;c=getchar())if(c=='-')f=-1;
	for(;'0'<=c&&c<='9';c=getchar())x=x*10+c-'0';
	return x*f;
}
inline void write(ll x)
{
	static char buf[20];
	int len=0;
	if(x<0)putchar('-'),x=-x;
	for(;x;x/=10)buf[len++]=x%10+'0';
	if(!len)putchar('0');
	else while(len)putchar(buf[--len]);
}
inline void writesp(ll x){write(x); putchar(' ');}
inline void writeln(ll x){write(x); putchar('\n');}
int a[maxn];
int n;
int main()
{
	n=read();
	for(int i=1;i<=n;i++)
		a[i]=read();
	ll sum=0;
	for(int i=1;i<=n;i++)
		sum+=a[i];
	ll now=0,ans=1ll<<60;
	for(int i=1;i<=n;i++){
		ans=std::min(ans,std::abs(sum-2*now));
		now+=a[i];
	}
	writeln(ans);
	return 0;
}

Measured memory_bytes: 896
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

#define fore(i,a,b) for(int i = a; i < (b); i++)
#define fr(i,a,b) for(int i = a - 1; i >= b; i--)
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define N 300005
#define inf 2000000000
#define EPS 1e-6
#define MOD (ll)1e15
#define __builtin_popcount(x) __popcnt(x)

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pr;

ll binpow(ll x, ll p)
{
	if (p == 0)
		return 1;
	if (p % 2)
		return (binpow(x, p - 1) * x) % MOD;
	else
	{
		ll xx = binpow(x, p / 2);
		return (xx * xx) % MOD;
	}
}

inline void solve()
{
	ll n, d, x, y, cnt = 0;
	cin >> n >> d;
	fore(i, 0, n)
	{
		cin >> x >> y;
		if (sqrt(binpow(x, 2) + binpow(y, 2)) <= d) cnt++;
	}
	cout << cnt;
}

int main()
{
	fast;
#if defined(_DEBUG)
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	/*int q = 1;
	//cin >> q;
	while (q--)
	{*/
		solve();
		//cout << '\n';
	//}
}

Measured memory_bytes: 3716
#include<stdio.h>
#include<iostream>
using namespace std;

int A,B,C;
int main (){
    cin >> A >> B >> C;
    int sum = 0;
    for(int i=0; i <= (B + C) * A; i++){
        sum += A;
        if ( sum  % B == C ) {
            cout << "YES" << endl;
            return 0;
        }
    }
    cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 256
# coding: utf-8

n = int(input())

nums = []
for _ in range(5):
    nums.append(int(input()))

minidx = 0
for i in range(5):
    if nums[i] < nums[minidx]:
        minidx = i

minnum = nums[minidx]

if n % minnum == 0:
    print(4 + n // minnum)
else:
    print(4 + n // minnum + 1)

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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define ALL(a) (a).begin(),(a).end()

using namespace std;
using ll = long long;

const double PI = 3.14159265358979;

void solve()
{
  ll a, v, b, w, t;
  cin >> a >> v >> b >> w >> t;
  cout << (abs(a - b) <= (v - w) * t ? "YES" : "NO");
}

int main()
{
  fastio;
  solve();

  return 0;
}

Measured memory_bytes: 3616
#pragma GCC optimize("O3") 

#include <bits/stdc++.h>
using namespace std;

typedef long long int           ll;
typedef unsigned long long int  ull;
typedef long double             ld;

typedef pair<int, int>          pii;
typedef pair<ll,ll>             pll;
typedef vector<int>             vi;
typedef vector<ll>              vll;
typedef vector<pii>             vpii;
typedef vector<pll>             vpll;

#define test(t)		        int t; cin >> t; while(t--)
#define f(i, a, b)	        for(int (i) = (a); (i) < (b); ++(i))
#define all(a)		        (a).begin(), (a).end()
#define endl 		        "\n"
#define maxvec(vec)             *max_element(all(vec))
#define minvec(vec)             *min_element(all(vec))
#define maxarr(arr)             *max_element(arr, arr + n)
#define minarr(arr)             *min_element(arr, arr + n)
#define deb(x)		        cout << #x << ": " << x << endl;
#define deb2(x,y)	        cout << #x << ": " << x << " ~ " <<  #y << ": " << y << endl;
#define deba(arr)	        cout << #arr << " ~ [ "; for(auto n: arr) cout << n << " "; cout << "]" << endl;
#define debap(arr)	        cout << #arr << " ~ [ "; for(auto n: arr) cout << n.first << "-" << n.second << " "; cout << "]" << endl;
#define fast 		        ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

#define mx9		1000000007
#define mx7		10000007
#define mx6		1000006
#define mx5		200005
#define inf		1<<30                                 
#define eps		1e-9
#define mod		1000000007
#define PI		3.141592653589793238462643383279502884L

void solve()
{
    int n, p;
    cin >> n;
    map<int,int> mp;
    f(i, 0, n)
    {
        cin >> p;
        vi arr;
        for(int j = 2; j * j <= p; j++)
        {
            if(p % j == 0)
            {
                while(p % j == 0)
                    p /= j;
                mp[j]++;
            }
        }
        if(p > 1)
            mp[p]++;
    }
    int c = 1;
    for(auto it: mp){
        if(it.second == n){
            cout << "not coprime" << endl;
            return;
        }
    }
    for(auto it: mp){
        if(it.second > 1){
            cout << "setwise coprime" << endl;
            return;
        }
    }
    cout << "pairwise coprime" << endl;
}

int main()
{
    fast;
    // test(t)
        solve();
    return 0;
}

Measured memory_bytes: 7300
#include <iostream>
#include <algorithm>
#include <cstring>

using namespace std;

struct node
{
	int c;//价格 
	int a[15];//这本书能够提升Ta的第j个算法多少等级 
}book[15];//第i本书的信息 
int b[15];//每一个子集中所有书能够提升Ta的第j个算法的总等级 

int main()
{ 
	int n,m,x;
	cin>>n>>m>>x;
	for(int i=0;i<n;i++)
	{
		cin>>book[i].c;
		for(int j=0;j<m;j++) cin>>book[i].a[j];
	 } 
	 int ans=2e9;
	for(int i=0;i<(1<<n);i++)
	{
		memset(b,0,sizeof b);
		int sum=0;//每一个子集中的所有书总价格
		for(int j=0;j<n;j++)
			if(i>>j&1)
			{
				sum+=book[j].c;
				for(int k=0;k<m;k++) b[k]+=book[j].a[k];
			 } 
		bool flag=1;//判断是否每一个算法都大于等于x，1为是，0为否
		for(int j=0;j<m;j++) if(b[j]<x) flag=0;
		if(flag) ans=min(ans,sum);
	}
	if(ans==2e9) cout<<"-1";
	else cout<<ans;
	
	return 0;
}

Measured memory_bytes: 3120
n,m = map(int,input().split())
d = {}
f = {}
for i in range(1,n+1):
    d[i] = []
    f[i] = 0
    
correct = 0
wrong = 0
for i in range(m):
    p,s = input().split()
    p = int(p)
    
    if(s=="AC" and f[p]==0):
        correct += 1 
        wrong += len(d[p])
        f[p] = 1
        
    d[p].append(s)

print(correct,wrong)
    


Measured memory_bytes: 34960
//g++ -std=c++17 -Wshadow -Wall -fsanitize=address -fsanitize=undefined -D_GLIBCXX_DEBUG -g PROGRAM -o OUTPUT -DLOCAL -lasan -lubsan
#include <bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>

#define ll long long
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define alli(a, n, k) (a + k), (a + n + k)
#define FP(i, a, b, k) for (__typeof(a) i = a; i < b; i += k)
#define FS(i, a, b, k) for (__typeof(a) i = a; i > b; i -= k)
#define IT(it, a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); ++it)
#define eps 1e-6
#define pi 3.141592653589793
using namespace std;
using namespace __gnu_pbds;

template <class T>
inline T gcd(T x, T y)
{
    if (!y)
        return x;
    return gcd(y, x % y);
}
typedef vector<int> VII;
typedef vector<ll> VLL;
typedef pair<int, int> PII;
typedef vector<pair<int, int>> VPII;
typedef vector<pair<int, PII>> VPPI;
const int MOD = 1e9 + 7;
const int INF = 1e9;


inline ll modulo(ll a, ll m)
{
    return (a % m + m) % m;
}

inline ll modInverse(ll a, ll m)
{
    assert(__gcd(a, m) == 1);
    ll m0 = m;
    ll y = 0, x = 1;

    if (m == 1)
        return 0;

    while (a > 1)
    {
        ll q = a / m;
        ll t = m;

        m = a % m, a = t;
        t = y;

        y = x - q * y;
        x = t;
    }

    if (x < 0)
        x += m0;

    return x;
}

inline ll modPow(ll x, ll y, ll m)
{ //x^y % m
    if (y == 0)
        return 1LL;
    else if (y == 1)
        return x;
    else
    {
        ll ans = modPow(x, y / 2, m) % m;
        if (y & 1)
        {
            return (((ans * ans) % m) * x) % m;
        }
        else
        {
            return (ans * ans) % m;
        }
    }
}

vector<string> split(char d,string s)
{
    stringstream ss(s);
    string t;
    vector<string> words;
    while(getline(ss,t,d))
    {
        words.pb(t);
    }

    return words;
}
double dist(ll x,ll y)
{
    return sqrt(x * x + y * y);
}
int main(int argc, char *argv[])
{
#ifdef LOCAL
    auto start = chrono::high_resolution_clock::now();
#endif
    
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    int n;
    double d;
    cin >> n >> d;
    int cnt = 0;
    while(n--)
    {
        int x, y;
        cin >> x >> y;
        double c = dist(x, y);
        if(c<=d)
            cnt++;
    }

    cout << cnt;

#ifdef LOCAL
    auto end = chrono::high_resolution_clock::now();
    double time_taken =
        chrono::duration_cast<chrono::nanoseconds>(end - start).count();

    time_taken *= 1e-9;

    cerr << "\nTime taken by program is : " << fixed
         << time_taken << setprecision(9);
    cerr << " sec" << endl;
#endif
    return 0;
}


Measured memory_bytes: 3728
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 
#include <stack>
#include <set>

using namespace std;
typedef long long ll;
#define rep(i, s, e) for (int(i) = (s); (i) <= (e); ++(i))
#define all(x) x.begin(),x.end()


int main()
{
	int n, k; cin >> n >> k;
	vector<int> h(n);
	rep(i, 0, n - 1)cin >> h[i];
	vector<int> dp(n, 1001001001);
	dp[0] = 0;
	rep(i, 0, n - 2)for (int j = 1; i + j < n && j <= k; ++j)
	{
		dp[i + j] = min(dp[i + j], dp[i] + abs(h[i] - h[i + j]));
	}
	cout << dp[n - 1] << endl;
}

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

vector <int> dx = {-1,1,0,0};
vector <int> dy = {0,0,-1,1};

int main(){

	ll d,t,s;cin>>d>>t>>s;
	if(t*s>=d){
		cout<<"Yes"<<"\n";
	}else{
		cout<<"No"<<"\n";
	}
	return 0;
}

Measured memory_bytes: 3624
N, M, C = [int(i) for i in raw_input().split()]
B = [int(i) for i in raw_input().split()]
n = 0
for i in range(N):
	A = [int(i) for i in raw_input().split()]
	if sum(a * b for a, b in zip(A, B))+C > 0:
		n = n + 1
print(n)


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

typedef long long ll;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define is(a, b) a == b
#define sz(v) ll(v.size())


void solve(ll N, ll A, ll B, ll C, ll D, ll E){
    ll v[5] = {A, B, C, D, E};
    ll mn = ll(1e15);
    ll idx = 0;
    rep(i, 5) {
        if (v[i] < mn) {
            mn = v[i];
            idx = i;
        }
    }
    ll t = N % mn == 0 ? (N / mn) : (N / mn + 1);
    ll s = t + 4;
    cout << s << endl;
}

int main() {
  ll N;
    scanf("%lld",&N);
    ll A;
    scanf("%lld",&A);
    ll B;
    scanf("%lld",&B);
    ll C;
    scanf("%lld",&C);
    ll D;
    scanf("%lld",&D);
    ll E;
    scanf("%lld",&E);
  solve(N, A, B, C, D, E);
  return 0;
}


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

int main() {
    int A,B,C,D;
  int total=0;
int p;
    cin >>A>>B>>C>>D;

  for(int i=0;i<=D;i++){
        for(int j=0;j<=D;j++){
        p=A*i+B*j;
            if(p==D){
total+=1; 

}
else if((D-p)%C==0&&(D-p)>=0){
     total+=1;
}
}
}
    
   cout << total<< endl;
    }
 

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define MN 100100
using namespace std;
typedef long long LL;
int n;
struct Com
{
    int a,b;
}num[MN];
int cmp(Com x,Com y)
{
    return x.a<y.a;
}
LL k,sum[MN];
int main()
{
    scanf("%d%lld",&n,&k);
    for(int i=1;i<=n;i++)
    {
        scanf("%d%d",&num[i].a,&num[i].b);
    }
    sort(num+1,num+1+n,cmp);
    sum[0]=0;
    for(int i=1;i<=n;i++)
    {
        sum[i]=sum[i-1]+num[i].b;
    }
    int pos=lower_bound(sum+1,sum+1+n,k)-sum;
    printf("%d\n",num[pos].a);
    return 0;
}


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

using namespace std;

#define loop(i, n) for(int i = 0;i < int(n);i++)
#define rloop(i, n) for(int i = int(n);i >= 0;i--)
#define range(i, a, b) for(int i = int(a);i <= int(b);i++)
#define SZ(c) int(c.size())
#define ALL(c) c.begin(), c.end()
#define RALL(c) c.rbegin(), c.rend()
#define PI acos(-1)
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define sfi1(v) scanf("%d",&v)
#define sfi2(v1, v2) scanf("%d %d",&v1,&v2)
#define sfi3(v1, v2, v3) scanf("%d %d %d",&v1,&v2,&v3)
#define sfll1(v) scanf("%I64d",&v);
#define sfll2(v1, v2) scanf("%I64d %I64d",&v1,&v2)
#define sfll3(v1, v2, v3) scanf("%I64d %I64d %I64d",&v1,&v2,&v3)
#define endl '\n'

typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
typedef long long ll;
typedef pair<int, int> pii;


int main() {

#ifndef ONLINE_JUDGE
    //freopen("in.in", "r", stdin);
    //freopen("out.in", "w", stdout);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int L, R;
    cin >> L >> R;
    if (R - L + 1 > 2019) {
        cout << 0 << endl;
    } else {
        int best = 2019;
        range(i, L, R) {
            range(j, i + 1, R) {
                int cur = 1LL * i * j % 2019;
                best = min(best, cur);
            }
        }
        cout << best << endl;
    }
    return 0;
}


Measured memory_bytes: 256
/*                                  /   \                                                                   (Hello)//JSM//*/      
/*                                 /*****\                                                                              */
/*     Jai Shree Mataji           /       \ |\| |_| $ |-| K                                                            */
#include<vector>
#include<iostream>
#include<algorithm>                
#include<string.h>                 
#include<bits/stdc++.h>            
#include<cstring>                  
#include<map>                     
#include<cmath>                  
#include<set>
using namespace std;            
#define ll long long int        
#define ld long double
#define MOD 1000000007 
#define PI 3.1415926535897932384626433832795                                               
#define YY cout<<"YES"
#define NN cout<<"NO"
#define EE cout<<"\n"
#define ee cout<<"\n"
#define ne cout<<"-1"
#define pb push_back 
#define fi first
#define se second
#define mkp make_pair    
#define mkt make_tuple
#define sall(v ) sort(v.begin(), v.end())      
#define all(v )  v.begin(), v.end()      
#define rall(v )  reverse(v.begin(), v.end())      
#define fo(i , n) for(ll i = 0 ; i < n ; i++)
#define vl vector<ll>
#define vll vector< pair<ll,ll> > 
#define mpl map<ll, ll>
#define pr pair<ll,ll>
#define tpl tuple<ll,ll,ll>
bool sortbysec(const pair<int,int> &a,const pair<int,int> &b) {return (a.second < b.second); }
ll soltn(ll x, ll n) {if(x>=0) return x%n;    else return n+x%n;}
ll pd(ll x,ll y){if(x%y==0) return x/y;else return x/y+1;}
ll coda(ll n,ll d){ll count=0;while(n!=0){if(n%10==d)count++;n/=10;}return count;}
ll pow1(ll n,ll p){if(p==0)return 1;ll x=pow1(n, p/2);x=(x*x)%MOD;if(p%2==0) return x;else return (x*n)%MOD;}
/*vl v[300009];
ll vis[300009];
ll d;
ll ma;
ll ext;
ll up=0;
mpl M;
void dfs(ll node,ll distance)
{
	if(vis[node]==1)
	return;
	if(ma<=distance)
	{
		ma=distance;
		ext=node;
	}
	if(up==1)
	{
		if(distance==ma)
		M[node]=1;
	}
	vis[node]=1;
	for(ll i=0;i<v[node].size();i++)
	{
		ll child=v[node][i];
		dfs(child,distance+1);
	}
}*/
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);	
	  ll t=1;
      
      
//	   cin>>t;
	      while(t--)
{
//jai shree mataji
ll a,b,c;
string s;
cin>>s;
ll ans=0;
fo(i,s.length())
{
	ans+=s[i]-48;
}	
if(ans%9==0)
cout<<"Yes";
else
cout<<"No";
ee;
}
return 0;
}














Measured memory_bytes: 3716
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int N = sc.nextInt();
      
	    double[] A = new double[N];
	    double[] gA = new double[N];
	    double num = 0;
    
  	    for(int i = 0 ;i<N;i++){
          A[i] = sc.nextInt();
          gA[i] = 1/A[i];
          num = num + gA[i];
       	}
      
      	num = 1/num;
		System.out.println(num);
	}
}

Measured memory_bytes: 20820
/* Just_Do_It ___________ICARUS__________________*/
	                 
	#include <bits/stdc++.h>
	using namespace std;
	       
	typedef long long ll;
	#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	#define rep(i,a,n) for(ll i=a;i<n;i++)
	#define per(i,a,n) for (ll i=n-1;i>=a;i--)
	#define te ll t; std::cin >> t; while(t--)
	#define SZ 100001
	//# define M_PIl  3.141592653589793238462643383279502884L 
	/*   Proceed with CAUTION   */

	int main(){
		fastio;
		ll n,k;
		cin>>n>>k;
		cout<<((n*k)%2 ? "Yes":"No")<<endl;
	}

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

int main() {
	int n, r, p, c;
	vector<int> v, vs;
	while(1) {
		cin >> n >> r;
		if(!n&&!r) break;
		v.clear();
		for(int i=n; i>0; --i) v.push_back(i); 
		for(int i=0; i<r; ++i) {
			cin >> p >> c;
			vs.clear();
			for(int j=p-1; j<p-1+c; ++j) vs.push_back(v[j]);
			v.erase(v.begin()+p-1, v.begin()+p-1+c);
			v.insert(v.begin(), vs.begin(), vs.end());
		}
		cout << v[0] << endl;
	}
	return 0;
}

Measured memory_bytes: 1224
import java.util.Scanner;

class Main {
  public static void main(String[] args){

    Scanner sc = new Scanner(System.in);

    int A = sc.nextInt();
    int B = sc.nextInt();
    int C = sc.nextInt();

    if (A == B){
      System.out.println(C) ;
    }
    if (B == C){
      System.out.println(A) ;
    }
    if (A == C){
      System.out.println(B) ;
    }

  }
}


Measured memory_bytes: 23252
#include<iostream>
#include<vector>
#include<algorithm>
#include<stdlib.h>
#include<utility>
#include<functional>
#include<cfenv>
#include<cmath>
#include<string>
#include<queue>
#include<stack>
#include<map>
#include<set>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define vint vector<int>
#define vvint vector<vint>
#define P pair<int,int>
#define INT_MAX 2147483647
#define MOD 1000000007
#define PI 3.14159265358979323846
using namespace std;
typedef long long ll;

#define MAX 1000000000000

map<ll,ll> st;

void devide(ll n) { //ここの値を自由に変えてください。cinで直接入力しても大丈夫かと思います。
	ll x = n;
	for (ll i = 2; i * i <= x; i++) {
		while (n % i == 0) {
			st[i]++;
			n /= i;
		}
	}
	if (n != 1)
		st[n]++;
}


int main(void) {
	ll n; cin >> n;
	ll ans = 0;
	devide(n);
	for (auto i = st.begin(); i != st.end();i++) {
		int j=0;
		while (true) {
			j++;
			if (i->second <(j*(j + 1)) / 2) {
				j--;
				break;
			}
		}
		ans += j;

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

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll t,n,m,i,j,k,x,y;
    string s;
    cin>>s;
    if(s[1]=='B')
        cout<<"ARC";
    else
        cout<<"ABC";
}


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

int main(void){
   int n,d,x;
   cin >> n >> d >> x;
   vector<int> a(n);
   for(int i = 0;i < n;i++)cin >> a[i];
   int ans = n+x;
   for(int i = 0;i < n;i++){
       if(d % a[i] == 0)ans += d/a[i]-1;
       else ans += d/a[i];
   }
   cout << ans;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <limits.h>
#include <time.h>
#define ll long long
int main(){
    ll i,n,eight[1000010]={},nine[1000010]={},ten[1000010]={},ans;
    scanf("%lld",&n);
    eight[0]=1;
    nine[0]=1;
    ten[0]=1;
    for(i=0; i<n; i++){
        eight[i+1]=8*eight[i];
        eight[i+1]=eight[i+1]%1000000007;
        nine[i+1]=9*nine[i];
        nine[i+1]=nine[i+1]%1000000007;
        ten[i+1]=10*ten[i];
        ten[i+1]=ten[i+1]%1000000007;
    }
    ans=ten[n]-2*nine[n]+eight[n];
    ans+=2000000014;
    ans=ans%1000000007;
    printf("%lld",ans);
    return 0;
}

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

#define F first
#define S second
#define mp make_pair
#define pb push_back
#define sz(x) x.size()
#define all(x) x.begin(), x.end()
#define pii pair < int , int >
#define task ""

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

const int N = 1e5 + 123;
const int mod = 1e9 + 7;
const int inf = 1e9 + 1;
const ll infl = 3e18 + 1;
const double pi = acos(-1.0);

inline void boost () {
    ios_base::sync_with_stdio (0);
    cin.tie (0); cout.tie (0);
}
int n, a[205], ans;

int main () {
	boost ();
	cin >> n;
	for (int i = 1;i <= n + n;i ++) cin >> a[i];	         	
	sort (a + 1, a + n + n + 1);
	reverse (a + 1, a + n + n + 1);
	for (int i = 1;i <= n + n;i += 2) {
		ans += a[i + 1]; 
	}
	cout << ans;

return 0;       
}
    

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define f(n) for(int i=0;i<n;i++)
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007
#define MOD 1000000007
#define endl "\n"
#define int long long
#define ll long long
#define vi vector <int>
#define vvi vector <vector<int> >
#define vii vector <pair<int,int> >
#define rep(i,a,b) for (int i=a;i<b;i++)
#define repD(i,a,b) for (int i=a;i>=b;i--)
#define init(i,k) memset(i,k,sizeof i)
#define pb push_back
#define pii pair <int,int>
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define maxe *max_element
#define mine *min_element
#define pow2(n) (1LL << (n))
#define sz(a) (int)a.size()
#define MOD 1000000007
#define PI 3.14159265359
inline ll add(ll a, ll b){ return ((a%MOD)+(b%MOD))%MOD;}
inline ll mul(ll a, ll b){ return ((a%MOD)*(b%MOD))%MOD;}
inline ll sub(ll a, ll b){ return ((a%MOD)-(b%MOD)+MOD)%MOD;}
int power(int x, unsigned int y, int p=MOD)  
{  
    if(y==0)
    {
        return 1;
    }
    int ans=power(x,y/2,p);
    if(y%2)
    {
        int z=((((ans*ans)%p)*x)%p);
        return z;
    }
    else
    {
        int z=(ans*ans)%p;
        return z;
    }
} 


int solve()
{
    int n,w;
    cin>>n>>w;
    vector<vector<int> > v(n,vector<int> (2));
    for(int i=0;i<n;i++)
    {
        cin>>v[i][0];
        cin>>v[i][1];
    }
    vector<vector<int> > dp(n+1,vector<int> (w+1,0));
    for(int i=1;i<=n;i++)
    {
        int x=v[i-1][0];
        int y=v[i-1][1];
        for(int j=1;j<=w;j++)
        {
            if(j>=x)
            {
                dp[i][j]=max(dp[i-1][j-x]+y,dp[i-1][j]);
            }
            else
                dp[i][j]=dp[i-1][j];
        }
    }
    return dp[n][w];
}
/********************************************/
signed main()
{   
    speed
    int t=1;
    //cin>>t;
    while(t--)
    {
        cout<<solve()<<endl;
    }
    return 0;
}


Measured memory_bytes: 83112
N = gets.chomp.to_i
S = gets.chomp.split('')

ans = 0
(0..9).to_a.map(&:to_s).repeated_permutation(3) do |a|
  flags = [false, false, false]
  S.each do |s|
    if !flags[0]
      if a[0] == s
        flags[0] = true
        next
      end
    elsif !flags[1]
      if a[1] == s
        flags[1] = true
        next
      end
    elsif !flags[2]
      if a[2] == s
        ans += 1
        break
      end
    end
  end
end
p ans


Measured memory_bytes: 15724
#include <iostream>
#include <cmath>
#include <algorithm>

using namespace std;

int n, a[100002];

int main()
{
	int cnt[2] = {0, 0}, sum = 0, mn = 1e9;

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

		if(a[i] >= 0)
			cnt[0]++;
		else
			cnt[1]++;
		sum += abs(a[i]);
		mn = min(mn, abs(a[i]));
	}

	sort(a, a + n);
	if(cnt[0] * cnt[1] != 0)
	{
		cout << sum << '\n';

		int prev = a[0] - a[n - 1];

		if(a[1] >= 0)
			cout << a[0] << ' ' << a[n - 1] << '\n';
		else
		{
			prev *= -1;
			cout << a[n - 1] << ' ' << a[0] << '\n';
		}

		for(int i = 1; i < n - 2; i++)
		{
			if(a[i + 1] >= 0)
			{
				if(prev >= 0)
					cout << a[i] << ' ' << prev << '\n';
				else
					cout << prev << ' ' << a[i] << '\n';
				prev = -abs(prev) - abs(a[i]);
			}
			else
			{
				if(prev >= 0)
					cout << prev << ' ' << a[i] << '\n';
				else
					cout << a[i] << ' ' << prev << '\n';
				prev = abs(prev) + abs(a[i]);
			}
		}

		if(a[n - 2] - prev > prev - a[n - 2])
			cout << a[n - 2] << ' ' << prev << '\n';
		else
			cout << prev << ' ' << a[n - 2] << '\n';
	}
	else
	{
		cout << sum - 2 * mn << '\n';

		if(cnt[0] == 0)
		{
			int prev = a[n - 1] - a[n - 2];
			cout << a[n - 1] << ' ' << a[n - 2] << '\n';

			for(int i = n - 3; i > 0; i--)
			{
				cout << prev << ' ' << a[i] << '\n';
				prev = prev - a[i];
			}

			if(n > 2)
				cout << prev << ' ' << a[0] << '\n';
		}
		else
		{
			int prev = a[0] - a[1];
			cout << a[0] << ' ' << a[1] << '\n';

			for(int i = 2; i < n - 1; i++)
			{
				cout << prev << ' ' << a[i] << '\n';
				prev = prev - a[i];
			}

			if(n > 2)
				cout << a[n - 1] << ' ' << prev << '\n';
		}
	}

}

Measured memory_bytes: 2304
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <deque>
#include <queue>
#include <set>
#include <functional>
#include <cmath>
#include <set>
#include <map>


//マクロ
/*動かない・・・
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define REP(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _roverload3(_1,_2,_3,name,...) name
#define _rrep(i,n) repi(i,0,n)
#define rrepi(i,a,b) for(int i=int(a);i<int(b);++i)
#define RREP(...) _roverload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
//*/
#define REP(i,n) for(int i=0; i<(int)(n); ++i)
#define REPS(i,n) for(int i=1; i<=(int)(n); ++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 FOR(i,s,e) for(int i=(int)(s); i<(int)(e); ++i)
#define RFOR(i,s,e) for(int i=(int)(e)-1; i>=(int)(s); --i)
//*/
#define All(a) (a).begin(),(a).end()
#define dump(x)  cerr << #x << " = " << (x) << endl;

//定数
#define INF 1e9
#define INFL 1e18
#define MOD (int)(1e9+7)

typedef long long ll;
typedef unsigned long long ull;
/*
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
//*/
using namespace std;
using Graph = vector<vector<int>>;

//とりあえず書いておく変数
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };

//今回の変数
string s;

//使用する関数
template<class T>bool chmax(T &a, const T &b) {
	if (a < b) { a = b; return 1; }
	return 0;
}
template<class T>bool chmin(T &a, const T &b) {
	if (a > b) { a = b; return 1; }
	return 0;
}

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

	cin >> s;
	if (s[0] == s[1] && s[1] == s[2]) {
		cout << "No" << endl;
	}
	else {
		cout << "Yes" << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,1,0,-1},dy={-1,0,1,0};
bool inside(int y,int x,int h,int w){
	if(y<h && y>=0 && x<w && x>=0) return true;
	return false;
}





int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,k;cin >> n >> k;
	int ans = 0;
	rep(i,n){
		int h;cin >> h;
		if(h >= k) ans++;
	}
	cout << ans << endl;
}


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

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

  string s0 = "CODEFESTIVAL2016";

  int count = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s0[i] != s[i]) count++;
  }

  cout << count << endl;

  return 0;
}


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

//降順
int s_dsort(const void *a, const void *b) {
  return *(int *)b - *(int *)a;
}

int main(void) {

	int  H;
	int  N,A[100000];
	int  i;

//入力
    scanf("%d %d",&H,&N);
    for(i=0;i<N;i++)
	    scanf("%d",&A[i]);

//降順に並べる
	qsort((void*)A,N,sizeof(int),s_dsort);

//やっつける！
	for(i=0;i<N;i++) {
		if(H<=0) break;
		H-=A[i];
	}
	if(H>0) printf("No\n");
	else    printf("Yes\n");
	return 0;
}



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

void file() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}

void fast()
{
    std::ios_base::sync_with_stdio(0);
    cin.tie(NULL); cout.tie(NULL);
}

const int MAX = 2e5 + 5;

int n;

int a[MAX];

ll dp[MAX][3]; // dp[N][K] holds the maximum sum of choosing N / 2 element and skipping K elements

ll solve(int idx, int k)
{
    if (idx > n)
    {
        return k ? -1e17 : 0;
    }
    
    ll &ret = dp[idx][k];

    if (~ret)
    {
        return ret;
    }
    ret = -1e17;

    if (k) // you can skip k elements in the serius
    {
        ret = max(ret, solve(idx + 1, k - 1));
    }
    ret = max(ret, solve(idx + 2, k) + a[idx]);
    return ret;

}

int main(int argc, char const *argv[])
{
    file();
    
    cin>>n;

    memset(dp, -1, sizeof(dp));
    
    for (int i = 0; i < n; ++i)
    {
        cin>>a[i];
    }

    cout<<solve(0, (n & 1) + 1);
        

}

Measured memory_bytes: 15340
package main

import "fmt"

// UnionFind is union find structure
type UnionFind struct {
	Par  []int
	Rank []int
	Size []int
}

// NewUnionFind generates a new union find
func NewUnionFind(n int) *UnionFind {
	uf := &UnionFind{make([]int, n), make([]int, n), make([]int, n)}
	for i := range uf.Par {
		uf.Par[i] = i
		uf.Rank[i] = 0
		uf.Size[i] = 1
	}
	return uf
}

// Root searches the root of the arguement
func (uf *UnionFind) Root(x int) int {
	if x == uf.Par[x] {
		return x
	}
	uf.Par[x] = uf.Root(uf.Par[x]) // 経路圧縮
	return uf.Par[x]
}

// Unite unites two trees by adding one root to another
func (uf *UnionFind) Unite(x, y int) {
	rx := uf.Root(x)
	ry := uf.Root(y)
	if rx == ry {
		return
	}
	if uf.Rank[rx] < uf.Rank[ry] {
		uf.Par[rx] = ry
		uf.Size[ry] += uf.Size[rx]
	} else {
		uf.Par[ry] = rx
		uf.Size[rx] += uf.Size[ry]
		if uf.Rank[rx] == uf.Rank[ry] {
			uf.Rank[rx]++
		}
	}
}

// Same returns true when the two are in the same group
func (uf *UnionFind) Same(x, y int) bool {
	return uf.Root(x) == uf.Root(y)
}

func main() {
	var n, m, k int
	fmt.Scan(&n, &m, &k)
	uf := NewUnionFind(n)

	friends := make(map[int]int)
	for i := 0; i < m; i++ {
		var a, b int
		fmt.Scan(&a, &b)
		uf.Unite(a-1, b-1)
		friends[a-1]++
		friends[b-1]++
	}

	blocks := make([]int, n)
	for i := 0; i < k; i++ {
		var c, d int
		fmt.Scan(&c, &d)
		if uf.Same(c-1, d-1) {
			blocks[c-1]++
			blocks[d-1]++
		}
	}

	for i := 0; i < n; i++ {
		ans := uf.Size[uf.Root(i)] - friends[i] - blocks[i] - 1
		fmt.Printf("%v ", ans)
	}
	fmt.Println()
}


Measured memory_bytes: 13456
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define f first
#define s second
#define all(container) container.begin(),container.end()
#define fast ios::sync_with_stdio(0); cin.tie(0)
// #ifndef ONLINE_JUDGE
// #include "debug.cpp"
// #endif
#define int long long
const int mod = 1e9+7;  
int power(int a,int b) { if(b==0) return 1; int res = power(a,b/2); if(b&1) return res * res * a; else return res * res; }

const int sz = 1e6+1;
int notPrime[sz];

void sieve(){ // false means prime , true means not prime
  notPrime[0] = notPrime[1] = true;
  for(int i=2;i*i<=sz;i++) if(!notPrime[i]) for(int j=i*i;j<sz;j+=i) notPrime[j] = true; 
}

int32_t main(){
    
  fast;
  sieve();

  int x; cin >> x;

  while(notPrime[x]==true){
    x++;
  }

  cout << x << '\n';
  

  return 0;
}

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

#define ll long long int
#define watch(x) cout << (#x) << " is " << (x) << endl
#define f(i,x,n)  for(int i=x;i<n;i++)
#define FASTIO cin.tie(0); cout.tie(0);
#define eb(x) emplace_back(x)
#define mp(a,b) make_pair(a,b)
#define sz(a) int((a).size())
#define mod 1000000007

//MIN-MAX
#define max3(a, b, c) max(a, max(b, c))
#define min3(a, b, c) min(a, min(b, c))

//LCM
int lcm(int a, int b) {  return a * (b / __gcd(a, b)); }

//For sort by second
bool cmp(const pair<int,int> &a)
{ return a.first<a.second; }

//Tree
/* const int MAXN = 1e5 + 5;
vector<ll> adj[MAXN];*/

//ModPower
ll modpower(ll a,ll b,ll c)
{
	ll res=1;
	while(b)
	{
		if(b&1LL)
			res=(res*a)%c;
		a=(a*a)%c;
		b>>=1;
	}
	return res;
}

template<typename T> void print(T n)
{
   cout<<n;

    putchar('\n');
}

int main()
{
	FASTIO;

	    ll a,b;
	     cin>>a>>b;

	     if(a>=10 || b>=10 )
            print(-1);
         else
            print(a*b);

	return 0;
}













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

int main(){
    int n; cin >> n;
    double x;
    string u;
    double ans=0;
    for(int i=0;i<n;++i){
        cin >> x >> u;
        if(u=="JPY") ans+=x;
        else ans+=x*380000;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define reg register
typedef long long ll;
using namespace std;
const int MN=2e5+5;
int n,a[MN],b[MN];
inline bool check(int x){
	for(reg int i=1;i<=n;i++)b[i]=(a[i]>=x);
	reg int lt=-1,rt=-1;
	for(reg int i=(n+1)/2;i>1;i--)
		if(b[i]==b[i-1]){lt=i;break;}
	for(reg int i=(n+1)/2;i<n;i++)
		if(b[i]==b[i+1]){rt=i;break;}
	if(lt<0&&rt<0)return b[1];
	if(lt<0)return b[rt];
	if(rt<0)return b[lt];
	if((n+1)/2-lt<rt-(n+1)/2)return b[lt];
	else return b[rt];
}
int main(){
	scanf("%d",&n);n=2*n-1;
	for(reg int i=1;i<=n;i++)scanf("%d",a+i);
	reg int l=1,r=n,mid,ans=0;
	while(l<=r){
		mid=(l+r>>1);
		if(check(mid))ans=mid,l=mid+1;
		else r=mid-1;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> ls(2 * n);
  for (int i = 0; i < 2 * n; ++i)
    cin >> ls[i];
  sort(ls.begin(), ls.end());

  int ret = 0;
  for (int i = 0; i < n; ++i) {
    ret += ls[2 * i];
  }
  cout << ret << "\n";

  return 0;
}


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

typedef long long ll;
typedef vector<int> vi;

const int M = 1000000007, BIG = 0x3f3f3f3f;

int n;
vi a;

int Process() {
  int ans = 0;
  
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j < n; j++)
      for (int k = j + 1; k < n; k++) 
        if (a[i] != a[j] && a[i] != a[k] && a[j] != a[k]) {
          vi b = { a[i], a[j], a[k] };
          sort(begin(b), end(b));
          if (b[0] + b[1] > b[2]) 
            ans++;
        }
  
  return ans;
}

void Output() { cout << Process() << "\n"; }

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

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

    Output();
  }

  return 0;
}

Measured memory_bytes: 3656
#include<stdio.h>
int main(void)
{
	int d,n,a,b;
	scanf("%d %d",&n,&d);
	
	a = n / ((2 * d) + 1);
	b = n % ((2 * d) + 1);
	if(b==0){
		a = a - 1;
	}
	printf("%d",a+1);
	return 0;
}

Measured memory_bytes: 128