akhauriyash/Code-Regression huggingface dataset:
#pragma warning(disable:4786)
#pragma warning(disable:4996)
#include<list>
#include<bitset>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<functional>
#include<string>
#include<cstring>
#include<cstdlib>
#include<queue>
#include<utility>
#include<fstream>
#include<sstream>
#include<cmath>
#include<stack>
#include<assert.h>
using namespace std;
 
#define MEM(a, b) memset(a, (b), sizeof(a))
#define CLR(a) memset(a, 0, sizeof(a))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define ABS(X) ( (X) > 0 ? (X) : ( -(X) ) )
#define S(X) ( (X) * (X) )
#define SZ(V) (int )V.size()
#define FORN(i, n) for(i = 0; i < n; i++)
#define FORAB(i, a, b) for(i = a; i <= b; i++)
#define ALL(V) V.begin(), V.end()
#define IN(A, B, C)  ((B) <= (A) && (A) <= (C))
 
typedef pair<int,int> PII;
typedef pair<double, double> PDD;
typedef vector<int> VI;
typedef vector<PII > VP;
 
#define AIN(A, B, C) assert(IN(A, B, C))
 
//typedef int LL;
typedef long long int LL;
//typedef __int64 LL;
 
LL N;
struct Line {
	int A, B, C;
	double val;
 
	double retCompute(double x) {
		return (-A * x + C) / B;
	}
} L[100005];
double eps = 1e-11;
 
bool operator<(Line P, Line Q) {
	return P.A * Q.B < P.B * Q.A;
}
 
int tree[100005];
 
//return cf[idx]
int read(int idx)
{
	int sum = 0;
 
	while (idx > 0)
	{
		sum += tree[idx];
		idx -= (idx & -idx);
	}
 
	return sum;
}
 
//add val to f[idx].
//MaxVal = Just max value of index
void update(int idx, int val)
{
	while (idx <= 100004)
	{
		tree[idx] += val;
		idx += (idx & -idx);
	}
}
 
// How many ints in the left side of X = x?
LL Count(double x) {
	LL total = 0;
 
	vector<pair<double, int>> V;
	for (int i = 0; i < N; i++) {
		double d = L[i].retCompute(x);
		V.push_back({ d, i });
	}
 
	sort(V.begin(), V.end());
	for (int i = N - 1; i >= 0; i--) {
		total += read(V[i].second + 1);
		update(V[i].second + 1, 1);
	}
	for (int i = 0; i < N; i++) {
		update(V[i].second + 1, -1);
	}
	return total;
}
 
double solve() {
	sort(L, L + N);
 
	double lo = -1e12;
	double hi = 1e12;
	LL total = (N)*(N - 1) / 2;
	LL at = (total + 1) / 2;
	for (int i = 1; i <= 80; i++) {
//		if (fabs(hi - lo) < eps) break;
//		if (fabs((hi - lo) / lo) < eps) break;
		double mid = (lo + hi) / 2;
		if (Count(mid) >= at) {
			hi = mid;
		}
		else {
			lo = mid;
		}
	}
	return (lo + hi) / 2;
}
 
int main()
{
	scanf("%lld", &N);
	for (int i = 0; i < N; i++) {
		scanf("%d %d %d", &L[i].A, &L[i].B, &L[i].C);
		if (L[i].B < 0) {
			L[i].A *= -1;
			L[i].B *= -1;
			L[i].C *= -1;
		}
	}
 
	double x = solve();
	for (int i = 0; i < N; i++) {
		swap(L[i].A, L[i].B);
		if (L[i].B < 0) {
			L[i].A *= -1;
			L[i].B *= -1;
			L[i].C *= -1;
		}
	}
	double y = solve();
 
	printf("%.17lf %.17lf\n", x, y);
	return 0;
}

Measured memory_bytes: 3184
#include <iostream>
#include <vector>
#define MAX 1000000
using namespace std;

int main(){
  //bool num[MAX];
  pair<bool,int> num[MAX];
  int input=0;
  while(cin >> input){
   int count=0;
  for(int i=2; i<MAX; i++){
    num[i].first=true;
    num[i].second=i;
  }
  for(int i=2;i<input+1;i++){
    if(num[i].first){
      //cout << num[i].second <<",";
      count++;
      for(int j=i+i; j<MAX; j+=i){
        num[j].first=false;
      }
    }
  }
  cout << count << endl;
  }
}

Measured memory_bytes: 8972
#include <cstdint>
#include <cstdio>
using namespace std;
#define rep(i, n) for (register uint_fast32_t i = 0; i < (n); ++i)
inline char tc() {
    static char fl[100], *A = fl, *B = fl;
    return A == B && (B = (A = fl) + fread(fl, 1, 100, stdin), A == B) ? EOF
                                                                       : *A++;
}
inline uint_fast32_t read() {
    uint_fast32_t a = 0;
    static char c;
    c = tc();
    while (c & 16) a = a * 10 + c - 48, c = tc();
    return a;
}
uint_fast32_t h[100001], n, a, b, left, right;
int_fast64_t temp, cnt, mid;
double a_;
int main() {
    n = read(), a = read(), b = read();
    a -= b;
    a_             = 1.0 / a;
    rep(i, n) h[i] = read() + a - 1;
    right          = 1000000000;
    while (right > left + 1) {
        mid = (right + left) >> 1;
        cnt = 0;
        rep(i, n) {
            temp = h[i] - b * mid;
            if (temp > 0) cnt += temp * a_;
        }
        if (cnt <= mid)
            right = mid;
        else
            left = mid;
    }
    printf("%u\n", right);
}


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

using namespace std;

#define TEMP_T template<typename T>
TEMP_T void sort(T& v){ sort(v.begin(), v.end()); }
TEMP_T void revs(T& v){ reverse(v.begin(), v.end()); }
TEMP_T void uniq(T& v){ sort(v); v.erase(unique(v.begin(), v.end())); }
TEMP_T T    cums(T& v){ T r(v.size()); partial_sum(v.begin(), v.end(), r); return r; }
TEMP_T void show(T& v, char delim=' ', char end='\n'){ for(int i=0; i<v.size()-1; i++) cout << v[i] << delim; cout << v[v.size()-1] << end; }
TEMP_T T    acum(vector<T>& v, T b=0){ return accumulate(v.begin(), v.end(), b); }
TEMP_T vector<T> inpt(int n){ vector<T> v(n); for (int i=0; i<n; i++) cin >> v[i]; return v; }

static inline int in(){ int x; scanf("%d", &x); return x; }

struct Solver {
  Solver(){}
  int solve(){
  }
};

int main()
{
  int a, b;
  while (a = in(), b = in(), a || b){
    int c = b - a;
    vector<int> cs;
    for (int i = 0; i < 3; i++){
      static const int ws[] = {1000, 500, 100};
      cs.push_back(c / ws[i]);
      c %= ws[i];
    }
    revs(cs);
    show(cs);
  }
  return (0);
}

Measured memory_bytes: 1224
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <cmath>
#include <set>
#include <map>
#include <functional>
#include <iomanip>
#include <bitset>

using namespace std;
#define     loop(n,i,a)     for(int i=a;i<n;i++)
#define     all(arr,n)      arr,arr+n
#define     allv(v)         (v).begin(),(v).end()
#define     rallv(v)        (v).rbegin(),(v).rend()
#define     m_p             make_pair
#define     ll              long long
#define     vi              vector<int>
#define     vll             vector<ll>
#define     sz(x)           (int)x.size()
#define     pb              push_back
int dx[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
int dy[] = { -1, 0, 1, -1, 1, -1, 0, 1 };

int main() {
	ll n,k;cin>>n>>k;
	vector<pair<int,int>>v;
	loop(n,i,0){
		int x,y;cin>>x>>y;
		v.pb({x,y});
	}
	sort(allv(v));
	ll cnt=0;
	for(auto x:v){
		cnt+=x.second;
		if(k<=cnt)return cout<<x.first<<endl,0;
	}
	return 0;
}



Measured memory_bytes: 1400
#include <iostream>
#include <math.h>
#include <string>
#include <string.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <stdlib.h>
#include <deque>  
#include <iomanip>

using namespace std;

using ll = long long;
#define INF 1e9
#define MOD 1e9 + 7
#define rep(i, n) for(int i = 0; i < n; i++)
#define loop(i, a, n) for(int i = a; i < n; i++)
#define all(in) in.begin(), in.end()
int main(){
    string S;
    cin >> S;
    int count = 0;

    int ans = 0;
    rep(i, S.size()){
        if(S[i]== 'A' || S[i]== 'C' || S[i]=='G' || S[i]=='T') count++;
        else ans = max(count, ans), count = 0;
    }
    ans = max(ans, count);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
from __future__ import division, print_function
import sys
if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip

import os, sys, bisect, copy
from collections import defaultdict, Counter, deque
#from functools import lru_cache   #use @lru_cache(None)
if os.path.exists('in.txt'): sys.stdin=open('in.txt','r')
if os.path.exists('out.txt'): sys.stdout=open('out.txt', 'w')
#
def input(): return sys.stdin.readline()
def mapi(arg=0): return map(int if arg==0 else str,input().split())
#------------------------------------------------------------------

s,w = mapi()
if w>=s:
    print("unsafe")
else:
    print("safe")


Measured memory_bytes: 68236
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int r,g,b,d;
    scanf("%d %d %d",&r,&g,&b);
    d=g*10+b;
    if(d%4==0)
    {
        printf("YES\n");
    }
    else
    {
        printf("NO\n");
    }



}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

    int count = 0;
    for(int i = 1; i <= N; i+=2){
        int eightCount = 0;
        for(int j = 1; j <= i; j++){
            if(i%j == 0) eightCount ++;
        }

        if(eightCount == 8) count ++;
    }

    cout << count << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <queue>
#include <string>
#include <map>
#include <cstring>
#include <ctime>
#include <vector>
#define inf 1e9
#define ll long long
#define For(i,j,k) for(int i=j;i<=k;i++)
#define Dow(i,j,k) for(int i=k;i>=j;i--)
using namespace std;
inline ll read(){   ll x=0,f=1;char ch=getchar();   while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}  while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}  return  x*f; }
inline void write(ll x){    if (x<0) putchar('-'),x=-x; if (x>=10) write(x/10);   putchar(x%10+'0');  }
inline void writeln(ll x){write(x);puts("");}
int cnt,poi[200001],nxt[200001],f[200001],F[200001],alr,siz[200001],dep[200001],n,x,y;
inline void add(int x,int y){poi[++cnt]=y;nxt[cnt]=f[x];f[x]=cnt;}
inline void dfs(int x,int fa)
{
	siz[x]=1;F[x]=fa;
	for(int i=f[x];i;i=nxt[i])
		if(poi[i]!=fa)		dep[poi[i]]=dep[x]+1,dfs(poi[i],x),siz[x]+=siz[poi[i]];
}
int main()
{
	n=read();
	For(i,1,n-1)	x=read(),y=read(),add(x,y),add(y,x);
	dep[1]=1;
	dfs(1,-1);
	int ne=(dep[n]-2)/2,alr=0,p=n;
	while(1)
	{
		if(alr==ne)	break;
		alr++;p=F[p];
	}
	if(siz[1]-siz[p]>siz[p])	puts("Fennec");else puts("Snuke");
}

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

#define cc(x) cout << (x) << endl
#define rep(i,n) for(int i = 0; i < int(n); i++)
#define repi(i,a,b) for(int i = int(a); i < int(b); ++i)
typedef long long ll;

template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }

const ll inf = 1LL<<58;
const int iinf = 1<<30;

int main(){
    ll n;
    ll t[5];
    cin >> n >> t[0] >> t[1] >> t[2] >> t[3] >> t[4];
    ll time=0;
    int end=0;
    ll p[6];
    p[0] = n;p[1]=0;p[2]=0;p[3]=0;p[4]=0;p[5]=0;
    ll tmp=inf;
    amin(tmp,t[0]);
    amin(tmp,t[1]);
    amin(tmp,t[2]);
    amin(tmp,t[3]);
    amin(tmp,t[4]);
    if(n%tmp!=0){
        cc(n/tmp+5);
    }else{
        cc(n/tmp+4);
    }
    
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int sum = 0;
		int div = 0;
		for (int i = 0; i < 5; i++) {
			int input = sc.nextInt();
			if (input % 10 == 0) {
				sum += input;
			} else {
				int nowdiv = input % 10;
				sum += input - nowdiv + 10;
				if (div == 0) {
					div = nowdiv;
				} else {
					if (div > nowdiv) {
						div = nowdiv;
					}
				}
			}
		}
		if(div == 0) {
			System.out.println(sum);
		}else {
			System.out.println(sum + div - 10);
		}
		sc.close();
	}
}


Measured memory_bytes: 21972
#arc083c

a,b,c,d,e,f=map(int,raw_input().split())
x=1
y=-1
for i in xrange(0,f+1,100*a):
 for j in xrange(0,f+1-i,100*b):
  s=min(f-i-j,(i+j)*e//100)
  if i+j==0:
   continue
  for k in xrange(0,s+1,c):
   for l in xrange(0,s+1-k,d):
    if 1.0*y/x<1.0*(k+l)/(i+j):
     x=i+j
     y=k+l
print x+y,y


Measured memory_bytes: 2568
#include <cstdio>
#include <cstring>

const long long mod=1000000007ll;

int main()
{
  int n;
  scanf("%d",&n);
  char s[5001];
  scanf("%s",s);
  int m=strlen(s);
  static long long dp2[5001][5001]={0};
  dp2[0][0]=1;
  for(int i=0;i<n;i++){
    for(int j=0;j<=i;j++){
      dp2[i+1][j+1]+=2*dp2[i][j]%mod;
      dp2[i+1][j+1]%=mod;
      if(j>0){
	dp2[i+1][j-1]+=dp2[i][j];
	dp2[i+1][j-1]%=mod;
      }
      else{
	dp2[i+1][0]+=dp2[i][j];
	dp2[i+1][0]%=mod;
      }
    }
  }
  long long A=dp2[n][m];
  for(int i=0;i<m;i++){
    A*=(mod+1)/2;
    A%=mod;
  }
  printf("%lld\n",A);
  return 0;
}


Measured memory_bytes: 116864
a,b,c,d,e=input().split()
a=int(a)
b=int(b)
c=int(c)
d=int(d)
e=int(e)
if a==0:
  print("1")
if b==0:
  print("2")
if c==0:
  print("3")
if d==0:
  print("4")
if e==0:
  print("5")

Measured memory_bytes: 9040
#include <iostream>

using namespace std;

void solve()
{
	int n;
	while(cin >> n)
	{
		if(n >= 37)
		{
			cout << 0 << endl;
		}
		else
		{
			int count = 0;
			for(int i = 0; i < 10; ++i)
			{
				for(int j = 0; j < 10; ++j)
				{
					for(int k = 0; k < 10; ++k)
					{
						for(int l = 0; l < 10; ++l)
						{
							if(i + j + k + l == n)
							{
								++count;
							}
						}
					}
				}
			}
			cout << count << endl;
		}
	}
}

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

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <cmath>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>
#define mop 1000000007

using namespace std;

map<long,long> res;
void prime_factor(int n){
    for  (long i=2;i*i<=n;i++){
        while (n%i == 0){
            ++ res[i];
            n /= i;
        }
    }
    if(n!=1){
        res[n] += 1;
    }

}

int main() {
    
    int n;
    cin >> n;
    for (int i=1;i<=n;i++){
        prime_factor(i);
    }
    vector <long long> v;
    for (auto itr = res.begin();itr!=res.end();itr++){
        v.push_back(itr->second);
    }
    long long num2 = 0;
    long long num4 = 0;
    long long num14 = 0;
    long long num24 = 0;
    long long num74 = 0;
    for (long long i=0;i<v.size();i++){
        if(v[i] >= 2){
            num2 += 1;
        }if(v[i] >= 4){
            num4 += 1;
        }if(v[i] >= 14){
            num14 += 1;
        }if(v[i] >= 24){
            num24 += 1;
        }if(v[i] >= 74){
            num74 += 1;
        }
    }
    long long ans = 0;
    ans += num4 * (num4-1) *(num2 -2) / 2;
    ans += num14 * (num4-1);
    ans += num24 * (num2 -1);
    ans += num74;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>

int h, *A;

void maxHeapify(i)
{
    int l = 2*i;
    int r = 2*i+1;
    int largest;
    int swap;
    if (l <= h && A[l] > A[i]) largest = l;
    else largest = i;
    if (r <= h && A[r] > A[largest]) largest = r;
    if (largest != i)
    {
        swap = A[i];
        A[i] = A[largest];
        A[largest] = swap;
        maxHeapify(largest);
    }
}

void buildMaxHeap()
{
    for(int i=h/2; i>=1; i--) maxHeapify(i);
}

int main()
{
    //input
    scanf("%d", &h);
    A = ( int*)malloc(sizeof(int)* h+1);
    for(int i = 1; i<h+1; i++ ) scanf("%d", &A[i]);
    buildMaxHeap();
    //output
    for(int i = 1; i<h+1; i++ )
    {
        printf(" %d", A[i]);
    }
    printf("\n");
    return 0;
}


Measured memory_bytes: 3660
/*ex6_2
  TKC001*/

#include<stdio.h>
#include<string.h>

int main(void){
    int len;
    char str[101];

    //入力
    scanf("%s", str);

    //文字列の長さ
    len = strlen(str);

    //真ん中の数字は文字列の長さ-2で、左の文字は先頭の文字、右の文字は最後の文字なので
    //出力はstr[0]len-2str[len-1]になる。
    printf("%c%d%c", str[0], len-2, str[len-1]);

    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define INF LLONG_MAX
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;


int main()
{
    double w, h, x, y; cin >> w >> h >> x >> y;
    cout << w * h / 2 << " ";
    if (w / 2 == x && h / 2 == y) cout << 1 << endl;
    else cout << 0 << endl;
    return 0;
}

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

int main()
{
  int H , W ;
  string s ;
  
  cin >> H >> W ;
  
  for(int i=0; i<H; i++)
  {
    cin >> s ;
    
    cout << s << endl ;
    cout << s << endl ;
  }
}

Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,k;
    cin >> n >> k;
    string s;
    cin >> s;
    vint zero;
    vint one;
    int id = 0;
    while(id<n){
        int tz = 0;
        while(id<n&&s[id]=='0'){
            tz++;
            id++;
        }
        zero.pb(tz);
        int to = 0;
        while(id<n&&s[id]=='1'){
            to++;
            id++;
        }
        one.pb(to);
    }
    int ans = 0;
    int sum = 0;
    int p = min(k,(int)zero.size());
    REP(i,p){
        sum+=zero[i];
        sum+=one[i];
    }
    ans = sum;
    for(int i=p;i<(int)zero.size();++i){
        int fz = i-k;
        int fo = i-k-1;
        if(fz>=0){
            sum-=zero[fz];
        }
        if(fo>=0){
            sum-=one[fo];
        }
        sum+=zero[i]+one[i];
        ans=max(ans,sum);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s; cin >> s;
    if(s.back() == '1') {
        cout << "-1" << endl;
        return 0;
    }
    bool ok = false;
    rep(i, s.length()) if(s[i] == '1') ok = true;
    if(!ok) {cout << "-1" << endl; return 0;}
    int n = s.length() - 1;
    rep(i, n / 2) {
        if (s[i] != s[n - i - 1]) {
            cout << "-1" << endl;
            return 0;
        }
    }
    int l = 1, r = 2;
    rep(i, n) {
        if(s[i] == '1') {
            cout << l << " " << r << endl;
            l = r;
            r++;
        } else {
            cout << l << " " << r << endl;
            r++;
        }
    }


    return 0;
}


Measured memory_bytes: 1616
#include<iostream>

using namespace std;
   
void Loan()
{
    int m;
    int sum = 100000;
    int week;
    
    cin>>week;
    
    for(int i=0; i<week; i++)
    {
        sum = sum * 1.05;
        
        m = sum % 1000;
        
        if(m > 0)
        {
            sum = sum - m + 1000; 
        }
        
    }
    
   cout<<sum<<endl;
   return;
}
     
int main()
{     
    Loan();
    return 0;
}

Measured memory_bytes: 1164
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int INF = 1LL << 30;
int MOD = 1e9+7;
main(){
    int N,X;
    cin >> N >> X;
    int mini = INF,cnt = 0;
    for(int i = 0;i < N;i++){
        int a;
        cin >> a;
        cnt++;
        X -= a;
        mini = min(mini,a);
    }
    cnt += X / mini;
    cout << cnt << endl;
}

Measured memory_bytes: 256
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<pii> vpii;
typedef vector<vi> vvi;
typedef vector<vb> vvb;
typedef vector<vpii> vvpii;
const int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
const int MOD = 1000000007;
const double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
bool odd(const int &n) { return n & 1; }
bool even(const int &n) { return !odd(n); }
void solve();
main { solve(); return 0; }
// clang-format on

void solve() {
  int n;
  while (cin >> n, n != -1) {
    string s = "";
    if (!n) {
      cout << 0 << endl;
      continue;
    }
    while (n) {
      s = string(1, '0' + n % 4) + s;
      n /= 4;
    }
    cout << s << endl;
  }
}

Measured memory_bytes: 3060
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <sstream>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef vector <int> vi;
typedef vector <vector <int>> vii;
typedef vector <long long> vll;
typedef vector <string> vs;
typedef vector <char> vc;
typedef set <int> si;
typedef set <string> ss;
typedef queue <int> qi;
typedef queue <long long> qll;
typedef queue <string> qs;
typedef queue <char> qc;
typedef struct board board;
typedef pair <int, int> pi;
typedef pair <long long, long long> pll;
typedef pair <int, pair<int, int>> pii;

#define eb emplace_back
#define ppb pop_back
#define clr(a) a.clear()
#define F first
#define S second
#define mkp make_pair

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

#define left(x) x * 2
#define right(x) x * 2 + 1

#define meme(a, b, c) fill(a + 1, a + 1 + b, c)

#define max(a, b) (a > b ? a : b)
#define min(a, b) (a > b ? b : a)
#define abs(a) (a > 0? a : -(a))

#define move(s) s += "#"

#define fr(i, a, b) for (ll i = a; i <= b; ++ i)
#define rf(i, a, b) for (ll i = a; i >= b; -- i)

#define eprintf(...) fprintf(stderr, __VA_ARGS__);

void to_pray() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cerr << "Ready\n";
}

const int N = 4e6 + 10;
const int NN = 1e3 + 10;
const int NNN = 2e3 + 9;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const ll LLINF = 1e12 + 7;
const ll P = 53;
const int EPS = 1e-9 - 8;
const int vN = 2e4 + 10;
const int sz = (1 << 22) - 1;
const double PI = acos(-1);

int main () {
    to_pray();

	int a, b, T;
	cin >> a >> b >> T;
	
	int sum = 0;
	
	for (int i = a; i <= T; i += a)
		sum += b;
		
	cout << sum;
    
    cout << '\n';
    return 0;
}

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

#define rep(i,m,n) for(int (i)=(int)(m);i<(int)(n);i++)
#define rep2(i,m,n) for(int (i)=(int)(n)-1;i>=(int)(m);i--)
#define REP(i,n) rep(i,0,n)
#define REP2(i,n) rep2(i,0,n)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define all(hoge) (hoge).begin(),(hoge).end()
#define en '\n'
using ll = long long;
using ull = unsigned long long;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = (ll) 1e9 + 7;
//constexpr long long MOD = 998244353LL;
typedef vector<ll> Array;
typedef vector<Array> Matrix;


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

struct Edge {
	ll to, cap, rev;
	Edge(ll _to, ll _cap, ll _rev) {
	to = _to; cap = _cap; rev = _rev;
	}
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;

void add_edge(Graph& G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}


void solve(){
    string s,t;
    cin>>s>>t;
    ll n=s.size();
    if(s==t.substr(0,n)) cout<<"Yes"<<en;
    else cout<<"No"<<en;
}

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

    solve();
    //ll t;cin>>t;REP(i,t) solve();

    return 0;
}

Measured memory_bytes: 3652
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

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

		List<Integer> absList = new ArrayList<Integer>();
		absList.add(Math.abs(a1 - a2));
		absList.add(Math.abs(a2 - a3));
		absList.add(Math.abs(a3 - a1));
		Collections.sort(absList);

		System.out.println(absList.get(0) + absList.get(1));

		sc.close();
	}
}

Measured memory_bytes: 23380
using System;
    class Program
    {
    	static void Main(string[] args)
    	{
    		// スペース区切りの整数の入力
    		string[] input = Console.ReadLine().Split(' ');
    		int value = int.Parse(input[0]) + int.Parse(input[1]);

    		//出力
    		Console.WriteLine(24 <=  value ? value - 24 : value);
    	}
    }

Measured memory_bytes: 11092
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<cmath>
#include<cstring>
#include<cctype>
#include<complex>
#include<iostream>
#include<sstream>
#include<algorithm>
#include<functional>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<bitset>
#include<numeric>
using namespace std;
const int dx[]={1,0,-1,0};
const int dy[]={0,1,0,-1};
#define INF 1e+8
#define EPS 1e-7
#define PB push_back
#define fi first
#define se second
#define ll long long
#define reps(i,j,k) for(int i = (j); i < (k); i++)
#define rep(i,j) reps(i,0,j)
typedef pair<int,int> Pii;
typedef vector<int> vi;
int main(){
	ll dp[10][10000]={{0}};
	dp[0][0] = 1;
	rep(i,101){
		for(int j = 1000; j >= i; j--){
			for(int k = 9; k > 0; k--){
				dp[k][j] += dp[k-1][j-i];
			}
		}
	}
	int n,s;
	while(scanf("%d%d",&n,&s),(n|s)){
		printf("%lld\n",dp[n][s]);
	}
	return 0;
}

Measured memory_bytes: 1976
def main():
    import sys
    readline = sys.stdin.buffer.readline
    sys.setrecursionlimit(10 ** 7)

    from itertools import product

    h, w, k = map(int, readline().split())
    c = [readline().rstrip().decode() for _ in range(h)]
    cnt = 0
    for bit_y in product([0, 1], repeat=h):
        for bit_x in product([0, 1], repeat=w):
            memo = 0
            for i, cc in enumerate(c):
                if bit_y[i] == 1:
                    continue
                for j, dc in enumerate(cc):
                    if dc == '#' and bit_x[j] == 0:
                        memo += 1
            if memo == k:
                cnt += 1
    print(cnt)


if __name__ == '__main__':
    main()


Measured memory_bytes: 74032
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n, k;
    cin >> n >> k;
    long long mod = 1e9 + 7;
    vector<long long>v(n + 5);
    for(int i = 1; i <= n; i++){
        cin >> v[i];
    }
    long long dp[n + 5][k + 5], cum[n + 5][k + 5];
    //sort(v.begin() + 1, v.begin() + n + 1);
    dp[1][0] = 1, cum[1][0] = 1;
    for(int i = 1; i <= v[1]; i++){
        dp[1][i] = 1;
        cum[1][i] = (cum[1][i - 1] + dp[1][i]) % mod;
    }
    for(int i = v[1] + 1; i <= k; i++){
        dp[1][i] = 0;
        cum[1][i] = cum[1][i - 1];
    }
    for(int i = 2; i <= n; i++){
        for(int j = 0; j <= v[i]; j++){
            dp[i][j] = cum[i - 1][j];
            if(j == 0){
                cum[i][j] = dp[i][j];
            }
            else{
                cum[i][j] = (cum[i][j - 1] + dp[i][j])%mod;
            }
        }
        for(int j = v[i] + 1; j <= k; j++){
            dp[i][j] = (cum[i - 1][j] - cum[i - 1][j - v[i] - 1] + 2*mod) % mod;
            cum[i][j] = (cum[i][j - 1] + dp[i][j]) % mod;
        }
    }
    cout << dp[n][k];
    return 0;
}

Measured memory_bytes: 159860
N, C, K = map(int, input().split(' '))
T = [int(input()) for _ in range(N)]
T.sort()
ans = 1
bus_cap = 1
last_time = T[0]
for t in T[1:]:
    if bus_cap + 1 > C or t - last_time > K:
        ans += 1
        bus_cap = 1
        last_time = t
    else:
        bus_cap += 1
print(ans)

Measured memory_bytes: 51032
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define inf (ll)(1e18)
#define mod 1000000007

int main()
{
    int t=1;
    //cin>>t;

    while( t-- )
    {
        int n;
        cin>>n;

        ll dp[n+1];

        if( n<3 )
        {
            cout<<0;
            return 0;
        }
        if ( n<=5 )
        {
            cout<<1;
            return 0;
        }

        dp[0]=0;
        dp[1]=0;
        dp[2]=0;

        dp[3]=dp[4]=dp[5]=1;

        for( int i=6 ; i<=n ; i++ )
        {
            ll ans=0;
            for( int j=3 ; j<=i ; j++ )
            {
                ans=( ans+dp[i-j] )%mod;
            }

            dp[i]=(ans+1)%mod;
        }

        cout<<dp[n];
    }
    return 0;
}












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

typedef long long ll;
const ll INF = 1LL<<60, MOD = 1e9 + 7;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;
const ll dx[] = {1,0,-1,0};
const ll dy[] = {0,1,0,-1};
#define REP(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define all(v) (v).begin(), (v).end()
#define m_p make_pair

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll n,ans;
    cin >> n;
    if(n%2==0){
        ans = n/2-1;
    }else{
        ans = n/2;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
s = int(input())
a =[s]
i = 0
while True:
    i += 1
    if a[i-1] % 2 == 0:
        if (a[i-1]//2) in a:
            print(len(a)+1)
            break
        else:
            a.append(a[i-1]//2)
    elif a[i-1] % 2 == 1:
        if (a[i-1]*3+1) in a:
            print(len(a)+1)
            break
        else:
            a.append(a[i-1]*3+1)

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

int main(){
  int N,Y,total;
  int sen = -1, gosen = -1, man = -1;
  bool judge = false;
  cin >> N >> Y;
  
  for(int i = 0; i <= N; i++){
    for(int j = 0; i + j <= N; j++){
      total = i*1000 + j*5000 + (N-i-j)*10000;
      if(total == Y){
        judge = true;
        sen = i;
        gosen = j;
        man = N-i-j;
      }
    if(judge) break;
    }
  if(judge) break;
  }
    cout << man << " " << gosen << " " << sen << endl;
}

Measured memory_bytes: 256
#include<string>
#include<iostream>
#include<algorithm>
#include<set>
using namespace std;
int main(){
  set<string> s;
  int n;
  cin >> n;
  while(n--){
    string a,b;
    cin >> a >> b;
    if(a=="insert") s.insert(b);
    else cout << (s.find(b)!=s.end()?"yes":"no") << endl;
  }
}



Measured memory_bytes: 32160
#include <iostream>
#include <string>

using namespace std;

int main(){
  string str;
  int sum = 0;
  cin >> str;
  for(const auto& e : str){
    sum += e - '0';
  }
  cout << ((sum % 9) ? "No" : "Yes") << endl;
  return 0;
}

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

int main(int argc, char const *argv[])
{
	ios::sync_with_stdio(false);
	int n,k;
	while(cin>>n>>k){
		if(n%k==0) cout<<0<<endl;
		else cout<<1<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int a[] = new int[N];
		for (int i=0;i<N;i++) {
			a[i] = sc.nextInt();
		}
		Arrays.parallelSort(a);
		System.out.println(a[N-1]-a[0]);
	}
}

Measured memory_bytes: 35504
#include <iostream>
#include <deque>
#include <stdio.h>
using namespace std;

int main()
{
    int n;
    cin >> n;
    deque <long long> arr;
    while (n--) {
        int q, d;
        scanf("%d", &q);
        if (q == 0) {
            scanf("%d", &d);
            long long x;
            scanf("%lld", &x);
            if (d == 0) {//begin
                arr.push_front(x);
            }
            else {//end
                arr.push_back(x);
            }
        }
        else if (q == 1) {
            int p;
            scanf("%d", &p);
            printf("%lld\n", arr[p]);
        }
        else {
            scanf("%d", &d);
            if (d == 0) {//begin
                arr.pop_front();
            }
            else {//end
                arr.pop_back();
            }
        }
    }
}



Measured memory_bytes: 6276
#include <iostream>
#include <iomanip>
#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>

#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, n) for (int i = 1; i <= (n); i++)
#define repi(i, a, b) for (int i = (a); i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ull << (b))

using namespace std;
using i32 = long long;
using u32 = unsigned long long;
using i64 = long long;
using u64 = unsigned long long;
using f64 = double;
using vi32 = vector<i32>;
using vu32 = vector<u32>;
using vi64 = vector<i64>;
using vu64 = vector<u64>;
using vf64 = vector<f64>;
using vstr = vector<string>;
using vvi32 = vector<vi32>;
using vvu32 = vector<vu32>;
using vvi64 = vector<vi64>;
using vvu64 = vector<vu64>;
using vvf64 = vector<vf64>;

template<typename T, typename S> void amax(T &x, S y) { if (x < y) x = y; }
template<typename T, typename S> void amin(T &x, S y) { if (y < x) x = y; }

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(16);
  int n, q;
  string s;
  cin >> n >> q;
  cin >> s;
  vi32 sums(n + 1, 0);
  rep(i, n - 1) {
    if (s.substr(i, 2) == "AC") sums[i + 2] = sums[i + 1] + 1;
    else sums[i + 2] = sums[i + 1];
  }
  rep(_, q) {
    int l, r;
    cin >> l >> r;
    cout << sums[r] - sums[l] << endl;
  }
  return 0; 
}


Measured memory_bytes: 1872
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000
#define MOD 10000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

//配列の要素を順番に出力
void trace(int A[], int N){
    int i;
    for(i=0; i<N; i++){
        if(i>0) printf(" "); //隣接する要素の間に1つの空白を出力
        printf("%d", A[i]);
    }
    printf("\n");
}

//挿入ソート（０オリジン配列）
void insertionSort(int A[], int N){
    int j,i,v;
    for(i=1; i<N; i++){
        v = A[i];
        j = i-1;
        while( j >= 0 && A[j] > v){
            A[j+1] = A[j];
            j--;
        }
        A[j+1] = v;
        trace(A, N);
    }
}

int main() {
    int N, i, j;
    int A[100];

    scanf("%d", &N);
    for(i=0; i<N; i++) scanf("%d", &A[i]);

    trace(A, N);
    insertionSort(A, N);

    return 0;

}


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

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef pair<ii, int> ri3;
#define mp make_pair
#define pb push_back
#define fi first
#define sc second
#define SZ(x) (int)(x).size()
#define ALL(x) begin(x), end(x) 
#define REP(i, n) for (int i = 0; i < n; ++i) 
#define FOR(i, a, b) for (int i = a; i <= b; ++i)
#define RFOR(i, a, b) for (int i = a; i >= b; --i)

const int MX_N = 105;
const int MX_M = 105;

int N, M;
int B[MX_N][MX_M], C[MX_M][MX_N];

vector<int> al[2*MX_N];

struct graph {
    vector<int> al[2*MX_N];
    bool vis[2*MX_N];
    int match[2*MX_N];
    void reset() {
        FOR(i,1,2*N) al[i].clear();
    }
    int aug(int u) {
        if (vis[u]) return 0;
        vis[u] = 1;
        for (int v : al[u]) if (match[v] == -1 || aug(match[v])) {
            match[u] = v;
            match[v] = u;
            return 1;
        }
        return 0;
    }
    int mcbm() {
        memset(match,-1,sizeof match);
        int res = 0;
        FOR(i,1,N) if (match[i] == -1) {
            memset(vis,0,sizeof vis);
            res += aug(i);
        }
        return res;
    }
} g;

int main() {
    //freopen("in.txt", "r", stdin);
    ios::sync_with_stdio(false);
    cin.tie(0);

    cin >> N >> M;
    FOR(i,1,N){
        FOR(j,1,M){
            cin >> B[i][j];
        }
    }

    FOR(c,1,M){
        g.reset();
        FOR(i,1,N){
            FOR(j,c,M){
                int r = (B[i][j]+M-1)/M;
                g.al[r+N].push_back(i);
                g.al[i].push_back(r+N);
            }
        }
        assert(g.mcbm() == N);
        FOR(i,1,N){
            int r = g.match[i]-N;
            FOR(j,c,M) {
                if ((B[i][j]+M-1)/M == r) { swap(B[i][j],B[i][c]); break; }
            }
        }
        //FOR(i,1,N){
        //    cout << B[i][c] << ' ';
        //} cout << endl;
    }

    FOR(i,1,N){
        FOR(j,1,M){
            cout << B[i][j] << (j==M?'\n':' ');
            C[j][i] = B[i][j];
        }
    }

    FOR(j,1,M){
        sort(C[j]+1,C[j]+1+N);
    }

    FOR(i,1,N){
        FOR(j,1,M){
            cout << C[j][i] << (j==M?'\n':' ');
        }
    }
}



Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr_inv(i,a,b) for(int i=(int)(a);i>=(int)(b);i--)
#define rep(i,n) repr(i,0,n)
#define INF INT_MAX
#define INFLL _I64_MAX
#define MOD 1000000007
#define PI 3.1415926535
using namespace std;
int main(void)
{
	int n, ans=0;

	cin>>n;

	vector<int> a(n); 

	rep(i, n) cin>>a[i];

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

	int i=0, count=1;
	while(i<n-1){
		if(a[i]==a[i+1]){
			count++;
		}else{
			ans+=count%2;
			count=1;
		}
		i++;
	}
	ans+=count%2;
	cout<<ans<<endl;
}

Measured memory_bytes: 640
/*
  AUTHOR:SOURABH
  CREATED:19:09:20
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define ordered_set tree<ll , null_type, less< ll >, rb_tree_tag, tree_order_statistics_node_update>
#define ll long long int
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pob pop_back
#define W while
#define fn(i,x) for(i=0;i<x;i++)
#define fs(i,s,x) for(i=s;i<x;i++)
#define fr(i,x) for(i=x;i>=0;i--)
#define fit(it,s) for(it=s.begin();it!=s.end();it++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define mii map<int,int>
#define mll map<ll,ll>
#define mod 1000000007
#define MAXN 10000001
#define M 32

using namespace std;
using namespace __gnu_pbds;

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

    //freopen("input.txt","r",stdin);
    //freopen("out.txt","w",stdout);

    ll t,i,n;
    t=1;
    //cin>>t;
    W(t--)
    {
        cin>>n;
        vector<pll> a(n);
        fn(i,n)
        {
            cin>>a[i].fi>>a[i].se;
        }
        fn(i,n-2)
        {
            if(a[i].fi==a[i].se && a[i+1].fi==a[i+1].se && a[i+2].fi==a[i+2].se)
            {cout<<"Yes";return 0;}
        }
        cout<<"No";
    }
}







Measured memory_bytes: 3644
#include <iostream>

using namespace std;

int main()
{
    long int n;
    cin>>n;
    long int a[n+1];
    long int minn;

    long int dem=0;
    cin>>a[1];
    minn=a[1];
    for(long int i=2;i<=n;i++)
    {
        cin>>a[i];
        if(a[i]>minn)
        {
            dem++;
        }
        else
        {
            minn=a[i];
        }
    }
    cout<<n-dem;

}


Measured memory_bytes: 1792
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<stack>
using namespace std;
int main(){
    stack<int> s;
    int a,tra[11]={0},i=0;
    while(cin>>a){
        if(a==0){
            cout<<s.top()<<endl;
            s.pop();
        }else{
            s.push(a);
        }
    }
}

Measured memory_bytes: 1200
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <tuple>
#include <vector>

using namespace std;
typedef long long int ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;

#define INF (1e9)

int N, M;

int main() {
    cin >> N >> M;
    ll MOD = 1000000007;

    vi A(N);
    for (int i = 0; i < M; i++) {
        cin >> A[i];
    }

    vi B(N + 1);
    int j = 0;

    B[0] = 1;
    if (A[0] == 1) {
        j++;
    } else {
        B[1] = 1;
    }

    for (int i = 2; i < N + 1; i++) {
        if (A[j] == i) {
            j++;
        } else {
            B[i] = B[i - 1] + B[i - 2];
            B[i] %= MOD;
        }
    }

    cout << B[N] << endl;
    return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pi 3.141592653589793238
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pb push_back
#define bg begin()
#define end end()
#define sz size()
#define vi vector<int>
#define vl vector<long long int>
int main(){
	fast;
	ll x,y;
	cin>>x>>y;
	if(x==2||y==2)
	{
		cout<<"No";
		return 0;
	}
	if(x==1||x==3||x==5||x==7||x==8||x==10||x==12)
		if(y==1||y==3||y==5||y==7||y==8||y==10||y==12)
			{
				cout<<"Yes";
				return 0;
			}
		else
		{
		cout<<"No";
		return 0;
		}
	else
		if(y==4||y==6||y==9||y==11)
			{
				cout<<"Yes";
				return 0;
			}
		else
		{
		cout<<"No";
		return 0;
		}
		
	return 0;
}



Measured memory_bytes: 3544
#include <iostream>
#include <string>
#include <string.h>
#include <map>
#include <set>
#include <vector>
#include <stdio.h>
#include <math.h>
#include <algorithm>
#include <queue>
#include <cmath>
#include <cstdio>
using namespace std;
int n;
string s;
int e[300010],w[300010];
int em,wm,ans=12345678;
int main(){
cin>>n>>s;
for(int i=0;i<n;i++)
{
 if(s[i]=='E'){
  em++;
  e[i]=em;
  w[i]=w[i-1];
 }
 else{
  wm++;
  w[i]=wm;
  e[i]=e[i-1];
 }
}
for(int i=0;i<n;i++){
if(i!=0){
 ans=min(ans,w[i-1]+em-e[i]);
 }
else{
 ans=min(ans,em-e[i]);
 }
}
cout<<ans;
system("pause");
return 0;
}

Measured memory_bytes: 3204
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
using namespace std;
typedef long long ll;
int main() {
	int n, m, k;
	cin >> n >> m >> k;
	for (int i = 0; i <= n; i++) {
		for (int j = 0; j <= m; j++) {
			if (i*m + j * n - i * j * 2 == k) {
				cout << "Yes" << endl;
				getchar();
				getchar();
				return 0;
			}
		}
	}
	cout << "No" << endl;
	getchar();
	getchar();
	return 0;
}

Measured memory_bytes: 764
#include<stdio.h>

int main(void){
    int i, j, temp, mountain[10];

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

    for(i=0; i<10; i++){
        for(j=i+1; j<10; j++){
            if(mountain[i] < mountain[j]){
                temp = mountain[j];
                mountain[j] = mountain[i];
                mountain[i] = temp;
            }
        }
    }

    for(i=0; i<3; i++){
        printf("%d\n", mountain[i]);
    }


    return 0;
}

Measured memory_bytes: 600
import itertools
import math
N = int(input())
AB = [[0] * 2  for i in range(N)]
P = list()
ans = 0
for i in range(1,N+1):
    P.append(i)
for j in range(N):
    A,B = map( int ,input().split())
    AB[j][0] = A
    AB[j][1] = B
#print(AB)
for list in itertools.permutations(P, N):
    for l in range(len(list)-1):
            dic=math.sqrt((AB[list[l+1]-1][0]-AB[list[l]-1][0])**2+(AB[list[l+1]-1][1]-AB[list[l]-1][1])**2)
            ans += dic/math.factorial(N)
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <cmath>
#include <iomanip>
#include <set>

using namespace std;

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

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

  int ans = 0;
  for (int a = 1; a <= k; a++) {
    for (int b = 1; b <= k; b++) {
      for (int c = 1; c <= k; c++) {
        ans += gcd(a, gcd(b, c));
      }
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 3152
#include <iostream>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>

using namespace std;

int main() {
    string s;
    cin >> s;
    
    int l = stoi(s.substr(0, 2));
    int r = stoi(s.substr(2, 2));

    if (0 < l && l <= 12 && 0 < r && r <= 12) {
        cout << "AMBIGUOUS" << endl;
    } else if (0 < l && l <= 12) {
        cout << "MMYY" << endl;
    } else if (0 < r && r <= 12) {
        cout << "YYMM" << endl;
    } else {
        cout << "NA" << endl;
    }

}


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

int main() {
  int n;
  cin >> n;
  vector<long long>data(n+1);
  data.at(0) = 2;
  data.at(1) = 1;
  for(int i = 2;i <= n;i++){
    data.at(i) += data.at(i-2)+data.at(i-1);
  }
  cout << data.at(n) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//#define _GLIBCXX_DEBUG //GCC5.4.1で配列の範囲外アクセスをエラーにする

//cmdで g++ test.cpp とするとコンパイルできる
//制限1秒なら10^6は余裕 10^7は多分間に合う 10^8はよほど単純でないと厳しい

typedef long long ll; //long long
typedef pair<int,int> pii; //pair<int,int>

const int MOD=1000000007; //10^9+7
const double PI=3.1415926535;

int main(){
    int N,K;
    cin>>N>>K;
    int ans=0;
    for(int i=0;i<N;i++){
        int h;
        cin>>h;
        if(K<=h)ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(void){
	int a,b;
    cin>>a>>b;
    bool found= false;
    for(int i = 1; i <= 1000; i++){
        double temp = i;
        if(abs(floor(temp*0.08)-a)<=0.0000001&&abs(floor(temp*0.1)-b)<=0.0000001){
            found = true;
            cout<<i<<'\n';
            break;
        }
    }
    if(!found){
        cout<<"-1\n";
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
using namespace std;
typedef long long int ll;

ll mod=1e9+7;
int cnt1[2020];
int cnt2[2020];

int main(){
    ll n,k;
    cin >> n >> k;
    vector<int> a(n);
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    ll ans=0;
    for(int i=0;i<n;i++){
        for(int j=0;j<i;j++){
            if(a[i]>a[j])cnt1[i]++;
        }
    }
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            if(a[i]>a[j])cnt2[i]++;
        }
    }
    for(int i=0;i<n;i++){
        ll m=k;
        ll l=k+1;
        ll j=k-1;
        if(k%2==0){
            m/=2;
        }
        else{
            l/=2;
            j/=2;
        }
        (ans+=cnt2[i]%mod*m%mod*l%mod)%=mod;
        (ans+=cnt1[i]%mod*m%mod*j%mod)%=mod;
    }
    cout << ans << endl;
}


Measured memory_bytes: 384