akhauriyash/Code-Regression huggingface dataset:
/*
   Aizu Vol-1 0165: Lottery
   2017.8.15 bal4u@uu
   ?´???°??¨?????????
*/

#include <stdio.h>

#define MAX  1000000
#define SQRT 1000     // sqrt(MAX)

char prime[MAX + 5], *p, *q, *pmax = prime + MAX;
int table[MAX + 5], *t;


int main()
{
	int N, P, M;
	int k, a, b, ans;

	for (k = 3, p = prime + 3; k <= SQRT; k += 2, p += 2) {
		if (!*p) {
			for (q = p + k; q <= pmax; q += k) *q = 1;
		}
	}
	table[2] = k = 1, t = table + 3;
	for (p = prime + 3; p <= pmax; p += 2) {
		if (!*p) k++;
		*t++ = k, *t++ = k;
	}
	while (1) {
		scanf("%d", &N); if (!N) break;
		for (ans = 0, k = 0; k < N; k++) {
			scanf("%d%d", &P, &M);
			a = P - M, b = P + M;
			if (a < 2) a = 2;
			if (b > 1000000) b = 1000000;
			ans += table[b] - table[a - 1] - 1;
		}
		if (ans < 0) ans = 0;
		printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 5476
def partition(A, p, r):
  x = A[r][1]
  i = p - 1
  for j in range(p, r):
    if A[j][1] <= x:
      i += 1
      A[i], A[j] = A[j], A[i]
  A[i + 1], A[r] = A[r], A[i + 1]
  return i + 1

def quick_sort(A, p, r):
  if p < r:
    q = partition(A, p, r)
    quick_sort(A, p, q - 1)
    quick_sort(A, q + 1, r)

def is_stable(A, B):
  ma = {}
  for suit, num in A:
    if num not in ma: ma[num] = []
    ma[num].append(suit)

  mb = {}
  for suit, num in B:
    if num not in mb: mb[num] = []
    mb[num].append(suit)

  for num in ma:
    if ma[num] != mb[num]: return False

  return True

N = int(input())
A = []
for i in range(N):
  suit, num = input().split()
  A.append([suit, int(num)])

B = A[:]
quick_sort(A, 0, len(A) - 1)
print("Stable" if is_stable(A, B) else "Not stable")
for suit, num in A: print("{} {}".format(suit, num))

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

int main(void){
    
    int a[4][4],n,b[100];
    for (int i=1;i<=3;i++){
        for (int j=1;j<=3;j++){
            scanf("%d",&a[i][j]);
        }
    }
    scanf("%d",&n);
    for (int i=1;i<=n;i++){
        scanf("%d",&b[i]);
    }
    
    for (int i=1;i<=3;i++){
        for (int j=1;j<=3;j++){
            for (int k=1;k<=n;k++){
                if(b[k] == a[i][j]){
                    a[i][j] = 0;
                }
            }
        }
    }
    
    for (int i=1;i<=3;i++){
        int sum=0;
        for (int j=1;j<=3;j++){
            sum += a[i][j];
        }
        if (sum == 0){
            printf("Yes");
            return 0;
        }
    }
    for (int i=1;i<=3;i++){
        int sum=0;
        for (int j=1;j<=3;j++){
            sum += a[j][i];
        }
        if (sum == 0){
            printf("Yes");
            return 0;
        }
    }
    if (a[1][1] == a[2][2] && a[2][2] == a[3][3] && a[1][1] == 0){
        printf("Yes");
        return 0;
    }else if (a[1][3] == a[2][2] && a[2][2] == a[3][1] && a[1][3] == 0){
        printf("Yes");
        return 0;
    }else{
        printf("No");
        return 0;
    }
}

Measured memory_bytes: 128
#include <iostream>
using namespace std;
int main(){
    int n,sum=0;
    cin >> n;
    int *d = new int[n];
    for(int i=0;i<n;i++){
        cin >> d[i];
    }
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            sum += d[i]*d[j];
        }
    }
    cout << sum << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
typedef long long ll;
typedef vector<vector<ll>> vvl;
typedef vector<ll> vl;
typedef vector<vector<char>> vvc;
typedef vector<char> vc;
typedef pair<ll,ll> pll;
ll max(ll x,ll y){
if(x>y)return x;
else return y;
}
ll min(ll x,ll y){
  return x+y-max(x,y);
}

ll fai(ll n);
ll fai2(ll n);
bool aaa(ll n,ll k);

//1除く約数を全列挙する。その各々に対し、互いに素になるまで割り、余り1を構成できればo
ll fai(ll n){
  ll sum=1;//n自身の分
  for(ll i=2;i*i<=n;i++){
    if(n%i!=0)continue;
    if(aaa(n,i))sum++;
    if(aaa(n,n/i)&&i*i!=n)sum++;
  }
  return sum;
}
bool aaa(ll n,ll k){
  while(n%k==0){
    n/=k;
  }
  if(n%k==1)return true;
  return false;
}

//nの約数の個数
ll fai2(ll n){
  ll sum=-1;//1を除く
  for(ll i=1;i*i<=n;i++){
    if(n%i!=0)continue;
    sum+=2;
    if(i*i==n)sum--;
  }
  return sum;
}

int main() {
  ll n;cin >> n;
  cout << fai2(n-1)+fai(n) << endl;
}

Measured memory_bytes: 256
N = int(input())
A = []

for i in range(N):
    A.append(int(input()))

ma = max(A)
B = A.copy()
B.pop(A.index(ma))
sa = max(B)

for i in range(N):
    if A[i] == ma:
        print(sa)
    else:
        print(ma)

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

void solve() {
  bitset<6> s; cin >> s;
  cout << s.count() << endl;
}

signed main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  solve();
  return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;
//typedef tuple<ll, ll, ll> T;

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; }

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

ll f(ll n){
    ll res=0;
    while(n>0){
        res += n%10;
        n/=10;
    }
    return res;
}
double g(ll n){
    return (double)(n)/f(n);
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    vector<ll> res;
    ll base=1;
    REP(i,15){
        for(int j=1;j<150;j++){
            res.push_back(base*(j+1) - 1);
        }
        base*=10;
    }
    VSORT(res);
    res.erase(unique(res.begin(),res.end()),res.end());

    for(ll i = 0; i < res.size(); i++)
    {
        for(ll j = i+1; j < res.size(); j++)
        {
            if(g(res[i])>g(res[j])){
                res.erase(res.begin()+i--);
                break;
            }
        }
        
    }
    ll k;
    cin>>k;
    for(ll i = 0; i < k; i++)
    {
        cout<<res[i]<<endl;
    }
    
}

Measured memory_bytes: 384
use std::io::{Read, stdin};

fn main() {
    let stdin = stdin();
    let mut stdin = stdin.lock();

    let mut buf = String::new();
    stdin.read_to_string(&mut buf).unwrap();

    let mut three_nums: Vec<i32> = buf.split_whitespace().map(|x| x.parse().unwrap()).collect();
    three_nums.sort();

    println!("{}", three_nums.iter().map(i32::to_string).collect::<Vec<_>>().join(" "));
}


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

#define rep(i,n) for (decay_t <decltype (n)> i = 0, i ## __len = (n); i < i ## __len; ++ i)
#define ALL(x) begin (x), end (x)

auto main () -> int
{
  cin.tie (nullptr);
  ios::sync_with_stdio (false);

  size_t n;
  int64_t x;
  cin >> n >> x;

  vector <int64_t> l;
  copy_n (istream_iterator <iterator_traits <decltype (begin (l))>::value_type> (cin), n, back_inserter (l));

  vector <int64_t> d;
  d.push_back (0);

  rep (i, n)
  {
    d.push_back (d.back () + l [i]);
  }

  auto ans = partition_point (ALL (d), [&] (auto && elem) {
    return elem <= x;
  });

  cout << distance (d.begin (), ans) << endl;
}



Measured memory_bytes: 256
# -*- coding: utf-8 -*-

A=int(input())
B=int(input())
C=int(input())
X=int(input())

count=0
for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            #print((i*500+j*100+k*50))
            if X==(i*500+j*100+k*50):
                count+=1

print(count)

Measured memory_bytes: 3060
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdlib>
#include<queue>
#include<map>
#include<stack>
#include<set>
#include<vector>
#include<functional>
using namespace std;
typedef long long LL;
inline long long read()
{
	long long kk=0,f=1;
	char cc=getchar();
	while(cc<'0'||cc>'9'){if(cc=='-')f=-1;cc=getchar();}
	while(cc>='0'&&cc<='9'){kk=(kk<<1)+(kk<<3)+cc-'0';cc=getchar();}
	return kk*f;
}
int main()
{
	LL N,H,W;
	scanf("%lld%lld%lld",&N,&H,&W);
	LL asd=0;
	for(int i=1;i<=N;++i)
	{
		LL a,b;
		a=read()/H;b=read()/W;
		asd+=(a*b>0);
	}
	printf("%lld",asd);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	ll n,k, res;
	cin>>n>>k;
	if(n < k){
		res = min( abs(n-k), n);
	}else{
		res = min(n%k,abs((n%k) - k));
	}
	cout<<res<<endl;
}


Measured memory_bytes: 3608
#include <algorithm>
#include <cstdio>
#include <cstdlib>

using namespace std;

#define MAX_NUM_NODES 10

bool is_connected[MAX_NUM_NODES][MAX_NUM_NODES];
int candidate[MAX_NUM_NODES];

void init_candidate(size_t size)
{
  for(size_t i = 0; i < size; i++) {
    candidate[i] = i;
  }
}

int try_candidate(size_t size)
{
  if(size == 0) {
    fputs("size is zero\n", stderr);
    exit(1);
  }
  for(size_t i = 0; i < size-1; i++) {
    if(!is_connected[candidate[i]][candidate[i+1]]) {
      return 0;
    }
  }
  return 1;
}

void init_is_connected()
{
  for(int i = 0; i < MAX_NUM_NODES; i++) {
    for(int j = 0; j < MAX_NUM_NODES; j++) {
      is_connected[i][j] = false;
    }
  }
}

int main()
{
  int num_node, num_edge;
  scanf("%d%d", &num_node, &num_edge);
  for(int i = 0; i < num_edge; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    is_connected[a-1][b-1] = true;
    is_connected[b-1][a-1] = true;
  }
  init_candidate(num_node);
  long long cnt = 0;
  do {
    cnt += try_candidate(num_node);
  } while(next_permutation(candidate+1, candidate + num_node));
  printf("%lld\n", cnt);
  return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
from itertools import combinations_with_replacement,product
def input(): return sys.stdin.readline().rstrip()


def main():
    D,G=map(int, input().split())
    problem=[]
    for i in range(1,D+1):
        p,c=map(int, input().split())
        problem.append([i,p,c])
    ans=10000000
    for bit in list(product([0,1],repeat=D)):
        pnum=0
        nokori=G
        notcomp=[]
        for i in range(D):
            if bit[i]==1:
                pnum+=problem[i][1]
                nokori-=problem[i][2]+problem[i][1]*problem[i][0]*100
            else:
                notcomp.append(problem[i])
        while nokori>0 and notcomp:
            score,p,c=notcomp.pop()
            if score*(p-1)*100<=nokori:
                nokori-=score*(p-1)*100
                pnum+=p-1
            else:
                tmp=score*100
                pnum+=(nokori+tmp-1)//tmp
                nokori=0
        if nokori<=0:
            ans=min(ans,pnum)
    print(ans)
    


if __name__ == '__main__':
    main()



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


int main()
{
	int a, b;
cin >> a;
cin >> b;
if(a == 1 && b == 2)
	cout << 3 << endl;
if(a == 2 && b == 3)
	cout << 1 << endl;
if(a == 3 && b == 1)
	cout << 2 << endl;
if(a == 1 && b == 3)
	cout << 2 << endl;
if(a == 3 && b == 2)
	cout << 1 << endl;
if(a == 2 && b == 1)
	cout << 3 << endl;
return 0;

}

Measured memory_bytes: 256
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
def sub(x):
    j = n-1
    ans = 0
    for i in range(x+1, n-1):
        if j<=i:
            break
        while j-1>i and l[i]+l[j]<=l[x]:
            j -= 1
        if i<j and l[i]+l[j]>l[x]:
            ans += (j-i)
#         print(i,j)
    return ans
ans = 0
for x in range(n-2):
    ans += sub(x)
#     print(ans)
print(ans)

Measured memory_bytes: 68540
#include<iostream>
#include<string>
#include<vector>
#include<numeric>
#include<math.h>
#include<algorithm>
#include<iomanip>
using namespace std;

int main() {

	vector<string> weather = { "Sunny", "Cloudy", "Rainy", "Sunny" };

	string S;
	cin >> S;

	auto itr = find(weather.begin(), weather.end(), S);

	cout << *(itr + 1) << endl;

	return  0;
}


Measured memory_bytes: 256
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << "\n";
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REVFOR(i, m, n) for (int i = (n - 1); i >= (m); --i)
#define REP(i, n) FOR(i, 0, n)
#define REVREP(i, n) REVFOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

void chmax(ll &x, ll y) {
    if (x < y) x = y;
}

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    int R, C, K;
    cin >> R >> C >> K;

    vector<vll> v(R + 1, vll(C + 1, 0));
    REP(i, K) {
        int r, c; ll vv;
        cin >> r >> c >> vv;
        --r; --c;
        v[r][c] = vv;
    }

    vector<vector<vll>> dp(R + 1, vector<vll>(C + 1, vll(4, 0)));

    REP(i, R) REP(j, C) {
        REP(k, 4) {
            chmax(dp[i + 1][j][k], dp[i][j][k]);
            chmax(dp[i][j + 1][k], dp[i][j][k]);
        }
        if (v[i][j] > 0) {
            REP(k, 3) {
                chmax(dp[i][j + 1][k + 1], dp[i][j][k] + v[i][j]);
            }

            REP(k, 3) {
                chmax(dp[i + 1][j][0], dp[i][j][k] + v[i][j]);
            }
        }
    }

    REP(i, 4) {
        chmax(dp[R][C][i], dp[R-1][C][i]);
        chmax(dp[R][C][i], dp[R][C-1][i]);
    }

    print(*max_element(ALL(dp[R][C])));

}


Measured memory_bytes: 706524
import sys
n = int(input())

array = []
for i in range(n):
  f = input().replace(' ', '')
  f = int(f, 2)
  array.append(f)
  
p = []
for i in range(n):
  tmp = list(map(int, input().split()))
  p.append(tmp)
  
ans = -sys.maxsize
for i in range(1,2 ** 10):
  profit = 0
  for j in range(len(array)):
    s = bin(array[j] & i).replace('0b', '').replace('0', '')
    profit += p[j][len(s)]
    
  ans = max(ans, profit)
print(ans)
    

Measured memory_bytes: 3064
#!/usr/bin/env python3
import sys


def solve(N: int):
    a = 2
    b = 1
    for i in range(N - 1):
        a, b = b, a + b
    print(b)


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)


if __name__ == '__main__':
    main()


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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MAXN 1000010
#define rep(i,n) for (int i = 0; i < (n); ++i)
const ll mod = 1e9+7;

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

int main() {
    
    int a, b;
    ll x;
    double ans, h;
    cin >> a >> b >> x;
    ll vol = a*a*b;
    if (x >= vol/2) {
        h = 2.0* (vol-x) / (a*a);
        ans = atan2(h, a) * (180/PI);
    } else {
        h = 2.0*x / (a*b);
        ans = atan2(b, h) * (180/PI);
    }
    cout << setprecision(14);
    cout << ans << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repo(i,N) for(int i = 1; i < (N); i++)
#define pb push_back
#define mp make_pair
#define ll long long
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
//#define num 1000000007
#define pi acos(-1.0)
//cout << fixed << setprecision (20);   小数点以下2０桁まで
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//string s = to_string(int数);
//int n = stoi(string文字列);


int main() {
  string s;
  cin >> s;
  
  rep(i,s.size()) {
  cout << "x";
  }
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define maxn 100000
int L, n, m, ret, bit[30], a[30], tot = 1;

int read()
{
	int x = 0, k = 1;
	char c; c = getchar();
	while(c < '0' || c > '9') { if(c == '-') k = -1; c = getchar(); }
	while(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return x * k; 
} 

struct edge
{
	int u, v, w;
}e[maxn];

int main()
{
	L = read(); int tem = L;
	while(tem) { n ++; a[n] = tem & 1; tem >>= 1; }
	bit[0] = 1; for(int i = 1; i <= n; i ++) bit[i] = bit[i - 1] << 1;
	for(int i = n - 2; i >= 0; i --)
	{
		int u = tot, v = ++ tot; 
		e[++ m].u = u, e[m].v = v, e[m].w = bit[i];
		e[++ m].u = u, e[m].v = v, e[m].w = 0;
	}
	ret += bit[n - 1];
	for(int i = n - 1; i; i --)
	{
		if(!a[i]) continue;
		e[++ m].u = 1, e[m].v = n - i + 1, e[m].w = ret;
		ret += bit[i - 1]; 
	}
	cout << tot << " " << m << endl;
	for(int i = 1; i <= m; i ++) 
		printf("%d %d %d\n", e[i].u, e[i].v, e[i].w);
	return 0;
}

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

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    int ans = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        ans += a[i];
    }
    sort(a.begin(), a.end());
    ans -= a[n - 1] / 2;
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
ll n,res;
using namespace std;

int main() {			
res=0;
cin>>n;
int arr[n];
int memo[n];
for(int i=0;i<n;i++)
	cin>>arr[i];
memo[0]=0;
memo[1]=abs(arr[0]-arr[1]);//10
for(int i=2;i<n;i++)
	memo[i]=min(memo[i-1]+abs(arr[i]-arr[i-1]),memo[i-2]+abs(arr[i]-arr[i-2]));
cout << memo[n-1] << endl;
return 0;
}

Measured memory_bytes: 4300
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
double factorial(int x){
  double y = 1;
  for (int i = x; i >=1; i--){
    y *= i;
  }
  return y;
}

int main(){
  int n;
  cin >> n;
  vector<vector<int>> x(n, vector<int>(2));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 2; j++) {
      cin >> x.at(i).at(j);
    }
  }
  
  double ans = 0;
  for (int i = 0; i < n-1; i++){
    for (int j = i+1; j < n; j++){
      ans += pow(pow(x.at(i).at(0)-x.at(j).at(0), 2)+pow(x.at(i).at(1)-x.at(j).at(1), 2), 1.0/2.0);
    }
  }
  ans /= n/2.0;
  cout << setprecision(15) << ans << endl;
  
  return 0;
}

Measured memory_bytes: 640
import numpy as np

# get input
eight, ten = map(lambda x: int(x), input().split(' '))

def oriPrice(a, b):
  """
  <int> a = round(0.08 * ori)
  <int> b = round(0.10 * ori)
  """
  # ori = b*10 ~ (b+1)*10 - 1
  for i in range(10, 0, -1):
    possibleOri = (b+1)/0.10-i
    if np.int(np.floor(possibleOri*0.08)) == a:
      return np.int(possibleOri)
    
  return -1

print(oriPrice(eight, ten))


Measured memory_bytes: 22268
import java.util.Scanner;

public class Main{
  public static void main(String[] args){

    Scanner sc = new Scanner(System.in);

    int A = sc.nextInt();
    int B = sc.nextInt();
    int C = sc.nextInt();

    int count = 0;

    while(true){

      if(B >= A){
        B = B - A;
        count = count + 1;
      }else{
       break;
      }

      if(count == C){
        break;
      }

    }
    System.out.println(count);
  }
}

Measured memory_bytes: 21844
#include <stdio.h>
typedef struct {
	char mark;
	int num;
} Card;

void BubbleSort(Card C[], int N) {
	int i, j;
	Card tmp;
	for (i = 0; i < N; ++i) {
		for (j = N - 1; j >= i +1 ; --j) {
			if (C[j].num < C[j-1].num) {
				tmp = C[j];
				C[j] = C[j-1];
				C[j - 1] = tmp;
			}
		}
	}
	return;
}

int isStable(Card C1[], Card C2[], int N) {
	int i;
	for (i = 0; i < N; ++i) {
		if (C1[i].mark != C2[i].mark) return 0;
	}
	return 1;
}

void showQue(Card A[], int N)
{
	int i;
	for (i = 0; i < N; ++i) {
		if (i != N - 1) {
			printf("%c%d ", A[i].mark, A[i].num);
		} else {
			printf("%c%d\n", A[i].mark, A[i].num);
		}
	}
	
	return;
}


void SelectionSort(Card C[], int N) {
	int i, j, minj;
	Card tmp;

	for (i = 0; i < N; ++i) {
		minj = i;
		for (j = i; j < N; ++j) {
			if (C[j].num < C[minj].num) {
				minj = j;
			}
		}	
		tmp = C[i];
		C[i] = C[minj];
		C[minj] = tmp;
	}
	return;
}


int main(void) {
	Card C1[100] = {0};
	Card C2[100] = {0};
	int N, i;
	
	scanf("%d", &N);

	for (i = 0; i < N; ++i) {
		scanf(" %c%d", &C1[i].mark, &C1[i].num);
		C2[i] = C1[i];
	}
	BubbleSort(C1, N);
	SelectionSort(C2, N);

	showQue(C1, N);
	printf("Stable\n");
	showQue(C2, N);
	if (isStable(C1, C2, N)) {
		printf("Stable\n");
	} else {
		printf("Not stable\n");
	}
	return 0;
}

Measured memory_bytes: 608
import numpy as np

N, M, C = map(int, input().split())
B = np.array(list(map(int, input().split())))
A = np.array([list(map(int, input().split())) for _ in range(N)])

ans = 0

for i in range(N):
    tmp = np.sum(A[i] * B) + C
    if tmp > 0:
        ans = ans + 1

print(ans)

Measured memory_bytes: 12480
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pb push_back
#define lowbit(x) ((x)&(-x))
#define inf 0x3f3f3f3f
#define endl "\n"
#define MP(x,y) (make_pair(x,y))
#define pll pair<int,int>
#define pi 3.1415926535
using namespace std;
int n,k,c;
char s[200005];
int z[200005],y[200005],lst[200005];
int main(){
    scanf("%d%d%d",&n,&k,&c);
    scanf("%s",s);
    int l = 0;
    while(s[l]=='x') l++;
    int r=n-1;
    while(s[r]=='x') r--;
    if(r<l) return 0;
    for(int i=l;i<=r;i++){
        if(s[i] == 'x'){
            z[i] = 0;
            lst[i] = lst[i-1];
        }else{
            lst[i] = i;
            int x = i;
            if(i-l>c){
                x = lst[x-c-1];
                z[i] = z[x]+1;
            }else{
                z[i] = 1;
            }
        }
    }
    for(int i=r;i>=l;i--){
        if(s[i]=='x'){
            y[i] = 0;
            lst[i] = lst[i+1];
        }else{
            lst[i] = i;
            int x=i;
            if(r-i>c){
                x = lst[x+c+1];
                y[i] = y[x]+1;
            }else{
                y[i] = 0;
            }
        }
    }
    vector<int> a,b;
    a.pb(-inf);
    for(int i=l;i<=r;i++){
      	if(z[i]+y[i]>k) return 0;
        if(z[i]+y[i]==k) a.pb(i);
        //cout<<i<<' ';}
    }
    a.pb(inf);
    for(int i=1;i<a.size()-1;i++){
        if(a[i]-a[i-1]>c && a[i+1]-a[i]>c){
            b.pb(a[i]+1);
        }
    }
    if(b.size()<=k){
        for(int i=0;i<b.size();i++){
            printf("%d\n",b[i]);
        }
    }
}


Measured memory_bytes: 5748
N = int(input())
A = input()
B = input()
C = input()
ans = 0
for i in range(N):
    if A[i] != B[i]:
        if A[i] != C[i]:
            if B[i] != C[i]:
                ans += 2
            else:
                ans += 1
        else:
            ans += 1
    else:
        if B[i] != C[i]:
            if A[i] != C[i]:
                ans += 1
print(ans)

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

long long int dp[1000][1000];
#define MOD 1000000007
int main() {
	int h,w;
	cin>>h>>w;
	char ar[h][w+1];
	for(int i=0;i<h;i++)
		cin>>ar[i];
		
	for(int i=0;i<h;i++)
		for(int j=0;j<w;j++)
			if(j==i && i==0)
				dp[i][j]=1;
			else if(ar[i][j]=='#') dp[i][j]=0;
			else dp[i][j]=((i?dp[i-1][j]:0) + (j?dp[i][j-1]:0))%MOD;
	cout<<dp[h-1][w-1];
}

Measured memory_bytes: 9088
#pragma region cp-helper
#include <bits/stdc++.h>
using namespace std;
#define AC ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define int long long
#define ll long long
#define ull unsigned long long
#define ii pair<ll, ll>
#define lll pair<ll, ll>
#define vi vector<int>
#define vvi vector<vi>
#define vl vector<ll>
#define vll vector<lll>
#define vvl vector<vl>
#define vii vector<ii>
#define all(a) a.begin(), a.end()
#define qsort(a) sort(all(a))
#define qsortd(a) sort(all(a), greater<>())
#define qsortf(a, f) sort(all(a), f)
#define pb(n) push_back(n)
#define eb(n) emplace_back(n)
#define pp(a, b) emplace_back(a, b)
#define umap unordered_map
#define uset unordered_set
#define nl '\n'
#define fileio(in, out) freopen(in, "r", stdin); freopen(out, "w", stdout)
#define qmod %mod
#define pls signed
#define give main()
const int mod = 1000000007;
#pragma endregion

const int N = 100005;

pls give {
    AC;
    int x, ans=0;
    cin >> x;
    ans = 1000*(x/500);
    x %= 500;
    ans += 5*(x/5);
    cout << ans << nl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <deque>
#include <numeric>
#include <utility>
#define sign(a) ((a>0)-(a<0))
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define LL long long
#define INF (LL)(1LL<<60)
#define all(a) a.begin(), a.end()
#define gr greater<LL>()

using namespace std;

template <class T>
class SegTree{
public:
    vector<T> arr;
    function<T(T,T)> f;
    T ini;
    uint n;
    SegTree(int N, function<T(T,T)> func, T ini_){
        f=func;
        ini=ini_;
        n=1;
        while(n<N)n<<=1u;
        arr.assign(2*n-1, ini);
    }

    void update(uint i, T val){
        i+=n-1;
        arr[i]=val;
        while(i>0){
            i=(i-1)/2;
            arr[i]=f(arr[2*i+1],arr[2*i+2]);
        }
    }

    T find(uint s, uint t){
        return __find(s,t,0,0,n);
    }
private:
    T __find(uint s, uint t, uint k, uint l, uint r){
        if(t<=l || s>=r)return ini;
        if(s<=l && t>=r)return arr[k];
        T vl=__find(s,t,2*k+1,l,(l+r)/2);
        T vr=__find(s,t,2*k+2, (l+r)/2, r);
        return f(vl,vr);
    }
};

void solve(long long N, std::vector<long long> p){
    SegTree<LL> st(N, [](LL a, LL b){return a+b;}, 0);
    rep(i,N)st.update(i,1);

    LL prev=0;
    for(auto pp:p){
        LL aa = st.find(0, pp);
        LL bb = st.find(pp-1, N);
        if(aa+bb <= prev){
            LL d = prev-(aa+bb)+1;
            st.update(pp-1,1+d);
            prev = aa+bb+2*d;
        }else {
            prev = aa + bb;
        }
    }
    rep(i,N)cout << st.find(0, i+1) << " ";
    cout << endl;
    rep(i,N)cout << st.find(i,N) << " ";
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> p(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&p[i]);
    }
    solve(N, std::move(p));
    return 0;
}


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

using namespace std;
#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__)

typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 1LL<<60;

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

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; }

ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

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

  ll N, K;
  cin >> N >> K;

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

  ll sumA = 0;
  rep(i, N) sumA += A[i];

  ll ans = 0;
  for(ll T = 1; T * T <= sumA; T++){

    if(sumA % T == 0){
    vector<ll> subvec(N);

    ll sum_pos = 0;
    rep(i, N){
      subvec[i] = A[i] % T;
      sum_pos += (T - subvec[i]);
    }

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

    ll sum_neg = 0;

    rep(i, N){

      sum_neg += subvec[i];
      sum_pos -= (T - subvec[i]);

      if(sum_neg == sum_pos){
        if(sum_neg <= K){
          chmax(ans, T);
        }else{
          break;
        }
      }

    }

    vector<ll> subvec2(N);
    ll TT = sumA / T;
    sum_pos = 0;
    rep(i, N){
      subvec2[i] = A[i] % TT;
      sum_pos += (TT - subvec2[i]);
    }

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

    sum_neg = 0;

    rep(i, N){

      sum_neg += subvec2[i];
      sum_pos -= (TT - subvec2[i]);

      if(sum_neg == sum_pos){
        if(sum_neg <= K){
          chmax(ans, TT);
        }else{
          break;
        }
      }

    }
    }
  }

    ll T = sumA;
    vector<ll> subvec(N);

    ll sum_pos = 0;
    rep(i, N){
      subvec[i] = A[i] % T;
      sum_pos += (T - subvec[i]);
    }

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

    ll sum_neg = 0;

    rep(i, N){

      sum_neg += subvec[i];
      sum_pos -= (T - subvec[i]);

      if(sum_neg == sum_pos){
        if(sum_neg <= K){
          chmax(ans, T);
        }else{
          break;
        }
      }
    }

  cout << ans << endl;



  return 0;
}


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

int main()
{
    int K;
    cin >> K;
    rep(i, 0, K)
    {
        cout << "ACL";
    }
    return 0;
}

Measured memory_bytes: 3580
n, p = map(int, raw_input().strip().split())
s = raw_input().strip()

if p == 2:
    ans = 0
    for i in xrange(n):
        if s[i] in '02468':
            ans += (i + 1)
    print ans
    exit()

if p == 5:
    ans = 0
    for i in xrange(n):
        if s[i] in '05':
            ans += (i + 1)
    print ans
    exit()

n = len(s)
l = [0 for i in xrange(n + 1)]

l[n] = int(s[n - 1])
if l[n] >= p: l[n] %= p

p10 = 1
for i in xrange(n - 1, 0, -1):
    p10 *= 10
    if p10 >= p: p10 %= p
    l[i] = p10 * (ord(s[i - 1]) - ord('0'))
    if l[i] >= p: l[i] %= p

cnt = [0 for i in xrange(p)]
cnt[l[0]] += 1
for i in xrange(1, n + 1):
    l[i] += l[i - 1]
    if l[i] >= p: l[i] -= p

    cnt[l[i]] += 1

ans = 0
for i in xrange(p):
    ans += ((cnt[i] * (cnt[i] - 1)) / 2)

print ans


Measured memory_bytes: 34540
#include <cstdio>
#include <iostream>
using namespace std;
 int main()
 {
     int n,m,t;
     cin>>n>>m>>t;
     if(n>t) cout<<"NO"<<endl;
     else if(n+m>=t) cout<<"YES"<<endl;
     else cout<<"NO"<<endl;
     return 0;
 }

Measured memory_bytes: 256
n=input()
L1=[[0,0,0,0,0,0,0,0,0,0],
   [0,0,0,0,0,0,0,0,0,0],
   [0,0,0,0,0,0,0,0,0,0]]
L2=[[0,0,0,0,0,0,0,0,0,0],
   [0,0,0,0,0,0,0,0,0,0],
   [0,0,0,0,0,0,0,0,0,0]]   
L3=[[0,0,0,0,0,0,0,0,0,0],
   [0,0,0,0,0,0,0,0,0,0],
   [0,0,0,0,0,0,0,0,0,0]]
L4=[[0,0,0,0,0,0,0,0,0,0],
   [0,0,0,0,0,0,0,0,0,0],
   [0,0,0,0,0,0,0,0,0,0]]
Mantion=[L1,L2,L3,L4]
for i in range(n):
  b,f,r,v=map(int, raw_input().split())
  Mantion[b-1][f-1][r-1]+=v

for j in range(3):
  L1_str=map(str, L1[j])
  print "",
  print " ".join(L1_str)
print "#"*20
for j in range(3):
  L2_str=map(str, L2[j])
  print "",
  print " ".join(L2_str)
print "#"*20
for j in range(3):
  L3_str=map(str, L3[j])
  print "",
  print " ".join(L3_str)
print "#"*20
for j in range(3):
  L4_str=map(str, L4[j])
  print "",
  print " ".join(L4_str)

Measured memory_bytes: 6500
#include <iostream>
#include <cstdio>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <cmath>
#include <complex>
#include <map>
#include <climits>
#include <sstream>
using namespace std;

#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-8
#define F first
#define S second
#define mkp make_pair

static const double PI=6*asin(0.5);
typedef long long ll;
typedef complex<double> CP;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vint;
static const int INF=1<<24;

template <class T>
void initvv(vector<vector<T> > &v,int a,int b, const T  &t = T()){
	v.assign(a,vector<T>(b,t));
}

//v.erase(unique(v.begin(),v.end()),v.end());


int main(){
	int n;
	// map<char,ll> ma;
	int dx[]={0,0,1,-1};
	int dy[]={1,-1,0,0};
	int aa[][4]={
		{0,0,1,3},
		{0,1,2,4},
		{1,2,2,5},
		{0,3,4,6},
		{1,3,5,7},
		{2,4,5,8},
		{3,6,6,7},
		{4,6,7,8},
		{5,7,8,8}
	};
	while(cin>>n,n){
		vector<ll> aaa(9,0);
		char x,y,z;
		cin>>x>>y>>z;
		int d,e,f;
		d=x-'A';
		e=y-'A';
		f=z-'A';
		aaa[d]++;
		
		rep(i,n){
			vector<ll> tmp(9,0);
			rep(k,9){
				rep(j,4){
					if(aa[k][j]==f){
						tmp[k]+=aaa[k];
					}
					else{
						tmp[aa[k][j]]+=aaa[k];
					}
				}
			}
			aaa=tmp;

		}
		
		long double ans=4.0;
		ans=pow(ans,n);
		ans=aaa[e]/ans;
		// cout<<ans<<endl;
		printf("%.8Lf\n",ans);
	}
	
}

Measured memory_bytes: 1236
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <limits>
#include <cmath>
#include <cassert>

using namespace std;
using ll = long long;

const int INF = 1<<30;
const int MOD = (int)1e9 + 7;
const int MAX_N = (int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, r;
    while(cin >> n >> r, n or r)
    {
        vector<int> v(n);
        iota(v.begin(), v.end(), 1);
        for(int i = 0; i < r; i++)
        {
            int p, c; cin >> p >> c;
            vector<int> tmp(v.begin() + n - p - c + 1, v.begin() + n - p + 1);
            v.erase(v.begin() + n - p - c + 1, v.begin() + n - p + 1);
            v.insert(v.end(), tmp.begin(), tmp.end());
        }
        cout << v.back() << endl;
    }
    return 0;
}




Measured memory_bytes: 3156
#include <iostream>
#include <algorithm>
#include <utility>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <list>
#include <stack>
#include <string>
#include <cmath>

using namespace std;

#define FAST_IO() ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define USE_DB() cout << fixed; cout.precision(10);

#define pqu priority_queue
#define que queue
#define stk stack
#define vec vector

typedef long long ll;
typedef double db;
typedef string str;

#define in(x) cin >> x
#define ini(x) int x; cin >> x
#define inl(x) ll x; cin >> x
#define ins(x) str x; cin >> x

#define out(x) cout << x
#define outb(x) cout << x << ' '
#define outn(x) cout << x << '\n'

#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define sz(x) x.size()
#define all(x) x.begin(), x.end()

#define forn(i, s, e) for (int i = s; i < e; i++)
#define forr(i, s, e) for (int i = s; i >= e; i--)
#define ford(i, s, e, d) for (int i = s; i < e; i += d)
#define fors(i, n) for (int i = 1; i*i <= n; i++)

int main() {
	FAST_IO();

	ini(a);
	ini(b);
	outn((a-1)*(b-1));

	return 0;
}


Measured memory_bytes: 256
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;
typedef string::const_iterator State;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 1e18
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD 998244353
#define seg_size 262144
#define REP(a,b) for(long long a = 0;a < b;++a)
vector<complex<double>>  DFT(vector<complex<double>> a) {
	int n = a.size();
	if (n == 1) return a;
	vector<complex<double>> a0(n / 2), a1(n / 2);
	REP(i, n) {
		if (i % 2 == 0) {
			a0[i / 2] = a[i];
		}
		else {
			a1[i / 2] = a[i];
		}
	}
	vector<complex<double>> inversed_a0 = DFT(a0), inversed_a1 = DFT(a1);
	vector<complex<double>> inversed_a(n);
	for (int i = 0; i < n; ++i) {
		complex<double> zeta = complex<double>(cos(2 * Ma_PI * i / n), sin(2 * Ma_PI * i / n));
		inversed_a[i] = inversed_a0[i % (n / 2)] + zeta * inversed_a1[i % (n / 2)];
	}
	return inversed_a;
}
vector<complex<double>> IDFT(vector<complex<double>> inversed_a) {
	int n = inversed_a.size();
	vector<complex<double>> now = DFT(inversed_a);
	reverse(now.begin(), now.end());
	for (int q = now.size() - 1; q >= 1; --q) {
		swap(now[q], now[q - 1]);
	}
	REP(i, n) {
		now[i] /= complex<double>(n, 0);
	}
	return now;
}
vector<complex<double>> conv(vector<complex<double>> a, vector<complex<double>> b) {
	int deg = a.size() + b.size() - 1;
	int n = 1;
	while (n < deg) n <<= 1;
	a.resize(n);
	b.resize(n);
	vector<complex<double>> inversed_a = DFT(a),inversed_b = DFT(b);
	vector<complex<double>> inversed_c(n);
	REP(i, n) {
		inversed_c[i] = inversed_a[i] * inversed_b[i];
	}
	return IDFT(inversed_c);
}
int main(){
	int n;
	cin >> n;
	vector<long long> inputs;
	REP(i, n) {
		long long a;
		cin >> a;
		inputs.push_back(a);
	}
	vector<long long> geko;
	REP(i, n) {
		if (geko.size() == 0) {
			geko.push_back(-inputs[i]);
			continue;
		}
		auto hoge = upper_bound(geko.begin(), geko.end(), -inputs[i]);
		if (hoge != geko.end()) {
			*hoge = -inputs[i];
		}
		else {
			geko.push_back(-inputs[i]);
		}
	}
	cout << geko.size() << endl;
	return 0;
}

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

using namespace std;

typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = (ll)1e9 + 7;

int main()
{
  int N, K; scanf("%d %d", &N, &K);
  int ans = K;
  for (int i = 0; i < N - 1; ++i) {
    ans *= (K - 1);
  }
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 256
/*Infor {{{
 ******************************************************
 * > File Name: a.cpp
 * > Author: samcompu
 * > Mail: admin@samcompu.com
 * > Created Time: 2018年06月23日 星期六 20时00分58秒
 ******************************************************
}}}*/

#include <bits/stdc++.h>

using namespace std;

/*Abbreviation {{{ */
#define FOR(i,a,b) for(int i = (int)(a); i <= (int)(b); i++)
#define ROF(i,a,b) for(int i = (int)(a); i >= (int)(b); i--)
#define cini(a) scanf("%d", &(a))
#define cinc(a) scanf("%c", &(a))
#define cinl(a) scanf("%lld", &(a))
#define cins(a) scanf("%s", (a))
#define cind(a) scanf("%lf", &(a))
#define coui(a) printf("%d", (a))
#define couc(a) printf("%c", (a))
#define coul(a) printf("%lld", (a))
#define cous(a) printf("%s", (a))
#define coud(a) printf("%f", (a))
#define SPA printf(" ")
#define LIN printf("\n")
#define ull unsigned long long int
/*}}}*/

/*Constant {{{*/
/*}}}*/

/*Class {{{*/
/*}}}*/

/*Variable {{{*/
char S[5];
/*}}}*/

/*Declare {{{*/
/*}}}*/

/*Main {{{*/
int main() {
  cins(S);
  int ans = 0;
  FOR(i, 0, strlen(S) - 1) {
    if (S[i] == '+') ans++;
    else ans--;
  }
  coui(ans), LIN;
  return 0;
}
/*}}}*/

/*Define {{{*/
/*}}}*/


Measured memory_bytes: 256
n = int(input())
#n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
count = 1
for i in range(1, n):
    if a[i-1] >= a[i]:
        count += 1
    else:
        a[i] = a[i-1]

print(count)


Measured memory_bytes: 24744
#include<iostream>
#include<cstdio>
#include<queue>
#include<vector>
#include<algorithm>
#include<cstring>
using namespace std;
typedef long long ll;
const int mod=1000000007;
int n,jc[200005]={1},ny[200005]={1};
vector<int> g[200005];
ll f[200005],f2[100005],size[200005];
int Power(int x,long long y,int mod) {
	int ret=1;
	while(y) {
		if(y&1)ret=1ll*ret*x%mod;
		x=1ll*x*x%mod,y>>=1;
	}
	return ret;
}
int C(int x,int y){
	return 1ll*jc[x]*ny[y]%mod*ny[x-y]%mod;
}
void DFS(int x,int fa) {
	f[x]=size[x]=1;
	for(int y:g[x]) {
		if(y==fa)continue;
		DFS(y,x);
		f[x]=1ll*f[x]*f[y]%mod*C(size[x]+size[y]-1,size[x]-1)%mod;
		size[x]+=size[y];
	}
}
void HuanGen(int x,int fa){
	for(int y:g[x]){
		if(y==fa)continue;
		int tmp=1ll*f2[x]*Power(C(n-1,n-size[y]-1),mod-2,mod)%mod*Power(f[y],mod-2,mod)%mod;
		f2[y]=1ll*f[y]*tmp%mod*C(n-1,size[y]-1)%mod;
		HuanGen(y,x);
	}
}
int main() {
	cin>>n;
	for(int i=1; i<n; i++) {
		int x,y;
		cin>>x>>y;
		g[x].push_back(y),g[y].push_back(x);
	}
	for(int i=1; i<=n; i++)jc[i]=1ll*jc[i-1]*i%mod;
	ny[n]=Power(jc[n],mod-2,mod);
	for(int i=n-1; i>=1; i--)ny[i]=1ll*(i+1)*ny[i+1]%mod;
	memset(size,0,sizeof(size));
	DFS(1,0);
	f2[1]=f[1];
	HuanGen(1,0);
	for(int i=1;i<=n;i++)cout<<f2[i]<<endl;
	return 0;
}

Measured memory_bytes: 19444
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<math.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define mod 1000000007
using namespace std;
int main(){
    int a,b,c;    cin>>a>>b>>c;
    if(a<b&&b<c){
        cout<<"Yes"<<endl;
        return 0;
    }
    cout<<"No"<<endl;
}


Measured memory_bytes: 3132
#include<bits/stdc++.h>
#define For(i,x,y) for (register int i=(x);i<=(y);i++)
#define FOR(i,x,y) for (register int i=(x);i<(y);i++)
#define Dow(i,x,y) for (register int i=(x);i>=(y);i--)
#define Debug(v) for (auto i:v) printf("%lld ",i);puts("")
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define ep emplace_back
#define siz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define fil(a,b) memset((a),(b),sizeof(a))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pa;
typedef pair<ll,ll> PA;
typedef vector<int> poly;
inline ll read(){
    ll x=0,f=1;char c=getchar();
    while ((c<'0'||c>'9')&&(c!='-')) c=getchar();
    if (c=='-') f=-1,c=getchar();
    while (c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
    return x*f;
}

ll f[100][100];

int main(){
	int n=read();
	For(i,1,n){
		double x;
		scanf("%lf",&x);
		ll y=(ll)(x*1e9+0.5);
		int a=0,b=0;
		while (y%2==0) y/=2,a++;
		while (y%5==0) y/=5,b++;
		f[a][b]++;
	}
	ll ans=0,ans2=0;
	For(i,0,60) For(j,0,60) if (f[i][j]){
		For(_i,0,60) For(_j,0,60) if (f[_i][_j]&&min(i+_i,j+_j)>=18){
			if (i!=_i||j!=_j) ans+=f[i][j]*f[_i][_j];
				else ans2+=f[i][j]*(f[i][j]-1)/2;
		}
	}
	printf("%lld\n",ans/2+ans2);
}

Measured memory_bytes: 3804
import sys;input=lambda:sys.stdin.readline().rstrip();aint=lambda:int(input());ints=lambda:list(map(int,input().split()))
import math;floor,ceil=math.floor,math.ceil
from collections import deque
Yes=lambda b:print('Yes')if b else print('No');YES=lambda b:print('YES')if b else print('NO')
is_even=lambda x:True if x%2==0 else False

def main():
    n,m = ints()
    a = ints()
    s = sum(a)
    a.sort(reverse=1)
    Yes(a[m-1]>=s/(4*m))

if __name__ == '__main__':
    main()

Measured memory_bytes: 3316
#include <bits/stdc++.h>
#define int long long
using namespace std;

const int mod=1e9+7;
int n,m,a,b,ans,mul[1000010];

inline void pre()
{
	mul[0]=1;
	for(int i=1;i<=1000000;i++) mul[i]=(mul[i-1]*i)%mod;
}

inline int ksm(int a,int b)
{
	int ans=1;
	a%=mod;
	while(b)
	{
	  if(b&1) ans=(ans*a)%mod;
	  b>>=1;
	  a=(a*a)%mod;
	}
	return ans;
}

inline int C(int n,int m)
{
	if(n>=0 && m>=0 && n>=m) return (mul[n]*ksm(mul[m],mod-2)%mod*ksm(mul[n-m],mod-2)%mod)%mod;
	return 0;
}

signed main()
{
	pre();
	scanf("%d%d%d%d",&n,&m,&a,&b);
	ans=C(n-1+m-1,n-1);
	for(int j=1;j<=b;j++)
	{
	  int i=n-a,sum=C(i-1+j-1,i-1)*C(n-i-1+m-j,n-i-1)%mod;
	  ans=((ans-sum)%mod+mod)%mod; 
	}
	cout<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 8064
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ff first
#define ss second
#define pb push_back

#define N 200010
#define MOD 998244353

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

	int a, b;
	cin >> a >> b;
	if(b % a == 0)
		cout << a + b;
	else
		cout << b - a;
	return 0;
}

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

int main(){
    int n,l;
    cin>>n>>l;
    vector<string> v(n);
    for(int i=0;i<n;i++) cin>>v[i];
    sort(v.begin(),v.end());
    for(int i=0;i<n;i++) cout<<v[i];
return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#include <cstdlib>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
    double r;
    double l;
    cin >> r;
    l = (2 * r) * M_PI;
    cout << l << endl;
    return 0;
}


Measured memory_bytes: 3788
#include<iostream>
#include<algorithm>
using namespace std;
static const int NIL = -1;
static const int MAX_A = 16;
static const int MAX_B = 16;

int a, b;
int n, x, y;
int memo[MAX_A][MAX_B];

int main(){
	for(;;){
		cin >> a >> b;
		if(a == 0 && b == 0) break;
		
		fill(memo[0], memo[a], 0);
		cin >> n;
		for(int i = 1; i <= n; i++){
			cin >> x >> y;
			x--; y--;
			memo[x][y] = NIL;
		}
		memo[0][0] = 1;
		
		for(int i = 0; i < a; i++){
			for(int j = 0; j < b; j++){
				if(memo[i][j] == NIL) continue;
				if(i == 0){
					if(memo[i][j - 1] == NIL) memo[i][j] = 0;
					else memo[i][j] += memo[i][j - 1];
				}else if(j == 0){
					if(memo[i - 1][j] == NIL) memo[i][j] = 0;
					else memo[i][j] += memo[i - 1][j];
				}else{
					if(memo[i][j - 1] == NIL && memo[i - 1][j] == NIL) memo[i][j] = 0;
					else if(memo[i][j - 1] == NIL) memo[i][j] += memo[i - 1][j];
					else if(memo[i - 1][j] == NIL) memo[i][j] += memo[i][j - 1];
					else memo[i][j] += memo[i - 1][j] + memo[i][j - 1];
				}
			}
		}

		cout << memo[a - 1][b - 1] << endl;
	}
	return 0;
}


Measured memory_bytes: 3080
import itertools
N = int(input())
List = list(map(int, input().split()))
List=sorted(List)

def has_duplicates(seq):
    return len(seq) != len(set(seq))

SList=list(itertools.combinations(List,3))
#print(SList)

ans=0

for i in range(len(SList)):
    #print(SList[i])
    if has_duplicates(SList[i])==False:
        C=sorted(SList[i])[::-1]
        #print("CCCCCCCCCCCC")
        if C[2]+C[1]>C[0]:
            ans+=1
            #print("AAAAAAAAAAAAA",C[0]+C[1],C[2])
    
print(ans)

Measured memory_bytes: 20536
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <algorithm>
#include <bitset>
#include <tuple>
#include <set>
#include <map>
#define range(i, r) for(int i=0;i<r;i++)
#define ranges(i, l, r) for(int i=l;i<r;i++)
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi std::vector<std::vector<int> >
#define vvl std::vector<std::vector<ll> >
#define MODs 1000000007;
#define MODn 1000000009;
typedef long long int ll;
using namespace std;

int main(int argc, char const *argv[]) {
  ll N;
  std::cin >> N;
  std::vector<ll> A(N);
  for(int i=0;i<N;i++) std::cin >> A[i];
  ll r=A[0]*2,l=0;
  ll mid,now;
  while(true){
       mid=(l+r)/2;
       now=mid;
    for(int i=0;i<N;i++){
      now=A[i]-now;
    }
    //std::cout << now << '\n';
    if(mid-now<0){
      l=mid;
    }else if(mid-now>0){
      r=mid;
    }else{
      break;
    }
  }
  for(int i=0;i<N;i++){
    std::cout << mid*2;
    if(i!=N-1) std::cout << " ";
    mid=A[i]-mid;
  }
  return 0;
}


Measured memory_bytes: 2048
fun main(args: Array<String>) {
    val S = readInputLine().toCharArray()
    
    var ans = 0
    
    var l = 0
    var r = S.size - 1
    
    while (r > l) {
        if (S[l] != S[r]) {
            ans++
        }
        l++
        r--
    }
    
    println(ans)
}

fun readInputLine(): String {
    return readLine()!!
}


Measured memory_bytes: 31776
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define pii pair<int,int>
#define pll pair<ll,ll>
#define IT iterator
#define PB push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));
#define debug puts("wzpakking")
#define y1 ysghysgsygsh
using namespace std;

int main(){
	char s[25];
	scanf("%s",s+1);
	s[4]=0;
	printf("%s\n",s+1);
} 

Measured memory_bytes: 3684
#include<bits/stdc++.h>
#include<iostream>
using namespace std;
typedef long long ll;
#define INF 1e10
ll N,X;
ll op=INF,ans;
vector<ll> b,a;
ll find(ll x)
{
	for(ll i=0;i<=x;i++)
	{
		b.push_back(i+1);
		//cout<<i<<endl;
	}
	//cout<<b.size();
	for(ll i=b.size()-1;i>=0;i--)
	{
	    //cout<<b[i]<<endl;
	    int j;
		for(j=0;j<a.size();j++)
		{
		    if(a[j]%b[i]!=0) break;
		    else continue;
		}
		if(j==a.size()) return b[i];
		else continue;
	}
}
int main()
{
	cin>>N>>X;
	for(int i=0;i<N;i++)
	{
	    ll c;
		cin>>c;
		ans=abs(X-c);
		a.push_back(ans);
		if(op>ans) op=ans;
		//cout<<ans<<endl;
	}
	if(N==1) {cout<<op<<endl;return 0;}
	cout<<find(op)<<endl;
	return 0;
}

Measured memory_bytes: 132444
#include <stdio.h>

int main (void)

{

long a,b;

while(scanf("%ld %ld", &a, &b) != EOF)

{

printf("%ld " ,a /  b);

printf("%ld ", a % b);

printf("%.5lf\n",((double)a / (double)b));

}

return 0;

}

Measured memory_bytes: 640