akhauriyash/Code-Regression huggingface dataset:
a, b, c, d = map(int, input().split())
mod = 998244353

dp1 = [[0 for j in range(d)] for i in range(c)] # 一番下の行に黒一つは下に追加で得られた場合に限って良い (下に追加する前の盤を初期状態から作れるので)
dp2 = [[0 for j in range(d)] for i in range(c)] # その状態が右に追加することでしか得られない場合 (一番下の行に黒複数 or a==c)
dp2[a-1][b-1] = 1

for i in range(a-1, c):
    for j in range(b-1, d):
        if i==a-1 and j==b-1: continue
        if i-1 >= 0:
            dp1[i][j] = (j+1)*(dp1[i-1][j]+dp2[i-1][j])
            dp1[i][j] %= mod
        if j-1 >= 0:
            dp2[i][j] = dp1[i][j-1] + (i+1)*dp2[i][j-1]
            dp2[i][j] %= mod

ans = (dp1[c-1][d-1] + dp2[c-1][d-1]) % mod
print(ans)

Measured memory_bytes: 231336
#include <bits/stdc++.h>
using namespace std;
#define ll                  long long int
#define ull                 unsigned long long int
#define ld                  long double
#define fi                  first
#define se                  second
#define pb                  push_back
#define pbb                 pop_back
#define mp                  make_pair
#define pii     	        pair<int,int>
#define all(x)              x.begin(), x.end()
#define uniq(x)             x.erase(unique(x.begin(),x.end()),x.end())
#define mem(array, value)   memset(array, value, sizeof(array))
#define PI      	        2*acos(0.0)
#define EPS     	        1e-8
#define line                cout << "\n==========\n"
#define fastRead 	        ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define trace(...)          __f( #__VA_ARGS__ , __VA_ARGS__ )
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << "\n";
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " , ";
    __f(comma + 1, args...);
}

const int INF = 1e9+9;


int main ()
{
    #ifdef Lollipop
        //freopen ("input.txt", "r", stdin);
        //freopen ("output.txt", "w", stdout);
    #endif

    string s;
    cin >> s;
    for (int i = 0; i < s.size() - 1; i++){
        if (s[i] == s[i+1]){
            return cout << "Bad\n", 0;
        }
    }
    cout << "Good" << endl;
    return 0;
}



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

int findSec(std::vector<int> a, int max) {
    int rtn = 0;
    for (int i = 0; i < a.size(); i++) {
        if(rtn < a[i])  {
            if(a[i] != max) {
               rtn = a[i];
            }
        }
    }

    return rtn;
}

int cntmax(std::vector<int> a, int max) {
    int cnt = 0;
    for (int i = 0; i < a.size(); i++) {
        if(max == a[i]) {
            cnt++;
        }

        if(cnt >= 2) {
            return false;
        }
    }

    return true;

}

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

        std::vector<int> a(n);
        for (int i = 0; i < n; i++)
        {
            std::cin >> a[i];
        }

        int max = *max_element(a.begin(), a.end());
        int maxsec = findSec(a, max);
        bool maxcnt = cntmax(a, max);

        if (maxsec == 0)
        {
            maxsec = max;
        }

        for (int i = 0; i < n; i++)
        {

            if(maxcnt) {
            if (a[i] != max)
            {
                std::cout << max << std::endl;
            }
            else
            {
                std::cout << maxsec << std::endl;
            }
            } else {
                std::cout << max << std::endl;
            }
        }
    }
    

Measured memory_bytes: 3184
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
using namespace std; using ll = long long; using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
int ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.first > secondElof.first;
}
//**Snippetリスト**//
//rep, vin, all, iteLoop//
//gcdlcm, isPrime, eratos, modinv, bitSearch, bitList, dfs, bfs, dijkstra, UnionFind, COM, digitDP//
ll i, j, k, l, m, n; ll N, M, K, H, W, L;
ll MOD = 1000000007; ll INF = 9999999999999; ll ans = 0;
vl flag, color; vll path; vl D;
//***********//
int main() {
	cin >> N >> M;
	vl A(N);
	vl B(N);
	for (i = 0; i < N; i++) {
		cin >> A[i];
		if (i == 0) B[0] = A[0] % M;
		else B[i] = (B[i - 1] + A[i]) % M;
	}
	sort(B.begin(), B.end());
	ll now = B[0];
	ll C = 1;
	for (i = 0; i < N; i++) {
		if (i == N-1) {
			ans += C*(C - 1) / 2;
			if (now == 0) ans += C;
		}
		else if (B[i + 1]==now) {
			C++;
		}
		else {
			ans += C * (C - 1) / 2;
			if (now == 0) ans += C;
			C = 1;
			now = B[i + 1];
		}
	}
	cout << ans;
}

Measured memory_bytes: 1792
/***** author : C0d1ngPhenomena *****/

	#include <bits/stdc++.h>
	#include <cstdio>
	#include <cstring>
	#include <cmath>
	#include <cstring>
	#include <chrono>
	#include <complex>
	#define endl "\n"
	#define ll long long int
	#define vi vector<int>
	#define vll vector<ll>
	#define vvi vector < vi >
	#define pii pair<int,int>
	#define pll pair<long long, long long>
	#define mod 1000000007
	#define inf 1000000000000000001;
	#define all(c) c.begin(),c.end()
	#define mp(x,y) make_pair(x,y)
	#define mem(a,val) memset(a,val,sizeof(a))
	#define eb emplace_back
	#define pb push_back
	#define f first
	#define s second
	
	using namespace std;
	int main()
	{
		std::ios::sync_with_stdio(false);
		cin.tie(NULL);
		double R;
	cin>>R;
	std::cout << std::fixed;
    std::cout << std::setprecision(3);
    std::cout << 2*3.14*R;
		

		return 0;
	}


Measured memory_bytes: 3816
#include <bits/stdc++.h>
#define dum(x) cout<<#x<<'='<<x<<endl
#define ll long long
using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; ++i) {
    cin >> v.at(i);
  }
  sort(v.begin(), v.end());

  if (n % 2 == 0) {
    ll res = 0;
    for (int i = 0; i < n / 2 - 1; ++i) {
      res -= v.at(i) * 2;
    }
    res -= v.at(n / 2 - 1);
    res += v.at(n / 2);
    for (int i = n / 2 + 1; i < n; ++i) {
      res += v.at(i) * 2;
    }
    cout << res << endl;
  } else {
    ll res_1 = 0;
    for (int i = 0; i < n / 2; ++i) {
      res_1 -= v.at(i) * 2;
    }
    res_1 += v.at(n / 2);
    res_1 += v.at(n / 2 + 1);
    for (int i = n / 2 + 2; i < n; ++i) {
      res_1 += v.at(i) * 2;
    }

    ll res_2 = 0;
    for (int i = 0; i < n / 2 - 1; ++i) {
      res_2 -= v.at(i) * 2;
    }
    res_2 -= v.at(n / 2 - 1);
    res_2 -= v.at(n / 2);
    for (int i = n / 2 + 1; i < n; ++i) {
      res_2 += v.at(i) * 2;
    }

    cout << max(res_1, res_2) << endl;
  }
}


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

using namespace std;
typedef long long ll;
typedef long double ld;
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }


const int q = 1e9+9;


int main()
{
    string n,ans = "AC";
    cin>>n;
    if(n[0] != 'A'){
        cout<<"WA"<<endl;
        return 0;
    }
    int cnt=0;
    for(int i=1;i<n.size();i++){
        if(isupper(n[i])){
            if(i==1 || i==n.size()-1 || n[i]!='C')
                ans = "WA";
                cnt++;
        }
    }
    if(cnt != 1){
        ans="WA";
    }
    cout<<ans<<endl;


    return 0;
}
// gotcha;



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

using namespace std;

int n, m, q;
long long result[15];

vector<pair<int,int>> pts, painted;

int main() {
    scanf("%d %d %d", &n, &m, &q);
    for (int i = 0; i < q; ++i) {
        int x, y;
        scanf("%d %d", &x, &y);
        painted.emplace_back(x, y);
        for (int i = x - 2; i <= x; ++i) {
            for (int j = y - 2; j <= y; ++j) {
                if (i > 0 && i + 2 <= n && j > 0 && j + 2 <= m) {
                    pts.emplace_back(i, j);
                }
            }
        }
    }
    sort(painted.begin(), painted.end());
    sort(pts.begin(), pts.end());
    pts.erase(unique(pts.begin(), pts.end()), pts.end());
    result[0] = 1LL * (n - 2) * (m - 2) - (int)pts.size();
    for (auto& item : pts) {
        int x = item.first, y = item.second;
        int current = 0;
        for (int i = x; i < x + 3; ++i) {
            for (int j = y; j < y + 3; ++j) {
                if (binary_search(painted.begin(), painted.end(), make_pair(i, j)))
                    ++current;
            }
        }
        ++result[current];
    }
    for (int i = 0; i < 10; ++i)
        cout << result[i] << endl;
    return 0;
}


Measured memory_bytes: 9452
/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>
#include <cstring>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
#include <stack>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type ---------- */
using ll = long long;
#define int ll
#define P pair<ll, ll>

/* ---------- Constants  */
const double PI = 3.141592653589793238462643383279;
const ll MOD = 1e9 + 7;
const int INF = 1LL << 55;

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */
signed main() {
    int n;
    cin >> n;
    int a[n];
    for (int i = 0; i < n; i++) cin >> a[i];

    int max_idx = 0;
    int max_abs = abs(a[0]);
    for (int i = 1; i < n; i++) {
        if (abs(a[i]) > max_abs) {
            max_abs = abs(a[i]);
            max_idx = i;
        }
    }

    vector<P> ans;
    for (int i = 0; i < n; i++) {
        if (i == max_idx) continue;
        ans.emplace_back(P(max_idx + 1, i + 1));
    }

    if (a[max_idx] >= 0) {
        for (int i = 0; i < n - 1; i++) {
            ans.emplace_back(P(i + 1, i + 2));
        }
    } else {
        for (int i = n - 1; i >= 1; i--) {
            ans.emplace_back(P(i + 1, i));
        }
    }

    cout << ans.size() << endl;
    for (P a : ans) {
        cout << a.first << " " << a.second << endl;
    }

    return 0;
}

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

#define N_MAX 100
#define K_MAX 9
#define S_MAX 1000

long long int dp[N_MAX + 1][K_MAX + 1][S_MAX + 1] = {};

int main() {
  
  for (int i = 0; i <= N_MAX; i++){
    dp[i][0][0] = 1;
    dp[i][1][0] = 1;
  }

  for (int n = 1; n <= N_MAX; n++) {
    for (int k = 1; k <= K_MAX; k++) {
      for (int s = 1; s <= S_MAX; s++) {

	dp[n][k][s] +=
	  (s - n < 0? 0 : dp[n-1][k-1][s-n]) +
	  dp[n - 1][k][s];
	/*
	if(n <= 2 && k <= 1 && s <= 10){
	  cout << n << ", " << k << ", " << s << ", " << dp[n][k][s] << endl;
	}
	*/
      }
    }
  }

  while( true ) {

    int n, s;
    cin >> n >> s;
    if ( n == 0 ) break;

    cout << dp[100][n][s]  << endl;

  }

  return 0;

}

Measured memory_bytes: 8800
#include <bits/stdc++.h>
using namespace std;
 
void solve()
{
    int n, a;
    cin >> n >> a;
    int y[n + 1];
    long long ans = 0;
    int m = 0;
    y[0] = 0;
    for (int i = 1; i <= n; ++i)
    {
        cin >> y[i];
        m = max(y[i], m);
    }
    int x = max(m, a);
    long long dp[n + 1][n + 1][n * x + 1] = {};
    dp[0][0][0] = 1;
    for (int i = 1; i <= n; ++i)
    {
        for (int j = 0; j <= i; ++j)
        {
            for (int s = 0; s <= n * x + 1; ++s)
            {
                if (i >= 1 && s < y[i])
                    dp[i][j][s] = dp[i - 1][j][s];
                else if (i >= 1 && j >= 1 && y[i] <= s)
                    dp[i][j][s] = dp[i - 1][j][s] + dp[i - 1][j - 1][s - y[i]];
            }
        }
    }
    for(int i = 1; i <= n; ++i)
        ans += dp[n][i][i * a];
    cout << ans << endl;
}
 
int main()
{
    solve();
}

Measured memory_bytes: 54444
#include <iostream>

int main(void){
    int M1,M2,D1,D2;
    std::cin >> M1 >> D1 >> M2 >> D2;

    if(M1 != M2){
        std::cout << 1 <<std::endl;
        return 0;
    }
    std::cout << 0 << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define ar array
 
const int mxN=1e7;
int n, c[mxN+1];
 
int main() {
	cin >> n;
	for(int i=1; i<=n; ++i)
		for(int j=0; (j+=i)<=n; )
			++c[j];
	ll ans=0;
	for(int i=1; i<=n; ++i)
		ans+=(ll)i*c[i];
	cout << ans;
}

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

int n; 
string s;
vector <int> pos[3];
LL cnt = 0;
char ch[3] = {'R', 'G', 'B'};

int lowerBound (int loc, int id) {
	int l = 0, r = pos[id].size () - 1;
	while (l <= r) {
		int mid = (l + r) >> 1;
		if (pos[id][mid] >= loc) r = mid - 1;
		else l = mid + 1;
	}
	return r + 1;
}

LL countTriple (int po, int x, int y) {
	LL res = 0;
	int locx = lowerBound (po, x);
	int leny = pos[y].size ();

	for (int i = locx; i < pos[x].size (); i ++) {
		int locy = lowerBound (pos[x][i], y);
		res += 1LL * (leny - locy);
		
		int d = pos[x][i] - po;
		if (pos[x][i] + d < n && s[pos[x][i] + d] == ch[y]) res --; 
	}
	return res;
}

int main () {
	cin >> n >> s;
	for (int i = 0; i < n; i ++) {
		if (s[i] == 'R') pos[0].push_back (i);
		else if (s[i] == 'G') pos[1].push_back (i);
		else if (s[i] == 'B') pos[2].push_back (i);	
	}
	
	for (int i = 0; i < 3; i ++) {

		int p = (i + 1) % 3, q = (i + 2) % 3;

		for (int j = 0; j < pos[i].size (); j ++) {
			cnt += countTriple (pos[i][j], p, q) + countTriple (pos[i][j], q, p);
		}
	}
	cout << cnt << endl;
	return 0;
}


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

int main() {
    int a, b, k, count = 0;
    cin >> a >> b >> k;
    for (int i = min(a, b); i >= 1; i--) {
        if (a % i == 0 && b % i == 0) count++;
        if (count == k) {
            cout << i << endl;
            break;
        }
    }
}

Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>


using namespace std;

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

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())


//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

int main() {

	string s; cin >> s;

	for (int i = 0; i < s.size()+1; i++) {
		for (int j = i; j < s.size()+1; j++) {
			string a = s.substr(0, i);
			string b = s.substr(i, j);
			string c = s.substr(j, s.size());

			string buf = a + c;

			if (buf == "keyence") {
				cout << "YES" << endl;
				return 0;
			}
		}
	}

	cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define bit(k) (1LL<<(k))
#define SUM(v) accumulate(all(v), 0LL)

typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
struct fast_ios{ fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; }fast_ios_;

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

#define TOSTRING(x) string(#x)
template <typename T> istream &operator>>(istream &is, vector<T> &vec) { for (T &x : vec) is >> x; return is; }
template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) { os  << "["; for(auto _: v) os << _ << ", "; os << "]"; return os; };
template <typename T> ostream &operator<<(ostream &os, set<T> &st) { os << "("; for(auto _: st) { os << _ << ", "; } os << ")";return os;}
template <typename T, typename U> ostream &operator<<(ostream &os, const pair< T, U >& p){os << "{" <<p.first << ", " << p.second << "}";return os; }
template <typename T, typename U> ostream &operator<<(ostream &os, const map<T, U> &mp){ os << "["; for(auto _: mp){ os << _ << ", "; } os << "]" << endl; return os; }

#define DUMPOUT cerr
void dump_func(){ DUMPOUT << endl; }
template <class Head, class... Tail> void dump_func(Head &&head, Tail &&... tail) { DUMPOUT << head; if (sizeof...(Tail) > 0) { DUMPOUT << ", "; } dump_func(std::move(tail)...); }

#ifdef DEBUG
#define dbg(...) dump_func(__VA_ARGS__)
#define dump(...) DUMPOUT << string(#__VA_ARGS__) << ": "; dump_func(__VA_ARGS__)
#else
#define dbg(...)
#define dump(...)
#endif

const int INF = (ll)1e9;
const ll INFLL = (ll)1e18+1;
const ll MOD = 1000000007;
// const ll MOD = 998244353;
const long double PI = acos(-1.0);

/*
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const string dir = "DRUL";
*/


int main() {
    ll N, K;
    cin >> N >> K;
    vector<ll> A(N);
    rep(i,N)cin >> A[i];
    vector<ll> dp(K+1, 0);
    // dp[i]: 自分にi個の状態で回ってきて、勝てるかどうか
    dp[0] = 0;
    rep(i,K+1)rep(j,N){
        if(i - A[j] < 0)continue;
        if(dp[i-A[j]] == 0)dp[i] = 1;
        if(K < 10){
            dump(dp);
        }
    }
    cout << (dp[K] ? "First" : "Second") << endl;
}


Measured memory_bytes: 4000
#include<bits/stdc++.h>
#define F first
#define S second
#define MP make_pair
#define pb push_back
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;
typedef pair< int, P > iP;
typedef pair< P, P > PP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;

int dx[] = {0, -1, 1, 0};
int dy[] = {-1, 0, 0, 1};

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    string s;
    cin >> s;
    for( int i = 0; i < s.size() - 8; ++i ) cout << s[i];
    cout << endl;
    return 0;
}



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

# define x first
# define y second
# define mp make_pair
// everything goes according to my plan
# define pb push_back
# define sz(a) (int)(a.size())
# define vec vector
// shimkenttin kyzdary, dzyn, dzyn, dzyn...
# define y1    Y_U_NO_y1
# define left  Y_U_NO_left
# define right Y_U_NO_right

# ifdef Local
# define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
# else
# define debug(...) (__VA_ARGS__)
# define cerr if(0)cout
# endif

using namespace std;

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

const int Mod = (int)1e9 + 7;
const int MX = 1073741822;
const ll MXLL = 4e18;
const int Sz = 1110111;
// a pinch of soul
inline void Read_rap () {
  ios_base :: sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
}
inline void randomizer3000 () {
  unsigned int seed;
  asm ("rdtsc" : "=A"(seed));
  srand (seed);
}
void files (string problem) {
  if (fopen ((problem + ".in").c_str(),"r")) {
    freopen ((problem + ".in").c_str(),"r",stdin);
    freopen ((problem + ".out").c_str(),"w",stdout);
  }
}
void localInput(const char in[] = "s") {
  if (fopen (in, "r")) {
    freopen (in, "r", stdin);
  }
  else
    cerr << "Warning: Input file not found" << endl;
}                  
int n, a, b, c, d;
const int N = 1002;
ll G[N][N];
ll fc[N];
ll dp[N];
ll C[N][N];

ll bp (int a, int b) {
	ll res = 1;
	while (b) {
		if (b & 1)
			res = (res * a) % Mod;
		a = (a * 1ll * a) % Mod;
		b >>= 1;
	}
	return res;
}	

int main()
{
  # ifdef Local
    //localInput();
  # endif
  Read_rap();
  cin >> n >> a >> b >> c >> d;       

  fc[0] = 1;
  for (int i = 1; i <= n; ++i)
  	fc[i] = (fc[i - 1] * 1ll * i) % Mod;
  for (int f = 1; f <= n; f++) {	
  	for (int x = 1; f * x <= n; x++) {
  		G[f][x] = fc[f*x] * bp(bp(fc[x], f), Mod-2) % Mod * bp (fc[f], Mod-2) % Mod;
  		
  	}
  }
  C[0][0] = 1;             
  for (int i = 1; i <= n; i++) {
  	C[i][0] = C[i][i] = 1;        
  	for (int j = 1; j < i; j++) {
  		C[i][j] = (C[i-1][j-1] + C[i-1][j]) % Mod;
  	}
  }	
    
  dp[0] = 1;
  for (int x = a; x <= b; x++) {
   	for (int s = n-1; s >= 0; s--) {	
			for (int f = c; f <= d && s + f * x <= n; f++) {
  			dp[s+f*x] = (dp[s + f*x] + C[n-s][f * x] * G[f][x] % Mod * dp[s] % Mod) % Mod;
  		}
  	}
  }    
  cout << dp[n];

	
  

  return 0;
}






// Coded by Z..

Measured memory_bytes: 14592
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  int n;
  cin >> n;
  
  int count = 0;
  int x = n - 1;
  
  vector<int> p(n);
  for (int i = 0; i < n; i++) {
    cin >> p.at(i);    
  }
  
  for (int i = 1; i < x; i++) {
    if ( p.at(i-1) < p.at(i) && p.at(i) < p.at(i+1) ) ++count;
    if ( p.at(i-1) > p.at(i) && p.at(i) > p.at(i+1) ) ++count;
  }
  
  cout << count << endl;
  
}

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

void solve() {
	int64_t a, b, c, d;
	cin >> a >> b >> c >> d;
	if(a < b or b > d) {
		cout << "No" << '\n';
		return;
	}
	if(c >= b) {
		cout << "Yes" << '\n';
		return;
	}
	int64_t g = __gcd(b, d);
	if(b + a % g - g > c) {
		cout << "No" << '\n';
	} else {
		cout << "Yes" << '\n';
	}
}

int main() {
	int t; cin >> t;
	while(t--) {
		solve();
	}
	return 0;
}

Measured memory_bytes: 256
puts gets.split.map(&:to_i).sort.reverse*' '

#puts gets.split.map(&:to_i).sort.reverse*" "

#puts gets.split.map{|x|x.to_i}.sort{|a,b|b<=>a}.join(' ')

#puts gets.split(" ").map(&:to_i).sort.reverse.join(" ")

#a = gets.chomp.split.map(&:to_i)
#puts a.sort { |b, c| c <=> b }.join(' ')


Measured memory_bytes: 6848
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < n; ++i)
using ll = long long;
const ll MOD = 1000000007;//998244353;
int main() {
   ios::sync_with_stdio(false);
   cin.tie(0);
   int n, m; cin >> n >> m;
   rep(i,m){
      if (n%2==0 && (i+1)*2-1==n/2)n--;
      cout << i+1 << " " << n-i << endl;
      if (n%2==0 && (i+1)*2==n/2)n--;
   }
}

Measured memory_bytes: 3532
(let ((s (read-line))
      (ans 0)
      (temp 0))
     (loop for i from 0 below (length s) do
           (cond ((eq (char s i) #\A) (incf temp))
             ((eq (char s i) #\T) (incf temp))
             ((eq (char s i) #\G) (incf temp))
             ((eq (char s i) #\C) (incf temp))
             (t (setf temp 0)))
           (setf ans (max temp ans)))
     (princ ans))


Measured memory_bytes: 12516
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.EmptyStackException;
import java.util.Stack;

/**
 * Problem C: Midnight Teatime
 */
public class Main {

	static int count;
	final static byte dummy = -10;

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = "";

		while (!(line = br.readLine()).equals("END")) {

			Stack<Byte> exp = new Stack<Byte>();
			Stack<Byte> oper = new Stack<Byte>();
			String linex = line;

			for (char c : line.trim().toCharArray()) {
				if (c == ' ') {
					oper.push(dummy);
				} else if (c >= '1' && c <= '9') {
					exp.push((byte) ((c - '0') * -1));
				} else if (c == ')') {
					exp.push(oper.pop());
				}
			}

			//
			int n = Integer.parseInt(br.readLine());
			for (int i = 1; i < n + 1; i++) {
				byte b = stob(line = br.readLine());
				for (int j = 0; j < exp.size(); j++) {
					if (exp.get(j).intValue() == i * -1) {
						exp.setElementAt(Byte.valueOf(b), j);
					}
				}
			}

			//
			count = 0;
			ArrayList<Byte> idx = new ArrayList<Byte>();
			for (byte i = 0; i < exp.size(); i++) {
				if (exp.get(i).intValue() == dummy) {
					idx.add(i);
				}
			}
			try {
				solve(0, idx, exp, (byte) -1);
				solve(0, idx, exp, (byte) -2);
				solve(0, idx, exp, (byte) -3);
				System.out.println(count);
			} catch (EmptyStackException e) {
				System.err.println(exp.toString());
			}

		}
	}

	static byte answer(Stack<Byte> exp) {
		Stack<Byte> ans = new Stack<Byte>();
		byte b1, b2, op;
		for (int i = 0; i < exp.size(); i++) {
			if (exp.get(i) < 0) {
				b2 = ans.pop();
				b1 = ans.pop();
				op = exp.get(i);
				switch ((int) op) {
				case -1:
					ans.push((byte) (b1 & b2));
					break;
				case -2:
					ans.push((byte) (b1 | b2));
					break;
				case -3:
					ans.push((byte) (b1 ^ b2));
					break;
				}
			} else {
				ans.push(exp.get(i));
			}
		}
		return (byte) ans.pop();
	}

	static byte stob(String str) {
		byte b = 0;
		for (int j = 0; j < 7; j += 2) {
			if (str.charAt(j) == '1') {
				b += 1 << j / 2;
			}
		}
		return b;
	}

	static void solve(int p, ArrayList<Byte> idx, Stack<Byte> exp, byte op) {
		if (p < idx.size()) {
			exp.setElementAt(Byte.valueOf(op), idx.get(p));
			if (p == idx.size() - 1) {
				if (answer(exp) == 15) {
					count++;
				}
			}
			solve(p + 1, idx, exp, (byte) -1);
			solve(p + 1, idx, exp, (byte) -2);
			solve(p + 1, idx, exp, (byte) -3);
		} else {
			return;
		}
	}
}

Measured memory_bytes: 40148
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll n,k;
    cin>>n>>k;
    n%=k;
    cout << min(n,abs(n-k)) <<endl;
    return 0;
}


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

using namespace std;

int main(){
  int n, t_desire, c, t, min = 100000;
  cin >> n >> t_desire;


  for ( int i = 0; i < n; i++ ){
    cin >> c >> t;
    if ( t <= t_desire && c < min ){
      min = c;
    }
  }
  if ( min <= 1000 )
    cout << min << endl;
  else
    cout << "TLE" << endl;

  return 0;
}

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

namespace AthleteProgramming2
{
    
    class Program
    {
        static void Main()
        {
            int[] abcde = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            Array.Sort(abcde);
            Array.Reverse(abcde);
            for(int i = 0; i < abcde.Length - 1; i++)
            {
                Console.Write("{0} ", abcde[i]);
            }
            Console.WriteLine(abcde[abcde.Length-1]);
        }
    }
}

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

#define pb push_back
#define eb emplace_back

typedef long long ll;
typedef unsigned long long ull;

using namespace std;






void one_case() {
    string s;
    cin >> s;
    int best = s.size();
    for (int k = 1; k < s.size(); ++k) {
        if (s[k] != s[k - 1]) {
            best = min(best, max(k, int(s.size()) - k));
        }
    }
    cout << best << '\n';
}


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


    int t = 1;
//    cin >> t;
    while (t--) {
        one_case();
    }

    return 0;
}


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

using namespace std;
#define sqr(x) ((x)*(x))
#define cube(x) ((x)*(x)*(x))
#define GCD(a, b) __gcd(a, b)
#define LCM(a, b) ((a)*(b)/GCD(a,b))
#define PI (3.141592653589793238462643383279502884197169399375105820974944)
#define MP make_pair
#define n1 first
#define n2 second
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define PDB pair<db,db>
#define SI set<int>
#define SL set<ll>
#define MS multiset
#define MSI multiset<int>
#define MSLL multiset<ll>
#define PB push_back
#define PF push_front
#define VI vector<int>
#define VPI vector<pair<int,int>>
#define VLL vector<ll>
#define VS vector<string>
#define SZ(x) ((int)x.size())

typedef long long ll;

typedef unsigned long long ull;
typedef long double ld;
typedef double db;
const int INF = 1000000007;
const ll LINF = 1000000000000000555;
const int N = 450555;
const int L = 21;
const int M = 1155;

void solve(){
    string s;
    cin >> s;

    if (s[2] == s[3] && s[4] == s[5]){
        cout << "Yes";
        return;
    }

    cout << "No";

}

int main() {
    ios_base::sync_with_stdio(false);
#ifdef dxz05
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else

#endif

    int T = 1;
    //cin >> T;

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

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ld long long
using namespace std;
int main()
{
	int l,r;
	cin>>l>>r;
	r=min(r,l+2019);
	int temp=2020;
	for(int i=l;i<r;i++)
	{
		for(int j=i+1;j<=r;j++)
		{
			int t1=((i%2019)*(j%2019))%2019;
			temp=min(temp,t1);
		}
	}
	cout<<temp<<endl;
}


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

int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
int n, b;
cin >> n;
vector<int>a, c;
for (int i = 0; i < n; i++){
cin >> b;
a.push_back(b);
c.push_back(b);
}
sort(a.begin(),a.end());
for (int j = 0; j < n; j++){
(c[j] == a[n-1]) ? cout << a[n-2] : cout << a[n-1];
cout <<"\n";
}
return 0;
}


Measured memory_bytes: 3436
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define all(x) x.begin(),x.end()
#define let auto const

template<typename... Types>
struct dynarr: std::vector<Types...> {
  using std::vector<Types...>::vector;
  using size_type = typename std::vector<Types...>::size_type;
  auto&& operator[](size_type i) { return this->at(i); }
  auto&& operator[](size_type i) const { return this->at(i); }
};

int main() {
  i64 N, K;
  cin >> N >> K;
  vector<i64> a(N);
  rep(i,0,N) cin >> a[i];
  set<i64> st;
  rep(i,0,K) {
    st.insert(a[i]);
  }
  dynarr<i64> vec(N - K + 1, 1);
  for(int i = 1;i + K - 1 < N;i++) {
    st.erase(a[i - 1]);
    st.insert(a[i + K - 2]);
    if(a[i - 1] < *st.begin() && *(--st.end()) < a[i + K - 1]) {
      vec[i] = 0;
    }
  }

  i64 cnt = 0;
  i64 MAX = 1e18;
  i64 Kc = 0;
  for(int i = 0;i < N;i++) {
    if(MAX < a[i]) {
      cnt++;
    }
    else {
      cnt = 1;
    }
    if(cnt >= K) Kc++;
    if(cnt >= K && Kc >= 2) {
      vec[i - K + 1] = 0;
    }
    MAX = a[i];
  }

  i64 sum = 0;
  for(auto x: vec) sum += x;
  cout << sum << endl;
}


Measured memory_bytes: 11136
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define MOD 1000000007
ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
ll findlcm(ll arr[], ll n)
{
    // Initialize result
    ll ans = arr[0];

    // ans contains LCM of arr[0], ..arr[i]
    // after i'th iteration,
    for (int i = 1; i < n; i++)
        ans = (((arr[i] * ans)) /
                (gcd(arr[i], ans)));

    return ans;
}
int main()
{
     ll n,i,j,cnt=0,k,w=-100,b,h,m,hcf,prod;
   /* freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);*/
    cin>>n>>m;
    if(n%m!=0)
    {
        cout<<(n/m)+1;
    }
    else{
        cout<<n/m;
    }
    
   
    

	    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,a,b) for(ll i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
ll n, a, b;
ll h[100000];

bool check(ll x){
    ll count = 0;
    rep(i, 0, n){
        ll tmp = h[i] - x * b;
        if(tmp > 0){
            count += ceil(tmp / ld(a - b));
        }
    }

    if(count > x){
        return false;
    }else{
        return true;
    }
}

int main(void){
    cin >> n >> a >> b;

    rep(i, 0, n){
        cin >> h[i];
    }

    ll ok = 1000000000;
    ll ng = 0;
    while(ok - ng > 1){
        ll mid = (ok + ng) / 2;
        if(check(mid)){
            ok = mid;
        }else{
            ng = mid;
        }
    }

    cout << ok << endl;
}


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

//#define DEBUG

using namespace std;

bool grid_info[6][6];
bool row_disable[6];
bool col_disable[6];
int path[36];
uint32_t count_ways = 0;
uint32_t H, W, K ;

template <class T>
void print_vect(std::vector<T> v){
    for(int i = 0 ; i < v .size(); i++) cout << v[i] << " ";
    cout << endl;
}

uint32_t count_black(){
    uint32_t count = 0;
    for(int i = 0 ; i < 6 ; i++){
        if(!row_disable[i]){
            for(int j = 0 ; j < 6 ; j++){
                if(!col_disable[j]){
                    count += grid_info[i][j];
                }
            }
        }
        
    }
    return count;
}


void bfs(int n){
    if(n == H + W){
        if(count_black() == K){
            /*cout << " mask " << endl;
            for(int i = 0 ; i < H ; i++){
                for(int j = 0 ; j < W ; j++){
                    cout << !( row_disable[i] || col_disable[j]) << " ";
                }
                cout << endl;
            }*/
            count_ways++;
        }
    }else{
        if( n < H){
            //row
            //paint
            row_disable[n] = true;
            bfs(n+1);

            //no paint
            row_disable[n] = false;
            bfs(n+1);
        }else{
            //col
            //paint
            uint32_t col = n - H ;
            col_disable[col] = true;
            bfs(n+1);
            //no paint
            col_disable[col] = false;
            bfs(n+1);
        }
    }
}

void solve(){
    cin >> H >> W >> K;
    std::string S;
    for(uint32_t i = 0 ; i < H ; i++){
        cin >> S;
        for(uint32_t j = 0 ; j < W ; j++){
            if(S[j] == '#'){
                grid_info[i][j] = 1;
            }
        }
    }
    /*
    for(uint32_t i = 0 ; i < H ; i++){
        for(int j = 0 ; j < W ; j++){
            cout << grid_info[i][j] << " ";
        }
        cout << endl;
    }*/

    bfs(0);
    cout << count_ways << endl;

}

int main()
{
    //making data IO Fast
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    /****************************/

    #ifdef DEBUG
    int TEST_CASES = 1;
    while(TEST_CASES--){
    #endif // DEBBUG

    solve();

    #ifdef DEBUG
    }
    #endif // DEBUG
    
    return 0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
 
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define int long long
#define rep(i,a,b)    for(int i=a;i<b;i++)
#define repn(i,a,b)   for(int i=a;i>=b;i--)
#define F first
#define S second
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define pb push_back
#define mp  make_pair
#define all(v) (v).begin(), (v).end()
#define mod 1000000007
#define inf 1e18
 
 
using namespace std;
map<int,int> m;
void primeFactors(int n)  
{  
    // Print the number of 2s that divide n  
    while (n % 2 == 0)  
    {  
        m[2]++; 
        n = n/2;  
    }  
  
    // n must be odd at this point. So we can skip  
    // one element (Note i = i +2)  
    for (int i = 3; i <= sqrt(n); i = i + 2)  
    {  
        // While i divides n, print i and divide n  
        while (n % i == 0)  
        {  
            m[i]++;  
            n = n/i;  
        }  
    }  
  
    // This condition is to handle the case when n  
    // is a prime number greater than 2  
    if (n > 2)  
        m[n]++;  
}  

signed main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output1.txt", "w", stdout);
    #endif
    
    IOS;
    int n;
    cin>>n;
    primeFactors(n);
    int ans=0;
    for(auto it=m.begin();it!=m.end();it++)
    {
        int num=it->S;
        int j=1;
        while(num>=j)
        {
            ans++;
            num-=j;
            j++;
        }
    }
    cout<<ans;
}

Measured memory_bytes: 3656
N, A, B = map(int, input().split())
S = list(input())

n = 0
f = 0
for s in S:
    if s == "c":
        print("No")
    elif s == "a":
        if n < A + B:
            n += 1
            print("Yes")
        else:
            print("No")
    else:
        f += 1
        if n < A + B and f <= B:
            n += 1
            print("Yes")
        else:
            print("No")

Measured memory_bytes: 4704
#include <stdio.h>

int main(void)
{
    int n, k, x, a;

    scanf("%d%d", &n, &k);

    a = k;
    x = 1;

    while (n>a-1) {
        x++;
        a *= k;
    }

    printf("%d\n", x);

    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <cctype>
using namespace std;
int main() {
	string S;
	getline(cin, S);
	for (int i = 0; i < S.length(); i++) {
		if (islower(S[i]))
			S[i] = toupper(S[i]);
		else
			S[i] = tolower(S[i]);
	}
	cout << S << endl;
}


Measured memory_bytes: 3196
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i = (a); i < (n); ++i)
#define repk(i,a,n) rep(i,a,n+1)
#define all(v) (v).begin(),(v).end()
typedef pair<int, int> P;
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const ll MOD = 1e9 + 7;
void sol() {
	int cnt = 0;
	int l, r, d; scanf("%d%d%d", &l, &r, &d);
	repk(i, l, r) {
		if (i % d == 0)
			cnt++;
	}
	cout << cnt;
}

int main() {
	int _ = 1;
	// for (scanf("%d", &_); _; _--)
	sol();

	return 0;
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
int read(){int x;scanf("%d",&x);return x;} 
int main(){
	int n=read();
	while(n--){
		long long a=read(),b=read();
		long long fxxk=sqrt(a*b-1);
		if(fxxk*fxxk>a*b-1)fxxk--;
		printf("%lld\n",fxxk*2-(fxxk>=a)-(fxxk>=b)-(fxxk*(fxxk+1)>=a*b));
	}
}

Measured memory_bytes: 256
#include<stdio.h>

int binarySearch(int A[], int key, int n){
    int left=0, right=n, mid;
    while(left<right){
        mid=(left+right)/2;
        if (A[mid]==key){
            return mid;
        }else if (key<A[mid]){
            right=mid;
        }else{
            left=mid+1;
        }
    }
    return -1;
}

int main(){
    int num, i, j, q, bs, ans=0;
    scanf("%d", &num);
    int num_list[num];
    for(i=0; i<num; i++){
        scanf("%d", &num_list[i]);
    }
    scanf("%d", &q);
    int q_list[q];
    for(j=0; j<q; j++){
        scanf("%d", &q_list[j]);
    }
    for(j=0; j<q; j++){
        bs=binarySearch(num_list, q_list[j], num);
        if(bs != -1) ans++;
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 2288
//g++  5.4.0

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

#define ff first
#define ss second
#define int long long
#define pb push_back
#define pii pair< int,int >
#define fast ios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0) ;

signed main()
{
    fast;
    string s;
    cin >> s;
    if( s[2] == s[3] && s[4] == s[5] )
        cout << "Yes\n";
    else cout << "No\n";
}





Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#include <iostream>
#include <sstream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>
#include <array>
#include <list>
#include <stack>
#include <valarray>

using namespace std;

typedef unsigned uint;
typedef long long Int;
typedef unsigned long long UInt;

const int INF = 1001001001;
const Int INFLL = 1001001001001001001LL;

template<typename T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<typename T> void chmin(T& a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T& a, T b) { if (a < b) a = b; }
int in() { int x; scanf("%d", &x); return x; }
double fin() { double x; scanf("%lf", &x); return x; }
Int lin() { Int x; scanf("%lld", &x); return x; }

const double EPS = 1e-9;
const double PI = acos(-1);

// sign
int sgn(double r) {
  return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0;
}

// mod of angle
double argmod(double t) {
  t = fmod(t, PI * 2);
  if (t < 0) t += PI * 2;
  return t;
}
struct Pt {
  double x, y;
  Pt(double x = 0, double y = 0) : x(x), y(y) { }
  Pt operator + (const Pt& o) const { return Pt(x + o.x, y + o.y); }
  Pt operator - (const Pt& o) const { return Pt(x - o.x, y - o.y); }
  Pt operator * (const double k) const { return Pt(k*x, k*y); }
  Pt operator / (const double k) const { return Pt(x/k, y/k); }
  double dot(const Pt& o) const { return x*o.x + y*o.y; }
  double det(const Pt& o) const { return x*o.y - o.x*y; }
  double abs2() const { return x*x + y*y; }
  double abs() const { return sqrt(abs2()); }
  double angle() const { return atan2(y, x); }
  Pt rot(const double t) const { return Pt(x*cos(t) - y*sin(t), x*sin(t) + y*cos(t)); }
  Pt rot90() const { return Pt(-y, x); }
  bool operator < (const Pt& o) const { return x != o.x ? x < o.x : y < o.y; }
};
ostream& operator << (ostream& os, const Pt& p) { os << "(" << p.x << ", " << p.y << ")"; return os; }

Pt P[128];

int main() {
  int N = in();
  for (int i = 0; i < N; ++i) {
    P[i].x = in();
    P[i].y = in();
  }

  for (int i = 0; i < N; ++i) {
    vector<double> as;
    for (int j = 0; j < N; ++j) {
      if (i != j) {
        as.push_back(argmod((P[j] - P[i]).rot90().angle()));
      }
    }
    const double za = argmod(as[0] - PI / 2);
    for (double& a : as) {
      a = argmod(a - za);
    }
    double lef = as[0], rig = as[0] + PI;
    for (const double a : as) {
      if (a < 3 * PI / 2 + EPS) chmax(lef, a);
      if (argmod(a + PI) > PI / 2 - EPS) chmin(rig, argmod(a + PI));
    }
    printf("%.9f\n", max(0.0, rig - lef) / (2 * PI));
  }



  return 0;
}


Measured memory_bytes: 256
//https://vjudge.net/contest/333005#problem
/*
* Author : MaxSally
*/
/********   All Required Header Files ********/
#include<bits/stdc++.h>
using namespace std;
/*******  All Required define Pre-Processors and typedef Constants *******/
#define SCD(t) scanf("%d",&t)
#define SCLD(t) scanf("%ld",&t)
#define SCLLD(t) scanf("%lld",&t)
#define SCC(t) scanf("%c",&t)
#define SCS(t) scanf("%s",t)
#define SCF(t) scanf("%f",&t)
#define SCLF(t) scanf("%lf",&t)
#define mem(a, b) memset(a, (b), sizeof(a))
#define rep(i, j, k) for (int i = j ; i <= k ; ++i)
#define rrep(i, j, k) for (int i = j; i >= k; --i)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define foreach(i, a) for(auto i: a)
#define forEach(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define in(A, B, C) assert( B <= A && A <= C)
#define mp make_pair
#define pb push_back
#define inf (int) (1e9 + 7)
#define epsi 1e-9
#define PI 3.1415926535897932384626433832795
#define mod 1000000007
#define read(type) readInt<type>()
#define io ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long int
#define left tuyiuoi
#define right fgjhk
#define ss second
#define ff first
#define debug(a) cout << #a << ": " << a << endl
#define debuga1(a, l, r) rep(i, l, r) cout << a[i] << " "; cout << endl
#define Flag(n) cout << "here " << n << endl
const double pi=acos(-1.0);
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<ll, ll> pll;
typedef vector<string> vs;
typedef vector<pii> vii;
typedef vector<pll> vpll;
typedef vector<vi> vvi;
typedef map<int,int> MPII;
typedef set<int> SETI;
typedef multiset<int> MSETI;
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int  uint64;

const int N = 100005;

int n, m, a[N], b[N];
vi graph[N];
bool visited[N];
vector<set<int> > connectedComponent;

void dfs(int s){
    stack<int> st; st.push(s);
    set<int> curS;
    int cnt = (int)connectedComponent.size();
    while((int)st.size()){
        int u = st.top();
        st.pop();
        visited[u] = 1;
        b[u] = cnt;
        curS.insert(u);
        foreach(t, graph[u]){
            if(visited[t]) continue;
            st.push(t);
        }
    }
    connectedComponent.pb(curS);
}

int main(){
    io;
    //freopen("input.txt", "r", stdin);
    mem(visited, 0);
    cin >> n >> m;
    rep(i, 1, n){
        cin >> a[i];
    }
    rep(i, 1, m){
        int x, y; cin >> x >> y;
        graph[x].pb(y);
        graph[y].pb(x);
    }
    rep(i, 1, n){
        if(visited[i]) continue;
        dfs(i);
    }
    int cnt = 0;
    rep(i, 1, n){
        if(!visited[i]){
            if(i == a[i]){
                cnt++;
            }
            continue;
        }
        if(connectedComponent[b[i]].find(a[i]) != connectedComponent[b[i]].end()){
            cnt++;
        }
    }
    cout << cnt;
    return 0;
}



Measured memory_bytes: 16000
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(10000)


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, M, A, B):
    
    mod = 10**9 + 7

    if len(A) != len(set(A)):
        return 0
    if len(B) != len(set(B)):
        return 0
    
    A.sort()
    B.sort()
    As = set(A)
    Bs = set(B)

    ans = 1
    NM = N*M
    for i in range(N*M, 0, -1):
        if i in As and i in Bs:
            pass
        elif i in As:
            j = M - bisect.bisect_right(B, i)
            ans = (ans * j) % mod
        elif i in Bs:
            j = N - bisect.bisect_right(A, i)
            ans = (ans * j) % mod
        else:
            j = N - bisect.bisect_right(A, i)
            k = M - bisect.bisect_right(B, i)
            ans = (ans * (j*k-(NM-i))) % mod

    
    return ans


def main():
    N, M = read_int_n()
    A = read_int_n()
    B = read_int_n()
    print(slv(N, M, A, B))


if __name__ == '__main__':
    main()


Measured memory_bytes: 6976
#include <iostream>
#include <utility>
#include <string>
#include <vector>
#include <algorithm>
#define rep(i,n) for(int i=0;i<(n);++i)

using namespace std;

int main(){
    int n,k;
    cin >> n >> k;
    vector<int> sumuke(n,0);
    vector<int> d(k);
    rep(i,k){
        cin >> d[i];
        vector<int> A(d[i]);
        rep(j,d[i]) {
            cin >> A[j];
            sumuke[A[j]-1]++;
        }
    }
    //rep(i,n) cout << "sunuke" << i << ": "  << sumuke[i] << endl;
    int cnt=0;
    rep(i,n){
        if(sumuke[i]==0) cnt++;
    }
    cout << cnt << endl;

    return 0;
}


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

int main() {
	int k;
	cin >> k;
	int ans;
	if (k % 2 == 0) {
		ans = k/2 * k/2;
	} else {
		ans = k/2 * (k/2+1);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256