akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
      
#define FOR(i,a,b) for(ll i = (a); i < (ll)(b); i++)
#define REP(i,n) FOR(i,0,n)
#define YYS(x,arr) for(auto& x:arr)
#define PW(x) (1LL<<(x))
#define SZ(x) ((ll)(x).size())

#define pb emplace_back
#define fi first
#define se second

using namespace std;

using ld = long double;
using ll = long long int;

const ll INF = (ll)1e9 + 10;
const ll INFLL = (ll)1e18 + 10;
const ll MOD = 1e9+7;
     
template<class T> T &chmin( T &a , const T &b ){ return a = min(a,b); }
template<class T> T &chmax( T &a , const T &b ){ return a = max(a,b); }
template<class T> void UNIQUE(vector<T> &a){ a.erase(unique(a.begin(), a.end()), a.end()); }

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

ll in(){long long int x; scanf("%lld", &x); return x;}
ld fin(){double x; scanf("%lf", &x); return x;}
char yuyushiki[1000010]; string stin(){scanf( "%s", yuyushiki ); return yuyushiki;}

// head

using vl = vector<ll>;
using pl = pair<ll, ll>;
using vpl = vector<pair<ll, ll>>;

vl fact( ll x ){
  vl res;
  for( ll i = 2; i*i <= x; i++ ){
    while( x % i == 0 ){
      res.pb( i );
      x /= i;
    }
  }
  if( x > 1 ) res.pb( x );
  return res;
}

vpl facts( ll x ){
  vpl res;
  vl ps = fact( x );
  REP( i , ps.size() ){
    if( i == 0 || ps[i-1] != ps[i] ) res.pb( pl( ps[i] , 1 ) );
    else res.back().se++;
  }
  return res;
}


int main(){

  ll n = in();
  ll p = in();

  auto res = facts(p);

  ll ans = 1;
  YYS(w, res){
    ll d = w.se / n;
    REP(i, d){
      ans *= w.fi;
    }
  }

  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<math.h>
#include<map>

#define rep(i,n,m) for(int i=n;i<(int)(m);i++)

using namespace std;

int main() {

	int k, s;
	cin >> k >> s;
	int cnt = 0;

	for (int i = 0; i <= k; i++) {
		for (int j = 0; j <= k; j++) {
			if (s - i - j <= k && 0 <= s-i-j)cnt++;
		}
	}

	cout << cnt << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
    int n, k;
    cin >> n >> k;
    double ans = 0;
    for (int i = 1; i <= n; ++i)
    {
        int tmp = i;
        double p = 1. / n;
        while (tmp < k)
        {
            tmp *= 2;
            p /= 2;
        }
        ans += p;
    }
    cout << std::setprecision(15) << ans << endl;
}

Measured memory_bytes: 256
from collections import deque
a, b, c = deque(), deque(), deque()

sa = list(input())
sb = list(input())
sc = list(input())
s = [sa, sb, sc]
l = [a, b, c]
for i in range(3):
    for j in s[i]:
        if j == "a":
            l[i].append(0)
        elif j == "b":
            l[i].append(1)
        else:
            l[i].append(2)
    l[i].append(3)

ans = ["A", "B", "C"]
t = l[0].popleft()
w = 0
while True:
    t = l[t].popleft()
    if t == 3:
        print(ans[w])
        break
    w = t

Measured memory_bytes: 3316
#include <cstdio>
int X, A, B, C;

int main() {
	scanf("%d %d %d %d", &A, &B, &C, &X);
	int out = 0;
	for (int i = 0; i <= A; i++) {
		for (int j = 0; j <= B; j++) {
			for (int k = 0; k <= C; k++) {
				if (500 * i + 100 * j + 50 * k == X) {
					out++;
				}
			}
		}
	}
	printf("%d\n", out);
	return 0;
}


Measured memory_bytes: 128
#include <stdio.h>

#define N 8
#define FREE -1
#define NOT_FREE 1

void init();
void putQueen(int);
void printBoard();

int row[N], col[N], dpos[2 * N - 1], dneg[2 * N - 1], A[N][N];

int main() {
  int n, c, k, i, j;

  init();

  for (i = 0; i < N; i++) {
    for (j = 0; j < N; j++) {
      A[i][j] = 0;
    }
  }

  scanf("%d", &n);

  for (i = 0; i < n; i++) {
    scanf("%d %d", &c, &k);
    A[c][k] = NOT_FREE;
  }

  putQueen(0);
  
  return 0;
}

void init() {
  int i;

  for (i = 0; i < N; i++) {
    row[i] = FREE;
    col[i] = FREE;
  }
  
  for (i = 0; i < 2 * N - 1; i++) {
    dpos[i] = FREE;
    dneg[i] = FREE;
  }
}

void putQueen(int i) {
  int j;

  if (i == N) {
    printBoard();
    return;
  }

  for (j = 0; j < N; j++) {
    if (col[j] == NOT_FREE || dpos[i + j] == NOT_FREE || dneg[i - j + N - 1] == NOT_FREE) {
      continue;
    }
    row[i] = j;
    col[j] = dpos[i + j] = dneg[i - j + N - 1] = NOT_FREE;
    putQueen(i + 1);
    col[j] = dpos[i + j] = dneg[i - j + N - 1] = FREE;
  }
}

void printBoard() {
  int i, j;

  for (i = 0; i < N; i++) {
    for (j = 0; j < N; j++) {
      if (A[i][j]) {
	if (row[i] != j) {
	  return;
	}
      }
    }
  }

  for (i = 0; i < N; i++) {
    for (j = 0; j < N; j++) {
      if (row[i] == j) {
	printf("Q");
      } else {
	printf(".");
      }
    }
    printf("\n");
  }
}



Measured memory_bytes: 2108
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>

using namespace std;

int g[200][200];

int main() {
  int n, m, r;
  cin >> n >> m >> r;

  vector<int> a(r);
  for (int i = 0; i < r; i++) {
    cin >> a[i];
    a[i]--;
  }

  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      g[i][j] = 1e9;
    }
    g[i][i] = 0;
  }

  for (int i = 0; i < m; i++) {
    int u, v, w;
    cin >> u >> v >> w;
    u--;
    v--;
    g[u][v] = w;
    g[v][u] = w;
  }

  for (int k = 0; k < n; k++) {
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        g[i][j] = min(g[i][j], g[i][k] + g[k][j]);
      }
    }
  }

  long long ans = 1e18;
  sort(a.begin(), a.end());
  do {
    long long d = 0;
    for (int i = 0; i < r - 1; i++) {
      d += g[a[i]][a[i + 1]];
    }
    ans = min(ans, d);
  } while (next_permutation(a.begin(), a.end()));

  cout << ans << endl;
}

Measured memory_bytes: 384
#include <cstdio>
#include <iostream>
#include <vector>
#include <limits>
#include <algorithm>

const int64_t BEAUCOUP = std::numeric_limits<int64_t>::max();

template<typename T>
T abs(T value)
{
	if (value < 0)
		return -value;
	return value;
}

int main()
{
	int64_t nbStones;
	std::scanf("%d", &nbStones);

	std::vector<int64_t> stones(nbStones);
	for (int64_t i=0; i<nbStones; i++)
		std::scanf("%d", &stones[i]);

	std::vector<int64_t> DP(nbStones+2, BEAUCOUP);
	DP[0] = 0;

	for (int64_t i=0; i<DP.size(); i++)
	{
		if (i+1 < nbStones)
			DP[i+1] = std::min(DP[i+1], DP[i] + abs(stones[i+1] - stones[i]));
		if (i+2 < nbStones)
			DP[i+2] = std::min(DP[i+2], DP[i] + abs(stones[i+2] - stones[i]));
	}

	std::printf("%d\n", DP[nbStones-1]);
}

Measured memory_bytes: 1792
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
int a[110][5];
int s1[110],s2[110];
int main()
{
    int n,i,j,k,ans;
    scanf("%d",&n);
    for(i=1;i<=n;i++)
        scanf("%d",&a[i][1]);
    for(i=1;i<=n;i++)
        scanf("%d",&a[i][2]);
    s1[0]=0;
    for(i=1;i<=n;i++)
        s1[i]=s1[i-1]+a[i][1];
    s2[n+1]=0;
    for(i=n;i>=1;i--)
        s2[i]=s2[i+1]+a[i][2];
    ans=0;
    for(i=1;i<=n;i++)
    ans=max(ans,s1[i]+s2[i]);
    printf("%d\n",ans);
    return 0;
}


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

#define int        long long
// #define mp      make_pair
#define eb         emplace_back
#define pb         push_back
#define ss         second
#define ff         first
#define IOS        ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mod        998244353
#define MOD        (1000*1000*1000+7)
#define MN         LLONG_MIN
#define MX         LLONG_MAX
#define v1d        vector<int>
#define v2d        vector<vector<int>>
#define vip        vector<pair<int,int> >
#define v1s        vector<string>
#define pa         pair<int,int>
#define mxpq(T)    priority_queue <T>
#define mnpq(T)    priority_queue<T,vector<T>,greater<T>>
#define print(v)   for(auto i:v)cout<<i<<" ";cout<<"\n";
#define p2d(v)     for(auto a:v){for(auto b:a)cout<<b<<" ";cout<<endl;}
#define p1d(v)     for(auto a:v)cout<<a<<" ";cout<<endl;
#define ppd(v)     for(auto a:v)cout<<a.ff<<" "<<a.ss<<endl;
#define endl       "\n"
#define input(b,n) for(int i=0;i<n;i++)cin>>b[i];
#define Sort(v)    sort(v.begin(),v.end())
#define RSort(v)   sort(v.rbegin(),v.rend())
#define all(v)     v.begin(),v.end()
int gcd(int a,int b){return b?gcd(b,a%b):a;}
//string s = bitset<64>(a).to_string();
int lb = 1000;
#define Exit    lb--;if(lb<0){cout<<"exit";exit(0);}

void azmuth(int n=12){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cout<<setprecision(n)<<fixed;
	#ifndef ONLINE_JUDGE
		 freopen("input.txt",  "r",  stdin);
		 freopen("output.txt", "w", stdout);
	#endif
}

//____________________________________________________________________________________

const int M = 1000000000000000000;

void solve(){
	int n;cin >> n;
    int ans = 1;
	bool f = false;
	v1d v(n);input(v,n);
	Sort(v);
	if(v[0] == 0){
		cout << "0";return ;
	}
    for(int i=0;i<n;i++){
        int a = v[i];
        if(a && M/a < ans ){
			cout << "-1";return ;
        }
        ans *= a;
    }
    cout << ans;
}

int32_t main(){
	azmuth();
	int t = 1;
	// cin>>t;
	while(t--){
		solve();
	}
	


	return 0;
}

Measured memory_bytes: 3992
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> P;
typedef priority_queue<P,vector<P>,greater<P>> P_queue;

#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define ALL(a) a.begin(),a.end()
#define SORT(a) sort(ALL(a))
#define U_ERASE(V) V.erase(unique(ALL(V)), V.end());

const ll MOD=998244353;
const ll mod=1000000007;
const ll INF=1e15;
vec dx={1,0,-1,0};
vec dy={0,1,0,-1};

ll N,K,C;
string S;
ll A[200010], B[200010];
int main(){
    cin>>N>>K>>C>>S;
    C++;
    ll count=1, i=0;
    while(true){
        if(i>=N) break;
        if(S[i]=='o'){
            A[i]=count;
            count++;
            i+=C;
        }
        else i++;
    }
    i=N-1; count=K;
    while(true){
        if(i<0) break;
        if(S[i]=='o'){
            B[i]=count;
            count--;
            i-=C;
        }
        else i--;
    }
    //rep(i,N) cout<<A[i]<<' '<<B[i]<<endl;
    rep(i,N) if(A[i]==B[i] && A[i]!=0) cout<<i+1<<endl;

}

Measured memory_bytes: 6776
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < n; i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
typedef long long ll;

class Combination {
   public:
    Combination(int n) {
        fac = new ll[n];
        inv = new ll[n];
        finv = new ll[n];
        fac[0] = fac[1] = 1;
        finv[0] = finv[1] = 1;
        inv[1] = 1;
        REP(i, 2, n) {
            fac[i] = fac[i - 1] * i % MOD;
            inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
            finv[i] = finv[i - 1] * inv[i] % MOD;
        }
    }

    ll cnr(int n, int k) {
        if (n < k) return 0;
        if (n < 0 || k < 0) return 0;
        return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
    }

   private:
    ll *fac, *inv, *finv;
};

int main() {
    int n, k; cin >> n >> k;
    k = min(n - 1, k);

    Combination comb(n + 1);

    ll ans = 1;
    for (int i = 1; i < k + 1; i++) {
        ans = (ans + (comb.cnr(n, i) * comb.cnr(n - 1, i)) % MOD) % MOD;
    }

    cout << ans << endl;
    return 0;
}

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

int main(int argc, char *argv[]){
  int n,s ;
  cin>>n;
  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];
  
  for(int i =0; i<n;i++){
    if(c[i]<v[i]){
      s +=v[i]-c[i];
    }
  }
  
  cout<<s<<endl;
  return 0;
}
  

Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;

int reverse_int(int n){
	int sum=0;
	int m;
	while(n){
		m=n%10;
		n/=10;
		sum+=m;
	}
	return sum;
}

int main(){
	int N;
	scanf("%d",&N);
	int t=reverse_int(N);
	if(N%t==0)	printf("Yes\n");
	else printf("No\n");
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 200000 + 10;
int a[N];
int main(){
    int n,x; scanf("%d%d",&n,&x);
    if(x==1||x==2*n-1) puts("No");
    else{
        puts("Yes");
        int p = n, v = x;
        for(int i=1;i<=2*n-1;i++){
            a[p] = v;
            p = p + 1, v = v + 1;
            if(p>2*n-1) p -= 2*n-1;
            if(v>2*n-1) v -= 2*n-1;
        }
        for(int i=1;i<=2*n-1;i++) printf("%d%c",a[i]," \n"[i==2*n-1]);
    }
}


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

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
static const ll INF = 1ll<<60;
static const int MOD = 1e9+7;

int main(){
    ll N,D;
    cin>>N>>D;
    vector<ll> x(N);
    vector<ll> y(N);
    for(int i=0; i<N; i++) cin>>x[i]>>y[i];

    int ans = 0;
    for(int i=0; i<N; i++){
        if(sqrt(x[i]*x[i] + y[i]*y[i]) <= D) ans++;
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 6432
import sys
N = int(input())
counts = {}
for _ in range(N):
    s = tuple(sorted(sys.stdin.readline()))
    counts[s] = counts.get(s, 0) + 1
ans = 0
for count in counts.values():
    if count > 1:
        ans += (count * (count - 1) // 2)
print(ans)

Measured memory_bytes: 27928
n = int(input())
s = input()
start = 0
end = n-1
count = [[0, 0] for _ in range(n)]
start_w = 0
end_r = 0
for i in range(n):
    count[i][0] = start_w
    if s[i] == "W":
        start_w += 1
for i in reversed(range(n)):
    count[i][1] = end_r
    if s[i] == "R":
        end_r += 1

print(min(map(max,count)))

Measured memory_bytes: 94212
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010


int main(){
  int x1, y1, x2, y2;
  int x3, y3, x4, y4;

  cin >> x1 >> y1 >> x2 >> y2;

  x3 = x2 - (y2 - y1);
  y3 = y2 + (x2 - x1);
  x4 = x3 - (x2 - x1);
  y4 = y3 - (y2 - y1);

  cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;


  return 0;
}


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

int main(){
    int q;
    cin>>q;
    int64_t cnt=0;
    while(q--){
        int64_t p;
        char c;
        int64_t n;
        cin>>p>>c>>n;
        if(c=='(')cnt+=n;
        else cnt-=n;
        if(cnt==0) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }

    return 0;
}

Measured memory_bytes: 3084
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <cstring>
#include <utility>
#include <numeric>

using namespace std;

// LazyUpdateSegmentTree
template<typename T>
class LazyUpdateSegTree{
public:
    int n;
    T defaultValue;
    vector<T> dat;
    vector<T> lazy;
    vector<bool> isSetLazy;

    LazyUpdateSegTree(vector<T>& v, T defaultValue){
        n = 1;
        int vSize = (int)v.size();
        while(n < vSize){
            n *= 2;
        }
        dat.assign(2 * n - 1, defaultValue);
        lazy.assign(2 * n - 1, 0);
        isSetLazy.assign(2 * n - 1, false);
        this->defaultValue = defaultValue;

        for(int i = 0; i < vSize; i++){
            dat[i + n - 1] = v[i];
        }
        for(int i = n - 2; i >= 0; i--){
            dat[i] = ope(dat[2 * i + 1], dat[2 * i + 2]);
        }
    }

    T update(int a, int b, T value, int k = 0, int l = 0, int r = -1){
        if(r < 0){
            r = n;
        }
        propagate(k);

        if(r <= a || b <= l){
            return dat[k];
        }

        if(a <= l && r <= b){
            lazy[k] = lazyUpdate(value, l, r);
            isSetLazy[k] = true;
            propagate(k);
            return dat[k];
        }
        else{
            T vl = update(a, b, value, 2 * k + 1, l, (l + r) / 2);
            T vr = update(a, b, value, 2 * k + 2, (l + r) / 2, r);
            dat[k] = ope(vl, vr);
            return dat[k];
        }
    }

    T query(int a, int b, int k = 0, int l = 0, int r = -1){
        if(r < 0){
            r = n;
        }

        if(r <= a || b <= l){
            return defaultValue;
        }
        propagate(k);

        if(a <= l && r <= b){
            return dat[k];
        }
        else{
            T vl = query(a, b, 2 * k + 1, l, (l + r) / 2);
            T vr = query(a, b, 2 * k + 2, (l + r) / 2, r);
            return ope(vl, vr);
        }
    }

private:

    void propagate(int k){
        if(isSetLazy[k]){
            dat[k] = lazy[k];
            if(k <= n - 2){
                T value = lazyPropUpdate(lazy[k]);
                lazy[2 * k + 1] = value;
                lazy[2 * k + 2] = value;
                isSetLazy[2 * k + 1] = true;
                isSetLazy[2 * k + 2] = true;
            }

            isSetLazy[k] = false;
        }
    }

    T ope(T a, T b){
        return a + b;
    }

    T lazyUpdate(T value, int l, int r){
        return (r - l) * value;
    }

    T lazyPropUpdate(T value){
        return value / 2;
    }
};

int main(){

    int n, q;
    cin >> n >> q;
    vector<long long> v(n, (1LL << 31) - 1);
    LazyUpdateSegTree<long long> segTree(v, 0);
    for(int i = 0; i < q; i++){
        int type;
        cin >> type;
        if(type == 0){
            int s, t, x;
            cin >> s >> t >> x;
            segTree.update(s, t + 1, x);
        }
        else{
            int j;
            cin >> j;
            cout << segTree.query(j, j + 1) << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 7856
#include<iostream>
using namespace std;
int main(){
    int n;
    int a,b;
    cin>>n>>a>>b;
    if(n%2==1){
        if(a%2==b%2) cout<<"Alice";
        else cout<<"Borys";
    }
    if(n%2==0){
        if(a%2==b%2) cout<<"Alice";
        else cout<<"Borys";
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FASTIO
#define endl "\n" // Since endl forces a buffer flush which slows down large I/O operations.
#define ff first
#define ss second
#define pb push_back
#define input(c, n)             \
	for (int i = 0; i < (n); i++) \
		cin >> (c)[i];
#define exit_message(s) return 0 * printf(s)
#define show(c)           \
	for (auto i : (c))      \
		cout << i << " "; \
	cout << "\n";
#define display(c, n)           \
	for (int i = 0; i < (n); i++) \
		cout << (c)[i] << " ";    \
	cout << "\n";
#define forl(i, a, n) for (int (i) = (a); (i) < (n); (i)++)
#define dugbe(k) cout << "-\t> " << #k << " = " << k << "\n";

/* TIPS FOR DEBUGGING
 * Check if values are not overflowing (use long long where required)
 * Check if ranges are inclusive or not.
 * Check properly if greedy will work or not before using it.
 * Check EDGE CASES!! Seriously, even in 2B, saving 8 points by being
 * 2 minutes faster will bite you in the ass if you don't make sure
 * it works on edge cases.
 * Keep adding to this list.
*/

using namespace std;
typedef long long ll;
typedef pair<int, int> pr;
typedef pair<ll, ll> prll;
typedef vector<int> vi;
typedef vector<ll> vill;
typedef vector<pr> vpr;
ifstream in("input.txt");
const ll mod = 1e9 + 7;

ll mod_pow(ll a, ll b)
{
	if (b == 0)
		return 1LL;

	ll res = mod_pow(a, b >> 1);
	res = (res * res) % mod;
	if (b & 1LL)
		res = (res * a) % mod;

	return res;
}

const int N = 100 + 5;
const int SZ = 1e5 + 5;

int n, k;
int a[N];
int dp[SZ][2];

int solve(int k, int plaiya)
{
	if (k < 0)
		return 1;

	int &win = dp[k][plaiya];
	if (win != -1)
		return win;

	win = 0;
	for (int i = 0; i < n; i++)
	{
		win |= !(solve(k - a[i], plaiya ^ 1));
	}
	return win;
}

int32_t main()
{
#ifdef FASTIO
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#endif
	// freopen("in.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);

	memset(dp, -1, sizeof dp);

	cin >> n >> k;
	forl(i, 0, n)
	{
		cin >> a[i];
	}

	int ans = solve(k, 0);

	cout << (ans ? "First" : "Second") << "\n";

	return 0;
}

Measured memory_bytes: 5888
import java.util.Scanner;

public class Main {
	static Scanner sc = new Scanner(System.in);
	static int ip;
	public static void main(String[] args) {
		ip=sc.nextInt();
		int h = ip/(60*60);int tmp = ip%(60*60);
		int m = tmp/60;
		int s=tmp%60;
		
		System.out.println(h+":"+m+":"+s);
		
	}

}

Measured memory_bytes: 17160
import sys


def input(): return sys.stdin.readline().strip()


def solve(N, a):
    def f(x): return 0 if x % 2 != 0 else 1+f(x//2)
    ans = sum(map(f, a))
    return ans


def main():
    N = int(input())
    a = list(map(int, input().split()))
    ans = solve(N, a)
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 4148
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

typedef struct dice{
	int face[6];
}dice;

void rotate(dice*d,char dir)
{
	int temp;
	switch(dir){
		case 'N':
		temp=d->face[0];
		d->face[0]=d->face[1];
		d->face[1]=d->face[5];
		d->face[5]=d->face[4];
		d->face[4]=temp;
		break;
		case 'E':
		temp=d->face[0];
		d->face[0]=d->face[3];
		d->face[3]=d->face[5];
		d->face[5]=d->face[2];
		d->face[2]=temp;
		break;
		case 'W':
		temp=d->face[0];
		d->face[0]=d->face[2];
		d->face[2]=d->face[5];
		d->face[5]=d->face[3];
		d->face[3]=temp;
		break;
		case 'S':
		temp=d->face[0];
		d->face[0]=d->face[4];
		d->face[4]=d->face[5];
		d->face[5]=d->face[1];
		d->face[1]=temp;
		break;
	}
}
int isSame(dice d1, dice d2)
{
	static const char dir[]= "NNNESSSWNNNESSSWNNNESSSW";
	int i,j;
	for(i=0;i<24;i++){
		for(j=0;j<6&&d1.face[j]==d2.face[j];j++);
		if(j==6) return 1;
		rotate(&d2,dir[i]);
	}
	return 0;
}
int main() 
{
	dice d1, d2;
	int i;
	for(i=0;i<6;i++){
		scanf("%d",&d1.face[i]);
	}
	for(i=0;i<6;i++){
		scanf("%d",&d2.face[i]);
	}
	puts(isSame(d1,d2)? "Yes":"No");
	return 0;
}

Measured memory_bytes: 1836
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};

#[allow(unused_imports)]
use std::io::Write;

fn main() {
    input!{
      n: usize,
      w: usize,
      wvs: [(usize, usize); n],
    }
    let mut dp = vec![vec![0; w+1]; n+1];
    for i in 0..n {
        let (cw, cv) = wvs[i].clone();
        for j in 0..w+1 {
            if j + cw <= w {
                dp[i+1][j+cw] = max(dp[i+1][j+cw], dp[i][j] + cv);
            }
            dp[i+1][j] = max(dp[i+1][j], dp[i][j]);
        }
    }
    println!("{}", dp[n].iter().max().unwrap());
}


Measured memory_bytes: 106748
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;cin >> s;
	vector<int> a;
	rep(i,s.size()-2){
		int x=0;
		rep(j,3){
			x*=10;
			x+=s.at(i+j)-'0';
		}
		a.pb(x);
	}
	int ans=1000;
	rep(i,a.size()){
		ans=min(ans,abs(a.at(i)-753));
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, x, n) for (int i = x; i < (n); i++)
#define all(n) begin(n), end(n)
struct cww
{
    cww()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
} star;
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<char> vchar;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template <typename T, typename... Ts>
auto make_v(size_t a, Ts... ts)
{
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }

template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v)
{
    for (auto &e : t)
        fill_v(e, v);
}
int main()
{
    double A,B,H,M;
    cin>>A>>B>>H>>M;
    double Min = H*60+M;
    double theta = 5.5*Min*M_PI/180;
    double ans = sqrt(A*A+B*B-2*A*B*cos(theta));
    cout<<setprecision(20)<<ans;
    return 0;
}

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

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

using namespace std;

using ll = long long;

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

    int N;
    cin >> N;
    string S;
    cin >> S;

    vector<int> freq(3);
    map<char, int> encode = {{'R', 0}, {'G', 1}, {'B', 2}};
    for (char c: S) {
        ++freq[encode[c]];
    }

    ll result = (ll)freq[0] * freq[1] * freq[2];
    REP(j, N) {
        FOR(d, 1, min(j, N - 1 - j) + 1) {
            int i = j - d;
            int k = j + d;
            if (S[i] != S[j] && S[j] != S[k] && S[k] != S[i]) {
                --result;
            }
        }
    }
    cout << result << endl;

    return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using ll = long long;
using P = pair<ll, ll>;
ll GCD(ll a, ll b) { return b?GCD(b, a%b):a; }
ll LCM(ll a, ll b) { return a/GCD(a, b)*b; }

// Eratosthenesの篩
vector<bool> primeno(10000100, true);
vector<ll> primep(10000100, 1);
vector<ll> primesum(10000100, -1);
void Eratosthenes(int n) {
    primeno.at(0) = primeno.at(1) = false;
    int limit = sqrt(n);
    for(int i = 2; i <= limit+1; ++i) {
        if(primeno.at(i)) {
            for(int j = 0; i*(j+2) <= n; ++j) {
                primeno.at(i*(j+2)) = false;
            }
        }
    }
}

int main() {
    ll x; cin >> x;
    Eratosthenes(x);
    vector<ll> sosuu;
    for(int i = 2; i <= x; ++i) {
        if(primeno.at(i)) sosuu.emplace_back(i);
    }
    for(int i = 0; i < (int)sosuu.size(); ++i) {
        ll sss = sosuu.at(i);
        for(int j = 0; sss*(j+1) <= x; ++j) {
            primep.at(sss*(j+1)) = sss;
        }
    }

    ll sum = 0;
    for(int i = 1; i <= x; ++i) {
        if(primesum.at(i) != -1) sum += primesum.at(i);
        ll now = i;
        map<ll, ll> mcnt;
        ll fk = 1;
        while(1) {
            if(primesum.at(now) != -1) {
                fk = primesum.at(now);
                break;
            }
            if(primep.at(now) == 1) break;
            ll mnow = primep.at(now);
            now /= mnow;
            mcnt[mnow]++;
        }
        for(auto xx : mcnt) {
            fk *= (xx.second+1);
        }
        sum += (fk*i);
    }
    cout << sum << endl;
}

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

int main() {
  int num, p;
  int kisuCnt = 0;
  cin >> num >> p;

  for (int i = 0; i < num; i++){
    int tmp;
    cin >> tmp;
    if (tmp % 2 == 1) kisuCnt++;
  }
  
  if(kisuCnt == 0){
    if (p == 0) cout << (1LL << num);
    else cout << 0;
  } else {
    cout << (1LL << num - 1);
  }
}

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

using namespace std;

int main(){
	int n, k;
	cin >> n >> k;
	string s;
	vector<int> p(26);
	for(int i = 0; i < n; i++){
		cin >> s;
		p[s[0] - 'A']++;
	}
	int ans = 0;
	bool f = true;
	while(1){
		sort(p.begin(), p.end(), greater<int>());
		for(int i = 0; i < k; i++){
			if(p[i] <= 0){
				f = false;
				break;
			}
			p[i]--;
		}
		if(!f){
			break;
		}
		ans++;
	}
	cout << ans << endl;
	return 0;
}

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

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

  int n, m;
  cin >> n >> m;

  priority_queue<int> aq;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;

    aq.push(a);
  }

  for (int i = 0; i < m; i++) {
    int a = aq.top();
    aq.pop();
    aq.push(a / 2);
  }

  ll total = 0;
  while (!aq.empty()) {
    total += aq.top();
    aq.pop();
  }

  cout << total << endl;

  return 0;
}

Measured memory_bytes: 892
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <math.h>
#include <string>
#include <numeric>
#include <queue>
#include <cstdio>
#include <cstring>
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define rep1(i,n) for(ll i=1;i<n;++i)
#define mrep(i,n) for(ll i=n;i>=0;--i)
#define all(a) (a).begin(),(a).end()
#define vl vector<ll>
#define vvl vector<vector<ll> >
#define vb vector<bool>
#define vvb vector<vector<bool> >
#define pl pair<ll,ll>
#define inf 1001001001001001000
//#define mod 1000000007
#define mod 998244353
#define pi 3.1415926535
using namespace std;
struct __INIT {
	__INIT() {
		cin.tie(0);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(15);
	}
}__init;


int main(void) {
	ll n;
	cin >> n;
	string s;
	cin >> s;
	ll l = 0;
	ll r = n-1;
	ll cnt = 0;
	vl ws(n, 0), as(n, 0);
	if (s[0] == 'W') ws[0] = 1;
	else as[0] = 1;
	rep1(i, n) {
		ws[i] = ws[i - 1];
		as[i] = as[i - 1];
		if (s[i] == 'W') ws[i]++;
		else as[i]++;
	}
	ll ans = as[n - 1];
	rep(i, n) {
		ans = min(ans,min(ws[i],(as[n-1]-as[i]))+abs(ws[i]-(as[n-1]-as[i])));
	}
	cout << ans << endl;
	return 0;
}


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

int main(){
	int n,l,sum=0,m1=0;
	cin>>n;
	for(int i=0; i<n; i++){
		cin>>l;
		sum+=l,m1=max(m1,l);
	}
	if(m1<sum-m1)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}


Measured memory_bytes: 256
from bisect import bisect_left
from collections import deque

N=int(input())
minList=deque([])
minmax=-1
for i in range(N):
  if i==0:
    a=int(input())
    minList.append(a)
    minmax=a
  else:
    a=int(input())
    if a<=minmax:
      minmax=a
      minList.appendleft(a)
    else:
      idx=bisect_left(minList,a)
      if idx==1:minmax=a
      minList[idx-1]=a
print(len(minList))

Measured memory_bytes: 76872
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <numeric>
#define ll long long int
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
using namespace std;
int mx4[] = {0,1,0,-1};
int my4[] = {1,0,-1,0};
int mx2[] = {1,0};
int my2[] = {0,1}; 

int main(){
    ll a,b,n; cin >> a >> b >> n;
    ll f,s;
    if(b>n){
        f = (a * n) / b;
        s = a * (n / b);
    }else{
        f = (a * (b-1)) / b;
        s = a * ((b-1) / b);
    }
    cout << f - s << endl;
}

Measured memory_bytes: 3636
#include <malloc.h>
#include <math.h>
#include <stdio.h>
#include <string.h>

//ABC169C
int main(){
    long long a;
    long double  b;
    scanf("%lld %Lf",&a,&b);
    long double c=a*b;
    long long d = c;
    printf("%lld",d);

    return 0;
}


Measured memory_bytes: 1756
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto&(x) : (a))
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

int main() {
  ll n;
  cin >> n;
  vector<ll> l(n), r(n);
  REP(i, n) { cin >> l[i] >> r[i]; }
  sort(ALL(l)), sort(ALL(r));

  if (n % 2 == 1) {
    ll low = l[(n - 1) / 2];
    ll high = r[(n - 1) / 2];
    cout << high - low + 1 << endl;
    return 0;
  }

  ll low1 = l[n / 2 - 1], low2 = l[n / 2];
  ll high1 = r[n / 2 - 1], high2 = r[n / 2];
  cout << (high1 + high2) - (low1 + low2) + 1 << endl;
}

Measured memory_bytes: 6360
import java.util.*;

public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    int k = sc.nextInt();
    int x = sc.nextInt();
    int amount = 500*k;
      if(amount>=x){
    System.out.println("Yes");
      }else{
 	System.out.println("No");       
      }
}
}

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


int main(){
    int64_t n, ans = 0;
    cin >> n;
    vector<int64_t> vec(n);
    for (int i = 0; i < n; i++){
        cin >> vec.at(i);
    }

    sort(vec.begin(), vec.end());
    if( 3 <= n){
    for(int i = 0; i < n - 2; i++){
        for(int j = i + 1; j < n - 1; j++){
            if(vec.at(i) != vec.at(j)){
                for(int k = j + 1; k < n; k++){
                    if(vec.at(j) != vec.at(k) && vec.at(i) + vec.at(j) > vec.at(k))ans++;
                }   
            }
        }

    }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3612
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define f first
#define s second
#define fastio ios_base::sync_with_stdio(false); cin.tie(0)
#define loop(i, a, b) for(int i=a; i<b; i++)
#define loopb(i, a, b) for(int i=a; i>=b; i--)
#define pb push_back
typedef long long int lli;
typedef pair<lli, lli> pii;
typedef vector<lli> vll;
// use to avoid collision
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
// for pair in unordered_map
struct hash_pair {
    template <class T1, class T2>
    size_t operator()(const pair<T1, T2>& p) const
    {
        auto hash1 = hash<T1>{}(p.first);
        auto hash2 = hash<T2>{}(p.second);
        return hash1 ^ hash2;
    }
};
lli power(lli x, lli y){
    lli res = 1;
    x = x ;
    while (y > 0) {
        if (y & 1)
            res = (res*x) ;
        y = y>>1;
        x = (x*x);
    }
    return res;
}
lli solve(){
	lli n;
	cin>>n;
	vector<pii> res;
	loop(i, 1, sqrt(n)+1){
		if(n%i == 0 ){
			res.push_back({i, n/i});
		}
	}
	if(res.size() == 1){
		cout<<n-1<<"\n";
		return 0;
	}
	lli ans = 1e16;
	loop(i, 0, res.size()){
		ans = min(ans, res[i].f + res[i].s - 2);
	}
	cout<<ans<<"\n";
	return 0;
}

int main(){
	fastio;
	lli t;
//	cin>>t;
	t = 1;
	while(t>0){
		t--;
		solve();
	}
}

Measured memory_bytes: 384
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <map>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main(){
    int n;
    cin >> n;
    int a=n%10;
    if(a==2||a==4||a==5||a==7||a==9){
        cout << "hon"<<endl;
    }else if(a==3){
        cout << "bon"<<endl;
    }else{
        cout << "pon"<<endl;
    }
    return 0;
}


Measured memory_bytes: 3596
import java.util.Scanner;
import java.math.BigDecimal;

class Main{

	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();

		int d = a / b;
		int r = a % b;

		double fa = (double)a;
		double fb = (double)b;

		double f = fa / fb;

		System.out.println(d + " " + r + " " + BigDecimal.valueOf(f).toPlainString());
	}
}


Measured memory_bytes: 26764
#include<bits/stdc++.h>
using namespace std;
#define ll long long                                    // long long省略
#define pb push_back                                    // push_back省略
#define mp make_pair                                    // make_pair省略
#define fi first                                        // first省略
#define se second                                       // second省略
#define itn int                                         // int誤字保険
#define count cout                                      // cout誤字保険
#define vecotr vector                                   // vector誤字保険
#define ednl endl                                       // endl誤字保険
#define opt() cin.tie(0); ios::sync_with_stdio(false)   // 入出力速度改善

#define rep(i,l,r) for(ll i=(l);i<(r);i++)               // 範囲[l, r)で刻み1のfor文(順方向)
#define repp(i,l,r,k) for(ll i=(l);i<(r);i+=(k))         // 範囲[l, r)で刻みkのfor文(順方向)
#define rrep(i,l,r) for(ll i=(r-1);i>=(l);i--)           // 範囲[l, r)で刻み1のfor文(逆方向)
#define rrepp(i,l,r,k) for(ll i=(r-1);i>=(l);i-=(k))     // 範囲[l, r)で刻みkのfor文(逆方向)
#define all(x) (x).begin(), (x).end()                   // vectorのポインタ位置指定用
#define max(p,q)((p)>(q)?(p):(q))                       // max拡張
#define min(p,q)((p)<(q)?(p):(q))                       // min拡張
#define bit(n,m)(((n)>>(m))&1)                          // 変数nのm番目のbitを取り出す

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int dy[]={0, 1, 0, -1};                                 // 4方向近傍
int dx[]={1, 0, -1, 0};                                 // 4方向近傍

int main(){
	ll n;cin>>n;
	rep(i,0,101)
      	rep(j,0,101)
		if(4*i+7*j == n){
			cout << "Yes" << ednl;
			return 0;
		}
	cout << "No" << ednl;
}


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

int main(void){
	int N,W;
	cin >> N >> W;

	vector<int> cur(W+1,0);
	vector<int> nxt(W+1,-1);
		
	cur[0] = 0;

	for(int i = 0; i < N; ++i){
		int v,w;
		cin >> v >> w;

		for(int j = 0; j <= W; ++j){
			nxt[j] = cur[j];	
			if(j-w < 0 or cur[j-w] == -1) continue;
			nxt[j] = max(nxt[j],cur[j-w]+v);
		}

		cur = move(nxt);
		nxt.assign(W+1,-1);
	}

	cout << *max_element(begin(cur),end(cur)) << endl;

	return 0;
}

Measured memory_bytes: 3168
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = sc.nextInt();
    int flg = 0;
    if(N == 1 && M == 0){
        System.out.println("0");
        flg = 1;
    }
    int[] n = new int[N];
    int[] flg2 = new int[N];
    for(int i = 0; i < M; i++){
      int s = sc.nextInt();
      int c = sc.nextInt();
      if(N == 1 && M == 1){
        System.out.println(c);
        flg = 1;
        break;
      } else if(s == 1 && c == 0){
        System.out.println("-1");
        flg = 1;
        break;
      } else if(n[s - 1] == 0 || n[s - 1] == c || flg2[s - 1] == 0){
        n[s - 1] = c;
        flg2[s - 1] = 1;
      } else {
        System.out.println("-1");
        flg = 1;
        break;
      }
    }
    if(N != 1 && n[0] == 0){
      n[0] = 1;
    }
    if(flg == 0){
      for(int i = 0; i < N; i++){
        System.out.print(n[i]);
      }
    }
  }
}


Measured memory_bytes: 23636
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    resolve(System.in, System.out);
  }

  static void resolve(InputStream is, PrintStream pw) {
    Scanner sc = new Scanner(is);
    String n = sc.next();
    int n1 = Integer.valueOf(String.valueOf(n.charAt(n.length() - 1)));
    if (n1 == 3) {
      pw.println("bon");
    } else if (n1 == 0 || n1 == 1 || n1 == 6 || n1 == 8) {
      pw.println("pon");
    } else {
      pw.println("hon");
    }
  }
}


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

typedef long long ll;
typedef pair<int, int> P;

const ll mod =  1000000007;  //出力は (ans % mod + mod) % mod  (負の剰余を正にする)
const int inf = 1e9;
const long long INF = 1LL << 60;   // INF = 1152921504606846976

int main()
{
    int n; cin >> n;
    int ans = 1;
    for(int i = 2; i <= n; i++){
        int tmp = i*i;
        while(tmp <= n){
            ans = max(ans,tmp);
            tmp *= i;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 384
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        int A = Integer.parseInt(sc.next());
        int B = Integer.parseInt(sc.next());
        int C = Integer.parseInt(sc.next());
        
        int res = 0;
        
        if((A+B) >= C){
            res = C+B;
        }else{
            res = B * 2 + Math.min(C - B, A + 1);
        }
        
        System.out.println(res);
    }
}


Measured memory_bytes: 23252
import numpy as np


def factor_num(N):
    factor = {}
    for i in range(2, int(N)):
        while N % i == 0:
            N /= i
            factor[i] = factor.get(i, 0) + 1

    return np.prod(list(map(lambda x: x+1, factor.values())))


N = int(input())
cnt = 0
for i in range(1, N+1):
    if i % 2 == 1 and factor_num(i) == 8:
        cnt += 1

print(cnt)


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

using namespace std;
typedef long long ll;

int main(void) {
	int num, k, i, a, b;
	ll ans = 0;
	cin >> num;
	vector<int> d(num);
	for (i = 0; i < num; i++) {
		scanf("%d%d", &a, &b);
		ans -= b;
		d[i] = a + b;
	}
	sort(d.begin(), d.end(), greater<int>());
	for (i = 0; i < num; i += 2) {
		ans += d[i];
	}
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 640
let rec yakusu a b c count =
  if a <= b then
    match c mod a with
    | 0 -> yakusu (a + 1) b c (count + 1)
    | _ -> yakusu (a + 1) b c count
  else
    count;;

read_line()
|> Str.split (Str.regexp " ")
|> List.map int_of_string
|> function | a :: b :: [c] -> yakusu a b c 0
            | _ -> 0;
              |> string_of_int
              |> print_endline



Measured memory_bytes: 2240
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int A,B,C;
    cin>>A>>B>>C;
    int max=A+B;
    if(A+B<A-B){
        max=A-B;
        if(A-B<A*B){
            max=A*B;
        }
    }
    else if(A+B<A*B){
        max=A*B;
        if(A*B<A-B){
            max=A-B;
        }
    }
    cout<<max;
}


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

int main()
{		
	int n, a, b, x;

	cin >> n >> a >> b;

	if (a + b > n)
		x = a + b - n;
	else
		x = 0;

	cout << min(a, b) << " " << x << endl;

	return 0;
}


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

#define LLINF (1LL<<60)
typedef long long ll;

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)

//C++14 (GCC 5.4.1)
int main() {
    int N,M,C;
    cin >>N>>M>>C;

    vector<vector<int>> A(N,vector<int>(M));
    vector<int> B(M);
    rep(i,M) cin >> B[i];
    rep(i,N)rep(k,M)cin >>A[i][k];

    
    //-----------------------------------
    int ans=0,NAI;
    rep(i,N){
        NAI=C;
        rep(k,M){
            NAI+=A[i][k]*B[k];
        }
        if(NAI>0)ans++;
    }

    cout << ans <<endl;
    return (0);
}

Measured memory_bytes: 256
import sys

input = sys.stdin.readline


def main():
    N, C = [int(x) for x in input().split()]
    XV = [[int(x) for x in input().split()] for _ in range(N)]

    migi = [0]
    last = 0
    for x, v in XV:
        migi.append(migi[-1] + v - x + last)
        last = x

    hidari = [0]
    last = C
    for x, v in XV[::-1]:
        hidari.append(hidari[-1] + v - (last - x))
        last = x

    ans = max(max(migi), max(hidari))

    migimax = []
    ma = 0
    for m in migi:
        ma = max(ma, m)
        migimax.append(ma)

    hidarimax = []
    ma = 0
    for m in hidari:
        ma = max(ma, m)
        hidarimax.append(ma)

    for i in range(N):
        ans = max(ans, migi[i + 1] - XV[i][0] + hidarimax[N - i - 1])

    for i in range(N):
        ans = max(ans, hidari[i + 1] - (C - XV[-i - 1][0]) + migimax[N - i - 1])

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 38916
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;


public class Main {
	private	static	BufferedReader	br = null;

	static {
		br    = new BufferedReader(new InputStreamReader(System.in));
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		ArrayList<Integer>	cards = null;
		int[]				aHand = null;

		while((aHand = parseHand()) != null) {
			if (cards == null) {
				cards = new ArrayList<Integer>();
				for (int n = 1; n <= 10; n++) {
					cards.add(n);
				}
			}
			else {
				Collections.sort(cards);
			}

			result(cards, aHand);
		}
	}

	private static int[] parseHand() {
		int[]		aHand = null;
		String[]	as    = null;

		try {
			String line = br.readLine();
			if (line != null) {
				if (!line.isEmpty()) {
					as       = line.split(" ");
					aHand    = new int[3];	
					aHand[0] = Integer.parseInt(as[0]);
					aHand[1] = Integer.parseInt(as[1]);
					aHand[2] = Integer.parseInt(as[2]);
				}
			}
		}
		catch (NumberFormatException e) {}
		catch (IOException e) {}

		return aHand;
	}

	private static void result(ArrayList<Integer> cards, int[] aHand) {
		int		sub    = 20 - aHand[0] - aHand[1];
		boolean	border = true;

		if (sub <= 10) {
			cards.remove((Integer)aHand[0]);
			cards.remove((Integer)aHand[1]);
			cards.remove((Integer)aHand[2]);
			for (int n = 0; n < 4 && border; n++) {
				border = (cards.get(n) <= sub);
			}
			cards.add((Integer)aHand[0]);
			cards.add((Integer)aHand[1]);
			cards.add((Integer)aHand[2]);
		}

		if (border) {
			System.out.println("YES");
		}
		else {
			System.out.println("NO");
		}
	}
}

Measured memory_bytes: 16916