akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxx = 1e5 + 7;
const ll Inf = 1ll << 60;
ll n;
ll a[maxx];
ll ans = Inf;
ll res = 0;

int main() {
	cin >> n;
	for(int i = 1; i <= n; i++) cin >> a[i];
	bool flg = 0;
	ll sum = 0;
	for(int i = 1; i <= n; i++) {
		sum += a[i];
		if(!flg) {
			if(sum <= 0) {
				res = res + 1 - sum;
				sum = 1;
			}
		}
		else {
			if(sum >= 0){
				res = res + sum + 1;
				sum = -1;
			}
		}
		flg ^= 1;
	}
	ans = min(ans, res);
	res = 0;
	sum = 0;
	flg = 0;
	for(int i = 1; i <= n; i++) {
		sum += a[i];
		if(flg) {
			if(sum <= 0) {
				res = res + 1 - sum;
				sum = 1;
			}
		}
		else {
			if(sum >= 0) {
				res = res + sum + 1;
				sum = -1;
			}
		}
		flg ^= 1;
	}
	ans = min(ans, res);
	cout << ans << endl;
}

Measured memory_bytes: 1024
#include <stdio.h>

/* out function */
void trace(int A[], int N){
    int i;
    for( i = 0; i < N; i++ ){
        if( i > 0) printf(" "); // single space to separate elments
        printf("%d", A[i]);
    }
    printf("\n");
}

/* insert sort (zero origin) */
void BubbleSort(int A[], int N){
    int i, j, v;
    int c = 0; // number of swap operations
    for( i = 0; i < N; i++ ){
        for( j = N -1; j >= (i + 1); j-- ){
            if( A[j] < A[j-1] ){
                v = A[j];
                A[j] = A[j-1];
                A[j-1] = v;
                c++; // count up
            }
        }
    }

    /* print sorted sequence */
    trace(A, N); 
    /* print the number of swap operations */
    printf("%d\n",c);
}

/* main function */
int main(){
    int N, i;
    int A[100];

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

    BubbleSort(A, N);

    return 0;    
}


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

using namespace std;
using ll = long long;


int main()
{
  ios_base::sync_with_stdio (0);
  cin.tie (0);
  int m, d;
  cin >> m >> d;
  int ans = 0;
  for (int i = 1; i <= m; i++) {
    for (int j = 22; j <= d; j++) {
      int d1 = j % 10;
      int d10 = j / 10;
      if (d1 >= 2 && d10 >= 2 && d1 * d10 == i) {
        ans++;
      }
    }
  }
  cout << ans << '\n';
  return 0;
}


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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int x;
    cin >> x;
    int rad = 360;
    int k = 0;
    while (rad != 0) {
        if (rad >= x) {
            rad -= x;
        } else {
            rad -= x;
            rad += 360;
        }
        ++k;
    }
    cout << k << '\n';
    return 0;
}

Measured memory_bytes: 3644
#include <stdio.h>
#include <string.h>

#define LEFT_KEYS  ("qwert" "asdfg" "zxcvb")
#define MAXLEN 32

int leftKeyTbl['z' - 'a' + 1];

void initialize()
{
  const char *p;
  for (p = LEFT_KEYS; *p != '\0'; p++) {
    leftKeyTbl[*p - 'a'] = 1;
  }
}


int isLeftKey(char c)
{
  return leftKeyTbl[c - 'a'];
}

int main()
{
  static char str[MAXLEN + 1];
  int i, prev, now, n;
  initialize();
  for (;;) {
    scanf("%s", str);
    if (strcmp(str, "#") == 0) break;
    prev = isLeftKey(str[0]);
    n = 0;
    for (i = 1; str[i] != '\0'; i++) {
      now = isLeftKey(str[i]);
      if (prev != now) n++;
      prev = now;
    }
    printf("%d\n", n);
  }
  return 0;
}

Measured memory_bytes: 540
import java.util.*;

class Main {
    public static void main (String[] args){
        Scanner stdIn = new Scanner(System.in);
        int[] A = new int[3];
        int sum = 0;
        for(int i = 0; i<3; i++){
            A[i] = stdIn.nextInt();
            sum += A[i];
        }

        if(sum >= 22)
            System.out.print("bust");
        else
            System.out.print("win");
      


    }
}

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

int main() {
  
  int n;
  cin >> n;
  int to=n;
  vector<int>a(n);
  rep(i,n){
    cin>>a.at(i);
    a.at(i)--;
  }
  int ans=0;
  rep(i,n){
    if(a.at(a.at(i))==i){
      ans++;
    }
  }
  cout<<ans/2<<endl;  
}

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

using namespace std;

long long w[105], v[105], dp[105][(int)1e5+10];

int main(){

    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int N, W;
    cin >> N >> W;

    for(int i=1;i<=N;++i){
        cin >> w[i] >> v[i];
        dp[i][w[i]] = v[i];
    }
    
    for(int i=2;i<=N;++i){
        for(int j=1;j<=W;++j)
            if(dp[i-1][j]){
                dp[i][j] = max(dp[i][j], dp[i-1][j]);
                if(j + w[i] <= W)
                    dp[i][j+w[i]] = max(dp[i][j+w[i]], dp[i-1][j] + v[i]);
            }
    }

    long long maxx = 0;
    for(int i=1;i<=W;++i)
        maxx = max(maxx, dp[N][i]);

    cout << maxx << '\n';

    return 0;
}

Measured memory_bytes: 78080
/* Manish Pant - insider_pants, hello_my_friend */
    
#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 F first
#define S second
#define endl "\n"
#define pb push_back

typedef long long ll;
typedef long double ldob;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

template <class T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << " "; return os; }
template <class T> ostream& operator << (ostream &os, const set<T> &v) { for (T i : v) os << i << " "; return os; }
template <class T> ostream& operator << (ostream &os, const multiset<T> &v) { for (T i : v) os << i << " "; return os; }
template <class T, class S> ostream& operator << (ostream &os, const pair<T, S> &v) { os << v.F << ' ' << v.S; return os; }
template <class T, class S> ostream& operator << (ostream &os, const map<T, S> &v) { for (auto i : v) os << '(' << i.F << " => " << i.S << ')' << ' '; return os; } 

void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}

const int N = 1e5 + 5;
int n, m;
vector<set<int>> v(N);
vector<int> h(N);

void solve()
{
    int ans = 0;
    for(int i = 1; i <= n; i++)
    {
        bool f = 1;
        for(int j:v[i])
        {
            if(h[j] >= h[i]) f = 0;
        }
        if(f) ans++;
    }
    cout << ans << endl;
}

int main()
{
    fast();
    cin >> n >> m;
    for(int i = 1; i <= n; i++) cin >> h[i];
    for(int i = 0; i < m; i++)
    {
        int a, b; cin >> a >> b;
        v[a].insert(b);
        v[b].insert(a);
    }
    solve();
}

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

#define int long long
#define double long double
#define rep(i,n) for(int i=0;i<n;i++)
#define mod 1000000007 // 10^9+7
#define INF 99999999999 //10^12-1
#define dev 998244353 //tenka1
#define P pair<int,int>
#define F first
#define S second
int n,m;
string s,t;
int gcd(int a,int b){
    if(a%b==0)return b;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    int g=gcd(a,b);
    return a*b/g;
}
signed main(){
    cin>>n>>m>>s>>t;
    if(s[0]!=t[0])cout<<-1<<endl;
    else if(gcd(n,m)==1)cout<<n*m<<endl;
    else{
        bool ans=true;
        int lm=n/gcd(n,m),ln=m/gcd(n,m);
        rep(i,gcd(n,m)){
            int x=lm*i,y=ln*i;
            if(s[x]!=t[y])ans=false;
        }
        if(ans)cout<<lcm(n,m)<<endl;
        else cout<<-1<<endl;
    }
    return 0;
}


Measured memory_bytes: 768
/*
    Ujjawal Pabreja [cuber_coder]
*/
#include <bits/stdc++.h> 
#include <functional> 
using namespace std;
#define speed_cubing    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll              long long
#define ld              long double
#define rep(i,a)        for(ll i = 0 ; i < a ; i++)
#define repe(i,a,b)     for(ll i = a ; i < b ; i++)
#define bac(i,a)        for(ll i = a ; i >= 0 ; i--)
#define bace(i,a,b)     for(ll i = a ; i >= b ; i--)
#define pb              push_back
#define in              insert
#define ff              first
#define ss              second
#define setbit(x)       __builtin_popcountll(x)
#define init(c,a)       memset(c,a,sizeof(c))
#define all(c)          c.begin(),c.end()
#define sz(c)           (ll)c.size()
#define lb              lower_bound
#define ub              upper_bound
#define maxe            *max_element
#define mine            *min_element
#define rev             reverse
#define Y				"YES"
#define N 				"NO"
#define endl            "\n"
#define debug(x)        cout << #x << " : " << x << endl;
const ll inf = 1e18;  
const ll mod = 1e9 + 7;
const ll MOD = 998244353;
const ll MAX = 2e5 + 1;

inline ll add(ll a,ll b) {return ((a % mod) + (b % mod)) % mod;}
inline ll sub(ll a,ll b) {return ((a % mod) - (b % mod) + mod) % mod;}
inline ll mul(ll a,ll b) {return ((a % mod) * (b % mod)) % mod;}
ll pwr(ll x,ll n){
    if(n == 0){
        return 1;
    }
    if(n&1){
        return mul(x, pwr(mul(x, x), (n - 1) / 2));
    } else {
        return pwr(mul(x, x), n / 2);
    }
}
ll modInv(ll n){ 
    return pwr(n, mod - 2); 
}
ll gcd(ll a,ll b) {
    if(b == 0) {
        return a;
    }
    return gcd(b, a % b);
}
// ====== Useful functions end ======
 
// ====== Global Variables begin ======

// ====== Global Variables end ======

void speed_solve(){
    string s;
    cin >> s;
    ll sum = 0;
    for(auto it : s) sum += (it - '0');
        cout << (sum % 9 ? "No" : "Yes");
}

int main(){
    // #ifndef ONLINE_JUDGE
    //     freopen("input.txt", "r", stdin);
    //     freopen("output.txt", "w", stdout);
    // #endif
    speed_cubing;
    ll test_cases = 1;
    // cin >> test_cases;
    rep(i,test_cases){
        // cout << "Case #" << i + 1 << ": ";
        speed_solve();
    }
    return 0;
}

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

vector<int> v[30]; // a to zが文字列の何番目にあるか

int main() {
    string s, t;
    cin >> s >> t;
    rep(i, s.length()) {
        v[s[i] - 'a'].push_back(i+1);
        v[s[i] - 'a'].push_back(i+1 + s.length());
    }
    rep(i, 30) {
        sort(v[i].begin(), v[i].end());
    }
    ll ans = 0;
    int id = 0;
    rep(j, t.length()) {
        if (v[t[j] - 'a'].empty()) {
            puts("-1");
            return 0;
        }
        // binary search
        int next = *upper_bound(v[t[j] - 'a'].begin(), v[t[j] - 'a'].end(), id);
        ans += next - id;
        id = next % s.length();
    }
    cout << ans << endl;
}

Measured memory_bytes: 1724
import numpy as np
import math

v_min = np.inf

def solve(arr):
  global v_min
  count = 0
  for v in arr:
    if v <= v_min:
      count += 1
      v_min = v
  return count

if __name__ == "__main__":
  _n = int(input())
  arr = [int(i) for i in input().split()]
  ans = solve(arr)
  print(int(ans))


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

namespace ConsoleApp17
{
    class Program
    {
        static void Main(string[] args)
        {
            var a = Console.ReadLine().Split();
            var sum = int.Parse(a[0])
                + int.Parse(a[1])
                + int.Parse(a[2]);

            if (22 <= sum) Console.WriteLine("bust");
            else Console.WriteLine("win");
        }
    }
}


Measured memory_bytes: 11092
s = input()
t = input()

s_count = []
t_count = []
for i in "abcdefghijklmnopqrstuvwxyz":
    s_count.append(s.count(i))
    t_count.append(t.count(i))
print("Yes" if sorted(s_count) == sorted(t_count) else "No")


Measured memory_bytes: 3632
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int a;
    scanf("%d",&a);
    int t=0,i;
    long int b[20000000],k=0;
    for(i=0;i<a;i++){
        scanf("%ld",&b[i]);
        if(t<b[i]) t=b[i];
        else k+=t-b[i];
    }
    printf("%ld",k);
    return 0;
}


Measured memory_bytes: 3712
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long S;
  cin >> S;
  cout << 0 << ' ' << 0 << ' ' << 1 << ' ' << 1000000000 << ' ' << (S + 1000000000 - 1) / 1000000000 << ' ' << (1000000000 - S % 1000000000) % 1000000000 << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    int k,p;
    int n;
    
    scanf("%d\n", &n);
    for (int i=0; i<n; i++){
        scanf("%d %d", &k, &p);
        printf("%d\n", k%p ? k%p : p);
    }
    return 0;
}

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

int main() {
	int a, b;
	string op;
	while (1) {


		cin >> a >> op >> b;
		if (op == "+") {
			cout << a + b << endl;
		}
		else if (op == "-") {
			cout << a - b << endl;
		}
		else if (op == "*") {
			cout << a * b << endl;
		}
		else if (op == "/") {
			cout << a / b << endl;
		}
		else {
			break;
		}
	}
}


Measured memory_bytes: 3124
#include <stdio.h>
#include <stdlib.h>

#define HASH 200003

typedef struct List {
	struct List *next;
	char *s;
	int l;
} list;

long long div_mod(long long x, long long y, long long z)
{
	if (x % y == 0) return x / y;
	else return (div_mod((1 + x / y) * y - x, (z % y), y) * z + x) / y;
}

int hash_string(char* s)
{
	int i, x = 0;
	for (i = 0; s[i] != 0; i++) x = ((x << 5) + s[i] - 'a') % HASH;
	return x;
}

int lex_smaller(char* s1, char* s2)
{
	int i;
	for (i = 0; s1[i] != 0 && s2[i] != 0; i++) {
		if (s1[i] < s2[i]) return 1;
		else if (s1[i] > s2[i]) return -1;
	}
	if (s1[i] == s2[i]) return 0;
	else if (s1[i] == 0) return 1;
	else return -1;
}

int main()
{
	int i, j, l[200001], N;
	char *S[200001], T[1000001];
	scanf("%d", &N);
	for (i = 1; i <= N; i++) {
		scanf("%s", T);
		for (l[i] = 0; T[l[i]] != 0; l[i]++);
		S[i] = (char*)malloc(sizeof(char) * (l[i] + 1));
		for (j = 0; j <= l[i]; j++) S[i][j] = T[j];
	}
	
	int h[200001];
	list *p, *hash[HASH], d[200001];
	for (i = 1; i <= N; i++) {
		h[i] = hash_string(&(S[i][1]));
		d[i].s = S[i];
		d[i].l = l[i];
		d[i].next = hash[h[i]];
		hash[h[i]] = &(d[i]);
	}
	
	int k, dp[26];
	long long ans = 0, tmp, pow[32];
	const long long inv = div_mod(1, 32, HASH);
	for (k = 1, pow[0] = 32; k < 32; k++) pow[k] = pow[k-1] * pow[k-1] % HASH;
	for (i = 1; i <= N; i++) {
		if (l[i] <= 1) continue;
		for (j = 0; j <= l[i]; j++) T[j] = S[i][j];
		for (j = l[i] - 2, k = 0, tmp = 1; j > 0; j >>= 1, k++) if ((j & 1) == 1) tmp = tmp * pow[k] % HASH;
		h[i] = (h[i] - tmp * (T[1] - 'a') % HASH + HASH) % HASH;
		for (j = 0; j < 26; j++) dp[j] = 0;
		dp[S[i][0] - 'a'] = 1;
		for (j = 1; j < l[i]; j++) {
			dp[S[i][j] - 'a'] = 1;
			for (k = 0; k < 26; k++) {
				if (dp[k] == 0) continue;
				T[j] = 'a' + k;
				for (p = hash[h[i]]; p != NULL; p = p->next) if (p->l == l[i] - j && p->s[0] == T[j] && lex_smaller(p->s, &(T[j])) == 0) break;
				if (p != NULL) ans++;
			}
			tmp = tmp * inv % HASH;
			h[i] = (h[i] - tmp * (T[j+1] - 'a') % HASH + HASH) % HASH;
		}
	}
	
	printf("%lld\n", ans);
	fflush(stdout);
	return 0;
}

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



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

#define ed cout << "\n";
#define speed                         \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define ll long long
#define ffor(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(i, n) ffor(i, 0, n)
#define All(obj) (obj).begin(), (obj).end()
#define INF ((ll)1e9 + 7)
#define c(a) cout << a << "\n";
using namespace std;
const int N = 100005;

int main()
{
    speed;
    cout << fixed << setprecision(6);
    /*start*/
    int h, w, k;
    cin >> h >> w >> k;
    char m[6][6];
    rep(i, h)
    {
        rep(j, w)
        {
            cin >> m[i][j];
        }
    }
    int ans = 0;
    for (int maskR = 0; maskR < (1 << h); maskR++)
    {
        for (int maskC = 0; maskC < (1 << w); maskC++)
        {
            int black = 0;
            rep(i, h)
            {
                rep(j, w)
                {
                    if (maskR & (1 << i) && maskC & (1 << j)  && m[i][j] == '#')
                        black++;
                }
            }
            if (black == k)
                ans++;
        }
    }
    c(ans);
}


Measured memory_bytes: 3656
#include <iostream>
#include <sstream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <cstdio>
#include <cmath>
using namespace std;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
#define ALL(a)  (a).begin(),(a).end()
#define REP(i,n) for(int i=0;i<(n);++i)
const double EPS = 1e-10;
const double PI  = acos(-1.0);
#define dump(x) cerr << "  (L" << __LINE__ << ") " << #x << " = " << (x) << endl;
#define dumpv(x) cerr << "  (L" << __LINE__ << ") " << #x << " = "; REP(q,(x).size()) cerr << (x)[q] << " "; cerr << endl;
template<typename T1, typename T2>
ostream& operator<<(ostream& s, const pair<T1, T2>& d) {return s << "(" << d.first << "," << d.second << ")";}


int main() {
  double x = 0.0, y = 0.0;
  double angle = 90;

  while (true) {
    int a, b; scanf("%d,%d", &a, &b); 
    if (a == 0 && b == 0) break;

    double theta = PI * angle / 180.0;
    x += a * cos(theta);
    y += a * sin(theta);
    angle -= b;
  }

  printf("%d\n%d\n", (int)x, (int)y);
}

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

using ll = long long;
#define repi(n) for (int i = 0; i < (n); i++)
#define repj(n) for (int j = 0; j < (n); j++)
#define repk(n) for (int k = 0; j < (n); k++)
#define rep(i, n) for (int i = 0; (i) < (n); i++)
#define repr(i, a, b) for (auto i = (a); i < (b); i++)
#define repv(itr) for (auto&& v : (itr))
#define updatemax(t, v) (t = max((t), (v)))
#define updatemin(t, v) (t = min((t), (v)))
const int dx[] = {-1, 0, 0, 1, -1, -1, 1, 1};
const int dy[] = {0, -1, 1, 0, -1, 1, -1, 1};
template <typename T>
T minptr(T begin, T end) {
  T re = begin;
  for (T i = begin + 1; i != end; i++) {
    if (*i < *re) re = i;
  }
  return re;
}
template <typename T>
T maxptr(T begin, T end) {
  T re = begin;
  for (T i = begin + 1; i != end; i++) {
    if (*i > *re) re = i;
  }
  return re;
}
int __vmax(int x) {
  return INT_MAX;
}
double __vmax(double x) {
  return 1e+300;
}
ll __vmax(ll x) {
  return LLONG_MAX;
}
int __vmin(int x) {
  return INT_MIN;
}
double __vmin(double x) {
  return -1e+300;
}
ll __vmin(ll x) {
  return LLONG_MIN;
}
template <typename T>
vector<T> lis(T begin, T end, bool allowequal = false, bool lds = false) {
  using V = typename iterator_traits<T>::value_type;
  int n = end - begin;
  vector<V> a(n, lds ? __vmin(*begin) : __vmax(*begin));
  vector<int> id(n);
  if (lds && allowequal) {
    for (int i = 0; i < n; i++) {
      id[i] = n - 1 -
              (lower_bound(a.rbegin(), a.rend(), begin[i]) - 1 - a.rbegin());
      a[id[i]] = begin[i];
    }
  } else if (lds) {
    for (int i = 0; i < n; i++) {
      id[i] = n - 1 -
              (upper_bound(a.rbegin(), a.rend(), begin[i]) - 1 - a.rbegin());
      a[id[i]] = begin[i];
    }
  } else if (allowequal) {
    for (int i = 0; i < n; i++) {
      id[i] = upper_bound(a.begin(), a.end(), begin[i]) - a.begin();
      a[id[i]] = begin[i];
    }
  } else {
    for (int i = 0; i < n; i++) {
      id[i] = lower_bound(a.begin(), a.end(), begin[i]) - a.begin();
      a[id[i]] = begin[i];
    }
  }
  int m = *maxptr(id.begin(), id.end());
  vector<T> re(m + 1);
  for (int i = n - 1; i >= 0; i--) {
    if (id[i] == m) re[m--] = begin + i;
  }
  return re;
}
template <typename T>
class segtree {
 private:
  int n;
  vector<T> data, lazy;

 public:
  segtree(int n_) {
    n = pow(2, ceil(log2(n_)));
    data.resize(n);
    lazy.resize(n);
    auto __x = data[0];
    repi(n) {
      data[i] = __vmin(__x);
      lazy[i] = 0;
    }
  }
};

int main() {
  int n;
  double x;
  cin >> n;
  repi(n) {
    double a;
    cin >> a;
    x += 1 / a;
  }
  cout.precision(10);
  cout << (1 / x) << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#define MAX 100005
#define NIL -1

typedef struct{

  int p,l,r;

}Tree;

void Pre(int);
void In(int);
void Post(int);

int n;
Tree T[MAX];

int main() {

  int i,v,l,r,root;

  scanf("%d",&n);
  for(i=0;i<n;i++) T[i].p=NIL;

  for(i=0;i<n;i++) {
    scanf("%d %d %d",&v,&l,&r);
    T[v].l = l;
    T[v].r = r;
    if(l!=NIL) T[l].p = v;
    if(r!=NIL) T[r].p = v;
  }

  for(i=0;i<n;i++) if(T[i].p == NIL) root = i;

  printf("Preorder\n");
  Pre(root);
  printf("\n");
  printf("Inorder\n");
  In(root);
  printf("\n");
  printf("Postorder\n");
  Post(root);
  printf("\n");
    
  return 0;

}

void Pre(int a)
{
    if(a == NIL) return;
    printf(" %d",a);
    Pre(T[a].l);
    Pre(T[a].r);
}

void In(int a) {
    if(a == NIL) return;
    In(T[a].l);
    printf(" %d",a);
    In(T[a].r);
}

void Post(int a) {
    if(a == NIL) return;
    Post(T[a].l);
    Post(T[a].r);
    printf(" %d",a);
}


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

using namespace std;

int s[] = {0,  9, 12, 15, 18, 21};
int e[] = {8, 11, 14, 17, 20, 29};

int ans;

bool check(int p[])
{
  for(int i = 0; i < 6; i++){
    for(int j = s[i]; j < e[i]; j++){
      if(p[j] != p[j+1]) return false;
    }
  }
  return true;
}

void rotate1(int p[])
{
  swap(p[0], p[27]);
  swap(p[1], p[28]);
  swap(p[2], p[29]);
  swap(p[14], p[15]);
  swap(p[18], p[20]);
}
void rotate2(int p[])
{
  swap(p[6], p[21]);
  swap(p[7], p[22]);
  swap(p[8], p[23]);
  swap(p[12], p[17]);
  swap(p[9], p[11]);
}
void rotate3(int p[])
{
  swap(p[0], p[23]);
  swap(p[3], p[26]);
  swap(p[6], p[29]);
  swap(p[9], p[20]);
  swap(p[15], p[17]);
}
void rotate4(int p[])
{
  swap(p[2], p[21]);
  swap(p[5], p[24]);
  swap(p[8], p[27]);
  swap(p[12], p[14]);
  swap(p[11], p[18]);
}

void solve(int p[], int cnt)
{
  if(cnt >= ans) return;
  if(check(p)){
    ans = min(ans, cnt);
    return;
  }
  
  for(int i = 0; i < 4; i++){
    int q[33];
    for(int j = 0; j < 30; j++) q[j] = p[j];
    switch(i){
    case 0: rotate1(q); break;
    case 1: rotate2(q); break;
    case 2: rotate3(q); break;
    case 3: rotate4(q); break;
    }
    solve(q, cnt + 1);
  }
}

int main()
{
  int N;
  cin >> N;
  while(N--){
    int p[33];
    for(int i = 0; i < 30; i++) cin >> p[i];
    ans = 8;
    solve(p, 0);
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
#include<stdio.h>
#include<math.h>
int main()
{
	double x,h;
	double sei;
	double s,san,tai,hen;
do{
	scanf("%lf%lf",&x,&h);
	if(x==0 && h==0)break;
	sei=x*x;
	tai=x/2;
	hen=tai*tai+h*h;
	hen=sqrt(hen);
	san=hen*x/2;
	s=4*san+sei;
	printf("%0.6f\n",s);
}while(1);
return 0;
}

Measured memory_bytes: 648
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll MOD = 998244353;

int main() {
  int n, s;
  cin >> n >> s;
  vector<int> a(n);
  for (auto& e : a) cin >> e;

  vector<vector<ll>> dp(n + 1, vector<ll>(s + 3001));
  dp[0][0] = 1;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= s; j++) {
      (dp[i + 1][j] += 2 * dp[i][j] % MOD) %= MOD;
      (dp[i + 1][j + a[i]] += dp[i][j]) %= MOD;
    }
  }
  cout << dp[n][s] << endl;
}


Measured memory_bytes: 144236
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr int Inf = 1000000000;
constexpr ll INF= 1e18;
constexpr ll MOD = 1000000007;
const double PI = 3.1415926535897;
typedef pair<ll,ll> P;

template<typename T>
T Pow(T a,T b) {
    T ret = 1;
    for(int i = 0;i < b;i++) {
        ret *= a;
    }
    return ret;
}

ll mod(ll val) {
    ll res = val % MOD;
    if(res < 0) {
        res += MOD;
    }
    return res;
}

int main() {
    int N,K;
	cin >> N >> K;
	string S;
	cin >> S;
	for(int i = 0;i < min(K,100);i++) {
		string cnt = S;
		reverse(cnt.begin(),cnt.end());
		string tmp = S;
		tmp += cnt;
		string ret2 = S;
		for(int j = 0;j < N + 1;j++) {
			string cnt2 = tmp.substr(j,N);
			ret2 = min(ret2,cnt2);
		}
		reverse(ret2.begin(),ret2.end());
		S = ret2;
	}
	reverse(S.begin(),S.end());
	cout << S << endl;
}

Measured memory_bytes: 256
def LI(): return list(map(int, input().split()))

n = int(input())
a = LI()
b = LI() + [0]

count = 0
for i in range(n):
    diff1 = min(b[i], a[i])
    b[i] -= diff1
    count += diff1

    diff2 = min(b[i], a[i+1])
    a[i+1] -= diff2
    count += diff2

print(count)


Measured memory_bytes: 18624
#include <bits/stdc++.h>
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
#define mid ((x + y) / 2)
#define left (ind * 2)
#define right (ind * 2 + 1)
#define mp make_pair
#define timer ((double)clock() / CLOCKS_PER_SEC)
#define endl "\n"
#define spc " "
#define d1(x) cerr<<#x<<":"<<x<<endl
#define d2(x, y) cerr<<#x<<":"<<x<<" "<<#y<<":"<<y<<endl
#define d3(x, y, z) cerr<<#x<<":"<<x<<" "<<#y<<":"<<y<<" "<<#z<<":"<<z<<endl
#define fast_io() ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;

typedef long long int lli;
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<double, double> dd;

const int N = (int)(1e6 + 5);
const int LOG = (int)(20);

int n, m, mark[N];
vector<int> ed[N], v, v2;

int main() {
	fast_io();
	// freopen("inp.in", "r", stdin);
	
	cin >> n >> m;
	for(int i = 1; i <= m; i++) {
		int a, b;
		cin >> a >> b;
		ed[a].pb(b);
		ed[b].pb(a);
	}

	int ep1 = 1, ep2 = ed[1][0];
	mark[ep1] = 1;
	mark[ep2] = 1;
	
	bool fl = true;
	while(fl) {
		mark[ep1] = 1;
		v.pb(ep1);
		fl = false;
		for(auto i : ed[ep1]) {
			if(!mark[i]) {
				fl = true;
				ep1 = i;
				break;
			}
		}
	}

	fl = true;
	while(fl) {
		mark[ep2] = 1;
		v2.pb(ep2);
		fl = false;
		for(auto i : ed[ep2]) {
			if(!mark[i]) {
				fl = true;
				ep2 = i;
				break;
			}
		}
	}

	cout << v.size() + v2.size() << endl;
	for(int i = v.size() - 1; i >= 0; i--)
		cout << v[i] << spc;
	for(auto i : v2)
		cout << i << spc;
}

Measured memory_bytes: 29048
import bisect
import math

n = int(input())
a = [int(item) for item in input().split()]
a.sort()
ai = a[-1]

left = bisect.bisect(a, ai/2) - 1
right = left + 1

if a[right] - ai/2 >= ai/2 - a[left]:
  print(ai, a[left])
else:
  print(ai, a[right])  

Measured memory_bytes: 14180
#include <sstream>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <stack>
#include <map>
#include <string>
#include <queue>
#include <bitset>

using namespace std;

#define fto(i,a,b) for (int i = (a); i <= b; i++)
#define fdw(i,a,b) for (int i = (a); i >= b; i--)
#define rep(i,a) for(int i = 0; i < a; i++) 
#define read(a) cin >> a
#define read2(a, b) cin >> a >> b
#define read3(a, b, c) cin >> a >> b >> c
#define read4(a, b, c, d) cin >> a >> b >> c >> d
#define write(a) cout << a << " "
#define writeln(a) cout << a << "\n"

#define PI 3.14159265
#define oo 1000000000
#define debug(a) cout << #a << " = " << a << endl

#define sz(a) int((a).size())
#define all(c) (c).begin(), (c).end()
#define tr(c,i) for(typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define next thongdeptrai
#define prev thongbachuthegioi
#define y1 thongsieucapvutru
#define y0 thongnotgay

typedef vector<int> vi;
typedef pair<int,int> ii;
typedef long long ll;

#define maxn 100005

using namespace std;

int n, m, x, y;
vector<int> AdjList[maxn];
int isPath[maxn];
vi res;

void solve(int u) {
	if (isPath[u] == 0) res.pb(u);
	isPath[u] = 1;
	fto(i, 0, AdjList[u].size() - 1) {
		int v = AdjList[u][i];
		if (isPath[v] == 0) {
			solve(v);
			break;
		}
	}
}

int main() {

  //  freopen("in.inp", "r", stdin);

	read2(n, m);
	fto(i, 1, m) {
		read2(x, y);
		AdjList[x].pb(y);
		AdjList[y].pb(x);
	}    

	//how to prove that this path is always true??
	solve(1);
	int pos = res.size();
	solve(1);

	cout << res.size() << endl;
	fdw(i, res.size() - 1, pos) cout << res[i] << " ";
	fto(i, 0, pos - 1) cout << res[i] << " "; cout << endl;
}


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

int main(void)
{
	ios_base::sync_with_stdio(false);    
	cin.tie(NULL);
	cout.tie(NULL);
	
	int n,k;
	cin>>n>>k;
	vector<bool> is(n+1);
	
	int d;
	while(cin>>d)
	{
		int x;
		for(int i=0;i<d;i++)
		{
			cin>>x;
			is[x]=1;
		}
	}
	int c=0;
	for(int i=1;i<=n;i++)
	{
		if(!is[i])
			c++;
	}
	
	cout<<c<<"\n";
	
	return 0;
}

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

int main(){
    int n;
    int count = 0;
    cin >> n;
    vector<string> s(n);
    vector<vector<int>> ab(n, vector<int>(2, 0));
    for(int i = 0; i < n; i++){
        cin >> s.at(i);
        if(s.at(i).at(0) == 'B') ab.at(i).at(1) = 1;
        if(s.at(i).at(s.at(i).size()-1) == 'A') ab.at(i).at(0) = 1;
        for(int j = 0; j < s.at(i).size() - 1; j++){
            if(s.at(i).at(j) == 'A' && s.at(i).at(j + 1) == 'B') count++;
        }
    }
    int a = 0;
    int b = 0;
    int both= 0;
    for(int i = 0; i < n; i++){
        if(ab.at(i).at(0) == 1){
            a++;
            if(ab.at(i).at(1) == 1) both++;
        }else if(ab.at(i).at(1) == 1){
            b++;
        } 
    }
    a = a - both;
    b = b;
    if(a == 0 && b == 0 && both != 0){
        count += both - 1;
    }else{
        count += both + 1 + min(a - 1, b - 1);
    }
    cout << count << endl;
}

Measured memory_bytes: 1408
#include<stdio.h>
#include<math.h>
int main(){
  int n,i,j;
  scanf("%d",&n);
  int x[n+1],y[n+1];
  double num=0;
  for(i=0;i<n;i++)
    scanf("%d%d",&x[i],&y[i]);
  for(i=0;i<n-1;i++)
    for(j=i+1;j<n;j++)
      num+=sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]));
  num=num*2/n;
  printf("%lf\n",num);
  return 0;
}


Measured memory_bytes: 128
#include <string>
#include <iostream>
using namespace std;
const int mod = 1000000007;
int n, a[209], dp[209][209]; string b;
int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> b;
		if (b == "D") a[i] = -1;
		if (b == "U") a[i] = 1;
	}
	dp[0][0] = 1;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j <= i + 1; j++) {
			if (a[i] == 0) dp[i + 1][j] = (dp[i + 1][j] + dp[i][j]) % mod;
			if (a[i] == -1 && j >= 1) {
				dp[i + 1][j] = (dp[i + 1][j] + 1LL * dp[i][j] * j) % mod;
				dp[i + 1][j - 1] = (dp[i + 1][j - 1] + 1LL * dp[i][j] * j * j) % mod;
			}
			if (a[i] == 1 && j <= i) {
				dp[i + 1][j + 1] = (dp[i + 1][j + 1] + dp[i][j]) % mod;
				dp[i + 1][j] = (dp[i + 1][j] + 1LL * dp[i][j] * j) % mod;
			}
		}
	}
	cout << dp[n][0] << endl;
	return 0;
}

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

int N;
vector<vector<pair<int, int>>> G;
vector<int> seen;
vector<int> ans;

void dfs(int v, int dist) {
  seen.at(v) = 1;
  ans.at(v) = dist % 2;
  // if (accumulate(seen.begin(), seen.end(), 0) == N) return;
  for (auto to : G.at(v)) {
    if (!seen.at(to.first)) dfs(to.first, dist + to.second);
  }
}

int main() {
  cin >> N;
  G.resize(N);
  seen.resize(N);
  ans.resize(N);
  for (int a, b, c; cin >> a >> b >> c;) {
    G.at(--a).push_back({--b, c % 2});
    G.at(b).push_back({a, c % 2});
  }
  dfs(0, 0);
  for (auto a : ans) cout << a << "\n";
}

Measured memory_bytes: 7808
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<iomanip>
#include<set>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int dp[4][2]={{1,0},{-1,0},{0,1},{0,-1}};
int main(){
	int H,W;
	char A[1004][1004];
	int wnum=0;
	scan(H>>W);
	vector<pint> zahyorecord;
	rep1(i,H){
		scanf("%s",A[i]+1);
		A[i][0]='#',A[i][W+1]='#';
		rep1(j,W){
			if(A[i][j]=='.') wnum++;
			else{
				zahyorecord.push_back(mp(i,j));
			}
		}
	}
	rep(j,W+2){
		A[0][j]='#';
		A[H+1][j]='#';
	}
	int count=0;
	for(;;count++){
		if(zahyorecord.empty()) break;
		vector<pint> zahyobefore=zahyorecord;
		zahyorecord.clear();
		rep(i,zahyobefore.size()){
			rep(j,4){
				pint zahyoto=zahyobefore[i];
				int y=zahyoto.first+dp[j][1];
				int x=zahyoto.second+dp[j][0];
				if(A[y][x]=='.'){
					zahyorecord.push_back(mp(y,x));
					A[y][x]='#';
				}
			}
		}
	}
	prin(count-1);
	return 0;
}


Measured memory_bytes: 17000
// region
fun main(args: Array<String>) = abc155b()
// endregion

fun abc155b() {
    val n = readLine()!!.toInt()
    val list = readLine()!!.split(' ').map { it.toInt() }

    val answer = if (list.filter { it % 2 == 0 }.all { it % 3 == 0 || it % 5 == 0 }) "APPROVED" else "DENIED"

    println(answer)
}


Measured memory_bytes: 38120
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;


void main()
{
  readln;
  auto a = readln.chomp.split.to!(int[]);
  int[int] cnt;
  int sum;
  foreach (e; a) {
    cnt[e]++;
  }
  foreach (k, v; cnt) {
    if (k != v) {
      if (v-k < 0) {
        sum += v;
      } else {
        sum += min(v, v-k);
      }
    }
  }
  sum.writeln;
}


Measured memory_bytes: 9688
N, F = map(int, input().split())
data = []
tmp = {}
for i in range(N) :
    data.append(list(input().split()))
    for x in range(1, len(data[i]) - 1) :
        for y in range(x+1, len(data[i])) :
            a = data[i][x]
            b = data[i][y]
            a, b = min(a, b), max(a, b)
            if (a, b) not in tmp :
                tmp[(a, b)] = 1
            else :
                tmp[(a, b)] += 1

ans = []
for k in tmp :
    if tmp[k] >= F :
        ans.append(list(k))

ans = sorted(ans, key = lambda x: x[1])
ans = sorted(ans)
print(len(ans))
if len(ans) != 0 :
    for i in range(len(ans)) :
        print(*ans[i])


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

int main(){
  vector<int> N(4),v={1,4,7,9};
  for(int &i:N)
    cin>>i;
  sort(N.begin(),N.end());
  if(N==v)
    cout<<"YES"<<endl;
  else
    cout<<"NO"<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
 
int main(void){
  char a[1999999],b[1999999];
  int cor=0;
  scanf("%s %s",&a[0],&b[0]);
  for(int i=0; a[i]!='\0'; i++){
    if(a[i]!=b[i]){
      cor++;
    }
  }
  printf("%d",cor);
  return 0;
}


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

#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define RFOR(i, a, b) for(int i=(a); i>=(b); i--)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) RFOR(i, n, 0)
#define dump(x)  cout << #x << " = " << (x) << endl;

typedef long long ll;
typedef pair<int, int> ii;
const ll INF = 1e18;
const ll inf = 1e9;


void solve()
{
  ll X;
  scanf("%lld",&X);
  ll Y;
  scanf("%lld",&Y);
  ll Z;
  scanf("%lld",&Z);
  cout << (X-Z)/(Y+Z) << endl;
}

int main()
{
  solve();
  return 0;
}


Measured memory_bytes: 256
// Problem : E - Multiplication 4
// Contest : AtCoder - AtCoder Beginner Contest 173
// URL : https://atcoder.jp/contests/abc173/tasks/abc173_e
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)


/*ヽ｀、ヽ｀｀、ヽ｀ヽ｀、、ヽ ｀ヽ 、ヽ｀🌙｀ヽヽ｀ヽ、ヽ｀
ヽ｀、ヽ｀｀、ヽ 、｀｀、 ｀、ヽ｀ 、｀ ヽ｀ヽ、ヽ ｀、ヽ｀｀、
ヽ、｀｀、｀、ヽ｀｀、 、ヽヽ｀、｀、、ヽヽ、｀｀、 、 ヽ｀、 
ヽ｀｀、 ヽ｀ヽ｀、、ヽ ｀ヽ 、 🚶ヽ｀｀｀｀ヽヽヽ｀、、ヽ｀、、ヽ*/

// #pragma GCC optimize ("O3")
// #pragma GCC target ("sse4")

#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,b,a) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for (auto& a : x)
 
#define bug(x) cout<<#x<<"="<<x<<endl; 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
 
template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const ld pii=3.14159265359; 
const int MOD = 1000000007;
const char nl = '\n';
const int MX = 200001; //check the limits, dummy
 
int main() 
{
	ios_base::sync_with_stdio(0); cin.tie(0);    
	// freopen("input.txt","r",stdin);
     // // freopen("output.txt","w",stdout);
	int N,K;
	cin>>N>>K;
	vl pos,neg;
	int ze=0;
	ll forN=1;
	F0R(x,N)
	{
		int nb;
		cin>>nb;
		if(nb>0)
			pos.pb(nb);
		else//?
			neg.pb(nb);
		// else
			// ze++;
		forN*=nb;
		forN%=MOD;
	}
	if(K==N)
	{
		cout<<(forN+MOD)%MOD;
		return 0;
	}
	sort(all(pos));
	reverse(all(pos));
	sort(all(neg));
	if(sz(pos)==0)
	{
		ll ans=1;
		if(K&1)
		{
			F0R(x,K)
			{
				ans*=neg[N-1-x],ans%=MOD;
			}
		}
		else
			F0R(x,K)
				ans*=neg[x],ans%=MOD;
		ans+=MOD;
		ans%=MOD;
		cout<<ans<<nl;
		return 0;
	}
	//first make positive max
	ll pp=min(K,sz(pos))-1,pn=(K-1-pp)/2-1;
	pn=pn*2+1;
	pi ans;
	if(pn+pp+2==K)
		ans={pp,pn};
	else
	{
		pp--;
		pn+=2;
		ans={pp,pn};
	}
	// bug(pp);
	// bug(pn);
	while(pn<sz(neg)-1 && pp>=0)
	{
		pp--;
		pn++;
		if(pn&1)
		{
			if(pos[pp+2]*pos[pp+1]<neg[pn]*neg[pn-1])
				ans={pp,pn};
			else
				break;
		}
	}
	
	ll res=1;
	F0R(x,ans.f+1)
		res*=pos[x],res%=MOD;
	F0R(x,ans.s+1)
		res*=neg[x],res%=MOD;
	// bug(pp);
	// bug(pn);
	cout<<res<<nl;
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343

Measured memory_bytes: 5568
#include <bits/stdc++.h>
using namespace std;
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fod(i,a,b) for(int i=a;i>=b;i--)
#define me0(a) memset(a,0,sizeof(a))
#define me1(a) memset(a,-1,sizeof(a))
#define op freopen("in.txt","r",stdin);
#define mp(x,y) make_pair(x,y)
#define pii pair<int,int>
void read(int &val) { int x = 0; int bz = 1; char c; for (c = getchar(); (c<'0' || c>'9') && c != '-'; c = getchar()); if (c == '-') { bz = -1; c = getchar(); }for (; c >= '0' && c <= '9'; c = getchar()) x = x * 10 + c - 48; val = x * bz; }
const int INF = 0x3f3f3f3f;
const int maxn=1e6+7;
const int mod=1e9+7;
typedef long long LL;

int n,m;
int a[maxn];

bool check(double mid){
    LL cnt = 0;
    fo(i,1,n){
        cnt+=ceil(a[i]/mid)-1;
    }
    return cnt<=m;
}

double eps=1e-6;
int main(){
//    op;
    read(n);read(m);
    int mx = 0;
    fo(i,1,n) read(a[i]),mx=max(mx,a[i]);


    double l = 0 ,r = mx,ans = mx;
    while(l+eps<=r){
        double mid = (l+r)/2;
        if(check(mid)){
            ans=mid;r=mid;
        }
        else {
            l=mid;
        }
    }
    int xx = ans+1;
    if(ans-eps<xx-1) xx--;
    printf("%d\n",xx);

    return 0;
}

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

using ll = long long;
using vi = vector<int>;
using vi2 = vector<vector<int>>;
#define MP(a,b) make_pair((a),(b))
#define MT(...) make_tuple(__VA_ARGS__)

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl;
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl;

#define DCOUT(x,n) cout << fixed << setprecision(n) << (x) << endl;

#define sz(x) (int)(x).size()

template<typename T>inline istream& operator>>(istream&i,vector<T>&v)
{REP(j,sz(v))i>>v[j];return i;}

int main() {
    int A, B, H, M;
    cin >> A >> B >> H >> M;
    long double d, dsquare;
    long double theta;
    long double pi = acos(-1);
    theta = (pi/360)*(60*H+M)-(pi/30)*M;
    dsquare = pow(A,2)+pow(B,2)-2*A*B*cos(theta);
    d = pow(dsquare,0.5);
    DCOUT(d,10);
}


Measured memory_bytes: 4164
N, K = map(int, input().split())
if K % 2 == 0:
    ans = 0
    cur = 0
    for i in range(1, N+1):
        if i % K == 0:
            cur += 1
    ans += cur ** 3
    cur = 0
    for i in range(1, N+1):
        if i % K == K // 2:
            cur += 1
    ans += cur ** 3
else:
    ans = 0
    cur = 0
    for i in range(1, N+1):
        if i % K == 0:
            cur += 1
    ans += cur ** 3
print(ans)

Measured memory_bytes: 3064
n, p = map(int,input().split())
a = list(map(int,input().split()))
b = []
for i in range(len(a)):
    b.append(a[i]%2)

nck = [[0 for i in range(100)] for j in range(100)]
def cb(n,m):
    if n == m:
        nck[n][m] = 1
    elif m == 0:
        nck[n][m] = 1
    else:
        if nck[n][m] == 0:
            nck[n][m] = cb(n-1,m-1) + cb(n-1,m)
    return nck[n][m]
b0 = b.count(0)
b1 = b.count(1)
if p == 0:
    s = 0
    for i in range(b1+1):
        if i%2 == 0:
            s+=cb(b1,i)*(2**b0)
    print(s)
else:
    s = 0
    for i in range(b1+1):
        if i%2 == 1:
            s += cb(b1,i)*(2**b0)
    print(s)

Measured memory_bytes: 38384
#include<iostream>
#include<cmath>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(){
	bool prime[50001];
	rep(i,50001)prime[i]=true;
	prime[0]=prime[1]=false;
	for(int i=2;i<50001;i++){
		for(int j=i*2;j<50001;j+=i){
			prime[j]=false;
		}
	}
	int n;
	int cnt=0;
	while(cin>>n,n){
		cnt=0;
		for(int i=1;i<=n/2;i++){
			if(prime[i] && prime[n-i])cnt++;
		}
		cout<<cnt<<endl;
	}
	return 0;
}

Measured memory_bytes: 1208
import math
a, b, h, m = map(int, input().split())
m_rad = 6 * m
h_rad = 30 * h + m / 2
rad = abs(h_rad - m_rad)
rad = rad
if rad > 180:
    rad = 360 - rad
length_2 = a**2 + b**2 - 2*a*b*math.cos(math.radians(rad))
print(length_2**0.5)

Measured memory_bytes: 9392
import java.util.Scanner;

/**
 * ABC118B
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int K = 0;
        int A = 0;
        int[] food = new int[M];
        for (int i = 0; i < N; i++) {
            K = sc.nextInt();
            for (int j = 0; j < K; j++) {
                A = sc.nextInt();
                food[A - 1]++;
            }
        }
        int ans = 0;
        for (int i = 0; i < M; i++) {
            if (food[i] == N) {
                ans++;
            }
        }

        System.out.println(ans);

        sc.close();
    }
}

Measured memory_bytes: 23048
#include<stdio.h>

int main(){
	int num, base, dig, check;
	scanf("%d %d", &num, &base);
	if(num == 0){
	puts("0");
	return 0;
	}
	check = 1;
	for(int i = 1; i < 32; i++){
		check *= base;
		if(num < check){
			printf("%d\n", i);
			break;
		}
	}

	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <numeric>
#include <climits>
#define LIM 1000007
#define ll long long
using namespace std;
int main() {
  ll n, l;
  vector<string> s;
  cin >> n >> l;
  while (n--) {
    string ss;
    cin >> ss;
    s.push_back(ss);
  }
  sort(s.begin(), s.end());
  for (auto c : s) {
    cout << c;
  }
  cout << endl;
  return 0;
}


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

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

    int n = Integer.parseInt(in.readLine());
    String[] str = in.readLine().split(" ");
    
    int[] h = new int[n];
    for(int i=0; i<n; i++) {
      h[i] = Integer.parseInt(str[i]);
    }
    
    in.close();
    
    boolean hantei = true;
    
    for(int i=n-1; i>0; i--) {
      if(h.length==1) {
        System.out.println("Yes");
        return;
        
      } else if(h[i]<h[i-1]-1) {
        System.out.println("No");
        return;
        
      } else if(h[i]==h[i-1]-1) {
        h[i-1] -= 1;
      }
    }
    
    System.out.println("Yes");
  }
}

Measured memory_bytes: 48168
#include <iostream>
using namespace std;
int main() {
    int n;
    cin >> n;
    int a[n];
    for(int i=0; i<n; i++) cin >> a[i];
    int now=a[0], i=1;
    while(now!=2) {
        if(i>n) {
            cout << "-1" << endl;
            return 0;
        }
        now = a[now-1];
        i++;
    }
    cout << i << endl;
    return 0;
}


Measured memory_bytes: 640
//C
#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 <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

//C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#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 <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>

//Others
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;
}
const int dx[8] = { -1, 0, 1, -1, 1, -1, 0, 1 };
const int dy[8] = { 1, 1, 1, 0, 0, -1, -1, -1 };
const int lr[4] = { 0, 1, 0, -1 };
const int ud[4] = { 1, 0, -1, 0 };



//LOVE Ayane Sakura



using namespace std;



int main() {
	long long N, A, B;
	cin >> N >> A >> B;
	long long ans = 0;
	ans += N / (A + B) * A;
	N -= N / (A + B) * (A + B);
	ans += min(A, N);
	cout << ans << endl;
}



Measured memory_bytes: 256
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;

LL N, K, Q, ans;

int main()
{
	in >> N >> K >> Q;
	std::vector<LL>A(N);
	rep(i, N) in >> A[i];
	ans = 1123456789;
	rep(i, N)
	{
		std::vector<std::vector<LL>>sec;
		std::vector<LL>temp;
		rep(j, N)
		{
			if (A[i] > A[j])
			{
				if (temp.size() >= K)
				{
					std::sort(temp.begin(), temp.end());
					sec.push_back(temp);
				}
				temp.clear();
			}
			else temp.push_back(A[j]);
		}
		if (temp.size() > 0)
		{
			if (temp.size() >= K)
			{
				std::sort(temp.begin(), temp.end());
				sec.push_back(temp);
			}
			temp.clear();
		}
		for (auto secc : sec)
		{
			rep(j, secc.size() - K + 1) temp.push_back(secc[j]);
		}
		std::sort(temp.begin(), temp.end());
		if (temp.size() < Q) continue;
		ans = std::min(ans, temp[Q - 1] - temp[0]);
	}
	out << ans << std::endl;
	return 0;
}


Measured memory_bytes: 384
S = input()
N = len(S)

if S != S[::-1]:
    print('No')
elif S[:(N - 1) // 2] != (S[:(N - 1) // 2])[::-1]:
    print('No')
elif S[(N + 3) // 2 - 1:] != (S[(N + 3) // 2 - 1:])[::-1]:
    print('No')
else:
    print('Yes')


Measured memory_bytes: 9012