akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include <algorithm>
#include <numeric>
using namespace std;

int gcd(int n1, int n2){
	
    int m1,m2;
    
	if(n1 >= n2){
    
    	m1 = n1;
        m2 = n2;
    
    }else{
    
    	m1 = n2;
        m2 = n1;
    
    }
	int r;
	
  	while(( r = m1 % m2) != 0){
    
    	m1 = m2;
      	m2 = r;
      
    }

  	return m2;
  	
}



int N,X;
int main(){

  	cin >> N;
  	
  	int X[N+1];
  	 
    cin >> X[0];
    
  	for(int i = 1 ; i < N+1; i++ ) cin >> X[i];
  	
  	sort(X, X + N+1, greater<int>());
  	
    
  	
    int diff[N];
  	
  	for(int i = 0 ; i < N ; i++ ){
    
      	diff[i] = X[i] - X[i+1];

    }
  
  	if(N != 1){
		sort(diff, diff + N - 1, greater<int>());
  		
  		int g = gcd(diff[0],diff[1]);
  		
  		for(int j = 0 ; j < N ; j ++){
    
    		g = gcd(g,diff[j]);
    
    	}
      	cout << g << endl;
    
    }else{
    
    	cout << diff[0] << endl;
      
    }
  	
  	
}



Measured memory_bytes: 1024
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <memory.h>
#include <vector>

using namespace std;
typedef long long LL;
const int maxn = 500005;

int D,n,d[maxn],x[maxn],Q;LL dp[maxn];
int xabs(int x) {return x>0?x:-x;}
bool check(LL x,LL w,LL o) {return min(x,x>w?x-w:w-x)==o;}
int main()
{
	#ifdef Amberframe
		freopen("arc072e.in","r",stdin);
		freopen("arc072e.out","w",stdout);
	#endif
	scanf("%d %d",&n,&D);x[0]=D;dp[n+1]=1;
	for (int i=1;i<=n;i++) scanf("%d",&d[i]);
	for (int i=1;i<=n;i++) x[i]=min(x[i-1],xabs(x[i-1]-d[i]));
	for (int i=n;i>=1;i--) {
		LL o=dp[i+1],w=d[i];dp[i]=1ll<<60;
		if (check(w+o,w,o)) dp[i]=min(dp[i],w+o);
		if (check(o,w,o)) dp[i]=min(dp[i],o);
		if (check(w-o,w,o)) dp[i]=min(dp[i],w-o);
	}
	scanf("%d",&Q);
	for (int j,i=1;i<=Q;i++) {
		scanf("%d",&j);
		printf("%s\n",x[j-1]>=dp[j+1]?"YES":"NO");
	}
	return 0;
}

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

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  int a_max = 0;
  int one = 0;
  rep(i,n){
    cin >> a[i];
    if(a[i]>a_max) a_max = a[i];
    if(a[i]==1) one++;
  }

  if(one==1){
    cout << 1 << endl;
    return 0;
  }

  if(one>1){
    cout << 0 << endl;
    return 0;
  }

  vector<int> dp(a_max+1,0);
  for(int x : a){
    dp[x]++;
    for(int i = 2 * x; i <= a_max; i += x) dp[i]++; 
  }

  int ans = 0;
  for(int x : a){
    if(dp[x]==1) ans++;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 7944
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#define PI 3.141592653589793
#define MOD 1000000007

int main(){
	int n;
	scanf("%d", &n);
	char str[10010];
	scanf("%s", str);
	char alp[] = {"ABCDEFGHIJKLMNOPQRSTUVWXYZ"};
	int len = strlen(str);
	int poi;
	for(int i=0; i<len; i++){
		int j=0;
		for(j=0; j<26; j++){
			if(str[i] == alp[j]){
				//printf("%c\n", str[i]);
				break;
			}
		}
		poi = (j+n)%26;
		//printf("%d\n", poi);
		str[i] = alp[poi];
	}
	
	printf("%s\n", str);

	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
 
typedef unsigned long long ull;
 
#define MOD 1000000007
 
ull powmod(ull m, ull n)
{
    if (n == 0) return 1;
    return powmod(m * m % MOD, n / 2) * (n % 2 ? m : 1) % MOD;
}
 
int main(void)
{
    ull m, n;
 
    scanf("%llu %llu", &m, &n);
    printf("%llu\n", powmod(m, n));
 
    return 0;
}


Measured memory_bytes: 2140
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>
#include <cassert>


using namespace std;
#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<n;++i)
#define FOR(i, a, b) for(int i=a;i<b;++i)
#define RREP(i, n) for(int i=n-1;i>=0;--i)
#define RFOR(i, a, b) for(int i=b-1;i>=a;--i)

#define all(x) begin(x),end(x)
#define dump(x) cerr<<#x<<" = "<<(x)<<endl
#define debug(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<< endl;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;
const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;

template<class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}


template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> p) {
    os << p.first << ":" << p.second;
    return os;
}

template<class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    os << "[";
    REP(i, SZ(v)) {
        if (i) os << ", ";
        os << v[i];
    }
    return os << "]";
}

template<class T1, class T2>
ostream &operator<<(ostream &os, const map<T1, T2> &mp) {
    os << "[";
    for (auto it = mp.begin(); it != mp.end(); ++it) {
        if (it != mp.begin()) {
            os << ", ";
        }
        os << *it;
    }
    return os << "]";
}

// edit

void solve() {
    string s;
    cin >> s;
    
    if(s == "RRR"){
        cout << 3 << endl;
    }else if(s == "SSS"){
        cout << 0 << endl;
    }else if(s == "RRS" || s == "SRR"){
        cout << 2 << endl;
    }else{
        cout << 1 << endl;
    }
    

}


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
//    std::ifstream in("input.txt");
//    std::cin.rdbuf(in.rdbuf());

    solve();


    return 0;
}


Measured memory_bytes: 3228
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
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 (b<a) {a=b; return 1;} return 0;}

const int mod = 1000000007;
struct mint {
    long long x;
    mint(long long x=0) : x((x % mod + mod) % mod) {}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
    mint operator+(const mint a) const { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(long long t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    mint inv() const { return pow(mod-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    string s;
    cin >> s;
    int n = sz(s);
    vector<vector<mint>> dp(n+1, vector<mint>(2));
    dp[0][0] = 1;
    rep(i, n) {
        if (s[i] == '0') {
            // 0にする
            dp[i+1][0] += dp[i][0];
            dp[i+1][1] += dp[i][1];
            // 1にする
            dp[i+1][1] += dp[i][1] * 2;
        } else {
            // 0にしたとき
            dp[i+1][1] += dp[i][0] + dp[i][1];
            // 1にしたとき
            dp[i+1][0] += dp[i][0] * 2;
            dp[i+1][1] += dp[i][1] * 2;
        }
    }
    mint ans = dp[n][0] + dp[n][1];
    cout << ans << endl;
}

Measured memory_bytes: 5840
#include <bits/stdc++.h>
using namespace std;
int main()
{
  ios::sync_with_stdio(0);cin.tie(0);ios_base::sync_with_stdio(0);
  int n,k;
  cin>>n>>k;
  int dp[k+1]={},arr[n];
  for(int i=0;i<n;i++)
    cin>>arr[i];
  for(int stones=1;stones<=k;stones++)
  {
      for(int i=0;i<n;i++)
      {
          if(stones>=arr[i]&&!dp[stones-arr[i]])
            dp[stones]=1;
      }
  }
  if(dp[k]==1) cout<<"First";
  else  cout<<"Second";
  return 0;
  }


Measured memory_bytes: 640
#include <bits/stdc++.h>
 
using namespace std;
 
#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { cout << #a << " = " << a << endl; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
 
typedef long long ll;
int const inf = 1<<29;
int main() {
 
  int K, T; cin >> K >> T;
  vector<pair<int, int>> vs;
  rep(i, T) {
    int x; cin >> x;
    vs.push_back({x, i});
  }

  int last = -1;
  int N = vs.size();
  while(vs.size() > 1) { // T-1要素すべて消すまで回す。O(K)
    sort(all(vs));
 
    for(int i=N-1; i>=N-2; i--) {
      if(last != vs[i].second) {
        if(vs[i].first > 0) {
          last = vs[i].second;
          vs[i].first --; // 1個ずつ食べる
          if(vs[i].first == 0) {
            vs.erase(vs.begin() + i); // T-1回しか実行されない
            N = vs.size();
          }
          break;
        }
      }
    }
  }
 
  cout << vs[0].first - 1 << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>

#define MAX_H 8

using namespace std;

string A[MAX_H];

int main() {
  int H, W;
  cin >> H >> W;
  for (int i = 0; i < H; ++i) {
    cin >> A[i];
  }
  for (int i = 0; i < H - 1; ++i) {
    for (int j = 0; j < W - 1; ++j) {
      if (A[i + 1][j] == '#' && A[i][j + 1] == '#') {
        printf("Impossible\n");
        return 0;
      }
    }
  }
  printf("Possible\n");
}

Measured memory_bytes: 3108
#include <cstdio>

int main()
{
    int a,b,c;
    scanf("%d %d %d", &a, &b, &c);
    if (a + b == c)
    {
        printf("Yes");
    }
    
    else if (a + c == b)
    {
        printf("Yes");
    }
    
    else if (b + c == a)
    {
        printf("Yes");
    }
    
    else
    {
        printf("No");
    }
}

Measured memory_bytes: 1704
#define ENABLE_DEBUG 1
// Kana's kitchen {{{
#include<bits/stdc++.h>
#define ALL(v) std::begin(v),std::end(v)
#define LOOP(k) for(i64 ngtkana_is_a_genius=0; ngtkana_is_a_genius<(i64)k; ngtkana_is_a_genius++)

using i32 = std::int_least32_t;
using i64 = std::int_least64_t;
using u32 = std::uint_least32_t;
using u64 = std::uint_least64_t;
using usize = std::size_t;

template <class T> using vec = std::vector<T>;
template <class T> using numr = std::numeric_limits<T>;

#ifdef NGTKANA
#include<debug.hpp>
#else
#define DEBUG(...)(void)0
#endif
/*}}}*/
auto cmx=[](auto&x,auto y){if(x<y){x=y;return true;}return false;};
int main(){
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    std::cout << std::setprecision(15) << std::fixed;

    usize n, m;
    std::cin >> n >> m;
    vec<vec<usize>> g(n);
    while (m--) {
        usize u, v;
        std::cin >> u >> v;
        u--, v--;
        g.at(u).push_back(v);
        g.at(v).push_back(u);
    }

    usize q;
    std::cin >> q;
    vec<usize> time_to_color(q);
    vec<vec<std::pair<usize, usize>>> queries(11);
    for (usize time=0; time<q; time++) {
        usize u, d, c;
        std::cin >> u >> d >> c;
        u--;
        queries.at(d).emplace_back(time, u);
        time_to_color.at(time) = c;
    }

    vec<usize> ans(n);
    for (usize ph=10; ph!=-1; ph--) {
        vec<usize> swp = ans;
        for (usize i=0; i<n; i++) {
            for (usize j: g.at(i)) {
                cmx(swp.at(j), ans.at(i));
            }
        }

        for (auto&& p: queries.at(ph)) {
            usize time, u;
            std::tie(time, u) = p;
            cmx(swp.at(u), time + 1);
        }
        swp.swap(ans);
    }

    for (usize t: ans) {
        std::cout << (t==0 ? 0 : time_to_color.at(t-1)) << '\n';
    }
}


Measured memory_bytes: 11732
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String ans = null;
		if(s.charAt(s.length() - 1) == 's') {
			ans = s + "es";
		}else {
			ans = s + "s";
		}
		
		System.out.println(ans);
		
		sc.close();
	}
}


Measured memory_bytes: 38720
fun main(args: Array<String>) {
    val N = nextInt()
    val A = listOfInt(-1)
    val B = IntArray(N)
    repeat(N) { B[A[it]] = it + 1 }
    println(B.joinToString(separator = " "))
}
fun next() = readLine()!!
fun nextInt(delta: Int = 0) = Integer.parseInt(next()) + delta
fun listOfString() = next().split(" ")
fun listOfInt(delta: Int = 0) = listOfString().map { Integer.parseInt(it) + delta }

Measured memory_bytes: 56228
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 100001
vector<int> v[N];
int income[N]={0}, mark[N]={0};
int dp[N]={0};


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
   
    int n,m;
    cin>>n>>m;


    for(int i=0;i<m;i++)
    {
    	int x,y;
    	cin>>x>>y;
    	v[x].push_back(y);
    	income[y]++;
    }
    queue<int> q;
    for(int i=1;i<=n;i++)
    {
    	if(mark[i]==0 && income[i]==0)
    	{
    		dp[i]=max(1,dp[i]);
    		q.push(i);
    		mark[i]=1;
    		while(q.empty()==0)
    		{
    			int x=q.front();
    			q.pop();
    			for(auto f:v[x])
    			{
    				mark[f]=1;
    				income[f]--;
    				dp[f]=max(dp[x]+1,dp[f]);
    				if(income[f]==0)
    				{
    					q.push(f);
    				}
    			}
    		}
    	}
    }
    int ans=0;

    for(int i=1;i<n+1;i++)
    	ans=max(ans,dp[i]);

    cout<<ans-1;
}

Measured memory_bytes: 6912
//统计字符串s最多可以划分成多少个不同的子串
/*******
aaa可以划分成2个子串a和aa 
*********/ 
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main()
{
	string s;
	while(cin >> s){
		vector<string> vs;
		string old,now;
		int cnt = 0;		//统计不同子串的个数 
		for(int i = 0;i < s.length();i++){
			now += s[i];
			//判断新串与上一个串是否相同
			if(now != old){  //不同，更新上一个串，新串清空
				old = now; 	//更新上一个串
				now.clear();	//新串清空 
				cnt++;			//子串个数加1 
			}
		}
		cout << cnt << endl; 
	}
	return 0;	
} 


Measured memory_bytes: 640
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vii vector<int>
#define vll vector<ll>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define rep(i, n) for (ll i = 0; i < n; i++)
#define rep2(i, a, b) for (ll i = a; i < b; i++)
#define repr(i, n) for (ll i = n - 1; i >= 0; i--)
#define all(x) x.begin(), x.end()
// #define int ll
using namespace std;
const int INF(1 << 30);
const ll LLINF(1LL << 55LL);
const int MOD = 1000000007;
const int MAX = 510000;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll n, st = -1;
    ll s[210][210], ans[310], max = -1;
    rep(i, 210) ans[i] = -1;
    map<ll, ll> mp;
    queue<ll> que;
    cin >> n;
    vector<ll> a, c;
    vector<ll> G[300];
    rep(i, n)
    {
        string S;
        cin >> S;
        rep(j, n)
        {
            if (S[j] == '1') {
                s[i][j] = 1;
                G[i + 1].push_back(j + 1);
            } else
                s[i][j] = 0;
        }
    }
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            if (G[j].size() == i) {
                st = j;
                break;
            }
        }
        if (st != -1)
            break;
    }
    for (int j = 1; j <= n; j++) {
        if (G[j].size() == 1) {
            a.push_back(j);
        }
    }
    if (true) {
        for (int i = 1; i <= n; i++) {

            bool flag = true;
            rep(j, 210) ans[j] = -1;
            que.push(i);
            ans[i] = 1;
            ll max1 = -1;
            while (!que.empty()) {
                int i = que.front();
                que.pop();
                for (int j : G[i]) {
                    if (ans[j] != -1) {
                    } else {
                        ans[j] = ans[i] + 1;
                        max1 = std::max(max1, ans[j]);
                        que.push(j);
                    }
                }
            }
            for (int i = 1; i < n + 1; i++) {
                for (int j : G[i]) {
                    if (ans[i] != ans[j] + 1 && ans[i] != ans[j] - 1) {
                        flag = false;
                    }
                }
            }
            if (flag)
                max = std::max(max, max1);
        }
    }
    cout << max << endl;
    return 0;
}

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

int main() {
     ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    string s,t;
    cin>>s>>t;
    ll n=s.length();
    ll m=t.length();
    ll arr[n+1][m+1];
    for(int i=0;i<=m;i++)
    arr[0][i]=0;
    for(int i=0;i<=n;i++)
    arr[i][0]=0;
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {   
            if(s[i-1]==t[j-1])
            arr[i][j]=1+arr[i-1][j-1];
            else
            arr[i][j]=max(arr[i-1][j],arr[i][j-1]);

        }
 
    }
    int index = arr[n][m]; 
    char lcs[index+1]; 
   lcs[index] = '\0';

   int i = n, j = m; 
   while (i > 0 && j > 0) 
   { 
   
      if (s[i-1] == t[j-1]) 
      { 
          lcs[index-1] = s[i-1]; 
          i--; j--; index--;  
      } 

      else if (arr[i-1][j] > arr[i][j-1]) 
         i--; 
      else
         j--; 
   }
   for(int i=0;i<arr[n][m];i++)
   cout<<lcs[i];
  
    
}

Measured memory_bytes: 70656
#pragma GCC optimize("Ofast,inline,unroll-loops,fast-math")
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <utility>
#define N 15
using namespace std;

vector<pair<int, bool> > a[N];

int main(void)
{
    int n, m, x, y;
    int i, j, k, o;

    cin >> n;
    for(i = 0; i < n; i ++)
    {
        cin >> m;
        while(m --)
        {
            cin >> x >> y;
            a[i].push_back(make_pair(-- x, y));
        }
    }

    for(i = o = 0; i < (1 << n); i ++)
    {
        for(j = 0; j < n; j ++)
        {
            for(k = 0; k < (signed)a[j].size(); k ++)
                if(i & (1 << j))
                {
                    if(((i >> a[j][k].first) & 1) != a[j][k].second)
                        break;
                }
            if(k != (signed)a[j].size())
                break;
        }
        if(j == n)
            o = max(o, (int)__builtin_popcount(i));
    }
    cout << o << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<int> x(n);
  for(int i=0;i<n;i++)
    cin>>x.at(i);
  vector<int> s=x;
  sort(s.begin(),s.end());
  for(int i=0;i<n;i++)
    cout<<(x.at(i)<s.at(n/2)?s.at(n/2):s.at(n/2-1))<<endl;
}

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

int main() {
  int N;
  scanf("%d", &N);
  
  int64_t L0 = 2, L1 = 1;
  int i = 1;
  while(i<N){
    if(i%2 == 1){
      L0 = L0 + L1;
    }else{
      L1 = L0 + L1;
    }
    i++;
  }
  if(N%2 == 1){
    cout << L1 << endl;
  }else{
    cout << L0 << endl;
  }
}


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

int main(){
	int cnt = 0;
	double x1, x2, x3, y1, y2, y3, s = 0.0;
	char c;

	while ( cin >> x3 >> c >> y3 ){
		++cnt;
		if ( cnt == 1 ){
			x1 = x3;
			y1 = y3;
		}
		if ( cnt >= 3 ){
			double a = sqrt( pow( x2 - x1, 2.0 ) + pow( y2 - y1, 2.0 ) );
			double b = sqrt( pow( x3 - x2, 2.0 ) + pow( y3 - y2, 2.0 ) );
			double c = sqrt( pow( x1 - x3, 2.0 ) + pow( y1 - y3, 2.0 ) );
			double z = ( a + b + c ) / 2;
			s += sqrt( z * ( z - a ) * ( z - b ) * ( z - c ) );
		}

		x2 = x3;
		y2 = y3;
	}

	cout << setprecision( 6 ) << setiosflags( ios::fixed );
	cout << s << endl;

	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
#define _overload3(_1,_2,_3,name,...) name
#define _rep2(i,n) for(ll i=0;i<(n);++i)
#define _rep3(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(...) _overload3(__VA_ARGS__,_rep3,_rep2)(__VA_ARGS__)
#define _repe2(i,n) for(ll i=0;i<=(n);++i)
#define _repe3(i,a,b) for(ll i=(a);i<=(b);++i)
#define repe(...) _overload3(__VA_ARGS__,_repe3,_repe2)(__VA_ARGS__)
#define _rrep2(i,n) for(ll i=(n)-1;i>=0;i--)
#define _rrep3(i,a,b) for(ll i=(b)-1;i>=(a);i--)
#define rrep(...) _overload3(__VA_ARGS__,_rrep3,_rrep2)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
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(b<a){a=b;return 1;}return 0;}
template<class T>
using pq=priority_queue<T,vector<T>,greater<T>>;

ll S;

void solve();

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cin >> S;
    solve();
}

// ll S
ll ans;
void dfs(ll d,ll r,ll sum){
    if(!d){
        ans+=sum;
        return;
    }
    ll base=1;
    rep(i,d){
        dfs(i,r%base,sum+r/base);
        base*=10;
    }
}
void solve(){
    dfs(to_string(S).size(),S,0);
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
      ll a,b,c;
     string str;
     string sbr;
     cin>>str>>sbr;
     ll l=sbr.size();
     ll n=str.size();
      ll i,j,k;
      ll mn=INT_MAX;
      for(i=0;i<=n-l;i++)
      {
            ll cnt=0;
            for(j=0;j<l;j++)
            {
                  if(str[i+j]!=sbr[j])
                        cnt++;
            }
            mn=min(mn,cnt);
      }
      cout<<mn<<endl;
      return 0;
}


Measured memory_bytes: 3632
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		final int N = scanner.nextInt();
		final int A = scanner.nextInt();
		final int B = scanner.nextInt();
		String s = scanner.next();
		int a = 0, b = 0;
		for(int i = 0; i < N; i++){
			switch(s.charAt(i)){
				case 'a':
					if(a+b < A+B){
						a++;
						System.out.println("Yes");
						continue;
					}
					break;
				case 'b':
					if(a+b < A+B && (b<B || b == 0)){
						b++;
						System.out.println("Yes");
						continue;
					}
					break;
			}
			System.out.println("No");
		}
		scanner.close();
	}

}


Measured memory_bytes: 23204
#include <iostream>
#include <string.h>
using namespace std;

int main() {
    int r, c;
    cin >> r >> c;
    int arr[r+1][c+1];
    memset(arr, 0, sizeof(arr));
    for (int i=0; i<r+1; i++) {
        for (int j=0; j<c; j++) {
            if (i<r) {
            int num;
            cin >> num;
            arr[i][j]=num;
            arr[i][c]+=num;
            arr[r][j]+=num;
            cout << num << " ";
        } else {
          arr[r][c]+=arr[r][j];
          cout << arr[r][j] << " ";
        }
    }
        cout << arr[i][c] << endl;
    }
    return 0;

}


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

using namespace std;

int main(void)
{
	int a, b, h, m;
	cin >> a >> b >> h >> m;
	long double hrad = 2.0 * M_PI * (h + m / 60.0) / 12.0;
	long double mrad = 2.0 * M_PI * m / 60.0;
	long double rad = hrad - mrad;
	printf("%20.20Lf\n", sqrtl(a*a+b*b - 2 * a * b * cosl(rad)));
	//cout << sqrtl(a*a+b*b - 2 * a * b * cosl(rad)) << endl;
	return 0;
}

Measured memory_bytes: 4140
#include<bits/stdc++.h>
using namespace std;
int main(){
  
  int H;
  int W;
  int N;
  cin >> H;
  cin >> W;
  cin >> N;
 
  if(H >= W){
    if(N % H == 0){
      cout << N / H << endl;
    }
    else{
      cout << N / H + 1 << endl;
    }
  }
  else{
    if(N % W == 0){
      cout << N / W << endl;
    }
    else{
      cout << N / W + 1 << endl;
    }
  }
}

Measured memory_bytes: 256
// https://atcoder.jp/contests/abc154/tasks/abc154_c

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
  int N;
  vector<int> A;

  cin >> N;
  A.resize(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }

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

  for (int i = 0; i < N - 1; i++) {
    if (A[i] == A[i + 1]) {
      cout << "NO" << endl;
      return 0;
    }
  }

  cout << "YES" << endl;

  return 0;
}


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

int main() {
    int sum=0;
    int N,R,ans;
    cin >> N >> R;

    if(N<10){
        ans = R +100*(10-N);
        cout << ans;
    }else{
        cout << R;
    }

    return 0;
    
  
}


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

int main () {
  int W, H, N;
  cin >> W >> H >> N;
  int x[110];
  int y[110];
  int a[110];
  for (int i=0;i<N;++i) {
    cin >> x[i] >> y[i] >> a[i];
  }

  int S[W][H] = {0};

  for (int i=0;i<N;++i) {
    if (a[i] == 1) {
      for (int j=0;j<x[i];++j) {
        for (int k=0;k<H;++k) {
          S[j][k] = 1;
        }
      }
    } else if (a[i] == 2) {
      for (int j=x[i];j<W;++j) {
        for (int k=0;k<H;++k) {
          S[j][k] = 1;
        }
      }
    } else if (a[i] == 3) {
      for (int j=0;j<W;++j) {
        for (int k=0;k<y[i];++k) {
          S[j][k] = 1;
        }
      }
    } else if (a[i] == 4) {
      for (int j=0;j<W;++j) {
        for (int k=y[i];k<H;++k) {
          S[j][k] = 1;
        }
      }
    } 
  }

  int s = W * H;

  for (int i=0;i<W;++i) {
    for (int j=0;j<H;++j) {
      s -= S[i][j];
    }
  }
  cout << s << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
using namespace std;
static const int MAX = 100;

void trace(int data[], int n) {
  cout << data[0];
  for (int i = 1; i < n; i++) {
    cout << " " << data[i];
  }
  cout << endl;
}

int selectionSort(int A[], int len) {
  int count = 0;
  for (int i = 0; i < len; i++) {
    int mini = i;
    for (int j = i; j < len; j++) {
      if (A[j] < A[mini]) {
        mini = j;
      }
    }
    if (i != mini) {
      swap(A[i], A[mini]);
      count++;
    }
  }
  return count;
}

int main() {
  int data[MAX + 1];
  int n;
  cin >> n;
  for (int i = 0; i < n; i++)
    cin >> data[i];

  int count = selectionSort(data, n);
  trace(data, n);
  cout << count << endl;
}

Measured memory_bytes: 3088
#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>
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)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
    int n,m,c;
    cin>>n>>m>>c;
    int l[c];
    rep(i,c)cin>>l[i];
    pair<ll,int> p[n];
    rep(i,n){
        cin>>p[i].second>>p[i].first;
        --p[i].second;
    }
    sort(p,p+n);
    reverse(p,p+n);
    ll ans=0;
    rep(i,n){
        if(!m)break;
        if(l[p[i].second]){
            ans+=p[i].first;
            --l[p[i].second];
            --m;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 4864
// Why am I so dumb? :c
// chrono::system_clock::now().time_since_epoch().count()
                                                  
#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>

#define pb push_back
#define mp make_pair

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

#define fi first
#define se second

using namespace std;
//using namespace __gnu_pbds;

typedef long long ll;   
typedef pair<int, int> pii;
//template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

const int MAXN = (int)1e5 + 5;
const int INF = (int)1e9;

int arr[MAXN];

int n, k, S;

void solve() {
    scanf("%d %d %d", &n, &k, &S);

    for (int i = 1; i <= k; ++i) {
        arr[i] = S;
    }

    for (int i = k + 1; i <= n; ++i) {
        if (S == INF) {
            arr[i] = 1;        
        }
        else {
            arr[i] = S + 1;        
        } 
    }

    for (int i = 1; i <= n; ++i) {
        printf("%d%c", arr[i], " \n"[i == n]);
    }
}

int main() {
    int tt = 1;

    while (tt--) {
        solve();
    }

    return 0;
}


Measured memory_bytes: 1664
#include<bits/stdc++.h>
#define int long long
int a[114514];
using namespace std;
signed main(){
    int n;
    cin>>n;
    int sum1=0;
    for(int i=0;i<n;i++){
        cin>>a[i];
        if(a[i]<0){
            sum1++;
        }
    }
    int sum2=0;
    for(int i=0;i<n;i++){
        sum2+=abs(0-a[i]);
    }
    for(int i=0;i<n;i++){
        a[i]=abs(0-a[i]);
    }
    sort(a,a+n);
    int s=a[0];
    if(sum1%2==0){
        cout<<sum2<<endl;
    }
    else{
        cout<<sum2-s-s<<endl;
    }
}

Measured memory_bytes: 1024
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef pair<ll,ll> P;
typedef tuple<int,int,int> T;
#define fi first
#define se second
map<ll,ll> used;
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c*d/gcd(c,d);}
vector<string> ans;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    int n,m;
    cin>>n>>m;
    vector<T> a(m);
    for(int i=0;i<m;i++){
         int p,q;
         cin>>p>>q;
         a.at(i)=T(p,q,i);
    }
    sort(a.begin(),a.end());
    ans.resize(m);
    vector<bool> check(n,false);
    int j=1;
    for(int i=0;i<m;i++){
        string s,t,d;
        int city=get<0>(a.at(i));
        s=to_string(city);
        if(!check.at(city-1))j=1;
        else j++;
        check.at(city-1)=true;
        int siz=6-s.size();
        while(siz--)t+='0';
        t+=s;
        s={};
        s=to_string(j);
        siz=6-s.size();
        while(siz--)d+='0';
       d+=s;
       int now=get<2>(a.at(i));
       t+=d;
       ans.at(now)=t;
    }
    for(int i=0;i<m;i++)cout<<ans.at(i)<<endl;
}


Measured memory_bytes: 9728
const double = Float64
const int = Int64
const vint = Vector{int}
const vdouble = Vector{double}

#int(x) = parse(int,x)
parseint(x) = parse(int, x)
function readint()
  moji = readline(stdin)
  moji = split(moji)
  return map(parseint,moji)

end

function main()
  s = readline()

  N = length(s)
  D = Dict{int,int}()
  D[0] = 1
  
  mod = 0
  mod10 = 1
  for i in N:-1:1
    a = parse(int,s[i]) #int(s[i])

    mod = (mod + mod10 * a) %2019

    if get(D,mod,0)==0
      D[mod]=1
    else
      D[mod] +=1
    end
    
    mod10 = (mod10 * 10) %2019

  end

  sum = 0
  for (k,v) in D
    sum += v*(v-1)÷2
  end
  println(sum)  

end

main()

Measured memory_bytes: 163960
#include<iostream>
using namespace std;
unsigned long long a[100050];
const long long maxx=1e18;
int main()
{
	int n,i,flag=1;
	long long ans=1;
	cin>>n;
	for(i=0;i<n;i++)
	{
		cin>>a[i];
		if(a[i]==0)
			flag=0;
	}
	if(!flag)
		cout<<0<<endl;
	else
	{
		for(i=0;i<n;i++)
		{
			if(ans*a[i]>maxx||maxx/ans<a[i])
			{
				ans=-1;
				break;
			}
			ans*=a[i];
		}
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 4396
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;

namespace MyProject
{
    class Program
    {
        static void Main(string[] args)
        {
#if Local
            var sw = new Stopwatch();
            sw.Start();
            Console.SetIn(new StreamReader("input.in"));
#endif

            var solver = new Solver();
            solver.Solve();
#if Local
            Console.WriteLine($"{sw.ElapsedMilliseconds}ms");
#endif
        }
    }

    class Solver
    {
        public void Solve()
        {
            var items = Console.ReadLine().Split().Select(elem => int.Parse(elem)).ToArray();
            var A = items[0];
            var B = items[1];
            var C = items[2];
            var K = int.Parse(Console.ReadLine());

            var count = 0;
            while (B <= A)
            {
                B *= 2;
                count++;
            }

            while (C <= B)
            {
                C *= 2;
                count++;
            }

            Console.WriteLine(count <= K ? "Yes" : "No");
        }
    }
}


Measured memory_bytes: 28264
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
//typedef pair<int,int> P;
//priority_queue<int> pque;
//priority_queue<int, vector<int>, greater<int>> pque;
ll INFL = 1000000000000000010;//10^18 = 2^60
int INF = 2000000000;//10^9
ll MOD  = 1000000007;
int N,K;
vector<int> a(110);
ll dp[110][100010];
ll solve(int i, int j){
    if(j == 0)return 1;
    if(j < 0)return 0;
    if(i == -1)return 0;
    if(dp[i][j] != -1){
        return dp[i][j];
    }
    
    return dp[i][j] = (((solve(i, j-1) + solve(i-1, j)) % MOD - solve(i-1, j-1-a.at(i))) % MOD + MOD) % MOD;
    
}





int main(void){
    cin >> N >> K;
    for(int i = 0; i < N; i++){
        cin >> a.at(i);
    }
    
    for(int i = 0; i < 110; i++){
        for(int j = 0; j < 100010; j++){
            dp[i][j] = -1;
        }
    }
    
    cout << solve(N-1, K) % MOD << endl;
    
    
}


Measured memory_bytes: 92416
K,N = (int(i) for i in input().split())
mod,ans,kn = 998244353,[],K+N
fn,fk = [1]*kn,[1]*kn
for i in range(kn-1): fn[i+1] = (fn[i]*(i+2))%mod
def power(n,k):
	if k==1: return n
	elif k%2==0: return power((n**2)%mod,k//2)
	else: return (n*power(n,k-1))%mod
def comb(n,k):
	if n==0 or k==0 or n==k: return 1
	else: return (((fn[n-1]*fk[n-k-1])%mod)*fk[k-1])%mod
fk[-1] = power(fn[-1],mod-2)
for i in range(2,kn+1): fk[-i] = (fk[-i+1]*(kn+2-i))%mod
x = comb(kn-1,N)
for i in range(2,K+2):
	num,c,y,p = N-2,1,0,i//2
	while num>-1 and c<=p:
		if c%2: y = (y+comb(p,c)*comb(K+num-1,num))%mod
		else: y = (y-comb(p,c)*comb(K+num-1,num))%mod
		num,c = num-2,c+1
	ans.append((x-y)%mod)
for i in range(2,K+2): print(ans[i-2])
for i in range(K,1,-1): print(ans[i-2])

Measured memory_bytes: 3664
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, K;
  cin >> N >> K;
  int m = 1;
  
  for(int i = 0; i < N; i++){
    if(m*2 < m+K){
      m *=2;
    }
    else{
      m += K;
    }
  }
  cout << m <<endl;
}

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

using namespace std;
#define rep(i,n) for(int i = 0 ; i < n ; ++i)


int solve(){
    int n;
    cin>>n;
    if(n==0)return 0;
    string s;
    cin>>s;
    vector<int> cnt(n);
    int ba = 0;
    rep(i,100){
        if(s[i]=='M')cnt[i%n]++;
        if(s[i]=='S'){
            ba+=cnt[i%n]+1;
            cnt[i%n]=0;
        }
        if(s[i]=='L'){
            cnt[i%n]+=ba+1;
            ba=0;
        }
    }
    sort(cnt.begin(),cnt.end());
    rep(i,n)cout<<cnt[i]<<" ";
    cout<<ba<<endl;
    return 1;
}

int main(){
    while(solve());
}


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

int main(void) {
  int n, k;
  cin >> n >> k;
  int p[n];
  for(int i = 0; i < n; i++) {
    cin >> p[i];
  }
  sort(p, p+n);
  int ans = 0;
  for(int i = 0; i < k; i++) {
    ans += p[i];
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3624
#include  <stdio.h>

int main(void)
{
	int a,b,c;
	scanf("%d",&a);
	scanf("%d",&b);
	scanf("%d",&c);

	if(a<b&&b<c)
	{
		printf("Yes\n");
	}
	else
	{
		printf("No\n");
	}
        return  0;
}

Measured memory_bytes: 580
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        int HP1 = sc.nextInt();
        int AT1 = sc.nextInt();
        int HP2 = sc.nextInt();
        int AT2 = sc.nextInt();
        String ans = "Yes";
        
        while(true){
            HP2 = HP2 - AT1;
            if(HP2<=0){
                break;
            }
            HP1 = HP1 - AT2;
            if(HP1<=0){
                ans = "No";
                break;
            }
        }
        
        System.out.println(ans);
    }
}


Measured memory_bytes: 35752
package main

import (
	"fmt"
)

// Dice サイコロ構造体
type Dice struct {
	val []int
}

// NewDice サイコロ構造体の生成
func NewDice() *Dice {
	dice := new(Dice)
	dice.val = make([]int, 7)

	return dice
}

// Throw サイコロを振る
func (d Dice) Throw(direction string) {

	tmp := 0

	switch direction {
	case "N":
		tmp = d.val[6]
		d.val[6] = d.val[5]
		d.val[5] = d.val[1]
		d.val[1] = d.val[2]
		d.val[2] = tmp
		break
	case "E":
		tmp = d.val[6]
		d.val[6] = d.val[3]
		d.val[3] = d.val[1]
		d.val[1] = d.val[4]
		d.val[4] = tmp
		break
	case "S":
		tmp = d.val[6]
		d.val[6] = d.val[2]
		d.val[2] = d.val[1]
		d.val[1] = d.val[5]
		d.val[5] = tmp
		break
	default:
		tmp = d.val[6]
		d.val[6] = d.val[4]
		d.val[4] = d.val[1]
		d.val[1] = d.val[3]
		d.val[3] = tmp
		break
	}
}

// Slide サイコロをスライドさせる
func (d Dice) Slide(direction string) {

	tmp := 0

	switch direction {
	case "L":
		tmp = d.val[2]
		d.val[2] = d.val[3]
		d.val[3] = d.val[5]
		d.val[5] = d.val[4]
		d.val[4] = tmp
		break
	default:
		tmp = d.val[2]
		d.val[2] = d.val[4]
		d.val[4] = d.val[5]
		d.val[5] = d.val[3]
		d.val[3] = tmp
		break
	}
}

func (d Dice) isFrontDirection(a, b int) bool {

	pattern := [][]int{{1, 2}, {2, 6}, {6, 5}, {5, 1}, {2, 4}, {4, 5}, {5, 3}, {3, 2}}

	for _, v := range pattern {

		if d.val[v[0]] == a && d.val[v[1]] == b || d.val[v[1]] == a && d.val[v[0]] == b {
			return true
		}

	}

	return false

}

func (d Dice) isFrontDirectionW(a, b int) bool {

	pattern := [][]int{{1, 2}, {2, 6}, {6, 5}, {5, 1}}

	for _, v := range pattern {

		if d.val[v[0]] == a && d.val[v[1]] == b {
			return true
		}

	}

	return false

}

func (d Dice) isFront(a, b int) bool {
	return d.val[1] == a && d.val[2] == b
}

func (d Dice) changeFront(a, b int) {
	for !d.isFrontDirection(a, b) {
		d.Slide("L")
	}

	for !d.isFrontDirectionW(a, b) {
		d.Throw("W")
	}

	for !d.isFront(a, b) {
		d.Throw("S")
	}
}

func main() {

	dice := NewDice()
	fmt.Scan(&dice.val[1], &dice.val[2], &dice.val[3], &dice.val[4], &dice.val[5], &dice.val[6])

	dice2 := NewDice()
	fmt.Scan(&dice2.val[1], &dice2.val[2], &dice2.val[3], &dice2.val[4], &dice2.val[5], &dice2.val[6])

	a, b := dice.val[2], dice.val[1]

	dice.changeFront(a, b)
	dice2.changeFront(a, b)

	c := true

	for i, v := range dice.val {
		if v != dice2.val[i] {
			c = false
		}
	}

	if c {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}



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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> h(n);
    rep(i, n) cin >> h[i];
    vector<int> a(m), b(m);
    rep(i, m) cin >> a[i] >> b[i];

    vector<bool> good(n, true);
    rep(i, m){
        if(h[a[i]-1] <= h[b[i]-1]){
            good[a[i]-1] = false;
        }
        if(h[b[i]-1] <= h[a[i]-1]){
            good[b[i]-1] = false;
        }
    }
    int answer = 0;
    rep(i,n){
        if(good[i]) answer++;
    }
    cout << answer << endl;
    return 0;    
}


Measured memory_bytes: 4580
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 998244353;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

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

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};


///////////////////////////

ll N;

vector<vector<ll>> g;

ll dfs(ll v){
	ll M = g[v].size();
	if (M == 0) { return 0; }

	vector<ll> a(M);
	rep(i, M) { a[i] = dfs(g[v][i]); }

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

	ll ret = a[0];

	for (ll i = 1; i < M; i++) {
		ret = max(ret + 1, a[i]);
	}

	return ret + 1;

}


int main() {
	cin >> N;

	g.resize(N + 1);

	repn(i, N - 1) {
		ll a;
		cin >> a;
		g[a].push_back(i+1);
	}

	cout << dfs(1);
	

	system("PAUSE");
}


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

#define watch(x) cerr << (#x) << ": " << (x) << endl

typedef long long LL;

int a, b, h, m;

pair<double, double> doit(int n, int d) {

    double angle = (double)n/d*2*M_PI;
    
    double x = sin(angle);
    double y = cos(angle);
    return {x, y};
}

int main() {

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin >> a >> b >> h >> m;

    pair<double, double> am = doit(h*60+m, 60*12);
    pair<double, double> bm = doit(m, 60);

    double dx = (am.first*a - bm.first*b), dy = (am.second*a - bm.second*b);
    double ans = sqrt(dx*dx + dy*dy);

    printf("%.20f\n", ans);
    
    return 0;
}


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

int main(){
  vector<bool> is_prime(1000000, true);
  is_prime[0] = false; is_prime[1] = false;

  for(int64_t i=2; i<1000000; i++){
    if(is_prime[i]){
      for(int64_t j=2; i*j<1000000; j++) is_prime[i*j] = false;
    }
  }

  int n;
  while(cin >> n){
    int ans = 0;
    for(int i=0; i<=n; i++){
      if(is_prime[i]) ans++;
    }
    cout << ans << endl;;
  }
}
  


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

using namespace std;

using ll = long long;

int main() {
    int N, M;cin >> N >> M;
    priority_queue<int, vector<int>, greater<int>> que;
    for(int i = 0;i < N;i++){
        int a;cin >> a;
        que.push(a);
    }
    vector<pair<int, int>> v;
    for(int i = 0;i < M;i++){
        int B, C;cin >> B >> C;
        v.push_back({C, B});
    }
    sort(v.begin(), v.end());
    reverse(v.begin(), v.end());
    for(int i = 0;i < M;i++){
        int B = v[i].second;
        int C = v[i].first;
        while(B--){
            if(C > que.top()){
                que.pop();
                que.push(C);
            }else{
                break;
            }
        }
    }
    ll ans = 0;
    while(!que.empty())ans += que.top(), que.pop();
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1784
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace C
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var nm = Console.ReadLine().Trim().Split(' ').Select(long.Parse).ToArray();
            var hi = Console.ReadLine().Trim().Split(' ').Select(long.Parse).ToArray();
            var bad = new bool[hi.Length];
            for (var i = 0; i < nm[1]; i++)
            {
                var ab = Console.ReadLine().Trim().Split(' ').Select(long.Parse).ToArray();
                var a = ab[0] - 1;
                var b = ab[1] - 1;
                var ha = hi[a];
                var hb = hi[b];
                if (ha > hb)
                {
                    bad[b] = true;
                }
                else if (ha < hb)
                {
                    bad[a] = true;
                }
                else
                {
                    bad[a] = true;
                    bad[b] = true;
                }

            }
            Console.WriteLine(bad.Where(x => !x).Count());
        }
    }
}


Measured memory_bytes: 50136
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

func main() {
	sc.Split(bufio.ScanWords)

	N := getInt()
	a := make([]int, N)
	for i := 0; i < N; i++ {
		a[i] = getInt()
	}
	n4 := 0
	n2 := 0
	for i := 0; i < N; i++ {
		if a[i]%2 == 0 {
			n2++
		}
		if a[i]%4 == 0 {
			n4++
		}
	}
	if n4 >= N/2 {
		out("Yes")
		return
	}
	if n2 == N {
		out("Yes")
		return
	}
	n0 := N - n4 - (n2 - n4)
	if n0 == n4 {
		out("Yes")
		return
	}

	out("No")
}


Measured memory_bytes: 2944
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <string.h>
#include <ctype.h>
#include <algorithm>
#include <math.h>

using namespace std;

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

  sort(a,a+n);

  int cnt = 0;
  for(long i = 0; i < n; i++) {
    if(i+1 < n & a[i] == a[i+1]) i++;
    else cnt++; 
  }

  cout << cnt << endl; 
}

Measured memory_bytes: 4388
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		List<ArrayList<Integer>> connect = new ArrayList<ArrayList<Integer>>();
		for (int i=0;i<n+1;i++) {
			connect.add(new ArrayList<Integer>());
		}

		for (int i=0;i<m;i++) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			connect.get(a).add(b);
			connect.get(b).add(a);
		}

		boolean taken[] = new boolean[n+1];
		taken[1]=true;
		LinkedList<Integer> ans = new LinkedList<Integer>();
		ans.add(1);
		extend(ans, connect, taken, false);
		extend(ans, connect, taken, true);
		System.out.println(ans.size());

		StringBuilder sb = new StringBuilder();
		for (Integer i : ans) {
			sb.append(i);
			sb.append(' ');
		}
		sb.deleteCharAt(sb.length()-1);
		System.out.println(sb);
	}

	static void extend(LinkedList<Integer> ans, List<ArrayList<Integer>> connect, boolean[] taken, boolean right) {

		while (true) {
			Integer tmp = right ? ans.getLast() : ans.getFirst();
			boolean found = false;
			for (Integer i : connect.get(tmp)) {
				if (!taken[i]) {
					taken[i] = true;
					if(right) {
						ans.addLast(i);
					} else {
						ans.addFirst(i);
					}
					found = true;
					break;
				}
			}

			if (!found) {
				break;
			}
		}
	}

}


Measured memory_bytes: 101396
#include <stdio.h>
int main(){
int X, b, count;
int max = 1;
scanf("%d",&X);
for(b=1;b<=31 && b <= X;b++){
  count = b;
  while(b != 1 && count*b<=X){
    count = count * b;
    if(max < count) max = count;
  }
}
printf("%d", max);
}

Measured memory_bytes: 128