akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
void divmod (vector<int>& vi, int a, int b) {
    int q;
    int r;
    if (b < 0) {
        b = -b;
        a = -a;
    }
    q = 0;
    r = a;
    if (r > 0) {
        while (r - b >= 0) {
            q += 1;
            r -= b;
        }
    } else if (r < 0) {
        do {
            q -= 1;
            r += b;
        } while (r < 0);
    }
    vi[0] = q;
    vi[1] = r;
}
int main() {
    vector<int> vi (2);
    int         N;
    cin >> N;
    string S    = "";
    int    base = 2;
    while (N) {
        divmod (vi, N, base);
        S = to_string (vi[1]) + S;
        N -= vi[1];
        divmod (vi, N, -base);
        N = vi[0];
    }
    if (S != "") cout << S << endl;
    else
        cout << "0" << endl;
    return 0;
}

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

#define fast ios::sync_with_stdio(0); cin.tie(NULL); 
#define fi first
#define se second
#define mp make_pair
#define pi 3.14159265359
#define MOD 1000000007
typedef long long ll;
#define mp make_pair
#define ALL(v) v.begin(), v.end() 
#define F(i,s,n) for(i=s;i<n;++i)
#define pb push_back
#define tin freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
ll max(ll a,ll b)
{
    return a*(a>=b)+b*(b>a);
}
/*----------------------------------------------------------*/

void solve()
{
    ll n,k;cin>>n>>k;vector<ll>h(n),dp(n);
      for(auto &i:h)cin>>i;
      ll t=0;
      if(n==1){cout<<"0";return;}
      dp[0]=0;dp[1]=abs(h[1]-h[0]);
      for(ll i=2;i<n;++i)
    {
      dp[i]=(ll)10e10;t=1;
      while(t<=k&&i-t>=0)
      {
          dp[i]=min(dp[i],dp[i-t]+abs(h[i]-h[i-t]));++t;
      }
    }
  cout<<dp[n-1];
}

int main()
{
    //tin
    fast
    ll tc=1;//cin>>tc;
   for(ll i=1;i<=tc;++i)
   {
    //cout<<"Case #"<<i<<": ";
    solve();
    if(i!=tc)cout<<"\n";
   }
return 0;
}
//End-Cases
//Precomputation
//Segmentation Fault
//Complexity
//Break it up
//Sub Problems


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

using namespace std;

pair<int, int> a[111111];
struct UFNode
{
	UFNode *parent;
	int rank;
	pair<int, int> i;
	UFNode() :parent(nullptr), rank(0) {}
	UFNode &Find() {
		if (parent == nullptr)
			return *this;
		return *(parent = &parent->Find());
	}
	int Union(UFNode &n, set<pair<int, int>> &s, set<pair<int, int>> &t) {
		auto &r = Find(), &nr = n.Find();
		if (&r == &nr) return 0;
		if (r.rank < nr.rank) {
			r.parent = &nr;
			if (nr.i <= r.i)
				s.erase(r.i), t.insert(r.i);
			else s.erase(nr.i), t.insert(nr.i), nr.i = r.i;
		}
		else {
			nr.parent = &r, r.rank += r.rank == nr.rank;
			if (r.i <= nr.i)
				s.erase(nr.i), t.insert(nr.i);
			else s.erase(r.i), t.insert(r.i), r.i = nr.i;
		}
		return -1;
	}
} u[111111];

int main()
{
	int n, m;
	cin >> n >> m;
	set<pair<int, int>> s, t;
	for (int i = 0; i < n; i++)
		scanf("%d", &a[i].first), a[i].second = i, s.insert(a[i]), u[i].i = a[i];
	for (int i = 0; i < m; i++) {
		int x, y;
		scanf("%d%d", &x, &y);
		u[x].Union(u[y], s, t);
	}
	if (s.size() == 1) {
		cout << 0 << endl;
		return 0;
	}
	long r = 0;
	for (auto &u : s)
		r += u.first;
	int c = 0;
	for (auto &u : t) {
		if (c == s.size() - 2)
			break;
		r += u.first;
		c++;
	}
	if (c < s.size() - 2) {
		cout << "Impossible" << endl;
		return 0;
	}
	cout << r << endl;
	return 0;
}


Measured memory_bytes: 10368
#include "bits/stdc++.h"
using namespace std;

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

	int x = 0;
	int mx = 0;

	for (int i=0; i < n; ++i) {
		x += (s[i]=='I') ? 1 : -1;
		mx = max(x, mx);
	}
	
	cout << mx << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define all(x) x.begin(),x.end()
#define let auto const

template<typename... Types>
struct dynarr: std::vector<Types...> {
  using std::vector<Types...>::vector;
  using size_type = typename std::vector<Types...>::size_type;
  auto&& operator[](size_type i) { return this->at(i); }
  auto&& operator[](size_type i) const { return this->at(i); }
};

int main() {
  string s;
  cin >> s;
  string t;
  cin >> t;
  i64 ans = 0;
  rep(i,0,3) {
    ans += (s[i] == t[i]);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
MOD=10**9+7
def mul(A,B):
    C=[[0]*len(B) for i in range(len(A[0]))]
    for i in range(len(A)):
        for j in range(len(B[0])):
            for k in range(len(B)):
                C[i][j]=(C[i][j]+A[i][k]*B[k][j])%MOD
    return C

def matpow(vec,n):
    B=[[0]*len(vec) for i in range(len(vec))]
    for i in range(len(vec)):
        B[i][i]=1
    while(n>0):
        if n&1:
            B=mul(B,vec)
        vec=mul(vec,vec)
        n>>=1
    return B

N,K=map(int,input().split())
A=[list(map(int,input().split())) for i in range(N)]

A_k=matpow(A,K)

ans=0
for i in range(N):
    for j in range(N):
        ans=(ans+A_k[i][j])%MOD
print(ans)

Measured memory_bytes: 74168
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,d;
    cin>>n>>d;
    int  x[20][20];
    for(int i=0;i<n;i++)
    {
        for(int  j=0;j<d;j++)
        {
            cin>>x[i][j];
        }
    }
    int k=0;
    for(int  s=0;s<n;s++)
    {
    for(int  i=s+1;i<n;i++)
    {
        int sum=0;
        for(int  j=0;j<d;j++)
        {
        sum+=((x[s][j]-x[i][j])*(x[s][j]-x[i][j]));
        }
        int l=sqrt(sum);
        if((l*l)==sum)
        {
            k++;
        }
    }
    }
    cout<<k<<endl;
return 0;
}


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

int main () {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int a;
  string s;
  cin >> a >> s;
  if (a >= 3200) cout << s << '\n';
  else cout << "red" << '\n';
  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <typeinfo>
#include <climits>
#include <algorithm>
#include <cctype>
#include <stdio.h>
#include <cstdlib>
using namespace std;

int main(){
    char x,y;
    cin >> x >> y;
    char s[7]="ABCDEF";
    int n=find(s,s+7,x)-s,m=find(s,s+7,y)-s;
    if(n>m){
        cout << ">";
    }else if(n<m){
        cout << "<";
    }else{
        cout << "=";
    }
}

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

int main() {
  int A, B, i, cnt = 0;
  int a, b, c, d, e;
  cin >> A >> B;
  
  for (i = A; i <= B; i++){
    a = i / 10000;
    b = i / 1000 - 10 * a;
    c = i / 100 - 100 * a - 10 * b;
    d = i / 10 - 1000 * a - 100 * b - 10 * c;
    e = i - 10000 * a - 1000 * b - 100 * c - 10 * d;
    
    if (a == e && b == d)
      cnt++;
  }  
  cout << cnt << endl;
}

Measured memory_bytes: 256
k, x = [int(n) for n in input().split()]

if x+(k-1) >= 1000000:
    r = 1000000
else:
    r = x+(k-1)
if x-(k-1) <= -1000000:
    l = -1000000
else:
    l = x-(k-1)

print(' '.join([str(n) for n in range(l, r+1)]))

Measured memory_bytes: 9108
#include <stdio.h>
int serch(int);
int A[1000000],kazu;
int main()
{
int i,j,suji,sum=0;
scanf("%d",&kazu);
for(i=0;i<kazu;i++){
  scanf("%d",&A[i]);
}
scanf("%d",&suji);
for(i=0;i<suji;i++){
  scanf("%d",&j);
  if(serch(j)) sum++;
}
  printf("%d\n",sum);
  return 0;
}
 int serch(key){
int left=0;
int right=kazu;
int mid; 

while(left<right){
  mid=(left+right)/2;
if(key==A[mid])
  return 1;
if(key<A[mid])
  right=mid;
else if(key>A[mid])
  left=mid+1;
}
  return 0;

}



Measured memory_bytes: 2100
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef double D;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef long double ld;

#define rd(x) scanf("%d",&x)
#define rd2(x,y) scanf("%d %d",&x,&y)
#define rd3(x,y,z) scanf("%d %d %d",&x,&y,&z)
#define rl(x) scanf("%lld",&x)
#define rl2(x,y) scanf("%lld %lld",&x,&y)
#define rl3(x,y,z) scanf("%lld %lld %lld",&x,&y,&z)
#define wd(x) printf("%d" ,x)
#define wd2(x,y) printf("%d %d",x,y)
#define wl(x) printf("%lld",x)
#define wl2(x,y) printf("%lld %lld",x,y)
#define PC(x) putchar(x)
#define GC() getchar()
#define NL printf("\n")
#define SP printf(" ")
 
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))

#define F first
#define S second
#define MP make_pair
#define PB push_back

#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)
#define fr(i,s,e) for(int i=s;i<e;i++)
#define frl(i,s,e) for(ll i=s;i<e;i++)
#define frr(i,s,e) for(int i=s-1;i>=e;i--)
#define frv(i,a) for(int i = 0;i<(int)a.size();i++)
#define frvr(i,a) for(int i = a.size()-1;i>=0;i--)
#define tr(i,a) for(typeof(a.begin()) i = a.begin(); i != a.end();i++)

#define inf 10000000000000
#define mod 1000000007
#define maxn 100009
#define maxr 100009
void solve()
{
	ll n,m;
	rl2(n,m);
	ll x=n*(n-1)/2+m*(m-1)/2;
	cout<<x<<endl;

	return;
}
int main()
{
	
	ll t=1;
	//rl(t);

	//cin>>t;
	//scanf()
	while(t--)
	{
		solve();
	}
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct edge {
    int to;     // 辺の行き先
    int weight; // 辺の重み
    edge(int t, int w) : to(t), weight(w) { }
};
using Graph = vector<vector<int>>;
#define rep(i, n)         for(int i = 0; i < (int)(n); i++)
#define brep(n)           for(int bit=0;bit<(1<<n);bit++)
#define erep(i,container) for (auto i : container)
#define irep(i, n)        for(int i = n-1; i >= (int)0; i--)
#define rrep(i,m,n) for(int i = m; i < (int)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define all(x) (x).begin(),(x).end()
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define res resize
#define as assign
#define fi first
#define se second
#define itn int
#define mp make_pair
#define sum accumulate
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
typedef long long ll;
const int INF = 2000000000;
const ll INF64 = 9223372036854775806ll;
const int mod = 1000000007ll;
const ll  MOD = 1000000007LL;
/*メモ 
*/
int main(){
    int n,m;
    std::cin >> n>>m;
    std::vector<int> s(m),c(m);
    rep(i,m)std::cin >> s[i]>>c[i];
    std::vector<int> a(n,-1);
    rep(i,m){
        if(a[s[i]-1]==-1)a[s[i]-1]=c[i];
        else{
            if(a[s[i]-1]==c[i])continue;
            else{
                std::cout << -1 << std::endl;
                exit(0);
            }
        }
    }
    if(n==1){
        if(a[0]==-1)std::cout << 0 << std::endl;
        else std::cout << a[0] << std::endl;
        exit(0);
    }
    if(a[0]==0){
        std::cout << -1 << std::endl;
        exit(0);
    }
    else if(a[0]==-1){
        std::cout << 1 ;
    }
    else std::cout << a[0];
    rrep(i,1,n){
        if(a[i]==-1)std::cout << 0;
        else std::cout << a[i];
    }
    std::cout << std::endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define mod 998244353
ll power(ll x, ll b)
{
    ll p = 1;
    while (b > 0)
    {
        if (b & 1)
        {
            p = p * x;
            p %= mod;
        }
        b >>= 1;
        x *= x;
        x %= mod;
    }
    return p % mod;
}
using namespace std;

int main()
{
    long double a, b;
    cin >> a >> b;
    long double p = a * b;
    cout << (ll)p << "\n";
    return 0;
}

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

typedef long long int ll;
typedef vector<ll> vi;			typedef vector<ll> vl;
typedef vector<vi> vvi; 		typedef vector<vl> vvl;
typedef pair<ll, ll> 	pii;	typedef pair<ll, ll> pll;
typedef vector<pii> vii; 		typedef vector<pll> vll;
typedef map<ll,ll> mii;
typedef vector<char> vc;
typedef vector<bool> vb;
#define endl '\n'
#define forn(i,n) for(ll i=0;i<n;i++)
#define rforn(i,n) for(ll i=n-1;i>=0;i--)
#define forne(i,n) for(ll i=1;i<=n;i++)
#define rforne(i,n) for(ll i=n;i>=1;i--)
#define forse(i,s,e) for(ll i=s;i<e;i++)
#define rforse(i,s,e) for(ll i=e-1;i>=s;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll)x.size()
#define MOD 1000000007
#define F first
#define S second
#define pb push_back
#define in insert
#define mp(a, b) make_pair(a, b)
#define fill(a,x) memset(a,x,sizeof a);
#define trav(a,x) for(auto &a:x)
#define min3(a, b, c) min(min(a, b), c)
#define min4(a, b, c, d) min(min(a, b), min(c, d))
#define max3(a, b, c) max(max(a, b), c)
#define max4(a, b, c, d) max(max(a, b), max(c, d))
#define INF ll_MAX
#ifdef KARAN
	#include "../../trace.h"
#else
    #define trace(args...)
#endif

void solve(){
	string s;
	cin>>s;
	ll n = s.size();

	ll dp[2][2019];
	forn(i, 2) forn(j, 2019) dp[i][j] = 0; 

	ll output = 0;
	dp[0][s[0]-'0']++;
	forne(i, n-1){
		forn(j, 2019)
			dp[i%2][j] = 0;
		ll curr = s[i] - '0';
		dp[i%2][curr]++;
		forn(j, 2019)
			dp[i%2][(j*10+curr)%2019] += dp[1-(i%2)][j];
		output = output + dp[i%2][0];
	}
	cout<<output<<endl;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	#ifdef KARAN
		freopen("inp.txt", "r", stdin);
    	freopen("out.txt", "w", stdout);
    	freopen("err.txt", "w", stderr);
	#endif
	ll t=1;
	// cin>>t;
	while(t--)
		solve();
}

Measured memory_bytes: 3696
import sys
input = sys.stdin.readline
def ii(): return int(input())
def mi(): return map(int, input().rstrip().split())
def lmi(): return list(map(int, input().rstrip().split()))
def li(): return list(input().rstrip())
# template #


N, K = mi()
strS = li()
S = [int(i) for i in strS]
S.append(0)
# S.insert(0, 1)
# print(S)

cnt = 0
lis0 = []
if S[0] == 1:
    listart = [0]
    cnt += 1
else:
    listart = []
liend = []
for i in range(1, N):
    # if S[i] == 0:
    #     cnt += 1
    if S[i-1] == 0 and S[i] == 1:
        listart.append(i)
        lis0.append(i)
    if S[i-1] == 1 and S[i] == 0:
        liend.append(i-1)
# if S[N-1] == 0:
#     lis0.append(N)
if S[N-1] == 1:
    liend.append(N - 1)
    cnt += 1
# lis.append(N)
# lis.insert(0, -1)
len0 = len(listart) + 1 - cnt
# print(listart)
# print(liend)
# print(len0)
# print(ma)
if K >= len0:
    print(N)
else:
    ma = max(liend[K - 1] + 1, N - listart[-K])
    for i in range(len(listart) - K):
        ma = max(ma, liend[i+K]-listart[i]+1)
    print(ma)


Measured memory_bytes: 8972
#include<stdio.h>
#define MAX 200000
#define INF (1<<30)

int L[MAX], R[MAX];

long long merge(int* A, int l, int mid, int r){
	int n1,n2,i,j,k;
	long long cnt=0;
	n1=mid-l;	n2=r-mid;
	for(i=0;i<n1;i++){
		L[i]=A[l+i];
	}
	for(int i=0;i<n2;i++){
		R[i]=A[mid+i];
	}
	L[n1]=R[n2]=INF;

	i=j=0;
	for(k=l;k<r;k++){
		if(L[i]<=R[j]){
			A[k]=L[i++];
		}else{
			cnt+=n1-i;
			A[k]=R[j++];
		}
	}
	return cnt;
}

long long MergeSort(int* A, int l, int r){
	int mid;
	long long cnt=0;
	if(r-l>1){
		mid=(l+r)/2;
		cnt+=MergeSort(A,l,mid);
		cnt+=MergeSort(A,mid,r);
		cnt+=merge(A,l,mid,r);
	}

	return cnt;
}

int main(){
	int i,n,A[MAX];
	scanf("%d",&n);
	for(i=0;i<n;i++)scanf("%d",&A[i]);

	long long cnt=MergeSort(A,0,n);

	//for(i=0;i<n;i++){
	//	if(i)printf(" ");
	//	printf("%d",A[i]);
	//}
	printf("%lli\n",cnt);
	return 0;
}



Measured memory_bytes: 3344
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <numeric>
#include <cmath>

#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
using P = pair<ll, ll>;

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

const ll MOD = 1000000007;
const int INF = 1<<30;
//const ll INF = (ll)1e18 + 1;


int main(){
  ll S; cin >> S;
  ll X1 = 0, Y1 = 0;
  const ll p = 1000000000;
  ll X2 = p, Y2 = 1;
  ll X3 = (p - S % p) % p;
  ll Y3 = (S + X3) / p;
  cout << X1 << " " << Y1 << " " << X2 << " " << Y2 << " " << X3 << " " << Y3 << endl;
}


Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <string>
#include <cstdio>
#include <cmath>

using namespace std;

int main() {  

	int N, A[1005], T[1005];
	cin >> N;
	for (int i = 0; i < N; i++) cin>>A[i] >> T[i];

	long long b1 = A[0], b2 = T[0], n;

	for (int i = 1; i < N; i++) {
		n = max((b1 + A[i] - 1)/A[i], (b2 + T[i] - 1)/T[i]);
		b1 = n*A[i];
		b2 = n*T[i];
	}

	cout << b1 + b2 << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(li i=0;i<n;i++)
#define li long long int
#define ll long long int
#define pb push_back
#define all(v) sort(v.begin(),v.end())
const int N = 40043;
const ll mod = 1e9 + 7;
#define FAST_IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define f first
#define s second
int gcd(int a,int b)
{
    if(b==0) return a;
    return gcd(b,a%b);
}
int lcm(int a,int b)
{
    return (a*b)/gcd(a,b);
}
li pow(li a,li b,li mo)
{
    if(a==0)
    return 1;
    li u=pow(a,b/2,mo);
    u=(u%mod*u%mod)%mo;
    if(b%2==1)
    u=(u%mod*a%mod)%mod;
    return u;
}
ll power(ll a,ll b)
{
    ll ans=1;
	while(b)
	{
		if(b&1) ans=ans*a%mod;
		a=a*a%mod;
		b>>=1;
	}
	return ans;
}
 
li xx,yy,dd;
void equation(li a,li b)
{
    if(b==0)
    {
        xx=1;
        yy=0;
        dd=a;
    }
    else
    {
        equation(b,a%b);
        li temp=xx;
        xx=yy;
        yy=temp-(a/b)*yy;
    }
}
li inverse(li a,li m)
{
    equation(a,m);
    return(xx%m+m)%m;
}
bool compare(const char &i, char &j)
{
    
    return i > j;
    
}
void solve()
{
   li n,k;
   cin>>n>>k;
   li a[n],su=0;
   rep(i,n)
   cin>>a[i];
   sort(a,a+n);
   rep(i,k)
   su+=a[i];
   cout<<su;
}
int main()
{
    li t;
    t=1;
    while(t--)
    solve(),cout<<endl;
    
}

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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  
  int flag = false;
  while(A > 0 && C > 0){
      
      if(flag){
          A -= D;
      }
      else{
          C -= B;
      }
      flag = !flag;
  }

  if(A <= 0)
      cout << "No" << endl;
  else if(C <= 0)
      cout << "Yes" << endl;

}



Measured memory_bytes: 3636
# ラーメン店「高橋屋」のラーメンの値段は 1 杯 700 円ですが、
# トッピング（味玉、チャーシュー、ねぎ）を乗せた場合は
#  1 種類につき 100 円が加算されます。
# ある客がラーメンを一杯注文し、店員にトッピングの希望を伝えました。
# 店員は注文の内容をメモ帳に文字列 S として記録しました。
# S の長さは 3 文字で、S の 1 文字目が o のとき客のラーメンに味玉を乗せることを、
# x のとき味玉を乗せないことを表します。
# 同様に、S の 2 文字目、3 文字目はそれぞれチャーシュー、ねぎの有無を表します。
# S が入力されると、対応するラーメンの値段を出力するプログラムを書いてください。

s = gets

topping = 0
s.length.times do |i|
  if s[i] == "o"
    topping += 1
  end
end

puts 700 + 100 * topping


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

using namespace std;

int main() {
  string s, t; cin >> s >> t;
  bool isCoin = true;
  for (int i = 0; i < 3; ++i) {
    if (s[i] != t[2 - i]) isCoin = false;
  }
  if (isCoin) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <numeric>
#include <algorithm>
#include <stdio.h>
#include <bitset>
#include <complex>
#include <iomanip>
#include <math.h>
using namespace std;
#define MM 1000000000
#define MOD MM+7
#define pi pair<int32,int32>
#define pl pair<int64,int64>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
const long double PI = acos(-1);
const long long INF = 1e15;
int dx[8] = {-1,0,1,0,-1,-1,1,1};
int dy[8] = {0,-1,0,1,-1,1,1,-1};
template<typename T>
T GCD(T u,T v){
    return v ? GCD(v,u%v) : u;
}
template<typename T>
T LCM(T x,T y){
    return x*y/(T)GCD(x,y);
}
int main(){
    double a,b,c; cin >> a >> b >> c;
    cout << fixed << setprecision(10);
    cout << (double)a*b*sin(c*PI/180.0)/2.0 << endl;
    cout << (double)(a + b + sqrt(a*a + b*b - 2*a*b*cos(c*PI/180))) << endl;
    cout << (double)b*sin(c*PI/180) << endl;
}
  




Measured memory_bytes: 3548
#include<bits/stdc++.h>
#define int long long
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
using namespace std;
#define endl '\n'
#define for(i,s,n) for(int i=s;i<n;i++) 
#define vii vector<int>
signed main()
{
        fast;
	int t = 1,a,b,c,d;
	//cin>>t;
	while (t--)
	{
		cin >> a>>b>>c>>d;
        cout<<max({(a*c),(a*d),(b*c),(b*d)});
	}
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
 
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define EPS (1e-8)
#define equals(a,b) (fabs((a)-(b))<EPS)
 
using namespace std;
 
class Point{
public:
  double x,y;
 
  Point(double x = 0,double y = 0): x(x),y(y){}
  Point operator + (Point p){return Point(x+p.x,y+p.y);}
  Point operator - (Point p){return Point(x-p.x,y-p.y);}
  Point operator * (double a){return Point(a*x,a*y);}
  Point operator / (double a){return Point(x/a,y/a);}
  bool operator < (const Point& p) const{ return !equals(x,p.x)?x<p.x:(!equals(y,p.y)&&y<p.y); }
  bool operator == (const Point& p)const{ return fabs(x-p.x) < EPS && fabs(y-p.y) < EPS; }
 
};
 
Point rotate(Point a,double rad){ return Point(cos(rad)*a.x - sin(rad)*a.y,sin(rad)*a.x + cos(rad)*a.y); }
 
const double DINF = 1e20;
int n;
Point ps[2][1010],tmp[1010];
 
inline double getDist(Point p){ return sqrt(p.x*p.x+p.y*p.y); }
 
bool comp_arg(const double &a,const double &b) { return !equals(fabs(a),fabs(b)) && fabs(a) < fabs(b); }
 
void compute(){
  Point grv[2] = {Point(),Point()};
  rep(i,2) rep(j,n) grv[i] = grv[i] + ps[i][j];
  rep(i,2) grv[i] = grv[i] / (double)n;
  rep(i,2) rep(j,n) ps[i][j] = ps[i][j] - grv[i];
  sort(ps[0],ps[0]+n);
  sort(ps[1],ps[1]+n);
 
  vector<double> arg_buf;
  rep(i,min(7,n)) rep(j,n) {
    double dist[2] = { getDist(ps[0][i]), getDist(ps[1][j]) };
    if( !equals(dist[0],dist[1]) ) continue;
    arg_buf.push_back( atan2(ps[0][i].y,ps[0][i].x) - atan2(ps[1][j].y,ps[1][j].x) );
  }
 
  sort(arg_buf.begin(),arg_buf.end(),comp_arg);
  arg_buf.erase(unique(arg_buf.begin(),arg_buf.end()),arg_buf.end());
 
  rep(i,(int)arg_buf.size()){
    double arg = arg_buf[i];
    rep(j,n) tmp[j] = rotate(ps[1][j],arg);
    sort(tmp,tmp+n);
    bool failed = false;
    rep(j,n) if( !( tmp[j] == ps[0][j] ) ) { failed = true; break; }
    if( !failed ) { printf("%.10lf\n",fabs(arg)); break; }
  }
 
}
 
int main(){
  while( cin >> n, n ){
    rep(i,2) rep(j,n) cin >> ps[i][j].x >> ps[i][j].y;
    compute();
  }
  return 0;
}

Measured memory_bytes: 1468
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define All(a) a.begin(),a.end()
#define INF 10*9+7

int main(){
  int n; cin >> n;
  ll ans = 0;
  for(int i=1;i<=n;i++){
    if(i%3!=0 && i%5!=0) ans +=i;
  }
  cout<< ans <<endl;
}


Measured memory_bytes: 3388
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<string>
#include<vector>
#include<map>
#include<queue>
#include<stack>
using namespace std;
long long s[100005];
long long vis[100005];
int main(){
	int n;
	while(scanf("%d",&n)==1)
	{
		for(int i=0;i<n;i++)
		scanf("%lld",&s[i]);
		sort(s,s+n);
		vis[0]=s[0];
		for(int i=1;i<n;i++)
		vis[i]=vis[i-1]+s[i];
		int sum=0;
		for(int i=n-1;i>=0;i--)
		if(s[i]<=vis[i-1]*2)sum++;
		else break;
		printf("%d\n",sum+1);
	}
	return 0;
} 

Measured memory_bytes: 1792
s = [x == "g" for x in input()]
# p <= g
p = 0
g = 0

def is_g(x):
    return x


cnt = 0
for v in s:
    if is_g(v):
        if p < g:
            p += 1
            cnt += 1
        else:
            g += 1
    else:
        if p >= g:
            g += 1
            cnt -= 1
        else:
            p += 1
print(cnt)



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

int main ()
{
    int n;
    while (cin >> n, n != -1) {
        long long res = 0;
        long long pos = 1;
        while (n > 0) {
            res += pos * (n & 0b0011);
            n = n >> 2;
            pos *= 10;
        }
        cout << res << endl;
    }

    return 0;
}

Measured memory_bytes: 1156
#include<stdio.h>

int main(void){
  int a, b, c;
  int i, n;
  int max, sum;

  scanf("%d%d%d%d", &a, &b, &c, &n);

  sum = a + b + c;

  if(a>=b){
    if(a>=c){
      max = a;
    }else{
      max = c;
    }
  }else{
    if(b>=c){
      max = b;
    }else{
      max = c;
    }
  }

  for(i=0; i<n; i++){
    sum += max;
    max *= 2;
  }

  printf("%d\n", sum);

  return 0;
}


Measured memory_bytes: 128
from collections import deque

h, w = map(int, input().split())
p = [input() for i in range(h)]

# メモ配列
INF = 10**7
memo = [[INF]*w for i in range(h)]

# 白マスをカウント
wcnt = 0
for i in p:
    for j in i:
        if j == '.':
            wcnt+=1

# 幅探索用キュー初期化
q = deque()
q.append((0, 0))
memo[0][0]  = 0

# 探索用ベクトル
vx = (0, -1, 0, 1)
vy = (-1, 0, 1, 0)

ans = -1
for i in range(INF):
    # キューが空なら終了
    if len(q) == 0:
        break
        
    # キューから一つ取り出す
    x, y = map(int, q.pop())
    
    # ゴールなら終了
    if x == w-1 and y == h-1:
        ans = memo[y][x]
        break
        
    # 4方向の距離を確定して、エンキューする
    for j in range(4):
        nx, ny = x+vx[j], y+vy[j]
        
        # エリア外 or 探索済み or 黒色なら探索しない
        if nx < 0 or w <= nx or ny < 0 or h <= ny or memo[ny][nx] != INF or p[ny][nx] == '#':
            continue
            
        memo[ny][nx] = memo[y][x]+1
        q.appendleft((nx, ny))

if ans == -1:
    print(ans)
else:
    print(wcnt-ans-1)

Measured memory_bytes: 3436
read n m;
for((i=0;i<n;i++))do
	read s;
	a=("${a[@]}" "$s");
done
for((i=0;i<m;i++))do
	read s;
	b=("${b[@]}" "$s");
done
for((i=0;i<=n-m;i++))do
	for((j=0;j<=n-m;j++))do
		c=1;
		for((k=0;k<m;k++))do
			for((l=0;l<m;l++))do
				if [ ${a[$[i+k]]:$[j+l]:1} != ${b[$k]:$l:1} ];then
					c=0;
					break;
				fi
			done
			if [ $c -eq 0 ];then
				break;
			fi
		done
		if [ $c -eq 1 ];then
			echo Yes
			exit
		fi
	done
done
echo No


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

int main() {
  int A,B,C,D ;
  cin >> A >> B >> C >> D;
 if ( A+B < C+D ) {
   cout << "Right" << endl;
 }
 else if ( A+B > C+D ) {
   cout << "Left" << endl; 
 }    
 else {
   cout << "Balanced" << endl;
 } 
 }
  


Measured memory_bytes: 3620
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = sc.next();
        char[] c = s.toCharArray();
        int e = 0;
        for (int i = 1; i < n; i++) {
            if (c[i] == 'E') {
                e++;
            }
        }
        int w = 0;
        int min = e;
        for (int i = 1; i < n; i++) {
            if (c[i - 1] == 'W') {
                w++;
            }
            if (c[i] == 'E') {
                e--;
            }
            min = Math.min(min, w + e);
        }
        System.out.println(min);
    }
}

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

#define all(X) (X).begin(), (X).end()
#define ll long long
#define linf (1ll << 60)

using namespace std;

// -------- FUNCS -------- //
vector<string> SPLIT(string str,char ch){vector<string> res;stringstream ss(str);string s;while(getline(ss, s, ch))res.push_back(s);return res;}
ll STOI(string str,int base){ll res=0;for(auto c:str){res*=base;res+=c-'0';}return res;}
string ITOS(ll val,int base){string res;while(val>0){res+='0'+(val%base);val/=base;}reverse(all(res));return res;}

// -------- Main Code -------- //
void runcase() {
    ll D, T, S;
    cin >> D >> T >> S;
    if (S * T >= D) {
        cout << "Yes\n";
    } else {
        cout << "No\n";
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    // int t;
    // cin >> t;
    // while (t-- > 0)
        runcase();
    return 0;
}


Measured memory_bytes: 3644
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll read()
{
    char ch=getchar();
    ll x=0,f=1;
    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;
}
priority_queue<ll,vector<ll>,greater<ll> > qa,qb;
priority_queue<ll> qo,t;
int main()
{
    ll xx,y,a,b,c;
    ll x,ans=0;
    cin>>xx>>y>>a>>b>>c;

    while(!t.empty())
        t.pop();
    for(int i=0;i<a;i++)
    {
        x=read();
        t.push(x);
    }
    for(int i=0;i<xx;i++)
    {
        x=t.top();
        t.pop();
        qa.push(x);
    }

    while(!t.empty())
        t.pop();
    for(int i=0;i<b;i++)
    {
        x=read();
        t.push(x);
    }
    for(int i=0;i<y;i++)
    {
        x=t.top();
        t.pop();
        qb.push(x);
    }
	for(int i=0;i<c;i++)
    {
        x=read();
        qo.push(x);
    }
    ll to,ta,tb;
    while(!qo.empty())
    {
        to=qo.top();
        ta=qa.top();
        tb=qb.top();
        qo.pop();
        /*
        if(to<=ta&&to<=tb)
            break;
        */
        if(ta>tb)
        {
            if(tb<to)
            {
                qb.pop();
                qb.push(to);
                //qo.pop();
            }
            /*else
                break;*/
        }
        else if(ta<=tb)
        {
            if(ta<to)
            {
                qa.pop();
                qa.push(to);
                //qo.pop();
            }
            /*else
                break;*/
        }
    }
    while(!qa.empty())
    {
        ans+=qa.top();
        qa.pop();
    }
    while(!qb.empty())
    {
        ans+=qb.top();
        qb.pop();
    }
    cout<<ans<<endl;
	return 0;
}
/*
20 5
0 5 10 17 19
*/


Measured memory_bytes: 3956
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;

int N, A, B;
ll h[100010];

int check(int m) {
  ll sum = 0;
  for (int i = 0; i < N; i++) {
    ll tmp = h[i] - (ll)m * B;
    if (tmp < 0) continue;
    sum += (tmp + (A - B) - 1) / (A - B);
  }
  return sum <= m;
}

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  cin >> N >> A >> B;
  for (int i = 0; i < N; i++) {
    cin >> h[i];
  }

  int ok = 1 << 30, ng = 0;
  while (ok - ng > 1) {
    int m = (ok + ng) / 2;
    if (check(m)) ok = m;
    else ng = m;
  }
  cout << ok << endl;

  return 0;
}

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

const int N=5005;
const int mod=1000000007;

int n,x,y,rt,mz,ans,tag;
int dp[N],sz[N],mx[N],c[N][N],fac[N];
vector<int> lev[N];

void add(int x,int y){
	lev[x].push_back(y);
	lev[y].push_back(x);
}

void dfs(int k,int pre){
	int u,j;
	sz[k]=1; mx[k]=0;
	for (j=0;j<lev[k].size();j++){
		u=lev[k][j];
		if (u==pre) continue;
		dfs(u,k);
		mx[k]=max(mx[k],sz[u]);
		sz[k]+=sz[u];
	}
	mx[k]=max(mx[k],n-sz[k]);
	if (mx[k]<mz) mz=mx[k],rt=k;
}

void init(){
	int i,j;
	c[0][0]=1; fac[0]=1;
	for (i=1;i<=n;i++){
		c[i][0]=1;
		for (j=1;j<=i;j++) c[i][j]=(c[i-1][j]+c[i-1][j-1])%mod;
	}
	for (i=1;i<=n;i++) fac[i]=1ll*fac[i-1]*i%mod;
}

int main(){
	int i,j,l;
	scanf("%d",&n);
	init();
	for (i=1;i<n;i++){
		scanf("%d%d",&x,&y);
		add(x,y);
	}
	mz=n; rt=0;
	dfs(1,0);
	for (i=1;i<=n;i++)
		if (mx[i]==mz&&i!=rt){
			printf("%d\n",1ll*fac[n/2]*fac[n/2]%mod);
			return 0;
		}
	dfs(rt,0);
	dp[0]=1;
	for (j=0;j<lev[rt].size();j++){
		x=lev[rt][j]; y=sz[x];
		for (i=n;i;i--)
			for (l=i-1;l>=0&&i-l<=y;l--){
				dp[i]=(dp[i]+1ll*dp[l]*c[y][i-l]%mod*c[y][i-l]%mod*fac[i-l]%mod)%mod;
			}
	}
	tag=1;
	for (i=0;i<n;i++){
		ans=(ans+1ll*tag*dp[i]*fac[n-i]%mod)%mod;
		tag*=-1;
	}
	ans=(ans+mod)%mod;
	printf("%d\n",ans);
	return 0;
}

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

int main(){
  int n,q;
  cin >> n >> q;
  string s;
  cin >> s;
  int m;
  m = s.size();
  vector<int> count(m,0);
  for(int i=1;i<m;i++){
    count[i] = count[i-1];
    if(s[i-1] == 'A' && s[i] == 'C'){
      count[i] ++;
    }
  }
  /*rep(i,m){
    //cout << count[i];
  }*/
  vector<int> L(q);
  vector<int> R(q);
  rep(i,q){
    cin >> L[i] >> R[i];
  }
  rep(i,q){
    cout << count[R[i]-1]-count[L[i]-1] << endl;
  }

  return 0;
}

Measured memory_bytes: 2176
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
#define MOD @
#define ADD(X,Y) ((X) = ((X) + (Y)%MOD) % MOD)
typedef long long i64; typedef vector<int> ivec; typedef vector<string> svec;

char S[33];

int main()
{
	scanf("%s", S);
	S[3] = 0;
	printf("%s\n",S);
	return 0;
}


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

int main(){
  int a,b,c,d;

  cin >> a >> b >> c >> d;
  if(a+b == c+d) {
    cout << "Balanced" << endl;
  } else if(a+b > c+d) {
    cout << "Left" << endl;
  } else {
    cout << "Right" << endl;
  }
}


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

#define int long long
#define rep(i,l,r) for(int i=(int)(l);i<(int)(r);i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)x.size())
template<class T>bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,T b){if(a>b){a=b;return 1;}return 0;}

/*
*/

using vi = vector<int>;
using vvi = vector<vi>;
using P = pair<int,int>;

signed main() {

  int h;
  cin >> h;

  int cnt = 1, t = h;
  while(t){
    cnt *= 2;
    t /= 2;
  }

  cout << cnt-1 << endl;

  return 0;
}


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

string s;
long long ans = 0;

void func(long long index,bool used[]){

    if(index == s.length()){
        
        long long lans = 0,uans = 0;
        for(long long i = 0;i<s.length();i++){
            
            if(used[i] == 1){
                
                lans = lans + uans;
                uans = s[i] - 48;
            }
            else{
                
                uans = uans*10 + (s[i]-48);
            }
        }
        lans = lans + uans;
      //  cout << lans << " ";
        ans = ans + lans;
    }
    else{
        
        used[index] = 1;
        func(index + 1,used);
        used[index] = 0;
        func(index + 1,used);
    }
}
int main(){

	cin >> s;
	
    bool used[s.length() + 1];
	func(0LL,used);
//	cout << "Answer = \n";
	cout << (ans >> 1) << endl;
}

Measured memory_bytes: 256
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
fn main(){
    let x:usize = read();
    let div = (x / 11) * 2;
    let rem = if x  % 11 == 0{
        0
    } else if x % 11 <=6 {
        1
    } else {
        2
    };
    println!("{}",div+rem );
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)
 
void solve()
{
   int r;
   cin >> r;
   double cur=2.0*M_PI*r;
    cout << setprecision(10) << cur << endl;
}
 
 
int main()
{
    fast_io;
    int t;
    //cin >> t;
t=1;
    for (int tt=1;tt<=t;tt++)
    {
        solve();
        
 
    }
 
    
    return 0;
}
 


Measured memory_bytes: 3796
#include<iostream>
#include<queue>
#include<cstdio>
using namespace std;
typedef long long ll;
priority_queue<ll >que;
int main()
{
	ll n,m;
	cin>>n>>m;
	ll x;
	for(ll i=1;i<=n;i++){
		cin>>x;
		que.push(x);
	}
	ll ans=0;
	while(m--){
		ll x=que.top();
		que.pop();
		x=x/2;
		que.push(x);
	}
	while(que.size()){
		ans+=que.top();
		que.pop();
	}
	cout<<ans<<endl;
	return 0;
}

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

using namespace std;
#define int long long
#define INF 1ll<<60
signed main(){
  int n,k=0,f=0;
  cin>>n;
  priority_queue<pair<int,int>, vector<pair<int,int> >, greater<pair<int,int> > > levi;
  pair<int,int> a;
  for(int i=0; i<n; i++){
    cin>>a.second>>a.first;
    levi.push(a);
  }
  for(int i=0; i<n; i++){
    a=levi.top();
    k+=a.second;
    if(k>a.first){
      cout<<"No"<<endl;
      f++;
      break;
    }else{
      levi.pop();
    }
  }
  if(f==0)
  cout<<"Yes"<<endl;
}


Measured memory_bytes: 6128
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <bits/stdc++.h>
#define ll long long
using namespace std;
void put(int x){
	if(x<0) {
		putchar('-');
		x*=-1;
	}
	if(x==0) {
		putchar('0');
	}
	int num=0;
	char c[15];
	while(x) {
		c[++num]=(x%10)+48;
		x/=10;
	}
	while(num) {
		putchar(c[num--]);
	}
	putchar('\n');
}
inline void in(int &x){
	char ch=getchar();
	int flag=1;
	while(!(ch>='0'&&ch<='9')) {
		if(ch=='-')
			flag*=-1;
		ch=getchar();
	}
	x=ch-'0';
	ch=getchar();
	while(ch>='0'&&ch<='9') {
		x=((x<<3)+(x<<1))+ch-'0';
		ch=getchar();
	}
	x*=flag;
}
int a,b,c,d,ans;
int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	in(a);in(b);
	if(a%3==0||b%3==0||(a+b)%3==0)printf("Possible\n");
	else printf("Impossible\n");
	return 0;
}


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

int main(){
    ll n,ans=0;
    cin >> n;
    vector<ll> vec(n);
    rep(i,n) cin >> vec[i];
    sort(vec.begin(),vec.end());
    ll now=vec[0];
    ll count=1;
    for(ll i=1;i<n;i++){
        if(vec[i-1]==vec[i]) count++;
        else{
            if(now>count) ans+=count;
            else ans+=count-now;
            now=vec[i];
            count=1;
        }
    }
    
    if(now>count) ans+=count;
    else ans+=count-now;
    
    cout << ans << endl;
    
    return 0;
}




Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;

class B
{
	static void Main()
	{
		var n = int.Parse(Console.ReadLine());
		var s = new int[n].Select(_ => Console.ReadLine()).ToArray();

		var map = s.Select(_ => new List<int>()).ToArray();
		for (int i = 0; i < n; i++)
			for (int j = 0; j < n; j++)
				if (s[i][j] == '1') map[i].Add(j);

		var M = 0;
		var q = new List<int>();
		var u = new int[n];
		for (int i = 0; i < n; i++)
		{
			q.Add(i);
			Array.Clear(u, 0, n);
			u[i] = 1;

			for (int k = 2; q.Any(); k++)
			{
				var ps = q.ToArray();
				q.Clear();

				foreach (var p in ps)
					foreach (var np in map[p])
					{
						if (u[np] == 0)
						{
							u[np] = k;
							q.Add(np);
						}
						else if (u[np] != k && u[np] + 1 != u[p]) { Console.WriteLine(-1); return; }
					}
			}
			M = Math.Max(M, u.Max());
		}
		Console.WriteLine(M);
	}
}


Measured memory_bytes: 15572
//  Created by conan1024hao in 2019.
//  Copyright © 2019 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define INF 10e16
#define MOD 1000000007
#define  mod 998244353
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
//using Int=int_fast64_t;
typedef long long int ll;
typedef pair<ll,ll>Pll;
typedef pair<int,int>Pin;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[8]={-1,0,1,0};
int dy[8]={0,-1,0,1};
char dir[4]={'u','l','d','r'};
ll cmp1(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}
//--------------------------------------------------------------------------

//---------------------------------------------------------------------------
int main(){//問題をちゃんと見ろ!!!!!!!!!!!!!!!!!      llか??????????        memset()!!!!!!!!!!!!       ペナを減らせ!!!!!!!!!!!!!
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    int n;cin>>n;
    vector<string>s(n);
    for(int i=0;i<n;i++)
        cin>>s[i];
    int m;cin>>m;
    vector<string>t(m);
    for(int i=0;i<m;i++)
        cin>>t[i];
    map<string,int>mm;
    ll ans=0;
    for(int i=0;i<n;i++){
        if(mm[s[i]]==1)continue;
        int cnt1=1;
        for(int j=i+1;j<n;j++){
            if(s[j]==s[i])
                cnt1++;
        }
        int cnt2=0;
        for(int j=0;j<m;j++){
            if(t[j]==s[i])
                cnt2++;
        }
        chmax(ans,cnt1-cnt2);
        
    }
    cout<<ans<<endl;
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------






Measured memory_bytes: 384
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): return [[ini]*i for _ in range(j)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))

S = input()

cnt = 0
ans = 0
for char in S:
    if char == 'A' or char == 'C' or char == 'G' or char == 'T':
        cnt += 1
    else:
        ans = max(cnt, ans)
        cnt = 0

ans = max(ans, cnt)
print(ans)

Measured memory_bytes: 8912
#include <iostream>
#include<sstream>
#include<vector>
#include<iterator>
using namespace std;

#define ADD 'I'
#define SUB 'D'

int main(void)
{
	int N;
	string S;
	cin >> N >> S;

	int ret = 0;
	int x = 0;
	for(int i=0; i<N; i++)
	{
		if(S[i] == ADD)
		{
			x++;
			ret = max(ret, x);
		}
		else
			x--;
	}

	cout << ret << endl;

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int x1,y1,x2,y2,x,y;cin >> x1 >> y1 >> x2 >> y2;
  x = x2-x1;y = y2-y1;
  x2 -= y;y2 += x;cout << x2 << " " << y2 << " ";
  x2 -= x;y2 -= y;cout << x2 << " " << y2 << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
int main(){
    int n, b, f, r, v;
    cin >> n;
    int dmiA[3][10];
    int dmiB[3][10];
    int dmiC[3][10];
    int dmiD[3][10];
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 10; j++){
            dmiA[i][j] = 0;
            dmiB[i][j] = 0;
            dmiC[i][j] = 0;
            dmiD[i][j] = 0;
        }
    }
    for(int i = 0; i < n; i++){
        cin >> b >> f >> r >> v;
        if(b == 1) dmiA[f - 1][r - 1] = v + dmiA[f - 1][r - 1];
        if(b == 2) dmiB[f - 1][r - 1] = v + dmiB[f - 1][r - 1];
        if(b == 3) dmiC[f - 1][r - 1] = v + dmiC[f - 1][r - 1];
        if(b == 4) dmiD[f - 1][r - 1] = v + dmiD[f - 1][r - 1];
    }
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 10; j++){
           cout << " " << dmiA[i][j] ;
        }
        cout << "" << endl;
    }
    cout << "####################" << endl;
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 10; j++){
            cout << " " <<dmiB[i][j]  ;
        }
        cout << "" << endl;
    }
    cout << "####################" << endl;
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 10; j++){
            cout << " " <<dmiC[i][j];
        }
        cout << "" << endl;
    }
    cout << "####################" << endl;
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 10; j++){
            cout << " " << dmiD[i][j];
        }
        cout << "" << endl;
    }
return 0;
}
   

Measured memory_bytes: 3084
#include<stdio.h>

int main(){
  int i,j,v,A[1000],n;
  
  scanf("%d",&n);


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

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

  for(i = 1; i <= n-1 ; i++){ 

    v = A[i];
    j = i -1;
    while (j >= 0 && A[j] >v)
      {
	A[j+1] = A[j];
	j--;
      }
    A[j+1] = v;
  for (j = 0;j < n-1;j++){
    printf("%d ",A[j]);
  }
  printf("%d\n",A[n-1]);
  }

 


  return 0;
}

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

int main() {
  string N;
  int S=0;
  cin >> N;
  if (N[0]=='1')
    S++;
  if (N[1]=='1')
    S++;
  if (N[2]=='1')
    S++;
  cout << S << endl;
}



Measured memory_bytes: 256
class node:
    def __init__(self,key=None):
        self.left=None
        self.right=None
        self.parent=None
        self.key=key

def insert(T,z):
    x=T
    y=None
    while isinstance(x,node):
        y=x
        if z.key<x.key:
            x=x.left
        else:
            x=x.right
    z.parent=y
    if y is None:
        T=z
    elif z.key<y.key:
        y.left=z
    else:
        y.right=z
    return T
        
def preorder(u):
    if not isinstance(u,node):
        return
    pripre.append(str(u.key))
    preorder(u.left)
    preorder(u.right)

def inorder(u):
    if not isinstance(u,node):
        return
    inorder(u.left)
    priin.append(str(u.key))
    inorder(u.right)

m=input()
root=None
for i in xrange(m):
    cmd=map(str,raw_input().split())
    if cmd[0]=="print":
        pripre=[]
        priin=[]
        preorder(root)
        inorder(root)
        print(' '+' '.join(priin))
        print(' '+' '.join(pripre))
    else:
        key=int(cmd[1])
        z=node(key)
        root=insert(root,z)

Measured memory_bytes: 259176
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
  int N; cin >> N;
  vector<int> v;
  for (int i=0; i<N;i++) { 
    int H;cin >> H;
    v.push_back(H);
  }

  for (int i=0; i<N-1; i++)
  {
    if (v.at(i+1) > v.at(i)) v[i+1] -=1;
  }

  vector<int> copy(v);
  sort(copy.begin(), copy.end());
  string res;
  if (v == copy) {
    res = "Yes";
  } else {
    res = "No";
  }
  cout << res << endl;
}

Measured memory_bytes: 1144
#include "bits/stdc++.h"
using namespace std;
using ll = long long; using ull = unsigned long long;
using vb = vector<bool>; using vvb = vector<vb>;
using vi = vector<int>; using vvi = vector<vi>;
using vl = vector<ll>; using vvl = vector<vl>;
using pii = pair<int,int>; using pll = pair<ll,ll>;
#define FOR(i,a,b) for(ll i = (a); i < (ll)(b); ++i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(ll i = (ll)(n)-1;i >= 0;--i)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define eb(val) emplace_back(val)
const double PI = acos(-1);
const double EPS = 1e-10;
const ll MOD = 1e9+7;
//#define int ll
void cioacc(){//accelerate cin/cout
  cin.tie(0);
  ios::sync_with_stdio(false);
}
signed main(){
  int n;
  cin >> n;
  vi dp(n,0);
  vi h(n);
  REP(i,n){
    cin >> h[i];
  }
  dp[1] = abs(h[1]-h[0]);
  REP(i,n-2){
    dp[i+2] = min(dp[i]+abs(h[i+2]-h[i]),dp[i+1]+abs(h[i+2]-h[i+1]));
  }
  cout << dp[n-1] << endl;
}



Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
using namespace std;

int main()
{
	int d, t, s;
	cin >> d >> t >> s;
	double res = (double)d / s;
	if (res <= t)cout << "Yes";
	else cout << "No";
}



Measured memory_bytes: 3588