akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())
#define endl "\n"

struct mint {
    constexpr static int mod = 1000000007;
    long long x;
    mint(long long x = 0) : x((x % mod + mod) % mod) {}
    mint operator-() const { return mint(-x); }
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this; }
    mint operator+(const mint a) const { return mint(*this) += a; }
    mint operator-(const mint a) const { return mint(*this) -= a; }
    mint operator*(const mint a) const { return mint(*this) *= a; }
    mint pow(long long t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }
    mint inv() const { return pow(mod - 2); }
    mint& operator/=(const mint a) { return *this *= a.inv(); }
    mint operator/(const mint a) const { return mint(*this) /= a; }
};

struct BinomialCoefficient {
    BinomialCoefficient() {}
    BinomialCoefficient(int n) : fac(n + 2), finv(n + 2), inv(n + 2) {
        fac[0] = fac[1] = 1;
        finv[0] = finv[1] = 1;
        inv[1] = 1;
        for (int i = 2; i <= n; i++) {
            fac[i] = fac[i - 1] * i % mod;
            inv[i] = mod - inv[mod % i] * (mod / i) % mod;
            finv[i] = finv[i - 1] * inv[i] % mod;
        }
    }
    
    long long factorial(int n) {
        return fac[n];
    }
    
    long long combination(int n, int r) {
        if ((n < r) || (n < 0) || (r < 0)) return 0;
        return fac[n] * (finv[r] * finv[n - r] % mod) % mod;
    }
    
    long long permutation(int n, int r) {
        if ((n < r) || (n < 0) || (r < 0)) return 0;
        return fac[n] * finv[n - r] % mod;
    }
    
private:
    int mod = 1000000007;
    vector<long long> fac, finv, inv;
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    ll n;
    cin >> n;
    vector<ll> x(n);
    rep(i, n) cin >> x[i];
    mint one = 1, r = 0, ans = 0;
    rep(i, n - 1) {
        r += one / (i + 1);
        ans += (mint)(x[i + 1] - x[i]) * r;
    }
    BinomialCoefficient bc(n);
    ans *= bc.factorial(n - 1);
    cout << ans.x << endl;
    return 0;
}


Measured memory_bytes: 6340
def calc_d2(p1, p2):
    d2 = 0
    for idx in range(len(p1)):
        d2 += (p1[idx]-p2[idx])**2
    return d2
    

n,d = map(int, input().split())

x = list()
for i in range(n):
    x.append( list(map(int, input().split())) )
    
count = 0
for p1 in range(0, n-1):
    for p2 in range(p1+1, n):
        d2 = calc_d2(x[p1], x[p2])
        if int(d2**0.5) ** 2 == d2:
            count += 1

print(count)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#define endl '\n'
#define ll long long

using namespace std;

int find_k(int x, int y, int k) {
    vector <int> v;

    for(int i = 1; i <= x && i <= y; i++){

        if(x % i == 0 && y % i == 0) {
            v.push_back(i);
        }
    }

    return v[v.size() - k];

}


int main() {
    int A, B, K;

    cin >> A >> B >> K;

    cout << find_k(A, B, K) << endl;    

    return 0;
}

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

#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define INF 999999999

int main() {
  int n; cin >> n;
  int p[n + 1], m[n][n];
  REP(i, n) {
    cin >> p[i] >> p[i + 1];
  }

  REP(i, n) m[i][i] = 0;
  FOR(l, 2, n + 1) {
    REP(i, n - l + 1) {
      int j = i + l - 1;
      m[i][j] = INF;
      FOR(k, i, j) {
        m[i][j] = min(m[i][j], m[i][k] + m[k + 1][j] + p[i] * p[k + 1] * p[j + 1]);
      }
    }
  }
  cout << m[0][n - 1] << endl;;
  return 0;
}

Measured memory_bytes: 3096
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
	
	public static final int MAX = 100000;
	public static final int S_MAX = (int) (Math.ceil(Math.sqrt(MAX)));

	public static class Data implements Comparable<Data>{
		int mul, p, q;

		public Data(int mul, int p, int q) {
			super();
			this.mul = mul;
			this.p = p;
			this.q = q;
		}
		
		public Data(int mul) {
			super();
			this.mul = mul;
		}

		@Override
		public int compareTo(Data arg0) {
			return this.mul - arg0.mul;
		}

		@Override
		public int hashCode() {
			final int prime = 31;
			int result = 1;
			result = prime * result + mul;
			return result;
		}

		@Override
		public boolean equals(Object obj) {
			if (this == obj)
				return true;
			if (obj == null)
				return false;
			if (getClass() != obj.getClass())
				return false;
			Data other = (Data) obj;
			if (mul != other.mul)
				return false;
			return true;
		}
	}
	
	public static void main(String[] args) {
		final Scanner sc = new Scanner(System.in);
		
		boolean[] is_prime = new boolean[MAX + 1];
		Arrays.fill(is_prime, true);
		is_prime[0] = is_prime[1] = false;
		
		for(int i = 0; i <= S_MAX; i++){
			if(is_prime[i]){
				for(int j = 2 * i; j <= MAX; j += i){
					is_prime[j] = false;
				}
			}
		}
		
		ArrayList<Integer> p_list = new ArrayList<Integer>();
		for(int i = 0; i <= MAX; i++){
			if(is_prime[i]){
				p_list.add(i);
			}
		}
		
		final int size = p_list.size();
		ArrayList<Data> mul_list = new ArrayList<Data>();
		for(int i = 0; i < size; i++){
			for(int j = i; j < size; j++){
				final int p = p_list.get(i);
				final int q = p_list.get(j);
				
				long mul = (long)(p) * (long)(q);
				
				if(mul > 100000L){
					break;
				}
				
				mul_list.add(new Data(p * q, p , q));
			}
		}
		
		Collections.sort(mul_list);
		
		while (true) {
			final int m = sc.nextInt();
			final int a = sc.nextInt();
			final int b = sc.nextInt();
			
			if(m == 0 && a == 0 && b == 0){
				break;
			}
			
			final double per = a / (double)(b);
			
			int pos = Collections.binarySearch(mul_list, new Data(m));
			if(pos < 0){
				pos = -(pos + 2);
			}
			
			for(int i = pos; i >= 0; i--){
				Data data = mul_list.get(i);
				final double cur = data.p / (double)(data.q);
				//System.out.println(data.p + " " + data.q + " " + cur + " " + per);
				if(per <= cur){
					System.out.println(data.p + " " + data.q);
					break;
				}
			}
		}
	}

}

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

int main(){
  int X;
  cin >> X;
  int kosuu = X/100;
  int sum = 0;
  bool flag = false;
  if (X >= 2000) flag = true;
  else if (X%100 <= kosuu*5) flag = true;
  if (flag) cout << 1 << endl;
  else cout << 0 << endl;
}

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

using namespace std;

int n;
int a[112123];

int main()
{
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	long long ans = 0;
	for (int i = 0; i < n; i++)
	{
		ans += a[i] / 2;
		if (a[i] % 2 && a[i+1] > 0)
		{
			ans++;
			a[i+1]--;
		}
	}
	cout << ans << '\n';
	return 0;
}


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

using namespace std;

int main() {
  int W, H, x, y, r;
  scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);
  x - r >= 0 && x + r <= W && y - r >= 0 && y + r <= H ? puts("Yes") : puts("No");
  return 0;
}



Measured memory_bytes: 3148
#include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
int main(void){
	int a[5]={0};
  int k=0,s=0;
  for(int i=4;i>=0;i--){
  	cin>>a[i];
  }
  cin>>k;
  for(int i=0;i<4;i++){
  	for(int j=i+1;j<5;j++){
    	if(a[i]-a[j]>k){s=1;break;}
    }
    if(s==1)break;
  }
  if(s==1){cout<<":("<<endl;}
  else{cout<<"Yay!"<<endl;}
  return 0;
}

Measured memory_bytes: 256
#include <iostream>

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

        std::cin >> a[i];
    }

    int flag = 0;
    int scores[2];
    scores[0] = 0;
    scores[1] = 0;
    for (int j = 0; j < n; j++)
    {
        int maxValue = 0;
        int maxIndex = 0;
        for (int k = 0; k < n; k++)
        {
            if (maxValue < a[k])
            {
                maxIndex = k;
                maxValue = a[k];
            }
        }
        scores[flag] += maxValue;
        a[maxIndex] = 0;
        if (flag == 0)
        {
            flag = 1;
        }
        else
        {
            flag = 0;
        }
    }

    int diff = scores[0] - scores[1];
    std::cout << diff << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <unordered_map>
typedef long long ll;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " \n"[i == n-1];}
#define printp(x,n) for(ll i = 0; i < n; i++){ cout << "(" << x[i].first << ", " << x[i].second << ") "; } cout << endl;
#define INF (1e18)
using namespace std;
const ll MOD = 1e9 + 7;
typedef pair<ll, ll> lpair;
ll f(ll n){
    return (n*n + 4) / 8;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string A,B;
    cin >> A >> B;
    ll na = A.size();
    ll nb = B.size();
    if(na > nb){
        print("GREATER");
    }else if(na < nb){
        print("LESS");
    }else{
        rep(i,0,na){
            if(A[i] > B[i]){
                print("GREATER");
                return 0;
            }else if(A[i] < B[i]){
                print("LESS");
                return 0;
            }
        }
        print("EQUAL");
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
//#include <string>
//#include <algorithm>
//#include <math.h>
//#include <queue>
//#include <stack>
//#include <iomanip>

// sometimes used
//#include <set>
//#include <map>
//#include <numeric>
//#include <list>
//#include <deque>
//#include <unordered_map>

typedef long long LL;
//typedef long double LD;
using namespace std;
 
//#define MOD 1000000007
//#define MAX 100100
#define NIL -1

int main() {
    LL d;
    LL g;
    cin >> d >> g;
    vector<LL> p(d);
    vector<LL> c(d);
    LL total=0;

    for(LL i=0; i<d; i++){
        cin >> p[i] >> c[i];
        total+=p[i];
    }

    vector<vector<LL>> dp(d, vector<LL>(total+1, NIL));
    dp[0][0]=0;

    for(LL i=1; i<=p[0]; i++){
        if(i==p[0]){
            dp[0][i]=dp[0][0]+i*100+c[0];
        }else{
            dp[0][i]=dp[0][0]+i*100;            
        }
    }

    total=p[0];
    for(LL i=1; i<d; i++){
        for(LL j=0; j<=total; j++){
            for(LL k=0; k<=p[i]; k++){
                LL score;
                if(k<p[i]){
                    score=dp[i-1][j]+(i+1)*100*k;
                }else{
                    score=dp[i-1][j]+(i+1)*100*k+c[i];
                }
                if(dp[i][j+k]==NIL || dp[i][j+k]<score){
                    dp[i][j+k]=score;
                }
                //cout << i << " " << j << " " << k << " " << score << endl;
            }
        }
        total+=p[i];
    }

    LL ans=0;
    for(LL i=0; i<=total; i++){
        //cout << dp[d-1][i] << endl;
        if(dp[d-1][i]>=g){
            ans=i;
            break;
        }
    }

    cout << ans << endl;

    return 0;
}


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

using namespace std;

int main(){
	
	int n,r;
	cin>>n>>r;
	
	if(n>=10){
		cout<<r<<endl;
		
	}
	else{
		int a=100*(10-n);
		r+=a;
		cout<<r<<endl;
	}
	
	
	return 0;
}

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

int main(){
    string str;
    int count = 0;
    int price;
    cin >> str;
    if(equal(str.begin(), str.end(), "xxx")){
        count = 0;
    }
    if(equal(str.begin(), str.end(), "ooo")){
        count = 3;
    }
    if(equal(str.begin(), str.end(), "xxo") || equal(str.begin(), str.end(), "xox") || equal(str.begin(), str.end(), "oxx")){
        count = 1;
    }
    if(equal(str.begin(), str.end(), "xoo") || equal(str.begin(), str.end(), "oxo") || equal(str.begin(), str.end(), "oox")){
        count = 2;
    }
    price = 700 + 100*count;
    
    cout << price << endl;
}


Measured memory_bytes: 256
public class Main {
    private static java.util.Scanner scanner = new java.util.Scanner(System.in);

    public static void main(String[]$) {
        long n = scanner.nextLong(), a = scanner.nextLong(), b = scanner.nextLong(), c = scanner.nextLong(), d = scanner.nextLong(), e = scanner.nextLong();
        long min = Math.min(Math.min(Math.min(Math.min(a, b), c), d), e);
        System.out.println((n + min - 1) / min + 4);
    }
}

Measured memory_bytes: 25300
#include <bits/stdc++.h>
	using namespace std;
	#define IOS ios::sync_with_stdio(false), cin.tie(0)
	#define REP(i, n) for (int i = 0; i < n; i++)
	#define FOR(i, a, b) for (int i = a; i < b; i++)
	#define ALL(x) (x).begin(), (x).end()
	#define dump(x) cout << (x) << endl
	#define LMAX 9223372036854775807LL
	#define LMIN -9223372036854775807LL

	using ll = long long;
	template<typename T>
	using vec = vector<T>;
	using P = pair<ll, ll>;

	template <typename A, size_t N, typename T>
	void Fill(A (&array)[N], const T &val){
		fill((T *)array, (T *)(array + N), val);
	}
	
	const ll INF = 1e18;
	const ll mod = 1e9 + 7;

	//int dx[4] = {1,0,-1,0};
	//int dy[4] = {0,1,0,-1};
	//ll pas[51][52];
	
	ll powm(ll a, ll b, ll c) {
		if (b == 0)return 1;
		else if (b % 2 == 0) {
			ll d = powm(a, b / 2, c);
			return (d * d) % c;
		}
		else return (a * powm(a, b - 1, c)) % c;
	}

	signed main(){
		IOS;
		string s;
		cin >> s;
		int n = s.size();
		REP(i,n - 1){
			if(s[i] == s[i + 1]){
				cout << i + 1 << ' ' << i + 2 << endl;
				return 0;
			}
		}
		REP(i, n - 2){
			if(s[i] == s[i + 2]){
				cout << i + 1 << ' ' << i + 3 << endl;
				return 0;
			}
		}
		cout << -1 << ' ' << -1 << endl;
		return 0;
	}

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

#define ST_ARR_LEN(array) (sizeof(array)/sizeof(*array))

using namespace std;

using ll = long long;
const ll MAX = LLONG_MAX;
const ll MIN = LLONG_MIN;

typedef stack<int> IntStack;
typedef queue<int> IntQueue;
typedef vector<int> IntVector;
typedef list<int> IntList;

typedef struct S{
  int a;
  int b;
} Object;

int main(){
  ll N, K;
  cin >> N >> K;
  ll h[N];
  for(int i=0;i<N;i++){
    cin >> h[i];
  }
  
  ll dp[N];
  for(int i=0;i<N;i++){
    dp[i] = MAX;
  }
  dp[0] = 0;
  for(int i=0;i<N-1;i++){
    for(int j=1;j<=K;j++){
      if(i+j >= N) break;
      dp[i+j] = min(dp[i+j], dp[i]+abs(h[i+j]-h[i]));
    }
  }
  ll ans = dp[N-1];
                
  
  cout << ans << endl;
}

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

int n, ans;

int main() {
	cin.sync_with_stdio(0); cin.tie(0);
    cin >> n;
    vector<ll> a(n), psum(n);
    for (auto& i : a) cin >> i;
    sort(a.begin(), a.end());
	psum[0] = a[0];
	for (int i = 1; i < n; i++) {
		psum[i] = a[i] + psum[i - 1];
	}
	
	ans = n - 1;
	for (int i = n - 2; i >= 0; --i) {
		if (psum[i] * 2 >= a[i + 1]) ans = i;
		else break;
	}
	cout << n - ans;
    return 0;
}


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

int main() {
  int a, b;
  string s;
  cin >> a >> b >> s;
  bool ans = true;
  for (int i = 0; i < s.size(); i++) {
    if (s.size() != a + b + 1) {
      ans = false;
      break;
    }
    if (i == a) {
      if (s[i] != '-') ans = false;
    }
    else {
      if (s[i] == '-') ans = false;
    }
  }
  if (ans) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
//last updated : 11.04.2020
#include <bits/stdc++.h>
#pragma GCC optimization ("O3")
using namespace std;

#define ll              long long
#define ld              long double
#define pll             pair <ll, ll>
#define plll            pair <ll, pll>

#define fa(i, n, N)     for (ll i = n; i <= N; ++i)
#define fac(i, n, b, N) for (ll i = n; i <= N && b; ++i)
#define fd(i, n, N)     for (ll i = n; i >= N; --i)

#define mp              make_pair
#define pb              push_back
#define pob             pop_back
#define pf              push_front
#define pof             pop_front
#define fi              first
#define se              second

#define ms(arr,t)       memset (arr, t, sizeof(arr));
#define all(x)          x.begin(), x.end()
#define len             length()
#define endl            '\n'

#define isss(x, s)      istringstream x (s)
#define db(x)           cout << ">>>>>> " << #x << " -> " << x << endl
#define AAAA            cout << "\t------" << endl;

//urgent cases only!
#define get_rt		cerr << "Time elapsed: " << (double)clock() / CLOCKS_PER_SEC * 1000 << " ms.\n"

const ll inf = INT_MAX;
const ll inf2 = 1e18;
const ll MAX = 1e5+5;
const ll MOD = 1e9+7;
const double pi = acos(-1.0);
const double EPS = 1e-9;

void init(int precision){
  	ios_base::sync_with_stdio(false);
  	cin.tie(0);
  	cout.tie(0);
  	cout.setf(ios::fixed);
  	cout.setf(ios::showpoint);
  	cout.precision(precision);
}

inline void iofile (){
	freopen ("input.txt", "r", stdin);
	// freopen ("output.txt", "w", stdout);
}


ld n;

int main() {
    init(10);
    //iofile();
	
	cin >> n;
	cout << (2.0 * n) * pi << endl;

	return 0;
}


Measured memory_bytes: 3804
import sys
input = sys.stdin.readline
def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():
    s = input()
    return(list(s[:len(s) - 1]))
def invr():
    return(map(int,input().split()))

a,b,c = inlt()
if a/c <= b:
    print('Yes')
else:
    print('No')

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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define ALL(x) x.begin(),x.end()
#define EPS (1e-9)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

typedef long long ll;
bool LTE(double a,double b) { return equals(a,b) || a < b; }
bool LT(double a,double b) { return !equals(a,b) && a < b; }

#define MAX 21
int n;
ll m,a[MAX];
double p[MAX];
double PIE[1<<MAX];
int bc[1<<MAX];

void init_PIE() {
  memset(PIE,-1,sizeof PIE);
  PIE[0] = 0;
  REP(i,1,(1<<n)) {
    ll lcm = 1;
    rep(j,n) if( (i>>j) & 1 ) {
      lcm = lcm / __gcd(lcm,a[j]);
      if( (double)lcm * (double)a[j] > 1e18 ) {
	lcm = m + 1;
	break;
      }
      lcm = lcm * a[j];
    }
    ll sign = ( ( bc[i] & 1 ) ? +1LL : -1LL );
    PIE[i] = sign * (ll)( m / lcm );
  }

  rep(i,n) {
    rep(j,(1<<n)) {
      if( ((j>>i)&1) == 1 ) {
	PIE[j] += PIE[j^(1<<i)];
      }
    }
  }
}

void compute() {
  init_PIE();
  double ans = 0;
  REP(i,1,(1<<n)) {
    double P = 1.0;
    rep(j,n) {
      if( (i>>j) & 1 ) {
	P *= p[j];
      } else {
	P *= ( 1.0 - p[j] );
      }
    }
    ans += ( (double)PIE[i] * P );
  }
  printf("%.10lf\n",ans);
}

int main() {
  rep(i,(1<<MAX)) bc[i] = __builtin_popcount(i);
  cin >> n >> m;
  rep(i,n) cin >> a[i];
  rep(i,n) {
    cin >> p[i];
    p[i] = p[i] / 100.0;
  }
  compute();
  return 0;
}



Measured memory_bytes: 27876
//Coded by Abhijay Mitra
#include <iostream>
#include <stdlib.h>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <numeric>
#include <vector>
#include <iterator> 
#include <map>
#include <set>
#include <climits>
#include <queue>
#include <cmath>
#include <stack>
#include <cctype>
#include <bitset>
// #include <bits/stdc++.h>
#define double long double
#define int long long int
#define ll int
#define ibs ios_base::sync_with_stdio(false)
#define cti cin.tie(0)
#define bp __builtin_popcount
#define pb push_back
#define res(v) v.resize(unique(v.begin(), v.end()) - v.begin());
#define cnt_res(v) std::distance(v.begin(),std::unique(v.begin(), v.end())); 
#define timer cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
using vi = std::vector<int>;
using vvi = std::vector<vi>;
using pii = std::pair<int,int>;
using vpii = std::vector<pii>;
using vvpii = std::vector<vpii>;
#define mp         make_pair
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define per(i,b,a) for (int i = b; i >= a; i--)
#define all(x)     x.begin(), x.end()
using namespace std;
const int N=2e6+10;
const int inf = /*0x3f3f3f3f*/1e18+10;
// const ll M = 998244353 ; // Mulo
const int M = 1e9+7 ; // Mulo
const double Pi = 3.14159265;
#define F first
#define S second
int mul(int a,int b){
  return ((a%M)*(b%M))%M;
}
int add(int a,int b){
  return ((a%M)+(b%M))%M;
}
ll powM(ll a, int n) {
  ll x = 1;
  while(n > 0){
    if(n & 1) x = x * a % M;
    a = a * a % M;
    n >>= 1;
  }
  return x;
}
int invM(int x){ 
  return powM(x,M-2);
}
int C[N],f[N],b[N];
void binomialCoeff(int n) 
{ 
  f[0]=b[0]=C[0]=1;
  rep(i,1,N-1){
    f[i]=mul(f[i-1],i);
    b[i]=invM(f[i]);
  }
  rep(i,1,n){
    C[i]=mul(mul(f[n],b[n-i]),b[i]);
  }
}
void solve(){
  int n,k;cin>>k;string s;cin>>s;n=s.length();
  binomialCoeff(n+k);
  int ans=0;
  rep(i,n,n+k){
    ans=add(ans,mul(powM(25,n+k-i),C[i]));
  }
  cout<<ans;
}
int32_t main()
{
  ibs;cti;
  solve()
  /*,cout<<"\n"*/;
  // cout<<"\n";
  int xx=0;
  // int t;cin>>t;while(t--){/*xx++;cout<<"Case "<<xx<<":\n"*/;solve();cout<<"\n";}
  return 0;
}

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

using namespace std;

const long long INF = 1LL<<60;

long long f(long long b, long long n){
    if(b < 2) return INF;
    long long res = 0;
    while(n > 0){
        res += n % b;
        n /= b; 
    }
    return res;
}

int main(){
    long long n, s;
    cin >> n >> s;
    if(n == s){
        cout << n + 1 << endl;
        return 0;
    }
    for(long long i = 2; i * i <= n; i++){
        if(f(i, n) == s){
            cout << i << endl;
            return 0;
        }
    }
    long long ans = INF;
    for(long long i = 1; i * i <= n; i++){
        if((n - s) % i != 0) continue;
        long long b = (n - s) / i + 1;
        if(f(b, n) == s){ans = min(ans, b);}
    }
    cout << (ans != INF? ans:-1) << endl;
    return 0;
}


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

int main(){
  int n;
  cin >> n;
  ll a[n];
  rep(i,n) cin >> a[i];
  ll c = 0, d = 0, s = 0, t = 0;
  rep(i,n) {
    s += a[i]; t += a[i];
    if(i % 2 == 0) {
      if(s <= 0) {
        c += 1 - s;
        s = 1;
      } 
      if(t >= 0) {
        d += t + 1;
        t = -1;
      }
    } else {
      if(s >= 0) {
        c += s + 1;
        s = -1;
      }
      if(t <= 0) {
        d += 1 - t;
        t = 1;
      }
    }
  }
  cout << min(c,d) << endl;
  return 0;
}

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

typedef long long ll;

typedef pair<ll,ll> ii;
typedef pair<ii, ll > iii;

const int kn = 2e5 + 5, N = 1e5+5;
const ll mod = 1e9 + 7, inf = 1e18 ;

#define x first
#define y second

#define ff(i,n) for(int i=1;i<=n;i++)

ll n,m,k,a[kn];

int main() {
	cin >> n;
	ff(i,n) cin >> a[i];
	ll ans = 0;
	for(int i = 2; i <n; i++)
	{
		if(a[i-1] > a[i] && a[i] > a[i+1]) ans++;
		else if(a[i-1]<a[i] && a[i]<a[i+1]) ans++;
	}
	cout <<ans;
	
}
//hahahahahahahahahhahahahahahaahahahahhahahahahahahah


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<stdlib.h>
#include<utility>
#include<functional>
#include<cfenv>
#include<cmath>
#include<string>
#include<queue>
#include<stack>
#include<map>
#include<set>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define vint vector<ll>
#define vvint vector<vint>
#define P pair<int,int>
#define INT_MAX 2147483647
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main(void) {
	int n; cin >> n;
	cout << (n + 1) / 2 << endl;
	return 0;
}



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

int main() {
    //
    int num;
    int cnt = 0;

    cin >> num;
    vector<int> vec(num);

    for (int i = 0; i < num; i++) cin >> vec.at(i);

    for (int i = 0; i < num - 2; i++) {
        if (vec.at(i) <= vec.at(i + 1) && vec.at(i + 1) <= vec.at(i + 2)) {
            cnt++;
        } else if (vec.at(i) >= vec.at(i + 1) && vec.at(i + 1) >= vec.at(i + 2)) {
            cnt++;
        }
    }

    cout << cnt;
    //
}


Measured memory_bytes: 3604
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
int acs(const void *a, const void *b){return *(int*)a - *(int*)b;} /* 1,2,3,4.. */
int des(const void *a, const void *b){return *(int*)b - *(int*)a;} /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b){return *(char*)a - *(char*)b;} /* a,b,c,d.. */
int cmp_str(const void *a, const void *b){return strcmp(*(const char **)a, *(const char **)b);} /* aaa,aab.. */
#define min(a,b) (a < b ? a: b)
#define max(a,b) (a > b ? a: b)
#define rep(i, l, r) for (int i = l; i < r; i++)
#define MAX 100001
#define MOD 1000000007

typedef long long int lli;

int main(void) {
  int m1, m2, d1, d2;
  scanf("%d %d %d %d", &m1, &d1, &m2, &d2);
  if (d2 == 1) printf("1\n");
  else printf("0\n");
  return 0;
}


Measured memory_bytes: 128
num = str(input())
a = []
x=[]
for i in str(num):
    a.append(i)
if a[1] <= a[0] and a[2] < a[0]:
    x.append(a[0])
    x.append(a[0])
    x.append(a[0])
    print(''.join(str(i) for i in x))
elif a[1] < a[0]:
    x.append(a[0])
    x.append(a[0])
    x.append(a[0])
    print(''.join(str(i) for i in x))
elif a[0] == a[1] == a[2]:
    x.append(a[0])
    x.append(a[0])
    x.append(a[0])
    print(''.join(str(i) for i in x))
else:
    z = int (a[0]) +1
    x.append(z)
    x.append(z)
    x.append(z)
    print(''.join(str(i) for i in x))


Measured memory_bytes: 3064
h,w = map(int, input().split())
S=[["." for _ in range(w+2)]]
S+=[["."]+[i for i in input()]+["."]for _ in range(h)]
S+=[["." for _ in range(w+2)]]
for i in range(1, h+1):
    l=""
    for j in range(1, w+1):
        if S[i][j]=="#":
            l+="#"
        else:
            l+=str(sum(S[i+n][j+m]=="#" for n in range(-1, 2, 1) for m in range(-1, 2, 1)))
    print(l)

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

using namespace std;

#define MAX_H 500
#define MAX_W 500
#define F first
#define S second
typedef pair<int,int> pii;

int H,W;
char field[MAX_H][MAX_W];
vector<pii> v[26];

bool inField(int x,int y){
    return (0 <= x && x < W && 0 <= y && y < H);
}

int calc(int x,int y){
    for(int i = 0 ; i < 26 ; i++){
        v[i].clear();
    }
    const int dx[] = {-1,0,1,0};
    const int dy[] = {0,-1,0,1};
    for(int i = 0 ; i < 4 ; i++){
        int nx = x, ny = y;
        while(1){
            nx += dx[i]; ny += dy[i];
            if(!inField(nx,ny)) break;
            if(field[ny][nx] != '.'){
                v[field[ny][nx]-'A'].push_back(pii(nx,ny));
                break;
            }
        }
    }
    int res = 0;
    for(int i = 0 ; i < 26 ; i++){
        if(v[i].size() == 2){
            field[v[i][0].S][v[i][0].F] = '.';
            field[v[i][1].S][v[i][1].F] = '.';
            res += 2;
        }
    }
    return res;
}

int main(){
    cin >> H >> W;
    for(int i = 0 ; i < H ; i++){
        for(int j = 0 ; j < W ; j++){
            cin >> field[i][j];
        }
    }
    int res = 0;
    bool update = 1;
    while(update){
        update = 0;
        for(int i = 0 ; i < H ; i++){
            for(int j = 0 ; j < W ; j++){
                if(field[i][j] != '.') continue;
                int r = calc(j,i);
                if(r > 0){
                    res += r;
                    update = 1;
                }
            }
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 3336
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
using ll = long long;
using P = pair<int,int>;
using PP = pair<int,pair<int,int>>;
using T = tuple<string,int,int>;
const ll INF = 1LL<<60;

vector<vector<int>> g;
vector<int> ans;

int main(){
  int n; cin >> n;
  vector<int> v(n), c(n);
  for(int i = 0; i < n; i++) cin >> v[i];
  for(int i = 0; i < n; i++) cin >> c[i];
  int ans = 0;
  for(int bit = 0; bit < (1<<n); bit++){
    int a = 0, b = 0;
    for(int i = 0; i < n; i++){
      if((bit >> i) & 1){
        a += v[i]; b += c[i];
      }
    }
    ans = max(ans, a - b);
  }
  cout << ans << endl;
  return 0;
}


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

#define si(a) scanf("%d",&a)
#define sl(a) scanf("%lld",&a)
#define sd(a) scanf("%lf",&a)
#define sc(a) scanf("%c",&a)
#define ss(a) scanf("%s",a)
#define pi(a) printf("%d\n",a)
#define pl(a) printf("%lld\n",a)
#define pc(a) putchar(a)
#define ms(a) memset(a,0,sizeof(a))
#define repi(i, a, b) for(register int i=a;i<=b;++i)
#define repd(i, a, b) for(register int i=a;i>=b;--i)
#define reps(s) for(register int i=head[s];i;i=Next[i])
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define pii pair<int,int>
#define mii unordered_map<int,int>
#define msi unordered_map<string,int>
#define lowbit(x) ((x)&(-(x)))
#define ce(i, r) i==r?'\n':' '
#define pb push_back
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define INF 0x3f3f3f3f
#define pr(x) cout<<#x<<": "<<x<<endl
using namespace std;

inline int qr() {
    int f = 0, fu = 1;
    char c = getchar();
    while (c < '0' || c > '9') {
        if (c == '-')fu = -1;
        c = getchar();
    }
    while (c >= '0' && c <= '9') {
        f = (f << 3) + (f << 1) + c - 48;
        c = getchar();
    }
    return f * fu;
}

const int MAX_N = 2e3 + 10, mod = 1e9 + 7;
ll dp[MAX_N];
ll solve(int x)
{
    if(~dp[x]) return dp[x];
    ll res=0;
    repi(i,3,x) res=(res+solve(x-i))%mod;
    return dp[x]=res;
}
int main()
{
    memset(dp,-1,sizeof(dp));
    dp[0]=1,dp[1]=dp[2]=0;
    dp[3]=dp[4]=dp[5]=1;
    printf("%lld\n",(solve(qr())%mod+mod)%mod);
    return 0;
}

Measured memory_bytes: 3756
N, Y = map(int, input().strip().split(" "))

is_found = False
man = 0
gosen = 0
sen = 0
for m in range(N + 1):
    if is_found:
        break
    for g in range(N - m + 1):
        s = N - m - g
        if 10000 * m + 5000 * g + 1000 * s == Y:
            man = m
            gosen = g
            sen = s
            is_found = True
            break

if is_found:
    print(man, gosen, sen)
else:
    print("-1 -1 -1")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const ll INF = 1e12;
const ll MOD = 1000000000 + 7;
#define PB push_back
#define PF push_front
#define fi first
#define se second
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vpi vector<pii>
#define vll vector<ll>
#define vpl vector<pll>
#define vvi vector<vector<int>>
#define vvl vector<vector<ll>>
#define mii map<int, int>
#define mci map<char, int>
#define MX(x) *max_element(all(x))
#define MN(x) *min_element(all(x))
#define ios ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define pr_d(x) cout << fixed << setprecision(15) << x << endl
#define ud(c, x) distance(c.begin(), upper_bound(all(c), x))
#define ld(c, x) distance(c.begin(), lower_bound(all(c), x))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define rep3(i, n) for (int i = (n - 1); i >= 0; --i)
#define rep4(i, a, b) for (int i = (a); i > (b); --i)
#define pb push_back
#define out(x) cout << x << "\n"
bool odd(int i) { return i % 2; }

#define all(v) v.begin(), v.end()
#define size(x) int(x.size())

int gcd(int a, int b) { return __gcd(a, b); }
int lcm(int a, int b) { return a * (b / gcd(a, b)); }
void Yes_No(bool f) {
  if (f)
    printf("Yes\n");
  else
    printf("No\n");
}
void YES_NO(bool f) {
  if (f)
    printf("YES\n");
  else
    printf("NO\n");
}

template <typename T>
void deb1(T x) {
  cout << "debug: " << x << "\n";
}

template <typename T>
bool chmax(T& a, const T& b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
bool chmin(T& a, const T& b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
//-------------------ここから回答する-----------------------

void solve(void) {
  int n;
  cin >> n;
  vll l(n);
  rep(i, n) cin >> l[i];
  set<pair<pair<int, int>, int>> st;
  int ans = 0;
  rep(i, n - 2) {
    rep2(j, i + 1, n - 1) {
      rep2(k, j + 1, n) {
        vi tmp;
        if (l[i] == l[j] or l[j] == l[k] or l[k] == l[i]) continue;
        tmp.pb(l[i]), tmp.pb(l[j]), tmp.pb(l[k]);
        sort(all(tmp));
        if (tmp[0] < tmp[1] + tmp[2] and tmp[1] < tmp[2] + tmp[0] and
            tmp[2] < tmp[0] + tmp[1])
          ans++;
      }
    }
  }
  out(ans);
}

int main(void) { solve(); }

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

#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
typedef pair<pint,int> P1;
typedef pair<int,pint> P2;
static const ll maxLL = (ll)1 << 62;
const ll MOD=1000000007;
const ll INF=1e18;
int dy[]={-1,0,1,0};
int dx[]={0,1,0,-1};

int n,a,x[55];
int dp[55][55][2555];

signed main(){
    cin.tie(0);
	ios::sync_with_stdio(false);
    cin>>n>>a;
    rep(i,0,n){
        cin>>x[i];
    }
    memset(dp,0,sizeof(dp));
    dp[0][0][0]=1;
    rep(i,0,n){
        rep(j,0,n+1){
            rep(k,0,2555){
                dp[i+1][j][k]+=dp[i][j][k];
                if(x[i]<=k && j>0)dp[i+1][j][k]+=dp[i][j-1][k-x[i]];
            }
        }
    }
    int ans=0;
    rep(i,1,n+1){
        ans+=dp[n][i][i*a];
        //cout<<i<<" "<<ans<<endl;
    }
    cout<<ans<<endl;
    
    
    
    
    
    return 0;
}

Measured memory_bytes: 60672
//12-4-20
#define _CRT_SECURE_NO_WARNINGS 1

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

#define scu(n)                     scanf("%u",&n)
#define scl(n)                     scanf("%d",&n)
#define scll(n)                     scanf("%lld",&n)
#define  maxN                     1005
#define uu                           first
#define vv                           second
#define ll                            unsigned long long
#define U                             unsigned
#define pb                            push_back
#define mp                           make_pair
#define pii                           pair<int,int>
#define vi                             vector<int>
#define mii                            map<int,int>
#define Pi                              acos(-1.0)
#define endl                          "\n"
#define pqb                            priority_queue<int>
#define pqs                             priority_queue<int,vi,greater<int> >
#define setbits(x)                    __builtin_popcountll(x)
#define zrobits(x)                    __builtin_ctzll(x)
#define mod                              1000000007
#define inf                               1e18
#define ps(x,y)                          fixed<<setprecision(y)<<x
#define mk(arr,n,type)              type *arr=new type[n];
#define w(x)                             int x; cin>>x; while(x--)
//mt19937                                  rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

//Vector Macros
#define pb                                 push_back
#define eb                                  emplace_back
#define ALL(v)                           v.begin(),v.end()
#define UNIQUE(v)                    v.erase(unique(ALL(v)),v.end())
#define MIN(c)                          *min_element(ALL(c))
#define MAX(c)                          *max_element(ALL(c))
#define SUM(c)                          accumulate(ALL(c),0)

//Loop Macros
#define FOR(i,a,b)                       for(ll i=a;i<=b;i++)
#define rep(i,a,b)                         for(int i=a;i<=b;i++)
#define For(i,n)                            for(int i=0;i<n;i++)

//Debug Macros
#define deb(a)                             cout << #a << " : " << a << " ";
#define debln(a)                          cout<< #a <<" : " << a << endl;
//Print Macros
#define print(v)    for(auto x : v) {  cout<<x<<" ";   }  cout<<endl;
#define PRINT(v)  for(auto x : v) { cout<<x.uu<<" "<<x.vv<<endl;

/*
Time Calculation :
auto st = high_resolution_clock::now();
auto en = high_resolution_clock::now();
auto duration = duration_cast < milliseconds > (en-st);
cout<< "consumed time in ms " << duration.count() <<endl;
*/


int main()
{

    ll n,i;
    cin>>n;

    ll sum=0;

    for(ll i=1; i<=n; i++)
    {
        if(i%3==0 || i%5==0)
            continue;
        else
            sum+=i;
        //deb(i) debln(sum)
    }

    cout<<sum<<endl;

    return 0;
}





Measured memory_bytes: 3624
class SegmentTree():
    """
    update, get を提供するSegmentTree

    Attributes
    ----------
    __n : int
        葉の数。2 ^ i - 1
    __dot :
        Segment function
    __e: int
        単位元
    __node: list
        Segment Tree
    """
    def __init__(self, A, dot, e):
        """
        Parameters
        ----------
        A : list
            対象の配列
        dot :
            Segment function
        e : int
            単位元
        """
        # n = 2 ** (len(A) - 1).bit_length()
        n = 2 ** (A - 1).bit_length()
        self.__n = n
        self.__dot = dot
        self.__e = e
        self.__node = [e] * (2 * n)
        # for i in range(len(A)):
        #     self.__node[i + n] = A[i]
        # for i in range(n - 1, 0, -1):
        #     self.__node[i] = self.__dot(self.__node[2 * i], self.__node[2 * i + 1])
    
    def update(self, i, c):
        i += self.__n
        node = self.__node
        node[i] = c
        while i > 1:
            i //= 2
            node[i] = self.__dot(node[2 * i], node[2 * i + 1])

    def get(self, l, r):
        vl, vr = self.__e, self.__e
        l += self.__n
        r += self.__n
        while (l < r):
            if l & 1:
                vl = self.__dot(vl, self.__node[l])
                l += 1
            l //= 2
            if r & 1:
                r -= 1
                vr = self.__dot(vr, self.__node[r])
            r //= 2
        return self.__dot(vl, vr)


def solve():
    N = int(input())
    P = map(int, input().split())
    plist = []
    for i, p in enumerate(P):
        plist.append((p, i))
    plist.sort(reverse=True)

    maxSeg = SegmentTree(N, max, -1)
    minSeg = SegmentTree(N, min, N)

    cnt = 0
    for p, c in plist:
        l2 = maxSeg.get(0, c)
        l1 = -1 if l2 <= 0 else maxSeg.get(0, l2)

        r1 = minSeg.get(c + 1, N)
        r2 = N if r1 >= N - 1 else minSeg.get(r1 + 1, N)

        a = (l2 - l1) * (r1 - c)
        b = (r2 - r1) * (c - l2)
        cnt += p * (a + b)

        maxSeg.update(c, c)
        minSeg.update(c, c)

    print(cnt)


solve()


Measured memory_bytes: 117900
#include <iostream>
#include <unordered_set>
#include <cstdint>
#include <vector>
#include <sstream>
#include <string>
#include <climits>
#include <set>
#include <array>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <numeric>
#include <map>
#include <utility>
using namespace std;

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

    vector<int> niz(n);
    for (int i = 0; i < n; i++)
        cin >> niz[i];
    sort(niz.begin(), niz.end());
    int sum = 0;
    for (int i = 0; i < k; i++)
        sum += niz[i];
    cout << sum;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i,a,b) for (ll i=(a);i<(ll)b; i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define INF 1LL << 60
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll,ll> p;
const long long MOD=1000000007;

// vector<p> cut(M);
// cut[i].second
// cut[i].first;
// REP(i,M){
//     int a,b;cin>>a>>b;
//     cut[i] = make_pair(b,a);//last first の順番
// }
// for(int i=0; i<N;i++){
// }
// sort(cut.begin(),cut.end()); //sort
// char '' str ""
int main(void)
{
    int N, k;cin>>N>>k;
    set<int> s;
    vector<int> v(N);
    for(int i=0;i<N;i++){
      v[i]=2000001;
    }
    for(int i=0;i<N;i++){
      int ss; cin>>ss; s.insert(ss);
      ss--;
      if(v[ss]==2000001) v[ss]=1;
      else v[ss]++;
    }
    sort(v.begin(), v.end());

    int si = s.size() - k;
    if(si<=0){
      cout<<0<<endl; return 0;
    }
    int cnt=0;
    for(int i=0; i<si;i++){
      cnt+=v[i];
    }
    cout<<cnt<<endl;
    return 0;
}


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

using namespace std;

typedef long long LL;

const int nmax = 200005; const LL inf = 1e18;

int N;

int main(){
   int i,j,ni,np;
   bool ok;
//   freopen("txt.in","r",stdin);
//   freopen("txt.out","w",stdout)
      cin >> N;
      for(i = 1,ni=np=0; i <= N; ++i){
         cin >> j;
         if(j%2)ni++;
         else np++;
      }
   np+=ni/2;
   ni%=2;
   if(ni){
      cout << "NO\n";
      return 0;
   }
   cout << "YES\n";
   return 0;
}



Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#define ll long long
using namespace std;
int main() {
	cin.tie(0); ios::sync_with_stdio(false);
	ll N; cin >> N;
	ll t, a; cin >> t >> a;
	for (int i = 1; i < N;i++) {
		ll T, A; cin >> T >> A;
		ll r = max(t / T, a / A);
		while (true) {
			if (r * T >= t && r * A >= a) {
				t = r * T;
				a = r * A;
				break;
			}
			r++;
		}
	}
	cout << t + a << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a,b,c;
  int count=0;
  cin >> a >> b;
  for(int i=0;i<b;i++){
   cin >> c;
   count += c;
  }
  if(a>count) cout << "No" << endl;
  else cout << "Yes" << endl;
  return 0;
}


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

int main(){
  int a[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51
};
  int n;
  cin >> n;
  
  cout << a[n-1] << endl;
  
}

Measured memory_bytes: 256
import sys
rline = sys.stdin.readline


def solve():
    H, W = map(int, input().split())
    
    if H == 1 or W == 1:
        print(1)
        exit()
    
    if H % 2 == 1:
        if W % 2 == 1:
            print(((H + 1) // 2) * ((W + 1) // 2) + (H // 2) * (W // 2))
        else:
            print(((H + 1) // 2) * (W // 2) + (H // 2) * (W // 2))
    else:
        if W % 2 == 1:
            print(((W + 1) // 2) * (H // 2) + (W // 2) * (H // 2))
        else:
            print((W // 2) * H)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define Int int64_t
 
using namespace std;
 
int main() {
	vector<int> v = { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
	
	int K;
	cin >> K;
	cout << v[K - 1] << endl;

	return 0;
}


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

int main( void )
{
    int n;
    cin >> n;
    
    if ( n % 1000 % 111 == 0 || n / 10 % 111 == 0 )
        cout << "Yes" << endl;
    else
        cout << "No" << 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;

// auto mod int
int mod = 1000000007;
struct mint
{
    long long x;
    mint(long long x = 0) : x(x % mod) {}
    mint &operator+=(const mint a)
    {
        if ((x += a.x) >= mod)
            x -= mod;
        return *this;
    }
    mint &operator-=(const mint a)
    {
        if ((x += mod - a.x) >= mod)
            x -= mod;
        return *this;
    }
    mint &operator*=(const mint a)
    {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const
    {
        mint res(*this);
        return res += a;
    }
    mint operator*(const mint a) const
    {
        mint res(*this);
        return res *= a;
    }
    mint pow(long long t) const
    {
        if (!t)
            return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1)
            a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const
    {
        return pow(mod - 2);
    }
    mint &operator/=(const mint a)
    {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const
    {
        mint res(*this);
        return res /= a;
    }
};


vector<vector<int>> tree;
int k;
mint dfs(int now, int upper){

    int remained_color = k - 2;
    if(now == 1){
        remained_color++; //親がない最上位だけ特別
    }

    if(k < tree[now].size()){ // 親の分を引く
        return 0; //塗分けられない。
    }

    mint count(1);
    for (auto i = tree[now].begin(); i < tree[now].end(); i++)
    {
        if(*i == upper) continue;
        mint rc(remained_color);
        count *= rc;
        remained_color--;
    }

    for (auto i = tree[now].begin(); i < tree[now].end(); i++)
    {
        if(*i == upper) continue;
        count *= dfs(*i, now);
    }
    

    return count;
}


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

    tree.resize(n + 1);
    
    for (size_t i = 0; i < n - 1; ++i)
    {
        int a, b;
        cin >> a >> b; 
        tree[a].push_back(b);
        tree[b].push_back(a);
    }
    
    mint answer(k);
    answer *= dfs(1, -1);
    cout << answer.x << endl; 
    return 0;   
}

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

#define int long long
#define fi first
#define se second
#define otp(n) cout << n;
#define ct(n) cout << n << endl;
#define cts(n) cout << n << " ";
#define cte cout << endl;
#define ctv(v) rep(i,(v).size()) ct(v[i])
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define repo(i,o,n) for(int i=o;i<n;i++)
#define repm(i,n) for(int i=n-1;i>=0;i--)
#define repv(i,v) for(int i=0;i<(v).size();i++)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end());
#define vdelete(v) (v).erase(unique(all(v)), (v).end());
#define pb(n) push_back(n);

int x;

main() {
    cin >> x;
    ct(x/11*2+x%11/6+(x%11%6+4)/5)
}

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;
int main(){
  int a,b;
  cin>>a>>b;
  int sum=1;
  for(int i=0;true;i++){
    if(sum<b){
      sum+=a-1;
    }else{
      cout<<i<<endl;
      break;
    }
  }   
}

Measured memory_bytes: 256