akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h> 
using namespace std; 
#define vll vector<long long>
#define mll map<long long,long long>
#define pb push_back
typedef  long long ll;
typedef long double ld;
long double pi=3.14159265358979323846;

vll al[500005];
ll vis[500005],color[500005],I[101][101];

ll gcd(ll a,ll b)
{
    if (b==0) return a;
    return gcd(b,a%b);
}

bool isPrime(int n)
{
    if (n<=1) return false; 
    if (n<=3) return true; 
    if (n%2==0||n%3==0) return false; 
    for (int i=5;i*i<=n;i=i+6) if (n%i==0||n%(i+2)==0) return false; 
    return true; 
}

ll bpow(ll n, ll po)
{
	ll res=1;
	while(po>0)
	{
		if(po%2)
		{
			res*=n;
			po--;
		}
		else
		{
			n*=n;
			po/=2;
		}
	}
	return res;
}

ll binpow(ll n, ll po, ll mod)
{
	ll res=1;
	while(po>0)
	{
		if(po%2)
		{
			res=(res*n)%mod;
			po--;
		}
		else
		{
			n=(n*n)%mod;
			po/=2;
		}
	}
	return res;
}

ll swap(ll a, ll b)
{
	a=a+b;
	b=a-b;
	a=a-b;
}

ll fact(ll n) { 
   if ((n==0)||(n==1))
      return 1;
   else
      return n*fact(n-1);
}

ll C(ll n, ll r) {
    if(r > n - r) r = n - r; 
    ll ans = 1;
    ll i;

    for(i = 1; i <= r; i++) {
        ans *= n - r + i;
        ans /= i;
        ans=ans%1000000007;
    }

    return ans;
}

//bool bipartite_dfs(ll node, ll flag)
//{
//	vis[node]=1;
//	ll cflag=flag;
//	color[node]=cflag;
//	for(ll child : al[node])
//	{
//		if(!vis[child])
//		{
//			bool n=bipartite_dfs(child,1-cflag);
//			if(n==false) return false;
//		}
//		else if(color[child]==color[node]) return false;
//	}
//	return true;
//}

void mmul(ll A[][101], ll B[][101], ll dim)
{
	ll res[dim][dim];
	for(ll i=0;i<dim;i++) for(ll j=0;j<dim;j++)
	{
		res[i][j]=0;
		for(ll k=0;k<dim;k++) res[i][j]=(res[i][j]+A[i][k]*B[k][j])%1000000007;
	}
	for(ll i=0;i<dim;i++) for(ll j=0;j<dim;j++) A[i][j]=res[i][j];
}

void mpow(ll A[][101],ll dim, ll po)
{
	for(ll i=0;i<dim;i++) for(ll j=0;j<dim;j++)
	{
		if(i==j) I[i][j]=1;
		else I[i][j]=0;
	}
	while(po>0)
	{
		if(po%2==1)
		{
			mmul(I,A,dim);
			po--;
		}
		else
		{
			mmul(A,A,dim);
			po/=2;
		}
	}
	for(ll i=0;i<dim;i++) for(ll j=0;j<dim;j++) A[i][j]=I[i][j];
}


int main()
{
	ll n,ans=1,z=0,flag=0;
	cin>>n;
	ll a[n];
	for(ll i=0;i<n;i++)
	{
		cin>>a[i];
		if(a[i]==0) z=1;
	}
	if(z==1) cout<<0;
	else
	{
		for(ll i=0;i<n;i++)
		{
			if((long double)1000000000000000000.0/a[i]>=ans) ans*=a[i];
			else 
			{
				flag=1;
				break;
			}
		}
		if(flag==1) cout<<-1;
		else cout<<ans;
	}
	
}


Measured memory_bytes: 16104
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m; i<n; i++)
#define co(n) cout << n << endl
using namespace std;
int main(){
  string s;
  cin >> s;
  s[3]='8';
  co(s);
  
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner in = new Scanner(System.in);
		
		int N = in.nextInt();
		int Q = in.nextInt();
		
		
		
		System.out.println(count(N, Q));
		//System.out.println(count_tu(N, Q));
		
		

	}
	
	public static long count(int N, int Q) {
		
		long ans=0;
		long t;
		if (Q%2==0) {
			int P = Q/2;
			t=N/P;
			if (t%2==0) {
				ans=(t/2)*(t/2)*(t/2)*2;
			}else {
				ans=(t/2)*(t/2)*(t/2) + ((t/2)+1)*((t/2)+1)*((t/2)+1);
			}
			
		} else {
			t=N/Q;
			ans = t*t*t;
			
		}
		
		return ans;
	}
	
	public static long count_tu(int N, int Q) {
		
		long ans = 0;
		
		if (Q%2==0) {
			int P = Q/2;
			for (int i=P;i<=N;i+=P) {
				for (int j=P;j<=N;j+=P) {
					if ((i+j)%Q != 0)
						continue;
					else {				
						for (int k=P;k<=N;k+=P) {
							
							if ((k+j)%Q != 0||(k+i)%Q != 0)
								continue;
							else {
							
								ans++;
								System.out.println(i + " " + j + " " + k);
							
							}
						}
					}
				}
			}
		} else {
			for (int i=Q;i<=N;i+=Q) {
				for (int j=Q;j<=N;j+=Q) {
					if ((i+j)%Q != 0)
						continue;
					else {				
						for (int k=Q;k<=N;k+=Q) {
							
							if ((k+j)%Q != 0||(k+i)%Q != 0)
								continue;
							else {
							
								ans++;
								System.out.println(i + " " + j + " " + k);
							
							}
						}
					}
				}
			}
			
		}
		return ans;
	}

}


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

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(n);
  rep(i, n) cin >> a.at(i);
  int sum = 0;
  rep(i, n) sum += a.at(i);
  int num = 0;
  float w = (float) sum / (4 * m);
  rep(i, n) {
    if(a.at(i) >= w) num++;
  }
  if(num >= m) cout << "Yes" << endl;
  else cout << "No" << endl;
} 

Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <climits>
using namespace std;
using ll =long long;
const int MAX=200000;
int N;
int A[MAX];

 
ll merge(int left,int mid,int right){
    ll cnt=0;
    int n1=mid-left;
    int n2=right-mid;
    vector<int> L(n1+1),R(n2+1);
    for(int i=0;i<n1;i++){
        L[i]=A[left+i];
    }
    for(int i=0;i<n2;i++){
        R[i]=A[mid+i];
    }
    L[n1]=INT_MAX;
    R[n2]=INT_MAX;
    cnt=0;
    for(int k=left,i=0,j=0;k<right;k++){
        if(L[i]<=R[j]){
            A[k]=L[i];
            i++;
        }else{
            A[k]=R[j];
            j++;
            cnt+=mid-left-i;
        }
    }
    return cnt;
}

ll mergeSort(int left,int right){
    ll a,b,c;
    if(left+1<right){
        int mid=(left+right)/2;
        a=mergeSort(left,mid);
        b=mergeSort(mid,right);
        c=merge(left,mid,right);
        return a+b+c;
    }else{
        return 0;
    }
}

int main(){
    cin>>N;    
    for(int i=0;i<N;i++){
        cin>>A[i];
    }
    //mergeSort(0,N);
    cout<<mergeSort(0,N)<<endl;
}


Measured memory_bytes: 4312
#include <bits/stdc++.h>
#define REP(i, n) for(long long i = 0; i < n; i++)
#define REPR(i, n) for(long long i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(long long i = m; i <= n; i++)
#define FORR(i, m, n) for(long long i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
#define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;
const ll mod = 1e9+7;


int main(){FIN
    float ans=0;
    float n,k; cin>>n>>k;
    FOR(i,1,n){
        int me = i;
        float prob = 1.0;
        while(k>me){
            prob *= 0.5;
            me*=2;
        }
        ans+=prob;
    }
    // cout<<ans<<endl;
    cout<<fixed<<setprecision(20)<<ans/double(n)<<endl;
    return 0;
}

Measured memory_bytes: 256
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define reps(i,a,b) for(int i=a;i<b;++i)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<typename T> inline bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T &a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U &u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U &u,const V... v){for(auto &e:u)fill_v<T>(e,v...);}

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

    string s, p;
    cin >> s >> p;
    int n = sz(s);
    int k = sz(p);
    s += s;
    rep(i, n) {
        if (s.substr(i, k) == p) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}



Measured memory_bytes: 3232
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
vector<LL> A,B,C;

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

    int x,y,z,K;
    cin >> x >> y >> z >> K;

    for(int i = 0; i < x; i++)
    {
        LL a;
        cin >> a;
        A.push_back(a);
    }
    for(int i = 0; i < y; i++)
    {
        LL a;
        cin >> a;
        B.push_back(a);
    }
    for(int i = 0; i < x; i++)
    {
        LL a;
        cin >> a;
        C.push_back(a);
    }
    sort(A.rbegin(), A.rend());
    sort(B.rbegin(), B.rend());
    sort(C.rbegin(), C.rend());

    int cnt = 0;
    vector<LL>AB;
    for(int i = 0; i < x ; i++)
    {
        LL ans1 = A[i];
        for(int j = 0; j < y; j++)
        {
            LL ans2 = ans1 + B[j];
            AB.push_back(ans2);
        }
    }
     vector<LL>ans;
    sort(AB.rbegin(), AB.rend());
    for(int i = 0; i < z; i++){
        for(int j = 0; j < AB.size(); j++){
            LL res = AB[j] + C[i];
            ans.push_back(res);
            if((i+1)*(j+1) >= K) break;
        }
    }
    sort(ans.rbegin(), ans.rend());
    for(int i = 0; i < K; i++) cout << ans[i] << endl;
    return 0;
}


Measured memory_bytes: 10616
#define _CRT_SECURE_NO_WARNINGS
#include <vector>
#include <iostream>
#include <string.h>
#include <set>
#include <algorithm>
#include <cmath>
#include <queue>
using namespace std;

typedef double LD;
typedef long long LL;
typedef pair<int, int> PII;
#define MP make_pair
#define PB push_back
#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define RFOR(i,b,a) for(int i = (b) - 1; i >= (a); --i)
#define REP(i, t) FOR(i,0,t)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)((a).size())

const LL MOD = 1000000007;
const int INF = 1e9;
const LL LINF = 1LL * INF * INF;
const int MAXN = 100007;
const LD EPS = 1e-7;

int A[MAXN], D[MAXN], Dep[MAXN], n, k;
vector <int> G[MAXN], G1[MAXN];
queue <int> Q;
bool used[MAXN];

void dfs(int v)
{
	used[v] = true;
	REP(i, SZ(G1[v]))
	{
		int to = G1[v][i];
		if (!used[to])
		{
			dfs(to);
			Dep[v] = max(Dep[v], (Dep[to] + 1) % k);
		}
	}
}

int main()
{
	ios_base::sync_with_stdio(0);
	//freopen("In.txt", "r", stdin);
	int ans = 0, e = 0;
	cin >> n >> k;
	REP(i, n)
	{
		cin >> A[i];
		--A[i];
	}
	if (A[0] != 0)
	{
		A[0] = 0;
		ans = 1;
	}
	FOR(i, 1, n)
		G[A[i]].push_back(i);
	used[0] = true;
	D[0] = 0;
	Q.push(0);
	while(!Q.empty())
	{
		int v = Q.front();
		Q.pop();
		e = max(e, D[v]);
		REP(i, SZ(G[v]))
		{
			int to = G[v][i];
			if (!used[to])
			{
				used[to] = true;
				D[to] = D[v] + 1;
				G1[v].push_back(to);
				Q.push(to);
			}
		}
	}
	memset(used, 0, MAXN);
	dfs(0);
	REP(i, n)
	{
		if (D[i] > 1 && Dep[i] == k - 1)
			++ans;
	}
	cout << ans;
	//cout << endl; system("pause");
	return 0;
}

Measured memory_bytes: 18688
#include<iostream>
#include<queue>
using namespace std;
typedef pair<pair<int,int>,int> pa;
#define ff first.first
#define fs first.second

int h,w,sx,sy,gx,gy;
int dx[4]={1,0,-1,0};
int dy[4]={0,-1,0,1};
int co[21][21];
char ma[21][21];
bool visited[21][21];
string pat;
int m = 999999;

int main(){
    while(cin>>h>>w,h){
        for(int i=0;i<h;i++){
            for(int j=0;j<w;j++){
                co[i][j]=m;
                cin>>ma[i][j];
                if(ma[i][j]=='A')
                    sx=j,sy=i;
                else if(ma[i][j]=='B')
                    gx=j,gy=i;
            }
        }
        queue<pa>q;
        q.push(make_pair(make_pair(sx, sy), 0));
        while(q.size()){
            pa p = q.front();
            q.pop();
            if(co[p.fs][p.ff]!=m)
                continue;
            co[p.fs][p.ff]=p.second;
            for(int i=0;i<4;i++){
                int nx=p.ff+dx[i];
                int ny=p.fs+dy[i];
                if(nx>=0&&nx<w&&ny>=0&ny<h&&ma[ny][nx]!='#'&&co[ny][nx]==m)
                    q.push(make_pair(make_pair(nx, ny), p.second+1));
            }
        }
        cin>>pat;
        for(int j=0,go=0;;j++,go++){
            int i=j%pat.length();
            if(co[gy][gx]<=go){
                cout<<go<<" "<<gy<<" "<<gx<<endl;
                break;
            }
            if(go>1000){
                cout<<"impossible"<<endl;
                break;
            }
            if(pat[i]=='8')
                gy--;
            else if(pat[i]=='6')
                gx++;
            else if(pat[i]=='4')
                gx--;
            else if(pat[i]=='2')
                gy++;
            gy=max(0,min(h-1,gy));
            gx=max(0,min(w-1,gx));
        }
    }
}

Measured memory_bytes: 1228
#include <stdio.h>

int main(void){
  int N, i, j, x=0;
  scanf("%d", &N);
  N = N % 28;
  for(i=0; i<=7; i++){
    for(j=0; j<=4; j++){
      if(4*i + 7*j == N){
        x = 1;
      }
    }
  }
  if(x == 0){
    printf("No\n");
  }else{
    printf("Yes\n");
  }
  return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define mx 1000000007
#define ll long long int

using namespace std;

int n,k;

int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin>> n;
    int arr[n+1][4];
    for(int i=1;i<=n;++i)
        cin>> arr[i][1] >> arr[i][2] >> arr[i][3] ;
    int dp[n+1][4]={0};
    dp[n][0]=max(arr[n][1],max(arr[n][2],arr[n][3]));
    dp[n][1]=max(arr[n][2],arr[n][3]);
    dp[n][2]=max(arr[n][1],arr[n][3]);
    dp[n][3]=max(arr[n][1],arr[n][2]);
    for(int i=n-1;i>0;--i){
    	dp[i][0]=max(dp[i+1][1]+arr[i][1],max(dp[i+1][2]+arr[i][2],dp[i+1][3]+arr[i][3]));
    	dp[i][1]=max(dp[i+1][2]+arr[i][2],dp[i+1][3]+arr[i][3]);
    	dp[i][2]=max(dp[i+1][1]+arr[i][1],dp[i+1][3]+arr[i][3]);
    	dp[i][3]=max(dp[i+1][1]+arr[i][1],dp[i+1][2]+arr[i][2]);
    }
    cout<< dp[1][0] ;
	return 0;
}


Measured memory_bytes: 6736
import collections
import sys

S1 = collections.deque()
S2 = collections.deque()
S3 = collections.deque()

for i, j in enumerate(sys.stdin.readline()):
    if j == '\\':
        S1.append(i)
    elif j == '/':
        if S1:
            left_edge = S1.pop()
            new_puddle = i - left_edge
            while S2 and (S2[-1] > left_edge):
                if S2[-1] > left_edge:
                    S2.pop()
                    new_puddle += S3.pop()
            S2.append(left_edge)
            S3.append(new_puddle)
        else:
            pass


print(sum(S3))

print(len(S3), *S3)

Measured memory_bytes: 8472
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<double,double> pdd;
#define SQ(i) ((i)*(i))
#define MEM(a, b) memset(a, (b), sizeof(a))
#define SZ(i) int(i.size())
#define FOR(i, j, k, in) for (int i=j ; i<(k) ; i+=in)
#define RFOR(i, j, k, in) for (int i=j ; i>=(k) ; i-=in)
#define REP(i, j) FOR(i, 0, j, 1)
#define REP1(i,j) FOR(i, 1, j+1, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
#define ALL(_a) _a.begin(),_a.end()
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define X first
#define Y second
#ifdef jayinnn
#define TIME(i) Timer i(#i)
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<", ";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,deque<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
class Timer {
private:
    string scope_name;
    chrono::high_resolution_clock::time_point start_time;
public:
    Timer (string name) : scope_name(name) {
        start_time = chrono::high_resolution_clock::now();
    }
    ~Timer () {
        auto stop_time = chrono::high_resolution_clock::now();
        auto length = chrono::duration_cast<chrono::microseconds>(stop_time - start_time).count();
        double mlength = double(length) * 0.001;
        debug(scope_name, mlength);
    }
};
#else
#define TIME(i)
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
#endif

const ll MOD = 1000000007;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int iNF = 0x3f3f3f3f;
const ll MAXN = 100005;

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

/********** Good Luck :) **********/
int main () {
    TIME(main);
    IOS();
    string s;
    cin >> s;
    bool flag1 = true;
    for(int i=0;i<3;i++){
        if(s[i] == 'B') flag1 = false;
    }
    bool flag2 = true;
    for(int i=0;i<3;i++){
        if(s[i] == 'A') flag2 = false;
    }
    cout << ((flag1 || flag2) ? "No" : "Yes") << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
    int A, B, C, X, tmp, count = 0;
    scanf("%d %d %d %d", &A, &B,&C, &X);

    for(int i = 0; i <= A; i++){
        for(int j = 0; j <= B; j++){
            tmp = X - (500 * i + 100 * j);
            count += (tmp >= 0) && (tmp / 50 <= C) && (tmp % 50 == 0);
        }
    }

    printf("%d\n", count);
    return 0;
}

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

int main() {
int W,H,x,y,r;
cin >> W;
cin >> H;
cin >> x;
cin >> y;
cin >> r;

if ( (x-r >= 0) && (y-r >= 0) && (x+r <= W) && (y+r <= H) ) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
}


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

#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define ALL(x) (x).begin(), (x).end()
#define OUT(a) cout << (a) << "\n"

typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;

const ll MOD = 10e9 + 7;
int dp[100001];

int main() {
    int n,k;
    cin >> n >> k;
    vector<int> h(n);
    REP(i, n) cin >> h[i];
    REP(i, n) dp[i] = INT_MAX;
    dp[0] = 0;
    for(int i=0; i<n-1; i++) {
        for(int j=1; j<=k && j+i<n; j++) {
            dp[i+j] = min(dp[i+j], dp[i]+abs(h[i]-h[i+j]));
        }
    }
    cout << dp[n-1] << endl;
    return 0;
}


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

#include <iomanip>
void _130() {
    int w, h, x, y;
    cin >> w >> h >> x >> y;

    cout << fixed << setprecision(10);
    cout << (double)w * h / 2 << " " << (2 * x == w && 2 * y == h) << endl;
}

void _131() {
    long long a, b, c, d;
    cin >> a >> b >> c >> d;

    long long count = 0;
    for (long long i = a; i <= b; ++i) {
        if (i % c != 0 && i % d != 0){
            count++;
        }
    }
    cout << count << endl;
}

#include <cmath>
void _131_() {
    long long a, b, c, d;
    cin >> a >> b >> c >> d;

    long long min_baisuu;
    for (long long i = min(c, d); i <= c * d; ++i) {
        if (i % c == 0 && i % d == 0) {
            min_baisuu = i;
            cout << min_baisuu << endl;
            break;
        }
    }

    long long c_baisuu_num = 0;
    long long d_baisuu_num = 0;
    long long cd_baisuu_num = 0;

    c_baisuu_num = abs(a / c - b / c);
    d_baisuu_num = abs(a / d - b / d);
    cd_baisuu_num = abs(a / min_baisuu - b / min_baisuu);

    cout << abs(a - b) + 1 - (c_baisuu_num + d_baisuu_num - cd_baisuu_num) << endl;
}

void _131__() {
    long long a, b, c, d;
    cin >> a >> b >> c >> d;

    long long min_baisuu = 0;
    long long max_yakusuu = 0;
    
    long long amari = 0;
    long long bigger = max(c, d);
    long long smaller = min(c, d);
    while (true) {
        amari = bigger % smaller;
        if (amari == 0) {
            max_yakusuu = smaller;
            break;
        }
        bigger = smaller;
        smaller = amari;
    }
    // cout << max_yakusuu << endl;
    min_baisuu = c * d / max_yakusuu;

    long long b_num = b - b / c  - b / d + b / min_baisuu;
    long long a_num = a - 1 - (a - 1) / c - (a - 1) / d + (a - 1) / min_baisuu;
    // cout << b_num << " " << a_num << endl;
    cout << b_num - a_num << endl;
}

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



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

using namespace std;

int niz[100050];

int main()
{
    int n;
    cin>>n;
    bool nula=false;
    int brNeg=0;
    for(int i=0;i<n;i++)
    {
        cin>>niz[i];
        if(niz[i]==0)nula=true;
        if(niz[i]<0)brNeg++;
    }
    long long res=0;
    for(int i=0;i<n;i++)
    {
        niz[i]=abs(niz[i]);
    }
    for(int i=0;i<n;i++)
            res+=niz[i];
    if(nula||brNeg%2==0)
    {
       cout<<res;
    }
    else if(brNeg%2!=0){
        int mini=*min_element(niz,niz+n);
        res-=2*mini;
        cout<<res;
    }
    return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_map>
#include<climits>
#include<cstdlib>
#include<cmath>
#include<string>
#include<iomanip>
#include<bitset>

using namespace std;

#define ll long long int

ll const MOD = 1000000007;
ll const INF = (long long int)1 << 61;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll a,b,c;
    cin >> a >> b >> c;

    cout << min(b/a,c) << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stdio.h>
#include<cstring>
#include<math.h>
#include<map>
#include<bitset>
#include<iomanip>
#include<queue>
#include<functional>
#include<stack>
#include<tuple>
#include<cassert>
using namespace std;

#define rep(i, n) for (long long i = 0; i < (long long)(n); ++i)
using ll = long long;
using P = pair<long long, long long>;
using MATRIX = vector< vector<ll> >;
template <class T> inline bool chmin(T &x, const T &y) {if (x > y) {x = y; return 1;} return 0;}
template <class T> inline bool chmax(T &x, const T &y) {if (x < y) {x = y; return 1;} return 0;}

int main() {
  long long a, b, c, d;
  cin >> a >> b >> c >> d;

  if(b < 0 && d < 0) {
    cout << a * c << endl;
  } else if(a >= 0 && c >= 0) {
    cout << b * d << endl;
  } else if(a >= 0 && d < 0) {
    cout << a * d << endl;
  } else if(c >= 0 && b < 0) {
    cout << b * c << endl;
  } else {
    cout << max(a * c, b * d) << endl;
  }
  return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF    	((ll)1ll<<60)
#define INF     	((int)1<<30)
#define EPS     	(1e-9)
#define MOD     	(1000000007ll)
#define fcout(a)	cout<<setprecision(a)<<fixed
#define fs 			first
#define sc			second
#define PI			3.1415926535897932384

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s; a=0;} return os;}
void OUT(bool b){cout<<(b?"YES":"NO")<<endl;}
void Out(bool b){cout<<(b?"Yes":"No")<<endl;}
void out(bool b){cout<<(b?"yes":"no")<<endl;}
int popcnt(int x) { return __builtin_popcount(x); }
int popcnt(ll x) { return __builtin_popcountll(x); }
int clz(int x) { return 31 - __builtin_clz(x); }
int clz(ll x) { return 63 - __builtin_clzll(x); }
int ctz(int x) { return __builtin_ctz(x); }
int ctz(ll x) { return __builtin_ctzll(x); }

class compare {
public:
	bool operator()(tuple<ll, ll> a, tuple<ll, ll> b) {
		return (get<1>(a) > get<1>(b));
	}
};

void solve(int n){
	n=1000-n;
	int ans=0;
	int c[5]={500,100,50,10,5};
	rep(i,5){
		while(n-c[i]>=0){
			ans++;
			n-=c[i];
		}
	}
	ans+=n;
	cout<<ans<<endl;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	while(cin>>n,n){
		solve(n);
	}
}



Measured memory_bytes: 3100
h, w, k = map(int, input().split())
c = [list(input()) for _ in range(h)]
ans = 0
for p_h in range(2**h):
    for p_w in range(2**w):
        black = 0
        for i in range(h):
            for j in range(w):
                if (p_h>>i)&1==0 and (p_w>>j)&1==0:
                    if c[i][j]=='#':
                        black +=1
        if black == k:
            ans += 1
print(ans)

Measured memory_bytes: 9060
a = input()
if a == "SUN" :
    print("7")
if a == "SAT" :
    print("1")
if a == "FRI" :
    print("2")
if a == "THU" :
    print("3")
if a == "WED" :
    print("4")
if a == "TUE" :
    print("5")
if a == "MON" :
    print("6")

Measured memory_bytes: 3060
from itertools import permutations as per
from math import sqrt
n=int(input())
x=[]
y=[]
for _ in range(n):
    xx,yy=map(int,input().split())
    x.append(xx)
    y.append(yy)

sum=0
div=0
for jun in per(range(n)):
    div+=1
    for i in range(n-1):
        post=jun[i]
        pre=jun[i+1]

        sum+=sqrt((x[pre]-x[post])**2+(y[pre]-y[post])**2)

print(sum/div)

Measured memory_bytes: 3064
#include <math.h>
#include <cstdlib>
#include <iostream>
#include <vector>
#include <numeric>

using namespace std;

int total(int a){
  int sum = 0;
  for (int i = 1; i <= a; i++) {
    sum += i;
  }
  return sum;
}

int main(int argc, const char* argv[]) {
  int N, K;
  double result = 0.0;
  cin >> N >> K;
  vector<int> P(N);
  vector<int> sum(N-K+1);
  for(int i=0; i< N;i++){
    cin >> P[i];
  }
  for (int i = 0; i <= N-K; i++) {
    sum[i] = accumulate(P.begin()+i, P.begin()+(K+i), 0);
  }
  vector<int>::iterator iter = max_element(sum.begin(), sum.end());
  size_t index = distance(sum.begin(), iter);
  for (int i = 0; i < K; i++) {
    result = result + (double)total(P[index + i]) / (double)P[index + i];
  }
  printf("%f\n", result);

  return 0;
}


Measured memory_bytes: 1792
import fractions

N = int(input())
A = [0] + list(map(int, input().split())) + [0]
L = [0] * (N+1)
R = [0] * (N+2)

for i in range(1, N+1):
  L[i] = fractions.gcd(L[i-1], A[i-1]) 
  R[N-i+1] = fractions.gcd(R[N-i+2], A[N-i+2])
ans = 0
for i in range(1, N+1):
  rest_gcd = fractions.gcd(L[i], R[i])
  ans = max(ans, rest_gcd)
print(ans)
    


Measured memory_bytes: 16152
import sys
readlines = sys.stdin.readlines
write = sys.stdout.write
P = [
    (0, 1, 2), (3, 4, 5), (6, 7, 8),
    (0, 3, 6), (1, 4, 7), (2, 5, 8),
    (0, 4, 8), (2, 4, 6),
]
def solve():
    for line in readlines():
        s = line.strip()
        for a, b, c in P:
            if s[a] == s[b] == s[c]:
                if s[a] == 'o':
                    write("o\n")
                    break
                elif s[a] == 'x':
                    write("x\n")
                    break
        else:
            write("d\n")
solve()


Measured memory_bytes: 5572
import sys
import math
from fractions import gcd
# import queue
# from collections import Counter
# from itertools import accumulate
# from functools import reduce

def lcm(a, b):
    return a * b // gcd(a, b)

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""
# 標準入力取得
## 文字列
 =  sys.stdin.readline().rstrip()
 =  list(sys.stdin.readline().rstrip())

## 数値
 =  int(sys.stdin.readline())
 =  map(int, sys.stdin.readline().split())
 =  list(map(int, sys.stdin.readline().split()))
 =  [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""

X, Y, Z =  map(int, sys.stdin.readline().split())
print((X - Z) // (Y + Z))

Measured memory_bytes: 64492
#include <stdio.h>

int main()
{
	int i, size_of_array;

	scanf("%d", &size_of_array);

	int array[size_of_array];

	for(i=0;i<size_of_array;i++){
		scanf("%d", &array[i]);
	}

	for(i=size_of_array-1;i>0;i--){
		printf("%d ", array[i]);
	}

	printf("%d\n", array[0]);

	return 0;
}


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

using namespace std;

void usain_bolt()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
}

const int N = 1e5;

int dp[N][4], a[N], b[N], c[N];

int main()
{
    usain_bolt();

    int n;

    cin >> n;
    for(int i = 1; i <= n; ++i) cin >> a[i] >> b[i] >> c[i];

    dp[1][1] = a[1], dp[1][2] = b[1], dp[1][3] = c[1];
    for(int i = 2; i <= n; ++i) {
        dp[i][1] = a[i] + max(dp[i - 1][2], dp[i - 1][3]);
        dp[i][2] = b[i] + max(dp[i - 1][1], dp[i - 1][3]);
        dp[i][3] = c[i] + max(dp[i - 1][1], dp[i - 1][2]);
    }
    cout << max(dp[n][1], max(dp[n][2], dp[n][3]));

    return 0;
}


Measured memory_bytes: 2944
#include <bits/stdc++.h>
#include <vector>
using namespace std;
const int MOD = 1000000007;
int main(){
  //入力
  int N;
  unsigned long long K;
  cin>>N>>K;
  vector<int>a(N);
  for(int i=0;i<N;i++){
    cin>>a[i];
  }
  //カウンタ
  unsigned long long cnt=0;
  unsigned long long cnt_sub=0;
  unsigned long long cnt_sub2=0;
  //aの転倒数
  for(int i=0;i<N-1;i++){
    for(int j=i+1;j<N;j++){
      if(a[i]>a[j]){
        cnt_sub++;
        if(cnt_sub>=MOD){
          cnt_sub-=MOD;
        }
      }
    }
  }
  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++){
      if(i==j) continue;
      if(a[i]>a[j]){
        cnt_sub2++;
        if(cnt_sub2>=MOD){
          cnt_sub2-=MOD;
        }
      }
    }
  }
  cnt=cnt_sub2*((K*(K-1)/2)%MOD)+((cnt_sub*K)%MOD);
  unsigned long long ans =cnt%MOD;
  
  //出力
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
using namespace std;

int main()
{
	int N;
	cin >> N;
	vector<unsigned long long> A(N);
	for (auto i = 0; i < N; ++i)
	{
		cin >> A[i];
	}

	sort(A.begin(), A.end(), greater<unsigned long long>());

	auto result = 0ull;
	for (auto i = 0; i < N - 3; ++i)
	{
		if (A[i] == A[i + 1])
		{
			for (auto j = i + 2; j < N - 1; ++j)
			{
				if (A[j] == A[j + 1])
				{
					result = A[i] * A[j];
					break;
				}
			}
			break;
		}
	}

	cout << result << endl;

	return 0;
}

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

int BubbleSort(vector<int> &A){
    int cnt = 0;
    int N = A.size();
    int tmp;
    for(int i = 0; i < N - 1; ++i){
        for(int j = N - 1; j >= i + 1; --j){
            if(A[j] < A[j - 1]){
                tmp = A[j];
                A[j] = A[j - 1];
                A[j - 1] = tmp;
                ++cnt;
            }
        }
    }
    return cnt;
}

int main(void){
    int N;
    cin >> N;
    vector<int> A(N, 0);
    for(int i = 0; i < N; ++i)
        cin >> A[i];
    int cnt = BubbleSort(A);
    for(int i = 0; i < N; ++i){
        cout << A[i];
        if(i != N - 1)
            cout << " ";
    }
    cout << endl << cnt << endl;
    return 0;
}

Measured memory_bytes: 3044
#include<stdio.h>
#include <iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;

int main() {
	int n;
	int a=100, b=10, c;
	int ans_a,ans_b,ans_c;

	cin >> n;

	ans_a = n / a;
	if (ans_a == 7) {
		cout<<"Yes";
		return 0;
	}
	ans_b = (n - ans_a * 100) / b;
	if (ans_b == 7) {
		cout << "Yes";
		return 0;
	}

	ans_c = n - ans_a * 100 - ans_b * 10;
	if (ans_c == 7) {
		cout << "Yes";
		return 0;
	}
	cout << "No";


	return 0;
}


Measured memory_bytes: 3136
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define FOR(i, s, n) for (int i = (s); i < (n); i++)
#define rep(i, n) FOR(i, 0, n)
#define repi(i, n) FOR(i, 1, n + 1)
#define pp(v) cout << #v "=" << (v) << endl;
#define ppa(v) cout << "----\n"; rep(i,v.size()) cout << #v << "[" << i << "] = " << v[i] << endl;
#define div_ceil(a,b) ((a) + ((b) - 1)) / (b)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
using namespace std;
using Graph = vector<vector<int>>;
using ll = long long;

int main() {
  int h,w;cin>>h>>w;
  rep(i,h) {
    string s; cin>>s;
    cout << s << endl;
    cout << s << endl;
  }  
}


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

int main()
{
    ll a, b, h, m;
    cin >> a >> b >> h >> m;

    double a_sita = 0;
    double b_sita = 0;
    double sita1 = 0;
    double sita2 = 0;
    double sita = 0;
    double radsita;
    double ans;

    a_sita = 30 * h + 0.5 * m;
    b_sita = 6 * m;

    if (a_sita <= b_sita)
    {
        sita1 = b_sita - a_sita;
        sita2 = 360 - sita1;
    }
    else if (a_sita > b_sita)
    {
        sita1 = a_sita - b_sita;
        sita2 = 360 - sita1;
    }
    sita = min(sita1, sita2);
    radsita = ((double)sita * acos(-1)) / 180.0;
    ans = ((double)a * (double)a + (double)b * (double)b) - (2.0 * (double)a * (double)b * cos(radsita));
    ans = sqrt(ans);

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

Measured memory_bytes: 4152
N=int(input())
L=list(map(int,input().split()))
L.sort()
cnt=0
for i in range(N):
  for j in range(i+1,N):
    for k in range(j+1,N):
      a=L[i]
      b=L[j]
      c=L[k]
      if abs(b-c)<a<b+c and a!=b and b!=c:
        cnt+=1
print(cnt)

Measured memory_bytes: 9188
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,a,b;
    cin>>n;
    if(n==1)
        cout<<"Hello World"<<endl;
    else if(n==2)
    {
        cin>>a>>b;
        cout<<a+b<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
struct MyIo{

}

impl MyIo{
    fn readline()->Vec<String>{
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).unwrap();
        let ret:Vec<String> = buf.split_whitespace().map(|c|c.to_string()).collect();
        ret
    }
}


fn main() {

    let mut input = MyIo::readline().into_iter();

    let v = input.next().unwrap().parse::<i32>().unwrap();

    let result = 
    match v {
        0...999=>{"ABC"},
        _=>{"ABD"},
    };

    println!("{}",result);
}


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

int n;
double ans;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> n;
	for(int i=0; i<n; ++i){
		double x;
		string s;
		cin >> x >> s;
		if(s == "JPY") ans += x;
		else ans += x * 380000;
	}
	cout << setprecision(10) << ans << "\n";
}

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

int main() {
  int n, a, v, ma, mv = -1;
  cin >> n;
  for(int i = 0; i < n; i++) {
    cin >> a >> v;
    if(v > mv) {
      ma = a;
      mv = v;
    } 
    else if(v == mv && ma > a) {
      ma = a;
    }
  }
  cout << ma << ' ' << mv << endl;
}

Measured memory_bytes: 1160
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <functional>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;


template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}

// swap(a,b);
// abs(a,b); a,bの型は問わない
// reverse(a+I,a+r); aは配列,a[i]からa[r-1]までを逆順にする.計算量はN. reverse(str.begin(),str.end());
// sortも上とあまり変わらない.
// ただし,sort(a,a+N,greater<int>());で大きい順にならべかえる.
// stack<int> a; 宣言 上に積み上げたものをとったり、一番上に積み上げる.
// a.push(x); aに要素xをつむ a.pop(); a.size(); a.empty(); これはtrue or false
// a.top;で一番上の要素を返す
// queue<int> a; a.front();
// priority_queue<int,vector<int>,greater<int>> Q1; 最も小さい奴を取り出す
// priority_queue<double,vector<double>,less<double>> Q2;最も大きい値を取り出す
// Q1.top();ができる
// count(a+l,a+r,x);
// find(a+l,a+r,x);
// 文字変換
//char a='a';
//a=a+1;
//cout<<a<<endl;

const long long INF = 1LL<<60;

int main(){
  int a,b,c;cin>>a>>b>>c;
  if(a!=b&&a!=c&&b!=c){
    cout<<"No"<<endl;
  }
  else if(a==b&&a==c){
    cout<<"No"<<endl;
  }
  else{
    cout<<"Yes"<<endl;
  }
}

Measured memory_bytes: 888
#include<stdio.h>

int month(int x){
	if(1<=x && x<=12)
		return 1;
	else
		return 0;
}

int main(){
	int s;
	scanf("%d",&s);
	/*aは上二桁、bは下二桁*/
	int a,b;
	a = s/100;
	b = s%100;
	if(month(a) && month(b))
		printf("AMBIGUOUS");
	else if(month(a) && month(b)==0)
		printf("MMYY");
	else if(month(a)==0 && month(b))
		printf("YYMM");
	else
		printf("NA");
	printf("\n");
	return 0;
}


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

using namespace std;

struct sushi_t {
  int d;
  int t;
  int prevIdx;
};

static int n, k;
static std::array<sushi_t, 100000> sushis{};

int64_t solve() {
  {
    std::vector<int> worstSushis(n, -1);
    for (int i = 0; i < n; ++i) {
      auto& s = sushis[i];
      s.prevIdx = worstSushis[s.t];
      worstSushis[s.t] = i;
    }
  }

  int64_t ret0 = 0;
  int64_t nn = 0;
  std::vector<int> replaceables{};
  int i = 0;
  for (; i < k; ++i) {
    const auto& s = sushis[i];
    ret0 += int64_t(s.d);
    if (s.prevIdx < 0) {
      nn++;
    } else {
      replaceables.push_back(i);
    }
  }
  int64_t ret = ret0 + nn * nn;
  std::vector<int> replacements{};
  for (; i < n; ++i) {
    const auto& s = sushis[i];
    if (s.prevIdx < 0) {
      replacements.push_back(i);
    }
  }

  int replaceableIdx = replaceables.size() - 1;
  int replacementIdx = 0;
  for (++nn;
       nn <= k && replaceableIdx >= 0 && replacementIdx < replacements.size();
       ++nn, --replaceableIdx, ++replacementIdx) {
    ret0 -= int64_t(sushis[replaceables[replaceableIdx]].d);
    ret0 += int64_t(sushis[replacements[replacementIdx]].d);
    if (ret0 + int64_t(k) * int64_t(k) <= ret) {
      break;
    }
    ret = std::max(ret0 + nn * nn, ret);
  }
  return ret;
}

int main() {
  std::cin.tie(nullptr);
  std::ios::sync_with_stdio(false);
  std::cin >> n >> k;
  for (int i = 0; i < n; ++i) {
    auto& s = sushis[i];
    std::cin >> s.t >> s.d;
    s.t--;
    s.prevIdx = -1;
  }
  std::sort(sushis.begin(), sushis.begin() + n,
            [](const auto& lhs, const auto& rhs) { return lhs.d > rhs.d; });
  std::cout << solve() << std::endl;
  return 0;
}

Measured memory_bytes: 1932
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>

using namespace std;

#define REP(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define pb(a) push_back(a)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

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

int main(){
  int x,a;
  cin >> x>> a;
  if(x<a){
    cout << 0 << endl;
  }else{
    cout << 10 << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <utility>
#include <cstring>
#include <algorithm>

using namespace std;

static const int INF = 1e9 + 7; 

int n, w;
vector<pair<int, int>> items;
int dp[100][10001];

int dfs(int no, int weight){
    if(w < weight) return -INF;
    if(no == n) return 0;
    if(~dp[no][weight]) return dp[no][weight];
    return dp[no][weight] = max(dfs(no + 1, weight), items[no].first + dfs(no + 1, weight + items[no].second));
}

int main(){
    cin >> n >> w;
    items.resize(n);
    for(auto&& i : items){
        cin >> i.first >> i.second;
    }
    memset(dp, -1, sizeof dp);
    cout << dfs(0, 0) << "\n";
}


Measured memory_bytes: 7028
#include <stdio.h>

int
main(int argc, char *argv[])
{
  int n, p[21000];
  scanf("%d", &n);
  int s = 30000, a[21000], b[21000];
  for (int i = 0; i < n; i++) {
    scanf("%d", &p[i]);
    a[i] = (i + 1) * s;
    b[i] = (n - i) * s;
  }
  for (int i = 0; i < n; i++) {
    b[p[i] - 1] += i;
  }
  for (int i = 0; i < n - 1; i++) {
    printf("%d ", a[i]);
  } printf("%d\n", a[n - 1]);
  for (int i = 0; i < n - 1; i++) {
    printf("%d ", b[i]);
  } printf("%d\n", b[n - 1]);
  
  return 0;
}
 
  
  


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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define _GLIBCXX_DEBUG

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vd = vector<double>;
using vvi = vector<vi>;
using vvll = vector<vll>;
using vvd = vector<vd>;
using vvvi = vector<vvi>;
using vvvll = vector<vvll>;
using vvvd = vector<vvd>;

const double pi=3.141592653589793;

int n;

int sft(string s){
    int b3=0,b5=0,b7=0;
    int num=s.size();
    rep(i,num){
        if (s.at(i)=='3'){
            b3=1;
        }
        if (s.at(i)=='5'){
            b5=1;
        }
        if (s.at(i)=='7'){
            b7=1;
        }
        
    }
  return b3*b5*b7;

}

void dfs(ll x , ll &c){
    //cout<<x<<endl;
    string y=to_string(x);
    if (x<=n){
        if (sft(y)==1){
            c+=1;
            //cout<<c<<endl;
            //cout<<x<<endl;
        }
        dfs(10*x+3,c);
        dfs(10*x+5,c);
        dfs(10*x+7,c);
    }
}

int main() {
    cin>>n;
    ll c=0;
    dfs(0,c);
    cout<<c<<endl;
    return 0;
}

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

int main() {
  string s;int p = 0;
  cin >> s;
  if((s.at(0) == s.at(1) && s.at(2) == s.at(3)) && s.at(0) == s.at(2)){
    p = 0;
  }
  else if(s.at(0) == s.at(1) && s.at(2) == s.at(3)){
    p = 1;
  }
  else if(s.at(0) == s.at(2) && s.at(1) == s.at(3)){
    p = 1;
  }
  else if(s.at(0) == s.at(3) && s.at(1) == s.at(2)){
    p = 1;
  }
  if(p == 0){
    cout << "No" << endl;
  }
  else{
    cout << "Yes" << endl;
  }
}


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

using namespace std;
int main()
{
	/* #ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
#endif*/
  int count_1 = 0;
	int count_2 = 0;
	int N, M;
	cin>>N;
	cin>>M;
	while(N>1)
	{
		count_1 = count_1 + (N-1);
		N--;
	}
	while(M>1)
	{
		count_2 = count_2 + (M-1);
		M--;
	}
	cout<<(count_1+count_2);
	return 0;

}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		String str=sc.nextLine();
		long k=sc.nextLong();
		long[] ranran=new long[100];
		char[] ctr=str.toCharArray();
		
		int j=0;
		try {
			while(ctr[j]=='1') {
				j++;
			}
		} catch (Exception e) {
			j--;
		}
		
		if(j>=k)System.out.println(1);
		else System.out.println(String.valueOf(ctr[j]));
	}
}


Measured memory_bytes: 23764
#include<bits/stdc++.h>
using namespace std;
int main(){
  int r,d,a;
  cin>>r>>d>>a;
  vector<long long>x(10);
  x[0]=a;
  for(int i=1;i<=10;i++){
    x[i]=x[i-1]*r-d;
    
  }

  for(int i=1;i<=10;i++){
    cout<<x[i]<<endl;
  }
  
}

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

int main(){
	int a,b,c;
	int flag = 0;
	
	cin >> a >> b >> c;
	for(int i = 1;i<=b;i++){
		if((i*a)%b==c) flag = 1;
	}
	if(flag) cout << "YES";
	else cout << "NO";
	cout << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
#include <cstring>

using namespace std;

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

int main(){
	int n;
	cin >> n;
	cout << (800 * n) - ((n / 15) * 200)<< endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ll int n,a,b,c,d,e;
    cin>>n>>a>>b>>c>>d>>e;
    
    ll int ans = min({a,b,c,d,e});
    cout<<(n-1)/ans + 5;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
const std::string ans[2] = { "No\n", "Yes\n" };
int main() {
    using namespace std;
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    long long sum=0LL;
    for(int i=0;i<n;i++){
        cin >> a[i];
        sum += a[i];
    }
    sort(a.rbegin(),a.rend());
    double border = sum*0.2500/(double)m;
    int selected = 0;
    for(int i=0; i<n; i++){
        if(border>a[i])break;
        selected=i+1;
    }

    cout << ans[selected>=m];
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
string S[50], T[50]; int n;
int main() {
	while (true) {
		cin >> n; if (n == 0)break;
		for (int i = 0; i < n; i++) {
			cin >> S[i]; T[i] = S[i][0];
			for (int j = 0; j < S[i].size() - 1; j++) {
				if (S[i][j] == 'a' || S[i][j] == 'i' || S[i][j] == 'u' || S[i][j] == 'e' || S[i][j] == 'o') {
					T[i] += S[i][j + 1];
				}
			}
		}
		sort(T, T + n); int maxn = 1 << 30;
		for (int i = 50; i >= 1; i--) {
			for (int j = 0; j < n - 1; j++) {
				string T1, T2;
				if (T[j].size() <= i)T1 = T[j];
				else {
					T1 = T[j].substr(0, i);
				}
				if (T[j + 1].size() <= i)T2 = T[j + 1];
				else { T2 = T[j + 1].substr(0, i); }
				if (T1 == T2) {
					goto E;
				}
			}
			maxn = i; E:;
		}
		if (maxn == 1 << 30)maxn = -1;
		cout << maxn << endl;
	}
	return 0;
}

Measured memory_bytes: 1236
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
#include <string>
#include <map>
using namespace std;


int main() {

    string S, T, U;
    int A, B;
    cin >> S >> T >> A >> B >> U;

    map<string, int> bowl;

    bowl[S] = A;
    bowl[T] = B;
    bowl[U]--;

    cout << bowl[S] << ' ' << bowl[T] << endl;


    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define deb(x) cout<< #x << " " << x << "\n";
#define MAX 9223372036854775807
#define MIN -9223372036854775807
#define PI 3.141592653589
#define setbits(n) __builtin_popcountll(n)
const int mod=1e9+7;

struct state {
    int len, link;
    map<char, int> next;
};

const int MAXLEN = 100000;
state st[MAXLEN * 2];
int sz, last;

void sa_init() {
    for(int i=0;i<sz;i++)
        st[i].next.clear();
    st[0].len = 0;
    st[0].link = -1;
    sz=1;
    last = 0;
}

void sa_extend(char c) {
    int cur = sz++;
    st[cur].len = st[last].len + 1;
    int p = last;
    while (p != -1 && !st[p].next.count(c)) {
        st[p].next[c] = cur;
        p = st[p].link;
    }
    if (p == -1) {
        st[cur].link = 0;
    } else {
        int q = st[p].next[c];
        if (st[p].len + 1 == st[q].len) {
            st[cur].link = q;
        } else {
            int clone = sz++;
            st[clone].len = st[p].len + 1;
            st[clone].next = st[q].next;
            st[clone].link = st[q].link;
            while (p != -1 && st[p].next[c] == q) {
                st[p].next[c] = clone;
                p = st[p].link;
            }
            st[q].link = st[cur].link = clone;
        }
    }
    last = cur;
}

/*-----------Distinct substrings--------*/
vector<ll> dp;
ll DistSub(ll u){
    if(dp[u]!=-1)
        return dp[u];
    ll ans=0;
    for(auto k: st[u].next)
        ans+=1+DistSub(k.second);
    return dp[u]=ans;
}
void CountDistinctSubstrings(){
    dp.assign(sz,-1);
    cout<<DistSub(0)<<"\n";
}
/*-----------Distinct substrings--------*/

/*-----------Lexicographically Kth substring--------*/
map<ll,string> lex;
ll k=0;
void lexk(ll u, string s){
    if(k>10) return;
    lex[k++]=s;
    for(auto p: st[u].next){
        lexk(p.second,s+p.first);
    }
}
void LexicographicallyKthSubstring(){
    lex.clear();
    lexk(0,"");
    //for(ll i=1;i<k;i++) cout<<lex[i]<<"\n";
}
/*-----------Lexicographically Kth substring--------*/

int main(){
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    ll t=1;
    //cin>>t;
    while(t--){
        string s;
        cin>>s;
        ll r; cin>>r;
        sa_init();
        for(ll i=0;i<s.size();i++)
            sa_extend(s[i]);
        //CountDistinctSubstrings();
        LexicographicallyKthSubstring();
        cout<<lex[r];
    }



    
    return 0;
}


Measured memory_bytes: 15124