akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cctype>
#include <complex>
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <cassert>
#define un using namespace
un std;
#define pb push_back
#define pf pop_front

#define mp make_pair

#define c0 first
#define c1 second
#define sqr(x) ((x)*(x))
#define clr(x) memset(x, 0, sizeof(x))
#define clr1(x) memset(x, -1, sizeof(x))
#define clr80(x) memset(x, 0x80, sizeof(x))
#define clr7F(x) memset(x, 0x7F, sizeof(x))

#define LL long long
#ifdef __unix__
#define LLD "%lld"
#else
#define LLD "%I64d"
#endif
#define pii pair<int, int>
#define pip pair<int, pii>
#define vi vector<int>
#define vpi vector<pii>
#define pq priority_queue

template<typename T>
inline bool chkmin(T &a, T b){return a > b ? a = b, 1 : 0;}
template<typename T>
inline bool chkmax(T &a, T b){return a < b ? a = b, 1 : 0;}

#define P 1000000007

#define getint(x){\
	char __next__char__;bool __nega__int__=0;\
	while(!isdigit(__next__char__=getchar())&&__next__char__!='-');\
	__next__char__=='-'?(x=0,__nega__int__=1):(x=__next__char__-48);\
	while(isdigit(__next__char__=getchar()))x=x*10+__next__char__-48;\
	if(__nega__int__)x=-x;\
}
#define getint2(x1,x2){getint(x1);getint(x2);}
#define getint3(x1,x2,x3){getint(x1);getint(x2);getint(x3);}
#define getint4(x1,x2,x3,x4){getint(x1);getint(x2);getint(x3);getint(x4);}
#define getint5(x1,x2,x3,x4,x5){getint(x1);getint(x2);getint(x3);getint(x4);getint(x5);}
#define getint6(x1,x2,x3,x4,x5,x6){getint(x1);getint(x2);getint(x3);getint(x4);getint(x5);getint(x6);}

int a[7];

void solve() {
	for (int i = 0; i < 7; i++)
		getint(a[i]);
	long long ans1 = a[1];
	ans1 += (a[0] / 2) * 2;
	ans1 += (a[3] / 2) * 2;
	ans1 += (a[4] / 2) * 2;
	long long ans2 = a[1];
	if (a[0] && a[3] && a[4]) {
		ans2 += 3;
		a[0]--;
		a[3]--;
		a[4]--;
		ans2 += (a[0] / 2) * 2;
		ans2 += (a[3] / 2) * 2;
		ans2 += (a[4] / 2) * 2;
	}
	printf(LLD"\n", max(ans1, ans2));
}

int main() {
	solve();
	return 0;
}


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

int main() {
  int A,B,C;
  cin >> A >> B >> C;
  int K;
    cin >> K;
  int D = 0;
  for (int i = 0; i < K; i++){
    if (A < B && B < C){
      D = 1;
      cout << "Yes" << endl;
      break;
    }
    else if (A < B){
      C += C;
      if (A < B && B < C){
        D = 1;
          cout << "Yes" << endl;
          break;
      }
    }
    else{
      B += B;
      if (A < B && B < C){
        D = 1;
          cout << "Yes" << endl;
          break;
      }
    }
  }
  if (D == 0){
    cout << "No" << endl;
  }
}

    
    



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

#define For(i, l, r) for (register int i = (l), i##end = (int)(r); i <= i##end; ++i)
#define Fordown(i, r, l) for (register int i = (r), i##end = (int)(l); i >= i##end; --i)
#define Rep(i, r) for (register int i = (0), i##end = (int)(r); i < i##end; ++i)
#define Set(a, v) memset(a, v, sizeof(a))
#define Cpy(a, b) memcpy(a, b, sizeof(a))
#define debug(x) cout << #x << ": " << (x) << endl

using namespace std;

template<typename T> inline bool chkmin(T &a, T b) { return b < a ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, T b) { return b > a ? a = b, 1 : 0; }

inline int read() {
	int x(0), sgn(1); char ch(getchar());
	for (; !isdigit(ch); ch = getchar()) if (ch == '-') sgn = -1;
	for (; isdigit(ch); ch = getchar()) x = (x * 10) + (ch ^ 48);
	return x * sgn;
}

void File() {
#ifdef zjp_shadow
	freopen ("C.in", "r", stdin);
	freopen ("C.out", "w", stdout);
#endif
}

long long x, ans = 0;

int main () {

	File();

	cin >> x;

	printf ("%lld\n", x / 11 * 2 + (x % 11 + 5) / 6);

    return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <climits>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#define INF_INT (INT_MAX / 2)
#define INF_LONG (LONG_MAX / 2)
//#define DEBUG true
#define DEBUG false
using namespace std;

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

  string s1, s2;

  cin >> s1;
  cin >> s2;

  string s3(s1);
  string s4(s2);

  reverse(s3.begin(), s3.end());
  reverse(s4.begin(), s4.end());

  if(DEBUG){
    cout << s1 << endl;
    cout << s2 << endl;
    cout << s3 << endl;
    cout << s4 << endl;
  }

  if(s1 == s4 && s2 == s3){
    cout << "YES" << endl;
  }
  else{
    cout << "NO" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
-- https://github.com/minoki/my-atcoder-solutions
{-# LANGUAGE BangPatterns #-}
import           Control.Monad
import           Control.Monad.Primitive     (PrimMonad, PrimState)
import qualified Data.ByteString.Builder     as BSB
import qualified Data.ByteString.Char8       as BS
import           Data.Char                   (isSpace)
import           Data.Foldable               (foldlM)
import           Data.List                   (unfoldr)
import qualified Data.Vector.Unboxed         as U
import qualified Data.Vector.Unboxed.Mutable as UM
import           System.IO                   (stdout)

-- Union Find
newUnionFindTree :: PrimMonad m => Int -> m (UM.MVector (PrimState m) Int)
newUnionFindTree n = U.thaw $ U.enumFromN 0 n

getRoot :: PrimMonad m => UM.MVector (PrimState m) Int -> Int -> m Int
getRoot !v = go
  where
    go !i = do
      j <- UM.read v i
      if i == j then
        return i
      else do
        k <- go j
        UM.write v i k
        return k
{-# INLINE getRoot #-}

unify :: PrimMonad m => UM.MVector (PrimState m) Int -> Int -> Int -> m ()
unify !v !i !j = do
  i' <- getRoot v i
  j' <- getRoot v j
  unless (i' == j') $ do
    let !k = min i' j'
    UM.write v i' k
    UM.write v j' k
{-# INLINE unify #-}

main = do
  [n,q] <- unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
  uf <- newUnionFindTree n
  queries <- U.replicateM q $ do
    [t,u,v] <- unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
    return (t,u,v)
  bb <- U.foldM (\bb (t,u,v) ->
                   if t == 0 then
                     unify uf u v >> return bb
                   else do
                     i <- getRoot uf u
                     j <- getRoot uf v
                     return $! bb <> if i == j then BSB.string8 "1\n" else BSB.string8 "0\n"
                ) mempty queries
  BSB.hPutBuilder stdout bb


Measured memory_bytes: 21508
#include<bits/stdc++.h>
#define f first
#define se second
#define pb push_back
#define pf push_front
#define eb emplace_back
#define emp emplace
#define ins insert
#define sz(s) (int)s.size()
#define rep(i,a,b) for( int i=a;i<b;i++)
#define repr(i,a,b) for( int i=a;i>=b;i--)
#define bitcount __builtin_popcount
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define mem(n,m) memset(n,m,sizeof(n))
#define ii pair<int,int>
#define iii tuple<int, int, int>
#define si set<int>
#define vi vector<int>
#define vii vector<ii>
#define mi map<int,int>
#define lb lower_bound
#define ub upper_bound
#define present(s,x) (s.find(x) != s.end())
#define ford(container, it) for(auto it:container)
#define fors(container, it, a, b) for(auto it = a; it != b; it++)
#define Anurag_Gupta ios_base::sync_with_stdio(0);
#define IIIT_ALLD cin.tie(0);cout.tie(0);
#define mod 987654319
#define EPSILON 1e-9
#define PI acos(-1)
#define inf 1e17
#define int long long
#define debug(a) cerr<<#a<<": ";for(auto i:a)cerr<<i<<" ";cerr<<'\n';
#define trace(a) cerr<<#a<<": "<<a<<"\n"
#define gcd(a,b) __gcd(a,b)
using namespace std;
int add(int a, int b, int c){int res=a+b;return(res>=c?res-c:res);}
int mod_neg(int a, int b, int c){int res;if(abs(a-b)<c)res=a-b;else res=(a-b)%c;return(res<0?res+c:res);}
int mul(int a, int b, int c){int res=(int)a*b;return(res>=c?res%c:res);}
template<typename T>T power(T e, T n){T x=1,p=e;while(n){if(n&1)x=x*p;p=p*p;n>>=1;}return x;}
template<typename T>T mdpower(T e, T n, T m){T x=1,p=e;while(n){if(n&1)x=mul(x,p,m);p=mul(p,p,m);n>>=1;}return x;}
template<typename T>T extended_euclid(T a, T b, T &x, T &y){T xx=0,yy=1;y=0;x=1;while(b){T q=a/b,t=b;b=a%b;a=t;\
t=xx;xx=x-q*xx;x=t;t=yy;yy=y-q*yy;y=t;}return a;}
template<typename T>T mod_inverse(T a, T n){T x,y,z=0;T d=extended_euclid(a,n,x,y);return(d>1?-1:mod_neg(x,z,n));}
/*------------------------------------------------------------------------------------------------------------------*/

int32_t main()
{
    Anurag_Gupta
    IIIT_ALLD
 
  
  
    
    int a,b;
    cin>>a>>b;
    int sum=0;
    
    rep(i,0,b)
    {
        int x;
        cin>>x;
        sum+=x;
    }

    cout<<max(-1LL,a-sum)<<"\n";
    
 






 
#ifndef LOCAL_DEFINE
        cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
    #endif
}


Measured memory_bytes: 3816
#include <bits/stdc++.h>
using namespace std;
const int maxn=2005;
int k[maxn][maxn];
int m[maxn];



int main(){
    int n,x,y;
    cin>>n>>x>>y;
    memset(m,0,sizeof(m));
    for(int i=1;i<=n;i++)
    for(int j=1;j<=n;j++)
        if(j>i){
        if(j<=x||i>=y)
        k[i][j]=j-i;
        else if(i<=x&&j<=y)
        k[i][j]=min(j-i,x-i+1+y-j);
        else if(i>=x&&j<=y)
        k[i][j]=min(j-i,i-x+1+y-j);
        else if(i>=x&&j>=y)
            k[i][j]=min(j-i,i-x+1+j-y);
        else
            k[i][j]=x-i+j-y+1;
     
     m[k[i][j]]++;
    }
    for(int i=1;i<n;i++)
        cout<<m[i]<<endl;
    return 0;
}

Measured memory_bytes: 15360
#include<bits/stdc++.h>
#define pii pair<int,int>
#define fi first
#define se second
#define int long long
#define pb push_back
#define mod 1000000007
#define pll pair<long long,long long>
using namespace std;
long long power(long long a,long long b){
    long long ans=1;
    while(b>0){
        if(b&1){ans=(ans*a)%mod;}
                a=(a*a)%mod;
                b>>=1;
        }
    return ans;
}
bool prime(int n){
    for(int i=2;i*i<=n;i++){
        if(n%i==0)return false;
    }
    return true;
}
int dp[100005];
int fun(int n,int a[],int k){
    for(int i=0;i<n;i++)dp[i]=1000000000;
    dp[0]=0;
    dp[1]=abs(a[1]-a[0]);
    for(int i=2;i<n;i++){
        for(int j=i-1;j>=max(0ll,i-k);j--){
            dp[i]=min(dp[i],dp[j]+abs(a[j]-a[i]));
        }
    }
    return dp[n-1];
}
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n,k;
    cin>>n>>k;
    int a[n];
    for(int i=0;i<n;i++)cin>>a[i];
    cout<<fun(n,a,k);
    return 0;
}

Measured memory_bytes: 5164
import java.util.Scanner;
import static java.lang.Integer.parseInt;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] c = { "black", "blue", "lime", "aqua", "red", "fuchsia", "yellow", "white" };
        for (;;) {
            char[] n = sc.next().toCharArray();
            if (n[0] == '0') {
                break;
            }
            System.out.println(c[parseInt("" + n[1] + n[2], 16) / 128 * 4 + parseInt("" + n[3] + n[4], 16) / 128 * 2 + parseInt("" + n[5] + n[6], 16) / 128]);
        }
    }
}


Measured memory_bytes: 31188
fun main(arg: Array<String>) {
    val N = nextInt()
    val S = Array<String>(N) {""}
    repeat(N) {
        S[it] = next().toCharArray().sorted().joinToString(separator = "")
    }
    val A = S.groupBy{ it }.map{ Pair(it.key, it.value.size) }
    var ans = 0L
    A.forEach {
        val n = it.second.toLong() 
        ans += (n * (n - 1)) / 2
    }
    println(ans)
}
fun next() = readLine()!!
fun nextInt() = Integer.parseInt(next())


Measured memory_bytes: 81412
import java.util.*;
public class Main
{
    public static void main(String args[])
    {
        Scanner sc=new Scanner(System.in);
        String s=sc.next();
        String s1=s.substring(0,4);
        String s2=s.substring(5,7);
        String s3=s.substring(8,10);
        int year=Integer.parseInt(s1);
        int month=Integer.parseInt(s2);
        int day=Integer.parseInt(s3);
        if(year>2019)
            System.out.println("TBD");
        else if(year==2019)
        {
            if(month>4)
                System.out.println("TBD");
            else
                System.out.println("Heisei");
        }
        else
            System.out.println("Heisei");
    }
}

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

using namespace std;

int main(){
	int n,m;
	cin >> n >> m;
	int p = 1;
	for(int i = 0; i < m;i++)p *=2;
	int ans = p*(m*1900 + (n-m)*100);
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll MOD = 1e9+7;

#define vec vector<int>
#define vecll vector<ll>
#define vpair vector<pair<int, int>>
#define vpairll vector<pair<ll, ll>>

#define rep(i,n)         for(int i=(int)0; i<(int)n; i++)
#define REP(i,m,n)       for(int i=(int)m; i<(int)n; i++)
#define arr(var, n)      vec var(n); rep(i,n){cin >> var[i];}
#define arrll(var, n)    vecll var(n); rep(i,n){cin >> var[i];}
#define all(var)         (var).begin(), (var).end()
#define sortall(var)     sort(all(var))
#define prt(var)         cout << var << endl
#define prtd(n, var)     cout << fixed << setprecision(n) << var << endl
#define prt2(v1, v2)     cout << v1 << " " << v2 << endl
#define prt3(v1, v2, v3) cout << v1 << " " << v2 << " " << v3 << endl
#define prtall(var)      rep(i,var.size()){cout << var[i] << " ";} cout << endl

//----------------------------------------------------------------

int main(void) {
  double a, b, x;
  cin >> a >> b >> x;
  x /= a;

  double ans;
  if(x==a*b){
    prtd(8, 0); return 0;
  }

  if(2*x>a*b){
    ans = 90.0-360*atan(a*a/(2*a*b-2*x))/(2*M_PI);
  } else {
    ans = 90.0-360*atan(2*x/b/b)/(2*M_PI);
  }

  prtd(8, ans);
}


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

int main(){
    int ans = 0;
    vector<int> a(3, 0);
    for (int tmp = 0; tmp < (int)a.size(); tmp++){
        int b;
        cin >> b;
        a[tmp] = b;;
    }
    sort(a.begin(), a.end());
    reverse(a.begin(), a.end());
    for (int tmp = 0; tmp < (int)a.size()-1; tmp++){
        ans += abs(a[tmp] - a[tmp+1]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <string>
#include <cstdio>
#include <cmath>
#include <map>

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define REP(i,n) for(int i = 0; i < (n); ++i)
#define RREP(i, n) for(int i = (n) - 1; i >= 0; --i)

using ll = long long;
using namespace std;

constexpr int INF = 2147483647; // 2 * 1e9
constexpr ll LLINF = 9223372036854775807; // 9 * 1e18

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	map<int, int> m;
	REP(i, n){
		int t;
		cin >> t;
		m[t-1] += 1;
		m[t] += 1;
		m[t+1] += 1;
	}
	int x, mx = 0;
	for(auto&& a : m){
		if(a.second > mx){
			mx = a.second;
			x = a.first;
		}
	}
	cout << mx << "\n";
	return 0;
}


Measured memory_bytes: 4736
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pli = pair<ll, int>;
using pil = pair<int, ll>;
using pdd = pair<double, double>;
using uint = unsigned int;
template <typename T>
using Graph = vector<vector<T>>;
const int MOD = 1e9 + 7;
const ld PI = acosl(-1);

template <typename T>
struct BIT {
    int siz;
    vector<T> bit;

    BIT(int N) : siz(N + 1), bit(siz) {}

    void add(int k, T x) {
        for (int i = k; i < siz; i += (i & -i))
            bit[i] += x;
    }

    T sum(int k) {
        T res(0);
        for (int i = k; i > 0; i -= (i & -i))
            res += bit[i];
        return res;
    }
};

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

    int N;
    cin >> N;
    vector<int> a(N);
    for (int i = 0; i < N; ++i)
        cin >> a[i];
    ll mi = (ll)N * (N + 1) / 4 + 1;

    auto acpy = a;
    sort(acpy.begin(), acpy.end());
    auto end = unique(acpy.begin(), acpy.end());
    int siz = end - acpy.begin();

    auto isok = [&](int x) -> bool {
        vector<int> cnt(N + 1);
        for (int i = 0; i < N; ++i)
            cnt[i + 1] = cnt[i] + (a[i] <= x ? 1 : -1);

        BIT<int> bit(2 * N + 1);
        ll res = 0;
        for (int i = 0; i <= N; ++i) {
            res += bit.sum(cnt[i] + N);
            bit.add(cnt[i] + N + 1, 1);
        }

        return mi <= res;
    };

    auto search = [&]() -> int {
        int ng = -1, ok = siz - 1;
        while (ok - ng > 1) {
            int mid = (ok + ng) / 2;
            (isok(acpy[mid]) ? ok : ng) = mid;
        }
        return acpy[ok];
    };

    cout << search() << endl;
    return 0;
}


Measured memory_bytes: 5312
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>

using namespace std;
#define MAXN 200000
#define ll long long
#define rint register int
#define gc() getchar()
inline int read(rint ans = 0, rint sgn = ' ', rint ch = gc())
{
	for(; ch < '0' || ch > '9'; sgn = ch, ch = gc());
	for(; ch >='0' && ch <='9';(ans*=10)+=ch-'0', ch = gc());
	return sgn-'-'?ans:-ans;
}
#define BUF_SIZE 1000000
#define _END fwrite(_Ob,1,_O-_Ob,stdout), _O = _Ob
#define Outc(a) (*_O++ = a)
char _Ob[BUF_SIZE+5], *_O = _Ob, _Os[25], *_Ot;
template <typename T> inline void Out(T x)
{
	if(!x){Outc('0'); return;} if(x < 0) Outc('-'), x = -x;
	for(_Ot = _Os; x; *_Ot++ = x%10+'0', x /= 10);
	for(; _Ot != _Os; Outc(*--_Ot)); if(_O-_Ob >= BUF_SIZE-50) _END;
}
int first[MAXN+5], fa[MAXN+5], sz[MAXN+5], r[MAXN+5], n, tot, cnt; ll ans[MAXN+5]; 
struct Edge{int to,nex; ll w; Edge(){} Edge(int _to, int _nex, ll _w){to=_to,nex=_nex,w=_w;}}e[MAXN+5];
inline void Add(int a, int b, ll w){e[tot] = Edge(b,first[a],w), first[a] = tot++;}
struct E{int u,v,w;}ed[MAXN+5]; inline bool operator < (E a, E b){return a.w > b.w;}
inline int getf(int x){return x-fa[x] ? fa[x] = getf(fa[x]) : x;}
void DFS(int p, ll w){ans[p] = w; for(rint u = first[p]; ~u; DFS(e[u].to,w+e[u].w), u = e[u].nex);}
int main()
{
	cnt = n = read(), memset(first+1,-1,n<<3); for(rint i = 1; i <= n; fa[i] = r[i] = i, sz[i] = 1, i++);
	for(rint i = 1; i < n; ed[i].u = read(), ed[i].v = read(), ed[i].w = read(), i++); sort(ed+1,ed+n);
	for(rint i = 1, x, y; i < n; i++)
		x = getf(ed[i].u), y = getf(ed[i].v), sz[x]>sz[y]?x^=y^=x^=y:0,
		++cnt, Add(cnt,r[x],1ll*ed[i].w*sz[y]), Add(cnt,r[y],1ll*ed[i].w*sz[x]),
		fa[x] = y, sz[y] += sz[x], r[y] = cnt;
	DFS(cnt,0); for(rint i = 1; i <= n; printf("%lld\n",ans[i]), i++); return 0;
}

Measured memory_bytes: 14208
//Created Time:2019/12/9 8:57:49
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#define ll __int128 
#define mod 1000000007

using namespace std;

ll f[100];

void init();
void work(ll, ll);
int calc(ll, ll, ll, ll);
ll read();

int main(){
	init(); int t; cin >> t;
	while(t--){
		ll x = read(), y = read();
		if(x > y) swap(x, y); work(x, y);
	}
	return 0;
}

void init(){
	f[1] = 1;
	for(int i = 2; i <= 88; ++i)
		f[i] = f[i - 1] + f[i - 2];
	return ;
}

int calc(ll x, ll y, ll a, ll b){
	int ans = ((y - b) / a + 1) % mod;
	if(b <= x) (ans += ((y - a) / b + 1) % mod) %= mod;
	return ans;
}

void work(ll x, ll y){
	if(x == 1){
		printf("%d %d\n", 1, y % mod);
		return ;
	}
	if(x == 2 && y == 2){
		puts("1 4");
		return ;
	}
	int pos = upper_bound(f + 1, f + 89, x) - f - 1;
	if(f[pos + 1] > y) --pos; printf("%d ", pos - 1);
	ll a = f[pos], b = f[pos + 1];
	int ans = calc(x, y, a, b);
	for(int i = 2; i < pos; ++i){
		ll na = a + f[pos - i] * f[i], nb = b + f[pos - i + 1] * f[i];
		if(na < a || nb < b || na > x || nb > y) continue; 
		(ans += calc(x, y, na, nb)) %= mod;
	}
	printf("%d\n", ans);
	return ;
}

ll read(){
	ll x = 0; char ch = getchar();
	for(; !isdigit(ch); ch = getchar());
	for(; isdigit(ch); ch = getchar()) x = x * 10 + (ch ^ 48);
	return x;
}


Measured memory_bytes: 3968
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;

using static Input;
using static Util;
class Program
{
    static int a;
    
    static void INPUT()
    {
        a = NextInt();
    }

    static void OUT()
    {
        Console.WriteLine(a + a * a + a * a * a);
    }

    static void Main(string[] args)
    {
#if DEBUG  
        //TESTINPUT();
        INPUT();

#else
        INPUT();
#endif
        OUT();
    }

    static void TESTINPUT()
    {
    }

}

public class Input
{
    public const long MOD = 1000000007;
    public const int INF = 1000000007;
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}

class Util
{
}

Measured memory_bytes: 17700
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;

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

  vvi G(N, vi(0));
  vi dp(N, -1); //ある頂点までにかかる最大の距離
  vi inn(N, 0);
  for(int i = 0; i < M; i++){
    int x, y;
    cin >> x >> y;
    x--; y--;
    G.at(x).push_back(y);
    inn.at(y)++;
  }

  queue<int> que;

  for(int i = 0; i < N; i++){
    if(inn.at(i) == 0){
      dp.at(i) = 0;
      que.push(i);
    }
  }

  while(!que.empty()){
    int v = que.front(); que.pop();
    for(auto x: G.at(v)){
      inn.at(x)--;
      if(inn.at(x) == 0){
        chmax(dp.at(x), dp.at(v) + 1);
        que.push(x);
      }
    }
  }

  int result = 0;
  for(int i = 0; i < N; i++){
    chmax(result, dp.at(i));
  }
  cout << result << endl;

}

Measured memory_bytes: 6528
#include <iostream>

using namespace std;

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

    uint32_t* a;
    a = (uint32_t*)calloc(31250001,sizeof(uint32_t));
    for(auto i = 0; i < n ; i++) {
        int in;
        cin >> in;
        int div = in / 32;
        int hi = in % 32;
        if((*(a + div)) & (0b01 << hi)) {
            cout << "NO" << endl;
            return 0;
        }else{
            *(a + div) = *(uint32_t*)(a + div) | 0b01 << hi;
        }
    }

    cout << "YES" << endl;

    return 0;
}


Measured memory_bytes: 122368
#include "bits/stdc++.h"
using namespace std;
#define maxn 100001
#define rep(i,n) for(int i=0; i<int(n); ++i)
#define pb push_back
#define mp make_pair

int n, m, N;
vector<int> b, c;
vector<pair<int, int> > a;
vector<int> bb, cc;

vector<long long> get_top(vector<int> &a, int n){
	vector<long long> u;
	u.clear();
	u.pb(0);
	priority_queue<int> q;
	while (!q.empty()) q.pop();
	long long s = 0;
	for (int x : a){
		q.push(-x);
		s += x;
		if (q.size() > n){
			s += q.top();
			q.pop();
		}
		u.pb(s);
	}
	return u;
}

void solve(){
	cin >> N >> n >> m;
	N += n + m;
	long long sum = 0;
	rep(i, N){
		int x, y, z;
		cin >> x >> y >> z;
		y -= x, z -= x;
		sum += x;
		b.pb(y);
		c.pb(z);
		a.pb(mp(y - z, i));
	}
	sort(a.begin(), a.end());
	rep(i, N) cc.pb(c[a[i].second]);
	rep(i, N) bb.pb(b[a[N-i-1].second]);
	//rep(i, N) cout << cc[i] << ' ' << bb[i] << endl;
	vector<long long> u = get_top(cc, m);
	vector<long long> v = get_top(bb, n);
	long long ans = v[n] + u[N-n];
	for (int x = n; x <= N - m; ++x){
		ans = max(v[x] + u[N - x], ans);
	}
	cout << ans + sum;
}

int main(int argc, char const *argv[])
{
    ios_base::sync_with_stdio(0);
    solve();
}

Measured memory_bytes: 5480
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <vector>

#define MOD 1000000007
#define int long long
//#define PI 3.14159265358979

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

using namespace std;

template < typename T >
ostream &operator<<(ostream &os, const vector< T > &A) {
	for (int i = 0; i < A.size(); i++)
		os << A[i] << " ";
	os << endl;
	return os;
}
template <>
ostream &operator<<(ostream &os, const vector< vector< int > > &A) {
	int N = A.size();
	int M;
	if (N > 0)
		M = A[0].size();
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++)
			os << A[i][j] << " ";
		os << endl;
	}
	return os;
}

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

struct edge {
	int from, to, d, c;
	edge(int _from = 0, int _to = 0, int _d = 0, int _c = 0) {
		from = _from;
		to = _to;
		d = _d;
		c = _c;
	}
	bool operator<(const edge &rhs) const {
		return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
	}
};

typedef vector< edge > edges;
typedef vector< edges > graph;
struct flow {
	int to, cap, rev, cost;
	flow(int to = 0, int cap = 0, int rev = 0, int cost = 0) : to(to), cap(cap), rev(rev), cost(cost) {}
};
typedef vector< vector< flow > > flows;

const int di[4] = {0, -1, 0, 1};
const int dj[4] = {-1, 0, 1, 0};
const int ci[5] = {0, 0, -1, 0, 1};
const int cj[5] = {0, -1, 0, 1, 0};
const ll LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;
const double PI = acos(-1);

template < typename T, typename U >
bool chmin(T &x, const U &y) {
	if (x > y) {
		x = y;
		return true;
	}
	return false;
}
template < typename T, typename U >
bool chmax(T &x, const U &y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

struct initializer {
	initializer() {
		cout << fixed << setprecision(11);
	}
};
initializer _____;

int N, M, K, T, Q;
signed main() {
	cin >> M;
	vector< int > D(M), C(M);
	rep(i, M) cin >> D[i] >> C[i];
	int csum = 0, dsum = 0;
	rep(i, M) csum += C[i];
	rep(i, M) dsum += D[i] * C[i];
	int ans = csum - 1 + (dsum - 1) / 9;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3328
#include<cstdio>
#define mod 1000000007
using namespace std;

  int dp[110][8],bit[7];
  int h,w,k;

int search(int p,int num){
  if(num==w-1){
    int visit[8]={};
    for(int i=0;i<w-1;i++){
      if(bit[i]==1){
        dp[p][i]+=dp[p-1][i+1];
        dp[p][i+1]+=dp[p-1][i];
        dp[p][i]%=mod;
        dp[p][i+1]%=mod;
        visit[i]=visit[i+1]=1;
      }
    }
    for(int i=0;i<w;i++)
      if(visit[i]==0){
        dp[p][i]+=dp[p-1][i];
        dp[p][i]%=mod;
      }
    return 0;
  }
  bit[num]=0;
  search(p,num+1);
  if(num==0||bit[num-1]==0){
    bit[num]=1;
    search(p,num+1);
  }
}

int main(){
  scanf("%d %d %d",&h,&w,&k);
  dp[0][0]=1;
  for(int i=1;i<=h;i++)
    search(i,0);
  /*for(int i=0;i<=h;i++){
    for(int j=0;j<w;j++)
      printf("%d ",dp[i][j]);
    printf("\n");
  }*/
  printf("%d\n",dp[h][k-1]);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
long long a[200050];
long long ans;
int main()
{
	int n;cin>>n;
	int count1=n-1;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
	}
	sort(a+1,a+1+n);
	reverse(a+1,a+1+n);
	ans+=a[1];
	count1--;
	if(count1==0)
	{
		cout<<ans;
	}
	for(int i=2;i<=n;i++)
	{
		for(int j=1;j<=2;j++)
		{
			ans+=a[i];
			count1--;
			if(count1==0)
			{
				cout<<ans;return 0;
			}
		}
	}
	
}

Measured memory_bytes: 5160
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

int main() {
    int a, b; cin >> a >> b;
    if ((a*b)&1) cout << "Odd" << endl;
    else cout << "Even" << endl;
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
#define maxs 220020
#define mme(i,j) memset(i,j,sizeof(i))
#define ll long long
using namespace std;
bool vis[maxs];
char s[maxs];
bool check(int x,int y,int len){
    vis[0]=x;
    vis[1]=y;
    for(int i=2;i<=len+1;i++){
        if(vis[i-1]){
            if(s[i-1]=='o') vis[i]=vis[i-2];
            else vis[i]=!vis[i-2];
        }else{
            if(s[i-1]=='o') vis[i]=!vis[i-2];
            else vis[i]=vis[i-2];
        }
    }
    if(vis[len]==vis[0]&&vis[len+1]==vis[1]){
        for(int i=0;i<len;i++){
            if(vis[i])
                printf("S");
            else
                printf("W");
        }
        puts("");
        return 1;
    }
    return 0;
}

int main()
{
    int n;
    while(~scanf("%d",&n)){
        scanf("%s",s);
        int len=n;
        s[len]=s[0];
        s[len+1]=s[1];
        s[len+2]='\0';
        bool fl=0;
        for(int i=0;i<2;i++){
            for(int j=0;j<2;j++){
                if(check(i,j,len) )
                   {
                       fl=1;
                        break;
                   }
            }
            if(fl) break;
        }
        if(!fl)
            puts("-1");
    }
    return 0;
}

Measured memory_bytes: 512
#include <cstdio>
#include <vector>

using namespace std;

#define INF (int)(1e9 + 7)
#define int long long
int N;
vector<int> vin;

//return => baainokazu if vcolor[index]=color
int solve(int index, int r, int g, int b)
{
    if (index == N - 1)
    {
        int ans = 0;
        if (r == vin[index])
            ans++;
        if (g == vin[index])
            ans++;
        if (b == vin[index])
            ans++;
        return ans;
    }

    int count = 0;
    if (r == vin[index])
        count++;
    if (g == vin[index])
        count++;
    if (b == vin[index])
        count++;

    if (count == 0)
    {
        return 0;
    }
    else if (count == 1)
    {
        if (r == vin[index])
        {
            return solve(index + 1, r + 1, g, b) % INF;
        }

        if (g == vin[index])
        {
            return solve(index + 1, r, g + 1, b) % INF;
        }

        if (b == vin[index])
        {
            return solve(index + 1, r, g, b + 1) % INF;
        }
    }
    else if (count == 2)
    {
        if (r == vin[index])
        {
            return 2 * solve(index + 1, r + 1, g, b) % INF;
        }

        if (g == vin[index])
        {
            return 2 * solve(index + 1, r, g + 1, b) % INF;
        }

        if (b == vin[index])
        {
            return 2 * solve(index + 1, r, g, b + 1) % INF;
        }
    }
    else
    {
        return 3 * solve(index + 1, r, g, b + 1) % INF;
    }
}

signed main()
{
    scanf("%d", &N);
    for (int i = 0; i < N; i++)
    {
        int hoge;
        scanf("%d", &hoge);
        vin.push_back(hoge);
    }

    //0 1 2
    printf("%d\n", solve(0, 0, 0, 0));
}

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

#define int             long long
#define FOR( i, m, n )  for( int (i) = (m); (i) < (n); (i)++ )
#define REP( i, n )     FOR( i, 0, n )
#define REPR( i, m )    for( int (i) = (m); (i) >= 0; (i)-- )
#define REPONE( i, n )  FOR( i, 1, n + 1 )
#define ALL( a )        (a).begin(), (a).end()
#define MP              make_pair

typedef pair<int, int> P;

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

const int INF = 1e9;
const int MOD = 1e9 + 7;

signed main(){
    int N; cin >> N;
    vector<int> a( N ), b( N ), c( N );
    REP( i, N ) cin >> a[i];
    REP( i, N ) cin >> b[i];
    REP( i, N ) cin >> c[i];

    sort( ALL( a ) );
    sort( ALL( c ) );

    int ans = 0;
    REP( i, N ){
        ans += ( lower_bound( ALL( a ), b[i] ) - a.begin() ) * ( c.end() - upper_bound( ALL( c ), b[i] ) );
    }

    cout << ans << endl;
}


Measured memory_bytes: 2688
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
struct ConvexHullTrickMonotonic {
    deque<Int> A, B;
    void add(Int a, Int b) { // a0 >= a1 >= ...
        Int a2 = a, b2 = b;
        while (A.size() >= 2) {
            Int a0 = A[A.size() - 2], b0 = B[A.size() - 2];
            Int a1 = A[A.size() - 1], b1 = B[A.size() - 1];
            if ((b2 - b1) * (a1 - a0) >= (b1 - b0) * (a2 - a1)) {
                A.pop_back(), B.pop_back();
            } else {
                break;
            }
        }
        A.push_back(a), B.push_back(b);
    }
    Int minimum(Int x) { // x0 <= x1 <= ...
        for (;;) {
            if (A.size() == 1) return A[0] * x + B[0];
            Int ans0 = A[0] * x + B[0];
            Int ans1 = A[1] * x + B[1];
            if (ans0 < ans1) return ans0;
            A.pop_front(), B.pop_front();
        }
    }
};
int main() {
    Int N, C; cin >> N >> C;
    vector<Int> H(N); for (auto &h : H) cin >> h;
    vector<Int> dp(N);
    ConvexHullTrickMonotonic cht;
    cht.add(-2 * H[0], H[0] * H[0] + dp[0]);
    for (int i = 1; i < N; i++) {
        dp[i] = cht.minimum(H[i]) + C + H[i] * H[i];
        cht.add(-2 * H[i], H[i] * H[i] + dp[i]);
    }
    cout << dp[N - 1] << '\n';
    return 0;
}


Measured memory_bytes: 5632
#include<stdio.h>
int main(){
  char s[100010];
  int i,j,a,b,x,y,w;
  while(scanf("%s",s),s[0]-'#'){
    int d[100][100]={};
    for(i=x=y=0;s[i];i++){
      if     (s[i]=='b')d[y][x++]=1;
      else if(s[i]=='/'){
	y++;
	w=x;
	x=0;
      }
      else  x+=s[i]-'0';
    }
    scanf("%d %d %d %d",&a,&b,&i,&j);
    d[a-1][b-1]=0;
    d[i-1][j-1]=1;
    /*for(i=0;i<=y;i++){
      for(j=0;j<w;j++)printf("%d",d[i][j]);printf("\n");
      }printf("\n");//*/
    for(i=0;i<=y;i++){
      if(i)printf("/");
      for(j=a=0;j<w;j++){
	if(d[i][j]){
	  if(a)printf("%d",a);
	  printf("b");
	  a=0;
	}
	else a++;
      }
      if(a)printf("%d",a);
    }
    printf("\n");
  }
  return 0;
}

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

int main()
{
	int n, q, a, v, fish[1000001] = {};
	cin >> n >> q;
	priority_queue<pair<int, int> > Q;
	Q.push(make_pair(0, -1));
	while(q--) {
		cin >> a >> v;
		fish[a] += v;
		Q.push(make_pair(fish[a], -a));
		while (Q.top().first > fish[-Q.top().second]) Q.pop();
		cout << -Q.top().second << " " << Q.top().first << endl;
	}
}

Measured memory_bytes: 6016
function f(n)
  if n % 2 == 0
    return div(n,2)
  else
    return 3n+1
  end
end

function main()
  
  s = parse(Int,readline())
  set = Set(Int64[])
  count = 0
  
  while true
    
    if in(s,set)
      println(count+1)
      break
    else
      push!(set,s)
      s = f(s)
      count += 1
    end
    
  end
  
end

main()

Measured memory_bytes: 165276
s = gets.strip
n = s.size

def parindrome?(str)
  ar = str.chars
  
  while ar.size > 1 do
    head = ar.shift
    last = ar.pop
    return false if head != last
  end

  true
end

fhalf = s[0...((n-1)/2)]
lhalf = s[((n+3)/2-1..-1)]

if parindrome?(s) && parindrome?(fhalf) && parindrome?(lhalf)
  puts 'Yes'
else
  puts 'No'
end


Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int INF = 1<<30;

int main(){
  char ca, cb, cc, cd;cin>>ca>>cb>>cc>>cd;
  int a=ca-'0', b=cb-'0', c=cc-'0', d=cd-'0';
  char op1, op2, op3;
  for(int i=0;i<(1<<3);i++){
  	op1 = (i>>0&1?'+':'-');
  	op2 = (i>>1&1?'+':'-');
  	op3 = (i>>2&1?'+':'-');
    int ans=a;
    ans += (op1=='+'?b:-b);
    ans += (op2=='+'?c:-c);
    ans += (op3=='+'?d:-d);
    if(ans==7)break;
  }
  cout<<a<<op1<<b<<op2<<c<<op3<<d<<"=7"<<endl;
}


Measured memory_bytes: 256
import java.util.*;

// ARC 83-C
// http://arc083.contest.atcoder.jp/tasks/arc083_a

public class Main {
	
	public static void main (String[] args) throws InterruptedException {
		Scanner in = new Scanner(System.in);
		
		int N = in.nextInt();
		
		int[][] givenMap = new int[N][N];
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < N; j++) {
				givenMap[i][j] = in.nextInt();
			}
		}
		
		long[][] map = new long[N][N];
		for (int i = 0; i < N; i++) {
			Arrays.fill(map[i], Long.MAX_VALUE / 2);
		}
		
		long sumPath = 0;
		
		for (int i = 0; i < N; i++) {
			for (int j = i + 1; j < N; j++) {
				boolean altPathFound = false;
				for (int k = 0; k < N && !altPathFound; k++) {
					if (k != i && k != j && givenMap[i][k] + givenMap[k][j] == givenMap[i][j]) {
						altPathFound = true;
					}
				}
				
				if (altPathFound) {
					// Do nothing. i <-> j can be achieved by different path
				} else {
					map[i][j] = givenMap[i][j];
					map[j][i] = givenMap[i][j];
					sumPath += givenMap[i][j];
				}
			}
		}
		
//		print2DArray(map);
//		System.out.println();
		
		for (int k = 0; k < N; k++) {
			for (int i = 0; i < N; i++) {
				for (int j = 0; j < N; j++) {
					if (i != j && j != k && k != i) {
						map[i][j] = Math.min(map[i][j], map[i][k] + map[k][j]);
					}
				}
			}
		}

//		print2DArray(map);
		
		boolean graphExists = true;
		for (int i = 0; i < N && graphExists; i++) {
			for (int j = i + 1; j < N && graphExists; j++) {
				if (i != j && map[i][j] != givenMap[i][j]) {
					graphExists  = false;
				}
			}
		}
		
		if (graphExists) {
			System.out.println(sumPath);
		} else {
			System.out.println(-1);
		}
	}
	
	public static void print2DArray(int[][] arr) {
		for (int i = 0; i < arr.length; i++) {
			for (int j = 0; j < arr[i].length; j++) {
				System.out.printf("%d ", arr[i][j]);
			}
			System.out.println();
		}
	}
	
	public static void print2DArray(long[][] arr) {
		for (int i = 0; i < arr.length; i++) {
			for (int j = 0; j < arr[i].length; j++) {
				System.out.printf("%d ", arr[i][j]);
			}
			System.out.println();
		}
	}
}
/**
5
0 1 2 3 2
1 0 1 2 3
2 1 0 1 2
3 2 1 0 1
2 3 2 1 0
*/

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

#define FOR(a, b, c) for(int a = b; a <= c; ++a)
#define FORW(a, b, c) for(int a = b; a >= c; --a)
#define fi first
#define se second
#define pb push_back
#define int long long

typedef pair<int, int> ii;
typedef pair<int, ii> iii;

const int N = 2e5 + 100;
const int oo = 1e18;
const int mod  = 1e9 + 7;



signed main()  {
//    freopen("test.inp", "r", stdin);
//    freopen("test.out", "w", stdout);
    ios_base::sync_with_stdio(false); cout.tie(0);
    int x, y, z; cin >> x >> y >> z;
    cout << z << ' ' << x << ' ' << y;
}


Measured memory_bytes: 256
($x,$y)=glob<>;
@l=map{[glob<>]}(0..2);
@p=sort{$$b[1]<=>$$a[1]}map{$c=$_;map{[$c,$_]}@{$l[$c]}}(0..2);
$a=$x+$y;
for(;0<$a;$i++){
  ($e,$f)=@{$p[$i]};
  (!$e)?$x&&($x--,$a--,$d+=$f):
  ($e==1)?$y&&($y--,$a--,$d+=$f):
  ($d+=$f,$a--)
}
print$d

Measured memory_bytes: 112004
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int[] h = new int[n];
		for(int i = 0; i < n; i++) {
			h[i] = sc.nextInt();
		}
		
		boolean[] check = new boolean[n];
		for(int i = 0; i < n; i++) {
			check[i] = true;
		}
		
		for(int i = 0; i < m; i++) {
			int temp1 = sc.nextInt() - 1;
			int temp2 = sc.nextInt() - 1;
			if(h[temp1] > h[temp2]) check[temp2] = false;
			else if(h[temp1] < h[temp2]) check[temp1] = false;
			else {
				check[temp1] = false;
				check[temp2] = false;
			}
		}
		
		int count = 0;
		for(int i = 0; i < n; i++) {
			if(check[i]) count++;
		}
		
		System.out.println(count);
		
	}

}


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

#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif

const int MOD = 1e9 + 7;

//http://hiramekun.hatenablog.com/entry/2019/08/25/043546
signed main(){

  int n; cin >> n;
  string s; cin >> s;

  int left = 0,ans = 1;
  for(int i = 0; i < n*2; i++){
    if(i%2 == 0 && s[i] == 'W' || i%2 == 1 && s[i] == 'B'){
      ans = (ans * left) % MOD;
      left--;
      if(left < 0) break;
    }
    else {
      left++;
    }
  }

  if(left != 0){
    cout << 0 << endl;
    return 0;
  }

  for(int i = 1; i <= n; i++){
    ans = (ans * i) % MOD;
  }
  cout << ans << endl;

  return 0;
}


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

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<=(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define Eback(s) s.erase(s.end()-1,s.end())
#define rev(v) reverse(all(v))
#define minvec(v) *min_element(all(v))
#define maxvec(v) *max_element(all(v))
#define sumvec(v) accumulate(all(v),0)
#define mapmax(v) v.rbegin()->first
#define mapmin(v) v.begin()->first
#define pb push_back
#define pf push_front
#define mod 1000000007
#define m_p make_pair
#define DOUBLE fixed << setprecision(15)
#define OK puts("OK")
#define OK1 puts("OK1")
#define OK2 puts("OK2")
#define SIZE(s) (int)s.size()
#define INF ((1LL<<62)-(1LL<<31))
#define zero(x,n) setw(x) << setfill('0') << n

typedef long long ll;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<string> vs;

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

const double pi = acos(-1.0);

template<class A, class B>
ostream& operator<<(ostream& ost, const pair<A, B>&p) {
	ost << "{" << p.first << ", " << p.second << "} ";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost, const vector<T>&v) {
	ost << "{";
	for (int i = 0; i<(int)v.size(); i++) {
		if (i)ost << " ";
		ost << v[i];
	}
	ost << "} \n";
	return ost;
}

template<class A, class B>
ostream& operator<<(ostream& ost, const map<A, B>&v) {
	ost << "{";
	for (auto p:v) {
		ost << "{" << p.first << ", " << p.second << "} ";
	}
	ost << "} ";
	return ost;
}

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

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

void YES(bool b) {cout << (b?"YES\n":"NO\n");}
void Yes(bool b) {cout << (b?"Yes\n":"No\n");}
void yes(bool b) {cout << (b?"yes\n":"no\n");}
void Yay(bool b) {cout << (b?"Yay!\n":":(\n");}

ll gcd(ll x, ll y) {return __gcd(x,y);}
ll lcm(ll x, ll y) {return x/__gcd(x,y)*y;}

int main()
{
	char c;
	cin >> c;
	cout << (char)(c+1) << endl;
	return 0;
}


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

namespace competitive_programming
{
    class Program
    {
        static void Main(string[] args)
        {
            var main = new Program();
            main.solve();
        }

        void solve()
        {
            int[] input = Console.ReadLine().Split(' ').Select(value => int.Parse(value)).ToArray();
            int n = input[0];
            int m = input[1];

            string[] swinfo = new string[m];
            for(int i = 0;i < m; i++)
            {
                swinfo[i] = Console.ReadLine();
            }

            int[] ps = Console.ReadLine().Split(' ').Select(value => int.Parse(value)).ToArray();

            var lamps = new lamp[m];
            for(int i = 0;i < m;i++)
            {
                var info = swinfo[i].Split(' ').Select(value => int.Parse(value)).ToArray();
                var sw = new int[info.Count() - 1];
                for (int j = 0; j < sw.Length; j++) sw[j] = info[j + 1];
                //Console.WriteLine("sw" + sw.Length);
                lamps[i] = new lamp( ps[i],sw );
            }

            check(1, lamps, n);
            Console.WriteLine(count);

        }

        static int count = 0;

        public bool check(int swNum,lamp[] lamps,int n)
        {
            //Console.WriteLine(swNum);
            if (swNum == n + 1) 
            { 
                foreach(var lamp in lamps)
                {
                    //Console.WriteLine(lamp.check);
                    if (lamp.check) continue;
                    else return false;
                }
                count++;
                //Console.WriteLine("goal");
                return true;
            }


            if (check(swNum + 1, lamps, n))
            {
                //if(swNum != 1)   return true;
            }


            var nlamps = lamps;
            for(int i = 0;i < nlamps.Length;i++)
            {
                //Console.WriteLine(i + "番目の最初は" + nlamps[i].switches[0]); ;
                if (nlamps[i].switches.Contains(swNum))
                {
                    //Console.WriteLine(i +" contain " + nlamps[i].check);
                    nlamps[i].check = !nlamps[i].check;
                }
                
            }

            if (check(swNum + 1, nlamps, n))
            {
                //if (swNum != 1) return true;
            }

            return false;
        }
    }


    struct lamp
    {
        public lamp(int p,int[] switches)
        {
            
            this.p = p;
            this.switches = switches;

            if (p == 0) check = true;
            else check = false;

        }

        public bool check;
        public int p;
        public int[] switches;
    }

    struct Vector2
    {
        public Vector2(int x,int y)
        {
            this.x = x;
            this.y = y;
        }
        public int x;
        public int y;
    }

    struct Vector3
    {
        public int x;
        public int y;
        public int z;
    }
}


Measured memory_bytes: 13396
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
typedef long long ll;
#define N 5050
inline int read(){
    int x=0,f=1;
    char c=getchar();
    while(c<'0'||c>'9'){
        if(c=='-')f=-1;
        c=getchar();
    }
    while(c>='0'&&c<='9'){
        x=(x<<3)+(x<<1)+c-'0';
        c=getchar();
    }
    return x*f;
}
int k,Q;
ll d[N],s[N];
int main(){
	k=read(),Q=read();
	for(int i=0;i<k;i++){
		d[i]=read();
		s[i]=s[i-1]+d[i];
	}
	while(Q--){
		ll n=read(),x=read(),m=read();
		x%=m;
		ll p=(n-1)/k,ans=n;
		ll sum=x,tmp=0,qwq=0;
		for(int i=0;i<k;i++){
			tmp+=d[i]%m;
			if(d[i]%m==0)qwq++;
		}
		sum+=tmp*((n-1)/k);
		ans-=((n-1)/k)*qwq;
		ll res=(n-1)-((n-1)/k*k);
		for(int i=0;i<res;i++){
			sum+=d[i]%m;
			if(d[i]%m==0)--ans;
		}
		printf("%lld\n",ans-1-sum/m);
	}
	return 0;
}


Measured memory_bytes: 384