akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 998244353;
const ll INF = mod * mod;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef pair<ll, ll> LP;
typedef vector<ll> vec;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-5;
const ld pi = acos(-1.0);

#include<cstring>
struct edge { int to, cap, rev; };
vector<edge> G[100000];
bool used[100000];
void add_edge(int from, int to, int cap) {
	G[from].push_back(edge{ to, cap, (int)G[to].size() });
	G[to].push_back(edge{ from, 0, (int)G[from].size() - 1 });
}
int dfs(int v, int t, int f) {
	if (v == t)return f;
	used[v] = true;
	for (int i = 0; i < (int)G[v].size(); i++) {
		edge &e = G[v][i];
		if (!used[e.to] && e.cap > 0) {
			int d = dfs(e.to, t, min(f, e.cap));
			if (d > 0) {
				e.cap -= d;
				G[e.to][e.rev].cap += d;
				return d;
			}
		}
	}
	return 0;
}
int max_flow(int s, int t) {
	int flow = 0;
	for (;;) {
		memset(used, 0, sizeof(used));
		int f = dfs(s, t, mod);
		if (f == 0)return flow;
		flow += f;
	}
}

const int mn = 10000000;
bool isp[mn + 1];
void init() {
	fill(isp + 2, isp + mn + 1, true);
	Rep(i, 2, mn + 1) {
		if (!isp[i])continue;
		for (int j = 2 * i; j <= mn; j += i) {
			isp[j] = false;
		}
	}
}
void solve() {
	int n; cin >> n;
	vector<int> x(n);
	rep(i, n) {
		cin >> x[i];
	}
	vector<int> v;
	rep(i, n) {
		if (i == 0 || x[i] - 1 > x[i - 1]) {
			v.push_back(x[i] - 1);
		}
		if (i + 1 == n || x[i + 1] > x[i] + 1) {
			v.push_back(x[i]);
		}
	}
	vector<int> od, ev;
	rep(i, v.size()) {
		//cout << v[i] << endl;
		if (v[i] % 2)od.push_back(v[i]);
		else ev.push_back(v[i]);
	}
	int s = od.size() + ev.size();
	int t = s + 1;
	rep(i, od.size()) {
		add_edge(s, i, 1);
	}
	rep(i, ev.size()) {
		add_edge(i + od.size(), t, 1);
	}
	rep(i, od.size()) {
		rep(j, ev.size()) {
			int l = i;
			int r = od.size() + j;
			int dif = abs(od[i] - ev[j]);
			if (isp[dif]) {
				add_edge(l, r, 1);
			}
		}
	}
	int f = max_flow(s, t);
	int ans = f;
	int odnum = od.size() - f;
	ans += 2*(odnum / 2);
	int evnum = ev.size() - f;
	ans += 2*(evnum / 2);
	if (odnum % 2||evnum%2) {
		ans += 3;
	}
	cout << ans << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(50);
	init();
	solve();

	//cout << "finish" << endl;
	//stop
	return 0;
}


Measured memory_bytes: 12672
#include<iostream>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<queue>
#include<set>
#include<stack>
#include<map>
#include<math.h>
#define EPS1 1e-6
#define EPS2 1e-9
#define EPS3 1e-15
#define fi first
#define se second
#define ff first.first
#define ss second.second
#define sf second.first
#define fs first.second
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ul;
typedef pair<ld,ld> ldd;
typedef pair<double,double> dd;
typedef pair<int,int> ii;
typedef pair<int, ii> iii;
typedef vector<int> vi;
typedef pair<ld,ii> dii;

int main(){
	ul a;
	cin>>a;
	ul ans = (a*(a-1))/2;
	cout<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 256
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rf = lambda: map(float, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

n, h, w = rm()
cnt = 0
for _ in range(n):
    a, b = rm()
    if a >= h and b >= w:
        cnt += 1
print(cnt)

Measured memory_bytes: 27248
#include <bits/stdc++.h> 
using namespace std; 
int main() 
{ 
	
	long x;
	cin>>x;
	long y = -1;
	while(true)
	{
	    
	    if(abs(pow(y,5))>x)
	        break;
	    y--;
	}
	y++;
	//cout<<y<<endl;
	for(int i =y ;;i++)
	{
	    long p = x+pow(i,5);
	    float ans = pow(p,0.2);
	    long a =ans;
	    //cout<<ans-a<<endl;
        if(ans - a == 0)
        {
	        cout<<ans<<" "<<i<<endl;
	        break;
        }
	
	    
	}

	return 0; 
} 


Measured memory_bytes: 4156
#include<bits/stdc++.h>
#define Imposter ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define ll long long int
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
using namespace __gnu_pbds;
#define ordered_set tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>//s.order_of_key(val) *s.find_by_order(ind)
using namespace std;
#define f(n) for(ll i=0;i<n;i++)
#define rep(i,a,b) for(i=a;i<b;i++)
#define input(arr,n) for(ll i1=0;i1<n;i1++ )cin>>arr[i1]
#define vll vector<ll>
#define vlll vector<vll>
#define all(x) x.begin(),x.end()
ll power(ll x, ll y, ll p) { 
    ll res = 1;    x = x % p;  
    while(y > 0) {
        if(y & 1) res = (res*x) % p; 
        y = y>>1;    x = (x*x) % p; 
    } return res; 
}
int main()
{
    Imposter
    
    int t=1;
    //cin>>t;
    while(t--)
    {
       ll a,b,c;
       cin>>a>>b>>c;
       ll k;
       cin>>k;
       //c>b>a
       if(c>b and b>a)
       {
           cout<<"Yes"<<endl;
           return 0;
       }
       ll i=0,j=0;
       while(b<=a)
       {
           b=b*2;
           i++;
       }
       while(c<=b)
       {
           c=c*2;
           j++;
       }
       
       if(k>=(i+j))
       cout<<"Yes"<<endl;
       else
       cout<<"No"<<endl;
        
    }
    return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
          int x,y;
          while (cin>>x>>y){
          if(x>y){
          	swap(x,y);
          }
          if(x!=0 || y!=0){
          	cout<<x<<" "<<y<<endl;
          }
          }
	return 0;
}


Measured memory_bytes: 3000
n, k = gets.strip.split.map(&:to_i)
ary = gets.strip.split.map(&:to_i)
ans = 0
if ary.uniq.size <= k
else
  counts = ary.group_by(&:itself).map{ |k, v| [k, v.count] }.sort_by(&:last)
  (ary.uniq.size - k).times do |i|
    ans += counts[i][1]
  end
end
puts ans

Measured memory_bytes: 68636
N = int(input())
M = { }
for i in range(N):
  S = input()
  if S not in M:
    M[S] = 0
  M[S] += 1
#print(M)
n = max(M.values())
l = []
for S in M.keys():
  if M[S] == n:
    l.append(S)
l.sort()
for S in l:
  print(S)


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

namespace multiset
{

class multiset
{
  public:
    multiset(int N) : N(N), tree(N + 1, 0), MSB(get_MSB(N)) {}
    void insert(int x) { add(x, 1); }
    void erase(int x) { add(x, -1); }
    int lower_bound(int x) { return bisect(sum(x)); }
    int size() { return sum(N); }

  private:
    std::vector<int> tree;
    int N;
    int MSB;

    void add(int i, int x)
    {
        if (i == 0) {
            return;
        }

        for (; i <= N; i += i & -i) {
            tree[i] += x;
        }
    }

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

    int bisect(int w)
    {
        if (w <= 0) {
            return 0;
        }

        int i = 0;
        for (int k = MSB; k > 0; k /= 2) {
            if (i + k <= N && tree[i + k] < w) {
                w -= tree[i + k];
                i += k;
            }
        }
        return i + 1;
    }

    int get_MSB(int x)
    {
        int msb = 1;
        while (msb < x) {
            msb <<= 1;
        }
        return msb;
    }
};

} // namespace multiset

int main()
{
    // https://atcoder.jp/contests/abc134/tasks/abc134_e

    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);

    int N;
    std::cin >> N;

    std::vector<int> A(N);
    for (auto &&a : A) {
        std::cin >> a;
    }

    std::vector<int> B = A;
    std::sort(begin(B), end(B));
    B.erase(std::unique(begin(B), end(B)), end(B));

    std::transform(begin(A), end(A), begin(A), [&](int val) -> int {
        return std::lower_bound(begin(B), end(B), val) - begin(B) + 1;
    });

    multiset::multiset ms(B.size());
    for (auto a : A) {
        auto i = ms.lower_bound(a - 1);
        if (i != 0) {
            ms.erase(i);
        }
        ms.insert(a);
    }

    std::cout << ms.size() << '\n';
}


Measured memory_bytes: 1408
#include <iostream>
using namespace std;
int n,m;
int main(int argc, char** argv) {
	cin >> n >> m;
	for(int i=1;i<=m;i++)
	{
		int x;
		cin >> x;
		n-=x;
		n=max(n,-1);
	}
	cout << n;
	return 0;
}

Measured memory_bytes: 3164
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
#define DBG(X) cout << #X << "=" << (X) << '\n';
#define SAY(X) cout << (X) << '\n';
#else
#define DBG(X)
#define SAY(X)
#endif

#define M_PI       3.14159265358979323846

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

const int NIL = -1;
static mt19937 _g(time(nullptr));

std::string pad(int num)
{
    char buffer[4];
    std::snprintf(buffer, sizeof(buffer), "%03d", num);
    return buffer;
}

inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

#ifdef _MSC_VER
#  include <intrin.h>
#  define __builtin_popcount __popcnt
#endif

struct Hashing {
    ull seed, mod;
    vector <ull> hs, pw;

    Hashing(ull seed = 31, ull mod = 1000173169) :
        seed(seed),
        mod(mod) {}

    void build(int n, const string& s) {
        hs.assign(n + 1, 0);
        pw.assign(n + 1, 1);
        pw[0] = 1;

        for (int i = 1; i <= n; ++i)
            pw[i] = pw[i - 1] * seed % mod;
        for (int i = 1; i <= n; ++i)
            hs[i] = (hs[i - 1] * seed + s[i]) % mod;
    }

    ull hash(int l, int r) {
        return (hs[r] - hs[l - 1] * pw[r - l + 1] % mod + mod) % mod;
    }
};

int solve()
{
    int n, m;
    cin >> n >> m;

    int wacnt = 0;

    unordered_map<int, int> wa;
    unordered_set<int> ac;
    string s;
    int prob;

    for (int i = 0; i < m; ++i)
    {
        cin >> prob >> s;

        if (ac.find(prob) == ac.end())
        {
            if (s == "WA")
            {
                wa[prob]++;
            }
            else
            {
                ac.insert(prob);
                wacnt += wa[prob];
            }
        }
    }

    cout << ac.size() << " " << wacnt << endl;

    return 0;
}

int main()
{
    solve();

    return 0;
}

Measured memory_bytes: 8520
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll INF = 100000000;
#define rep1(i, n) for (ll i=0; i<(n); i++) 
#define rep2(i, k, n) for (ll i=k; i<(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main() {
    ll n;
    cin >> n;
    vector<ll> a(n,0), b(n,0);
    rep1(i, n) cin >> a[i];
    ll res = n-1;
    bool change = false;
    rep1(i,n){
        if (!change){
            b[i] = a[res];
            res -= 2;
            if (res==-2){
                change = true;
                res = 1;
                continue;
            }
            if (res==-1){
                change = true;
                res = 0;
                continue;
            }
        }
        if (change){
            b[i] = a[res];
            res += 2;
        }
    }
    rep1(i, n){
        if (i==n-1) cout << b[i] << endl;
        else cout << b[i] << " ";
    }
}

Measured memory_bytes: 6424
#include <bits/stdc++.h>
  
using namespace std;
  
template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }
  
#define pb push_back
#define mp make_pair
#define cotu cout
#define itn int
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i,n) for(int i = n - 1; i >= 0; --i)
#define Rep(i, a, n) for(int i = (a); i <=(n); ++i)
#define repst(i, n) for(auto it = n.begin(); it != n.end(); ++it)
#define Repr(i, a, n) for(int i = (n); i >= (a); --i)
#define forit(it, st) for(auto it : st)
#define ordered_set tree<int , null_type,less<int >, rb_tree_tag,tree_order_statistics_node_update> 
  
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
  
const int inf = int(1e9);
const int mod = inf + 7;
const int N = 1e6 + 555; // TL MB
const double PI = acos(-1.0);
void solve(){
	int x = 0;
	rep(i, 3){
		int p;
		cin >> p;
		x += p;
	}
	cout << (x >= 22 ? "bust" : "win");

}
 
int main()
{
    Red;
  	// int T; cin >> T; while(T--)
    solve();
    return 0;
}


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

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll n,k,mx=0;
    cin>>n>>k;
    vector<ll>p(n+5,0);
    vector<ll>sum(n+5,0);
    double ans =0;
    int from = 0;
    for(ll i = 1 ; i <= n ; i++){
        cin>>p[i];
        sum[i] = sum[i-1]+p[i];
        if(i>=k){
            ll tem = sum[i]-sum[i-k];
            if(tem>mx){
                mx = tem;
                from = i;
            }
        }
    }
    
   
    for(ll i = from ; i > from-k ; i--){
        double t = p[i];
        ans+= ((1+t)/2.0);
        //cout<<"i "<<i<<" t: "<<t<<" ans: "<<ans<<'\n';
    }
    cout.precision(16);
    cout<<ans<<'\n';
    //printf("%.16f",ans);
}



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

#define ll long long
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define pqb priority_queue<int>
#define pqs priority_queue<int, vi, greater<int>>
#define setbits(x) __builtin_popcountll(x)
#define zrobits(x) __builtin_ctzll(x)
#define mod 1000000007
#define inf (int)(1e18)
#define ps(x, y) fixed << setprecision(y) << x
#define w(x)  \
    int x;    \
    cin >> x; \
    while (x--)
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define all(p) p.begin(), p.end()
#define ub(a, b) upper_bound(all(a), b)
#define lb(a, b) lower_bound(all(a), b)
#define sz(x) (int)x.size()
#define PI 3.14159265
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

void run()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
void solution()
{
    const int N = 1000005;
    vi lp(N + 1, 0);
    vector<int> pr;
    for (int i = 2; i <= N; ++i)
    {
        if (lp[i] == 0)
        {
            lp[i] = i;
            pr.push_back(i);
        }
        for (int j = 0; j < (int)pr.size() && pr[j] <= lp[i] && i * pr[j] <= N; ++j)
            lp[i * pr[j]] = pr[j];
    }
    int n;
    cin >> n;
    vi c(N + 1, 0);
    bool flag = false;
    int temp;
    int gcd = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> temp;
        if (i == 0)
        {
            gcd = temp;
        }
        else
        {
            gcd = __gcd(gcd, temp);
        }
        int x = temp;
        while (x > 1)
        {
            if (c[lp[x]] > 0)
            {
                flag = true;
            }
            x /= lp[x];
        }
        x = temp;
        while (x > 1)
        {
            c[lp[x]]++;
            x /= lp[x];
        }
    }
    if (flag == 1 and gcd == 1)
    {
        cout << "setwise coprime" << endl;
    }
    else if (flag == 0 and gcd == 1)
    {
        cout << "pairwise coprime" << endl;
    }
    else
    {
        cout << "not coprime" << endl;
    }
    return;
}
int32_t main()
{
    run();
    solution();
    return 0;
}

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

const ll INF = 1e18;

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

  int ans = 0;
  for(int i = 1; i<=n; i+=2){
    int div = 0;
    for(int j = 1; j<=i; j++){
      if(i%j==0) div++;
    }
    if(div==8) ans++;
  }

  cout << ans << endl;

  return 0;
}

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

#define rep(n) for(int i=0;i<n;i++)
#define repp(j, n) for(int j=0;j<n;j++)
#define reppp(i, m, n) for(int i=m;i<n;i++)
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define debug(x) cerr << #x << ": " << x << endl

using namespace std;

typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> Pii;

const ll MOD = 1000000007;
const long double EPS = 10e-10;

int main(){
    int N;
    cin >> N;
    if(N==1){
        cout << "Hello World" << endl;
    }else{
        int a,b;
        cin >> a >> b;
        cout << a+b << endl;
    }
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <map>
#include <numeric>
#include <random>
#include <queue>
#include <tuple>
#include <iomanip>

using namespace std;

const int MOD = 1000000007;
typedef long long ll;

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin>>n;
  vector<ll> L(100);
  L[0]=2;L[1]=1;
  for(int i=2;i<100;i++){
    L[i]=L[i-2]+L[i-1];
  }
  cout<<L[n]<<endl;
}


Measured memory_bytes: 256
package main

import (
  "bufio"
  "os"
  "fmt"
)

var reader = bufio.NewReaderSize(os.Stdin, 1000000)
var writer = bufio.NewWriter(os.Stdout)
func NextLine() string {
  var line, buffer []byte
  var isPrefix bool = true
  var err error
  for isPrefix {
    line, isPrefix, err = reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer, line...)
  }
  return string(buffer)
}
func Write(s interface{}) {
  fmt.Fprintln(writer, s)
}
func Output() {
  _ = writer.Flush()
}

func main() {
  A := NextLine()
  W := make([]int, 26)
  for i := 0; i < len(A); i++ {
    W[rune(A[i]) - 97] += 1
  }
  cnt := 0
  for _, w := range W {
    if w > 0 { cnt += w * (len(A) - w)}
  }
  Write(cnt / 2 + 1)
  Output()
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define forn(x, n) for (int x = 0; x < n; x++)
#define forr(x, n) for (int x = n; x >= 0; x--)
#define clr cin.ignore(numeric_limits<streamsize>::max(), '\n')
#define all(container) (container).begin(), (container).end()
#define rall(container) (container).rbegin(), (container).rend()
#define FILL(x, val) memset(x, val, sizeof(x))
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

using namespace std;

typedef long long i64; 
typedef vector<int> vi;
typedef vector<i64> vi64;
typedef pair<int, int> pi;
typedef vector<pair<int, int>> vpi;

char str[101];

int main(void) {
	scanf("%s", str);
	int cnt[26] = {0};
	forn(i, (int)strlen(str)) cnt[str[i]-'a'] += 1;
	for (int x : cnt) {
		if (x % 2 != 0) {
			printf("No\n");
			return 0;
		}
	}
	printf("Yes\n");
	return 0;
}

Measured memory_bytes: 256
#![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 v = read_vec::<usize>();
    let (n, m, k) = (v[0], v[1], v[2]);
    let mut uft = UnionFindTree::new(n);
    let mut count = vec![0; n];

    for i in 0..m {
        let v = read_vec::<usize>();
        let (a, b) = (v[0] - 1, v[1] - 1);
        uft.unite(a, b);
        count[a] += 1;
        count[b] += 1;
    }
    let mut blocks = vec![];
    for i in 0..k {
        let v = read_vec::<usize>();
        let (a, b) = (v[0] - 1, v[1] - 1);
        blocks.push((a, b));
    }

    let mut ans = vec![0i64; n];
    for i in 0..n {
        ans[i] += (uft.get_size(i) - count[i] - 1) as i64;
    }

    for (a, b) in blocks {
        if uft.same(a, b) {
            ans[a] -= 1;
            ans[b] -= 1;
        }
    }
    for num in ans {
        print!("{} ", num);
    }
    println!("");
}

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()
}

#[derive(Debug, Clone)]
struct UnionFindTree {
    parent: Vec<isize>,
    size: Vec<usize>,
    height: Vec<u64>,
}

impl UnionFindTree {
    fn new(n: usize) -> UnionFindTree {
        UnionFindTree {
            parent: vec![-1; n],
            size: vec![1usize; n],
            height: vec![0u64; n],
        }
    }

    fn find(&mut self, index: usize) -> usize {
        if self.parent[index] == -1 {
            return index;
        }
        let idx = self.parent[index] as usize;
        let ret = self.find(idx);
        self.parent[index] = ret as isize;
        ret
    }

    fn same(&mut self, x: usize, y: usize) -> bool {
        self.find(x) == self.find(y)
    }

    fn get_size(&mut self, x: usize) -> usize {
        let idx = self.find(x);
        self.size[idx]
    }

    fn unite(&mut self, index0: usize, index1: usize) -> bool {
        let a = self.find(index0);
        let b = self.find(index1);
        if a == b {
            false
        } else {
            if self.height[a] > self.height[b] {
                self.parent[b] = a as isize;
                self.size[a] += self.size[b];
            } else if self.height[a] < self.height[b] {
                self.parent[a] = b as isize;
                self.size[b] += self.size[a];
            } else {
                self.parent[b] = a as isize;
                self.size[a] += self.size[b];
                self.height[a] += 1;
            }
            true
        }
    }
}


Measured memory_bytes: 12540
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(v) v.begin(), v.end()

int main(){
    
    int n, m, x;
    cin >> n >> m >> x;

    vector <int> cost(n);
    vector <vector <int> > a(n, vector<int> (m));
    rep(i,n){
        cin >> cost[i];
        rep(j,m){
            cin >> a[i][j];
        }
    }

    int mincost = 0;
    rep(i,n) mincost += cost[i];
    bool exist = false;

    for(int i=0; i < (1 << 12); i++){
        vector<int> sumabi (m,0);
        int costi = 0;
        bool oki = true;

        bitset<12> s(i);
        for(int k=0; k<n; k++){
            if(s.test(k)){
                costi += cost[k];
                rep(j,m){
                    sumabi[j] += a[k][j];
                }
            }
        }

        for(int j=0; j<m; j++){
            if(sumabi[j] < x){
                oki = false;
                break;
            }
        }
            
        if(oki){
            exist = true;
            if(costi < mincost) mincost = costi;
        }
    }

    if(exist) cout << mincost << endl;
    else cout << -1 << endl;
}


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

int main(){
	string s;
	cin >> s;
	int length = (int)s.size();
	for(int i = length -2; i >0; i -= 2){
		if(s.substr(0,i/2) == s.substr(i/2,i/2)){
			cout << i << endl;
			return 0;
		}
	}
}

// cout << fixed << setprecision(15) <<  << endl;

Measured memory_bytes: 3568
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		int[] p = new int[n];
		for (int i = 0; i < p.length; i++) {
			p[i] = Integer.parseInt(sc.next());
		}
		int count = 0;
		for (int i = 0; i < p.length; i++) {
			if (i + 1 != p[i]) {
				count++;
			}
		}
		if (count == 0 || count == 2) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
		sc.close();
	}
}

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

int main()
{
  int n, k;
  cin >> n >> k;
  vector<double> p(n);

  for (int i = 0; i < n; i++) {
    cin >> p[i];
    p[i] += 1;
    p[i] /= 2;
  }

  double ans = 0;
  for (int i = 0; i < k; i++) {
    ans += p[i];
  }

  double t = ans;
  for (int i = 0; i < n - k; i++) {
    t += p[i + k];
    t -= p[i];
    ans = max(ans, t);
  }
  cout << setprecision(8) << ans << endl;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
#include<cmath>
using namespace std;
string a;
long long c,k,k2;
int main()
{
	cin>>a;
	c=a.size();
	for(int i=0;i<c;i++)
	{
		if(a[i]=='C')k=1;
		if(a[i]=='F'&&k==1)
		{
			cout<<"Yes";
			return 0;
		}
	}
	cout<<"No";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
 
int main() {
    int x1,y1,x2,y2;
    cin >> x1 >> y1 >> x2 >> y2;
    cout << x2+y1-y2 << " " << y2+x2-x1 << " " << x1+y1-y2 << " " << y1+x2-x1 << endl;    
}


Measured memory_bytes: 3604
/*
 * a.c
 *
 *  Created on: 2017/06/13
 *      Author: AWV060608
 */

#include	<stdio.h>
//#include	<string.h>
//#include	<math.h>

int		main(void)
{
	int		H,W;
	int		i,j;

	while(1)
	{
		scanf("%d",&H);
		scanf("%d",&W);

		if((H==0) && (W==0))
		{
			break;
		}

		for(i=0; i<H; i++)
		{
			if( i== 0 || i== H-1)
			{
				for(j=0; j<W; j++)
				{
					printf("#");
				}
			}
			else
			{
				for( j=0; j<W; j++)
				{
					if( j==0 || j==W-1 )
					{
						printf("#");
					}
					else
					{
						printf(".");
					}
				}
			}
			printf("\n");
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 572
n = int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))

from itertools import permutations as pr
nums = range(1, n+1)
for i, num in enumerate(pr(nums)):
  lis = list(num)
  #print(lis)
  if lis == P:
    n_p = i
  if lis == Q:
    n_q = i
print(abs(n_p - n_q))

Measured memory_bytes: 40300
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define pb push_back
#define ss second
#define ff first
#define INF 300000000000001
#define ll_max 9000000000000000001
//#define mod 1000000007
#define PI 3.14159265358979323846L
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define db(args...) {string _ss = #args; replace(_ss.begin(), _ss.end(), ',' , ' '); stringstream ___s(_ss) ; debug(___s, args);}
using namespace std;
typedef vector<pair<ll,ll> > vll;
typedef vector<pair<int,int> > vii ;
typedef pair<ll,ll> pll;
const ll N = 100001;
const ll M = 1;
ll mod = 1000000007;
struct point {
    ll x, y;
    ll i;
};

void debug(stringstream &s){}
template <typename T, typename... Args>
void debug(stringstream &s, T a, Args... args)
{
    string word;
    s >> word;
    cout << word << " = " << a << endl;
    debug(s, args...);
}

ll fast_exp(ll x, ll n)
{
    if(n == 0) return 1;
    else if(n & 1)
        return fast_exp(x, n - 1) * x % mod;
    else
    {
        ll tmp = fast_exp(x, n >> 1);
        return tmp * tmp % mod;
    }
}

vector<int> p;
void soe(int n = 1000001)
{
    bool P[n];
    P[0] = P[1] = 1;
    for(int i = 2; i < n; i++)
    {
        if(!P[i])
        {
            p.pb(i);
            for(int j = i + i; j < n; j += i)
            P[j] = 1;
        }
    }
}

int main()
{
    fast;
    int _ = 1;
    //cin >> _;
    while(_--)
    {
        ll n, m, x = 0, y = 0, ans = 1, k = 0;
        string s, t;
        cin >> s >> t;
        if(s.size() + 1 != t.size()) ans = 0;
        for(int i = 0; i < s.size(); i++)
            if(s[i] != t[i]) ans = 0;
        if(ans)
            cout << "Yes\n";
        else
            cout << "No\n";
    }
    return 0;
}


Measured memory_bytes: 3656
h, w, a, b = map(int, input().split())
m = 10**9 + 7

fac = [1, 1]
inv = [1, 1]
finv = [1, 1]
for i in range(2, w+h+5):
    fac.append(fac[i-1] * i % m)
    inv.append(m - inv[m%i] * (m//i) % m)
    finv.append(finv[i-1] * inv[i] % m)

def nck(n, k):
    if n < k:
        return 0
    if n < 0 or k < 0:
        return 0
    return fac[n] * (finv[k] * finv[n-k] % m) % m


row = []
for i in range(h-a):
    row.append(nck(b+i, i))

ans = 0
for i in range(len(row)-1):
    ans += row[i] * nck(w-b-2 + h-1-i, h-1-i)
    ans %= m

ans += row[-1] * nck(w-b-1 + a, a)
ans %= m

print(ans)

Measured memory_bytes: 30504
#include <bits/stdc++.h>
 
#define rep(i, x, n) for (int i = x; i < n; i++)
typedef long long ll;
 
const int INF = 1e9 + 7;
 
using namespace std;
 
int main()
{
	cin.tie(0); ios::sync_with_stdio(false);
	int x, y, z, k;
	cin >> x >> y >> z >> k;

	vector<ll> A(x), B(y), C(z);
	priority_queue<ll> res;
	rep (i, 0, x)
	    cin >> A[i];
	rep (i, 0, y)
	    cin >> B[i];
	rep (i, 0, z)
	    cin >> C[i];
	sort(A.begin(), A.end(), greater<ll>());
	sort(B.begin(), B.end(), greater<ll>());
	sort(C.begin(), C.end(), greater<ll>());

	for (int i = 0; i < x; i++)
	    for (int j = 0; j < y; j++)
		for (int l = 0; l < z; l++) {
		    if ((i + 1) * (j + 1) * (l + 1) <= k)
			res.push(A[i] + B[j] + C[l]);
		    else
			break;
		}

	rep (i, 0, k) {
	    cout << res.top() << endl;
	    res.pop();
	}


	return 0;
}


Measured memory_bytes: 1404
#include <bits/stdc++.h>
using namespace std;
int gcd(int a,int b){
  if(a<b){
    swap(a,b);
  }
  int r;
  while(b>0){
    r = a%b;
    a = b;
    b = r;
  }
  return a;
}
int main(){
  int n,k;
  cin >> n >> k;
  vector<int> a(n);
  for(int i=0; i<n; i++){
    cin >> a[i];
  }
  int g[n];
  for(int i=0; i<n; i++){
    if(i==0){
      g[i] = a[0];
    }
    g[i] = gcd(g[i-1],a[i]);
  }
  sort(a.begin(),a.end());
  if(k%g[n-1]==0 && k<=a[n-1]){
    cout << "POSSIBLE" << endl;
  }else{
    cout << "IMPOSSIBLE" << endl;
  }
}

Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int main(){
  int sx, sy, tx, ty;

  cin >> sx >> sy >> tx >> ty;

  for(int i = 0;i < ty - sy;i++){
    cout << 'U';
  }
  for(int i = 0;i < tx - sx;i++){
    cout << 'R';
  }

  for(int i = 0;i < ty - sy;i++){
    cout << 'D';
  }
  for(int i = 0;i < tx - sx;i++){
    cout << 'L';
  }

  cout << 'L';
  for(int i = 0;i <= ty - sy;i++){
    cout << 'U';
  }
  for(int i = 0;i <= tx - sx;i++){
    cout << 'R';
  }
  cout << 'D';

  cout << 'R';
  for(int i = 0;i <= ty - sy;i++){
    cout << 'D';
  }
  for(int i = 0;i <= tx - sx;i++){
    cout << 'L';
  }
  cout << 'U' << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <numeric>
#include <vector>
using namespace std;
#define repl(i, l, r) for (ll i = l; i < r; i++)
#define rep(i, n) repl(i, 0, n)
using ll = long long;
const ll MOD = 1000000007;
ll modpow(ll a, ll n) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % MOD;
		a = a * a % MOD;
		n >>= 1;
	}
	return res;
}
int main() {
	int n;
	cin >> n;
	ll a[n], b[n];
	map<pair<ll, ll>, ll> mp;
	int z = 0;
	rep(i, n) {
		cin >> a[i] >> b[i];
		if (a[i] == 0 and b[i] == 0) {
			z++;
			continue;
		} else if (a[i] == 0)
			a[i] = 0, b[i] = 1;
		else if (b[i] == 0)
			a[i] = 1, b[i] = 0;
		else {
			ll g = gcd(a[i], b[i]);
			a[i] /= g, b[i] /= g;
			if (a[i] < 0) a[i] *= -1, b[i] *= -1;
		}
		mp[{a[i], b[i]}]++;
	}
	map<pair<ll, ll>, ll> seen;
	rep(i, n) {
		ll na = a[i], nb = b[i];
		if (seen[{na, nb}]) continue;
		mp[{na, nb}] = modpow(2, mp[{na, nb}]) - 1;
		if (nb > 0) {
			mp[{na, nb}] += modpow(2, mp[{nb, -na}]) - 1;
			mp[{nb, -na}] = 0;
			seen[{nb, -na}] = 1;
		} else {
			mp[{na, nb}] += modpow(2, mp[{-nb, na}]) - 1;
			mp[{-nb, na}] = 0;
			seen[{-nb, na}] = 1;
		}
		mp[{na, nb}] %= MOD;
		seen[{na, nb}] = 1;
	}
	ll ans = 1;
	for (auto p : mp) {
		ans *= p.second + 1;
		ans %= MOD;
	}
	ans = (ans - 1 + z + MOD) % MOD;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 56680
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>

using namespace std;

int main()
{
    int a;
    string s;
    cin >> a >> s;
    if(a >= 3200) cout << s <<endl;
    else cout << "red" <<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<iomanip>
#include <math.h>
using namespace std;

int main(){
    int n;
    cin>>n;
    string s="abcdefghijklmnopqrstuvwxyz";
    vector<string>a(100);
    vector<int>b(26);
    vector<int>c(26);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    for(int i=0;i<26;i++){
        b[i]=count(a[0].begin(), a[0].end(), s[i]);
    }
    for(int i=1;i<n;i++){
        for(int j=0;j<26;j++){
            c[j]=count(a[i].begin(), a[i].end(), s[j]);
        }
        for(int j=0;j<26;j++){
            if(c[j]<b[j]){
                b[j]=c[j];
            }
        }
    }
    for(int i=0;i<26;i++){
        for(int j=0;b[i]>j;j++){
            cout<<s[i]<<flush;
        }
    }
    cout<<endl;
    
    return 0;
}


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

#define int long long
#define pb emplace_back
#define mp make_pair
#define f(i,a,n) for(int i=a ; i<n ; i++)
#define F first
#define S second
#define fast ios:: sync_with_stdio(false),cin.tie(0);

int32_t main(){
	fast;
	int n;
	cin >> n;
	
	vector<pair<int,int>>v(n);
	
	for(int i=0; i<n ; i++) cin >> v[i].F >> v[i].S;
	
	vector<int> p;
	for(int i=0; i<n ; i++) p.pb(i);
	double ans = 0.0;
	int cnt = 0;
	do
	{
		cnt++;
		for(int i=1 ; i<n; i++)
			ans += sqrt((double)(pow(v[p[i]].F-v[p[i-1]].F,2) + pow(v[p[i]].S-v[p[i-1]].S,2)));
	}
	while(next_permutation(p.begin(),p.end()));
	ans = ans/(double)cnt;
	cout << setprecision(10) << ans;
}


Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <set>
#include <unordered_set>
#include <vector>
#include<valarray>
#include<map>
#include <utility>
#include <deque>
#include <queue>
using namespace std;

int main()
{

    long long N;
    cin>>N;
    string s;
    char arr[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
    int x=0, y=0,count=0;
    while(true){
        if(N<26){

            break;
        }
        else{
            if(N%26!=0){
                N--;
                count++;
            }
            else if(N%26==0 && count==0){
                s+=arr[25];
                N-=1;
                N=N/26;
            }
            else{
                s+=arr[count-1];
                N=N/26;
                count=0;
            }
        }
    }
    if(N==26)
    s+='a';
else if(N>=1&&N<26) {



    s += arr[N-1];
}


    reverse(s.begin(),s.end());
    cout<<s;


    return 0;
}

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

int main(){
  int n;
  cin>>n;
  vector<int>x;
  for(int i=0;i<n;i++){
    int k;
    cin>>k;
    x.push_back(k);
  }
  int ans = 0;
  for(int i=0;i<n;i++){
    if(i!=0&&i!=n-1){
      vector<int>med;
      med.push_back(x[i]);
      med.push_back(x[i+1]);
      med.push_back(x[i-1]);
      sort(med.begin(),med.end());
      if(x[i]==med[1]){
        ans++;
      }
    }
  }
  cout<<ans<<endl;
  return 0;
}


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

typedef pair<int, int> P;
const int INF = 1e9;

int main() {
  int h, w; cin >> h >> w;
  vector<vector<char>> s(h, vector<char>(w));
  rep(i, h) rep(j, w) cin >> s[i][j];
  int ans = 0;
  int dx[4] = {-1, 0, 1, 0}, dy[4] = {0, -1, 0, 1};
  rep(sx, h) rep(sy, w) {
    if (s[sx][sy] == '#') continue;
    vector<vector<int>> dist(h, vector<int>(w, INF));
    queue<P> q;
    dist[sx][sy] = 0;
    q.push(P(sx, sy));
    while (!q.empty()) {
      int x = q.front().first, y = q.front().second; q.pop();
      rep(dir, 4) {
        int nx = x + dx[dir], ny = y + dy[dir];
        if (nx < 0 || h <= nx || ny < 0 || w <= ny) continue;
        if (s[nx][ny] == '#') continue;
        if (dist[nx][ny] == INF) {
          dist[nx][ny] = dist[x][y] + 1;
          q.push(P(nx, ny));
        }
      }
    }
    rep(i, h) rep(j, w) {
      if (dist[i][j] == INF) continue;
      ans = max(ans, dist[i][j]);
    }
  }
  cout << ans << endl;
  return 0;
}

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

int main(void){
   int a,b;
   cin>>a>>b;
   string s1=to_string(a);
   string s2=to_string(b);
   string s3=s1+s2;
   int result=atoi(s3.c_str());
   for(int i=1;i<=1050;i++){
      if(i*i==result){
         cout<<"Yes"<<endl;
         return 0;
      }
   }
   cout<<"No"<<endl;
   return 0;
}



Measured memory_bytes: 256
def prime_factorize(n):
    x=2
    lim=int(n**0.5)
    factors=[]
    while n!=1 and x<=lim:
        if n%x==0:
            n//=x
            factors.append(x)
        else:
            x+=1
    if n!=1:
        factors.append(n)
    return factors

n=int(input())
print(n,': ',sep='',end='')
print(*prime_factorize(n))


Measured memory_bytes: 5636
#include <iostream>

using namespace std;

int main() {
    int a, b;
    cin>>a>>b;
    if (a%3 == 0 || b%3 == 0 || (a+b)%3==0)
    {
        cout<<"Possible";
    }
    else
    cout<<"Impossible";
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<=(b);++i)
#define per(i,a,b) for(int i=a;i>=(b);--i)
#define mem(a,x) memset(a,x,sizeof(a))
#define pb push_back
#define pi pair<int, int>
#define mk make_pair
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll a,b,n;
void solve()
{
    cin>>a>>b>>n;
    if(b==1){
        printf("0");return ;
    }
    ll x=min(n,b-1);
    ll t1=(a*x)/b,t2=x/b*a;
    printf("%lld\n",t1-t2);
}
int main()
{
	///int _;cin>>_;while(_--)
	solve();
}


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

#define rep(i, a, b) for(int i = (a); i < (b); ++i)
#define per(i, a, b) for(int i = (b)-1; i >= (a); --i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fst first
#define snd second

template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pii> vii;

const ll mod = 1e9+7;
const int N = 512345;
vl fac;

ll modpow(ll b, ll e) {
  ll ans = 1;
  while (e) {
    if (e&1) ans *= b;
    b *= b;
    b %= mod;
    ans %= mod;
    e >>= 1;
  }
  return ans;
}

ll inv(ll x) { return modpow(x, mod-2); }

ll ncr(ll n, ll r) {
  if (r < 0 or r > n) return 0;
  return (fac[n] * inv(fac[r])%mod) * inv(fac[n-r]) % mod;
}

int main() {
  cin.tie(0)->sync_with_stdio(0);
  cin.exceptions(cin.failbit);

  fac.pb(1);
  rep(i,1,N) fac.pb(fac.back()*i%mod);

  int h, w, n;
  cin >> h >> w >> n;

  vii bad(n);
  rep(i,0,n) cin >> bad[i].fst >> bad[i].snd;
  bad.eb(h,w);
  sort(all(bad));

  vl ans;
  for (auto [x, y] : bad) ans.pb(ncr(x+y-2, x-1));

  rep(i,0,n) {
    auto [x1, y1] = bad[i];
    rep(j,0,n+1) {
      auto [x2, y2] = bad[j];
      if (x2 < x1 or y2 < y1 or j==i) continue;
      ans[j] -= ans[i]*ncr(x2-x1+y2-y1, x2-x1)%mod;
      ans[j] %= mod;
    }
  }

  ans[n] %= mod; ans[n] += mod; ans[n] %= mod;
  cout << ans[n] << '\n';

}

Measured memory_bytes: 7364
using System;
using System.Diagnostics;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        var t = new int[n];
        var x = new int[n];
        var y = new int[n];
        for (int i = 0; i < n; i++)
        {
            string[] cin = Console.ReadLine().Split().ToArray();
            t[i] = int.Parse(cin[0]);
            x[i] = int.Parse(cin[1]);
            y[i] = int.Parse(cin[2]);
        }
        bool flag = false;

        var now = 0;
        var point = new int[2];
        point[0] = 0;
        point[1] = 0;
        for (int i = 0; i < n; i++)
        {
            int l = Math.Abs(x[i] - point[0]) + Math.Abs(y[i] - point[1]);
            if (t[i] - now < l)
            {
                flag = true;
                break;
            }
            if (((t[i] - now) % 2) != (l % 2))
            {
                flag = true;
                break;
            }
        }

        if (flag) Console.WriteLine("No");
        else Console.WriteLine("Yes");
    }
}

Measured memory_bytes: 17300
#include<iostream>
#include<algorithm>

using namespace std;

int main(){
  int input=0;
  int a[100];
  int b[100][2];
  for(int i=0;i<100;i++){
    for(int j=0;j<2;j++){
      b[i][j]=0;
    }
  }
  int n=0;
  while(cin>>input){
    a[n]=input;
    n++;
  }
  sort(a,a+n);
  int i=0,j=0;
  for(i=0;i<n;i++){
    if(i==0){
      b[0][0]=a[0];
      b[0][1]++;
    }
    else if(b[j][0]==a[i]){
      b[j][1]++;
    }
    else{
      b[++j][0]=a[i];
      b[j][1]++;
    }
  }
  int max=b[0][1];
  for(int k=0;k<=j;k++){
    if(max<b[k][1]){
      max=b[k][1];
    }
  }
  int out[100];
  int m=0;
  for(int k=0;k<=j;k++){
    if(max==b[k][1]){
      out[m]=b[k][0];
      m++;
    }
  }
  for(int p=0;p<m;p++){
    cout<<out[p]<<"\n";
  }
  return 0;
}

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

int main(void) {
	int N, K;
	scanf("%d %d", &N, &K);
	if (K == 1) printf("0\n");
	else printf("%d\n", (N - (K - 1)) - 1);
	return 0;
}


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

using namespace std;

typedef long long ll;
typedef long double ld;
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  if (n % 1000 == 0) {
    cout << "0\n";
    return 0;
  }
  cout << 1000 - n % 1000 << "\n";
  return 0;
}


Measured memory_bytes: 3648
a = [list(map(int, input().split())) for _ in range(3)]
n = int(input())
b = [list(map(int, input().split())) for _ in range(n)]

for k in range(n):
    for i in range(3):
        for j in range(3):
            if a[i][j] == b[k][0]:
                a[i][j] = 0

ans = "No"

for i in range(3):
    if a[i][0] == a[i][1] == a[i][2] == 0:
        ans = "Yes"
    if a[0][i] == a[1][i] == a[2][i] == 0:
        ans = "Yes"
        
if a[0][0] == a[1][1] == a[2][2] == 0:
    ans = "Yes"
if a[0][2] == a[1][1] == a[2][0] == 0:
    ans = "Yes"

print(ans)

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

int main() {
    int N, K, Q, S = 0; cin >> N >> K >> Q;
    vector<int> A(Q), cnt(N, 0);
    for (int i = 0; i < Q; i++) {
        cin >> A.at(i);
        cnt.at(A.at(i) - 1)++;
    }
    for (int i = 0; i < N; i++) {
        if (Q - cnt.at(i) >= K) {
            cout << "No" << endl;
        }
        else {
            cout << "Yes" << endl;
        }
    }
}

Measured memory_bytes: 1408
#include<stdio.h>
void trace(int A[], int N)
{
	int i;
	for (i = 0; i < N; i++)
	{
		if (i > 0) printf(" ");
		printf("%d", A[i]);
	}
	printf("\n");
}

void insertionSort(int A[], int N)
{
	int j, i, v;
	for ( i = 1; i < N; i++)
	{
		v = A[i];
		j = i - 1;
		while (j >= 0 && A[j] > v)
		{
			A[j + 1] = A[j];
			j--;
		}
		A[j + 1] = v;
		trace(A, N);
	}
}

int main()
{
	int N, i, j;
	int A[100];

	scanf("%d", &N);
	for ( i = 0; i < N; i++)
	{
		scanf("%d", &A[i]);
	}
	trace(A, N);
	insertionSort(A, N);

	return 0;
}

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

int main ()
{
    string str;
    int a[26] = {0};
    while(getline(cin, str))
    {
        for (int i = 0;i < str.size();i++)
        {
            if (97 <= str[i] && str[i] < 123)
            {
                a[str[i] - 97]++;
            }
            else if (65 <= str[i] && str[i] < 91)
            {
                a[str[i] - 65]++;
            }
        }
    }
    
    for (int i = 0;i < 26;i++)
    {
        char c = i+97;
        cout << c << " : " << a[i] << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3100