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

using namespace std;

const int MAX = 1005;
const int md = 1000000007;

int prime[MAX], a[MAX];

int mul(int x, int y) {
	return (long long)x * y % md;
}

void sieve() {
	for (int i = 0; i < MAX; i++) {
		prime[i] = i;
	}	
	prime[0] = prime[1] = 1;
	for (int i = 4; i < MAX; i += 2) {
		prime[i] = 2;
	}
	for (int i = 3; i * i < MAX; i += 2) {
		if (prime[i] == i) {
			for (int j = i * i; j < MAX; j += 2 * i) {
				prime[j] = i;
			}
		}
	}
}

void solve(int x) {
	while (x > 1) {
		int pr = prime[x];
		int e = 0;
		while (x % pr == 0) {
			x /= pr;
			e++;
		}
		a[pr] += e;
	}
}

int main() {
	sieve();
	int n;
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) {
		solve(i);
	}
	int ans = 1;
	for (int i = 1; i <= n; i++) {
		if (!a[i]) continue;
		ans = mul(ans, a[i] + 1);		
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;

namespace A
{
    partial class Program
    {
        public IEnumerable<string> Solve()
        {
            string res = "";

            var n = Num;
            var x = Num;
            var ls = Nums(n);

            var d = 0L;
            var r = 1;
            foreach (var l in ls)
            {
                d += l;
                if (d <= x)
                    r++;
            }
            res = r.ToString();

            yield return res;
        }
    }

    class StartingPoint
    {
        static void Main(string[] args)
        {
            if (args?.Any() == true)
            {
                var assembly = Assembly.GetExecutingAssembly();
                var resourceName = "AtCoder.Resources.In.txt";
                var stream = assembly.GetManifestResourceStream(resourceName);
                var streamReader = new StreamReader(stream, Encoding.UTF8);
                var str = streamReader.ReadToEnd();
                var textReader = new StringReader(str);
                Console.SetIn(textReader);
            }

            try
            {
                foreach (var s in new Program().Solve())
                {
                    Console.WriteLine(s);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                if (args?.Any() != true)
                    throw e;
            }

            if (args?.Any() == true)
                Console.ReadLine();
        }
    }

    partial class Program
    {
        long[] Nums(long count) => Enumerable.Range(0, (int)count).Select(_ => Num).ToArray();

        long Num => long.Parse(Str);

        StringBuilder sb = new StringBuilder();

        string Str => GetStr();
        string GetStr()
        {
            sb.Clear();

            int r = 0;
            bool? b = null;
            do
            {
                r = Console.Read();
                b = IsBreak(r);
            } while (b == true);

            if (b == null)
                throw new Exception("input error: unexpected end of stream");

            do
            {
                sb.Append((char)r);
                r = Console.Read();
                b = IsBreak(r);
            } while (b == false);

            return sb.ToString();
        }

        bool? IsBreak(int c)
        {
            switch (c)
            {
                case -1:
                    return null;
                case (int)' ':
                case (int)'\n':
                case (int)'\r':
                    return true;
                default:
                    return false;
            }
        }
    }
}

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

int main()
{
  int n;
  while (cin >> n) {
    if (n == 0)
      break;

    vector<string> field(n);
    for (int i = 0; i < n; ++i)
      cin >> field[i];

    vector<vector<int> > dp(n, vector<int>(n));
    for (int i = 0; i < n; ++i) {
      if (field[i][0] == '.')
	dp[i][0] = 1;
      else
	dp[i][0] = 0;
      if (field[0][i] == '.')
	dp[0][i] = 1;
      else
	dp[0][i] = 0;
    }

    int ans = 0;
    for (int i = 1; i < n; ++i) {
      for (int j = 1; j < n; ++j) {
	if (field[i][j] == '*')
	  continue;
	dp[i][j] = min(dp[i-1][j-1], min(dp[i-1][j], dp[i][j-1]))+1;
	ans = max(ans, dp[i][j]);
      }
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include <cstdio>
#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 <complex>
#include <stack>
#include <queue>
#include <iomanip>
using namespace std;
#define INF 1e9
#define PI acos(-1)
typedef long long ll;



int main() {
	
	int n;
	string s;
	cin >> n >> s;
	int ans = -INF;

	for (int i = 0; i < n; i++) {
		set<char> c = {};

		int cnt = 0;
		for (int j = 0; j <= i; j++) {
			c.insert(s[j]);
		}

		bool al[30] = { false };
		for (int j = i + 1; j < n; j++) {
			if (!al[s[j] - 'a'] && c.find(s[j]) != c.end()) {
				cnt++;
				al[s[j] - 'a'] = true;
			}
		}
		ans = max(ans, cnt);

	}


	cout << ans << endl;

	return 0;
}

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

using namespace std;

// repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

// container util
#define all(x) (x).begin(), (x).end()

// debug
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x)                                         \
  cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
       << " " << __FILE__ << endl;

// typedef
typedef long long lint;
typedef unsigned long long ull;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;

// constant
const int MOD = (int)1e9 + 7;
const int INF = (int)1e18;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

// conversion
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

//
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() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  int n, l;
  cin >> n >> l;
  int ans = 0;
  bool f = true;
  FOR(i, 1, n + 1) { ans += l + i - 1; }
  int res = 1e9;
  int p = 0;
  FOR(i, 1, n + 1) {
    int tmp = l + i - 1;
    tmp = ans - tmp;

    if (abs(ans - tmp) < res) {
      res = min(res, abs(ans - tmp));
      p = tmp;
    }
  }

  cout << p << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n,k,a[8848488],ans;
int cmp(int a,int b){
	return a>b;
}
int main(){
	cin>>n>>k;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	sort(a,a+n,cmp);
	for(int i=0;i<k;i++){
		ans+=a[i];
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <math.h>
#include <complex>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <functional>
#include <assert.h>
#define int long
#define ll long long
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define SZ(x) x.size()
#define fi first
#define se second
const int INF = 1e9;
using namespace std;

template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;

using pi=pair<int,int>;
using vi=vc<int>;

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(20);

    int N,M; cin >> N >> M;
    if(N==1 && M==1) {
        cout << 1 << endl;
    }
    else if(N==1){
        cout << M-2 << endl;
    }
    else if(M==1){
        cout << N-2 << endl;
    }
    else {
        cout << (N-2)*(M-2) << endl;
    }
}


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

int main() {
  long A, B, K;
  cin >> A >> B >> K;
  if (A > K) {
    cout << (A-K) <<" " << B << endl;
    return 0; 
  }
  if (A+B > K) {
    cout << "0 " << A+B-K << endl;
    return 0;
  }  
  cout << "0 0" << endl;
  return 0;
}


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

using namespace std;

int main()
{
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if((a*b) > (c*d))
    cout << a*b << endl;
  else if ( (a*b) <= (c*d))
    cout << c*d << endl;
return 0;

}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <climits>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <functional>
#include <set>
#include <numeric>
#include <stack>
#include <utility>
#include <time.h>
#include <iterator>
//#include "util.h"

using namespace std;
typedef unsigned uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int, int> pii;

//呪文
template <typename _KTy, typename _Ty> ostream& operator << (ostream& ostr, const pair<_KTy, _Ty>& m) { cout << "{" << m.first << ", " << m.second << "}"; return ostr; }
template <typename _KTy, typename _Ty> ostream& operator << (ostream& ostr, const map<_KTy, _Ty>& m) { if (m.empty()) { cout << "{ }"; return ostr; } cout << "{" << *m.begin(); for (auto itr = ++m.begin(); itr != m.end(); itr++) { cout << ", " << *itr; } cout << "}"; return ostr; }
template <typename _Ty> ostream& operator << (ostream& ostr, const vector<_Ty>& v) { if (v.empty()) { cout << "{ }"; return ostr; }	cout << "{" << v.front(); for (auto itr = ++v.begin(); itr != v.end(); itr++) { cout << ", " << *itr; }	cout << "}"; return ostr; }
template <typename _Ty> ostream& operator << (ostream& ostr, const set<_Ty>& s) { if (s.empty()) { cout << "{ }"; return ostr; } cout << "{" << *(s.begin()); for (auto itr = ++s.begin(); itr != s.end(); itr++) { cout << ", " << *itr; }	cout << "}"; return ostr; }
template <typename _KTy, typename _Ty> istream& operator >> (istream& istr, pair<_KTy, _Ty>& m) { cin >> m.first >> m.second; return istr; }
template <typename _Ty> istream& operator >> (istream& istr, vector<_Ty>& v) { for (size_t i = 0; i < v.size(); i++) cin >> v[i]; return istr; }
ll modpow(ll n, ll p, ll m) { ll result = 1; while (p > 0) { if (p & 1) result = (result * n) % m; p >>= 1; n = (n * n) % m; } return result; }
#define PI 3.14159265358979323846
#define EPS 1e-8
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define all(x) (x).begin(), (x).end()
#define fake false



int main() {
	int A, B, C, D;
	cin >> A >> B >> C >> D;
	int push[128] = {};
	
	push[A]++; push[C]++;
	push[B]--; push[D]--;

	for (int i = 0; i < 100; i++) {
		push[i + 1] += push[i];
	}
	int ans = 0;
	for (int i = 0; i <= 100; i++) {
		if (push[i] == 2) ans++;
	}
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 256
#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

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

int solve()
{
    ll N, A, B;

    std::cin >> N >> A >> B;

    cout << (N / (A + B)) * A + std::min(A, N - (N / (A + B) * (A + B))) << endl;

    return 0;
}

int main()
{
//    std::cout << solve() << std::endl;
    solve();

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,N) for (int i = 0; i < (N); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main(void){
int n, m;
cin >> n >> m;

cout << (n - 1) * (m - 1) << endl;
}


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

using namespace std;

int main() {
	int N;
	scanf("%d", &N); 
	int nx = 0;
	int ny = 0;
	int nt = 0;
	for (int i = 1; i <= N; i++) {
		int x;
		int y;
		int t;
		scanf("%d%d%d", &t, &x, &y);
		int haveTime = t - nt;
		int haveRoad = abs(x - nx) + abs(y - ny);
		if (haveTime < haveRoad || (haveTime % haveRoad) % 2) {
			printf("No\n");
			return 0;
		}
		nx = x;
		ny = y;
		nt = t;
	}
	printf("Yes\n");
	return 0;
}

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

using namespace std;

int main(){
    int n, m;
    cin >> n >> m;
    int x[m];
    for(int i = 0; i < m; i++){
        cin >> x[i];
    }
    sort(x, x + m);
    int d[m-1];
    for(int i = 0; i < m - 1; i++){
        d[i] = x[i+1] - x[i]; 
        // cout << d[i] << '\n';
    }
    sort(d, d + m - 1, greater<int>());
    int ans = 0;
    if (n >= m) {
        ans = 0;
    }else{
        ans += x[m-1] - x[0];
        for(int i = 0; i < n - 1; i++){
            ans -= d[i];
        }
    }
    cout << ans << '\n'; 
}

Measured memory_bytes: 1024
def goodinteger(s):

    ans = "No"

    for i in range(2):
        if s[i] == s[i + 1] and s[i] == s[i + 2]:
            ans = "Yes"

    return ans

def main():
    s = str(input())
    print(goodinteger(s))

if __name__ == '__main__':
    main()


Measured memory_bytes: 38384
/* ***********************************************
Author        :kuangbin
Created Time  :2013/11/15 16:30:39
File Name     :G.cpp
************************************************ */

#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <stdlib.h>
#include <time.h>
using namespace std;
const int INF = 0x3f3f3f3f;
struct Edge
{
	int to,next;
	int w;
}edge[20010];
int head[110];
int tot;
void addedge(int u,int v,int w)
{
	edge[tot].to = v;
	edge[tot].next = head[u];
	edge[tot].w = w;
	head[u] = tot++;
}

void init()
{
	tot = 0;
	memset(head,-1,sizeof(head));
}
int dp[110][1010];
int n,m;
bool vis[110][1010];
void SPFA(int s)
{
	queue<pair<int,int> >q;
	q.push(make_pair(s,0));
	for(int i = 1;i <= n;i++)
		for(int j = 0;j <= m;j++)
			dp[i][j] = INF;
	memset(vis,false,sizeof(vis));
	dp[s][0] = 0;
	vis[s][0] = true;
	while(!q.empty())
	{
		pair<int,int> tmp = q.front();
		int u = tmp.first;
		int k = tmp.second;
		//printf("%d %d\n",u,k);
		q.pop();
		vis[u][k] = false;
		for(int i = head[u];i != -1;i = edge[i].next)
		{
			int v = edge[i].to;
			//cout<<v<<endl;
		//	printf("%d %d\n",dp[v][k],dp[u][k] + edge[i].w);

			if(dp[v][k] > dp[u][k] + edge[i].w)
			{
			//	cout<<"*"<<endl;
				dp[v][k] = dp[u][k] + edge[i].w;
				if(!vis[v][k])
				{
					q.push(make_pair(v,k));
					vis[v][k] = true;
				}
			}

			if( dp[v][k+1] > dp[u][k] )
			{
				dp[v][k+1] = dp[u][k] ;
				if(!vis[v][k+1])
				{
					q.push(make_pair(v,k+1));
					vis[v][k+1] = true;
				}
			}
		}
	}
}
int main()
{
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    int c;
	while(scanf("%d%d%d",&n,&m,&c) == 3)
	{
		if(n == 0 && m == 0 && c == 0)break;
		init();
		int u,v,w;
		for(int i = 0;i < m;i++)
		{
			scanf("%d%d%d",&u,&v,&w);
			addedge(u,v,w);
		}
		SPFA(1);
	//	for(int i = 1;i <= n;i++)
	//		for(int j = 0;j <= m;j++)
	//			printf(" %d %d %d\n",i,j,dp[i][j]);
		int ans = m ;
		for(int i = 0;i <= m;i++)
			if(dp[n][i] <= c)
			{
				ans = i;
				break;
			}
		cout<<ans<<endl;
	}
    return 0;
}

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

namespace atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            int len = N.ToString().Length;

            int digit_sum = 0;
            int C = N;
            for (int i = 0; i < len; i++)
            {
                digit_sum += C % 10;
                C = C / 10;
            }

            if (N % digit_sum == 0) Console.WriteLine("Yes");
            else Console.WriteLine("No");

        }

    }
}



Measured memory_bytes: 13140
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<vector>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<stdio.h>
#include<iostream>
#include<numeric>
using namespace std;

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	int s;
	s = max(a, b);
	s = max(s, c);
	cout << 9 * s + a + b + c << endl;
}

Measured memory_bytes: 256
//ITP 1_5_A
#include <iostream>
using namespace std;

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

int main() {
	int h, w;
	while (cin >> h >> w, h) {
		rep(i, h) {
			rep(j, w) cout << "#";
			cout << endl;
		}
		cout << endl;
	}
}


Measured memory_bytes: 3092
#include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
#include <algorithm>
#include <cctype>
using namespace std;

int main() {
    int p, q, r;
    cin >> p >> q >> r;
    int t = max({ p, q, r });
    cout << p + q + r - t << endl;
}

Measured memory_bytes: 256
/*
RAone00
Rohit sharma
*/

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair < ll, ll > pll;
typedef vector < vector < ll > > matrix;
typedef vector < ll > vll;

#define pb push_back
#define debug(x) cout << (#x) << " is " << (x) << endl
#define fast_io() ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0)

const ll mod = 1e9 + 7;
const ll inf = LLONG_MAX;
const ll N = 1e5 + 10;

int main() {
    fast_io();
    int a, s;
    cin >> a >> s;
    int as[100];
    for (int i = s + 1 - a; i <= s + a - 1; ++i) {
      cout << i << " ";
    }
    return 0;
}


Measured memory_bytes: 256
/*Author: S7a2a7d */
    #include <bits/stdc++.h>
    #pragma GCC optimize("Ofast")
    using namespace std;
     
    #define pb push_back
    #define ll long long
    #define rep(i,n)  for(ll i=0;i<n;i++)
    #define repi(i,n)  for(ll i=1;i<=n;i++)
    #define mem(arr,x) memset(arr,x,sizeof(arr))
     
    #define mp make_pair
    #define f first
    #define s second
     
    const double PI = 3.1415926535897932;
    const int mod = 1e9 + 7;  
    const int inf = 1e9 + 5;
    ll lcm(ll a,ll b)
    {
        return (a*b)/__gcd(a,b);
    }

    int main()
    {
        
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
     
        ll d,t,s;
        cin>>d>>t>>s;
        double rem=(double)d/s;
        if(rem<=t)
        cout<<"Yes"<<'\n';
        else
        cout<<"No"<<'\n';
    
}


Measured memory_bytes: 3684
#include "bits/stdc++.h"

using namespace std;

int N,M,K,L,R,H,W;

//const long long int MOD=1000000007;
const long long int MOD=998244353;

long long int power(long long int x, long long int n, long long int M) {
	long long int ret = 1;
	long long int by = x;
	while (n) {
		if (n & 1) {
			ret *= by;
			ret %= M;
		}
		by *= by;
		by %= M;
		n >>= 1;
	}
	return ret;
}

int main(){
	
	cin>>N>>M;
	vector<vector<long long int>>dp(N+1,vector<long long int>(2*N+1));
	dp[0][0]=1;
	for(int i=0;i<N;i++){
		for(int j=i;j<=i*2;j++){
			dp[i+1][j+1]+=dp[i][j];
			dp[i+1][j+1]%=MOD;
			dp[i+1][j+2]+=dp[i][j];
			dp[i+1][j+2]%=MOD;
		}
	}
	vector<long long int>num(N+1);
	for(int i=0;i<=N;i++){
		for(int j=0;j<M;j++){
			num[i]+=dp[i][j];
			num[i]%=MOD;
		}
	}
	if(M&1){
		for(int i=M+1;i<=2*N;i+=2){
			num[i/2]++;
		}
	}
	//cout<<"hoge"<<endl;
	vector<long long int>by(N+1,1);
	vector<long long int>rev(N+1,1);
	for(int i=2;i<=N;i++){
		by[i]=by[i-1]*i;
		by[i]%=MOD;
		rev[i]=power(by[i],MOD-2,MOD);
	}
	for(int i=0;i<=N;i++){
	//	cout<<i<<" "<<num[i]<<endl;
	}
	for(int i=2;i<M-1;i+=2){
		if(M-1-i<0)break;
		for(int j=1;j<=N;j++){
			if(j+i>N)break;
			//cout<<i<<" "<<j<<" "<<M-1-i<<endl;
			if(j*2==M-1-i)continue;
			num[j+i]+=dp[j][M-1-i];
			num[j+i]%=MOD;
		}
	}
	long long int ans=0;
	for(int i=0;i<=N;i++){
	//	cout<<i<<" "<<num[i]<<endl;
		long long int add=by[N];
		add*=rev[i];
		add%=MOD;
		add*=rev[N-i];
		add%=MOD;
		add*=num[i];
		add%=MOD;
		ans+=add;
		ans%=MOD;
	}
	cout<<ans<<endl;
	return 0;
}

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

int main()
{
    long long N;
    cin >> N;

    string s;
    map<string, long long> M;
    long long ans = 0;
    for (int i = 0; i < N; i++)
    {
        cin >> s;
        sort(s.begin(), s.end());
        ans += M[s];
        M[s]++;
    }
    cout << ans << endl;
}


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

int main() {
  string s;
  cin >> s;
  
  if(s=="Sunny"){
    cout << "Cloudy" << endl;
  }
  else if(s=="Cloudy"){
    cout << "Rainy" << endl;
  }
  else{
    cout << "Sunny" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
const int MX = 20005;
typedef pair<int,P> Q;
typedef vector<Q> vq;

ll dp[MX];

int main() {
  int n;
  scanf("%d",&n);
  vq a(n);
  cin>>a;
  rep(i,n) {
    swap(a[i].fi, a[i].se.fi);
    a[i].fi += a[i].se.fi;
  }
  sort(rng(a));
  rep(i,n) {
    int s = a[i].fi, w = a[i].se.fi, x = a[i].se.se;
    drep(j,s+1) {
      if (j >= w) maxs(dp[j], dp[j-w]+x);
    }
    rep(j,MX-1) maxs(dp[j+1], dp[j]);
  }
  ll ans = dp[MX-1];
  cout<<ans<<endl;
  return 0;
}






















Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <math.h>
#include <bitset>
#include <queue>
#include <set>
#include <iomanip>
#include <math.h>
#include <assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr long long int infll = 1001001001001001LL;
constexpr int INF = 1000000007;
constexpr int inf = 1000000007;
const int mod = 1000000007;

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

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

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

inline double nCr(const int n, int r)
{
    if (n == 0)
    {
        return 0;
    }
    if (r == 0)
    {
        return 1;
    }
    if (r == 1)
    {
        return n;
    }
    if (n == r)
    {
        return 1;
    }

    if (r > n / 2)
    {
        r = n / 2;
    }

    double result = 1;
    for (double i = 1; i <= r; i++)
    {
        result *= (n - i + 1) / i;
    }

    return (result);
}

template <typename T>
T seinomi(T a)
{
    if (a > 0)
    {
        return a;
    }
    else
    {
        return 0;
    }
}

template <typename T>
map<T, T> soinsuubunkai(T n) //連想配列[素因数f.first][個数f.second]
{
    map<T, T> ret;
    for (T i = 2; i * i <= n; i++)
    {
        while (n % i == 0)
        {
            ret[i]++;
            n /= i;
        }
    }
    if (n != 1)
        ret[n] = 1;
    return ret;
}

template <typename T>
T ketasuu(T num)
{
    return std::to_string(num).length();
}

int kaizyou(int k)
{
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

template <class ForwardIt, class T>
void iota(ForwardIt first, ForwardIt last, T value)
{
    while (first != last)
    {
        *first++ = value;
        ++value;
    }
}

//nの階乗を計算
int factorial(int n)
{
    int answer = 1;
    while (n > 1)
    {
        answer *= n;
        n--;
    }
    return answer;
}
int comb(int n, int r)
{
    return factorial(n) / (factorial(r) * factorial(n - r));
}

long long modpow(long long a, long long n, long long mod)
{
    long long res = 1;
    while (n > 0)
    {
        if (n & 1)
            res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

//小数点以下10桁テンプレート（main関数内の最初に貼付け）
//std::cout << std::fixed << std::setprecision(10);

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


int main(){
ll n;
cin>>n;
cout<<pow(n,3)<<endl;
}









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

#define ll long long
#define MOD 1000000007

using namespace std;

const ll MAX = 1010000;

vector<ll> fac(MAX);
vector<ll> finv(MAX);
vector<ll> inv(MAX);

void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}

long long COM(int n, int k) {
  if (n < k)
    return 0;
  if (n < 0 || k < 0)
    return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
  ll X, Y;
  cin >> X >> Y;

  if ((2 * Y - X) % 3 != 0 || (2 * X - Y) % 3 != 0) {
    cout << 0 << endl;
    return 0;
  }

  ll x = (2 * Y - X) / 3, y = (2 * X - Y) / 3;

  COMinit();
  cout << COM(x + y, x) % MOD << endl;
}


Measured memory_bytes: 23936
#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;
typedef long long ll;
typedef double db;
typedef vector <ll> vll;
typedef pair <ll, ll> pll;
#define pb push_back
#define mp make_pair
#define MAX 1000000
#define mod 1000000007
#define all(_) _.begin(), _.end()
#define F first
#define S second
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

int main()
{
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL), cout.tie(NULL);
    string s;
    ll n, q, i, a, b, t;
    cin >> s >> q;
    a = 0;
    vector <char> ch;
    vector <pll> cp;
    while(q--)
    {
        char c;
        cin >> t;
        if(t == 1)
            a++;
        else
        {
            cin >> b >> c;
            cp.pb(mp(b, a));
            ch.pb(c);
        }
    }
    if(a % 2)
        reverse(all(s));
    string t1, t2;
    for(i = 0; i < ch.size(); i++)
    {
        ll val = a - cp[i].S;
        if((cp[i].F == 1 && val % 2 == 0) || (cp[i].F == 2 && val % 2))
            t1 += ch[i];
        else
            t2 += ch[i];
    }
    reverse(all(t1));
    cout << t1 + s + t2 << endl;
    return 0;
}

Measured memory_bytes: 6336
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <list>
#include <cmath>
#include <stack>
#include <string>
#include <cstring>
#include <numeric>
#include <iomanip>
#include <fstream>
using namespace std;
int main(){
	long long n,d;
	int ans=0;
	cin>>n>>d;
	for(int i=0;i<n;i++){
		long long x,y;
		cin>>x>>y;
		if(x*x+y*y<=d*d){
			ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3592
var GET=(function(){function f(s){return new g(s);}function g(s){this._s=s.trim().split("\n");this._y=0;}g.prototype.a=function(f){var s=this._s, y=this._y, r;if(typeof s[y]==="string")s[y]=s[y].split(" ").reverse();r=s[y].pop();if(!s[y].length)this._y++;return f?r:+r;};g.prototype.l=function(f){var s=this._s[this._y++].split(" ");return f?s:s.map(a=>+a);};g.prototype.m=function(n,f){var r=this._s.slice(this._y,this._y+=n).map(a=>a.split(" "));return f?r:r.map(a=>a.map(a=>+a));};g.prototype.r=function(n,f){var r=this._s.slice(this._y,this._y+=n);return f?r:r.map(a=>+a);};return f;})();
var o=GET(require("fs").readFileSync("/dev/stdin","utf8"));

console.log(main());
function main(){
  var a = o.l();
  return a[0] * a[1] / 2;
}

Measured memory_bytes: 7372
using System;
class Program {
  static void Main(string[] args) {
    string[] value = Console.ReadLine().Split();
    int r = int.Parse(value[0]);
    int D = int.Parse(value[1]);
    int x = int.Parse(value[2]);

    for (int i = 0; i < 10; ++i) {
      x = r * x - D;
      Console.WriteLine(x);
    }
  }
}


Measured memory_bytes: 11092
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet, BinaryHeap, VecDeque, BTreeSet, BTreeMap};
#[allow(unused_imports)]
use std::iter::FromIterator;
#[allow(unused_imports)]
use std::io::stdin;

mod util {
    use std::io::stdin;
    use std::str::FromStr;
    use std::fmt::Debug;

    #[allow(dead_code)]
    pub fn line() -> String {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.trim().to_string()
    }

    #[allow(dead_code)]
    pub fn gets<T: FromStr>() -> Vec<T>
    where
        <T as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|t| t.parse().unwrap())
            .collect()
    }
}

#[allow(unused_macros)]
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    get!($t)
                   ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    get!($($t),*)
                   ).collect::<Vec<_>>()
    };
    ($t:ty ;;) => {
        {
            let mut line: String = String::new();
            stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

#[derive(Eq, PartialEq, Clone, Debug)]
struct Rev<T>(pub T);

impl<T: PartialOrd> PartialOrd for Rev<T> {
    #[inline(always)]
    fn partial_cmp(&self, other: &Rev<T>) -> Option<Ordering> {
        other.0.partial_cmp(&self.0)
    }
}

impl<T: Ord> Ord for Rev<T> {
    #[inline(always)]
    fn cmp(&self, other: &Rev<T>) -> Ordering {
        other.0.cmp(&self.0)
    }
}

fn main() {
    let n = get!(usize);
    let mut aa = util::gets::<u64>();

    // aa.sort_by_key(|&a| Rev(a));
    aa.sort();

    let ans = (0..n)
        .map(|i| unsafe { aa.get_unchecked(n + i * 2) })
        .sum::<u64>();

    println!("{}", ans);
}


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

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

    vector<long long> num(k, 0);

    for (int i = 1; i <= n; i++) num[i%k]++;
    long res = 0;
    for (int a = 0; a < k; a++) {
        int b = (k-a) % k;
        int c = (k-a) % k;
        if ((b+c) % k != 0) continue;
        res += num[a] * num[b] * num[c];
    }

    cout << res << endl;

    return 0;
}

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

int main() {
    string S , T ;
    cin >> S >> T ;
    
    int cnt=0 ;
    
    for( int i=0 ; i< S.size() ; i++ ){
        if( S.at(i) == T.at(i) ){
            cnt++ ;
        }
    }
    
    if( cnt == S.size() ){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    
}


Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b;
  cin >> a >> b;
  long long total = 0;
  for (int i=a-1; i>0; i--) total += i;
  for (int i=b-1; i>0; i--) total += i;
  cout << total;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}
void neg() {cout << - 1 << endl;}
void unhap() {cout << ":(" << endl;}

int main() {
  string s;
  cin >> s;
  int n = s.size() + 1;
  vector<string> t(1);
  t.at(0).push_back(s.at(0));
  for (int i = 1; i < n - 1; i++) {
    if (s.at(i - 1) != s.at(i)) {
      string u;
      t.push_back(u);
    }
    t.at(t.size() - 1).push_back(s.at(i));
  }
  ll sum = 0;
  for (int i = 0; i < t.size(); i++)
    sum += (t.at(i).size() - 1) * t.at(i).size() / 2;
  for (int i = 0; i < t.size() - 1; i++) {
    if (t.at(i).at(0) == '>') continue;
    sum += max(t.at(i).size(), t.at(i + 1).size());
  }
  if (t.at(0).at(0) == '>') sum += t.at(0).size();
  if (t.at(t.size() - 1).at(0) == '<') sum += t.at(t.size() - 1).size();
  cout << sum << endl;
}

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

signed main()
{
    int n, t, a;
    cin >> n >> t >> a;
    double hoge = static_cast<double>(t - a);
    int closest = 1;
    double diff;
    cin >> diff;
    diff = abs(hoge - 0.006 * diff);
    for (int i = 2; i <= n; ++i) {
        double tmp;
        cin >> tmp;
        if (diff > abs(hoge - 0.006 * tmp)) {
            closest = i;
            diff = abs(hoge - 0.006 * tmp);
        }
    }
    cout << closest;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include<map>
#include<algorithm>
#include<set>
#include<iomanip>
#define rep(i,n) for(int i = 0;i < n;i++)
#define req(i,n) for(int i = 1; i<=n;i++)
#define rrep(i,n) for(int i = n-1;i >=0;i--)
#define ALL(a) a.begin(),a.end()
#define PI  acos(-1)
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T& val) {
    std::fill((T*)array, (T*)(array + N), val);
}
typedef long long int ll;
typedef long double ld;
const int MOD = 1e9 + 7;
int dx[4] = { 0,0,1,-1 }, dy[4] = { 1,-1,0,0 }, sum = 0, h, w;
ll gcd(ll a, ll b) {
    return b ? gcd(b, a % b) : a;
}
ll lcm(ll a, ll b) {
    return a * b / gcd(a, b);
}
int main() {
    int n, m; string s; cin >> n >> m; vector<int> v(n);
    rep(i, n) v[i] = i + 1;
    rep(i, m) {
        int a,b;char c;
        cin >> a >> c >> b;
        swap(v[a-1], v[b-1]);
    }for (int i : v) cout << i << endl;
}


Measured memory_bytes: 3080
N = int(input())
D = []

count = 0
for _ in range(N):
  D.append([int(i) for i in input().split()])

for i in D:
  if i[0] == i[1]:
    count += 1
  else:
    count = 0

  if count >= 3:
    break

if count == 3:
  print('Yes')
else:
  print('No')

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

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

struct UnionFind
{
    vector<int> parent;
    vector<int> siz;
    UnionFind(int n) : parent(n), siz(n) {
        for(int i = 0; i < n; i++) parent[i] = i;
        siz.assign(n, 1);
    }

    int root(int x){
        return x == parent[x] ? x : (parent[x] = root(parent[x]));
    }

    void unite(int x, int y){
        int rx = root(x), ry = root(y);
        if(rx != ry){
            parent[rx] = parent[ry];
            siz[ry] += siz[rx];
        }
        return;
    }

    bool isSame(int x, int y){
        return root(x) == root(y);
    }

    int count(int x){
        return siz[root(x)];
    }
};

int main()
{
    int n, m, k; cin >> n >> m >> k;
    UnionFind u(n);
    vector<int> candnum(n, 0);
    rep(i, m){
        int ai, bi; cin >> ai >> bi;
        --ai, --bi;
        u.unite(ai, bi);
        candnum[ai]--;
        candnum[bi]--;
    }

    vector<vector<int> > blocked(n);
    rep(j, k){
        int cj, dj; cin >> cj >> dj;
        --cj, --dj;
        blocked[cj].push_back(dj);
        blocked[dj].push_back(cj);
    }
    rep(i, n){
        candnum[i] += u.count(i);
        for(auto b : blocked[i]){
            if(u.isSame(i, b)) candnum[i]--;
        }
        cout << candnum[i]-1; // candnum includes i itself
        if(i == n-1) cout << endl;
        else cout << " ";
    }
    
    return 0;
}

Measured memory_bytes: 10680
#include <iostream>      // cout, endl, cin
#include <string>        // string, to_string, stoi
#include <vector>        // vector
#include <algorithm>     // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility>       // pair, make_pair
#include <tuple>         // tuple, make_tuple
#include <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <map>           // map
#include <cmath>         // sqrt
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <deque>         // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset>        // bitset
#include <bits/stdc++.h> // isupper, islower, isdigit, toupper, tolower
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, n) for (int i = (a); i < (n); i++)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> Pl;
typedef pair<int, int> P;
typedef tuple<ll, ll, string> Tlls;

// Greatest Common Divisor (最大公約数)
ll gcd(ll a, ll b)
{
  // Eucledean algorithm
  while (a)
  {
    if (a < b)
    {
      std::swap(a, b);
    }
    a %= b;
  }
  return b;
}

// Least Common Multiple 最小公倍数
ll lcm(ll a, ll b)
{
  return a / gcd(a, b) * b;
}

// key: value of prime factor素因数分解
// value: number of prime factor
map<ll, ll> prime_factorization(ll n)
{
  map<ll, ll> prime_factors;
  for (ll i = 2; i * i <= n; i++)
  {
    while (n % i == 0)
    {
      prime_factors[i]++;
      n /= i;
    }
  }
  if (n != 1)
    prime_factors[n] = 1;
  return prime_factors;
}

// 約数リスト約数の列挙
vector<ll> get_divisors(const ll n)
{
  vector<ll> divs;
  for (ll i = 1; i < (ll)sqrt((ld)n) + 1; i++)
  {
    if (n % i == 0)
    {
      divs.push_back(i);
      if (i != n / i)
      {
        divs.push_back(n / i);
      }
    }
  }

  // 必要に応じてソート
  // sort(divs.begin(), divs.end());

  return divs;
}

int main()
{
  ll N, M;
  ll ans = 0;
  cin >> N >> M;
  vector<ll> H(N);
  rep(i, N)
  {
    cin >> H.at(i);
  }
  vector<Pl> AB(M);
  vector<bool> ANS(N, true);
  rep(i, M)
  {
    cin >> AB.at(i).first >> AB.at(i).second;
    AB.at(i).first--;
    AB.at(i).second--;
  }
  // sort(AB.begin(), AB.end());

  rep(i, M)
  {
    if (H.at(AB.at(i).first) <= H.at(AB.at(i).second))
    {
      ANS.at(AB.at(i).first) = false;
    }
    if (H.at(AB.at(i).second) <= H.at(AB.at(i).first))
    {
      ANS.at(AB.at(i).second) = false;
    }
  }
  rep(i, N)
  {
    if (ANS.at(i))
    {
      ans++;
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 5700
#include <iostream>
#include <math.h>	
#include <string>
#include <vector>
#include <deque>
#include <cmath>
#include <map>
#include <algorithm>
#include <unordered_set>
#include <iomanip>
#include <set>
using namespace std;
typedef long long ll;
int main() {
	
	string a;
	cin >> a;
	if (a[0] == 'S')cout << "Cloudy" << endl;
	else if (a[0] == 'C')cout << "Rainy" << endl;
	else cout << "Sunny" << endl;
	return 0;
}

Measured memory_bytes: 256
while True:
    n, x = map(int, input().split())
    if n == 0 and x == 0:
        break
    cnt = 0
    for i in range( 1, n - 1):
        for j in range( i + 1, n ):
            for k in range( j + 1, n + 1 ):
                if i + j + k == x:
                    cnt += 1
    print(cnt)

Measured memory_bytes: 7716
#include <iostream>
#include <limits>
#include <map>
#include <set>
#include <tuple>
#include <vector>

template <class... Ts> using tuple_t = std::tuple<Ts...>;
template <class T, class U> using map_t = std::map<T, U>;
template <class T, class U> using pair_t = std::pair<T, U>;
template <class T> using vector_t = std::vector<T>;
template <class T> using set_t = std::set<T>;

uint64_t digit(uint64_t num, uint64_t base = 10) {
  uint64_t i = 0;
  while (num) {
    ++i;
    num /= base;
  }
  return i;
}

uint64_t digit_sum(uint64_t num, uint64_t base = 10) {
  uint64_t i = 0;
  while (num) {
    i += num % base;
    num /= base;
  }
  return i;
}

int min(vector_t<int> nums) {
  int min_ = std::numeric_limits<int>::max();
  for (auto &i : nums)
    if (min_ > i)
      min_ = i;
  return min_;
}
int first_min(vector_t<int> nums, int start = 0) {
  int min_ = min(nums);
  for (int i = start; i < nums.size(); ++i)
    if (nums[i] == min_)
      return i;
}

int first_not_min(vector_t<int> nums, int start = 0) {
  int min_ = min(nums);
  for (int i = start; i < nums.size(); ++i)
    if (nums[i] != min_)
      return i;
  return nums.size();
}

int f(int n, int k) {
  if ((n - 1) % (k - 1))
    return (n - 1) / (k - 1) + 1;
  else
    return (n - 1) / (k - 1);
}

int main() {
  int N, ai;
  std::cin >> N;
  vector_t<int> a;
  for (int i = 0; i < N; ++i) {
    std::cin >> ai;
    a.push_back(ai);
  }
  int n = 0;
  if (N == 2 && a[0] == a[1]) {
    std::cout << 1 << std::endl;
    return 0;
  }
  for (int i = 1; i < N - 1; ++i) {
    if (a[i - 1] == a[i]) {
      ++n;
      a[i] = -1;
    } else if (i == N - 2 && a[i] == a[i + 1])
      ++n;
  }
  std::cout << n << std::endl;
  return 0;
}


Measured memory_bytes: 256
w,h,n=map(int,input().split())
b=w
c=h
d=0
e=0
for i in range(n):
  x,y,a=map(int,input().split())
  if a==1:
    d=max(x,d)
  elif a==2:
    b=min(x,b)
  elif a==3:
    e=max(y,e)
  elif a==4:
    c=min(y,c)
if b<d or c<e:
  print(0)
else:
  print((b-d)*(c-e))

Measured memory_bytes: 9140
#include <bits/stdc++.h>
using namespace std;
int main() {
    string S, T;
    cin >> S >> T;
    int A, B;
    cin >> A >> B;
    string U;
    cin >> U;
    if(S == U) {
        A--;
    } else if(T == U) {
        B--;
    }
    cout << A << " " << B << endl;
}


Measured memory_bytes: 256
while 1:
    a,b,c = list(map(str,input().split()))
    num_a=int(a)
    num_c=int(c)
    if b=="+":
        print(num_a+num_c)
    elif b=="-":
        print(num_a-num_c)
    elif b=="*":
        print(num_a*num_c)
    elif b=="/":
        print(num_a//num_c)
    elif b=="?":
        break

Measured memory_bytes: 7692
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<cassert>
#define PB push_back
#define MP make_pair
#define sz(v) (in((v).size()))
#define forn(i,n) for(in i=0;i<(n);++i)
#define forv(i,v) forn(i,sz(v))
#define fors(i,s) for(auto i=(s).begin();i!=(s).end();++i)
#define all(v) (v).begin(),(v).end()
using namespace std;
typedef long long in;
typedef vector<in> VI;
typedef vector<VI> VVI;
void yes(){
  cout<<"Yes"<<endl;
  exit(0);
}
void no(){
  cout<<"No"<<endl;
  exit(0);
}
in n;
map<in,in> fq;
bool cn(in c){
  if(c<1)
    return 0;
  if(c>n)
    return 0;
  in x=fq[c];
  in y=fq[c-1];
  if(x==1)
    return 0;
  if(c<y+(x>0))
    return 0;
  if(c>y+(x/2))
    return 0;
  return 1;
}
int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin>>n;
  in mn=1e9;
  in mx=-2;
  in t;
  forn(z,n){
    cin>>t;
    mn=min(mn,t);
    mx=max(mx,t);
    ++fq[t];
  }
  if(mn+1<mx)
    no();
  bool isk=0;
  if(mn==mx)
    isk=cn(mx+1)|cn(mx);
  else
    isk=cn(mx);
  if(isk)
    yes();
  else
    no();
  return 0;
}


Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
int main()
{
   int y,m,d;
   char a,b;
   cin >> y >> a >> m >> b >> d;
   
   if(m <= 4){
       cout << "Heisei" << endl;
   }else{
       cout << "TBD" << endl;
   }
   return 0;
}

Measured memory_bytes: 256
from sys import stdin
import math
import fractions
from collections import deque
from collections import Counter
import itertools

INF = 10 ** 10

# N <= 2*10^5
# Q <= 2*10^5
N, Q = [int(x) for x in stdin.readline().rstrip().split()]
ab = [list(map(int, stdin.readline().rstrip().split())) for _ in range(N-1)]
px = [list(map(int, stdin.readline().rstrip().split())) for _ in range(Q)]

node_value = [0] * (N+1)
parent = [-1] * (N+1)

for a, b in ab:
    parent[b] = a

for p, x in px:
    node_value[p] += x

#print(parent)

ans = [0] * (N+1)

for i in range(1, N+1):
    ans[i] = node_value[i]
    if parent[i] != -1:
        ans[i] += ans[parent[i]]

print(*ans[1:], sep=" ")

Measured memory_bytes: 122328