akhauriyash/Code-Regression huggingface dataset:
/*********************************************************************************\
*  _________  _      _  ________  _       _       __       ________               *
* |___   ___|| |    | ||  ______|| |     | |     /  \     |  ____  |              *
*     | |    | |    | || |______ | |_____| |    / /\ \    | |____| |              *
*     | |    | |    | ||______  ||  _____  |   / /__\ \   |  __  __|              *
*     | |    | |____| | ______| || |     | |  / ______ \  | |  \ \                *
*     |_|    |________||________||_|     |_| /_/      \_\ |_|   \_\               *
*                                                                                 *
*   Department of Computer Science & Engineering                                  *
*   Student ID : 18CSE035                                                         *
*   Bangabnadhu Sheikh Mujibur Rahman Science & Technology University,Gopalgonj.  *
*                                                                                 *
\*********************************************************************************/

//Now Write to Code ___________________________


#include <bits/stdc++.h>
using namespace std ;
 
 
typedef long long                ll;
typedef long double              ld;
typedef unsigned long long       ull;
typedef pair <int,int>           pii;
typedef pair <ll,ll>             pll;
typedef vector <int>             vi;
typedef vector <ll>              vll;
typedef vector <vector <int> >   vvi;
 
inline int    Int(){int x; cin >> x; return x;}
inline ll     Long(){ll x; cin >> x; return x;}
inline float  Float(){float x; cin >> x; return x;}
inline double Double(){double x; cin >> x; return x;}
inline void   Yes(){cout << "Yes" << endl;}
inline void   No(){cout << "No" << endl;}
inline void   YES(){cout << "YES" << endl;}
inline void   NO(){cout << "NO" << endl;}
 
const int N             =(int)2e5 + 5;
const int maxN          =(int)1e6 + 6;
const ll  Mod           =(ll)1e9 + 7;
const int inf           =(int)2e9;
const ll  Inf           =(ll)1e18;
 
#define     T           int t,q; cin >> t; for(q=1;q<=t;q++)
#define     debug(x)    cerr << #x << " = " << x << '\n' ;
#define     rep(i,b,e)  for(__typeof(e) i=(b); i!=(e+1)-2*(b > e); i =i+1-2*(b > e))
#define     Int         Int()
#define     Long        Long()
#define     Float       Float()
#define     Double      Double()
#define     all(x)      x.begin() , x.end()
#define     sz(x)       (int)x.size()
#define     ff          first
#define     ss          second
#define     pb          push_back
#define     eb          emplace_back
#define     mem(a)      memset(a , 0 ,sizeof a)
#define     memn(a)     memset(a , -1 ,sizeof a)
#define     biday       return 0 
 
 
int main(){
	int N;
	const double PI = 3.141592653589793;
	cin >> N;

	cout << showpoint;
	cout << fixed;
	cout << setprecision(20);
	cout << 2*PI*N << endl;


    biday;
}
 
//...............BYE BYE................

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

int main()
{
    int p;
    cin >> p;
    int a[3000];
    for(int i = 0; i < p; i++) cin >> a[i];
    int b[3000];
    b[p] = b[0] = a[0];
    for(int i = p - 1; i > 0; i--){
        b[i] = p * p;
        for(int j = 0; j < p; j++) b[i] -= a[j];
        b[i] %= p;
        for(int j = 0; j < p; j++){
            a[j] = a[j] * j;
            if(a[j] >= p) a[j] %= p;
        }
    }
    for(int i = 0; i < p; i++) cout << b[i] << " ";
    cout << endl;
}

Measured memory_bytes: 384
package main

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

type bufReader struct {
	r   *bufio.Reader
	buf []byte
	i   int
}

var reader = &bufReader{
	bufio.NewReader(os.Stdin),
	make([]byte, 0),
	0,
}

func (r *bufReader) readLine() {
	if r.i < len(r.buf) {
		return
	}
	r.buf = make([]byte, 0)
	r.i = 0
	for {
		line, isPrefix, err := r.r.ReadLine()
		if err != nil {
			panic(err)
		}
		r.buf = append(r.buf, line...)
		if !isPrefix {
			break
		}
	}
}

func (r *bufReader) next() string {
	r.readLine()
	from := r.i
	for ; r.i < len(r.buf); r.i++ {
		if r.buf[r.i] == ' ' {
			break
		}
	}
	s := string(r.buf[from:r.i])
	r.i++
	return s
}

func (r *bufReader) nextLine() string {
	r.readLine()
	s := string(r.buf[r.i:])
	r.i = len(r.buf)
	return s
}

var writer = bufio.NewWriter(os.Stdout)

func next() string {
	return reader.next()
}

func nextInt64() int64 {
	i, err := strconv.ParseInt(reader.next(), 10, 64)
	if err != nil {
		panic(err)
	}
	return i
}

func nextInt() int {
	return int(nextInt64())
}

func nextLine() string {
	return reader.nextLine()
}

func out(a ...interface{}) {
	fmt.Fprintln(writer, a...)
}

func max64(x, y int64) int64 {
	if x > y {
		return x
	}
	return y
}

func max(x, y int) int {
	return int(max64(int64(x), int64(y)))
}

func min64(x, y int64) int64 {
	if x < y {
		return x
	}
	return y
}

func min(x, y int) int {
	return int(min64(int64(x), int64(y)))
}

func abs64(x int64) int64 {
	if x < 0 {
		return -x
	}
	return x
}

func abs(x int) int {
	return int(abs64(int64(x)))
}

func joinInt64s(a []int64, sep string) string {
	b := make([]string, len(a))
	for i, v := range a {
		b[i] = strconv.FormatInt(v, 10)
	}
	return strings.Join(b, sep)
}

func joinInts(a []int, sep string) string {
	b := make([]string, len(a))
	for i, v := range a {
		b[i] = strconv.Itoa(v)
	}
	return strings.Join(b, sep)
}

func divUp64(x, y int64) int64 {
	return (x + y - 1) / y
}

func divUp(x, y int) int {
	return int(divUp64(int64(x), int64(y)))
}

func gcd64(x, y int64) int64 {
	if x < y {
		x, y = y, x
	}
	for y != 0 {
		x, y = y, x%y
	}
	return x
}

func gcd(x, y int) int {
	return int(gcd64(int64(x), int64(y)))
}

func lcm64(x, y int64) int64 {
	return x * y / gcd64(x, y)
}

func lcm(x, y int) int {
	return int(lcm64(int64(x), int64(y)))
}

func pow64(x, y int64) int64 {
	return int64(math.Pow(float64(x), float64(y)))
}

func pow(x, y int) int {
	return int(pow64(int64(x), int64(y)))
}

func main() {
	solve()
	writer.Flush()
}

func solve() {
	S := nextLine()
	ans := 0
	cur := S[0]
	for i := 1; i < len(S); i++ {
		if cur != S[i] {
			ans++
			cur = S[i]
		}
	}
	out(ans)
}


Measured memory_bytes: 1280
import java.io.*;
import java.util.*;

public class Main {
    static long solve (int [] arr, int parity) {
        long sum = 0;
        long res = 0;
        for (int n = arr.length, i = 0; i < n; i++) {
            if ((parity & 1) == 0) {
                if (sum + arr[i] <= 0) {
                    res += (1 - (sum + arr[i]));
                    sum = 1;
                } else {
                    sum += arr[i];
                }
            } else {
                if (sum + arr[i] >= 0) {
                    res += ((sum + arr[i]) - - 1);
                    sum = -1;
                } else {
                    sum += arr[i];
                }
            }
            parity ^= 1;
        }
        return res;
    }
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int n = sc.nextInt();
        int [] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
        }

        out.println(Math.min(solve(arr, 0), solve(arr, 1)));
        out.flush();
        out.close();
    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public Scanner (FileReader f) {br = new BufferedReader(f);}

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public double nextDouble() throws IOException {
            String x = next();
            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if (x.charAt(0) == '-') {
                neg = true;
                start++;
            }
            for (int i = start; i < x.length(); i++)
                if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec)
                        f *= 10;
                }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg ? -1 : 1);
        }

        public boolean ready() throws IOException {
            return br.ready();
        }

    }
}

Measured memory_bytes: 37240
import java.util.*;
import java.util.stream.*;
class Main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int[] num = new int[6];
        for (int i = 0; i < 6; i++){
            num[i] = input.nextInt();
        }
        Dice dice1 = new Dice(num);
        for (int i = 0; i < 6; i++){
            num[i] = input.nextInt();
        }
        Dice dice2 = new Dice(num);
        String ans = "No";
        String rolling = "EEENEEENEEESEEESEEENEEEN";
        if (dice1.isSame(dice2)){
            System.out.println("Yes");
        } else {
            for (int i = 0; i < rolling.length(); i++){
                char c = rolling.charAt(i);
                dice2.roll(c);
                if (dice1.isSame(dice2)){
                    ans = "Yes";
                    break;
                }
            }
            System.out.println(ans);
        }
    }
}
class Dice {
    private int N,E,W,S,T,B;
    private int[] dice_num;
    Dice(int[] num_array){
        dice_num = num_array;
        T = dice_num[0];
        S = dice_num[1];
        E = dice_num[2];
        W = dice_num[3];
        N = dice_num[4];
        B = dice_num[5];
    }
    public void roll(char direction){
        int tmp;
        if (direction == 'N'){
            tmp = T;
            T = S;
            S = B;
            B = N;
            N = tmp;
        } else if (direction == 'E'){
            tmp = T;
            T = W;
            W = B;
            B = E;
            E = tmp;
        } else if (direction == 'W'){
            tmp = T;
            T = E;
            E = B;
            B = W;
            W = tmp;
        } else {
            tmp = T;
            T = N;
            N = B;
            B = S;
            S = tmp;
        }
    }
    public void disp_top(){
        System.out.println(T);
    }
    public boolean isSame(Dice dice){
        if (T == dice.T &&
            S == dice.S &&
            E == dice.E &&
            W == dice.W &&
            N == dice.N &&
            B == dice.B){
                return true;
            } else {
                return false;
            }
    }
}


Measured memory_bytes: 26272
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x) cout << #x << ' ' << '=' << ' ' << (x) << endl;
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;
typedef vector<ll> vec;
typedef vector<P> pvec;
typedef vector<vector<ll>> vvec;
typedef vector<vector<P>> pvvec;
typedef priority_queue<ll> PQI;
typedef priority_queue<P> PQP;
const vector<int> dx = {0, -1, 0, 1, 1, 1, -1, -1};
const vector<int> dy = {1, 0, -1, 0, 1, -1, 1, -1};
const int MOD = (1000000007);
// const int MOD = (998244353);
// const int INF = (1 << 30);
const int INF = (1LL << 60);
const double EPS = (1 >> 30);
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}



signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);
    //---------------------------------------------
    
    string s;
    cin>>s;
    rep(i,s.size()){
        cout<<"x";
    }
    
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
  int i,n,k;
  int a[100000];
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &k);
    a[k-1]=i;
  }
  for(i=0;i<n;i++)
    printf("%d ",a[i]+1);
  printf("\n");
  return 0;
}

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

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

    vector<int> h(N);
    for(int i=0; i<N; i++){
        cin>>h.at(i);
        if(h.at(i)>=K) cnt++;
    }

    cout<<cnt<<endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define ll long long
#define pq priority_queue
using namespace std;
const ll INF=(ll)1e9;
const ll MOD=(ll)1e9+7;
const ll MAX=510000;
vector<int> dx={1,0,-1,0},dy={0,1,0,-1};
template<class T> inline bool chmax(T& a, T b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a>b) { a=b; return 1; } return 0; }

int main(){
   ll N,C,kotae=0;
   cin>>N>>C;
   vector<vector<ll>> v(35,vector<ll> (100010,0));
   vector<ll> ans(100010,0);
   for(ll i=0;i<N;i++){
       ll s,t,c;
       cin>>s>>t>>c;
       v[c][s]++;
       v[c][t+1]--;
   }
   for(ll i=1;i<=C;i++){
       for(ll j=1;j<100010;j++){
           v[i][j]+=v[i][j-1];
        }
   }
   for(ll i=1;i<=C;i++){
       for(ll j=1;j<100010;j++){
           if(v[i][j]) v[i][j]=1;
        }
   }
  
   for(ll i=1;i<=C;i++){
       for(ll j=0;j<100010;j++) ans[j]+=v[i][j];
   }
    for(ll i=1;i<100010;i++) chmax(kotae,ans[i]);
   cout<<kotae<<endl;
}


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

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;

#define REP(i, n, m) for(ll i=n; i<(ll)m; ++i)
#define IREP(i, n, m) for(ll i=n-1; i>=m; --i)
#define rep(i, n) REP(i, 0, n)
#define irep(i, n) IREP(i, n, 0)
#define all(v) v.begin(), v.end()


ll pow_mod(ll n, ll m, ll mod=1000000007){
    ll a = 1;
    while(m>0){
        if(m&1) a = a*n % mod;
        n = n*n % mod;
        m >>= 1;
    }
    return a;
}


int main(){
    cout << setprecision(20);

    ll N, K;
    cin >> N >> K;

    vll a(K+1, 0);
    IREP(i, K+1, 1){
        ll n = pow_mod(K/i, N);
        for(ll m=2*i; m<=K; m+=i) n -= a[m];
        a[i] = n;
    }

    ll total = 0;
    REP(i, 1, K+1) total = (total+i*a[i]) % 1000000007;
    cout << total << endl;
}


Measured memory_bytes: 4048
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int m = sc.nextInt();
        int f = sc.nextInt();
        int r = sc.nextInt();
        while(m!=-1 || f!=-1 || r!=-1){
            if(m==-1 || f==-1){
                System.out.printf("F\n");
            }else if(m+f>=80){
                System.out.printf("A\n");
            }else if(m+f>=65){
                System.out.printf("B\n");
            }else if(m+f>=50){
                System.out.printf("C\n");
            }else if(m+f>=30){
                if(r>=50){
                    System.out.printf("C\n");
                }else{
                    System.out.printf("D\n");
                }
            }else{
                System.out.printf("F\n");
            }
            m=sc.nextInt();
            f=sc.nextInt();
            r=sc.nextInt();
        }
        sc.close();
    }
}


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

int main()
{
    int n,t;
    cin >> n >> t;
    int minc = 1000;

    int a[n][2];

    for(int i = 0; i < n; i++){
        for(int j = 0; j < 2; j++){
            cin >> a[i][j];
        }
    }

    int exist = 1;

    for(int i = 0; i < n; i++){
        if(a[i][1] <= t){
            minc = min(minc,a[i][0]);
            exist = 0;
        }
    }
    if(exist){
        cout << "TLE" << endl;
        return 0;
    }else{
        cout << minc << endl;
    }
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))

flg = False
cnt = 0

while True :

    for num in a :
        if int(num) % 2 == 0:
            pass
        else :
            flg = True
            break
    if flg == True :
        break

    for num in range(n) :
        a[num] = a[num] / 2

    cnt += 1

print(cnt)

Measured memory_bytes: 3060
s = int(input())

x1,y1 = 0,0
y2, y3 = 10**9, 1
x3 = 1 + (s-1)//y2
x2 = y2 - (((s-1) % y2) +1)

print("{} {} {} {} {} {}".format(x1,y1,x2,y2,x3,y3))

Measured memory_bytes: 3060
/*
sonu_verma1
*/
#include <bits/stdc++.h>
// For policy based data structure
/*#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp> */
using namespace std;
/*using namespace __gnu_pbds; 
typedef tree<int, null_type, less<int>, rb_tree_tag, 
             tree_order_statistics_node_update> 
    new_data_set;*/
 
#define MD 1000000007
#define X first
#define Y second
#define pb push_back
#define debug(val, ch) cout <<val <<ch
#define FOR(i, st, en, ch) for(register int i = (st); i <= (en) ; i += (ch))
#define RFOR(i, st, en, ch) for(register int i = (st); i >= (en) ; i -= (ch))
#define REP(i, j) FOR(i, 0, j, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
 
typedef long long int ll;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<int, bool> pib;
typedef pair<bool, int> pbi;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)
/*********************************************************************/
int ans,val;
void fun(vector<vector<int>>&v,vector<int>&ch,int x,int n,int m,int id)
{
	int f=0,i,j,k;
	for(i=0;i<m;i++){
		if(ch[i]<x)
		{
			f=1;
			break;
		}}
	if(f==0)
	{
		ans=min(ans,val);
		return;
	}
	if(id==n)
		{
	return ;}
	
	val+=v[id][0];
	for(j=1;j<=m;j++)
		ch[j-1]+=v[id][j];
	fun(v,ch,x,n,m,id+1);
	val-=v[id][0];
	for(j=1;j<=m;j++)
		ch[j-1]-=v[id][j];
	fun(v,ch,x,n,m,id+1);
	return ;


}
void test(int r)
{
	ans=INT_MAX;
	val=0;
	int n,m,x;
	cin>>n>>m>>x;
	vector<vector<int>>v(n,vector<int>(m+1,0));
	int i,j,k;
	for(i=0;i<n;i++)
	{
		cin>>v[i][0];
		for(j=1;j<=m;j++)
			cin>>v[i][j];
	}
	// for(i=0;i<n;i++)
	// {
	// 	for(j=0;j<=m;j++)
	// 		cout<<v[i][j]<<" ";
	// 	cout<<endl;
	// }
	vector<int>ch(m,0);
	fun(v,ch,x,n,m,0);
	if(ans==INT_MAX)
		ans=-1;
	cout<<ans;
}
/***********************************************************************/
int main()
{
	fast();
    int t=1,r;
    // cin>>t;
    for(r=1;r<=t;r++)
        test(r);
    return 0;
}

Measured memory_bytes: 3664
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
    int h,n;
    cin>>h>>n;
    int a[n];
    int i;
    int sum = 0;
    for(i = 0;i < n;i++)
    {
        cin>>a[i];
        sum+=a[i];
    }
    if(sum>=h)
        cout<<"Yes"<<endl;
    else

        cout<<"No"<<endl;

}


Measured memory_bytes: 640
import sys
input = sys.stdin.readline

def main():
    n, k = map(int, input().split())
    h = sorted([int(input()) for i in range(n)])

    mn = 10**10

    for i in range(n - k + 1):
        mn = min(mn, h[i + k - 1] - h[i])
    print(mn)

if __name__ == "__main__":
    main()

Measured memory_bytes: 8280
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <vector>
#include <queue>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

ull gcd(ull X, ull Y) {
    if(Y==0)
        return X;

    if(X < Y)
        return gcd(Y, X);

    return gcd(Y, X%Y);
}

ull count(ull A, ull B, ull X) {
    if(B < X)
        return 0;
    
    return max(ull(0), B / X - (A-1) / X);
}

int main() {
    ull A, B, C, D;
    cin >> A >> B >> C >> D;

    cout << B-A+1 - count(A,B,C) - count(A,B,D) + count(A,B,C*D/gcd(C,D)) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int gcd(int a, int b)
{
  if (a < b) {
    a = a ^ b;
    b = a ^ b;
    a = a ^ b;
  }

  int tmp;
  while (b != 0) {
    tmp = a % b;
    a = b;
    b = tmp;
  }

  // cout << "in gcd: a: " << a << ", b: " << b << endl;

  return a;
}

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

int main(int argc, char const* argv[])
{
  int a, b;
  cin >> a >> b;

  // cout << a << ", " << b << endl;
  cout << lcm(a, b) << endl;

  return 0;
}


Measured memory_bytes: 256
def g(A,l,m,r):
 global c
 L,R=A[l:m]+[1e9],A[m:r]+[1e9]
 i=j=0
 for k in range(l,r):
  if L[i]<R[j]:A[k]=L[i];i+=1
  else:A[k]=R[j];j+=1
  c+=1
def s(A,l,r):
 if l+1<r:
  m=(l+r)//2
  s(A,l,m);s(A,m,r)
  g(A,l,m,r)
c=0
n=int(input())
A=list(map(int,input().split()))
s(A,0,n)
print(*A)
print(c)


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

#define ll long long
#define vecll vector<long long>
#define vec2ll vector<vector<long long>>
#define vecpairll vector<pair<long long,long long>>
#define forll(s,a,b) for(long long s = a;s < b;s++)
#define forllde(s,a) for(long long s = a;s > 0;s--)


int main()
{
  ll n, m, x, y, c=0;
  cin >> n >> m;
  vecll a(n, 0);
  vecll b(n, 1);
  a[0] = 1;
  forll(i, 0, m){
	cin >> x >> y;
	b[x-1]--;
	b[y-1]++;
	if(a[x-1] == 1){
	  a[y-1] = 1;
	  if (b[x-1] == 0)
		a[x-1] = 0;
	}
  }
  forll(i, 0, n){
	if (a[i] == 1)
	  c++;
  }
  cout << c << endl;
}


Measured memory_bytes: 1792
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

int main()
{
    string s;
    cin >> s;

    if(s <= "2019/04/30")
        cout << "Heisei" << endl;
    else
        cout << "TBD" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <iostream>

using namespace std;

int main()
{
	int n;
	cin >> n;
	for(int i = 0; i < n; i++)
	{
		int k, p, ans;
		cin >> k >> p;
		ans = k % p;
		if(ans == 0)ans = min(k, p);
		cout << ans << endl;
	}
}

Measured memory_bytes: 1164
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cwchar>
#include <cwctype>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <codecvt>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize("Ofast")
using namespace std;
typedef int64_t ll;
typedef long double ld;
const ll INF=(1LL<<60);
const ld pi=acosl((ld)1);
const ll mod = 1000000007;
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};
#define endn "\n"

ll f(ll n){
    if(n==0)return INF;
    ll ret=0;
    while(n%2==0){
        n/=2;
        ret++;
    }
    return ret;
}

char rf(int n){
    if(n<26)return ('A'+n);
    else return ('a'+(n-26));
}

bool solve(){
    ll a,b,c;cin>>a>>b>>c;
    ll ans=INF;
    if(a%2==1 or b%2==1 or c%2==1){
        cout<<0<<endl;
        return false;
    }
    chmin(ans,f(abs(a-b)));
    chmin(ans,f(abs(c-b)));
    chmin(ans,f(abs(a-c)));

    cout<<(ans==INF ? -1 : ans)<<endl;
    return false;
}

signed main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout<<fixed;
	cout<<setprecision(30);
	return solve();
}


Measured memory_bytes: 256
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10

#solve
def solve():
    n, q = LI()
    a = LI()
    odd = [0] * n
    even = [0] * n
    def f(mid):
        return abs(a[mid] - x) < abs(a[mid - (n - mid - 1)] - x)
    for i in range(n):
        if i & 1:
            odd[i] += odd[i - 1] + a[i]
        else:
            odd[i] += odd[i - 1]
    acc = list(itertools.accumulate(a))
    for _ in range(q):
        x = II()
        ok = 0
        ng = n
        while abs(ng - ok) > 1:
            mid = (ok + ng) // 2
            if f(mid):
                ok = mid
            else:
                ng = mid
        ok = ng - (n - ng)
        ng -= 1
        ans = acc[-1] - acc[ng]
        if ok < 0:
            pass
        elif n & 1:
            ans += acc[ok]-odd[ok]
        else:
            ans += odd[ok]
        print(ans)
        
    return


#main
if __name__ == '__main__':
    solve()


Measured memory_bytes: 65900
#include<stdio.h>
int main(){
  int N, M, X, Y;
  scanf("%d %d %d %d", &N, &M, &X, &Y);
  
  int xn[101];
  int xm[101];
  for(int i = 0; i < N; i++){
    scanf("%d",&xn[i]);
    if(X < xn[i]){
      X = xn[i];
    }
  }
  
  for(int i = 0; i < M; i++){
    scanf("%d",&xm[i]);
    if(Y > xm[i]){
      Y = xm[i];
    }
  }
  if(X >= Y){
    printf("War");
  }else{
    printf("No War");
  }
}


Measured memory_bytes: 1732
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();

int cal(vector<int>& arr, vector<int>& fac) {
    int n = arr.size();
    int nth = 0;
    for(int i = 0; i < n; i++) {
        int small = 0;
        for(int j = i+1; j < n; j++) {
            if (arr[j] < arr[i])
                small += 1;
        }
        nth += small * fac[n-1-i];
    }
    return nth;
}

int main() {
    int n;
    cin >> n;
    vector<int> fac(n+1, 0);
    fac[1] = 1;
    for(int i = 2; i <= n; i++)
        fac[i] = fac[i-1]*i;
    vector<int> A(n, 0);
    vector<int> B(n, 0);
    for(int& val: A)
        cin >> val;
    for(int& val: B)
        cin >> val;
    cout << abs(cal(A, fac)-cal(B, fac)) << endl;
    return 0;
}





Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;

import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main{
    static long mod=1000000007;
//    static int dx[]={-1,0,1,0};
//    static int dy[]={0,-1,0,1};

    public  static void main(String[] args)   throws Exception, IOException{        
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);

        int n=sc.nextInt();
        int k=sc.nextInt();
        int d[]=sc.nextIntArray(n);
        long ans=0;
        
        for (int i = 0; i <= d.length; i++) {
        	for (int t = 0; t <= d.length; t++) {
				if(i+t>k)break;
				boolean u[]=new boolean[n];
				long a=0;
				int v[]=new int[i+t],c=0, rem=k-i-t;
				for (int j = 0; j < i; j++) {
					v[c++]=d[j];
					u[j]=true;
				}
				for (int j = 0; j < t; j++) {
					if(u[n-1-j])break;
					v[c++]=d[n-1-j];
				}
				sort(v);
				for (int j = 0; j < v.length; j++) {
					if(v[j]<0 && rem>0) {
						v[j]=0;rem--;
					}
				}
				for (int j = 0; j < v.length; j++) {
					a+=v[j];
				}
				ans=max(a,ans);
			}
		}
        


        out.println(ans);
        out.flush();
    }
    



    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }

    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }  
}

//class P {
//    int id, d;
//    P(int  id, int d) {
//        this.id=id;
//        this.d=d;
//    }
//}

//class P implements Comparable<P>{
//	int v,id;
//	String s;
//	P(int id, int v, String s) {
//	  this.id=id;
//	  this.v=v;
//	  this.s=s;
//	}
//	public int compareTo(P p){			
//	 if(s.equals(p.s)) {
//		 return -v+p.v;
//	 }
//	  return s.compareTo(p.s);
//	}
//}

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public int[] nextIntArray(int size) throws IOException{
    	int r[] = new int[size];
    	for (int i = 0; i < size; i++) {
			r[i] = this.nextInt(); 
		}
    	return r;
    }
    public long[] nextLongArray(int size) throws IOException{
    	long r[] = new long[size];
    	for (int i = 0; i < size; i++) {
			r[i] = this.nextLong(); 
		}
    	return r;
    }
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}


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

int main(){
    int N, K, buf, ans = 0;
    cin >> N >> K;
    priority_queue<int, vector<int>, greater<int>> P;
    for(int i = 0; i < N; ++i){
        cin >> buf;
        P.push(buf);
    }
    for(int i = 0; i < K; ++i){
        ans += P.top();
        P.pop();
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3644
#include<iostream>
using namespace std;
int a[200010];
int main()
{
	int n,sma=999999,ans=0;	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	for(int i=1;i<=n;i++){
		if(sma>=a[i])
			ans++ , sma=a[i];
	}
	cout<<ans<<endl;
}

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

ans = 0
st = "0"
while H!=[0]*N:
    for i in range(N):
        if H[i]>0:
            st = "+"
            H[i] -= 1
        elif st=="+" and H[i]==0:
            st = "0"
            ans += 1
    if st=="+":
        ans += 1
    st = "0"

print(ans)





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

int main(){
  int m1,d1,m2,d2;
  cin>>m1>>d1>>m2>>d2;
  
  if(m1==2){
    if(d1==28){cout<<1;}
    else{cout<<0;}
  }
  else if(m1==1||m1==3||m1==5||m1==7||m1==8||m1==10||m1==12){
    if(d1==31){cout<<1;}
    else{cout<<0;}
  }
  else{if(d1==30){cout<<1;}
       else{cout<<0;}
      }
  
  return 0;
}

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

#define int long long int
#define pb push_back
#define M 1000000007
#define ff first
#define ss second
#define deb(x) cout< #x< " "< x< endl;
#define fo(i,n) for(int i=0;i<n;i++)
#define Fo(i,k,n) for(int i=k;i<=n;i++)
#define FORR(a,b,c) for(int a= b;a>=c;a--)
#define fa(arrr) for(auto x:arrr)
#define iPair pair<int, pair<int,int>>
#define sz size()
// #define mp make_pair
#define mxm3(a,b,c) max(a, max(b,c))
#define mi3(a,b,c) min(a, min(b,c))
#define mxn 500005
#define PII pair<int,int>
#define aint(v) v.begin(), v.end()
#define endl "\n"
// #define N 1000
#define C 4
#define nfs ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
// Ordered Set Tree
// typedef tree<PII, null_type, less<PII>,
//         rb_tree_tag,
//         tree_order_statistics_node_update>
//         oset;
#define db(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cout << name << " : " << arg1 << '\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cout.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}

// int fact[1005];




// int N;
// int dx[] = { -1, 0, 1, 0};
// int dy[] = {0, 1, 0, -1};
int vis[1000][1000];


// int dp[] = { -1};
// int n, k;
// int dp[1001][100005];

int knap(int *weight, int *value, int n, int total, int **dp){
    // if(n==0 || total == 0) return 0;
    if(n<0) return 0;
    if(dp[n-1][total]!=-1) return dp[n-1][total];
    if(weight[n-1] > total) {
        dp[n-1][total] =  knap(weight, value, n-1, total, dp);
        return dp[n-1][total];
    }
    else{
        dp[n-1][total] =  max(value[n-1]+knap(weight, value, n-1, total-weight[n-1], dp),
                    knap(weight, value, n-1, total, dp));
        return dp[n-1][total];
    }
}

void solve() {
    int n, total;
    cin >> n >> total;
    int weight[n], value[n];
    int dp[n+1][total+1];
    for (int i = 0; i < n; i++)
        cin >> weight[i] >> value[i];
    // cout << 0 <<endl;
    for(int i = 0;i<=n;i++){
        for(int j = 0;j<=total;j++){
            if(i==0 || j==0) dp[i][j] = 0;
            else if(j-weight[i-1]>=0) dp[i][j] = max(value[i-1] + dp[i-1][j-weight[i-1]], dp[i-1][j]);
            else dp[i][j] = dp[i-1][j];
        }
    }
    cout << dp[n][total] << endl;


}


int32_t main()
{


    nfs;
    int t;
    // facto();
    // cin >> t;
    t = 1;
    while (t--) {
        solve();
    }

    return 0;
}

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

void fnInput(vector<string>& rvsStrX, vector<string>& rvsStrY)
{
  int nMaxSiz;
  cin >> nMaxSiz;
  rvsStrX.resize(nMaxSiz);
  rvsStrY.resize(nMaxSiz);

  for (int i = 0; i < nMaxSiz; ++i)
  {
    cin >> rvsStrX[i] >> rvsStrY[i];
    rvsStrX[i] = ' ' + rvsStrX[i];
    rvsStrY[i] = ' ' + rvsStrY[i];
  }
}

int fnLngCmnSubseq(const vector<string>& cnrvsStrX, const vector<string>& cnrvsStrY)
{
  vector<vector<int>> vvnLcsDP;
  for (int i = 0; i < cnrvsStrX.size(); ++i)
  {
    const int nMAXNX = cnrvsStrX[i].size();
    const int nMAXNY = cnrvsStrY[i].size();

    vvnLcsDP.clear();
    vvnLcsDP.resize(nMAXNX, vector<int>(nMAXNY, 0));

    for (int nx = 1; nx < nMAXNX; ++nx)
      for (int ny = 1; ny < nMAXNY; ++ny)
        if (cnrvsStrX[i][nx] == cnrvsStrY[i][ny])
          vvnLcsDP[nx][ny] = vvnLcsDP[nx - 1][ny - 1] + 1;
        else
          vvnLcsDP[nx][ny] = max(vvnLcsDP[nx - 1][ny], vvnLcsDP[nx][ny - 1]);

    cout << vvnLcsDP[nMAXNX - 1][nMAXNY - 1] << endl;
  }
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<string> vsStrX, vsStrY;

  fnInput(vsStrX, vsStrY);
  fnLngCmnSubseq(vsStrX, vsStrY);
  return 0;
}

Measured memory_bytes: 6884
K,N = map(int,input().split(sep=" "))
A = list(map(int,input().split(sep=" ")))
maxA = 0
for i in range(0,N,1):
    if i == N-1:
        tmp = K + A[0] - A[i]
    else:
        tmp = A[i+1] - A[i]
    if maxA < tmp:
        maxA = tmp
print(K-maxA)

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

using namespace std;

int main(){
  int sr,sw,c,r;
  while(cin >> sr >> sw >> c >> r && (sr||sw||c||r)){
  int i;
  for(i=0;(sr+i*r)/sw < c;++i);

  cout << i <<endl;
  }
  return 0;
}



Measured memory_bytes: 3096
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() { 
  ios::sync_with_stdio(false); cin.tie(0);
  //c
  int n, m;
  cin >> n >> m;
  vector<int> ac(n), wa(n);
  for (int i = 0; i < m; i++) {
    int p;
    cin >> p;
    p--;
    string s;
    cin >> s;
    if (s == "AC")  ac[p] = 1;
    else if (!ac[p]) wa[p]++;
  }
  int a = 0, b = 0;
  for (int i = 0; i < n; i++) {
    if (ac[i]) a++, b += wa[i];
  }
  cout << a << " " << b << '\n';
  return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  if (s[0] == 'R' && s[1] == 'R' && s[2] == 'R') cout << 3 << endl;
  else if ((s[0] == 'R' && s[1] == 'R') || (s[1] == 'R' && s[2] == 'R'))
    cout << 2 << endl;
  else if (s[0] == 'R' || s[1] == 'R' || s[2] == 'R') cout << 1 << endl;
  else cout << 0 << endl;
  return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <stdio.h>
#include <string>
#include <queue>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll mod = 1000000007;
int n, black[200010], ans;
string s;

ll pow(ll x, ll y)
{
	if (y == 0) return 1;
	if (y % 2)
	{
		return pow(x, y - 1) * x % mod;
	}
	else
	{
		ll yyy = pow(x, y / 2);
		return yyy * yyy % mod;
	}
}

ll div(ll x)
{
	return pow(x, mod - 2);
}



int main(void)
{
	cin >> n >> s;
	ans = 200010;
	for (int i = 0; i < n; i++)
	{
		black[i + 1] = black[i];
		if (s[i] == '#')
		{
			black[i + 1]++;
		}
	}
	for (int i = 0; i <= n; i++)
	{
		int zan = 0;
		zan += black[i];
		zan += n - i - (black[n] - black[i]);
		ans = min(ans, zan);
	}
	cout << ans << endl;
	cin >> n;
}


Measured memory_bytes: 1412
#include <iostream>
#include <algorithm>
int main()
{
  int n;
  std::cin >> n;
  while (n--) {
    int a[3];
    std::cin >> a[0] >> a[1] >> a[2];
    std::sort(a, a + 3);
    if (a[0] * a[0] + a[1] * a[1] == a[2] * a[2]) std::cout << "YES" << std::endl;
    else std::cout << "NO" << std::endl;
  }
  return 0;
}

Measured memory_bytes: 1164
import sys

def solve():
    input = sys.stdin.readline
    C = [[int(c) for c in input().split()] for _ in range(3)]
    possible = True
    for i in range(3):
        if abs(C[i][0] - C[(i+1) % 3][0]) == abs(C[i][1] - C[(i+1) % 3][1]) == abs(C[i][2] - C[(i+1) % 3][2]): continue
        else:
            print("No")
            break
    else:
        for j in range(3):
            if abs(C[0][j] - C[0][(j+1) % 3]) == abs(C[1][j] - C[1][(j+1) % 3]) == abs(C[2][j] - C[2][(j+1) % 3]): continue
            else:
                print("No")
                break
        else: print("Yes")

    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 3064
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{

	public static void main(String args[]){
		BufferedReader sc=new BufferedReader(new InputStreamReader(System.in));
		String st="";
		int yakusu;
		int bunkatu;
		long ans;
		while(true) {

				try {
					st=sc.readLine();
					if(st==null) {
						System.exit(0);
					}

					yakusu=Integer.parseInt(st);
					bunkatu=600/yakusu;

					ans=0;
					for(int i=0; i<bunkatu; i++) {
						ans+=(yakusu*i)*(yakusu*i)*yakusu;
					}
					System.out.println(ans);

				} catch (IOException e) {

					System.exit(0);
				}
		}

	}
}


Measured memory_bytes: 24300
#include <iostream>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <map>
#include <vector>
#include <iomanip>

using namespace std;

int main(void) {
  int N;
  cin >> N;
  for (int i = floor(N / 1.09); i <= ceil(N / 1.07); i++) {
    if (floor(i * 1.08) == N) {
      cout << i << endl;
      return 0;
    }
  }
  cout << ":(" << endl;
  return 0;
}


Measured memory_bytes: 888
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=(b-1);i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

long long modpow(long long a, long long b) {
  long long r = 1LL;

  while (b) {
    if (b & 1LL)r *= a;
    if (r >= MOD)r %= MOD;
    a *= a;
    if (a >= MOD)a %= MOD;
    b >>= 1LL;
  }
  return r;
}

#define N_MAX 2001

long long fact[N_MAX];
long long rfact[N_MAX];

long long nCr(long long n, long long r) {
  long long ret = 1LL;
  ret *= fact[n];
  ret %= MOD;
  ret *= rfact[r];
  ret %= MOD;
  ret *= rfact[n - r];
  ret %= MOD;
  return ret;
}

long long nPr(long long n, long long r) {
  long long ret = 1LL;
  ret *= fact[n];
  ret %= MOD;
  ret *= rfact[n - r];
  ret %= MOD;
  return ret;
}

ll dp[1010][1010];

int main() {
  ll n, a, b, c, d;
  cin >> n >> a >> b >> c >> d;
  clr(fact, 0);
  fact[0] = 1;
  rep(i, 1, N_MAX) {
    fact[i] = fact[i - 1] * i;
    fact[i] %= MOD;
  }
  clr(rfact, 0);
  rfact[0] = 1;
  rep(i, 1, N_MAX) {
    rfact[i] = rfact[i - 1] * modpow(i, MOD - 2);
    rfact[i] %= MOD;
  }
  clr(dp,0);
  dp[0][0] = 1;
  rep(i,1,n+1){
    rep(j,0,n+1){
      dp[i][j] += dp[i-1][j];
      dp[i][j] %= MOD;
      if(i<a||b<i)continue;
      rep(k,1,n+1){
        if(k<c||d<k)continue;
        if(n-j<i*k)break;
        if(j+i*k>1005)break;
        dp[i][j+i*k] += (((dp[i-1][j]*nPr(n-j,i*k)%MOD)*modpow(rfact[i],k)%MOD)*rfact[k]%MOD);
        dp[i][j+i*k] %= MOD;
      }
    }
  }
  cout << dp[b][n] << endl;
  return 0;
}





Measured memory_bytes: 8192
import java.util.*;
import java.io.*;

public class Main {

    static int n;
    static int[] w;
    static int[][] dp;

    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        PrintWriter pw = new PrintWriter(System.out);

        while(true){
            n = fs.nextInt();
            if (n == 0){
                break;
            }else if (n == 1){
                pw.println(0);
                continue;
            }

            w = new int[n];
            for (int i = 0; i < n; i++){
                w[i] = fs.nextInt();
            }

            if (n == 2){
                if (Math.abs(w[0] - w[1]) <= 1){
                    pw.println(2);
                }else{
                    pw.println(0);
                }
                continue;
            }

            dp = new int[n][n];
            for (int i = 0;i < n - 1; i++){
                if (Math.abs(w[i + 1] - w[i]) <= 1){
                    dp[i][i+1] = 2;
                }
            }

            for (int s = 2;s < n;s++){
                for (int l = 0;l + s < n;l++){
                    int r = l + s;
                    if (s % 2 == 1){
                        if (dp[l + 1][r - 1] == s - 1 && Math.abs(w[l] - w[r]) <= 1){
                            dp[l][r] = s + 1;
                            continue;
                        }
                    }
                    for (int i = 0; i < s;i++){
                        dp[l][r] = Math.max(dp[l][r], dp[l][l + i] + dp[l + i + 1][r]);
                    }
                }
            }
            if (n % 2 == 0){
                pw.println(dp[0][n-1]);
            }else{
                pw.println(Math.max(dp[0][n-2], dp[1][n-1]));
            }
        }
        pw.flush();
    }

    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(Reader in) {
            br = new BufferedReader(in);
        }

        public FastScanner() {
            this(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String readNextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}



Measured memory_bytes: 46784
def check(left, right):
    if left == "" and right == "":
        return 1, 1
    elif left == "":
        return 0, 3
    elif right == "":
        return 3, 0

    l_c = ord(left[0])
    r_c = ord(right[0])
    if l_c < r_c:
        return 0, 3
    elif l_c > r_c:
        return 3, 0
    else:
        return check(left[1:], right[1:])


n = int(input())
l_p = 0
r_p = 0
for x in range(n):
    left, right = input().split()
    tmp = check(left, right)
    l_p += tmp[0]
    r_p += tmp[1]
print(l_p, r_p)



Measured memory_bytes: 5600
#include <iostream>
#include <string>
#include <sstream>
#include <climits>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <bitset>
#include <cassert>

using namespace std;

#define    watch(x); cout << "\n" <<  #x << " is: " << x << "\n";
#define    all(a) (a).begin(), (a).end()
#define    fi first
#define    se second

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

template<class A>
ostream& operator << (ostream& output, const vector<A>& a) {
    output << "[";
    for(auto it = a.begin(); it != a.end(); ++it) {
        if(it != a.begin()) {
            output << ", ";
        }
        output << *it;
    }
    output << "]";
    return output;
}

using lld = long long;
using pii = pair<int, int>;
using pll = pair<lld, lld>;

//const int inf = 1e9;
//const int mod = 1e9 + 7;
//const double PI = acos(-1.0);
//const int mx = 1e5 + 5;



int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
#ifndef ONLINE_JUDGE
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
#endif


    int n, k;
    cin >> n >> k;
    if(k & 1) {
        long long ans = n / k;
        cout << ans * ans * ans << endl;
    }
    else {
        long long ans1 = n / k;
        long long ans2 = (n + (k / 2)) / k;
        cout << ans1 * ans1 * ans1 + ans2 * ans2 * ans2 << endl;
    }
    return 0;
}


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

int main() {
    double t,x;
    cin >> t >> x;
    cout << t/x << endl;
}

Measured memory_bytes: 256