akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define rep(i, a, b) for (int i = a; i < b; i++)
#define ff first
#define pii pair<int, int>
#define vii vector< pair<int,int> >
#define vi vector<int>
#define vvi vector< vector< int> >
#define vs vector<string>
#define ss second
#define pb push_back
#define mp make_pair
#define int long long
#define ll long long
#define all(a) a.begin(), a.end()
#define inf (1LL<<61)
#define ull unsigned long long
#define tr1(x)                cout<<#x<<": "<<x<<endl
#define tr2(x, y)             cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define tr4(x, y, z, d)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<" | "<<#d<<": "<<d<<endl
#define tr3(x, y, z)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define db1(x) cerr << #x << ": " << x <<'\n'
#define db2(x, y) cerr << #x << ": " << x << '\t' << #y << ": " << y <<'\n'
#define db3(x, y, z) cerr << #x << ": " << x << '\t' << #y << ": " << y << '\t' << #z << ": " << z <<'\n'
using namespace std;
int dx[]={1,0,-1, 0};int dy[]={0,1,0, -1}; //4 Direction
//int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
bool compare(const pair<pair<string,int>, int> &a,const pair<pair<string,int>, int> &b)
{
    if(a.ff.ff == b.ff.ff) {
        return (a.ff.ss > b.ff.ss);
    }
    return (a.ff.ff<b.ff.ff);
}
int min(int a, int b){
    if(a<b){
        return a;
    }
    else{
        return b;
    }
}
int max(int a, int b){
    if(a>b){
        return a;
    }
    else{
        return b;
    }
}
int max(int a, int b, int c){
    return(max( max(a,b), c ));
}
int min(int a, int b, int c){
    return (min ( min(a,b) , c));
}
int poww(int a, int b)
{
    int res = 1;
    for(int i = 1; i<=b; ++i)
        res *= a;

    return res;
}
int findlcm(int arr[], int n) 
{ 
    // Initialize result 
    int ans = arr[0]; 
  
    // ans contains LCM of arr[0], ..arr[i] 
    // after i'th iteration, 
    for (int i = 1; i < n; i++) 
        ans = (((arr[i] * ans)) / 
                (__gcd(arr[i], ans))); 
  
    return ans; 
}
bool prime[100001];
void SieveOfEratosthenes(int n) 
{
    memset(prime, true, sizeof(prime));

    for (int p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (int i=p*p; i<=n; i += p)
                prime[i] = false;
        }
  }
}

//Define mx for maximum range and MOD for large numbers
#define mx 500005
#define mod 1000000007 

// Declare all the variables and global functions here -

int32_t main(){
    IOS;
    int n,a,b;
    cin >> n>> a >> b;
    cout << min(n*a, b);
}   

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

ll solve() {
    ll N, a;
    cin >> N;
    unordered_map<ll, int> m;
    for ( int i = 0; i < N; i++ ) {
        cin >> a;
        m[a] = 1 - m[a];
    }
    ll ans = 0;
    for ( auto x : m ) {
        ans += x.second;
    }
    return ans;
}

int main() {
    auto ans = solve();
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 4388
n=int(input())
l=[0]*(10000+1)
l[0]=1
for i in range(n):
  s=int(input())
  for j in range(10000,s-1,-1):
    if l[j-s]:l[j]=1
for j in range(10000,-1,-1):
  if j%10 and l[j]:print(j);exit()
print(0)

Measured memory_bytes: 3064
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x) (x).begin(), (x).end()
#define rep(i, s, n) for (i64 i = (s), i##_limit = (n); i < i##_limit; ++i)
#define repr(i, s, t) for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#define var(type, ...) \
    type __VA_ARGS__;  \
    read(__VA_ARGS__);
#ifndef DBG
#define dump(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U>
inline bool chmax(T &a, const U &b) {
    return b > a && (a = b, true);
}
template <class T, class U>
inline bool chmin(T &a, const U &b) {
    return b < a && (a = b, true);
}
constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> makeV(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto makeV(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(makeV<T>(initValue, args...))>(
        sz, makeV<T>(initValue, args...));
}

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

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail &... tail) {
    cin >> head;
    read(tail...);
}

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail &&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream &operator<<(ostream &os, const vector<T> &vec) {
    static constexpr const char *delim[] = {" ", ""};
    for (const auto &e : vec) os << e << delim[&e == &vec.back()];
    return os;
}

template <class Container>
struct Rev {
    Container &x_;
    inline Rev(Container &x) : x_(x) {}
    inline auto begin() { return rbegin(x_); }
    inline auto end() { return rend(x_); }
};
// }}} End Header

// Make PrimeTable [0, N] in Compile Time.
template <size_t N>
struct Eratosthenes {  // {{{
#ifdef DBG
#define constexpr /* Disable constexpr */
#endif

    bool isPrime[N + 1]{};

    constexpr explicit Eratosthenes() {
        if (N < 2) return;
        isPrime[2] = true;
        for (int i = 3; i <= N; i += 2) isPrime[i] = true;
        for (int i = 3; i * i <= N; i += 2) {
            if (isPrime[i])
                for (int k = i * i; k <= N; k += i) isPrime[k] = false;
        }
    }

    constexpr vector<int> primes(size_t n = N) const {
        if ((n = min(n, N)) < 2) return {};
        vector<int> a{2};
        for (int i = 3; i <= n; i += 2)
            if (isPrime[i]) a.push_back(i);
        return a;
    }

    constexpr bool operator[](size_t i) const { return isPrime[i]; }

#ifdef constexpr
#undef constexpr
#endif
};  // }}}

Eratosthenes<100010> isprime;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    vector<int> cum(100010);
    rep(i, 1, 100005) {
        cum[i + 1] = cum[i] + (isprime[i] && isprime[(i + 1) / 2]);
    }

    var(int, Q);
    rep(i, 0, Q) {
        var(int, l, r);
        ++r;
        print(cum[r] - cum[l]);
    }

    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define per1(i,n) for(int i=n;i>0;i--)
#define all(v) v.begin(), v.end()
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,q;
    ll ans=0;
    cin>>n;
    vec A(n),num(100001,0);
    rep(i,n) cin>>A[i],num[A[i]]++,ans+=A[i];
    cin>>q;
    rep(i,q){
        ll b,c;
        cin>>b>>c;
        ans-=b*num[b];
        ans+=c*num[b];
        num[c]+=num[b];
        num[b]=0;
        cout<<ans<<"\n";
    }
}

Measured memory_bytes: 4780
/*
  Vivek Rathi
  CSE 2nd Year
  MNNIT
*/
#include<bits/stdc++.h>
using namespace std;
#define M 1000000007
#define ll long long int
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define debug1(x) cout<<#x<<" "<<x<<endl;
#define debug2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<endl;
#define present(c,x) ((c).find(x) != (c).end())
#define null NULL
#define mp make_pair
#define fi first
#define se second
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);
#define inf 1e17
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
ll lens,lent;
string s,t;
ll dp[3001][3001];
ll solve(ll i,ll j)
{
	if(j==lent)
	{
		return 0;
	}
	if(i==lens)
	{
		return 0;
	}
	if(dp[i][j]!=-1) return dp[i][j];
	ll ans1=0,ans2=0,ans3=0;
	if(s[i]==t[j])
	{
		ans1=1+solve(i+1,j+1);
	}
	ans2=solve(i,j+1);
	ans3=solve(i+1,j);
	//debug3(i,j,max(ans1,max(ans2,ans3)));
	return dp[i][j]=max(ans1,max(ans2,ans3));
}
int main()
{
	boost
	memset(dp,-1,sizeof(dp));
	cin>>s>>t;
	lens=s.length();
	lent=t.length();
	solve(0,0);
	ll anslen = dp[0][0];
	ll prev=0;
	string ans;
	for(ll i=0,j=0;i<lens&&j<lent;)
	{
		if(s[i]==t[j])
		{
			ans=ans+s[i];
			i++;
			j++;
		}
		else if(dp[i][j+1]>dp[i+1][j+1]&&dp[i][j+1]>dp[i+1][j])
		{
			j++;
		}
		else i++;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 70912
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
#![macro_use]

use std::cmp::*;
use std::collections::*;
use std::io::*;
use std::mem::*;
use std::num::*;
use std::slice::*;

fn main() {
    let (r, w, e) = (stdin(), stdout(), stderr());
    let mut io = IO::new(r.lock(), w.lock(), e.lock());
    // =============================================== //
    let n: usize = io.read();
    let mut p = vec![0f64; n];
    let mut dp = vec![vec![0f64; n + 1]; n];
    for i in 0..n {
        let k: f64 = io.read();
        p[i] = k;
    }
    let mut rp = vec![1f64; n];
    for (i, v) in p.iter().enumerate() {
        rp[i] = rp[i] - v;
    }
    dp[0][0] = 1f64 - p[0];
    dp[0][1] = p[0];
    for i in 1..n {
        for j in 0..(i + 2) {
            if j > 0 {
                dp[i][j] = dp[i - 1][j - 1] * p[i] + dp[i - 1][j] * rp[i];
            } else {
                dp[i][j] = dp[i - 1][j] * rp[i];
            }
        }
    }
    let mut ans = 0f64;
    for i in (n / 2 + 1)..n + 1 {
        ans += dp[n - 1][i];
    }
    io.writeln(ans);
}

// IO
struct IO<R: Read, W: Write, E: Write> {
    Read: R,
    Write: BufWriter<W>,
    Error: BufWriter<E>,
}
impl<R: Read, W: Write, E: Write> IO<R, W, E> {
    fn new(r: R, w: W, e: E) -> IO<R, W, E> {
        IO {
            Read: r,
            Write: BufWriter::new(w),
            Error: BufWriter::new(e),
        }
    }
    fn read<T>(&mut self) -> T
    where
        T: std::str::FromStr,
    {
        let next: String = self
            .Read
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect();
        next.parse().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
    fn readn<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read::<T>()).collect::<Vec<_>>()
    }
    fn readmat<T: std::str::FromStr>(&mut self, n: usize, m: usize) -> Vec<Vec<T>> {
        (0..n).map(|_| self.readn(m)).collect()
    }
    fn write<S: ToString>(&mut self, val: S) {
        self.Write.write(val.to_string().as_bytes());
    }
    fn writeln<S: ToString>(&mut self, val: S) {
        self.Write.write(val.to_string().as_bytes());
        self.Write.write(b"\n");
    }
    fn debug<S: std::fmt::Debug>(&mut self, val: S) {
        writeln!(self.Error, "(debug ) {:?}", &val);
    }
    fn debug2<S: std::fmt::Debug, T: std::fmt::Debug>(&mut self, val1: S, val2: T) {
        writeln!(self.Error, "(debug2) {:?} -> {:?}", val1, val2);
    }
}


Measured memory_bytes: 90364
#include <bits/stdc++.h>
#define rep(i, z, n) for(int i = z; i < n; i++)
#define all(v) v.begin(), v.end()
typedef long long ll;
#define PI 3.14159265358979

//const int64_t INF = 1LL << 60;
const int INF = 1 << 29;
const int64_t MOD = 1000000007;
//const int64_t INF = 998244353;
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; }
using namespace std;
//#define P pair<int, int>
typedef pair<int, int> P;

int main(){
    int64_t N;
    cin >> N;
    int M = pow(N, 0.5);
    int64_t x, y;
    for (int64_t i = M; i >= 1; i--){
        if (N % i == 0){
            x = i;
            y = N / i;
            break;
        }
    }
    cout << (x + y) - 2 << endl;
}


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

const int MAX_SIZE = 86400;

bool ok(int N, int L, int s[], int t[], int u[], double m) {
  double w = L, e[2];
  for (int j = 0; j < 2; ++j) {
    for (int i = 0; i < N + 2; ++i) {
      w += (m - u[i]) * (t[i] - s[i]);
      if (w <= 0.0) {
        return false;
      }
      if (i < N + 1) {
        w += m * (s[i + 1] - t[i]);
      }
      if (w > L) w = L;
    }
    e[j] = w;
  }
  return e[1] >= e[0];
}

double calc(int N, int L, int s[], int t[], int u[]) {
  double l = 0.0, r = 1e6, m;
  for (int k = 0; k < 50; ++k) {
    if (r - l < 1e-7) break;
    m = (l + r) / 2;
    if (ok(N, L, s, t, u, m)) {
      r = m;
    } else {
      l = m;
    }
  }
  return m;
}

int main() {
  int N, L, s[MAX_SIZE + 2], t[MAX_SIZE + 2], u[MAX_SIZE + 2];
  while (true) {
    cin >> N >> L;
    if (!N) break;
    for (int i = 0; i < N; ++i) {
      cin >> s[i + 1] >> t[i + 1] >> u[i + 1];
    }
    s[0] = 0; t[0] = s[1]; u[0] = 0;
    s[N + 1] = t[N]; t[N + 1] = 86400; u[N + 1] = 0;
    cout << fixed << setprecision(7) << calc(N, L, s, t, u) << endl;
  }
}

Measured memory_bytes: 2248
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() { 
  ios::sync_with_stdio(false); cin.tie(0);
  auto solve = [] () {
    int n;
    cin >> n;
    vector<long long> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    string s;
    cin >> s;
    vector<long long> base(61);
    for (int i = n - 1; i >= 0; i--) {
      long long cur = a[i];
      for (int j = 0; j < 61; j++) {
        if (cur & (1LL << j)) {
          cur ^= base[j];
        }
      }
      if (s[i] == '0') {
        if (cur != 0) {
          int id = 0;
          while (true) {
            if (cur & (1LL << id)) {
              break;
            }
            id++;
          }
          base[id] = cur;
        }
      } else if (cur != 0) {
        return 1;
      }
    }
    return 0;
  };
  int t;
  cin >> t;
  while (t--) cout << solve() << '\n';
  return 0;
}

Measured memory_bytes: 3576
import java.io.*;
import java.util.*;


public class Main {

    public static void main(String[] args) throws IOException {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        InputReader.OutputWriter out = new InputReader.OutputWriter(outputStream);

        int n = in.nextInt();
        int x = in.nextInt();
        int min = Integer.MAX_VALUE;
        int [] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = in.nextInt();
        }
        Arrays.sort(a);
        int diff = Math.abs(x - a[0]);
        int gcd = diff;
        for (int i = 1; i < a.length; i++) {
            int current = a[i] - a[i-1];
            gcd = gcd(current,gcd);
        }
        out.println(gcd);
        out.flush();
    }
    static int gcd (int a,int b) {
        return b == 0 ? a : gcd(b,a%b);
    }


    private static int [] mergeTwoArrays(int [] a, int [] b) {
        int [] res = new int[a.length + b.length];
        int i = 0;
        int j = 0;
        int index = 0;
        while (i<a.length && j<b.length) {
            if(a[i]<b[j]) {
                res[index++] = a[i++];
            }
            else {
                res[index++] = b[j++];
            }
        }
        System.out.println(i + " " + j);
        if(j == b.length - 1) {
            while (i<a.length) {
                res[index++] = a[i++];
            }
        }
        else {
            while (j<b.length) {
                res[index++] = b[j++];
            }
        }
        return res;
    }
}
class Point {
    private int left;
    private int right;

    public int getLeft() {
        return left;
    }

    public int getRight() {
        return right;
    }
    public Point(int left,int right) {
        this.left = left;
        this.right = right;
    }
}

class InputReader extends BufferedReader {
    StringTokenizer tokenizer;

    public InputReader(InputStream inputStream) {
        super(new InputStreamReader(inputStream), 32768);
    }

    public InputReader(String filename) {
        super(new InputStreamReader(Thread.currentThread().getContextClassLoader().getResourceAsStream(filename)));
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(readLine());
            } catch (IOException e) {
                throw new RuntimeException();
            }
        }
        return tokenizer.nextToken();
    }

    public Integer nextInt() {
        return Integer.valueOf(next());
    }
    public Long nextLong() {return  Long.valueOf(next());}

    static class OutputWriter extends PrintWriter {
        public OutputWriter(OutputStream outputStream) {
            super(outputStream);
        }

        public OutputWriter(Writer writer) {
            super(writer);
        }

        public OutputWriter(String filename) throws FileNotFoundException {
            super(filename);
        }

        public void close() {
            super.close();
        }
    }
}

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

int main(){
    //input
    long long n, m;
    cin >> n >> m;
    long long i, j;
    long long c[m+1];
    long long one_spot;
    for(i = 1; i <= m; i++){
        cin >> c[i];
        if(c[i] == 1){
            one_spot = i;
        }
    }
    if(c[1] != 1){
        swap(c[1],c[one_spot]);
    }

    //calc
    long long dq[m+1][n+1];
    for(j = 0; j <= n; j++){
        dq[1][j] = 0;
    }
    for(i = 1; i <= m; i++){
        dq[i][0] = 0;
    }
    for(i = 2; i <= m; i++){
        for(j = 1; j <= n; j++){
            if(j < c[i]){
                dq[i][j] = dq[i-1][j];
            }else{
                dq[i][j] = max(dq[i-1][j],dq[i][j-c[i]] + (c[i]-1));
            }
        }
    }

    //answer
    cout <<  n - dq[m][n] << endl;
    return 0;
}


Measured memory_bytes: 10908
def main():
    sx, sy, tx, ty = map(int, input().split())
    print('U' * (ty - sy), end='')
    print('R' * (tx - sx), end='')
    print('D' * (ty - sy), end='')
    print('L' * (tx - sx + 1), end='')
    print('U' * (ty - sy + 1), end='')
    print('R' * (tx - sx + 1), end='')
    print('D', end='')
    print('R', end='')
    print('D' * (ty - sy + 1), end='')
    print('L' * (tx - sx + 1), end='')
    print('U')

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include<stdio.h>

int main(void)
{
int a,b;

scanf("%d",&a);
scanf("%d",&b);

if(a<b){
printf("a < b\n");
}
else if(a>b){
printf("a > b\n");
}
else if(a==b){
printf("a == b\n");
}

return 0;
}

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

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

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define FORR(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)

#define DEBUG(x) cout << #x << ": " << (x) << endl
#define DEBUG_VEC(v) cerr<<#v<<": ";REP(__i,(v).size())cerr<<((v)[__i])<<", ";cerr<<endl
#define PRINT(x) cout << x << endl
#define all(x) x.begin(),x.end()

int main() {
    int n,m;
    cin >> n >> m;
    vi a(n);
    int sum = 0;
    REP(i,n){
        cin >> a[i];
        sum += a[i];
    }
    
    int count = 0;
    REP(i,n){
        if ( m*a[i]*4 >= sum) count++;
    }

    if(count>=m) cout << "Yes" << endl;
    else cout << "No" << endl;


}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define IFOR(i, m, n) for(int i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
const ll INF = 1e18;
/* テンプレートここまで */

int main() {
  ll n; cin >> n;
  vector<ll> t(n);
  ll sum = 0;
  REP(i, n){
    cin >> t[i];
    sum += t[i];
  }
  ll m; cin >> m;
  REP(i, m){
    ll p,x; cin >> p >> x;
    p--;
    cout << sum - t[p] + x << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i= 0; i < (n); i++)
using ll= long long int;
using namespace std;
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 mod= 1e9 + 7;



int main(){
  string s;
  cin >> s;
  string a="dreamer",b="eraser";
  int g=s.size();
  int d=0;
  bool ans=1;
  while(d<g){
    if(s[d]=='e'){
      for(int i=d;i<d+5;i++){
        if(s[i]!=b[i-d])ans=0;
      }
      d+=5;
      if(s[d]=='r')d++;
    }else 
    if(s[d]=='d'){
      for(int i=d;i<d+5;i++){
        if(s[i]!=a[i-d])ans=0;
      }
      d+=5;
      if(s[d]=='e' && s[d+1]=='r' && s[d+2]!='a')d+=2;
    }else{ans=0;}

    if(ans==0)break;
  }

  if(ans){cout << "YES" << endl;}else{cout << "NO" << endl;}
}

Measured memory_bytes: 3724
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cassert>
#include <cstring>
#include <climits>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define INF (ll)1e18
#define MOD (ll)1e9 + 7
#define pb push_back

typedef long long ll;
typedef long long int llt;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

char dif = 'A' - 'a';
int mod = 1e9 + 7;
ll inf = 1e18;

int main()
{
    ll x, y;
    cin >> x >> y;
    if(abs(x-y)<=1)
        cout << "Brown" << endl;
        else
            cout << "Alice" << endl;
        return 0;
}


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

int main(){
    string s1, s2;
    cin >> s1 >> s2;

    for(int i = 0; i < 3; i++){
        if(s1[i] != s2[2-i]){
            cout << "NO" << endl;
            return 0;
        }
    }

    cout << "YES" << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

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

    int n;
    int m;
    while(true) {
      n = sc.nextInt();
      m = sc.nextInt();
      if (n == 0 && m == 0) return;
      int a[] = new int[n];
      for (int i = 0; i < n; i++){
        a[i] = sc.nextInt();
      }
      int max = 0;
      for (int i = 0; i < n-1; i++) {
        for (int j = 1; j < n; j++) {
          if (i != j && a[i] + a[j] <= m) {
            if (a[i] + a[j] > max) {
              max = a[i] + a[j];
            }
          }
        }
      }
      System.out.println(max == 0 ? "NONE" : max);
    }
  }
}



Measured memory_bytes: 53904
n, m = map(int, input().split())
a = list(map(int, input().split()))
list = sorted(a, reverse=True)
total = 0
for i in range(n):
    total += a[i]
for i in range(m):
    if list[i] < total * (1 / (4 * m)):
        print('No')
        exit()
print('Yes')



Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
template <class T>
void get_unique(vector<T>& x) {
    x.erase(unique(x.begin(), x.end()), x.end());
}
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;
}
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for (int i = 0; i < sz(v); i++) {
        os << v[i];
        if (i < sz(v) - 1) os << " ";
    }
    return os;
}
int main() {
    ll n;
    cin >> n;
    ll ans = 0;
    for (ll a = 1; a < n; a++) {
        for (ll b = 1; b < n; b++) {
            if (a * b >= n) break;
            ans++;
        }
    }
    cout << ans << '\n';
}

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

// input
int N, H;
vector<int> A, B;


void input() {
    cin >> N >> H;
    A = B = vector<int>(N);
    rep(i, N) cin >> A[i] >> B[i];
}


int main() {
    input();
    sort(B.rbegin(), B.rend());
    int m = *max_element(A.begin(), A.end());
    int ans = 0;
    rep(i, N) {
        if (H > 0 && B[i] > m) {
            H -= B[i];
            ans++;
        }
    }
    if (H > 0) ans += (H - 1) / m + 1;
    cout << ans << endl;
}


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






#define pf                  printf
#define sf(a)               scanf("%d",&a)
#define sfl(a)              scanf("%lld",&a)
#define sff(a,b)            scanf("%d %d",&a,&b)
#define sffl(a,b)           scanf("%lld %lld",&a,&b)
#define sfff(a,b,c)         scanf("%d %d %d",&a,&b,&c)
#define sfffl(a,b,c)        scanf("%lld %lld %lld",&a,&b,&c)
#define sffff(a,b,c,d)      scanf("%d %d %d %d",&a,&b,&c,&d)
#define sffffl(a,b,c,d)     scanf("%lld %lld %lld %lld",&a,&b,&c,&d)
#define sfffff(a,b,c,d,e)   scanf("%d %d %d %d %d",&a,&b,&c,&d,&e)
#define sfffffl(a,b,c,d,e)  scanf("%lld %lld %lld %lld %lld",&a,&b,&c,&d,&e)
#define sfc(a)              scanf("%c",&a)
#define pii                 pair<int,int>
#define ms(a,b)             memset(a,b,sizeof(a))
#define pb(a)               push_back(a)
#define pbp(a,b)            push_back({a,b})
#define db                  double
#define ft                  float
#define ll                  long long
#define ull                 unsigned long long
#define pii                 pair<int,int>
#define ff                  first
#define ss                  second
#define sz(x)               x.size()
#define all(x)              x.begin(),x.end()
#define CIN                 ios_base::sync_with_stdio(0); cin.tie(0)
#define max3(a, b, c)       max(a, b) > max(b, c) ? max(a, b) : max(b, c)
#define min3(a, b, c)       min(a, b) < min(b, c) ? min(a, b) : min(b, c)
#define for0(i,n)           for(int i=0;i<n;i++)
#define for1(i,n)           for(int i=1;i<=n;i++)
#define forrev(i,n)         for(int i=n-1; i>=0; i--)
#define forab(i,a,b)        for(int i=a;i<=b;i++)
#define forba(i,b,a)        for(int i=b;i>=a;i--)
#define stlloop(x)          for(__typeof(x.begin()) it=x.begin();it!=x.end();it++)
#define gcd(a, b)           __gcd(a, b)
#define lcm(a, b)           ((a)*((b)/gcd(a,b)))
#define case1(z)            cout<<"Case "<<z<<": "
#define case2(z)            printf("Case %d: ",z)
#define PI                  acos(-1) //3.14159265358979323846264338328
#define valid(tx,ty)        tx>=0 && tx<row && ty>=0 && ty<col
#define intlim              2147483648
#define N                   200005
#define inf                 100000008
#define mod                 1000000007

/*------------------------------Graph Moves----------------------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*---------------------------------------------------------------------*/


ll x[N];




int main()
{
    ll n,i,j,k=0;
    string s;
    cin>>n>>s;
    if(n%2==0)
    {
        for(i=0,j=n/2;i<n;i++,j++)
        {
            if(s[i]==s[j])
                k++;
        }
        if(k==n/2)
            cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
    return 0;
}
































Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;cin>>n;
  vector<int >nos(n+1,0);
  for(int x=1;x<=100;x++)
    for(int y=1;y<=100;y++)
      for(int z=1;z<=100;z++)
      {
        int val = x*x+y*y+z*z+x*y+x*z+y*z;
        if(val>n)continue;
        else nos[val]+=1;
      }
  for(int i=1;i<=n;i++)cout<<nos[i]<<'\n';
}

Measured memory_bytes: 3512
#include <iostream>
#include <string>
#include <unordered_map>
#include <cstring>
#include <chrono>
#include <vector>
#include <map>
#include <random>
#include <set>
#include <algorithm>
#include <math.h>
#include <cstdio>
#include <stdio.h>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <deque>
#include <cassert>
#include <stack>
using namespace std;
 
#define max3(a, b, c) max(a, max(b, c))
#define min3(a, b, c) min(a, min(b, c))
#define mp make_pair
#define f first
#define se second
#define pb push_back
#define ppb pop_back
#define ll long long
#define y1 abcde
#define ull unsigned long long
#define cntbit(x) __builtin_popcount(x)
#define endl '\n'
#define uset unordered_set
#define umap unordered_map
#define pii pair<int, int>
#define ld long double
#define pll pair<long long, long long>
#define int long long

const ll inf = 1e15;
const int N = 4e2 + 15;
int n, a[N], p[N], dp[N][N];

int rec(int l, int r) {
    if(dp[l][r])
        return dp[l][r];
    dp[l][r] = inf;
    for(int i = l; i < r; ++i)
        dp[l][r] = min(dp[l][r], rec(l, i) + rec(i + 1, r) + (p[r] - p[l-1]));
    return dp[l][r];
}

main() {
    ios_base::sync_with_stdio(0); cout.tie(0); cin.tie(0);
    cin >> n;
    for(int i = 1; i <= n; ++i) {
        cin >> a[i];
        p[i] = p[i-1] + a[i];
        dp[i][i] = a[i];
    }
    cout << rec(1, n) - p[n] << endl;
    return 0;
}

Measured memory_bytes: 1536
import Control.Applicative
import Control.Monad
import Control.Monad.ST
-- import qualified Data.ByteString as BS
import Data.Functor
import Data.Function
import Data.Monoid
import Data.Maybe
import Data.List
import qualified Data.Foldable as Foldable
--import qualified Data.Set as Set
--import qualified Data.Sequence as Sequence
import Data.List.Split
import Data.Bits
import Data.Char
import Data.Ix
import Data.Ratio
import Data.Ord
import Data.Fixed
import Data.Tuple
--import Data.Array
--import Data.Array.Unboxed
import Data.Array.IArray
import Data.Array.MArray
import Data.Array.IO
import Data.Array.ST
import Data.IORef
import Data.STRef
import Text.Printf
import System.IO
-- import System.IO.Unsafe
 
-- templete
readInt = read :: String -> Int
readInteger = read :: String -> Integer
readDouble = read :: String -> Double
getInt = readLn :: IO Int
getInts = map readInt . words <$> getLine
getInteger = readLn :: IO Integer
getIntegers = map readInteger . words <$> getLine
getDouble = readLn :: IO Double
getDoubles = map readDouble . words <$> getLine
sjoin :: (Show a) => [a] -> String
sjoin = unwords . map show
tjoin :: (Show a, Show b) => (a, b) -> String
tjoin (x, y) = show x ++ (' ' : show y)
cond :: a -> a -> Bool -> a
cond t f c = if c then t else f
apply2 :: (a -> a -> b) -> [a] -> b
apply2 f [x,y] = f x y
apply3 :: (a -> a -> a -> b) -> [a] -> b
apply3 f [x,y,z] = f x y z
apply4 :: (a -> a -> a -> a -> b) -> [a] -> b
apply4 f [x,y,z,w] = f x y z w
fnTuple :: (a -> b, a -> c) -> a -> (b, c)
fnTuple (f,g) a = (f a, g a)
replace :: (Eq a) => a -> a -> [a] -> [a]
replace x y = map (\z -> if z==x then y else z)
binMap :: (a -> a -> b) -> [a] -> [b]
binMap f (x:xs@(y:_)) = f x y : binMap f xs
binMap _ _ = []
splitRec :: Int -> [a] -> [[a]]
splitRec _ [] = []
splitRec n xs = let (y,ys) = splitAt n xs in y : splitRec n ys
infixl 7 `divCeil`
divCeil :: Integral a => a -> a -> a
x `divCeil` y = (x+y-1) `div` y
coverC :: Ord a => (a, a) -> a -> Bool
coverC (l,r) x = l<=x && x<=r
coverH :: Ord a => (a, a) -> a -> Bool
coverH (l,r) x = l<=x && x<r
ibsearch :: (Int -> Bool) -> (Int,Int) -> Int
ibsearch f (ok,ng) = if abs (ok-ng) <= 1 then ok else let mid = (ok + ng) `div` 2 in ibsearch f (if f mid then (mid,ng) else (ok,mid))
whenM :: Monad m => m Bool -> m () -> m ()
whenM c a = c >>= flip when a
unconsU :: [a] -> (a, [a])
unconsU (x:xs) = (x, xs)
-- templete


main = do
    [x, y] <- getIntegers
    print . length . takeWhile (<=y) . iterate (*2) $ x

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

#include <limits.h>

using namespace std;

typedef long long ll;

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

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

int main(void) {
    int N;
    cin >> N;

    if (N % 2 == 0) {
        cout << N << endl;
    } else {
        cout << N * 2 << endl;
    }

    return 0;
}


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

int odd(long long k){
    return ((k+1)/2)%2;
}

long long calc(long long k){
    if(k%2==1) return odd(k);
    else return (k+1)^odd(k+1);
}

int main(void){
    long long A,B;
    cin>>A>>B;
    
    cout<<(calc(A-1)^calc(B))<<endl;
}

Measured memory_bytes: 256
#include<map>
#include<cmath>
#include<stack>
#include<queue>
#include<cstdio>
#include<vector>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
template<class Read>void in(Read &x){
    x=0;
    int f=0;
    char ch=getchar();
    while(ch<'0'||ch>'9'){
        f|=(ch=='-');
        ch=getchar();
    }
    while(ch>='0'&&ch<='9'){
        x=(x<<1)+(x<<3)+(ch^48);
        ch=getchar();
    }
    x=f?-x:x;
    return;
}
struct Node{
    int x;
    int y;
}a[100005],s[100005];
int n,m,du[100005],h[100005],f[100005];
vector<int>v[100005],k[100005];
queue<int>q;
int main(){
    in(n);in(m);
    for(int i=1;i<=m;i++){
        in(a[i].x);in(a[i].y);
        v[a[i].x].push_back(a[i].y);
        k[a[i].y].push_back(a[i].x);
        du[a[i].y]++;
    }
    for(int i=1;i<=n;i++)if(du[i]==0)q.push(i),h[++h[0]]=i;
    while(!q.empty()){
        int l=q.front();
        q.pop();
        for(int i=0;i<v[l].size();i++){
            int u=v[l][i];
            du[u]--;
            if(du[u]==0){
                q.push(u);
                h[++h[0]]=u;
            }
        }
    }
    for(int i=1;i<=n;i++){
        int x=h[i];
        for(int j=0;j<k[x].size();j++){
            int u=k[x][j];
            f[x]=max(f[x],f[u]+1);
        }
    }
    printf("%d\n",f[h[n]]);
	return 0;
}


Measured memory_bytes: 13440
#include <iostream>

using namespace std;

int main(void)
{
  int N;
  unsigned long long power = 1;

  cin >> N;

  for(int i=1; i<=N; ++i){
    power *= i;
    power %= (1000000000+7);
  }

  cout << power << endl;
  
  return 0;
}


Measured memory_bytes: 256
# https://drken1215.hatenablog.com/entry/2020/01/26/164200
# bit_pathの参考にした

def main():
    from collections import namedtuple
    from functools import reduce
    from itertools import combinations
    from operator import or_

    Edge = namedtuple('Edge', 'to edge_id')

    def bit_path(curr, goal, par=-1):
        if curr == goal:
            return 0
        for e in g[curr]:
            if e.to == par: continue
            res = bit_path(curr=e.to, goal=goal, par=curr)
            if ~res:  # -1以外
                return res | (1 << e.edge_id)
        return -1

    N = int(input())

    g = tuple(set() for _ in range(N))
    for edge_id in range(N - 1):
        a, b = (int(x) - 1 for x in input().split())
        g[a].add(Edge(to=b, edge_id=edge_id))
        g[b].add(Edge(to=a, edge_id=edge_id))

    M = int(input())

    cons = []
    for _ in range(M):
        u, v = (int(x) - 1 for x in input().split())
        b = bit_path(u, v)
        cons.append(b)

    ans = 1 << (N - 1)
    for k in range(1, M + 1):
        for comb in combinations(cons, r=k):
            b = reduce(or_, comb)
            ans += ((-1) ** k) * (1 << (N - 1 - bin(b).count('1')))
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3572
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
typedef long long ll;
const int iINF = 0x3f3f3f3f;
const long long INF = 1LL << 60;
using namespace std;

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

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

const int mod = 998244353;

struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const { return mint(*this) += a; }
  mint operator-(const mint a) const { return mint(*this) -= a; }
  mint operator*(const mint a) const { return mint(*this) *= a; }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod - 2); }
  mint &operator/=(const mint a) { return *this *= a.inv(); }
  mint operator/(const mint a) const { return mint(*this) /= a; }
};

struct combination
{
  vector<mint> fact, ifact;
  combination(int n) : fact(n + 1), ifact(n + 1)
  {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i)
      fact[i] = fact[i - 1] * i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i)
      ifact[i - 1] = ifact[i] * i;
  }
  mint operator()(int n, int k)
  {
    if (k < 0 || k > n)
      return 0;
    return fact[n] * ifact[k] * ifact[n - k];
  }
} c(2000005);

mint ans = 0;

int n, m, k;

int main()
{

  cin >> n >> m >> k;

  mint mm(m);
  rep(i, k + 1)
  {
    ans += (c(n - 1, i) * mm * (mm - 1).pow(n - 1 - i)).x;
  }

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

Measured memory_bytes: 34236
import java.util.Scanner;

public class Main {
	static Scanner scn = new Scanner(System.in);

	public static void main(String[] args) {
		int n = scn.nextInt();
		int DR = scn.nextInt();
		int CR = 0;
		if (n > 10) {
			CR = DR;
		} else {
			CR = DR + 100 * (10 - n);
		}
		System.out.println(CR);
	}
}


Measured memory_bytes: 23124
#include <stdio.h>
//#define scanf scanf_s
typedef long long int lli;

//void call(int n) {
//    int i = 1;
//CHECK_NUM:
//    int x = i;
//    if (x % 3 == 0) {
//        cout << " " << i;
//        goto END_CHECK_NUM;
//    }
//INCLUDE3:
//    if (x % 10 == 3) {
//        cout << " " << i;
//        goto END_CHECK_NUM;
//    }
//    x /= 10;
//    if (x) goto INCLUDE3;
//END_CHECK_NUM:
//    if (++i <= n) goto CHECK_NUM;
//
//    cout << endl;
//}

// 上記プログラムをgotoを使用しない形で書き換えよ
int main()
{
    int iInputN;
    int iCnt = 1;
    int iX;

    scanf("%d", &iInputN);

    do
    {
        iX = iCnt;
        if (iX % 3 == 0)
        {
            printf(" %d", iX);
        }
        else {
            while (iX != 0)
            {
                if (iX % 10 == 3)
                {
                    printf(" %d", iCnt);
                    break;
                }
                iX /= 10;
            }
        }
    } while (++iCnt <= iInputN);

    printf("\n");
    return 0;
}


Measured memory_bytes: 2048
n,m,k=map(int,input().split())
a=[0]+list(map(int,input().split()))
b=list(map(int,input().split()))
t=sum(b)
j=m-1
ans=0
for i in range(n+1):
  t+=a[i]
  while j>=0 and t>k:
    t-=b[j]
    j-=1
  if t>k:
    break
  ans=max(ans,j+i+1) 
print(ans)

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

int main(){
  int N;
  cin >> N;
  vector<int> p(N);
  int cost=0;
  for(int i=0; i<N; i++){
    cin >> p.at(i);
    cost+=p.at(i);
  }
  sort(p.begin(), p.end());
  cost-=p.at(N-1)/2;
  cout << cost << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main (){
  int ct=0,i,tmp=0;
  string data;
  cin>>data;
  for(i=0;i<data.size();i++){
    if(data.at(i)=='A'||data.at(i)=='C'||data.at(i)=='G'||data.at(i)=='T'){
      tmp++;
      if(ct<tmp){
        ct=tmp;
      }
    }else{
      tmp=0;
    }}
    cout<<ct<<endl;

  return 0;
}


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

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

  vector<int> x(N), y(N);
  for (int i = 0; i < N; i++) cin >> x.at(i) >> y.at(i);

  auto dist = [&](int i, int j) {
    double dx = x.at(i) - x.at(j);
    double dy = y.at(i) - y.at(j);
    return sqrt(dx * dx + dy * dy);
  };

  vector<int> p(N);
  for (int i = 0; i < N; i++) p.at(i) = i;
  double len = 0;
  int cnt = 0;

  do {
    for (int i = 0; i < N - 1; i++) {
      len += dist(p.at(i), p.at(i + 1));
    }
    cnt++;
  } while (next_permutation(p.begin(), p.end()));

  double ans = len / cnt;
  cout << fixed << setprecision(6);
  cout << ans << endl;
}

Measured memory_bytes: 256
# D - AtCoder Express 2

import numpy as np
import sys

N, M, Q = map(int, sys.stdin.buffer.readline().split())
LRpq = np.array(sys.stdin.buffer.read().split(), np.int64)
L = LRpq[:2*M:2]
R = LRpq[1:2*M:2]
p = LRpq[2*M::2]
q = LRpq[2*M+1::2]
    
train = np.zeros((N+1, N+1))
np.add.at(train, (L,R), 1)

np.cumsum(train, axis = 0, out = train)
np.cumsum(train, axis = 1, out = train)
    
ans = train[q,q] - train[p-1,q] - train[q,p-1] + train[p-1,p-1]
for i in range(Q):
    print(int(ans[i]))

Measured memory_bytes: 48248
// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O2")
// #pragma GCC optimization ("unroll-loops")
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef long double ld;
// #define int ll
#define pb push_back
#define pob pop_back
#define __bp __builtin_popcount
using pii = pair<int,int>;
using pil = pair<int,ll>;
using pli = pair<ll,int>;
using pdd = pair<ld,ld>;
using vint = vector<int>;
using vll = vector<ll>;
using vpii = vector<pii>;
using vpil = vector<pil>;
using vpli = vector<pli>;
#define F first
#define S second
const int N = 1e5+5;//(1 << 18) + 5;
//const ll inf = 1e18+7;
const int Inf = 1e9+7;
const ll INF = 1e18+7;
const int Mod = 1e9+7;
const ld eps = 1e-9;
#ifndef M_PI
#define M_PI 3.1415926535
#endif

void io()
{
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
	cerr.tie(NULL);
//	freopen("sweets.in", "r", stdin);
//	freopen("sweets.out", "w", stdout);
//	cout << setprecision(7) << fixed;
}

int n;

void solve()
{
	cin >> n;
	cout << 1 - n;
}

signed main()
{
	io();
	int tt = 1;
//	cin >> tt;
	while (tt--) {
		// solve();
		solve();
//		cerr << '\n';

	}
}

Measured memory_bytes: 3648
#include <stdio.h>

int main (void)
{
    int N,M;
    int odd,even; //奇数，偶数
    int odd_mul = 1,even_mul = 1; //奇数，偶数
    int i;

    scanf("%d",&N);
    scanf("%d",&M);

    for(i=0; i<2; i++){
        if(N>1){
        odd_mul = odd_mul * (N - i);
        }
        else{
            odd_mul = 0;
        }
        if(M>1){
        even_mul = even_mul * (M - i);
        }
        else{
            even_mul = 0;
        }

    }

    printf("%d\n",odd_mul/2 + even_mul/2);

    return 0;

}


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

int main(void) {
    int k;
    cin >> k;
    vector<ll> a;
    for(int i = 1; i <= 9; ++i) a.push_back(i);

    while(1) {
        if(k <= a.size()) {
            cout << a[k-1] << endl;
            return 0;
        }
        k -= a.size();
        vector<ll> old;
        swap(old,a);
        for(ll x : old) {
            for(int i = -1; i <= 1; i++) {
                ll dx = x%10 + i;
                if(dx < 0 || dx > 9) continue;
                dx = x * 10 + dx;
                a.push_back(dx);
            }
        }
    }
    return 0;
}

Measured memory_bytes: 1712
import numpy as np
from bisect import bisect_right

# from bisect import bisect_left

N, M, K = map(int, input().split())
A = [0] + list(map(int, input().split()))
B = [0] + list(map(int, input().split()))

cum_A = np.cumsum(A)
cum_B = np.cumsum(B)

# print(cum_A, cum_B)

ans = 0

for idx_a in range(N + 1):
    if A[idx_a] > K:
        break

    b = K - cum_A[idx_a]
    idx_b = max(0, bisect_right(cum_B, b) - 1)
    if cum_A[idx_a] + cum_B[idx_b] > K:
        idx_b -= 1
    if idx_b < 0:
        break
    ans = max(ans, idx_a + idx_b)
    # print(b, idx_a, idx_b, ans)

# for idx_a in range(N + 1):
#     if A[idx_a] > K:
#         break

#     b = K - cum_A[idx_a]
#     idx_b = min(bisect_left(cum_B, b), M)
#     if cum_A[idx_a] + cum_B[idx_b] > K:
#         idx_b -= 1
#     if idx_b < 0:
#         break
#     ans = max(ans, idx_a + idx_b)
#     # print(b, idx_a, idx_b, ans)

print(ans)


Measured memory_bytes: 59984
import sys
stdin = sys.stdin

sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

def digit_sum(num:int, base:int) -> int:

    if num < base:
        return num
    else:
        return digit_sum(int(num/base), base) + (num % base)
    
n = ni()

if n % digit_sum(n,10) == 0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#include<iostream>

using namespace std;

int main(void)

{
    string s;
    cin>>s;
    if(!s.compare("SAT"))
        cout<<"1\n";
    else if(!s.compare("SUN"))
        cout<<"7\n";
    else if(!s.compare("MON"))
        cout<<"6\n";
    else if(!s.compare("TUE"))
        cout<<"5\n";
    else if(!s.compare("WED"))
        cout<<"4\n";
    else if(!s.compare("THU"))
        cout<<"3\n";
    else
        cout<<"2\n";
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define For(i,m,n) for(int i=m;i<n;i++)
#define FOR(n) for(int i=0;i<n;i++)
#define ll long long
ll mob=1000000007;
using namespace std;
int main()
{ int a,b,c;
cin>>a>>b>>c;
cout<<c<<" "<<a<<" "<<b;





return 0;
}


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

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

using namespace std;

using ll = long long;
using P = pair<int, int>;

int main() {
  int a, b, k;
  cin >> a >> b >> k;
  for (int i = a; i <= b; i++) {
    if (i >= a + k && i <= b - k) {
      continue;
    }
    cout << i << endl;
  }
  return 0;
}


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

typedef long long ll;
ll MOD = 1e9+7;

int main()
{
	int n,a,b;
	int aa=0;
	int mid=0;
	int bb=0;
	int p[100];
	int ans=0;
	cin>>n>>a>>b;
	for(int i=0;i<n;i++)
		cin>>p[i];
	sort(p,p+n);
	for(int i=0;i<n;i++)
	{
		if(p[i]<=a)
			aa++;
		else if(p[i]>=b+1)
			bb++;
		else
			mid++;
	}
	ans=min(mid,aa);
	ans=min(ans,bb);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256