akhauriyash/Code-Regression huggingface dataset:
while 1:
    try:
        w = [512,256,128,64,32,16,8,4,2,1]
        x,y = [],[]
        n = int(input())

        for i in w:
            weight = n // i
            n %= i
            x.append(weight)

        for i in range(10):
            if x[i] != 0:
                y.append(w[i])

        y.reverse()        
        print(*y)
    except:
        break


Measured memory_bytes: 5592
import java.util.*;

public class Main {
  public static void main(final String[] args) {
    final Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    sc.close();

    if(500 * A >= B) {
      System.out.println("Yes");
    } else {
    System.out.println("No");
    }
  }
}

Measured memory_bytes: 21972
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        List<Double> v = new ArrayList<>();
        for(int i = 0; i < n; i++){
            v.add(scan.nextDouble());
        }
        Collections.sort(v);
        double sum = 0;
        double a = 0;
        while(v.size() > 1){
            a = (v.get(0) + v.get(1)) / 2;
            v.remove(0);
            v.remove(0);
            v.add(a);
            Collections.sort(v);
        }
        System.out.println(v.get(0));
    }
}

Measured memory_bytes: 23252
# -*- coding: utf-8 -*-
"""
A - Can you get AC?
https://atcoder.jp/contests/code-festival-2017-qualc/tasks/code_festival_2017_qualc_a

"""
import sys


def solve(S):
    if 'AC' in S:
        return 'Yes'
    return 'No'


def main(args):
    S = input()
    ans = solve(S)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])


Measured memory_bytes: 2940
import java.io.File;
import java.io.IOException;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Deque;
import java.util.List;
import java.util.Scanner;

public class Main {
 
	public static void main(String[] args) throws IOException {
		//File file = new File("input.txt");
		//Scanner sc = new Scanner(file);
		
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		List<String> list = new ArrayList<String>();
		String w = sc.next();
		list.add(w);
		boolean flag = true;
		
		for(int i = 0; i < N-1; i++){
			String W = sc.next();
			if(W.charAt(0) != w.charAt(w.length()-1)){
				flag = false;
				break;
			}
			if(list.contains(W)){
				flag = false;
				break;
			}
			list.add(W);
			w = W;
		}
		
		System.out.println(flag?"Yes":"No");
	}
}

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

int main()
{

    int n;
    cin>>n;
    set<string>s;
    int cnt=0;
    while(n--)
    {
        string str;
        cin>>str;
        if(s.find(str)==s.end())
        {
            s.insert(str);
            cnt++;
        }
    }
    cout<<cnt<<"\n";
}


Measured memory_bytes: 19256
from itertools import permutations

N = int(input())
P = "".join(input().split())
Q = "".join(input().split())
L = []
perm = permutations(range(1, N + 1), N)
for p in perm:
    s = "".join(map(str, list(p)))
    L.append(s)
L.sort()
print(abs(L.index(P) - L.index(Q)))


Measured memory_bytes: 6040
#include<stdio.h>
int main(){
	int N,i,j,b=0,c=0,d=0;
	scanf("%d",&N);
	int a[100];
	for(i=0;i<N;i++){
		scanf("%d",&a[i]);
	}
	for(i=0;i<N;i++){
		for(j=i+1;j<N;j++){
			if(a[i]<a[j]){
				b=a[i];
				a[i]=a[j];
				a[j]=b;
			}
		}
	}
	for(i=0;i<N;i++){
		if(i%2==0){
			c+=a[i];
		}else{
			d+=a[i];
		}
	}
	printf("%d",c-d);
	return 0;
}

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

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());


void c_p_c()
{
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
}

int32_t main()
{
 // c_p_c();
  int n,k;
  cin >> n >> k;
  priority_queue <int> maxh;
  for(int i=0;i<n;i++)
  { 
    int x;
    cin >> x;
    if(maxh.size() >= k)
    {
      maxh.push(x);
      maxh.pop();
    }
    else
    {
      maxh.push(x);
    }
  }
  int s = 0;
  while(!maxh.empty())
  {
    s += maxh.top();
    maxh.pop();
  }
  cout<<s<<endl;
  return 0;
}



Measured memory_bytes: 3604
#include<stdio.h>

int main(){
	
int nm[101][101]={0},ml[101][101]={0},n,m,l,i,j,k;
long nl[101][101]={0};

scanf("%d %d %d",&n,&m,&l);
for(j=0;j<n;j++){
	for(i=0;i<m;i++){
		scanf("%d",&nm[j][i]);
	}
}

for(j=0;j<m;j++){
	for(i=0;i<l;i++){
		scanf("%d",&ml[j][i]);
	}
}

 for(j=0;j<n;j++) {
                for(i=0;i<l;i++) {
                        for(k=0;k<m;k++) {
                                nl[j][i]+=nm[j][k]*ml[k][i];
                        }
                        printf("%ld", nl[j][i]);
                        if(i!=l-1)      printf(" ");
                }
                printf("\n");
        }

return 0;

}

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

int main() {
	int a,b;
	cin >> a >> b;
	
	if(a<b){
		cout << "a < b" << endl;
	}else if(a>b){
		cout << "a > b" << endl;
	}else if(a==b){
		cout << "a == b" << endl;
	}
	return 0;
}

Measured memory_bytes: 1156
//  Created by conan1024hao in 2019.
//  Copyright © 2019 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define IINF 10e8
#define INF 10e16
#define MOD 1000000007
#define  mod 1000000007
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
//using Int=int_fast64_t;
typedef long long int ll;
typedef pair<ll,ll>Pll;
typedef pair<int,int>Pin;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[8]={-1,0,1,0,1,1,-1,-1};
int dy[8]={0,-1,0,1,1,-1,1,-1};
char dir[4]={'u','l','d','r'};
ll cmp1(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}
//--------------------------------------------------------------------------

//---------------------------------------------------------------------------
int main(){//問題をちゃんと見ろ!!!!!!!!!!!!!!!!!      llか??????????        memset()!!!!!!!!!!!!       ペナを減らせ!!!!!!!!!!!!!
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    int n;cin>>n;
    vector<int>s(n);
    for(int i=0;i<n;i++)
        cin>>s[i];
    int sum=0;
    sort(all(s));
    for(int i=0;i<n;i++)
        sum+=s[i];
    int now=0;
    while(sum%10==0&&sum&&now<n){
        if(s[now]%10==0){
            now++;
            continue;
        }
        sum-=s[now];
        now++;
    }
    if(sum%10==0)
        sum=0;
    cout<<sum<<endl;
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------






Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
#define LL long long
const LL inf = 1e17;
const LL mod = 1e9 + 7;
int N, M;
LL ans = 1;
bool usea[1000010];
bool useb[1000010];
int A[1010];
int B[1010];
int main() {
	cin >> N >> M;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
		if (usea[A[i]]) {
			cout << 0 << endl;
			return 0;
		}
		usea[A[i]] = true;
	}
	for (int i = 0; i < M; i++) {
		cin >> B[i];
		if (useb[B[i]]) {
			cout << 0 << endl;
			return 0;
		}
		useb[B[i]] = true;
	}
	LL used = -1;
	for (int i = N * M; i >= 1; i--) {
		used++;
		if (usea[i] && useb[i]) continue;
		int t = 0;
		for (int j = 0; j < N; j++) {
			if (A[j] >= i) t++;
		}
		int y = 0;
		for (int j = 0; j < M; j++) {
			if (B[j] >= i) y++;
		}
		if (usea[i]) t = 1;
		if (useb[i]) y = 1;
		LL res = t * y - used;
		if (usea[i] || useb[i]) {
			res += used;
			ans *= res;
			ans %= mod;
			continue;
		}
		if (res <= 0 || (t == 1 && y == 1)) {
			cout << 0 << endl;
			return 0;
		}
		ans *= res;
		ans %= mod;
	}
	cout << ans << endl;
	return 0;
}

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

int main() {

	string res = "Yes";
	string N; cin >> N;

	if (stoi(N.substr(0, 3)) % 111 != 0 && stoi(N.substr(1, 3)) % 111 != 0) res = "No";

	cout << res << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,f,n) for(ll i=(f); (i) < (n); i++)
#define repe(i,f,n) for(ll i=(f); (i) <= (n); i++)
using namespace std;
using ll = long long;
#define MOD (ll)1000000007
#define PI 3.14159265359
#define debug(x) cout<<#x<<" :: "<<x<<"\n";
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\n";
//#define P pair<ll, ll>
//printf("%.10f\n")
//cout << fixed << setprecision(10);
template<class T> inline bool chmax(T& a, T b){if (a < b) { a = b; return true; } return false;}
template<class T> inline bool chmin(T& a, T b){if (a > b) { a = b; return true; } return false;}
ll INF = 1e+18;
int iINF = 1e9;

int
main()
{
  int N; cin >> N;
  string S; cin >> S;
  int red, white = 0;
  rep(i, 0, N){
    if(S[i] == 'R') red++;
    else white++;
  }
  
  int neededspace = 0;
  rep(i, 0, red){
    if(S[i] != 'R') neededspace++;
  }

  cout << neededspace << endl;
  

}

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

int main() {
  while (true){
    int w,h,s,ans=1;
    vector<int> adx={0,0,1,1,1,-1},ady={-1,1,1,-1,0,0};
    vector<int> bdx={0,0,-1,-1,-1,1},bdy={-1,1,0,1,-1,0};
    queue<pair<pair<int,int>,int>> q;
    pair<pair<int,int>,int> v;
    cin >> w >> h;
    if (w==0 && h==0) break;
    cin >> s;
    vector<vector<int>> a(w+2,vector<int>(h+2));
    rep(i,h+2){
      rep(j,w+2){
        a.at(j).at(i)=1;
      }
    }
    for (int i=1;i<h+1;i++){
      for (int j=1;j<w+1;j++){
        a.at(j).at(i)=0;
      }
    }
    vector<int> e(s),r(s);
  rep (i,s){
    cin >> e.at(i) >> r.at(i);
  }
  int u;
  cin >> u;
  rep(i,u){
    rep(i,h+2){
      rep(j,w+2){
        a.at(j).at(i)=1;
      }
    }
    for (int i=1;i<h+1;i++){
      for (int j=1;j<w+1;j++){
        a.at(j).at(i)=0;
      }
    }
      rep (p,s){
    a.at(e.at(p)).at(r.at(p))=1;
    v.first.first=e.at(p);v.first.second=r.at(p);
    v.second=0;
    q.push(v);
  }
    int xx,yy,o=1;
    cin >> xx >> yy;
    v.first.first=xx;v.first.second=yy;v.second=1;
    a.at(xx).at(yy)=1;
    q.push(v);
    while (!q.empty()){
      int x=q.front().first.first,y=q.front().first.second,t=q.front().second;
      q.pop();
      for (int j=0;j<6;j++){
        if (y%2==0){
        if (a.at(x+adx.at(j)).at(y+ady.at(j))==0) {
          a.at(x+adx.at(j)).at(y+ady.at(j))=1;
          v.first.first=x+adx.at(j);v.first.second=y+ady.at(j);v.second=t;
          q.push(v);
          if (t==1)  o++;
        }
        }
        if (y%2==1){
        if (a.at(x+bdx.at(j)).at(y+bdy.at(j))==0) {
          a.at(x+bdx.at(j)).at(y+bdy.at(j))=1;
          v.first.first=x+bdx.at(j);v.first.second=y+bdy.at(j);v.second=t;
          q.push(v);
          if (t==1) o++;
        }
        }
      }
    }
    ans=max(ans,o);
  }
  cout << ans << endl;
  }
}


Measured memory_bytes: 3112
#include<iostream>
#include<vector>
using namespace std;
int main()
{
  int n;
  cin>>n;
  vector<int> h(n);
  for(int i =0;i <n; i++)
    cin>>h[i];
  vector<int> dp(n, 0);
  if(n==2)
    {cout<<abs(h[1] - h[0])<<endl;return 0;}
  dp[1]  = abs(h[1] - h[0]);
  for(int i = 2; i< n; i++)
  {
    dp[i] = min(dp[i-2] + abs(h[i] - h[i-2]), dp[i-1] + abs(h[i] - h[i-1]));
  }
  cout<<dp[n-1]<<endl;
  return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin,(obj).end()
#define SORT(list) sort(ALL((list)));
using namespace std;
using ll = long long;
int main(){
    ll n;
    cin >> n;
    ll a[n];
    
    REP(i,n)cin >> a[i];

    ll max = 0;
    ll mmax = 0;
    ll remi = 0;

    REP(i,n){
        if(a[i] > max){
            //mmax = max;
            max = a[i];
            remi = i;
        }
    }
    REP(i,n){
        if(a[i] >= mmax&&i != remi){
            //mmax = max;
            mmax = a[i];
        }
    }

    REP(i,n){
        if(a[i] < max){
            cout << max << endl;
        }
        else{
            /* REP(j,n){
                if(a[j] >= mmax&&i != j){
                    //mmax = max;
                    mmax = a[j];
                }
            }*/
            cout << mmax << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 3200
#include <cstdio>
#include <vector>

using namespace std;

bool isSquare(int x) {
    for (int i = 1; i * i <= 10 * 40 * 40; ++i) {
        if (x == i * i) return true;
    }

    return false;
}

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

    vector<vector<int>> points(n, vector<int>(d));

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

    int count = 0;

    for (int i = 0; i < n; ++i) {
        for (int j = i + 1; j < n; ++j) {
            int doubleLen = 0;
            for (int k = 0; k < d; ++k) {
                doubleLen += (points[i][k] - points[j][k]) * (points[i][k] - points[j][k]);
            }

            if (isSquare(doubleLen)) count++;
        }
    }

    printf("%d\n", count);

    return 0;
}

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

int main() {
	deque<int> deq;
    int q; cin >> q;
    while (q--) {
        int com; cin >> com;
        if (com == 0) {
            int d, x; cin >> d >> x;
            if (d == 0) deq.emplace_front(x);
            else deq.emplace_back(x);
        } else if (com == 1) {
            int p; cin >> p;
            cout << deq[p] << endl;
        } else if (com == 2) {
            int d; cin >> d;
            if (d == 0) deq.pop_front();
            else deq.pop_back();
        }
    }
	return 0;
}


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

int main(){
  int n,x;
  cin >> n >> x;
  
  int a = 1000;//初期値を大きく取っといてmと比較
  int sum = 0;//最低限使わなきゃいけない粉の量の初期値
  
  for (int i = 0;i < n;i++){
    int m;
    cin >> m;
    
    sum = sum + m;
    a = min(a,m);
  }
  cout << n + (x-sum)/a << endl;
}


Measured memory_bytes: 256
a, b = map(str,input().split())
if a == "H" and b == "H":
	ans = "H"
elif a =="H" and b == "D":
	ans = "D"
elif a == "D" and b =="H":
	ans = "D"
elif a =="D" and b =="D":
	ans = "H"
print(ans)

Measured memory_bytes: 2940
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <numeric>
#include <functional>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <memory>
#include <thread>
#include <tuple>

using namespace std;

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


  vector<tuple<int, int, int>> edges;


  for (int i = 0; i < 18; i++) {
    edges.emplace_back(i, i + 1, 0);
    edges.emplace_back(i, i + 1, 1<<i);
  }
  int base = 0;
  if (L >= 524288) {
    edges.emplace_back(18, 19, 0);
    edges.emplace_back(18, 19, 1<<18);
    base += 1 << 19;
    L -= 524288;
  }

  for (int i = 18; i >= 0; i--) {
    if (L & (1 << i)) {
      edges.emplace_back(i, 19, base);
      base += (1 << i);
      L -= (1 << i);
    }
  }
  sort(edges.begin(), edges.end());
  int m = edges.size();
  printf("%d %d\n", 20, m);
  for (auto edge : edges) {
    int u, v, w;
    tie(u, v, w) = edge;
    u++, v++;
    printf("%d %d %d\n", u, v, w);
  }
  return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding: utf-8 -*-

while True:
    n,k,m = map(int,input().split())
    if (n,k,m) == (0,0,0):
        break
    stones = [i + 1 for i in range(n)] 
    pointer = m - 1
    stones_length = len(stones)
    while stones_length > 1:
        stones.pop(pointer)
        stones_length -= 1
        pointer = (pointer - 1 + k) % stones_length
    print(stones[0])

Measured memory_bytes: 7084
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);

        Problem solver = new Problem();
        solver.solve(0, in, out);
        out.close();
    }

    static class Problem {

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int N = in.nextInt();
            int[][] arr = new int[N][3];
            for (int i = 0; i < N; i++) {
                arr[i][0] = in.nextInt();
                arr[i][1] = in.nextInt();
                arr[i][2] = in.nextInt();
            }

            int res = 0;
            int[][] dp = new int[N][3];

            for (int i = 0; i <= 2; i++) {
                res = Math.max(res, arr[0][i] + maxPoints(arr, i, 1, dp));
            }

            out.println(res);
        }

        public int maxPoints(int[][] arr, int chosen, int index, int[][] dp) {
            if (index == arr.length)
                return 0;

            if (dp[index][chosen] != 0)
                return dp[index][chosen];

            int max = 0;
            for (int i = 0; i <= 2; i++) {
                if (chosen == i) continue;
                max = Math.max(max, arr[index][i] + maxPoints(arr, i, index + 1, dp));
            }

            dp[index][chosen] = max;
            return max;
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

    }
}



Measured memory_bytes: 67496
#include <stdio.h>
//なにを出力するかをしっかり確認する必要がある

int main (void){
	int a, b,i;
	scanf("%d %d", &a, &b);
	
	if(a>=b){
		for(i=0;i<a; i++){
			printf("%d", b);
		}
		
	}else{
		for(i=0;i<b; i++){
			printf("%d", a);
		}
	}
	
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<queue>
#include<algorithm>
#include<cstdint>
#include<cstdlib>
template<typename T>
void fin(T const& t){ std::cout << t << std::endl; exit(0); }

uint64_t getZ() {
  uint64_t v = 0; int c;
  while((c = getchar_unlocked()) >= '0') v=v*10+c-'0';
  return v;
}

int main() {
  int N = getZ(), M = getZ();
  std::priority_queue<int> q;
  for(int i = 0; i < N; ++i) q.push(getZ());
  for(int i = 0; i < M; ++i) {
    int a = q.top()/2; q.pop(); q.push(a);
  }

  int64_t ans = 0;
  while(!q.empty()) { ans += (int64_t)q.top(); q.pop(); }
  fin(ans);
  return 0;
}


Measured memory_bytes: 892
N = int(input())
H = [int(v) for v in input().split()]

l = []
c = 0
i = 0
for i in range(N - 1):
    if H[i] >= H[i + 1]:
        c += 1
    else:
        l.append(c)
        c = 0
l.append(c)
print(max(l))



Measured memory_bytes: 14252
import heapq
n = int(input())
arr = list(map(int, input().split()))
arr = sorted(arr, reverse=True)
# print(arr)
ans = 0
q = []
# 人１人が既に到着しているとしたとき、得られる値はa0に等しい。
heapq.heappush(q, -arr[0])
# print(q)
for i in range(1, n):
    tmp = heapq.heappop(q)
    tmp *= -1
    ans += tmp
    heapq.heappush(q, -arr[i])
    heapq.heappush(q, -arr[i])
print(ans)


Measured memory_bytes: 31680
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		String S = sc.next();

		String a = S.substring(0, K-1);
		String b = S.substring(K-1, K).toLowerCase();
		String c = S.substring(K);
		System.out.println(a + b + c);
	}
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
#define M 1000000007LL
using namespace std;
typedef long long ll;
ll pot(ll a,ll b){
	if(b == 0)
		return 1;
	if(b&1)
		return (a*pot((a*a)%M,b/2))%M;
	return pot((a*a)%M,b/2)%M;
}
int main(){
	ll n;
	scanf("%lld",&n);
	if(n == 1){
		scanf("%lld",&n);
		n = (n*2LL)%M;
		printf("%lld\n",n);
	}
	else{
		ll res = 0;
		ll ini = pot(2,n-1);
		ll paso = pot(2,n-2);
		vector<ll> val(n);
		for(int i = 0; i < n; i++)
			scanf("%lld",&val[i]);
		sort(val.rbegin(), val.rend());
		for(int i = 0; i < n; i++){
			res = (res + (val[i]*ini)%M)%M;
			ini = (ini + paso)%M;
		}
		res = (res * pot(2,n))%M;
		printf("%lld\n", res);
	}
	return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <cstdlib>
#include <algorithm>
using namespace std;

int timetable[60*60*24];
	
int main(void){
	int n;
	while(cin >> n,n){
		for(int i=0;i<60*60*24;i++)
			timetable[i]=0;
		for(int j=0;j<n;j++){
			string l,a;
			cin >> l >> a;
			int lh=atoi(l.substr(0,2).c_str());
			int lm=atoi(l.substr(3,2).c_str());
			int ls=atoi(l.substr(6,2).c_str());
			int ah=atoi(a.substr(0,2).c_str());
			int am=atoi(a.substr(3,2).c_str());
			int as=atoi(a.substr(6,2).c_str());
			int from=lh*60*60+lm*60+ls;
			int to=ah*60*60+am*60+as;
			for(int i=from;i<to;i++)
				timetable[i]++;
		}
		int cmax=0;
		for(int i=0;i<60*60*24;i++)
			cmax=max(cmax,timetable[i]);
		cout << cmax << endl;
	}
	return 0;
}

Measured memory_bytes: 1556
#include <cstdio>

typedef long long LL;

#define int LL

const int MAXN = 1e5 + 5;

template<typename _T>
void read( _T &x )
{
	x = 0;char s = getchar();int f = 1;
	while( s > '9' || s < '0' ){if( s == '-' ) f = -1; s = getchar();}
	while( s >= '0' && s <= '9' ){x = ( x << 3 ) + ( x << 1 ) + ( s - '0' ), s = getchar();}
	x *= f;
}

template<typename _T>
void write( _T x )
{
	if( x < 0 ){ putchar( '-' ); x = ( ~ x ) + 1; }
	if( 9 < x ){ write( x / 10 ); }
	putchar( x % 10 + '0' );
}

template<typename _T>
_T MAX( const _T a, const _T b )
{
	return a > b ? a : b;
}

template<typename _T>
_T MIN( const _T a, const _T b )
{
	return a < b ? a : b;
}

int BIT[MAXN];
int a[MAXN], s[MAXN];
int N;

int lowbit( const int &x ) { return x & ( -x ); }
void update( int x, const int v ) { for( ; x <= N ; x += lowbit( x ) ) BIT[x] += v; }
int getSum( int x ) { int ret = 0; while( x ) ret += BIT[x], x -= lowbit( x ); return ret; }

bool chk( const int len )
{
	LL ret = 0; int mn = N;
	for( int i = 1 ; i <= N ; i ++ ) s[i] = a[i] >= len ? -1 : 1;
	for( int i = 1 ; i <= N ; i ++ ) s[i] += s[i - 1], ret += s[i] > 0, mn = MIN( mn, s[i] );
	for( int i = 1 ; i <= N ; i ++ ) BIT[i] = 0, s[i] += 1 - mn;
	for( int i = 1 ; i <= N ; i ++ ) ret += getSum( s[i] - 1 ), update( s[i], 1 );
	return ret <= 1ll * N * ( N + 1 ) / 4;
}

signed main()
{
	int l = 1e9, r = -1;
	read( N );
	for( int i = 1 ; i <= N ; i ++ ) read( a[i] ), l = MIN( l, a[i] ), r = MAX( r, a[i] );
	int mid;
	while( r - l > 1 )
	{
		if( chk( mid = l + r >> 1 ) ) l = mid;
		else r = mid - 1;
	}
	if( chk( r ) ) write( r );
	else write( l );
	putchar( '\n' );
	return 0;
}

Measured memory_bytes: 2560
#include <iostream>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <cmath>
#include <utility>

using namespace std;

int main() {
    int64_t n, m, c;
    cin >> n >> m >> c;
    std::vector<int64_t> b(m);
    for (size_t i = 0; i < m; ++i) {
        cin >> b[i];
    }
    int64_t a;
    size_t res = 0;
    for (size_t i = 0; i < n; ++i) {
        int64_t sum = 0;
        for (size_t j = 0; j < m; ++j) {
            cin >> a;
            sum += a * b[j];
        }
        sum += c;
        if (sum > 0) {
            ++res;
        }
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<stdio.h>
using namespace std;
int main(){
    int a,b;
    cin>>a>>b;
    int c,d,e;
    c=a+b;
    d=a-b;
    e=a*b;
    if(c<d){
        c=d;
    }
    if(c<e){
        c=e;
    }
    cout<<c<<endl;






return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int i,len1,len2,j,f=0;
	char a[101],b[101];
	gets(a);
	gets(b);
	len1=strlen(a);
	len2=strlen(b);
//	cout<<len1<<" "<<len2;
	for(i=0;i<len1;i++)
	{
		for(j=0;j<len2;j++)
		{
//			cout<<a[i]<<" "<<b[j]<<" ";
			if(a[i]<b[j])
			{
				cout<<"Yes"<<endl;
				return 0;
			}
			if(a[i]!=b[j])
			f=1;
		}
	}
	if(f==0&&len1<len2)
	{
		cout<<"Yes"<<endl;
		return 0;
	}
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include"bits/stdc++.h"
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const long long mod = 100000;
const long long inf = 1ll << 61;
typedef pair<int, int> P;
typedef pair<int,P> PP;
typedef pair<int,PP> PPP;
struct edge { int to;  int cost; };
int x[200006];
int l, n;
int solve() {
	int sum = 0, res=x[n-1];
	rep(i, n) {
		if (i <= (n-1)/ 2)sum += x[i];
		else sum += l - x[i];
	}
	sum *= 2;
	if (n & 1) {//ki
		sum -= x[n / 2];
		res = max(res,sum);
		rep(i, n-1) {
			sum -= 2 * x[i];
			if (i & 1) {
				sum -= l - x[n / 2 + i/2+1];
				sum += x[n / 2 + i / 2+1];
				res = max(res, sum);
			}
			else {
				sum += x[n / 2 + i / 2];
				sum -= l-x[n / 2 + i / 2+1];
				res = max(res, sum);
			}
		}
	}

	else {
		sum -= l - x[n / 2];
		res = max(res,sum);
		rep(i, n-1) {
			sum -= x[i] * 2;
			if (i & 1) {
				sum += x[n / 2 + i / 2];
				sum -= l-x[n / 2 + i/ 2+1];
				res = max(res, sum);
			}
			else {
				sum -= l - x[n / 2 + i/2];
				sum += x[n / 2 + i/2];
				res = max(res, sum);
			}
		}
	}
	return res;
}

signed main(){
	cin >> l >> n;
	rep(i, n)cin >> x[i];

	int ans = 0;
	ans = solve();
	rep(i, n)x[i] = l - x[i];
	reverse(x, x + n);
	ans = max(ans, solve());
	
	cout << ans << endl;
}

Measured memory_bytes: 1792
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cmath>
#include<string>
#include<bitset>
#include <sstream>
#include<queue>
#include<set>
#define rep(i,n) for(ll i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef pair<int,ll>P;

const ll mod = 1e9+7;
const ll INF = 1e9;
const ll MAXN = 1e6;

int main()
{
    int n,m;
    cin>>n>>m;
    int x[m];
    int d[m-1];
    rep(i,m)
    {
        cin>>x[i];
    }
    if(n>=m)
    {
        cout<<0;
        return 0;
    }
    sort(x,x+m);
    ll ans=0;
    rep(i,m-1)
    {
        d[i]=abs(x[i+1]-x[i]);
        ans+=d[i];
    }
    sort(d,d+m-1,greater<int>());
    rep(i,n-1)
    {
        ans-=d[i];
    }
    cout<<ans;
}

Measured memory_bytes: 1024
n = int(input())
a = list(map(int, input().split()))

for i in range(n):
  if a[i] % 2 == 0:
    if a[i] % 3 == 0 or a[i] % 5 == 0:
      pass
    else:
      print("DENIED")
      exit()
print("APPROVED")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define show(x) std::cerr << #x << " = " << (x) << std::endl
using ll = long long;
using ld = long double;
constexpr ll MOD = 1000000007LL;
template <typename T>
constexpr T INF() { return std::numeric_limits<T>::max() / 16; }
std::mt19937 mt{std::random_device{}()};

int main()
{
    int N;
    std::cin >> N;
    constexpr int MAX = 100000;
    std::vector<int> num(MAX, 0);
    for (int i = 0, A; i < N; i++) { std::cin >> A, num[A - 1]++; }
    int t = 0, o = 0;
    for (int i = 0; i < MAX; i++) {
        if (num[i] == 0) { continue; }
        num[i] = (num[i] + 1) % 2 + 1;
        if (num[i] == 1) {
            o++;
        } else {
            t++;
        }
    }
    if (t % 2 == 1) { o--; }
    std::cout << t + o << std::endl;

    return 0;
}


Measured memory_bytes: 768
import java.io.*;
import java.util.*;

class Main {
    static Scanner scanner = new Scanner();

    public static void main(String[]$) {
        int n = scanner.nextInt();
        System.out.println(n * n * n);
    }

    static class Scanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
        StringTokenizer tokenizer;

        String next() {
            try {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                    tokenizer = new StringTokenizer(reader.readLine());
                }
            } catch (IOException ignored) {
            }
            return tokenizer.nextToken();
        }

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

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

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

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int m = Integer.parseInt(br.readLine());
        System.out.println(problem084a(m));
    }

    private static int problem084a(int m) {
        return 24 + 24 - m;
    }
}

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

int main()
{
	int N, ac, wa, tle, re;
	N = 0; ac = 0; wa = 0; tle = 0; re = 0;
	string res;
	cin >> N;
	if (1 <= N && N <= 100000) {
		for (int i = 0; i < N; i++) {
			cin >> res;
			if (res == "AC") {
				ac += 1;
			}
			else if (res == "WA") {
				wa += 1;
			}
			else if (res == "TLE") {
				tle += 1;
			}
			else if (res == "RE") {
				re += 1;
			}
		}
		cout << "AC x " << ac << endl;
		cout << "WA x " << wa<< endl;
		cout << "TLE x " << tle<< endl;
		cout << "RE x " << re << endl;
		return 0;
	}
	return 0;
}

Measured memory_bytes: 3600
import java.util.*;
import java.math.BigInteger;
 
public class Main {
    public static void main(String[] args) {

        Scanner scan = new Scanner(System.in);
        
        int n = scan.nextInt();
        int k = scan.nextInt();

        int[] nums = new int[n];
        for (int i = 0; i < n; i++) {
            nums[i] = scan.nextInt();
        }

        Arrays.sort(nums);

        int ans = 0;

        for (int i = 0; i < k; i++) {
            ans += nums[i];
        }

        System.out.println(ans);
    }
}

Measured memory_bytes: 39340
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc  = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int[] Ai = new int[N];
		int[] Bi = new int[M];
		int[] point = new int[N];
		int res = 0;
		for(int i = 0; i < N; i++){
			Ai[i] = sc.nextInt();
		}
		for(int j = 0; j < M; j++){
			Bi[j] = sc.nextInt();
		}
		for(int j = 0; j < M; j++){
			for(int i = N - 1; 0 <= i; i--){
				if(Bi[j] >= Ai[i]){
					res = i + 1;
				}
			}
			point[res - 1]++;
		}
		int Maxp = 0;
		int pointer = 0;
		for(int i = N - 1; 0 <= i; i--){
			if(Maxp < point[i]){
				Maxp = point[i];
				pointer = i;
			}
		}
		System.out.println(pointer + 1);
	}
}

Measured memory_bytes: 25036
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#pragma GCC optimize("Ofast")
//*********************************************DO IT NOW****************************************************************
#include<bits/stdc++.h> 
#include<random>
#define int long long   
#define pp pair<int,int> 
#define ss second 
#define ff first 
#define pb push_back
#define mod 1000000007
#define pi 3.14159265359
#define mk(arr,n,type)  type *arr=new type[n];
#define sl s1.length();
#define yes cout<< "YES"<<endl
#define no  cout<< "NO"<<endl
#define all(v) (v).begin(),(v).end()
#define s(v)   sort(v,v+n)
#define  mt mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define read(a,n) for(int i=0;i<n;i++)cin>>a[i]
#define print(a,n) for(int i=0;i<n;i++)cout<<a[i]<<" "
#define for1(i,a,n)  for(int i=0;i<n;i++)
#define rep(i, c) for(int i = 0; i < (int)c; i++)
#define set(x) cout<<fixed<<setprecision(x);
using namespace std;
//**********************************************DO IT NO****************************************************************
void fastio()
{  
  #ifndef ONLINE_JUDGE
  freopen("INPUT.txt","r",stdin);
  freopen("OUTPUT.txt","w",stdout); 
  #endif
  ios_base :: sync_with_stdio(false); 
  cin.tie(NULL) ; 
  cout.tie(NULL);
}
int dp[101][1001],ans1=1e9,dp1[1000001];
int num[10];
int a[1000000];
signed main()
{   
    fastio();
    int t=1;
    //cin>>t;
    while(t--)
    {  
        int n,m;
        cin>>n>>m;
        if(n==1 ||m==1)
        {
            cout<<1;
            continue;
        }
        int x=n*m;
        if(x%2)
        cout<<(x+1)/2;
        else
        cout<<x/2;
    }
}
// 🍪 🍪 🍪


Measured memory_bytes: 3648
N, K = map(int, input().split())
S = input()
Is = []
i = 0
while i < N:
  j = S.find("0", i)
  if j < 0: j = N
  k = S.find("1", j)
  if k < 0: k = N
  Is.append((i, j, k))
  i = k
Is.append((N, N, N))
#print(Is)
if len(Is) <= K:
  r = N
  print(r)
  exit()
rs = []
for i in range(len(Is)-K):
  r = Is[i+K][1]-Is[i][0]
  rs.append(r)
#print(rs)
r = max(rs)
print(r)


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

using namespace std;

int main() {
	int n, a[3];
	cin >> n;
	a[0] = n / 100 % 10;
	a[1] = n / 10 % 10;
	a[2] = n % 10;
	for (int i = 0; i < 3; ++i)
		if (a[i] == 9)
			cout << 1;
		else if (a[i] == 1)
			cout << 9;
		else
			cout << a[i];
	return 0;
}

Measured memory_bytes: 256
import math


def solve():
    N, X, M = map(int, input().split())

    if N == 1:
        return X % M

    A = [X]
    vis = [-1] * M
    vis[X] = 0
    for i in range(1, M + 1):
        X = X ** 2 % M
        if vis[X] != -1:
            pref = A[:vis[X]]
            cycle = A[vis[X]:]
            break
        A.append(X)
        vis[X] = i

    n_full_period = (N - len(pref)) // len(cycle)
    suffix_length = N - len(pref) - n_full_period * len(cycle)

    ans = 0
    ans += sum(pref)
    ans += sum(cycle) * n_full_period
    ans += sum(cycle[:suffix_length])
    return ans

print(solve())

Measured memory_bytes: 69412
import java.util.*;
public class Main {
	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		
		HashMap<String, Integer> map = new HashMap<String, Integer>();
		String[] str;
		str = new String [N+1];
		for(int i=1;i<=N;i++){
			str[i]=sc.next();
		}
		
		for(int j=1;j<=N;j++){
			int v=0;
			if (map.containsKey(str[j])){
				v=map.get(str[j])+1;
			}
			else{
				v=1;
			}
			map.put(str[j], v);
		}
		//最大値を求める
		int max=-1;
			for (String key : map.keySet()) {
				if(max<map.get(key)){
					max=map.get(key);
				}
			}
		//最大値似mapするkeyをすべて求める
		List<String> list = new ArrayList<>();
		for (String key : map.keySet()) {
			if(map.get(key)==max){
			list.add(key);
			}
		}
		Collections.sort(list);
		for(int i=0;i<=list.size()-1;i++){
			System.out.println(list.get(i));
		}
	}
}

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

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(lol i=0;i<lol(n);i++)
#define REPD(i,n) for(lol i=n-1;i>=0;i--)
#define FOR(i,a,b) for(lol i=a;i<=lol(b);i++)
#define FORD(i,a,b) for(lol i=a;i>=lol(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() //sortなどの引数を省略したい
#define SIZE(x) lol(x.size()) //sizeをsize_tからllに直しておく
//定数
#define PI 3.1415926535897932385 //pi
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//最大値最小値
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main()
{
    list<char> s;
    string str; cin >> str;
    int ju{0};
    REP(i, str.length())
    {
        s.push_back(str[i]);
    }
    lol q; cin >> q;
    REP(i, q)
    {
        int t; cin >> t;
        if(t == 1)
            ju++;
        else if(t == 2)
        {
            int f; cin >> f;
            char ch; cin >> ch;
            if(ju%2 == 0)
            {
                if(f == 1)
                    s.push_front(ch);
                else
                    s.push_back(ch);
            }
            else
            {
                if(f == 2)
                    s.push_front(ch);
                else
                    s.push_back(ch);
            }
            
        }
    }

    if(ju%2 == 0)
        for(list<char>::iterator itr = s.begin(); itr != s.end(); itr++)
        {
            cout << *itr;
        }
    else
    {
        list<char>::const_reverse_iterator itEnd = s.rend();
        for(list<char>::const_reverse_iterator it = s.rbegin(); it != itEnd; it++)
            cout << *it;
    }
    cout << endl;
    return 0;
}

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

bool comp(string a, string b){
    return (a.length()==b.length())? a < b : a.length() < b.length();
}

int main(){
    int n;
    cin >> n;
    vector<string> a(n);
    for(int i=0; i<n; i++) cin >> a[i];
    sort(a.begin(), a.end(), comp);
    vector<string> perm;
    for(int i=0; i<4; i++){
        for(int j=0; j<4; j++){
            if(i==j) continue;
            perm.push_back(a[i]+a[j]);
        }
    }
    sort(perm.begin(), perm.end(), comp);
    cout << perm[2] << endl;
    return 0;
}



Measured memory_bytes: 3588
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include<iomanip>
using namespace std;

int  main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin>>s;
  int n=s.length()-1;
  long long res=0;
  bool flag[n];
  for(int i=0;i<(1<<n);i++)
  {
    long long tres=0;
    for(int j=0;j<n;j++)
    {
      flag[j]=(i>>j)%2;
    }
    long long  tmp=0;
    for(int j=0;j<n;j++)
    {
      tmp+=s[j]-'0';
      if(flag[j]){tres+=tmp;tmp=0;}
      else tmp*=10;
    }
    tres+=tmp;
    tres+=s[n]-'0';
    //cout<<tres<<endl;
    res+=tres;

  }
  cout<<res;


  return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, end) for (long long int i=0; i<end; i++)
#define repp(i, begin, end) for (long long int i=begin; i<end; i+)
#define srt(x) sort((x).begin(), (x).end());
#define rsrt(x) sort((x).rbegin(), (x).rend());
#define deb(x) cout<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<<endl;
using namespace std;
using ll = long long int;
using vi = vector<int>;
using vll = vector<long long int>;
using vllvll = vector<vll>;
using vs = vector<string>;
ll sm(vll x) {ll sum=0; rep(i, x.size()) sum+=x[i]; return sum;}
void vdeb(string s, vll x) {cout<<s<<" = { "; rep(i, x.size()) cout<<x[i]<<' '; cout <<'}'<<endl;}

//=======================================================================================================

int main()
{
    ll a, b, c;
    cin >> a >> b >> c;
    ll ans = c - a + b;
    cout << (ans>=0?ans:0)<< endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <tuple>
#include <numeric>

using namespace std;

typedef long long ll;

int main(void){
    string s;
    cin >> s;
    ll o_cnt = 0;
    ll x_cnt = 0;
    for(ll i = 0;i < s.size();i++){
        if(s[i] == 'x'){
            x_cnt++;
        }else{
            o_cnt++;
        }
    }
    o_cnt += 15 - s.size();
    if(o_cnt >= 8){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <array>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
#include <cstring>
using namespace std;

using ll = long long;
using P = pair<int, int>;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

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

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

    int N, M;
    string s;
    cin >> N >> M >> s;
    vector<int> num(N);
    for(int i = 0; i < N; ++i)  num[i] = s[i] - 'A';
    vector<vector<int>> graph(N * 2), rev(N * 2);
    vector<int> in(N * 2);
    for(int i = 0; i < M; ++i){
        int a, b;
        cin >> a >> b;
        --a, --b;
        if(num[a] == num[b]){
            graph[a * 2].emplace_back(b * 2 + 1);
            ++in[b * 2 + 1];
            if(a != b){
                graph[b * 2].emplace_back(a * 2 + 1);
                ++in[a * 2 + 1];
            }
        }
        else{
            graph[a * 2 + 1].emplace_back(b * 2);
            graph[b * 2 + 1].emplace_back(a * 2);
            ++in[b * 2];
            ++in[a * 2];
        }
    }

    queue<int> que;
    for(int v = 0; v < N * 2; ++v){
        if(in[v] == 0)  que.emplace(v);
    }
    vector<int> vs;
    while(!que.empty()){
        int u = que.front();
        que.pop();
        vs.emplace_back(u);
        for(int v : graph[u]){
            if(--in[v] == 0)    que.emplace(v);
        }
    }
    if(vs.size() == N * 2)  cout << "No\n";
    else    cout << "Yes\n";
}

Measured memory_bytes: 33556
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <iomanip>
#include <map>
#include <bitset>
#include <cstdio>
#include <set>
#include <stack>
#include <queue>
#include <cassert>
#include <numeric>
using namespace std;
typedef long long ll;
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
    REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
    REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}
#define vi vector<int>
#define vii vector<vector<int>>
#define mii map<int,int>
#define Sort(v) sort(v.begin(),v.end())
#define Reverse(v) reverse(v.begin(),v.end())
#define ALL(a)  (a).begin(),(a).end()
#define pb push_back
#define mp make_pair
//#define int ll

const int md = 1000000007;
const int INF = 1<<30;

bool check(vector<ll> &x,int p,int k){
    int n = x.size();
    int id = 0;

    ll tmp  = 0;
    rep(i,k){
        tmp = 0;
        while(tmp + x[id] <= p){
            tmp += x[id];
            id++;
            if(id == n) return true;
        }
    }
    return false;
}

int main(){
    int n,k; cin>> n >>k;
    vector<ll> w(n); cin>> w;

    ll left = 0;
    ll right = 1e9;

    while(right-left > 1){
        ll mid = left + (right-left)/2;
        if(check(w,mid,k)) right =mid;
        else left = mid;
    }

    cout << right << endl;
}



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

#define FI(i,a,b) for(int i=(a);i<=(b);i++)
#define FD(i,a,b) for(int i=(a);i>=(b);i--)

#define LL long long
#define Ldouble long double
#define PI 3.1415926535897932384626

#define PII pair<int,int>
#define PLL pair<LL,LL>
#define mp make_pair
#define fi first
#define se second

using namespace std;

int n;
char s[100005];
int ans[100005], ok;

int main(){
	scanf("%d %s", &n, s + 1);
	FI(i, 0, 1) FI(j, 0, 1){
		ans[1] = i;
		ans[2] = j;
		FI(k, 2, n - 1){
			ans[k + 1] = ans[k - 1] ^ (s[k] == 'x') ^ ans[k];
		}
	//	FI(k, 1, n) printf("%d%c", ans[k], k == n ? '\n':' ');
		if(ans[1] == ans[n - 1] ^ (s[n] == 'x') ^ ans[n]){
			if(ans[n] == ans[2] ^ (s[1] == 'x') ^ ans[1]){
				FI(k, 1, n){
					if(ans[k] == 0) printf("S");
					else printf("W");
				}
				printf("\n");
				return 0;
			}
		}
	}
	printf("-1\n");
	return 0;
}


Measured memory_bytes: 768
import numpy as np
D = int(input())
C = np.array(list(map(int, input().split())))
S = np.zeros((D,26),int)
for i in range(0,D):
    S[i] = list(map(int, input().split()))

N = (C/np.sum(C)*D)
MN = np.argmax(N)
# print(N)
N = np.floor(N)
N[MN] += D-np.sum(N)
# print(N)
# print(np.sum(N))

Plan = np.zeros(D,int)
num = np.arange(D).reshape(D,-1)
# print(num)
S = np.hstack((S,num)).T
# print(S)

test=list()
for i in range(26):
    for j in range(int(N[i])):
        test.append(int(i))
# print(len(test))
CH = D*2
np.random.seed(seed=30)
bef = np.random.randint(0,len(test),(CH))
aft = np.random.randint(0,len(test),(CH))
for i in range(CH):
    buffer = test[bef[i]]
    test[bef[i]] = test[aft[i]]
    test[aft[i]] = buffer

# print(test)
for i in test:
    l = np.argmax(S[i])
    # print(S[26,l])
    Plan[S[26,l]] = i
    S = np.delete(S,l,1)
# print(Plan)

[print(i+1) for i in Plan]

Measured memory_bytes: 27664
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define prin(a) cout<<(a)<<endl
using ll=int64_t;
using namespace std;

//define gcd and lcm (using 64bit)
ll gcd(ll a,ll b){
    if (a < b) {
        //^はxor(bitwise operator)。以下三行でswap(a,b)を行っている。
        a ^= b;
        b ^= a;
        a ^= b;
    }
    //only when b==0,this program finds that b means false and returns a.
    return b ? gcd(b, a % b) : a;
}

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


int main(){
    double n,a,b,c=0;
    cin>>n;
    vector<pair<int,int>> p(n);
    rep(i,n){
        cin>>p[i].first>>p[i].second;
    }
    rep(i,n){
        rep(j,n){
            c+=sqrt(((p[i].first-p[j].first)*(p[i].first-p[j].first)+(p[i].second-p[j].second)*(p[i].second-p[j].second)));
        }
    }
    cout<<setprecision(10)<<(c/n)<<endl;
    return 0;
}

Measured memory_bytes: 256