akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int main (void)
{
    int N;
    int A[100000];
    int idx[100000];
    int Atemp;
    scanf("%d", &N);
    int i;
    for (i = 0; i < N; i++) {
        scanf("%d", &A[i]);
        idx[A[i] - 1] = i + 1;
    }

    //int j;
    //for (i = 1; i <= N; i++) {
    //    for (j = 0; j <= N; j++) {
    //        if (A[j] == i) {
    //            printf("%d\n", j+1);
    //            break;
    //        }
    //    }
    //    
    //}
    for (i = 0; i < N; i++) {
        printf("%d\n", idx[i]);
    }

    return 0;
}

Measured memory_bytes: 1536
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cstdint>
#include<cstdlib>
template<typename T>
void fin(T const& t){ std::cout << t << std::endl; exit(0); }

// mint
#include<cstdint>
int64_t const MOD = 1e9+7;

template<int64_t Prime>
struct mod_int {
  int64_t v_;
  mod_int(int64_t x=0) : v_(x) { normalize(); }
  void normalize() { ((v_ %= Prime) += Prime) %= Prime; }
  mod_int operator+=(mod_int const& r){ (v_ += r.v_) %= Prime; return *this; }
  mod_int operator-=(mod_int const& r){ (v_ += Prime - r.v_) %= Prime; return *this; }
  mod_int operator*=(mod_int const& r){ (v_ *= r.v_) %= Prime; return *this; }
  mod_int operator+(mod_int const& r) { mod_int res(*this); return res += r; }
  mod_int operator-(mod_int const& r) { mod_int res(*this); return res -= r; }
  mod_int operator*(mod_int const& r) { mod_int res(*this); return res *= r; }
  mod_int pow(int x) const {
    int64_t res = 1, v = v_;
    while(x > 0) {
      if(x&1) (res *= v) %= Prime;
      x/=2; (v *= v) %= Prime;
    }
    return mod_int(res);
  }
  mod_int inv() const { return pow(Prime-2); }
};
typedef mod_int<MOD> mint;

template<typename T>
struct optional {
  bool valid;
  T v_;
  optional(): valid(false) {}
  T& operator=(T const& v)
    { v_ = v; valid = true; return v_; }
};

optional<mint> dp[60][2][2][2];
int bL[60], bR[60];

mint calc(int i, bool tl, bool tr, bool has1) {
  if(i < 0) return 1;
  if(dp[i][tl][tr][has1].valid) return dp[i][tl][tr][has1].v_;
  bool canbe1 = (bR[i]==1 || !tr);
  bool canbe0 = (bL[i]==0 || !tl);
  
  mint res;
  // y[i]=x[i]=1
  if(canbe1) res = calc(i-1, tl && bL[i]==1, tr, true);
  // y[i]=1; x[i]=0
  if(canbe1&canbe0&has1) res += calc(i-1, tl, tr, has1);
  // y[i]=x[i]=0
  if(canbe0) res += calc(i-1, tl, tr && bR[i]==0, has1);

  return dp[i][tl][tr][has1] = res;
}

int main() {
  int64_t L, R; std::cin >> L >> R;
  for(int i = 0; i < 60; ++i) {
    int64_t b = (int64_t)1 << i;
    bL[i] = (b&L)? 1: 0;
    bR[i] = (b&R)? 1: 0;
  }
  fin(calc(59, true, true, 0).v_);
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#define MAX(_A, _B) (((_A) > (_B)) ? (_A) : (_B))
int p[666666], cnt;
int n, m;
int main(){
	scanf("%d %d", &n, &m);
	int ans = 1;
	for(int i = 1; i * i <= m; i++){
		if(m % i == 0){
			if(i >= n) ans = MAX(ans, m / i);
			if(m / i >= n) ans = MAX(ans, i);
		}
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<string>

using namespace std;

int const N = 5e3 + 41;
int const MOD = 1e9 + 7;

int n, m, dp[N][N];
string s;

int bp(int x, int d){
	if(!d){
		return 1;
	}
	if(d&1){
		return x * 1LL * bp(x, d-1) % MOD;
	}
	int r = bp(x, d/2);
	return r * 1LL * r % MOD;
}

int main(){
	cin >> n >> s;
	m = s.size();
	dp[0][0] = 1;
	for(int i=0;i<=n;++i){
		for(int j=0;j<N-7;++j){
			dp[i+1][j+1] += (2 * dp[i][j]) % MOD;
			dp[i+1][j+1] %= MOD;
			dp[i+1][max(0, j-1)] += dp[i][j];
			dp[i+1][max(0, j-1)] %= MOD;
		}
	}
	int ans = dp[n][m];
	int two = bp(2, m);
	two = bp(two, MOD-2);
	ans = ans * 1LL * two % MOD;
	printf("%d\n",ans);

	return 0;
}

Measured memory_bytes: 98688
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int inputValue(){
    int a;
    cin >> a;
    return a;
};

void inputArray(int * p, int a){
    REP(i, a){
        cin >> p[i];
    }
};

void inputVector(vector<int> * p, int a){
    REP(i, a){
        int input;
        cin >> input;
        p -> push_back(input);
    }
}

int main()
{
  char s[101];
  cin >> s;
  bool ans = true;
  REP(i, strlen(s)){
    int even = (i+1) % 2;
    if(even == 1 && s[i]=='L')
      ans = false;
    if(even == 0 && s[i]=='R')
      ans = false;
  }

  if(ans){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
int main()
{
  ll a,b,c,k,sum;
  cin>>a>>b>>c>>k;
  if(k<=a)
  {
      sum=k;
  }
  else
  {
     if(k<=a+b)
     {
         sum=a;
     }
     else
     {
         sum=a-(k-(a+b));
     }
  }
  cout<<sum;
    return 0;
}

Measured memory_bytes: 3636
#include "bits/stdc++.h"

using namespace std;

int main(){
	int N,M;
	cin>>N>>M;
	while(N){
		int ans=0;
		vector<int>v(N+1);
		vector<int>w(N+1);
		for(int i=0;i<M;i++){
			int a,b,c;
			cin>>a>>b;
			for(int j=0;j<b;j++){
				cin>>c;
				v[c]+=a;
				if(b==1)w[c]+=a;
			}
		}
		pair<int,int>vf,vs,wf,ws;
		vf={0,0};
		vs={0,0};
		wf={INT_MAX,0};
		ws={INT_MAX,0};
		for(int j=1;j<=N;j++){
			pair<int,int>p={v[j],j};
			if(vf<p){
				vs=vf;
				vf=p;
			}
			else if(vs<p){
				vs=p;
			}
			p={w[j],j};
			if(wf>p){
				ws=wf;
				wf=p;
			}
			else if(ws>p){
				ws=p;
			}
		}
		if(vf.second==wf.second){
			ans=max(vf.first-ws.first,vs.first-wf.first)+1;
		}
		else{
			ans=vf.first-wf.first+1;
		}
		cout<<ans<<endl;
		cin>>N>>M;
	}
}


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

using namespace std;
using ll = long long;
constexpr int mod = 1e9+7;
constexpr int md = mod;
int main(){
    map<string,vector<pair<int,int>>> m;
    int n;
    cin>>n;
    for(int i=1;i<=n;++i){
        string s;
        int num;
        cin>>s>>num;
        m[s].push_back({num,i});
    }
    for(auto a : m){
        sort(a.second.rbegin(),a.second.rend());
        for(auto b : a.second){
            cout << b.second << endl;
        }
    }
    return 0;
}



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

int main() {
  int n ;
  cin >> n;
  int cmp = n / 15;
  int ans = (n*800) - (cmp*200);
  cout << ans << endl;
}

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

namespace ABC125
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            int[] n = s.Select(x => int.Parse(x)).ToArray();

            int result = (n[2] / n[0]) * n[1];

            Console.WriteLine(result);
        }
    }
}


Measured memory_bytes: 13268
using System;
using static System.Console;
using System.Collections.Generic;
using System.Linq;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var a = int.Parse(ReadLine());
            int cnt = 0;

            for (int i = 1; i <= a; i+=2)
            {
                if (Count(i) == 8) cnt++;
            }

            WriteLine(cnt);
        }

        static int Count(int n)
        {
            int count = 0;
            for (int i = 1; i <= n; i++)
            {
                if (n % i == 0) count++;
            }
            return count;
        }
    }
}



Measured memory_bytes: 11092
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")

#include "bits/stdc++.h"
using namespace std;

#define pb push_back
#define F first
#define S second
#define f(i,a,b)  for(int i = a; i < b; i++)
// #define endl '\n'

using ll = long long;
using db = long double;
using ii = pair<int, int>;

const int N = 2e5+5, LG = 17, MOD = 998244353;
const int SQ = 450;
const long double EPS = 1e-7;
vector<int> v;
int cur[N], a[N];
int32_t main(){
#ifdef ONLINE_JUDGE
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif

  int n;
  cin >> n;

  f(i,1,n+1)
    cin >> a[i];

  for(int i = n; i >= 1; --i){
    int val = 0;
    for(int j = i + i; j <= n; j += i)
      val ^= cur[j];
    if(val == a[i])continue;
    v.pb(i);
    cur[i] = 1;
  }

  reverse(v.begin(),v.end());
  cout<<v.size()<<endl;
  for(auto x : v)cout << x << ' ';


  return 0;
}


Measured memory_bytes: 2936
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main(void)
{
	string s;cin >> s;
	vector<int> v(s.length() + 1, 0), w(s.length() + 1, 0);
	for (int i = 0; i < s.length(); i++) {
		if (s[i] == '<') {
			v[i + 1] = v[i] + 1;
		}
	}
	for (int i = s.length() - 1; i >= 0; i--) {
		if (s[i] == '>') {
			w[i] = w[i + 1] + 1;
		}
	}
	long long sum = 0;
	for (int i = 0; i <= s.length(); i++) {
		sum += max(v[i], w[i]);
	}
	cout << sum << endl;
}

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

int main()
{
    int n, k;
    cin >> n >> k;
    vector<int> p(n), c(n);
    rep(i, n) cin >> p[i];
    rep(i, n) cin >> c[i];
    rep(i, n) p[i]--;
    ll ans = -1e9;
    rep(si, n) {
        int x = si;
        vector<int> s;
        ll tot = 0;
        while (1) {
            x = p[x];
            s.push_back(c[x]);
            tot += c[x];
            if (x == si) break;
        }
        int l = s.size();
        ll t = 0;
        rep(i, l){
            t += s[i];
            if (i+1 > k) break;
            ll now = t;
            if (tot > 0) {
                ll e = (k-(i+1))/l;
                now += tot*e;
            }
            ans = max(ans, now);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3716
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<stack>
#include<bitset>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pII;
#define pb push_back
#define X first
#define Y second
#define mp make_pair
#define clr(x,y) memset(x,y,sizeof(x))
#define FOR(i, x, y) for (decay<decltype(y)>::type i = (x), _##i = (y); i < _##i; ++i)
#define FORD(i, x, y) for (decay<decltype(x)>::type i = (x), _##i = (y); i > _##i; --i)
const int inf=0x3f3f3f3f;
const ll mod=1e9+7;
const int maxn=1e6+5;
ll fmod(ll x,ll y){ll res=1;while(y){if(y&1)res=res*x%mod;y>>=1;x=x*x%mod;}return res;}
//ll gcd(ll x,ll y){return y==0?x:gcd(y,x%y);}
ll dp[105][10];
ll pre[10][10];
void init()
{
    clr(pre,0);
    pre[1][1] = 1;
    pre[1][0] = 1;
    for(int i = 2; i <= 10; ++i)
    {
        pre[i][1] = pre[i-1][0];
        pre[i][0] = pre[i-1][1] + pre[i-1][0];
    }
    for(int i = 1; i <= 10; ++i)
        pre[i][0] += pre[i][1];
    pre[0][0] = 1;
}
int main()
{
     int h,w,k;
     init();
     //for(int i = 0; i <= 5; ++i)
        //cout<<pre[i][0]<<endl;
     while(cin>>h>>w>>k)
     {
         if(w == 1)
         {
             cout<<1<<endl;
             continue;
         }

         clr(dp,0);
         //dp[1][1] = pre[max(0,w-1)][0];
         //dp[1][2] = pre[max(0,w-2)][0];
         dp[0][1] = 1;
         for(int i = 1; i <= h; ++i)
         {
             for(int j = 1; j <= w; ++j)
                {
                    if(j == 1)
                    {
                        dp[i][j] += dp[i-1][j]*pre[max(0,w-2)][0];
                        dp[i][j] %= mod;
                        dp[i][j] += dp[i-1][j+1]*pre[max(0,w-3)][0];
                        dp[i][j] %= mod;
                    }
                    else if(j == w)
                    {
                        dp[i][j] += dp[i-1][j]*pre[max(0,w-2)][0];
                        dp[i][j] %= mod;
                        dp[i][j] += dp[i-1][j-1]*pre[max(0,w-3)][0];
                        dp[i][j] %= mod;
                    }
                    else
                    {
                        dp[i][j] += dp[i-1][j]*pre[max(0,w-j-1)][0]*pre[max(0,j-2)][0];
                        dp[i][j] %= mod;
                        dp[i][j] += dp[i-1][j+1]*pre[max(0,w-j-2)][0]*pre[max(0,j-2)][0];
                        dp[i][j] %= mod;
                        dp[i][j] += dp[i-1][j-1]*pre[max(0,j-3)][0]*pre[max(0,w-j-1)][0];
                        dp[i][j] %= mod;
                    }
                }
         }
         cout<<dp[h][k]<<endl;
     }
}












Measured memory_bytes: 256
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define INF 1000000000000000000

int main() {
    ll N, K;
    cin >> N >> K;
    vector<ll> A(N);
    rep(i, N) {
        cin >> A[i];
        A[i]--;
    }

    vector<ll> sy;
    vector<bool> seen(N, false);
    sy.push_back(0);
    seen[0] = true;
    int s = A[0];
    while (!seen[s]) {
        sy.push_back(s);
        seen[s] = true;
        s = A[s];
    }

    ll botle = 0;
    rep(j, sy.size()) {
        if (sy[j] == s) {
            botle = j;
            break;
        }
    }

    ll cycle = sy.size() - botle;
    if (K <= botle) {
        cout << sy[K] + 1 << endl;
        return 0;
    } else {
        K -= botle;
        cout << sy[botle + K % cycle] + 1 << endl;
        return 0;
    }
}

Measured memory_bytes: 6900
function main()
	N,M=map(x->parse(Int,x),split(readline()))
	G=[Int[] for _=1:N]
	for _=1:M
		u,v=map(x->parse(Int,x),split(readline()))
		push!(G[u],v)
		push!(G[v],u)
	end
	d=zeros(Int,N)
	d[1]=-1
	Q=Int[1]
	while !isempty(Q)
		u=popfirst!(Q)
		for v=G[u]
			if d[v]==0
				d[v]=u
				push!(Q,v)
			end
		end
	end
	println("Yes")
	for i=2:N
		println(d[i])
	end
end
main()


Measured memory_bytes: 229776
//Name: ALDS1_1_D: Maximum Profit
//Level: 2
//Category:
//Note:

#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
    int R[200001], n;
    int min_R, ans;

    cin >> n;

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

    min_R = R[0];
    ans = R[1]-R[0];

    for (int i = 1; i < n; i++) {
        ans = max(ans, R[i]-min_R);
        min_R = min(min_R, R[i]);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3876
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#include<algorithm>//next_permutation
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
#define large "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#define small "abcdefghijklmnopqrstuvwxyz"
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

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

const ll MOD = 1000000007;
const ll MAX = 2000001;

ll mod(ll a){
  return a % MOD;
}

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

ll fac[MAX], finv[MAX], inv[MAX];

void nCrprep() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

ll nCr(ll n, ll r){
    if (n < r) return 0;
    if (n < 0 || r < 0) return 0;
    return fac[n] * (finv[r] * finv[n - r] % MOD) % MOD;
}

ll nCrcheep(ll n,ll r){
  if(r == 0) return 1;
  else if(r == 1) return n;
  else return nCrcheep(n-1,r-1)*n/r;
}

vector<pair<ll,ll>> prime_factorize(ll n){
  vector<pair<ll,ll>> res;
  
  for(ll i=2; i*i <= n; i++){
    if(n % i != 0) continue;
    
    ll ex = 0;
    while(n % i == 0){
      ex++;
      n /= i;
    }
    
    res.push_back({i,ex});
  }
  
  if(n != 1) res.push_back({n,1});
  
  return res;
  
}


struct UnionFind {
    //自身が親であれば、その集合に属する頂点数に-1を掛けたもの
    //そうでなければ親のid
    vector<int> r;
 
    UnionFind(int N) {
        r = vector<int>(N, -1);
    }
 
    int root(int x) {
        if (r[x] < 0) return x;
        return r[x] = root(r[x]);
    }
 
    bool unite(int x, int y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (r[x] > r[y]) swap(x, y);
        r[x] += r[y];
        r[y] = x;
        return true;
    }
 
    int size(int x) {
        return -r[root(x)];
    }
  
};




int main(){
  ll n,m; cin >> n >> m;
  
  UnionFind UF(n);
  
  rep(i,m){
    ll a,b,z; cin >> a >> b >> z;
    a--; b--;
    
    UF.unite(a,b);
  }
  
  set<ll> al_cnt; ll cnt = 0;
  
  rep(i,n){
    if(!al_cnt.count(UF.root(i))){
      cnt++;
      al_cnt.insert(UF.root(i));
    }
  }
  
  cout << cnt << endl;
  
}

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

int n;

bool solve(int x) {
  if (x == n) return true;
  else if (x > n) return false;
  return (solve(x+4)||solve(x+7));
}

int main() {
  scanf("%d", &n);
  if (solve(0)) printf("Yes\n");
  else printf("No\n");
}

Measured memory_bytes: 256
ARGF.each_line do |line|
  h, w = line.split.map(&:to_i)
  break if h == 0 && w == 0
  1.upto(h) { |i|
    case i
    when 1, h
      puts '#' * w
    else
      print "##{"." * (w - 2)}#\n"
    end
  }
  puts
end

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

const int P = 924844033;
int n, K, tot, ans, fact[2010], chk[4010], f[4010][4010][2];

int main() {
    scanf("%d %d", &n, &K);
    for (int i = fact[0] = 1; i <= n; i++) {
        fact[i] = 1LL * i * fact[i - 1] % P;
    }
    f[0][0][0] = 1;
    for (int i = 1; i <= K; i++) {
        for (int j = i; j <= n; j += K) chk[++tot] = (i == j);
        for (int j = i; j <= n; j += K) chk[++tot] = (i == j);
    }
    for (int i = 0; i < 2 * n; i++) {
        for (int j = 0; j <= i; j++) {
            f[i + 1][j][0] = (f[i][j][0] + f[i][j][1]) % P;
            if (!chk[i + 1]) f[i + 1][j + 1][1] = f[i][j][0];
        }
    }
    for (int i = 0; i <= n; i++) {
        int s = (f[2 * n][i][0] + f[2 * n][i][1]) % P;
        ans = (ans + 1LL * (i & 1 ? P - 1 : 1) * fact[n - i] % P * s) % P;
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 123904
n, m = map(int, input().split())

a = [tuple(map(int, input().split())) for _ in range(m)]

p = []
q = []

for i in range(m):
    if a[i][0] == 1:
        p.append(a[i][1])
    elif a[i][1] == n:
        q.append(a[i][0])

if len(set(p)&set(q)) > 0:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")


Measured memory_bytes: 39260
import java.util.Scanner;

class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		
		int count = 0;
		int small = Math.min(A, B);
		for(int i = small;i >= 1;i--){
			if(A%i == 0 && B%i == 0){
			count++;
				if(count == C){
					System.out.println(i);
					return;
				}
			}
		}

		
	}
	
	
}



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

int day(int month){
	switch(month){
		case 4:
		case 6:
		case 9:
		case 11:
			return 30;
			break;
		case 1:
		case 3:
		case 5:
		case 7:
		case 8:
		case 10:
		case 12:
			return 31;
			break;
		case 2:
			return 29;
			break;
	}
}

int main(){
	int m, d, num;
	while(cin >> m >> d, m || d){
		num = 0;
		for(int i=1; i < m; i++){
			num += day(i);
		}
		num += d;
		switch(num % 7){
			case 1:
				cout << "Thursday" << endl;
				break;
			case 2:
				cout << "Friday" << endl;
				break;
			case 3:
				cout << "Saturday" << endl;
				break;
			case 4:
				cout << "Sunday" << endl;
				break;
			case 5:
				cout << "Monday" << endl;
				break;
			case 6:
				cout << "Tuesday" << endl;
				break;
			case 0:
				cout << "Wednesday" << endl;
		}
	}
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define rep(i,n) for(int i=0;i<(int)n;i++)
const ll INF = (1LL<<60);
const int MOD = 1000000007;


int main(){
    string s; cin >> s;
    int n = s.size();
    if(s[n-1]=='s'){
        if(s[n-1]!='e') s+="es";
        else s+="s";
    }else s+="s";
    cout << s << endl;
}

Measured memory_bytes: 3624
"""
https://qiita.com/drken/items/03c7db44ccd27820ea0d


"""
def main():
        
    S = input()
    T = input()

    """
    dp[i+1]][j+1]
    Sのi番目とtのｊ番目まで見たときの共通する部分列の最大長さ
    """
    dp = [[0 for _ in range(len(T)+1)] for _ in range(len(S)+1)]

    #prev = {}
    # 部分列の最大長さを求める
    for i, s in enumerate(S):
        for j, t in enumerate(T):
            if s == t:
                #i番目とｊ番目が同じなら、dp[i+1][j+1]はそれまでの最大長さ＋１
                dp[i+1][j+1] = dp[i][j] + 1
                #prev[(i+1, j+1)] = (i,j)
            else:
                #異なる場合はdp[i][j]かd[i+1][j]かdp[i][j+1]のどれかだけども、後者ふたつがi,jより小さいことはないから後ろ二つの大きいほうを採用
                dp[i+1][j+1] = max(dp[i+1][j], dp[i][j+1])
                #prev[(i+1, j+1)] = (i+1,j) if dp[i+1][j] >= dp[i][j+1] else (i,j+1)

    i, j = len(S), len(T)
    """
    なんかi+1,j+1がどのDPノードから更新されてできたのかをたどって、S[i],T[j]が同じであればそれを部分列に加えられるから～みたいな感じで部分列の後ろから作って最後にひっくり返すといいらしい
    
    """

    substr = ""
    while i != 0 and j != 0:
        # 同じ文字で＋１になっていた場合、その文字を部分列に加える
        if S[i-1] == T[j-1]:
            substr += S[i-1]
            i,j = i-1, j-1
        else:
            i,j = (i, j-1) if dp[i][j-1] >= dp[i-1][j] else (i-1, j)


    #TLEなのでやめた
    """
    while i != 0 and j != 0:
        if S[i-1] == T[j-1]:
            substr +=S[i-1] 
        i,j = prev[(i,j)]
    """
    print(substr[::-1])

if __name__ == "__main__":
    main()

Measured memory_bytes: 120028
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<stdlib.h>
#include<iostream>
using namespace std;
int main(void)
{
	long long i,j,k=0,n,m;
	scanf("%lld",&n);
	for(i=1;i<=3500;i++)
	{
		for(j=1;j<=3500;j++)
		{
			long long d=i*j*n;
			long long dd=(4*i*j-n*i-n*j);
			if(dd<=0)
			continue;
			if(d%dd==0)
			{
				printf("%lld %lld %lld\n",i,j,d/dd);
				return 0;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define rep(i,n); for(long long i = 0;i < (n);i++)
using ll = long long;
using P = pair<long long,long long>;
template <class T> using vec = vector<T>;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll x,y; cin >> x >> y;
    ll res = 0;
    while(y >= x){
        x *= 2;
        res++;
    }
    cout << res << endl;
}

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

int main() {
  int k;
  cin >> k;
  queue<long long>que;
  for(int i = 1;i <= 9;i++) que.push(i);
  for(int i = 0;i < k-1;i++){
    long long a = que.front();
    long long siri = a%10;
    que.pop();
    if(siri == 0){
      que.push(a*10);
      que.push(a*10+1);
    }
    else if(siri == 9){
      que.push(a*10+siri-1);
      que.push(a*10+siri);
    }
    else{
      que.push(a*10+siri-1);
      que.push(a*10+siri);
      que.push(a*10+siri+1);
    }
  }
  cout << que.front() << endl;
}


Measured memory_bytes: 1792
fun main(args: Array<String>) {
    val sc = java.util.Scanner(System.`in`)
    val map = mutableMapOf<String, Int>()
    for (i in 0 until sc.next().toInt()){
        val s = sc.next()
        if (map[s] == null) map[s] = 1
        else map[s] = map[s]!! + 1
    }
    for (i in 0 until sc.next().toInt()){
        val t = sc.next()
        if (map[t] == null) map[t] = 0
        else map[t] = map[t]!! - 1
    }
    println(if (map.values.max()!! < 0) 0 else map.values.max())
}

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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    int a,b;cin>>a>>b;
    if (a<=8&&b<=8)cout<<"Yay!";
    else cout<<":(";
    return 0;
}


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)

	var c, c2, c4 int
	for i := 0; i < n; i++ {
		var a int
		fmt.Scan(&a)

		if a%4 == 0 {
			c4++
			continue
		}
		if a%2 == 0 {
			c2++
			continue
		}
		c++
	}

	if c2 == 0 {
		if c4 < c-1 {
			fmt.Println("No")
			return
		}
	}
	if c2 > 0 && c > 0 {
		if c4 < c {
			fmt.Println("No")
			return
		}
	}
	fmt.Println("Yes")
}


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

int main()
{
	int s, w;
    
    cin>>s>>w;
    
    if(s>w)
    {
    	cout<<"safe"<<endl;
    }
    else
    {
    	cout<<"unsafe"<<endl;
    }
    
    return 0;
}

Measured memory_bytes: 3620
def main():
    N = int(input())
    p = [int(x) for x in input().split()]
    count = 0
    for i, v in enumerate(p):
        if i + 1 != v:
            count += 1
    if count == 0 or count == 2:
        print("YES")
    else:
        print("NO")


if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
#include <iostream>

using namespace std;
using int64 = long long;

int main() {
    int64 n,a,b;
    cin >> n >> a >> b;
    int64 ans = b*(n-2) - a*(n-2) + 1;
    if (n==1) ans = a==b;
    if (a>b) ans = 0;
    cout << ans << endl;
}


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

vector<int> section_sum(vector<int> numbers,int separate){
    int n = numbers.size()-separate;
    int initial_sum;
    decltype(numbers)::iterator nb = numbers.begin();
    decltype(numbers)::iterator ne = numbers.end();
    if (n<=0){
        vector<int> sep1;
        sep1.push_back(accumulate(nb,ne,0));
        return sep1;
    }else{
        vector<int> sep1(n),sep2(n),sep3(separate);
        copy(nb+separate , ne , sep1.begin());
        copy(nb , ne-separate , sep2.begin());
        copy(nb , nb+separate , sep3.begin());
        initial_sum=accumulate(sep3.begin(),sep3.end(),0);
        for(int i=0  ;i<n  ;i++) sep1[i]-=sep2[i];
        for(int i=1  ;i<n  ;i++) {sep1[i]+=sep1[i-1];sep1[i-1]+=initial_sum;}
        sep1[n-1]+=initial_sum;
        sep1.insert(sep1.begin(),initial_sum);
        return sep1;
    }
}

int main(void){
    int n,k,tmp,pre;
    string st;
    cin>>n>>k;
    cin>>st;
    vector<int> a;
    vector<int> b;
    for(int i=0  ;i<n  ;i++){
        a.push_back(st[i]);
    }
    pre=a[0];
    tmp=1;
    for(int i=1  ;i<n  ;i++){
        if (a[i]==pre) tmp+=1;
        else{
            b.push_back(tmp);
            tmp=1;
            pre=a[i];
        }
    }
    b.push_back(tmp);
    if (a[n-1]==48) b.insert(b.end(),0);
    if (a[0]==48) b.insert(b.begin(),0);
    k=2*k+1;
    vector <int> ans=section_sum(b,k);
    vector <int> ans2;
    for(int i=0  ;i<ans.size()  ;i++){
        if (i%2==0) ans2.push_back(ans[i]);
    }
    cout<< *max_element(ans2.begin(),ans2.end()) <<endl;
}

Measured memory_bytes: 3000
#include <bits/stdc++.h>
using namespace std;
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);  
	int n;
	cin >> n;
	vector<int> a(n);
	for(int i = 0; i < n; i++) {
		cin >> a[i];
		a[i] -= i + 1;
	}
	sort(a.begin(), a.end());
	int med = a[n / 2];
	long long ans = 0;
	for(int i = 0; i < n; i++) {
		ans += abs(med - a[i]);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define MOD (int) (1e9+7)
#define INF (int) 2e9
#define LLINF (ll) 2e18

int main(){
    int n, r;
    cin >> n >> r;
    if(n>=10){
        cout << r << endl;
    }else{
        cout << r + 100*(10-n) << endl;
    }
    // printf("%d\n", N);
    return 0;
}

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

int n, m, a, b, w = 0;
vector<int> r[100001];
bool f[100001];

void ck(int k) {
	for (int i = 0; i < r[k].size(); i++) {
		int j = r[k][i];
		if (!f[j]) {
			f[j] = 1;
			ck(j);
		}
	}
}

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

	for (int i = 0; i < m; i++) {
		cin >> a >> b;

		r[a].push_back(b);
		r[b].push_back(a);
	}

	for (int i = 1; i <= n; i++) {
		if (!f[i]) {
			w++;
			f[i] = 1;
			ck(i);
		}
	}

	cout << w - 1 << endl;
}


Measured memory_bytes: 9560
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 2000000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
#define seg_size 524288
int grid[2][200000] = {};
long long memorize[2][200000] = {};
int main() {
#define int long long
	int h, w;
	cin >> w;
	h = 1;
	REP(i, h) {
		REP(q, w) {
			cin >> grid[i][q];
		}
	}
	for (int i = 0;i < w;++i) {
		int cnt = 0;
		for (int q = 0;q < h;++q) {
			memorize[q][i] = grid[q][i];
		}
	}
	long long ans = 0;
	for (int i = 0;i < h;++i) {
		stack<pair<int, int>> wow;
		for (int q = 0;q <= w;++q) {
			if (wow.empty() == true || wow.top().first < memorize[i][q]) {
				wow.push(make_pair(memorize[i][q], q));
			}
			else {
				int itring = q;
				while (wow.empty() == false && wow.top().first > memorize[i][q]) {
					ans = max(ans, (q - wow.top().second)*wow.top().first);
					itring = min(itring, wow.top().second);
					wow.pop();
				}
				wow.push(make_pair(memorize[i][q], itring));
			}
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 5804
//https://atcoder.jp/contests/dp/tasks/dp_d
#include<bits/stdc++.h>
using namespace std;

int main(int argc, char* argv[]) {
	int n, W;
	cin >> n >> W;
	int w, v;
	vector<long long> dp (W+1);
	long long mw = 0;
	for (int i = 0; i < n; i++) {
		cin >> w >> v;
		for (int lw = W-w; lw>=0; lw--) {
			dp[lw+w] = max(dp[lw+w], dp[lw]+v);
		}
	}
	for (auto x:dp) {
		mw = max(mw, x);
	}
	cout << mw << endl;
	return 0;
}

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

int top, S[1000];

void push(int x){
    S[++top] = x;
}

int pop(){
    top--;
    return S[top+1];
}

int main(){
    int a,b;
    top = 0;
    char s[100];
    int c;
  while( scanf("%s", s) != EOF ){
        if( s[0] == '+'){
            a = pop();
            b = pop();
            push(a + b);
        } else if( s[0] == '-'){
            b = pop();
            a = pop();
            push(a - b);
        } else if(s[0] == '*'){
            a = pop();
            b = pop();
            push(a * b);
        }else{
            push(atoi(s));
        }
    }

    printf("%d\n", pop());
    return 0;
}


Measured memory_bytes: 2100
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
int main()
{
	string a;
	cin>>a;
	for(int i=1;i<4;i++)
	{
		if(a[i]==a[i-1])	{
			cout<<"Bad\n";
			return 0;
		}
	}
	cout<<"Good\n";
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
main(){
  int a,b,c,n;
  int i;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d %d %d",&a,&b,&c);
    if(a*a+b*b == c*c || a*a+c*c==b*b || b*b+c*c==a*a){
      printf("YES\n");
    }
    else{
      printf("NO\n");
    }
  }
  return 0;
}

Measured memory_bytes: 580
import java.util.Scanner;

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

		String s = sc.next();
		sc.close();

		int N = s.length();
		int[] res = new int[N + 2];

		boolean lastTile = true;	//Rはtrue
		int n = 1;
		int lastRIndex = 0;
		for(int i = 1;i <= N - 1;i++) {
//			System.out.println(s.charAt(i));
			if(lastTile) {
				if(s.charAt(i) == 'R') {
					n++;
				}else {
//					System.out.println("a i:" + i);
//					System.out.println("a n:" + n);
					res[i - 1] += (n + 1) / 2;
					res[i] += n / 2;
					n = 1;
					lastTile = false;
					lastRIndex = i - 1;
				}
			}else {
				if(s.charAt(i) == 'L') {
					n++;
				}else {
//					System.out.println("b i:" + i);
					res[lastRIndex] += n / 2;
					res[lastRIndex + 1] += (n + 1) / 2;
					n = 1;
					lastTile = true;
				}
			}
		}
		res[lastRIndex] += n / 2;
		res[lastRIndex + 1] += (n + 1) / 2;

		for(int i = 0;i <= N - 2;i++) {
			System.out.print(res[i] + " ");
		}
		System.out.println(res[N - 1]);


	}
}


Measured memory_bytes: 43840
#include<iostream>
#include<string>

using namespace std;

int main(void)
{
	string s,t;
	cin >> s >> t;
	for(int i=1;i<=s.size();i++)
	{
		if(s==t)
		{
			cout << "Yes" << endl;
			return 0;
		}
		char c=s[0];
		for(int j=1;j<=s.size()-1;j++)
			s[j-1]=s[j];
		s[s.size()-1]=c;
	}
	cout << "No" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
int x,a,b;
int main()
{
	scanf("%d%d%d",&x,&a,&b);
	x-=a;
	if(x<=0)
	{
		printf("0");
		return 0;
	}
	while(x>=b)
	{
		x-=b;
	}
	if(x<=0)
	{
		printf("0");
		return 0;
	}
	printf("%d",x);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#include <string>
using namespace std;
typedef double  dbl;
typedef long long int lld;
#define foi(i,n) for(i = 0; i < n; i+=1)
#define fod(i,n) for(i=n-1; i >=0; i-=1)
#define MAX std::numeric_limits<lld>::max()
#define MIN std::numeric_limits<lld>::min()
#define FastIO  ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define LEN 200005
#define PEN 100001
lld abc[PEN];
void sieve ()
{
	bool prime[LEN];
	prime[1]= false;
	for(lld i = 2; i<LEN; i++)
	{
		prime[i] = true;
	}
	lld i , j;
	for(i = 2; i*i < LEN; i++)
	{
		if (prime[i] ==true)
		{
			for(j = i*i;j<LEN;j+=i)
			{
				prime[j] = false;
			}
		}
	}
	lld x;
	for(i = LEN-1; i>=100000; i--)
	{
		if (prime[i]==true)
			x = i;
	}
	for(i = PEN-1; i>=1; i--)
	{
		if (prime[i]==true)
		{
			x = i;
		}
		abc[i]  = x;
	}
}
int main ()
{
      FastIO
      sieve();
      lld x, i;
      cin >> x;
      cout << abc[x] << "\n";
      return 0;
}

Measured memory_bytes: 1280
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<chrono>//実行時間計測
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm,accumulate
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//順序保持しないmap
#include<unordered_set>//順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

//マクロ
//forループ
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() 
#define SIZE(x) ll(x.size()) 
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素

#define int long long

template<typename A, size_t N, typename T>

void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}


//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//ここにグローバル変数宣言

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//ここに関数宣言


//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
signed main(){
    //入力の高速化用のコード
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

 int N,M,cnt=0,sum=0;
 cin>>N>>M;
 int A[N];
 REP(i,N){
 	cin>>A[i];
 	sum+=A[i];
 }
 REP(i,N){
 	if (A[i]*4*M>=sum){cnt++;}
 }
 if (cnt>=M)
 {
 	cout<<"Yes"<<endl;
 }
 else cout<<"No"<<endl;



return 0;





}

Measured memory_bytes: 3556
import sys
N, M, Q = map(int, sys.stdin.readline().split())
 
LR = [[0 for _ in range(N+2-i)] for i in range(N+2)]
for i in range(M):
  L, R = map(int, sys.stdin.readline().split())
  LR[L][R-L+1] += 1
 
for i in range(2,N+2):
  for j in range(1,N-i+2):
    LR[j][i] += LR[j][i-1] + LR[j+1][i-1] - LR[j+1][i-2]
 
for i in range(Q):
  p, q = map(int, sys.stdin.readline().split())
  sys.stdout.write("{}\n".format(LR[p][q-p+1]))

Measured memory_bytes: 8648
import java.util.*;

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

    char[] c = s.toCharArray();
    int l = c.length;
    int count = 0;

    for(int i=0;i<l/2;i++){
      if(c[i]!=c[l-1-i]){
        count += 1;
      }
    }

    System.out.println(count);

  }
}

Measured memory_bytes: 23764
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
//main definations
#define UI unsigned int
#define LLI long long int
#define ULLI unsigned long long int
void read_array(int *a, int n);
void write_array(int *a, int n);
void sort_array(int *a, int n);
//codechef only
#define TC for(UI defined_i=1;defined_i<=t;defined_i++)
using namespace std;

int main(){
	string s;
	cin>>s;
	int len=s.size();
	for(int i=0;i<len;i+=2){
		cout<<s[i];
	}
	cout<<endl;
	return 0;
}

void read_array(int *a, int n){
	for(int i=0;i<n;i++){
		cin>>*(a+i);
	}
}
void write_array(int *a, int n){
	for(int i=0;i<n;i++){
		cout<<*(a+i)<<" ";
	}
}
void sort_array(int *a, int n){
	sort(a,a+n);
}

Measured memory_bytes: 512
import sys
sys.setrecursionlimit(10 ** 6)
# input = sys.stdin.readline    ####
int1 = lambda x: int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

INF = float('inf')

def solve():
    n, q = MI()
    S = input()
    ats = [0]
    cnt = 0
    for i in range(n-1):
        j = i + 2
        s = S[i:j]
        # print(s)
        if s == 'AC':
            cnt += 1
        ats.append(cnt)
    # print(ats)
    for _ in range(q):
        l, r = MI1()
        # print(S[l:r+1])
        print(ats[r] - ats[l])


if __name__ == '__main__':
    solve()


Measured memory_bytes: 52708
#include<bits/stdc++.h>
using namespace std;
int main(){
  long double a;
  cin >> a;
  long double b, c, d;
  b = a / 3;
  c = a/ 3;
  d = a / 3;
  long double ans = b* c * d;
  cout << fixed << setprecision(12) << ans << endl;
}

Measured memory_bytes: 256
import fractions

A,B,C,D = map(int, input().split())

def lcm(x, y):
  return (x * y) // fractions.gcd(x, y)

a = (B // C) - ((A-1) // C)
b = (B // D) - ((A-1) // D)
c = (B // (lcm(C, D))) - ((A-1) // (lcm(C, D)))

s = a + b - c

ans = B - (A-1) - s

print(ans)

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

typedef long long ll;
const int NMAX = 2e5 + 10;
const int MOD = 1e9 + 7;

int pre[NMAX];

int find(int x){	return pre[x] = (x == pre[x]?x:find(pre[x]));}
int main(int argc, char const *argv[])
{
	int n , m;
	int u , v , pre_u , pre_v;
	scanf("%d%d",&n,&m);
	for(register int i = 1;i <= n;i++)
		pre[i] = i;
	while(m--)
	{
		scanf("%d%d",&u,&v);
		pre_u = find(u); pre_v = find(v);
		pre[pre_u] = pre_v;
	}
	int ans = 0;
	for(register int i = 1;i <= n;i++)
		if(i == find(i))
			ans++;
	printf("%d\n",ans - 1 );
	return 0;
}

Measured memory_bytes: 4216
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<int,int>;
/* ちゃんと考えてわかって実装 */

int main(void){
    int n, m;
    cin >> n >> m;
    vector< vector<P> > city(n+1);
    for(int i=1; i<=m; i++){
        int p, y;
        cin >> p >> y;
        city[p].push_back(make_pair(y, i));
    }
    for(int j=1; j<=n; j++){
        sort(city[j].begin(), city[j].end());
    }
    vector<P> ans(m+1);
    for(int j=1; j<=n; j++){
        for(int i=1; i<=city[j].size(); i++){
            ans[city[j][i-1].second] = make_pair(j, i);
        }
    }
    for(int i=1; i<=m; i++){
        string left = to_string(ans[i].first);
        while(left.length() < 6){
            left = "0" + left;
        }
        string right = to_string(ans[i].second);
        while(right.length() < 6){
            right = "0" + right;
        }
        cout << left << right << endl;
    }
    return 0;
}

Measured memory_bytes: 7808
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

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;}

const ll INF=1e18;

int main()
{
    ll n;
    cin >> n;
    vector<ll> h(n);
    rep(i,n){
        cin >> h[i];
    }
    ll ans=0;
    while(true){
        ll cnt=0;
        rep(i,n){
            if((i<n-1 && h[i]>0 && h[i+1]==0) || (i==n-1 && h[i]>0)){
                cnt++;
            }
            if(h[i]){
                h[i]--;
            }
        }
        if(cnt==0){
            break;
        }
        else{
            ans+=cnt;
        }
    }
    cout << ans << endl;
    return 0;
} 

Measured memory_bytes: 256
loop do
  medal = 100
  b,r,g,c,s,t = $stdin.gets.chomp.split(" ").map(&:to_i)
  break if b + r + g + c + s + t == 0
  medal += 95 * b
  medal += 63 * r
  medal += 7 * g
  medal += 2 * c
  medal -= (t - s) * 3
  p medal
end

Measured memory_bytes: 6096
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


char buf[5];

int main(){

	scanf("%s",buf);

	if((buf[0] == buf[1] && buf[0] == buf[2]) || (buf[1] == buf[2] && buf[1] == buf[3])){

		printf("Yes\n");

	}else{

		printf("No\n");
	}

	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

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

		int n = Integer.parseInt(sc.next());

		long[] l = new long[n + 1];

		l[0] = 2;
		l[1] = 1;

		for (int i = 2; i <= n; i++) {
			l[i] = l[i - 1] + l[i - 2];
		}

		System.out.println(l[n]);
	}

}


Measured memory_bytes: 20948
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

const (
	SENTINEL = 2000000000
)

func main() {
	fmt.Println(answer(os.Stdin))
}

func answer(r io.Reader) string {
	sc := bufio.NewScanner(r)
	sc.Split(bufio.ScanWords)
	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())
	A := make([]int, n)
	for i := 0; i < n; i++ {
		sc.Scan()
		A[i], _ = strconv.Atoi(sc.Text())
	}
	return strconv.Itoa(mergeSort(A, n, 0, n))
}

func merge(A []int, n, left, mid, right int) int {
	n1 := mid - left
	n2 := right - mid
	L, R := make([]int, n1+1), make([]int, n2+1)
	for i := 0; i < n1; i++ {
		L[i] = A[left+i]
	}
	for i := 0; i < n2; i++ {
		R[i] = A[mid+i]
	}
	L[n1], R[n2] = SENTINEL, SENTINEL

	cnt := 0
	i, j := 0, 0
	for k := left; k < right; k++ {
		if L[i] <= R[j] {
			A[k] = L[i]
			i++
			continue
		}
		A[k] = R[j]
		j++
		cnt += n1 - i
	}
	return cnt
}

func mergeSort(A []int, n, left, right int) int {
	if left+1 < right {
		mid := (left + right) / 2
		v1 := mergeSort(A, n, left, mid)
		v2 := mergeSort(A, n, mid, right)
		v3 := merge(A, n, left, mid, right)
		return v1 + v2 + v3
	}
	return 0
}



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

using namespace std;

int main() {
    int n;
    cin >> n;
    set <string> s;
    for (int i = 0; i < n; i++) {
        string t;
        cin >> t;
        s.insert(t);
    }
    cout << s.size() << endl;
}


Measured memory_bytes: 19156
import java.math.*;
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner scan_ = new Scanner(System.in);
        String a = scan_.next();
        double a_ = Double.parseDouble(a);
        double menseki = a_ * a_ * 3.14159265358979323846;
        double enshuu = a_ * 2 * 3.14159265358979323846;
        System.out.println(
            String.format("%.8f" , menseki) + " " + String.format("%.8f" , enshuu)
        );
        
        
        
        
        }
      }




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

#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>

using namespace std;

void getStr(long n){
  vector<int> ret;
  long ii;
  while(n!=0){
	ret.push_back(n%2);
	n /= 2;
  }

  for(ii=ret.size() -1;ii>=0;ii--){
	if(ret[ii] == 1){
	  cout << "1" ;
	}
	else{
	  cout << "0" ;
	}

  }
  cout << endl;
}
int main(){
  long n,org;
  long res,temp;
  //long box[64];
  long ii,kk;
  cin >> n;
  res = LONG_MAX;
  vector<int> box;
  org = n;
  while(n!=0){
	if((n & 1) == 1){
	  box.push_back(1);
	}
	else{
	  box.push_back(0);
	}
	if(n<0){
	  n = (n-1)/(-2) ;
	}
	else{
	  n = n/(-2);
	}
  }
  if(org !=0){
	for(ii=box.size()-1;ii>=0;ii--){
	  cout << box[ii];
	}
	cout << endl;
  }
  else{
	cout << "0"  << endl;
  }
  //cout << ii << endl;
  //getStr(ii);
  return 0;
}


Measured memory_bytes: 256
/*
　　　∫ ∫ ∫
　　　ノヽ
　　（＿　 ）
　（＿　　　 ）
（＿＿＿＿＿＿ ）
　ヽ(´･ω･)ﾉ　
　　 |　 /
　　 UU
*/
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef long long ll;
const int MOD = (int)1e9 + 7;
const int INF = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define REP(i, n) for (int i = 0; i < (n); i++)
#define FOR(i,s,n) for (int i = s; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end() //コンテナじゃないと使えない!!
#define debug(x) cerr << #x << ": " << x << "\n";
template <typename T>
ostream& operator<<(ostream& os, vector<T> &V){
    int N = V.size();
    REP(i,N){
        os << V[i];
        if (i!=N-1) os << " ";
    }
    os << "\n";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, pair<T,T> &P){
os << P.first;
os << " ";
os << P.second;
os << "\n";
return os;
}
template <typename T>
ostream& operator<<(ostream& os, set<T> &S){
    auto it=S.begin();
    while(it!=S.end()){
        os << *it;
        os << " ";
        it++;
    }
    os << "\n";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, deque<T> &q){
    for(auto it=q.begin();it<q.end();it++){
        os<<*it;
        os<<" ";
    }
     os<<endl;
    return os;
}
//fixed<<setprecision(10)<<ans<<endl;
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<int> A(N);
    REP(i,N) cin >> A[i];

    vector<int> LIS(1,-1);
    REP(i,N){
        if (LIS.back()<A[i]) LIS.push_back(A[i]);
        else{
            auto it = lower_bound(ALL(LIS),A[i]);
            chmin(*it,A[i]);
        }
    }
    int ans=LIS.size()-1;

    cout << ans << endl;
}


Measured memory_bytes: 4560