akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
using namespace std;

int main(){
  int N, M, min = 2500;
  char c[50][50];
  cin>>N>>M;
  for(int i=0;i<N;i++){
    for(int j=0;j<M;j++){
      cin>>c[i][j];
    }
  }
  for(int i=1;i<N-1;i++){
    for(int j=i;j<N;j++){
      int paint = 0;
      for (int k=0;k<i;k++){
	for(int l=0;l<M;l++){
	  if(!(c[k][l] == 'W')){
	    paint++;
	  }
	}
      }
      for (int k=i;k<j;k++){
	for(int l=0;l<M;l++){
	  if(!(c[k][l] == 'B')){
	    paint++;
	  }
	}
      }
      for (int k=j;k<N;k++){
	for(int l=0;l<M;l++){
	  if(!(c[k][l] == 'R')){
	    paint++;
	  }
	}
      }
      if(paint < min){
	min = paint;
      }
    }
  }
  cout<<min<<endl;
  return 0;
}



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

int main(){
  int n,h[100];
  cin>>n;
  for(int i=0;i<n;i++)cin>>h[i];
  for(int i=1;i<n;i++){
    for(int k=0;k<n;k++){
      cout<<h[k];
      if(k==n-1)cout<<endl;
      else cout<<" ";
    }
    int v=h[i],j=i-1;
    while(j>=0&&h[j]>v){
      h[j+1]=h[j];
      j--;
    }
    h[j+1]=v;
  }
  for(int k=0;k<n;k++){
    cout<<h[k];
    if(k==n-1)cout<<endl;
    else cout<<" ";
  }
  return 0;
}

Measured memory_bytes: 3084
s = [int(x) for x in input()]
count = len(s)-1
wa = 0
for bit in range(2**count):
    hugou = [""] * count
    for i in range(count):
        if (bit >> i) & 1:
            hugou[count-1-i] = "+"
    calc = ""
    for j in range(count):
        calc += str(s[j])
        calc += str(hugou[j])
    calc += str(s[-1])
    wa += eval(calc)
print(wa)


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

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i < (ll)(n); i++)
#define INF 1000000000000
#define MOD 1000000007
using ll = long long;

ll f(ll a, ll b){
  string sa = to_string(a);
  string sb = to_string(b);
  ll la = sa.size(), lb = sb.size();
  return max(la,lb);
}

int main(){
  ll n;
  cin >> n;
  ll ans = n;
  for(ll i = 1; i <= sqrt(n); i++){
    if(n%i==0)ans = min(ans,f(i,n/i));
  }
  cout<<ans<<endl;
  return 0;
}

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

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

int n, m, q, ans;
vector<int> a, b, c, d;


void dfs(vector<int> A) {
    if (A.size() == n + 1) {
        int current = 0;
        rep(i, q) {
            if (A[b[i]]-A[a[i]] ==c[i]) current += d[i];
        }
        ans = max(ans, current);
        return;
    }

    A.push_back(A.back());
    while (A.back() <= m) {
        dfs(A);
        A.back()++;
    }

}


int main() {
    cin >> n >> m >> q;
    a = b = c = d = vector<int>(q);
    rep(i, q) cin >> a[i] >> b[i] >> c[i] >> d[i];

    dfs(vector<int>(1, 1));

    cout << ans << endl;
    return 0;
}

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

int main (){

    int N,A=0,B=0;
    cin >> N;
    int a[N];
    for(int i = 0; i < N ;i++) {
        cin >> a[i];
    }
    
    sort(a,a+N);
    reverse(a,a+N);
    
    for(int i = 0; i < N; i++) {
        if(i % 2 == 0) {
            A += a[i];
        }else {
            B += a[i];
        }
    }
    
    cout << A - B << endl;
    return 0;
}


Measured memory_bytes: 256
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE UndecidableInstances #-}

module Main where

import Control.Category hiding (id, (.))
import Control.Monad
import Control.Monad.ST
import Control.Monad.State.Strict
import qualified Data.ByteString.Char8 as BS
import Data.List as List
import Data.Maybe
import Data.Set as Set
import qualified Data.Vector.Unboxing as U
import qualified Data.Vector.Unboxing.Mutable as UM
import Debug.Trace
import GHC.Generics

readInt :: BS.ByteString -> Int
readInt = fst . fromJust . BS.readInt

readIntList :: BS.ByteString -> [Int]
readIntList = Prelude.map readInt . BS.words

getInt :: IO Int
getInt = readInt <$> BS.getLine

getIntList :: IO [Int]
getIntList = readIntList <$> BS.getLine

-- data Point = Pt {-# UNPACK #-} Int {-# UNPACK #-} Int
--   deriving (Generic)
--   deriving (U.Unboxable) via U.Generics Point

-- ptX :: Point -> Int
-- ptX (Pt x y) = x

-- ptY :: Point -> Int
-- ptY (Pt x y) = y

range :: (Num a, Enum a) => a -> a -> [a]
range begin end = [begin .. (end - 1)]

partitionIdx :: U.Unboxable a => U.Vector a -> (a -> Bool) -> Int
partitionIdx vec pred =
  if pred (vec U.! 0) == False
    then 0
    else loop 0 (U.length vec)
  where
    loop begin end =
      if end == begin + 1
        then end
        else
          let !mid = (begin + end) `div` 2
           in if pred (vec U.! mid) then loop mid end else loop begin mid

main :: IO ()
main = do
  n <- getInt
  ls <- getIntList
  let sortedVec = U.fromList . fmap fst . Set.toList . Set.fromList $ zip ls [0 ..]
      count = sum $ do
        i <- range 0 n
        j <- range (i + 1) n
        let a = sortedVec U.! i
            b = sortedVec U.! j
            k = partitionIdx sortedVec (< a + b)
        return (k - j - 1)
  print count

{-
9
218 786 704 704 704 233 645 728 389

-}

Measured memory_bytes: 5820
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cstdlib>
#include<ctime>
#include<functional>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<bitset>
#include<assert.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
void open(const char *s){
#ifndef ONLINE_JUDGE
	char str[100];sprintf(str,"%s.in",s);freopen(str,"r",stdin);sprintf(str,"%s.out",s);freopen(str,"w",stdout);
#endif
}
void open2(const char *s){
#ifdef DEBUG
	char str[100];sprintf(str,"%s.in",s);freopen(str,"r",stdin);sprintf(str,"%s.out",s);freopen(str,"w",stdout);
#endif
}
template <class T>
int upmin(T &a, const T &b){return (b<a?a=b,1:0);}
template <class T>
int upmax(T &a, const T &b){return (b>a?a=b,1:0);}
namespace io
{
	const int SIZE=(1<<20)+1;
	char ibuf[SIZE],*iS,*iT;
	char obuf[SIZE],*oS=obuf,*oT=oS+SIZE-1;
	int getc()
	{
		(iS==iT?iS=ibuf,iT=ibuf+fread(ibuf,1,SIZE,stdin):0);
		return iS==iT?EOF:*(iS++);
	}
	int f;
	char c;
	template <class T>
	void get(T &x)
	{
		f=1;
		for(c=getc();(c<'0'||c>'9')&&c!='-';c=getc());
		(c=='-'?f=-1,c=getc():0);
		x=0;
		for(;c>='0'&&c<='9';c=getc())
			x=x*10+c-'0';
		x*=f;
	}
	void flush()
	{
		fwrite(obuf,1,oS-obuf,stdout);
		oS=obuf;
	}
	void putc(char x)
	{
		*(oS++)=x;
		if(oS==oT)
			flush();
	}
	int a[55],t;
	template <class T>
	void put(T x)
	{
		if(!x)
			putc('0');
		x<0?putc('-'),x=-x:0;
		while(x)
		{
			a[++t]=x%10;
			x/=10;
		}
		while(t)
			putc(a[t--]+'0');
	}
	void space()
	{
		putc(' ');
	}
	void enter()
	{
		putc('\n');
	}
	struct flusher
	{
		~flusher()
		{
			flush();
		}
	}
	io_flusher;
}
int c[]={0,2,5,5,4,5,6,3,7,6,100};
string f[10010];
int d[100010];
int n,m;
int b[20];
string check(string a,string b)
{
	if(a.size()!=b.size())
		return a.size()>b.size()?a:b;
	return max(a,b);
}
int main()
{
	scanf("%d%d",&n,&m);
	int x;
	for(int i=1;i<=m;i++)
	{
		scanf("%d",&x);
		b[x]=1;
	}
	f[n]="";
	d[n]=1;
	for(int i=n;i>=1;i--)
		if(d[i])
		{
			for(int j=1;j<=9;j++)
				if(b[j]&&i>=c[j])
				{
					d[i-c[j]]=1;
					f[i-c[j]]=check(f[i-c[j]],f[i]+char(j+'0'));
				}
		}
	for(auto v:f[0])
		putchar(v);
	return 0;
}

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

#define N 100

int stack[N];
int sp = 0;

void push(int a) {
    stack[sp] = a;
    sp++;
}

int pop() {
    return stack[--sp];
}

int main() {
    int ans, a;
    char s[7];
    
    while(scanf("%s", s) != EOF) {
        if ('0' <= s[0] && s[0] <= '9') {
            push(atoi(s));
        } else {
            if (s[0] == '+') {
                ans = pop() + pop();
            }
            if (s[0] == '-') {
                a = pop();
                ans = pop() - a;
            }
            if (s[0] == '*') {
                ans = pop() * pop();
            }
            push(ans);
        }
    }
    printf("%d\n", pop());
    return 0;
}




Measured memory_bytes: 2048
#include <stdio.h>
#include <string.h>
#include <limits.h>

int A[20000003], size = 0;
void insert(int *, int);
void increase(int *, int, int);
int extract(int *);
int parent(int);
void maxheapify(int *, int);
int left(int *, int);
int right(int *, int);

main() {
  int n, i;
  char com[20];

  while(1) {
    scanf("%s", com);
    if(com[0] == 'i') {
      scanf("%d", &n);
      insert(A, n);
    }
    else if(com[1] == 'x') {
      printf("%d\n", extract(A));
    }
    else {
      break;
    }
  }
  return 0;
}

void insert(int *A, int key) {
  size = size + 1;
  A[size] = INT_MIN;;
  increase(A, size, key);
}

void increase(int *A, int i, int key) {
  int tmp, p;
  if(key < A[i]) {
    printf("error");
  }
  A[i] = key;
  while(i > 1 && A[parent(i)] < A[i]) {
    tmp = A[parent(i)];
    A[parent(i)] = A[i];
    A[i] = tmp;
    i = parent(i);
  }
}

int extract(int *A) {
  int max;
  if(size < 1) {
    printf("error");
    return 0;
  }
  max = A[1];
  A[1] = A[size];
  size = size - 1;
  maxheapify(A, 1);
  return max;
}

int parent(int i) {
  return i / 2;
}
int left(int *a, int i) {
    return 2 * i;
}
int right(int *a, int i) {
    return 2 * i + 1;
}

void maxheapify(int *a, int i) {
  int largest, l, r, tmp;
  l = left(a, i);
  r = right(a, i);
  if(l <= size && a[l] > a[i]) {
    largest = l;
  }
  else {
    largest = i;
  }
  if(r <= size && a[r] > a[largest]) {
    largest = r;
  }
  if(largest != i) {
    tmp = a[i];
    a[i] = a[largest];
    a[largest] = tmp;
    maxheapify(a, largest);
  }
}

Measured memory_bytes: 4692
#include<iostream>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<vector>
#include<array>
#include<string>
#include<stack>
#include<queue>
#include<algorithm>
#include<cassert>
#include<functional>
#include<random>
#include<complex>
#include<bitset>
#include<chrono>
//#include<boost/multiprecision/cpp_int.hpp>
#define int int64_t
#define uint uint64_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 SZ(X) ((int64_t)((X).size()))
#define ITR(x, a) for (auto x = a.begin(); x != a.end(); x++)
#define ALL(a) (a.begin()), (a.end())
#define HAS(a, x) (a.find(x) != a.end())
#define Min(x) *min_element(ALL(x))
#define Max(x) *max_element(ALL(x))
#define Unique(L) (L.erase(unique(ALL(L)), L.end()))
#define intmax (std::numeric_limits<int64_t>::max() / 4)
#define doublemax (std::numeric_limits<double>::max() / 4)
using namespace std;
//typedef boost::multiprecision::cpp_int bigint;
const double EPS = 1e-9;
const double PI = acos(-1.0);




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

	int A, B, C;
	cin >> A >> B >> C;
	cout << ((A <= C&&C <= B) ? "Yes" : "No") << endl;

	return 0;
}

Measured memory_bytes: 892
def main():
  n=int(input())
  a=[]
  xy=[]
  for _ in range(n):
    a.append(int(input()))
    xy.append([list(map(int,input().split())) for _ in range(a[-1])])
  ans=0
  for i in range(2**n):
    ch=0
    seen=[0]*n # まず全員を不誠実と仮定
    for j in range(n):
      if ((i>>j) & 1): #正直者だと仮定
        seen[j]=1
    f=True
    j=0
    while j<n and f:
      if seen[j]==1:
        for x,y in xy[j]:
          if seen[x-1]!=y:
            f=False
            break
      j+=1
    if f:
      ans=max(sum(seen),ans)
  print(ans)
if __name__=='__main__':
  main()


Measured memory_bytes: 3064
#include <iostream>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
#include<string>
using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;

template<typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

#define in(x) cin >> x
#define out(x) cout << x
#define outn(x) cout << x << '\n'
#define outs(x) cout << x << ' '
#define rep(i,s,e) for(long i=s;i<e;i++)
#define repeq(i,s,e) for(long i=s;i<=e;i++)


int main() {
	ll n, a,s;
	in(n);
	vll b(n);
	s = n / 2;
	rep(i, 0, n) {
		in(a);
		if (i % 2 == 0) {
			b[s + (i / 2)] = a;
		}
		else {
			b[s - ((i + 1) / 2)] = a;
		}
	}
	if (n % 2 == 0) {
		rep(i, 0, n) {
			outs(b[i]);
		}
	}
	else {
		for (ll i = n - 1; i >= 0; i--) {
			outs(b[i]);
		}
	}
	outn("");

	return 0;
}


Measured memory_bytes: 3712
#include<algorithm>
#include <iostream>
#include<cstdio>
#include<cmath>
#include<iomanip>
#include<string>
#include<cstdlib>
#include<ctime>
#include<vector>
#include<map>
using namespace std;

int main(){
//srandom((unsigned long)time(NULL));

int n,l;
cin>>n>>l;
string s[n];
for(int i=0;i<n;i++){
    cin>>s[i];
}

sort(s,s+n);
string ans;

for(int i=0;i<n;i++){
    ans+=s[i];
}

cout<<ans<<endl;

return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define pii pair<int,int>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(c) (c).begin(),(c).end()
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MINF(a) memset(a,0x3f,sizeof(a))
#define POW(n) (1LL<<(n))
#define IN(i,a,b) (a <= i && i <= b)
using namespace std;
template <typename T> inline bool CHMIN(T& a,T b) { if(a>b) { a=b; return 1; } return 0; }
template <typename T> inline bool CHMAX(T& a,T b) { if(a<b) { a=b; return 1; } return 0; }
template <typename T> inline void SORT(T& a) { sort(ALL(a)); }
template <typename T> inline void REV(T& a) { reverse(ALL(a)); }
template <typename T> inline void UNI(T& a) { sort(ALL(a)); a.erase(unique(ALL(a)),a.end()); }
template <typename T> inline void LB(vector<T>& v, T& a) { return *lower_bound(ALL(v),a); }
template <typename T> inline void LBP(vector<T>& v, T& a) { return lower_bound(ALL(v),a) - v.begin(); }
template <typename T> inline void UB(vector<T>& v, T& a) { return *upper_bound(ALL(v),a); }
template <typename T> inline void UBP(vector<T>& v, T& a) { return upper_bound(ALL(v),a) - v.begin(); }
template <typename T1, typename T2> ostream& operator<< (ostream& os, const pair<T1,T2>& p) { os << p.first << " " << p.second; return os; }
template <typename T1, typename T2> istream& operator>> (istream& is, pair<T1,T2>& p) { is >> p.first >> p.second; return is; }
template <typename T> ostream& operator<< (ostream& os, const vector<T>& v) { REP(i,v.size()) { if (i) os << " "; os << v[i]; } return os; }
template <typename T> istream& operator>> (istream& is, vector<T>& v) { for(T& in : v) is >> in; return is; }
template <typename T = int> vector<T> make_v(size_t a) { return vector<T>(a); }
template <typename T, typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...)); }
template< typename T, typename V > typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) { t = v; }
template< typename T, typename V > typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) { for(auto &e : t) fill_v(e, v); }
const int MOD = 1000000007;
const int INF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-10;

int A,B;

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

  cin >> A >> B;
  if (A >= 13) cout << B << endl;
  else if (A >= 6) cout << B/2 << endl;
  else cout << 0 << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<bits/stdc++.h>
#define ll long long int
#define lld long double
#define F first
#define S second
#define f(i,a,b) for(int i=a;i<=b;i++)
#define g(i,a,b) for(int i=a;i>=b;i--)
#define pb push_back
#define mh make_heap
#define ph push_heap
#define pq priority_queue
#define bits(x) __builtin_popcountll(x)
#define op(x) cout<<"Case #"<<x<<": "
#define op1(x) cout<<"Scenario #"<<x<<": "
#define endl "\n"
using namespace std;
const ll mod = 1000000007;
const ll INF = 1e18;
const int N = 20;


/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define policy tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
*/


void solve(int t)
{

	ll n, d;
	cin >> n >> d;
	ll cn = 0;

	for (int i = 0; i < n; i++)
	{
		ll x, y;
		cin >> x >> y;
		lld dis = sqrt(x * x + y * y);

		if (dis <= d)
		{
			cn++;
		}
	}
	cout << cn << endl;


}

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



	int t = 1;
	//cin >> t;


	for (int i = 1; i <= t; i++)
	{
		solve(i);

	}
}

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

int main() {
    int N;
    cin >> N;
    vector<int> H(N);
    for (int i = 0; i < N; i++)
        cin >> H[i];

    int pre = -1;
    for (int i = 0; i < N; i++) {
        if (pre <= H[i] - 1) {
            pre = H[i] - 1;
        } else if (pre <= H[i]) {
            pre = H[i];
        } else {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <climits>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <cassert>
#include <unordered_map>

using namespace std;
const int MOD = 1000000007;
typedef long long ll;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int x, n; cin >> x >> n;
    set<int> st;
    for (int i = 0, a; i < n; ++i) {
        cin >> a;
        st.insert(a);
    }

    if (!st.count(x)) {
        cout << x << '\n';
        return 0;
    }
    int ax1 = x, ax2 = x;
    while(ax1 >= 1 && st.count(ax1)) {
        ax1--;
    }
    while(ax2 <= 100 && st.count(ax2)) {
        ax2++;
    }

    if (abs(x - ax1) == abs(x- ax2)) {
        cout << min(ax1, ax2) << '\n';
    } else if (abs(x - ax1) < abs(x - ax2)) {
        cout << ax1 << '\n';
    } else {
        cout << ax2 << '\n';
    }
    return 0;

}



Measured memory_bytes: 3648
import java.util.Scanner;

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

		int a, b, c;

		a = in.nextInt();
		b = in.nextInt();
		c = in.nextInt();

		if(b - a == c - b) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}
}


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

typedef long long ll;
typedef double dd;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;

const int mx=1e6+11;
const double PI = acos(-1);
#define MOD 1000000007


#define nl '\n'
#define pb push_back
#define F first
#define S second
#define I insert
#define mp make_pair

#define sz(x) x.size()
#define tt int t; cin>>t; while(t--)
#define lo(i,a,b) for(int i=a;i<b;i++)
#define be(a) (a).begin(),(a).end()
#define rbe(a) (a).rbegin(),(a).rend()
#define mem(a,b) memset(a,b,sizeof(a))

#define su ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define frac cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)
void faltu ()
{
    cerr << endl;
}
template < typename T, typename ... hello>void faltu( T arg, const hello &... rest)
{
    cerr << arg << ' ';
    faltu(rest...);
}

bool prime[1001];
vl pr;

void sieve(int n)
{
    mem(prime, true);
    prime[0]=false;
    prime[1]=false;
    for(int i=4; i<=n; i+=2)
    {
        prime[i]=false;
    }
    for (int p=3; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (int i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }
    pr.pb(2);
    for (int p=3; p<=n; p+=2)
        if (prime[p] == true)
            pr.pb(p);

}

int main()
{
    su;
    ll n,ans=1,c,p;
    cin>>n;
    sieve(n);
    for(auto i:pr)
    {
        c=1;
        p=i;
        while(p<=n)
        {
            c+=(n/p);
            c%=MOD;
            p*=i;
        }
        ans*=c;
        ans%=MOD;
    }
    cout<<ans%MOD<<nl;
    return 0;
}

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

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

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
typedef pair <ll,ll> P;


int main()
{
    ll N, M;
    cin >> N >> M;
    vector<ll> a(M);
    vector<ll> b(M);
    vector<ll> c(M);
    vector<vector<ll>> adj(N, vector<ll>(N, 0));
    rep(i, N) {
        rep(j, N) {
            if (i == j) 
                adj[i][i] = 0;
            else
                adj[i][j] = INF;
        }
    }
    rep(i, M) {
        cin >> a[i] >> b[i] >> c[i];
        a[i]--; b[i]--;
        adj[a[i]][b[i]] = c[i];
        adj[b[i]][a[i]] = c[i];
    }
    rep(k, N) {
        rep(i, N) {
            rep(j, N) {
                if (adj[i][j] > adj[i][k] + adj[k][j]){
                    adj[i][j] = adj[i][k] + adj[k][j];
                }
            }
        }
    }
    int ans = M;
    rep(i, M) {
        bool flag = false;
        rep(j, N) {
            if (adj[j][a[i]] + c[i] == adj[j][b[i]]) flag = true;
        }
        if (flag){
            ans--;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <cmath>
#define PI acos(-1)
 
using namespace std;
 
int main(){
        double x=0.0,y=0.0;
        double nr=PI/2.0;
        int l,r;
        while(true){
                cin >> l;
		cin.ignore();
		cin >> r;
                if(!(l|r))
                        break;
                x+=l*cos(nr);
                y+=l*sin(nr);
                nr-=r*PI/180.0;
        }
        cout << (int)x <<endl<< (int)y <<  endl;
return 0;
}

Measured memory_bytes: 1164
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <limits.h>
#include <stdbool.h>

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

//qsort(str, n, sizeof(int), up_comp);
int up_comp(const void *a, const void *b){return *(int*)a - *(int*)b;}
int down_comp(const void *a, const void *b){return *(int*)b - *(int*)a;}
int int_sort( const void * a , const void * b ) {return strcmp(( char * )a , ( char * )b );}
int count_digit(int a){int i=0;while(a!=0){a=a/10;i++;}return i;}
int euclid( int a, int b ){int temp;if(a<b){temp=a;a=b;b=temp;}if(b<1)return -1;if(a%b==0) return b;return euclid(b,a%b);}

int main(void){
 
    int a, b;
    
    scanf("%d%d", &a, &b);
    
    if (a==b) {
        printf("Draw");
    } else if ((a < b&&a!=1)||b==1) {
        printf("Bob");
    } else if ((a > b&&b!=1)||a==1) {
        printf("Alice");
    }
    
    return 0;
}



Measured memory_bytes: 1712
n,k = map(int,input().split())
num = [0]*n
for i in range(1,n+1):
    j = 1
    if i >= k:
        num[i-1] = 0
    else:
        while 1:
            if i*2**j >= k:
                num[i-1] = j
                break
            j += 1
ans = 0
for i in range(n):
    ans += 0.5**num[i]
print(ans/n)

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

int main() {
    const int N = 100005;
    vector<bool> is_prime(N, true);
    vector<int> cusum(N, 0);
    is_prime[0] = is_prime[1] = false;
    for (int i = 2; i < N; i++)
    {
        if(is_prime[i]==false) continue;
        for (int j = i+i; j < N; j+=i)
        {
            is_prime[j] = false;
        }
    }
    
    for (int i = 3; i < N; i++)
    {
        if(is_prime[i] && is_prime[(i+1)/2]){
            cusum[i]++;
        }
        cusum[i] += cusum[i-1];
    }
    
    int Q; cin >> Q;
    for (int i = 0; i < Q; i++)
    {
        int l, r; cin >> l >> r;
        cout << cusum[r] - cusum[l-1] << '\n';
    }
}

Measured memory_bytes: 1024
#include <iostream>
#include <stdio.h>
using namespace std;

int main() {
    int n;
    int min = 1000000;
    int max = -1000000;
    long r = 0;
    int a[10000];
    cin >> n;
    for (int i=0;i<n;i++) {
        cin >> a[i];
    }
    for (int i=0;i<n;i++) {
        if (a[i]>max) {
            max = a[i];
        }
        if (a[i]<min) {
            min = a[i];
        }
        r += a[i];
    }
    cout << min << " " << max << " " << r << endl;
}



Measured memory_bytes: 3156
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Scanner;

class Main {
    static final int MOD = 1000000007;
    static final int INF = 1 << 30;
    static final int ALF = 26;

    ArrayList<Wood> list = new ArrayList<Wood>();
    int K;
    int N;
    Main() {
        Scanner sc = new Scanner(System.in);
        long ans = 0;
        N = sc.nextInt();
        K = sc.nextInt();

        // PriorityQueue<Wood> queue = new
        // PriorityQueue<Wood>(Comparator.comparing(Wood::LEND));
        for (int i = 0; i < N; i++) {
            Wood w = new Wood(sc.nextInt());
            list.add(w);
            // queue.add(w);
        }
        /*
         * int cut = 0; while(true){ int remain = K-cut; Wood w = queue.poll();
         * if(w.COST() <= remain){ w.CUT(); queue.add(w); }else{ ans =
         * (long)Math.floor(w.LEND()); break; } }
         */

        ans = binarySearch(1, 1000000001);

        System.out.println(ans);
    }

    int binarySearch(int min, int max) {
        int ng = min - 1, ok = max;
        while (ok - ng > 1) {
            int mid = ng + (ok - ng) / 2;
            if (isOK(mid))
                ok = mid;
            else
                ng = mid;
        }
        if (ok == max)
            throw new Error("all false");
        return ok;
    }

    boolean isOK(int key) {
        long sum = 0;
        for (int i = 0; i < N; i++) {
            Wood w = list.get(i);
            if (w.length <= key)
                continue;
            //double col = (double)w.length / key;
            //sum += (w.length / key) - (((w.length % key) == 0) ? 1 : 0);
            int ck = (w.length / key);
            if((double)w.length/ck > key){
                //ck++;
            }else{
                ck--;
            }
            sum += ck;
            if (sum > K){
                //System.err.println(key+" is false " + sum);
                return false;
            }
        }
        //System.err.println(key+" is true "+sum);
        return true;
    }

    public static void main(String[] args) {
        new Main();
    }

    class Wood {
        int length;
        int cut;

        Wood(int length) {
            this.length = length;
            cut = 0;
        }

        void CUT() {
            cut += cut + 1;
        }

        int COST() {
            return cut + 1;
        }

        int LEN() {
            return length / (cut + 1);
        }

        double LEND() {
            return length / (cut + 1d);
        }
    }
}


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

int main() {


    int n;

    cin >> n;

    vector<int> v(n);
    int maxV = 0;
    int nextMaxV = 0;

    for(int i = 0; i < n; ++i) {
        cin >> v[i];

        if(v[i] >= maxV) {
            nextMaxV = maxV;
            maxV = v[i];
        }
        else if(v[i] >= nextMaxV)
            nextMaxV = v[i];

    }

    for(int i = 0; i < n; ++i) {

        if(v[i] == maxV) 
            cout << nextMaxV << endl;
        else
            cout << maxV << endl;
    }

    return 0;
}

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

#define Sort(x) sort(x.begin(), x.end())
#define Sort_rev(x) sort(x.begin(), x.end(), greater<int>())

long long gcd(long long a, long long b)
{
	if (a%b==0) {
		return(b);
	} else {
		return(gcd(b,a%b));
	}
}

int main() {
    long long a, b;
    cin >> a >> b;
	long long ans = 1;
	long long c = gcd(a, b);

	for (long long i = 2; i*i <= c; ++i) {
		if ( c%i == 0 ) {
			ans++;
			while ( c%i == 0 ) {
				c /= i;
			}
		}
	}

	if ( c != 1 ) {
		ans++;
	}
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
S = sum(A)


def solve():
    n = (N + 1) * N // 2
    if S % n != 0:
        return False
    c = S // n
    cc = 0
    for i in range(N):
        j = (i + 1) % N
        delta = A[j] - A[i]
        if (c - delta) % N != 0:
            return False
        ci = (c - delta) // N
        if ci < 0:
            return False
        cc += ci
    assert(c == cc)


    return True

if solve():
    print('YES')
else:
    print('NO')



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

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define ll long long
#define ii pair<int,int>
#define vi vector<int>
#define vll vector<ll>
#define vii vector<ii>

const int maxn = 3e3+10;
const int mod = 998244353;

int n,s;

int memo[maxn][maxn],vs[maxn];

using namespace std;

int sum(int x,int v){
	return (x%mod+v%mod)%mod;
}

int dp(int pos,int soma){
	if(pos>n)
		return 0;
	if(soma==s)
		return n-pos+1;
	if(soma > s)
		return 0;
	int &val = memo[pos][soma];
	if(val!=-1)
		return val;
	return val = sum(dp(pos+1,soma),dp(pos+1,soma+vs[pos]));
}

void solve(){
	memset(memo,-1,sizeof memo);
	cin>>n>>s;
	int ans=0;
	for(int i=0;i<n;++i)
		cin>>vs[i];
	for(int i=0;i<n;++i){
		//cout<<dp(i,0)<<endl;
		ans = sum(ans,dp(i,0));
	}
	cout<<ans<<endl;
}

int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t=1;
	//cin>>t;
	while(t--){
		solve();
	}
	return 0;
}

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

using namespace std;
#define DBG(x)                         \
    (void)(cout << "L" << __LINE__     \
                << ": " << #x << " = " \
                << (x) << '\n')
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
typedef long long ll;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;
const int INF = 0x3f3f3f3f;
const int maxn = 1100000;

void run_case()
{
    int a, b, h, m;
    cin >> a >> b >> h >> m;
    double angle1 = h * 30.0 + m * 0.5;
    double angle2 = m * 6.0;
    double angle = min(abs(angle1 - angle2), 360 - abs(angle1 - angle2));
    //DBG(angle);
    double t = angle * PI * 1.0 / 180;
    //DBG(cos(t));
    double c = sqrt(a * a * 1.0 + b * b * 1.0 - 2 * a * b * cos(t));
    cout << c << "\n";
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setiosflags(ios::fixed) << setprecision(15);
    run_case();
    cout.flush();
    return 0;
}

Measured memory_bytes: 4180
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
map<ull, ull> cnt;
int main() {
    ull n;
    cin >> n;
    ull m = n;
    if (n == 1) {
        cout << 0 << endl;
        return 0;
    }
    for (ull i = 2; i * i <= m && i <= n; i++) {
        if (n % i == 0) {
            cnt[i] = 0;
            while (n % i == 0) {
                n /= i;
                cnt[i]++;
            }
        }
    }
    if (n != 1) {
        cnt[n] += 1;
    }
    ull ans = 0;
    for (auto ite = cnt.begin(); ite != cnt.end(); ite++) {
        int x = ite -> second;
        int cnt = 1;
        for (int i = 1; i * (i + 1) / 2 <= x; i++, cnt++);
        cnt--;
        // cout << cnt << endl;
        ans += cnt;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3648
N,X = (int(T) for T in input().split())
A = [int(T) for T in input().split()]
Eat = 0
for AN in range(0,N-1):
    if A[AN]+A[AN+1]>X:
        Need = A[AN]+A[AN+1]-X
        if A[AN+1]>=Need:
            A[AN+1] -= Need
        else:
            A[AN] -= Need-A[AN+1]
            A[AN+1] = 0
        Eat += Need
print(Eat)

Measured memory_bytes: 19916
#include <bits/stdc++.h>
using namespace std;
int n,w;
long long d[100005];

int main()
{
    int n,w;
    scanf("%d %d", &n, &w);
    for(int i = 1;i <= n;i++)
    {
        int n1,n2;
        scanf("%d %d", &n1, &n2);
        for(int j = w;j >= n1;j--)
        {
            if(d[j] < d[j-n1] + n2) d[j] = d[j-n1] + n2;
        }
    }
    printf("%lld",d[w]);
}


Measured memory_bytes: 1024
while True:
    n = int(raw_input())
    if n == 0:
        break
    m = int(raw_input())
    x = int(raw_input())
    d = int(raw_input())
    amida = ["" for i in range(d)]
    for i in range(d):
        amida[i] = "0" + raw_input() + "0"
    rroot = []
    for i in range(d-1,-1,-1):
        if amida[i][x-1] == "1":
            x -= 1
        elif amida[i][x] == "1":
            x += 1
        rroot.append(x)
    if m == x:
        print 0
    else:
        root = []
        for i in range(d):
            if amida[i][m-1] == "1":
                m -= 1
            elif amida[i][m] == "1":
                m += 1
            root.append(m)
        rroot.reverse()
        for i in range(d):
            if abs(root[i]-rroot[i]) == 1:
                p = min(root[i],rroot[i])
                if int(amida[i][p-1]) + int(amida[i][p+1]) == 0:
                    print i+1, p
                    break
            if i == d-1:
                print 1

Measured memory_bytes: 4288
//Running median
//keeping max heap for first half and min heap for second half
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define endl "\n";
ll  P=1000000007;
ll M=P;
ll power(ll a, ll b) {
    if(b == 0) return 1;
    ll x = power(a, b / 2);
    x = (x * x)%M;
    if(b%2) x = (x*a)%M;
    return x;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll i,j,k,l,m,n,o,p,q,r,s,t;
    cin>>n;
    long double x=(n);
    x=(2*x*M_PI);
    printf("%.20llf\n",x);
    return 0;
}


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

mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());

int N, D;
vector<int> C;
vector<vector<int>> S;

vector<int> ans;

void Read(bool local = false) {
  N = 26;
  if (local) {
    D = 365;
  } else {
    cin >> D;
  }
  C.resize(N);
  for (int i = 0; i < N; i++) {
    if (local) {
      C[i] = rnd() % 100;
    } else {
      cin >> C[i];
    }
  }
  S.resize(D);
  for (int i = 0; i < D; i++) {
    S[i].resize(N);
    for (int j = 0; j < N; j++) {
      if (local) {
        S[i][j] = rnd() % 20000;
      } else {
        cin >> S[i][j];
      }
    }
  }
  ans.assign(D, 0);
}

void Write() {
  for (auto i : ans) {
    cout << i + 1 << "\n";
  }
}

int Arithmetic(int n) {
  return n * (n - 1) / 2;
}

vector<set<int>> Build(vector<int> a) {
  vector<set<int>> occ(N);
  for (int i = 0; i < D; i++) {
    occ[a[i]].insert(i);
  }
  for (int i = 0; i < N; i++) {
    occ[i].insert(-1);
    occ[i].insert(D);
  }
  return occ;
}

int Evaluate(vector<int> a) {
  vector<int> last(N, -1);
  int score = 0;
  for (int i = 0; i < D; i++) {
    score += S[i][a[i]];
    last[a[i]] = i;
    for (int j = 0; j < 26; j++) {
      score -= C[j] * (i - last[j]);
    }
  }
  return score;
}

int Evaluate(int init_score, const vector<int> &a, const vector<set<int>> &occ, int d, int q) {
  if (a[d] == q) return init_score;
  const set<int> &cur = occ[a[d]];
  auto pos = cur.lower_bound(d);
  int lst = *prev(pos);
  int nxt = *next(pos);

  int score = init_score;
  score += C[a[d]] * (Arithmetic(nxt - d) + Arithmetic(d - lst) - Arithmetic(nxt - lst));

  pos = occ[q].upper_bound(d);
  lst = *prev(pos);
  nxt = *pos;
  score -= C[q] * (Arithmetic(nxt - d) + Arithmetic(d - lst) - Arithmetic(nxt - lst));

  score -= S[d][a[d]];
  score += S[d][q];

  return score;
}

void Change(int &init_score, vector<int> &a, vector<set<int>> &occ, int d, int q) {
  int new_score = Evaluate(init_score, a, occ, d, q);
  init_score = new_score;
  occ[a[d]].erase(d);
  a[d] = q;
  occ[a[d]].insert(d);
}

void Solve() {
  vector<int> a(D);
  for (int i = 0; i < D; i++) {
    a[i] = rnd() % N;
  }
  int score = Evaluate(a);
  vector<set<int>> occ = Build(a);

  double temp = 10000;
  double cooling_rate = 0.999999;
  double absolute_zero = 0.00000001;
  int rep = 2e5;
  while (rep--) {
    int d = rnd() % D;
    int q = -1;
    int nsc = -2e9;
    for (int i = 0; i < N; i++) {
      int sc = Evaluate(score, a, occ, d, i);
      if (sc > nsc) {
        nsc = sc;
        q = i;
      }
    }
    int delta = Evaluate(score, a, occ, d, q) - score;
    if (delta > 0) {
      Change(score, a, occ, d, q);
    }
    // temp *= cooling_rate;
  }
  if (Evaluate(ans) < Evaluate(a)) {
    ans = a;
  }
}

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

  Read();
  for (int rep = 0; rep < 5; rep++) {
    Solve();
  }
  Write();
  // cerr << Evaluate(ans) << "\n";
  return 0;
}


Measured memory_bytes: 3744
//                                 Alisher_2211
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        # include <bits/stdc++.h>
# define  long          long long
# define  all(vc)       vc.begin(),vc.end()
# define  allr(vc)      vc.rbegin(),vc.rend()
# define  pb            push_back
# define  fi            first 
# define  se            second
# define  pi            pair <long, long>    
# define  lcm(a, b)     (a * b) / __gcd(a, b)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        using namespace std;
const long N = 100100;
void read(){freopen("input.txt" , "r" , stdin );freopen("output.txt", "w" , stdout );}
long dp[N][2];
string s;
void solve(){
    long n, m;
    cin >> n;
    vector <long> v(n);
    long ans = 0;
    for(auto &i: v) cin >> i, ans += i;
    if( ans % 10 ) cout << ans;
    else{
        sort( all(v) );
        for (int i = 0; i < n; ++i){
            if( (ans - v[i]) % 10 ){
                cout << ans - v[i];
                return;
            }
        }
        cout << 0;
    }

}
int32_t main(){
ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); 
        long T = 1;
        //cin >> T;
        while( T-- ){
            solve();
            cout<<'\n';
        }
cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
}

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

using namespace std;

int main()
{
  int N, T;
  cin >> N >> T;
  int sh, sm, ah, am;
  char ss[55], as[55];
  scanf("%d:%d %s %d:%d %s", &sh, &sm, ss, &ah, &am, as);
  int prevt = ah * 60 + am; 
  char prevs[55]; strcpy(prevs, as);
  int cnt = 0;
  char vis[11][55];
  int vt[11];
  for(int i = 1; i < N; i++){
    scanf("%d:%d %s %d:%d %s", &sh, &sm, ss, &ah, &am, as);
    int nowt = sh * 60 + sm;
    if(nowt - prevt >= T) strcpy(vis[cnt], prevs), vt[cnt] = nowt - prevt, cnt++;
    prevt = ah * 60 + am;
    strcpy(prevs, as);
  }
  cout << cnt << endl;
  for(int i = 0; i < cnt; i++) printf("%s %d\n", vis[i], vt[i]);
  return 0;
}

Measured memory_bytes: 1284
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001
#define mod 1000000007
#define pi 3.141592653589793

ll gcd(ll a,ll b){
    if(b>a) swap(a,b);
    ll r=a%b;
    while(r!=0){
        a=b;
        b=r;
        r=a%b;
    }
    return b;
}

int main (){
    int n;
    string ans;
    cin >> n;
    vector<int>alpha(26);
    rep(i,n) {
        string s;
        cin >> s;
        vector<int>al(26,0);
        rep(k,26){
            al[k]=count(s.begin(),s.end(),'a'+k);
        }
        if(i==0){
            rep(j,26){
                alpha[j]=al[j];
            }
        }
        else {
            rep(j,26) alpha[j]=min(alpha[j],al[j]);
        }
    }
    rep(i,26){
        while(alpha[i]>0){
            ans+='a'+i;
            alpha[i]--;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <sstream>
#include <complex>
#include <ctime>
#include <cassert>
#include <functional>

using namespace std;

typedef long long ll;
typedef vector<int> VI;
typedef pair<int,int> PII;

#define REP(i,s,t) for(int i=(s);i<(t);i++)
#define FILL(x,v) memset(x,v,sizeof(x))

const ll INF = (ll)1E18+1;
#define MAXN 200005

char pattern[MAXN];
int nxt[MAXN];
void calcNext(){
  int k=0, len = strlen(pattern);
  nxt[0] = 0;
  for(int i=1; i<=len; i++){
    if(pattern[i]==pattern[k]) nxt[i] = nxt[k++];
    else{
      nxt[i] = k;
      while(k>0 && pattern[i]!=pattern[k]) k=nxt[k];
      if(pattern[k]==pattern[i]) k++;
    }
  }
}

ll plen[100], cnt[100][26];
int N, Tlen, stcnt[MAXN][26];
vector<ll> solve(int i, ll k) {
  vector<ll> sol(26,0), sol2(26,0);
  if (k == 0) return sol;
  if (i <= 1) {
    REP(c,0,26) sol[c] = stcnt[k-1][c];
    return sol;
  }
  if (k <= plen[i-1]) {
    sol = solve(i-1, k);
  } else {
    REP(c,0,26) sol[c] = cnt[i-1][c];
    sol2 = solve(i-2, k-plen[i-1]);
    REP(c,0,26) sol[c] += sol2[c];
  }
  return sol;
}
int main() {
  ll L, R;
  cin >> pattern >> L >> R;
  N = strlen(pattern);
  N /= 2;
  pattern[N] = 0;
  calcNext();
  Tlen = N - nxt[N];
  REP(i,N,N+Tlen) pattern[i] = pattern[i-N];
  REP(i,0,N+Tlen) {
    if (i) REP(c,0,26) stcnt[i][c] = stcnt[i-1][c];
    stcnt[i][pattern[i]-'a']++;
  }
  plen[0] = N;
  plen[1] = N + Tlen;
  REP(c,0,26) {
    cnt[0][c] = stcnt[plen[0]-1][c];
    cnt[1][c] = stcnt[plen[1]-1][c];
  }
  int maxi = 1;
  REP(i,2,100) {
    plen[i] = plen[i-1] + plen[i-2];
    REP(c,0,26) cnt[i][c] = cnt[i-1][c] + cnt[i-2][c];
    if (plen[i] >= INF) {
      maxi = i;
      break;
    }
  }
  vector<ll> ans = solve(maxi, R);
  vector<ll> dec = solve(maxi, L-1);
  REP(c,0,26) cout << ans[c] - dec[c] << " ";
  return 0;
}


Measured memory_bytes: 21248
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  char x;
  cin>>x;
  if(x=='A')cout<<'T'<<endl;
  else if(x=='T')cout<<'A'<<endl;
  else if(x=='C')cout<<'G'<<endl;
  else cout<<'C'<<endl;
  return 0;
}

Measured memory_bytes: 256
// g++ -std=gnu++1y -O2 xxx.cpp

#include <bits/stdc++.h>

using namespace std;

using ll = long long;

int main() {
    int K,N; cin>>K>>N;
    vector<int> pi(K);
    vector<double> e(K);
    vector<double> sum(K);

    for (int i=0;i<K;i++) {
        cin >> pi[i];
    }

    // 期待値計算
    for (int i=0;i<K;i++) {
        e[i] = (1.0/pi[i]) * (1.0/2.0) * (pi[i]+1) * (pi[i]+1-1);
        //cout << e[i] << " ";
    }

    for (int j=0;j<N;j++) {
        sum[0] += e[0+j];
    }
    
    for (int i=1;i<=K-N;i++) {
        sum[i] = sum[i-1] - e[i-1] + e[i+N-1];
    }

    sort(sum.begin(), sum.end(), greater<int>());

    cout << setprecision(16) << sum[0] << endl;

    return 0;
}

Measured memory_bytes: 4096
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr int Inf = 1000000000;
constexpr ll INF= 9 * 1e18;
constexpr ll MOD = 1000000007;
const double PI = 3.1415926535897;
typedef pair<ll,ll> P;

template<typename T>
T Pow(T a,T b) {
    T ret = 1;
    for(int i = 0;i < b;i++) {
        ret *= a;
    }
    return ret;
}

ll mod(ll val) {
    ll res = val % MOD;
    if(res < 0) {
        res += MOD;
    }
    return res;
}

int main() {
    int A,B,C,X,Y;
    cin >> A >> B >> C >> X >> Y;
    C *= 2;
    int ret = Inf;
    for(int i = 0;i <= max(X,Y);i++) {
        int cnt = C * i;
        int x = max(0,X - i);
        int y = max(0,Y - i);
        ret = min(ret,cnt + x * A + y * B);
    }
    cout << ret << endl;
}

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

long long h,w;
int main(){
	cin>>h>>w;
	long long ans=114514;
	if(h%3==0)ans=0;
	else ans=min(ans,w);
	if(w%3==0)ans=0;
	else ans=min(ans,h);
	for(int i=0;i<=h;i++){
		long long a=i*w,b=(w/2)*(h-i),c=(w/2+w%2)*(h-i);
		long long cnt=abs(a-b);
		cnt=max(cnt,abs(b-c));
		cnt=max(cnt,abs(a-c));
		ans=min(ans,cnt);
	}
	int tmp=h;
	h=w,w=tmp;
	for(int i=0;i<=h;i++){
		long long a=i*w,b=(w/2)*(h-i),c=(w/2+w%2)*(h-i);
		long long cnt=abs(a-b);
		cnt=max(cnt,abs(b-c));
		cnt=max(cnt,abs(a-c));
		ans=min(ans,cnt);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
package main

import "fmt"

var inf = 10000000000

func main() {
	var x, y int
	fmt.Scan(&x, &y)

	a := y - x
	b := y - -x + 1
	c := -y - x + 1
	d := -y - -x + 2

	if a < 0 {
		a = inf
	}
	if b < 0 {
		b = inf
	}
	if c < 0 {
		c = inf
	}
	if d < 0 {
		d = inf
	}

	fmt.Println(min(min(min(a, b), c), d))
}

func abs(n int) int {
	if n < 0 {
		return -n
	}
	return n
}

func min(n, m int) int {
	if n < m {
		return n
	}
	return m
}


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

//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>(b);i--)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll;
const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12;
void tostr(ll x,string& res){while(x)res+=('0'+(x%10)),x/=10; reverse(ALL(res)); return;}
template<class T> inline bool chmax(T& a,T b){ if(a<b){a=b;return 1;}return 0; }
template<class T> inline bool chmin(T& a,T b){ if(a>b){a=b;return 1;}return 0; }
//template end

ll dp[110][10][5][2]={};

int main(){
   string s; cin>>s;
   int k; scanf("%d",&k);
   reverse(ALL(s)); dp[s.size()][0][0][0]=1;
   rrep(i,s.size(),0)rep(j,0,10)rep(cnt,0,k+1)rep(f,0,2)if(dp[i][j][cnt][f]!=0){
      rep(to,0,10){
         if(!f&&(s[i-1]-'0')<to)continue;
         bool g=f; if(i==1||(s[i-1]-'0')>to)g=1;
         dp[i-1][to][cnt+(to!=0)][g]+=dp[i][j][cnt][f];
      }
   }
   /*
   rep(i,0,s.size()){
      rep(j,0,10){
         rep(cnt,0,4){
            rep(f,0,2)cerr<<dp[i][j][cnt][f]<<" "; puts("");
         }
      }
   }
   */
   ll res=0;
   rep(j,0,10)res+=dp[0][j][k][1];
   printf("%lld\n",res);
   return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
 
int main()
{
  int N, r, l, result = 0;
    
  std::cin >> N;
  
  for(int i = 0; i < N; i++)
  {
    int r, l;
    std::cin >> r >> l;
    result += (l - r + 1);
  }
  
  std::cout << result;
}

Measured memory_bytes: 3156
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>

using namespace std;

int main(void) {
	int Q, H, S, D;
	long long int N;
	cin >> Q >> H >> S >> D >> N;
	if (2 * Q < H) H = 2 * Q;
	if (2 * H < S) S = 2 * H;
	if (2 * S < D) D = 2 * S;
	cout << (N / 2) * D + (N % 2) * S << endl;
	system("pause");
	return 0;
}

Measured memory_bytes: 504