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

const long long INF = 1e7 + 1;
const long long MOD = 1000000007;
const long double PI = 3.1415926;

#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); ++i)
#define RFOR(i,n,r) for(ll i = (ll)(n-1); i >= r; --i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,n,0)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()

#define cout cout << setprecision(12)

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using vi = vector<ll>;
using vvi = vector<vi>;
using vp = vector<pair<ll, ll>>;
using vs = vector<string>;
using vc = vector<char>;
using lst = list<ll>;
using pq = priority_queue<ll>;

template < typename T >
inline void dbg(T a) { cout << a << ' ' << endl; }

ll n, m, k, ans = 0, sum = 0, cnt = 0;
string s;
char c;

/*--------------------template--------------------*/

int main() {
    cin >> n >> m;
    cout << 6 -n -m << endl;
}


Measured memory_bytes: 892
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include<bitset>
#include<math.h>
using namespace std;
#define INF 110000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> P;


int main(){
  ll sum=0;
  int N,T[110],M,p,x;
  cin>>N;
  for(int i=1;i<=N;i++){
    cin>>T[i];
    sum+=T[i];
  }

  cin>>M;

  for(int i=0;i<M;i++){
    cin>>p>>x;

    cout<<sum+x-T[p]<<endl;;
  }
}


Measured memory_bytes: 256
#include <cstdlib>
#include <iostream>

static void
putcharN(char ch, int n);


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

  int sx, sy, tx, ty;
  std::cin >> sx >> sy >> tx >> ty;

  int w = tx - sx;
  int h = ty - sy;

  putcharN('R', w);
  putcharN('U', h);
  putcharN('L', w);
  putcharN('D', h);

  putcharN('D', 1);
  putcharN('R', w + 1);
  putcharN('U', h + 1);
  putcharN('L', 1);
  putcharN('U', 1);
  putcharN('L', w + 1);
  putcharN('D', h + 1);
  putcharN('R', 1);

  return EXIT_SUCCESS;
}


static void
putcharN(char ch, int n)
{
  for (int i = 0; i < n; i++) {
    std::cout.put(ch);
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>

using namespace std;

bool check(char ary[60][60], int a, int b)
{
    for (int i = 0; i < a; i++) {
        for (int j = 0; j < b; j++) {
            if (ary[i][j] == '#') {
                if (ary[i - 1][j] != '#' &&
                    ary[i + 1][j] != '#' &&
                    ary[i][j - 1] != '#' &&
                    ary[i][j + 1] != '#') {
                    return false;
                }
            }
        }
    }
    return true;
}

int main()
{
    char ary[60][60] = { '-' };
    int a, b;

    memset(ary, 0, 60 * 60);

    cin >> a >> b;

    for (int i = 0; i < a; i++) {
        cin >> ary[i + 1] + 1;
    }

    bool yes = check(ary, a, b);
    if (yes) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}

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

main(){
  static int C[3] = {1000, 500, 100}, ans[3];
  int a, b;
  while(1){
    cin >> a >> b;
    if ( a== 0 && b == 0 ) break;
    b -= a;
    for ( int i = 0; i < 3; i++ ){
      ans[3-i-1] = b/C[i];
      b = b%C[i];
    }
    for ( int i = 0; i < 3; i++ ){
      if (i) cout << " ";
      cout << ans[i];
    }
    cout << endl;
  }
}

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

long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }

long long countPrimeFactor(long long x)
{
    long long count = 1;
    long long prev_prime_factor = 1;
    long long i = 2;
    while (i * i <= x)
    {
        if (x % i == 0)
        {
            x /= i;
            if (i != prev_prime_factor)
                count++;
            prev_prime_factor = i;
        }
        else
        {
            i++;
        }
    }
    if (x != prev_prime_factor)
        count++;

    return count;
}

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

    long long a, b;
    cin >> a >> b;

    long long c = gcd(a, b);
    long long ans = countPrimeFactor(c);

    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
  
int main() {
  int N,X;
  cin >> N >> X;
  vi L(N);
  rep(i,N){
    cin >> L[i];
  }
  int d = 0;
  int cnt = 1;
  rep(i,N) {
    d += L[i];
    if(d > X) break;

    cnt++;
  }
  cout << cnt << endl;
  return 0;
}

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

#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_CAT_I(x,y) x ## y
//#define CPP_STR(x) CPP_STR_I(x)
//#define CPP_STR_I(args...) #args
//#define ASSERT(expr...) assert((expr))

using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
//using f80 = __float80;

constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
constexpr char EL[] = "\n";

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(),(x).end()
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))
#define UNIQUE(x) (x).erase(unique(all(x)), (x).end());
#define REPIT(x) for(auto it=(x).begin(), end=(x).end(); it!=end; ++it)
#define perm(c) sort(all(c)); for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

template<typename T = i64>
T IN() { T x; cin >> x; return (x); }

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T(&)[N]) { return static_cast<i64>(N); }

template<typename T, typename U, typename Comp = less<>>
bool chmax(T& xmax, const U& x, Comp comp = {}) {
	if (comp(xmax, x)) {
		xmax = x;
		return true;
	}
	return false;
}
template<typename T, typename U, typename Comp = less<>>
bool chmin(T& xmin, const U& x, Comp comp = {}) {
	if (comp(x, xmin)) {
		xmin = x;
		return true;
	}
	return false;
}

void print() {
  cout << EL;
}
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  cout << head;
  if (sizeof...(tail) != 0) cout << " ";
  print(forward<Tail>(tail)...);
}
template <class T>
void print(vector<T> &vec) {
  for (auto& a : vec) {
	cout << a;
	if (&a != &vec.back()) cout << " ";
  }
  cout << EL;
}
template <class T>
void print(vector<vector<T>> &df) {
  for (auto& vec : df) {
	print(vec);
  }
}

struct ProconInit {
	static constexpr int IOS_PREC = 15;
	static constexpr bool AUTOFLUSH = false;

	ProconInit() {
		cin.tie(nullptr);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(IOS_PREC);
		if (AUTOFLUSH)
			cout << unitbuf;
	}
} PROCON_INIT;
#pragma endregion

signed solve()
{
	int n, m;
	cin >> n >> m;
	vector<i64> a(n + 1), b(n + 1);
	FOR(i, 1, n + 1) { cin >> a[i] >> b[i]; }
	vector<i64> c(m + 1), d(m + 1);
	FOR(i, 1, m + 1) { cin >> c[i] >> d[i]; }

	FOR(i, 1, n + 1)
	{
		int ans = 0;
		i64 distance = INF;
		FOR(j, 1, m + 1)
		{
			if (chmin(distance, abs(a[i] - c[j]) + abs(b[i] - d[j])))
				ans = j;
		}
		print(ans);
	}
	return 0;
}

#ifndef LOCALCODE
signed main()
{
	return solve();
}
#endif


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define ll long long
using namespace std;
int main()
{
    string s;
    cin >> s;
    int n = s.size();
    int ans = 10000;
    rep(i, n - 2){
        string t;
        rep(j,3){
            t += s[i + j];
        }
        ans = min(abs(753 - stoi(t)), ans);
    }
    cout << ans << endl;

}


Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();

        long[] A = new long[N];

        for(int i=0; i<N; i++){
            A[i] = scanner.nextLong();
        }

        long x2 = 0;
        for(int i=0; i<N; i++){
            if(i%2 == 0){
                x2 += A[i];
            }else{
                x2 -= A[i];
            }
        }

        x2 /= 2;


        long[] ans = new long[N];

        ans[0] = x2;

        for(int i=1; i<N; i++){
            ans[i] = A[i-1] - ans[i-1];
        }

        for(int i=0; i<N; i++){
            if(i != 0){
                System.out.print(" ");
            }
            System.out.print(2*ans[i]);
        }
        System.out.println();
    }

    static List<Integer> primeList(int n) {
        List<Integer> list = new ArrayList<>();
        boolean[] prime = new boolean[n + 1];
        Arrays.fill(prime, true);
        prime[0] = false;
        prime[1] = false;
        for (int i = 2; i < Math.sqrt(n); i++) {
            if (!prime[i]) continue;
            for (int j = 2; i * j <= n; j++) {
                prime[i * j] = false;
            }
        }
        for (int i = 0; i < prime.length; i++) {
            if (prime[i]) list.add(i);
        }

        return list;
    }
}


Measured memory_bytes: 70620
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vll vector<ll>
#define rep(c, a, b) for(ll c=a;c<b;c++)
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(int argc, char const *argv[]) {
  ll n, k;std::cin >> n >> k;
  ll ans = 1;
  for(int i=0;i<n-1;i++) ans *= (k-1);
  std::cout << ans*k << '\n';
}


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

using namespace std;
typedef long long ll;

int main(){
	int n; cin >> n;
	vector< pair <int , int> > pair(n);
	for(int i = 0; i < n; i++){
		int temp;
		cin >> temp;
		pair[i].first = temp;
		pair[i].second = i + 1;
	}

	sort(pair.begin(), pair.end());

	for(int i = 0; i < n; i++){
		cout << pair[i].second << " ";
	}
	cout << endl;
}

Measured memory_bytes: 1664
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

pub fn digit_num(mut n: u64) -> u64 {
    let mut keta = 0;
    let d = 10;
    while n != 0 {
        keta += 1;
        n /= d;
    }
    keta
}

fn main() {
    input! {
        n: u64
    }
    let mut cnt = 0;
    for i in 1..n+1 {
        let k = digit_num(i);
        if k % 2 != 0 {
            cnt += 1;
        }
    }
    println!("{}", cnt);
}


Measured memory_bytes: 4352
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <vector>
#include <math.h>
#include <time.h>
#include <bitset>
#include <stdio.h>
#include <stdlib.h>
#include <iomanip>
#include <iostream>
#include <string.h>
#include <algorithm>
using  namespace  std;

#define ff first
#define ss second
#define pb push_back
#define ll long long
#define ull unsigned long long
#define min3(a, b, c) min(a, min(b, c))
#define max3(a, b, c) max(a, max(b, c))
#define mst(ss,b) memset(ss,b,sizeof(ss));
#define dbg(x) cout << #x << "= " << x << endl;
typedef pair <int, int> pii;
const int inf = 0x3f3f3f3f;
const ll INF = (1LL<<62)-1;
const ll mod = 1e9+7;
const int N = 4000+5;

char s1[N], s2[N];
int n, m;
ull p[30], h1[N][N], h2[N][N];

void calc(int n, ull hx[][N], char *s){
    for(int i=1; i<=n; i++){
        ull h = 0;
        for(int j=i; j<=n; j++)h += p[s[j]-'a'], hx[j-i+1][i] = h;
    }
}

void go(){
    int ans = 0;
    calc(n, h1, s1);
    calc(m, h2, s2);
    int len = min(n, m);
    for(int i=1; i<=n; i++)sort(h1[i]+1, h1[i]+2+n-i);
    for(int i=1; i<=m; i++)sort(h2[i]+1, h2[i]+2+m-i);
    for(int i=1; i<=len; i++){
        for(int j=1; j+i-1<=n; j++){
            int pos = lower_bound(h2[i]+1, h2[i]+2+m-i, h1[i][j])-h2[i];
            if(h2[i][pos] == h1[i][j])ans = max(ans, i);
        }
    }
    printf("%d\n", ans);
}

int  main(){
    scanf("%s%s", s1+1, s2+1);
    n = strlen(s1+1), m = strlen(s2+1);
    p[0] = 1;
    for(int i=1; i<30; i++)p[i] = p[i-1]*23;
    go();
    return 0;
}


// lower_bound()
// __builtin_popcount()
// ios::sync_with_stdio(false);
// freopen("in.txt","r",stdin);
// freopen("out.txt","w",stdout);
// const double eps=1e-12;
// #pragma comment(linker,"/STACK:102400000,102400000")

Measured memory_bytes: 158180
#include<stdio.h>
#include<string.h>
#define ll long long//不加wa5个点
#define For(i,a,b) for(register long long i=a;i<=b;i++)
using namespace std;
const int maxn=2e5+10;
char s[maxn];
ll ans,n;
int c[30];
signed main(){
	scanf("%s",s+1);
	n=strlen(s+1);
	ans=n*(n-1)/2;
	For(i,1,n){
		c[s[i]-'a']++;
	}
	For(i,0,26){
		ans-=1ll*c[i]*(c[i]-1)/2;
	}
	ans++;
	printf("%lld\n",ans);
}

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

#define FOR(i, l, r) for(size_t i = (l); i < (r); i = i + 1)
#define REP(i, n) FOR(i, 0, n)
using ll = long long;

int main() {
    int N, M;
    cin >> N >> M;
	int sum = 0;
  	int temp;
    REP(i, M) {
        cin >> temp;
      	sum += temp;
    }
  	if(N - sum >= 0) {
      cout << N - sum << endl;
    }
  	else {
      cout << -1 << endl;
    }
    return 0;
}


Measured memory_bytes: 3636
let split str delim =
  let open String in
  let rec doit s acc =
    match
      try Some (rindex s delim) with _ -> None
    with
    | None -> s :: acc
    | Some i -> doit (sub s 0 i) (sub s (i + 1) (length s - i - 1) :: acc) in
  doit str []

let solve n k =
  let a = Array.init n (fun _ -> read_int ()) in
  let rec check = function
    | (i, _, _, _) when i = n -> n
    | (i, j, _, _) when j >= k -> i
    | (i, j, s, p) when s + a.(i) <= p -> check (i + 1, j, s + a.(i), p)
    | (i, j, _, p) -> check (i, j + 1, 0, p) in
  let rec bin_search l r =
    if r < l then l
    else
      let m = (l + r) / 2 in
      if check (0, 0, 0, m) >= n then bin_search l (m - 1)
      else bin_search (m + 1) r in
  Printf.printf "%d\n" (bin_search 0 (100000 * 10000))

let () =
  match List.map int_of_string (split (read_line ()) ' ') with
  | [n; k] -> solve n k
  | _ -> exit 1

Measured memory_bytes: 5204
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
using namespace std;

int main() {
	uint64_t a, b, c;
	cin >> a >> b >> c;

	bool ans = false;

	uint64_t l = a * b;
	int64_t rr = c - a - b;
	if (rr > 0) {
		uint64_t r = (c - a - b);
		if (r * r > 4 * l && r > 0) ans = true;
	}
	if (ans) cout << "Yes" << endl;
	if (!ans) cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 888
#include <iostream>
using namespace std;
int main(){
	//町の数が10個以下なのでワーシャルフロイドでも時間制限に間に合う
	int path,n,i,j,k;
	int length[10][10]={};

	//初期化
	while(cin>>path && path != 0){

		for(int u = 0; u < 10; u++){
			for (int v = 0; v < 10; v++)
			{
				if(u==v){
					length[u][v]=0;
				}else{
					length[u][v]=10*100;
				}
			}

		}

		for(n=0;n<path;n++){
			cin>>i>>j;
			cin>>length[i][j];
			length[j][i]=length[i][j];
		}
		//本計算
		n=10;
		for(k = 0; k < n; k++){
			for ( i = 0; i < n; i++){
				for (j = 0; j < n; j++)
				{
					if(length[i][j]>length[i][k]+length[k][j]){
						length[i][j]=length[i][k]+length[k][j];

					}
				}
			}
		}
		int dsum[10]={};
		for(i=0; i<10; i++){
			for (j = 0; j < 10; j++)
			{
				if(length[i][j]==10*100){
					length[i][j]=0;
				}
				dsum[i]+=length[i][j];
			}
		}


		int min=10*100;
		int minindex=0;
		for(i=0;i<10;i++){
			if(min>dsum[i] && dsum[i]!=0){
				min=dsum[i];
				minindex=i;
			}

		}

		cout<<minindex<<" "<<min<<endl;

	}
}



Measured memory_bytes: 3060
N=int(input())
S=input()

sumE=[0]*(N+1)

for i in range(N):
    sumE[i+1]=sumE[i]
    if S[i]=="E":
        sumE[i+1]+=1

ans=10**9
for i in range(N):
    temp=(i-sumE[i])+(sumE[-1]-sumE[i+1])
    ans=min(ans,temp)
    
print(ans)

Measured memory_bytes: 44504
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>

using namespace std;

int main(){
	
	while(true){
		int n;
		cin >> n;
		if(n == 0){
			break;
		}
		int a[2000];
		for(int i = 0; i < n; i++){
			cin >> a[i];
		}
		sort(a, a + n);
		int ans = a[n - 1] - a[0];
		for(int i = 0; i < n - 1; i++){
			if(a[i + 1] - a[i] < ans){
				ans = a[i + 1] - a[i];
			}
		}
		cout << ans << endl;
	}
	return 0;
	
}



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

int main()
{
    long long int a,b,c,d;
        cin>>a>>b>>c>>d;

        double tak= ceil((1.0*c)/b);
        double akoi=ceil((1.0*a)/d);

        if(akoi<tak)
            cout<<"No"<<endl;
        else
            cout<<"Yes"<<endl;
}


Measured memory_bytes: 3636
#include <stdio.h>

int meiji[3]={1868,9,8};
int taisho[3]={1912,7,30};
int showa[3]={1926,12,25};
int heisei[3]={1989,1,8};

int cmp(int input[],int comp[]){//前後判定　inputがcompより前なら0 後なら1
    if(input[0]*372 + input[1]*31 + input[2] < comp[0]*372 + comp[1]*31 + comp[2])return 0;
    else return 1;
    //すべての月を31日、1年を371日と理想化して比較

}

int main(void){
    int input[3];//[0]=year,[1]=month,[2]=day
    while(scanf("%d %d %d",&input[0],&input[1],&input[2]) != EOF){
        if(cmp(input,meiji) == 0)printf("pre-meiji\n");
        else if(cmp(input,taisho) == 0)printf("meiji %d %d %d\n",input[0]-meiji[0]+1,input[1],input[2]);
        else if(cmp(input,showa) == 0)printf("taisho %d %d %d\n",input[0]-taisho[0]+1,input[1],input[2]);
        else if(cmp(input,heisei) == 0)printf("showa %d %d %d\n",input[0]-showa[0]+1,input[1],input[2]);
        else printf("heisei %d %d %d\n",input[0]-heisei[0]+1,input[1],input[2]);
    }
    return 0;
    
}

Measured memory_bytes: 1036
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<math.h>
#include<string>
#include <iomanip>
#include<deque>
#include<queue>
#include<stack>
#include<set>


using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
const ll LINF = 1e18;
const int INF = 1e9;

//マクロ定義
#define vvint(vec,n,m,l) vector<vector<int>> vec(n, vector<int>(m,l));	// lで初期化
#define vvll(vec,n,m,l) vector<vector<ll>> vec(n,vector<ll>(m,l));
#define vint vector<int>
#define pint pair<int,int>
#define rep(i,a) for(int i=0;i<(a);i++)
#define all(x) (x).begin(),(x).end()
#define debug system("pause")				//デバッグ用
#define ret return 0

template<class T>bool chmax(T & a, const T & b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }

#define ketasitei setprecision(15) //15桁表示



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

	ll k, x;
	cin >> k >> x;

	if (500 * k >= x)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
#include <map>
#include <iomanip>
#include <limits.h>
#include <cmath>
#include <stdio.h>

using namespace std;    
typedef long long ll;
typedef pair<ll, ll> pll;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const bool DEBAG = false;

ll pow10(int n){

    ll ret = 1;
    while(n != 0){
        n--;
        ret *= 10;
    }

    return ret;

}

int main(){

    int n;
    cin >> n;

    int keta = 0;
    int n_tmp = n;
    while(n_tmp > 0){
        keta += 1;
        n_tmp /= 10;
    }

    ll ans = 0;
    //cout << "keta " << keta << endl;

    if(keta % 2 == 1){
        ans += n - pow10(keta -1) + 1;
        keta --;
    }


    while(keta != 0){
        if(keta % 2 == 1) ans += 9 * pow10(keta) / 10; 
        keta --;
    }

    cout << ans << endl;

}

Measured memory_bytes: 256
import scala.io.StdIn._
import scala.collection._

object Main {

  class Sieve(val n: Int){
    private[this] val top = ((n - 3) / 2 + 1) + ((n - 4) / 3 * 2) - n/6 + ((n - 7) / 6)
    private[this] val cmpsts = new Array[Int]((top >>> 5) + 1)
    private[this] val sqrtLimit = (Math.sqrt(n).toInt - 3) / 2

    def isPrime(ci: Int): Boolean = (cmpsts(ci >>> 5) & (1 << (ci & 31))) == 0
    def setCmpst(ci: Int): Unit = cmpsts(ci >>> 5) |= 1 << (ci & 31)

    private def innerLoop(j: Int, p: Int): Unit = {
      if(j <= top){
        setCmpst(j)
        innerLoop(j + p, p)
      }
    }

    private def loop(i: Int): Unit = {
      if(i <= sqrtLimit){
        if(isPrime(i)){
          val p = 2 * i + 3
          innerLoop((p * p - 3) >>> 1, p)
        }
        loop(i + 1)
      }
    }

    private def next(i: Int): Int =
      if ((i > top) || isPrime(i)) 2 * i + 3 else next(i + 1)

    def exec: Iterator[Int] = {
      loop(0)
      Iterator.single(2) ++ Iterator.single(3) ++ Iterator.iterate(5)(p => next((p - 1) >>> 1)).takeWhile(_ <= n)
    }
  }

  def loop(s: String){
    if(s != null){
       val Array(n,_*) = s.split(" ").map(_.toInt)
       if(n<2) println(0)
       else if(n==2)println(1)
       else println(new Sieve(n).exec.size)
       loop(readLine)
    }
  }

  def main(args: Array[String]): Unit = loop(readLine)
}

Measured memory_bytes: 68012
import java.io.*;

class Main {
    public static void main (String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
        int i;

        int n = Integer.parseInt(br.readLine());
        int[] A = new int[n];
        for (i = 0; i < n; i++) {
            A[i] = Integer.parseInt(br.readLine());
        }

        int cnt = 0;

        int m = (int) (Math.log(n + 1) / Math.log(2));
        int[] G = new int[m];
        for (i = 0; i < m; i++) {
            G[i] = (int) Math.pow(2, m - i) - 1;
        }

        int j, k, g, v;

        for (i = 0; i < m; i++) {
            g = G[i];
            for (j = g; j < n; j++) {
                v = A[j];
                k = j - g;
                while (k >= 0 && A[k] > v) {
                    A[k + g] = A[k];
                    k = k - g;
                    cnt++;
                }
                A[k + g] = v;
            }
        }

        System.out.println(m);
        for (i = 0; i < m; i++) {
            System.out.print(G[i] + (i == m - 1 ? "\n" : " "));
        }
        System.out.println(cnt);
        for (i = 0; i < n; i++) {
            System.out.println(A[i]);
        }
    }
}

Measured memory_bytes: 106880
using System;

namespace C___Alchemist
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var input = Console.ReadLine().Split(' ');
            var a = new double[n];
            for (var i = 0; i < n; i++)
            {
                a[i] = double.Parse(input[i]);
            }
            Array.Sort(a);
            var b = a[0];
            for (var i = 1; i < n; i++)
            {
                b = (b + a[i]) / 2;
            }
            Console.WriteLine(b);
        }
    }
}

Measured memory_bytes: 11348
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define rREP(i,m,n) for(ll i = (m); i >= (n); i--)
#define ALL(c) (c).begin(), (c).end()
#define print(x) cout << (x) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} cout<<endl;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    int ary[n];
    rep(i,n) cin >> ary[i];
    ll ans = INF;
    REP(i,1,101)
    {
        ll tmp_ans = 0;
        rep(j,n)
        {
            tmp_ans += (ary[j] - i) * (ary[j] - i);
        }
        ans = min(ans, tmp_ans);
    }
    cout << ans << endl;
    
    
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main()
{
  int n, k;
  cin >> n >> k;
 	set < int > s;
 	for(int i = 0; i < k; i++)
 	{
 		int d;
 		cin >> d;
 		int z;
 		while(d--)
 		{
 			cin >> z;
 			s.insert(z);
 		}
 	} 
 	int ans = 0;
 	for(int i = 1; i <= n; i++)
 		if(s.count(i) == 0)
 			ans++;
 		cout << ans << endl;
}

Measured memory_bytes: 3624
import java.util.*; 

class Main{
public static void main(String[] args){
	Scanner sc=new Scanner(System.in);
        int a=sc.nextInt();
  		int b=sc.nextInt();
  		int c=Math.min(a,b);
  		int d=Math.max(a,b);
     String f= String.valueOf(c);
     String ans=""; 
    for(int e=0; e<d; e++){
     ans= ans+f;
    }
  
  	
    System.out.println(ans);
    
    
   
    }
}

Measured memory_bytes: 21716
import java.util.*;

public class Main {
	
	public static void main(String args[]){
		
		//A
		Scanner sc= new Scanner(System.in);
		int x= sc.nextInt();
		String ans = "NO";
		
		if(x==7 || x==5 || x==3){
			ans = "YES";
		}
		
		System.out.println(ans);
	}

}


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

using namespace std;

typedef long long ll;

const int INF = (1<<29);
const int INFF = 0x7fffffff;
const ll LINF = (1ll<<60);
const ll LINFF = 0x7fffffffffffffff;
const long double PI = 3.14159265359;

#define _fi(n) for(int i = 0;i < n;i++)
#define _fj(n) for(int j = 0;j < n;j++)
#define _fk(n) for(int k = 0;k < n;k++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define prec(x) cout << fixed << setprecision(x)
#define sz(x) (int)x.size()
#define _log2(x) 31-__builtin_clz(x)

#define hash sodnf9843bsd
#define right iadjfof23n3okd
#define pqueue priority_queue
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define len length
#define endl '\n'

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll rnd(ll a, ll b){return uniform_int_distribution<ll>(a, b)(rng);}


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

    int n;cin>>n;
    vector<double>p(n);
    _fi(n) cin>>p[i];

    double dp[3030] = {};
    dp[0] = 1;
    for(int coin = 0;coin < n;coin++){
        for(int h = n;h >= 0;h--){
            dp[h] = (1-p[coin])*dp[h];
            if (h > 0) dp[h] += p[coin]*dp[h-1];
        }
    }

    double ans = 0;
    for(int h = 1;h <= n;h++){
        if (h > n-h) ans += dp[h];
    }

    prec(10);
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3816
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define rep(i, n) for(ll i = 0; i < (n); i++)
int main(){
  ll n,ans=0,tmp=0;
  cin>>n;
  map<ll,ll> mp;
  rep(i,n){
    ll a;cin>>a;mp[a]++;
  }
  for(auto c:mp){
    if(c.second%2==0){
      mp[c.first]=0;
      tmp++;
    }else{
      mp[c.first]=1;
    }
  }
  ans+=(tmp/2)*2;
  for(auto c:mp){
    ans+=c.second;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 6528
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
#define pb push_back
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define cotu cout
#define itn int
const int INF = 1e9 + 7;

int main(){
    int n; cin>>n;
    for(int i = 1; i <= 9; i++){
        if(n%i==0 && n/i<=9){
            cout<<"Yes";
            return 0;
        }
    }
    cout<<"No";

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
// *st.find_by_order(index), 0-based
// order_of_key(e)

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int N; cin>>N;
	int ret=0;
	for (int i=1; i<=N; i++) {
		int a; cin>>a;
		if(i%2 && a%2) ret++;
	}
	cout<<ret<<"\n";
	return 0;
}

Measured memory_bytes: 3636
#[allow(unused_imports)]
use std::cmp::{min,max};
#[allow(unused_imports)]
use std::collections::BTreeMap;
#[allow(unused_imports)]
use std::ops::*;
#[allow(unused_imports)]
use std::collections::BinaryHeap;

fn main() {
    let n = read_i64() as usize;
    let xs = read_vec_i64();
    let res = xs.iter().fold(0, |r,x| r + x - 1);
    println!("{}", res);
}

#[allow(dead_code)]
fn read_line() -> String {
    let mut ret = String::new();
    std::io::stdin().read_line(&mut ret).ok();
    ret.pop();
    return ret;
}

#[allow(dead_code)]
fn read_i64() -> i64 {
    let ss = read_line();
    return ss.parse::<i64>().unwrap();
}

#[allow(dead_code)]
fn read_vec_i64() -> Vec<i64> {
    let mut res = vec![];
    let ss = read_line();
    for ts in ss.split_whitespace() {
        let x = ts.parse::<i64>().unwrap();
        res.push(x);
    }
    return res;
}

use std::fmt::Display;
#[allow(dead_code)]
fn write_vec<T: Display>(xs: &Vec<T>) {
    if xs.len() == 0 {
        println!("");
        return;
    }
    print!("{}", xs[0]);
    for i in 1..xs.len() {
        print!(" {}", xs[i]);
    }
    println!("");
}


Measured memory_bytes: 4352
using System;
using System.Collections.Generic;
using System.Linq;

namespace CSharpSample01
{

    
    class Program
    {

        static int[] Two_from_Ten(long a)
        {
            int[] ans_two = new int[50];

            long b = 0;

            int cnt = 0;
            while (true)
            {
                b = a % 2;
                a /= 2;

                ans_two[cnt] = (int)b;

                if(a == 0)
                {
                    break;
                }
                cnt++;
            }

            for(int i = cnt + 1; i < ans_two.Length; i++)
            {
                ans_two[i] = 0;
            }

            return ans_two;
        }

        static long Ten_from_Two(int[] nisin)
        {
            long ans_ten = 0;

            int cnt_sisu = 0;
            for(int i = 0; i < nisin.Length; i++)
            {               
                if(nisin[i] == 1)
                {
                    ans_ten += (long)Math.Pow(2, cnt_sisu);
                }
                cnt_sisu++;
            }

            return ans_ten;
        }

        static int[] XOR_by_two(int[] a, int[] b)
        {
            int[] s = new int[a.Length];
            
            for(int i = 0; i < a.Length; i++)
            {
                if(a[i] != b[i])
                {
                    s[i] = 1;
                }
                else
                {
                    s[i] = 0;
                }
            }

            return s;
        }

        static long Solve(long A)
        {
            long ans_ten = 0;
            long cnt_one;
            if(A % 2 == 1)
            {
                cnt_one = (A + 1) / 2;
                
                if(cnt_one % 2 == 1)
                {
                    ans_ten = 0;
                }
                else
                {
                    ans_ten = 1;
                }
            }
            else
            {
                cnt_one = A / 2;
                int B = 0;

                if(cnt_one % 2 == 1)
                {
                    B = 0;
                }
                else
                {
                    B = 1;
                }

                int[] left_two = Two_from_Ten(B);
                int[] right_two = Two_from_Ten(A);

                ans_ten = Ten_from_Two(XOR_by_two(left_two, right_two));

            }

            return ans_ten;
        }


        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            long A = long.Parse(str[0]);
            long B = long.Parse(str[1]);

            long a_ten = Solve(A - 1);
            long b_ten = Solve(B);

            /*
            Console.WriteLine("a : " + a_ten);
            Console.WriteLine("b : " + b_ten);
            */

            long ans_ten = Ten_from_Two(XOR_by_two(Two_from_Ten(a_ten), Two_from_Ten(b_ten)));

            Console.WriteLine(ans_ten);
            
        }
    }
}


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

int main() {
	long long k;
	priority_queue<int> s;
	string ope;

	while (1) {
		cin >> ope;
		if (ope == "end") break;
		else if (ope == "insert") {
			cin >> k;
			s.push(k);
		}
		else if (ope == "extract") {
			cout << s.top() << endl;
			s.pop();
		}
	}

	return 0;
}

Measured memory_bytes: 5980
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,int> pli;
typedef pair<int,int> pii;
#define rep(i,a,b) for(ll i=a ; i<b ; i++)
#define qrep(que, ite) for(auto ite=begin(que) ; ite!=end(que) ; ite++)
const int max_n = 1e5;
const ll mod = 1e9+7;
const ll INF = 1e17;
const int inf = 1e5;
//typedef long double ld;
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; }
ll gcd(ll a, ll b) { return a ? gcd(b%a, a) : b; }
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
ll mo = 998244353;
struct UnionFind {
    vector<int> par;

    UnionFind(int n) : par(n, -1) { }
    void init(int n) { par.assign(n, -1); }

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }

    int size(int x) {
        return -par[root(x)];
    }
};
struct SegmentTree{
  int N;
  vector<int> node;
  public :
    void intit(vector<int>v){
      int sz = v.size();
      N=1;
      while(N<sz) N*=2;
      node.resize(N);
      for(int i=0 ; i<sz ; i++) node[i+N-1] = v[i];
      for(int i=N-2 ; i>=0 ; i--) node[i] = min(node[i*2+1], node[i*2+2]);
    }
    void update(int x, int val){
      x += N-1;
      node[x+N-1] = val;
      while(x>0){
        x = (x-1)/2;
        node[x] = min(node[x*2+1], node[x*2+2]);
      }
    }
    int getmin(int a, int b, int k, int l, int r){
      if(b<=l || r<=a) return inf;
      else if(a<=l && r<=b) return node[k];
      else{
        int vl = getmin(a, b, 2*k+1, l, (l+r)/2);
        int vr = getmin(a, b, 2*k+2, (l+r)/2, r);
        return min(vl, vr);
      }
    }
};
void solve(const vector<int> &v){

}
int main(){
  int N;  string s;
  cin>>N>>s;
  vector<set<int> > v(10);
  rep(i,0,N){
    v[s[i]-'0'].insert(i);
  }
  int ans = 0;
  rep(i,0,10)rep(j,0,10)rep(k,0,10){
    int pos = -1;
    if(v[i].upper_bound(pos)==v[i].end()) continue;
    pos = *v[i].upper_bound(pos);
    if(v[j].upper_bound(pos)==v[j].end()) continue;
    pos = *v[j].upper_bound(pos);
    if(v[k].upper_bound(pos)==v[k].end()) continue;
    ans++;
  }
  cout<<ans<<endl;
  return 0;
}


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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)

int const MOD = 1e5;

int H, W;
vector<string> G;

inline bool able(int i, int j, int piece) {
  return G[i][j] == "JOI"[piece] || G[i][j] == '?';
}

inline bool goodFlag(int bitJO, int j, int piece) {
  return (bitJO >> j & 1) && piece == 2;
}

int main() {

  cin >> H >> W;
  G.resize(H);
  rep(i, H) {
    cin >> G[i];
  }

  static int dp[2][1<<20][2];
  dp[0][0][0] = 1;
  auto curr = dp[0], next = dp[1];

  rep(i, H) {

    rep(j, W) {
      rep(i, 1<<20) rep(j, 2) next[i][j] = 0;
      rep(bitJO, 1 << W) {
        rep(isJ, 2) {
          if(!curr[bitJO][isJ]) continue;
          rep(piece, 3) {
            int nBitJO = bitJO & ~(1 << j), nIsJ = piece == 0;
            if(!able(i, j, piece)) continue;
            if(goodFlag(bitJO, j, piece)) continue;
            if(isJ == 1 && piece == 1) nBitJO |= 1 << (j - 1);
            next[nBitJO][nIsJ] += curr[bitJO][isJ];
            if(next[nBitJO][nIsJ] >= MOD) next[nBitJO][nIsJ] -= MOD;
          }
        }
      }
      swap(curr, next);
    }

    rep(S, 1 << W){
      curr[S][0] += curr[S][1];
      if(curr[S][0] >= MOD) curr[S][0] -= MOD;
      curr[S][1] = 0;
    }

  }

  int ans = 1; rep(i, H) rep(j, W) if(G[i][j] == '?') (ans *= 3) %= MOD;
  int sum = 0; rep(S, 1 << W) (sum += curr[S][0]) %= MOD;
  cout << (ans - sum + MOD) % MOD << endl;

  return 0;
}

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

int main()
{
  int N;
  char a[101], b[101];
  cin>>N;
  cin >> a >> b;
  rep(i,N){
    cout << a[i] << b[i];
  }
  cout << endl;
}

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

#define PI 3.1415926535897932
#define MOD 1000000007
#define INF 1e9

#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define ALL(v) (v).begin(), (v).end()
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO  cout << "NO"  << endl
#define No  cout << "No"  << endl

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;


void solve()
{
    string S; cin >> S;
    string s1 = S.substr(0, 2);
    string s2 = S.substr(2, 2);
    int x = stoi(s1), y = stoi(s2);
    if(1 <= x && x <= 12 && 1 <= y && y <= 12) cout << "AMBIGUOUS" << endl;
    else if(1 <= y && y <= 12) cout << "YYMM" << endl;
    else if(1 <= x && x <= 12) cout << "MMYY" << endl;
    else cout << "NA" << endl;
} 
    
int main() 
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    solve();

    return 0;
}

Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef string str;

int main(){
  ll n,x;
  cin >> n >> x;
  ll m[n];
  REP(i,n){
    cin >> m[i];
    x-=m[i];
  }
  sort(m,m+n);
  cout << x/m[0]+n << endl; 
  return 0;
}


Measured memory_bytes: 256
def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i:
        divisors.append(n//i)

    divisors.sort()
  return divisors

a, b ,c = map(int, input().split())
divisors = make_divisors(c)
ans = []
for i in divisors:
  if  a <= i <= b:
    ans.append(i)
print(len(ans))


Measured memory_bytes: 5640
#include <bits/stdc++.h>
// #include <iostream>
// #include <vector>
// #include <map>
// #include <algorithm>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())

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

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

void solve(){
    string S;
    cin >> S;
    int len = S.size();

    for (int i = len-1; i >= 0; i--) {
        // cout << i << endl;
        if (S[i] == 'm') {
            if (S.compare(i-4, 5, "dream") == 0) {
                i -= 4;
            } else {
                cout << "NO" << endl;
                return;
            }
        } else if (S[i] == 'e') {
            if (S.compare(i-4, 5, "erase") == 0) {
                i -= 4;
            } else {
                cout << "NO" << endl;
                return;
            }
        } else if (S[i] == 'r'){
            if (S.compare(i-5, 6, "eraser") == 0) {
                i -= 5;
            } else if (S.compare(i-6, 7, "dreamer") == 0) {
                i -= 6;
            } else {
                cout << "NO" << endl;
                return;
            }
        }
    }

    cout << "YES" << endl;

    return;
}

int main(int argc, char const* argv[])
{
    solve();
    return 0;
}



Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define MAXN	405
#define MAXM	100005
template <typename T> void read(T &x) {
	x = 0; int f = 1;
	char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
	for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
	x *= f;
}
bool halted[MAXN], a[MAXN][MAXN];
int n, m, x[MAXM], y[MAXM];
int main() {
	read(n), read(m);
	for (int i = 1; i <= m; i++)
		read(x[i]), read(y[i]);
	for (int i = 1; i <= n; i++) {
		a[i][i] = true;
		for (int j = m; j >= 1; j--) {
			if (a[i][x[j]] && a[i][y[j]]) {
				halted[i] = true;
				break;
			}
			if (a[i][x[j]]) a[i][y[j]] = true;
			if (a[i][y[j]]) a[i][x[j]] = true;
		}
	}
	int ans = 0;
	for (int i = 1; i <= n; i++)
	for (int j = i + 1; j <= n; j++) {
		if (halted[i] || halted[j]) continue;
		bool flg = false;
		for (int k = 1; k <= n; k++)
			flg |= a[i][k] && a[j][k];
		if (flg == false) ans++;
	}
	cout << ans << endl;
	return 0;
}

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

int main() {
    int n;
    cin >> n;
    vector<int> d(n+5, 1);
    for (int i = 2; i <= n; ++i) {
        for (int j = 1; i*j <= n; ++j) {
            d[i*j]++;
        }
    }
    ll ans = 0;
    rep(i, n) {
        ans += (ll)d[i+1] * (ll)(i+1);
    }
    cout << ans << endl;
}

Measured memory_bytes: 42324
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define dunk(a) cout << (a) << "\n"
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int x, y, z;
	cin >> x >> y >> z;
	cout << z << ' ' << x << ' ' << y << endl;
	return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
sys.setrecursionlimit(pow(10, 6))

def main():
    n = int(input())
    a = [(i, _a) for i, _a in enumerate(map(int, input().split()))]
    a.append((n, 0))
    ans = [0 for _ in range(n)]
    a = list(sorted(a, key=lambda x: (-x[1], x[0])))
    mini = a[0][0]
    for j, _a in enumerate(a):
        if j>0 and a[j-1][1] != _a[1]:
            ans[mini] += (a[j-1][1] - _a[1]) * j
            mini = min(mini, a[j][0])
    print(*ans, sep='\n')


if __name__ == '__main__':
    main()


Measured memory_bytes: 68964
#include<algorithm>
#include<cassert>
#include<climits>
#include<cmath>
#include<cstring>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;

using lint = long long;
using P = pair<int, int>;
using LLP = pair<long long, long long>;

#define REP(i, x, n) for(int i = (x), i##_len = int(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = int(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = int(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = int(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = int(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())
#define TWINS(x) cout << ((x) ? "Yay!" : ":(") << endl

constexpr int IINF = (1 << 30) - 1;
constexpr long long LLINF = 1LL << 61;
constexpr double EPS = 1e-8;

const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};

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

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

int f(int x){
    return x * x;
}

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

    int n;
    cin >> n;

    while(n--){
        string s, t;
        cin >> s >> t;

        reverse(s.begin(), s.end());
        reverse(t.begin(), t.end());

        while(s.size() < t.size()){
            s.push_back('0');
        }
        while(t.size() < s.size()){
            t.push_back('0');
        }

        string ans = "";
        int k = 0;
        rep(i, s.size()){
            int tmp = s[i] - '0' + t[i] - '0' + k;
            ans.push_back((tmp % 10) + '0');
            k = tmp / 10;
        }
        if(k){
            ans.push_back(k + '0');
        }

        if((int)ans.size() <= 80){
            reverse(ans.begin(), ans.end());
            cout << ans << endl;
        }else{
            cout << "overflow" << endl;
        }
    }

    return 0;
}


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

bool d[10001];
int n;

int main(){

  memset(d,true,sizeof(d));
  d[0] = d[1] = false;
  for(int i=2;i*i<10001;i++){
    if(d[i] == true){
      for(int j=i+i;j<10001;j+=i) d[j] = false;
    }
  }

  while(cin >> n){

    int cnt = 0;
    for(int i=1;i<=n;i++){
      if(d[i] == true && d[n-(i-1)] == true) cnt++;
    }

    cout << cnt << endl;

  }
}

Measured memory_bytes: 1176
#include <iostream>
#include <vector>
using namespace std;
int main(void) {
  int N;
  cin >> N;
  unsigned long long allxor = 0;
  vector <unsigned long long> a(N);
  for (int i = 0; i < N; i++) {
    cin >> a[i];
    allxor ^= a[i];
  }

  for (int i = 0; i < N; i++) {
    cout << (unsigned long long)(allxor^a[i]) << endl;
  }
  return 0;
}


Measured memory_bytes: 4852
#include <bits/stdc++.h>
#include<algorithm>
#include<deque>
#include<string>
using namespace std;

#include<cstdio>
#define r(i,n) for(int i=0;i<n;i++)

int main(void){
  int n,i;
  cin>>n>>i;

  cout<<n-i+1<<endl;


return 0;}


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

int main(){
  unsigned long int n,m;
  cin >> n >> m;
  
  if(n*2 <= m){
    cout << n + (m-n*2)/4 << endl;    
  }
  else{
    cout << m/2 << endl;
  }
  
  return 0;
}


Measured memory_bytes: 384