akhauriyash/Code-Regression huggingface dataset:
n,m = map(int,input().split())
a_array = [int(x) for x in input().split()]
d = dict()
for a in a_array:
    d.setdefault(a, 0)
    d[a] += 1
for _ in range(m):
    b,c = map(int, input().split())
    d.setdefault(c, 0)
    d[c] += b
key = sorted(d.keys(),reverse=True)
ans = 0
index = 0
while n > 0:
    num = key[index]
    if d[num] >= n:
        ans += num * n
        break
    ans += num * d[num]
    n -= d[num]
    index += 1

print(ans)



Measured memory_bytes: 32064
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[][] a = new int[n][26];
    for(int i = 0; i < 3; i++) {
      String s = sc.next();
      for(int j = 0; j < n; j++) {
        int t = s.charAt(j) - 'a';
        a[j][t]++;
      }
    }
    int ans = 0;
    for(int i = 0; i < n; i++) {
      int m = 0;
      for(int j = 0; j < 26; j++) {
        m = Math.max(m, a[i][j]);
      }
      ans += (3 - m);
    }
    System.out.println(ans);
  }
}

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

#define FOR(i, a, b) for(int i = (int)a; i <= (int)b; ++i)
#define FORD(i, a, b) for (int i = (int)a; i >= (int)b; --i)
#define REP(i, n) for (int i = 0; i < (int)n; ++i)
#define Debug(x) cerr << #x << " = " << x << '\n';
#define HERE cerr << "HERE\n\n";
#define X first
#define Y second
#define pb push_back
#define FASTER { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); }

using namespace std;

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



int main(){
    FASTER
//    freopen("x.INP", "r", stdin);
//    freopen("x.OUT", "w", stdout);
    int n;
    string s, t;
    cin >> n >> s >> t;
    REP(i, n) cout << s[i] << t[i];
}


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

int n;
string s;

long long solve(int k){

  int tail = n;
  int cnum = 0;
  long long ans = 0;
  int mnum = 0;
  long long tmp = 0;
  for(int i = n-1;i >= 0;i--){
    switch(s[i]){
      case 'C':
        cnum++;
        break;
      case 'M':
        mnum++;
        tmp += cnum;
        break;
      case 'D':
        ans += tmp;
        break;
    }
    if(tail-i == k){
      tail--;
      switch(s[tail]){
        case 'C':
          tmp -= mnum;
          cnum--;
          break;
        case 'M':
          mnum--;
          break;
      }
    }
  }

  return ans;
}

int main(){

  cin >> n >> s;

  int q, k;

  cin >> q;

  for(int i = 0;i < q;i++){
    cin >> k;
    cout << solve(k) << endl;
  }

  return 0;
}



Measured memory_bytes: 1412
#define _CRT_SECURE_NO_WARNINGS

#include<iostream>
#include<algorithm>
#include<stdio.h>

using namespace std;

long long m[100010], n, a, b;

int check(long long  times) {
	long long an = 0;
	long long p = times * b;
	long long q = a - b;
	for (int i = n - 1; i >= 0; i--) {
		if (m[i] > p) {
			an += (m[i] - p) / q + ((m[i] - p) % q == 0 ? 0 : 1);
		}
	}
	if (an > times) {
		return 0;
	}
	else {
		return 1;
	}
}

/*int find(long long  left, long long right) {
	//cout << left <<" "<< right << endl;
	if (left >= right) {
		return left;
	}
	int mid = (left + right) >> 1;
	if (check(mid)) {
		find(left, mid);
	}
	else {
		find(mid + 1, right);
	}
}*/

int main() {
	scanf("%lld%lld%lld", &n, &a, &b);
	long long shp = 0;
	for (int i = 0; i < n; i++) {
		scanf("%lld", &m[i]);
		shp += m[i] / b + 1;
	}
	sort(m, m + n);
	long long left = 1, right = shp;
	while (left < right) {
		long long mid = (left + right) >> 1;
		if (check(mid)) {
			right = mid;
		}
		else{
			left = mid + 1;
		}
	}
	cout << left << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep_(i, n, m) for (int i = n; i < (int)(m); i++)
#define all(v) v.begin(), v.end()
#define int long long
#define stoi stoll
//#define _GLIBCXX_DEBUG



signed main() {
  int N; cin >> N;
  
  map<pair<int,int>, int> m;
  rep(i, N) {
    int x, y; cin >> x >> y;
    m[make_pair(x,y)]++;
  }
  
  if(m.size() == 1) {
    cout << 0 << endl;
    return 0;
  }
  
  int mi = 10000000000, ma = -10000000000;
  int mmi = 10000000000, mma = -10000000000;
  
  map<pair<int,int>, int> mm;
  for(auto p : m) {
    int x = p.first.first, y = p.first.second;
    mi = min(mi, x-y); ma = max(ma, x-y);
    mmi = min(mmi, x+y); mma = max(mma, x+y);
  }
  
  cout << max(ma-mi, mma-mmi) << endl;
    
  

}


Measured memory_bytes: 16092
#include <stdio.h>

int main(void){
    char s[3];
    int sc[3] = {0};
    int flag = 0;
    scanf("%s",s);
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            if(s[i] == 'a'+j)sc[j]++;
        }
    }
    for(int i=0;i<3;i++){
        if(sc[i] > 1){
            flag = 1;
        }
    }
    if(flag)printf("No\n");
    else printf("Yes\n");
    return 0;
}

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

using namespace std;

#define REP(i, n)   for(int i = 0; i < (n); i++)
#define REPS(i, n)  for(int i = 1; i <= (n); i++)
#define RREP(i, n)  for(int i = (n)-1; i >= 0; i--)
#define RREPS(i, n) for(int i = (n); i > 0; i--)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define mp make_pair
#define mt make_tuple
#define pb push_back

using ll  = long long;
using pi  = pair<int, int>;
using pl  = pair<ll, ll>;
using vi  = vector<int>;
using vl  = vector<ll>;
using vs  = vector<string>;
using vb  = vector<bool>;
using vvi = vector<vi>;
using vvl = vector<vl>;

const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const ll  INFL = 1e18;
const double PI = 3.141592653589793;
const double EPS = 1e-9;

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

vi city_road;
vi city_train;

int root(int x)
{
    if(city_road[x] == x) return x;
    return city_road[x] = root(city_road[x]);
}

void unite(int x, int y)
{
    int rx = root(x);
    int ry = root(y);
    city_road[rx] = ry;
}

int root2(int x)
{
    if(city_train[x] == x) return x;
    return city_train[x] = root2(city_train[x]);
}

void unite2(int x, int y)
{
    int rx = root2(x);
    int ry = root2(y);
    city_train[rx] = ry;
}

signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    int N, K, L; cin >> N >> K >> L; 
    city_road.resize(N); REP(i, N) city_road[i] = i;
    city_train.resize(N); REP(i, N) city_train[i] = i;

    REP(i, K)
    {
        int a, b; cin >> a >> b;
        a--; b--;
        unite(a, b);
    }
    REP(i, L)
    {
        int a, b; cin >> a >> b;
        a--; b--;
        unite2(a, b);
    }

    map<pi, int> m;
    REP(i, N)
    {
        m[mp(root(city_road[i]), root2(city_train[i]))]++;
    }
    REP(i, N)
    {
        cout << m[mp(root(city_road[i]), root2(city_train[i]))] << " ";
    }
    cout << endl;
}

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

#define ll long long
#define MOD 1000000007


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

    vector<ll> a(n);
    for(int i=0;i<n;i++){
        cin>>a.at(i);
    }

    sort(a.begin(),a.end());

    priority_queue<ll> s;

    for(int i=1;i*i<a.at(0);i++){
        if(a.at(0)%i==0){
            s.push(a.at(0)/i);
            s.push(i);
        }
    }

    int v=0;
    while(v==0){
        for(int i=0;i<n;i++){
            if(a.at(i)%s.top()!=0)break;
            if(i==n-1)v=s.top();
        }
        s.pop();
    }

    cout<<v<<endl;


}



Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>
using namespace std;
double d,x,n,ans;
int main()
{
	cin>>n>>d>>x;
	for(int i=n;i;--i)
	{
		double sum=(d*2*n+n*(n+n-1)*x);
		ans+=sum/2/n;
		double dd=(d*(n+n-2)+d+2*x+3*d+3*x)/2/n;
		sum-=(4*d+4*n*x-2*x)/2/n;--n;
		d=dd;x=(sum-2*n*d)/n/(n+n-1);
	}
	printf("%.10lf\n",ans);
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<string>
#include<unordered_map>
#include<set>
using namespace std;

#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j,k
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define sort(a) sort(a.begin(),a.end())
#define push(a,b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define sizeoof(a,b) (a,vector<ll>(b))
#define llpvec vector<pair<ll,ll>>
/*繰り上げ除算*/ll cei(ll x,ll y){ll ans=x/y;if(x%y!=0)ans++;return ans;}
/*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
/*n乗*/ll llpow(ll x,ll n){ll i,ans=1;rep(i,0,n)ans*=x;return ans;}
/*階乗*/ll fact(ll x){ll i,ans=1;rep(i,0,x)ans*=(x-i);return ans;}
/*nCr*/ll ncr(ll n,ll r){return fact(n)/fact(r)/fact(n-r);}
/*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);}
/*primejudge*/bool prime(ll a){if(a<=1)return false;ll i;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
llfor;///////////////////////////////////////////////////////////
int main(){
 ll n;sc(n);
 vector<string>s;
 string t;
 rep(i,0,n){
  sc(t);
  //pr(t);
  push(s,t);
 }
 ll len;
 ll cnt[100][100];
 rep(i,0,100){
  rep(j,0,100){
   cnt[i][j]=0;
  }
 }

 rep(i,0,n){
  t=s[i];
  len=t.length();
  rep(j,0,len){
   cnt[i][t[j]-'a']++;
  // cout<<i<<" "<<t[j]-'a'<<" "<<cnt[i][t[j]-'a']<<endl;
  }
 }
 ll k;bool flag=false;
 string ans;
 char b;
 rep(i,0,26){
  ll tmp=0;
  flag=false;
  while(!flag){
   //pr(i);
   tmp++;
   rep(j,0,n){
    if(cnt[j][i]<tmp){
     flag=true;break;
    }
   // cout<<i<<" "<<j<<" "<<tmp<<" "<<cnt[j][i]<<endl; 
   }
   if(!flag){
    b='a'+i;
    ans+=b;
   // pr(ans);
   }
  }
 }
 sort(ans);
 pr(ans);
 
return 0;}

Measured memory_bytes: 3636
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cstdlib>
#include<ctime>
#include<functional>
#include<cmath>
#include<vector>
#include<assert.h>
#include<unordered_map>
//using namespace std;
using std::min;
using std::max;
using std::swap;
using std::sort;
using std::reverse;
using std::random_shuffle;
using std::lower_bound;
using std::upper_bound;
using std::unique;
using std::vector;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef std::pair<int,int> pii;
typedef std::pair<ll,ll> pll;
void open(const char *s){
#ifndef ONLINE_JUDGE
	char str[100];sprintf(str,"%s.in",s);freopen(str,"r",stdin);sprintf(str,"%s.out",s);freopen(str,"w",stdout);
#endif
}
void open2(const char *s){
#ifdef DEBUG
	char str[100];sprintf(str,"%s.in",s);freopen(str,"r",stdin);sprintf(str,"%s.out",s);freopen(str,"w",stdout);
#endif
}
int rd(){int s=0,c,b=0;while(((c=getchar())<'0'||c>'9')&&c!='-');if(c=='-'){c=getchar();b=1;}do{s=s*10+c-'0';}while((c=getchar())>='0'&&c<='9');return b?-s:s;}
void put(int x){if(!x){putchar('0');return;}static int c[20];int t=0;while(x){c[++t]=x%10;x/=10;}while(t)putchar(c[t--]+'0');}
int upmin(int &a,int b){if(b<a){a=b;return 1;}return 0;}
int upmax(int &a,int b){if(b>a){a=b;return 1;}return 0;}
const int N=200010;
std::unordered_map<int,int> s;
int c[N];
int a[N];
int b[N];
int n;
vector<int> vec[N];
int main()
{
//	open("b");
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	sort(a+1,a+n+1,std::greater<int>());
	int ans=0;
	int cnt=0;
	for(int i=1;i<=n;i++)
		s[a[i]]=++cnt;
	for(int i=n;i>=1;i--)
		vec[s[a[i]]].push_back(i);
	c[0]=1;
	for(int i=1;i<=30;i++)
		c[i]=c[i-1]*2;
	for(int i=1;i<=n;i++)
		if(!b[i])
		{
			vec[s[a[i]]].pop_back();
			for(int j=30;j>=0;j--)
				if(c[j]-a[i]<=a[i]&&c[j]>a[i]&&s.count(c[j]-a[i])&&!vec[s[c[j]-a[i]]].empty())
				{
					int v=vec[s[c[j]-a[i]]].back();
					vec[s[c[j]-a[i]]].pop_back();
					b[v]=1;
					b[i]=1;
					ans++;
				}
		}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 20936
#include<iostream>
using namespace std;
int main()
{
    long long int a,b,x;
    cin>>a>>b>>x;
    long long int mod,m;
    m=a/x;
    mod=(b/x)-m;
    if(a%x==0){
        mod++;
    }
    cout<<mod<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
#define LL long long
#define INF 1<<31-1
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define FOR(i,a,n) for(i=a;i<n;i++)
#define MOD 1000000007
#define NUM 100005
void swap(int* a,int* b){int tmp=*a;*a=*b;*b=tmp;}
int cmp(const void* a,const void* b){return *(int*)a-*(int*)b;}

LL GCD(LL x,LL y){
  int z=1,tmp=MAX(x,y);
  y=MIN(x,y);
  x=tmp;
  while(z!=0){
    z=x%y;
    x=y;
    y=z;
  }
  return x;
}

int main() {
  LL A,B,C,D,i,ans=0;
  scanf("%lld%lld%lld%lld",&A,&B,&C,&D);
  LL E=C*D/GCD(C,D);
  A--;
  ans=B-B/C-B/D+B/E-(A-A/C-A/D+A/E);

  printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 128
#include <iostream>

using namespace std;

int main(){
  int n, rj, ri, answer = -1000000000;
  cin >> n >> ri;
  for(int i = 1; i < n; i++){
    cin >> rj;
    if(answer < rj - ri) answer = rj - ri;
    if(ri > rj) ri = rj;
  }
  cout << answer << endl;
}


Measured memory_bytes: 3116
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<functional>

using namespace std;

long n;
long p[65000];
long j[64999];

int main(){
	while(1) {
		scanf("%ld", &n);

		if( n == 0 ) break;

		long sum = 0;
		for( int i = 0; i < n; ++i ) {
			scanf("%ld", &p[i]);
			sum += p[i];
		}
		for( int i = 0; i < n - 1; ++i ) {
			scanf("%ld", &j[i]);
		}
		sort(j, j+n-1, greater<long>());

		long res = sum * n;
		for( int i = 0; i < n - 1; ++i ) {
			sum += j[i];
			res = max(res, sum*(n-1-i));
		}
		printf("%ld\n", res);
	}

	return 0;
}

Measured memory_bytes: 2060
#include <stdio.h>
#include <string.h>
int main(void){
    
    int i,a,b;
    char s[100];
    
    scanf("%d%d%s",&a,&b,s);
    
    if(s[a]-'-'==0){
        for(i=0;i<a+b+1;i++){
            if(i==a) i++;
            if((s[i]-'0'>=0)&&(s[i]-'0'<10)){}
            else{
                printf("No\n");
                return 0;
            }
        }
    }
    else{
        printf("No\n");
        return 0;
    }
    printf("Yes\n");
    
    return 0;
}


Measured memory_bytes: 1600
/*
ID: wangjun30
TASK:
LANG: C++
*/
#include<iostream>
#include<queue>
using namespace std;
int maxv=0;
int main(){
	int n,k;
	cin>>n>>k;
	int num[n+1];
	for(int i=1;i<=n;i++)	
		cin>>num[i];
	for(int f=1;f<=n;f++)
		for(int r=n;r>f;r--){
			int sumk=f+(n-r+1);
			if(sumk>k)
				continue;
			int remain=k-sumk;
			int sum=0;
			priority_queue<int> pq;
			for(int i=1;i<=f;i++)
				pq.push(num[i]);
			for(int i=r;i<=n;i++)
				pq.push(num[i]);
			while(pq.top()>0 || pq.size()>remain){
				if(pq.empty())
					break;
				sum+=pq.top();
				pq.pop();
			}
			maxv=max(maxv,sum);
		}
	for(int f=1;f<=n;f++){
		int sumk=f;
		if(sumk>k)
			continue;
		int remain=k-sumk;
		int sum=0;
		priority_queue<int> pq;
		for(int i=1;i<=f;i++)
			pq.push(num[i]);
		while(pq.top()>0 || pq.size()>remain){
			if(pq.empty()) 
				break;
			sum+=pq.top();
			pq.pop();
		}
		maxv=max(maxv,sum);
	}
	for(int r=n;r>=1;r--){
		int sumk=n-r+1;
		if(sumk>k)
			continue;
		int remain=k-sumk;
		int sum=0;
		priority_queue<int> pq;
		for(int i=r;i<=n;i++)
			pq.push(num[i]);
		while(pq.top()>0 || pq.size()>remain){
			if(pq.empty())
				break;
			sum+=pq.top();
			pq.pop();
		}
		maxv=max(maxv,sum);
	}
	cout<<maxv;
	return 0;
}

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

int main() {
    int H, W;
    cin >> H >> W;
    rep(i, H) {
        string S;
        cin >> S;
        cout << S << endl << S << endl;
    }
    return 0;
}

Measured memory_bytes: 256
N = int(input())
Ss = list(input())
S = [int(i) for i in Ss]

ans = 0
for i in range(10):
    for j in range(10):
        for k in range(10):
            val = [i,j,k]
            idx = 0
            for s in S:
                if s==val[idx]:idx+=1
                if idx>2:
                    ans += 1
                    break
print(ans)

Measured memory_bytes: 42860
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vc = vector<char>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using stkll = vector<pll>;
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
#define rep(i, n) for (ll i = 0; i < (n); i++)
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
#ifndef ONLINE_JUDGE
    #define debug(x) cerr << #x << ": " << x << endl;
#else
    #define debug(x)
#endif

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    ll n, k, l, r;
    cin >> n >> k >> l >> r;
    vll a(n);
    rep(i, n) cin >> a[i];

    vvll v1(30), v2(30);
    v1[0].push_back(0);
    v2[0].push_back(0);
    for(ll bit = 1; bit < 1<<(n/2); bit++) {
        ll tmp = 0;
        ll cnt = __builtin_popcountll(bit);
        rep(i, n/2) {
            if(bit>>i&1) tmp += a[i];
        }
        v1[cnt].push_back(tmp);
    }
    for(auto& v : v1) sort(v.begin(), v.end());

    for(ll bit = 1; bit < 1<<(n-n/2); bit++) {
        ll tmp = 0;
        ll cnt = __builtin_popcountll(bit);
        rep(i, n - n/2) {
            if(bit>>i&1) tmp += a[n/2 + i];
        }
        v2[cnt].push_back(tmp);
    }
    for(auto& v : v2) sort(v.begin(), v.end());

    ll ans = 0;
    rep(i, n/2+1) {
        if(i > k) continue;
        for(auto x : v1[i]) {
            if(r < x) continue;
            if(k-i > n - n/2) continue;
            ans += upper_bound(v2[k-i].begin(), v2[k-i].end(), r-x)
                   - lower_bound(v2[k-i].begin(), v2[k-i].end(), l-x);
        }
    }
    cout << ans << endl;
}



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

using namespace std;

#define ll long long int

int main()
{
ios_base::sync_with_stdio(false);
cout.tie(NULL);
cin.tie(NULL);
              string s;
cin>>s;
if(s=="ABC")
cout<<"ARC";
else
cout<<"ABC";
              return(0);
}


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

int main()  {
    int n,ans=INT_MAX;
    cin>>n;
    vector<int> v(n);
    for(int i=0;i<n;i++)
        cin>>v[i];
    for(int i=-100;i<=100;i++)
    {
        int cost=0;
        for(auto j:v)
            cost+=pow(i-j,2);
        ans=min(ans,cost);
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 3576
#include <cmath>
#include <iostream>
#include <vector>

using namespace std;

int main()
{
  int64_t a, b, v, w, t;
  cin >> a >> v;
  cin >> b >> w;
  cin >> t;

  int64_t ba = abs(b - a);
  int64_t wv = w - v;

  if (wv > 0)
  {
    cout << "NO" << endl;
    return 0;
  }

  double ti = 1 / (double)t;
  if (wv <= -ba * ti)
  {
    cout << "YES" << endl;
    return 0;
  }

  cout << "NO" << endl;
  return 0;
}

Measured memory_bytes: 3556
#include <functional>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <iomanip>
#include <vector>
#include <string>
#include <cstdio>
#include <chrono>
#include <random>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <set>
#if __cplusplus >= 201103L
#include <unordered_map>
#include <unordered_set>
#endif
#define ls x<<1
#define rs x<<1|1
#define fi first
#define se second
#define ll long long
#define pb push_back
#define mp make_pair
#define fun function
#define sz(x) x.size()
#define lowbit(x) x&(-x)
#define all(x) x.begin(),x.end()
#define mem(a,b) memset(a,b,sizeof(a))
#define IOS ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0);

using namespace std;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int INF = 0x3f3f3f3f;

char s[111111];

int main() {
	IOS;
#ifdef xiaofan
	freopen("1.in","r",stdin);
	freopen("1.out","w",stdout);
#endif


	cin>>s+1;
	if(s[3]==s[4] && s[5]==s[6]) cout<<"Yes";
	else cout<<"No";



	return 0;
}



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

int H,W;

int main() {
  cin >> H >> W;

  if (H < W) {
    cout << "0\n" ;
  } else {
    cout << "10\n" ;
  }

#if 0
  cout << H << " " << W << "\n";
#endif
  return 0;
}

Measured memory_bytes: 256
a=0
b=0
lists=[]
n=int(input())
lists2=[2*j for j in range(1,15001)]
lists3 =[3+6*k for k in range(0,5000)]
for q in range(1,2501):
    if (n-2*q)%3==0 and 1<=(n-2*q)<=15000:
        a=(n-2*q)
        b=q
if n>=7and n!=19999:
    lists=lists2[:a]+lists3[:2*b]
    print(*lists)
elif n==3:
    lists=[2,5,63]
    print(*lists)
elif n==4:
    lists=[2 ,5 ,20, 63]
    print(*lists)  
elif n==5:
    lists=[2,4,6,3,9]
    print(*lists)
elif n==6:
    lists=[2,5,20,63,70,140]
    print(*lists)
elif n==19999:
    lists=lists2[:14985]
    addlist2=[]
    count=0
    for i in lists3:
        if i%5!=0:
            addlist2.append(i)
            count+=1
        if count==3040:
            break
    addlist3=[]
    counter=0
    for i in range(5,30001,5):
        if i%2!=0 and i%3!=0:
            addlist3.append(i)
            counter+=1
        if counter==1974:
            break
    lists=lists+addlist2+addlist3
    print(*lists)
    


 
    

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

int main(){
	int n;
    string s;
    cin >> n >> s ;
    int ans = 0;
       for(int i = 0; i <= n - 3; i++) {
          if(s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C') ans++;
    }
       cout << ans << endl;
    return 0;
}

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

int main(){
    int N, K;
    int x;
    cin >> N;
    cin >> K;

    int distance = 0;

    rep(i, N)
    {
        cin >> x;
        if(x > K / 2){
            distance += (K - x) * 2;
        }else{
            distance += x * 2;
        }
    }

    cout << distance << endl;

    return 0;
}

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

using namespace std;

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

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

  vector<int> d(N);
  rep(i, N) cin >> d.at(i);

  vector<int> cnt(101);

  rep(i, N){
    cnt.at(d.at(i))++;
  }

  int total=0;
  for(int a : cnt){
    if(a) total++;
  }

  cout << total << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ld double
#define F first
#define S second
#define sz size
#define pb push_back

using namespace std;

const int MAXN = 1e6 + 5;
const int inf = 1e9 + 7;
const ll INF = 1e18;

int n;
double sum;

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    cin >> n;
    while (n--) {
        double x;
        string s;
        cin >> x >> s;
        if (s == "JPY") {
            sum += x;
        }
        else {
            sum += (380000.0 * x);
        }
    }
    cout.precision(5);
    cout << fixed;
    cout << sum;
    return 0;
}


Measured memory_bytes: 256
/*
Author : N_o_o_B
Created : June 14 2020 17:32:18 
*/
#include <bits/stdc++.h>
using namespace std;
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
*/
#define TRACE
#ifdef TRACE
#define trace(...) { cerr<<"[ "; __trace__(#__VA_ARGS__, __VA_ARGS__);}
#undef endl
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const pair<Arg1,Arg2> &x) {
    return out<<"("<<x.first<<","<<x.second<<")";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const vector<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const set<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const map<Arg1,Arg2> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
void __trace__(const string name, Arg1&& arg1){
    cerr << name << " : " << arg1 << " ] " << endl;
}
 
template <typename Arg1, typename... Args>
void __trace__(const string names, Arg1&& arg1, Args&&... args){
    const string name = names.substr(0,names.find(','));
    cerr<<name<<" : "<<arg1<<" | ";
    __trace__(names.substr(1+(int)name.size()), args...);
}
#else
    #define trace(args...)
#endif
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vll;
typedef vector<vl> vvl;
//typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> oset;
#define fori(i,n) for(int i=0;i<n;i++)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repd(i,a,b) for(int i=a;i>=b;i--)
#define ford(i,n)  for(int i=n-1;i>=0;i--)
#define trav(x,a) for(auto& x:a)
#define all(x) x.begin(),x.end()
#define pb push_back
#define endl '\n'
#define sz(a) (int)a.size()
#define fi first
#define se second
clock_t time_p=clock();
void time_taken()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
//const ll mod=998244353;
const ll mod=1e9+7;
const ll INF=1e18;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    cout.precision(12);cout << fixed;

    int n,m;
    cin >> n >> m;
    rep(i,0,n){
        if(i*2 + (n-i)*4 == m){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;



    time_taken();
    return 0;
}

Measured memory_bytes: 3780
import sys
import math
import string
import fractions
import random
from operator import itemgetter
import itertools
from collections import deque
import copy
import heapq
import bisect

MOD = 10 ** 9 + 7
INF = float('inf')
input = lambda: sys.stdin.readline().strip()


class UnionFind:
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


def comb(n, k):
    if n % 2 == 0:
        return n / 2 * (n - 1)
    else:
        return (n - 1) / 2 * n


N, M = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(M)]
uf = UnionFind(N)
ans = deque()
ans.appendleft(int(comb(N, 2)))
for i in range(M - 1, 0, -1):
    size1 = uf.size(AB[i][0] - 1)
    size2 = uf.size(AB[i][1] - 1)
    if size1 == N:
        ans.appendleft(0)
    elif uf.same(AB[i][0] - 1, AB[i][1] - 1):
        ans.appendleft(ans[0])
    else:
        uf.union(AB[i][0] - 1, AB[i][1] - 1)
        size3 = uf.size(AB[i][0] - 1)
        if size1 + size2 == 2:
            ans.appendleft(ans[0] - 1)
        elif size1 == 1:
            ans.appendleft(ans[0] - (int(comb(size3, 2)) - int(comb(size2, 2))))
        elif size2 == 1:
            ans.appendleft(ans[0] - (int(comb(size3, 2)) - int(comb(size1, 2))))
        else:
            ans.appendleft(ans[0] - (int(comb(size3, 2)) - int(comb(size1, 2)) - int(comb(size2, 2))))
for i in ans:
    print(i)


Measured memory_bytes: 37064
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>

bool triable(long long a, long long b, long long c){
  return (a < (c+b) && b < (a+c) && c < (a+b));
}

int main(){
  int n;
  std::cin >> n;
  std::vector<long long> v(n);
  for(auto&&e : v){
    std::cin >> e;
  }
  int ans=0;
  for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
      for(int k=j+1;k<n;k++){
        if(triable(v.at(i),v.at(j),v.at(k))
          && (v.at(i) != v.at(j)) && (v.at(i) != v.at(k)) && (v.at(k) != v.at(j))){
          ans++;
        }
      }
    }
  }
  std::cout << ans << "\n";
  return 0;
}

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

template <class T>
inline void read(T &x) {
    x = 0;
    char c = getchar();
    bool f = 0;
    for (; !isdigit(c); c = getchar()) f ^= c == '-';
    for (; isdigit(c); c = getchar()) x = x * 10 + (c ^ 48);
    x = f ? -x : x;
}

template <class T>
inline void write(T x) {
    if (x < 0) {
        putchar('-');
        x = -x;
    }
    T y = 1;
	int len = 1;
    for (; y <= x / 10; y *= 10) ++len;
    for (; len; --len, x %= y, y /= 10) putchar(x / y + 48);
}

int n, m, bit;

inline void printEdge(int u, int v) {
	write(u);
	putchar(' ');
	write(v);
	putchar('\n');
}

int main() {
	read(n);
	for (int i = 0; (1 << i) <= n; ++i)
		if (n == (1 << i)) {
			puts("No");
			return 0;
		}
	puts("Yes");
	for (int i = 2; i + 1 <= n; i += 2) {
		printEdge(1, i), printEdge(i, i + 1);
		printEdge(1, i + n + 1), printEdge(i + n + 1, i + n);
	}
	printEdge(3, n + 1);
	if (!(n & 1)) {
		for (int i = 0; (1 << i) <= n; ++i)
			if (n & (1 << i)) bit = i;
		printEdge(((1 << bit) ^ 1) + n, n), printEdge(n ^ (1 << bit), n << 1);
	}
	return 0;
}

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

int main(){
  int a,b;
  cin >> a >> b;
  if(a >= 13){
    cout << b << endl;
  }
  else if(a >= 6){
    cout << b /2 << endl;
  }
  else {
    cout << "0" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
import sys

use_clipboard=True
bbn=1000000007
	
#+++++

		
def main():
	s = input()
	n=len(s)
	m=n//2
	ret = s.count('p') - m
	
	print(-ret)
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
class input_clipboard:
	def __init__(self,s):
		self.input_l=s.splitlines()
		self.ii=0
		
	def input(self):
		ret = self.input_l[self.ii]
		self.ii+=1
		return ret

if __name__ == "__main__":
	if sys.platform =='ios':
		if use_clipboard:
			import clipboard
			input_text=clipboard.get()
			ic=input_clipboard(input_text)
			input = lambda : ic.input()
		else:
			sys.stdin=open('inputFile.txt')
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

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

// #define ONLINE_JUDGE

#define V vector
#define P pair

using LL = long long;
#define FOR(i, x, y) \
    for (decay<decltype(y)>::type i = (x), _##i = (y); i < _##i; ++i)
#define FORD(i, x, y) \
    for (decay<decltype(x)>::type i = (x), _##i = (y); i > _##i; --i)
#ifndef ONLINE_JUDGE
#define dbg(x...)                             \
    do {                                      \
        cerr << "\033[32;1m" << #x << " -> "; \
        err(x);                               \
    } while (0)
void err() { cerr << "\033[39;0m" << endl; }
template <template <typename...> class T, typename t, typename... A>
void err(T<t> a, A... x) {
    for (auto v : a) cerr << v << ' ';
    err(x...);
}
template <typename T, typename... A>
void err(T a, A... x) {
    cerr << a << ' ';
    err(x...);
}
#else
#define dbg(...)
#endif
#define sz(x) (int)x.size()

LL bin(LL a, LL b, LL p) {
    LL res = 1;
    a = (a % p + p) % p;
    for (; b; b >>= 1, a = a * a % p)
        if (b & 1) res = res * a % p;

    return res;
}

const int N = 1e5+50;


void solve() {
    LL x;
    LL now = 100;
    cin >> x;
    for (int i=0; ; ++i) {
        if (now >= x) {
            printf("%d\n", i);
            return;
        }

        now += floor(now * 0.01);
    }
}

int main() {

    // int t;
    // cin >> t;
    // while (t--) solve();

    solve();

    return 0;
}

Measured memory_bytes: 3764
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;

int main() {
  int a, b, c, k;
  cin >> a >> b >> c >> k;
  int ans = 0;
  int use_a = min(a, k);
  ans += min(a, k);
  if (use_a != k) {
    int use_b = min(b, k-use_a);
    if (use_a + use_b != k) {
      ans -= min(c, k-use_a-use_b);
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3636
s = str(input())
t = str(input())
n_s = len(s)
n_t = len(t)

count = n_t
for i in range(n_s-n_t+1):
  tmp = 0
  for s1, s2 in zip(s[i:n_t+i], t):
    if s1 != s2:
      tmp += 1
  if count > tmp:
    count = tmp
print(count)

Measured memory_bytes: 9148
import itertools
n, m, q = map(int,input().split())
A = itertools.combinations_with_replacement(range(1,m+1),n)
cond = [list(map(int,input().split())) for i in range(q)]
ma = 0
for a in A:
    p = 0
    for c in cond:
        if a[c[1]-1]-a[c[0]-1] == c[2]:
            p += c[3]
    if ma < p:
        ma = p

print(ma)


Measured memory_bytes: 9208
//---------------------------------------------------------------
#include <bits/stdc++.h>
using namespace std;
#include <iostream>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <math.h>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>
#include<algorithm>
//---------------------------------------------------------------
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define SIZE 100005
#define INF 1000000000000000LL
#define all(x) x.begin(),x.end()
using pint = pair<int,int>;
using vec = vector<int>;
using ll=long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
//---------------------------------------------------------------
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
//---------------------------------------------------------------

//↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

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

    int L;cin>>L;
    cout<<fixed<<setprecision(10)<<(double)L*L*L/27<<endl;
}

Measured memory_bytes: 3768
# -*- coding: utf-8 -*-

import itertools as it

############### TESTCASE ###############
test = ""
#test = \
"""
8
7 3 5 4 2 1 6 8
3 8 2 5 4 6 7 1
ans 17517
"""
########################################
test = list(reversed(test.strip().splitlines()))
if test:
    def input2():
        return test.pop()
else:
    def input2():
        return input()
################# MAIN ################# 

n = int(input2())
p = tuple(map(int, input2().split()))
q = tuple(map(int, input2().split()))

perm = tuple(it.permutations(range(1, n+1)))
ans = abs(perm.index(p) - perm.index(q))
print(ans)



Measured memory_bytes: 7992
#include<bits/stdc++.h>
#define PB push_back
#define F first
#define S second
#define MP m ake_pair
#define LB lower_bound
#define UB upper_bound

using namespace std;
typedef long long ll;
typedef pair<int , int> pii;
typedef long double DB;
const int N = 300100;
int a[N] , ans[N] , w1 , e1;
int main(){

	ios_base::sync_with_stdio(0) , cin.tie(0) , cout.tie(0);
	int n;
	string s;
	cin >> n >> s;

	for(int i = 0 ; i < n ; i++){
	   ans[i] += w1;
	   if(s[i] == 'W')
		  w1++;		  
	}
	
	for(int i = n-1 ; i >= 0 ; i--){
	   ans[i] += e1;
	   if(s[i] == 'E')
		  e1++;
	}
	
	int ret(N);

	for(int i = 0 ; i < n ; i++)
	   ret = min(ret , ans[i]);

	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 1812
#include<bits/stdc++.h>
using namespace std;
int main()
{
	unsigned long long int n,w;
	cin>>n>>w;
	unsigned long long int x,y;
	pair<unsigned long long int,unsigned long long int> p[n];
	
	for(unsigned long long int i=0;i<n;++i)
	{
		cin>>x>>y;
		p[i]=make_pair(x,y);
	
	}
	sort(p,p+n);
	unsigned long long int dp[n+1][w+1];
	
	memset(dp,0,sizeof(dp));
	for(unsigned long long int i=1;i<=n;++i)
	{
		for(unsigned long long int j=1;j<=w;++j)
		{
			if(p[i-1].first>j)
			{
				dp[i][j]=dp[i-1][j];
			}
			else
			{
				dp[i][j]=max(dp[i-1][j],p[i-1].second+dp[i-1][j-p[i-1].first]);
			}
		}
	}
	cout<<dp[n][w];
}

Measured memory_bytes: 79104
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<deque>
#include<iomanip>
using namespace std;
typedef long long int LL;
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;
typedef pair<LL,int> LP;
const int INF=1<<30;
const LL MAX=1e9+7;

void array_show(int *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%d%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(LL *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%lld%c",array[i],(i!=array_n-1?middle:'\n'));
}
void print_YES_NO(bool answer){cout<<(answer?"YES":"NO")<<endl;}
void print_Yes_No(bool answer){cout<<(answer?"Yes":"No")<<endl;}
void print_POSSIBLE_IMPOSSIBLE(bool answer){cout<<(answer?"POSSIBLE":"IMPOSSIBLE")<<endl;}

LL t[100005][3];
priority_queue<LP> q1;
bool used[100005];

int main(){
	LL n,m;
	int i,j,k;
	LL a,b,c;
	LL p,q;
	LL s=0;
	cin>>n>>m;
	for(i=0,p=0;i<n;i++){
		for(j=0;j<3;j++){
			cin>>t[i][j];
		}
		a=(m-t[i][0])*t[i][2]+t[i][0]*t[i][1];
		q1.push(make_pair(a,i));
		p+=t[i][0]*t[i][1];
	}
	while(!q1.empty()){
		a=q1.top().first,b=q1.top().second,q1.pop();
		if(p<a)break;
		p-=a,used[b]=true;
		s+=m;
	}
	if(p==0){
		cout<<s<<endl;
		return 0;
	}
	c=a;
	for(i=0,b=m;i<n;i++){
		if(used[i]){
			q=p+(m-t[i][0])*t[i][2]+t[i][0]*t[i][1]-c;
			if(t[i][0]*t[i][1]>=q)a=(q-1)/t[i][1]+1;
			else a=t[i][0]+(q-t[i][0]*t[i][1]-1)/t[i][2]+1;
		}else{
			if(t[i][0]*t[i][1]>=p)a=(p-1)/t[i][1]+1;
			else a=t[i][0]+(p-t[i][0]*t[i][1]-1)/t[i][2]+1;
		}
		if(b>a)b=a;
	}
	s+=b;
	cout<<s<<endl;
}
	


Measured memory_bytes: 4336
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define all(x) x.begin(),x.end()
#define pll  pair <long long,long long>
#define ss second
#define ff first
#define inf 9223372036854775807
#define maa 1000000007
#define ld long double
#define fast  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define bug(x) cout << #x <<": " << x << '\n';
const ll N=10001 ;
ll  power(ll  i,ll  j)
{
    if(j==0)
    return 1 ;
    ll t=power(i,j/2)%maa ;
    if(j%2==0)
    return (t%maa*t%maa)%maa ;
    else
    return ((t%maa*t%maa)%maa*(i%maa)%maa)%maa ;
}
int main()
{
   fast ;
   ll tests=1 ;
  // cin>>tests ;
   for(ll testcase=1;testcase<=tests;testcase++)
   {
      ///cout<<"Case #"<<testcase<<": " ;
      ///Read,Think ans Test Properly,then code
      ///Try to avoid using print statements debug on your own

      ll ar[32]={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} ;
      ll k ;
      cin>>k ;
      cout<<ar[k-1] ;



   }
}
/// ans ->for answer
/// cur ->for local answer
/// level ->for depth in tree
/// v -> adjacency matrix
/// r -> array
/// s ->string



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<ll>;
using vii = vector<vi>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1000000007;
template<class T> void print(const T& t){ cout << t << endl; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
  vi a(3);
  ll k;
  cin >> a[0]>> a[1] >> a[2] >> k;
  sort(all(a));
  rep(i,k){
    a[2] *= 2;
  }
  ll ans = a[0] + a[1] + a[2];
  print(ans);
}


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

typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=100003,INF=10000000;

vector<int> S[MAX],d0(MAX),d1(MAX),d2(MAX);
int N;

void dijkstra(int s,int t){
    priority_queue<pair<int,int>> PQ;
    for(int i=0;i<N;i++){
        d0[i]=INF;
        d1[i]=INF;
        d2[i]=INF;
    }
    d0[s]=0;
    PQ.push(make_pair(s,0));
    
    while(!PQ.empty()){
        int a=PQ.top().first;
        int b=PQ.top().second;
        PQ.pop();
        if(-b%3==0){
            if(d0[a]<-b) continue;
            for(int i=0;i<S[a].size();i++){
                int c=S[a][i];
                if(d1[c]>-b+1){
                    d1[c]=-b+1;
                    PQ.push(make_pair(c,-d1[c]));
                }
            }
        }
        if(-b%3==1){
            if(d1[a]<-b) continue;
            for(int i=0;i<S[a].size();i++){
                int c=S[a][i];
                if(d2[c]>-b+1){
                    d2[c]=-b+1;
                    PQ.push(make_pair(c,-d2[c]));
                }
            }
        }
        if(-b%3==2){
            if(d2[a]<-b) continue;
            for(int i=0;i<S[a].size();i++){
                int c=S[a][i];
                if(d0[c]>-b+1){
                    d0[c]=-b+1;
                    PQ.push(make_pair(c,-d0[c]));
                }
            }
        }
    }
}


int main(){
    
    int M;cin>>N>>M;
    for(int i=0;i<M;i++){
        int a,b;cin>>a>>b;
        a--;b--;
        S[a].push_back(b);
    }
    int s,t;cin>>s>>t;
    s--;t--;
    
    dijkstra(s,t);
    
    if(d0[t]==INF) cout<<-1<<endl;
    else cout<<d0[t]/3<<endl;
}


Measured memory_bytes: 7168
#include<bits/stdc++.h>
using namespace std;
int a[5];
int k;
int main(){
    for(int i = 0; i < 5; i++)
    {
        cin >> a[i];
    }
    cin >> k;
    if(a[4]-a[0]>k)
    cout << ":(" << endl;
    else
    cout << "Yay!" << endl;
}

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

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

    int h[100005];
    for (int i = 0; i < N; i++) {
        cin >> h[i];
    }
    int dp[100005]; // dp[i] : h_iにたどり着くのに必要な最低コスト
    dp[0] = 0;
    dp[1] = abs(h[0] - h[1]);
    for (int i = 2; i < N; i++) {
        dp[i] = min(dp[i - 2] + abs(h[i - 2] - h[i]),
                    dp[i - 1] + abs(h[i - 1] - h[i]));
    }
    cout << dp[N - 1];
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
//# define M_PI           3.14159265358979323846
int main()
{
	int r;
	cin >> r;
	float ans = M_PI * 2.0 * r;
	printf("%.2f", ans);
	
	return 0;
}


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

#define MOD 1000000007

using namespace std;

string replace_with_str(string str, string str_from, string str_to) {
    string::size_type pos = 0;
    while (pos = str.find(str_from, pos), pos != string::npos) {
        str.replace(pos, str_from.length(), str_to);
        pos += str_to.length();
    }
    return str;
}

int main(int argc, char const *argv[]){
    string w;
    cin >> w;
    int pos = 0;
    map<char, int> mp;
    while(pos != w.size()){
        if(mp[w[pos]] == NULL){
            mp[w[pos]] = 1;
            pos++;
            continue;
        }
        mp[w[pos]]++;
        pos++;
    }
    for(pair<char, int> p:mp){
        if(p.second%2 != 0){
            printf("No\n");
            return 0;
        }
    }
    printf("Yes\n");
    return 0;
}

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;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;

int main() {
  ll n;
  cin >> n;
  if(n==0) {
    cout << 0 << endl;
    return 0;
  }
  string ans = "";
  while(n!=0) {
    if(n%2!=0) {
      n--;
      ans = "1" + ans;
    }
    else ans = "0" + ans;
    n /= -2;
  }
  cout << ans << endl;
  return 0;
}

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

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	const long long inf = 1e17 + 1e8;
	int n; cin >> n;
	vector<int> a(n + 1);
	for (int i = 0; i <= n; i++) cin >> a[i];
	long long ans = 0;
	if (n == 0) {
		if (a[0] == 1) ans = 1;
		else ans = -1;
	} else {
		if (a[0] == 0) {
			vector<long long> mx(n + 1, 0);
			mx[0] = 1;
			for (int i = 1; i <= n; i++) {
				mx[i] = mx[i - 1] * 2 - a[i];
				if (mx[i] >= inf) mx[i] = inf;
				if (mx[i] < 0) {
					ans = -1;
				}
				if (i < n && mx[i] == 0) ans = -1;
			}
			if (ans >= 0) {
				long long ver = 0;
				for (int i = n; i > 0; i--) {
					ver += a[i];
					ans += ver;
					if (mx[i - 1] * 2 < ver) {
						ans = -1;
						break;
					}
					ver = min(ver, mx[i - 1]);
				}
				if (ans >= 0) ans++;
			}
		} else {
			ans = -1;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 4520
import java.util.Scanner;

public class Main{

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

        // input
        int num = scan.nextInt();
        int a = scan.nextInt();
        int b = scan.nextInt();

        // answer
        System.out.println(Math.min(a * num, b));

    }
}

Measured memory_bytes: 23636
# -*- coding: utf-8 -*-
if True:
    s = input()


else:
    s="attaiatta"


def isKaibun(data):
    zen = data[0:int(len(data)/2)]
    go=""
    if len(data)%2 == 1:
        range_from = int(len(data)/2)+1
    else:
        range_from = int(len(data)/2)

    for i in range(range_from,len(data)):
        go = data[i:i+1] + go
    # print(zen)
    # print(go)
    return (zen == go)

n=len(s)
# print(n)
isKaibun(s)
before = s[0:int((n-1)/2)]
after = s[int((n+3)/2)-1:n]
# print(before)
# print(after)
if isKaibun(s) and isKaibun(before) and isKaibun(after):
    print("Yes")
else:
    print("No")

# isKaibun("atta")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
//エラトステネスの篩
bool is_prime[ 100000 + 3 ];
vector<int> P;
void Eratosthenes( const int N )
{
    for( int i = 0; i <= N; i++ )
    {
        is_prime[ i ] = true;//初期化
    }    
    for( int i = 2; i <= N; i++ )
    {
        if( is_prime[ i ] )
        {
            for( int j = 2 * i; j <= N; j += i )
            {
                is_prime[ j ] = false;
            }
            P.emplace_back( i );
        }
    }
}
int main(void){
    int N=100003,x;
    cin >> x;
    Eratosthenes( N );
    for( const auto &y: P ){
        if(y>=x){
            cout << y <<endl;
            return 0;
        }
    }
}


Measured memory_bytes: 512
using System;
using System.Linq;
using System.IO;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
 
class Program
{
    static bool[,] adja;
    static int[] discoveryTime;
    static int[] finishTime;
    static int time = 0;
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        adja = new bool[n, n];
        discoveryTime = new int[n];
        finishTime = new int[n];
        for (int i = 0; i < n; i++)
        {
            int[] inputs = Console.ReadLine().Split(' ')
                                        .Select(val => int.Parse(val))
                                        .ToArray();
            for (int j = 0; j < inputs[1]; j++)
            {
                adja[inputs[0] - 1, inputs[2 + j] - 1] = true;
            }
        }
        for (int i = 0; i < n; i++)
        {
            if(discoveryTime[i] == 0) DepthFirstSearch(i);
        }
        for (int i = 0; i < n; i++)
        {
            Console.WriteLine("{0} {1} {2}", i + 1, discoveryTime[i], finishTime[i]);
        }
    }

    static void DepthFirstSearch(int nodeNum)
    {
        discoveryTime[nodeNum] = ++time;
        for (int i = 0; i < adja.GetLength(1); i++)
        {
            if(adja[nodeNum, i] && discoveryTime[i] == 0)
            {
                DepthFirstSearch(i);
            } 
        }
        finishTime[nodeNum] = ++time;
    }
}

Measured memory_bytes: 9672