akhauriyash/Code-Regression huggingface dataset:
#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>
#ifdef __cplusplus
#include <bits/stdc++.h>
#endif

uint32_t nextpint(void){ char c=getchar_unlocked(); while(c<'0'||'9'<c) c=getchar_unlocked(); uint32_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar_unlocked(); } return x; }

uint32_t c[12];
uint32_t a[12][12];
int main(void){
	uint32_t n=nextpint();
	uint32_t m=nextpint();
	uint32_t x=nextpint();
	for(uint32_t i=0; i<n; i++){
		c[i]=nextpint();
		for(uint32_t j=0; j<m; j++){
			a[i][j]=nextpint();
		}
	}
	uint32_t ans = UINT32_MAX;
	uint32_t l=1<<n;
	for(uint32_t i=0; i<l; i++){
		uint32_t now=0;
		uint32_t r[12]={};
		for(uint32_t j=0; j<n; j++){
			if(i&(1<<j)){
				now+=c[j];
				for(uint32_t k=0; k<m; k++){
					r[k]+=a[j][k];
				}
			}
		}
		bool f=true;
		for(uint32_t k=0; k<m; k++){
			if(r[k]<x) f=false;
		}
		if(f&&now<ans) ans=now;
	}
	printf(ans==UINT32_MAX?"-1\n":"%"PRIu32"\n", ans);
}


Measured memory_bytes: 1604
n =int(input())-1
m=0
while 26*((26**m)-1)/25<= n:
    m+=1
m-=1
n= n - 26*((26**m)-1)/25 
ans=[]
for i in range(m,-1,-1):
    ans.append(n//(26**i))
    n= n% (26**i)
w=""
for i in ans:
    w=w + chr(int(i)+97)
print(w)
    

Measured memory_bytes: 9252
#include <bits/stdc++.h>
using namespace std;
int main(){
  int h,w;
  cin>>h>>w;
  int ch,cw,dh,dw;
  cin>>ch>>cw>>dh>>dw;
  ch--;
  cw--;
  dh--;
  dw--;
  vector<string> s(h);
  for(int i=0;i<h;i++){
    cin>>s[i];
  }
  vector<vector<int>> d(h,vector<int>(w,-1));
  deque<int> deq;
  deq.push_back(ch);
  deq.push_back(cw);
  d[ch][cw]=0;
  int curr_h,curr_w;
  while(deq.size()>0){
    curr_h=deq[0];
    curr_w=deq[1];
    deq.pop_front();
    deq.pop_front();
    for(int i=0;i<5;i++){
      for(int j=0;j<5;j++){
        if(curr_h-2+i>=0 && curr_h-2+i<h && curr_w-2+j>=0 && curr_w-2+j<w && s[curr_h-2+i][curr_w-2+j]=='.'){
          if((i==2 && abs(j-2)==1) || (j==2 && abs(i-2)==1)){
            if(d[curr_h-2+i][curr_w-2+j]>d[curr_h][curr_w] || d[curr_h-2+i][curr_w-2+j]==-1){
              d[curr_h-2+i][curr_w-2+j]=d[curr_h][curr_w];
              deq.push_front(curr_w-2+j);
              deq.push_front(curr_h-2+i);
            }
          }else{
            if(d[curr_h-2+i][curr_w-2+j]>d[curr_h][curr_w]+1 || d[curr_h-2+i][curr_w-2+j]==-1){
              d[curr_h-2+i][curr_w-2+j]=d[curr_h][curr_w]+1;
              deq.push_back(curr_h-2+i);
              deq.push_back(curr_w-2+j);
            }
          }
        }
      }
    }
  }
  cout<<d[dh][dw]<<endl;
}
  

Measured memory_bytes: 9516
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx2,tune=native")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("trapv")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<ll>;
using vvi = vector<vi>;
using pi = pair<ll, ll>;
const ll mod = 7 * 17 * (1 << 23) + 1;
const ll inf = 1e18;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());\
int a[] = { 100000, 200000, 300000 };
int main() { //DINIC ORZ
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll x, y;
	cin>> x >> y, x--, y--;
	ll ans = 0;
	if(x<3) ans += a[2-x];
	if(y<3) ans += a[2-y];
	if(max(x, y)==0) ans += 400000;
	cout << ans;
}


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

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);
    int n;
    cin >> n;
    set<int> s;
    for (int i = 0; i < n; ++i)
    {
        int d;
        cin >> d;
        s.insert(d);
    }
    cout << s.size();
    return 0;
}


Measured memory_bytes: 256
N = int(input())

char = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']

def search(arr):
  global N, char
  if len(arr) == N:
    ans = ''.join([char[x] for x in arr])
    print(ans)
    return
  else:
    for i in range(max(arr) + 2):
      arr_next = arr + [i]
      search(arr_next)

search([0])

Measured memory_bytes: 4412
cards = [[False for i in range(13)] for j in range(4)]
pattern=["S","H","C","D"]
n = int(input())
for i in range(n):
    a,b=list(input().split())
    cards[pattern.index(a)][int(b)-1] = True
for i in range(4):
    for j in range(13):
        if cards[i][j] == False:
            print(pattern[i],j+1)


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

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

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int n; cin>>n;
	cout << (n<1000 ? "ABC" : "ABD") << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <tuple>
#include <queue>
#include <bitset>
#include <set>
#include <map>
#include <list>

using ll = long long;
using ld = long double;
using namespace std;
const int INF = 1e9+100;
const ll INF64 = 7e18l;
const int mod = 1000000007;
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(a) (a).begin(), (a).end()
#define FIN ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);


int main(){
    FIN;
    ll n; cin >> n;
    vector<ll> t(100001,0);
    ll sum = 0;
    for(ll i=0;i<n;i++){
        ll a; cin >> a;
        t[a]++;
        sum += a;
    }

    ll q; cin >> q;
    for(ll i=0;i<q;i++){
        ll b,c; cin >> b >> c;
        sum += (c-b) * t[b];
        t[c] += t[b];
        t[b] = 0;
        cout << sum << endl;
    }


    return 0;
}



Measured memory_bytes: 3976
let reads f = stdin.ReadLine().Split() |> Array.map f

let swap (a : int array) i j =
    let x = a.[i]
    a.[i] <- a.[j]
    a.[j] <- x

let A = reads int
swap A 0 1
swap A 0 2

printfn "%s" (A |> Array.map string |> Array.toSeq |> String.concat " ")


Measured memory_bytes: 11996
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define in ({int x=0;int c=getchar(),n=0;for(;!isdigit(c);c=getchar()) n=(c=='-');for(;isdigit(c);c=getchar()) x=x*10+c-'0';n?-x:x;})
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int rnd(int l,int r){return l+rng()%(r-l+1);}
#define fasty ios_base::sync_with_stdio(false),cin.tie(nullptr);
#define task "b"
#define forinc(a,b,c) for(int a=b,_c=c;a<=_c;++a)
#define fordec(a,b,c) for(int a=b,_c=c;a>=_c;--a)
#define forv(a,b) for(auto&a:b)
#define fi first
#define se second
#define pb push_back
#define ii pair<int,int>
#define mt make_tuple
#define all(a) a.begin(),a.end()
#define reset(f, x) memset(f, x, sizeof(f))
#define bit(x,i) ((x>>(i-1))&1)
#define on(x,i) (x|(1ll<<(i-1)))
#define off(x,i) (x&~(1<<(i-1)))

const int M=998244353,
          N=300010;

int n,ret=1;
int mn[N],mx[N],role[N];
vector<int> v[3];

main(){
	//freopen(task".inp","r",stdin);
	//freopen(task".out",w"",stdout);
	fasty;
	cin>>n;
    forinc(i,1,n*3){
        char ch; cin>>ch;
        int ind=ch=='R'?0:ch=='G'?1:2;
        v[ind].pb(i);
	}
    forinc(i,1,n){
        mn[i]=n*3;
        forinc(j,0,2){
            mn[i]=min(mn[i],v[j][i-1]);
            mx[i]=max(mx[i],v[j][i-1]);
        }
        role[mx[i]]=2;
        forinc(j,0,2){
            if(mn[i]<v[j][i-1]&&v[j][i-1]<mx[i])
                role[v[j][i-1]]=1;
        }
    }
    vector<int> f(4); f[0]=n;
    forinc(i,1,n*3){
        ret=ret*f[role[i]]%M;
        f[role[i]]--;
        f[role[i]+1]++;
    }
    cout<<ret;
}


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

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

    string s;
    cin >> s;

    int n = s.length();

    int has[2];
    has[0] = has[1] = 0;

    for (int i = 0; i < n; ++i) {
        if (s[i] == 'N') {
            has[0] |= 1;
        } else if (s[i] == 'S') {
            has[0] |= 2;
        } else if (s[i] == 'W') {
            has[1] |= 1;
        } else {
            has[1] |= 2;
        }
    }

    if (has[0] == 1 || has[0] == 2 || has[1] == 1 || has[1] == 2) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)

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

int main() {
    int n;
    cin>>n;
    vector<int>a(n);
    rep(i,n)cin>>a[i];
    //input
    int ans=1;
    vector<int>mae(n),ush(n);
    mae[0]=a[0];
    ush[n-1]=a[n-1];
    for(int i=1;i<n;i++)mae[i]=gcd(mae[i-1],a[i]);
    for(int i=n-2;i>=0;i--)ush[i]=gcd(ush[i+1],a[i]);
    for(int i=1;i<n-1;i++)ans=max(ans,gcd(mae[i-1],ush[i+1]));
    ans=max(ans,mae[n-2]);
    ans=max(ans,ush[1]);
    cout<<ans;
	return 0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, s, e) for (int i = (int)(s); i < (int)(e); i++)
#define _rep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define _REP(i, e, s) for (int i = (int)(e - 1); i >= (int)(s); i--)

#define yes cout << "yes" << endl;
#define Yes cout << "Yes" << endl;
#define YES cout << "YES" << endl;

#define no cout << "no" << endl;
#define No cout << "No" << endl;
#define NO cout << "NO" << endl;

#define AC cout << "AC" << endl;
#define WA cout << "WA" << endl;

#define out(s) cout << s << endl;

#define ll long long
#define ull unsigned long long

const unsigned int BIT_FLAG_0 = (1 << 0);  // 0000 0000 0000 0001
const unsigned int BIT_FLAG_1 = (1 << 1);  // 0000 0000 0000 0010
const unsigned int BIT_FLAG_2 = (1 << 2);  // 0000 0000 0000 0100
const unsigned int BIT_FLAG_3 = (1 << 3);  // 0000 0000 0000 1000
const unsigned int BIT_FLAG_4 = (1 << 4);  // 0000 0000 0001 0000
const unsigned int BIT_FLAG_5 = (1 << 5);  // 0000 0000 0010 0000
const unsigned int BIT_FLAG_6 = (1 << 6);  // 0000 0000 0100 0000
const unsigned int BIT_FLAG_7 = (1 << 7);  // 0000 0000 1000 0000

const double PI = 3.14159265358979323846;

const int dy[4] = {0, 1, 0, -1};
const int dx[4] = {1, 0, -1, 0};

#define H_MAX 500
#define W_MAX 500
#define INF 1e9 + 7

int main() {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << max(max(a * c, max(a * d, b * c)), b * d) << endl;
}


Measured memory_bytes: 3632
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Solver solver = new Solver();
        solver.solve(in, out);
        out.close();
    }

    static class Solver {
        public void solve(Scanner in, PrintWriter out) {
            String S = in.next();
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < S.length(); i++) {
                sb.append("x");
            }
            out.println(sb.toString());
            // out.println("x".repeat(S.length()));
        }
    }
}

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

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

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

int main(){
    int l, a, b, c, d;
    scanf("%d%d%d%d%d", &l, &a, &b, &c, &d);
    printf("%d\n", min(l - --a/c - 1, l - --b/d - 1));
    return 0;
}

Measured memory_bytes: 1188
n = int(input())
A = list(map(int,input().split()))

L = A[0]
R = sum(A[1:])
A.pop(0)
A.pop(-1)
ans = abs(L-R)

for a in A:
	L += a
	R -= a
	if abs(L-R) < ans:
		ans = abs(L-R)
print(ans)

Measured memory_bytes: 24832
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <queue>

using namespace std;

const int N = 2e5+5;
int n, color[N];
vector<int> edg[N];

void render(int cur, int cur_c) {
    if (color[cur]) return;
    color[cur] = cur_c;
    for (auto to : edg[cur]) {
        render(to, 3-cur_c);
    }
}

int main() {
   // freopen("C.in", "r", stdin);
    scanf("%d", &n);
    for (int i = 1; i < n; i++) {
        int a, b; 
        scanf("%d%d", &a, &b);
        edg[a].push_back(b);
        edg[b].push_back(a);
    }
    for (int i = 1; i <= n; i++) render(i, 1);

    int c = 1;
    int r = count_if(color+1, color+n+1, [](int v) {
        return v == 1;
    });
    if (r > n-r) {
        r = n-r;
        c = 2;
    }
    queue<int> qu[3];
    for (int i = 1; i <= n; i++) {
        qu[i%3].push(i);
    }
    for (int i = 1; i <= n; i++) {
        queue<int> *p = 0;
        if (r <= n/3) {
            if (color[i] == c) {
                p = &qu[0];
            } else {
                if (!qu[1].empty()) {
                    p = &qu[1];
                } else if (!qu[2].empty()) {
                    p = &qu[2];
                } else {
                    p = &qu[0];
                }
            }
        } else {
            if (color[i] == c) {
                if (!qu[1].empty()) {
                    p = &qu[1];
                } else {
                    p = &qu[0];
                }
            } else {
                if (!qu[2].empty()) {
                    p = &qu[2];
                } else {
                    p = &qu[0];
                }
            }
        }

        int v = p->front();
        p->pop();
        printf("%d%c", v, "\n "[i<n]);
    }
    return 0;
}

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

int main() {
    int N;
    cin >> N;
    vector<int> H(N);
    for (int i = 0; i < N; i++) {
        cin >> H[i];
    }
    int cnt = 1;
    int maxv = H[0];
    for (int i = 1; i < N; i++) {
        if (maxv <= H[i]) cnt++;
        maxv = max(maxv, H[i]);
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let n: usize = iterator.next().unwrap().parse().unwrap();
    let s: Vec<char> = iterator.next().unwrap().chars().collect();
    let t: Vec<char> = iterator.next().unwrap().chars().collect();

    let mut ans = String::new();
    for i in 0..n {
        ans.push(s[i]);
        ans.push(t[i]);
    }

    return ans;
}


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

#define P(s) cout<<s<<endl
#define All(c) c.begin(),c.end()

using ll = int64_t;

int main() {
    ll h,w,n;
    cin >> h >> w >> n;
    
    map<pair<ll,ll>, ll> cnt;
    for (ll i=0; i<n; ++i) {
        ll a, b;
        cin >> a >> b;
        for (auto ai=-1; ai<=1; ++ai) for (auto bi=-1; bi<=1; ++bi) {
            cnt[make_pair(a+ai, b+bi)]++;
        }
    }
    
    vector<ll> res(10);
    res[0] = (h - 2) * (w - 2);
    for (const auto& c: cnt) {
        auto pos = c.first;
        if (1<pos.first && pos.first<h && 1<pos.second && pos.second<w) {
            res[c.second]++;
            res[0] --;
        }
    }
    
    for (auto r: res) {
        P(r);
    }
    
    return 0;
}

Measured memory_bytes: 56448
#include <stdio.h>

int main(void){
    int S;
    scanf("%d",&S);
    if(S/1000==(S/100)%10){
        printf("Bad\n");
    }
    else if((S/100)%10==(S/10)%10){
        printf("Bad\n");
    }
    else if((S/10)%10==S%10){
        printf("Bad\n");
    }
    else{
        printf("Good\n");
    }
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
void solve(int N) {
  int count = 0;
  for(int i = 1; i <= N; i++)
  {
    if(i % 2 == 1)
    {
      count++;
    }
  }
  std::cout << static_cast<double>(count)/static_cast<double>(N) << std::endl;
}
int main(void) {
  int N;
  std::cin >> N;
  solve(N);
  return 0;
}


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

#define NDEBUG
#ifdef DEBUG
#include "../cout11.h"
#undef NDEBUG
#endif
#include <cassert>

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef pair<double,double> dd;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<ll> vll;

#define sz(a)  int((a).size())
#define pb  push_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define found(s,e)  ((s).find(e)!=(s).end())
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))


inline ll span(string& s, int from, int to){
    ll x = 0;
    for (int i=from; i<to; ++i) {
        x = x * 10 + (int)(s[i] - '0');
    }
    return x;
}
inline ll times(int len){
    if (len == 0) return 1;
    return 1 << (len-1);
    /*
    if (len == 1) return 1;
    if (len == 2) return 2; // 2, 1*1
    if (len == 3) return 4; // 3, 12, 21, 1*1
    if (len == 4) return 8; // 4 13 22 31 112 121 211 1111
    // sep0, sep1, sep2, sep3
    for (int sep=0; sep<=len-1; ++sep) {
        // n=len-1 k=sep
        // nCkの和、そりゃ2^n = 2^(len-1)に決まってるだろ
    }
    return 1 << (len-1);
    */
}

ll solve(string& s) {
    int N = s.size();
    ll ans = 0;
    repC2(i,j,N+1){
        // [区間i,j]の出現回数
        // j-i + i + N-j = N
        ans += span(s,i,j) * times(i) * times(N-j);
    }
    return ans;
}

int main() {
    string s; cin >> s;
    cout << solve(s) << endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
A = list(map(int,input().split()))
flag = 0

for i in A:
    if i % 2 == 0:
        if i % 3 == 0 or i % 5 == 0:
            pass
        else:
            flag += 1
if flag > 0:
    print("DENIED")

else:
    print("APPROVED")

Measured memory_bytes: 2940
from itertools import*
s,k=open(0)
k=int(k)
g=[len(list(v))for _,v in groupby(s)]
print(sum(c//2for c in g)*k+(g[0]*g[-2]%2*s[0]==s[-2])*(~-k//2**(len(s)-1==g[0])))

Measured memory_bytes: 3060
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>

#define MAX(p,q) ((p>q)?(p):(q))
#define MIN(p,q) ((p<q)?(p):(q))

#define INF 1000000000;
#define REP(i,n) for(i=0;i<n;i++)

int gcd(int a,int b);
/*比較函数の実装
int -32768 to 32767 (2**15-1)
long -2147483648 to 2147483648 (2**31-1)
*/
int intcmp(const void *a,const void *b){
  return *(int *)a - *(int *)b;
}
//qsort(a,sizeof(a)/sizeof(int),sizeof(int),intcmp);
int longcmp(const void *a,const void *b){
  return *(long *)a - *(long *)b;
}
//qsort(a,sizeof(a)/sizeof(long),sizeof(long),longcmp);
int doublecmp(const void *a, const void *b){
  return *(double *)a - *(double *)b;
}
//qsort(a,sizeof(a)/sizeof(double),sizeof(double),doublecmp);
int main(void)
{
  int n,k;
  scanf("%d%d",&n,&k);
  if(k==1) printf("0");
  else printf("%d",n-k);
  return 0;
  
}

int gcd(int a,int b)
{
  int max,min,tmp;
  max = MAX(a,b);
  min = MIN(a,b);
  if(max%min==0) return min;
  else
  {
    tmp = min;
    min = max%min;
    max = tmp;
    return gcd(max,min);
  }
}


Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include<cstring>
#include<ctime>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<string>
#include<queue>
#include<vector>
#include<map>
#include<set>
#include<utility>
#include<iomanip>
#include<map>
#include<vector>
using namespace std;
int read(){
    int xx=0,ff=1;char ch=getchar();
    while(ch>'9'||ch<'0'){if(ch=='-')ff=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){xx=xx*10+ch-'0';ch=getchar();}
    return xx*ff;
}
long long READ(){
    long long xx=0,ff=1;char ch=getchar();
    while(ch>'9'||ch<'0'){if(ch=='-')ff=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){xx=xx*10+ch-'0';ch=getchar();}
    return xx*ff;
}
char one(){
	char ch=getchar();
	while(ch==' '||ch=='\n')
		ch=getchar();
	return ch;
}
int main(){
	//freopen("in","r",stdin);
	int a=read();
	string s;
	cin>>s;
	if(a>=3200)
		cout<<s<<endl;
	else
		puts("red");
	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int N,a[110000];
int main(){
  cin>>N;
  for(int i=1;i<=N;i++)cin>>a[i];
  int ans=0;
  for(int i=1;i<=N;i++)ans+=i==a[a[i]];
  ans/=2;
  cout<<ans<<endl;
}

Measured memory_bytes: 640
a = list(map(str,input().split()))
b = list(map(str,input().split()))
c = list(map(str,input().split()))
l = a + b + c
cnt = 0
for i in "1234":
    if l.count(i)==2:
        cnt += 1
if cnt==2:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 3060
#include<iostream>
#include<algorithm>

int main(){

    size_t n;
    std::cin >> n;

    long long max, min, sum = 0;
    for(size_t i = 0; i < n; i++){
        long long a;
        std::cin >> a;

        if(i == 0){
            max = a;
            min = a;
        }else{
            max = std::max(max, a);
            min = std::min(min, a);
        }

        sum += a;
    }

    std::printf("%lld %lld %lld\n", min, max, sum);

    return 0;
}



Measured memory_bytes: 3220
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,-1,0,1},dy={1,0,-1,0};
bool inside(int y,int x,int h,int w){
	if(y<h && y>=0 && x<w && x>=0) return true;
	return false;
}





int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a,b;cin >> a >> b;
	int ans = 0, sum = 1;
	while(sum < b){
		sum += a - 1;
		ans++;
	}
	cout << ans << endl;
}


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

int n, l = 0,r = 0, ans = INT32_MAX;
string s;

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

	for (int i = 0; i < s.length(); i++) {
		if (s[i] == 'W')r++;
	}

	for (int i = 0; i < s.length(); i++) {
		if (s[i] == 'W')r--;
		int lnum = 0;
		if (i != 0)lnum = i - l;
		//ここが怪しいかも
		int rnum = s.length() - (i + 1) - r;

		ans = min(ans, lnum + rnum);
		
		if (s[i] == 'E')l++;
	}

	cout << ans << endl;
}

Measured memory_bytes: 900
#include <iostream>
using namespace std;
int main() {
  int64_t n; cin >> n;
  int64_t a = n/3, b = n/5, c = n/15;
  cout << n*(n+1)/2 - a*(a+1)/2*3 - b*(b+1)/2*5 + c*(c+1)/2*15 << endl;
}


Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
#define MAXN	100005
#define MAXS	2200
#define EPS	1e-6
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;
}
int n, tot, f[MAXN];
long long a[MAXN], prime[MAXN], cube[MAXN];
map <long long, long long> another;
map <long long, int> cnt;
int main() {
	int n; read(n);
	for (int i = 1; i <= n; i++)
		read(a[i]);
	for (int i = 2; i <= MAXS; i++) {
		if (f[i] == 0) {
			prime[++tot] = f[i] = i;
			cube[tot] = prime[tot] * prime[tot] * prime[tot];
		}
		for (int j = 1; prime[j] <= f[i] && j <= tot; j++) {
			int tmp = prime[j] * i;
			if (tmp > MAXS) continue;
			f[tmp] = prime[j];
		}
	}
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= tot; j++)
			while (a[i] % cube[j] == 0)
				a[i] /= cube[j];
		long long product = 1, tmp = a[i];
		for (int j = 1; j <= tot; j++)
			if (tmp % prime[j] == 0) {
				tmp /= prime[j];
				if (tmp % prime[j] == 0) {
					tmp /= prime[j];
					product *= prime[j];
				} else product *= prime[j] * prime[j];
			}
		if (fabs((long long) sqrt(tmp) - sqrt(tmp)) <= EPS) product *= (long long) sqrt(tmp);
		else product *= tmp * tmp;
		another[a[i]] = product;
		cnt[a[i]]++;
	}
	cnt[1] = min(cnt[1], 1);
	int ans = 0;
	for (int i = 1; i <= n; i++) {
		long long tmp = another[a[i]];
		ans += max(cnt[a[i]], cnt[tmp]);
		cnt[a[i]] = cnt[tmp] = 0;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 19840
#include <iostream>
#include <vector>
#include <stdio.h>
using namespace std;
const int N=0;
const int E=1;
const int S=2;
const int W=3;
const int Z=4;
int rs[5][4]={{0,1,5,4},{0,3,5,2},{0,4,5,1},{0,2,5,3},{3,1,2,4}};
struct xai{
int ds[6];
void round(int n){
int t=ds[rs[n][0]];
for(int i=0;i<3;i++){
	ds[rs[n][i]]=ds[rs[n][i+1]];
}
ds[rs[n][3]]=t;
}
xai rounds(int n){
xai e;
for(int i=0;i<6;i++)e.ds[i]=ds[i];

if(0<n){
	e.round(S);
}
if(1<n){
	e.round(E);
}
if(2<n){
	e.round(E);
}
if(3<n){
	e.round(E);
}
if(4<n){
	e.round(S);
}
return e;
}
void roundZ(){
int cs[4];
std::vector<int> vec;
for(int i=0;i<4;i++){
	vec.push_back(ds[rs[Z][i]]);
}
for(int i=0;i<4;i++){
	round(Z);
	std::vector<int> vec2;
	for(int i=0;i<4;i++){
		vec2.push_back(ds[rs[Z][i]]);
	}
	if(vec<vec2)vec=vec2;
}
for(int i=0;i<4;i++){
	ds[rs[Z][i]]=vec[i];
}
}
bool eq(xai e){
for(int i=0;i<6;i++){
	if(ds[i]!=e.ds[i])return false;
}
return true;
} 
};

int main() {
// your code goes here
xai e,e2,e3;
for(int i=0;i<6;i++){
	scanf("%d",&e.ds[i]);
}
for(int i=0;i<6;i++){
scanf("%d",&e2.ds[i]);
}
e.roundZ();
bool hit=false;
for(int i=0;i<6;i++){
e3=e2.rounds(i);
e3.roundZ();
if(e3.eq(e)==true){
	hit=true;
	break;
}
}
printf("%s\n",hit?"Yes":"No");
return 0;
}


Measured memory_bytes: 3204
#include<iostream>
#include<string>
#include<sstream>
using namespace std;
 
class Stack{
private:
  int sp;
  int S[100];
public:
  Stack(){
    sp=0;
  }
  bool isFull(){
    return (sp==100);
  }
  bool isEmpty(){
    return (sp==0);
  }
  void push(int d){
    if(isFull()){
      return;
    }
    S[sp++] = d;
  }
  void pop(){
    if(isEmpty()){
      return;
    }
    sp--;
  }
  int top(){
    if(isEmpty()){
      return -1;
    }
    return S[sp-1];
  }
};
 
int main(){
  Stack s;
  string expr;
  getline(cin, expr);
 
  istringstream is(expr);
 
  while(!is.eof()){
    string op;
    is >> op;
 
    int tmp1,tmp2;
 
    switch(op[0]){
      case'+':
        tmp1 = s.top();
        s.pop();
        tmp2 = s.top();
        s.pop();
        s.push(tmp2+tmp1);
        break;
      case'-':
        tmp1 = s.top();
        s.pop();
        tmp2 = s.top();
        s.pop();
        s.push(tmp2-tmp1);
        break;
      case'*':
        tmp1 = s.top();
        s.pop();
        tmp2 = s.top();
        s.pop();
        s.push(tmp2*tmp1);
        break;
      default:
        istringstream is2(op);
        is2 >> tmp1;
        s.push(tmp1);
        break;
    }
  }
  cout << s.top() << endl;
 
  return 0;
}


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

int main(){
  int n, s, a, b;
  s = 0;
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> a >> b;
    s = s + b - a + 1;
  }
  cout << s << endl;
}

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

int main(){
    int w,h,n;
    int cnt = 0;

    cin >> w >> h >> n;
    vector<vector<int>> rect(w,vector<int>(h,1));

    for(int i = 0; i < n; i++){
        int x,y,a;
        cin >> x >> y >> a;
        if(a == 1){
            for(int j = 0; j < x; j++){
                for(int k = 0; k < h; k++){
                    rect[j][k] = 0;
                }
            }
        }
        else if(a == 2){
            for(int j = x; j < w; j++){
                for(int k = 0; k < h; k++){
                    rect[j][k] = 0;
                }
            }
        }
        else if(a == 3){
            for(int j = 0; j < w; j++){
                for(int k = 0; k < y; k++){
                    rect[j][k] = 0;
                }
            }
        }
        else{
            for(int j = 0; j < w; j++){
                for(int k = y; k < h; k++){
                    rect[j][k] = 0;
                }
            }
        }
    }

    for(int i = 0; i < w; i++){
        for(int j = 0; j < h; j++){
            cnt += rect[i][j];
        }
    }

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


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

ll f(ll b, ll n) {
  if (n < b) {
    return n;
  } else {
    return f(b, n / b) + (n % b);
  }
}

int main() {
  ll n, s;
  cin >> n >> s;

  if (n == s) {
    cout << n + 1 << endl;
    return 0;
  }

  ll p = 2;
  for (; p * p <= n; p++) {
    if (f(p, n) == s) {
      cout << p << endl;
      return 0;
    }
  }

  for (; p > 0; p--) {
    if ((n - s) % p == 0) {
      ll b = (n - s) / p + 1;
      if (b >= 2 && f(b, n) == s) {
        cout << b << endl;
        return 0;
      }
    }
  }

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


Measured memory_bytes: 256
s=list(input())
a=[]
b=[]
for i in range(1,len(s)+1):
    a.append(i%2)
    b.append((i+1)%2)
c=0
d=0
s=list(map(int,s))
for i in range(len(s)):
    if a[i] != s[i]:
        c+=1
    if b[i] != s[i]:
        d+=1
if c>d:
    print(d)
else:
    print(c)

Measured memory_bytes: 6280
#include<iostream>
#include<fstream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<stack>
#include<climits>
#include<cstring>
#include<queue>
#include<map>
#include<set>
#include<complex>
#include<typeinfo>
using namespace std;
typedef unsigned long long ull;
const int N_MAX = 200000;

struct raqSB{
    int dataSize;
    int bucketSize;
    ull data[N_MAX];
    ull bucket[N_MAX];

    raqSB(const int n){
        bucketSize = (int)sqrt(n) + 1;
        dataSize = bucketSize * bucketSize;
        for (int i=0;i<N_MAX;i++){
            data[i] = 0ull;
            bucket[i] = 0ull;
        }
    }

    void add(int s, int t, int x){
        int ss = s/bucketSize;
        int tt = t/bucketSize;
        if(ss==tt){
            for (int i=s;i<t+1;i++){
                data[i] += x;
            }
        }else{
            for(int i=s;i<(ss+1)*bucketSize;i++){
                data[i] += x;
            }
            for(int i=tt*bucketSize;i<t+1;i++){
                data[i] += x;
            }
            for(int i=ss+1;i<tt;i++){
                bucket[i] += x;
            }
        }
    }

    ull get(int i){
        return data[i] + bucket[i/bucketSize];
    }
};

int main(){
    int n, q, s, t, i, x;
    cin >> n >> q;
    bool qType;
    raqSB raqsb(n);
    for (int j=0;j<q;j++){
        cin >> qType;
        if(qType){
            cin >> i;
            cout << raqsb.get(i) << endl;
        }else{
            cin >> s >> t >> x;
            raqsb.add(s, t, x);
        }
    }
    return 0;
}

Measured memory_bytes: 6208
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<map>
#include<vector>
#include<queue>
#include<stack>
#include<climits>
#include<set>
#include<utility>
#include<typeinfo>
#include<random>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef set<int> S;
#define rep(i, n) for(int i=0; i<n; i++)
const ll MOD=1e9+7;

int main(){

  int a, b, c, k;
  cin >> a >> b >> c >> k;
  int ans=0;
  ans += min(a, k);
  k-=a;
  if(k<=0){
    cout << ans << endl;
    return 0;
  }
  k-=b;
  if(k<=0){
    cout << ans << endl;
    return 0;
  }
  ans -= min(c, k);
  cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3592
use itertools::Itertools as _;
    use proconio::*;
    use proconio::fastout;
    macro_rules! p {
        ($x:expr) => {
            println!("{}", $x);
        };
    }
    #[fastout]
    fn main() {
        input! {
            n:usize,
            s:[usize;n],
            t:[usize;n],
            u:[u64;n],
            v:[u64;n],
        }
        let mask = std::u64::MAX;
        let (or, and) = (1, 0);
        // 1確定
        let mut one = vec![vec![0u64; n]; n];
        // 0確定
        let mut zero = vec![vec![0u64; n]; n];

        // 自明
        for i in 0..n {
            for j in 0..n {
                if s[i] == and {
                    one[i][j] |= u[i];
                } else {
                    zero[i][j] |= !u[i];
                }
                if t[j] == and {
                    one[i][j] |= v[j];
                } else {
                    zero[i][j] |= !v[j];
                }
                if one[i][j] & zero[i][j] != 0 {
                    p!(-1);
                    return;
                }
            }
        }
        let mut ans = one.clone();

        let ch = |ans: &[Vec<u64>]| {
            let mut u_check = (0..n)
                .map(|i| if s[i] == or { 0 } else { mask })
                .collect_vec();
            let mut v_check = (0..n)
                .map(|j| if t[j] == or { 0 } else { mask })
                .collect_vec();

            for i in 0..n {
                for j in 0..n {
                    if s[i] == and {
                        u_check[i] &= ans[i][j];
                    } else {
                        u_check[i] |= ans[i][j];
                    }
                    if t[j] == and {
                        v_check[j] &= ans[i][j];
                    } else {
                        v_check[j] |= ans[i][j];
                    }
                }
            }
            let check = u
                .iter()
                .zip(&u_check)
                .chain(v.iter().zip(&v_check))
                .map(|(x, y)| x ^ y)
                .fold(0, |x, y| x | y);
            check
        };
        for i in 0..n {
            for j in 0..n {
                ans[i][j] |= !zero[i][j] & mask * (i ^ j) as u64;
            }
        }
        let check = ch(&ans);
        for i in 0..n {
            for j in 0..n {
                ans[i][j] &= !check;
                ans[i][j] |= check & (u[i] | v[j]) & !zero[i][j];
            }
        }
        let check = ch(&ans);

        for i in 0..n {
            for j in 0..n {
                ans[i][j] &= !check;
                ans[i][j] |= check & ((u[i] & v[j]) | one[i][j]);
            }
        }
        let check = ch(&ans);
        if check != 0 {
            p!(-1);
            return;
        }

        ans.iter().for_each(|x| p!(x.iter().join(" ")));
    }


Measured memory_bytes: 11516
#include <iostream>
#include<map>

using namespace std;

int main()
{
    int N;
    map<string, int> count;
    count["AC"] = 0;
    count["WA"] = 0;
    count["TLE"] = 0;
    count["RE"] = 0;

    cin >> N;
    for (int i = 0; i < N; i++){
        string str;
        cin >> str;
        count[str]++;
    }

    cout << "AC x " << count["AC"] << endl;
    cout << "WA x " << count["WA"] << endl;
    cout << "TLE x " << count["TLE"] << endl;
    cout << "RE x " << count["RE"] << endl;

    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define Y cout << "YES\n"
#define N cout << "NO\n"
#define REP(i, a, b) for (int i = a; i <= b; i++)
#define R(i, n) for (int i = 0; i < n; i++)

int main()
{
    int a, b, ans = 0;
    cin >> a >> b;
    if (a > 0)
    {
        cout << "Positive\n";
    }
    else if (a <= 0 && b >= 0)
    {
        cout << "Zero\n";
    }
    else
    {
        ans = b - a;
        if (ans % 2)
        {
            cout << "Positive\n";
        }
        else
        {
            cout << "Negative\n";
        }
    }
}

Measured memory_bytes: 256
#!/usr/bin/python3

import math
import os
import sys


DEBUG = 'DEBUG' in os.environ


def inp():
    return sys.stdin.readline().rstrip()


def dprint(*value, sep=' ', end='\n'):
    if DEBUG:
        print(*value, sep=sep, end=end)


def main():
    N = int(inp())
    odds = (N + 1) // 2
    print(odds / N)


if __name__ == '__main__':
    main()


Measured memory_bytes: 38256
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define INF 2e9
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  long long a,b;
  cin>>a>>s>>b;
  if(s=="+"){
    cout<<a+b<<'\n';
  }
  else{
    cout<<a-b<<'\n';
  }
  return(0);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
vector <int> v;
vector <double> vd;

vector <char> vc;
vector <string> vs;
map <string,int> sm;
map <int,int> mp;
map <char,int>cm;
//int string_to_int(string s){stringstream x(s);double a=0; x>>a; return a;}
//long long int gcd(long long int a, long long int b){if(a%b==0)return b;return gcd(b, a%b);}
//long long int lcm(long long int a, long long int b){return (a*b)/gcd(a, b);}
//int string_sum(string s){int b = 0;auto k =s.size();for(int j=0; j<k; j++){b +=(s[j]-48);}return b;}
//long long int factorial(long long int n){if (n == 0)return 1;return n * factorial(n - 1);}

//int cnt =0;
//
//void SieveOfEratosthenes(int n)
//{
//   // v.push_back(1);
//
//    bool prime[n+1];
//    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;
//        }
//    }
//
//
//    for (int p=2; p<=n; p++)
//       if (prime[p])
//          v.push_back(p);
//}
//

//int mod(string num, int a)
//{
//    // Initialize result
//    int res = 0;
//
//    // One by one process all digits of 'num'
//    for (int i = 0; i < num.length(); i++)
//         res = (res*10 + (int)num[i] - '0') %a;
//
//    return res;
//}
long long int mx = 1000000000000000000;

long long int power(long long int base, long long int powerRaised)
{
    if (powerRaised != 0)
        return (base*power(base, powerRaised-1));
    else
        return 1;
}


int main() {
    
    
    long long int a,b=0,c=0,n,cnt=0;
    string s,p;
    char ch;
    
   
    cin >> n;
    
    for(int i=1; i<=sqrt(n); i++)
    {
        if(n%i==0)b=i;
    }
    
    c = n/b;
    
    cout << c+b-2 << endl;
    
    
    
    
    
    
    return 0;
}
 
 
 


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

public class Main{
    public static void main(String[] args)throws Exception{
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt(),m=sc.nextInt();
        if(n==m){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 23252
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>

using namespace std;

bool bounded(int x,int y,int w, int h) {
	return (0 <= x && x < w && 0 <= y && y < h);
}

int main() {
	int h, w;
	cin >> h >> w;
	int inf = 100 * 100;
	int black = 0;
	vector<vector<int>> field(h, vector<int>(w, 0));
	vector<vector<int>> cost(h, vector<int>(w, inf));

	string line;
	for (int y = 0; y < h; ++y) {
		cin >> line;
		for (int x = 0; x < w; ++x) {
			if (line[x] == '.') {
				field[y][x] = 0;
			}
			if (line[x] == '#') {
				field[y][x] = 1;
				black++;
			}
		}
	}
	queue<pair<pair<int, int>, int>> todo;
	todo.push(make_pair(make_pair(0,0),0));
	cost[0][0] = 0;
	int dx[4] = { 0,1,0,-1 };
	int dy[4] = { 1,0,-1,0 };
	while (!todo.empty()) {
		auto val = todo.front();
		todo.pop();
		int x = val.first.first;
		int y = val.first.second;
		int next_cost = val.second+1;
		for (int i = 0; i < 4; ++i) {
			int nx = x + dx[i];
			int ny = y + dy[i];
			if (bounded(nx,ny, w, h)) {
				if (field[ny][nx] == 0) {
					if (cost[ny][nx] > next_cost) {
						cost[ny][nx] = next_cost;
						todo.push(make_pair(make_pair(nx, ny),next_cost));
					}
				}
			}
		}
	}
	/*
	for (int i = 0; i < h; ++i) {
		for (int j = 0; j < w; ++j) {
			if (cost[i][j] == inf) cout << ".";
			else cout << cost[i][j];
		}
		cout << endl;
	}
	*/
	int walkcost = cost[h - 1][w - 1];
	if (walkcost == inf) cout << -1 << endl;
	else cout << h * w - black - walkcost -1 << endl;
}

Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};
#[allow(unused_imports)]
use std::io::{stdout, stdin, BufWriter, Write};

fn main() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }

    input!{
      m: usize,
      d: usize,
    }

    let mut ans = 0;
    for i in 1..m+1 {
        for d in 1..d+1 {
            let d0 = d%10;
            let d10 = d/10;
            if d0 >= 2 && d10 >= 2 && d0 * d10 == i {
                ans += 1;
            }
        }
    }
    puts!("{}\n", ans);
}



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

// repetition
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

// container util
#define all(x) (x).begin(), (x).end()

// typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

// const value
// const ll MOD = 1e9 + 7;
// const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
// const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

// conversion
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
inline ll toLL(string s) {
  ll v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T> inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) {
  return a < b && (a = b, true);
}

template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) {
  return a > b && (a = b, true);
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  set<string> st;
  rep(i, n) {
    string s;
    cin >> s;
    st.insert(s);
  }
  cout << st.size() << endl;
  return 0;
}


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

// types - only for stuff used a lot 
using ll = long long;
#define vv vector
#define Pp pair

// IO
#define get(x) scanf("%d",&x)
#define getl(x) scanf("%lld",&x);

// Operations
#define pb push_back
#define pob pop_back
#define sz(a) int(a.size()) 
#define re(a,b) a=max(a,b) // relax
#define ri(a,b) a=min(a,b) // relaxi

// Debugging

#ifndef LOCAL
#define cerr if (0) cerr
#else
#define cerr cout
#endif

#define print(arr,n) {for (int _ = 0; _ < n; _++) cerr<<arr[_]<<" "; cerr << endl; }
#define printv(vec)  {for (int _ : vec) cerr<<_<<" "; cerr<<endl;}

const int mod = 1e9+7, oo = 1e9;
const ll loo = 1e18;

// Functions 
ll modpow(ll a, ll b) {
	ll ans = 1; // faster modpow than recursive
	for (; b; b/=2,a=a*a%mod)
		if (b&1) ans = (ans*a)%mod;
	return ans;
}
ll gcd(ll a, ll b) {
	while (a) b%=a,swap(a,b);
	return b;
}
#define bitcount __builtin_popcountll
#define f(i,a,b) for (int i = a; i < b; i++)
#define fr(i,a,b) for (int i = b-1; i >= a; i--)


/* 

   ALRIGHT HACKERS, THIS IS WHERE THE ACTUAL CODE BEGINS

 */

const bool DEBUG = 1;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#ifdef LOCAL
	if (DEBUG) freopen("input.txt", "r", stdin);
	if (DEBUG) freopen("output.txt", "w", stdout);
	clock_t start = clock();
#endif

	int n, d, h;
	cin>>n>>h>>d;
	ll c = 0;
	ll co = 1; 
	f(i,1,n+1) {
		co = (co*i)%mod;
		c = (c+co)%mod;	
	}
	ll dp[h];
	dp[0]=1;
	f(i,1,n+1) dp[0]=dp[0]*i%mod;
	ll partial = dp[0]*c%mod;
	f(i,1,h) {
		dp[i] = partial;	
		partial = (partial+dp[i]*c%mod)%mod;
		if (i>=d)
			partial = (partial+mod-dp[i-d]*c%mod)%mod;
	}
	ll ans = 0;
	f(i,0,h)
		if (h-i<=d) ans = (ans+dp[i])%mod;
	cout << ans << endl;

#ifdef LOCAL
	cout << setprecision(12) << (long double)(clock()-start) / CLOCKS_PER_SEC << endl;
#endif
	return 0;
}




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

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

		if (S[2] == S[3] && S[4] == S[5])
			cout << "Yes" << endl;
        else
		    cout << "No" << endl;
      
		return 0;
	}



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

#define rp(i, k, n) for (int i = k; i < n; i++)
typedef long long ll;
typedef double ld;

template<class T>inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF = 1ll << 60;
const ll MOD = 1e9 + 7ll;
const double PI=3.14159265358979323846;



int main() {
    int n; ll k;
    cin >> n >> k;
    vector<int> a;
    int ok = -1;
    rp(i, 0, n) {
        int temp;
        scanf("%d", &temp);
        chmax(ok, temp);
        a.emplace_back(temp);
    }
    int ng = 0;
    while(abs(ok - ng) > 1) {
        int x = (ok + ng) / 2;
        int count = 0;
        int i = 0;
        while(i < n && count <= k) {
            count += a[i] / x;
            if(a[i] % x != 0) count++;
            count --;
            i++;
        }
        if(count <= k) ok = x; else ng = x;
        // cout << "x =" << x << endl;
    } 
    cout << ok << endl;
    return 0;
}

Measured memory_bytes: 4296
#include<stdio.h>
int main()
{
    int N,M,i,sum=0,A[10000];
    scanf("%d %d",&N,&M);
    for(i=0;i<M;i++)
    {
        scanf("%d",&A[i]);
    }
    for(i=0;i<M;i++)
    {sum=sum+A[i];
    }
    if(sum>N)
    {
        printf("-1\n");
    }
    else
    {
       printf("%d\n",N-sum);
    }
}

Measured memory_bytes: 1740
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cout << #x << ": " << x << endl
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define endl '\n'

ll gcd(ll a, ll b){ return ((b == 0) ? a : gcd(b, a % b)); }

ll A, B, C, D;

ll solve(ll a){
	return (a - a / C - a / D + a / ((C * D) / gcd(C, D)));
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	cin >> A >> B >> C >> D;
	cout << solve(B)  - solve(A - 1) << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


Measured memory_bytes: 256