akhauriyash/Code-Regression huggingface dataset:
from itertools import accumulate

n = int(input())
s = input()

black = [0] * n
white = [0] * n

for i, c in enumerate(s):
    if c == '#':
        black[i] = 1
    else:
        white[i] = 1


black = [0] + black
black = list(accumulate(black))
white = [0] + white[::-1]
white = list(accumulate(white))[::-1]

# print(black, white)

ans = 1e10
for i in range(n+1):
    ans = min(ans, black[i] + white[i])

print(ans)

Measured memory_bytes: 24468
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <sstream>
#include <cmath>
#include <functional>
#include <fstream>
#include <cstdlib>
typedef long long ll;
const int MOD = 1e9+7;


#define REP(i, N) for (int i = 0; i < (N); i++)
#define REPP(i, a, b) for (int i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define VSORT(c) sort((c).begin(),(c).end())
#define SZ(x) ((int)(x).size())
//vvintを作る　マクロで　 #define vvint(N,M) vector<vector<int>>

using namespace std;


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

    int n;
    cin >> n;
    ll tmp;
    ll mn = MOD, sum = 0;
    int minusCount = 0;
    bool zeroFlag = false;

    for(int i = 0; i < n;i++){
        cin >> tmp;
        if(tmp == 0){
            zeroFlag = true;
        }else { 
            mn = abs(min(abs(tmp),mn));
        }
        if(tmp < 0) minusCount++;
        sum += abs(tmp);
    }

    ll ans = 0;
    if(minusCount % 2 == 0 || zeroFlag){
        ans = sum;
    }else if(minusCount % 2 == 1){
        ans = sum-mn*2;
    }

    cout << ans << endl;

    

    return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
inf = 10**17
mod = 10**9+7

n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = input().rstrip()

memo = [None] * n
ans = 0

for i in range(n):
    if t[i] == 'r':
        if i - k < 0 or (0 <= i - k and memo[i - k] != 'p'):
            ans += p
            memo[i] = 'p'
        elif n <= i + k or (i + k < n and t[i + k] != 's'):
            memo[i] = 'r'
        else:
            memo[i] = 's'

    if t[i] == 's':
        if i - k < 0 or (0 <= i - k and memo[i - k] != 'r'):
            ans += r
            memo[i] = 'r'
        elif n <= i + k or (i + k < n and t[i + k] != 'p'):
            memo[i] = 's'
        else:
            memo[i] = 'p'

    if t[i] == 'p':
        if i - k < 0 or (0 <= i - k and memo[i - k] != 's'):
            ans += s
            memo[i] = 's'
        elif n <= i + k or (i + k < n and t[i + k] != 'r'):
            memo[i] = 'p'
        else:
            memo[i] = 'r'

print(ans)


Measured memory_bytes: 73976
#include<stdio.h>

int main(void){

    int S, h, m, s;
    scanf("%d", &S);

    h = S / 3600;
    m = (S % 3600) / 60;
    s = (S % 3600) % 60;

    printf("%d:%d:%d\n", h, m, s);

    return 0;
}


Measured memory_bytes: 2120
N, hp = gets.split.map(&:to_i)

katana = N.times.map { gets.split.map(&:to_i) }.sort_by { |a, b| -a }

used = katana[0]

katana.sort_by! { |a, b| -b }

ans = 0

until katana.empty?
  k = katana.shift

  break if hp <= 0
  break if used[0] >= k[1]

  ans += 1
  hp -= k[1]
end

if hp > 0
  ans += (hp / used[0].to_f).ceil
end

puts ans


Measured memory_bytes: 13404
#include <bits/stdc++.h>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<=int(b);i++)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,n) for (int i=(n-1);i >= 0;i--)
#define all(v) v.begin(),v.end()
#define sz(v) (int)((v).size())
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;
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;}
const ll INF = 1LL << 60;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b,c;
    cin >> a >> b >> c;
    if(a==b+c||b==a+c||c==a+b) cout <<"Yes"<<endl;
    else cout << "No" << endl;
}


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

using namespace std;

int main()
{
    int n;
    cin >> n;
    int h[n+5];
    
    for (int i=1; i<=n; ++i) {
        cin >> h[i];
    }

    int dp[100000+1];
    dp[0] = dp[1] = 0;
    dp[2] = abs(h[2] - h[1]);

    for(int i=3; i<=n; ++i) {
        dp[i] = min(abs(h[i] - h[i-2]) + dp[i-2],abs( h[i] - h[i-1]) + dp[i-1] );
    }
    cout << dp[n] << '\n';
}

Measured memory_bytes: 1024
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        a: usize,
        b: usize,
    }
    let diff = b-a;
    let bheight : usize = (1..diff+1).sum();
    println!("{}", bheight - b);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
const int N = 3003;
int n;
long long dp[N][N] , a[N];
long long s[N];

int32_t main(){
	scanf("%d" , &n);
	for(int i = 1 ; i <= n; i++)
		for(int j = 1 ; j <= n ;j ++){
			dp[i][j] = (long long) 1e18;
		}
	s[0] = 0;
	for(int i = 1 ; i <= n; i ++) scanf("%lld" , &a[i]) , dp[i][i] = 0 , s[i] = s[i-1] + a[i];
	for(int i = 2 ; i <= n; i ++){
		for(int j = 1 ; j <= n; j ++){
			for(int k = j ; k < j + i - 1 ; k++){
				dp[j][j+i-1] = min(dp[j][j+i-1] , dp[j][k] + dp[k+1][j+i-1] + s[j+i-1] - s[j-1]);
			}
		}
	}
	printf("%lld\n" , dp[1][n]);
}

Measured memory_bytes: 9088
#include<bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
const double eps = 1e-8;
const int NINF = 0xc0c0c0c0;
const int INF  = 0x3f3f3f3f;
const ll  mod  = 1e9 + 7;
const ll  N = 1e5 + 5;

map<int,int> M;

int n,T;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>n;
	ll ans=0;
	for(int i=1;i<=n;i++){
		int x;cin>>x;
		ans+=x;
		M[x]++;
	}
	cin>>T;
	while(T--){
		int u,v;cin>>u>>v;
		ans=ans+(v-u)*M[u];
		M[v]+=M[u];
		M[u]=0;
		cout<<ans<<'\n';
	}
	return 0;
}

Measured memory_bytes: 8052
#include<bits/stdc++.h>
using namespace std;
int main(void)
{
	long long a=100,b,k=0,c;cin>>b;bool j=0;
	while(1)
	{
		a+=a/100;k++;
		if(a>=b)
		{
			break;
		}
	}
	cout<<k;;
	return 0;
 } 

Measured memory_bytes: 3676
s=list(input().split())
N=int(s[0])
K=int(s[1])
Q=int(s[2])
minus=[Q]*N

Nscore=[K]*N
for i in range(Q):
  a=int(input())
  minus[a-1]=minus[a-1]-1
for i in range(N):
  if Nscore[i]>minus[i]:
    print('Yes')
  else:
    print('No')
  

Measured memory_bytes: 51416
from sys import stdin

S = stdin.readline().rstrip()

A = []
r_count = 0
l_count = 0
rl = 0
ans = [0] * len(S)

for i in range(len(S)):
    if i > 0:
        if S[i] == 'L' and S[i - 1] == 'R':
            rl = i - 1
        if (S[i] == 'R' and S[i - 1] == 'L') or i == len(S) - 1:
            if i == len(S) - 1:
                l_count += 1
            A.append((r_count, l_count, rl))
            r_count = 0
            l_count = 0
            rl = 0
    if S[i] == 'R':
        r_count += 1
    if S[i] == 'L':
        l_count += 1

for a in A:
    r_index = a[2] - a[0] + 1
    l_index = a[2] + a[1]
    ans[a[2]] = (a[2] - r_index) // 2 + 1 + (l_index - a[2]) // 2
    ans[a[2] + 1] = (a[2] - r_index + 1) // 2 + 1 + (l_index - a[2] - 1) // 2

print(*ans)

Measured memory_bytes: 53468
#include <algorithm>
#include <sstream>
#define REP(i,n) for(int i=0; i<(int)(n); i++)

#include <cstdio>
inline int getInt(){ int s; scanf("%d", &s); return s; }

#include <iostream>
#include <queue>
#include <set>

using namespace std;

template<typename O, typename I>
O f(I i){
  O ret;
  stringstream ss; ss << i;
  ss >> ret;
  return ret;
}

int main(){
  vector<int> buff;

  const int n = getInt();

  REP(i,n){
    buff.push_back(getInt());
    if(buff.size() > 5){
      sort(buff.begin(), buff.end());
      buff.pop_back();
    }
  }

  vector<int> ans;
  REP(i,5) REP(j,5) if(i != j){
    ans.push_back(f<int>(f<string>(buff[i]) + f<string>(buff[j])));
  }
  sort(ans.begin(), ans.end());
  printf("%d\n", ans[2]);
  return 0;
}

Measured memory_bytes: 1312
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
struct node
{
	int v;
	int x;
}arr[100010];

bool cmp(node a,node b)//比较函数很重要 
{ 
	if(a.v==b.v)
	return a.x<b.x;
	else 
	return a.v>b.v;
}

int idx[100010];
ll num[100010];
ll flag[100010];
ll val[100010];
int main()
{
	int n;
	while(~scanf("%d",&n))
	{
		memset(num,0,sizeof num);
		memset(flag,0,sizeof flag);
		for(int i=1;i<=n;i++)
		{
			scanf("%lld",&arr[i].v);
			arr[i].x=i;
		}
		sort(arr+1,arr+1+n,cmp);
		arr[0].v=-1;
		int cnt=0;
		for(int i=1;i<=n;i++)
		{
			if(arr[i-1].v!=arr[i].v)
			{
				cnt++;
				idx[cnt]=arr[i].x;
				num[cnt]=1;
				val[cnt]=arr[i].v;
			}
			else 
			num[cnt]++;
		}
		for(int i=1;i<cnt;i++)
		{
			flag[idx[i]]+=num[i]*(val[i]-val[i+1]);
			idx[i+1]=min(idx[i],idx[i+1]);
			num[i+1]+=num[i];
		}
		flag[idx[cnt]]+=num[cnt]*val[cnt];
		for(int i=1;i<=n;i++)
		printf("%lld\n",flag[i]);
	}
	return 0;
}

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

typedef long long ll;
//const int INF = 2e9;
//const ll INF = 9e18;


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N, M;
    cin >> N >> M;
    vector<vector<pair<int,int>>> d(N);
    for (int i=0;i<M;i++){
        int P, Y;
        cin >> P >> Y;
        P--;
        d[P].push_back(make_pair(Y,i));
    }
    for (int i=0;i<N;i++){
        if (d[i].size() != 0){
            sort(d[i].begin(),d[i].end());
        }
    }
    vector<pair<int,pair<int,int>>> ans;
    for (int i=0;i<N;i++){
        for (int j=0;j<d[i].size();j++){
            ans.push_back(make_pair(d[i][j].second,make_pair(i+1,j+1)));
        }
    }
    sort(ans.begin(),ans.end());
    for (auto x : ans){
        cout.fill('0');
        cout << setw(6) << x.second.first << setw(6) <<  x.second.second << "\n";
    }
    return 0;
}

Measured memory_bytes: 8308
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <ratio>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
#define MAX 1e9+7
#define MIN -1e9-7
#define int long long
#define endl "\n"
#define max(x,y) (x>y)?x:y
#define min(x,y) (x<y)?x:y
#define s(n) scanf("%d",&n)
#define mem memset(a, 0, sizeof(a))
#define minimum(a)	*min_element(a.begin(), a.end())
#define maximum(a)	*max_element(a.begin(), a.end())
typedef vector<int> vi;
typedef vector<string> vs;
/*
* * * * * * * * * * * * * * * * * * * * * *
*       ☆꧁𝓑𝓐𝓒𝓚_𝓛𝓞𝓖꧂☆              **
*                                        ***
* * * * * * * * * * * * * * * * * * * * *****
*/ 

int32_t main()
{
	string s,t;
	cin>>s>>t;
	int ans=-1;
	for(int i=0;i<=(s.size()-t.size());i++)
	{
		int count=0;
		int temp=i;
		for(int j=0;j<t.size();j++)
		{
			if(s[temp]==t[j])
			{
				count++;
			}
			temp++;
		}
		
		ans=max(ans,count);
		
	}
	cout<<t.size()-ans<<endl;
   
return 0;

}




Measured memory_bytes: 3616
xs = list(map(int, list(input())))

ys = [xs[0] - xs[1], xs[1]- xs[2], xs[2]-xs[3]]
if ys[0] == 0 and ys[1] ==0 or ys[1] == 0 and ys[2] ==0:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 2940
import sys
input = sys.stdin.readline
import math

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

l,r=MI()
mod=[]
if r-l>=2019:
    rm=0
    print(rm)
    sys.exit()
else:
    for i in range(l,r+1):
        mod.append(i%2019)
#print(mod)
mn=10**7
for i in range(len(mod)-1):
    for j in range(i+1,len(mod)):
        #print(mod[i],end=" ")
        #print(mod[j])
        ans=(mod[i]*mod[j])%2019
        if ans<mn:
            mn=ans
print(mn)

Measured memory_bytes: 3064
#include<bits/stdc++.h> //ABC 167_a
using namespace std;
string s,t;
int main(){
	cin>>s>>t;
	int len=s.size();
	if(t.substr(0,len)==s){
		cout<<"Yes";
		return 0;
	}
	else{
		cout<<"No";
		return 0;
	}
}

Measured memory_bytes: 3584
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

a,b,n = iim()
print(int(a*min((b-1),n)/b))

Measured memory_bytes: 9204
#include<stdio.h>
#define N 1000 

int main(void){
	char su[N]={'0'};
	int susum=0;
	int j=0;
	
	while(1){
		for(j=0;j<=N;j++){
			scanf("%c",&su[j]);
			if(su[j]=='\n')break;
			susum=susum+(su[j]-'0');
		}	
		if(su[0]=='0')break;
		printf("%d\n",susum);
		susum=0;
	}
	return 0;
}


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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    int  a,b,c,d;
    cin>>a>>b>>c>>d;
    if ((b<c)||(d<a)){
        cout<<0;
    }else{
        int arr[4];
        arr[0]=a;
        arr[1]=b;
        arr[2]=c;
        arr[3]=d;
        sort(arr,arr+4);
        cout<<arr[2]-arr[1];
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#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;

int main(){
  int N;
  cin >> N;
  vector<int> T(N);
  for(int i=0;i<N;i++){
    cin >> T[i];
  }
  int sum=0;
  for(int i=0;i<N;i++){
    sum+=T[i];
  }
  int M;
  cin >> M;
  for(int i=0;i<M;i++){
    int P,X;
    cin >> P >> X;
    cout << sum-T[P-1]+X << endl;
  }
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define x first
#define y second
#define pb push_back
#define mk make_pair
#define all(a) a.begin(), a.end()
#define len(a) (int)a.size()

using namespace std;

typedef long long ll;
typedef vector <int> vi;
typedef pair <int, int> pii;

int main(){
	int n;
	cin >> n;
	
	int cnt = 0;
	for(int i = 1; i <= n; i++){
		int tmp;
		cin >> tmp;
		
		if(i % 2 != 0 && tmp % 2 != 0)
			cnt++;
	}
	
	cout << cnt << endl;
	return 0;
}


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

using namespace std;

int main(int argc, char *argv[])
{

  int N, a[2][123];
  cin >> N;

  a[1][0] = a[0][0] = 0;

  for (int i = 1; i <= N; i++) {
    cin >> a[0][i];
    a[0][i] += a[0][i-1];
  }

  for (int i = 1; i <= N; i++) {
    cin >> a[1][i];
    a[1][i] += max(a[0][i], a[1][i-1]);
  }

  printf("%d\n", a[1][N]);
}


Measured memory_bytes: 256
#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  yesno(flag)if(flag)cout<<"Yes"<<endl; else cout<<"No"<<endl;
using namespace std;
typedef long long ll;
const ll INF=10000000000LL;
ll r197(ll n){
	return n%1000000007;
}

typedef pair<int,int>P;

typedef pair<int,P>Pa;
vector<int> v[100001];
bool b[100005]={};
struct edge{
	int score;
	int num;
};
int n;
double k;
int p[3003];
int d[3]={};
double dp[303][303][303];
double reg(int a,int b,int c){
	if(dp[a][b][c]!=-1)return dp[a][b][c];
	if(a==0)return 0;
	double res=0;
	if(c>0)res+=(k/a+reg(a,b,c-1))*c/a;
	if(b>c)res+=(k/a+reg(a,b-1,c))*(b-c)/a;
	if(a>b)res+=(k/a+reg(a-1,b,c))*(a-b)/a;
	return dp[a][b][c]=res;
}
int main() {
	rep(i,0,303){
		rep(j,0,303){
			rep(k,0,303)dp[i][j][k]=-1;
		}
	}
	cin>>n;
	rep(i,0,n){
		cin>>p[i];
		rep(j,0,3)if(p[i]>j)d[j]++;
	}
	k=n;
	printf("%.9f",reg(d[0],d[1],d[2]));
	return 0;
}


Measured memory_bytes: 220032
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
#define mm(a,x) memset(a,x,sizeof(a))
#define sync std::ios::sync_with_stdio(false);std::cin.tie(0)
#define ll long long
using namespace std;
int main(void)
{
    sync;
    int x,y,z;
    cin>>x>>y>>z;
    swap(x,y);
    swap(x,z);
    cout<<x<<" "<<y<<" "<<z<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <climits>

using namespace std;

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

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

vector<bool> isprime;
vector<int> primes;

void eratos(int n)
{
	isprime.assign(n, true);
	
	isprime[0] = isprime[1] = false;
	for(int i=2; i*i<=n; ++i){
		if(isprime[i]){
			for(int j=i*2; j<n; j+=i)
				isprime[j] = false;
		}
	}
	
	primes.clear();
	rep(i, n)
		if(isprime[i])
			primes.push_back(i);
}

int main()
{
	int n;
	eratos(10000001);
	
	while(scanf("%d", &n), n){
		int a = distance(primes.begin(), lower_bound(primes.begin(), primes.end(), n));
		if(primes[a] > n)
			--a;
		int ans;
		for(;;){
			int h = primes[a];
			if(primes[a-1] == primes[a]-2 && primes[a-2] == primes[a]-6 && primes[a-3] == primes[a]-8){
				ans = h;
				break;
			}
			--a;
		}
		printf("%d\n", ans);
	}
	
	return 0;
}

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

void fnInput(vector<int> &a_rvoTarget, vector<int> &a_rvoSearch)
{
  int iTargetCnt;
  cin >> iTargetCnt;

  a_rvoTarget.resize(iTargetCnt + 1);
  for (int i = 0; i < iTargetCnt; i++)
    cin >> a_rvoTarget[i];

  int iSearchCnt;
  cin >> iSearchCnt;

  a_rvoSearch.resize(iSearchCnt);
  for (int i = 0; i < iSearchCnt; i++)
    cin >> a_rvoSearch[i];
}

void fnLinearSearch(vector<int> &a_rvoTarget, const vector<int> &a_cnrvoSearch, int &a_riFound)
{
  size_t zMaxSize = a_rvoTarget.size() - 1;
  for (size_t zi = 0; zi < a_cnrvoSearch.size(); zi++)
  {
    a_rvoTarget[zMaxSize] = a_cnrvoSearch[zi];
    size_t zj = 0;
    while (a_rvoTarget[zj] != a_cnrvoSearch[zi])
      zj++;
    if (zj != zMaxSize)
      a_riFound++;
  }
}

void fnResultOut(int a_iFound)
{
  cout << a_iFound << endl;
}

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

  vector<int> voTarget, voSearch;
  int iFound = 0;

  fnInput(voTarget, voSearch);
  fnLinearSearch(voTarget, voSearch, iFound);
  fnResultOut(iFound);

  return 0;
}

Measured memory_bytes: 1244
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<cstring>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
#include<time.h>
#include<cassert>

using namespace std;
typedef long long ll;
typedef long double ld;
#define all(a) (a).begin(),(a).end()
#define EPS (1e-13)
#define bit(n,k) ((n>>k)&1)
const ll Mod = 1e9 + 7;
const ll mod = 998244353;
struct H {
	ll x, y;
	bool operator<(const H& b) const {
		if (x != b.x) return x < b.x;
		return y < b.y;
	}
	bool operator>(const H& b) const {
		if (x != b.x) return x > b.x;
		return y > b.y;
	}
	bool operator==(const H& b) const { return x == b.x && y == b.y; }
	bool operator!=(const H& b) const { return (*this) != b; }
};
struct P {
	ll pos, cost;
	bool operator<(const P& b) const { return cost < b.cost; }
	bool operator>(const P& b) const { return cost > b.cost; }
};
struct B {
	ll to, cost;
};
struct E {
	ll from, to, cost;
	bool operator<(const E& b) const { return cost < b.cost; }
	bool operator>(const E& b) const { return cost > b.cost; }
};
template<typename T, typename U>
void chmin(T& a, U b) {
	if (a > b) a = b;
}
template<typename T, typename U>
void chmax(T& a, U b) {
	if (a < b) a = b;
}
template<typename T>
T max_0(T a) {
	if (a < 0) return 0;
	return a;
}
template<typename T>
T min_0(T a) {
	if (a > 0) return 0;
	return a;
}
ll read() {
	ll u;
	ll k = scanf("%lld", &u);
	return u;
}
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j % i, i);
}
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}//x^n%p
ll bitcount(ll x) {
	int sum = 0;
	for (int i = 0; i < 20; i++)
		if ((1ll << i) & x) sum++;
	return sum;
}
/*ll fact_[200000];
ll comb(ll x, ll y, ll mod = Mod) {
	if (!fact_[0]) {
		fact_[0] = 1;
		for (int i = 1; i < 200000; i++) {
			fact_[i] = fact_[i - 1] * i % mod;
		}
	}
	if (x < y) return 0;
	return mod_pow(fact_[x], mod, mod) *
		mod_pow(fact_[x - y], mod - 2, mod) % mod *
		mod_pow(fact_[y], mod - 2, mod) % mod;
}//xCy*/
const ll Inf = 3023372036854775807;
const int inf = 1500000000;
#define int unsigned long long
//----------------------------------------------------
int n;
int a[400000];
int b[40];
signed main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	int ans = 0;
	for (int i = n - 1; i >= 0; i--) {
		for (int j = 0; j < 60; j++) {
			if (!((1ll << j) & a[i])) {
				ans += (1ll << j) % Mod * b[j] % Mod;
				ans %= Mod;
			}
			if (((1ll << j) & a[i])) {
				ans += (1ll << j) % Mod * (n - i - 1 - b[j]) % Mod;
				ans %= Mod;
			}
		}
		for (int j = 0; j <60; j++) {
			if ((1ll << j) & a[i]) {
				b[j]++;
			}
		}
		if (i == 0) break;
	}
	cout << ans << endl;

}

Measured memory_bytes: 2560
#include <iostream>
#include <math.h>

using namespace std;

static const int COUNTER_CLOCKWISE = 1;
static const int CLOCKWISE = -1;
static const int ONLINE_BACK = 2;
static const int ONLINE_FRONT = -2;
static const int ON_SEGMENT = 0;


#define EPS (1e-10)
#define equals(a, b) (fabs((a)-(b)) < EPS)

class Point{
public:
	double x, y;
	Point(double _x = 0, double _y = 0) :x(_x), y(_y){};

	Point operator+(const Point &p){ return Point(x + p.x, y + p.y); }
	Point operator-(const Point &p){ return Point(x - p.x, y - p.y); }
	Point operator*(const Point &p){ return Point(x * p.x, y * p.y); }
	Point operator*(double k){ return Point(x * k, y * k); }
	Point operator/(const Point &p){ return Point(x / p.x, y / p.y); }

	double norm() { return x*x + y*y; }
	double abs() { return sqrt(norm()); }

	bool operator<(const Point &p) const{
		return (x != p.x) ? (x < p.x) : (y < p.y);
	}

	bool operator==(const Point &p){
		return equals(x, p.x) && equals(y, p.y);
	}
};

typedef Point Vector;
struct Segment{
	Point p1, p2;
};

double dot(Vector a, Vector b){
	double res = a.x*b.x + a.y*b.y;
	return res;
}

double cross(Vector a, Vector b){
	double res = a.x*b.y - a.y*b.x;
	return res;
}

bool isOrthogonal(Vector a, Vector b){
	return equals(dot(a, b), 0.0);
}

bool isParallel(Vector a, Vector b){
	return equals(cross(a, b), 0.0);
}

Point project(Segment s, Point p){
	Vector base = s.p2 - s.p1;
	Vector v = p - s.p1;
	double l = dot(v, base) / base.norm();
	return s.p1 + base * l;
}

int ccw(Point p0, Point p1, Point p2){
	Vector a = p1 - p0;
	Vector b = p2 - p0;

	if (cross(a, b) < -EPS) return CLOCKWISE;
	if (cross(a, b) > EPS) return COUNTER_CLOCKWISE;
	if (dot(a, b) < -EPS) return ONLINE_BACK;
	if (a.norm() < b.norm()) return ONLINE_FRONT;
	return ON_SEGMENT;
}


int main(){
	Point p0, p1, p2;
	cin >> p0.x >> p0.y >> p1.x >> p1.y;
	int n; cin >> n;
	for (int i = 0; i < n; ++i){
		cin >> p2.x >> p2.y;
		int res = ccw(p0, p1, p2);
		switch (res)
		{
		case CLOCKWISE:
			cout << "CLOCKWISE" << endl;
			break;
		case COUNTER_CLOCKWISE:
			cout << "COUNTER_CLOCKWISE" << endl;
			break;
		case ONLINE_FRONT:
			cout << "ONLINE_FRONT" << endl;
			break;
		case ONLINE_BACK:
			cout << "ONLINE_BACK" << endl;
			break;
		case ON_SEGMENT:
			cout << "ON_SEGMENT" << endl;
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 3232
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <algorithm> 
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i,n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<"\n"
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define mp make_pair
#define sz(x) (ll)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using vc = vector<char>;
using vvc = vector<vc>;
template<class T> inline bool chmax(T& a, T b) { 
 if (a < b) { a = b; return true; } return false; 
}
template<class T> inline bool chmin(T& a, T b) {
 if (a > b) { a = b; return true; } return false; 
}
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
vector<ll> res(0);
void yakusuu(ll n){
	for(ll i=1;i*i<=n;i++){
	    if(n%i==0){
            res.pb(i);
            if(i!=n/i) res.pb(n/i);
	    }
	}
	return ;
}
int main(){
  ll n,k;
  cin>>n>>k;
  vll a(n);
  ll cu=0;
  rep(i,n){
    cin>>a[i];
    cu+=a[i];
  }
  yakusuu(cu);
  sort(rall(res));
  rep(i,sz(res)){
    vll c(n);
    c=a;
    rep(j,n){
      c[j]%=res[i];
    }
    sort(all(c));
    ll ccu=0;
    rep(j,n){
      ccu+=c[j];
    }
    if(ccu%res[i]!=0){
      continue;
    }
    vll d(n);
    rep(j,n){
      d[j]=res[i]-c[j];
    }
    vll u(n);
    u=c;
    ll o;
    ll cs=0;
    ll ds=0;
    rep(j,n){
      if(j==0) continue;
      u[j]+=u[j-1];
      d[n-1-j]+=d[n-j];
    }
    rep(j,n){
      if(u[j]==d[j+1]){
        o=j;
      }
    }
    ll y=0;
    rep(j,o+1){
      y+=c[j];
    }
    if(y<=k){
      COUT(res[i]);
      return 0;
    }
  }
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/trie_policy.hpp>
#include <ext/rope>

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

#define fef(i,a,b) for(ll i=a;i<=b;i++)
#define rer(i,a,b) for(ll i=b;i>=a;i--)
#define wew while(true)
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define FILE_IN "A.inp"
#define FILE_OUT "A.out"
#define ofile freopen(FILE_IN,"r",stdin);freopen(FILE_OUT,"w",stdout)
#define fio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define nfio cin.tie(0);cout.tie(0)
#define ord(a,b,c) ((a>=b)and(b>=c))
#define MOD (ll(1000000007))
#define INF (ll(1000000007))
#define MAXN 300011
#define x first
#define y second
#define pii pair<int,int>
#define piii pair<int,pii>
#define pb push_back
#define endl "\n"
typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> order_set;
typedef trie<string,null_type,trie_string_access_traits<>,pat_trie_tag,trie_prefix_search_node_update> order_trie;
typedef long long ll;
class DisjointSet{ public:
    vector<int> parent;
    DisjointSet(int n): parent(n) { for(int i=0; i<n; i++) parent[i] = i; }
    void join(int a, int b) { parent[find(b)] = find(a); }
    int find(int a){ return a == parent[a] ? a : parent[a] = find(parent[a]); }
    bool check(int a, int b){ return find(a) == find(b); }
};
//---------END-------//

int x;
int main(){
    //ofile;
    cin >> x;
    cout << 1-x;
}



Measured memory_bytes: 3616
def sieve(n):
    p = [True for i in range(n + 1)]
    p[0] = p[1] = False
    end = int(n ** .5)
    for i in range(2, end + 1):
        if p[i]:
            for j in range(i * i, n + 1, i):
                p[j] = False

    return p

def primes_below(n):
    if n < 2: return 0
    c = 1
    for i in range(3, n + 1, 2):
        if p[i]: c += 1

    return c

p = sieve(1000000)
while 1:
    try:
        n = int(input())
    except EOFError:
        break
    else:
        print(primes_below(n))

Measured memory_bytes: 14552
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        FastScanner sc = new FastScanner();

        int n = sc.nextInt();
        int k = sc.nextInt();

        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
        }
        Arrays.sort(arr);
        int sum = 0;
        for (int i = 0; i < k; i++) {
            sum += arr[i];
        }

        System.out.println(sum);

    }

    static class FastScanner {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer("");
        
        String next() {
            while (!st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        String nextLine()  {
            String s = "";
            try {
                s = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return s;
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

    }
}


Measured memory_bytes: 32884
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using pint = pair<int,int>;
ll mod = 1000000007,mod2 = 998244353;

void chmin(long long &a, long long b) { if (a > b) a = b; }
void chmax(long long &a, long long b) { if (a < b) a = b; }
const long long INF = 1LL<<60;
ll gcd(ll a,ll b){
    if(b == 0) return a;
    else return gcd(b,a%b);
}

//重みある時
using Edge = pair<int,int>;
using Graph = vector<vector<Edge> >;

vector<int> cnt;

int main() {
    string s;
    ll k;
    cin >> s >> k;
    for (int i = 0; i < s.size(); ++i) {
        int banme = s[i] - 'a';  // 何番目のアルファベット a0,b1
        int need = 25 - banme + 1;  // 何回やるか a0,b25
        if(s[i] == 'a') need = 0;

        if(k >= need){
            k -= need;
            s[i] = 'a';
        }
    }

    k %= 26;
    int banme2 = s[s.size()-1] - 'a';
    banme2 += k;
    banme2 %= 26;
    s[s.size()-1] = (char)('a'+banme2);
    cout << s << endl;
    return 0;
}


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

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

    int a[N + 1] = {0};
    std::unordered_map<int, int> m;
    int A;
    for (int i = 0; i < N; ++i) {
        std::cin >> A;
        a[A] += 1;
    }

    std::sort(a, a + N + 1, std::greater<int>());

    int cnt = 0;
    for (int i = K; i < N; ++i) {
        if (a[i] == 0) {
            break;
        }
        cnt += a[i];
    }
    
    std::cout << cnt << std::endl;

    return 0;
}


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

int main(){
    int n, k;
    cin >> n >> k;
    int p[n];
    for(int i=0;i<n;i++){
        cin >> p[i]; 
    }

    int ans = 0;
    sort(p, p+n);
    for(int i=0;i<k;i++){
        ans += p[i];
    }

    cout << ans << endl;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define mp          make_pair
#define pii         pair<int,int>
#define vi          vector<int>
#define all(a)      (a).begin(),(a).end()
#define sz(x)       (int)x.size()
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define ios         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
ll a[3005];
ll dp[3005][3005][2];
ll func(int i,int j,int k){
    if(i>j)
        return 0;

    if(dp[i][j][k]!=-1)
        return dp[i][j][k];

    ll ans;
    if(k==1)
        ans=max(func(i+1,j,2)+a[i],func(i,j-1,2)+a[j]);
    else
        ans=min(func(i+1,j,1)-a[i],func(i,j-1,1)-a[j]);

    return dp[i][j][k]=ans;
}   
int main(){
    int n;
    cin>>n;

    for(int i=0;i<n;i++)
        cin>>a[i];

    memset(dp,-1,sizeof dp);
    cout<<func(0,n-1,1);
}

Measured memory_bytes: 141440
//
//  select_half.cpp
//  learningCplusplus
//
//  Created by Tran Duc Chinh on 2020/04/04.
//  Copyright © 2020 Tran Duc Chinh. All rights reserved.
//

#include <iostream>
#include <math.h>
using namespace std;
typedef long long ll;
ll mod = 1000000007;


int main(int argc, const char* argv[]) {

  int r;
  std::cin >> r;
  double cir = 2*r*3.14159265358979323846;
  std::cout << cir << std::endl;

  return 0;
}


Measured memory_bytes: 3788
#include<stdio.h>

int main() {
	int a, b, c, d,small1,small2;
	scanf("%d", &a);
	scanf("%d", &b);
	scanf("%d", &c);
	scanf("%d", &d);
	small1 = a;
	small2 = c;
	if (a > b) small1 = b;
	if (c > d) small2 = d;
	printf("%d\n", small1 + small2);
	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

int main() {
  int i,j;
  int c[3][3];
  for (i=0;i<3;i++) {
    for (j=0;j<3;j++) {
      scanf("%d",&c[i][j]);
    }
  }
  int check = 0;
  if (c[0][1]-c[0][0]==c[1][1]-c[1][0]) {
    if (c[0][1]-c[0][0]==c[2][1]-c[2][0]) {
      if (c[0][2]-c[0][0]==c[1][2]-c[1][0]) {
        if (c[0][2]-c[0][0]==c[2][2]-c[2][0]) {
          if (c[1][0]-c[0][0]==c[1][1]-c[0][1]) {
            if (c[1][0]-c[0][0]==c[1][2]-c[0][2]) {
              if (c[2][0]-c[0][0]==c[2][1]-c[0][1]) {
                if (c[2][0]-c[0][0]==c[2][2]-c[0][2]) {
                  check = 1;
                }
              }
            }
          }
        }
      }
    }
  }
  if(check == 0) {
    printf("No\n");
  } else {
    printf("Yes\n");
  }
  return 0;
}


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

using namespace std;


int main (void) 
{

  /* Variable_Proclamation */
  int N;    // input
  int dif;  // output

  int i;    // subscript


  /* Input, Array_Proclamation */
  cin >> N;
  vector<int> a(N);


  for(i=0; i<N; i++)
  {
    cin >> a.at(i);
  }


  /* Initialize */
  dif     = 0;


  /* Calculation */
  sort   (a.begin(), a.end());
  reverse(a.begin(), a.end());

  for(i=0; i<N; i++)
  {
    if(i%2 == 0)
    {
      dif += a.at(i);
    }
    else if(i%2 == 1)
    {
      dif -= a.at(i);
    }
  }
  
  /* Output */
  cout << dif << endl;


  return 0;

}


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

int main() {
	int N, T[100], count = 0, M, P, X;
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> T[i];
		count += T[i];
	}
	cin >> M;
	for (int i = 0; i < M; i++) {
		cin >> P >> X;
		cout << count - T[P - 1] + X << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
// #define int long long
 
/* short */
#define pb push_back
#define print(x) cout << x << '\n'
 
/* REPmacro */
#define REPS(i, a, n) for (int i = (a); i < (n); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = 1; i <= (n); i++)
#define DEPS(i, a, n) for (int i = (a); i >= n; i--)
#define DEP(i, n) for (int i = (n); i >= 0; i--)

/* typedef */
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef pair<int, int> pii;

/* const */
const int INF = INT_MAX;
const int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};

/* func */
inline bool is_uruu(int y) {return (y % 4 == 0 && (y % 100 != 0 || y % 400 == 0));}


signed main()
{
  ios::sync_with_stdio(false);
  int n;

  for (;cin >> n, n;){
    vi ans(n, 0);
    REP(i, n){
      REP(j, 5){
        int a; cin >> a;
        ans[i] += a;
      }
    }
    cout << *max_element(ans.begin(), ans.end()) << " " << *min_element(ans.begin(), ans.end()) << '\n';
  }

  return (0);
}

Measured memory_bytes: 1200
N,K,Q=[int(x) for x in input().rstrip().split()]
cnt=[0 for i in range(N)]
for i in range(Q):
  A=int(input())
  cnt[A-1]+=1
for i in cnt:
  if 0<(K-Q+i):
    print("Yes")
  else:
    print("No")
    

Measured memory_bytes: 4732
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define REP(i,a,b) for(int i=int(a);i<(int)b;++i)
#define Graph vector<vecctor<ll>>
#define pairs vector<pair<ll,ll>>
#define pb push_back



using namespace std;
using ll = long long;
const ll INF = 1e18;
const double PI = acos(-1);

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



int main(void)
{
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    ll n,k,l=1,ind=0;
    cin >> n >> k;
    while(n >= l){
        ind++;
        l *= k;
    }
    cout << ind << endl;


    return 0;
}


Measured memory_bytes: 3628
#include<iostream>
    //#include <bits/stdc++.h>
    #include<vector>
    #include<algorithm>
    #include<string>
    #include<math.h>
    #include<sstream>
    #include<set>
    #include<map>
    using namespace std;
    #define INF 10000000;
    #define rep(i,n)for(int i=0;(i)<(int)(n);i++)
    #define vec(n) vector<int> vec(n)
    #define vvec(m,n) vector<vector<int>> vec(m,vector(n))

    int main(){
      int a,b;
      cin >> a >> b;
      
      cout << 6-a-b <<endl;
    }
    

Measured memory_bytes: 256
n = int(input())
h = [int(i) for i in input().split()]
ans = []
a = 0
for i in range(n-1):
  if h[i] >= h[i+1]:
    a += 1
  else:
    ans.append(a)
    a = 0
ans.append(a)
print(max(ans))

Measured memory_bytes: 14252
#define _USE_MATH_DEFINES

#include <iostream>
#include <string>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <utility>
#include <vector>
#include <numeric>

using namespace std;

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

	reverse(s.begin(), s.end());
	cout << s << endl;
}


Measured memory_bytes: 3140
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<string>
#include<string.h>
#include<algorithm>
using namespace std;
#define ll long long
ll n;
ll ans;
ll dfs(ll x)
{
	if(x==1) return 1;
	return 2*dfs(x/2)+1;
}
int main()
{
	scanf("%lld",&n);
	printf("%lld",dfs(n));
	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 area = a * b;
        int length = (a + b) * 2;
        System.out.println(area + " " +length );
        sc.close();
    }
}


Measured memory_bytes: 26100
using System;

namespace atcorder
{
    class Program
    {
        static void Main(string[] args)
        {
            var input1 = System.Console.ReadLine();
            var input1ary = input1.Split(' ');
            var K = Int32.Parse(input1ary[0]);
            var N = Int32.Parse(input1ary[1]);

            var input2 = System.Console.ReadLine();
            var A = input2.Split(' ');
            var tmp = 0;
            int max = 0;
            for(int i = 0; i < N - 1; ++i){
                tmp = Int32.Parse(A[i + 1]) - Int32.Parse(A[i]);
                if(tmp > max) max = tmp;
            }
            tmp = K - Int32.Parse(A[N-1]) + Int32.Parse(A[0]);
            if(tmp > max) max = tmp;

            var result = K - max;
            Console.WriteLine(result);
        }
    }
}


Measured memory_bytes: 30940
#include <bits/stdc++.h>
using namespace std;
#define watch(x) cout << (#x) << " is " << (x) << '\n'
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef double db;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a; }
//head
 
void solve(){
    int n;
    cin >> n;
    vector<int> p(n);
    int m = 99;
    int s = 0;
    for (int i = 0; i < n; i++){
        cin >> p[i];
        s += p[i];
        m = max(m, p[i]);
    }

    cout << s-m + m/2 << '\n';
}

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

    //int t; cin >> t; while (t--)
        solve();
}

Measured memory_bytes: 3644
#include <stdio.h>
#include <algorithm>

int pasta[3], juice[2];
int ans;

int main(void) {
	scanf("%d%d%d%d%d", &pasta[0], &pasta[1], &pasta[2], &juice[0], &juice[1]);
	printf("%d\n", std::min(pasta[0], std::min(pasta[1], pasta[2])) + std::min(juice[0], juice[1]) - 50);
	return 0;
}

Measured memory_bytes: 2712
n=int(input())
a=list(map(int,input().split()))
count=0
w=False
for i in range(n):
  if a[i]%2==0:
    w=True
  while w:
    count+=1
    a[i]=a[i]//2
    if a[i]%2!=0:
      w=False
print(count)

Measured memory_bytes: 9992
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; (i) < (n); (i)++)
using namespace std;

int N, M;
vector<vector<int>> G;
bool check[100005];
int pre[100005];
typedef pair<int, int> P;

int main()
{   
    cin >> N >> M;
    G.resize(N);
    REP(i, M){
        int A, B; cin >> A >> B;
        G[A-1].push_back(B-1);
        G[B-1].push_back(A-1);
    }
    REP(i, N) check[i] = false;
    
    queue<P> que;
    que.push(P(0, -1));
    while(!que.empty()){
        P p = que.front(); que.pop();
        if(check[p.first]) continue;
        if(p.second != -1) pre[p.first] = p.second + 1;
        check[p.first] = true;
        for(auto next : G[p.first]){
            que.push(P(next, p.first));
        }
    }

    bool ok = true;
    REP(i, N) if(!check[i]) ok = false;
    if(ok){
        cout << "Yes" << endl;
        REP(i, N-1) cout << pre[i+1] << endl;
    }else cout << "No" << endl;

    return 0;
}



Measured memory_bytes: 12164
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<utility>
#include<string>
#include<utility>
#include<iomanip>
#include<bitset>
#include<math.h>
using namespace std;
 
 
int main(){
 
	int n;
	cin >> n;
	vector<double> v(n);

	for (int i = 0; i < n; i++)
	{
		cin >> v[i];
	}
	
	double sum = 0;
	for (int i = 0; i < n; i++)
	{
		sum += 1.0/v[i];
	}
	
	cout << setprecision(12) << 1.0/sum << endl;

}


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

int main()
{
  string S, T;
  cin >> S >> T;
  int ans = 0;
  rep(i, S.size()) {
    if (S.at(i) == T.at(i)) {
      ans++;
    }
  }
  cout << ans << endl;
}

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

using namespace std;

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

  int64_t root_N;

  int a = 0;

  root_N = (int64_t)floor(sqrt(N*1.0));
  //cout << root_N << endl;

  for (int64_t i = root_N; i >0 ;i--){
    if(N%i==0&&a==0){
      cout << (i - 1) + (N / i - 1) << endl;
      a = 1;
    }
  }
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{

int a,b,c;

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

if(a>b){

int t;

t=a;

a=b;

b=t;

}

if(b>c){

int t;

t=b;

b=c;

c=t;

}

if(a>b){

int t;

t=a;

a=b;

b=t;

}

printf("%d %d %d\n",a,b,c);

return 0;

}

Measured memory_bytes: 596
N, K = map(int, input().split())
P = 10**9+7
def calc(n):
    X = [1]
    a, b = n, 1
    for i in range(n):
        X.append(X[-1]*a*pow(b, P-2, P)%P)
        a, b = a-1, b+1
    return [0]+X+[0]*3000
B = calc(K-1)
R = calc(N-K-1)
if N==K:
    print(1)
    for i in range(K-1):
        print(0)
else:
    for i in range(1, K+1):
        print(B[i] * (R[i-1]+2*R[i]+R[i+1]) % P)

Measured memory_bytes: 3444
//in the name of god
#include <bits/stdc++.h>
using namespace std;
#define MAX_N (int)1e5+20
#define INF 1e9+20
#define pb push_back
#define F first
#define S second
typedef long long LL; 
#define int LL
typedef pair<int,int> pii;
const int delta=(int)1e9+7,B=100;
int n,z,w,a[2020],x,ans;
main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	cin>>n>>z>>w; 
	for(int i=1;i<=n;++i) cin>>a[i]; 
	ans=abs(w-a[n]); if(n>1) ans=max(ans,abs(a[n]-a[n-1]));
	cout<<ans;
	return cout<<endl,0;
}

Measured memory_bytes: 256