akhauriyash/Code-Regression huggingface dataset:
use std::io::*;

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let mut a: usize = itr.next().unwrap().parse().unwrap();
    let b: usize = itr.next().unwrap().parse().unwrap();
    let mut c: usize = itr.next().unwrap().parse().unwrap();
    let d: usize = itr.next().unwrap().parse().unwrap();

    loop {
        if b >= c {
            println!("Yes",);
            return;
        }
        c -= b;
        if d >= a {
            println!("No",);
            return;
        }
        a -= d;
    }
}


Measured memory_bytes: 2156
let rev_split str delim =
  let rec doit s acc =
    match
      try Some (String.index s delim)
      with _ -> None
    with
    | None -> s :: acc
    | Some i ->
        let s1 = String.sub s 0 i in
        let s2 = String.sub s (i + 1) (String.length s - String.length s1 - 1) in
        doit s2 (s1 :: acc)
  in
  doit str []

let take n lst =
  let rec doit n lst acc =
    if n <= 0 then List.rev acc
    else
      match lst with
      | [] -> List.rev acc
      | hd :: tl -> doit (n - 1) tl (hd :: acc)
  in
  doit n lst []

let () =
  let n = read_int () in
  let l = read_line () in
  let ss = take n (rev_split l ' ') in
  List.iteri (fun i s ->
    if i = 0 then Printf.printf "%s" s
    else Printf.printf " %s" s)
    ss;
  print_newline ()

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

typedef long long ll;

ll K;
ll ans[100] = {0};

int main()
{
    scanf("%lld",&K);
    printf("50\n");
    for(int i = 0; i < 50; i++)
    {
        ans[i] += i + K / 50;
    }
    ll all = 0;
    for(int i = 0; i < K % 50; i++)
    {
        ans[i] += 51;
    }
    for(int i = 0; i < 50; i++)
    {
        printf("%lld",ans[i] - K % 50);
        if(i != 49)printf(" ");
    }printf("\n");
    return 0;
}


Measured memory_bytes: 256
n,k=map(int,input().split())
d = list(map(int,input().split()))
#print(d)
for i in range(n,10**5):
    count=0
    for j in range(k):
        u = str(d[j])
        if(str(i).count(u)==0):
            count+=1
    #print("count:"+str(count))
    if(count==k):
        print(i)
        break


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

int n, k;
int h[100000];
int dp[100000];
int main(void){
	cin >> n >> k;
	for(int i=0; i<n; i++) cin >> h[i];
	dp[0]=0;
	for(int i=1; i<n; i++){
		int x;
		for(int j=i-1; j>=i-k; j--){
			if(j==i-1||j>=0&&x>dp[j]+abs(h[j]-h[i])) x = dp[j]+abs(h[j]-h[i]);
		}
		dp[i] = x;
	}
	cout << dp[n-1] << endl;
}

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




int main() {

  int64_t a,b,c;
  cin>>a>>b>>c;


  if(a==b)
    cout<<c<<endl;
  else if(a==c)
    cout<<b<<endl;
  else if(b==c)
    cout<<a<<endl;

	return 0;
}

Measured memory_bytes: 3560
#include <iostream>
#include <string>
#include <vector>
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main(void) {
	string s;
	cin >> s;
	vector<ll> dp0(s.size(), 0), dp1(s.size(), 0); //0: L未満確定
	int i;
	dp0[0] = 1;
	dp1[0] = 2;
	for (i = 1; i < s.size(); i++) {
		dp0[i] = (dp0[i - 1] * 3) % MOD;
		if (s[i] == '0') {
			dp1[i] = dp1[i - 1];
		}
		else {
			(dp0[i] += dp1[i - 1]) %= MOD;
			dp1[i] = (dp1[i - 1] << 1) % MOD;
		}
	}
	cout << (dp0[s.size() - 1] + dp1[s.size() - 1]) % MOD << "\n";
	return 0;
}

Measured memory_bytes: 2048
#include <iostream>
#include <cstring>
using namespace std;
int n,m,i,j,x,ans,cnt[100005],s;
string st;
int main()
{
	ios::sync_with_stdio(0);
	cin>>n;
	for (i=1;i<=n;i++)
	{
		cin>>x;
		cnt[x]++;
	}
	for (i=0;i<=100000;i++)
	{
		s=0;
		if (i) s+=cnt[i-1];
		ans=max(ans,s+cnt[i]+cnt[i+1]);
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 640
a,b = map(int,input().split())
s = input()

good = True
for i in range(a):
    if not s[i].isdigit():
        good = False
        break

if good and s[a] == "-":
    for i in range(a+1,a+b+1):
        if not s[i].isdigit():
            good = False
            break
else:
    good = False

print("Yes" if good else "No")

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

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

	int H, W;
	scanf("%d %d", &H, &W);

	char a;
	scanf("%c", &a);  //改行文字空読み
	int pre_right = 0, right;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			scanf("%c", &a);
			// printf("%c", a);
			if (a == '#') {
				right = j;
				// printf("pre = %d, now = %d\n", pre_right, right);
				if (pre_right > right) {
					printf("Impossible");
					return 0;
				}
			}
		}
		scanf("%c", &a);  //改行文字空読み

		pre_right = right;
	}
	printf("Possible");

	return 0;
}

Measured memory_bytes: 256
n = int(input())
s = [sorted(input()) for i in range(n)]

count = 0
dic1 = {}
#print(s)
for i in range(n):
    #print(s[i])
    so = ''.join(s[i])
    if so in dic1:
        count += dic1[so]
        dic1[so] += 1
    else:
        dic1[so] = 1
    #print(count, dic1)
print(count)


Measured memory_bytes: 39040
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        long[] aa = sc.LongArray();

        bool ok = aa.Distinct().Count() == 1;

        string answer = ok ? "Yes" : "No";

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


Measured memory_bytes: 28044
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define ld long double
#define pi pair<ll,ll>
#define pii vector<pair<ll,ll> >
#define v vector
#define vi vector<ll>
#define f(a,i,n) for(int i=a;i<n;i++)
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define MAX 1000001
#define all(x) x.begin(),x.end()
const ll inf=(ll) 1e18;

ll gcd(ll a, ll b) {ll r; while (b) {r = a % b; a = b; b = r;} return a;}
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
ll fpow(ll n, ll k, int p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
int inv(int a, int p = MOD) {return fpow(a, p - 2, p);}
ll spf[MAX+1];
void sieve()//complexity = approx 3*10^6
{
    f(1,i,MAX) {spf[i]=i;} 
    for(ll i=2;i<MAX;i+=2){spf[i]=2;}
    for(ll i=3;i<MAX;i+=2)
    {
        if(spf[i]==i) //if i is prime mark its multiples with spf as i
        {
            for(ll j=i*i;j<MAX;j+=i)
            {
                spf[j]=min(i,(ll)spf[j]);
            }
        }
    }
}

int main()
{
    string s, t;
    cin >> s >> t;
    ll n = s.size();
    ll m = t.size();
    string ans = "";    
    v<vi> dp(n + 1, vi(m + 1, 0));
    f(0, i, n + 1) {
        f(0, j, m + 1) {
            if(i == 0 or j == 0)
                dp[i][j] = 0;
            else if(s[i - 1] == t[j - 1])
                dp[i][j] = dp[i - 1][j - 1] + 1;
            else dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
        }
    }
    ll curlen = dp[n][m];
    ll ii = n, jj = m;
    while(ii > 0 and jj > 0) {
        if(s[ii - 1] == t[jj - 1]) {ans += s[ii - 1]; ii--; jj--;}
        else if(dp[ii - 1][jj] >  dp[ii][jj - 1]) ii--;
        else jj--;
    }
    reverse(ans.begin(), ans.end());
    cout << ans << endl;
} 

Measured memory_bytes: 73720
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int ll;

#define all(x) x.begin(),x.end()

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

ll gcd(ll x,ll y){
  if(y == (ll)0) return x;
  else return gcd(y,x%y);
}

int main()
{
  ll n,m;
  cin >> n >> m;
  string s,t;
  cin >> s >> t;

  ll g = gcd(n,m);
  ll l = n*m/g;

  ll ss = n/g, tt = m/g;
  for(ll i = 0; i < g; i++){
    if(s[ss*i] != t[tt*i]){
      cout << -1 << endl;
      return 0;
    }
  }


  cout << l << endl;

  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(long long i=0;i<x;i++)
#define repn(i,x) for(long long i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())


set<pair<ll,ll> > s;
vector<pair<ll,pair<ll,ll> > > vec;
vector<ll> ans(200001, -1);


int main(){	
	long long Q;
	long long N;
	scanf("%lld",&N);
	vector<long long> T(N-1+1);
	vector<long long> S(N-1+1);
	vector<long long> X(N-1+1);
	scanf("%lld",&Q);
	vector<long long> D(Q-1+1);
	for(int i = 0 ; i <= N-1 ; i++){
		scanf("%lld",&S[i]);
		scanf("%lld",&T[i]);
		scanf("%lld",&X[i]);
		vec.pb(mp(X[i], mp(S[i]-X[i], T[i]-1-X[i])));
	}
	for(int i = 0 ; i <= Q-1 ; i++){
		scanf("%lld",&D[i]);
		s.insert(mp(D[i],i+1));
	}

	SORT(vec);
	rep(i,vec.size()) {
		if (s.empty()) continue;
		auto it = s.lower_bound(mp(vec[i].sc.fi, -1));
		while (!s.empty() && it != s.end() && (*it).fi <= vec[i].sc.sc) {
			ans[(*it).sc] = vec[i].fi;
			s.erase(it++);
		}
	}
	repn(i,Q) cout << ans[i] << endl;

	return 0;
}



Measured memory_bytes: 27628
import java.util.*;
import java.util.stream.Collectors;
import java.io.*;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	static class Tuple implements Comparable<Tuple> {
		long i, j, k;

		Tuple(long i, long j, long k) {
			this.i = i;
			this.j = j;
			this.k = k;
		}

		@Override
		public int compareTo(Tuple o) {
			if (this.i != o.i) {
				return Long.compare(this.i, o.i);
			} else if (this.j != o.j) {
				return Long.compare(this.j, o.j);
			} else {
				return Long.compare(this.k, o.k);
			}
		}
	}

	int N;
	long[] L;
	Map<Long, Integer> counts;

	Main(BufferedReader in) throws IOException {
		N = Integer.parseInt(in.readLine());
		L = new long[N];
		String[] tokens = in.readLine().split(" ");
		for (int i = 0; i < N; ++i) {
			L[i] = Long.parseLong(tokens[i]);
		}
		Arrays.sort(L);
		counts = new HashMap<>();
		for (int i = 0; i < N; ++i) {
			if (!counts.containsKey(L[i])) {
				counts.put(L[i], 1);
			} else {
				counts.put(L[i], counts.get(L[i]) + 1);
			}
		}
	}

	void calc() {
		List<Long> keys = new ArrayList<>();
		keys.addAll(counts.keySet());
		Collections.sort(keys);
		long count = 0;
		for (int i = 0; i < keys.size(); ++i) {
			for (int j = i + 1; j < keys.size(); ++j) {
				for (int k = j + 1; k < keys.size(); ++k) {
					long I = keys.get(i);
					long J = keys.get(j);
					long K = keys.get(k);
					if (I + J > K) {
						count += counts.get(I) * counts.get(J) * counts.get(K);
					}
				}
			}
		}

		System.out.println(count);
	}

	void showResult() {
	}
}

Measured memory_bytes: 39028
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.exec();
    }

    
    private void exec() {
        Scanner scanner = new Scanner(System.in);
        List<String> wordList = new ArrayList<>();
        int j = scanner.nextInt();
        int k = scanner.nextInt();
        
        for (int i = 0; i <= j; i++) {
            String input = scanner.nextLine();
            wordList.add(input);
        }
        Collections.sort(wordList);
        for (int i = 0; i <= j; i++) {
            System.out.print(wordList.get(i));
        }
    }
}        
        




Measured memory_bytes: 22612
from collections import Counter
 
N = int(input())
 
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

a = prime_factorize(N)
num = list(Counter(a).values())

ans = 0
for i in num:
    j = 1
    while i - j >= 0:
        ans += 1
        i -= j
        j += 1
 
print(ans)

Measured memory_bytes: 9436
# https://atcoder.jp/contests/arc098/tasks/arc098_a

import sys
from collections import Counter
# sys.setrecursionlimit(100000)


def input():
    return sys.stdin.readline().strip()


def input_int():
    return int(input())


def input_int_list():
    return [int(i) for i in input().split()]


def main():
    n = input_int()
    S = input()
    count = Counter(S)
    left_w = 0
    left_e = 0
    ans = len(S) + 1
    for i in range(len(S)):
        if S[i] == "E":
            ans = min(ans, left_w + (count["E"] - left_e - 1))
        else:
            ans = min(ans, left_w + (count["E"] - left_e))
        if S[i] == "W":
            left_w += 1
        else:
            left_e += 1
    print(ans)
    return


if __name__ == "__main__":
    main()


Measured memory_bytes: 74548
import heapq
X,Y,A,B,C=map(int,input().split())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
S=[]
T=[]
for i in range(X):
    heapq.heappush(S,-p[i])
for i in range(Y):
    heapq.heappush(S,-q[i])
for i in range(C):
    heapq.heappush(T,-r[i])
ans=0
for i in range(X+Y):
    if len(T)>0:
        if S[0]<T[0]:
            ans+=heapq.heappop(S)
        else:
            ans+=heapq.heappop(T)
    else:
        ans+=heapq.heappop(S)
print(-ans)


Measured memory_bytes: 111628
//url:
//problem name:

#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); ++i)
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<long,long>;
using veci = vector<int>;
using vecl = vector<long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long,long>>;

string O,E;

int main() {
    cin >> O >> E;
    string ans = "";
    if(O.size() == E.size()) 
        REP(i,O.size()) {
            ans += O.at(i);
            ans += E.at(i);
        }
    else {
        REP(i,E.size()) {
            ans += O.at(i);
            ans += E.at(i);
        }
        ans += O.at(O.size()-1);
    }
    cout << ans << endl;
}


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

using namespace std;
using ll = long long;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define REP(i, n) for(ll i = n-1; i >= 0; i--)
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr << #x << " = " << x << endl
#define mp(a, b) make_pair(a, b)
#define pb push_back

const long long MOD = 1000000007;


vector<ll> Zalgo(const string &s){
    ll n = s.size();
    vector<ll> res(n);
    res[0] = n;
    ll i = 1, j = 0;
    while(i < n){
        while(i+j < n && s[j] == s[j+i]){
            j++;
        }
        res[i] = j;
        if(j == 0){
            i++;
            continue;
        }
        ll k = 1;
        while(i+k < n && k+res[k] < j){
            res[i+k] = res[k];
            k++;
        }
        i += k;
        j -= k;
    }
    return res;
}

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

    ll res = 0;
    rep(i, n){
        string t = s.substr(i);
        vector<ll> z = Zalgo(t);

        rep(j, t.size()){
            ll lcp = min(z[j], j);
            res = max(res, lcp);
        }
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,k;
  cin>>n>>k;
  int a[n];
  for(int i=0;i<n;i++)
    cin>>a[i];
  sort(a,a+n);
  int ans=0;
  for(int i=0;i<k;i++)
    ans+=a[i];
  cout<<ans<<endl;
}

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

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

    ll n;
    cin >> n;
    
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    
    sort(a.begin(), a.end());
    
    for(ll i = 0; i < n - 1; i++){
        if(a[i] < 0 and a[i+1] < 0){
            a[i] = -a[i];
            a[i+1] = -a[i+1];
            i++;
        } else if(abs(a[i]) > abs(a[i+1])){
            a[i] = -a[i];
            a[i+1] = -a[i+1];
        }
    }
    
    ll sum = 0;
    rep(i,n){
        sum += a[i];
    }
    cout << sum << endl;
}


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

using namespace std;

#define int long long
#define ll long long
typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define YES puts("YES\n")
#define Yes puts("Yes\n")
#define NO  puts("NO\n")
#define No  puts("No\n")
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }



signed main() {

	int N;
	int A[123456], x[123456];
	cin >> N;
	rep(i, N) cin >> A[i];
	int sum = 0;
	rep(i, N) sum += A[i];
	for (int i = 1; i < N; i += 2) sum -= A[i]*2;

	x[0] = sum;
	for (int i = 1; i < N; i++) x[i] = A[i - 1] * 2 - x[i - 1];

	rep(i, N) cout << x[i] << endl;

	return 0;
}


Measured memory_bytes: 2944
N = int(input().strip())
H = list(map(int, input().strip().split(' ')))+[0]
count = 0
for _ in range(max(H)):
  l = 0
  m = max(H)
  for r in range(1,len(H)):
    if H[r] != m:
      if H[l] == m:
        # 水抜き
        H[l:r] = [h-1 for h in H[l:r]]
        count += 1
      l = r
    else:
      if H[l] != m:
        l = r
print(count)

Measured memory_bytes: 3064
#include<stdio.h>
#include<string.h>
int main(){
  int n,len,i;
  char s[10002];
  scanf("%d%*c%s",&n,s);
  len=strlen(s);
  for(i=0;i<len;i++){
    if(s[i]+n>'Z')
      printf("%c",s[i]+n-26);
    else
      printf("%c",s[i]+n);
  }
  return 0;
}


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

int main()
{
    int N;
    cin >> N;
    int c = 0;
    vector<int> p(N);
    for (int i = 0; i < N; i++)
    {
        cin >> p.at(i);
    }
    for (int i = 1; i < N - 1; i++)
    {
        if ((p.at(i - 1) < p.at(i) && p.at(i) < p.at(i + 1)) || (p.at(i + 1) < p.at(i) && p.at(i) < p.at(i - 1)))
        {
            c++;
        }
    }
    cout << c << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
ll mul(ll a, ll b) { if (infl / a < b) return infl; return min(infl, a * b); }
ll gcd(ll a, ll b) { return a ? gcd(b % a, a) : b; }
ll lcm(ll a, ll b) { if (a == infl || b == infl) return infl; return mul(a / gcd(a, b), b); }
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan0
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/














int N, M, A[101010], B[101010];
//---------------------------------------------------------------------------------------------------
int naive() {
	int ans = 0;
	
	rep(x, 1, M + 1) {
		bool ok = true;
		rep(i, 0, N) {
			if (x % B[i] != 0) ok = false;
			if ((x / B[i]) % 2 == 0) ok = false;
		}
		if (ok) {
			printf(">> %d\n", x);
			ans++;
		}
	}

	return ans;
}
//---------------------------------------------------------------------------------------------------
int solve() {
	ll lc = 1;
	rep(i, 0, N) lc = lcm(lc, B[i]);

	rep(i, 0, N) if ((lc / B[i]) % 2 == 0) return 0;

	ll ans = M / lc;
	ans = (ans + 1) / 2;
	return ans;
}
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> N >> M;
	rep(i, 0, N) cin >> A[i];
	rep(i, 0, N) B[i] = A[i] / 2;

	//cout << naive() << endl;
	cout << solve() << endl;
}







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

int main(void){
	int N;
	cin >> N;
	int C[4] = {0};
	string tmp;
	rep(i,N){
		cin >> tmp;
		if (tmp=="AC") C[0]++;
		if (tmp=="WA") C[1]++;
		if (tmp=="TLE") C[2]++;
		if (tmp=="RE") C[3]++;
	}
	cout << "AC x " << C[0] << endl;
	cout << "WA x " << C[1] << endl;
	cout << "TLE x " << C[2] << endl;
	cout << "RE x " << C[3] << endl;
return 0;
}


Measured memory_bytes: 3628
import java.util.Scanner;
import java.util.*;

public class Main {
    public static void main(String[] arg){
        Scanner sc = new Scanner(System.in);
        while(true){
            int n = sc.nextInt();
            if(n == 0) break;
            int[] x = new int[n]; 
            int sum = 0;
            int ave;
            for(int i = 0; i<n; i++){
                x[i] = sc.nextInt();
            }
            Arrays.sort(x);
            for(int i = 1; i<n-1; i++){
                sum += x[i];
            }
            ave = sum/(n-2);
            System.out.println(ave);
        }
        sc.close();
    }
}


Measured memory_bytes: 29292
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Stack;

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

        Scanner scan=new Scanner(System.in);
        int n=0,m=0;
        if(scan.hasNext())
            n=scan.nextInt();
        if(scan.hasNext())
            m=scan.nextInt();
        String s="";
        char[][] arr=new char[n][m];
        for(int i=0;i<n;i++){
            if(scan.hasNext())
                s=scan.next();
            arr[i]=s.toCharArray();
        }
        int[][] dp=new int[n][m];
        for(int i=0;i<n;i++){
            if(arr[i][0]=='#'){
                break;
            }
            dp[i][0]=1;
        }
        for(int j=0;j<m;j++){
            if(arr[0][j]=='#'){
                break;
            }
            dp[0][j]=1;
        }
        for(int i=1;i<n;i++){
            for(int j=1;j<m;j++){
                if(arr[i][j]=='#'){
                    continue;
                }
                dp[i][j]=(dp[i-1][j]+dp[i][j-1])%1000000007;
            }
        }
        System.out.println(dp[n-1][m-1]);
    }
}


Measured memory_bytes: 38808
#include<iostream>
using namespace std;
int main () {
  long long L, R;
  cin >> L >> R;
  if (R - L >= 2018) {
    cout << 0 << endl;
    return 0;
  }
  int k[2020];
  k[0] = (int) L % 2019;
  for (int i = 0; i <= (int)R - L; i ++) {
    k[i] = (k[0] + i) % 2019;
    if (k[i] == 0) {
      cout << 0 << endl;
      return 0;
    }
  }
  int p = (int)R - L;
  int ans = 2020;
  for (int i = 0; i < p; i ++) {
    for (int j = i + 1; j <= p; j ++) {
      int q = k[i] * k[j];
      q %= 2019;
      if (ans > q) ans = q;
    }
  }
  cout << ans << endl;
}



Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

typedef long long int ll;
using ll = long long int;
using ull = long long unsigned int;
using Int = long long int;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//edit
class Solve {
public:
    void solve() {
        string s;
        cin >> s;
        if (s.size() == 3) reverse(all(s));
        cout << s << endl;
    }
};


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    Solve().solve();


    return 0;
}


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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (int i=(int)from; i<(int)to; i++)
#define all(vec) vec.begin(), vec.end()
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;

vector<ll> fac;
void c_fac(int x=pow(10,6)+10) { fac.resize(x,true); rep(i,x) fac[i] = i ? (fac[i-1]*i)%MOD : 1; }
ll inv(ll a, ll m=MOD) { ll b = m, x = 1, y = 0; while (b!=0) { int d = a/b; a -= b*d; swap(a,b); x -= y*d; swap(x,y); } return (x+m)%m; }
ll nck(ll n, ll k) { return fac[n]*inv(fac[k]*fac[n-k]%MOD)%MOD; }
ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }


int main() {
  int N; cin >> N;
  int P[N]; rep(i,N) cin >> P[i];
  int result = 0;
  int mp = INF;
  rep(i,N) {
    result += mp>P[i];
    mp = min(mp,P[i]);
  }
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<queue>
using namespace std;
typedef pair<int,int>P;
main(){
  int n,m;
  int max=0;
  int turara[100004]={0};
  P p;
  priority_queue<P ,vector<P> ,greater<P> > q;
  cin>>n>>m;
  for(int i=2;i<=n+1;i++){
    cin>>turara[i];
  }
  for(int i=2;i<=n+1;i++){
    if(turara[i-1]<turara[i]&&turara[i+1]<turara[i]){
      p.first=m-turara[i];
      if(p.first>max){
        max=p.first;
      }
      p.second=i;
      q.push(p);
    }
  }
  while(!q.empty()){
    turara[q.top().second]=0;
    if(turara[q.top().second-2]<turara[q.top().second-1]){
      p.first=q.top().first+m-turara[q.top().second-1];
      if(p.first>max){
        max=p.first;
      }
      p.second=q.top().second-1;
      q.push(p);
    }
    if(turara[q.top().second+2]<turara[q.top().second+1]){
      p.first=q.top().first+m-turara[q.top().second+1];
      if(p.first>max){
        max=p.first;
      }
      p.second=q.top().second+1;
      q.push(p);
    }
    q.pop();
  }
  cout<<max<<endl;
}

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

import sys

debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        # for line in sys.stdin:
        #     lines.append(line)
        lines.append(input())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    s = lines[0]

    return (s,)


def solve(s):

    w = {'Sunny':'Cloudy', 'Cloudy': 'Rainy', 'Rainy': 'Sunny'}



    return w[s]


def main():
    # 出力
    result = solve(*parse_input())
    if isinstance(result, list):
        for r in result:
            print("%s" % r, sep='')
    else:
        print("%s" % result, sep='')

if __name__ == '__main__':

    main()
	

Measured memory_bytes: 3064
alph = [chr(i) for i in range(65, 65+26)]
H, W = map(int, input().split())
box = [list(input().split()) for _ in range(H)]

for i in range(H):
    for j in range(W):
        if box[i][j] == "snuke":
            print(alph[j] + str(i+1))

Measured memory_bytes: 3060
from itertools import permutations, combinations

N,K = map(int,input().split())

ans = 0
_list = list(range(N+1))
_list.sort(reverse = True)
h = 0
l = 0
cnt = -1

for i in range(N+1):
    h += _list[i]
    cnt += 1
    l += cnt
    if i >= K-1:
        ans += h - l + 1
        
print(ans%(10**9 + 7))

Measured memory_bytes: 16704
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007

int main(){
   int x;
   cin >> x;
   double n = sqrt(x);

   while(true){
      bool judge = true;
      for(int i=2;i<x;i++){
         if(x%i == 0){
            judge = false;
            break;
         }
      }
      if(judge) break;
      x++;
   }
   cout << x << endl;
   return 0;
}

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

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

    string a;
    cin>>a;
    bool flag = false;
    for(int i = 0; i < a.length(); i++)
        if(a[i] == '7')
        {
            flag = true;
            break;
        }
    if(flag)
        cout<<"Yes\n";
    else
        cout<<"No\n";
    return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <set>

#define DEBUG 0

#define lli long long unsigned int
#define REP(i,n) for(int i=0;i<n;i++)

using namespace std;

void show(lli *data,lli size){
	REP(i,size){
		cout<<data[i]<<" ";
	}
	cout<<endl;
}

int isNotConnect(set<lli> ans,lli a,lli b){
	if(DEBUG)cout<<"connect? a="<<a<<" b="<<b<<endl;
	auto num = ans.lower_bound(a);
	if(num == ans.end()){
		return 0;
	}
	if(DEBUG)cout<<*num<<endl;

	if(*num > b){
		return 0;
	}
	else{
		return 1;
	}
}


int main(){
	lli n,m;
	cin>>n>>m;

	lli a,b;

	map<lli,set<lli>> data;
	set<lli> bSet;
	set<lli> ans;

	REP(i,m){
		cin>>a>>b;
		a--;
		b--;
		data[b].insert(a);
		bSet.insert(b);
	}

	for(auto itr = bSet.begin() ; itr != bSet.end(); itr++){
		lli nowB = *itr;
		if(DEBUG)cout<<"nowB="<<nowB<<endl;
		auto itr2 = data[nowB].end();
		itr2--;
		if(isNotConnect(ans,*itr2,nowB)){
			continue;
		}
		if(DEBUG)cout<<nowB-1<<endl;
		ans.insert(nowB-1);
		if(DEBUG)cout<<"insert"<<nowB-1<<endl;
	}

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

}

Measured memory_bytes: 14336
from collections import defaultdict
n=int(input())
a=list(map(int,input().split()))
dp=[defaultdict(lambda:-float('inf'))for _ in range(n)]
for i in range(n):dp[i][0]=0
for i,a in enumerate(a):
    for j in range(n//2-(n-i)//2,i//2+2):
        dp[i][j]=max(dp[i-2][j],dp[i-2][j-1]+a,dp[i-1][j])
print(dp[-1][n//2])


Measured memory_bytes: 138032
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <functional>
#include <queue>
#include <stack>
#include <map>
#include <vector>
#include <cmath>
#include <cctype>
#include <cstdio>
#define ll long long
#define INF 1e+18
#define MOD 1000000007
using namespace std;



int main(){
    int n;
    cin >> n;
    int k=0;
    while(k*4<=n){
        if((n-k*4)%7==0){
            cout<<"Yes"<<endl;
            return 0;
        }
        k++;
    }
    cout<<"No"<<endl;
    return 0;
}


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

using namespace std;

using ll = long long;
constexpr ll MOD = 1e9 + 7;
constexpr ll INF = 1e18;

int main() {
    ll n, m, i, j, k;
    cin >> n >> m >> k;
    cout << m + min(n+m+1,k) << endl;
    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;
using P = pair<int,int>;

int main(){
	int k;
	cin >> k;
    vector<int> ns(32);
    ns = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
	cout << ns.at(k-1) << endl;
    return 0;
}


Measured memory_bytes: 256
package main

import (
  "fmt"
  "sort"
)

func main() {
  var N int
  fmt.Scanf("%d", &N)
  
  nums := make([]int, N)
  for i := 0; i < N; i++ {
  	var n int
    fmt.Scanf("%d", &n)
    nums[i] = n
  }
  
  sort.Ints(nums)
  
  var duplicate bool
  var previous int
  for _, n := range nums {
    if previous == n {
      duplicate = true
      break
    }
    previous = n
  }
  
  if duplicate {
  	fmt.Println("NO")
  } else {
    fmt.Println("YES")
  }
}

Measured memory_bytes: 5888
#include <iostream>
#include <cstring>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
ll n, m, x, y, z;

struct union_find {//1-origin
	vector<int> rnk, par;
	union_find(int n) {
		rnk.resize(n+1);
		par.resize(n+1);
		for(int i = 1; i <= n; i++){
			par[i] = i;
			rnk[i] = 0;
		}
	}
	
	int find(int x) {
		if (par[x] == x) return x;
		return par[x] = find(par[x]);
	}
 
	void unite(int x, int y) {
		x = find(x);
		y = find(y);
		if (x == y)return;
		if (rnk[x] < rnk[y]) {
			par[x] = y;
		}
		else {
			par[y] = x;
			if (rnk[x] == rnk[y])rnk[x]++;
		}
	}
	
	bool same(int x, int y) {
		return (find(x) == find(y));
	}
};

int main(){
	cin >> n >> m;
	
	union_find u(n);
	for(ll i = 1; i <= m; i++){
		cin >> x >> y >> z;
		u.unite(x, y);
	}
	
	ll ans = n; 
	for(ll j = 1; j <= n; j++){
		if(j != u.find(j)){ans--;}
	}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <iomanip> // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple> // get<n>(xxx)
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set> // S.insert(M);
// if (S.find(key) != S.end()) { }
// for (auto it=S.begin(); it != S.end(); it++) { }
// auto it = S.lower_bound(M);
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib> // atoi(xxx)
using namespace std;

typedef long long ll;

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

// const int C ;
// const int M = 1000000007;

int main () {
  string S;
  cin >> S;
  int s = S.size();
  int ans = 0;
  for (auto i = 0; i < s-1; i++) {
    if (S[i] != S[i+1]) {
      ans++;
    }
  }
  cout << ans << endl;
}


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

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

    vector<vector<string>> st(s.size() + 1, vector<string>(t.size() + 1, ""));

    for (int i = 1; i <= s.size(); i++)
    {
        for (int j = 1; j <= t.size(); j++)
        {
            if (st[i - 1][j].size() > st[i][j - 1].size())
            {
                st[i][j] = st[i - 1][j];
            }
            else
            {
                st[i][j] = st[i][j - 1];
            }

            if (s[i - 1] == t[j - 1] && (st[i - 1][j - 1].size() + 1) > st[i][j].size())
            {
                st[i][j] = st[i - 1][j - 1] + s[i - 1];
            }
            string().swap(st[i - 1][j - 1]);
        }
    }

    cout << st.back().back() << endl;
}


Measured memory_bytes: 81536
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int n, m;
	int dp[50001];
	cin >> n >> m;
	int c[10000];
	for (int i = 0; i < 50001; i++){
		dp[i] = 1<<13;
	}
	for (int i = 0; i < m; i++){
		cin >> c[i];
	}
	dp[0] = 0;
	for (int i = 0; i < m; i++){
		for (int i2 = 0; i2 + c[i] <= n; i2++){
				dp[i2 + c[i]] = min(dp[i2 + c[i]], dp[i2] + 1);
		}
	}
	cout << dp[n] << endl;
}

Measured memory_bytes: 1368
import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()
from math import gcd
from collections import Counter
from functools import cmp_to_key

def cmp(A1, A2):
    x1, y1 = A1[0]
    x2, y2 = A2[0]
    if (x1, y1) == (x2, y2):
        return 0
    return -1 if x2 * y1 < x1 * y2 else 1

def resolve():
    n = int(input())
    zero = 0
    counter = Counter()
    for _ in range(n):
        x, y = map(int, input().split())
        if x == 0 and y == 0:
            zero += 1
            continue

        g = gcd(x, y)
        x //= g
        y //= g

        if y == 0:
            x, y = 1, 0
        elif y < 0:
            x, y = -x, -y
        counter[x, y] += 1

    C = list(counter.items())
    C.sort(cmp_to_key(cmp))

    k = len(C)
    dp = [0] * (k + 1)
    dp[0] = 1
    for i in range(k):
        x, y = C[i][0]
        dp[i + 1] += dp[i]
        dp[i + 1] += (pow(2, counter[x, y], MOD) - 1) * dp[i] * pow(2, -counter[y, -x] % (MOD - 1), MOD)
        dp[i + 1] %= MOD

    res = dp[k]
    res -= 1
    res += zero
    print(res % MOD)
resolve()

Measured memory_bytes: 144020
#include<cstdio>
#include<stdlib.h>

int main(){
	int S,W;
	scanf("%d%d",&S,&W);
	if(W>=S){
		printf("unsafe");
	}else{
		printf("safe");
	}
	//printf("羊の数は%d、オオカミの数は%d",S,W);
}


Measured memory_bytes: 1732
#include<bits/stdc++.h>
#define sz(a) int((a).size()) 
#define pb push_back 
#define all(c) (c).begin(),(c).end() 
#define tr(c,i) for(auto i = (c).begin(); i != (c).end(); i++) 
#define present(c,x) ((c).find(x) != (c).end()) 
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define F(i,n) for(int i=0;i<n;i++)
#define MOD 1000000007
#define VE(i,v) for(int i = 0;i < (v).size();i++)

using namespace std;
#define trace(...) cerr<<__FUNCTION__<<":"<<__LINE__<<" "; __f(#__VA_ARGS__, __VA_ARGS__)
template<typename Arg1>
void __f(const char *name, Arg1 &&arg1) {
	cerr<<name<<" : "<<arg1<<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...);
}
typedef vector<int> vi; 
typedef vector<vi> vvi; 
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef long long ll;
typedef unsigned int ui;
typedef vector<ll> vl; 
typedef vector<vl> vvl; 
typedef pair<ll,ll> pll;
typedef vector<pll> vpll; 
 




int main()

{
	std::ios::sync_with_stdio(false);
	cin.tie(NULL);
	int T;
	T=1;
	for(int tc=1; tc<=T;tc++)
	{
		int N;
		cin>>N;
		string s, t;
		cin>>s>>t;
		for(int i=0; i< N; i++)
			cout<<s[i]<<t[i];
		cout<<"\n";
	}
 
 
 
	return 0;
}
 
 


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<utility>
#include<algorithm>
#include<cstdio>
#include<iomanip>
#include<queue>
#include<stack>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)

using namespace std;

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

    ll N;
    cin >> N;
    vector<ll> A(N), B(N), C(N-1);
    Rep (i, N) {
        cin >> A[i];
    }
    Rep (i, N) {
        cin >> B[i];
    }
    Rep (i, N-1) {
        cin >> C[i];
    }

    ll ans = 0;
    Rep (i, N) {
        ans += B[i];
    }

    Rep (i, N-1) {
        ll now = A[i]-1;
        ll next = A[i+1]-1;
        if (now+1 == next) {
            ans += C[now];
        }
    }

    cout << ans << endl;
}

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


int array[100001];

void Partition(const int begin, const int end){
	int mid = array[end];
	int i = begin;
	for(int j = begin; j < end; j++){
		if(array[j] <= mid){
			int buf = array[i];
			array[i] = array[j];
			array[j] = buf;
			i ++;
		}
	}
	{
		int buf = array[i];
		array[i] = array[end];
		array[end] = buf;
	}
	for(int j = 0; j <= end; j++){
		     if(j == i)cout << "[" << array[j] << "] ";  	
		else if(j == end) cout << array[j] << endl;
		else cout << array[j] << " "; 
	}
}

int main(){
	int end;
	cin >> end;
	for(int i = 0; i < end; i++){
		int num;
		cin >> num;
		array[i] = num;
	}
	
	Partition(0, end - 1);
	return 0;
}

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

using namespace std;
using i64 = long long;
using f64 = double;

#define FOR(i, s, n) for (size_t i = (s); i < (size_t)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(v) (v).begin(), (v).end()

template <typename T, typename U>
inline bool chmax(T &a, U b) {
  return a < b ? (a = b, true) : false;
}

template <typename T, typename U>
inline bool chmin(T &a, U b) {
  return a > b ? (a = b, true) : false;
}

int main() {
  int X;
  cin >> X;
  cout << (X >= 30 ? "Yes" : "No");
  return 0;
}


Measured memory_bytes: 3628
#include<cstdio>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
using namespace std;
typedef set<int> Edge;
struct Cell
{
	int v;
	Edge edge;
	Cell(int v):v(v),edge(){}
	Cell():v(-1),edge(){}
};
typedef map<int,Cell>Numoeba;
typedef Numoeba::value_type Pair;

Numoeba numoeba;
int makeIndex;

int Collatz(int x)
{
	x=3*x+1;
	while(x%2==0)
		x/=2;
	if(x>=12345678)
		x-=12345678;
	return x;
}
void ConnectEdge(int x,int y)
{
	numoeba.find(x)->second.edge.insert(y);
	numoeba.find(y)->second.edge.insert(x);
}
void EraseEdge(int controlIndex,int erasedIndex)
{
	numoeba.find(controlIndex)->second.edge.erase(erasedIndex);
}
void Spawn(int K,int fromID)
{
	numoeba.insert( Pair(makeIndex,Cell(K)) );
	ConnectEdge(fromID, makeIndex);
	++makeIndex;
}
void Kill(int id,int fromID,bool willDie)
{
	const Cell &cell=numoeba.find(id)->second;
	if(cell.v==1 || willDie)
	{
		if(!willDie && fromID>=0 && cell.edge.size()==2)
		{
			Edge::iterator ite=cell.edge.begin();
			if(*ite==fromID)
				++ite;
			int childID = *ite;
			EraseEdge(fromID, id);
			EraseEdge(childID,id);
			ConnectEdge(childID,fromID);
			numoeba.erase(id);
			Kill(childID,fromID,false);
		}
		else
		{
			for(Edge::iterator ite=cell.edge.begin(); ite!=cell.edge.end();)
			{
				if(*ite!=fromID)
					Kill(*(ite++), id, true);
				else ++ite;
			}
			if(fromID>=0)
				EraseEdge(fromID,id);
			numoeba.erase(id);
		}
	}
	else
	{
		for(Edge::iterator ite=cell.edge.begin(); ite!=cell.edge.end();)
			if(*ite!=fromID)
				Kill(*(ite++),id,false);
			else ++ite;
	}
}

int main()
{
	vector<int>candidate;
	int K,T,maxCell,rootIndex, i;
	while(scanf("%d",&K),K)
	{
		maxCell=1;
		rootIndex = makeIndex = 0;
		numoeba.clear();
		numoeba.insert(Pair(makeIndex++,Cell(K)));
		for(T=1;;++T)
		{
			candidate.clear();
			for(Numoeba::iterator ite=numoeba.begin(); ite!=numoeba.end(); ++ite)
			{
				int x=Collatz(ite->second.v);
				if(x>ite->second.v && (ite->second.edge.size()==1&&ite->first!=rootIndex || numoeba.size()==1))
					candidate.push_back(ite->first);
				ite->second.v = x;
			}
			Kill(rootIndex,-1,false);
			if(numoeba.empty())
				break;

			for(i=0; i<candidate.size(); ++i)
			{
				Numoeba::iterator ite=numoeba.find(candidate[i]);
				if(ite!=numoeba.end())
				{
					int v=(ite->second.v+1)/2;
					if(v%2==0)++v;
					Spawn(v,candidate[i]);
				}
			}
			int maxV=0, count=0, index=-1;
			for(Numoeba::iterator ite=numoeba.begin(); ite!=numoeba.end(); ++ite)
			{
				int v=ite->second.v;
				if(maxV < v)
				{
					maxV = v;
					index=ite->first;
					count=1;
				}
				else if(maxV == v)
					++count;
			}
			if(count==1)
			{
				int v=(maxV+1)/2;
				if(v%2==0)--v;
				Spawn(v,index);
				rootIndex = index;
			}
			maxCell = max<int>(maxCell, numoeba.size());
		}
		printf("%d %d\n",T,maxCell);
	}
	return 0;
}

Measured memory_bytes: 868
n,k =map(int, input().split())
#連立方程式を解く
#m*k/2がn以下のkの倍数となる値を数える
#kが偶数の時、a,b,cをkで割った余りは0かk/2
#kが奇数の時、a,b,cをkで割った余りは0
ans=0
odd=0
even=0

#奇数の数
odd=n//k

#偶数の数
even=n//(k/2)-odd

if k%2==0:
  ans+=odd**3+even**3
else:
  ans+=odd**3

print(int(ans))

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {

public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        long sum = 0;
        int max = 0;
        int min = 0;
       for(int i = 0; i < n;i++){
    	   a[i] = sc.nextInt();
    	   max = a[0];
    	   min = a[0];;
       }
       for(int i = 0; i < n; i++){
    	   if(max < a[i]){
    		   max = a[i];
    	   }
    	   if(min > a[i]){
    		   min = a[i];
    	   }
    	   sum += a[i];
       }
       System.out.println(min + " " + max + " " + sum);
    }
}


Measured memory_bytes: 41480
#include <bits/stdc++.h>
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define rep(i,N) for(long long i = 0; i < (long long)(N); i++)
#define repr(i,N) for(long long i = (long long)(N) - 1; i >= 0; i--)
#define rep1(i,N) for(long long i = 1; i <= (long long)(N) ; i++)
#define repr1(i,N) for(long long i = (N) ; (long long)(i) > 0 ; i--)
#define each(x,v) for(auto& x : v)
#define all(v) (v).begin(),(v).end()
#define sz(v) ((int)(v).size())
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
using namespace std; void solve();
using ll = long long; template<class T = ll> using V = vector<T>;
using vi = V<int>; using vl = V<>; using vvi = V< V<int> >;
constexpr int inf = 1001001001; constexpr ll infLL = (1LL << 61) - 1;
struct IoSetupNya {IoSetupNya() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); cerr << fixed << setprecision(7);} } iosetupnya;
template<typename T, typename U> inline bool amin(T &x, U y) { return (y < x) ? (x = y, true) : false; }
template<typename T, typename U> inline bool amax(T &x, U y) { return (x < y) ? (x = y, true) : false; }
template<typename T, typename U> ostream& operator <<(ostream& os, const pair<T, U> &p) { os << p.first << " " << p.second; return os; }
template<typename T, typename U> istream& operator >>(istream& is, pair<T, U> &p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator <<(ostream& os, const vector<T> &v) { int s = (int)v.size(); rep(i,s) os << (i ? " " : "") << v[i]; return os; }
template<typename T> istream& operator >>(istream& is, vector<T> &v) { for(auto &x : v) is >> x; return is; }
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
template<typename T>void die(T x){out(x); exit(0);}
#ifdef NyaanDebug
  #include "NyaanDebug.h"
  #define trc(...) do { cerr << #__VA_ARGS__ << " = "; dbg_out(__VA_ARGS__);} while(0)
  #define trca(v,N) do { cerr << #v << " = "; array_out(v , N);cout << endl;} while(0)
#else
  #define trc(...)
  #define trca(...)
  int main(){solve();}
#endif

#define inc(...) char __VA_ARGS__; in(__VA_ARGS__)
#define in2(N,s,t) rep(i,N){in(s[i] , t[i]);}
#define in3(N,s,t,u) rep(i,N){in(s[i] , t[i] , u[i]);}
using vd = V<double>; using vs = V<string>; using vvl = V< V<> >;
template<typename T>using heap = priority_queue< T , V<T> , greater<T> >;

using P = pair<int,int>; using vp = V<P>;
constexpr int MOD = /**/ 1000000007; //*/ 998244353;
//////////////////

void solve(){
  ins(S);
  int ans = 0;
  rep(i , sz(S)){
    int a = (S[i] == 'p');
    if(i & 1) a--;
    ans -= a;
  }
  out(ans);
}

Measured memory_bytes: 512