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

#define int long long
#define REP(i, l, r) REPEAT(i,l,r,true) // [l, r)
#define rep(i, n) REP(i,0,n)           // [0, n)
#define REPEAT(i, l, r, condition) for(int i=(condition)?l:r-1;(condition)?i<r:i>=l;(condition)?++i:--i) // false<-[l, r)->true
#define all(e) e.begin(),e.end()
#define rall(e) e.rbegin(),e.rend()
#define pb push_back
#define fs first
#define sc second
#ifdef LOCAL
#define show(...) cerr<<#__VA_ARGS__<<" = ";_DEBUG(__VA_ARGS__)
#define showlr(n, l, r) cerr<<#n<<" = ";for(int i=l;i<r;i++){cerr<<n[i]<<", ";}cerr<<endl // [l, r)
#else
#define show(...) true
#define showlr(n,l,r) true
#endif

#define YN(condition) puts((condition)?"YES":"NO")
#define Yn(condition) puts((condition)?"Yes":"No")
#define yn(condition) puts((condition)?"yes":"no")
#define YES puts("YES")
#define Yes puts("Yes")
#define yes puts("yes")
#define NO  puts("NO")
#define No  puts("No")
#define no  puts("no")

#define case(i) printf("Case #%lld: ",i)

using namespace std;

using vi=vector<int>;
using pint=pair<int, int>;

struct io {
    io() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout.tie(0);
        cout << fixed << setprecision(20);
    }
} io;

template<class T>
istream &operator>>(istream &is, vector<T> &v) {
    for (T &e:v)is >> e;
    return is;
}

template<class T>
ostream &operator<<(ostream &os, vector<T> v) {
    os << "{";
    for (T &e:v)os << e << (v.size() - (int) (&e - &v[0]) > 1 ? ", " : "");
    os << "}";
    return os;
}

void _DEBUG() {}

template<typename H, typename... T>
void _DEBUG(H a, T...b) {
    cerr << a << (sizeof...(b) ? "," : "\n");
    _DEBUG(b...);
}

inline void in() {}

template<typename H, typename... T>
void in(H &a, T &... b) {
    cin >> a;
    in(b...);
}

inline void out() {}

template<typename H, typename... T>
void out(H a, T... b) {
    cout << a << (sizeof...(b) ? " " : "\n");
    out(b...);
}

template<class T>
void resz(int n, T &v) { v.resize(n); }

template<class H, class... T>
void resz(int n, H &a, T &... b) {
    a.resize(n);
    resz(n, b...);
}

template<typename V, typename H>
void resize(vector<V> &v, const H a) { v.resize(a); }

template<typename V, typename H, typename... T>
void resize(vector<V> &v, const H &a, const T... b) {
    v.resize(a);
    for (auto &v:v) resize(v, b...);
}

const int INF = 1LL << 55;
const int MOD = 1000000007;
const double EPS = 1e-8;

/*------------end of definitions------------*/

int K, X;

signed main() {

    in(K, X);
    REP(i, X - K + 1, X + K) {
        cout << i << " ";
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 256
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <list>
#include <stack>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#include <functional>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   vi   vector<int> 
#define   co(x)  cout << x << '\n' 
#define   dbg(x)  cerr << #x << " = " << x << '\n' 
#define   bitcount(x)  (int)__builtin_popcount(x) 
#define   sz(x)  (int)x.size()
#define   all(a) a.begin(),a.end() 
#define   ff   first
#define   ss   second
#define   pii  pair<int,int> 
#define   lcm(a,b) (a*b)/__gcd(a,b) 
using namespace std;

inline void solve(){
    int n,ans = 0; 
    cin>>n; 
    co(!n); 
}

signed main()
{
    int n=1; // cin>>n;
    while (n--) solve();
    return 0;
}


Measured memory_bytes: 3632
import java.util.*;

public class Main {
    public static void main(String[] args) {
        try(Scanner scn = new Scanner(System.in)) {
            int sum = scn.nextInt() + scn.nextInt() + scn.nextInt() + scn.nextInt();
            System.out.println(sum / 60);
            System.out.println(sum % 60);
        }
    }
}

Measured memory_bytes: 26264
import java.util.*; import java.io.*; import java.math.*;
public class Main{
	//Don't have to see. start------------------------------------------
	static class InputIterator{
		ArrayList<String> inputLine = new ArrayList<String>(1024);
		int index = 0; int max; String read;
		InputIterator(){
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			try{
				while((read = br.readLine()) != null){
					inputLine.add(read);
				}
			}catch(IOException e){}
			max = inputLine.size();
		}
		boolean hasNext(){return (index < max);}
		String next(){
			if(hasNext()){
				return inputLine.get(index++);
			}else{
				throw new IndexOutOfBoundsException("There is no more input");
			}
		}
	}
	static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
	static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
	static PrintWriter out = new PrintWriter(System.out);
	static void flush(){out.flush();}
	static void myout(Object t){out.println(t);}
	static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
	static String next(){return ii.next();}
	static boolean hasNext(){return ii.hasNext();}
	static int nextInt(){return Integer.parseInt(next());}
	static long nextLong(){return Long.parseLong(next());}
	static double nextDouble(){return Double.parseDouble(next());}
	static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
	static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
	static ArrayList<Integer> nextIntArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Integer.parseInt(input.get(i)));
		}
		return ret;
	}
	static ArrayList<Long> nextLongArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Long.parseLong(input.get(i)));
		}
		return ret;
	}
	static String myconv(Object list, int no){//only join
		String joinString = CONVSTR.get(no);
		if(list instanceof String[]){
			return String.join(joinString, (String[])list);
		}else if(list instanceof ArrayList){
			return String.join(joinString, (ArrayList)list);
		}else{
			throw new ClassCastException("Don't join");
		}
	}
	static ArrayList<String> myconv(String str, int no){//only split
		String splitString = CONVSTR.get(no);
		return new ArrayList<String>(Arrays.asList(str.split(splitString)));
	}
	public static void main(String[] args){
		CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
		solve();flush();
	}
	//Don't have to see. end------------------------------------------
	static void solve(){//Here is the main function
      ArrayList<String> s = nextCharArray();
      ArrayList<String> t = nextCharArray();
      Collections.sort(s);
      Collections.sort(t, Comparator.reverseOrder());
      String ns = myconv(s, 0);
      String nt = myconv(t, 0);
      myerr(ns);
      myerr(nt);
      myout((ns.compareTo(nt) <= -1) ? "Yes" : "No");
	}
	//Method addition frame start



	//Method addition frame end
}


Measured memory_bytes: 33444
import sys

readline = sys.stdin.readline

N, M = map(int, readline().split())

A = list(map(int, readline().split()))

BC = [list(map(int, readline().split())) for i in range(M)]


A.sort()
BC.sort(key=lambda x:-x[1])

i = 0
total = 0

for b, c in BC:
    if i >= len(A):
        break
    for j in range(b):
        if i >= len(A):
            break
        total += max(A[i], c)
        i += 1

while i < len(A):
    total += A[i]
    i += 1

print(total)


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

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyScanner in = new MyScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        abc076_c solver = new abc076_c();
        solver.solve(1, in, out);
        out.close();
    }

    static class abc076_c {
        public void solve(int testNumber, MyScanner in, PrintWriter out) {
            String S = in.next();
            String T = in.next();

            String ans = "UNRESTORABLE";
            int sl = S.length();
            int tl = T.length();
            int idx = -1;
            for (int i = 0; i <= sl - tl; i++) {
                String s = S.substring(i, i + tl);
                boolean f = true;
                for (int j = 0; j < tl; j++) {
                    char c1 = s.charAt(j);
                    char c2 = T.charAt(j);
                    if (c1 != '?' && c1 != c2) {
                        f = false;
                        break;
                    }
                }
                if (f) {
                    idx = i;
                }
            }
            if (idx < 0) {
                out.println(ans);
                return;
            }
            StringBuilder sb = new StringBuilder(S);
            sb.replace(idx, idx + tl, T);
            out.println(sb.toString().replace('?', 'a'));
        }

    }

    static class MyScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public MyScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    return null;
                }
            }
            return st.nextToken();
        }

    }
}



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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i < (n); i++)
#define all(a) begin(a),end(a)
template<class T> istream& operator >> (istream& s, vector<T>& v)
{ for (T& x: v) { s >> x; } return s;}
#define FMT(a) #a<<":"<<a 
#define FMT2(a,b) #a<<":"<<a<<", "<<#b<<":"<<b 
#define FMT3(a,b,c) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c 
#define FMT4(a,b,c,d) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c<<", "<<#d<<":"<<d 

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

    int N, M; cin >>N>>M;

    vector<int> X(M); cin >> X;
    sort(all(X));

    vector<int> dX(M-1);
    rep(i, M-1) {
        dX[i] = X[i + 1] - X[i];
    }
    sort(all(dX), greater<int>());

    int ans = accumulate(min(dX.begin() + N - 1, dX.end()), dX.end(), 0);

    //cout << ans << endl;
    printf("%d\n", ans);
}


Measured memory_bytes: 1024
#include<stdio.h>
#include<string.h>
#define LEN 100005

typedef struct pp{
  char name[100];
  int t;
}P;

void enqueue(P);
P dequeue();

P Q[LEN+1];
int head, tail, n;

int main(){
  int elaps = 0, c=0;
  int i=0, q;
  P u;

  scanf("%d %d", &n, &q);

  for ( i = 1; i <= n; i++){
    scanf("%s", Q[i].name);
    scanf("%d", &Q[i].t);
  }
  head = 1;
  tail = n;

  while(elaps<n){

    u = dequeue();

    if(u.t<=q){
      c+=u.t;
      printf("%s %d\n",u.name,c);
      elaps++;
    }
    else{
      c+=q;
      u.t -= q;
      enqueue(u);
    }
    i++;
  }
  return 0;
}
void enqueue(P x){
  
  if(tail == n)tail = 1;
  else tail++;
  Q[tail] = x;
}
P dequeue(){
  P x;

  x = Q[head];
  if(head == n)head = 1;
  else head++;

  return x;
}
    

Measured memory_bytes: 6740
#include<cstdio>
long long s(long long n){
    long long ans=0, m;
    for(m=n;m>0;m/=10)ans += m - (m/10)*10;
    return ans;
}
int main(){
    int k,i;
    long long n=1,d=1;
    scanf("%d",&k);
    printf("1\n");
    for(i=1;i<k;i++){
        if(s(n+d)*(n+10*d)<s(n+10*d)*(n+d))d*=10;
        n+=d;
        printf("%lld\n",n);
    }
    return 0;
}

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


int main() {
	int n;
	cin >> n;
	int ans = 0;
	for (int i = 1; i <= n ; i +=2)
	{
		int tmp = 0;
		for (int j = 1; j <= i; j++)
		{
			if (i%j==0)
			{
				tmp++;
			}
		}
		if (tmp==8)
		{
			ans++;
		}
	}
	cout << ans << endl;

}

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

int main() {
  string S;
  cin >> S;

  int MojiNagasa = S.size();
  bool flag = true;

  if (S[0]!='A') flag = false;

  int count = 0;
  rep(i, 1, MojiNagasa) {
    if (isupper(S[i])) {
      if (i==1 || i==MojiNagasa-1 || S[i]!='C') flag = false;
      count++;
    }
  }
  if (count != 1) flag = false;

  cout << ( flag ? "AC" : "WA" ) << endl;
}


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

#define rep(i,n) for(int i=0;i<(n);i++)
#define dbg(S) { int f=1; for(auto x:S) cerr<<(f?"[":", ")<<x, f=0; cerr<<"]\n"; }

using namespace std;
using lint=long long;

int main(){
	lint n,k; cin>>n>>k;

	if(2*k>n+1){
		cout<<-1<<'\n';
		return 0;
	}

	vector<lint> a(n),b(n),c(n);
	rep(i,n){
		c[i]=k+2*n+i;
	}

	rep(i,k-1){
		b[n-k+i+1]=k+2*n-i-1;
	}
	rep(i,n-k+1){
		b[i]=k+2*n-k-i;
	}

	vector<pair<lint,int>> p(n);
	rep(i,n){
		p[i]={c[i]-b[i],i};
	}
	sort(p.begin(),p.end());
	rep(i,n){
		a[p[i].second]=k+i;
	}

	rep(i,n){
		cout<<a[i]<<' '<<b[i]<<' '<<c[i]<<'\n';
	}

	return 0;
}


Measured memory_bytes: 6144
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 int a,b;
  string o;
  cin>>a>>o>>b;
  if(o == "+"){
    cout<<a+b<<endl;  
  }
  if(o == "-"){
    cout<<a-b<<endl;  
  }
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;

int main() {
  int n;
  cin >> n;
  vector<int> a;
  for (int i = 0; i < n; i++) {
    int e;
    cin >> e;
    if (a.empty() || a.back() != e) a.push_back(e);
  }
  n = a.size();

  vector<int> v(n, n);
  {
    map<int, int> m;
    for (int i = n - 1; i >= 0; i--) {
      if (m.count(a[i])) {
        v[i] = m[a[i]];
      }
      m[a[i]] = i;
    }
  }

  vector<ll> dp(n + 1);
  dp[0] = 1;
  for (int i = 0; i < n; i++) {
    dp[i + 1] += dp[i];
    dp[i + 1] %= mod;
    dp[v[i]] += dp[i];
    dp[v[i]] %= mod;
  }
  cout << dp[n - 1] << endl;
}


Measured memory_bytes: 11252
#include <bits/stdc++.h>
using Int = long long;  // clang-format off
#define REP_(i, a_, b_, a, b, ...) for (Int i = (a), lim##i = (b); i < lim##i; i++)
#define REP(i, ...) REP_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define ALL(v) std::begin(v), std::end(v)
struct SetupIO { SetupIO() { std::cin.tie(nullptr), std::ios::sync_with_stdio(false), std::cout << std::fixed << std::setprecision(13); } } setup_io;
#ifndef dump
#define dump(...)
#endif  // clang-format on

/**
 *    author:  knshnb
 *    created: Sun Sep 20 21:00:57 JST 2020
 **/

struct UnionFind {
    int cnt;                  // 集合の数
    std::vector<int> number;  // 0以上のとき親のindex, 負のときは集合サイズ
    UnionFind(int n) : cnt(n), number(n, -1) {}
    int root(int x) { return number[x] < 0 ? x : number[x] = root(number[x]); }
    void unite(int x, int y) {
        x = root(x), y = root(y);
        if (x == y) return;
        if (number[y] < number[x]) std::swap(x, y);
        // yをxにマージ
        number[x] += number[y];
        number[y] = x;
        cnt--;
    }
    bool is_same(int x, int y) { return root(x) == root(y); }
    int size(int x) { return -number[root(x)]; }
};

std::mt19937 rnd(std::chrono::steady_clock::now().time_since_epoch().count());

using pii = std::pair<Int, Int>;
signed main() {
    Int n;
    std::cin >> n;
    UnionFind uf(n);
    std::vector<Int> X(n), Y(n), xrev(n), yrev(n);
    REP(i, n) {
        std::cin >> X[i] >> Y[i], X[i]--, Y[i]--;
        xrev[X[i]] = i, yrev[Y[i]] = i;
    }
    std::set<Int, std::greater<Int>> s;
    REP(x, n) {
        Int i = xrev[x];
        auto it = s.upper_bound(Y[i]);
        if (it == s.end()) {
            s.insert(Y[i]);
        } else {
            while (1) {
                uf.unite(i, yrev[*it]);
                if (*it == *std::prev(s.end())) break;
                s.erase(it);
                it = s.upper_bound(Y[i]);
            }
        }
    }
    REP(i, n) std::cout << uf.size(i) << "\n";
}


Measured memory_bytes: 13644
#include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>

#define MP make_pair
#define PB push_back
#define ALL(x) (x).begin(),(x).end()
#define REP(i,n) for(int i=0;i<(n);i++)
#define REP1(i,n) for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n) for(int i=(n);i>=0;i--)
#define CLR(a) memset((a),0,sizeof(a))
#define MCLR(a) memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;

const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;

const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};


struct edge {
    LL to, cost;
    edge(LL _to, LL _cost) {to = _to; cost=_cost;}
};
typedef pair<LL, LL> P;


int main(){
    int N,tmp;
    LL all_num = 0;
    VI a;
    cin >> N;
    REP(i, N){
        cin >> tmp;
        all_num += tmp;
        a.PB(tmp);
    }

    LL ans = INFL;
    LL now = 0;
    REP(i, N - 1){
        now += a[i];
        ans = min(ans, abs((all_num - now) - now));
    }

    cout << ans << endl;
}


Measured memory_bytes: 1400
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdint.h>
#include <tuple>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-12;
static const double PI = acos(-1.0);
static const ll MOD = 1000000007;

#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(a) (a).begin(), (a).end()
#define DEBUG(x) cout << #x << ": " << x << endl

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

void solve(long long N) {
  auto m = prime_factor(N);
  ll ans = 0;
  for (auto i = begin(m); i != end(m); i++) {
    ll x = i->second;
    ll cur = 1;
    while (true) {
      if (x >= cur) {
        x -= cur;
        cur++;
        ans++;
      } else {
        break;
      }
    }
  }
  cout << ans << endl;
}

int main() {
  long long N;
  scanf("%lld", &N);
  solve(N);
  return 0;
}


Measured memory_bytes: 3696
#include <cstdio>
#include <cmath>

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

    double x[n], y[n];
    for(int i = 0; i < n; i++){
        scanf("%lf", &x[i]);
    }
    for(int i = 0; i < n; i++){
        scanf("%lf", &y[i]);
    }

    int p[3] = {1, 2, 3};
    double distance[n], sum, max;

    for(int i = 0; i < 3; i++){
        sum = 0;
        for(int j = 0; j < n; j++){
            sum += pow(fabs(y[j] - x[j]), p[i]);
        }
        printf("%lf\n", pow(sum, 1.0/p[i]));
    }

    for(int i = 0; i < n; i++){
        distance[i] = fabs(y[i] - x[i]);
    }

    max = distance[0];

    for(int i = 0; i < n; i++){
        if(max < distance[i]) max = distance[i];
    }

    printf("%lf\n", max);
    return 0;
}

Measured memory_bytes: 1144
#include "bits/stdc++.h"
using namespace std ;


#define PI 3.14159265 

int main(){
	double  a  ,  b  , x , X , ans   ;
	cin >> a >> b >> x ;
	X = 0.5* a*a*b ;
	if( x  > X ){
		ans = a*a*a*0.5 ;
		ans = ans /(a*a*b - x);
		// ans = atan(ans);
	}
	else{
		ans = (2*x)/(a*b*b) ;
		// ans = atan(ans);
	}
	ans = atan(ans)*180.0 ;
	ans = ans/ PI ;
	printf("%lf\n",90.0-ans);	



	return 0 ;
}

Measured memory_bytes: 256
from sys import stdin
S = (stdin.readline().rstrip())
if S == "SUN":
    print(7)
elif S == "MON":
    print(6)
elif S == "TUE":
    print(5)
elif S == "WED":
    print(4)
elif S == "THU":
    print(3)
elif S == "FRI":
    print(2)
else:
    print(1)

Measured memory_bytes: 3060
if __name__ == '__main__':
	N,K = map(int, input().split())
	S = input()
	nums = []
	if(S[0]=='0') : 
		nums.append(0)
	i=0
	while i < N:
		j = i
		while j<N and S[j]==S[i] :
			j+=1
		nums.append(j-i)
		i=j


	if(S[N-1]=='0') :
		nums.append(0)
	
	sums=[0] * (len(nums)+1)
	for i in range(len(nums)):
		sums[i+1] = sums[i] + nums[i]

	window_size = 2*K + 1
	ans=0
	l = 0
	while l < len(sums):
		r = l + window_size
		if(r>=len(sums)):
			r = len(sums)-1
		ans = max(ans,sums[r] - sums[l])
		l+=2

	print(ans)

Measured memory_bytes: 7884
process.stdin.resume();
    process.stdin.setEncoding('utf8');

    process.stdin.on('data', function (chunk) {
        var numbers = chunk.toString().split(' ');
        var a = parseInt(numbers.pop());
        var c = a*(a+1)/2;

        process.stdout.write(c.toString());    

        process.exit();
    });

Measured memory_bytes: 21064
#include <iostream>
#include <string>
#include <set>
using namespace std;
int main(){
    int a; cin >> a;
    string s; cin >> s;
    int ans = 0;
    for(int i = 1; i < s.size(); i++){
        string a = s.substr(0,i);
        string b = s.substr(i);
        set<char> ast; for(char c:a) ast.insert(c);
        set<char> bst; for(char c:b) bst.insert(c);
        int cnt = 0;
        for(auto it = ast.begin(); it != ast.end(); ++it){
            if(bst.find(*it) != bst.end()){
                cnt++;
            }
        }
        ans = max(ans, cnt);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {
	  public static void main(String args[]) {
		    Scanner scanner = new Scanner(System.in);

		    String a = scanner.next();
		    String b = scanner.next();
		    int A = Integer.parseInt(a);
		    int B = Integer.parseInt(b);
		    int N = B - A - 1;
		    int Height = ( N * N + N )/2;
		    int Depth = Height - A ;
		    
		    System.out.println(Depth);
		    
        	scanner.close();}
		  }

Measured memory_bytes: 21844
#include<bits/stdc++.h>
#define rep(i,a,...) for(int i = (a)*(strlen(#__VA_ARGS__)!=0);i<(int)(strlen(#__VA_ARGS__)?__VA_ARGS__:(a));++i)
#define per(i,a,...) for(int i = (strlen(#__VA_ARGS__)?__VA_ARGS__:(a))-1;i>=(int)(strlen(#__VA_ARGS__)?(a):0);--i)
#define foreach(i, n) for(auto &i:(n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll << (x))
using ll = long long;
//const ll MOD = (ll)1e9+7;
const ll MOD = 998244353;
const int INF = (ll)1e9+7;
const ll INFLL = (ll)1e18;
using namespace std;
template<class t>
using vvector = vector<vector<t>>;
template<class t>
using vvvector = vector<vector<vector<t>>>;
template<class t>
using priority_queuer = priority_queue<t, vector<t>, greater<t>>;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}
#ifdef DEBUG
#define debug(x) cout<<"LINE "<<__LINE__<<": "<<#x<<" = "<<x<<endl;
#else
#define debug(x) (void)0
#endif

ll modpow(ll x, ll b){
  ll res = 1;
  while(b){
    if(b&1)res = res * x % MOD;
    x = x * x % MOD;
    b>>=1;
  }
  return res;
}

ll modinv(ll x){
  return modpow(x, MOD-2);
}

bool was_output = false;
template<class t>
void output(t a){
  if(was_output)cout << " ";
  cout << a;
  was_output = true;
}
void outendl(){
  was_output = false;
  cout << endl;
}
ll in(){
  ll res;
  scanf("%lld", &res);
  return res;
}

template<class t>
istream& operator>>(istream&is, vector<t>&x){
  for(auto &i:x)is >> i;
  return is;
}

template<class t, class u>
istream& operator>>(istream&is, pair<t, u>&x){
  is >> x.first >> x.second;
  return is;
}

template<class t>
void in(t&x){
  cin >> x;
}

template<class t>
void out(t x){
  cout << x;
}

template<class t>
vector<t> sorted(vector<t> line,function<bool(t,t)> comp=[](t a,t b){return a<b;}){
  sort(line.begin(),line.end(),comp);
  return line;
}

template<class t>
vector<t> reversed(vector<t> line){
  reverse(line.begin(),line.end());
  return line;
}

int main(){
  int n = in();
  int m = in();
  vector<int> line(n);
  foreach(i,line)i=in();
  int sum = 0;
  foreach(i,line)sum+=i;
  int cnt = 0;
  foreach(i,line){
    if(i*4*m>=sum)++cnt;
  }
  if(cnt>=m)cout<<"Yes"<<endl;
  else cout << "No" << endl;
  return 0;
}


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

namespace Sample101
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');

            int N = int.Parse(str[0]);
            int x = int.Parse(str[1]);

            // 喜ぶ個数
            int[] ai = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();

            // 喜ぶ個数を渡す人数
            int result = 0;

            Array.Sort(ai);
            int num = 0; // お菓子の数

            for (int j = 0; j < N; ++j)
            {
                int count = 0;
                num = x;
                for (int i = j; i < N; ++i)
                {
                    if (num < ai[i])
                    {
                        continue;
                    }
                    num -= ai[i];
                    count++;
                    if (i == N - 1 && num != 0)
                    {
                        count--;
                    }
                }
                if (count > result)
                {
                    result = count;
                }
            }


            Console.WriteLine(result);
        }
    }
}

Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define REP(i,b) FOR(i,0,b)
#define MP make_pair
#define PB push_back

using ll=long long;
using pii=pair<int,int>;
using vi=vector<int>;
using ld=long double;

int read(){
	int i;
	scanf("%d",&i);
	return i;
}

int main(){
	ld n=read(),k=read();
	ld ans=sin(M_PI*2.0/n)/2;
	ld a=sin(M_PI/n);
	ld b=a/tan(M_PI*(0.5-(k-1)/n));
	ans-=a*b;
	cout<<fixed<<setprecision(10)<<ans*n<<endl;
}

Measured memory_bytes: 3668
N = int(input())
A = tuple(map(int, input().split(" ")))

m = 0
c = 0
for i in range(N):
	m += A[i]
	# print(m)
	if i%2 == 0:
		if m <= 0:
			c += abs(m)+1
			m += abs(m)+1
	else:
		if m >= 0:
			c += m+1
			m -= m+1
	# print(m, c)
# print(c)

m = 0
d = 0
for i in range(N):
	m += A[i]
	# print(m)
	if i%2 == 1:
		if m <= 0:
			d += abs(m)+1
			m += abs(m)+1
	else:
		if m >= 0:
			d += m+1
			m -= m+1
	# print(m, d)

print(min(c, d))

Measured memory_bytes: 14596
A = list(input())

for i in range(2**3):
  tmp=A[:]
  for j in range(3):
    if (i>>j)&1:
      tmp[j]+="-"
    else:
      tmp[j]+="+"
  if eval("".join(tmp)) == 7:
    tmp[-1]+="=7"
    for s in tmp:
      print(s,end="")
    exit()

Measured memory_bytes: 3060
import scala.io.StdIn._
object Main extends App {
  val Array(r, s, p) = readLine.trim.split(' ').map(_.toInt)
  val times = Array.tabulate(p){_ ⇒
    val Array(i, j) = readLine.trim.split(' ').map(_.toInt)
    if (j > s) j - s + r - i + 1 else s - j + 2 + r - i
  }
  println(times.sorted.foldLeft(0){case (acc, t) ⇒ if (acc < t) t else acc + 1})
}



Measured memory_bytes: 458196
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

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

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL


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

    int n;
    cin >> n;

    vs32 A(n);
    rep (i, n) A[i] = i + 1;

    vs32 P(n), Q(n);
    rep (i, n) cin >> P[i];
    rep (i, n) cin >> Q[i];    

    int a, b;
    int cnt = 1;
    do
    {
        if (A == P) a = cnt;
        if (A == Q) b = cnt;
        ++cnt;
    } while (next_permutation(A.begin(), A.end()));


    cout << abs(a - b) << "\n";
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N = 500005, mod = 1e9 + 7;
int f[N] = {1};
int qp(int a, int b) {
	int ans = 1;
	while (b) {
		if (b & 1)
			ans = ans * a % mod;
		a = a * a % mod;
		b >>= 1;
	}
	return ans;
}
int c(int n, int m) {
	return f[n] * qp(f[m], mod - 2) % mod * qp(f[n - m], mod - 2) % mod;
}
signed main() {
	for (int i = 1; i <= 500000; i++)
		f[i] = f[i - 1] * i % mod;
	int n, m, ans = 0;
	cin >> n >> m;
	for (int i = 0; i <= n; i++) {
		int zz = 1;
		zz = zz * c(m, i) % mod * c(n, i) % mod * f[i] % mod;
		zz = zz * c(m - i, n - i) % mod * c(m - i, n - i) % mod * f[n - i] % mod * f[n - i] % mod;
		if (i % 2) ans = (ans + mod - zz) % mod;
		else ans = (ans + zz) % mod;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 7492
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {

	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = br.readLine();
		int[] numArray = parseInt(getSplitLine(line));

		for (int j = 1; j < numArray.length; j++) {
			int key = numArray[j];
			int i = j - 1;
			while (i >= 0 && key < numArray[i]) {
				numArray[i + 1] = numArray[i];
				i--;
			}
			numArray[i + 1] = key;
		}

		System.out.println(Arrays.toString(numArray)
				.replaceAll("[\\[\\],]", ""));
	}

	private static String[] getSplitLine(String line) {
		return line.split("\\s");
	}

	private static int[] parseInt(String[] line) {
		int[] numArray = new int[line.length];
		for (int i = 0; i < line.length; i++) {
			numArray[i] = Integer.parseInt(line[i]);
		}
		return numArray;
	}
}

Measured memory_bytes: 17016
#include<stdio.h>

#define MAX 100

int main() {
  int cats[MAX];
  int count = 0;
  int a, b, i, j;

  scanf("%d", &a);
  for(i = 0; i < a; i++) {
    scanf("%d", &b);

    if(b > 0) {

      for(j = 0; j < count; j++) {
	if(b == cats[j]) {
	  printf("%d\n", i+1);
	  return 0;
	}
      }
		
      cats[count] = b;
      count++;
      
    } else if(b < 0) {

      if(!(cats[count-1] == -b)) {
	printf("%d\n", i + 1);
	return 0;
      }
      
      count--;
    }
  }
  
  printf("OK\n");

}

    



Measured memory_bytes: 2092
#include <bits/stdc++.h>
#include <iostream>
#include <utility> // pair
#include <string>
#include <vector>
#define MAX_N 100001
#define rep(i, a, b) for(ll i=a; i<b; i++)
#define rer(i, a, b) for(ll i=a-1; i>=b; i--)
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll n;
P ab[MAX_N];

signed main(){
    cin >> n;
    rep(i, 0, n) cin >> ab[i].first >> ab[i].second;
    sort(ab, ab+n, [](P x, P y)->bool{
        return x.first + x.second > y.first + y.second;
    });
    ll ha=0, hb=0;
    rep(i, 0, n){
        if(i%2==0) ha += ab[i].first;
        else hb += ab[i].second;
    }
    cout << ha - hb << endl;
    return 0;
}

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

using namespace std;
using ll = long long;

const int N = 300005;
const int mod = 1e9+7;

int n;
ll a[N];

int main() {

	scanf("%d", &n);

	for(int i = 0; i < n; i++) scanf("%lld", a + i);

	ll ans = 0;
	for(int b = 0; b < 60; b++) {
		int p[2] = {0, 0};
		int psum = 0;
		ll sum = 0;
		for(int i = 0; i < n; i++) {
			int val = int(a[i] >> b & 1);
			psum ^= val;
			p[val]++;
			sum += p[ val^1 ];
		}
		sum %= mod;
		ans += (1LL << b) % mod * sum % mod;
		ans %= mod;
	}

	printf("%lld\n", ans);
}


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

using namespace std;

int FindFurthest(const vector<int> &hotels, int dist, int pos)
{
    auto res = pos;
    auto power = (1 << 17);

    while (power > 0) {
        auto new_res = res + power;
        power >>= 1;

        if (new_res < (int)hotels.size() && hotels[new_res] - hotels[pos] <= dist) {
            res = new_res;
        }
    }
    return res;
}

vector<vector<int>> FindJumps(const vector<int> &hotels, int dist)
{
    vector<vector<int>> jumps(hotels.size());

    for (int i = hotels.size() - 2; i >= 0; i -= 1) {
        jumps[i].push_back(FindFurthest(hotels, dist, i));

        auto next = jumps[i][0];
        auto index = 0;

        while (index < (int)jumps[next].size()) {
            jumps[i].push_back(jumps[next][index]);
            next = jumps[i].back();
            index += 1;
        }
    }
    return jumps;
}

int FindBestJump(const vector<int> &jumps, int max_pos)
{
    auto pos = 0;
    auto power = (1 << 17);

    while (power > 0) {
        auto new_pos = pos + power;
        power >>= 1;

        if (new_pos < (int)jumps.size() && jumps[new_pos] <= max_pos) {
            pos = new_pos;
        }
    }
    return pos;
}

int CountDays(const vector<vector<int>> &jumps, int a, int b)
{
    if (a > b) {
        swap(a, b);
    }

    auto days = 0;
    while (a < b) {
        auto index = FindBestJump(jumps[a], b);
        a = jumps[a][index];
        days += (1 << index);
    }
    return days;
}

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

    vector<int> hotels(n);
    for (auto &pos : hotels) {
        cin >> pos;
    }

    int dist, tests;
    cin >> dist >> tests;

    auto jumps = FindJumps(hotels, dist);
    for (auto i = 0; i < tests; i += 1) {
        int a, b;
        cin >> a >> b;

        auto res = CountDays(jumps, a - 1, b - 1);
        cout << res << "\n";
    }
    return 0;
}


Measured memory_bytes: 13568
#include<bits/stdc++.h>
using namespace std;
const int N=1000005,mod=924844033;
int n,fac[N],ifac[N],A[N],B[N],sz[N],r[N];
vector<int>g[N];
int pw(int a,int b){int r=1;for(;b;b>>=1,a=1ll*a*a%mod)if(b&1)r=1ll*r*a%mod;return r;}
int C(int a,int b){return 1ll*fac[a]*ifac[b]%mod*ifac[a-b]%mod;}
void ntt(int n,int *a,int f)
{
	int l=0;while((1<<l)<n)l++;
	for(int i=1;i<n;i++)r[i]=r[i>>1]>>1|((i&1)<<(l-1));
	for(int i=0;i<n;i++)if(i<r[i])swap(a[i],a[r[i]]);
	for(int i=2;i<=n;i<<=1)
	{
		int wn=pw(5,(mod-1)/i);
		if(f==-1)wn=pw(wn,mod-2);
		for(int j=0;j<n;j+=i)for(int k=0,w=1;k<(i>>1);k++,w=1ll*w*wn%mod)
		{
			int u=a[j+k],v=1ll*a[j+k+(i>>1)]*w%mod;
			a[j+k]=(u+v)%mod;a[j+k+(i>>1)]=(u-v+mod)%mod;
		}
	}
	if(f==-1)for(int i=0,iv=pw(n,mod-2);i<n;i++)a[i]=1ll*a[i]*iv%mod;
}
void dfs(int x,int p)
{
	sz[x]=1;
	for(int i=0;i<g[x].size();i++)if(g[x][i]!=p)dfs(g[x][i],x),sz[x]+=sz[g[x][i]];
	if(x!=1)A[sz[x]]++,A[n-sz[x]]++;
}
int main()
{
	scanf("%d",&n);
	for(int i=1,u,v;i<n;i++)
	{
		scanf("%d%d",&u,&v);
		g[u].push_back(v);g[v].push_back(u);
	}
	dfs(1,0);
	for(int i=fac[0]=1;i<=n;i++)fac[i]=1ll*fac[i-1]*i%mod;
	ifac[n]=pw(fac[n],mod-2);
	for(int i=n;i;i--)ifac[i-1]=1ll*ifac[i]*i%mod;
	for(int i=0;i<=n;i++)A[i]=1ll*A[i]*fac[i]%mod;
	reverse(A,A+n+1);
	int nn=1;while(nn<=(n<<1))nn<<=1;
	for(int i=0;i<nn;i++)B[i]=ifac[i];
	ntt(nn,A,1);ntt(nn,B,1);
	for(int i=0;i<nn;i++)A[i]=1ll*A[i]*B[i]%mod;
	ntt(nn,A,-1);
	reverse(A,A+n+1);
	for(int i=0;i<=n;i++)A[i]=1ll*A[i]*ifac[i]%mod;
	for(int i=1;i<=n;i++)A[i]=(1ll*n*C(n,i)%mod-A[i]+mod)%mod;
	for(int i=1;i<=n;i++)printf("%d\n",A[i]);
	return 0;
} 

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

using namespace std;
int main(void) {
    const long MOD = 1e9 + 7;

    long n, k;
    cin >> n >> k;

    vector<long> a(n);
    for(auto &x: a) cin >> x;

    long r1 = 0;
    for(int i=0; i<n; i++)
        for(int j=i+1; j<n; j++)
            if(a[i] > a[j]) r1++;

    long r2 = 0;
    for(int i=0; i<n; i++)
        for(int j=0; j<n; j++)
            if(a[i] > a[j]) r2++;

    long r = 0;
    r += r1 * k;
    r %= MOD;
    r += r2 * ((k * (k-1) / 2) % MOD);
    r %= MOD;
    cout << r << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a=sc.nextInt(),b=sc.nextInt(),c=sc.nextInt(),d=sc.nextInt();
    int ans=Math.min(b,d)-Math.max(a,c);
    if(ans>0){
      System.out.println(ans);
    }else{
      System.out.println(0);
    }
  }
}

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

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

const int maxn=200003;

vector<ppi> e;
int n,d,a[maxn];

inline ll calcf(int i){
	return a[i]-1ll*d*i;
}

inline ll calcg(int i){
	return a[i]+1ll*d*i;
}

void add(int l,int r){
	e.push_back(make_pair(calcf(l)+calcg(r),make_pair(l,r)));
}

void solve(int l,int r){
	if(l==r) return ;
	int mid=(l+r)/2;
	solve(l,mid);
	solve(mid+1,r);
	ll mn=1e18;
	int pl,pr;
	for(int i=l;i<=mid;++i){
		if(calcf(i)<mn){
			mn=calcf(i);
			pl=i;
		}
	}
	mn=1e18;
	for(int i=mid+1;i<=r;++i){
		if(calcg(i)<mn){
			mn=calcg(i);
			pr=i;
		}
	}
	for(int i=l;i<=mid;++i)
		add(i,pr);
	for(int i=mid+1;i<=r;++i)
		add(pl,i);
}
int fa[maxn];

int fnd(int x){
	return fa[x]==x?x:fa[x]=fnd(fa[x]);
}

int main(){
	scanf("%d%d",&n,&d);
	for(int i=1;i<=n;++i)
		scanf("%d",&a[i]),fa[i]=i;
	solve(1,n);
	sort(e.begin(),e.end());
//	for(int i=0;i<e.size();++i){
//		printf("[%d (%d %d)]\n",e[i].first,e[i].second.first,e[i].second.second);
//	}
	ll res=0;
	for(int i=0;i<e.size();++i){
		int x=e[i].second.first;
		int y=e[i].second.second;
		int fx=fnd(x),fy=fnd(y);
		if(fx!=fy){
			fa[fx]=fy;
			res+=e[i].first;
		}
	}
	printf("%lld\n",res);
	return 0;
}



Measured memory_bytes: 69472
S = input()
 
left = S[0:2]
right = S[2:4]
if left[0] == "0": left = left[1]
if right[0] == "0":right = right[1]
left, right = int(left), int(right)
 
if 1 <= left <= 12 and 1 <= right <= 12:
    print("AMBIGUOUS")
elif 1 <= left <= 12:
    print("MMYY")
elif 1 <= right <= 12:
    print("YYMM")
else:
    print("NA")

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

/**
 *
 * @author Y
 */
public class Main {
    public static void main(String[]args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(br.readLine());
        int[] a = new int[N];
        String[] s = br.readLine().split(" ");
        for(int i = 0;i<N;i++){
            a[i] = Integer.parseInt(s[i]);
        }
        
        int Nswap = 0;
        for(int i=0;i<N;i++){
            for(int j = N-1;j>=i+1;j--){
                if(a[j]<a[j-1]){
                    int tmp = a[j];
                    a[j]=a[j-1];
                    a[j-1]=tmp;
                    
                    Nswap++;
                }
            }
        }
        
        for(int i=0;i<N-1;i++){
            System.out.print(a[i] + " ");
        }
        System.out.println(a[N-1]);
        System.out.println(Nswap);
        
    }
}

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

int main(){
  int64_t N , ans , preans , newans;
  cin >> N;
  
  for(int i=0;i<N;i++){
    if(i==0){
      preans=2;
      ans=1;
    }
    else{
      newans=ans+preans;
      preans=ans;
      ans=newans;
    }
  }
  
  cout << ans << endl;
  return 0;
}


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


int main() {
  int A , B , C ; 
  cin >> A >> B >> C ; 
  
  if(A - B <= C){
    cout << C - (A - B ) << endl ; 
    
  }
  else {
    cout << 0 << endl ; 
  }
  
  
  
  
}

Measured memory_bytes: 3652
/*
ID: computerbox --> Huseyn Hajiyev
LANG: C++
TASK: target_mode_on
*/
#include <bits/stdc++.h>
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#define _CRT_SECURE_NO_WARNINGS
//#include <boost/multiprecision/cpp_int.hpp>
//using boost::multiprecision::cpp_int;
#define FAST_READ ios_base::sync_with_stdio(0);cin.tie(0);
#define in freopen("input.txt", "r", stdin);
#define out freopen("output.txt", "w", stdout);
#define ll long long
#define debt(x,y)cout<<"#x = "<<(x)<<" and "<<"#y = "<<(y)<<endl;
#define deb(x)cout<<"#x = "<<(x)<<endl;
#define COUT(n, a) cout<< fixed << setprecision(a) << n<<endl
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define endl "\n"
#define arr(a,n) for(ll i=1;i<=n;i++) cout<<a[i]<<" "; cout << "\n";
#define vecc(a,n) for(ll i=0;i<n;i++) cout<<a[i]<<" "; cout << "\n";
#define CURTIME() cerr << clock() * 1.0 / CLOCKS_PER_SEC << endl
#define DTIME(ccc) __begin = clock(); ccc; cerr<<"Time of work = "<<(clock()-__begin)/CLOCKS_PER_SEC<<endl;
#define MAXN 5002

using namespace std;

#define debug(args...)(Debugger()) , args
class Debugger
{
  public:
  Debugger(const std::string& _separator=", ") :
  first(true),separator(_separator){}
  template<typename ObjectType>
  Debugger& operator,(const ObjectType& v)
  {
        if(!first)cerr<<separator;
        cerr<<v;
        first=false;
        return *this;
  }
  ~Debugger() {cerr<<endl;}
  private:
    bool first;
    string separator;
};

template <typename T1, typename T2>
inline ostream& operator<<(std::ostream& os, const std::pair<T1, T2>& p)
{
   return os<<"("<<p.first<<", "<<p.second<<")";
}
template<typename T>
inline ostream &operator<<(ostream & os,const vector<T>& v)
{
    bool first=true;
    os<<"[";
    for(unsigned ll i=0;i<v.size();i++)
    {
        if(!first)os<<", ";
        os<<v[i];
        first=false;
    }
        return os<<"]";
}
template<typename T>
inline ostream &operator<<(ostream & os,const set<T>&v)
{
    bool first=true;
    os<<"[";
    for(typename set<T>::const_iterator ii=v.begin();ii!=v.end();++ii)
    {
        if(!first)os<<", ";
        os<<*ii;
        first=false;
    }
    return os<<"]";
}
template<typename T1, typename T2>
inline ostream &operator<<(ostream & os,const map<T1, T2>&v)
{
        bool first=true;
        os<<"[";
        for(typename map<T1,T2>::const_iterator ii=v.begin(); ii!=v.end();++ii)
        {
            if(!first)os<<", ";
            os<<*ii;
            first=false;
        }
        return os<<"]";
}


ll massiv[MAXN];
int main(){
FAST_READ;
ll n;
cin>>n;
ll mina=10e10;
ll maxa=-10e10;
ll x;
for(ll i=1;i<=n;i++)
{
  cin>>x;
  mina=min(x,mina);
  maxa=max(x,maxa);
}
cout<<abs(maxa-mina)<<endl;


return 0;
}


Measured memory_bytes: 256
from collections import Counter

def prime_factor(num):
  factor_list = []
  while num % 2 == 0:
    factor_list.append(2)
    num /= 2
  f = 3
  while f * f <= num:
    if num % f == 0:
      factor_list.append(f)
      num /= f
    else:
      f += 2
  if num!=1:
    factor_list.append(num)
  return factor_list

def get_count(c):
  ans = 0
  _max = c
  for i in range(1,c+1):
    if i <= _max:
      ans += 1
      _max -= i
    else:
      break
  return ans
a = int(input())
counter = Counter(prime_factor(a))
ans = 0
for i in counter:
  ans += get_count(counter[i])
print(ans)

Measured memory_bytes: 9532
#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>;

template <class _T> inline bool chmax (_T& a,_T b){if(a<b){a=b;return true;}return false;}
template <class _T> inline bool chmin (_T& a,_T b){if(a>b){a=b;return true;}return false;}

const long long INF = 1LL << 60;


int main(void){
	ll n;cin >> n;
	ll sum = 0;
	for(int i=1;i<=n;i++){
		if(i%3 == 0 || i%5 == 0) continue;
		sum += i;
	}
	cout << sum << endl;
	return 0;
}



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

int main() {
  // Nの入力
  string S;
  cin >> S;

  int length = S.size();

  for(int i=0; i<length; i++){
    S.at(i) = 'x';
  }
  
  cout << S << endl;

}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#define int int64_t
#define REP(i, a, b) for (int64_t i = (int64_t)(a); i < (int64_t)(b); i++)
#define rep(i, a) REP(i, 0, a)
#define ALL(a) (a.begin()), (a.end())
using namespace std;

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

	int N;
	cin >> N;
	vector<int>a(N);
	rep(i, N)cin >> a[i];
	sort(ALL(a));

	int size = a.size();//"最も多く残っている山のキャンディを全部食べる"度に1引く。
	int offset = 0;//"すべての山から1個づつキャンディを食べる"度に1足す。

	//解説図7の"右上に進めるだけ進む"処理
	while (2 <= size && 2 <= a[size - 2] - offset) {
		offset++;
		size--;
	}

	//縁に達する直前になったので、
	//右向きと上向きにどれだけ残っているかを調べる。
	int w = 0;
	for (int i = size - 1; 0 <= i && offset < a[i]; i--)w++;
	int h = a[size - 1] - offset;
	
	cout << (((w % 2) && (h % 2)) ? "Second" : "First") << endl;
}

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

using namespace std;

const int N = 2005;
const int K = 10005;

int n, k;
char s[N][K];
int len[N];
bitset<K> dp[N];
pair<int, int> v[2][K];
int nv, tnv;

int main() {
  scanf("%d %d", &n, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%s", s[i]);
    len[i] = strlen(s[i]);
  }
  dp[n + 1][0] = 1;
  for (int i = n; i > 0; i--) {
    dp[i] = dp[i + 1] | (dp[i + 1] << len[i]);
  }
  for (int i = 1; i <= n; i++) {
    if (dp[i + 1][k - len[i]]) {
      v[0][nv++]= make_pair(i, 0);
    }
  }
  for (int iter = 1,i = 1; iter <= k; iter++, i ^= 1) {
    tnv = 0;
    char c = 'z';
    for (int j = 0; j < nv; j++) {
      c = min(c, s[v[i ^ 1][j].first][v[i ^ 1][j].second]);
    }
    putchar(c);
    int bid = n + 1;
    for (int j = 0; j < nv; j++) {
      int id = v[i ^ 1][j].first;
      int pos = v[i ^ 1][j].second;
      if (s[id][pos] != c) {
        continue;
      }
      if (pos < len[id] - 1)
        v[i][tnv++] = make_pair(id, pos+1);
      else {
        bid = min(bid, id);
      }
    }
    for (int j = bid + 1; j <= n; j++) {
      if (k - iter - len[j] >= 0 && dp[j + 1][k - iter - len[j]]) {
        v[i][tnv++] = make_pair(j, 0);
      }
    }
    nv = tnv;
  }
  putchar('\n');
  return 0;
}

Measured memory_bytes: 21504
class Card:
    def __init__(self, suit, value):
        self.suit = suit
        self.value = value


def merge(a, left, mid, right):
    n1 = mid - left
    n2 = right - mid
    l = a[left:left+n1]
    r = a[mid:mid+n2]
    l.append(Card('X', float('inf')))
    r.append(Card('X', float('inf')))
    i = 0
    j = 0
    for k in range(left, right):
        if l[i].value <= r[j].value:
            a[k] = l[i]
            i += 1
        else:
            a[k] = r[j]
            j += 1


def mergeSort(a, left, right):
    if left+1 < right:
        mid = (left+right) // 2
        mergeSort(a, left, mid)
        mergeSort(a, mid, right)
        merge(a, left, mid, right)


def partition(a, p, r):
    x = a[r]
    i = p - 1
    for j in range(p, r):
        if a[j].value <= x.value:
            i += 1
            tmp = a[i]
            a[i] = a[j]
            a[j] = tmp
    tmp = a[r]
    a[r] = a[i+1]
    a[i+1] = tmp
    return i + 1


def quickSort(a, p, r):
    if p < r:
        q = partition(a, p, r)
        quickSort(a, p, q-1)
        quickSort(a, q+1, r)


n = int(input())
a = []
b = []
for i in range(n):
    tmp = input().split()
    a.append(Card(tmp[0], int(tmp[1])))
    b.append(Card(tmp[0], int(tmp[1])))

mergeSort(a, 0, n)
quickSort(b, 0, n-1)

is_stable = True
for i in range(n):
    if a[i].suit != b[i].suit:
        is_stable = False
        break

if is_stable:
    print('Stable')
else:
    print('Not stable')

for v in b:
    print('%s %d' % (v.suit, v.value))


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

int main() {
  int d, n, ans;
	cin >> d >> n;
  	int s = 1; for (int i = 0; i < d; i++) s *= 100;
    if (n <= 99) {
		cout << s * n << endl;
	}
	else {
		cout << s * 101 << endl;
	}
 	return 0;
}

Measured memory_bytes: 256