akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define _LIBCPP_DEBUG 0
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;

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


    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define mod 1000'000'007

int memo[110][6][6][6][6]={};
int n;


int dp(int i,int a,int b, int c,int d){


if(a==1 && b==2 && c==3){
    return 0;
}

if(b==1 && c==2 && d==3){
    return 0;
}

if(a==2 && b==1 && c==3){
    return 0;
}

if(b==2 && c==1 && d==3){
    return 0;
}

if(a==1 && b==3 && c==2){
    return 0;
}

if(b==1 && c==3 && d==2){
    return 0;
}

if(a==1 && c==2 && d==3){
    return 0;
}


if(a==1 && b==2 && d==3){
    return 0;
}

if(i==n){
    return 1;
}

if(memo[i][a][b][c][d]!=-1){
    return memo[i][a][b][c][d];
}

int ta,tb,tc,td;
ta=a;
tb=b;
tc=c;
td=d;

a=b;
b=c;
c=d;
int ans=0;

for(int j=0;j<4;j++){
    d=j;
    ans+=dp(i+1,a,b,c,d);
    ans%=mod;
}

return memo[i][ta][tb][tc][td]=ans;
}

signed main(){

cin>>n;
memset(memo,-1,sizeof(memo));

cout<<dp(0,5,5,5,5)<<endl;

    

 return 0;
}

Measured memory_bytes: 1408
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		long[] a = new long[n];
		for(int i = 0; i < n; i++) {
			a[i] = stdIn.nextLong();
		}
		
		long[]s = new long[n+1];
		for(int i = 0; i < n; i++) {
			s[i+1] = s[i] + a[i];
		}
		Map<Long,Long> map = new HashMap<>();
		
		for(int i = 0; i < n+1; i++) {
			if(!map.containsKey(s[i])) {
				map.put(s[i], (long)0);
			}
			map.put(s[i], map.get(s[i])+1);
		}
		long cnt = 0;
		
		/*for(int i = 0; i < map.size(); i++) {
			if(map.get(s[i]) < 2) {
				continue;
			}else {
				cnt += map.get(s[i])*(map.get(s[i])-1)/2;
			}
		}*/
		
		for(long ss: map.keySet()) {
			if(map.get(ss) < 1) {
				continue;
			}else {
              	long x=map.get(ss);
				cnt += x*(x-1)/2;
			}
		}
		
		System.out.println(cnt);
		
	}

}

Measured memory_bytes: 101384
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <limits.h>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string>
#include <vector>
#include <cstdio>
#include <iomanip>
#define ll long long
#define rep2(i,a,b) for(int i=a;i<=b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define rep3(i,a,b) for(int i=a;i>=b;i--)
#define REP(e,v) for(auto e:v)
#define queint queue<int>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue<int>//大きい順
#define pqg priority_queue<int,vec,greater<int>>//小さい順
#define pb push_back
#define vec vector<int>
#define vecvec vector<vector<int>>
#define vecll vector<ll>
#define vecvecll vector<vector<ll>>
#define bs binary_search
#define All(c) (c).begin(),(c).end()
#define mp make_pair
using namespace std;
int in(){int x;scanf("%d",&x);return x;}
string stin(){string s;cin>>s;return s;}
ll lin(){ll x;scanf("%lld",&x);return x;}
int n,a,b,c,d;
vec x;
int cnt_rock=0,cnt_emp=0,max_rock=0,max_emp=0;
bool f(){
    if(max_rock>1)return false;
    if(c<d){
        return true;
    }else{
      return max_emp>=3;
    }
}
int main(){
    n=in();
    a=in();
    b=in();
    c=in();
    d=in();
    string s=stin();
    x.resize(n+1);
    rep(i,n){
        if(s[i+1]=='#'){
            x[i+1]=1;
        }
        else{
            x[i+1]=0;
        }
    }
    rep2(i,a+1,c-1){
        if(x[i]==1){
            cnt_rock++;
        }
        else{
            cnt_rock=0;
        }
        max_rock=max(max_rock,cnt_rock);
    }
    cnt_rock=0;
    rep2(i,b-2,d){
        if(x[i]==1){
            cnt_rock++;
        }
        else{
            cnt_rock=0;
        }
        max_rock=max(max_rock,cnt_rock);
    }
    rep2(i,b-2,d){
        if(x[i]==1){
            cnt_emp=0;
        }
        else{
            cnt_emp++;
        }
        max_emp=max(max_emp,cnt_emp);
    }
    string ans=f()?"Yes":"No";
    cout<<ans<<endl;
}

Measured memory_bytes: 1412
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m,a;
  cin>>n>>m;
  int b[10]={0,2,5,5,4,5,6,3,7,6};
  string c[10]={"0","1","2","3","4","5","6","7","8","9"};
  vector<bool> f(10,false),ff(10010,false);
  for(int i=0;i<m;i++){
    cin>>a;
    f[a]=true;
  }
  vector<string> dp(10010,"");
  ff[0]=true;
  for(int i=2;i<=n;i++){
    for(int j=1;j<10;j++){
      if(f[j]){
        if(i>=b[j]){
          if(ff[i-b[j]]){
            ff[i]=true;
            string s=dp[i-b[j]]+c[j];
            if(s.size()>=dp[i].size()){
              sort(s.begin(),s.end(),greater<char>());
              if(s.size()==dp[i].size()){
                dp[i]=max(dp[i],s);
              }else{
                dp[i]=s;
              }
            }
          }
        }
      }
    }
  }
  cout<<dp[n];
}

Measured memory_bytes: 25344
#include <map>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
#define rep(i,x,y) for (int i=(x);i<=(y);i++)
#define drp(i,x,y) for (int i=(x);i>=(y);i--)
void judge(){
	freopen("data.in","r",stdin);
	freopen("data.out","w",stdout);
}
const int maxn=110;
int n,m,ans;
string s[maxn];
map<string,int> sum;
int main(){
//	judge();
	scanf("%d",&n);
	rep(i,1,n){
		cin>>s[i];
		sum[s[i]]++;
	}
	scanf("%d",&m);
	rep(i,1,m){
		string t; cin>>t;
		sum[t]--;
	}
	rep(i,1,n) ans=max(ans,sum[s[i]]);
	printf("%d\n",ans);
	return 0;
}

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

int main(){
  int N;
  cin >> N;
  int t[N+1],x[N+1],y[N+1];
  t[0] = 0,x[0] = 0,y[0] = 0;
  for(int i = 1; i <= N; i++){
    cin >> t[i] >> x[i] >> y[i];
  }

  bool flag = true;
  for(int i = 0; i < N; i++){
    if(((t[i+1] - t[i] - (x[i+1] - x[i] + y[i+1] - y[i]))%2!=0)||(t[i+1] - t[i])<(x[i+1] - x[i] + y[i+1] - y[i])){
      flag = false;
      break;
    }
  }

  if(flag) printf("Yes\n");
  else printf("No\n");
  return 0;
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
using namespace std;
typedef long long ll;

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

    ll n, count=0; cin >> n;
    string tmp, s[n]; for (ll i=0; i<n; i++) cin >> s[i];
    
    sort(s, s + SIZE_OF_ARRAY(s));

    tmp = s[0];
    for (ll i=1; i<n; i++) {
        if (s[i]!=tmp) {
            count += 1;
            tmp = s[i];
        }
    }

    cout << count + 1 << "\n";


    return 0;
}

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

signed main(void)
{
	int h, w;
	cin >> h >> w;
	string s[h];
	int l[h][w], r[h][w], d[h][w], u[h][w];
	int L[h][w];
	rep(i, h) cin >> s[i];
	rep(i, h) rep(j, w + 1) l[i][j] = r[i][j] = 0;
	rep(i, h + 1) rep(j, w)	d[i][j] = u[i][j] = 0;
	rep(i, h) rep(j, w)
	{
		if (j == 0 && s[i][j] == '.')
			l[i][j] = 1;
		else if (s[i][j] == '.')
			l[i][j] += l[i][j - 1] + 1;
	}
	rep(i, h) for(int j = w - 1; j >= 0; j--)
	{
		if (j == w - 1 && s[i][j] == '.')
			r[i][j] = 1;
		else if (s[i][j] == '.')
			r[i][j] += r[i][j + 1] + 1;
	}
	rep(j, w) rep(i, h) 
	{
		if (i == 0 && s[i][j] == '.')
			d[i][j] = 1;
		else if (s[i][j] == '.')
			d[i][j] += d[i - 1][j] + 1;
	}
	rep(j, w) for(int i = h - 1; i >= 0; i--)
	{
		if (i == h - 1 && s[i][j] == '.')
			u[i][j] = 1;
		else if (s[i][j] == '.')
			u[i][j] += u[i + 1][j] + 1;
	}
	int ans = 0;
	rep(i, h) rep(j, w)
	{
		L[i][j] = l[i][j] + r[i][j] + d[i][j] + u[i][j] - 3;
		ans = max(ans, L[i][j]);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 82432
#include <iostream>
#include<stdio.h>
#include<ctype.h>
#include<string.h>
#include <algorithm>
#include <cstring>
#include<queue>
#include <stack>
#include<map>
#include<vector>
using namespace std;

int main(){
    int n,k;
    long long s;
    long long t;
    cin>>n>>k>>s;
    if(s==1000000000){
        t=s-1;
    }else{
        t=s+1;
    }
    for(int i=1;i<=k;i++){
        cout<<s<<" ";
    }
    for(int i=k+1;i<=n;i++){
        cout<<t<<" ";
    }
    return 0;
}


Measured memory_bytes: 1280
#include <iostream>
#include <vector>

using namespace std;
typedef long long ll;

constexpr int sizeMax = 7368791 + 1;

int solve();

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

int solve() {
	
	int m, n;
	cin >> m >> n;

	if (!(m | n)) { return 0; }

	//	??¨????????????????????????
	//	m??\????????°????????\?????????????????????n????????¶???
	//	p[i]???p[0],p[1], ...,p[i-1]??????????????§?????????????????????????°??????°???
	//	m??\????????°????????????p[0], p[1], ..., p[n-1]??????????????§?????????????????????????°??????°???????????§?????????

	std::vector< bool > b(sizeMax, true);
	int cnt = 0;

	for (int i = m; i < sizeMax; i++) {

		if( b[i] == true ) {

			if (cnt == n) {
				cout << i << endl;
				break;
			}
			else {

				cnt++;

				for (int j = 2; j * i < sizeMax; j++)
					b[i*j] = false;

			}

		}

	}




	return 1;


}

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

string s;

int main() {
    cin.sync_with_stdio(0); cin.tie(0);
    cin >> s;
    int lc = 0, rc = 0;
    for (auto& i : s) {
        if (i == 'S') lc++;
        else {
            if (lc) lc--;
            else rc++;
        }
    }
    cout << lc + rc;
}



Measured memory_bytes: 720
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(i, a, b) for(int i = (a); i<(b); ++i)
#define rep(i, n) for (int i=0; i<(n); ++i)
#define out(x) cout << x << endl

int main(){
    ll N, A, B;
    cin >> N >> A >> B;
    out((N/(A+B))*A + min(N%(A+B), A));
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define sz              size()
#define pb              push_back
#define Fr              first
#define Sc              second
#define Log2(x)         (31^__builtin_clz(x))
#define endl            "\n"
#define int             ll
using namespace std;
typedef long long ll;
int n, k, c;
string s;
int dpL[200200];
int dpR[200200];
int recL(int i) {
    if(i >= s.sz) return 0;
    if(dpL[i] != -1) return dpL[i];
    int p = 0, l = 0;
    if(s[i] == 'x') p += recL(i + 1);
    else {
        p += recL(i + c + 1) + 1;
        l += recL(i + 1);
    }
    return dpL[i] = max(p, l);
}
int recR(int i) {
    if(i < 0) return 0;
    if(dpR[i] != -1) return dpR[i];
    int p = 0, l = 0;
    if(s[i] == 'x') p += recR(i - 1);
    else {
        p += recR(i - c - 1) + 1;
        l += recR(i - 1);
    }
    return dpR[i] = max(p, l);
}
int32_t main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    cin >> n >> k >> c;
    cin >> s;
    memset(dpL, -1, sizeof dpL);
    memset(dpR, -1, sizeof dpR);
    recL(0);
    recR(s.sz - 1);
    if(dpL[1] < k && s.sz>1) cout << 1 << endl;
    for(int i = 1 ; i < s.sz - 1 ; i++) {
        if(s[i] == 'o' && dpL[i + 1] + dpR[i - 1] < k)
            cout << i + 1 << endl;
    }
    if(dpR[s.sz - 2] < k) cout << s.sz << endl;
}


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

using namespace std;

const int maxn=1e5+10; 

#define pt pair<double,double> 
#define x first 
#define y second 

double cross2( pt o , pt a , pt b ){
	return ( a.x - o.x )*( b.y - o.y ) - ( a.y - o.y )*( b.x - o.x );
} 
pt p[ maxn ];
int n; 
vector<pt> hull; 
void convexhull(){ 
	hull.push_back( p[ 0 ] ); 
	for( int i = 1 ; i < n ; i++ ){ 
		while( hull.size() > 1 && cross2( hull[ hull.size()-2 ] , hull.back() , p[ i ] ) > 0){
			hull.pop_back(); 
		}
		hull.push_back( p[ i ] );
	}
	int hs = hull.size(); 
	for( int i = n-2 ; i >= 0 ; i-- ){ 
		while( hull.size() > hs && cross2( hull[ hull.size()-2 ] , hull.back() , p[ i ] ) > 0){
			hull.pop_back();
		}
		hull.push_back( p[ i ] );
	}
} 
int main(){
	//printf("Double value is %lf \n", dbl);
	//printf("Integer value is %d\n" , no);
	//printf("%lf can be written %le\n", dip, dip);
	//ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	//cin >> n;
	scanf( "%d" , &n );
	for( int i = 0 ; i < n ; i++ ){
		//cin >> p[ i ].x >> p[ i ].y;
		scanf( "%lf %lf" ,  &p[ i ].x , &p[ i ].y );
	}
	sort( p , p+n ); 
	convexhull(); 
	//the first point is repeated at last! 
	hull.pop_back(); 
	cout << hull.size() << endl; 
	int my = 1e6 , mx = 1e6 , ind; 
	for( int i = 0 ; i < hull.size() ; i++ ){
		if( hull[i].y < my ){
			my = hull[i].y , mx = hull[ i ].x , ind = i;
		}
		else if( hull[ i ].y == my && mx > hull[ i ].x ){
			mx = hull[ i ].x , ind = i;
		}
	}
	for( int i = ind , cnt = hull.size() ; cnt ; cnt-- , i = ( i-1 + hull.size() ) % hull.size() ){
		cout << hull[ i ].x << " " << hull[ i ].y << endl;
	}
}


Measured memory_bytes: 6156
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<queue>
#include<vector>
#include<string>
#include<set>
#include<map>
using namespace std;
const int N = 100010;
int dp[N][4];
int a[N][4];
int main(){
	int n;
	cin >> n;
	for(int i = 1; i <= n;i++)	cin >> a[i][1] >> a[i][2] >> a[i][3];
	
	dp[1][1] = a[1][1];
	dp[1][2] = a[1][2];
	dp[1][3] = a[1][3];
	
	for(int i = 2; i <= n;i++){
		dp[i][1] = max(dp[i - 1][2], dp[i - 1][3]) + a[i][1];
		dp[i][2] = max(dp[i - 1][1], dp[i - 1][3]) + a[i][2];
		dp[i][3] = max(dp[i - 1][1], dp[i - 1][2]) + a[i][3];
	}
	
	cout << max(dp[n][1], max(dp[n][2], dp[n][3])) << endl;
	return 0;
 }

	



Measured memory_bytes: 3328
#include <iostream>

using namespace std;

int main(int argc, char const* argv[])
{
    int N, h_max = -1, ans = 0;
    cin >> N;
    for (int i = 0; i < N; ++i) {
        int h;
        cin >> h;
        if (h_max <= h) {
            ++ans;
            h_max = h;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
N = int(input())
S = str(input())

w = S.count('.')
b = S.count('#')
cnt = N+1
tmp = w
for i in range(N):
  if S[i] == '.':
    tmp -= 1
  else:
    tmp += 1
  cnt = min(cnt, tmp)
    
ans = min(w, b, cnt)
print(ans)

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

int main() {
  int n;
  cin >> n;
  vector<int> num(n-1,0);
  for (int i = 0; i < n-1; i++) {
    cin >> num.at(i);
  }

  vector<int>count(n);
  for (int i = 0; i < n-1; i++) {
    count.at(num.at(i)-1)++;
  }
  for (int i = 0; i < n; i++) {
    cout << count.at(i) << endl;
  }
}

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

int main() {
	int n, q;
	string s;
	cin >> n >> q >> s;
	vector<int> a(n);
	for (int i = 1; i < n; i++) {
		a[i] = a[i - 1] + (s[i - 1] == 'A' && s[i] == 'C' ? 1 : 0);
	}

	for (int i = 0, l, r; i < q; i++) {
		cin >> l >> r;
		l--, r--;
		cout << a[r] - a[l] << endl;
	}
}



Measured memory_bytes: 1408
#include"bits/stdc++.h"
using namespace std;
#define REP(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define rep(i,n) REP((i),0,(n))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using tp3 = tuple<int, int, int>;
using Mat = vector<vector<ll>>;
constexpr int INF = 1 << 28;
constexpr ll INFL = 1ll << 60;
constexpr int dh[4] = { 0,1,0,-1 };
constexpr int dw[4] = { -1,0,1,0 };
bool isin(const int H, const int W, const int h, const int w) {
    return 0 <= h && h < H && 0 <= w && w < W;
}
// ============ template finished ============


vector<int> make_acc(const string& s, const char c) {
    const int N = s.size();
    vector<int> acc(N, 0);
    rep(i, N) {
        acc[i] = (i == 0 ? 0 : acc[i - 1]) + (s[i] == c ? 1 : 0);
    }
    return acc;
}

int count(const vector<int>& accr, const vector<int>& accw, const int redcnt) {
    const int N = accr.size();
    int wout = redcnt == 0 ? 0 : accw[redcnt - 1];
    int rout = redcnt == 0 ? accr.back() : accr.back() - accr[redcnt - 1];
    return max(wout, rout);
}

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

    auto accR = make_acc(s, 'R');
    auto accW = make_acc(s, 'W');

    int res = INF;
    rep(i, N + 1) {
        res = min(res, count(accR, accW, i));
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 5236
#include<iostream>
#include<vector>
#include<algorithm>
#include<utility>
#include<iterator>

using namespace std;
bool sortit(pair<long int,long int>a, pair<long int,long int>b){
	return (a.first < b.first);
}
int main(){
	int n,m;
	cin >> n >> m;
  	// insertion into two arrays
  	long int arr1[n], arr2[n];
  vector<pair<long int,int>> vec;
  	for (int i = 0 ; i < n; i++)
    {
      cin >> arr1[i] >> arr2[i];
      vec.push_back(make_pair(arr1[i],arr2[i]));
    }
  	// sorting vector on basis of first element
  	sort(vec.begin(), vec.end(), sortit);
  // main code
  long long int res =0;
  int i = 0;
  while (m != 0){
  	if(vec[i].second < m) {
    	res += (vec[i].first)*(vec[i].second);
      m = m - vec[i].second;
    }
    else {
    	res += (vec[i].first)*m;
      	m = 0;
    }
    ++i;
  }
  cout << res<<'\n';
  return 0;
}

Measured memory_bytes: 3444
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<math.h>
#include<stdio.h>

using namespace std;

int main(void)
{
	int n, t, a;
	double num = 100000000000000;
	int flag = 0;
	cin >> n >> t >> a;
	vector<double> h(n);
	vector<double> ans(n);
	int i;
	for (i = 0; i < n; i++)
	{
		cin >> h[i];
	}
	for (i = 0; i < n; i++)
	{
		ans[i] = t - h[i] * 0.006;
	}

	for (i = 0; i < n; i++)
	{
		ans[i] = fabs(a - ans[i]);
	}
	for (i = 0; i < n; i++)
	{
		if (num > ans[i])
		{
			flag = i;
			num = ans[i];
		}
	}
	cout << flag+ 1 << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> p;
int jyo(int x,int y){//xのｙ乗
	int ans=1;
	for(int i=0;i<y;i++){
		ans*=x;
	}
	return ans;
}
int main() {
	int x;
	cin>>x;
	int v[x];
	for(int i=0;i<x;i++)cin>>v[i];
	for(int i=0;i<x;i++){
		for(int j=i+1;j<x;j++){
			if(v[i]>v[j]){
				swap(v[i],v[j]);
			}
		}
	}
	double ans=v[0];
	for(int i=1;i<x;i++){
		ans=(ans+v[i])/2;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
using System;

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input=Console.ReadLine().Split();
            int N=int.Parse(input[0]);
            int K=int.Parse(input[1]);
            int temp=1;
            int num=0;
            while(temp<=N){
                temp*=K;
                num++;
            }
            Console.WriteLine(num);
        }
    }
}


Measured memory_bytes: 13140
#include <stdio.h>
#include <stdint.h>

int main (void)
{
    int N1, N2, N3, N4;
    uint16_t flag = 0;

    scanf("%d %d %d %d", &N1, &N2, &N3, &N4);

    flag = (1 << N1) | (1 << N2) | (1 << N3) | (1 << N4);

    if (flag == ((1 << 1) | (1 << 9) | (1 << 7) | (1 << 4))) {
        puts("YES");
    } else {
        puts("NO");
    }
}


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

int main(){
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	int t1=c/b,t2=a/d;
	if(c%b)t1++;
	if(a%d)t2++;
	if(t1<=t2)cout<<"Yes";
	else cout<<"No";
	return 0;
}

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

namespace _2019apc_b
{
    class Program
    {
        static void Main(string[] args)
        {
            string n = Console.ReadLine();
            string[] ab = Console.ReadLine().Split(' ');
            string[] p = Console.ReadLine().Split(' ');

            int N = int.Parse(n);
            int A = int.Parse(ab[0]);
            int B = int.Parse(ab[1]);

            int[] P = new int[N];

            for(int i = 0; i < N; i++)
            {
                P[i] = int.Parse(p[i]);
            }

            int m1 = 0;
            int m2 = 0;
            int m3 =0;


            for(int i = 0; i < N; i++)
            {
                if(P[i] <= A)
                {
                    m1++;
                }else if(P[i] >= (B + 1))
                {
                    m3++;
                }
                else
                {
                    m2++;
                }
            }

            int ans;

            if (m1 > m2)
            {
                if(m2 > m3)
                {
                    ans = m3;
                }
                else
                {
                    ans = m2;
                }
            }
            else
            {
                if(m1 > m3)
                {
                    ans = m3;
                }
                else
                {
                    ans = m1;
                }
            }

            Console.WriteLine(ans);
            Console.ReadLine();
        }
    }
}


Measured memory_bytes: 11092
using System;
using System.Linq;

namespace PrintTestCases
{
    class Class1
    {
        public static void Main()
        {
            string[] s = Console.ReadLine().Trim().Split(' ');
            int[] i = s.Select(str => int.Parse(str)).ToArray();
            int j = 0;
            for(int n = i[0]; n < i[1]+1; n++)
            {
                if (i[2]%n == 0)
                {
                    j++;
                }
            }
            Console.WriteLine("{0}", j);
        }
    }
}



Measured memory_bytes: 20264
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include <stdio.h>
#include<iostream>
#include<iomanip>
#include<cmath>
#include<array>
#include<vector>
#include<set>
#include <utility>
#include <map>
#include<queue>
using namespace std;
const long long INF = 1LL<<60;


int main(){
  int n; cin>>n;
  int a[110000][3];
  for(int i=0;i<n;i++){
    for(int j=0;j<3;j++){
      cin>>a[i][j];
    }
  }
  int dp[110000][3]={0};

  for(int i=1;i<n+1;i++){
    for(int j=0;j<3;j++){
      for(int k=0;k<3;k++){
        if(j!=k)
        dp[i][k]=max(dp[i][k],dp[i-1][j]+a[i-1][k]);
    }
  }}
  cout<<max(dp[n][0],max(dp[n][1],dp[n][2]))<<endl;
}


Measured memory_bytes: 2816
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = int(A); I < int(B); ++I)
#define FORR(I,A,B) for(ll I = int((B)-1); I >= int(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=1e18+7;
const ll MOD=1e9+7;


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

	ll N;
	cin >> N;
	vector<ll> a(N-1),b(N-1),c(N),ans(N,0);
	vector<P> zisu(N);
	vector<ll> v[N];
	FOR(i,0,N){
		zisu[i] = {0,i};
	}
	FOR(i,0,N-1){
		cin >> a[i] >> b[i];
		a[i]--;b[i]--;
		zisu[a[i]].first++;
		zisu[b[i]].first++;
		v[a[i]].push_back(b[i]);
		v[b[i]].push_back(a[i]);
	}
	FOR(i,0,N){
		cin >> c[i];
	}

	SORT(zisu);
	SORT(c);
	REV(zisu);
	REV(c);
	queue<ll> q;
	int ci = 0;
	q.push(zisu[0].second);
	while(q.size()){
		ll now = q.front();
		q.pop();
		ans[now] = c[ci];
		ci++;
		for(auto to:v[now]){
			if(ans[to]==0){
				q.push(to);
			}
		}
	}
	ll ansm = 0;
	FOR(i,0,N-1){
		ansm += min(ans[a[i]],ans[b[i]]);
	}
	cout << ansm << endl;
	cout << ans[0];
	FOR(i,1,N){
		cout << " " << ans[i];
	}
	cout << endl;
}


Measured memory_bytes: 1536
#include<iostream>
#include<vector>

using namespace std;
int main(void) {
	int n;
	cin >> n;
	vector<int> R(n);
	for (int i = 0; i < n; i++) {
		cin >> R[i];
	}

	int max = R[1] - R[0];
	int min = R[0];
	for (int j = 2; j < n; j++) {
		min = R[j - 1] < min ? R[j - 1] : min;
		max = max < R[j] - min ? R[j] - min : max;
	}
	cout << max << "\n";

	return 0;
}



Measured memory_bytes: 3632
#include <iostream>
#include <map>
#include <vector>
using namespace std;
typedef long long ll;
const int MAX = 2e5 + 10;
int n;
ll mod(ll x){
	x %= n;
	if(x < 0) x += n;
	return x;
}
 
int main()
{	
	ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int m; cin>>m; cin>>n; ll cnt = 0; ll cs = 0;
	map<ll,int> mp; mp[0]=1;
	for(int i=0;i<m;i++){
		ll d; cin>>d;
		cs = mod(cs + d);
		ll r = cs%n;
 
		if(mp[r]) cnt += mp[r];
		mp[cs]++;
	}
 
	cout<<cnt;
}

Measured memory_bytes: 4224
import sys
import math
 
sys.setrecursionlimit(10 ** 8)
input = sys.stdin.readline
 
def main():
    s = list(map(int,input().split()))
    if sum(s) == 17:
      print("YES")
    else:
      print("NO")
 
if __name__ == '__main__':
    main()

Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
int main()
{
	vector<int>a;
	int b;
	for(int i=0;i<3;i++)
	{
		cin>>b;
		a.push_back(b);
	}
	sort(a.begin(),a.end());
	int c=0;
	for(int i=1;i<3;i++)
	{
		c+=(a[i]-a[i-1]);
	} 
	cout<<c;
	return 0;
	
} 

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>

using namespace std;

bool is_prime(const unsigned n);


int main(){
	int n=2;
	int p=0;
	int c;
	int data[10000];
	int ans=0;

	while(p < 10000){
		if(is_prime(n)){
			data[p++] = n;
		}
		n++;
	}


	scanf("%d",&c);
	while(c != 0){
		p= ans = 0;
		for(int i=0;i<c;i++){
			ans += data[i];
		}
		printf("%d\n",ans);

		scanf("%d",&c);
	}


	return 0;
}

bool is_prime(const unsigned n){
    switch(n){
        case 0: 
        case 1: return false;
        case 2: 
        case 3: return true;
    } 

    if(n%2 == 0) return false;
    if(n%3 == 0) return false;

    if(n%6 != 1 && n%6 != 5) return false;

    for(unsigned i=5;i*i<=n;i+=6){
        if(n%i     == 0) return false;
        if(n%(i+2) == 0) return false;
    }

    return true;}

Measured memory_bytes: 3116
#include<stdio.h>

int main()
{
  char a;
  scanf("%c", &a);

  if ('a' <= a && 'z' >= a) {
    puts("a");
  } else {
    // 制約より英小文字以外は英大文字とする
    puts("A");
  }

  return 0;
}


Measured memory_bytes: 1556
N, M = map(int, raw_input().split())
graph = []
for i in range(0, N):
	lst = []
	for j in range(0, N):
		lst.append(False)
	graph.append(lst)
for i in range(0, M):
	a, b = map(int, raw_input().split())
	graph[a-1][b-1] = True
	graph[b-1][a-1] = True
memo = []
for i in range(0, N):
	memo.append(True)
queue = [[0, memo]]
cnt = 0
while queue != []:
	now = queue.pop(0)
	newmemo = []
	for i in range(0, N):
		if i == now[0]: newmemo.append(False)
		else: newmemo.append(now[1][i])
	if True not in newmemo: cnt += 1
	else:
		for i in range(0, N):
			if graph[now[0]][i] and newmemo[i]:
				queue.append([i, newmemo])
print cnt

Measured memory_bytes: 3844
#include <iostream>
#include <cstring>
#include <cstdio>
#define MN 501

typedef long long ll;

int n;
ll f[MN][MN][MN], a[MN][MN];

int main()
{
	scanf("%d", &n);
	for(int i = 1; i <= n; i++)
	{
		for(int j = 1; j < i; j++) scanf("%lld", &a[i][j]), a[i][j] += a[i][j - 1];
		for(int j = i + 1; j <= n; j++) scanf("%lld", &a[i][j]), a[i][j] += a[i - 1][j]; 
	}
	memset(f, 0x3f, sizeof(f)); f[0][0][0] = 0;
	for(int i = 0; i < n; i++)
		for(int j = 0; j <= i; j++)
			for(int k = 0; k <= j; k++)
			{
				f[i + 1][i][j] = std::min(f[i + 1][i][j], f[i][j][k] + a[i + 1][j]);
				f[i + 1][j][k] = std::min(f[i + 1][j][k], f[i][j][k] + a[i][i + 1] - a[j][i + 1] + a[i + 1][k]); 
			}
	ll ans = 1e18;
	for(int j = 0; j <= n; j++)
		for(int k = 0; k <= j; k++) ans = std::min(ans, f[n][j][k]);
	printf("%lld\n", ans);
}

Measured memory_bytes: 984576
#include <iostream>
//#include <iomanip>
#include <string>
//#include <vector>
//#include <algorithm>
//#include <utility>
//#include <set>
//#include <map>
//#include <queue>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
//using vll = vector<ll> ;
//using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;
//#define all(v) v.begin(),v.end()
//ll mod = 1000000007 ;
//long double pie = acos(-1) ;
//ll INF = 1000000000000 ;

//void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void mysort(vector<long long> &a){sort(a.begin(),a.end()) ;}
//void myrev(vector<long long> &a){reverse(a.begin(),a.end()) ;}
//void fix_cout(){cout << fixed << setprecision(20) ;}

int main(){
	string s ; cin >> s ;
	ll k ; cin >> k ;
	ll n = s.size() ;
	for(int i=0;i<n-1;i++){
		ll c = s.at(i)-'a' ;
		if(c+k>=26){
			s.at(i) = 'a' ;
			k -= (26-c)%26 ;
		}
	}
	s.at(n-1) = 'a'+(s.at(n-1)-'a'+k)%26 ;
	cout << s << endl ;
}


Measured memory_bytes: 512
def resolve():
    N, Y = map(int, input().split())
    if Y % 1000 != 0 or Y > 10000 * N:
        print("-1 -1 -1")
        return
    Y //= 1000
    for x in range(Y // 10 + 1):
        for y in range((Y - x * 10) // 5 + 1):
            if N - x - y == Y - x * 10 - y * 5:
                print(x, y, N - x - y)
                return
    print("-1 -1 -1")


if __name__ == "__main__":
    resolve()

Measured memory_bytes: 38768
#include<bits/stdc++.h>
using namespace std;
int main()
{
  long long  int n,k,i,sum=0;
    cin>>n>>k;
  long long int price[n];
   
    for(i=0;i<n;i++)
    {
        cin>>price[i];
    }
   sort(price,price+n);
    
    for(i=0;i<k;i++)
    {
        sum+=price[i];
    }
    cout<<sum;
     return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
#include <map>
#include <unordered_map>
#include <set>
using namespace std;

typedef long long ll;

#define INF 10e17
#define rep(i,n) for(long long i=0; i<n; i++)
#define repr(i,n,m) for(long long i=m; i<n; i++)
#define END cout << endl
#define MOD 1000000007
#define pb push_back
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<long long>())
#define debug(x) std::cerr << (x) << std::endl;
#define roll(x) for (auto&& itr : x) { debug(itr); }

template <class T> inline void chmax(T &ans, T t) { if (t > ans) ans = t;}
template <class T> inline void chmin(T &ans, T t) { if (t < ans) ans = t;}

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

  int a;
  string s;
  cin >> a;
  cin >> s;
  if (a >= 3200) cout << s << endl;
  else cout << "red" << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int h = 1;
		int w = 1;
		while (h != 0 || w != 0) {
			h = scanner.nextInt();
			w = scanner.nextInt();
			for (int i = 0; i < h; ++i) {
				if(i%2==0) {
				for (int c = 0; c < w; ++c) {
					if (c % 2 == 0) {
						System.out.print("#");
					} else {
						System.out.print(".");
					}
				}}
				else {
					for (int c = 0; c < w; ++c) {
						if (c % 2 == 0) {
							System.out.print(".");
						} else {
							System.out.print("#");
						}
					}
				}
				System.out.println("");
			}
			if (h != 0 || w != 0) {
				System.out.println("");
			}
		}

	}
}


Measured memory_bytes: 34592
#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 rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb(x) push_back(x)
#define all(x) x.begin(), x.end()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = 1e9;
const ll INF = 1e18;
const ld EPS = 1e-10;

int main(){
    int S, W;
    cin >> S >> W;
    if(S > W) cout << "safe" << endl;
    else cout << "unsafe" << endl;
}

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

int main()
{
    string s, t;
    int m, h;
    
    while (cin >> s && s != "-") {
        cin >> m;
        for (int i = 0; i < m; i++) {
            cin >> h;
            t = s.substr(h) + s.substr(0, h);
            s = t;
        }
        cout << s << endl;
    }
}



Measured memory_bytes: 3212
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
typedef long long ll;

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; }

const long long INF = 1LL << 60;

int main(){
  int d, t, s;
  cin >> d >> t >> s;

  cout << (d <= t * s ? "Yes" : "No") << endl;

  return 0;
}


Measured memory_bytes: 3644
import java.util.HashSet;
import java.util.Scanner;

class Main {

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

        var set = new HashSet<String>();
        for(int i = 0; i<s; i++) {
            set.add(sc.next());
        }

        System.out.println(set.size());
    }
}

Measured memory_bytes: 78088
n = int(input().rstrip("\n"))
cells = [0] + [int(x) for x in input().rstrip("\n").split(" ")]
         
dp = [0]
         
for i in range(1,n+1):
  if cells[i-1] >= cells[i]:
    dp.append(dp[-1] + 1)
  else:
    dp.append(0)

print(max(dp))


Measured memory_bytes: 14252
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
const int mod= 1e+9+7;

int main(){
    ll N,K; cin>>N>>K;
    ll ans =0;
    ans+=(N/K)*(N/K)*(N/K);
    if(K%2!=0){
        cout<<ans<<endl;
        return 0;
    }
    ll k=N/(K/2)-N/K;
    ans+=k*k*k;
    cout<<ans<<endl;
    
}




Measured memory_bytes: 256
N = int(input()) # 数字を変数に格納
List = list(map(int,input().split())) # 複数の数字をリストに格納

flag = 0
before = 0

if N == 1:
    flag = 0
    
else: 
    for i in range(N-1):
        if i > 0:
            before = List[i-1]
        
        if List[i] > before:
            List[i] -= 1

        if List[i] > List[i+1]:
            print('No')
            flag = 1
            break

if flag == 0:
    print('Yes')

Measured memory_bytes: 14396
#include<iostream>
#include <math.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main()
{
    string a, b;
    cin >> a >> b;

    int n = stoi(a+b);
    int root = sqrt(n);
    if (n == root*root) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> // Common file  
#include <ext/pb_ds/tree_policy.hpp>  
#include <functional> // for less
using namespace __gnu_pbds;

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

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#define rep(i,a,n)    for(int i=a; i<=n; ++i)
#define rep1(i,a,n)   for(int i=a; i>=n; --i)
#define pb            push_back
#define mp            make_pair
#define int           long long
#define fr            first
#define sc            second
#define vc            vector
#define sz(v)         (int)v.size()
#define all(x)        (x).begin(),(x).end()
#define rall(x)       (x).rbegin(),(x).rend()
#define N             (int)(1e6+5)
#define M             1000000007
#define MM            998244353
#define PI            3.14159265358979
#define INF           1000000000000000

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef map<int,int> mii;

int n,m,ans; string str;

int solve(){
    int a,b; cin>>n>>a>>b;
    int t=n/(a+b);
    cout<<t*a+min(n%(a+b),a);
    return 0;
}

signed main() {
    ios::sync_with_stdio(0);
    //std::mt19937_64 rng(std::chrono::steady_clock::now().time_since_epoch().count());
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t=1;
    // cin>>t;
    while(t--) solve();
    return 0;
}

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

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

int main()
{
    int N, Q, a;
    cin >> N;
    vector<int> A(N),  count(100001);
    rep(i, N){
        cin >> a;
        A[i] = a;
        ++count[a];
    }
    cin >> Q;
    vector<ll> B(Q), C(Q);
    rep(i, Q) cin >> B[i] >> C[i];
    ll ans = 0;

    rep(i, N)
    {
        ans += A[i];
    }

    rep(i, Q)
    {
        ans -= count[B[i]] * B[i];
        ans -= count[C[i]] * C[i];
        count[C[i]] += count[B[i]];
        ans += count[C[i]] * C[i];
        count[B[i]] = 0;
        cout << ans << endl;
    }
}


Measured memory_bytes: 5584
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<string>
#include<climits>
#include<stack>
#include<queue>
#include<unordered_map>
#include<map>
#include<set>
#include <fstream>
#include<list>

#define loopi(x,y) for(int i = x;i<(y);i++)
#define loopj(x,y) for(int j = x;j<(y);j++)
#define rloopi(x,y) for(int i = x;i>=(y);i--)
#define rloopj(x,y) for(int j = x;j>=(y);j--)


#define nl cout<<"\n";
#define ll long long int
#define mod  1000000007


using namespace std;

int main()
{

	ios :: sync_with_stdio(false);
	cin.tie(nullptr);

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	int x;

	cin >> x;

	if (x >= 30)
		cout << "Yes";
	else
		cout << "No";


	return 0;
}


Measured memory_bytes: 3648
/*************************************\
*           بِسْمِ اللهِ الرَّحْمٰنِ الرَّحِيْمِ             *
*             رَّبِّ زِدْنِى عِلْمًا                *
*   Mir Abdullah yousuf, KUET_EEE14   *
\*************************************/
#include <bits/stdc++.h>
#define LL              long long
#define PI              acos(-1.0)
#define PII             pair<int,int>
#define xx              first
#define yy              second
#define MS(a,b)         memset(a, b, sizeof (a))
#define MP(a,b)         make_pair(a, b)
#define pb              push_back
#define sf(a)           scanf("%d", &a)
#define READ()          freopen("input.txt", "r", stdin)
#define WRITE()         freopen("output.txt", "w", stdout)
#define GCD(a, b)       __gcd(a, b)
#define LCM(a, b)       (a * b) / GCD(a, b)
#define sqr(a)          (a) * (a)
#define MOD             100000007
#define MAX             1000005
#define inf             2147483647
using namespace std;

///***********-8-direction*************/
//int fx[] = {1, -1, 0, 0, 1, -1, -1, 1};
//int fy[] = {0, 0, 1, -1, 1, 1, -1, -1};

///***********-4-direction*************/
//int fx[] = {1, -1, 0, 0};
//int fy[] = {0, 0, 1, -1};


int main()
{
    int n; sf(n);
    int ans = 1;
    if (n == 1) cout << ans << endl;
    else {
        while (ans < n) {
            ans = ans * 2;
        }
        if (ans == n) cout << ans << endl;
        else cout << ans / 2 << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#define MAX 2000001
#define VMAX 10000

int main() {
	unsigned short *A, *B;
	int C[VMAX + 1];
	int n, i, j;
	
	scanf("%d", &n);
	
	A = (unsigned short *) malloc(sizeof(short) * n + 1);
	B = (unsigned short *) malloc(sizeof(short) * n + 1);
	
	for(i = 0; i <= VMAX; i++) C[i] = 0;
	
	for(i = 0; i < n; i++) {
		scanf("%hu", &A[i + 1]);
		C[A[i + 1]]++;
	}
	
	for( i = 1; i <= VMAX; i++) C[i] = C[i] + C[i - 1];
	
	for(j = 1; j <= n; j++) {
		B[C[A[j]]] = A[j];
		C[A[j]] --;
	}
	
	for(i = 1; i <= n; i++) {
		if(i > 1) printf(" ");
		printf("%d", B[i]);
	}
	printf("\n");
	
	return 0;	
	
} 

Measured memory_bytes: 10432
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()
// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return;std::cout << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class X> void DEBUG(X d, T e){if(DEBUG_OUT == false)return;std::cout <<d<<" ";DEBUG(e);};
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

//CODE
int N,A,B,C;
int DFS(int depth, int a,int b,int c,vector<int> & vec)
{
  if(depth == N)
  {
    if(min(a,min(b,c)) > 0)
    return abs(a - A) + abs(b - B) + abs(c-C) - 30;
    else
    {
      return INF;
    }
    
  }
  int ret0 = DFS(depth+1,a,b,c,vec);
  int ret1 = DFS(depth+1,a+vec[depth],b,c,vec)+10;
  int ret2 = DFS(depth+1,a,b+vec[depth],c,vec)+10;
  int ret3 = DFS(depth+1,a,b,c+vec[depth],vec)+10;
  return min(min(ret0,ret1),min(ret2,ret3));
}

void solve(void)
{

  cin>>N>>A>>B>>C;
  vector<int> vec(N);
  for (int i = 0; i < N; i++)
  {
    cin>>vec[i];
  }
  cout<<DFS(0,0,0,0,vec)<<endl;;
  

  return;
}


int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();
  

 
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		int [] count = new int[26];
		int i = 0, alphabet_AtoZ = 0;
		String input;
		try (Scanner sc = new Scanner(System.in)) {
			while (sc.hasNextLine()) {
				input = sc.nextLine();
				for(i = 0; i < input.length(); i++) {
					alphabet_AtoZ = Character.getNumericValue(input.charAt(i)) - 10;
					if(0 <= alphabet_AtoZ && alphabet_AtoZ <= 25) {
						count[alphabet_AtoZ]++;
					}
				}
			}
			for(i = 0; i < 26; i++) {
				System.out.println((char)(i + 97) + " : " + count[i]);
			}
		}
	}
}


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

using namespace std;

#define FOR(i, x, y) for(int i = (x); i < (y); ++i)
#define REP(i, x, y) for(int i = (x); i <= (y); ++i)
#define MP make_pair
#define PB push_back
#define PH push
#define fst first
#define snd second
typedef double db;
typedef long double ldb;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

const int INF = 1e9 + 7;
const int maxn = 2e5 + 5;

class SegmentTree{
private:
	int sz;
	ll dat[maxn << 2], add[maxn << 2];
	inline void pushDown(int x){
		add[x << 1] += add[x];
		add[x << 1 | 1] += add[x];
		dat[x << 1] += add[x];
		dat[x << 1 | 1] += add[x];
		add[x] = 0;
		return;
	}
public:
	SegmentTree(){}
	inline int size(){ return sz; }
	inline void init(int n){
		for(sz = 1; sz < n; sz <<= 1);
		memset(dat, 0, sizeof(dat));
		memset(add, 0, sizeof(add));
		return;
	}
	inline void update(int x,int l,int r,int s,int t,ll k){
		if(l > t || r < s) return;
		if(l >= s && r <= t){
			dat[x] += k;
			add[x] += k;
			return;
		}
		int md=(l + r) >> 1;
		pushDown(x);
		update(x << 1, l, md, s, t, k);
		update(x << 1 | 1, md + 1, r, s, t, k);
		dat[x] = max(dat[x << 1], dat[x << 1 | 1]);
		return;
	}
	inline ll query(int x,int l,int r,int s,int t){
		if(l > t || r < s) return 0;
		if(l >= s && r <= t) return dat[x];
		int md=(l + r) >> 1;
		pushDown(x);
		ll vl = query(x << 1,l, md, s, t);
		ll vr = query(x << 1 | 1, md + 1, r, s, t);
		return max(vl, vr);
	}
	inline void print(int x,int l,int r){
		if(l == r) return;
		int md= l + r >> 1;
		print(x << 1, l, md);
		print(x << 1 | 1, md+1, r);
		return;
	}
}seg;

int n,m;
ll dp[maxn],sum[maxn];
vector<pii> cov[maxn];

int main(){
	scanf("%d%d", &n, &m);
	seg.init(n+1);
	FOR(i,0,m){
		int l,r,w;
		scanf("%d%d%d",  &l, &r, &w);
		cov[r].PB(MP(l, w));
		seg.update(1, 0, seg.size() - 1, l, r, -w);
		sum[l] += w;
		sum[r + 1] -= w;
	}
	REP(i, 1, n + 1) sum[i] += sum[i - 1];
	REP(i, 1, n){
		dp[i] = seg.query(1, 0, seg.size() - 1, 0, i - 1) + sum[i];
		FOR(j, 0, cov[i].size()){
			seg.update(1, 0, seg.size() - 1, cov[i][j].fst, i, cov[i][j].snd);
		}
		seg.update(1, 0, seg.size()-1, i, i, dp[i]);
	}
	printf("%lld\n",seg.query(1, 0, seg.size()-1, 0, n));
	return 0;
}


Measured memory_bytes: 26752
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define si(n) scanf("%d",&n);
#define PI acos(-1.0)
#define sl(n) scanf("%lld",&n);
#define sf(n) scanf("%lf",&n);
#define ss(n) scanf("%s",n);
#define for0(i,n) for(ll i=0;i<n;i++)
#define for1(i,n) for(ll i=1;i<=n;i++)
#define forc(i,j,n) for(ll i=j;i<n;i++)
#define pb push_back
#define sor(n) sort(n.begin(),n.end())
#define sorcmp(n) sort(n.begin(),n.end(),cmp)
#define rev(n) reverse(n.begin(),n.end())
#define pi(x)  prllf("%d",x);
#define pl(x)  prllf("%lld",x);
#define pf(x)  prllf("%.10lf",x);
#define ps(x)  prllf("%s",x);
#define en() prllf("\n");
#define random_shuffle(r...)random_shuffle(r,[](int _){return rand()%_;})
#define SQR(a) (a)*(a)
#define sp(x) fixed<<setprecision(x)
#define mod 100000007
#define endl '\n'
#define pii pair<int,int>
#define pll pair<ll,ll>
void fastio(){ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);}
template <typename T> T POW(T B,T P){ if(P==0) return 1; if(P&1) return B*POW(B,P-1);  else return SQR(POW(B,P/2));}
ll powmod(ll a, ll b){ll ans = 1;while(b){if(b&1) ans = ans*a%mod;a = a*a%mod;b >>= 1;}return ans;}


int main()
{
    ll n,m;
    cin>>n>>m;
    ll arr[m];
    ll sum=0;
    for(int i=0;i<m;i++) cin>>arr[i],sum+=arr[i];

    if(sum>n) return cout<<-1<<endl,0;
    else
    {
        cout<<n-sum<<endl;
    }
}























Measured memory_bytes: 3716
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    string s;
    cin>>n>>s;
    vector<int> e(n+1,0);
    vector<int> w(n+1,0);
    for(int i=0;i<n;i++){
        w[i+1]+=w[i];
        if(s[i]=='W')w[i+1]++;
    }
    for(int i=n;i>=1;i--){
        e[i-1]=e[i];
        if(s[i]=='E')e[i-1]++;
    }
    int ans=300000;
    for(int i=0;i<=n;i++){
        ans=min(ans,e[i]+w[i]);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3076
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in);) {
            new Main().solve(sc);
        }
    }

    void solve(Scanner sc) {
        int n =sc.nextInt();
        char[] s = sc.next().toCharArray();
        int[] wSums = new int[n + 1];
        int[] eSums = new int[n + 1];
        wSums[0] = 0;
        eSums[0] = 0;
        for (int i = 0; i < n; i++) {
            wSums[i + 1] = s[i] == 'W' ? wSums[i] + 1 :wSums[i];
            eSums[i + 1] = s[i] == 'E' ? eSums[i] + 1 :eSums[i];
        }

        int ans = 300001;
        for (int i = 0; i < n; i++) {
            int tmpAns = wSums[i] + eSums[n] - eSums[i + 1];
            ans = Math.min(ans, tmpAns);
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 31196