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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

typedef long long ll;

const int INF = 1000000000;
const int MOD = 1000000007;

int main(int argc, char *argv[]) {
    // cin.tie(0);
    // ios::sync_with_stdio(false);
    int N; cin >> N;
    int ans = 0, pre = 0;
    rep(i, N) {
        int a; cin >> a;
        if (a == pre) {
            ans++;
            pre = 0;
        } else {
            pre = a;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
from collections import Counter

def main():
    n = int(input())
    list_ = []
    for i in range(n):
        list_.append(input())
    cnt = Counter(list_)

    labals = ['AC', 'WA', 'TLE', 'RE']
    for label in labals:
        print(f'{label} x {cnt[label]}')

    # print(f'AC x {cnt["AC"]}')
    # print(f'WA x {cnt["WA"]}')
    # print(f'TLE x {cnt["TLE"]}')
    # print(f'RE x {cnt["RE"]}')



if __name__ == "__main__":
    main()

Measured memory_bytes: 16404
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N  = sc.nextInt();
        ArrayList<Integer> List = new ArrayList<>();
        int sum=0,h_num=0;
        for(int a=0;a<N;a++) {
            List.add(sc.nextInt());
            sum+=List.get(a);
        }
        h_num+=List.get(0);
        for(int a=1;a<N;a++){
            int num2=0;
            if(List.get(a-1)<List.get(a))num2 = List.get(a) - List.get(a-1);
            h_num+=num2;
        }
        System.out.println(h_num);
    }
}

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

using namespace std;

using ll = long long;

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

typedef pair<int, int> P;

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 dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int n, w[305];
int dp[305][305];

int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	while (1) {
		cin >> n;
		if (n == 0) break;
		REP(i, n) cin >> w[i];
		memset(dp, 0, sizeof(dp));
		
		for (int i = n - 1; i >= 0; --i) {
			dp[i][i] = 0;
			dp[i][i + 1] = 0;
			for (int j = i + 1; j <= n; ++j) {
				if (i + 1 < j && abs(w[i] - w[j - 1]) <= 1 && dp[i + 1][j - 1] == j - i - 2) {
					dp[i][j] = j - i;
				}
				for (int k = j + 1; k <= n; ++k) {
					chmax(dp[i][k], dp[i][j] + dp[j][k]);
				}
			}
		}
		
		cout << dp[0][n] << endl;
	}
	
	return 0;
}


Measured memory_bytes: 3532
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<vector>
using namespace std;

typedef long long ll;
const ll maxn=1e5+10,maxa=2.5e3+10;
ll n,a[maxn],ans;
ll pcnt,prime[maxa];
bool prm[maxa];
vector<ll> vec,size;
bool vis[maxn];

int main(){
	for(ll i=2;i<maxa;++i){
		if(!prm[i])
			prime[++pcnt]=i;
		for(ll j=1;j<=pcnt&&i*prime[j]<maxa;++j)
			if(i%prime[j])
				prm[i*prime[j]]=true;
			else{
				prm[i*prime[j]]=true;
				break;
			}
	}
	scanf("%lld",&n);
	for(ll i=1;i<=n;++i){
		scanf("%lld",&a[i]);
		for(ll j=1;j<=pcnt;++j)
			while(a[i]%(prime[j]*prime[j]*prime[j])==0)
				a[i]/=prime[j]*prime[j]*prime[j];
	}
	sort(a+1,a+n+1);
	for(ll i=1;i<=n;){
		ll j=i;
		while(a[j]==a[i])
			++j;
		vec.push_back(a[i]);
		size.push_back(j-i);
		i=j;
	}
	if(vec[0]==1)
		++ans;
	for(ll i=vec[0]==1?1:0;i<vec.size();++i){
		if(vis[i])continue;
		ll now=vec[i],other=1;
		for(ll j=1;j<=pcnt;++j)
			if(now%prime[j]==0)
				if(now%(prime[j]*prime[j])==0)
					other*=prime[j],now/=prime[j]*prime[j];
				else
					other*=prime[j]*prime[j],now/=prime[j];
		if(now>1)
			other*=now*now;
		vector<ll>::iterator p=lower_bound(vec.begin(),vec.end(),other);
		if(p!=vec.end()&&(*p)==other){
			int k=p-vec.begin();
			vis[k]=true;
			ans+=max(size[k],size[i]);
		}
		else
			ans+=size[i];
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 2804
#include<iostream>
#include<string>
#include<string.h>
#include<algorithm>
#include<cmath>
#include<math.h>
#include<functional>
#include<map>
#include<stack>
#include<queue>
#include<vector>
using namespace std;
int main() {
	string s, t;
	cin >> s >> t;
	for (int i = s.size() - t.size(); i >= 0; i--) {
		for (int j = 0; j < t.size(); j++) {
			if (!(s[i + j] == t[j] || s[i + j] == '?'))goto age;
		}
		for (int j = 0; j < s.size(); j++) {
			if (i <= j && j < i + t.size() && s[j] == '?')s[j] = t[j - i];
			else if (s[j] == '?')s[j] = 'a';
		}
		cout << s << endl;
		return 0;
	age:;
	}
	cout << "UNRESTORABLE" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;

main() {
    int64_t n;
    cin >> n;

    // len
    vector<int64_t> a;
    int64_t prev = (1L << 30);
    for (auto i : irange(0L, n)) {
        int64_t aa;
        cin >> aa;
        if (prev >= aa) {
            a.push_back(aa);
        }

        prev = aa;
    }

    auto r = irange(1L, static_cast<int64_t>(a.size()) + 1L);
    auto it = partition_point(r.begin(), r.end(), [&a](int64_t t){
        // len, char
        vector<pair<int64_t, int64_t>> seq;

        seq.emplace_back(a[0], 0);
        // prev len
        int64_t s = a[0];
        for (int64_t i_block = 1; i_block < a.size(); ++i_block) {
            auto len = a[i_block];

#if 0
            cerr << "[" << t << "]" << len << endl;
            for (const auto& kv : seq) {
                cerr << kv.first << ", " << kv.second << endl;
            }
#endif
            if (s < len) {
                if (seq.back().second == 0) {
                    seq.back().first += len - s;
                } else {
                    seq.emplace_back(len - s, 0);
                }
                s = len;
            }

            while (s > len) {
                if (s - seq.back().first >= len) {
                    s -= seq.back().first;
                    seq.pop_back();
                } else {
                    seq.back().first -= s - len;
                    s = len;
                }
            }

            bool found = false;
            for (auto ii = seq.rbegin(); ii != seq.rend(); ++ii) {
                auto&& block = *ii;
                if (block.second + 1 < t) {
                    if (block.first == 1) {
                        ++block.second;
                    } else {
                        --block.first;
                        seq.emplace(ii.base(), 1, block.second + 1);
                    }

                    found = true;
                    break;
                } else {
                    block.second = 0;
                }
            }

            if (!found) {
                return true;
            }
        }

        return false;
    });

    cout << *it << endl;
}

Measured memory_bytes: 2420
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,d;
    int x,y,z;
    cin>>a>>b>>c>>d;
    if(a>=b)
    {
        x=b*c;
        y=a-b;
        z=y*d;
        cout<<x+z;
    }
    else if(a<b)
    {
        x=a*c;
        cout<<x;
    }


    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;

int main(){
    ll N,K;
    cin >> N >> K;
    ll Sum = 0;
    vector<ll> A(N+1,0),B(N+1,0);
    for(int i=1;i<=N;i++){
        cin >> A[i];
        Sum += A[i];
    }
    ll ans = 1;
    auto check = [&](ll mod){
        vector<ll> S(N+1);
        ll sum = 0;
        for(ll i=1;i<=N;i++){
            S[i] = A[i]%mod;
        }
        sort(S.begin()+1,S.end());
        ll cnt = 0;
        int l = 1, r = N;
        while(l<r){
            ll mi = min(S[l],mod-S[r]);
            cnt += mi;
            S[l] -= mi;
            (S[r] += mi)%=mod;
            if(S[l]==0) l++;
            if(S[r]==0) r--;
        }
        return cnt<=K;
    };
    for(ll i=1;i*i<=Sum;i++){
        if(Sum%i!=0) continue;
        if(check(i)) ans = max((ll) ans,i);
        if(check(Sum/i)) ans = max((ll)ans,Sum/i);
    }
    cout << ans << endl;
}

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

#define ll long long int
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define MOD 998244353

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	ll N,W;	cin>>N>>W;
	pair<ll,ll> obj[N+1]; //weight,value
	for(ll i=1;i<=N;i++)
		cin>>obj[i].fi>>obj[i].se;
	ll dp[N+1][W+1]; //max value when first i obj are considered and total weight <= j
		
	for(ll i=0;i<=N;i++){
		for(ll j=0;j<=W;j++){
			if(i==0||j==0)	dp[i][j]=0;
			else{
				if(j-obj[i].fi>=0)	dp[i][j]=max(dp[i-1][j], dp[i-1][j-obj[i].fi] + obj[i].se);
				else   dp[i][j]=dp[i-1][j];
			}
		}
	}
	cout<<dp[N][W];
	
	return 0;
}


Measured memory_bytes: 79104
/*
title:

url:
*/

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <functional>
#include <queue>
#include <limits>
#include <string>
#include <utility>
#include <cstring>
#include <map>
#include <cmath>
#include <iterator>

using namespace std;

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

typedef pair<int, int> pint;
typedef long long ll;

int main()
{
    int n, m;
    cin >> n >> m;
    cout << (1 << m) * (1800 * m + 100 * n) << endl;
}

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

int main(){
  
  int N;
  ll L, T;
  cin >> N >> L >> T;
  vector<ll> X(N);
  vector<int> W(N);
  vector<ll> Now(N);
  rep(i,N) cin >> X[i] >> W[i];
  rep(i,N){
    if (W[i] == 1) Now[i] =(X[i] + T) % L;
    else Now[i] =((X[i] - T) % L + L) % L;
  }
  sort(Now.begin(), Now.end());
  ll cnt = 0;
  rep(i,N){
    if(W[i] == 1)  cnt -= (X[i] + T) / L;    
    else cnt += (T -(X[i] + 1 ) + L) / L;
  }
  cnt = (cnt % N + N) % N;  
  vector<ll>ans(N);
  rep(i,N) ans[(i+cnt)%N] = Now[i];  
  rep(i,N) cout << ans[i] << endl;
 
}


Measured memory_bytes: 3968
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#define rep(i, a, b) for(int i = a; i < (b); ++i)
using namespace std;
typedef long long ll;

vector<pair<int, int>> to[100010];
bool visited[100010];
ll dist[100010];
ll gcd(ll a, ll b)
{
   if (b == 0)
   {
       return a;
   }
    return gcd(b, a%b);
}
void dfs(int now, ll d) {
  visited[now] = true;
  dist[now] = d;
  for (auto p : to[now]) {
    if (visited[p.first]) continue;
    dfs(p.first, d + p.second);
  }
}
vector<int>ans(10005,0);
void f(ll n){
    for (ll x = 1; x<n;x++){
        for (ll y = 1; y<n;y++){
            for (ll z = 1; z<n;z++){
                ll v = (x*x)+(y*y)+(z*z)+(x*y)+(y*z)+(z*x);
                if(v<10005) ans[v]++;
            }
        }
    }
}

int main() {
    int n;
    f(105);
    string s;
    cin>>n;
    rep(i,1,n+1){
        cout << ans[i]<<endl;
    }
   
   
    return 0;
}

Measured memory_bytes: 5936
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.TreeSet;
 
 
 
public class Main {
  public static void main(String[] args) {
    InputReader sc = new InputReader(System.in);
 
 
    int l = sc.nextInt();
		int r = sc.nextInt();
		
		if(r - l >= 2018){
			System.out.println(0);
		}else{
			int waru = l / 2019;
			l -= waru * 2019;
			r -= waru * 2019;
			int ans = 10000000;
			for(int i = l; i < r; i++){
				for(int j = i + 1; j <= r; j++){
					int num = (i * j) % 2019;
					if(num < ans){
						ans = num;
					}
				}
			}
			System.out.println(ans);
		}
 
 
  }
 
 //ここからテンプレ
  static class InputReader {
      private InputStream stream;
      private byte[] buf = new byte[1024];
      private int curChar;
      private int numChars;
      private SpaceCharFilter filter;
 
      public InputReader(InputStream stream) {
          this.stream = stream;
      }
 
      public int next() {
          if (numChars == -1)
              throw new InputMismatchException();
          if (curChar >= numChars) {
              curChar = 0;
              try {
                  numChars = stream.read(buf);
              } catch (IOException e) {
                  throw new InputMismatchException();
              }
              if (numChars <= 0)
                  return -1;
          }
          return buf[curChar++];
      }
 
      public String nextStr() {
        int c = next();
        while(isSpaceChar(c)){c = next();}
        StringBuffer str = new StringBuffer();
        do{
          str.append((char)c);
          c = next();
        }while(!isSpaceChar(c));
        return str.toString();
      }
 
      public char nextChar() {
        int c = next();
        while(isSpaceChar(c)){c = next();}
        char ret;
        do{
          ret = (char)c;
          c = next();
        }while(!isSpaceChar(c));
        return ret;
      }
 
      public int nextInt() {
          int c = next();
          while (isSpaceChar(c))
              c = next();
          int sgn = 1;
          if (c == '-') {
              sgn = -1;
              c = next();
          }
          int res = 0;
          do {
              if (c < '0' || c > '9')
                  throw new InputMismatchException();
              res *= 10;
              res += c - '0';
              c = next();
          } while (!isSpaceChar(c));
          return res * sgn;
      }
 
      public boolean isSpaceChar(int c) {
          if (filter != null)
              return filter.isSpaceChar(c);
          return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
      }
 
      public interface SpaceCharFilter {
          public boolean isSpaceChar(int ch);
      }
  }
}

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

int main() {
	string s, t, u;
	int a, b;
	cin >> s >> t >> a >> b >> u;
	if (s == u)a--;
	if (t == u)b--;
	cout << a << " " << b << endl;

	return 0;
}

Measured memory_bytes: 256
n = parse(Int64, strip(readline()))
points = Complex[]
for i in 1:n
  a,b = map(x->parse(Int64, x), split(readline()))
  push!(points, a + b*1im)
end
sort!(points, by=angle)
points = vcat(points, points)

lim = 0
loc = 0+0im
best = 0
for i in 1:n
  if i != 1
    loc -= points[i-1]
  end
  while lim < i + n - 1 && abs2(loc) <= abs2(loc + points[lim+1])
    lim += 1
    loc += points[lim]
  end
  if best < abs2(loc)
    best = abs2(loc)
  end
end
println(sqrt(best))

Measured memory_bytes: 171700
#include<iostream>
#include <stdio.h>
using namespace std;
int main()
{
    char a[1000];
    char s[100000];
    int i=0;
    while(cin>>a)
    {
        getchar();
        s[i] = a[0];
        i++;
        if(a[0]=='C')
            if(a[1]=='o')
                if(a[2]=='n')
                    if(a[3]=='t')
                        if(a[4]=='e')
                            if(a[5]=='s')
                                if(a[6]=='t')
                    {
                        break;
                    }
    }
    int t=0;
    while(i--)
    {
        cout<<s[t];
        t++;
    }
    cout<<endl;
    return 0;
}


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

#define ll long long 
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define ld long double
#define ef else if
#define e else
#define loc(x) (x).begin(),(x).end() 
#define ii pair<int,int>
#define no puts("No")
#define yes puts("Yes")
#define en puts("")
#define N (int)5e5+10

int n,x,happy,cand[111],sum,c;

int main() 
{
	cin.tie(0); cout.tie(0); cin >> n >> x;
	for(int i = 0 ; i < n && scanf("%d", cand+i) ; i++);

	sort(cand,cand+n);
	sum = cand[0];

	if(sum > x) return printf("0"),0;

	happy++;

	for(int i = 1 ; i < n ; i++)
	{
		if(sum + cand[i] <= x)
		{
			c++;
			happy++;
			sum += cand[i];
			continue;
		}
		break;
	}

	if(sum < x && c == n - 1) happy--;
	printf("%d", happy);
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        boolean [] boo = new boolean [26];
        for(int i = 0; i < s.length(); i++) {
            int tmp = s.charAt(i) - 'a';
            boo[tmp] = true;
        }
        for(int i = 0; i < 26; i++) {
            if(!boo[i]) {
                System.out.println( (char)(i+'a') );
                System.exit(0);
            }
        }
        System.out.println("None");
    }
}

Measured memory_bytes: 26324
from itertools import product

N = int(input())
answers = {}
for i in range(N):
    A = int(input())
    answers[i + 1] = [tuple(map(int, input().split(' '))) for _ in range(A)]

max_people = 0

for bits in product((False, True), repeat=N):
    for index, bit in enumerate(bits, start=1):
        if not bit:
            continue

        for people, true_or_false in answers[index]:
            if bool(bits[people - 1]) != bool(true_or_false):
                break
        else:
            continue
        break
    else:
        max_people = max(max_people, bits.count(True))

print(max_people)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define ld double
#define ll long long
#define pb emplace_back
#define mk make_pair
#define mod 1000000007
#define ff first
#define ss second
#define sz(x) (int)x.size()
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define all(x) x.begin(),x.end()
ll power(ll a, ll b) {ll res = 1; a = a % mod; while (b) {if (b & 1)res = (res * a) % mod; a = (a * a) % mod; b /= 2;} return res;}
ll invmod(ll a) {return power(a, mod - 2);}
int main(void)
{
	FIO
	int t = 1;
	// cin >> t;
	while (t--)
	{
		ll n, k, x;
		cin >> n >> k;
		vector<ll>pos, neg, zero;
		for (int i = 0; i < n; i++) {
			cin >> x;
			if (x > 0) pos.pb(x);
			else if (x < 0) neg.pb(-x);
			else zero.pb(0);
		}
		ll p = sz(pos);
		n = sz(neg);
		sort(all(pos));
		sort(all(neg));
		ll z = sz(zero);
		if (p * n >= k) {
			ll l = 0, h = (1ll << 60);
			ll  ans = 0;
			while ( l <= h) {
				ll mid = l + (h - l) / 2, cnt = 0;
				ll id = n;
				for (int i = 0; i < p; i++) {
					while (id > 0 && pos[i]*neg[id - 1] >= mid)id--;
					cnt += (n - id);
				}
				// cout << mid << " " << cnt << "\n";
				if (cnt >= k) {
					ans = mid;
					l = mid + 1;
				}
				else {
					h = mid - 1 ;
				}
			}
			cout << -ans << '\n';
			return 0;
		}
		if (p * n + (p + n)*z + z * (z - 1) / 2 >= k) {
			cout << "0\n";
			return 0;
		}
		ll l = 0, h = 1e18, ans;
		k -= p * n + (p + n) * z + z * (z - 1) / 2;
		while (l <= h) {
			ll mid = l + (h - l) / 2;
			ll cnt = 0, id = p - 1;
			for (int i = 0; i < p; i++) {
				while (id > i && (pos[i]*pos[id]) > mid) {
					id--;
				}
				if (id >= i)
					cnt += (id - i);
				else break;
			}
			id = n - 1;
			for (int i = 0; i < n; i++) {
				while (id > i && (neg[i]*neg[id]) > mid) {
					id--;
				}
				if (id >= i)
					cnt += (id - i);
				else break;
			}
			if (cnt < k) {
				l = mid + 1;
			}
			else {
				ans = mid;
				h = mid - 1;
			}
		}
		cout << ans << '\n';
	}
	return 0;
}


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

public class Main {
	public static void main(String[] args) {
		try {
			InputStreamReader isr = new InputStreamReader(System.in);
			BufferedReader br = new BufferedReader(isr);

			while (true) {
				String buf = br.readLine();
				StringTokenizer st = new StringTokenizer(buf, " ");
				int H = Integer.parseInt(st.nextToken());
				int W = Integer.parseInt(st.nextToken());

				if (W == 0 && H == 0)
					break;
				if (H >= 300 && W >= 300)
					break;
				;
				for (int i = 1; i <= H; i++) {
					for (int j = 1; j <= W; j++) {
						if(i%2==0){
							if (j%2==0)
								System.out.print("#");
							else
								System.out.print(".");
						}else {
							if (j%2==0)
								System.out.print(".");
							else
								System.out.print("#");

						}
					}
					System.out.println();
				}
				System.out.println();
			}
		} catch (IOException e) {
			System.err.println(e);
		}
	}
}

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

int main(void){
    int N,K;
    cin >> N >> K;
    int l[N];
    for(int i = 0; i < N ;i++){
        cin >> l[i];
    }
    sort(l ,l+N ,greater<int>());
    int answer = 0;
    for(int i = 0; i < K ; i++){
        answer += l[i];
    }
    cout << answer << endl;
    return 0;
}

Measured memory_bytes: 3156
#include <bits/stdc++.h>
#define GET_REP(_1, _2, _3, NAME, ...) NAME
#define rep(...) GET_REP(__VA_ARGS__, irep, _rep)(__VA_ARGS__)
#define rep1(...) GET_REP(__VA_ARGS__, irep1, _rep1)(__VA_ARGS__)
#define _rep(i, n) irep (i, 0, n)
#define _rep1(i, n) irep1(i, 1, n)
#define irep(i, a, n) for (int i = a; i < (int)(n); ++i)
#define irep1(i, a, n) for (int i = a; i <= (int)(n); ++i)
#define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define rrep1(i, n) for (int i = (int)(n); i >= 1; --i)
#define allrep(X, x) for (auto &&X : x)
#define all(x) begin(x), end(x)
#ifdef LOCAL
  #include "../../Lib/cout_container.hpp"
  #define debug(x) cout << #x " => " << (x) << endl
#else
  #define debug(x) 0
#endif
using lint = long long;
constexpr int    INF  = 1 << 29;
constexpr lint   INFL = 1LL << 61;
constexpr int    MOD  = (int)1e9 + 7;
constexpr double EPS  = 1e-9;
using namespace std;
namespace { struct INIT { INIT() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(15); } } INIT; }

int main(void) {
  int n;
  cin >> n;
  vector<pair<double, string>> xu(n);
  rep (i, n) cin >> xu[i].first >> xu[i].second;
  double sum = accumulate(all(xu), 0.0, [](double acc, pair<double, string> p) { return acc + p.first * (p.second == "JPY" ? 1 : 380000); });
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 256
N, C, K = map(int, input().split())
T = [int(input()) for i in range(N)]
T.sort()
bus = 1 
passenger = 1 
p = 0 
t = T[0]
while p < N - 1:
        if T[p + 1] <= t + K and passenger < C:
                passenger += 1
        else:
                bus += 1
                passenger = 1 
                t = T[p + 1]
        p += 1
print(bus)

Measured memory_bytes: 7384
#include<stdio.h>
int main(void){
  int D,N,i,s,t=1;
  scanf("%d %d",&D,&N);
  for(i=0;i<D;i++){
    t*=100;
  }
  s=t*100;
  if(t*N % s ==0){
    printf("%d\n",t*(N+1));
  }else{
  	printf("%d\n",t*N);
  }
  return 0;
}

Measured memory_bytes: 128
/**
 *
 * AtCoder Beginner Contest 100 - Problema C: *3 or /2 (https://abc100.contest.atcoder.jp/tasks/abc100_c)
 *
 * Find the maximum number of operations that can be done in the given sequence. The multiply by
 * 3 can't be done in all elements and the results must be integers.
 *
 * Greedy solution: while there is one even number, divide it by 2 and multiply all others by 3.
 * This can be done for each factor 2 in each element (multiply by 3 don't add a new 2 factor and
 * divide by 2 eliminates one factor).
 */
#include <iostream>

using namespace std;

const int MAX { 10010 };

int as[MAX];

void solve(int N)
{
    int ans = 0;

    for (int i = 0; i < N; ++i)
    {
        while (not (as[i] & 1))
        {
            ++ans;
            as[i] /= 2;
        }
    }
    
    cout << ans << endl;
}

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

    int N;
    cin >> N;

    for (int i = 0; i < N; ++i)
        cin >> as[i];

    solve(N);

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

int main(void){
    int x1,y1,x2,y2,x3,y3,x4,y4,va,vb;
    scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
    va = x2 - x1;
    vb = y2 - y1;
    x3 = x2 - vb;
    y3 = y2 + va;
    x4 = x3 - va;
    y4 = y3 - vb;
    printf("%d %d %d %d", x3, y3, x4, y4);
}


Measured memory_bytes: 128
#include<iostream>
using namespace std;
int main(){
    int n;
    cin >> n;
for(int i=1;i<10;i++){
    for(int j=1;j<10;j++){
        if(i*j==n){
            cout << "Yes"<<endl;
            return 0;
        }

    }
}
    cout << "No"<<endl;
}

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



int main(void) 
{
	int a, b, c;
	scanf("%d %d %d", &a, &b, &c);
	int tot = a + b + c;
	int tmp = max(a, max(b, c));

	printf("%d\n", tot - tmp);




	return false;
}

Measured memory_bytes: 256
from collections import deque
k = int(input())
d = deque()
for i in range(1, 10):
    d.append(i)
while k > 1:
    k -= 1
    temp = d.popleft()
    if temp % 10:
        d.append(10 * temp + (temp % 10)-1)
    d.append(10 * temp + (temp % 10))
    if temp % 10 != 9:
        d.append(10 * temp + (temp % 10) + 1)
print(d.popleft())


Measured memory_bytes: 40816
def _input():
    n = int(input())
    a = input().split()
    foods = convrt_to_int(a)
    b = input().split()
    satisfaction = convrt_to_int(b)
    c = input().split()
    add = convrt_to_int(c)
    return foods, satisfaction, add

def convrt_to_int(array):
    int_array = []
    for i in array:
        int_array.append(int(i))
    return int_array

def calc(foods, satisfaction, add):
    counter = 0
    total = satisfaction[foods[0] - 1]
    for i in foods:
        if counter == 0:
            counter += 1
            continue
        if i == foods[counter - 1] + 1:
            option = optional(i - 1,add)
            total += satisfaction[i - 1]
            total += option
        else:
            total += satisfaction[i - 1]
        counter += 1
    return total

def optional(index, add):
    return add[index - 1]


if __name__ == "__main__":
    foods, satisfaction, add = _input()
    print(calc(foods, satisfaction, add))

Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<math.h>
#define rep(i, a) for(int i = 0; i < a; i++)
using namespace std;

int main(){
	int h, w;
	while(1){
		cin >> h >> w;
		if(h == 0 && w == 0) break;
		rep(i, h){
			rep(j, w){
				if(i == 0 || i == h-1 || j == 0 || j == w - 1)	cout << "#";
				else cout << ".";
			}
			cout << endl;
		}
	cout << endl;
	}
}

Measured memory_bytes: 1152
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main(){
    int n, k;
    cin >> n >> k;
    vector<int> a(n, 0);
    rep(i, k) {
        int d;
        cin >> d;
        rep(j, d) {
            int num;
            cin >> num;
            --num;
            ++a[num];
        }
    }
    int ans = 0;
    rep(i, n) {
        if ( a[i] == 0 ) ++ans;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    int N, M, X;
    cin >> N >> M >> X;
    vector<int> vc(N, 0);
    vector<vector<int>> va(N, vector<int>(M, 0));
    for (int i = 0; i < N; i++)
    {
        cin >> vc[i];
        for (int j = 0; j < M; j++)
        {
            cin >> va[i][j];
        }
    }

    int count = 0;
    int ans = 1e9;
    int maximum = (1 << N);
    while (count != maximum)
    {
        int sum_cost = 0;
        int tmp_count = count;
        vector<int> vu(M, 0);
        for (int i = 0; i < N; i++)
        {
            if ((tmp_count >> i) & 1)
            {
                sum_cost += vc[i];
                for (int j = 0; j < M; j++)
                {
                    vu[j] += va[i][j];
                }
            }
        }
        if (*min_element(vu.begin(), vu.end()) >= X)
        {
            ans = min(ans, sum_cost);
        }
        count++;
    }

    if (ans == 1e9)
        cout << -1 << endl;
    else
        cout << ans << endl;
    return 0;
}

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

typedef long long ll;

using Graph = vector<vector<int>>;

// 深さ優先探索
vector<bool> seen;
void dfs(const Graph &G, int v) {
	seen[v] = true;
	for (auto next_v : G[v]) { 
		if (seen[next_v]) continue;
		dfs(G, next_v); // 再帰的に探索
	}
}

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

	Graph G(N);
	for (int i = 0; i < M; ++i) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}

	int count = 0;
	seen.assign(N, false);
	for (int v=0; v<N; v++) {
		if (seen[v]) continue;
		dfs (G,v);
		count ++;
	}

	cout << count-1 << endl;
	return 0;
}

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

int main() {
  int N, M, S;
  cin >> N >> M;
  
  vector<int> A(M);
  for (int i = 0; i < M; i++) {
    cin >> A.at(i);
  }
  
  S = 0;
  for (int i = 0; i < M; i++) {
    S = S + A.at(i);
  }
  
  if ( N-S >= 0 ) {
    cout << N-S << endl;
  }
  else {
    cout << -1 << endl;
  }

}


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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  
  if(A + B == C + D){
    cout << "Balanced" << endl;
  }
  
  else if (A + B >= C + D){
    cout << "Left" << endl;
  }
  
  else{
    cout << "Right" << endl;
  }   
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define print(x)cout<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int imos[30][101010];
int main() {
  int n,c;
  cin>>n>>c;
  rep(i,n){
    int a,b,c;
    cin>>a>>b>>c;
    a--;c--;
    imos[c][a]++;
    imos[c][b]--;
  }
  rep(i,c)srep(j,1,101010)imos[i][j]+=imos[i][j-1];
  rep(i,c)srep(j,0,101010)if(imos[i][j])imos[i][j] = 1;
  
  int ans = 0;
  srep(j,0,101010){
    int cnt = 0;
    rep(i,c){
      cnt+=imos[i][j];
    }
    maxs(ans,cnt);
  }
  print(ans);
  return 0;
}

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

using namespace std;

typedef long long ll;

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

int dfs(int u, int d, int N, vector<bool>& seen, vector<vector<int>>& adj)
{
  if (d == N) { return 1; }
  int ret = 0;
  for (int v : adj[u]) {
    if (not seen[v]) {
      seen[v] = true;
      ret += dfs(v, d + 1, N, seen, adj);
      seen[v] = false;
    }
  }
  return ret;
}

int main()
{
  int N, M; scanf("%d %d", &N, &M);
  vector<vector<int>> adj(N + 5, vector<int>());
  int a, b;
  for (int i = 0; i < M; ++i) {
    scanf("%d %d", &a, &b);
    adj[a].push_back(b);
    adj[b].push_back(a);
  }

  vector<bool> seen(N + 5, 0);
  seen[1] = true;
  int ans = dfs(1, 1, N, seen, adj);
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
int main(){
    int n,m,l[51]={},a,b;
    scanf("%d%d",&n,&m);
    for(int i=0;i<m;i++){
        scanf("%d%d",&a,&b);
        l[a]++;
        l[b]++;
    }
    for(int i=1;i<=n;i++)printf("%d\n",l[i]);
    return 0;
}

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

int main(){
  int n;
  int k;
  cin >> n >> k;
  int p[n];
  int m=100000;
  for(int i=0; i<n; i++){
    cin >> p[i];
  }
  int ans=0;
  int check=0;
  for(int i=0; i<=1000; i++){
    for(int j=0; j<n; j++){
      if(i==p[j]){
	ans=ans+p[j];
	check++;
      }
      if(check==k){
	cout << ans << endl;
	return 0;
      }
    }
  }
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
typedef long long ll;

using namespace std;

const ll inf=1000000007;

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

int main()
{
    int n, ma=0;
    ll z=0;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        int x;
        scanf("%d",&x);
        if(x>ma)
        {
            ma=x;
        }
        else
        {
            z=z+ma-x;
        }
    }
    cout << z << endl;
    return 0;
}


Measured memory_bytes: 3756
//============================================================================
// Name        : JOI.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long ll;
int N;
int F[101]={};
int P[101][11]={};
int main() {
	cin>>N;
	int f1;
	for(int j=0;j<N;j++){
		for(int i=1;i<(1<<10);i=i<<1){
			cin>>f1;
			F[j]+=f1*i;
		}
	}
	for(int i=0;i<N;i++){
		for(int j=0;j<11;j++){
			cin>>P[i][j];
		}
	}
	int total=-1000000001;
	for(int i=1;i<(1<<10);i++){
		int sum=0;
		for(int j=0;j<N;j++){
			int x=F[j]&i;
			int K=0;
			for(int m=1;m<(1<<10);m=m<<1){
				if((x&m)==m)K++;
			}
			sum+=P[j][K];
		}
		total=max(total,sum);
	}

	cout<<total<<endl;
	return 0;
}


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

#define all(A) begin(A), end(A)
#define rall(A) rbegin(A), rend(A)
#define sz(A) int(A.size())

using namespace std;

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

int main () {
  ios::sync_with_stdio(false); cin.tie(0);
  int n;
  cin >> n;
  vector <int> arr(n);
  for (int i = 0; i < n; i++) cin >> arr[i];
  vector <int> s = arr;
  sort(all(s));
  for (int i = 0; i < n; i++) {
    for (int j = i; j < n; j++) {
      swap(arr[i], arr[j]);
      if (arr == s) {
        cout << "YES\n";
        return (0);
      }
      swap(arr[i], arr[j]);
    }
  }
  cout << "NO\n";
  return (0);
}


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

int main(){
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	int n;
	cin >> n;
	int m[n][n];
	memset(m,-1,sizeof(m));
	for(int i=0;i<n;i++){
		int x;
		cin >> x;
		while(x--){
			int a,b;
			cin >> a >> b;
			m[i][--a]=b;
		}
	}
	// for(int i=0;i<n;i++){
	// 	for(int j=0;j<n;j++)
	// 		cout << m[i][j] << " ";
	// 	cout << endl;
	// }
	int ans=0;
	for(int mask=(1<<n)-1;mask>=0;--mask){
		int c=0,flag=1;
		// mask=3;
		for(int i=0;i<n;i++){
			if((mask&(1<<i))>0){
				for(int j=0;j<n;j++){
					if(m[i][j]==-1)
						continue;
					bool q=(mask&(1<<j));
					if(m[i][j]!=q){
						flag=0;
						break;
					}
				}
				c++;
			}
		}
		if(flag)ans=max(c,ans);
		// break;
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(void){
    int a,b,c;
    cin >> a >> b >> c;
    int max = a;
    if(max < b)max = b;
    if(max < c)max = c;
    int res = max*3 - a - b - c;
    if(res % 2)res += 3;
    cout << res/2 << endl;
    return 0;
}

Measured memory_bytes: 256
//daddy's back in town, back to rolling the damn hash yoooo babeeeeees//
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define clock (clock() * 1000.0 / CLOCKS_PER_SEC)
#define dbg(x) cout << #x << '=' << x << '\n';
#define ll long long
#define x first
#define y second
#define pi pair <int, int>
#define vi vector <int>
#define L nod<<1
#define R ((nod<<1)|1)
#define int ll
const ll mod = (int)1e9 + 7;
int n, m, a[100010], cnt2=-1, lcm;

int32_t main(){
	ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
	mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	cin>>n>>m;
	for(int i=1; i<=n; i++){
		cin>>a[i];
		a[i]/=2;
		int xd=0, cur=a[i];
		while(cur%2==0){
			cur/=2;
			xd++;
		}
		if(cnt2==-1) cnt2=xd;
		else if(cnt2!=xd) return cout<<0, 0;
	}
	//cout<<"xd"<<endl;
	if(n==1) return cout<<(m+a[1])/(2*a[1]), 0;
	lcm=a[1]*a[2]/__gcd(a[1], a[2]);
	for(int i=3; i<=n; i++){
		lcm=lcm*a[i]/__gcd(lcm, a[i]);
		if(m+lcm<2*lcm) return cout<<0, 0;
	}
	//cout<<lcm<<endl;
	cout<<(m+lcm)/(2*lcm);
}

Measured memory_bytes: 1024
using System;
using System.Linq;

class Program
{
    static void Main()
    {
        var a = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var k = a[0];
        var x = a[1];
        var s = String.Join(" ", Enumerable.Range(x - k + 1, k * 2 - 1).ToArray());
        Console.WriteLine(s);
    }
}

Measured memory_bytes: 13396
from functools import reduce
X, Y = map(int, input().split())
MOD = 10**9 + 7

def cmb(n, r, mod):
    '''nCrを返却(modは素数であるべし)
    '''
    r = min(n-r, r)
    if r == 0: return 1
    over = reduce(lambda x, y : x*y % mod, range(n, n-r, -1))
    under = reduce(lambda x, y : x*y % mod, range(1, r+1))
    return (over * pow(under, mod-2, mod)) % mod

if 2*Y-X < 0 or 2*X-Y < 0 or (2*Y-X)%3 != 0 or (2*X-Y)%3 != 0:
    print(0)
else:
    a, b = (2*X-Y)//3, (2*Y-X)//3
    print(cmb(a+b, a, MOD))


Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
 
typedef long long LL;
typedef pair <int,int> pii;
const double pi = acos(-1.0);
const double eps = 1e-8;
const int mod = 1e9 + 7;
const int inf = 1e9;
const LL INF = 1e18;
const int N = 1e5 + 5;
 
const int level = 62;
 
int main() {
  ios_base::sync_with_stdio(0); cin.tie(0);
  #ifdef LOCAL
    freopen("input.txt", "r", stdin);
  #endif
  int n;
  LL k;
  cin >> n >> k;
 
  vector <int> a (n + 1);
  for (int i = 1; i <= n; i++) cin >> a[i];
 
  vector <vector <int> > nxt (n + 1, vector <int> (65, -1));
  for (int i = 1; i <= n; i++) nxt[i][0] = a[i];
  for (int i = 1; i <= level; i++) {
    for (int node = 1; node <= n; node++) {
      nxt[node][i] = nxt[nxt[node][i - 1]][i - 1];
    }
  }
 
  int cur = 1;
  for (int i = 0; i <= 62; i++) {
    if ((k >> i)&1) cur = nxt[cur][i];
  }
 
  cout << cur << endl;
  return 0;
}

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

int main(){
  int n;
  cin >> n;
  float a[n];
  for(int i = 0;i<n;i++){
    cin >> a[i];
  }
  sort(a,a+n);
  for(int i = 0;i<n-1;i++){
    a[i+1] = (a[i] + a[i+1])/2;
  }
  cout << setprecision(10) << a[n-1] << endl;

}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int counter(int x, int y, int z) {
    if (x == y && x == z)
        return 1;
    if (x != y && x != z && y != z)
        return 6;
    return 3;
}

int the_sol(int ind) {
    int sum = 0;
    for (int x = 1; x * x <= ind; x++) {
        for (int y = x; y * y <= ind; y++) {
            for (int z = y; z * z <= ind; z++) {
                if (x * x + y * y + z * z + x * y + x * z + y * z == ind)
                    sum += counter(x, y, z);
            }
        }
    }
    return sum;
}
int main() {
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++)
        cout << the_sol(i) << "\n";
    return 0;
}

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

using namespace std;

int main()
{
  int W[11], K[11];
  for(int i = 0; i < 10; i++) cin >> W[i];
  for(int i = 0; i < 10; i++) cin >> K[i];
  sort(W, W + 10);  sort(K, K + 10);
  cout << W[9] + W[8] + W[7] << " " << K[9] + K[8] + K[7] << endl;
  return 0;
}

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

int main(){

  int N, inp_n;
  priority_queue<int> pq;
  // input
  cin >> N;
  rep(i, N){
    cin >> inp_n;
    pq.push(inp_n);
  }

  int first, second;
  bool isAble = true;
  first = pq.top();
  pq.pop();
  rep(i,N-1){
    second = pq.top();
    pq.pop();
    if(first == second){
      isAble = false;
      break;
    }else{
      first = second;
    }
  }
  if (isAble) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}

Measured memory_bytes: 1400
N,K=map(int,input().split())
A=list(map(int,input().split()))
p=[0]*(N+1)
m=[0]*(N+1)
for i in range(N):
    p[i+1]=p[i]
    m[i+1]=m[i]
    if A[i]>0:
        p[i+1]+=A[i]
    elif A[i]<0:
        m[i+1]-=A[i]
a=10**15
for i in range(N-K+1):
    a=min(a,p[i+K]-p[i],m[i+K]-m[i])
print(p[N]-a)

Measured memory_bytes: 14576
s = input()
ans = 105
from string import ascii_lowercase
for c in ascii_lowercase:
    t = s
    anstemp = 0
    while True:
        tmp = ''
        if t.count(c) == len(t): break
        for i in range(len(t)-1):
            if c in t[i:i+2]: tmp += c
            else: tmp += t[i]
        anstemp += 1
        t = tmp
    if anstemp < ans: ans = anstemp
print(ans)

Measured memory_bytes: 3768
def euclid(m, n):
    m0 = m = abs(m)
    n0 = n = abs(n)
    while n != 0:
        m, n = n, m % n
    qm = m0 // m
    lcm = qm * n0
    return lcm

# ABC070C
n = int(input())
ans = 1
for i in range(n):
    t = int(input())
    ans = euclid(ans, t)
print(ans)


Measured memory_bytes: 3060
var rows = require("fs").readFileSync("/dev/stdin", "utf8").split("\n")

var A = parseFloat(rows[0].split(" ")[0])
var B = parseFloat(rows[0].split(" ")[1])

var isPrime = function (n) {
  if (n === 1) return false
  if (n === 2) return true
  if (n === 3) return true

  var sqrtn = Math.sqrt(n)

  for (var i = 2; i < sqrtn + 1; i++) {
    if (n % i === 0) return false
  }

  return true
}
var getPrimeFactors = function (n) {
  var sqrtn = Math.sqrt(n)
  var res = {}

  for (var i = 1; i < sqrtn + 1; i++) {
    if (n % i !== 0) continue

    var I = parseInt(n / i, 10)

    if (isPrime(i)) res[i] = true
    if (isPrime(I)) res[I] = true
  }

  return res
}
var getIntersection = function (S1, S2) {
  var res = {}
  var Base = Object.keys(S1) < Object.keys(S2) ? S1 : S2

  for (var key in Base) {
    if (S1[key] && S2[key]) res[key] = true
  }

  return res
}
var size = function (S) {
  return Object.keys(S).length
}
var commonPrimeFactors = getIntersection(getPrimeFactors(A), getPrimeFactors(B))

console.log(size(commonPrimeFactors) + 1)


Measured memory_bytes: 21064
#include <bits/stdc++.h>
#define endl '\n'
#define pb push_back
#define mp make_pair
#define LL long long
#define INF 0x3f3f3f3f
#define Inf 1000000000000000000LL
#define F first
#define S second
using namespace std;
typedef pair<int,int>pii;
int n;
int main(){
	cin>>n;
	double m=double(n)/3;
	printf("%.12f\n",m*m*m);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_int.hpp>
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E15;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
////////////////////////////


 
int main(){fastio
    
    ll a,b;cin>>a>>b;
    if(a>=10||b>=10){
        cout<<-1<<endl;
    }else{
        cout<<a*b<<endl;
    }
    
    return 0;
}


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

const int INF = 1234567890;
const int MAX_N = 200005;
vector<int> v, ans;
vector<int> g[MAX_N];
int dp[MAX_N];


void dfs(int from, int p=-1) {
  int i = lower_bound(dp, dp+MAX_N, v[from])-dp;
  int old = dp[i];
  dp[i] = v[from];
  ans[from] = i;
  if (p != -1) ans[from] = max(ans[from], ans[p]);
  for (auto to : g[from]) {
    if (to == p) continue;
    dfs(to, from);
  }
  dp[i] = old;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  v = ans = vector<int>(n);
  rep(i, n) cin >> v[i];
  rep(i, n-1) {
    int u, v;
    cin >> u >> v;
    --u, --v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  rep(i, MAX_N) dp[i] = INF;
  dp[0] = 0;
  dfs(0);
  rep(i, n) cout << ans[i] << endl;
}

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

#define pout(n)  printf ("%d\n", n)

#define rep(i,a,n) for (int i = a;i < n;i++)
#define per(i,n,a) for (int i = n-1;i >= a;i--)

const int d4x[4] = {1, 0, -1, 0};
const int d4y[4] = {0, 1, 0, -1};
const int d8x[8] = { 1,1,0,-1,-1,-1,0,1 };
const int d8y[8] = { 0,1,1,1,0,-1,-1,-1 };

typedef long long ll;
using namespace std;

int main() {
  ll n;
  int a,b;
  cin >> n >> a >> b;
  int c = n,d = 0;
  int ans = 0;

  rep(i,1,n+1){
    ans = 0;
    c = i;
    rep(j,0,5){
      ans += c%10;
      c /= 10;
    }
    if(a <= ans && ans <= b) d += i;
  }
  pout(d);
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<tuple>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define Per(i,sta,n) for(int i=n-1;i>=sta;i--)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;

ll n,x,d;
unordered_map<ll,vector<LP>> D; 

void solve(){
    cin >> n >> x >> d;
    if (d==0){
        if (x==0){
            cout << 1 << endl;
            return;
        }
        cout << n+1 << endl;
        return;
    }
    if (d<0){
        x=(n-1)*d+x;
        d*=-1;
    }
    for(ll i=0;i<=n;i++){
        D[i*x%d].push_back(LP(i*(i-1)*d/2+i*x,0));
        D[i*x%d].push_back(LP(i*(2*n-i-1)*d/2+i*x,1));
    }
    ll ans=0;
    for(auto L:D){
        sort(L.second.begin(),L.second.end());
        int a=0;
        ll fir;
        for(LP p:L.second){
            //cout << p.first <<" " << p.second << endl;
            if(p.second==0){
                if(a==0) fir=p.first;
                a+=1;
            }
            else{
                if(a==1) ans+=(p.first-fir)/d+1;
                a-=1;
            }
            //cout << ans << endl;
        }
    }
    cout << ans << endl;
}

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

Measured memory_bytes: 21064
#include <stdio.h>
int main(){
  int c ,d ,l ,jp ,mp ,day=0;
  scanf( "%d" ,&l );
  scanf( "%d" ,&jp );
  scanf( "%d" ,&mp );
  scanf( "%d" ,&c );
  scanf( "%d" ,&d );
  while( 1 ){
    if( jp <= 0 && mp <= 0 ){
      break;
    }
    jp -= c;
    mp -= d;
    day++;
  }

  printf( "%d\n" ,l-day );
  return 0;
}

Measured memory_bytes: 596