akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ll long long int
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define put(x) cout << x << endl;
#define println(x) cout << x << endl;
using namespace std;
signed main()
{
    string s;
    cin >> s;

    int best = 0;
    for (int i = 0; i < (int)s.size(); i++) {
        int x = 0;
        for (int j = i; j < (int)s.size(); j++) {
            if (s[j] == 'A' || s[j] == 'T' || s[j] == 'C' || s[j] == 'G') {
                x += 1;
            }
            else {
                break;
            }
        }
        if (x > best) {
            best = x;
        }
    }

    put(best)

    return 0;
}

Measured memory_bytes: 3628
#include<iostream>
using namespace std;
string s;
int cons[4];
int main(void){
	cin>>s;
	cons[0]=1;
	for (int i=1;i<4;++i)
		if (s[i]==s[i-1]) cons[i]=cons[i-1]+1;
		else cons[i]=1;
	for (int i=2;i<4;++i)
		if (cons[i]>=3){
			cout<<"Yes"<<endl;
			return 0;
		}
	cout<<"No"<<endl;
	return 0;
}

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

using namespace std;
int a[500][500];
int cnt[500], dl[500];
int n, m;
int ll[500];
void del(int x) {
    dl[x] = 1;
    cnt[x] = 0;
    for (int i = 1; i <= n; i++) {
        int lst = ll[i];
        while (ll[i] <= m && dl[a[i][ll[i]]] == 1) ll[i]++;
        if (ll[i] <= m && ll[i] != lst) cnt[a[i][ll[i]]]++;
    }
}
bool chck(int x) {
    for (int i = 1; i <= m; i++) {
        dl[i] = 0;
        cnt[i] = 0;
    }
    for (int i = 1; i <= n; i++) {
        cnt[a[i][1]]++;
        ll[i] = 1;
    }
    while (1) {
        bool ok = true;
        for (int i = 1; i <= m; i++)
            if (cnt[i] > x) {
                del(i);
                ok = false;
            }
        if (ok) break;
    }
    for (int i = 1; i <= m; i++)
        if (dl[i] == 0) return true;
    return false;
}
int main() {
    ios_base::sync_with_stdio(0);
    cin >> n >> m;
    for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) cin >> a[i][j];
    int l = 1;
    int r = n;
    while (r - l > 0) {
        int mid = (r + l) / 2;
        if (chck(mid)) r = mid;
        else l = mid + 1;
    }
    cout << l << "\n";
    return 0;
}


Measured memory_bytes: 896
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
int gcd(int a,int b){//最大公約数
	if(b==0)return a;
	return gcd(b,a%b);
}
int main(){
cin.tie(0);
ios::sync_with_stdio(false);

	int N,K,ma=0;
	cin>>N>>K;
	VI A(N);
	
	REP(i,N){
		cin>>A[i];
		ma=max(ma,A[i]);
	}
	int G=A[0];
	FOR(i,1,N){
		G=gcd(G,A[i]);
	}
	if(K<=ma && K%G==0)
		cout<<"POSSIBLE"<<endl;
	else
		cout<<"IMPOSSIBLE"<<endl;
	
	return 0;
}



Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0; i<(int)n; i++)
#define REPR(i, n) for(int i=(int)n-1; i>=0; i--)
#define FOR(i, m, n) for(int i=(int)m; i<(int)n; i++)
#define FORR(i, m, n) for(int i=(int)m-1; i>=(int)n; i--)
#define ALL(x) (x).begin(), (x).end()
#define ASC(v) sort(ALL(v));
#define DESC(v) sort(ALL(v), greater<int>());
#define UNIQ(a) sort(ALL(a));(a).resize(unique(ALL(a)) - a.begin());
#define PRINTD(x, d) cout << fixed << setprecision(d) << x << "\n";
#define DEBUG(x) cout<<#x<<": "<<x<<"\n"
typedef long long ll;
const double PI = acos(-1);
ll lcm(ll a, ll b) { return a / __gcd(a, b) * b; }
bool isprime(int x){ int i; if(x<2)return 0; else if(x==2) return 1; if(x%2==0) return 0; for(i=3; i*i<=x; i+=2) if(x%i==0) return 0; return 1; }
int digsum(int n) { int r=0; while(n>0) { r+=n%10; n/=10; } return r; }
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }



void solve(long long K, long long X){
	REP(i, K*2-1) {
		cout << X-K+i+1;
		if (i != K*2-2) cout << " ";
	}
	cout << "\n";
}

int main(){
    long long K;
    scanf("%lld",&K);
    long long X;
    scanf("%lld",&X);
    solve(K, X);
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
double a[5];

int main(){
	for (int i = 0; i < 5; i++){
		cin >> a[i];
	}
	sort(a, a + 5);
	cout << a[4] << " " << a[3] << " " << a[2] << " " << a[1] << " " << a[0] << endl;


	return 0;
}

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

#ifdef LOCAL

template<class T, class U>
ostream& operator<<(ostream& os, pair<T, U> p) {
	os << "(" << p.first << ", " << p.second << ")";
	return os;
}

template<template<class, class...> class C, class... A>
typename enable_if<!is_same<C<A...>, string>::value, ostream&>::type
operator<<(ostream& os, class C<A...> c) {
	auto i = c.begin();
	while (i != c.end()) {
		os << " {"[i == c.begin()] << *i;
		os << ",}"[++i == c.end()];
	}
	return os;
}

#define debug(x) cerr << #x << " = " << x << endl;
#else
#define debug(...) {}
#endif

const int N = 1e6;
long long infLL = 1e18;
int inf = 1e9;

int main() {
	ios_base::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<int> tab;
	long long cost = 0;
	int last = 0;
	int prelast = 0;
	vector<int> res;
	res.resize(n);
	for (int i = 0; i < n; i ++) {
		int x;
		cin >> x;
		tab.push_back(x);
		cost += abs(last - x);
		if (i > 0) {
			res[i - 1] = -abs(prelast - last) -abs(last - x) + abs(prelast - x);
		}
		prelast = last;
		last = x;
	}
	cost += abs(last);
	res[n - 1] = - abs(prelast - last) - abs(last) + abs(prelast);
	for (int i= 0; i < n; i ++) {
		cout << cost + res[i] << "\n";
	}
}


Measured memory_bytes: 2168
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cmath>
#include <iomanip>
#include <bitset>
#include <string>
#include <stdlib.h>
using namespace std;
//cout <<  << endl;
typedef long long int ll;
typedef long double ld;

int main(){
    string a;
    ll ans=0;
    cin >> a;
    for (ll i=0;i<4;++i){
        if (a[i]=='2'){
            ++ans;
        }
    }
    cout << ans << endl;
    return 0;
}


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

typedef long long int ll;
typedef vector<int> vi;
typedef set<int> si;
typedef set<ll> sll;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define pvec(v) for(auto e: v) cout << e << " ";
#define IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define rep(i, a, b) for(int i = (a); i<(b); ++i)
#define pb push_back
#define INF 1000000005
#define MOD 1000000007
#define all(v) v.begin(), v.end()

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

ll power(ll x, ll y, ll p = MOD){  
    ll res = 1LL; 
    x = x % p;
    if (x == 0) return 0;
    while (y > 0){
        if (y & 1LL)  
            res = (res*x) % p;
        y = y>>1LL; 
        x = (x*x) % p;  
    }  
    return res;  
}  

vll dp;

ll solve(int S) {
	if(S < 3)
		return 0;
	else if(S == 3)
		return 1LL;

	if(dp[S] != -1) return dp[S];

	ll count = 1LL;
	for(int s = 3; s <= S; ++s) {
		count = (count + solve(S - s))%MOD;
	}
	return dp[S] = count;
}

int main()
{
  int S;
  cin >> S;
  dp.assign(S + 1, -1);

  cout << solve(S) << endl;
  return 0;
}



Measured memory_bytes: 3652
N = int(input())

def make_divisors(n):
    lower_divisors, upper_divisors = [], []
    i = 1
    while i * i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n // i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

count = 0
for i in range(1, N+1):
    # print(i, len(make_divisors(i)))
    if i % 2 == 1 and len(make_divisors(i)) == 8:
        count += 1
print(count)

Measured memory_bytes: 61484
#include <bits/stdc++.h>
#define lsb(x) (x & (-x))
#define ll long long
#define ull unsigned long long
// 220
// 44

using namespace std;

char str[40];

ll dp[40][20];

int main() {
    //ifstream cin("A.in");
    //ofstream cout("A.out");
    int i, n;
    ios::sync_with_stdio(false);
    cin >> n;
    cin >> str;
    ll ans = 0;
    for(int conf = 0; conf < (1 << n); conf++) {
        vector <char> arr0, arr1;
        for(i = 0; i < n; i++) {
            if(conf & (1 << i))
                arr1.push_back(str[i]);
            else
                arr0.push_back(str[i]);
        }
        memset(dp, 0, sizeof(dp));
        dp[2 * n][0] = 1;
        for(i = 2 * n - 1; i >= n; i--) {
            for(int a = 0; a <= 2 * n - i && a <= arr0.size(); a++) {
                int b = 2 * n - i - a;
                if(b > arr1.size())
                    continue;
                if(a > 0)
                    dp[i][a] += dp[i + 1][a - 1] * (arr0[a - 1] == str[i]);
                if(b > 0)
                    dp[i][a] += dp[i + 1][a] * (arr1[b - 1] == str[i]);
            }
        }
        ans += dp[n][arr0.size()];
    }
    cout << ans;
    //cin.close();
    //cout.close();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int mod = 1e9+7;

queue<char> q[3];
vector<char> ans;

int to(char t){
    if(t == 'a') return 0;
    if(t == 'b') return 1;
    if(t == 'c') return 2;
}

char solve(char s){
    int tmp = to(s);
    if(q[tmp].empty()) return s;
    ans.push_back(s);
    char x = q[tmp].front();q[tmp].pop();
    solve(x);
}

int main(){
    string sa,sb,sc;
    cin >> sa >> sb >> sc;
    
    for(int i = 0; i < sa.size(); i++){
        q[0].push(sa[i]);
    }
    for(int i = 0; i < sb.size(); i++){
        q[1].push(sb[i]);
    }
    for(int i = 0; i < sc.size(); i++){
        q[2].push(sc[i]);
    }
    int s = q[0].front();q[0].pop();
    
    char tmp = solve(s);
    if(tmp == 'a') cout << 'A' << endl;
    else if(tmp == 'b') cout << 'B' << endl;
    else if(tmp == 'c') cout << 'C' << endl;
}

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

using namespace std;

typedef long long ll;
typedef long double ld;

const int MAXN = 1010;
vector <int> g[MAXN];
int p[MAXN];
bool used[MAXN];

bool dfs(int u)
{
    if (used[u])
        return 0;
    used[u] = 1;
    for (int v : g[u])
    {
        if (!p[v] || dfs(p[v]))
        {
            p[v] = u;
            return 1;
        }
    }
    return 0;
}

signed main()
{
#ifdef POSPELOV
    freopen("in", "r", stdin);
    freopen("out", "w", stdout);
#endif
    int n;
    cin >> n;
    vector <pair <int, int>> arr(n + 1);
    for (int i = 1; i <= n; i++)
        cin >> arr[i].first >> arr[i].second;
    for (int i = 1; i <= n; i++)
    {
        int x, y;
        cin >> x >> y;
        for (int j = 1; j <= n; j++)
            if (arr[j].first < x && arr[j].second < y)
                g[i].push_back(j);
    }
    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= n; j++)
            used[j] = 0;
        dfs(i);
    }

    int ans = 0;
    for (int i = 1; i <= n; i++)
        ans += p[i] > 0;
    cout << ans;
    return 0;
}

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

const int nmax = 100010;

int h[nmax];
int dp[nmax];

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

    int n;cin>>n;
    for(int i=1;i<=n;++i)cin>>h[i];
    dp[0]=1000000000;
    dp[1]=0;
    for(int i=2;i<=n;++i)
    {
        dp[i]=min( abs(h[i] - h[i-1] )+dp[i-1] , abs(h[i] - h[i-2])+dp[i-2] );
    }
    cout<<dp[n];
    return 0;
}


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

using namespace std;
int n,q;
const int maxn=2e5+5;
multiset<int> mul;

struct node
{
    int f,t,x;
} a[maxn*2];
bool cmp(node x,node y)
{
    return x.t<y.t;
}
int main()
{
    int s,t,x;
    scanf("%d%d",&n,&q);
    int len=0;
    for(int i=1; i<=n; i++)
    {
        scanf("%d%d%d",&s,&t,&x);
        a[++len].t=s-x;
        a[len].x=x;
        a[len].f=0;
        a[++len].t=t-x;
        a[len].x=x;
        a[len].f=1;
    }
    int k=1;
    sort(a+1,a+1+len,cmp);
    while(q--)
    {
        int d;
        scanf("%d",&d);
        while(k<=len)
        {
            if(a[k].t<=d)
            {
                if(a[k].f==0)
                    mul.insert(a[k].x);
                else
                    mul.erase(mul.find(a[k].x));
                ++k;
            }
            else break;
        }
        int ans=-1;
        if(mul.size()) ans=*mul.begin();
        printf("%d\n",ans);
    }
    return 0;
}


Measured memory_bytes: 15360
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int inf = 1001001001;

int main(){

    ll n,ans=0;
    cin >> n;
    vector<ll> v(n);
    vector<ll> c(n);
    rep(i,n){
        cin >> v.at(i);
    }
    rep(i,n){
        cin >> c.at(i);
        v.at(i)-=c.at(i);
        if(v.at(i)>0) ans+=v.at(i);
    }

    cout << ans << endl;

    

}

Measured memory_bytes: 256
#include <stdio.h>

int main(int argc, const char * argv[]) {
    
    int x, a;
    scanf("%d", &x);
    
    if(1 <= x && x <= 100){
    
        a = x * x * x ;
    
        printf("%d\n", a);
    }
    
    return 0;
}



Measured memory_bytes: 2064
#include <bits/stdc++.h>
#define LL long long
#define PII pair<int,int>
#define PIII pair<int,PII>
#define PLL pair<LL,LL>
#define PLII pair<LL,PII>
#define VI vector<int>
#define FF first
#define SS second
#define MP make_pair
#define PB push_back
#define MX 50
#define EPS 0.00000000001
#define MOD 1000000007
#define PI acos(-1)
#define INF 100000000
#define loop(i,b,n) for(int i=b;i<n;++i)
#define rev_loop(i,b,n) for(int i=b;i>=n;--i)
using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n,x,y;
    cin>>n>>x>>y;
    int d[n][n];
    --x;--y;
    loop(i,0,n)
    {
        loop(j,0,n) d[i][j] = abs(j - i);
    }

    d[x][y] = 1;
    int c[n] = {0};
    loop(i,0,n)
    {
        loop(j,i+1,n)
        {
            d[i][j] = min(d[i][j], d[i][x] + 1 + d[y][j]);
            d[i][j] = min(d[i][j], d[i][y] + 1 + d[x][j]);
            ++c[d[i][j]];
        }
    }

    loop(i,1,n) cout<<c[i]<<'\n';

    return 0;
}


Measured memory_bytes: 15872
#include <stdio.h>
#include <math.h>
int main()
{
    int n;
    scanf("%d",&n);
    int sz[100000],asd[100000];
    int i;
    int s;
    for(i=1; i<=n; i++)
    {
        scanf("%d",&sz[i]);
    }
    s=0;
    sz[0]=0;
    for(i=1; i<=n; i++)
    {
        s=s+abs(sz[0]-sz[i]);
        sz[0]=sz[i];

    }
    s=s+abs(sz[0]);
    sz[0]=0;
    for(i=1; i<=n; i++)
    {
        asd[i]=s-abs(sz[i]-sz[i-1])-abs(sz[i+1]-sz[i])+abs(sz[i-1]-sz[i+1]);
        printf("%d\n",asd[i]);
    }
    return 0;
}


Measured memory_bytes: 1536
#include <stdio.h>
#include <string.h>

/*--- 文字列strの長さを返す ---*/
unsigned str_length(const char str[])
{
    unsigned len = 0;
    while (str[len])
        len++;
    return (len);
}

/*--- 文字列を逆順に並べ替える ---*/
void rev_string(char str[])
{
    int i;
    int len = str_length(str);
    for (i = 0; i < len / 2; i++) {
        char temp = str[i];
        str[i] = str[len-i-1];
        str[len-i-1] = temp;
    }
}

//文字列の切り出し
int substr( char *t, const char *s, int pos, int len )
{
    if( pos < 0 || len < 0 || len > strlen(s) )
        return -1;
    for( s += pos; *s != '\0' && len > 0; len-- )
        *t++ = *s++;
    *t = '\0';
    return 0;
}


int main(void)
{
    int len,i,count;
    char str[100];
    char s[100];
    char t[100];

    scanf("%s", str);

    len = str_length(str);

    if(len % 2==0){
        substr(s,str,0,len/2);
        substr(t,str,len/2,len/2);
        rev_string(s);

        count = 0;

        for(i=0;i<=len/2;i++){
            if(s[i]!=t[i]){
                count = count + 1;
            }
        }
    }

    if(len % 2==1){
        substr(s,str,0,(len-1)/2);
        substr(t,str,(len-1)/2 + 1,(len-1)/2);
        rev_string(s);

        count = 0;

        for(i=0;i<=(len-1)/2;i++){
            if(s[i]!=t[i]){
                count = count + 1;
            }
        }
    }

    printf("%d",count);


    return (0);
}

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

typedef long long ll;
typedef vector<ll> vint;
typedef vector< vector<ll> > vvint;

#define rep(i,n) for(ll i=0;i<n;i++)
#define repf(i,f,n) for(ll i=f;i<n;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define ALL(obj) (obj).begin(), (obj).end()
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int dy[]={0, 0, 1, -1, 1, -1, -1, 1};
int dx[]={1, -1, 0, 0, 1, 1, -1, -1};

vector< int64_t > divisor(int64_t n) {
  vector< int64_t > ret;
  for(int64_t i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

int main() {
    cout<<fixed<<setprecision(10);

    ll n; cin>>n;
    vint a(n), b(n);
    rep(i,n){
        // scanf("%ld.%ld", &a[i], &b[i]);
        string s; cin>>s;
        ll j = 0;
        a[i] = 0;
        while(s[j] != '.' and j<s.size()){
            a[i] = a[i]*10 + (ll)(s[j]-'0');
            j++;
        }
        j++;
        ll cnt = 0;
        b[i] = 0;
        while(j<s.size()){
            b[i] = b[i]*10 + (ll)(s[j]-'0');
            j++;
            cnt++;
        }

        while(cnt<9){
            b[i] *= 10;
            cnt++;
        }
    }

    vvint cum(19, vint(19,0));
    vint c2(n,0),c5(n,0);
    ll ans = 0;

    rep(i,n){
        ll x = 1000000000*a[i] + b[i];
        while(x%2==0){
            c2[i]++;
            x/=2;
        }
        while(x%5==0){
            c5[i]++;
            x/=5;
        }
        chmin(c2[i],18ll);
        chmin(c5[i],18ll);


        rep(j,19){
            rep(k,19){
                if(c2[i]+j>=18 and c5[i]+k>=18){
                    ans += cum[j][k];
                }
            }
        }

        cum[c2[i]][c5[i]]++;
    }

    cout<<ans<<endl;


    return 0;


}


Measured memory_bytes: 9488
#include <bits/stdc++.h>
using namespace std;
#define int long
const int mod = 1e9 + 7;
signed main() {
    int n;
    cin >> n;
    vector<int> c(n), dp(n, 0);
    for (int& i : c) cin >> i;
    map<int, int> m;
    dp[0] = 1;
    for (int i = 0; i < n; ++i) {
        if (i) dp[i] = dp[i - 1];
        if (m.count(c[i]) && m[c[i]] + 1 < i) (dp[i] += dp[m[c[i]]]) %= mod;
        m[c[i]] = i;
    }
    cout << dp[n - 1];
}

Measured memory_bytes: 15872
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> VI;
typedef vector<VI> VVI;//例: VVI dp(10, vector<int>(10, INF);
typedef priority_queue<int, vector<int>, less<int> > QUE_int;
const int INF = pow(10, 5)+1;//+1しないとREになる(out of rangeになるんかな?? )


int main(){
  int N, M;
  cin >> N >> M;
  if(N==M) cout << "Yes" << endl;
  else cout << "No" << endl;
}


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

using namespace std;

const int N=1e6+3;

const double eps=0.000000001;

#define pb push_back
#define all(x) (x).begin(),(x).end()
typedef long long ll;

const int dx[]={1,-1,0,0},
		  dy[]={0,0,1,-1};

const int inf=1e9,mod=1e9+7;

int n,m,a[N],b[N],k,q,u,v,x,y,tc,c,l,r,ans,cnt[100005],p;

char s[N];

void IO(){
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	#ifndef ONLINE_JUDGE
		freopen("test.txt","r",stdin);
	#endif
}

ll modExp(ll base, ll power) {
    if (power == 0) {
        return 1;
    } else {
        ll cur = modExp(base, power / 2); cur = cur * cur; cur = cur % p;
        if (power % 2 == 1) cur = cur * base;
        cur = cur % p;
        return cur;
    }
}

int main(){
	//IO();
	scanf("%d %d",&n,&p);
	scanf("%s",s);
	int mod=0;
	ll ans=0;
	ll cur=0;
	for(int i=0;s[i];i++){
		x=s[i]-'0';
		cur *= 10; cur += x; cur %= p;
        int val = modExp(10, n-1-i) * cur; val %= p;
        cnt[val]++;
		if ((p==2 || p==5) && x%p==0)
			ans+=i+1;
	}
	cnt[0]++;
	if (p==2 || p==5)
		return !printf("%lld\n",ans);
	for(int i=0;i<p;i++){
 		ans +=(ll)cnt[i]*(cnt[i]-1)/2;
	}
	printf("%lld\n",ans);
}


Measured memory_bytes: 512
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;

//typedef
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//conversion
inline LL toLong(string s) {LL v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) LL((a).size())
#define EACH(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define UNTIL(p) while(!(p))

//constant
const double EPS = 1e-5;
const double PI  = acos(-1.0);

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

#define PUTS(x) cout << (x) << endl;


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

    char maze[22][22]={{0}};
    REP(i,22)REP(j,22)maze[i][j]='#';
    LL h,w;
    cin>>h>>w;
    REP(i,h)REP(j,w)cin>>maze[i+1][j+1];
    h+=2;
    w+=2;

    LL ans = 0;
    REP(s,h*w){
        LL si = s/w;
        LL sj = s%w;
        if(maze[si][sj]=='#')continue;
        FOR(g,s+1,h*w){
            LL gi = g/w;
            LL gj = g%w;
            if(maze[gi][gj]=='#')continue;


            LL d[22][22] = {{0}};
            REP(i,22)REP(j,22)d[i][j] = -1;
            LL min_d = 99999;
            deque<PLL> q;
            q.PB(MP((LL)0,(si*w + sj)));
            UNTIL(q.empty()){
                PLL now = q.front();
                q.pop_front();

                LL ni = now.second/w;
                LL nj = now.second%w;
                if(maze[ni][nj] == '#' || d[ni][nj] != -1)continue;
                d[ni][nj] = now.first;
                if(ni == gi && nj == gj){
                    min_d = now.first;
                    break;
                }
                q.PB(MP(now.first+1, (ni*w + nj+1)));
                q.PB(MP(now.first+1, (ni*w + nj-1)));
                q.PB(MP(now.first+1, ((ni+1)*w + nj)));
                q.PB(MP(now.first+1, ((ni-1)*w + nj)));
            }
            ans = max(ans, min_d);
        }
    }

    PUTS(ans);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
	string s, t, k; int a, b; cin >> s >> t >> a >> b >> k;
  	if (k == t & b != 0) b--;
  	else if (k == s && a != 0) a--;
  	cout << a << " " << b;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define pb push_back
#define ll long long int
#define ld long double
#define fi first
#define se second
#define mod 1000000007
#define all(v) v.begin(),v.end()
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define go_t int t;cin>>t;for(int tt=1;tt<=t;tt++)
#define set_ar(arr,v) memset(arr,v,sizeof(arr))
#define trace2(x, y)             cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<< endl;
#define trace3(x, y, z)          cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define trace4(a, b, c, d)       cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;
#define trace5(a, b, c, d, e)    cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<<": "<<e<<endl;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set; // order_of_key
typedef pair<int,int>pi;
typedef pair<ll,ll>pl;
const ll inf = 0x3f3f3f3f3f3f3f3fll;//4x10e18
const int maxx = 3000000;
#define PI 3.14159265
int main()
{
    fastio;
    int k,n;
    cin>>k>>n;
    int a[n];
    for(int i=0;i<n;i++)cin>>a[i];
    sort(a,a+n);
    int ans = INT_MAX;
    for(int i=1;i<n;i++)
    {
        ans = min(ans,k-(a[i]-a[i-1]));
    }
    ans = min(ans,k-(k-a[n-1]+a[0]));
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<algorithm>
#include<unordered_set>
#include<set>
#include<map>
#include<unordered_map>
#include<stack>
#include<queue>
#include<string>
#include<cmath>
#include<climits>
using namespace std;

int main() {
    int n,K;
    cin>>n>>K;
    vector<int> ht(n+1,0);
    for(int i=1;i<=n;i++)
        cin>>ht[i];
    
    vector<int> dp(n+1,INT_MAX);
    dp[0]=0;
    dp[1]=0;
    for(int i=1;i<=K;i++)   
        dp[i] = abs(ht[i]-ht[1]);
    for(int i=2;i<=n;i++) {
        for(int k=1;k<=K && i-k>=1;k++) 
            dp[i] = min(abs(ht[i]-ht[i-k])+dp[i-k], dp[i]);
    }
    cout<<dp[n];
}


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

int main(){
  int N;
  cin >> N;
  vector<int> d(N);
  vector<int> c;
  for(int i = 0;i < N;i++){
    cin >> d.at(i);
  }
  
  c.push_back(d.at(0));
  for(int i = 0;i < N;i++){
    bool flg = false;
    for(int j = 0;j < c.size();j++){
      if(c.at(j) == d.at(i)){
        flg = true;
      }
    }
    if(flg == false){
      c.push_back(d.at(i));
    }
  }

  cout << c.size() << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
     
    public class Main {
        public static void main(String[] args){
            Scanner sc = new Scanner(System.in);
            int A = sc.nextInt();
            int B = sc.nextInt();
            int C = sc.nextInt();
            System.out.println(C + " " + A + " " + B);
        }
    }

Measured memory_bytes: 22996
//#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);
    string a,b;
    cin >> a >> b;
    a = a+b;
    int x = atoi(a.c_str());
    for(int i=1;i*i<=x;++i){
        if(i*i==x){
            puts("Yes");
            return 0;
        }
    }
    puts("No");

    return 0;
}

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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
// using P = std::tuple<int,int>;

int N;
int P[10], Q[10];
int A[41000][10];
int n;

int f(int (&P)[10]){
    for(int i=0;i<n;++i){
        bool ok = true;

        for(int j=0;j<N;++j){
            if(P[j] != A[i][j]){
                ok = false;
            }
        }

        if(ok){
            return i;
        }
    }
    
    return -1;
}

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

  std::cin >> N;

  int B[10];
  std::iota(B, B + N, 1);

  while(true){
      for(int i=0;i<N;++i){
          A[n][i] = B[i];
      }
      n += 1;

      if(!std::next_permutation(B, B + N)){
          break;
      }
  }

  for(int i=0;i<N;++i){
      std::cin >> P[i];
  }

  for(int i=0;i<N;++i){
      std::cin >> Q[i];
  }

  int a = f(P), b = f(Q);
  int res = std::abs(a - b);

  std::cout << res << std::endl;
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <queue>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <complex>
#include <set>
#include <map>
#include <cmath>
using namespace std;



int main(){
	int N;
	while(cin >> N && N){
		set< pair< pair<int,int> , int> > se;
		for(int i = 0 ; i < N ; i++){
			string s;
			cin >> s;
			if( s == "D" ){
				int v;
				cin >> v;
				vector< pair< pair<int,int>,int> > del;
				for( set< pair< pair<int,int> , int> >:: iterator it = se.begin(); it != se.end() ;){
					if( it->second == v ){
						se.erase(it++);
					}else{
						++it;
					}
				}
			}else if( s == "W" ){
				int l,sec;
				cin >> l >> sec;
				int prev = 0;
				vector< pair<int,int> > ad;
				for( set< pair< pair<int,int> , int> >:: iterator it = se.begin(); it != se.end() ;++it){
					if( sec == 0 ) break;
					int width = it->first.first - prev;
					int use = min(sec,width);
					if( use != 0 ) {
						sec -= use;
						ad.push_back(make_pair(prev,prev+use));
					}
					prev = it->first.second;
				}
				if( sec != 0 ){
					ad.push_back(make_pair(prev,prev+sec));
				}
				for(int i = 0 ; i < ad.size() ; i++)
					se.insert(make_pair(ad[i],l));
			}else{
				int pos;
				cin >> pos;
				int flag = 0;
				for( set< pair< pair<int,int> , int> >:: iterator it = se.begin(); it != se.end() ;++it){
					if( it->first.first <= pos && pos < it->first.second ){
						cout << it->second << endl;
						flag = 1;
						break;
					}
				}
				if( !flag ){
					cout << -1 << endl;
				}
			}
		}
		cout << endl;
	}
}

Measured memory_bytes: 1444
H, W = map(int, input().split())
c = [list(map(int, input().split())) for i in range(10)]
A = [list(map(int, input().split())) for i in range(H)]

for k in range(10):
    for i in range(10):
        for j in range(10):
            c[i][j] = min(c[i][j], c[i][k]+c[k][j])

ans = 0
for row in A:
    for a in row:
        if a < 0:
            continue
        ans += c[a][1]
print(ans)

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

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  int l, r;
  l = a + b;
  r = c + d;
  string ans;
  if (l > r) {
    ans = "Left";
    
  } else if (l < r) {
    ans = "Right";
  } else {
    ans = "Balanced";
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
N = int(input())
 
A = [0] * N
x = [[0]*N for _ in range(N)]
y = [[0]*N for _ in range(N)]
 
for i in range(N):
    A[i] = int(input())
    for j in range(A[i]):
        x[i][j], y[i][j] = map(int, input().split())

ans = 0
 
for i in range(2**N):
    bit = bin(i)[2:].zfill(N)
    checked = 1
    for j in range(N):
        if bit[j] == "1":
            for k in range(A[j]):
                if int(bit[x[j][k] - 1]) != y[j][k]:
                    checked = 0
                    break
    if checked == 1:
        ans = max(ans, bit.count("1"))
 
print(ans)

Measured memory_bytes: 3064
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

#define MAX(x,y) (x>y?x:y)
#define MIN(x,y) (x<y?x:y)
#define ABS(x) (x>0?x:-(x))

#define INF 1000000000

void swap(int* a, int* b)
{
	int tmp;
	tmp = *a;
	*a = *b;
	*b = tmp;
}

int gcd(int a, int b)
{
	if (a < b)
		swap(&a, &b);

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

int lcm(int a, int b)
{
	return a*b/gcd(a, b);
}

void bubble_sort(int* p, int n)
{
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < n - i - 1; j++)
		{
			if (p[j] > p[j + 1])
				swap(&p[j], &p[j + 1]);
		}
	}
}

int array_max(int* p, int n)
{
	int max = 0;
	for (int i = 0; i < n; i++)
	{
		if (p[i] > max)
			max = p[i];
	}
	return max;
}

int binary_search(int* p, int key, int n)
{
	int low = 0, high = n - 1;
	int middle;

	while (low <= high)
	{
		middle = (low + high) / 2;

		//printf("low %d  middle %d  high %d\n", low, middle, high);

		//for (int i = 0; i < n; i++)
		//{
		//	if (i == middle)
		//		printf(" ^ ");
		//	else if (i == low)
		//		printf(" [ ");
		//	else if (i == high)
		//		printf(" ] ");
		//	else if (i == middle)
		//		printf(" ^ ");
		//	else
		//		printf("   ");
		//}
		//printf("\n");

		if (key == p[middle])
			return key;
		else if (key < p[middle])
			high = middle - 1;
		else if (key > p[middle])
			low = middle + 1;
	}

	//printf("low %d  middle %d  high %d\n", low, middle, high);
	return -1;
}

int main()
{
	int X;
	int count = 0;

	scanf("%d", &X);

	while (1)
	{
		count = 0;
		for (int i = 2; i < X; i++)
		{
			if (X % i == 0)
				count++;
		}
		if (count == 0)
		{
			printf("%d\n", X);
			return 0;
		}
		X++;

	}

	return 0;
}

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

using namespace std;

int main(){
    int n = 0, k = 0;
    cin >> n >> k;
    int number = 0;
    vector<int> x;
    for(int i = 0; i < n; ++i){
        cin >> number;
        x.push_back(number);
    }
    --k, --n;
    cout << (n+k-1)/k << endl;
    
    return 0;
}

Measured memory_bytes: 892
#include<bits/stdc++.h>
using namespace std;
int main()
{
 long long a,b,c,d,x,y;
 long long p,q,r,s,m,n;
  cin>>a>>b>>c>>d;

p=max(a,b);
q=min(a,b);
r=max(c,d);
s=min(c,d);
if(p*r>p*s)
{
	x=p*r;
}
else x=p*s;

if (q*r>q*s)
{
	y=q*r;
}
else y=q*s;
cout<<max(x,y);
}

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

using namespace std;

int max_subsequence(vector<int> xs) {
    int hi = 0;
    int current_lo = 0;
    int current_sum = 0;
    for (auto x : xs) {
        current_sum += x;
        current_lo = min(current_lo, current_sum);
        hi = max(hi, current_sum - current_lo);
    }
    return hi;
}


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int h, w, n;
    int s_r, s_c;
    string s, t;
    cin >> h >> w >> n;
    cin >> s_r >> s_c;
    cin >> s >> t;
    auto f = [&](int start, char x, char y) {
        vector<int> xs;
        xs.push_back(start);
        for (int i = 0; i < n; ++i) {
            if (s[i] == x) {
                xs.push_back(1);
            }
            if (t[i] == y) {
                xs.push_back(-1);
            }
        }
        return xs;
    };
    bool a = max_subsequence(f(s_c - 1, 'R', 'L')) >= w;
    bool b = max_subsequence(f(w - s_c, 'L', 'R')) >= w;
    bool c = max_subsequence(f(s_r - 1, 'D', 'U')) >= h;
    bool d = max_subsequence(f(h - s_r, 'U', 'D')) >= h;
    if (a || b || c || d) {
        cout << "NO" << endl;
    } else {
        cout << "YES" << endl;
    }
    return 0;
}


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

namespace x
{
    class Program
    {
        static readonly int MODBASE = (int)(Math.Pow(10, 9) + 7);
        static void Main(string[] args)
        {
            var n = IOUtils.ReadInt();
            var power = 1;
            long result = power;

            for (int i = 1; i <= n; i++)
            {
                result = (result * i) % MODBASE;
            }
            
            System.Console.WriteLine(result);
        }
    }
    
    static class IOUtils
    {
        // public static (int a, int b) Read2Ints()
        // {
        //     var vals = ReadInts();
        //     return (vals[0], vals[1]);
        // }
        // public static (int a, int b, int c) Read3Ints()
        // {
        //     var vals = ReadInts();
        //     return (vals[0], vals[1], vals[2]);
        // }
        public static IEnumerable<int[]> ReadIntLines(int count)
        {
            for (int i = 0; i < count; i++)
            {
                yield return ReadInts();
            }
        }
        public static IEnumerable<long[]> ReadLongLines(int count)
        {
            for (int i = 0; i < count; i++)
            {
                yield return ReadLongs();
            }
        }
        public static int ReadInt()
        {
            return int.Parse(Console.ReadLine());
        }
        public static long ReadLong()
        {
            return long.Parse(Console.ReadLine());
        }
        public static ulong ReadUlong()
        {
            return ulong.Parse(Console.ReadLine());
        }
        public static int[] ReadInts()
        {
            return Console.ReadLine().Split(' ').Select(v => int.Parse(v)).ToArray();
        }
        public static long[] ReadLongs()
        {
            return Console.ReadLine().Split(' ').Select(v => long.Parse(v)).ToArray();
        }

        public static void WriteNums(params int[] nums)
        {
            Console.WriteLine(string.Join(" ", nums));
        }
    }
}


Measured memory_bytes: 13140
using System;
using System.IO;
using System.Linq;

namespace Triangular_Relationship
{
    class Program
    {
        public static void Main(string[] args)
        {
            using (var sc = new SetConsole())
            {
                var input = GetArrayIntInput();
                var n = input[0];
                var k = input[1];
                var count = (long)Math.Pow(n / k, 3);
                if (k % 2 == 0)
                {
                    count += (long)Math.Pow((n + (k / 2)) / k, 3);
                }
                CWrite(count);
            }
        }

        static string[] GetArrayCharInput() => Console.ReadLine().Split();
        static int[] GetArrayIntInput() => Console.ReadLine().StringToIntArray();
        static int GetIntInput() => Console.ReadLine().ToInt();
        static void CWrite<T>(T str) => Console.WriteLine(str);

    }

    class SetConsole : IDisposable
    {
        StreamWriter sw = new StreamWriter(Console.OpenStandardOutput());
        public SetConsole()
        {
            sw.AutoFlush = false;
            Console.SetOut(sw);
        }
        public void Dispose()
        {
            Console.Out.Flush();
            sw.AutoFlush = true;
            Console.SetOut(sw);
        }
    }

    static class ExtentionsLibrary
    {
        public static int[] StringToIntArray(this string str) =>
            str.Split().Select(int.Parse).ToArray();
        public static int ToInt(this string str) => int.Parse(str);
    }
}


Measured memory_bytes: 13396
import heapq
from collections import defaultdict
n,m = map(int,input().split())
dct = defaultdict(list)

for i in range(n):
    a,b = map(int,input().split())
    dct[a].append(-b)

h = []
ans = 0

for i in range(1,m+1):
    if dct[i]:
        for item in dct[i]:
            heapq.heappush(h, item)
    if h:
        ans += heapq.heappop(h)
print(-ans)


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

using namespace std;





int main()
{/////////////////hi
    int m;
    cin>>m;
   int flag=0;
   for(int i=1;i<10;i++)
   {
       for(int j=1;j<10;j++)
       {
           if(i*j==m)
            flag=1;



       }
   }

   if(flag==1)
            cout<<"Yes";
   else
    cout<<"No";






}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll int64_t
#define sec second
#define f first
#define pb push_back
#define pf push_front
#define po pop_back
const ll mod=1000000007;
const ll MOD=998244353;
#define fast ios_base::sync_with_stdio(false)
#define vi vector<ll>
#define vii vector< pair<ll,ll> >
#define pii pair<ll,ll>
#define set set<ll>
#define map map<ll,ll>
#define tostr to_string
#define toint stoi
#define gcd __gcd
ll maxm(ll a,ll b){return a>b?a:b;}
ll minm(ll a,ll b){return a>b?b:a;}
#define max maxm
#define min minm
ll powr(ll x,ll n){ll result=1;while(n>0){if(n%2==1)result=result*x;x=x*x;n=n/2;}return result;}
#define pow powr
ll modpow(ll a,ll b){ll res=1;a%=mod;assert(b>=0);for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
const ll inf=1e18;
const double pi=3.1415926535897932384626433832795;

ll dp[200006];
int main()
{
    fast;

   ll n,i;
   cin>>n;
   ll x;
   for(i=1;i<=n;i++)
    {
      cin>>x;
      dp[x]=dp[x-1]+1;
    }
    cout<<n-*max_element(dp,dp+n+1)<<endl;
}



Measured memory_bytes: 1792
#include <stdio.h>

int main()
{
    int h,w;
    scanf("%d %d",&h,&w);

    int i,j,k,l;
    char s[50][51];
    for (i = 0; i < h; i++)scanf("%s",s[i]);

    int count[100][100] = {0};

    for (i = 0; i < h; i++)
    {
        for (j = 0; j < w; j++)
        {
            if(s[i][j] == '#')
            {
                for (k = -1; k <= 1; k++)
                {
                    for (l = -1; l <= 1; l++)
                    {
                        count[i + 1 + k][j + 1 + l]++;
                    }
                }
            }
        }
    }
    
    for (i = 0; i < h; i++)
    {
        for (j = 0; j < w; j++)
        {
            if(s[i][j] == '#')printf("#");
            else printf("%d",count[i + 1][j + 1]);
        }
        printf("\n");
    }
    
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#define VSORT(v) sort(v.begin(), v.end())
#define SORT(v, n) sort(v, v+n)
#define vi vector<int>
#define pb push_back
#define P pair<int,int>


template <class T> void chmin(T&a, const T&b) { a = min(a,b); }
template <class T> void chmax(T&a, const T&b) { a = max(a,b); }

const double EPS =1e-9;
const long INF =999999999;
const long MOD =1000000007; //10^9+7
#define PI 3.14159265258979

int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};

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

ull lcm(ull a,ull b){
	ll g=gcd(a,b);
	return a/g*b;
}

int main(){
	int N;
	ull result=1;
	cin>>N;
	FOR(i,0,N){
		ull T;
		cin>>T;
		result=lcm(result,T);
	}

	cout<<result<<endl;
	return 0;
}



Measured memory_bytes: 256
N = int(input())
xy = []
for i in range(N):
  xy.append(list(map(int,input().split())))
ans = 0
for i in range(N):
  for j in range(N):
    if i != j:
      ans += ((xy[i][0]-xy[j][0])**2 + ((xy[i][1]-xy[j][1])**2))**0.5
print(ans/N)

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    string s;
    cin >> s;
    auto iter = find(s.begin(), s.end(), 'C');
    auto iter2 = find(iter, s.end(), 'F');
    if(iter != s.end() && iter2 != s.end()) cout << "Yes";
    else cout << "No";
    cout << endl;
    return 0;
}


Measured memory_bytes: 3580
#include<stdio.h>
int main(){
    int x, y, i;
    for(i=1;;i++){
        scanf("%d %d",&x,&y);
        if(x==0 && y==0) break;
        if(x<y){
            printf("%d %d\n",x,y);
        }
        else{
            printf("%d %d\n",y,x);
        }
    }
    return 0;
}


Measured memory_bytes: 1972
#include <float.h>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

// 内部定数
#define D_MOD			1000000007								// 除数(10の9乗+7)
#define D_DIGIT_MAX		100005									// 最大桁数

// 内部変数
static FILE *szpFpI;											// 入力
static char sc1Val[D_DIGIT_MAX];								// 値
static int si2PCnt[D_DIGIT_MAX][3];								// パターン数[桁数][0 or 1 or 最大値]

// 内部変数 - テスト用
#ifdef D_TEST
	static int siRes;
	static FILE *szpFpA;
	static int siTNo;
#endif

// １行出力
int
fOutLine(
	char *pcpLine				// <I> １行
)
{
	char lc1Buf[1024];

#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, pcpLine)) {
		siRes = -1;
	}
#else
	printf("%s", pcpLine);
#endif

	return 0;
}

// 実行メイン
int
fMain(
)
{
	int i, liNo;

	// 値 - 取得
	fgets(sc1Val, sizeof(sc1Val), szpFpI);

	// パターン数 - 初期値
	si2PCnt[0][0] = 1;
	si2PCnt[0][2] = 2;

	// パターン数 - セット
	for (liNo = 1; ; liNo++) {
		if (sc1Val[liNo] < '0' || '1' < sc1Val[liNo]) {
			break;
		}

		// -> 0
		si2PCnt[liNo][0] = (si2PCnt[liNo - 1][0] + si2PCnt[liNo - 1][1]) % D_MOD;

		// -> 1
		si2PCnt[liNo][1] = (si2PCnt[liNo - 1][0] + si2PCnt[liNo - 1][1]) % D_MOD * 2 % D_MOD;

		// 最大値
		if (sc1Val[liNo] == '0') {
			si2PCnt[liNo][2] = si2PCnt[liNo - 1][2];
		}
		else {

			// -> 0
			si2PCnt[liNo][0] = (si2PCnt[liNo][0] + si2PCnt[liNo - 1][2]) % D_MOD;

			// -> 1
			si2PCnt[liNo][2] = si2PCnt[liNo - 1][2] * 2 % D_MOD;
		}
	}

	// パターン数 - 合計
	int liPCnt = 0;
	for (i = 0; i < 3; i++) {
		liPCnt = (liPCnt + si2PCnt[liNo - 1][i]) % D_MOD;
	}

	return liPCnt;
}

// １回実行
int
fOne(
)
{
	int liRet;
	char lc1Buf[1024];

	// データ - 初期化
	memset(si2PCnt, 0, sizeof(si2PCnt));						// パターン数

	// 入力 - セット
#ifdef D_TEST
	sprintf(lc1Buf, ".\\Test\\T%d.txt", siTNo);
	szpFpI = fopen(lc1Buf, "r");
	sprintf(lc1Buf, ".\\Test\\A%d.txt", siTNo);
	szpFpA = fopen(lc1Buf, "r");
	siRes = 0;
#else
	szpFpI = stdin;
#endif

	// 実行メイン
	liRet = fMain();

	// １行出力
	sprintf(lc1Buf, "%d\n", liRet);
	fOutLine(lc1Buf);

	// 残データ有無
#ifdef D_TEST
	lc1Buf[0] = '\0';
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, "")) {
		siRes = -1;
	}
#endif

	// テストファイルクローズ
#ifdef D_TEST
	fclose(szpFpI);
	fclose(szpFpA);
#endif

	// テスト結果
#ifdef D_TEST
	if (siRes == 0) {
		printf("OK %d\n", siTNo);
	}
	else {
		printf("NG %d\n", siTNo);
	}
#endif

	return 0;
}

// プログラム開始
int
main()
{

#ifdef D_TEST
	int i;
	for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {
		siTNo = i;
		fOne();
	}
#else
	fOne();
#endif

	return 0;
}



Measured memory_bytes: 1408
#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 << "Left" << endl;
    }else if(A+B < C+D){
        cout << "Right" << endl;
    }else{
        cout << "Balanced" << endl;
    }
}

Measured memory_bytes: 3620