akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < (int)(b); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 1e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    int D; //365
    cin >> D;

    int c[26];
    rep(i, 0, 26) {
        cin >> c[i];
    }

    int s[D][26];
    int t[D] = {};
    //各日について、s[i][j]が最大になるコンテストタイプで初期化
    rep(i, 0, D) {
        int mx = -1;
        rep(j, 0, 26) {
            cin >> s[i][j];
            if (mx < s[i][j]) {
                mx = s[i][j];
                t[i] = j;
            }
        }
    }

    //日程を乱数で初期化
    srand(time(NULL));
    /*rep(i, 0, D) {
        t[i] = rand() % 26;
    }*/

    ll mx_score = -1e18;
    int cnt = 90000;
    while (cnt--) {
        //d日目のコンテストをqに置き換えてスコアを計算し、改善しなければ元に戻す
        int d = rand() % 365;
        int q = rand() % 26;
        int old = t[d];
        t[d] = q;

        //スコアを計算する
        ll score = 0;
        vector<int> last_day(26, -1);
        rep(i, 0, D) {
            //増加分
            score += s[i][t[i]];

            last_day[t[i]] = i;

            //減少分
            ll decrease = 0;
            rep(j, 0, 26) {
                decrease += c[j] * (i - last_day[j]);
            }
            score -= decrease;
        }
        //cout << "score[D - 1]: " << score[D - 1] << endl;
        if (mx_score > score) {
            t[d] = old;
        } else {
            mx_score = score;
        }
    }

    rep(i, 0, D) cout << t[i] + 1 << endl;
    return 0;
}


Measured memory_bytes: 3584
import fractions
a,b=map(int,input().split())
gcd_ab=fractions.gcd(a, b)

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

ans=1
ans+=len(set(prime_factorize(gcd_ab)))
print(ans)

Measured memory_bytes: 5344
#define ll long long
#define vi vector<int>

#include<iostream>
#include<bitset>
#include<vector>
#include<algorithm>

using namespace std;

int main(){
	ll n,k;
	cin>>n>>k;
	ll ans=0,xi=0;
	for(int i =0;i<n;i++){
		cin>>xi;
		if(xi<=k/2){
			ans+=xi;
		}else{
			ans+=k-xi;
		}
	}
	cout<<2*ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <queue>
#define ll long long
#define space putchar(' ')
#define endl putchar('\n')
#define debug puts("------------------------")
#define F(i,x,n) for(int i=x;i<=n;++i)
#define F_(i,x,n) for(int i=x;i>=n;--i)
using namespace std;
inline void read(int &a) {a=0;int c=getchar(),b=1; while(c>'9'||c<'0') {if(c=='-')b=-1;c=getchar();} while(c>='0'&&c<='9') a=(a<<3)+(a<<1)+c-48,c=getchar();a*=b; }
inline int  Rem() {int a=0,c=getchar(),b=1; while(c>'9'||c<'0') {if(c=='-')b=-1;c=getchar();} while(c>='0'&&c<='9') a=(a<<3)+(a<<1)+c-48,c=getchar();return a*=b; }
inline void write(int x) {if(x>9)write(x/10);putchar('0'+x%10);}
inline void W(int x) {if(x<0){putchar('-'),x=-x;}write(x);}
/**/
char s[200005];
int f[200005][3],n;
/**/
int main()
{
    scanf("%s",s+1);
    n=strlen(s+1);
    f[1][1]=f[2][2]=1;
    if(s[1]!=s[2]) f[2][1]=2;
    for(int i=3;i<=n;i++)
    {
        f[i][1]=f[i-1][2]+1;
        if(s[i]!=s[i-1]) f[i][1]=max(f[i-1][1]+1,f[i][1]);
        f[i][2]=f[i-2][1]+1;
        if(s[i-1]+s[i]!=s[i-3]+s[i-2]) f[i][2]=max(f[i-2][2]+1,f[i][2]);
    }
    cout<<max(f[n][1],f[n][2]);
    return 0;
}

Measured memory_bytes: 2816
n, p = map(int, input().split())
arr = list(map(int, input().split()))

a = sum([x % 2 == 1 for x in arr])
b = n - a


def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p


MOD = 10**18 + 7
N = 10**6
fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]

for i in range(2, N + 1):
    fact.append((fact[-1] * i) % MOD)
    inv.append((-inv[MOD % i] * (MOD // i)) % MOD)
    factinv.append((factinv[-1] * inv[-1]) % MOD)

start = p

# aから奇数個 or 偶数個選ぶ
ans = 0
for i in range(p, a + 1, 2):
    for j in range(b + 1):
        ans += cmb(a, i, MOD) * cmb(b, j, MOD)

print(ans)

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

//#include <tuple>

//#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back

int main() {
  ll A, B, K, cnt = 0;
  cin >> A >> B >> K;
  if (A >= K) {
    A = A - K;
  } else {
    B = B - (K - A);
    A = 0;
  }
  if (B < 0) B = 0;
  cout << A <<" "<< B << endl;

}


Measured memory_bytes: 256
///Bismillahir Rahmanir Rahim
#include "bits/stdc++.h"

#define                           ll                          long long
#define                           int                         ll
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<ll,ll>
#define                           clr(x)                      memset(x,0,sizeof(x));
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           show(x,y)                   cout<<x<<" : ";for(auto z:y)cout<<z<<" ";cout<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

const ll inf=1e18;
const int mod=1e9+7;
const int M=100005;
int n,s1,s2;
vector<int>adj[M];
bool vis[M];
void bfs(int src,vector<int>&d)
{
    clr(vis);
    d.resize(n+2);
    queue<int>q;
    q.push(src);
    vis[src]=1;
    d[src]=0;
    while(!q.empty())
    {
        int u=q.front();
        q.pop();
        for(auto v:adj[u])
        {
            if(vis[v])continue;
            vis[v]=1;
            d[v]=d[u]+1;
            q.push(v);
        }
    }
}
 main()

{
    fast
    cin>>n>>s1>>s2;
    f(i,1,n-1)
    {
        int u,v;
        cin>>u>>v;
        adj[u].pb(v);
        adj[v].pb(u);
    }
    if(n==2)
    {
        cout<<"0"<<endl;
        return 0;
    }
    vector<int>d1,d2;
    bfs(s1,d1);
    bfs(s2,d2);
    int mx=-1,mxi;
    f(i,1,n)
    {
        if(d1[i]<d2[i])
        {
            int  mov=d1[i]+(d2[i]-d1[i]-1);
            mx=max(mx,mov);
        }
    }
    if(mx==-1)
    {
        mx=1;
    }
    cout<<mx<<endl;
    return 0;

}





































Measured memory_bytes: 8192
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define REP(i, n) for(int i = 1; i < (int)(n); ++i)
using namespace std;

int main() {
    int N, K;
    cin >> N >> K;
    vector<int> h(N);
    rep(i, N) cin >> h[i];
    
    sort(h.begin(), h.end());
    int ans = 1000000000;
    rep(i, N - K + 1) ans = min(ans, h[i + K - 1] - h[i]);
    cout << ans << endl;
    return 0;
}


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

int main(void){
    
    string str;
    getline(cin, str);
    
    for(int i = 0; i < str.size(); i++){
        if(isalpha(str[i])){
            if(isupper(str[i])) str[i] = tolower(str[i]);
            else str[i] = toupper(str[i]);
        }
    }
    
    cout << str << endl;

}



Measured memory_bytes: 3236
#include <bits/stdc++.h>
using namespace std ;
template < class R > inline void Readin( R &K ) {bool F=K=0;char C=getchar();while(C<'0'||C>'9')
{if(C=='-')F=1;C=getchar();}while(C<='9'&&C>='0')K=(K<<1)+(K<<3)+C-'0',C=getchar();if(F)K=-K;}
template < class R > inline bool Checkmax( R &A , R B ) { return A < B ? A = B , 1 : 0 ; }
template < class R > inline bool Checkmin( R &A , R B ) { return A > B ? A = B , 1 : 0 ; }
const int MaxN = 100000 + 10 ;
int X , Y , Z , N ;
long long Ans = -1ll << 60 , Add ;
struct P_ {
	long long A , B ;
	P_( long long a = 0 , long long b = 0 ) {
		A = a , B = b ;
	}
} P[MaxN] ;
inline bool Cmp( P_ A , P_ B ) {
	return A.A - A.B > B.A - B.B ;
}
priority_queue<long long> Q ;
long long Suf[MaxN] , Pre[MaxN] ;
int main() {
	Readin( X ) ;
	Readin( Y ) ;
	Readin( Z ) ;
	N = X + Y + Z ;
	for(register int i = 0 ; ++i <= N ; ) {
		register int A , B , C ;
		Readin( A ) ;
		Readin( B ) ;
		Readin( C ) ;
		Add += C ;
		P[i] = P_( A - C , B - C ) ;
	}
	sort( P + 1 , P + 1 + N , Cmp ) ;
	for(register int i = 0 ; ++i <= N ; ) {
		Q.push( -P[i].A ) ;
		Suf[i] = Suf[i-1] + P[i].A ;
		if( Q.size() > X ) {
			Suf[i] -= -Q.top() ;
			Q.pop() ;
		}
	}
	while( Q.size() ) Q.pop() ;
	for(register int i = N ; i ; --i ) {
		Q.push( -P[i].B ) ;
		Pre[i] = Pre[i+1] + P[i].B ;
		if( Q.size() > Y ) {
			Pre[i] -= -Q.top() ;
			Q.pop() ;
		}
	}
	for(register int i = X ; i + Y <= N ; ++i )
		Checkmax( Ans , Suf[i] + Pre[i+1] ) ;
	return not printf( "%lld\n" , Ans + Add ) ;
}

Measured memory_bytes: 4216
#include <bits/stdc++.h>
#define pb push_back
#define fs first
#define sc second
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

const int N=110000;
ll n, x[N];

int ok() {
	ll i, s=0, q=n*(n+1)/2;
	for(i=0; i<n; i++) s+=x[i];
	if(s%q) return 0;
	ll k=s/q;
	for(i=0; i<n; i++) {
		if(k+x[i]-x[i+1]<0) return 0;
		if((k+x[i]-x[i+1])%n) return 0;
	}
	return 1;
}

int main() {
	scanf("%lld", &n);
	for(ll i=0; i<n; i++) scanf("%lld", &x[i]);
	x[n]=x[0];
	printf(ok()? "YES\n":"NO\n");
   	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>

using namespace std;

int main()
{
	int n;
	cin >> n;
	
	vector<long long> a(n);
	for(int i = 0; i < n; i++)
	{
		cin >> a[i];
	}
	
	vector<int> x(3);
	for(int i = 0; i < n; i++)
	{
		if((a[i] % 4) == 0)
		{
			x[2]++;
		}
		else if((a[i] % 2) == 0)
		{
			x[1]++;
		}
		else
		{
			x[0]++;
		}
	}
	
	if((x[1] + x[2]) == n || x[0] <= x[2] || ((n % 2) == 1 && x[0] <= x[2] + 1))
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
	
	return 0;
}

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

const int N = 1000000;
int dp[2][N+1];

int main(){
  for(int i=0;i<=N;i++)dp[0][i] = dp[1][i] = N;
  dp[0][0] = dp[1][0] = 0;

  int val = 1;
  for(int i=2;val<=N;i++){
    for(int j=0;j+val<=N;j++){
      int nxt = j+val;
      dp[0][nxt] = min(dp[0][nxt],dp[0][j] + 1);
      if(val&1)dp[1][nxt] = min(dp[1][nxt],dp[1][j] + 1);
    }
    val = i*(i+1)*(i+2)/6;
  }

  int n;
  while(cin >> n,n)cout << dp[0][n] << " " << dp[1][n] << endl;
}

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

#define REP(i,n) for(long long i = 0; i < (n); i++)
#define FOR(i, m, n) for(long long i = (m);i < (n); ++i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SPEED cin.tie(0);ios::sync_with_stdio(false);

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQR = priority_queue<T,vector<T>,greater<T>>;

constexpr long long MOD = (long long)1e9 + 7;
constexpr long long MOD2 = 998244353;
constexpr long long HIGHINF = (long long)1e18;
constexpr long long LOWINF = (long long)1e15;
constexpr long double PI = 3.1415926535897932384626433;

template <class T> vector<T> multivector(size_t N,T init){return vector<T>(N,init);}
template <class... T> auto multivector(size_t N,T... t){return vector<decltype(multivector(t...))>(N,multivector(t...));}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const multiset<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "{" << obj.first << ", " << obj.second << "}"; return o;}
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
void print(void) {cout << endl;}
template <class Head> void print(Head&& head) {cout << head;print();}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head << " ";print(forward<Tail>(tail)...);}
template <class T> void chmax(T& a, const T b){a=max(a,b);}
template <class T> void chmin(T& a, const T b){a=min(a,b);}
void YN(bool flg) {cout << (flg ? "YES" : "NO") << endl;}
void Yn(bool flg) {cout << (flg ? "Yes" : "No") << endl;}
void yn(bool flg) {cout << (flg ? "yes" : "no") << endl;}

int main() {
	int N; cin >> N;
	vector<ll> A(N+1,0);
	for(int i = 1; i <= N; ++i) cin >> A[i];
	for(int i = 1; i <= N; ++i) A[i] += A[i-1];

	ll ans = LOWINF;
	for(int i = 1; i < N; ++i) {
		ll L = A[i],R = A[N]-A[i];
		chmin(ans,abs(L-R));
	}
	cout << ans << endl;

}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main()
{
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);
   long long int sheeps,wolf;
   cin>>sheeps>>wolf;
   if(wolf>=sheeps)
   {
     cout<<"unsafe"<<endl;
   }
   else
   {
     cout<<"safe"<<endl;
   }
}  

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

int main() {
  string day;
  cin >> day;
  int least = 0;
  if (day == "SUN") {
    least = 7;
  } else if (day == "MON") {
    least = 6;
  } else if (day == "TUE") {
    least = 5;
  } else if (day == "WED") {
    least = 4;
  } else if (day == "THU") {
    least = 3;
  } else if (day == "FRI") {
    least = 2;
  } else { least = 1; }
  cout << least << endl;
}

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

using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

int main() {

    int h, w; cin >> h >> w;

    vector<vector<int>> a(h, vector<int>(w));

    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            cin >> a[i][j];
        }
    }

    vector<tuple<int, int, int, int>> ans;

    for (int i = 0; i < h; ++i) {
        if (i % 2 == 0) {
            for (int j = 0; j < w; ++j) {
                if (i == h-1 && j == w-1) continue;

                if (j == w-1) {
                    if (a[i][j] % 2 != 0) {
                        a[i][j]--;
                        a[i+1][j]++;

                        ans.push_back(make_tuple(i, j, i+1, j));
                    }
                } else {
                    if (a[i][j] % 2 != 0) {
                        a[i][j]--;
                        a[i][j+1]++;

                        ans.push_back(make_tuple(i, j, i, j+1));
                    }
                }
            }
        } else {
            for (int j = w-1; j >= 0; --j) {
                if (i == h-1 && j == 0) continue;

                if (j == 0) {
                    if (a[i][j] % 2 != 0) {
                        a[i][j]--;
                        a[i+1][j]++;

                        ans.push_back(make_tuple(i, j, i+1, j));
                    }
                } else {
                    if (a[i][j] % 2 != 0) {
                        a[i][j]--;
                        a[i][j-1]++;

                        ans.push_back(make_tuple(i, j, i, j-1));
                    }
                }
            }
        }
    }

    cout << ans.size() << endl;

    for (auto t : ans) {
        cout << get<0>(t)+1 << ' ' << get<1>(t)+1 << ' ' << get<2>(t)+1 << ' ' << get<3>(t)+1 << endl;
    }
}

Measured memory_bytes: 5232
# /usr/bin/python
# -*- coding: utf-8 -*-
import math


N = int(input())
An = list(map(int, input().split()))
sm = [0, sum(An)]

ans = abs(An[0] - sum(An[1:]))
for i in range(N-1):
  sm[0] += An[i]
  sm[1] -= An[i]
  ans = min(ans, abs(sm[0]-sm[1]))
print(ans)

Measured memory_bytes: 76752
import java.util.*;
import java.io.*;
public class Main
{
    public static void main(String args[])throws Exception
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); 
        PrintWriter pw=new PrintWriter(System.out);
        int n=Integer.parseInt(br.readLine());
        int cntr[]=new int[200001];
        int arr[]=new int[n];
        long sum=0;
        String str[]=br.readLine().split(" ");
        for(int i=0;i<n;i++)
        {
            arr[i]=Integer.parseInt(str[i]);
            cntr[arr[i]]++;
        }
        for(int i=1;i<=200000;i++)
        sum+=(long)(cntr[i]-1)*cntr[i]/2;
        for(int i=0;i<n;i++)
        pw.println(sum-cntr[arr[i]]+1);
        pw.flush();
        pw.close();
    }
}


Measured memory_bytes: 54420
#include <bits/stdc++.h>
typedef long long ll;
#define pb push_back
using namespace std;
const int mx = 100000;
const int mod = 1e9 + 7;
ll dp[mx + 5][2];
vector <int> vec[mx + 5];
void dfs(int a, int p) {
	dp[a][0] = dp[a][1] = 1;
	for (int b : vec[a]) {
		if (b != p) {
			dfs(b, a);
			ll white = dp[b][0] + dp[b][1];
			white %= mod;
			ll black = dp[b][0];
			dp[a][0] *= white;
			dp[a][1] *= black;
			dp[a][0] %= mod;
			dp[a][1] %= mod;
		}
	}
}

int main() {
	int n;
	cin >> n;
	for (int i = 1; i < n; ++i) {
		int a, b;
		cin >> a >> b;
		vec[a].pb(b);
		vec[b].pb(a);
	}
	dfs(1, -1);
	cout << (dp[1][0] + dp[1][1]) % mod << endl;
}

Measured memory_bytes: 14208
#include<cstdio>
using namespace std;

int a, b, c, d, e;

int main() {
  scanf("%d%d%d%d%d", &a, &b, &c, &d, &e);
  int ans = 0;
  if (a > 0) ans = (b - a) * e;
  else ans = b * e + d + c * -a;
  printf("%d\n", ans);
}



Measured memory_bytes: 2740
#include <iostream>

using namespace std;

int main(){
  long long int N, Y;
  cin >> N >> Y;

  int ans1000 = -1;
  int ans5000 = -1;
  int ans10000 = -1;
  for(int i = 0; i <= N; i++){
    for(int j = 0; j <= N; j++){
      int k = N - (i + j);
      if(k < 0) continue;
      long long int A = 1000 * i + 5000 * j + 10000 * k;
      if(Y == A){
	ans1000 = i;
	ans5000 = j;
	ans10000 = k;
      }
    }
  }
  cout << ans10000 << " " << ans5000 << " " << ans1000;
}


Measured memory_bytes: 256
#pragma GCC optimize("-Ofast","-funroll-all-loops","-ffast-math")

#include "bits/stdc++.h"
using namespace std;

int main()
{
    int n; cin>>n; 
    string k; cin>>k;
    int l = k.length();
    if(l<=n) cout<<k<<"\n";
    else cout<<k.substr(0,n)+"..."<<"\n";
}


Measured memory_bytes: 3604
#include <utility>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <cmath>
#include <set>
#include <iostream>
using namespace std;
typedef long long ll;
const long long mod = 1e9 + 7;
int main() {
    ll x;
    cin >> x;
    int count = 0;
    ll start = 100;
    while (start < x) {
        start = start + start/100;
        count++;
    }
    cout << count;;
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)n; i++)
#define all(x) (x).begin(),(x).end()
typedef long long int ll;
using namespace std;
int main()
{
  int n, k;
  cin >> n >> k;
  int ans = 1e9;
  int tmp = 0;
  REP(i,n + 1){
    tmp = pow(2,i) + (n - i)*k;
    ans = min(ans, tmp);
  }
  cout << ans << endl;
}


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


using namespace std;


#define ll long long
#define mk make_pair
#define pb push_back
#define ff first
#define sc second
#define all(x) x.begin(), x.end()
#define sz(x) (x).size()

ll gcd(ll a, ll b);

ll sum(int n);

void go(){
   int p,q,r;cin>>p>>q>>r;
   cout << min({p+q,p+r,r+q});
}
int main(){
   
   ios_base::sync_with_stdio(0);
   cin.tie(0);
   cout.tie(0);

   go();

   return 0;
}

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

ll sum(int n){                
   if(n == 0){
      return n;
   }else{
      return sum(n/10) + n%10;
   }
}


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

int main() {

  int A,B;
  cin >> A >> B;
  int s=0;
  
  int N=A;
  for (int i=0; i<B-A+1; i++) {
    
    if (N/10000==N%10 && N/1000%10==N%100/10) s+=1;
    
    N++;
  }
  
  cout << s << endl;
}

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

int main() {
    bool students[31];
    for (int i = 1; i <= 30; i++) {
        students[i] = false;
    }
    for (int i = 0; i < 28; i++) {
        int index;
        cin >> index;
        students[index] = true;
    }
    for (int i = 1; i <= 30; i++) {
        if (students[i] == false) {
            cout << i << endl;
        }
    }
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
int main()
{	int sum=0;
	string a,b;
	cin>>a;
	cin>>b;
	for(int i=0;i<3;i++)
	{
		if(a[i]==b[i])
			sum++;
	}
	cout<<sum;
}

Measured memory_bytes: 384
n=int(input())
l=list(map(int,input().split()))
sum=0
k=0
l=l+[0]
for i in range(n):
    if k==1:
        k=0
        pass
    else:
        if l[i]==i+1:
            sum+=1
            if l[i+1]==i+2:
                k=1
print(sum)

Measured memory_bytes: 14008
#include <iostream>
#include <cstdio>
#include <vector>
#include <complex>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <cstring>
#include <stack>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <cassert>

using namespace std;

typedef long long ll;
typedef ll li;
typedef pair<int,int> PI;
#define EPS (1e-10L)
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define F first
#define S second
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define SZ(a) (int)((a).size())
#define ALL(a) a.begin(),a.end()
#define FOR(it,a) for(__typeof(a.begin())it=a.begin();it!=a.end();++it)
void pkuassert(bool t){t=1/t;};

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


bool ispr(int n){
  if(n==1) return false;
  for(int i=2;i*i<=n;++i)
    if(n%i==0) return false;
  return true;
}

int main(int argc, char *argv[])
{
  int n,p;
  while(cin >> n >> p && ~n){
    vector<int> app;
    while(SZ(app)<=p){
      ++n;
      if(ispr(n)) app.pb(n);

    }
    vector<int> wa;
    rep(i,SZ(app)) for(int j=i;j<SZ(app);++j) wa.pb(app[i]+app[j]);
    sort(ALL(wa));
    cout << wa[p-1] << endl;
  }
  return 0;
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()

int main()
{
        int N;
        cin >> N;
        vector<int> vec(N);

        rep(i, N)
        {
                cin >> vec.at(i);
        }
        rep(i, N)
        {
                if (vec.at(i) % 2 == 0)
                {
                        if (vec.at(i) % 3 == 0 || vec.at(i) % 5 == 0)
                        {
                                continue;
                        }
                        else
                        {
                                cout << "DENIED" << endl;
                                return 0;
                        }
                }
        }

        cout << "APPROVED" << endl;
        return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

bool fanc(int mid, vector<int> &a, int n, int m, int v, int p){
	vector<int> ot;
	if(mid < p) return true;
	rep(i, n){
		if(i == mid) continue;
		ot.push_back(a.at(i));
	}
	ll now = a.at(mid);
	now += m;
	if(now < ot.at(p-1)) return false;
	ll add = (ll)m * (v-1);
	rep(i, n-1){
		if(i < p-1) add -= m;
		else{
			add -= min((ll)m, now - ot.at(i));
		}
	}
	// cerr << "t " << mid << " " << add << " " << now << endl;
	if(add > 0) return false;
	else return true;
}

int main(){
	int n, m, v, p;
	cin >> n >> m >> v >> p;
	vector<int> a(n);
	rep(snip_i, n) cin >> a.at(snip_i);
	sort(a.begin(), a.end(), greater<int>());
	vector<ll> sum(n+1, 0);
	rep(i, n) sum.at(i+1) = sum.at(i) + a.at(i);
	int ok = 0, ng = n;
	while(ng - ok > 1){
		int mid = (ok+ng)/2;
		if(fanc(mid, a, n, m, v, p)) ok = mid;
		else ng = mid;
	}
	cout << ok+1 << endl;
	return 0;
}

Measured memory_bytes: 2380
#include <iostream>
#include <numeric>
#include <cmath>
#include <limits>
#include <stdio.h>
#include <iomanip>
#include <cstdlib>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
ll Max(ll(a), ll(b), ll(c)) {
	return max(max(a, b), c);
}
ll Min(ll(a), ll(b), ll(c)) {
	return min(min(a, b), c);
}





int main() {

	ll N;
	cin >> N;
	ll an = -N;
	rep(i, N) {
		ll A;
		cin >> A;
		an += A;
	}
	cout << an << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 int n,m,k,i,p; //mとpは高さ、nは個数、iは回数、kは答えの回数
 i=0;
 m=0;
 k=0;
 cin >> n,m;
 while (i<n){
  i++;
  cin>>p;
  if (m<=p){
   m=p;
   k++;
  }
 }
 cout << k;
}

Measured memory_bytes: 256
from collections import defaultdict
import sys

ip = lambda : sys.stdin.readline()
ipl = lambda : sys.stdin.readline().split()

n, m = map(int, ipl())
elevation = list(map(int, ipl()))
elevation.insert(0, 0)
# construct graph
Graph = defaultdict(list)
for i in range(m):
	s, e = map(int, ipl())
	Graph[s].append(e)
	Graph[e].append(s)
c = 0
for i in range(1, n+1):
	f = 1
	for j in Graph[i]:
		if elevation[j] >= elevation[i]:
			f = 0
			break
	if f:
		c += 1
print(c)

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

using namespace std;

typedef long long int llint;
typedef pair<int, int> pii;
typedef pair<llint, llint> pll;
typedef vector<int> vi;
typedef vector<llint> vl;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define ci cin
#define co cout
#define en endl
#define ln cout<< '\n'
#define rep(i, n) for(int i = 0; i < n; i++)
#define outl(x) cout<< (x) << '\n'
#define pb push_back
#define fi first
#define se second
#define MOD 1000000007

template<typename Tn> Tn gcd(Tn a, Tn b)
{
    return (b ? gcd(b, a % b) : a);
}

template<typename Tn> Tn lcm(Tn a, Tn b)
{
    return a / gcd(a, b) * b;
}

string IntToString(int number)
{
    stringstream ss;
    ss << number;
    return ss.str();
}

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

int h, w, n;
int sy, sx;
string s, t;

int main()
{
    ci >> h >> w >> n;
    ci >> sy >> sx;
    ci >> s >> t;

    map<char, int> mp;
    string lurd = "LURD";
    rep(i, 4) mp[lurd[i]] = 0;
    //mp['L'] = mp['R'] = sx;
    //mp['U'] = mp['D'] = sy;

    bool ans = false;
    
    rep(i, n) {
	rep(j, 4) {
	    if(s[i] == lurd[j]) mp[lurd[j]]++;
	    
	    if(sx - mp['L'] < 1) ans = true;
	    if(sx + mp['R'] > w) ans = true;
	    if(sy - mp['U'] < 1) ans = true;
	    if(sy + mp['D'] > h) ans = true;
	}

	rep(j, 4) {
	    if(t[i] == lurd[j]) {
		char c = lurd[(j + 2) % 4];
		mp[c]--;
		if(c == 'L') {
		    if(sx - mp[c] > w) mp[c]++;
		} else if(c == 'R') {
		    if(sx + mp[c] < 1) mp[c]++;
		} else if(c == 'U') {
		    if(sy - mp[c] > h) mp[c]++;
		} else {
		    if(sy + mp[c] < 1) mp[c]++;
		}
	    }
	}

	//co << "L : " << mp['L'] << en;
	//co << "R : " << mp['R'] << en;
	//co << "U : " << mp['U'] << en;
	//co << "D : " << mp['D'] << en;ln;ln;
    }

    if(ans) co << "NO" << en;
    else    co << "YES" << en;
  
    return 0;
}


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

int main()
{
    int n;
    std::cin >> n;
    std::vector<std::vector<int>> memo(60, std::vector<int> (25));
    for (int i = 0; i < n; ++i)
    {
        long double a;
        std::cin >> a;
        long long b = (long long) (a * 1e9 + 0.5);
        int count2 = 0, count5 = 0;
        while (b % 2 == 0)
        {
            ++count2;
            b /= 2;
        }
        while (b % 5 == 0)
        {
            ++count5;
            b /= 5;
        }
        ++memo[count2][count5];
    }
    long long ans = 0;
    for (int i = 0; i < 60; ++i)
    {
        for (int j = 0; j < 25; ++j)
        {
            for (int ii = std::max(0, 18 - i); ii < 60; ++ii)
            {
                for (int jj = std::max(0, 18 - j); jj < 25; ++jj)
                {
                    if (i != ii || j != jj)
                    {
                        ans += 1LL * memo[i][j] * memo[ii][jj];
                    }
                }
            }
        }
    }
    ans /= 2;
    for (int i = 0; i < 60; ++i)
    {
        for (int j = 0; j < 25; ++j)
        {
            if (i + i >= 18 && j + j >= 18)
            {
                ans += 1LL * memo[i][j] * (memo[i][j] - 1) / 2;
            }
        }
    }
    std::cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF (1LL<<50)
#define MOD 1000000007

int main(){
    int A,B,C,K;
    cin >> A >>B >> C >> K;
    ll ans = K;
    if(A<K){
        if(K-A>B){
            ans = A - (K-A-B);
        }else{
            ans = A;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3500
using System;

class Program
{
	static void Main(string[] args)
	{
		string input = Console.ReadLine();
		int ans = 0;
        if (input == "SSS")
        {
			ans = 0;
        }
        else if (input == "RRR")
        {
			ans = 3;
        }
		else if (input == "SRR" || input == "RRS")
        {
			ans = 2;
        }
        else
        {
            ans = 1;
        }

		Console.WriteLine(ans);
	}
}

Measured memory_bytes: 25844
#include<iostream>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<vector>
#include<array>
#include<string>
#include<stack>
#include<queue>
#include<algorithm>
#include<cassert>
#include<functional>
#include<random>
#include<complex>
#include<bitset>
#include<chrono>
#include<boost/multiprecision/cpp_int.hpp>
#define int int64_t
#define uint uint64_t
#define REP(i, a, b) for (int64_t i = (int64_t)(a); i < (int64_t)(b); i++)
#define rep(i, a) REP(i, 0, a)
#define EACH(i, a) for (auto i: a)
#define ITR(x, a) for (auto x = a.begin(); x != a.end(); x++)
#define ALL(a) (a.begin()), (a.end())
#define HAS(a, x) (a.find(x) != a.end())
#define Min(x) *min_element(ALL(x))
#define Max(x) *max_element(ALL(x))
#define Unique(L) (L.erase(unique(ALL(L)), L.end()))
#define veccat(v1, v2) std::copy((v2).begin(),(v2).end(),std::back_inserter(v1)/*v1の後ろにv2を入れる*/)
#define intmax (std::numeric_limits<int64_t>::max() / 4)
using namespace std;
typedef boost::multiprecision::cpp_int bigint;
const double EPS = 1e-9;
const double PI = acos(-1.0);

int S(int N) {
	if (N < 10)return N;
	return N % 10 + S(N / 10);
}

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

	int N; cin >> N;
	if (N%S(N) == 0)cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}



Measured memory_bytes: 256
import copy

N,W=map(int,input().split())
G=[0]   #G[0]はダミー
for index1 in range(N):
    w,v=map(int,input().split())
    G.append((w,v))
sum_v=0
for index2 in range(1,N+1):
    sum_v+=G[index2][1]

#DP[i][j]=i番目までの品物を使って価値j以上の最小重量
DP=[]
inf=float('inf')
component=[0]+[inf]*sum_v
for index3 in range(N+1):
    DP.append(copy.copy(component))

for i in range(1,N+1):
    for j in range(1,sum_v+1):
        DP[i][j]=min(DP[i-1][j],DP[i-1][max(0,j-G[i][1])]+G[i][0])

#print(sum_v)
#print(DP[N][sum_v])
ans=0
for k in range(1,sum_v+1):
    #print(ans)
    if DP[N][k]<=W:
        ans=max(ans,k)

print(ans)

Measured memory_bytes: 262760
#include<bits/stdc++.h>
#define N 40010
#define int long long
#define INF 0x3f3f3f3f
#define mod 1000000007
#define rep(i, l, r) for(register int i = l; i <= r; ++ i)
using namespace std;
inline int read()
{
	register char cc = getchar();register int cn(0), flus(1);
	while(cc > '9' || cc < '0') {if(cc == '-') flus = -flus; cc = getchar();}
	while(cc >= '0' && cc <= '9') {cn = cn * 10 + cc - '0'; cc = getchar();}
	return cn * flus; 
}
char a[N], b[N];
signed main()
{
	string a, b;
	cin >> a;
	cin >> b;
	int n = a[0] - '0' - 1, m = b[0] - '0' - 1;
	//cout << "n = " << n;
	rep(i, 1, m)
	{
		a += a[0];
	}
	rep(i, 1, n)
	{
		b += b[0];
	}
	int t = min(n, m);
	rep(i, 0, t)
	{
		if(a[i] != b[i]) 
		{
			if(a[i] > b[i])
			{
				//cout << a;
				cout << b;
				return 0; 
			}
			else 
			{
				//cout << b;
				cout << a;
				return 0;
			}
		}
	}
	cout << a;
	return 0;
}

Measured memory_bytes: 256
def two_anagrams(s: str, t: str) -> bool:
    '''s を並び替えた実現可能な最小の文字列 s' と t を並び替えて
    実現可能な最小の文字列 t' に関して、s' < t' が成り立てば良い。
    '''
    sn, tn = len(s), len(t)
    sd, td = sorted(s), sorted(t, reverse=True)

    idx = 0
    while idx < sn and idx < tn:
        # idx-1 番目の文字までは同じと仮定する。
        if sd[idx] < td[idx]:
            # この場合 sn < tn が成り立つ。
            return True
        if sd[idx] == td[idx]:
            # 次に持ち越し
            idx += 1
            continue
        if sd[idx] > td[idx]:
            # この場合 sn > tn が成り立つ。
            return False

    # min(sn, tn) 番目まで同じ。あとは長いほうが後ろ
    return sn < tn


if __name__ == "__main__":
    s = input()
    t = input()
    yes = two_anagrams(s, t)
    print('Yes' if yes else 'No')


Measured memory_bytes: 3064
a,b,ab,x,y=map(int,input().split())

if x<y:
    #print((y-x)*b+x*ab*2)
    print(min((y-x)*b+x*ab*2 , a*x+b*y , y*ab*2))
else:#x>=y
    #print((x-y)*a+y*ab*2)
    print(min((x-y)*a+y*ab*2,a*x+b*y , x*ab*2))


Measured memory_bytes: 2940
#include <stdio.h>

int main(void) {
  int a;
  int b;
  int c;
  char buf1[20];
  fgets(buf1, 20, stdin);
  sscanf(buf1, "%d" "%d"" %d" , &a, &b, &c);
  
  int d, e, f, min;
  d = a + b;
  e = b + c;
  f = c + a;
  min = d;
  if(e < min) min = e;
  if(f < min) min = f;
  
  printf("%d \n", min);
  
  return 0;
}

Measured memory_bytes: 128
#include<iostream>
using namespace std;
#define rep(i, n) for(int i; i < int(n); i++)

int main() {
  int n;
  cin >> n;
  int p[n];
  rep(i, n) cin >> p[i];
  int k = 0;
  rep(i, n) if(p[i] != i+1) k++;
  if (k<=2) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> P;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

void YN(bool flg){if(flg) cout << "YES" << endl; else cout << "NO" << endl;}
void Yn(bool flg){if(flg) cout << "Yes" << endl; else cout << "No" << endl;}
void yn(bool flg){if(flg) cout << "yes" << endl; else cout << "no" << endl;}

int main() {
    int n;
    cin >> n;
    vi a(8);
    int t = 0;
    int cnt = 0;
    rep(i, n) {
        int x;
        cin >> x;
        if(x >= 3200) t++;  
        else {
            x /= 400;
            if(!a[x]) {
                a[x] = 1;
                cnt++;
            }
        }
    }

    cout << max(1, cnt) << " " << cnt + t << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int,int>;


const long long INFLL = 1LL << 60;
const int INFI = 1000000000;


int main(){
    int N; cin >> N;
    map<string, int> m{};
    long long count =0;
    for(int i=0;i<N;i++){
        string s; cin >> s;
        sort(s.begin(), s.end());
        count+=m[s];
        m[s]++;
    }
    cout << count << endl;
}



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

int main() {
    int n;
    cin >> n;
    int a[n];
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    sort(a,a+n);
    for(int i=1;i<n;i++){
        if(a[i]==a[i-1]){
            a[i]=0;
            a[i-1]=0;
        }
    }
    int count=0;
    for(int i=0;i<n;i++){
        if(a[i]>0){
            count++;
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 640
import Data.Tuple
import Data.List

data Tree a = Node a (Tree a) (Tree a)
memoize f = memof where memof = f (query (blank memof))
blank f = blank' 1 where blank' k = Node (f k) (blank' (2*k)) (blank' (2*k+1))

query m x = query' m bits
 where
  bits = reverse (take w (unfoldr (return . swap . flip divMod 2) x))
  w = floor (logBase 2 (fromIntegral x))
  query' (Node v left right) bs
   | bs == [] = v
   | head bs == 0 = query' left (tail bs)
   | otherwise = query' right (tail bs)

main = readLn >>= print . fib
fib = memoize $ \f n -> if n < 2 then n else f (n-1) + f (n-2)

Measured memory_bytes: 4204
#include<bits/stdc++.h>
using namespace std;int a,b,c,d;
int attack(int n)
{
	if(n==1)
	{
		c-=b;
		if(c<=0)
		{
			cout<<"Yes";
			return 1;
		}
	}
	else
	{
		a-=d;
		if(a<=0)
		{
			cout<<"No";
			return 1;
		}
	}
	return 0;
}
int main()
{
	
	cin>>a>>b>>c>>d;
	while(1)
	{
		if(attack(1)==1)
			return 0;
		if(attack(2)==1)
			return 0;
	}
	return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void _main()
{
    int M;
    cin >> M;
    cout << 48 - M << endl;
}


Measured memory_bytes: 256
#include <string>
#include <bits/stdc++.h>
#include <stdio.h>
#include<math.h>
#include <ctype.h>
#include <algorithm> // sort
#include <map> // pair
using namespace std;

int main() {
 string s;
  cin >> s;
  int asum,bsum;
  asum=0;
  bsum=0;
  for(int i=0;i<s.size();i++){
    if(s.at(i)=='1'){
      asum++;
    }
    else{
      bsum++;
    }
  }
  cout << 2*min(asum,bsum) << endl;
}
 

Measured memory_bytes: 512
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <functional>
#include <limits.h>
#include <set>
#include <map>
#include <tuple>
using namespace std;



#define ll long long
#define ull unsigned long long
#define rep(i,N) for (ll i=0;i<N;i++)
#define loop(i,N,M) for(ll i=N;i<M;i++)
#define MAX(v) *max_element(v.begin(),v.end())
#define MIN(v) *min_element(v.begin(),v.end())
#define SORTL2S(type,v) sort(v.begin(),v.end(),greater<type>())
#define SORTS2L(type,v) sort(v.begin(),v.end())
#define SORTMF(v,func) sort(v.begin(),v.end(),func)

ll debugFlag = false;
template<typename T> void debug(T&);
template<typename T> void debug(T&, bool);
template<typename T> void debug(vector<T>&);
template<typename T> void debug(vector<T>&, bool);
template<typename T, typename U> void debug(pair<T, U>&);
template<typename T, typename U> void debug(pair<T, U>&, bool);

template<typename T>
void debug(T& obj) {
	debug(obj, true);
}

template<typename T>
void debug(T& obj, bool lnFlag) {
	if (!debugFlag) return;
	cout << obj;
	if (lnFlag) cout << endl;
}

template<typename T>
void debug(vector<T>& obj) {
	debug(obj, true);
}

template<typename T>
void debug(vector<T>& obj, bool lnFlag) {
	if (!debugFlag) return;
	cout << "[";
	rep(i, obj.size()) {
		if (i != 0) cout << ",";
		debug(obj[i], false);
	}
	cout << "]";
	if (lnFlag) cout << endl;
}

template<typename T, typename U>
void debug(pair<T, U>& obj) {
	debug(obj, true);
}

template<typename T, typename U>
void debug(pair<T, U>& obj, bool lnFlag) {
	if (!debugFlag) return;
	cout << "(";
	debug(obj.first, false);
	cout << ",";
	debug(obj.second, false);
	cout << ")";
	if (lnFlag) cout << endl;
}

void solve() {

	ll N;
	cin >> N;

	vector<ll> vec(N);
	rep(i, N) cin >> vec[i];

	ll ans = 0;

	ll tmp = 0;

	for (ll i = 1; i < N; i++) {
		if (vec[i - 1] >= vec[i]) {
			tmp++;
		}
		else {
			ans = max(ans, tmp);
			tmp = 0;
		}
	}
	ans = max(ans, tmp);

	cout << ans;

}


int main(int argc, char* argv[]) {
	if (argc == 2 && string(argv[1]) == "debug") debugFlag = true;
	solve();
	return 0;
}


Measured memory_bytes: 1024
#include <algorithm>
#include <iostream>
#include <vector>

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

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

    std::sort(D.begin(), D.end());

    const int idx = N / 2;
    const auto ret = D[idx] - D[idx - 1];
    
    std::cout << ret << std::endl;
}


Measured memory_bytes: 1024
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;
const ll mod = 1e9 + 7;



int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<set<int> > edges(n);
  REP(i, 0, m) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    edges[a].insert(b);
    edges[b].insert(a);
  }
  bool possum = false;
  REP(i, 1, n - 1) {
    if (edges[i].count(0) && edges[i].count(n - 1)) {
      possum = true;
      break;
    }
  }
  cout << (possum ? "POSSIBLE" : "IMPOSSIBLE") << "\n";
}


Measured memory_bytes: 28416
#include <iostream>

int main(){

   int N, H, W;
   std::cin >> N >> H >> W;
   int A[N], B[N];
   for(int i=0; i<N; i++){
      std::cin >> A[i] >> B[i];
   }

   int cnt = 0;
   for(int i=0; i<N; i++){
      if((A[i] >= H) && (B[i] >= W)){
         cnt++;
      }
   }
   std::cout << cnt <<std::endl;
   return 0;
}

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

using namespace std;

int main()
{
	int N, sum = 0;
  cin >> N;
	int n = N;
  
  for(int i = 0; n > 0; i++){
	sum += n%10; 
	n /= 10;
  }
    if(N%sum == 0)
      cout << "Yes" << endl;
  else
    cout << "No" << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
#include <cmath>
#include <map>
#include <iomanip>
#include <unordered_map>
#include <stack>
#include <cstring>
#include <cctype>
#include <random>

using namespace std;
typedef long long  ll;
const ll INF = 1000000007;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (n); ++i)

ll f(ll n) {
	ll ans = 1;
	rep(i, n) {
		ans *= 2;
	}
	return ans;
}

int main() {
	ll a, b, c;
	cin >> a >> b >> c;
	ll k;
	cin >> k;
	rep(i, k + 1) {
		rep(j, k - i + 1) {
			rep(o, k -  i + 1 - j) {
				if (a * f(i) < b * f(j) && b * f(j) < c * f(o)) {
					cout << "Yes" << endl;
					return 0;
				}
			}
		}
	}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <array>
#include <queue>
#include <stack>
#include <set>
#include <list>
#include <utility>
using namespace std;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long int N; cin >> N;
  long long int o = 0; long long int e = 0;
  for (int i = 0; i < N; i++) {
    int t; cin >> t;
    o += (t%2 != 0);
    e += (t%2 == 0);
  }
  if (o%2 == 1) {
    cout << "NO" << endl;
  } else {
    cout << "YES" << endl;
  }
}


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

using namespace std;

int main()
{
	// 入力
	int n;
	cin >> n;
	vector<int> p(n);
	for (int i = 0; i < n; i++)
	{
		cin >> p[i];
	}
	
	int answer = 0;
	for (int i = 1; i < n - 1; i++)
	{
		// piが2番目に大きい条件は以下の2つ
		if ((p[i - 1] < p[i]) && (p[i] < p[i + 1]))
		{
			answer++;
		}
		else if ((p[i - 1] > p[i]) && (p[i] > p[i + 1]))
		{
			answer++;
		}
	}
	
	// 出力
	cout << answer << endl;
	
	return 0;
}

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

int main(void){
  long long int a, b, c;
  cin >> a >> b >> c;
  if((2*sqrtl(a*b))<(c-b-a)){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
/*
[abc110] B - 1 Dimensional World's Tale
*/

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;

const int MAX_N = 100;
const int MAX_M = 100;
const int INF = 1e8;

int N, M, X, Y;
int max_x = -INF, min_y = INF;

int solve() { return (max_x < min_y) && (max_x < Y) && (X < min_y); }

int main() {
    cin >> N >> M >> X >> Y;
    for (int i = 0; i < N; i++) {
        int x;
        cin >> x;
        max_x = max(max_x, x);
    }
    for (int i = 0; i < M; i++) {
        int y;
        cin >> y;
        min_y = min(min_y, y);
    }

    cout << (solve() ? "No War" : "War") << endl;

    return 0;
}


Measured memory_bytes: 256
from math import floor, ceil

def main():
  a, b = list(map(int, input().split()))
  a_min = ceil(a*12.5)
  a_max = (a+1)*12.5
  b_min = ceil(b*10)
  b_max = (b+1)*10
  
  if(b_min <= a_min and a_min<b_max):
    print(a_min)
    return
  if(a_min <= b_min and b_min<a_max):
    print(b_min)
    return
  print(-1)
  return

main()

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
vector<int> cnt; 

void fillcnt(int n){
    cnt.resize(n+1,0);    
        int tmp,ans;
        for(int i=2;i<=n;i++){
            tmp=i;
            for(int j =2;j<=n;j++){
                while(tmp%j==0){
                    cnt[j]++;
                    tmp/=j;
                }
            }
        }
}


int num(int x){
    int ret;
    ret=count_if(cnt.begin(),cnt.end(),[&](int y){return y>=x-1;});
    return ret;
}


int main(){
    int n;cin>>n;
    fillcnt(n);  
    //for(auto&& x:cnt)cout<<x<<" ";  
    int n75,n25,n15,n5,n3,ans;
    n75=num(75);
    n25=num(25);
    n15=num(15);
    n5=num(5);
    n3=num(3);

   ans=n75+n25*(n3-1)+n15*(n5-1)+n5*(n5-1)*(n3-2)/2;
    cout <<ans<<endl;
}

Measured memory_bytes: 256