akhauriyash/Code-Regression huggingface dataset:
//templates
#include <iostream>
#include <algorithm>
#include <string>
#include <numeric>
#include <vector>
#include <unordered_map>
#include <map>
#include <cmath>
#include <iomanip>
#include <bitset>
#include <sstream>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define ALL(x) (x).begin(),(x).end()
#define sort_key(struct_name,key_name) [](const struct_name &x, const struct_name &y){return x.key_name < y.key_name;}
#define pb(x) push_back(x)
typedef long long ll;
const ll MOD = 1e9 + 7;
using namespace std;

//main
int main(){
    int N,M; cin >> N >> M;
    int temp;
    int ans = 0;
    int oncount;
    vector<vector<int>> KS(M, vector<int> {});
    vector<int> P(M);
    rep(i,M){
        cin >> temp;
        KS[i].pb(temp);
        rep(j,KS[i][0]){
            cin >> temp;
            KS[i].pb(temp);
        }
    }
    rep(i,M) cin >> P[i];
    for(int b = 0; b < (1<<N); b++){
        oncount = 0;
        rep(i,M){
            temp = 0;
            for(int j=1; j<KS[i][0]+1; j++){
                temp += pow(2,KS[i][j]-1);
            }
            bitset<10> bs(b & temp);
            if(P[i] == bs.count()%2) ++oncount;
        }
        if(oncount == M) ++ans;
    }
    cout << ans << endl;
}



Measured memory_bytes: 256
import java.util.Scanner;
    
    public class Main{
    public static void main(String args[]){
    int a = 0;
    int b = 0;
    int n = 1;
    Scanner scan = new Scanner(System.in);
    
    a=scan.nextInt();
    b=scan.nextInt();
    
    if(a<=0 && b>=0){
    	System.out.println("Zero");
    }else if(a>0){
    	System.out.println("Positive");
    }else{
    	for(int i=a;i<=b;i++){
    		n=n*(-1);
    	}
    	if(n<0){
    		System.out.println("Negative");
    	}else{
    		System.out.println("Positive");
    	}
    }

    }
}

Measured memory_bytes: 9932
#include <iostream>
#include <string>
 
#define N 36
#define M 1000
 
using  namespace std;
 
void detect_wrong(bool is_candidate[N][M], bool switch_is_on[N], bool bulb_is_on[M], int n, int m) {
  for (int i=0; i<m; i++) {
    if (bulb_is_on[i]) {
      continue;
    }
    for (int j=0; j<n; j++) {
      if (switch_is_on[j]) {
        is_candidate[j][i] = false;
      }
    }
  }
  for (int i=0; i<n; i++) {
    if (switch_is_on[i]) {
      continue;
    }
    for (int j=0; j<m; j++) {
      if (bulb_is_on[j]) {
        is_candidate[i][j] = false;
      }
    }
  }
}
 
void print_result(bool is_candidate[N][M], int n, int m) {
  for (int i=0; i<m; i++) {
    bool is_multiple = false;
    int switch_num = -1;
    for (int j=0; j<n; j++) {
      if (is_candidate[j][i]) {
        if (switch_num < 0) {
          switch_num = j;
        }
        else {
          is_multiple = true;
        }
      }
    }
    if (is_multiple) {
      cout << '?';
    }
    else if (switch_num < 0) {
      cout << '?';
    }
    else if (switch_num < 10) {
      cout << (char)(switch_num+'0');
    }
    else {
      cout << (char)(switch_num+'A'-10);
    }
  }
  cout << endl;
}
 
int main() {
  int n, m, q;
  string s, b;
  bool switch_is_on[N], bulb_is_on[M];
  bool is_candidate[N][M];
  while (true) {
    cin >> n >> m >> q;
    if (n == 0) {
      return 0;
    }
    for (int i=0; i<n; i++) {
      switch_is_on[i] = false;
      for (int j=0; j<m; j++) {
        is_candidate[i][j] = true;
      }
    }
    for (int i=0; i<m; i++) {
      bulb_is_on[i] = false;
    }
    for (int i=0; i<q; i++) {
      cin >> s >> b;
      for (int j=0; j<n; j++) {
        if (s[j] == '1') {
          switch_is_on[j] = !switch_is_on[j];
        }
      }
      for (int j=0; j<m; j++) {
        if (b[j] == '1') {
          bulb_is_on[j] = true;
        }
        else {
          bulb_is_on[j] = false;
        }
      }
      detect_wrong(is_candidate, switch_is_on, bulb_is_on, n, m);
    }
    print_result(is_candidate, n, m);
  }
}
 

Measured memory_bytes: 1236
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        while(true) {
            String num = sc.next();
            int i;
            int Sum = 0;
            for (i = 0; i <= (num.length() - 1); i++) {
                int x = ((num.charAt(i)) - '0');
                Sum += x;
            }
            if(Sum == 0) break;
            System.out.printf("%d\n", Sum);
        }
    }
}



Measured memory_bytes: 26712
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
const ll MOD = 1e9+7;
const ll inf = (LLONG_MAX>>1);
int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  //cout << fixed;
  //cout.precision(40);
  int h1,m1,h2,m2,k;
  cin >> h1 >> m1 >> h2 >> m2 >> k;
  int l = (h2-h1)*60+(m2-m1)-k;
  cout << l;
  return 0;
}

Measured memory_bytes: 3624
///Bismillahir Rahmanir Rahim
#include "bits/stdc++.h"

#define                           ll                          long long
#define                           int                         ll
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<ll,ll>
#define                           clr(x)                      memset(x,0,sizeof(x));
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           show(x,y)                   cout<<x<<" : ";for(auto z:y)cout<<z<<" ";cout<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

const ll inf=1e18;
const int mod=1e9+7;
const int M=100005;

 main()

{
    fast
    string s,t;
    cin>>s>>t;
    cout<<t+s<<endl;
    return 0;

}





































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

ll N, K;

signed main(){
    cin >> N >> K;
    ll keta = 1;
    while(pow(K, keta)<=N) {
        keta++;
    }
    cout << keta<< endl;
    return 0;
}

Measured memory_bytes: 512
n = int(input())
s_p = [ list(map(str, input().split())) for i in range(n)  ]

d = {}
for i, v in enumerate(s_p):
    s = v[0]
    p = v[1]
    if s not in d.keys():
        d[s] = [(i, p)]
    else:
        d[s] = sorted(d[s] + [(i,p)], key=lambda x: int(x[1]), reverse=True)

for key in sorted(d.keys()):
    for i,j in d[key]:
        print(i+1)

Measured memory_bytes: 9124
#pragma region head
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
#define len(x) ((ll)(x).size())
#define debug(var) cout << "[" << #var << "]\n" << var << endl
#define test(s) \
  if (!(s))     \
    cout << "Line " << __LINE__ << ": [" << #s << "] is false" << endl;
#define int long long
typedef long long ll;
#define double long double
typedef double ld;
const int INF = 1001001001001001001ll;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;
const double EPS = 1e-9;
const double PI = acos(-1.0);

template <typename T>
ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i];
    if (i < len - 1)
      s << ' ';
  }
  return s;
}

template <typename T>
ostream& operator<<(ostream& s, const vector<vector<T>>& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
    s << vv[i];
    if (i != len - 1)
      s << '\n';
  }
  return s;
}

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

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

__attribute__((constructor)) void initial() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}
#pragma endregion

int N;
vector<int> nums;

bool ok(int num) {
  string s = to_string(num);
  map<char, int> m;
  for (char c : s) {
    m[c]++;
  }

  return m['7'] > 0 && m['5'] > 0 && m['3'] > 0;
}

void dfs(int num) {
  if (num > N)
    return;
  if (ok(num))
    nums.pb(num);

  dfs(num * 10 + 7);
  dfs(num * 10 + 5);
  dfs(num * 10 + 3);
}


signed main() {
  cin >> N;
  dfs(0);

  int ans = len(nums);
  cout << ans << endl;
}

Measured memory_bytes: 3800
import java.util.Scanner;

public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    String t = sc.nextLine();
    
    int out = 0;
    for(int i = 0; i<s.length(); i++) {
      if(s.charAt(i) != t.charAt(i)) {
        out++;
      }
    }
    
    System.out.println(out);
  }
}


Measured memory_bytes: 42152
n = int(input())
s = []
for i in range(n):
    s.append(input())

m = int(input())
t = []
for i in range(m):
    t.append(input())

money = []
for i in range(n):
    money.append(s.count(s[i]) - t.count(s[i]))
    
print(max(max(money), 0))


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

const int MAXN = 1e5 + 5;
const int ALPHA = 26;

string s, t;
int n;
int nxt[ALPHA][MAXN];

void init() {
	for (int c = 0; c < ALPHA; c++)
		nxt[c][n] = -1;
	for (int i = n - 1; i >= 0; i--) {
		for (int c = 0; c < ALPHA; c++) {
			nxt[c][i] = nxt[c][i + 1];
		}
		nxt[s[i] - 'a'][i] = i;
	}
}

int main() {
	cin >> s >> t;
	n = s.size();
	init();
	long long res = 0;
	int idx = 0;
	bool notfound = false;
	for (int i = 0; i < (int) t.size(); i++) {
		int c = t[i] - 'a';
		if (nxt[c][idx] == -1) {
			idx = 0;
			res += n;
		}
		if (idx == 0 && nxt[c][idx] == -1) {
			notfound = true;
			break;
		}
		idx = nxt[c][idx] + 1;
	}
	res += idx;
	if (notfound)
		res = -1;
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 10752
n,k = gets.split.map(&:to_i)
num = gets.split.map(&:to_i)
check = 0
ans = 0
res = 0
40.downto(0){|i|
  if ans+2**i <= k
    check = 0
    for j in 0..n-1
      if (num[j] / (2**i)) % 2 == 1
        check += 1
      end
    end
    ans += 2**i if check*2 < n
  end
}
n.times{|i| res += ans ^ num[i]}
puts res


Measured memory_bytes: 8836
import java.util.Scanner;

public class Main {

    public static final int MOD = 1000000007;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        int h = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        double hh = 2 * Math.PI * h / 12.0;
        hh += 2 * Math.PI * m / 720.0;
        double mm = 2 * Math.PI * m / 60.0;
        double hm = Math.abs(hh - mm);
        if (hm > Math.PI) {
            hm = 2 * Math.PI - hm;
        }
        double ans = Math.sqrt(a * a + b * b - 2.0 * a * b * Math.cos(hm));
        System.out.println(ans);
    }
}

Measured memory_bytes: 35880
#include "bits/stdc++.h"
using namespace std;
const int MOD = 1e9 + 7;
typedef long long lint;
#define int lint
const int INF = 1e7;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repi(i, k, n) for (int i = (k); i < (int)(n); ++i)
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(), (x).end()
#define pb push_back
signed main()
{
    int n;
    cin >> n;
    vi h(n);
    int sum = 0;
    rep(i, n)
    {
        cin >> h[i];
        sum += h[i];
    }
    int ans = 0;
    int left = 0;
    int right = 0;
    while (1)
    {
        if (sum == 0)
        {
            cout << ans << endl;
            return 0;
        }
        int mini = 1 << 20;
        while (right < n && h[right] != 0)
        {
            mini = min(mini, h[right]);
            right++;
        }
        for (int i = left; i < right; i++)
        {
            h[i] -= mini;
        }
        if (left!=right)
        {
            sum -= mini * (right - left);
            ans += mini;
        }
        if (right == n)
        {
            left = 0;
            right = 0;
        }
        else
        {
            right++;
            left = right;
        }
    }
    return 0;
}

Measured memory_bytes: 256
import scala.io.StdIn._
object Main extends App {

  val n = readLong()
  val times = Array.tabulate(5){_ ⇒ readLong()}
  println(
    solve(times.toList, n)
  )

  def solve(times: List[Long], size: Long): Long = {
    times match {
      case h::t ⇒ math.max((size + h - 1) / h + t.length, solve(t, size) + 1)
      case Nil ⇒ 0
    }
  }
}

Measured memory_bytes: 27076
#include <iostream>
#include <iomanip>
#include <cmath>
#include <functional>
#include <algorithm>
#include <numeric>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <boost/range/irange.hpp>
#include <boost/container/static_vector.hpp>
#include <boost/utility/string_ref.hpp>

template <class Integer>
auto boost_irange(Integer last) { return boost::irange(static_cast<Integer>(0), last); }
template <class Integer>
auto boost_irange(Integer first, Integer last) { return boost::irange(first, last); }

class input
{
    std::istream& cin;

public:
    input() : cin(std::cin)
    {
        std::cin.tie(nullptr);
        std::ios::sync_with_stdio(false);
    }

    template <class T>
    inline input& operator>>(T& var)
    {
        cin >> var;
        return *this;
    }
    template <class T>
    inline input& operator,(T& var)
    {
        cin >> var;
        return *this;
    }

    template <class T>
    inline T read()
    {
        T var;
        cin >> var;
        return var;
    }

    template <class InputIterator>
    inline void read(InputIterator head, std::size_t n)
    {
        for (std::size_t i = 0; i < n; ++i) {
            cin >> *head;
            ++head;
        }
    }

    template <class T, class F>
    inline void online(std::size_t n, F&& f)
    {
        T var;
        for (std::size_t i = 0; i < n; ++i) {
            cin >> var;
            f(var);
        }
    }
};
template <class T, std::size_t n>
std::istream& operator>>(std::istream& in, std::array<T, n>& var)
{
    for (std::size_t i = 0; i < n; ++i) {
        in >> var[i];
    }
    return in;
}

class output
{
    std::ostream& cout;

public:
    class proxy
    {
        std::ostream& cout;

    public:
        proxy() : cout(std::cout) {}
        ~proxy() { cout << '\n'; }
        template <class T>
        proxy& operator,(T&& val)
        {
            cout << ' ' << val;
            return *this;
        }
    };

public:
    output() : cout(std::cout)
    {
        cout << std::fixed << std::setprecision(15);
    }

    template <class T>
    proxy operator<<(T&& val)
    {
        cout << val;
        return {};
    }
};

int main()
{
    input in;
    output out;

    int N = in.read<int>();
    std::unordered_map<std::string, std::uint64_t> map;

    std::string str;
    for (int i = 0; i < N; ++i) {
        in >> str;
        std::sort(str.begin(), str.end());
        map[str] += 1;
    }

    std::uint64_t res = 0;
    for (auto& s : map) {
        // out << s.first, s.second;
        res += s.second * (s.second - 1) / 2;
    }
    out << res;

    return 0;
}


Measured memory_bytes: 10660
P=[]
N = int(input())
P = list(map(int, input().split()))

flg=0



for n in range(N):
    if(int(P[n]) % 2):
        pass
    else:
        if((int(P[n])%3 == 0) or (int(P[n])%5 == 0)):
            pass
        else:
            flg=1

if(flg==0):
    print("APPROVED")
else:
    print("DENIED")

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main(void)
{
    string s[3];
    for(int i=0;i<3;i++){
        cin >> s[i];
    }
    for(int i=0;i<3;i++){
        cout << s[i][0];
    }
    cout << endl;
    return 0;
}


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

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

    if(N % 2 == 1)
    {
        // Nが奇数の場合は絶対奇数になる
        cout << 0 << endl;
    }
    else
    {
        unsigned long long ret = 0;
        unsigned long long warukazu = 10;
        // Nが偶数の場合、2より5のほうが少ないので5の個数を数える
        while(floor(N/warukazu) >= 1)
        {
            ret += floor((long double)N/warukazu);
            warukazu = warukazu * 5;
        }
        cout << ret << endl;
    }
    return 0;
}

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

using namespace std;

typedef long long ll;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n+1);
    a[0] =1;
    while(k--){
        ll d;
        cin >> d;
        while(d--){
            ll x;
            cin >> x;
            a[x]++;
        }
    }
    ll ans = 0;
    for(auto x: a)
        if(!x)
            ans++;
    cout << ans << '\n';
    return 0;
}
/*

*/


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

int a[3][3];
int d[3][3];

int main() {
    rep(i, 3)rep(j, 3) cin >> a[i][j];
    int n;
    cin >> n;
    rep(ni, n) {
        int x;
        cin >> x;
        rep(i,3)rep(j,3) if(a[i][j]==x) d[i][j] = 1;
    }
    bool ans = false;
    rep(i,3) {
        int cnt = 0;
        rep(j, 3) cnt += d[i][j];
        if(cnt==3) ans = true; 
    }
    rep(i,3) {
        int cnt = 0;
        rep(j, 3) cnt += d[j][i];
        if(cnt==3) ans = true; 
    }
    {
        int cnt = 0;
        rep(j, 3) cnt += d[j][j];
        if(cnt==3) ans = true; 
    }
    {
        int cnt = 0;
        rep(j, 3) cnt += d[j][2-j];
        if(cnt==3) ans = true; 
    }
    puts(ans?"Yes":"No");

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long h, n;
  cin >> h >> n;
  
  long long a[n];
  for(int i=0; i<n; i++) {
    cin >> a[i];
  }
 
  long long sum=0;
  for(int j=0; j<n; j++){
    sum = sum + a[j];
  }
  
  if(sum < h){
    cout << "No" << endl;
  }
  else{
    cout << "Yes" << endl;
  }
  
  
}
  

Measured memory_bytes: 1024
#include<cstdio>
#define N 110000
inline char gc(){
	static char now[1<<16],*T,*S;
	if (T==S){T=(S=now)+fread(now,1,1<<16,stdin);if (T==S) return EOF;}
	return *S++;
} 
inline int read(){
	int x=0;char ch=gc();
	while (ch<'0'||ch>'9') ch=gc();
	while (ch<='9'&&ch>='0'){x=x*10+ch-'0';ch=gc();}
	return x;
}
inline int gcd(int x,int y){
	if (y==0) return x;return gcd(y,x%y);
}
int cur,n,a[N],mod,g1[N],g2[N];long long sum;
void printans(){
	if (!cur) printf("Second");else printf("First");
}
int main(){
//	freopen("d.in","r",stdin);
	n=read();
	for (int i=1;i<=n;++i) a[i]=read(),(mod+=a[i]%2)%=2;
	if (n%2&&!mod) {printf("First");return 0;}
	if (!(n%2)) {if (mod) printf("First");else printf("Second");return 0;}
	while (1){sum=0;
		for (int i=1;i<=n;++i) g1[i]=gcd(a[i],g1[i-1]);
		for (int i=n;i>=1;--i) g2[i]=gcd(a[i],g2[i+1]);
		for (int i=1;i<=n;++i) sum+=a[i];int g;
		for (int i=1;i<=n;++i){
			if (a[i]==1) {printans();return 0;}
			g=gcd(g1[i-1],gcd(a[i]-1,g2[i+1]));
			if (((sum-1)/g)%2) break;
		}
		if (g==1) {printans();return 0;}
		for (int i=1;i<=n;++i) a[i]/=g;
		cur^=1;
	}
	return 0;
}

Measured memory_bytes: 1536
// while (clock()<=69*CLOCKS_PER_SEC)
// #pragma comment(linker, "/stack:200000000")
// #pragma GCC optimize("O3")
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// #pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define pb push_back
#define SZ(x) ((int)(x).size())
#define ALL(x) x.begin(),x.end()
#define all(x) x.begin(),x.end()
#define fi first
#define se second
#define _upgrade ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define erase_duplicates(x) sort(all(x)); (x).resize(distance((x).begin(), unique(all(x))));


using namespace std;
using namespace __gnu_pbds;
template<typename T>
using ordered_set = tree<
T,
null_type,
less<T>,
rb_tree_tag,
tree_order_statistics_node_update>;

//X.find_by_order(k); - zwraca iterator na k-ty element (numeracja od zerowego)
//X.order_of_key(k); - zwraca liczbę elementów ostro mniejszych niż k

typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL,LL> PLL;
typedef vector<PII> VPII;
typedef vector<PLL> VPLL;
typedef vector<LL> VLL;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef long double LD;
typedef pair<LD,LD> PLD;
typedef vector<LD> VLD;
typedef vector<PLD> VPLD;

template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<" = "<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;
  cerr<<" = "<<h<<", "; _dbg(sdbg+1, a...);
}

#ifdef LOCAL
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define dbg(...)
#define cerr if(0)cout
#endif

const int maxn = (1e6)+7;
const int maxk = 20;
const int inf = (1e9)+7;
const LL LLinf = ((LL)1e18)+7LL;
const LD eps = 1e-9;
const LL mod = 1e9+7;

// ***************************** CODE ***************************** //

VPII wek;
LL n, m, v, p;

bool ok(int pos)
{
  if(SZ(wek) - pos <= p)
    return 1;
  LL val = (v - p - pos) * m;
  LL maxi = wek[pos].fi + m;
  for(int i = pos + 1;SZ(wek) - i >= p;i++)
  {
    val -= min(maxi - wek[i].fi, m);
    if(maxi < wek[i].fi)
      return 0;
  }
  if(val <= 0)
    return 1;
  return 0;
}

int main()
{
	_upgrade
  cin>>n>>m>>v>>p;
  for(int i = 1;i <= n;i++)
  {
    int a;
    cin>>a;
    wek.pb({a, i});
  }
  sort(all(wek));
  int L = -1;
  int P = SZ(wek);
  while(L + 1 < P)
  {
    int sr = (L + P) / 2;
    if(ok(sr))
      P = sr;
    else
      L = sr;
  }
  cout<<SZ(wek) - P;
	return 0;
}


Measured memory_bytes: 1400
#include<iostream>
#include<cstring>
#include<algorithm>
#define M 100
using namespace std;
int n,l,ans,a[M];
int main()
{
    while(scanf("%d%d",&n,&l)!=EOF)
    {
        ans = 0;
        for (int i = 0; i < n; i++)
            scanf("%d",&a[i]);
        sort(a,a+n);
        for (int i = n-l; i < n; i++)
            ans+=a[i];
        printf("%d\n",ans);
    }
    return 0;
}

Measured memory_bytes: 256
import Control.Applicative ((<$>), (<*>))
import Control.Monad
import Data.List

main :: IO ()
main = do
  solve <$> getLine <*> getLine <*> getLine >>= putStrLn

solve :: String -> String -> String -> String
solve sa sb sc = f 'a' sa sb sc
  where
    f x as bs cs
      | x == 'a' && null as = "A"
      | x == 'a' = f (head as) (tail as) bs cs
      | x == 'b' && null bs = "B"
      | x == 'b' = f (head bs) as (tail bs) cs
      | x == 'c' && null cs = "C"
      | otherwise = f (head cs) as bs (tail cs)


Measured memory_bytes: 508
#include <vector> 
#include <list> 
 #include <map>
 #include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
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 SORT(c) sort((c).begin(),(c).end())

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

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

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

int NUM[4];
string splus="+",sminus="-";
string s[4];
int dfs(int index,int sum){

    if(index==4){
        if(sum==7){
        return 1;
        }
        else{
            return 0;
        }
    }
    

    if(dfs(index+1,sum+NUM[index])){
        cerr<<splus;
        cerr<<NUM[index]<<endl;
        
        s[index]=splus;
        return 1;
    }
    else if(dfs(index+1,sum-NUM[index])){
        cerr<<sminus;
        cerr<<NUM[index]<<endl;
        s[index]=sminus;
        return 1;
    }
    return 0;
}

int main(){
 
    // REP(i,4){
    //     int a;
    //     cin>>a;
    //     NUM[i]=a;
    //     cerr<<NUM[i]<<endl;
    // }
    int a;
    cin>>a;
    NUM[0]=a/1000;
    NUM[1]=a/100-10*NUM[0];
    NUM[2]=a/10-10*NUM[1]-100*NUM[0];
    NUM[3]=a-10*NUM[2]-100*NUM[1]-1000*NUM[0];
    // REP(i,4){
    //     cerr<<NUM[i]<<endl;
    // }
    dfs(1,NUM[0]);

    // REP(i,4){
    //     cerr<<s[i]<<endl;
    // }
    REP(i,3){
        cout<<NUM[i]<<s[i+1];
    }
    cout<<NUM[3]<<"=7";
    cout<<endl;


}


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

void solve(){

	int n ;
	cin>>n ;

	vector<int> a(n) ;


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

	if(n==1){
		cout<<"Yes" ;
		return ;
	}

	for(int i=n-2;i>=0;i--){
		if(a[i]>a[i+1]){
			a[i]-- ;
		}

	}

	for(int i=n-2;i>=0;i--){
		if(a[i]>a[i+1]){
			cout<<"No" ;
			//cout<<a[i]<<" " <<a[i+1] ;
			return ;
		}
	}

	cout<<"Yes" ;

}


int main(){

	
	int y ;

	y=1 ;
	//cin>>y ;

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

}

Measured memory_bytes: 3784
#include<bits/stdc++.h>
#define all(x) x.begin() , x.end()
#define ll long long 
#define pb push_back
#define mp make_pair

using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n , l ; cin>>n>>l;
    int sum = 0;
    bool zero  = false;
    for(int i = 0 ; i < n; ++i){
        sum += l + i;
        if(l + i == 0){
            zero = true;
        }
    }
    if(zero)cout<<sum<<" ";
    else if(l < 0) cout<<sum - (l + n - 1)<<" ";
    else cout<<sum - l<<" ";
}

Measured memory_bytes: 256
while (line = gets) do
  person_count, initial_stone_count = line.split.map(&:to_i)
  break if  person_count == 0 && initial_stone_count == 0
  my_stones = Array.new(person_count, 0)

  stone_count = initial_stone_count
  turn_count = 0

  while true do
    index = turn_count % person_count

    if stone_count == 1
      if my_stones[index] == initial_stone_count - 1
        p index
        break
      end
    end

    if stone_count == 0
      stone_count += my_stones[index]
      my_stones[index] = 0
    else
      stone_count -= 1
      my_stones[index] +=1
    end

    turn_count += 1
  end
end

Measured memory_bytes: 8684
// https://atcoder.jp/contests/aising2020/tasks/aising2020_c

use proconio::fastout;
use proconio::input;

#[fastout]
fn main() {
    input! {
       n: f64,
    }
    let mut vec: Vec<u64> = vec![0; 1 + n as usize];
    for x in 1..=n.sqrt() as u64 {
        for y in 1..=n.sqrt() as u64 {
            for z in 1..=n.sqrt() as u64 {
                let nn = x * x + y * y + z * z + x * y + y * z + z * x;
                if nn <= n as u64 {
                    vec[nn as usize] += 1;
                }
            }
        }
    }
    for i in 1..=n as usize {
        println!("{}", vec[i]);
    }
}


Measured memory_bytes: 2264
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;

double R,L,H;
double P,E,T;
int k;

double sleep(double L,double R,double k){
  double H = (L+R)/2;
  if(!k){
    if(abs(T-H)>E)return 0.0;
    return 1.0;
  }

  if(T-E<R && L<T+E)return 1.0;
  if(T+E < R)return 0.0;
  if(T-E > L)return 0.0;

  if(H<T)return P*sleep(H,R,k-1) + (1.0-P)*sleep(L,H,k-1);
  else return (1.0-P)*sleep(H,R,k-1) + P*sleep(L,H,k-1);
}

int main(){
  cin >> k >> R >> L >> P >> E >> T;

  printf("%.8lf\n",sleep(L,R,k));
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
char a[110],b[110],c[110];
int main()
{
    int n;
    scanf("%d",&n);
    scanf("%s",a);
    scanf("%s",b);
    scanf("%s",c);
    int ans=0;
    for(int i=0;i<n;i++)
    {
        if(a[i]==b[i])
        {
            if(a[i]!=c[i]) ans+=1;
        }
        else
        {
            if(a[i]==c[i]) ans+=1;
            else
            {
                if(b[i]==c[i]) ans+=1;
                else ans+=2;
            }
        }
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 256
A = input()
B = input()
C = input()

now = A[:1]
A = A[1:]

while(1):
    if(now == 'a'):
        if(len(A) == 0):
            print("A")
            exit()
        now = A[:1]
        A = A[1:]
    elif(now == 'b'):
        if(len(B) == 0):
            print("B")
            exit()
        now = B[:1]
        B = B[1:]
    else:
        if(len(C) == 0):
            print("C")
            exit()
        now = C[:1]
        C = C[1:]


Measured memory_bytes: 9036
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <string.h>
#include <math.h>
#include <algorithm>

using namespace std;


int main() {
	string s, t;
	cin >> s >> t;
	int ans = 0;

	for (int i = 0;i < s.size();i++) {
		if (s[i] != t[i]) {
			ans++;
		}
	}

	cout << ans << endl;

	return 0;
}

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

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)
#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using ll = long long;
using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using ld = long double;

#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

long int M = 1e+9+7;
int inf = 1e+9;

ll solve(ll ans,ll sum,vi a,int n){
    ll sa;
    srep(i,1,n){
        if(sum > 0){
            sum+=a[i];
            if(sum > -1){
                sa = sum+1;
                sum-=sa;
                ans+=sa;
            }
        }else if(sum < 0){
            sum+=a[i];
            if(sum < 1){
                sa = 1-sum;
                sum+=sa;
                ans+=sa;
            }
        }
    }
    return ans;
}

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << std::setprecision(10);

    int n;
    cin >> n;
    vi a(n);
    rep(i,n){
        cin >> a[i];
    }

    ll psum=a[0];
    ll msum=a[0];
    ll pans=0,mans=0;
    if(psum < 1){
        ll sa = 1-psum;
        psum+=sa;
        pans+=sa;
    }
    if(msum > -1){
        ll sa = msum+1;
        msum-=sa;
        mans+=sa;
    }

    pans = solve(pans,psum,a,n);
    mans = solve(mans,msum,a,n);
    cout << min(pans,mans) << endl;
    return 0;
}

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

int n, a[10], ans;

int func(int a[], int i, int prod){
  if (i==n){
    ans += (prod%2==0);
  } else {
    func(a, i+1, prod*(a[i]-1)%2);
    func(a, i+1, prod*(a[i])%2);
    func(a, i+1, prod*(a[i]+1)%2);
  }
}

int main(void){
  cin >> n;
  for (int i=0; i<n; i++) cin >> a[i];
  func(a, 0, 1);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=n-1;i>=(0);i--)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define all(v) (v).begin(),(v).end()
#define eall(v) unique(all(v), v.end())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll INFF = 1e18;

int N, M;
int a[100010], b[100010];
vector<int> v[100010];
int main(void){
	cin >> N >> M;
	rep(i, M) cin >> a[i] >> b[i];
	rep(i, M) a[i]--, b[i]--;
	rep(i, M){
		v[a[i]].pb(b[i]), v[b[i]].pb(a[i]);
	}
	rep(i, N){
		if(v[i].size() % 2 == 1){
			printf("NO\n");
			return 0;
		}
	}
	printf("YES\n");
	return 0;
}

Measured memory_bytes: 6144
#include <bits/stdc++.h>
#include <string>
using namespace std;
#define ll long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
#define _GLIBCXX_DEBUG

void printv(vector<int> v) {
  for (int i : v)
    cout << i << " ";
  cout << endl;
}

int main() {
  int q;
  cin >> q;
  rep(loop, q) {
    int n;
    cin >> n;
    int now = n;
    int ans = 0;
    while (now > 9) {
      string stNum = to_string(now);
			int numSize=stNum.size();
      int maxNum = 0;
      for (int i = 1; i < numSize; i++) {
        int num1 = stoi(stNum.substr(0, i));
        int num2 = stoi(stNum.substr(i, numSize - i));
        maxNum = max(maxNum, num1 * num2);
      }
      now = maxNum;
      ans++;
    }
    cout << ans << endl;
  }
}



Measured memory_bytes: 3288
Imports System

Public Class Program

    Public Shared Sub Main()

        Dim N As Integer = Integer.Parse(Console.ReadLine())
        Dim InputString() As String = Console.ReadLine().Split(" ")
        Dim InputInteger(N - 1) As Integer

        For i As Integer = 0 To N - 1

            InputInteger(i) = Integer.Parse(InputString(i))

        Next

        Array.Sort(Of Integer)(InputInteger)

        Dim dif As Integer = 0

        For i As Integer = N - 1 To 0 Step -2
            dif = dif + InputInteger(i)
            If Not (i = 0) Then
                dif = dif - InputInteger(i - 1)
            End If

        Next



        Console.WriteLine(dif)

    End Sub
End Class


Measured memory_bytes: 13140
'use strict'

const INF = 900719925474099;
function mapint(temp){
    return temp.split(' ').map((v)=>parseInt(v));
}
function lower_bound(d,a,b,e){for(var c;1<b-a;)d[c=0|(a+b)/2]<e?a=c:b=c;return d[a]<e?b:a};
const MOD = 1000000007;

function Main(input){
    let temp = input.trim().split('\n');
    let temp2 = mapint(temp[0]);
    let n = temp2[0];
    let x = temp2[1];
    let l = mapint(temp[1]);

    let d = 0;
    let count = 1;
    for(let i=0;i<n;i++){
        d=d+l[i];
        if(d>x) break;
        count++;
    }

    console.log(count);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 21064
n, h = map(int, input().split())
katana = [tuple(map(int, input().split())) for _ in range(n)]
maxa = 0
for a, _ in katana:
    maxa = max(maxa, a)
bgreedy = 0
count = 0
katana.sort(key = lambda x: x[1], reverse = True)
for a, b in katana:
    if b < maxa:
        break
    bgreedy += b
    count += 1
    if h <= bgreedy:
        print(count)
        exit()
print(count + (h - bgreedy)//maxa + int((h-bgreedy) % maxa != 0))

Measured memory_bytes: 18076
import java.util.Scanner;

public class Main {
	//java11

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		long[] A = new long[N];
		for(int i=0; i<N; i++) {
			A[i] = sc.nextLong();
			if(A[i] == 0) {
				System.out.println(0);
				return;
			}
		}

		long ans = A[0];
		for(int i=1; i<N; i++) {
			if(A[i] <= (1000000000000000000L / ans)) {
				ans *= A[i];
			}else {
				System.out.println(-1);
				return;
			}
		}

		System.out.println(ans);

	}

}


Measured memory_bytes: 61364
//Bismillahir Rahmanir Rahim
#include <bits/stdc++.h>
using namespace std;

typedef long long              ll;
typedef long double            ld;
typedef pair<int, int>         pi;
typedef vector<int>            vi;
typedef vector<pair<int, int>> vpi;

#define pb       push_back
#define all(x)   begin(x), end(x)
#define sz(x)    (int)(x).size()
#define ff       first
#define ss       second
#define mp       make_pair
#define lb       lower_bound
#define ub       upper_bound
#define tcase()  int t; cin >> t; while(t--)

const int MOD = 1e9 + 7; // 998244353;
const int MX  = 2e5 + 5;
const ll  INF = 1e18;
const ld  PI  = acos((ld) -1);

void setIO(string name = "") {
    ios_base::sync_with_stdio(0); cin.tie(0);
    if(sz(name)){
        freopen((name+".in").c_str(), "r", stdin);
        freopen((name+".out").c_str(), "w", stdout);
    }
}

int n;
int arr[MX];
bool NotOk[1000002];

int main(){

    setIO();

    cin >> n;

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

    sort(arr, arr + n);

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

        if(i != 0 && arr[i] == arr[i - 1]){
            NotOk[arr[i]] = true;
            continue;
        }

        for(int j = 2 * arr[i]; j <= 1000000; j += arr[i]) NotOk[j] = true;
    }

    int Ans = 0;

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

        if(!NotOk[arr[i]]) Ans++;
    }

    cout << Ans;
}


Measured memory_bytes: 5372
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<char> vchar;
typedef vector<vector<char>> vvchar;
typedef vector<int> vint;
typedef vector<vector<int>> vvint;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
typedef priority_queue<long long> prque;
#define ain(i,n,a) for(long long i=0;i<(long long)(n);i++){cin>>a[i];}
#define aout(i,n,a) for(long long i=0;i<(long long)(n);i++){if(i){cout<<" ";}cout<<a[i];if(i==n-1){cout<<endl;}}
#define rep(i,n) for(long long i=0;i<(long long)(n);i++)
#define vsort(v) sort((v).begin(),(v).end())
#define vrsort(v) sort((v).rbegin(),(v).rend())
#define vreverse(v) reverse((v).begin(),(v).end())
#define pf(a) push_front(a)
#define pb(a) push_back(a)
#define INF 1998021900
#define MOD 1000000007
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  //input
  string s;cin>>s;s.at(3)='8';cout<<s<<endl;
  //caricurate
  //output
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<algorithm>
#include<stdint.h>
#include<vector>
#include<deque>
#include<stack>
#include<functional>
#include<string>
#include<cstring>
#include<time.h>
#include<array>
#include<iomanip>
#include<list>
#include<set>
#include<map>
#include<random>
#include<unordered_map>
#include<unordered_set>
#include<bitset>
#include <queue>


using namespace std;
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using ldouble = long double;


//BDD,ZDD,kdtree, bdtree,bicalc, bolonoy, doloney, tree, chinesemod,segmenttree,daikusutora, saidairyuu, 2bugurahu, heirokenshutu, topologicalsort, kyourenketuseibun

#define REP(i,a,b) for(ll i = a; i < b; ++i)
#define PRI(s) cout << s << endl
#define PRIY PRI("Yes")
#define PRIN PRI("No")
#define mins(a,b) a = min(a,(decltype(a))(b))
#define maxs(a,b) a = max(a,(decltype(a))(b))



int main() {
	ll N;
	cin >> N;
	vector<ll> S(N);
	REP(i, 0, N) cin >> S[i];
	vector<vector<ll>> dp(N);
	ll ans = 0;
	REP(c, 1, N) {
		dp[c].push_back(0);
		unordered_set<ll> buf;
		REP(n, 1, N) {
			if (!(n * c < N - 1))break;
			if (buf.count(n * c) > 0 || buf.count(N - 1 - n * c) > 0)break;
			if ((N - 1 - n * c) % c == 0 && !((N - 1 - n * c) / c > n))break;
			if (N - 1 - n * c - c <= 0) break;
			dp[c].push_back(dp[c][n - 1] + S[n * c] + S[N - 1 - n * c]);
			buf.insert(n * c);
			buf.insert(N - 1 - n * c);
			maxs(ans, dp[c].back());
		}
	}
	PRI(ans);
	return 0;
}




Measured memory_bytes: 20060
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <climits>
#include <cstring>
#include <string>
#include <set>
#include <bitset>
#include <map>
#include <queue>
#include <stack>
#include <vector>
#include <list>
#define rep(i,m,n) for(i=m;i<=n;i++)
#define mod 1000000007
#define inf 0x3f3f3f3f
#define vi vector<int>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ll long long
#define pi acos(-1.0)
#define pii pair<int,int>
#define Lson L, mid, ls[rt]
#define Rson mid+1, R, rs[rt]
#define sys system("pause")
#define intxt freopen("in.txt","r",stdin)
const int maxn=1e3+10;
using namespace std;
ll gcd(ll p,ll q){return q==0?p:gcd(q,p%q);}
ll qpow(ll p,ll q){ll f=1;while(q){if(q&1)f=f*p%mod;p=p*p%mod;q>>=1;}return f;}
inline void umax(int &p,int q){if(p<q)p=q;}
inline void umin(int &p,int q){if(p>q)p=q;}
inline ll read()
{
    ll x=0;int f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
int n,m,k,t,a,b,c,d;
ll fac[maxn],dp[2][maxn];
void init()
{
    fac[0]=1;
    for(int i=1;i<=maxn-10;i++)
    {
        fac[i]=fac[i-1]*i%mod;
    }
}
int main()
{
    int i,j;
    init();
    scanf("%d%d%d%d%d",&n,&a,&b,&c,&d);
    dp[t][n]=1;
    for(int i=a;i<=b;i++)
    {
        for(int j=0;j<=n;j++)dp[t^1][j]=dp[t][j];
        ll tmp=1;
        for(int j=1;j<=d;j++)
        {
            if(j*i>n)break;
            tmp=tmp*qpow(fac[i],mod-2)%mod*qpow(j,mod-2)%mod;
            if(j<c)continue;
            for(int k=j*i;k<=n;k++)
            {
                ll ok=fac[k]*qpow(fac[i*j],mod-2)%mod*qpow(fac[k-i*j],mod-2)%mod;
                dp[t^1][k-j*i]=(dp[t^1][k-j*i]+dp[t][k]*ok%mod*fac[i*j]%mod*tmp%mod)%mod;
            }
        }
        t^=1;
    }
    printf("%lld\n",dp[t][0]);
    //system("Pause");
    return 0;
}


Measured memory_bytes: 256
D = int(input())
C = list(map(int, input().split()))
S = [list(map(int, input().split())) for _ in range(D)]
T = [int(input()) for _ in range(D)]

ans = []
val = 0
sch = [0]*26
for d in range(D):
    day = d+1
    t = T[d]-1
    sch[t] = day

    down = 0
    for i in range(26):
        down += C[i]*(day - sch[i])

    val = val + S[d][t] - down
    ans.append(val)

print(*ans, sep="\n")

Measured memory_bytes: 9500
program fizzbuzz
 
 implicit none
 integer(8) :: n,ans,i
 integer(8),allocatable :: a(:)

 read*,n
 allocate(a(n))
 ans=0
 
 
 do i=1,n
  if(mod(i,3)==0 .or. mod(i,5)==0) then 
      a(i)=0
  else
      a(i)=i
     ! print*,a(i)
  end if
  ans=ans+a(i)
 end do 
   

 print*,ans

end program fizzbuzz

Measured memory_bytes: 10436
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define RREP(i, s, n) for (int i = s; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
using namespace std;
using ll = long long;
typedef pair<int, int> pint;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
const int inf = (1<<29);

int main() {

    int N, K, Q;
    cin >> N >> K >> Q;
    
    vector<int> A(Q);
    map<int, int> mp;
    for (int i = 0; i < Q; i++) {
        cin >> A[i];
        mp[A[i]-1] += 1;
    }

    for (int i = 0; i < N; i++) {
        cout << ((Q-mp[i] < K) ? "Yes" : "No") << endl;
    }
    

    // for (int i = 0; i < Q; i++) {
    //     for (int j = 0; j < A[i]-1; j++) {
    //         point[j] --;
    //     }
    //     for (int j = A[i]; j < N; j++) {
    //         point[j] --;
    //     }
    // }
    
    

    return 0;
}

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

typedef unsigned long long ull;
#define loop(i,a,b) for(int i=(a);i<ull(b);++i)
#define rep(i,n) loop(i,0,n)

const double eps = 1e-10;
const double pi  = acos(-1.0);
const double inf = (int)1e8;

int main(){
    int q;
    cin >> q;
    rep(p, q){
        string s, m;
        cin >> s >> m;
        reverse(s.begin(), s.end());
        for(int i=0; i< s.size(); i++){
            if(s[i] == 'J'){
                if(1 <= m.size())m = m.substr(m.size()-1, 1) + m.substr(0, m.size()-1);
            }
            if(s[i] == 'C'){
                if(1 <= m.size())m = m.substr(1) + m.substr(0, 1);
            }
            if(s[i] == 'E'){
                if(1 <= m.size()){
                    if(m.size()%2 == 0)m = m.substr(m.size()/2)+ m.substr(0, m.size()/2);
                    else m = m.substr(m.size()/2+1) + m.substr(m.size()/2, 1) + m.substr(0, m.size()/2);
                }
            }
            if(s[i] == 'A') reverse(m.begin(), m.end());
            if(s[i] == 'P'){
                for(int j=0; j< m.size(); j++){
                    if('0' <= m[j] && m[j] <= '9'){
                        if(m[j] == '0') m[j] = '9';
                        else m[j]--;
                    }
                }
            }
            if(s[i] == 'M'){
                for(int j=0; j< m.size(); j++){
                    if('0' <= m[j] && m[j] <= '9'){
                        if(m[j] == '9') m[j] = '0';
                        else m[j]++;
                    }
                }
            }
        }
        cout << m << endl;
    }
}

Measured memory_bytes: 1208
import numpy as np
import math
N, K = map(int, input().split())
aaa = np.array(list(map(float, input().split())), dtype='f8')
l = 0
r = 10 ** 9
while r != l:
    mid = (r + l) // 2
    bbb = aaa / mid
    bbb -= 1
    bbb = np.ceil(bbb)
    if bbb.sum() <= K:
        r = mid
    else:
        l = mid + 1
print(l)


Measured memory_bytes: 49604
#include <iostream>
#include <algorithm>
#include <iomanip>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define IN(v) int v;cin>>v;
#define OUT(v) cout<<v<<"\n"

double dp[303][303][303];
int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  IN(N);

  int count[3];
  count[0] = count[1] = count[2] = 0;
  REP(i, N) {
    IN(a);
    ++count[a-1];
  }
  REP(i, N+1) {
    REP(j, N+1) {
      REP(k, N+1) {
        if (i + j + k == 0)
          continue;
        dp[i][j][k] = 1.0 * N / (i + j + k);
        if (i - 1 >= 0)
          dp[i][j][k] += (double)dp[i-1][j+1][k] * i / (i + j + k);
        if (j - 1 >= 0)
          dp[i][j][k] += (double)dp[i][j-1][k+1] * j / (i + j + k);
        if (k - 1 >= 0)
          dp[i][j][k] += (double)dp[i][j][k-1] * k / (i + j + k);
      }
    }
  }
  OUT(fixed << setprecision(11) << dp[count[2]][count[1]][count[0]]);

  return 0;
}


Measured memory_bytes: 217344
#include<bits/stdc++.h>
#define rep(i, n) for(i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define MOD 1000000007
 
int main(){
  ll N, i, X, Y, Z;
  cin >> X >> Y >> Z;
 
  cout << Z << " " << X << " " << Y << endl;
  return 0;
}

Measured memory_bytes: 256
-module('Main').
-export([main/1]).

solve() ->
    [A, B] = input("~d~d"),
    io:format("~s~n", [case A * B rem 2 of
        0 -> "Even"; 1 -> "Odd" end]),
    ok.

main(_) ->
    solve(),
    halt().

input(Pat) ->
    {ok, L} = io:fread("", Pat),
    L.


Measured memory_bytes: 21724
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <cstdlib>

typedef long long ll;

using namespace std;

int main() {
    int a;
    string b;

    cin >> a;
    cin >> b;

    if (a >= 3200)
    {
        cout << b << endl;
    } else {
        cout << "red" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <map>
#include <math.h>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

typedef long long ll;

char s[8];

int main() {

   int N;
   scanf("%d", &N);
   int ac = 0, wa = 0, tle = 0, re = 0;
   for (int i = 0; i < N; i++) {
      scanf("%s", s);
      if (strcmp("AC", s) == 0) {
         ac++;
      } else if (strcmp("WA", s) == 0) {
         wa++;
      } else if (strcmp("TLE", s) == 0) {
         tle++;
      } else if (strcmp("RE", s) == 0) {
         re++;
      }
   }
   printf("AC x %d\n", ac);
   printf("WA x %d\n", wa);
   printf("TLE x %d\n", tle);
   printf("RE x %d\n", re);

   return 0;
}

Measured memory_bytes: 1736