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

const int64_t MOD = 1e9 + 7;

// O(log a)
int64_t powmod(int64_t a, int64_t p) {
    int64_t value = 1;
    for (int64_t mul = a; p > 0; p >>= 1, mul = (mul * mul) % MOD) {
        if (p & 1) value = (value * mul) % MOD;
    }
    return value;
}

int64_t invmod(int64_t x) {
    return powmod(x, MOD - 2);
}

struct Factorial {
    vector<int64_t> val;
    vector<int64_t> inv;
};

// O(N)
Factorial GetFact(int N) {
    N++;
    Factorial fact;
    fact.val = vector<int64_t>(N);
    fact.inv = vector<int64_t>(N);
    fact.val[0] = 1;
    for (int i = 1; i < N; i++) {
        fact.val[i] = int64_t(fact.val[i - 1] * i) % MOD;
    }
    fact.inv[0] = 1;
    fact.inv[N - 1] = powmod(fact.val[N - 1], MOD - 2);
    for (int i = N - 1; i > 0; i--) {
        fact.inv[i - 1] = int64_t(fact.inv[i] * i) % MOD;
    }
    return fact;
}

int64_t Combination(int n, int m, const Factorial &f) {
    if (n < m || m < 0 || n < 0) return 0;
    return ((f.val[n] * f.inv[m] % MOD) * f.inv[n - m]) % MOD;
}

struct MInt {
    static int64_t mod;
    int64_t v;
    MInt() {}
    MInt(int64_t x) {v = x % mod;}
    MInt operator+(const MInt &y) { return (v + y.v) % mod; }
    MInt operator-(const MInt &y) { return (v - y.v + mod) % mod; }
    MInt operator*(const MInt &y) { return (v * y.v) % mod; }
    MInt operator/(const MInt &y) { return (v * invmod(y.v)) % mod; }
    MInt operator^(const MInt &y) { return powmod(v, y.v);}
    void operator+=(const MInt &y) { *this = *this + y; }
    void operator-=(const MInt &y) { *this = *this - y; }
    void operator*=(const MInt &y) { *this = *this * y; }
    void operator/=(const MInt &y) { *this = *this / y; }
    friend istream &operator>>(istream &ist, MInt &m) { return ist >> m.v; }
    friend ostream &operator<<(ostream &ost, MInt &m) { return ost << m.v; }
};
int64_t MInt::mod = MOD;

int main() {
    #ifdef DEBUG
    std::ifstream in("/home/share/inputf.in");
    std::cin.rdbuf(in.rdbuf());
    #endif
    int64_t N, a, b, c;
    cin >> N >> a >> b >> c;
    a *= invmod(100), b *= invmod(100), c *= invmod(100);
    a %= MOD, b %= MOD, c %= MOD;
    MInt ans = 0;
    Factorial f = GetFact(2 * N);
    for(int i = 0; i < 2; i++) {
        for(int64_t X = 0; X < N; X++) {
            ans += MInt(N + X) * MInt(Combination(N + X - 1, N - 1, f)) * 
                    ((MInt(a)^N) * (MInt(b)^X)) / ( (MInt(1) - c)^(N + X + 1) );
        }
        swap(a, b);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
int main(){
	int M,D;
	cin>>M>>D;
	int ans=0;
	for(int i=1;i<=M;i++){
		for(int j=22;j<=D;j++){
			int d1=j%10,d2=j/10;
			if(d1>=2 && d2>=2 && d1*d2==i)
				ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}

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

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

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define sz(a) ((int)(a).size())
#define rep(i,a,b) for(int i=(a); i<(b); i++)
#define trav(it, a) for(auto& it : a)
#define allin(it, a) for(auto it : a)
#define read(v, a, b) for(int i=(a); i<(b); i++) scanf("%d", &v[i]);
#define clr(a,v) memset(a, v, sizeof(a))
#define all(a) (a).begin(),(a).end()
#define FAST cin.tie(0), cout.tie(0), ios::sync_with_stdio(0)
#define db(x) cerr << #x << " == " << x << endl

const int maxn = 1e5 + 100;

void max_self(ll& a, ll b){
	a = max(a, b);
}

int main(){
	int n, W;
	scanf("%d %d", &n, &W);
	vector<ll> dp(W + 1);
	for(int i = 0; i < n; i++){
		int weight, value;
		scanf("%d %d", &weight, &value);
		for(int weight_already = W - weight; weight_already >= 0; --weight_already){
			max_self(dp[weight_already + weight], dp[weight_already] + value);
		}
	}
	
	ll ans = -1;
	
	for(auto it : dp)
		max_self(ans, it);
	
	printf("%lld\n", ans);
}


Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<list>
#include<set>
using namespace std;
int mod = 1e9+7;

int main() {

  int n, k; cin >> n >> k;
  cout << (n%k == 0 ? 0 : 1) << endl;

  return 0;
}




//


Measured memory_bytes: 256
h,w=[int(i) for i in input().split()]
s=0
l=0
for i in range(h):
  sf=True
  lf=False
  a=list(input().strip())
  for j in range(w):
    if a[j]=="#" and sf==True:
      s=j
      sf=False
      if s!=l and i!=0:
        print("Impossible")
        exit()
    if a[j]=="#" and lf==True:
      print("Impossible")
      exit()
    if a[j]=="." and sf==False and lf==False:
      l=j-1
      lf=True
  if sf==True:
    print("Impossible")
    exit()
  if lf==False:
    l=w-1
else:
  print("Possible")

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;


#define mk make_pair
#define pb push_back

typedef long long lld;
typedef pair<lld,lld> pr;
typedef priority_queue <lld> max_heap;
typedef priority_queue <lld, vector<lld>, greater<lld> > min_heap;
lld const mod = 1e9+7;
lld const N = 1e5+5;
#define ordered_set tree<lld, null_type,less<lld>, rb_tree_tag,tree_order_statistics_node_update>

lld fact[N], ifact[N];

lld power(lld x, lld y)
{
    lld res = 1;
    while (y > 0) {
        if (y & 1)
            res = res * x;
        y = y >> 1;
        x = x * x;
    }
    return res;
}

lld power_mod(lld base, lld y)
{
    lld t = 1;
    while (y > 0)
    {

        if (y % 2 != 0)
            t = (t * base) % mod;
        base = (base * base) % mod;
        y /= 2;
    }
    return t % mod;
}

void findFact() {
    fact[0] = 1;
    for(lld i = 1; i <= N; i++)
        fact[i] = 1ll * fact[i - 1] * i % mod;
    ifact[N] = power_mod(fact[N], mod - 2);
    for(lld i = N - 1; i >= 0; i--)
        ifact[i] = 1ll * ifact[i + 1] * (i + 1) % mod;
}

lld comb(lld n, lld r) {
    return 1ll * fact[n] * ifact[r] % mod * ifact[n - r] % mod;
}


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

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  lld n,x,t;
  cin>>n>>x>>t;
  lld a = ceil(n/(x*1.0));
  lld ans = a*t;
  cout<<ans<<endl;

}


Measured memory_bytes: 3760
#include<bits/stdc++.h>
#define lson l, mid, i<<1
#define rson mid+1, r, i<<1|1
#define PII pair<int, int>
#define Size(x) (int)(x.size())
using namespace std;
typedef long long LL;
//const int MOD = 1e9+7;
const auto INF = 0x3f3f3f3f;
const int N = 2e5+5;
const double pri = acos(-1.0);
struct node {
    int x, y;
}A, B, E[N], Ans[N];

map<int, int> maps[2];

bool cmp1(const struct node &u, const struct node &v) {
    if(u.x == v.x)
        return u.y < v.y;
    return u.x < v.x;
}

bool cmp2(const struct node &u, const struct node &v) {
    if(u.x == v.x)
        return u.y < v.y;
    return u.x > v.x;
}

int b[N];

int main() {
    double p1 = (double)10*pri;
    double p2 = (double)5*pri;
    int n;
    scanf("%d%d%d%d", &A.x, &A.y, &B.x, &B.y);
    scanf("%d", &n);
    int x1 = min(A.x, B.x), x2 = max(A.x, B.x);
    int y1 = min(A.y, B.y), y2 = max(A.y, B.y);
    int cnt = 0;
    for(int i=1; i<=n; i++) {
        scanf("%d%d", &E[i].x, &E[i].y);
        if(E[i].y >= y1 && E[i].y <= y2)
            maps[0][E[i].x]++;
        if(E[i].x >= x1 && E[i].x <= x2)
            maps[1][E[i].y]++;
        if(E[i].x >= x1 && E[i].x <= x2 && E[i].y >= y1 && E[i].y <= y2) {
            Ans[++cnt] = E[i];
        }
    }
    if(A.x == B.x) {
        double answer = (double)100*(y2 - y1);
        if(maps[0].find(A.x) != maps[0].end()) {
            answer += p1 - 20.0;
        }
        printf("%.11lf\n", answer);
        return 0;
    }
    if(A.y == B.y) {
        double answer = (double)100*(x2 - x1);
        if(maps[1].find(A.y) != maps[1].end()) {
            answer += p1 - 20.0;
        }
        printf("%.11lf\n", answer);
        return 0;
    }
    if(A.y > B.y)
        swap(A, B);
    if(A.x < B.x)
        sort(Ans+1, Ans+1+cnt, cmp1);
    else
        sort(Ans+1, Ans+1+cnt, cmp2);
    int len = 1;
    b[1] = Ans[1].y;
    for(int i=2; i<=cnt; i++) {
        if(Ans[i].y > b[len]) {
            b[++len] = Ans[i].y;
        } else {
            int pos = (int)(lower_bound(b+1, b+1+len, Ans[i].y) - b);
            b[pos] = Ans[i].y;
        }
    }
    if(cnt == 0)
        len = 0;
    double answer = (double)100*(double)(y2 - y1 + x2 - x1);
    if(len == x2-x1+1 || len == y2-y1+1) {
        len--;
        answer += (double)len * p2 - (double)len * 20.0;
        answer += p1 - 20;
    } else
        answer += (double)len * p2 - (double)len * 20.0;
    printf("%.11lf\n", answer);
}

/*

0 0 2 3
2
1 1
2 2

*/







Measured memory_bytes: 22912
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<map>
#include<stack>
#include<queue>
#include<bitset>

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

using namespace std;

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

int main() {
	int n, m, c, i, j, k, ans;
	vi b;
	vector< vi >a;

	cin >> n >> m >> c;
	b.resize(m);
	rep(i, m) {
		cin >> b[i];
	}

	a.resize(n);

	rep(i, n) {
		a[i].resize(m);
		rep(j, m) {
			cin >> a[i][j];
		}
	}

	ans = 0;
	rep(i, n) {
		k = c;
		rep(j, m) {
			k += a[i][j] * b[j];
		}
		if (k > 0)ans++;
	}

	cout << ans;

	return 0;
}

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

int main()
{
    int N, K, h, ans = 0;
    cin >> N >> K;

    for (int i = 0; i < N; i++)
    {
        cin >> h;

        if (h >= K)
        {
            ans++;
        }
    }
    cout << ans << endl;
    ;
}

Measured memory_bytes: 256
A,B,C,X,Y = map(int, input().split())
Z = X-Y
if Z<0:
  AB_least = min([X,Y])*2*C + abs(Z)*B
else:
  AB_least = min([X,Y])*2*C + Z*A
AB_all = max([X,Y])*2*C
AandB = A*X + B*Y
ans = min([AB_least,AB_all,AandB])
print(ans)

Measured memory_bytes: 3064
import java.util.*;

public class Main {

    private static int N, M;
    private static int[] A, B, C;

    private static void read() {
        Scanner sc = new Scanner(System.in);
        N = sc.nextInt();
        M = sc.nextInt();
        A = new int[N];
        B = new int[M];
        C = new int[M];
        for (int i = 0; i < N; i += 1) {
            A[i] = Integer.parseInt(sc.next());
        }
        for (int i = 0; i < M; i += 1) {
            B[i] = Integer.parseInt(sc.next());
            C[i] = Integer.parseInt(sc.next());
        }
    }

    public static void main(String[] args) {
        read();

        List<List<Integer>> XY = new ArrayList<>();
        for (int Ai : A) {
            List<Integer> list = new LinkedList<>();
            list.add(1); list.add(Ai);
            XY.add(list);
        }
        for (int i = 0; i < M; i += 1) {
            List<Integer> list = new LinkedList<>();
            list.add(B[i]); list.add(C[i]);
            XY.add(list);
        }

        Collections.sort(XY, new Comparator<List<Integer>>() {
            @Override
            public int compare(List<Integer> o1, List<Integer> o2) {
                Integer Y1 = o1.get(1);
                Integer Y2 = o2.get(1);
                return Y2.compareTo(Y1);
            }
        });

        long max = 0;
        int remaining = N;
        boolean getReturn = false;
        for (List<Integer> xy : XY) {
            int x = xy.get(0);
            int y = xy.get(1);
            for (int i = 0; i < x; i += 1) {
                max += y;
                remaining -= 1;
                if (remaining == 0) {
                    getReturn = true;
                    break;
                }
            }

            if (getReturn) {
                break;
            }
        }

        System.out.println(max);
    }
}


Measured memory_bytes: 88116
#include<bits/stdc++.h>
using namespace std;
inline int rd(char c[]){
  int i, sz=0;
  for(;;){
    i = getchar_unlocked();
    if(i!=' '&&i!='\n'&&i!='\r'&&i!='\t'&&i!=EOF){
      break;
    }
  }
  c[sz++] = i;
  for(;;){
    i = getchar_unlocked();
    if(i==' '||i=='\n'||i=='\r'||i=='\t'||i==EOF){
      break;
    }
    c[sz++] = i;
  }
  c[sz]='\0';
  return sz;
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(const char c[]){
  int i=0;
  for(i=0;c[i]!='\0';i++){
    putchar_unlocked(c[i]);
  }
}
int N;
char S[12];
int main(){
  int c, i, ok;
  N = rd(S);
  ok = 1;
  if(S[0]!='A'){
    ok = 0;
  }
  c = 0;
  for(i=2;i<N-1;i++){
    if(S[i]=='C'){
      c++;
    }
  }
  if(c!=1){
    ok = 0;
  }
  c = 0;
  for(i=0;i<N;i++){
    if('A'<=S[i] && S[i]<='Z'){
      c++;
    }
  }
  if(c!=2){
    ok = 0;
  }
  if(ok){
    wt_L("AC");
    wt_L('\n');
  }
  else{
    wt_L("WA");
    wt_L('\n');
  }
  return 0;
}
// cLay varsion 20190609-2 [beta]

// --- original code ---
// int N; char S[12];
// {
//   int i, c, ok;
//   rd(S@N);
// 
//   ok = 1;
//   if(S[0]!='A') ok = 0;
// 
//   c = 0;
//   rep(i,2,N-1) if(S[i]=='C') c++;
//   if(c!=1) ok = 0;
// 
//   c = 0;
//   rep(i,N) if('A'<=S[i]<='Z') c++;
//   if(c!=2) ok = 0;
// 
//   wt(if[ok,"AC","WA"]);
// }


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

int main()
{
	ios::sync_with_stdio(false);

	int n;
	cin >> n;
	string s1, s2;
	bool found = true;
	while (found)
	{
		found = false;
		for (int i=0; i<2; i++)
		{
			for (int j=0; j<2; j++)
			{
				cout << (i == 0 ? '.' : '#') << s1 << "\n";
				cout << (j == 0 ? '.' : '#') << s2 << "\n";
				cout << flush;
				char res;
				cin >> res;
				if (res == 'T')
				{
					found = true;
					s1 = (i == 0 ? '.' : '#') + s1;
					s2 = (j == 0 ? '.' : '#') + s2;
					break;
				}
			}
			if (found)
				break;
		}
	}
	found = true;
	while (found)
	{
		found = false;
		for (int i=0; i<2; i++)
		{
			for (int j=0; j<2; j++)
			{
				cout << s1 << (i == 0 ? '.' : '#') << "\n";
				cout << s2 << (j == 0 ? '.' : '#') << "\n";
				cout << flush;
				char res;
				cin >> res;
				if (res == 'T')
				{
					found = true;
					s1 += (i == 0 ? '.' : '#');
					s2 += (j == 0 ? '.' : '#');
					break;
				}
			}
			if (found)
				break;
		}
	}


	return 0;
}

Measured memory_bytes: 596
#include<bits/stdc++.h>
using namespace std;
#define int long long
set< pair<int,int> > cell;
int h,w,n,a,b,dem[15];
signed main(){
	scanf("%lld %lld %lld",&h,&w,&n);
	dem[0]=(h-2)*(w-2);
	while(n--){
		scanf("%lld %lld",&a,&b);
		a--,b--;
		cell.insert({a,b});
		for(int x=max((int)0,a-2);x<=min(h-3,a);x++){
			for(int y=max((int)0,b-2);y<=min(w-3,b);y++){
				int cnt=0;
				for(int i=x;i<=x+2;i++){
					for(int j=y;j<=y+2;j++){
						if(cell.count({i,j})) cnt++;
					}
				}
				dem[cnt]++;
				dem[cnt-1]--;
			}
		}
	}
	for(int i=0;i<=9;i++){
		printf("%lld\n",dem[i]);
	}
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define nl "\n"
#define rep(i,n) for(ll i=0; i<(n); i++)
#define INF ((1LL<<62)-(1LL<<31))
#define MOD 1000000007 //998244353
typedef vector<ll> vl;
typedef vector<vl> matrix;//A(n, vl(m)); //n*m行列
typedef vector<string> vs;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
typedef vector<bool> vb;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define Sortup(V) sort(V.begin(), V.end())
#define Sortdown(V) sort(V.rbegin(), V.rend())
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;}
void CumuSum(vl &A){rep(i,A.size())if(i)A[i]+=A[i-1];}
ll llpow(ll e,ll x){ll res=1LL;while(x){if(x&1)res*=e;e*=e;x/=2;}return res;}
ll llpowMOD(ll e,ll x){ll res=1LL;while(x){if(x&1)res*=e;e*=e;x/=2;res%=MOD;e%=MOD;}return res;}
bool bit(ll subset, ll Rsift){ return ((subset)>>(Rsift))&1; }

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

    // solution comes here

    ll N;
    cin >> N;
    string S, T, ans="";
    cin >> S >> T;
    rep(i, N) {
        ans += S[i];
        ans += T[i];
    }

    cout << ans << nl;
}

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

string S, T;

int main(void) {

    cin >> S >> T;

    for (long i = 0; i < S.length(); i++) {
        if (S[i] != T[i]) {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;

    return 0;

}

Measured memory_bytes: 3556
N = int(input())
A = list(map(int, input().split()))


As = set(A)

if len(As) == 3:
    k = 0
    x, y, z = As
    if x^y != z and x^z != y and y^z != x:
        print('No')
        k = 1
    n = N // 3
    if k == 0:
        for i in [x, y, z]:
            if A.count(i) != n and A.count(i) != n+1:
                k = 1
                print('No')
                break
        if k == 0:
            print('Yes')
elif len(As) == 2:
    k = 0
    if 0 in As:
        if A.count(0) == 2:
            pass
        elif A.count(0) == N//3 or A.count(0) == N//3 + 1:
            k = 1
            print('Yes')
    if k == 0:
        print('No')
elif len(As) == 1:
    if 0 in As:
        print('Yes')
    else:
        print('No')
else:
    print('No')


Measured memory_bytes: 14212
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef unsigned long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	int H, W, h, w;
	cin >> W >> H >> w >> h;
	vector<string> A(H), B(h);
	set<char> cs;
	
	rep(i, H){ cin >> A[i]; for(char c : A[i]) cs.insert(c); }
	rep(i, h){ cin >> B[i]; for(char c : B[i]) cs.insert(c); }
	cs.erase('?');
	
	vector<vector<bool>> ok(H, vector<bool>(W, 1));
	
	for(char c : cs){
		int any = 0;
		vector<vector<ll>> t(H, vector<ll>(W));
		rep(i, H) for(int j = W - 1; j >= 0; j--){
			if(j < W - 1) t[i][j] = t[i][j + 1] << 1;
			if(A[i][j] != c && A[i][j] != '?'){
				t[i][j] |= 1;
				any |= 1;
			}
		}
		
		vector<vector<ll>> u(h, vector<ll>(2));
		rep(i, h) rep(j, w) if(B[i][j] == c){
			u[i][j / 64] |= 1ull << j % 64;
			any |= 2;
		}
		if(any != 3) continue;
		
		rep(i, H - h + 1) rep(j, W - w + 1) if(ok[i][j]){
			rep(k, h){
				if(u[k][0] & t[i + k][j]) goto BAD;
				if(w > 64 && (u[k][1] & t[i + k][j + 64])) goto BAD;
			}
			continue;
			BAD:
			ok[i][j] = 0;
		}
	}
	
	int ans = 0;
	rep(i, H - h + 1) rep(j, W - w + 1) if(ok[i][j]) ans++;
	cout << ans << endl;
	
	return 0;
}


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

using namespace std;

using i64 = int64_t;


signed main(){
    int n;
    cin >> n;
    set<vector<int>> v;
    for(int i = 0; i < n; ++i){
        vector<int> w(3);
        for(auto& x : w)
            cin >> x;
        sort(w.begin(), w.end());
        v.emplace(w);
    }
    cout << n - v.size() << endl;
}



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

#include <algorithm>
#include <iomanip>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>

int main() {

    long long int x;
    cin >> x;

    long long int cnt = 100;

    for ( long long int i = 1;; i++ ) {
        cnt += cnt / 100;
        if ( cnt < x ) continue;
        cout << i << endl;
        break;
    }

    return 0;

}


Measured memory_bytes: 3632
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cctype>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>
#include <cstdio>
#include <numeric>
#include <functional>
#include <cstdlib>
#include <regex>
#include <list>
int main() {
	int r, D, x;
	std::cin >> r >> D >> x;
	std::vector<long long>A(11);
	for (int i = 0; i < 10;++i) {
		A[0] = x;
		A[i + 1] = r * A[i] - D;
		std::cout << A[i + 1] << std::endl;
	}
	return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())


int n;
int d[50];

int ans;


int dist(int b){
	int res=INF;

	for (int i=1;i<=12;i++){
		if (b&b<<i){
			res=i;
			break;
		}
	}
	for (int i = 1; i < res; i++){
		if (b&(b>>24-i)){
			res = i;
			break;
		}
	}

	
	return res;
}

void search(int b,int i){
	if (i==n){
		ans = max(ans, dist(b));
		return;
	}
	if (ans >= dist(b)){
		return;
	}
	if ((b&(1 << d[i]))==0) search(b | 1 << (d[i]), i + 1);
	if(d[i] && (b&(1<<24-d[i]))==0) search(b | 1 << (24-d[i]), i + 1);
}



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


	cin>>n;
	rep(i, n)cin >> d[i];
	ans = 0;

	search(1, 0);

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
int main(void){
  long n,p; scanf("%ld%ld",&n,&p);
  if(n==1L) printf("%ld",p);
  else if(n>=40L) printf("1");
  else{
    long i=1L,x=1L,r=1L;
    for(;x<=p;x=(long)powl(++i,n)){ if(p%x==0L) r=i; }
    printf("%ld",r);
  }
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repd(i,a,b) for (int i = (a); i < (b); i++)
#define INF LLONG_MAX
typedef long long ll;

int main(void)
{
	int A1, A2, A3;
	cin >> A1 >> A2 >> A3;
	if(A1+A2+A3>=22) cout << "bust" << endl;
	else cout << "win" << endl;
	return 0;
}


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

#define fi first
#define se second

const int N = 100100;
const long long mod = 1e9 + 9;

using namespace std;

int n;
int d[N][3];

int main()
{
        //freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);
        ios_base::sync_with_stdio(0);

        cin >> n;
        for(int i = 1; i <= n; i++){
                int a, b, c;
                cin >> a >> b >> c;
                d[i][0] = max(d[i - 1][1], d[i - 1][2]) + a;
                d[i][1] = max(d[i - 1][0], d[i - 1][2]) + b;
                d[i][2] = max(d[i - 1][1], d[i - 1][0]) + c;
        }
        int res = d[n][0];
        res = max(res, d[n][1]);
        res = max(res, d[n][2]);
        cout << res << "\n";
}



Measured memory_bytes: 1408
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int num=sc.nextInt();
        String comp[][] = new String[2][num];
        int taro=0;
        int hanako=0;

        for(int i=0; i< num; i++){
        	comp[0][i]= sc.next();
        	comp[1][i]= sc.next();
        }
        sc.close();
        for(int i=0; i< num; i++){
        	int ans = comp[0][i].compareTo(comp[1][i]);
        	if (ans == 0) {
        		taro += 1;
        		hanako += 1;
        	} else if (ans < 0) {
        		hanako += 3;
        	} else {
        		taro += 3;
        	}
        }
        System.out.printf("%d %d%n", taro, hanako);
    }
}


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

int main(){
	int n;
	long long ans = 0;
	set<int> s;
	int a[200010];
	
	cin >> n;
	for (int i = 0;i < n;i++) {
		int temp;
		cin >> temp;
		a[temp-1] = i;
	}
	
	s.insert(-1),s.insert(n);
	for (long long i = 0;i < n;++i) {
		decltype(s)::iterator it = s.lower_bound(a[i]);
		int r = *it,l = *(--it);
		ans += (i+1)*(a[i]-l)*(r-a[i]);
		s.insert(a[i]);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 10368
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let s = read::<String>().chars().collect::<Vec<_>>();
    for i in 0..s.len() {
        if i % 2 == 0 && s[i] == 'R' {
            continue;
        } else if i % 2 == 1 && s[i] == 'L' {
            continue;
        } else if s[i] == 'U' || s[i] == 'D' {
            continue;
        }
        println!("No");
        return;
    }
    println!("Yes");
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 4352
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
int N;
int main()
{
    cin >> N;
    int a[N];
    for (int i = 0; i < N; i++)
        cin >> a[i];

    sort(a, a + N, greater<int>());
    int ret = 0;
    for (int i = 0; i < N; i++)
        if (i % 2 == 0)
        {
            ret += a[i];
        }
        else
        {
            ret -= a[i];
        }

    cout << ret << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<cctype>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
#define reps(i,n) for (int i=1;i<=(n);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rreps(i,n) for (int i=(n);i>0;i--)
#define all(v) (v).begin(),(v).end()
#define pi 3.1415926535897932384
#define E9 1000000000
#define eps 1e-4
#define pii pair<int,int>
template<class T> inline bool chmin(T &a, T b) {if (a>b) {a = b; return 1;} return 0;};
template<class T> inline bool chmax(T &a, T b) {if (a<b) {a = b; return 1;} return 0;};
typedef long long int ll;
const long long INF = 1LL << 60;


int main(){
  int N; cin >> N;
  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(A,A+N);
  sort(B,B+N);
  sort(C,C+N);

  ll ans = 0;
  rep(i,N){
    ll idx_A = lower_bound(A,A+N,B[i]) - A;
    ll idx_C = lower_bound(C,C+N,B[i]+1) - C;
    ans += idx_A*(N-idx_C);
  }
  cout << ans << endl;


  
  // cout << fixed << setprecision(10);
  
  return 0;
}


Measured memory_bytes: 4700
#include<cstdio>
#include<stdlib.h>
#include<algorithm>
#include<iostream>
#include<string>
#include<cstring>
#include<map>
#include<vector>
#include<queue>
#include<math.h>
#include<climits>
#include<set>
#include<sstream>
#include<time.h>

#define debug(x) cout <<#x<<" = "<<x<<endl
#define debug2(x, y) cout<<#x<<" = "<<x<<", "<<#y<<" = "<<y<<endl
#define gg cout <<"---------------QAQ---------------"<<endl
#define fi first
#define SZ(x) (int)x.size()
#define se second
#define pb push_back
#define MEM(a) memset(a, 0, sizeof(a))
#define inf 0x3f3f3f3f
#define lson l, m, rt<<1
#define rson m+1, r, rt<<1|1
#define PI acos(-1)
#define endl "\n"
#define eps 1e-8
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<pii, ll> Pii;
template<class T> inline void read(T &x){
    x=0; char c=getchar(); int f=1;
    while (!isdigit(c)) {if (c=='-') f=-1; c=getchar();}
    while (isdigit(c)) {x=x*10+c-'0'; c=getchar();} x*=f;
}
const int N = 2e5+10, maxn = 1e6+10;
void FAST(){ios::sync_with_stdio(false);cin.tie(nullptr); cout.tie(nullptr);}
const ll mod =  998244353;

int n, m, k;

struct node
{
    ll l, r;
    bool operator< (const node& oth) const
    {
        if(l == oth.l) return r < oth.r;
        return l < oth.l;
    }
}a[N];
ll A[N], B[N];

void solve()
{
    scanf("%d", &n);
//    for(int i = 1; i <= n; ++i) scanf("%lld%lld", &a[i].l, &a[i].r);
    for(int i = 1; i <= n; ++i) scanf("%lld%lld", &A[i], &B[i]);
    sort(A+1, A+n+1);
    sort(B+1, B+n+1);
    ll ans = 0;
    if(n%2==0) {
        ll l = A[n/2]+A[n/2+1];
        ll r = B[n/2]+B[n/2+1];
        ans = r-l+1;
    }
    else {
        ll l = A[(n+1)/2], r = B[(n+1)/2];
        ans = r-l+1;
    }
    printf("%lld\n", ans);
}

int main()
{
//    FAST();
//    init();
//    int _;scanf("%d", &_); while(_--)
//    while(scanf("%d", &n)&&n)
//    while(scanf("%d%d%d", &n, &m, &k)&&(n+m+k))
    solve();
    return 0;
}


Measured memory_bytes: 6968
package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
	"strings"

)


func main() {
	solve(os.Stdin, os.Stdout)
}

type ReaderEx struct {
	baseScanner *bufio.Scanner
	words       []string
	nextWordIdx func() int
	initWordIdx func(int)
}

func NewScannerEx(stdin io.Reader) *ReaderEx {
	var this ReaderEx
	var idx int
	var wordsCnt int
	this.baseScanner = bufio.NewScanner(stdin)
	this.baseScanner.Buffer(make([]byte, 0), 1E+11)
	this.nextWordIdx = func() int {
		cur := idx
		idx = (idx + 1) % wordsCnt
		return cur
	}
	this.initWordIdx = func(wc int) {
		idx = 0
		wordsCnt = wc
	}
	return &this
}

func (me *ReaderEx) Scan(doSplit bool) (isScanned bool) {
	isScanned = me.baseScanner.Scan()
	if doSplit {
		me.words = strings.Fields(me.baseScanner.Text())
	} else {
		me.words = []string{me.baseScanner.Text()}
	}
	me.initWordIdx(len(me.words))
	return
}

func (me *ReaderEx) nextBytes() []byte {
	return []byte(me.words[me.nextWordIdx()])
}
func (me *ReaderEx) nextString() string {
	return me.words[me.nextWordIdx()]
}

type StringArray []string

func (me *ReaderEx) nextStringArray() StringArray {
	return me.words[me.nextWordIdx():]
}

func (me StringArray) toStrings() []string {
	return me
}

func (me StringArray) toInts() []int {
	strValues := me.toStrings()
	values := make([]int, len(strValues))
	for i, v := range strValues {
		n, err := strconv.Atoi(v)
		if err != nil {
			panic(err)
		}
		values[i] = n
	}
	return values
}
func (me *ReaderEx) nextInt() int {
	n, err := strconv.Atoi(me.words[me.nextWordIdx()])

	defer func() {
		if err != nil {
			panic(fmt.Sprintf("getInt(%d)", n))
		}
	}()
	return n
}

func pow(x, y, MOD int) int {

	z := 1
	for y > 0 {
		if y%2 == 0 {
			x = (x * x)
			if MOD > 0 {
				x %= MOD
			}
			y /= 2
		} else {
			z = (z * x)
			if MOD > 0 {
				z %= MOD
			}
			y--
		}
	}
	return z
}

type factType struct {
	prime int
	count int
}

func fact(n int) (facts []*factType) {

	for i := 2; i*i <= n; i++ {
		if n%i == 0 {
			fa := factType{prime: i}
			for n%fa.prime == 0 {
				n /= fa.prime
				fa.count++
			}
			facts = append(facts, &fa)
		}
	}
	if n > 1 {
		facts = append(facts, &factType{prime: n, count: 1})
	}
	return facts
}
func dec2bin(n int) (ret []bool) {
	for bit := 1 << uint(math.Floor(math.Log2(float64(n)))); ; bit >>= 1 {
		ret = append(ret, n&bit != 0)

		if bit <= 1 {
			return
		}
	}

}

func abs(v int) int {
	if v < 0 {
		v = -v
	}
	return v
}

func b2i(b bool) (i int) {
	if b {
		i = 1
	} else {
		i = 0
	}
	return
}

func solve(stdin io.Reader, stdout io.Writer) {

	r := NewScannerEx(stdin)
	r.Scan(true)
	//n := r.nextInt()
	r.Scan(true)
	a := r.nextStringArray().toInts()

	MOD := pow(10, 9, 0) + 7

	maxInt := func(a int, vs ...int) int {
		for i := range vs {
			v := &vs[i]
			if a < *v {
				a = *v
			}
		}
		return a
	}
	mm := map[int]int{}
	for _, v := range a {
		for _, v := range fact(v) {
			mm[v.prime] = maxInt(mm[v.prime], v.count)
		}
	}

	m := 1
	for mi, mv := range mm {
		m = m * pow(mi, mv, MOD) % MOD
	}

	ans := 0
	for _, v := range a {
		ans = (ans + m*pow(v, MOD-2, MOD)) % MOD
	}
	fmt.Fprintln(stdout, ans%MOD)
}


Measured memory_bytes: 3456
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
    input!{
        n: usize,
        m: usize,
    }
    let t = m/n;
    for i in (2..t+1).rev() {
        if m % i == 0 {
            println!("{}", i);
            return;
        }
    }
    println!("{}", 1);
}


Measured memory_bytes: 4352
N=int(input())
H=list(map(int, input().split()))

ans=0
posi=0
counter=0
while posi<N-1:
  if H[posi]>=H[posi+1]:
    counter+=1
    posi+=1
  else:
    if counter>ans:
      ans=counter
      
    counter=0
    posi+=1

if counter>ans:
  ans=counter
  
print(int(ans))

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

 
int main() {
     
   int d;
  scanf("%d",&d);
  
  if(d==25) 
     printf("Christmas");
  
  else if(d==24)
      printf("Christmas Eve");
  
   else if(d==23)
      printf("Christmas Eve Eve");
  
  else 
      printf("Christmas Eve Eve Eve");
  
  
  
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main()
{
	char s[3];
	scanf("%s",&s);
	int m=0,n=0;
	int len = strlen(s);
	for(int i=0;i<len;i++)
	{
		if(s[i]=='A')
			m++;
		if(s[i]=='B')
			n++;
	}
	if(m&&n)
		printf("Yes");
	else printf("No");
	return 0;
 } 

Measured memory_bytes: 128
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using E = System.Linq.Enumerable;

class Program
{
    static void Main(string[] args)
    {
        //入力を受け取る
        var N = long.Parse(Console.ReadLine());
        var A = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
        
        var C = A.Max();
        var r = 0L;
        double distance = double.MaxValue;
        for(int i = 0; i < A.Length ; i++){
          var num = A[i];
          //組む合わせの定理を使い標準化
          if(num > (C/2)){
            num = C-num;
          }
         
          //(n+1)/2との近さ
          if(A[i] != C){
            if(Math.Abs(((C+1)/2)-num) < distance){
              distance = ((C+1)/2)-num;
              r = A[i];
            }
          }
        }
        Console.WriteLine(C+" "+r);
    }
}


Measured memory_bytes: 21728
mod = 1_000_000_007

gets

h = Hash.new{|h, k| h[k] = [0, 0] }
genten_iwashi = 0

$<.read.split.map(&:to_i).each_slice(2) do |(a,b)|

  if 0 == a | b
    genten_iwashi += 1
  else
    f = a.zero? || (a > 0 && b > 0) || (a < 0 && b < 0)
    r = ( f ? Rational(a,b) : -Rational(b,a) )
    h[r][ f ? 0 : 1 ] += 1
  end
end

ans = 1
heiwa_iwashi = 0
h.values.each do |(s, t)|
  if s == 0 || t == 0
    heiwa_iwashi += (s + t)
  else
    ans *= ( 2.pow(s,mod) + 2.pow(t, mod) - 1)
    ans %= mod
  end
end
ans = ( ans * 2.pow(heiwa_iwashi, mod) ) % mod
ans = ( ans - 1 + genten_iwashi ) % mod

puts ans

Measured memory_bytes: 70404
#include<iostream>

using namespace std;

int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

int main(){
  int n;
  cin>>n;
  int a=findSumOfDigits(n);
  n%a==0 ? cout<<"Yes"<<endl : cout<<"No"<<endl;
}

Measured memory_bytes: 256
import java.util.*;
class Main{
    int min(int a,int b){
	if(a<b)return a;
	else return b;
    }
    int max(int a,int b){
	if(a>b)return a;
	else return b;
    }
    Main(){
	Scanner sc =new Scanner(System.in);
	int a=sc.nextInt();
	int b=sc.nextInt();
	int c=sc.nextInt();
	int[] N=new int[a];
	boolean [] flg = new boolean [a];

	for(int i=0;i<b;i++){
	   N[i] =sc.nextInt();
	   N[i]-=c;
	   if(N[i]<0) N[i]+=a;
	   flg[ N[i] ] = true;	   
	}
	flg[0] = true;

	int [] n = new int [a];
	int x=0;

	for(int i=0;i<a;i++){
	    if(flg[i]){
		n[x]=i;
		x++;
	    }
	}

	int ans=a;
	for(int i=0;i<x;i++){
	    int L=n[i],R=n[(i+1)%x];
	    int distL= L;
	    int distR= a-R;
	    if(distR==a)distR=0;
	    ans=min(ans,  min(distL,distR)*2+max(distL,distR)  );
	    
	    
	}
	System.out.println(ans*100);


    }
    public static void main (String[]arg){
	new Main();
    }
}

Measured memory_bytes: 31548
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define INF 1000000000000 //10^12
#define MOD 10000007 //10^9+7
#define PB push_back

template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}

template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}

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

//scanf("%lld", &);
//cin >> ;
//cout << ans << endl;

ll N, M, K, i, j, k, l, ans, cnt = 0;
string s;

int main(){
    //cin >> ;
    //cout << ans << endl;
    ll A, B, H, tmp;

    scanf("%lld", &N);
    scanf("%lld", &M);
    vector<ll> Hs;
    vector<bool> Hans(N, true);
    
    REP(i, N){
        scanf("%lld", &H);
        Hs.push_back(H);
    }

    REP(i, M){
        scanf("%lld", &A);
        scanf("%lld", &B);
        A--;
        B--;
        if(Hs.at(A) > Hs.at(B)){
            Hans.at(B) = false;
        }else if(Hs.at(A) < Hs.at(B)){
            Hans.at(A) = false;
        }else{
            Hans.at(A) = false;
            Hans.at(B) = false;
        }
    }

    REP(i, N){
        if(Hans.at(i)){
            ans++;
        }
    }
    cout << ans;
    cout << endl;
    return 0;
}

Measured memory_bytes: 4348
import qualified Data.Vector.Unboxed as V
main=do
 [n,x]<-map read.words<$>getLine
 let tv=V.iterateN (n+1) ((+3).(*2)) 1
 let pv=V.iterateN (n+1) ((+1).(*2)) (1::Int)
 print$f tv pv n x
f tv pv n x
 |x<=0=0
 |n==0=1
 |x==1=0
 |x<=(tv V.! n)`div`2=f tv pv (n-1) (x-1)
 |otherwise=(pv V.! (n-1)) + 1 + f tv pv (n-1) (x-2-tv V.! (n-1))

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

int main()
{
	using vi = std::vector<int64_t>;
	using vvi = std::vector<vi>;

	int V, E;
	scanf("%d%d", &V, &E);
	vvi graph(V, vi(V, 1ll << 60));
	for (int i{}; i < V; i++) graph[i][i] = 0;
	for (int i{}; i < E; i++)
	{
		int s, t;
		int64_t d;
		scanf("%d%d%lld", &s, &t, &d);
		graph[s][t] = std::min(graph[s][t], d);
	}
	for (int mid{}; mid < V; mid++)
		for (int from{}; from < V; from++)
			for (int to{}; to < V; to++)
				if (graph[from][mid] < (1ll << 60) && graph[mid][to] < (1ll << 60))
					graph[from][to] = std::min(graph[from][to], graph[from][mid] + graph[mid][to]);
	
	for (int i{}; i < V; i++)
		for (int j{}; j < V; j++)
			if (graph[i][j] + graph[j][i] < 0)
			{
				puts("NEGATIVE CYCLE");
				return 0;
			}
	
	for (int i{}; i < V; i++)
		for (int j{}; j < V; j++)
			if (graph[i][j] == (1ll << 60))
				printf("INF%c", j == V - 1? '\n': ' ');
			else
				printf("%lld%c", graph[i][j], j == V - 1? '\n': ' ');

	return 0;
}


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

int main() {
    int N, M, Q;
    cin >> N >> M >> Q;
    vector<vector<int>> LR(N, vector<int>(N, 0));
    vector<int> p(Q), q(Q);
    rep(i, M) {
        int l, r;
        cin >> l >> r;
        l--; r--;
        LR[l][r]++;
    }
    rep(i, Q) {
        cin >> p[i] >> q[i];
        p[i]--; q[i]--;
    }
    vector<vector<int>> sums(N, vector<int>(N+1, 0));
    for(int i=0; i<N; i++) {
        for(int j=1; j<N+1; j++) {
            sums[i][j] = sums[i][j-1] + LR[i][j-1];
        }
    }

    rep(i, Q) {
        int res = 0;
        for(int j=p[i]; j<=q[i]; j++) {
            res += sums[j][q[i]+1] - sums[j][p[i]];
        }
        cout << res << endl;
    }

    return 0;
}

Measured memory_bytes: 3712
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
#include <cassert>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>

#define cauto const auto&
#define ALL(v) begin(v),end(v)
#else
#define ALL(v) (v).begin(),(v).end()
#endif

using namespace std;


namespace{
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}
template <class T> inline T &chmin(T &x, const T &y){ return x = min(x, y); }
template <class T> inline T &chmax(T &x, const T &y){ return x = max(x, y); }
template <class F, class T>
void convert(const F &f, T &t){
	stringstream ss;
	ss << f;
	ss >> t;
}


#define REP(i,n) for(int i=0;i<int(n);++i)
#define RALL(v) (v).rbegin(),(v).rend()


#define MOD 1000000007LL
#define EPS 1e-8


void mainmain(){
	int n, h, w;
	cin >> n >> h >> w;
	cout << (n - h + 1) * (n - w + 1) << '\n';
}



}
int main() try{
//	ios::sync_with_stdio(false); cin.tie(0);
	cout << fixed << setprecision(10);
	cerr << fixed << setprecision(4);
	mainmain();
}
catch(...){}


Measured memory_bytes: 256
N = int(input())
D = [int(i) for i in input().strip().split(' ')]
M = int(input())
D2 = [int(i) for i in input().strip().split(' ')]
D.sort()
D2.sort()

if M > N:
  print("NO")
else:
  d2idx = 0
  for i in range(len(D)):
    if D[i] == D2[d2idx]:
      d2idx += 1
    if d2idx >= len(D2):
      break
  print("YES" if d2idx == len(D2) else "NO")

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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define SZ(x) ((int)(x).size())
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 29;
const ll INF64 = 1ll << 55;
const int mod = 1000000007;
//const int mod = 998244353;

template <class T>inline bool chmin(T &a, const T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline bool chmax(T &a, const T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline void line_out(const vector<T> vec) {
  int n = SZ(vec);
  rep(i, n) {
    cout << vec[i];
    if(i < n-1) cout << " ";
  }
  cout << endl;
  return;
}

struct mint
{
  ll x; // typedef long long ll;
  mint(ll 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
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

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

int main()
{
  ll a, v, b, w;
  double t;
  cin >> a >> v >> b >> w >> t;
  if(w > v) {
    cout << "NO" << endl;
    return 0;
  }

  double res = (double)abs(a-b) / (v-w);
  if(res <= t) cout << "YES" << endl;
  else cout << "NO" << endl;
}

Measured memory_bytes: 3720
function main(input){
	const args=input.split(' ');
	const a=parseInt(args[0],10);
	const b=parseInt(args[1],10);
	
	if((a*b)%2===0){
		console.log('Even');
	}else{
		console.log('Odd');
	}
		
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

int main() {
	int n, k; cin >> n >> k;
	vector<double> p(n);
	rep(i, n) cin >> p[i];
	vector<double> res;
	rep(i, n) {
		double tmp = p[i] * (p[i] + 1) / (2 * p[i]);
		res.emplace_back(tmp);
	}
	vector<double> sum(n + 1);
	sum[0] = 0.0;
	rep(i, n) sum[i + 1] = sum[i] + res[i];
	double ans = 0.0;
	rep(i, n - k + 1) {
		double tmp = sum[i + k] - sum[i];
		ans = max(ans, tmp);
	}
	cout << setprecision(10) << fixed << ans << endl;
	return 0;
}


Measured memory_bytes: 5104
#include <iostream>
#include <algorithm>
using namespace std;
const long long inf = 1LL << 62;
int main() {
	long long X, Y;
	cin >> X >> Y;
	long long ans = inf;
	if(X <= Y) ans = min(ans, Y - X);
	else ans = min(ans, X - Y + 2);
	if(-X <= Y) ans = min(ans, Y - (-X) + 1);
	else ans = min(ans, (-X) - Y + 1);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256