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

int main() {
  int n;cin>>n;
  vector<int> a(n);
  for(int i=0;i<n;++i) cin>>a[i];
  
  sort(a.begin(), a.end());
  int b=a[n-1];
  
  int dist=0;
  int ans =0;
  for(int i=0;i<n;++i){
    if (dist < min(b-a[i], a[i])) {
      dist=min(b-a[i], a[i]);
      ans = i;
    }
  }
  cout<<b<<" "<<a[ans]<<endl;
  
  return 0;
}


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

//template
typedef long long int ll;
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<n;i++)
#define repr(i,n) for(ll i=n;i>0;i--)
#define all(v) v.begin(),v.end()
#define in cin>>
#define out cout<<
#define en <<endl
const ll INF = 10000000000000;

int main()
{
	vector<ll> A(3);
	in A.at(0) >> A.at(1) >> A.at(2);
	sort(all(A));
	out A.at(0) <<" "<< A.at(1) <<" "<< A.at(2) en;
}



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

string str;

bool isPalindrome(int start, int end) {
  for(int i = start, j = end; i < j; i++, j--)
    if(str[i] != str[j])
      return false;
  return true;
}
int main() {
  int n;
  cin >> str;
  n = (int) str.size();
  isPalindrome(0, n - 1) && isPalindrome(0, ((n - 1) / 2) - 1) && isPalindrome(((n + 3) / 2) - 1, n - 1) ? cout << "Yes\n" : cout << "No\n";
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	int one,zero;
	one = 0;
	zero = 0;
	string S;
	cin >> S;
	int n = int(S.length());
	for(int i = 0;i < n; i++){
		if (S[i] == '1'){
			one++;
		}
		else{
			zero++;
		}
	}
	cout << 2 * min(one,zero) << endl;
	return 0;
}

Measured memory_bytes: 512
n, k = map(int, input().split())
res = 0.0

for i in range(n):
    dif = k - i
    temp = i + 1
    count = 0

    while (temp < k):
        #print(temp)
        temp = temp * 2
        count += 1

    p = (1 / n) * (1 / 2) ** count
    res += p

print(res)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define LL long long
using namespace std;
const int Maxn = 500000 + 100;
int X, Y, Z;
struct node
{
	int x, y, z;
}A[Maxn];
inline int cmp(node a, node b)
{
	return (a.x - a.y) < (b.x - b.y);
}
LL B[Maxn];
priority_queue<LL, vector<LL>, greater<LL> > q, Q;
inline int read()
{
	char ch = getchar();
	while (!isdigit(ch)){ch = getchar();}
	int Sum = ch - '0';
	ch = getchar();
	while (isdigit(ch))Sum = Sum * 10 + ch - '0', ch = getchar();
	return Sum;
}
int main()
{
	X = read(), Y = read(), Z = read();
	LL Cnt = 0;
	for (int i = 1; i <= (X + Y + Z); ++i)
		A[i].x = read(), A[i].y = read(), A[i].z = read(), Cnt += A[i].z;
	sort(A + 1, A + X + Y + Z + 1, cmp);
	LL Sum = 0;
	for (int i = 1; i <= Y; ++i)
		Sum += A[i].y - A[i].z,	q.push(A[i].y - A[i].z);
	for (int i = Y + 1; i <= Y + Z + 1; ++i)
	{
		B[i] = Sum;
		Sum += A[i].y - A[i].z;
		q.push(A[i].y - A[i].z);
		Sum -= q.top();
		q.pop();
	}
	Sum = 0;
	int i;
	for (i = X + Y + Z; i >= Y + Z + 1; --i)
	{
		Sum += A[i].x - A[i].z;
		Q.push(A[i].x - A[i].z);
	}
	LL Ans = 0;
	for (; i >= Y; i--)
	{
		Ans = max(Ans, Cnt + B[i + 1] + Sum);
		Sum += A[i].x - A[i].z;
		Q.push(A[i].x - A[i].z);
		Sum -= Q.top();
		Q.pop();
	}
	printf("%lld\n", Ans);
	return 0;
}

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

// const int MAX_M = 1e5;
// const int MAX_V = 1e9;
// int N, M;
// int a[MAX_N], b[MAX_N];

const int v_m = 6;
const int v_h = 30;

int main(){
    int a,b,h,m;
    cin >> a >> b >> h >> m;
    double ans, theta;
    double x,y;
    x = h * v_h + m * 0.5;
    y = v_m * m;
    theta = abs(x-y);
    theta = min(theta, 360-theta);
    theta *= (M_PI/180);

    // cout << theta << endl;

    ans = sqrt(a*a + b*b - 2*a*b*cos(theta));
    cout << setprecision(20) << ans << endl;
    return 0;
}

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

int	main()
{
	int	N;
	cin >> N;
	vector<vector<int>> table(2, vector<int>(N));
	for (int i = 0; i < 2; ++i) {
		for (int j = 0; j < N; ++j)
			cin >> table.at(i).at(j);
	}
	int	max_val, val;
	val = table.at(0).at(0);
	val += accumulate(table.at(1).begin(), table.at(1).end(), 0);
	max_val = val;
	for (int i = 1; i < N; ++i) {
		val += table.at(0).at(i) - table.at(1).at(i - 1);
		max_val = (max_val > val) ? max_val : val;
	}
	cout << max_val << endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int s[3][1001][1001],n,m,q;
main()
{
	cin>>n>>m>>q;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<m;j++)
		{
			char c;cin>>c;
			if(c=='J')c=0;
			else if(c=='O')c=1;
			else c=2;
			for(int a=0;a<3;a++)s[a][i+1][j+1]=s[a][i][j+1]+s[a][i+1][j]-s[a][i][j];
			s[c][i+1][j+1]++;
		}
	}
	for(int i=0;i<q;i++)
	{
		int a,b,c,d;cin>>a>>b>>c>>d;
		a--,b--;
		for(int j=0;j<3;j++)
		{
			int ans=s[j][c][d]-s[j][a][d]-s[j][c][b]+s[j][a][b];
			cout<<(j?" ":"")<<ans;
		}
		cout<<endl;
	}
}

Measured memory_bytes: 14700
#include <iostream>
using namespace std;
#define MAX 100005
#define NIL -1
struct Node { int parent, left, right; };
Node T[MAX];
int N, D[MAX], H[MAX];

void setDepth(int U, int E) {
	if (U == NIL) return;
	D[U] = E;
	setDepth(T[U].left, E + 1);
	setDepth(T[U].right, E + 1);
}
int setheight(int U) {
	int h1 = 0, h2 = 0;
	if (T[U].left != NIL) {
		h1 = setheight(T[U].left) + 1;
	}
	if (T[U].right != NIL) {
		h2 = setheight(T[U].right) + 1;
	}
	return H[U] = (h1 > h2 ? h1 : h2);
}
int getSibling(int U) {
	if (T[U].parent == NIL) return NIL;
	if (T[T[U].parent].left != U && T[T[U].parent].left != NIL) {
		return T[T[U].parent].left;
	}
	if (T[T[U].parent].right != U && T[T[U].parent].right != NIL) {
		return T[T[U].parent].right;
	}
	return NIL;
}
void print(int U) {
	cout << "node " << U << ": ";
	cout << "parent = " << T[U].parent << ", ";
	cout << "sibling = " << getSibling(U) << ", ";
	int deg = 0;
	if (T[U].left != NIL) deg++;
	if (T[U].right != NIL) deg++;
	cout << "degree = " << deg << ", ";
	cout << "depth = " << D[U] << ", ";
	cout << "height = " << H[U] << ", ";

	if (T[U].parent == NIL) {
		cout << "root" << endl;
	}
	else if (T[U].left == NIL && T[U].right == NIL) {
		cout << "leaf" << endl;
	}
	else cout << "internal node" << endl;
}

int main() {
	int V, L, R, root = 0;
	cin >> N;
	for (int i = 0; i < N; i++) {
		T[i].parent = NIL;
	}
	for (int i = 0; i < N; i++) {
		cin >> V >> L >> R;
		T[V].left = L;
		T[V].right = R;
		if (L != NIL) T[L].parent = V;
		if (R != NIL) T[R].parent = V;
	}

	for (int i = 0; i < N; i++) if (T[i].parent == NIL) root = i;

	setDepth(root, 0);
	setheight(root);

	for (int i = 0; i < N; i++) print(i);
}


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

int main() {
    int N; cin >> N;
    vector<ll> A(N); for (int i = 0; i < N; ++i) cin >> A[i];
    ll ans = 0;
    ll curr = 0;
    for (int i = 0; i < N; ++i) {
        if (A[i] < curr) {
            ans += curr - A[i];
        }
        curr = max(curr, A[i]);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4772
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
use 5.010;
my @args;
for (<>) {
    chomp $_;
    push @args, $_;
}

my ($A, $B, $C) = sort split " ", shift @args;
say $C * 10 + $B + $A;



__END__

# 6
3 2
1 1 2

Measured memory_bytes: 1920
#include<iostream>
using namespace std;
int main(){
  int N,M;
  cin>>N>>M;
  int count[100001]={0};
  int i=0;
  int tmp;
  for(i=0;i<M;i++){
    int a,b;
    cin>>a>>b;
    if(a>b){
      tmp=a;
      a=b;
      b=tmp;
    }
    count[a]++;
    count[b]++;
    //int k;
    //for(k=a;k<b;k++){
    //  count[k]++;
    //}
  }
  for(i=0;i<N;i++){
    if(count[i]%2){
      cout<<"NO"<<endl;
      return 0;
    }
  }
  cout<<"YES"<<endl;
  return 0;
  
}


Measured memory_bytes: 640
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <limits.h>
#include <math.h>
#include <functional>
#include <bitset>
#include <iomanip>

#define repeat(i,n) for (long long i = 0; (i) < (n); ++ (i))
#define debug(x) cerr << #x << ": " << x << '\n'
#define debugArray(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i] << '\n'
#define debugArrayP(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i].first<< " " << x[i].second << '\n'

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef vector<int> vint;
typedef vector<ll> vll;
const ll INF = INT_MAX;
const ll MOD = 1e9+7;


ll gcd(ll x,ll y){
  return y==0? x:gcd(y,x%y);
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;cin>>N;
  vint a(N);
  repeat(i,N){
    cin>>a[i];a[i]--;
  }
  int ans = -1;
  int j=0;
  repeat(i,N+1){
    if(j==1){
      ans = i;
      break;
    }
    j=a[j];
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include <cstdint>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;


int a, b, c;

int main() {

	cin >> a >> b >> c;

	cout << max(0, c - (a - b)) << endl;

	return 0;
}


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

int main(){
    string S;
    const char *s = NULL;
    cin >> S;
    s = S.c_str();
    vector<char> A;
    A.assign(s, s + S.length());
    vector<char>::iterator IA;
    long long Q;
    cin >> Q;
    long long T[Q + 1];
    long long F[Q + 1];
    char C[Q + 1];
    for(long long i = 1; i <= Q; i++){
        cin >> T[i];
        if(T[i] == 2){
            cin >> F[i] >> C[i];
        }
    }

    long long reversed = 0;
    for(long long i = 1; i <= Q; i++){
        if(T[i] == 1){
            reversed = !reversed;
        }
        else if((F[i] == 1 && reversed == 0) || (F[i] == 2 && reversed == 1)){
            IA = A.begin();
            IA = A.insert(IA, C[i]);
        }
        else{
            A.push_back(C[i]);
        }
    }
    if(reversed == 1) reverse(A.begin(), A.end());
    IA = A.begin();
    while(IA != A.end()){
        cout << *IA;
        ++IA;
    }
    cout << endl;
    system("pause");
    return 0;
}

Measured memory_bytes: 4660
import sys
input = sys.stdin.readline
Q = int(input())
Y = []
D = []
S = [0] * Q
s = 0
for i in range(Q):
    a = list(map(int, input().split()))
    Y.append(a)
    if a[0] == 1:
        D.append(a[1])
        s += a[2]
    S[i] = s

D = sorted(list(set(D)))
INV = {}
for i in range(len(D)):
    INV[D[i]] = i

N = 17
X = [0] * (2**(N+1)-1)
C = [0] * (2**(N+1)-1)

def add(j, x):
    i = 2**N + j - 1
    while i >= 0:
        X[i] += x
        C[i] += 1
        i = (i-1) // 2

def rangesum(a, b):
    l = a + (1<<N)
    r = b + (1<<N)
    s = 0
    while l < r:
        if l%2:
            s += X[l-1]
            l += 1
        if r%2:
            r -= 1
            s += X[r-1]
        l >>= 1
        r >>= 1
    return s
def rangecnt(a, b):
    l = a + (1<<N)
    r = b + (1<<N)
    s = 0
    while l < r:
        if l%2:
            s += C[l-1]
            l += 1
        if r%2:
            r -= 1
            s += C[r-1]
        l >>= 1
        r >>= 1
    return s

c = 0
su = 0
CC = [0] * (2**N)
for i in range(Q):
    y = Y[i]
    if y[0] == 1:
        add(INV[y[1]], y[1])
        CC[INV[y[1]]] += 1
        c += 1
        su += y[1]
    else:
        l, r = 0, 2**N
        while True:
            m = (l+r)//2
            rc = rangecnt(0, m)
            if rc >= (c+1)//2:
                r = m
            elif rc + CC[m] <= (c-1)//2:
                l = m
            else:
                break
        rs = rangesum(0, m)
        print(D[m], D[m]*rc-rs+(su-rs)-(c-rc)*D[m]+S[i])


Measured memory_bytes: 116308
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

    static PrintWriter out;
    static Scanner sc;

    static void solve() {
        int n = nextInt();
        List<Integer> list = nextIntList(n);

        sort(list);

        int ans = 0;
        boolean isAliceTurn = true;
        for (int i = n - 1; i >= 0; i--) {
            if (isAliceTurn) {
                ans += list.get(i);
                isAliceTurn = !isAliceTurn;
            } else {
                ans -= list.get(i);
                isAliceTurn = !isAliceTurn;
            }
        }
        System.out.println(ans);
    }

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

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

    static String nextString() {
        return sc.next();
    }

    static int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = nextInt();
        }
        return a;
    }

    static List<Integer> nextIntList(int n) {
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            list.add(nextInt());
        }
        return list;
    }

    static List<Long> nextLongList(int n) {
        List<Long> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            list.add(nextLong());
        }
        return list;
    }

    static <T extends Comparable<? super T>> void sort(List<T> list) {
        Collections.sort(list);
    }

    // greatest common divisor
    static long gcd(long a, long b) {
        if (b == 0) {
            return a;
        }
        return gcd(b, a % b);
    }

    // baseのn乗を計算を返す
    static int pow(int base, int n) {
        int ret = 1;
        for (int i = 0; i < n; i++) {
            ret *= base;
        }
        return ret;
    }

    // intをlength桁のbit文字列に変換
    static String toBinaryString(int input, int length) {
        return toBinaryString(input).substring(29 - length);
    }

    // intを29桁のbit文字列に変換
    static String toBinaryString(int input) {
        String ret = "";
        int max = 0x10000000;
        for (int i = 0; i < 29; i++) {
            int tmp = input / max;
            ret += tmp;
            input %= max;
            max /= 2;
        }
        return ret;
    }

    public static void main(String[] args) {
        out = new PrintWriter(System.out);
        sc = new Scanner(System.in);

        solve();

        out.flush();
        sc.close();
    }

}


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

int main(){
  long long A,B,K;
  cin >> A >> B >> K;
  for(int i=0;i<K;i++){
    if(i%2==0){
      if(A%2==1){
        A--;
      }
      B+=A/2;
      A/=2;
    }
    else{
      if(B%2==1){
        B--;
      }
      A+=B/2;
      B/=2;
    }
  }
  cout << A << " " << B << endl;
}
        
  

Measured memory_bytes: 3576
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1000000007;
 
ll powmod(ll x,ll y){
    ll res=1;
    for(ll i=0;i<y;i++){
        res=res*x%mod;
    }
    return res;
}
int main(){
    ll n;
    cin>>n;
    ll ans=powmod(10,n)-powmod(9,n)-powmod(9,n)+powmod(8,n);
    ans%=mod;
    ans=(ans+mod)%mod;
    cout<<ans<<"\n";
}

Measured memory_bytes: 3568
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,b,a) for(int i=b;i>=a;i--)
#define fori(a) for(auto i : a )
#define all(a) begin(a), end(a)
#define set(a,b) memset(a,b,sizeof(a))
#define sz(a) a.size()
double pi=acos(-1);
#define ll long long
#define ull unsigned long long
#define pb push_back
#define PF push_front //deque
// #define mp make_pair
#define pq priority_queue
const ll mod=1000000007;
// #define f first
// #define s second
#define pii pair< ll, ll >
#define vi vector<int>
#define vpii vector<pii>
#define debug(v) for(auto i:v) cout<<i<<" ";
#define tc int t; cin >> t; while(t--)

using namespace boost::multiprecision;
using namespace std;
void optimizeIO(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}


const int N=1000005;
ll fact[N],invfact[N];
ll power(ll x,ll y){
  if(y<=0) return 1LL;
  ll z=power(x,y/2);
  if(y%2) return (((z*z)%mod)*x)%mod;
  return (z*z)%mod;
}

void pre(){
  fact[0]=invfact[0]=invfact[1]=fact[1]=1;
  rep(i,2,N) fact[i]=(i*fact[i-1])%mod;
  rep(i,2,N) invfact[i]=(invfact[i-1]*power(i,mod-2))%mod;
}
ll nCr(ll n,ll k){ return (((fact[n]*invfact[n-k])%mod)*invfact[k])%mod; }



const int N1=1e6+1;
vector<int> isprime(N1,1),prime;
void seive(){
  rep(i,2,sqrt(N1)+1){
      if(isprime[i]){
        for(int j=i*i;j<N1;j+=i) isprime[j]=0;
        prime.pb(i);
      }
  }
  rep(i,sqrt(N1)+1,N1) if(isprime[i]) prime.pb(i);
}



struct dsu {
    vector<int> par, rank;
    dsu(int n): par(n+1), rank(n+1) {
        for (int i = 0; i <= n; i++) {
            par[i] = i;
            rank[i]= 1;
        }
    }
    int root(int a) {
        if (a == par[a]) return a;
        return par[a] = root(par[a]);
    }
    void merge(int a, int b) {
        a = root(a);
        b = root(b);
        if (a == b) return;
        if (rank[a] > rank[b]) swap(a, b);
        par[b] = a;
    }
    set<int> parent(int n){
        set<int> s;
        for(int i=1;i<=n;i++){
            s.insert(root(i));
        }
        return s;
    }
};
struct time{
  int c,s,f;
};
void solve(){
  int n,c,s,f;
  cin>>n;
  vector<struct time> v1(n-1);
  rep(i,0,n-1) cin>>v1[i].c>>v1[i].s>>v1[i].f;

  rep(j,0,n-1){
    int last=0;
    rep(i,j,n-1){
      c=v1[i].c,s=v1[i].s,f=v1[i].f;
      last=max(last,s);
      int z=(last-s)/f;
      if(z*f+s<last) z++;
      last=s+z*f+c;
    }
    cout<<last<<endl;
  }
  cout<<0<<endl;
}

int main(){
    optimizeIO();
    int r=1;
    {solve();}
}


Measured memory_bytes: 6984
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

const int N = 1e5 + 10;
char s[N];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  scanf("%s", s);
  int k = 0, ret = 0;
  for (int i = 0; i < n; ++i) {
    if (s[i] == '0') {
      --m;
      while (i < n && s[i] == '0') ++i;
      --i;
    }
    while (m < 0) {
      if (s[k] == '0') {
        ++m;
        while (k < n && s[k] == '0') ++k;
        --k;
      }
      ++k;
    }
    ret = max(ret, i - k + 1);
  }
  printf("%d\n", ret);
  return 0;
}


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

int main(){
    int N;cin>>N;
    ll d[N];
    rep(i,N)cin>>d[i];
    ll ans=0;
    for(int i=0;i<N-1;i++){
        for(int j=i+1;j<N;j++){
            ans+=d[i]*d[j];
        }
    }
    cout<<ans<<endl;
    return 0;
}

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

#define INF ((1<<30)-1)  //int32_t
#define MOD 1000000007
#define MOD2  

#define all(a)  (a).begin(),(a).end()

#define mkp make_pair
#define pb push_back

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;



int main(){
    bool flag=true;
    ll ans=0,sum=0;

    int n,x;
    cin >>n>>x;
    vector<int> a(n);

    for (int i = 0; i < n; i++){
        cin >> a[i];
    }
    sort(all(a));
    
    
    int i=0;
    while (x > 0){
        x -= a[i++];
        ++ans;
        if(i >= n)break;
    }
    
    if(x != 0)--ans;

    //cout <<fixed<<setprecision(16)<< << endl;
    cout << ans << endl;

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
        #include <chrono>
      
        using namespace std;
        using namespace std::chrono; 
     
        typedef long long int ll;
     
        #define MOD (ll)(1e9+7)
        #define endl "\n"
        #define pb push_back
        #define TEST_CASES  ll t;cin>>t;while(t--)
        #define forn(i,a,n) for (int i = a; i < n; ++i)
        #define f first
        #define s second
        #define all(x) x.begin(), x.end()


        
        ll powD(ll x,ll y){
          ll res = 1;
          while(y > 0){
            if(y & 1)
              res = (res*x);
            x = (x*x);
            y = y>>1;
          }
          return res;
        }
        int main()
        {
          ios_base::sync_with_stdio(false);
          cin.tie(NULL);
          int n,k;
          cin>>n>>k;
          vector<int> a(n);
          forn(i,0,n){
            cin>>a[i];
          }
          sort(all(a));
          int sum = 0;
          forn(i,0,k){
            sum += a[i];
          }
          cout<<sum<<endl;

        }

        
      


Measured memory_bytes: 3652
s = input()
na = s.count('a')
nb = s.count('b')
nc = s.count('c')
lst = [na, nb, nc]
lst.sort()

n1,n2,n3 = lst[0], lst[1], lst[2]
if n1+n2 >= (n3-1)*2:
    print('YES')
else:
    print('NO')

Measured memory_bytes: 3188
H , W = map(int,input().split())
ahw = [list(map(int,input().split())) for _ in range(H)]
ans = []
for i in range(H):
    for j in range(W):
        # 奇数のマスであれば
        if ahw[i][j] & 1:
            # まず右をチェック
            if j < W - 1:
                if ahw[i][j+1] & 1:
                    ahw[i][j] -= 1
                    ahw[i][j+1] += 1
                    ans.append([i,j,i,j+1])
        # 奇数のマスであれば
        if ahw[i][j] & 1:
            # まず下をチェック
            if i < H - 1:
                if ahw[i+1][j] & 1:
                    ahw[i][j] -= 1
                    ahw[i+1][j] += 1
                    ans.append([i,j,i+1,j])
        if (ahw[i][j] & 1) and (j < W - 1):
            ahw[i][j] -= 1
            ahw[i][j+1] += 1
            ans.append([i,j,i,j+1])
            
        if (ahw[i][j] & 1) and (i < H - 1):
            ahw[i][j] -= 1
            ahw[i+1][j] += 1
            ans.append([i,j,i+1,j])
print(len(ans))
for a in ans:
    print(a[0]+1,a[1]+1,a[2]+1,a[3]+1)

Measured memory_bytes: 26272
#include <stdio.h>
int main() {
	char str[100000];
	int i,a=0,b=0,c=0;
	int flag=0;
	
	scanf("%s",str);
	for(i=0;flag==0;i++){
		switch(str[i]){
			case 'a':
			a++;
			break;
			case 'b':
			b++;
			break;
			case 'c':
			c++;
			break;
			case '\0':
			flag=1;
			break;
		}
	}
	if(a-b<2&&b-a<2&&b-c<2&&c-b<2&&a-c<2&&c-a<2){
		printf("YES");
	}else{
		printf("NO");
	}
	
return 0;	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
//cout<<"Kush";
    int n;cin>>n;
    int a[n];
    int dp[n];
    for(int i=0;i<n;i++) cin>>a[i];
    dp[0]=0;
    dp[1]=abs(a[0]-a[1]);
    for(int i=2;i<n;i++){
    dp[i]=min(dp[i-1] + abs(a[i]-a[i-1]), dp[i-2]+abs(a[i]-a[i-2]));
    }
    cout<<dp[n-1]<<endl;

    return 0;
}


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

using namespace std;

typedef int itn;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef map<int, int> M;
typedef pair<int, int> P;
typedef stack<int> S;
typedef queue<int> Q;

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

    int k;
    cin >> k;
    cout << (k/2)*(k-k/2) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b, y;
  double x;
  cin>>a>>b;
  y=(a+b)/2;
  x=(a+b)/2.0;
    if(x>y){
      y++;
    }
  cout<<y<<endl;
  
}

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

int main()
{
    int N;
    cin >> N;
    int d[110];
    for (int i = 0; i < N; ++i){
        cin >> d[i];
    }
    sort(d, d + N, greater<int>());
    int ans = 1;
    int cur = d[0];
    for (int i = 1; i < N; ++i){
        if (cur > d[i]) {
            ans += 1;
            cur = d[i];
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
    int n,tmp=0,iro=0;
    cin >> n;
    vector<int> a(n);
    vector<bool> rate(8,false);
    for(int i=0;i<n;i++){
        cin >> a.at(i);
        for(int j=0;j<8;j++){
            if(400*j<=a.at(i)&&400*(j+1)>a.at(i))rate.at(j)=true;
        }
        if(a.at(i)>=3200){
            tmp++;
        }
    }
    for(int i=0;i<8;i++){
        if(rate.at(i))iro++;
    }
    cout << iro+!iro << " " << iro+tmp << endl;
    return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#include <math.h>
#include <float.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = 0; i <= (n); i++)
using namespace std;
typedef long long ll;
 
const ll INF = 1LL<<62;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// 多次元 vector 生成
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
const int MOD = 1000000007;

int main(){
    int H, W; cin >> H >> W;
    int N; cin >> N;

    int max_v = max(H,W);

    cout << (N+(max_v-1))/max_v << endl;

}

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

struct Node{
  int key;
  struct Node *right;
  struct Node *left;
  struct Node *parent;
};

struct Node *root;
struct Node *NIL;


struct Node *find(struct Node *u, int k){
  while (u != NIL && k != u->key){
    if(k < u->key) u = u->left;
    else u = u->right;
  }
  return u;
}

void insert(int k){

  struct Node *y = NIL;
  struct Node *x = root;
  struct Node *z;

  z = (struct Node *)malloc(sizeof(struct Node));

  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x != NIL){
    y = x;
    if(z->key < x-> key) x = x->left;
    else x = x->right;
  }
  z->parent = y;
  if(y == NIL) root = z;
  else{
    if(z->key < y->key) y->left = z;
    else y -> right = z;
  }
}

void inorder(struct Node *u){
  if(u == NIL) return;
  inorder(u->left);
  printf(" %d", u->key);
 
  inorder(u->right);
}

void preorder(struct Node *u){
  if(u == NIL) return;
  printf(" %d", u->key);
  preorder(u->left);
  preorder(u->right);
}

int main(){

  int n;
  int i,j;
  int x;
  
int count=0;
int cnt[10];
int tmp=0;

  struct Node *t;
  char *com;
  char *comin = "insert";
  char *compr = "print";

  com = (char*)malloc(7*sizeof(char));  

  scanf("%d", &n);

  for(i=0; i<n; i++){
    scanf("%s", com);
    if(com[0] == 'f'){
      scanf("%d", &x);
      t = find(root, x);
      if(t != NIL){
	printf("yes\n");
      }
      else{
	printf("no\n");
      }
    }
      else if(strncmp(com,comin,6)==0){
	scanf("%d",&x);
	insert(x);
      }
      else if(strncmp(com,compr,5)==0){

	inorder(root);
	printf("\n");
	preorder(root);
	printf("\n");
      }
    }

    return 0;
  }



Measured memory_bytes: 20484
#include <stdio.h>

int main(int argc, const char * argv[]) {
    
    
    char array[33]={'\0'};
    char qwerty[3][10]={{'q','w','e','r','t','y','u','i','o','p'},{'a','s','d','f','g','h','j','k','l'},{'z','x','c','v','b','n','m'}};
    int i,j,k;
    while (1) {
        int count=0;
        scanf("%s",array);
        if (array[0]=='#') {
            break;
        }
        for (i = 1; array[i] != '\0'; i++) {
            int flag = 0,flag_1=0,jkp=0,jkpi=0;
            for (j = 0; j < 3; j++) {
                for (k = 0 ; k < 10; k++) {
                    if (array[i] == qwerty[j][k]) {
                        flag=1;
                        jkp=k;
                        
                    }
                    if (array[i-1] == qwerty[j][k]) {
                        flag_1=1;
                        jkpi=k;
                    }
                    
                    if (flag_1==1&&flag==1) {
                        break;
                    }
                    
                }
                if (flag == 1&&flag_1==1) {
                    break;
                }
            }
            
            if (jkp > 4) {//l
                jkp=0;
            } else if(jkp <=5) {//r
                jkp=1;
            }
            
            if (jkpi > 4) {//l
                jkpi=0;
            } else if(jkpi <=5) {//r
                jkpi=1;
            }
            
            
            if (jkp != jkpi) {
                count++;
            }
            
        }
        
        printf("%d\n",count);
        
    }
    return 0;
}

Measured memory_bytes: 540
$debug = false
flag = ARGV.shift
if flag == "-d"
  $debug = true
end

def dputs str
  p str if $debug
end

def max(n, m)
  if n > m
    return n
  else
    return m
  end
end

def min(n, m)
  if n < m
    return n
  else
    return m
  end
end

def gets_all_int
  return gets.chomp.split.map{|v| v.to_i}
end

## start
N = gets.to_i
P = gets_all_int
Q = gets_all_int

a = 0
b = 0
P.sort.permutation.to_a.each_with_index do |elm, i|
  if elm == P
    a = i
    break
  end
end

Q.sort.permutation.to_a.each_with_index do |elm, i|
  if elm == Q
    b = i
    break
  end
end

puts (a - b).abs

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

int main()
{
 int N;int nowmax=0;
  cin>>N;
  vector<int> data(N+1);
  data.at(N)=1000000001;
  for(int i=0;i<N;i++)
  {
   cin>>data.at(i);
  }
  
  for(int i=0;i<N;i++)//落下地点
  {
    int  Now=i;
    int count=0;
    while(data.at(Now)>=data.at(Now+1))
    {
      Now++;
      count++;
    }
    if(count>nowmax)
    {
     nowmax=count;
    }
    if(nowmax>=N-i)
      break;
  }
  cout<<nowmax<<endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <cstring>
#include <vector>
using namespace std;
int N;
char S[100005];
int Next[100005], P[100005], DP[100005];
const int MOD = 1000000007;
vector <int> V[3];
int ind[3];
void Read()
{
    cin.getline(S + 1, 100005);
    N = strlen(S + 1);
    //V[P[0]].push_back(0);
    for(int i = 1; i <= N; i++)
    {
        P[i] = P[i - 1] + S[i] - 'a' + 1;
        while(P[i] >= 3)
            P[i] -= 3;
        V[P[i]].push_back(i);
    }
}
inline void Add(int& x, int y)
{
    x += y;
    if(x >= MOD)
        x -= MOD;
}
void Solve()
{
    int next = 1;
    DP[1] = 1;
    int ans = 0;
    for(int i = 1; i <= N; i++)
    {
        if(next <= i)
        {
            while(next <= N && (S[next] != S[next - 1] || next <= i))
            {
                ind[P[next]]++;
                ++next;
            }
        }
        Add(DP[i + 1], DP[i]);
        for(int j = 0; j < 3; j++)
        {
            if(P[i - 1] == j || ((j - P[i - 1] + 3) % 3) == S[i] - 'a' + 1)
                continue;
            if(ind[j] == V[j].size())
                continue;
            Add(DP[V[j][ind[j]] + 1], DP[i]);
        }
        if(P[N] == P[i - 1] && i > 1)
            Add(ans, DP[i]);
    }
    Add(ans, DP[N + 1]);
    /*for(int i = N - 1; i > 1; i--)
    {
        if(S[i] == S[i + 1])
            break;
        if(P[N] == P[i - 1] && S[i - 1] != S[i])
            Add(ans, MOD - 1);
    }*/
    cout << ans << '\n';
}
int main()
{
    Read();
    bool ok = 0;
    for(int i = 2; i <= N; i++)
        if(S[i] == S[i - 1])
        {
            ok = 1;
            break;
        }
    if(ok == 0)
    {
        cout << "1\n";
        return 0;
    }
    Solve();
    return 0;
}


Measured memory_bytes: 1784
#include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstring>
#include <chrono>
#include <complex>
#define endl "\n"
#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 mod 1000000007
#define inf 1000000000000000001;
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define f first
#define s second
const ll INF = 1e18L+5;
using namespace std;
int main()
{
	std::ios::sync_with_stdio(false);
	cin.tie(0);  cout.tie(0);
  int n,w;
  cin>>n>>w;
  vector<int> weight(n),value(n);
  for(int i=0;i<n;i++)
    cin>>weight[i]>>value[i];
  int sum_value=0;
  for(int x : value)
    sum_value+=x;
  vector<ll> dp(sum_value+1,INF);
  dp[0]=0;
  for(int item=0;item<n;item++)
  {
    for(int value_already=sum_value-value[item];value_already>=0;--value_already)
    {
      dp[value_already+value[item]]=min(dp[value_already+value[item]],dp[value_already]+weight[item]);
    }
  }
  ll res=0;
  for(int i=0;i<=sum_value;i++)
  {
    if(dp[i]<=w)
      res=max(res,(ll)i);
  }
  cout<<res<<endl;
	return 0;
}


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

int main()
{
  int n;
  cin >> n;
  
  int ans = 0;
  int count = 0;
  for(int i = 1; i <= n; i++){
    if(i % 2 == 1){
      for(int j = 1; j <= i; j++){
        if(i % j == 0){
          count++;
        }//if
      }//for
      if(count == 8){
        ans++;
      }//if
    }//if
    count = 0;
  }//for
  
  cout << ans << endl;
}

Measured memory_bytes: 3584
#include <iostream>

#define ll long long

using namespace std;

ll int frog (ll int n, ll int *arr) {
	ll int c[n] , x1, x2;

	c[0] = 0;
	c[1] = abs ( arr[0] - arr[1] );

	for ( ll int i=2; i<n; i++ ) {
		x1 = c[i-1] + abs ( arr[i] - arr[i-1] );
		x2 = c[i-2] + abs ( arr[i] - arr[i-2] );

		if ( x1 < x2 )
			c[i] = x1;
		else
			c[i] = x2;
	}
	
	return c[n-1];
}


int main() {
	ll int n, *arr;

	cin >> n;
	arr = new ll int[n];
	
	for ( ll int i=0; i<n; i++ )
		cin >> arr[i];

	cout << frog(n, arr) << endl;

	return 0;
}


Measured memory_bytes: 1792
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
void solve();
main { solve(); return 0; }
// clang-format on

void solve() {
  int n;
  while (cin >> n, n) {
    vpii v;
    rep(i, n) {
      int id, m1, s1, m2, s2, m3, s3, m4, s4;
      cin >> id >> m1 >> s1 >> m2 >> s2 >> m3 >> s3 >> m4 >> s4;
      v.pb(mp((m1 + m2 + m3 + m4) * 60 + (s1 + s2 + s3 + s4), id));
    }
    sort(all(v));
    cout << v[0].se << '\n'
         << v[1].se << '\n'
         << v[v.size() - 2].se << endl;
  }
}

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

using namespace std;

int main(){
	int n;
	cin >> n;
	vector<int> a(1 << n);
	for(int i = 0; i < (1 << n); ++ i) cin >> a[i];
	vector<pair<int, int> > f(1 << n);
	for(int i = 0; i < (1 << n); ++ i){
		f[i] = {i, - 1};
		for(int k = 0; k < n; ++ k){
			if(i & (1 << k)){
				vector<int> val(4);
				tie(val[0], val[1]) = f[i];
				tie(val[2], val[3]) = f[i ^ (1 << k)];
				val.erase(remove(val.begin(), val.end(), -1), val.end());
				sort(val.begin(), val.end(), [&](int x,int y){
					return a[x] > a[y];
				});
				val.erase(unique(val.begin(), val.end()), val.end());
				f[i] = {val[0], val[1]};
			}
		}
	}
	int ans = 0;
	for(int i = 1; i < (1 << n); ++ i){
		ans = max(ans, a[f[i].first] + a[f[i].second]);
		cout << ans << '\n';
	}
}


Measured memory_bytes: 6144
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int MOD = 1000000007LL;
const int INF = LLONG_MAX;

signed main(){
    
    int n, x; cin >> n >> x;
    vector<int> s(n);
    for(int i = 0; i < n; i++) cin >> s[i];
    sort(s.rbegin(), s.rend());

    //dp[i][x]=降順ソートした数列 i番目まで見て、その時点での黒板に書かれた値が x であるような場合の数
    vector<vector<int> > dp(n + 1, vector<int> (x + 1, 0));
    dp[0][x] = 1;
    for(int i = 0; i < n; i++){
        for(int j = 0; j <= x; j++){
            if(dp[i][j] == 0) continue;
            // 採用する
            dp[i + 1][j % s[i]] += dp[i][j];
            dp[i + 1][j % s[i]] %= MOD;
            // 採用しない
            dp[i + 1][j] += dp[i][j] * (n - (i + 1));
            dp[i + 1][j] %= MOD;
        }
    }

    int ans = 0;
    for(int j = 1; j <= x; j++){
        ans += dp[n][j] * j;
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 158592
#include <iostream>

using namespace std;

int main()
{
  int num;
  cin >> num;
  if (num % 10 == 3)
  {
    cout << "bon"<<endl;
    return 0;
  }
  else if (num % 10 == 0 || num % 10 == 1 || num % 10 ==  6|| num % 10 == 8 )
  {
    cout << "pon"<<endl;
    return 0;
  }
  else if (num % 10 == 2 || num % 10 == 4 || num % 10 ==  5|| num % 10 == 7|| num % 10 == 9 )
  {
    cout << "hon"<<endl;
    return 0;
  }
}


Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long int
#define int long long
#define f(i,l,n) for(int i=l;i<n;i++) 
#define E "\n"

int solve()
{
	return 0;	
}


int32_t main()
{

    
    string s;
    cin >> s;

    int cnt=0,ans=0;

    f(i,0,3) 
    {
    	if(s[i]=='R') cnt++;
    	else cnt=0;
    	ans=max(cnt,ans);
   	}

   	cout<<ans<<E;
     return 0;
    
}

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

using namespace std;

typedef long long ll;

int main() {
    ll n, k, ans = 0;    cin >> n >> k;
    vector<ll> num(k, 0);

    for (int i = 1; i <= n; i++)
        num[i%k]++;

    for (ll a = 0; a < k; a++) {
        if ((k-a)%k*2%k == 0)
            ans += num[a] * num[(k-a)%k] * num[(k-a)%k];
        }

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

Measured memory_bytes: 4716
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef long double ld;
const double pi=acos(-1.0);
const ll mod=pow(10,9)+7;
const ll INF=pow(2,31)-1;
using str=string;
typedef pair<int,int> P;
typedef vector<int> vi;

ll gcd(ll a,ll b){
    ll v0=a,v1=b,v2=a%b;
    while(v2!=0){
        v0=v1;
        v1=v2;
        v2=v0%v1;
    }
    return v1;
}

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

ll count(ll n){
    if(n==1){
        return 1;
    }
    else{
        return 1+2*count(floor(n/2));
    }
}

int main(){
    ll h;
    cin >>h;
    cout << count(h) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define pii pair<int,int>
#define vi vector<int>
#define vpii vector<pii>
#define pll pair<ll,ll>
#define vll vector<long long>
#define f first
#define s second
long long mod = 1e9+7;
typedef vector<map<char,int>> vmci;

// int diry[] = {-1,-1,-1,0,0,1,1,1};
// int dirx[] = {-1,0,1,-1,1,-1,0,1};

ll pow(ll x, ll y, ll p) {
    ll res = 1;
    x %= p;
    if(x == 0) {
        return 0;
    }
    while(y > 0) {
        if(y & 1) {
            res = (res * x) % p;
        }
        y >>= 1;
        x = (x * x) % p;
    }
    return res;
}

// ll factorial(ll n) 
// { 
//     int res = 1, i; 
//     for (i = 2; i <= n; i++) 
//         res *= i; 
//     return res; 
// }

void seg_sieve(ll max,ll arr[]){
    ll i,j;
    for(i=2;i*i<=max;i++){
        if(arr[i]==0){
            for(j=i*i;j<=max;j+=i)
                arr[j]=1;
        }
    }
}


vector<ll> getdivs(ll n){
    vector<ll> a;
    for(int i=1;i<=sqrt(n);i++){
        if(n%i==0){
            if(n/i==i){
                a.push_back(i);
            }
            else{
                a.push_back(i);
                a.push_back(n/i);
            }            
        }
    }
    return a;
}

int lte(vector<ll> array, int start_idx, int end_idx, ll search_val) {

   if( start_idx == end_idx )
      return array[start_idx] <= search_val ? start_idx : -1;

   int mid_idx = start_idx + (end_idx - start_idx) / 2;

   if( search_val < array[mid_idx] )
      return lte( array, start_idx, mid_idx, search_val );

   int ret = lte( array, mid_idx+1, end_idx, search_val );
   return ret == -1 ? mid_idx : ret;
}

bool noob(const pii &a,const pii &b){
    if(a.second == 0 ) return true;
    return a.first*1.0/a.second > b.first*1.0/b.second;
}

unordered_map<bitset<1000>,int> dp;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t=1;
    int tcase=0;
    // cin>>t;        
    while(t--){           
        ll d,t,s;
        cin>>d>>t>>s;
        if(t*s>=d) cout<<"Yes";
        else cout<<"No";
    }
    
}

Measured memory_bytes: 3644
#include<stdio.h>
int next[300000];
int first[300000];
int go[300000];
int h[300000];
	int n,m,i,ans=0,x,y;
int check(int k){
	int t=first[k];
	int flag=1;
	while (t!=0){
		if (h[go[t]]>=h[k])
		  flag=0;
		t=next[t];
	}
   if (flag==1) return 1;else return 0;
}
int main(){

	scanf("%d %d",&n,&m);
	for (i=1;i<=n;i++)
	  scanf("%d",&h[i]);
	for (i=1;i<=m;i++)
	{scanf("%d %d",&x,&y);
	 next[i]=first[x];
	 first[x]=i;
	 go[i]=y;
	 next[i+m]=first[y];
	 first[y]=i+m;
	 go[i+m]=x;
	}
	for (i=1;i<=n;i++)
	  if (check(i)==1)
	    ans++;
	printf("%d",ans);
} 

Measured memory_bytes: 4096
#include <iostream>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <math.h>
using namespace std;

int main() {
	
	int m,n,gf,g,y,sc,c,in,max;
	double r;
	cin>>m;
	
	for(int i=0;i<m;i++){
		max=0;
		cin>>gf>>y>>n;
		
		for(int j=0;j<n;j++){
			in=0;
			cin>>sc>>r>>c;
			if(sc==0){
				g=gf;
				for(int k=0;k<y;k++){
					in+=g*r;
					g-=c;
				}
				g+=in;
			}
			else {
				g=gf;
				for(int k=0;k<y;k++){
					g=g*(1+r)-c;
				}
			}
			if(g>max)max=g;
		}
		cout<<max<<endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define IO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
int n,m;
set<string> s;
int main()
{
    cin>>n;
    for(int i=0;i<n;++i)
    {
        string x;
        cin>>x;
        s.insert(x);
    }
    cout<<s.size()<<endl;
    return 0;
}


Measured memory_bytes: 19228
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
const int INF = 1e9+7;

// dp[i]: 価値 i を生成できる最小の重さ
// dp[0] = 0
// dp[i] = min(dp[i], dp[i-v[i]] + w[i])

int w[110], v[110];

int main() {
    int N, W;
    cin >> N >> W;

    for(int i = 0; i < N; ++i) {
        scanf("%d%d", w + i, v + i);
    }

    vector<int> dp(101010, INF);
    dp[0] = 0;

    for(int i = 0; i < N; ++i) {
        for(int j = 100000; j >= 0; --j) {
            dp[j] = min(dp[j], ((j-v[i] < 0) ? 0 : dp[j-v[i]]) + w[i]);
        }
    }

    int cnt = 100000;
    while(dp[cnt] > W) cnt--;

    cout << cnt << endl;
}


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

int main() {
	string s;cin>>s;
  	int count=0,temp=0,ans=10000;
	for(int i=0;i<26;i++){
      for(int j=0;j<s.size();j++){
    	if(s[j]==('a'+i)){
        	count=max(count,temp);
          	temp=0;
        }else{
        	temp++;
        }
      }
      count=max(count,temp); temp=0;
      ans=min(ans,count); count=0;
    }
  cout<<ans<<endl;
}
  

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
w = input()
o = []
for i in range(len(w)):
    o.append(ord(w[i]))

c = [0] * 26
for i in range(len(w)):
    c[o[i] - 97] += 1

i = 0
while i < 26:
    if c[i] % 2 == 0:
        i += 1
    else:
        print('No')
        break
if i == 26:
    print('Yes')

Measured memory_bytes: 3064
n=int(input())
d=dict()
for i in range(n):
    a,b=input().split()
    if a in d:d[a]+=int(b)
    else:d[a]=int(b)
s=list(d.items())
s.sort(key=lambda y: y[0])
s.sort(key=lambda y: len(y[0]))
for i in s:print(i[0],i[1])


Measured memory_bytes: 5620
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;

int main(){
	int X,Y;
	
    scanf("%x %x",&X,&Y);
	if(X>Y){
		printf(">\n");}
	else if(X==Y){
		printf("=\n");}
	else if(X<Y){
		printf("<\n");}



    
		return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h> 
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define size_of_array(array) (sizeof(array)/sizeof(array[0]))
#define MAX 100005
using ll =long long;
using namespace std;
using Graph=vector<vector<int>>;


int main(){
    int d,g;
    cin>>d>>g;
    vector<ll> p(d),c(d);
    rep(i,d){
        cin>>p[i]>>c[i];
    }
    ll score[1024]={};
    ll cnt[1024]={};
    ll min_cnt=LLONG_MAX;
    rep(i,pow(2,d)){
        int k=-1;
        rep(j,d){
            if(i>>j&1){
                score[i]+=(c[j]+p[j]*(j+1)*100);
                cnt[i]+=p[j];
            }else{
                k=j;
            }
        }
        rep(l,p[k]){
            if(score[i]>=g||k==-1){
                break;
            }
            score[i]+=((k+1)*100);
            cnt[i]++;
        }
        if(score[i]>=g){
            min_cnt=min(cnt[i],min_cnt);
        }
    }
    cout<<min_cnt<<endl;
    return 0;
}

Measured memory_bytes: 256
n,m=map(int,input().split())
cnt=[]
for i in range(n):
  cnt.append(0)
for i in range(m):
  a,b=map(int,input().split())
  cnt[a-1]+=1
  cnt[b-1]+=1
for i in range(n):
  if cnt[i]%2==1:
    print('NO')
    exit()
print('YES')

Measured memory_bytes: 3888
#include <stdio.h>

int main(void)
{
    int N, n;
    int i, j;
    
    scanf("%d", &N);
    i = 1;
    while (1){
        n = 0;
        for (j = 1; j <= i; j++){
            if (i % j == 0){
                n++;
            }
        }
        if (n == N){
            break;
        }
        i++;
    }
    
    printf("%d\n", i);
    
    return (0);
}



Measured memory_bytes: 2140
def main():
    x, n = map(int, input().split())
    if n == 0:
        print(x)
        return
    p = [int(i) for i in input().split()]
    for d in range(110):
        if x - d not in p:
            print(x - d)
            break
        if x + d not in p:
            print(x + d)
            break


if __name__ == '__main__':
    main()

Measured memory_bytes: 9184