akhauriyash/Code-Regression huggingface dataset:
//#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>

#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define bit(n,k) (((ll)n>>(ll)k)&1) /*nのk bit目*/
#define pb push_back
#define eb emplace_back
#define SZ(x) ((ll)(x).size())
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const long long INF= 1e+18+1;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
//const ll MOD=1000000007LL;
//ll MOD=1000000007LL;
const ll MOD=998244353LL;
//const ll MOD=1777777777LL;
//const ll MAX_V=114514LL;
//const ll MAX = 500010LL;
const ll mod=MOD;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
vl dx={0,0,1,-1};
vl dy={1,-1,0,0};

//素因数分解O(√n)
map<ll,ll>prime_factor(ll n){
  map<ll,ll>res;
  for(ll i=2;i*i<=n;i++){
    while(n%i==0){
      res[i]++;
      n/=i;
    }
  }
  if(n!=1)res[n]=1;
  return res;
}

const ll MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];
//finvが階乗の逆元

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

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(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  cout << fixed << setprecision(10);
  /*--------------------------------*/
  ll n;cin>>n;
  ll s;cin>>s;
  vl a(n);
  rep(i,n)cin>>a[i];
  vvl dp(n+1,vl(s+1,0));
  ll ans=0;
  dp[0][0]=1;
  rep(i,n){
    rep(j,s+1){
      dp[i+1][j]+=2*dp[i][j];
      dp[i+1][j]%=MOD;
      if(j>=a[i]){
        dp[i+1][j]+=dp[i][j-a[i]];
        dp[i+1][j]%=MOD;
      }
    }
  }
  cout<<dp[n][s]<<endl;
}

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

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

    // i文字目までにACが含まれる個数
    int dp[N + 1];
    for (int i = 0; i <= N; i++) dp[i] = 0;

    for (int i = 1; i < N; i++) {
        char s = S[i];
        char s_before = S[i - 1];
        if (s_before == 'A' && s == 'C') {
            dp[i + 1] = dp[i] + 1;
        } else {
            dp[i + 1] = dp[i];
        }
    }

    // 結果出力
    for (int i = 0; i < Q; i++) {
        int l,r;cin>>l>>r;
        cout << dp[r] - dp[l] << endl;
    }
    
    return 0;
}

Measured memory_bytes: 1472
import sys
input = sys.stdin.readline


def main():
    N, K = map(int, input().split())
    H = list(map(int, input().split()))
    
    cnt = 0
    for h in H:
        if h>=K:
            cnt += 1
    
    print(cnt)


if __name__ == '__main__':
    main()

Measured memory_bytes: 11900
class Combi
    def initialize(max_n, mod = 10**9+7)
        @mod = mod
        @max_n = max_n

        @fac = Array.new(@max_n+1)
        @inv = Array.new(@max_n+1)
        @finv = Array.new(@max_n+1)

        @fac[0] = @fac[1] = 1
        @finv[0] = @finv[1] = 1
        @inv[1] = 1
        2.upto(@max_n) do |i|
            @fac[i] = @fac[i-1] * i % @mod
            @inv[i] = @mod - @inv[@mod%i] * (@mod/i) % @mod
            @finv[i] = @finv[i-1] * @inv[i] % @mod
        end
    end

    def nCk(n,k)
        @fac[n] * @finv[n - k] * @finv[k] % @mod
    end
end

require 'prime'
$M = 10**9+7
n,m = gets.chomp.split.map(&:to_i)
f = m.prime_division

combi = Combi.new(n+100, $M)

ans = 1
f.each do |v|
    ans *= (combi.nCk(n-1+v[1], v[1]) % $M)
end
puts ans % $M

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

int main() {
	double a, b, x;
	double k;
	cin >> a >> b >> x;
	if (x > a * a * b / 2) {
		k = atan((a*a*b-x)*2.0/a/a/a);
	}
	else {
		k = atan(a * b * b / 2 / x);
	}
	double PI = 3.141592653589793238;
	cout <<fixed<<setprecision(10)<< k * 180 / PI << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
 
int main()
{
   int S, h, m, s;
   scanf("%d", &S);
   h = S / 3600;
   S = S - h * 3600;
   m = S / 60;
   s = S % 60;
   printf("%d:%d:%d\n", h, m, s);
 
   return 0;
}

Measured memory_bytes: 592
//in the name of god
#include <bits/stdc++.h>
using namespace std;
#define ios ios::sync_with_stdio(0)
#define int long long
const int maxn=1e5+7;
const long long INF=1<<32;
int dp[maxn];
int n;
int h[maxn];

int32_t main(){
    ios;
    int n,k;
    cin>>n>>k;
    for(int i=0;i<n;i++){
        cin>>h[i];
    }
    long long s=maxn*10000000,t;
    dp[0]=0;
    dp[1]=dp[0]+abs(h[1]-h[0]);
    for(int i=2;i<n;i++){
        for(int j=max(0ll,i-k);j<i;j++){
            t=dp[j]+abs(h[j]-h[i]);
            s=min(s,t);
        }
        dp[i]=s;
        s=maxn*1000000;
    }
    cout<<dp[n-1];
}


Measured memory_bytes: 1792
a[100],v,j,k,n;p(){for(k=0;k<n;printf("%d%s",a[k++],k-n+1?" ":"\n"));}main(i){scanf("%d",&n);for(;j<n;scanf("%d",&a[j++]));p();for(;i<n;i++){v=a[i];j=i-1;for(;a[j]>v;a[j+1]=a[j--]);a[j+1]=v;p();}exit(0);}

Measured memory_bytes: 600
// Two Anagrams
#include <iostream>
#include <algorithm>
using namespace std;

int main() {
    string a, b;
    cin >> a >> b;
    int N = a.size();
    int M = b.size();
    sort(a.begin(), a.end());
    sort(b.begin(), b.end(), greater<char>());

    if (a < b) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
	long long int n;
	scanf("%lld", &n);
	
	
	long long int total=0;
	
	if(n>=1){
		total=total+1;
	}
	if(n>=2){
		total=total+2;
	}
	if (n>3){
		for (int i = 3; i<=n; i++){
			if(i%3==0|| i%5==0){
				continue;
			}
			total = total + i;
		}
	}
	printf("%lld", total);
	return 0;
}

Measured memory_bytes: 1732
// AOJ 2069: Greedy, Greedy.
// 2017.11.5 bal4u@uu

#include <stdio.h>
#include <string.h>

int c[52], n;
int greedy[10001];
int dp[10001];

int calcGreedy(int lim)
{
	int v, p, i, k;
	memset(greedy, 0, sizeof(greedy));
	for (v = lim; v >= 1; v--) {
		p = v;
		for (i = n - 1; i >= 0; i--) if (c[i] <= p) {
			k = p/c[i];
			greedy[v] += k;
			p -= c[i]*k;
		}
		if (greedy[v] != dp[v]) return 0;
	}
	return 1;
}

void calcDP(int lim)
{
	int i, j, k;
	memset(dp, 0, sizeof(dp));
	for (i = 0; i < n; i++) for (j = 0; (k = j + c[i]) <= lim; j++) {
		if (!dp[k] || dp[k] > dp[j] + 1) dp[k] = dp[j] + 1;
	}
}

int main()
{
	int cno = 0, i, lim;

	while (scanf("%d", &n) && n > 0) {
		printf("Case #%d: ", ++cno);
		for (i = 0; i < n; i++) scanf("%d", c+i);
		if (c[0] != 1) { puts("Cannot pay some amount"); continue; }
		if (n == 1) lim = c[0];
		else lim = c[n-1] + c[n-2];
		calcDP(lim);
		if (calcGreedy(lim)) puts("OK");
		else puts("Cannot use greedy algorithm");
	}
	return 0;
}

Measured memory_bytes: 1764
#include <functional>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MAX = 2500LL;
typedef pair <ll, ll> P;

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

    ll n, m, s;
    cin >> n >> m >> s;
    s = min(s, MAX - 1);

    vector<vector<P>> edge(n * MAX);
    for (int i = 0; i < m; i++) {
        ll u, v, a, b;
        cin >> u >> v >> a >> b;
        u--; v--;
        for (int j = a; j < MAX; j++) {
            edge[u * MAX + j].push_back({v * MAX + j - a, b});
            edge[v * MAX + j].push_back({u * MAX + j - a, b});
        }
    }

    for (int i = 0; i < n; i++) {
        ll c, d;
        cin >> c >> d;
        for (int j = 0; j < MAX; j++) {
            edge[i * MAX + j].push_back({i * MAX + min(j + c, MAX - 1), d});
        }
    }

    vector <ll> ans(n * MAX, 1LL << 60);
    priority_queue <P, vector<P>, greater<P>> q;
    ans[s] = 0;
    q.push({0, s});

    while (!q.empty()) {
        P p = q.top();
        q.pop();
        ll time = p.first;
        int cur = p.second;
        if (ans[cur] < time) continue;
        for (P nxt : edge[cur]) {
            int next_node = nxt.first;
            ll total_time = time + nxt.second;
            if (ans[next_node] > total_time) {
                ans[next_node] = total_time;
                q.push({total_time, next_node});
            }
        }
    }

    for (int i = 1; i < n; i++) {
        ll mn = 1LL << 60;
        for (int j = 0; j < MAX; j++) mn = min(mn, ans[i * MAX + j]);
        cout << mn << '\n';
    }
    return 0;
}

Measured memory_bytes: 23860
#include<bits/stdc++.h> 
using namespace std;
typedef long long ll;
template<typename T1,typename T2> bool chmin(T1 &a,T2 b){if(a<=b)return 0; a=b; return 1;}
template<typename T1,typename T2> bool chmax(T1 &a,T2 b){if(a>=b)return 0; a=b; return 1;}


class Dijkstra {
public:
    struct edge { ll v, dist; };

    struct state {
        ll v, cost;
        bool operator>(const state s) const { return cost > s.cost; }
    };

    const ll INF = (1LL << 60);
    ll N;
    ll MOD = 1e9+7;
    vector< vector<edge> > E;

    Dijkstra(ll n): N(n), E(n) {}

    //有効グラフの時はこっち。u→vに距離dで結ぶ
    void add_directed_edge(ll u, ll v, ll d) {
        E[u].push_back((edge) { v, d });
    }

    //無向グラフの時はこっち。uとvを双方向に距離dで結ぶ
    void add_undirected_edge(ll u, ll v, ll d) {
        E[u].push_back((edge) { v, d });
        E[v].push_back((edge) { u, d });
    }

    //Sを始点として、他の頂点への最短経路を探す
    vector<long long> shortest_path(long long S) {
        vector<long long> dp(E.size(), INF);
        priority_queue<state, vector<state>, greater<state> > q;
        q.push((state) { S, 0 });
        while(!q.empty()) {
            long long v = q.top().v, cost = q.top().cost;
            q.pop();
            if(dp[v] <= cost) continue;
            dp[v] = cost;
            for(int i=0;i < E[v].size() ; i++) {
            long long nv = E[v][i].v, ncost = cost + E[v][i].dist;
            if(dp[nv] > ncost) q.push((state) { nv, ncost });
            }
        }
        return dp;
    }
};

Dijkstra dij(200020);

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);
 
    ll n,m,s;
    cin>>n>>m>>s;
    for(int i=0;i<m;i++){
        ll a,b,c,d;
        cin>>a>>b>>c>>d;
        a--,b--;
        // coin*n + a -> (coin - c)*n + b
        for(int coin=2500;coin>=0;coin--){
            if(coin - c < 0) break;
            dij.add_directed_edge(coin*n+a, (coin-c)*n+b, d);
            dij.add_directed_edge(coin*n+b, (coin-c)*n+a, d);
        }
    }
    for(int i=0;i<n;i++){
        ll c,d;
        cin>>c>>d;
        for(int coin=0;coin<2500;coin++){
            dij.add_directed_edge(coin*n+i, min(2500LL,coin+c)*n+i,d);
        }
    }
    vector<ll> v = dij.shortest_path(min(2500LL,s)*n);
    for(int i=1;i<n;i++){
        ll ret = 1e18;
        for(int coin=0;coin<=2500;coin++){
            chmin(ret,v[coin*n+i]);
        }
        cout << ret<<"\n";
    }
    // if(s >= 50 * n){
    //     int dp[n][n] = {};
    //     for(int i=0;i<n;i++)for(int j=0;j<n;j++){
    //         if(i!=j) dp[i][j] = 1e9;
    //     }
    //     for(int i=0;i<n;i++){
    //         for(auto a:v[i]){
    //             dp[i][a[0]] = a[2];
    //         }
    //     }
    //     for(int k=0;k<n;k++)for(int i=0;i<n;i++)for(int j=0;j<n;j++){
    //         dp[i][j]=min(dp[i][j],dp[i][k]+dp[k][j]);
    //     }
    //     for(int i=1;i<n;i++){
    //         cout << dp[0][i] << "\n";
    //     }
    //     return 0;
    // }

    
}

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

int main(){
  
  int n,m;
  cin>>n>>m;
  int s[m],c[m];
  for(int i=0;i<m;i++)cin>>s[i]>>c[i];
  bool exi=1;
  int ans=-1;
  
  bool flg=1;
  for(int i=0;i<m-1;i++){
  	for(int j=0;j<m;j++){
      if(s[i]==s[j]&&c[i]!=c[j]) flg=0;
    }
  }
  if(flg){
  if(n==1){
    
  	for(int i=0;i<10;i++){
      exi=1;
    	for(int j=0;j<m;j++){
        	if(i!=c[j]) exi=0;
        }
      if(exi){
        ans=i;
        break;
      }
    }
    
  }
  else if(n==2){
  	for(int i=10;i<100;i++){
      exi=1;
    	for(int j=0;j<m;j++){
        	if(s[j]==1){ if(i/10!=c[j]) exi=0;}
           else{ if(i%10!=c[j]) exi=0;}
        }
      if(exi){
        ans=i;
        break;
      }
    }
  }

  else{
  	for(int i=100;i<1000;i++){
      exi=1;
    	for(int j=0;j<m;j++){
        	if(s[j]==1){ if(i/100!=c[j]) exi=0;}
           else if(s[j]==3){ if(i%10!=c[j]) exi=0;}
           else {if((i/10)%10!=c[j]) exi=0;}
        }
      
      if(exi){
        ans=i;
        break;
      }
      
    }
  }
    
  }
  cout<< ans<<endl;
  
}

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++)
    cin >> a[i];
  sort(a.begin(), a.end());
  cout << a.back() - a[0] << '\n';   
  return 0;
}

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

#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define for1(i, n) for (int i = 1; i <= int(n); ++i)
#define fore(i, l, r) for (int i = int(l); i <= int(r); ++i)
#define ford(i, n) for (int i = int(n)-1; i >= 0; --i)
#define pb push_back
#define eb emplace_back
#define ms(a, x) memset(a, x, sizeof(a))
#define F first
#define S second
#define endl '\n'
#define de(x) cout<<#x<<" = "<<(x)<<endl
#define de2(x,y) cout<<#x<<" = "<<(x) <<' '<< #y<<" = "<<y<<endl;

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
const int INF = 0x3f3f3f3f;
mt19937 gen(chrono::high_resolution_clock::now().time_since_epoch().count());

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
	string s,t,u;
	int a,b;
	cin>>s>>t>>a>>b>>u;
	if(u==s) a--;
	else b--;
	cout<<a<<' '<<b;
    return 0;
}



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

int main() {
    int n, size1,size2;
    string ans;
    vector<int> vt;
    cin >> n;
    rep(i,n) {
        int m;
        cin >> m;
        vt.push_back(m);
    }
    size1 = vt.size();
    sort(vt.begin(), vt.end());
    vt.erase(unique(vt.begin(), vt.end()), vt.end());
    size2 = vt.size();
    if(size1 == size2) ans = "YES";
    else ans = "NO";
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1400
a = [1, 3, 5, 7, 8, 10, 12]
b = [4, 6, 9, 11]
c = [2]
x, y = map(int, input().split())

if x in a and y in a:
    print("Yes")
elif x in b and y in b:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
import java.util.*;

public class Main {
	public static void main(String[] arg){
		Scanner in = new Scanner(System.in);
		int i = 1;
		while(in.hasNext()) {
            String buf = in.nextLine();
            if(Integer.parseInt(buf) == 0){
            	break;
			}
            System.out.println("Case "+ i +": "+ buf);
            i++;
        }
	}
}

Measured memory_bytes: 65392
h,w,k = map(int,input().split())
c = []
for i in range(h):
    c.append(list(input()))

import itertools 
hd = list(itertools.product(range(2), repeat = h))
wd = list(itertools.product(range(2), repeat = w))

ans = 0
for hdata in hd:
    for wdata in wd:
        buf = 0
        for i in range(h):
            for j in range(w):
                if hdata[i]==0 and wdata[j]==0 and c[i][j]=='#':
                    buf += 1
        if buf==k:
            ans += 1
print(ans)


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

using namespace std;

char s[100100] = "CODEFESTIVAL2016", t[20];

int main ()
{
//    freopen ("in", "r", stdin);
    int n, a, b;
    cin >> n >> a >> b;
    scanf ("%s", s + 1);
    int c1 = 0, c2 = 0;
    for (int i = 1; i <= n; i++) {
        if (s[i] == 'a') {
            if (c1 < a + b) {
                c1++;
                printf ("Yes\n");
            } else {
                printf ("No\n");
            }
        }
        if (s[i] == 'b') {
            if (c1 < a + b && c2 < b) {
                c2++;
                c1++;
                printf ("Yes\n");
            } else {
                printf ("No\n");
            }
        }
        if (s[i] == 'c') printf ("No\n");
    }
}


Measured memory_bytes: 768
h, w = map(int, input().split())
n = int(input())
A = list(map(int, input().split()))

ans = [[0]*w for i in range(h)]

now = 0
for color, count in enumerate(A, 1):
    for idx in range(now, now+count):
        y = idx // w
        x = idx % w
        if y % 2 == 1:
            x = -x-1
        ans[y][x] = color

    now += count

for line in ans:
    print(*line)

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

using lint = long long;

void solve() {
    int n;
    std::cin >> n;

    lint sum = 0;
    for (lint i = 1; i <= n; ++i) {
        sum += i * (n - i + 1);
    }

    for (int i = 0; i < n - 1; ++i) {
        lint l, r;
        std::cin >> l >> r;
        if (l > r) std::swap(l, r);
        sum -= l * (n - r + 1);
    }

    std::cout << sum << "\n";
}

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

    solve();

    return 0;
}


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

void cal(int a, int b){

  double f = (double)a/(double)b;
  printf("%d %d %.5f\n", a/b, a%b, f);

}

int main(){
  int a, b;

  cin >> a >> b;
  cal(a,b);
}

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

const int INF = (1 << 28);

int countDigitsSum(int n) {
    string sn = to_string(n);
    return accumulate(sn.begin(), sn.end(), 0,
                      [](int x, char y) { return x + (y - '0'); });
}

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

    int ans = INF;
    for (int A = 1; A < N; A++) {
        int B = N - A;

        ans = min(ans, countDigitsSum(A) + countDigitsSum(B));
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
// abc162_b
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF ((1 << 29)-1)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
#define print_line(vec, n) {for(int i=0;i<(n-1);i++) cout << (vec)[i] << " "; cout << (vec)[(n)-1] << endl;}
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

    int N;
    cin >> N;

    ll ans = 0;
    REPN(i, 1, N+1){
        if (i % 3 != 0 && i % 5 != 0){
            ans += i;
        }
    }

    print(ans);

    return 0;
}


Measured memory_bytes: 3648
#include "bits/stdc++.h"

using namespace std;
typedef long long ll;
#define out(ans) cout << ans << endl;
const long long mod = 1e9 + 7;

int main(int argc, char const *argv[]) {
  int n, h, hr, tmp = 0, res = 0;
  cin >> n;
  cin >> h;
  for (int i = 1; i < n; i++) {
    cin >> hr;
    if (h >= hr) {
      tmp++;
    } else {
      res = max(res, tmp);
      tmp = 0;
    }
    h = hr;
  }
  res = max(res, tmp);
  cout << res;

  return 0;
}


Measured memory_bytes: 764
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>

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

typedef int long long ll;
using namespace std;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const ll MOD = 1e9 + 7;

int main() {

string s;
cin>>s;
stack<char> ss;
ss.push(s[0]);
for(int i=1;i<s.size();i++){
    if(s[i]!=ss.top()){
        ss.push(s[i]);
    }
}
cout<<ss.size()-1<<endl;



    return 0;
}


Measured memory_bytes: 512
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
}

func readInt() int {
	sc.Scan()
	r, _ := strconv.Atoi(sc.Text())
	return r
}

func main() {
	a, b, m := readInt(), readInt(), readInt()
	mina, minb, min, sum := 100000, 100000, 0, 0
	arra := make([]int, a)
	for i := 0; i < a; i++ {
		arra[i] = readInt()
		if arra[i] < mina {
			mina = arra[i]
		}
	}
	arrb := make([]int, b)
	for i := 0; i < b; i++ {
		arrb[i] = readInt()
		if arrb[i] < minb {
			minb = arrb[i]
		}
	}
	min = mina + minb

	for i := 0; i < m; i++ {
		x, y, c := readInt(), readInt(), readInt()
		sum = arra[x-1] + arrb[y-1] - c
		if sum < min {
			min = sum
		}
	}
	fmt.Println(min)
}

Measured memory_bytes: 4992
#include<stdio.h>
int n,B[200010]={0};
void badd(int i,int a){for(;i<=n;i+=i&-i)B[i]+=a;}
int  bsum(int i){
  int s=0;
  for(;i;i-=i&-i)s+=B[i];
  return s;
}
int L(int l,int r){//printf("L:%d %d\n",l,r);
  if(l==r)return l;
  int m=(l+r)/2;//printf("::m%d r%d m%d\n",m,bsum(r),bsum(m));
  if(bsum(r)-bsum(m)==0)return L(l,m);
  return L(m+1,r);
}
int R(int l,int r){//printf("R:%d %d\n",l,r);
  if(l+1==r)return l+1;
  int m=(l+r)/2;//printf("::m%d l%d m%d\n",m,bsum(l),bsum(m));
  if(bsum(m)==bsum(l))return R(m,r);
  return R(l,m);
}
int main(){
  int i,a,d[200010];
  long long s=0,r,l;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&a);
    d[a-1]=i+2;
  }
  n+=2;
  badd(1,1);
  badd(n,1);
  //for(i=0;i<n;i++)printf("%d ",d[i]);printf("\n");
  //for(i=1;i<=n;i++)printf("%d ",bsum(i));printf("\n");
  for(i=0;i<n-2;i++){
    l=d[i]-L(1,d[i]-1);
    r=R(d[i],n)-d[i];//printf("%d %lld %d %lld\n",i+1,l,d[i],r);
    s+=l*r*(i+1);
    badd(d[i],1);
    //for(a=0;a<n;a++)printf("%d ",bsum(a+1));printf("\n");
    //printf("s%lld\n",s);
  }
  printf("%lld\n",s);
  return 0;
}
  


Measured memory_bytes: 1664
#pragma GCC optimize (2)
#include<bits/stdc++.h>
using namespace std;

inline int read()
{
    int x=0,f=1;char ch=getchar();
    for (;ch<'0'||ch>'9';ch=getchar()) if (ch=='-') f=-1;
    for (;ch>='0'&&ch<='9';ch=getchar()) x=(x<<1)+(x<<3)+ch-'0';
    return x*f;
}

int main()
{
	int n=read();
	printf("%d\n", n*(n-1)/2-n/2);
	for (int i=1; i<=n; i++)
		for (int j=i+1; j<=n; j++) 
			if (i+j^(n+(n%2==0))) printf("%d %d\n", i, j);
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
typedef long long ll;
typedef double dd;
#define pb push_back
#define mp make_pair
#define endl "\n"
ll const M = 1000000007;
dd const pi = acos(-1);
ll const inf = 2e18;
ll const N = 200001;
int main()
{
    fast;
   /* #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif*/
    ll i,j,t,k;
    cin >> i >> j >> t >> k;
    if(k <= i)
        cout<<k<<endl;
    else if(k <= (i + j))
        cout<<i<<endl;
    else
        cout<<i - (k - (i + j))<<endl;
    return 0;
}        

Measured memory_bytes: 3636
#include<iostream>
    #include<math.h>
    #include<iomanip>
    #include<vector>
    using namespace std;
    #define PI 3.14159265358979

    int main(void)
    {

    int N;
    int a;
    string s; 
    cin>>s;
    bool f=true;
    for(int i=0;i<s.size();i+=2)
    {
        if(s[i]=='L') f =false;
    }

        for(int i=1;i<s.size();i+=2)
    {
        if(s[i]=='R') f =false;
    }

    if(f==true) cout<<"Yes"<<endl;

    else cout<<"No"<<endl;

    }





Measured memory_bytes: 256
main :: IO ()
main = do
  [n,a,b] <- map read . words <$> getLine  :: IO [Int]
  let xs = filter (\x -> let d = digs x in d>=a && d<=b) [1..n] 
  print $ sum xs

digs :: Int -> Int
digs = sum . map (read . return) . show

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

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

    int res=0;
    for (int i=1; i<N; i++){
        int cnt=0;
        for (char c='a'; c<='z'; c++) {
            bool left=false, right=false;

            for (int j=0; j<i; j++) {
                if (s[j] == c) left=true;
            }

            for (int j=i; j<N; j++) {
                if (s[j] == c) right=true;
            }
            
            if (left && right) cnt++;
        }
        res = max(res, cnt);
    }
    cout << res << endl;


}


Measured memory_bytes: 256
#include<bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

#define ll long long
//#define bint int1024_t
#define ld long double
#define vect vector<ll>
#define unmap unordered_map
#define pb push_back
#define F first
#define pll pair<ll,ll>
#define S second
#define pi 3.1415926536
#define mod int(998244353)
//ios_base::sync_with_stdio(false);cin.tie(NULL);
#define testcases ll t; cin>>t; while(t--)

using namespace std;
//using namespace boost::multiprecision;
//using namespace __gnu_pbds;

ll n,m,k;
ll fact[200001];

ll power (ll a,ll b)   // a^b % mod
{
    ll ans=1;
    a%=mod;
    while(b)
    {
        if(b&1)ans=(ans*a)%mod;
        a=(a*a)%mod;
        b=b/2;
    }
    return ans;
}

ll Inv(ll n)
{
 return power(n,mod-2);
}

ll nCr(ll n,ll k)
{
    return ((((fact[n])*(Inv(fact[k])))%mod)*(Inv(fact[n-k])))%mod;
}

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

    fact[0]=1;
    for(ll i=1;i<=200000;i++) fact[i]=(i*fact[i-1])%mod;

    cin>>n>>m>>k;

    ll ans=0;
    for(ll i=0;i<=k;i++)
    {
        ans+=(((m*power(m-1,n-i-1))%mod)*nCr(n-1,i))%mod;
        ans%=mod;
    }
    cout<<ans;

    return 0;
}


Measured memory_bytes: 5256
import java.util.*;

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 x = sc.nextInt();
        x /= 50;
        int ans = 0;
        for (int i=0; i<=a; i++) {
            for (int j=0; j <= b; j++) {
                for (int k=0; k <= c; k++) {
                    if (10*i + 2*j + k == x) {
                        ans ++;
                    }  
                }
            }
        }
        System.out.println(ans);
        sc.close();
    }
}

Measured memory_bytes: 35604
import java.util.*;

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

		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		String str = String.valueOf(n);

		int total = 0;
		for (int i = 0; i < str.length(); i++) {
			total += Integer.valueOf(str.substring(i, i+1));
		}
		
		String ans = "No";
		if (0 == n%total) {
			ans = "Yes";
		}
		System.out.println(ans);

		sc.close();
	}
}

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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef long long ll;

int main() {
    ll A, B, C, X, Y;
    cin >> A >> B >> C >> X >> Y;

    ll ans = A * X + B * Y;

    ll tmp = C * 2 * X;
    chmin(ans, tmp + C * 2 * max(0LL, Y - X));
    chmin(ans, tmp + B * max(0LL, Y - X));

    tmp = C * 2 * Y;
    chmin(ans, tmp + C * 2 * max(0LL, X - Y));
    chmin(ans, tmp + A * max(0LL, X - Y));

    cout << ans << endl;
}


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

int main()
{
  int n;
  cin >> n;
  vector<int> a(n), b(n);
  for (int i = 0; i < n; i++) {
    int t;
    cin >> t;
    a[i] = t;
    b[i] = t;
  }
  sort(begin(b), end(b), greater<>());
  for (const auto& e : a) {
    cout << (e == b[0] ? b[1] : b[0]) << endl;
  }
}


Measured memory_bytes: 3200
N=gets.to_i
M=10**9+7
s=0
*F=I=[r=1,1]
*R=I
2.upto(N){|i|I<<z=M/i*-I[M%i]%M;F<<r=r*i%M;R<<z*R[-1]%M;i<-~N/2||i>=N||s+=F[-2]*r*R[2*i-N]%M}
p N>2?(r-s)%M: 1
###############################################
###############################################
###############################################
###############################################
###############################################

Measured memory_bytes: 27184
N = int(input())
n = []
cnt = 0
p = [int(x) for x in input().split()]
for i in range(1,N+1):
  n.append(i)
for i in range(N):
  if p[i] != n[i]:
    cnt += 1
if cnt <= 2:
  print("YES")
else:
  print("NO")

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
const int mx = 200005;
int n, s, t, ed, dg[mx], d;
bool used[mx];
vector<int> a[mx];
queue<int> st;
int main(){
    scanf("%d", &n);
    for(int i = 1; i < n; i++){
        scanf("%d%d", &s, &t);
        a[s].push_back(t);
        a[t].push_back(s);
    }
    
    st.push(1);
    used[1] = true;
    while(!st.empty()){
        int it = st.front(); st.pop();
        for(auto i:a[it]){
            if(used[i]) continue;
            used[i] = true;
            st.push(i);
        }
        ed = it;
    }
    dg[ed] = 1;
    st.push(ed);
    while(!st.empty()){
        int it = st.front(); st.pop();
        for(auto i:a[it]){
            if(dg[i]) continue;
            dg[i] = dg[it] + 1;
            st.push(i);
        }
        d = max(d, dg[it]);
    }
    puts(d % 3 == 2 ? "Second" : "First");
}

Measured memory_bytes: 13812
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define DEBUG
#ifdef DEBUG
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
	template <typename Arg1>
	void __f(const char* name, Arg1&& arg1){
		cerr << name << " : " << arg1 << std::endl;
	}
	template <typename Arg1, typename... Args>
	void __f(const char* names, Arg1&& arg1, Args&&... args){
		const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
	}
#else
#define debug(...)
#endif
#define FOR(i,a,b) 	for(int i=a;i<b;++i)
#define RFOR(i,a,b) 	for(int i=a;i>=b;--i)
#define ln 		"\n"
#define mp make_pair
#define pb push_back
#define sz(a)	ll(a.size())
#define F first
#define S second
#define all(c)	c.begin(),c.end()
#define rall(c) c.rbegin(), c.rend()
#define trace(c,x) for(auto &x:c)
#define pii pair<ll,ll>
#define init(a, x) memset(a,x,sizeof(a))
typedef long long ll;
typedef long double ld;
typedef	priority_queue<pii,std::vector<pii>,greater<pii> > revpr;

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> pbds;
// ordered_set X
//K-th smallest
//*X.find_by_order(k-1)
//NO OF ELEMENTS < A
//X.order_of_key(A)
const int L=1e6+7;
ll a[L];
void fff()
{
	ll n;
	cin >> n;
	multiset<pii>SET;
	FOR(i,0,n)
	{
		cin >> a[i];
	}	
	sort(a,a+n);
	ll ans = 0;
	pii cur;
	SET.insert({a[n-1],a[n-1]});
	RFOR(i,n-2,0)
	{
		cur = *SET.rbegin();
		SET.erase(SET.find(cur));
		ans += cur.F;
		// debug(cur.F,cur.S);
		SET.insert({a[i],cur.F});
		SET.insert({a[i],cur.S});
	}
	cout << ans<<ln;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	//int t;cin >> t;while(t--)
	fff();
	return 0;
}

Measured memory_bytes: 17716
#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <limits.h>
#include <math.h>
#include <functional>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <float.h>
#include <random>

#define repeat(i,n) for (int i = 0; (i) < (n); ++ (i))
#define debug(x) cerr << #x << ": " << x << '\n'
#define debugArray(x,n) for(long long hoge = 0; (hoge) < (n); ++ (hoge)) cerr << #x << "[" << hoge << "]: " << x[hoge] << '\n'
#define debugArrayP(x,n) for(long long hoge = 0; (hoge) < (n); ++ (hoge)) cerr << #x << "[" << hoge << "]: " << x[hoge].first<< " " << x[hoge].second << '\n'

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef vector<int> vint;
typedef vector<ll> vll;
const ll INF = LLONG_MAX/10;
const ll MOD = 1e9+7;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N,K;cin>>N>>K;
  string S;cin>>S;
  S[K-1] += 'a'-'A';
  cout<<S<<endl;
  return 0;
}


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


int main(){
	int a, b;

	while(std::cin >> a >> b){
		//end
		if(a == 0 && b == 0)break;

		int obstacleNum;
		std::cin >> obstacleNum;

		std::vector<std::vector<int>> obstacle(a+1, std::vector<int>(b+1, 0));
		std::vector<std::vector<int>> road(a+1, std::vector<int>(b+1, 0));

		//obstacle input
		int tmp_a,tmp_b;
		for(int i = 0; i < obstacleNum; ++i) {
			std::cin >> tmp_a >> tmp_b;
			obstacle[tmp_a][tmp_b] = 1;
		}

		for (int i = 1; i <= a; ++i){
			for (int j = 1; j <= b; ++j){
				if(i == 1 && j == 1)road[i][j] = 1;
				else if(obstacle[i][j] == 1) road[i][j] = 0;
				else road[i][j] = road[i-1][j] + road[i][j-1];
			}
		}
		//output
		std::cout << road[a][b] << std::endl;

	}
	return 0;
}

Measured memory_bytes: 1220
directions = [(1, 0), (0, 1), (-1, 0), (0, -1)]


def main():
    H, W = map(int, input().split())
    s = [input() for _ in range(H)]
    path = [[float("inf")] * W for _ in range(H)]
    white = sum([len(row.replace("#", "")) for row in s])
    scan = [(0, 0, 1)]  # i, j, cost
    while len(scan):
        i, j, cost = scan.pop(0)
        if cost >= path[i][j]:
            continue
        path[i][j] = cost
        for d in directions:
            nexti = i + d[0]
            nextj = j + d[1]
            if 0 <= nexti and nexti < H and \
               0 <= nextj and nextj < W and \
               s[nexti][nextj] == ".":
                scan.append((nexti, nextj, cost + 1))
    if path[H-1][W-1] == float("inf"):
        print(-1)
    else:
        print(white - path[H-1][W-1])


if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
#include <stdio.h>


int main(void){

  int N, i, j , count = 0;
  scanf("%d", &N);
  int a[N], res[N];
  for(i=1 ; i<=N ; i++)
    scanf("%d", &a[i]);

  int sum = 0;
  for(i=N ; i>0 ; i--){
    sum = 0;
    if(a[i] == 1){
      for(j=i+i ; j<=N ; j += i)
	sum += res[j];

      if(sum % 2 == 0){
	res[i] = 1;
	count++;
      }
      else
	res[i] = 0;
    }
    else{
      for(j=i+i ; j<=N ; j += i)
	sum += res[j];
      
      if(sum % 2 == 0)
        res[i] = 0;
      else{
        res[i] = 1;
	count++;
      }
    }
  }
  
  printf("%d\n", count);
  for(i=1 ; i<=N ; i++){
    if(res[i] == 1)
      printf("%d ", i);
  }
  printf("\n");

  return 0;
}


Measured memory_bytes: 2432
#include<stdio.h>

int main(){
  int i,j,f,N,b,s,count;
  f=1;
  scanf("%d",&N);
  int A[N];
  for(i=0;i<=N-1;i++){
    scanf("%d",&A[i]);
  }
  count=0;
  i=0;
  while(f){
    f=0;
    for(j=N-1;j>=i+1;j--){
      if(A[j]<A[j-1]){
	b=A[j];
	A[j]=A[j-1];
	A[j-1]=b;
	f=1;
	count++;
      }
    }
    i++;
  }
  for(s=0;s<=N-1;s++){
    if(s<N-1)
      printf("%d ",A[s]);
    else printf("%d\n",A[s]);
  }
  printf("%d\n",count);
	 
  return 0;
}
  
  



Measured memory_bytes: 2140
import java.util.*;

public class Main{
    public static void main(String[] args){
	Scanner a = new Scanner(System.in);
	int x = a.nextInt();
	int y = a.nextInt();
	int n = x;
	if(x < y){
	    x = y;
	    y = n;
	}
	while(y != 0){
	    n = y;
	    y = x%y;
	    x = n;;
	}
	System.out.println(x);
    }
}



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

#define EPS (1e-10)
#define equals(a, b) (fabs((a) - (b)) < EPS)
#define pb push_back
#define rep(i, n) for(int i = 0; i < (n); i++)
#define INF (1 << 29)

using namespace std;

/*class Point{
	public:
		double x, y;

		Point(double x = 0, double y = 0): x(x), y(y) {}

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

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

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

		bool operator == (const Point &p) const{
			return fabs(x - p.x) < EPS && fabs(y - p.y) < EPS;
		}
};

class Segment{
	public:
		Point p1, p2;
		Segment(Point p1 = Point(), Point p2 = Point()): 
			p1(p1), p2(p2) {}
};

class Circle{
	public:
		Point c;
		double r;
		Circle(Point c = Point(), double r = 0.0): c(c) , r(r) {}
};

typedef Segment Line;
typedef vector<Point> Polygon;
typedef Point Vector;

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

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

int main(){
	int R; cin >> R;
	cout << 2 * M_PI * R << endl; 

	return 0;
}


Measured memory_bytes: 3752
import java.util.Arrays;
import java.util.Scanner;

class Solver {
    public void Solve() {
        int n = sc.nextInt();
        int m = sc.nextInt();
        int a[] = new int[n];
        long wa = 0;
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
            wa += a[i];
        }
        Arrays.sort(a);
        double dd = wa * 1.0 / (4.0 * m);
        int cnt = 0;
        for (int i = 0; i < n; i++) {
            if (a[i] >= dd) {
                cnt++;
            } else {

            }
        }
        if (cnt >= m) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }

    }

    Scanner sc;

    Solver(Scanner in) {
        this.sc = in;
    }
}

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Solver s = new Solver(sc);
        s.Solve();
        sc.close();
    }
}


Measured memory_bytes: 23508
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=1000000007,MAX=300005;
const ll INF=1LL<<60;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll N;cin>>N;
    
    if(N<=100){
        cout<<2*N<<endl;
        for(int i=0;i<N;i++) cout<<N-i<<" ";
        for(int i=0;i<N;i++) cout<<i+1<<" ";
        cout<<endl;
        return 0;
    }
    
    ll rem=N-100;
    
    vector<int> ans(200);
    for(int i=0;i<100;i++) ans[i]=100-i;
    for(int i=100;i<200;i++) ans[i]=i-100+1;
    
    ll last=99;
    for(int d=0;d<40;d++){
        ll move=min(last,rem);
        if((move&1)!=(rem&1)) move--;
        
        for(int i=0;i<100;i++){
            if(ans[i]==d+1){
                ans.erase(ans.begin()+i);
                ans.insert(ans.begin()+i-move,d+1);
                break;
            }
        }
        
        last=move-1;
        rem-=move;
        rem/=2;
        
        if(rem==0) break;
    }
    cout<<200<<endl;
    for(int i=0;i<200;i++){
        cout<<ans[i]<<" ";
    }
    cout<<endl;
    
}



Measured memory_bytes: 256
#include "math.h"
#include <iostream>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <vector>
#include <functional>
#include <numeric>
#include <cmath>
using namespace std;

int t;
const int N = 10001;
int arr[N];

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	for (int i = 0; i < N; i++)
	{
		arr[i] = 0;
	}
	for (int x = 1; x <= 100; x++)
	{

		for (int y = x; y <= int(sqrt(10001-x*x)); y++)
		{
			for (int z = y; z <= int(sqrt(10001 - x * x-y*y)); z++)
			{
				long long s = x * x + y * y + z * z + x * y + x * z + y * z;
				int k = 6;
				if (x == y && x == z)
				{
					k = 1;
				}
				else if (x == y) {
					k = 3;
				}
				else if (x == z) {
					k = 3;
				}
				else if (y == z) {
					k = 3;
				}
				if (s < N) arr[s - 1] += k;
			}

		}
	}
	cin >> t;
	for (int i = 0; i < t; i++)
	{
		cout << arr[i] << endl;
	}
	return 0;
}


Measured memory_bytes: 3708
#include <iostream>
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ll long long
using namespace std;
int main() {
fastio;
    int a,b,c;
    cin>>a>>b>>c;
    int ans=(a/b)*c;
    ans+=(a%b!=0?c:0);
    cout<<ans;
return 0;
}

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

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var A = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var count = A.Count(z => z % 2 == 1);
            Console.WriteLine(count % 2 == 0 ? "YES" : "NO");
        }
    }
}


Measured memory_bytes: 21728
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class Main {

	/**
	 * @param args
	 * @throws IOException 
	 * @throws NumberFormatException 
	 */
	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
		int n = Integer.parseInt(br.readLine());
		int k = Integer.parseInt(br.readLine());
		
		int distSum = 0;
		String[] tmpArray = br.readLine().split(" ");
		for(int i = 0; i < n; i++){
			int ballPos = Integer.parseInt(tmpArray[i]);
			
			distSum += Math.min(ballPos, k-ballPos)*2;
		}
		
		System.out.println(distSum);
	}

}


Measured memory_bytes: 24916
#pragma optimization_level 3
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#include<bits/stdc++.h>
#define F first
#define S second
#define vec vector
#define ms multiset
#define pb push_back
#define pll pair<ll,ll>
#define pdd pair<ld, ld>
#define pq priority_queue
#define umap unordered_map
#define uset unordered_set
#define pii pair<int, int>
#define pnn pair<Node*, Node*>
#define uid uniform_int_distribution
#define FILE ifstream in("input.txt");ofstream out("output.txt");
#define fast cin.tie(0);cout.tie(0);cin.sync_with_stdio(0);cout.sync_with_stdio(0);
using namespace std;
typedef string str;
typedef long long ll;
typedef long double ld;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); //uid<int> u1(5, 10); u1(rnd);

struct Node{
    Node *l=0, *r=0;
    pll p;

    Node(Node *a, Node *b){
        l = a; r = b;
        p = min(a->p, b->p);
    }

    Node(Node *a, Node *b, pll c){
        l = a; r  =b;
        p = c;
    }
};

void upd(Node *n){
    if(!n->l) return;
    n->p = min(n->l->p, n->r->p);
}

Node* build(int l, int r, vec<ll> &m){
    if(l==r) return new Node(0,0,{m[l-1], l-1});
    int md = (l+r)/2;
    return new Node(build(l,md,m), build(md+1,r,m));
}

pll gm(int l, int r, int l1, int r1, Node *n){
    if(l==l1 && r==r1) return n->p;
    int md = (l1+r1)/2;
    if(r<=md) return gm(l,r,l1,md,n->l);
    if(l>md) return gm(l,r,md+1,r1,n->r);
    return min(gm(l,md,l1,md,n->l), gm(md+1,r,md+1,r1,n->r));
}

void cng(int l, int r, int p, Node *n, int v){
    if(l==r){
        n->p = {v, n->p.S};
        return;
    }
    int md = (l+r)/2;
    if(p<=md) cng(l,md,p,n->l,v);
    else cng(md+1,r,p,n->r,v);
    upd(n);
}

int main(){
    fast;
    ll a,k; cin>>a>>k;
    deque<pll> m(a), store;
    vec<ll> mx(k);
    ll o = 0;
    for(int q=0; q<a; q++) cin>>m[q].F>>m[q].S;
    sort(m.begin(), m.end(), [](pll p1, pll p2){return p1.F!=p2.F ? p1.F>p2.F : p1.S>p2.S;});
    for(; m.size() && m[0].F>k;) m.pop_front();
    a = m.size();
    for(int q=0; q<a; q++){
        if(mx[m[q].F-1]>0){
            store.pb(m[q]);
            continue;
        }
        mx[m[q].F-1] = m[q].S;
    }
    //for(int q=0; q<k; q++) cout<<mx[q]<<" "; cout<<endl;
    //sort(store.begin(), store.end(), [](pll p1, pll p2){return p1.S>p2.S;});
    Node *n = build(1,k,mx);
    for(pll p : store){
        pll u = gm(p.F-1,k-1,0,k-1,n);
        mx[u.S] = max(mx[u.S], p.S);
        cng(0,k-1,u.S,n,mx[u.S]);
    }
    for(ll i : mx) o+=i;
    cout<<o;
}

Measured memory_bytes: 13696
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>
#include<string>
#include <map>
#include <queue>
#include <stack>
#include <set>

#define DIV 1000000007
using namespace std;
using ll = long long;

int main() {
    map<string, int> m;
    string s;

    int N;
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> s;
        m[s]++;
    }

    int M;
    cin >> M;
    for (int i = 0; i < M; i++) {
        cin >> s;
        m[s]--;
    }

    int ans = 0;
    for (auto x : m) {
        ans = max(ans, x.second);
    }

    cout << ans << endl;
}


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

using namespace std;

int main () {
  int N, ans;

  cin >> N;

  for (int i = N; i <= INT_MAX; i = i * 2) {
    if (i % 2 == 0 && i % N == 0) {
      ans = i;
      break;
    }
  }

  cout << ans << endl;

  return 0;
}

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

#define rep0(i, n) for(int i=0; i<(int)(n);i++)
#define rep1(i, n) for(int i=1; i<=(int)(n);i++)
#define all(x) (x).begin(), (x).end()
#define debug(a) if(flagdebug){cout << "debug (" #a "):" << endl << (a) << endl;}

typedef uint64_t ulint;
typedef int64_t lint;
using namespace std;

lint a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;
bool flagdebug = false;

int main(){
//////////////////////////////////////////////////////
    // flagdebug = true;

    string s;
    cin >> s;
    if(s == "Sunny")
    {
        cout << "Cloudy" << endl;
    }

    if(s == "Cloudy")
    {
        cout << "Rainy" << endl;
    }

    if(s == "Rainy")
    {
        cout << "Sunny" << endl;
    }


    //cout << 0 << endl;

//////////////////////////////////////////////////////
// Ctrl + Opt + N to make
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
#include <numeric>
using namespace std;
const double PI = acos(-1.0);
const string alp = "abcdefghijklmnopqrstuvwxyz";
const string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
int main(){
  string a,b,c;
  cin >> a >> b >> c;
  cout << ALP[alp.find(a[0])] << ALP[alp.find(b[0])] << ALP[alp.find(c[0])] << endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

#define MAX 100
#define INFINITY 111111111
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n, M[MAX][MAX];

void dijkstra(){
  int minv;
  int d[MAX], unchi[MAX];
  int i, u, v;

  for(i = 0; i < n; i++){
    d[i] = INFINITY;
    unchi[i] = WHITE;
  }

  d[0] = 0;
  unchi[0] = GRAY;
  while(1){
    minv = INFINITY;
    u = -1;
    for(i = 0; i < n; i++){
      if(minv > d[i] && unchi[i] != BLACK){
	u = i;
	minv = d[i];
      }
    }

    if(u == -1)break;
    unchi[u] = BLACK;
    for(v = 0; v < n; v++){
      if(unchi[v] != BLACK && M[u][v] != INFINITY){
	if(d[v] > d[u] + M[u][v]){
	  d[v] = d[u] + M[u][v];
	  unchi[v] = GRAY;
	}
      }
    }
  }
  for(i = 0; i < n; i++){
    printf("%d %d\n", i, (d[i] == INFINITY ? -1 : d[i]));
  }
}

int main(){
  int i, j;
  
  scanf("%d",&n);
  for(i = 0; i < n; i++){
    for(j = 0; j < n; j++){
      M[i][j] = INFINITY;
    }
  }

  int k, c, u, v;
  for(i = 0; i < n; i++){
    scanf("%d%d",&u,&k);
    for(j = 0; j < k; j++){
      scanf("%d%d",&v, &c);
      M[u][v] = c;
    }
  }

  dijkstra();

  return 0;
}



Measured memory_bytes: 2004