akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>//万能头文件
using namespace std;//名字空间
int main(){//主函数
    string AC;
    cin>>AC;
    string b=AC;
    reverse(AC.begin(),AC.end());
    for(int i=0;i<AC.size();i++)
    {
        if(AC[i]=='b') AC[i]='d';
        else if(AC[i]=='d') AC[i]='b';
        else if(AC[i]=='p') AC[i]='q';
        else if(AC[i]=='q') AC[i]='p';
    }
    if(AC==b) cout<<"Yes";//符合就输出"Yes"
    else cout<<"No";//否则就输出"No"
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = 1LL << 30;
#define REP(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, n) for (ll i = a; i < n; i++)
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int cnt = 0;
    REP(i, s.size())
    if (s[i] == '1') cnt++;

    cout << cnt << endl;
}

Measured memory_bytes: 256
import sys
import numpy as np
from operator import mul
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

d = int(readline())
c = list(map(int, readline().split()))
s = []
for _ in range(d):
    add = list(map(int, readline().split()))
    s.append(add)

#t = [0] * d
day = 0
satisfy = 0
sumC = sum(c)
count = np.zeros(26)

for i in range(d):
    #t = int(readline()) - 1
    tarLis = s[day]
    tar = max(tarLis)
    t = tarLis.index(tar) + 1
    print(t)
    day += 1
    '''
    up = s[day][t]
    count += 1
    count[t] = 0
    sub = map(mul, count, c)
    satisfy += (up - sum(sub))

    # satisfy
    print(satisfy)
    '''


Measured memory_bytes: 27240
#if 1

#include <bits/stdc++.h>
using namespace std;
int n,m,ans;
int d[100005],x,y;
vector <int> v[100005];

int dfs(int x)
{
    if(d[x]) return d[x];
    //d[x] = 1;
    for(int i = 0;i < v[x].size();i++)
    {
        d[x] = max(d[x],dfs(v[x][i])+1);
        ans = max(ans,d[x]);
    }
    return d[x];
}

int main()
{
    scanf("%d %d", &n, &m);
    for(int i = 1;i <= m;i++)
    {
        scanf("%d %d", &x, &y);
        v[x].push_back(y);
    }
    for(int i = 1;i <= n;i++)
    {
        if(!d[i]) dfs(i);
    }
    printf("%d",ans);
}

#endif // 1++

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

#define int long long
#define REP(i, l, r) REPEAT(i,l,r,true) // [l, r)
#define rep(i, n) REP(i,0,n)           // [0, n)
#define REPEAT(i, l, r, condition) for(int i=(condition)?l:r-1;(condition)?i<r:i>=l;(condition)?++i:--i) // false<-[l, r)->true
#define all(e) e.begin(),e.end()
#define rall(e) e.rbegin(),e.rend()
#define pb push_back
#define fs first
#define sc second
#ifdef LOCAL
#define show(...) cerr<<#__VA_ARGS__<<" = ";_DEBUG(__VA_ARGS__)
#define showlr(n, l, r) cerr<<#n<<" = ";for(int i=l;i<r;i++){cerr<<n[i]<<", ";}cerr<<endl // [l, r)
#else
#define show(...) true
#define showlr(n,l,r) true
#endif

#define YN(condition) puts((condition)?"YES":"NO")
#define Yn(condition) puts((condition)?"Yes":"No")
#define yn(condition) puts((condition)?"yes":"no")
#define YES puts("YES")
#define Yes puts("Yes")
#define yes puts("yes")
#define NO  puts("NO")
#define No  puts("No")
#define no  puts("no")

#define case(i) printf("Case #%lld: ",i)

using namespace std;

using vi=vector<int>;
using pint=pair<int, int>;

struct io {
    io() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout.tie(0);
        cout << fixed << setprecision(20);
    }
} io;

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

template<class T>
ostream &operator<<(ostream &os, vector<T> v) {
    os << "{";
    for (T &e:v)os << e << (v.size() - (int) (&e - &v[0]) > 1 ? ", " : "");
    os << "}";
    return os;
}

void _DEBUG() {}

template<typename H, typename... T>
void _DEBUG(H a, T...b) {
    cerr << a << (sizeof...(b) ? "," : "\n");
    _DEBUG(b...);
}

inline void in() {}

template<typename H, typename... T>
void in(H &a, T &... b) {
    cin >> a;
    in(b...);
}

inline void out() {}

template<typename H, typename... T>
void out(H a, T... b) {
    cout << a << (sizeof...(b) ? " " : "\n");
    out(b...);
}

template<class T>
void resz(int n, T &v) { v.resize(n); }

template<class H, class... T>
void resz(int n, H &a, T &... b) {
    a.resize(n);
    resz(n, b...);
}

template<typename V, typename H>
void resize(vector<V> &v, const H a) { v.resize(a); }

template<typename V, typename H, typename... T>
void resize(vector<V> &v, const H &a, const T... b) {
    v.resize(a);
    for (auto &v:v) resize(v, b...);
}

const int INF = 1LL << 55;
const int MOD = 1000000007;
const double EPS = 1e-8;

/*------------end of definitions------------*/

string S;

signed main() {

    in(S);
    rep(i, S.size()) {
        if (i & 1) {
            if (S[i] == 'R') {
                No;
                return 0;
            }
        } else {
            if (S[i] == 'L') {
                No;
                return 0;
            }
        }
    }
    Yes;

    return 0;
}


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

using namespace std;

int main() {
  long n;
  cin >> n;
  for (long i = sqrt(n) + 1; i > 0; i--) {
    if (!(n % i)) {
      cout << to_string(n / i).length() << '\n';
      return 0;
    }
  }
}


Measured memory_bytes: 256
/////////////////////////   _LeMur_
#define _CRT_SECURE_NO_WARNINGS
#include <unordered_map>
#include <unordered_set>
#include <functional>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cassert>
#include <chrono>
#include <random>
#include <bitset>
#include <cstdio>
#include <vector>
#include <string>
#include <ctime>
#include <stack>
#include <queue>
#include <cmath>
#include <ctime>
#include <list>
#include <map>
#include <set>

using namespace std;

const int N = 305;
const int inf = 1000 * 1000 * 1000;
const int mod = 998244353;

int n;
int a[N];

int binpow(int a,int b){
    if(b == 0)return 1;
    if(b % 2)return a * 1ll * binpow(a , b - 1) % mod;
    int t = binpow(a , b / 2);
    return t * 1ll * t % mod;
}

int pw(int x,int y){
    int answ = 1;
    while(y--){
        answ = answ * 1ll * x % mod;
    }
    return answ;
}

int dp[N * N];
int q[N * N];

int calc(int n){
    int answ = pw(2 , n);
    answ = (answ - 2 + mod) % mod;
    return answ;
}

int main() {
	mt19937 myrand(chrono::steady_clock::now().time_since_epoch().count());
    scanf("%d",&n);
    int sum = 0;
    for(int i=1;i<=n;i++){
        scanf("%d",&a[i]);
        sum += a[i];
    }
    int answ = pw(3 , n);
    answ -= 3ll * pw(2 , n);
    answ = (answ + mod) % mod;
    answ = (answ + 3) % mod;
    ///
    dp[0] = pw(2 , n);
    q[0] = 2;
    ///
    int cof = binpow(2 , mod - 2);
    ///
    for(int i=1;i<=n;i++){
        for(int j=sum;j>=0;j--){
            if(j + a[i] > sum)continue;
            dp[j + a[i]] += dp[j] * 1ll * cof % mod;
            dp[j + a[i]] %= mod;
            ///
            q[j + a[i]] += q[j];
            q[j + a[i]] %= mod;
        }
    }
    ///
    int k = sum / 2;
    if(sum % 2) ++k;
    for(int i=k;i<sum;i++){
        int A = (dp[i] - q[i] + mod) % mod;
        A = A * 3ll % mod;
        answ = (answ - A + mod) % mod;
    }
    cout << answ << endl;
	return 0;
}


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

using namespace std;

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

	int n, flag=0, cnt=0;
	cin >> n;
	for(int i=0; i<n; i++){
        int d1, d2;
        cin >> d1 >> d2;
        if(d1==d2) cnt++;
        else cnt=0;
        if(cnt>=3) flag=1;
	}
    if(flag) cout << "Yes" << endl;
    else cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
 
int main()
{
  int n;
  cin>>n;
  string s;
  cin>>s;
  if(n%2!=0)
  {
    cout<<"No";
    return 0;
  }
  else
  {
    string t = s.substr(0 , n/2);
    string m = s.substr(n/2);
    // cout<<t<<" "<<m;
    if(t==m)
    cout<<"Yes";
    else
    cout<<"No";
 
    return 0;
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n,i,c=0;
	cin>>n;
	int a[n];
	for(i=0;i<n;i++){
		cin>>a[i];
	}
	sort(a,a+n);
	for(i=0;i<n-2;i++){
		for(int j=i+1;j<n-1;j++){
			if(a[i]!=a[j])
			for(int k=j+1;k<n;k++){
				if(a[j]!=a[k]){
					if(a[i]+a[j]>a[k]) c++;
					else break;
				}
			}
		}
	}
	cout<<c<<'\n';
}

Measured memory_bytes: 3648
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
//#include <bits/stdc++.h>

using namespace std;

int main(){
  int K,S,ans = 0;
  cin >> K; 
  cin >> S;
  for(int i=0;i<=K;i++){
    for(int j=0;j<=K;j++){
        if(0 <= S - i - j && S - i - j <=K) ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#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 ALL(a) a.begin(),a.end()
typedef long long ll;
#define INF 1<<30

int main()
{
    int N,K;
    cin >> N >> K;
    int A = 0;
    while(N>0){
        A ++;
        N /= K;
    }
    cout << A << endl;
    return 0;
}

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

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

    vector<string> vs = {"w", "", "k", "s", "t", "n", "h", "m", "y", "r"};

    for (int i = 0; i < str.size(); i += 2) {
        int c = str[i] - '0';
        if (str[i+1] == 'R') cout << vs[c] + "e";
        if (str[i+1] == 'T') cout << vs[c] + "a";
        if (str[i+1] == 'L') cout << vs[c] + "i";
        if (str[i+1] == 'U') cout << (c == 0 ? "nn" : (vs[c] + "u"));
        if (str[i+1] == 'D') cout << vs[c] + "o";
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 3224
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <locale>
#include <iostream>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()

using namespace std;

using ll = long long;
using ld = long double;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> int len(const T &x) { return x.size(); }

template<typename T>
vector<T> table(int n, T v) { return vector<T>(n, v); }

template <class... Args>
auto table(int n, Args... args) {
  auto val = table(args...);
  return vector<decltype(val)>(n, move(val));
}

struct yes_no : numpunct<char> {
  string_type do_truename()  const { return "YES"; }
  string_type do_falsename() const { return "NO"; }
};

void solve(ll a, ll b, ll c) {
  cout << min({a + b, a + c, b + c}) << endl;
}

int main() {
  locale loc(locale(), new yes_no);
  cout << boolalpha << setprecision(12) << fixed;
  cout.imbue(loc);
	ll a;
	ll c;
	ll b;
	scanf("%lld", &a);
	scanf("%lld", &b);
	scanf("%lld", &c);
	solve(a, b, c);
	return 0;
}


Measured memory_bytes: 256
def read_input
  gets.split(" ").map(&:to_i)
end

class ABProblem
  def initialize(a, b)
    @a, @b = a, b
  end

  def div
    @a / @b
  end

  def mod
    @a % @b
  end

  def div_float
    sprintf("%.5f", @a.to_f / @b.to_f)
  end
end

a, b = read_input
p = ABProblem.new(a, b)
puts [p.div, p.mod, p.div_float].join(" ")

Measured memory_bytes: 8604
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int inf = 2e5+9;
ll n,k,a[inf],ans;

int main(){
    cin>>n>>k;
    for(int i=1;i<=n;++i)
        cin>>a[i];
    sort(a+1,a+1+n);
    for(int i=1;i<=n-k;i++)
        ans += a[i];
    cout<<ans<<endl;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define time clock_t tStart = clock();
#define show printf("Time taken: %.6fs\n", (double)(clock() - tStart)/CLOCKS_PER_SEC);
#define ll                    long long int
#define loop(a,b)             for(int i=a;i<=b;++i)
#define count_1(n)            __builtin_popcountll(n)
#define pb                    push_back
#define F                     first
#define S                     second
#define mp                    make_pair
#define MOD                   1000000007
#define itoc(c)               ((char)(((int)'0')+c))
#define vi                    vector<int>
#define vll                   vector<ll>
#define pll                   pair<ll,ll>
#define pii                   pair<int,int>
#define all(p)                p.begin(),p.end()
#define mid(s,e)              (s+(e-s)/2)
#define tcase()               ll t,n; cin>>t;n=t; while(t--)
#define iscn(num)             scanf("%d",&num);
#define eb                    emplace_back
#define ull                   unsigned long long
#define KAMEHAMEHA            ios_base::sync_with_stdio(0);
#define RASENGAN              ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
int main()
{
    KAMEHAMEHA
//    #ifdef _soumik
//        freopen("input.txt", "r", stdin);
//    #endif
    int n;
    cin>>n;
    cout<<3*(n*n)<<endl;
    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
l;
main(i)
{
char s[21],r;
scanf("%s",s);
l=strlen(s);
for(i=0;i<l/2;i++)
r=s[i],s[i]=s[l-i-1],s[l-i-1]=r;
printf("%s\n",s);
return 0;
}

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

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define pb(n) push_back(n)
#define mp make_pair
#define INF LONG_LONG_MAX
#define MOD 1000000007
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;

#define P pair<int,pair<int,int>>

int n,m,s,c[50],d[50],dp[50][2501];
vector<pair<int,pair<int,int>>> v[50];
priority_queue<P, vector<P>, greater<P>> pq;
bool visited[50][2501];
int ans[50];

signed main() {
    rep(i,50) rep(j,2501) dp[i][j] = INF/10000;
    rep(i,50) ans[i] = INF/10000;
    cin >> n >> m >> s;
    s = min(s, 2500LL);
    dp[0][s] = 0;
    rep(i,m) {
        int _u, _v, a, b;
        cin >> _u >> _v >> a >> b;
        --_u, --_v;
        v[_u].pb(mp(_v, mp(a,b)));
        v[_v].pb(mp(_u, mp(a,b)));
    }
    rep(i,n) cin >> c[i] >> d[i];
    pq.push(mp(0,mp(0,s)));
    while(pq.size()) {
        int cost = pq.top().fi, idx = pq.top().se.fi, IDX = pq.top().se.se;
        pq.pop();
        if (visited[idx][IDX]) continue;
        visited[idx][IDX] = true;
        dp[idx][IDX] = cost;
        ans[idx] = min(ans[idx], cost);
        if (IDX+c[idx] <= 2500) {
            if (dp[idx][IDX+c[idx]] > dp[idx][IDX] + d[idx]) {
                pq.push(mp(dp[idx][IDX]+d[idx], mp(idx, IDX+c[idx])));
            }
        }
        for(auto path : v[idx]) {
            int to = path.fi, a = path.se.fi, b = path.se.se;
            if (0 <= IDX-a && IDX-a <= 2500) {
                if (dp[to][IDX-a] > dp[idx][IDX]+b) {
                    pq.push(mp(dp[idx][IDX]+b, mp(to, IDX-a)));
                }
            }
        }
    }
    rep11(i,n) cout << ans[i] << endl;
}




Measured memory_bytes: 10628
#include<iostream>
#include<string>
#include<algorithm>    
#include<cmath>
#include<map>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<stack>
#include<queue>
#include<tuple>
#include<cassert>
#include<set>
//#include<bits/stdc++.h>
using ll = long long;
using namespace std;
const ll INF = 10000000000000000;
const ll mod = 1000000007;
ll test[12345678];
signed main() {
	ll n = 0, m = 0, k, l, cnt = 0, z = 0; string s, t; cin >> s >> t;
	for (int h = 0; h < 3; h++) {
		if (s[h] == t[h]) { cnt++; }
	}
	cout << cnt << endl;
	cin >> n; return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;int main(){long long n,i=0;cin>>n;vector<long long>a(n);while(i!=n){cin>>a[i++];}sort(a.begin(), a.end());cout<<a[0]<<" "<<a[n-1]<<" "<<accumulate(a.begin(),a.end(),0LL)<<endl;}

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

int main() {
    int N, M;
    cin >> N >> M;
    int a[100] = {}, b[100] = {};
    int ha[100] = {};

    for (int i = 0; i < M; i++) {
        cin >> a[i] >> b[i];
    }
    for (int i = 0; i < M; i++) {
        ha[a[i]-1]++;
        ha[b[i]-1]++;
    }
    for (int i = 0; i < N; i++) {
        cout << ha[i] << endl;
    }
}

Measured memory_bytes: 256
import std.stdio;
import std.algorithm;
import std.math;
import std.conv;
import std.string;

T readNum(T)(){
  return readStr.to!T;
}

T[] readNums(T)(){
  return readStr.split.to!(T[]);
}

string readStr(){
  return readln.chomp;
}

void main(){
  auto k = readNums!int;

  auto start = k[0] * 60 + k[1];
  auto end = k[2] * 60 + k[3];
  writeln(end - start - k[4]);
}


Measured memory_bytes: 3236
#include<iostream>
#include<iomanip>
using namespace std;
int main(){
	double a,b,c,d;
	cin>>a>>b>>c>>d;
	cout<<fixed<<setprecision(6)<<a*b/2<<' ';
	if(c==a/2&&d==b/2)
		cout<<1<<endl;
	else
		cout<<0<<endl;
	return 0;
}

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

using ll = long long;
using pp = pair<ll,ll>;
const ll amari = 1e9+7;
const char BC = 'A' - 'a';
#define ben(a) a.begin(),a.end() //昇順
#define enb(a) a.rbegin(),a.rend() //降順
#define pb(a,b) a.push_back(b)
//fixed << setprecision(20)

int main(){
	ll n;
	cin >> n;
	ll a = sqrt(n);
	ll maxi = 0;
	for(ll i = 1; i <= a; i++){
		if(n % i == 0){
			maxi = max(i,maxi);
		}
	}
	cout << maxi + (n / maxi) - 2 << endl;
	return 0;
}


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

int main()
{
  int n;
  cin >> n;
  vector<vector<double>> dp(n + 1, vector<double>(n + 1));
  double ret = 0;
  for (int i = 1; i <= n; ++i) {
    double x;
    cin >> x;
    if (i == 1) {
      dp[i][0] = (1 - x);
      dp[i][1] = x;
    }
    else {
      for (int j = 0; j <= i; ++j) {
        dp[i][j] = dp[i-1][j] * (1 - x);
        if (j > 0)
          dp[i][j] += dp[i-1][j-1] * x;
      }
    }
  }

    for (int i = n/2 + 1; i <= n; ++i)
      ret += dp[n][i];
    cout << setprecision(10) << ret <<'\n';


  return 0;
}


Measured memory_bytes: 70656
def main():
    N = int(input())
    H = list(map(int, input().split()))
    ans = 0
    seq = 0
    for i in range(N-1):
        if H[i] >= H[i+1]:
            seq += 1
        else:
            seq = 0
        ans = max(ans, seq)
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 63984
#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
#define idfc ios_base::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr)
//:/
#define pb emplace_back
#define mp make_pair
#define nt _ll128
#define ld long double
long double PI =3.14159265358979323846;
using ll = long long;



const ll modo=1e9+7;
const ll inf=LONG_LONG_MAX;
const ll ms=(2e5)+5;


set<string> ss;

int main()
{
    idfc;
    int n;
    cin>>n;
    string s;
    while(n--)
    {
        cin>>s;
        ss.insert(s);
    }
    cout<<ss.size();
    return 0;
}

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


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

  int p;
  cin >> p;
  int ans = p;
  for (int i = 0; i < n - 2; ++i) {
    int n;
    cin >> n;
    ans += min(p, n);
    p = n;
  }
  ans += p;
  cout << ans;
  
  return 0;
}




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


int main() {
	int n, l;
	cin >> n >> l;

	int sum = 0, apl = 114514;
	for (int i = 1; i <= n; i++) {
		sum += (l + i - 1);

		if (abs(l + i - 1) < abs(apl)) {
			apl = l + i - 1;
		}
	}

	cout << sum - apl << endl;

	return 0;
}

Measured memory_bytes: 256
s = input()
ans = [0] * len(s)
c = 0
for i in range(len(s)):
    if s[i] == 'R':
        c += 1
    if s[i] == 'L' and s[i-1] == 'R':
        if c % 2 == 0:
            ans[i] += c // 2
            ans[i-1] += c // 2
        else:
            ans[i] += c//2
            ans[i-1] += c//2 + 1
        c = 0
c = 0
for i in reversed(range(len(s))):
    if s[i] == 'L':
        c += 1
    if s[i] == 'R' and s[i+1] == 'L':
        if c % 2 == 0:
            ans[i+1] += c // 2
            ans[i] += c // 2
        else:
            ans[i+1] += c//2 + 1
            ans[i] += c // 2
        c = 0
print(' '.join(list(map(str, ans))))

Measured memory_bytes: 10504
z=ord('z')
a=ord('a')
ss=input()
s=list(ss)
k=int(input())
l=len(s)

for i in range(l):
    if (z-ord(s[i])+1<=k)and(s[i]!='a'):
        k-=z-ord(s[i])+1
        s[i]='a'

if k>0:
    last=(ord(s[-1])+k-a)%26+a
    s[-1]=chr(last)

ans=''.join(s)
print(ans)

Measured memory_bytes: 4212
#pragma GCC optimize ("Ofast")
#pragma GCC target ("avx2")
//#include<bits/stdc++.h>
#include<cstdio>
#include<cstring>

//同じコードでそんなにばらつくんですか

using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int CM = 200000, CL = 12;
char cn[CM + CL], * ci = cn + CM + CL, * owa = cn + CM, ct;
const ll ma0 = 1157442765409226768;
const ll ma1 = 1085102592571150095;
const ll ma2 = 71777214294589695;
const ll ma3 = 281470681808895;
const ll ma4 = 4294967295;
inline int getint() {
	if (ci - owa > 0) {
		memcpy(cn, owa, CL);
		ci -= CM;
		fread(cn + CL, 1, CM, stdin);
	}
	ll tmp = *(ll*)ci;
	int dig = ((tmp & ma0) ^ ma0) ? 68 - __builtin_ctzll((tmp & ma0) ^ ma0) : 0;
	tmp = tmp << dig & ma1;
	tmp = tmp * 10 + (tmp >> 8) & ma2;
	tmp = tmp * 100 + (tmp >> 16) & ma3;
	tmp = tmp * 10000 + (tmp >> 32) & ma4;
	ci += (64 - dig >> 3);
	while ((ct = *ci++) >= '0') tmp = tmp * 10 + ct - '0';
	return tmp;
}

bool NG[100001];
int main() {
	//cin.tie(0);
	//ios::sync_with_stdio(false);


	int N = getint(), M = getint();
	int H[100001];
	rep1(i, N) H[i] = getint();
	rep(i, M) {
		int a = getint(), b = getint();
		if (H[a] >= H[b]) NG[b] = 1;
		if (H[a] <= H[b]) NG[a] = 1;
	}
	int kotae = N;
	rep1(i, N) kotae -= NG[i];

	printf("%d", kotae);

	Would you please return 0;
}

Measured memory_bytes: 2248
#include <bits/stdc++.h>
using namespace std;
#define int long long
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define SZ(c) ((int)c.size())
#define CONTAIN(c,x) (c.find(x)!=end(c))
#define OUTOFRANGE(y,x,h,w) (y<0||x<0||y>=h||x>=w)
#define dump(...)
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
#define INF (1001001001)
#define INFLL (1001001001001001001ll)
template<class T> ostream& operator << (ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v)) os<<*i<<(i==end(v)-1?"":"\n"); return os; }
template<class T> istream& operator >> (istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is>>*i; return is; }
template<class T> istream& operator >> (istream &is, pair<T,T> &p) {
    is>>p.first>>p.second; return is; }
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;}
//------------------------------------------------------------------------------
struct before_main_function {
    before_main_function() {
        #ifdef int
            #undef INF
            #define INF INFLL
            #define stoi stoll
        #endif
        cin.tie(0);ios::sync_with_stdio(false);
        cout<<setprecision(15)<<fixed;
        #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int n;
    cin>>n;
    set<int> s;
    REP(i,n) {
        int a;
        cin>>a;
        if(CONTAIN(s,a)) s.erase(a);
        else s.insert(a);
    }
    cout<<SZ(s)<<endl;
    return 0;
}


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

namespace D
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine(solver());
        }
        static int solver()
        {
            var N = int.Parse(Console.ReadLine());
            var A = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            Array.Sort(A);
            if (N == 1) return 1;
            if (A[1] == 1) return 0;
            if (A[0] == 1) return 1;

            var Amax = A[N - 1];
            var check = new bool[Amax + 1];
            for (int i = 0; i < Amax + 1; i++) check[i] = true;
            for (int i = 0; i < N; i++)
            {
                if (!check[A[i]]) continue;
                for (int j = 2 * A[i]; j < Amax + 1; j += A[i]) check[j] = false;
            }
            var result = new bool[N];
            for (int i = 0; i < N; i++)
            {
                if (i + 1 < N && A[i] == A[i + 1])
                {
                    result[i] = false;
                    result[i + 1] = false;
                    check[A[i]] = false;
                }
                else
                {
                    result[i] = check[A[i]];
                }
            }
            return result.Count(r => r);
        }
    }
}

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

int main(){
  int a, b;
  int ans = 0;
  string s;
  cin >> a >> b;
  for (int i=a ;i < b+1;i++){
    s = to_string(i);
    if(s[0]==s[4] && s[1]==s[3]) ans ++;
  }
  cout << ans << endl;  
}

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

int main() {
  int N;
  cin >> N;
  bool ans = 0;
  for(int i = N / 7; i >= 0; i--) {
    if((N - 7 * i) % 4 == 0) {
      ans = 1;
      break;
    }
  }
  if(ans)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
  

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

using namespace std;

#define debug(x) cout << #x << "==" << x << endl;

const int inf = 100000000;

typedef long long ll;



int memo[1001][1001];
bool checked[1001][1001];
int lcs(string s, string t, int si, int ti) {
  if( si == -1 && ti == -1) {
    return 0;
  }
  if( si == -1 ) {
    return lcs(s, t, si, ti-1) + 1;
  } 
  if( ti == -1) {
    return lcs(s, t, si-1, ti) + 1;
  }

  if( checked[si][ti] ) {
    return memo[si][ti];
  }
  checked[si][ti] = true;

  int r1 = lcs(s, t, si-1, ti) + 1;  // sを一文字削除
  int r2 = lcs(s, t, si, ti-1) + 1;  // tを一文字削除
  int r3 = lcs(s, t, si-1, ti-1) + ( s[si] == t[ti] ? 0 : 1 ); // 最後の文字を交換して一致させる。もともと一致している場合は不要

  int res = min(r1, min(r2, r3)  );

  return memo[si][ti] = res;

}


int main() {
  ios::sync_with_stdio(false);

  string s, t;
  cin >> s >> t;

  cout << lcs(s, t, s.size(), t.size()) << "\n";

  return 0;
}

Measured memory_bytes: 8308
#include<iostream>
#include<vector>
#include<algorithm>
#define MAX_N 200000
using namespace std;
vector<int> ps;
int prime[MAX_N];
int main(){
	for(int i=2;i<MAX_N;i++)prime[i]=1;
	for(int i=2;i<MAX_N;i++){
		if(prime[i]){
			for(int j=2;i*j<MAX_N;j++){
				prime[i*j]=0;
			}
		}
	}
	for(int i=2;i<MAX_N;i++){
		if(prime[i])ps.push_back(i);
	}
	int n,p;
	while(cin>>n>>p&&n>=0&&p>=0){
		vector<int> v;
		vector<int> ::iterator x;
		x=upper_bound(ps.begin(),ps.end(),n);
		for(int i=0;i<=p;i++){
			for(int j=i;j<=p;j++){
				v.push_back((*(x+i))+(*(x+j)));
			}
		}
		sort(v.begin(),v.end());
		cout<<v[p-1]<<endl;
	}
}

Measured memory_bytes: 2128
#include <vector>
#include <list>
#include <map>
#include <set>
#include <unordered_set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <stdio.h>
#include <complex>
#include <cstdint>
#include <tuple>

#define M_PI       3.14159265358979323846

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }
inline int readInt() { int x; scanf("%d", &x); return x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007

int main() {
	string str;
	cin >> str;
	int ret = 0;
	int cnt = 0;
	REP(i, str.length()) {
		if (str[i] == 'A')cnt++;
		else if (str[i] == 'C')cnt++;
		else if (str[i] == 'G')cnt++;
		else if (str[i] == 'T')cnt++;
		else {
			ret = max(ret, cnt);
			cnt = 0;
		}
	}
	ret = max(ret, cnt);
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 256
n = int(input())
ans = 0
if(n<10):
    ans=n
elif(n<100):
    ans = 9
elif(n<1000):
    ans+=9
    ans+=n-99
elif(n<10000):
    ans+=9
    ans+=900
elif(n<100000):
    ans+=9
    ans+=900
    ans+=n-9999
else:
    ans+=9
    ans+=900
    ans+=90000
print(ans)

Measured memory_bytes: 3188
import sys
 
stdin = sys.stdin
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()
nas = lambda: stdin.readline().split()

h, w, a, b = na()
d1 = [1, 0]
d2 = [0, 1]

c = d1
for i in range(h):
    if i == b:
        c = d2
    for j in range(w):
        if j >= a:
            print(c[1], end='')
        else:
            print(c[0], end='')
    print()

Measured memory_bytes: 5364
//Littleboy123 Template 1.7
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

//pragmas

// #pragma comment(linker, "/stack:200000000")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")


typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long long int ll;
typedef pair<ll, ll> pll;
typedef unsigned long long int ull;
typedef long double ld;
typedef unsigned long long ull;

const long double pi = acos(-1.0);

#define FOR(a,b,c) for(ll (a)=(b);(a)<(c);++(a))
#define FORE(a,b,c) for(ll (a)=(b);(a)<=(c);++(a))
#define FORN(a,b,c) for(ll (a)=(b);(a)>(c);--(a))
#define FORNE(a,b,c) for(ll (a)=(b);(a)>=(c);--(a))
#define TC(n) cout << "Case #" << (n) << ": "
#define DEBUG(x) cout << "DEBUG " << #x << ' ' << x << '\n';
#define MEM(a,b) memset((a), (b), sizeof((a)))
#define MAX(a,b) (a) = max((a), (b))
#define MIN(a,b) (a) = min((a), (b))
#define nl '\n'
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ordered_set tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>

void init(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}

void infile(){
    freopen("output.out", "r", stdin);
}

void outfile(){
    freopen("output.out", "w", stdout);
}

ll modex(ll a, ll b, ll mod){
    if(b == 0)
        return 1;
    if(b == 1)
        return a;
    ll tmp = modex(a, b/2, mod);
    tmp = (tmp * tmp) % mod;
    if(b & 1)
        tmp = (tmp * a) % mod;
    return tmp;
}

//End of template

int main(){
    init();

    ll x;
    cin >> x;
    if(x >= 30){
        cout << "Yes\n";
    }
    else{
        cout << "No\n";
    }
    return 0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define lli long long int
#define MOD 1000000007
#define FOR(i,n) for(int i=0;i<(int)N;i++)
#define ALL(x) (x).begin(),(x).end()
using namespace std;

inline int getint(){
    int n;
    scanf("%d",&n);
    return n;
}

inline vector<int> getints(int n){
    vector<int> a(n);
    for(int i=0;i<n;i++)scanf("%d",&a[i]);
    return a;
}

void dumpints(vector<int> a){
  cout<<"[";
  for(int i=0;i<a.size()-1;i++){
    cout<<a[i]<<",";
  }
  cout<<a[a.size()-1]<<"]"<<endl;
}

template<class T> bool ifinclude(vector<T> a,T x){
    auto itr=find(a.begin(),a.end(),x);
    return distance(a.begin(),itr)!=a.size();
}

int main(void){
  lli a=getint(),b=getint();
  if(a<=0&&b>=0){
    cout<<"Zero"<<endl;
  }else if(a<0&&b<0){
    if((b-a)%2==0){
      cout<<"Negative"<<endl;
    }else{
      cout<<"Positive"<<endl;
    }
  }else{
  	cout<<"Positive"<<endl;
  }
  return 0;
}


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

int main(){
    int N;
    cin >> N;
    rep(i,40000){
        if (i * i > N){
            cout << (i - 1) * (i - 1)  << endl;
            break;
        }
    }
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
   int n, i, t, o, a[100];

   scanf("%d",&n);
   for(i=0;i<n;i++)
      scanf("%d",&a[i]);

   t=a[0];
   o=a[0];

   for(i=1;i<n;i++){
      if(t>a[i]) t=a[i];
      else if(o<a[i]) o=a[i];
   }

   printf("%d\n",o-t);
   return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()

#define PI acos(-1.0)
#define INF 1000000007

typedef long long ll; 
typedef pair<ll, ll> P;
typedef pair<string, ll> PS;

int a[5];

int main(){
	while (1){
		bool f[5] = {};
		REP(i, 5){
			cin >> a[i];
			if (!a[i])return 0;
			f[a[i]] = 1;
		}
		if ((f[1] && f[2] && f[3]) || (f[1] && !f[2] && !f[3]) || (!f[1] && f[2] && !f[3])
			|| (!f[1] && !f[2] && f[3])){
			REP(i, 5){
				cout << 3 << endl;
			}
			continue;
		}
		REP(i, 5){
			if (!f[2]){
				a[i] = (a[i] + 1) % 3;
			}
			else if (!f[1]){
				a[i]--;
			}
			cout << a[i] << endl;
		}
	}
}

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

public class Main {
	private static void solve(){
	//Implement solution here.
		int n = ni();
		int m = ni();		
		boolean[] broken = new boolean[n + 1];
		for(int i = 0; i < m; i++) {
			broken[ni()] = true;
		}
		int[] dp = new int[n + 1];
		dp[0] = 1;
		int mod = 1000000007;
		
		if(n <= 1) {
			System.out.println(1);
		}else {
			dp[1] = broken[1] ? 0 : 1;
			for(int i = 2; i < n; i++) {
				dp[i] = broken[i] ? 0 : ((dp[i - 2]%mod) + (dp[i - 1]%mod))%mod;
			}
			System.out.println(((dp[n - 2]%mod) + (dp[n - 1]%mod))%mod);
		}		
	}

    //Switch input source (stdin/file)
	private static BufferedReader br  = new BufferedReader(new InputStreamReader(System.in));
	public static void main(String[] args){
        String debugDataPath = System.getenv("DD_PATH");        
        if(debugDataPath != null){
            try{
            	br = new BufferedReader(new InputStreamReader(new FileInputStream(new File(debugDataPath))));
            }catch(Exception e){
                throw new RuntimeException(e);
            }
        }
        solve();
	}

    //Input read utility
	private static StringTokenizer tokenizer = null;
	public static String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}
    //Get next single int
	private static int ni() {
		return Integer.parseInt(next());
	}
    //Get next single long
	private static long nl() {
		return Long.parseLong(next());
	}
    //Get next single double
	private static double nd() {
		return Double.parseDouble(next());
	}
    //Get next int array from one line
	private static int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}
	//Get next char array from one line
	private static char[] ns() {
		return next().toCharArray();
	}
    //Get next long array from one line
	private static long[] nal(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nl();
		return a;
	}
}

Measured memory_bytes: 33304
#include<stdio.h>
int main(){
  int H,W,i,j;
  while(1){
    scanf("%d %d",&H,&W);
    if(H==0&&W==0)break;
    for(j=1;j<=H;j++){  
      for(i=1;i<=W;i++){
	printf("#");
      }
      printf("\n");
    }
    printf("\n");
  }
  return 0;
}

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

using namespace std;

#define fcout(d) cout << fixed << setprecision(d)
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define rep1(i,n) for(int (i) = 1; (i) <= (n); ++(i))
#define repU(i,bottom,ceiling) for(auto (i) = (bottom); (i) <= (ceiling); ++(i))
#define repD(i,ceiling,bottom) for(auto (i) = (ceiling); (i) >= (bottom); --(i))
#define repS(n) for(int (s) = 0; (s) < 1 << (n); ++(s))
#define repV(i,v) for(auto (i) = begin(v); (i) < end(v); ++(i))
#define all(v)  begin(v),end(v)
#define clr(v) fill(all(v),0)
#define l_bnd lower_bound
#define u_bnd upper_bound
#define puf push_front
#define pub push_back
#define pof pop_front
#define pob pop_back
#define mkp make_pair
#define mkt make_tuple
#define fir first
#define sec second
#define divceil(n,d) ((n)/(d) + ((n)%(d) > 0))
#define parity(a,b) (((a) & 1LL)^((b) & 1LL)^1LL)

typedef long long ll;
typedef unsigned long long ull;
typedef double db;

const pair<int,int> DIR[] = { {1,0},{0,1},{-1,0},{0,-1},{1,1},{-1,1},{-1,-1},{1,-1} };
const int INF_32 = -1 + (1 << 30);
const ll INF_64 = -1 + (1LL << 62);
const int MOD = 1e9 + 7;

template<class T> T gcd(T a, T b){ if(a % b){ return gcd(b, a % b); }else{ return b; } }

template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }

ll Pow(ll n, ll m, int mod = MOD){
	ll res = 1,pow = n % mod;
	while(m) {
		if(m & 1LL) res = (res * pow) % mod;
		pow = (pow * pow) % mod;
		m >>= 1;
	}
	return res;
}

void Fact_table(ll *fact, int range, int mod = MOD){
	fact[0] = 1;
	rep1(i,range) fact[i] = fact[i - 1] * i % mod;
}

void Fact_inv_table(ll *fact_inv, ll *fact, int range, int mod = MOD){
	rep(i,range + 1) fact_inv[i] = Pow(fact[i], mod - 2, mod);
}

ll Comb(int n, int m, ll *fact, ll *fact_inv, int mod = MOD){
	if(n < m || m < 0) return 0;
	ll rev = fact_inv[m] * fact_inv[n - m] % mod;
	return rev * fact[n] % mod;
}

bool Prime_judge(int n){
	if(n <= 1 || !(n % 2)) return 0;
	for(int d = 3; d * d <= n; d += 2) if(!(n % d)) return 0;
	return 1;
}

void Prime_table(bool *is_prime, int n){
	fill(is_prime + 1, is_prime + n + 1, 1);
	repU(i,2,n/2) is_prime[i * 2] = 0;
	is_prime[0] = is_prime[1] = 0;
	int p = 3;
	while(p * p <= n){
		for(int t = p * 3; t <= n; t += p * 2) is_prime[t] = 0;
		p += 2;
		while(!is_prime[p]) p += 2;
	}
}

int main(){
	int N; cin>>N;
	ll fact[1000001],fact_inv[1000001],cur,last = 0;
	ll ans = 0;
	Fact_table(fact,N);
	Fact_inv_table(fact_inv,fact,N);
	rep1(i,N - 1){
		cur = fact[i] * fact[N - i - 1] % MOD * Comb(i - 1, N - i - 1, fact, fact_inv) % MOD;
		ans += (cur - last) * i % MOD;
		ans %= MOD;
		if(ans < 0) ans += MOD;
		last = cur;
	}
	cout<<ans<<endl;
	return 0;
}





Measured memory_bytes: 15872
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i=0;i<((int)(n));i++)
#define reg(i,a,b) for(int i=((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i=((int)(n))-1;i>=0;i--)
#define ireg(i,a,b) for(int i=((int)(b));i>=((int)(a));i--)
typedef long long int lli;
typedef pair<int,int> mp;
#define fir first
#define sec second
#define IINF INT_MAX
#define LINF LLONG_MAX
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define pque(type) priority_queue<type,vector<type>,greater<type> >
#define memst(a,b) memset(a,b,sizeof(a))
#define iter(v,ite) for(auto ite=(v).begin();ite!=(v).end();ite++)
#define mimunum(v,x) distance((v).begin(),lower_bound((v).begin(),(v).end(),x))


int n=37;


int dat[3000][50];
int main(void){
	printf("%d %d\n",n*(n+1)+1,n+1);
	rep(i,n+1)printf("%d%c",i+1,i==n?'\n':' ');
	rep(i,n){
		printf("1 ");
		rep(j,n){
			int c=i*n+j+2+n;
			printf("%d%c",c,j+1==n?'\n':' ');
			rep(k,n){
				int d=(k*i)%n;
				int td=k*n+((d+j))%n;
				//printf("%d %d :: %d\n",td,j,c);
				dat[td][i]=c;
			}
		}
	}
	
	rep(i,n){
		rep(j,n){
			printf("%d ",i+2);
			rep(k,n){
				printf("%d%c",dat[i*n+j][k],k+1==n?'\n':' ');
			}
		}
	}
	
		
	
	return 0;
}






Measured memory_bytes: 768
L,R=map(int,input().split())
l1=L//2019
r1=R//2019
if l1<r1:
  print(0)
elif l1==r1:
  res=[]
  for i in range(L,R+1):
    for j in range(i+1,R+1):
      res.append((i*j)%2019)
  print(min(res))

Measured memory_bytes: 81016
#include<stdio.h>
int main(void) {
	int a[7], b[7];
	int i;
	for (i = 0; i < 7; i++) {
		scanf("%d %d", &a[i], &b[i]);
		printf("%d\n", a[i] - b[i]);
	}
	
	return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
 
typedef long long LL;
typedef pair<int, LL> II;

const int N = 100 + 10;
const int INF = 0x3f3f3f3f;
int n, a[N];
int dp[N][10];

int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);

	memset(dp, -INF, sizeof dp); dp[0][0] = 0;
	for (int i = 1; i <= n; ++i) for (int d = 0; d < 10; ++d) {
		dp[i][d] = dp[i - 1][d];
		dp[i][d] = max(dp[i][d], dp[i - 1][(d - a[i] % 10 + 10) % 10] + a[i]);
	}

	int ans = 0;
	for (int i = 1; i < 10; ++i) ans = max(ans, dp[n][i]);
	printf("%d", ans);
	return 0;
}

Measured memory_bytes: 256
#import <stdio.h>
#import <stdlib.h>
int desc(const void *a, const void *b) {
    int d = *(int *)b - *(int *)a;
    return (d > 0) ? 1 : (d < 0) ? -1 : 0;
}
int main() {
    int a[3] = {0};
    char c;
    while ((c = getchar()) != '\n') a[c - 'a']++;
    qsort(a, 3, sizeof(int), desc);
    int total = a[0] + a[1] + a[2];
    switch (total % 3) {
    case 0:
        puts(a[0] == a[1] && a[1] == a[2] ? "YES" : "NO");
        return 0;
    case 1:
        puts(a[0] == a[1] + 1 && a[1] == a[2] ? "YES" : "NO");
        return 0;
    case 2:
        puts(a[0] == a[1] && a[1]  == a[2] + 1? "YES" : "NO");
        return 0;
    }
}


Measured memory_bytes: 2164
/*
    Reference :-
*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define F first
#define S second
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define forn1(i, n) for (int i = 1; i < int(n); i++)
#define PI pair<int,int>
#define all(vec) vec.begin(),vec.end()
ll mod=1e9+7;
ll fac[100001];
ll power(ll n,ll k){
    ll ans=1;
    while(k){
        if(k&1)ans=(ans*n)%mod;
        k/=2;
        n=(n*n)%mod;
    }
    //ans=(ans-1+mod)%mod;
    return ans;
}


int main(){
    //std::ios::sync_with_stdio(false);
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int h,w,n;
    cin>>h>>w>>n;
    double ans=(n/double(max(h,w)));
    int ans1=ceil(ans);
    cout<<ans1;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    if (n >= 30) cout << "Yes";
    else cout << "No";
}


Measured memory_bytes: 3128
N, X = list(map(int, input().split()))
P = [abs(int(c)-X) for c in input().split() if int(c)-X !=0 ]

for i in range(len(P)-1):
    a, b = P[i], P[i+1]
    if a>b: a,b = b,a
    while a>0:
        a, b = b%a, a
    P[i+1]=b

print(P[-1])

Measured memory_bytes: 14248
///Bismillahir Rahmanir Rahim
#include<bits/stdc++.h>

#define                           int                         long long
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<int,int>
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);




using namespace std;

const int inf=1e18;
const int mod=1e9+7;
const int M=100009;
inline int bigmod(int B,int P){int R=1;while(P>0){if(P&1){R=(R*B)%mod;}P>>=1;B=(B*B)%mod;}return R;}

vector<int>adj[M+4];
int n,m,q;
int qv[M+4],qd[M+3],qc[M+4];
int dp[M+4][12];
void magic(int pos,int d,int c)
{
    if(dp[pos][d])return ;
    dp[pos][d]=c;
    if(d>0)
    {
        magic(pos,d-1,c);
        for(auto v:adj[pos])
        {
            magic(v,d-1,c);
        }
    }
}
 main()

{
    fast
    cin>>n>>m;
    f(i,1,m)
    {
        int u,v;
        cin>>u>>v;
        adj[u].pb(v);
        adj[v].pb(u);
    }
    cin>>q;
    f(i,1,q)
    {
        int v,d,c;
        cin>>qv[i]>>qd[i]>>qc[i];
    }
    rf(i,q,1)
    {
        magic(qv[i],qd[i],qc[i]);
    }
    f(i,1,n)
    {
        cout<<dp[i][0]<<endl;
    }
















    return 0;

}













Measured memory_bytes: 18676
#include <bits/stdc++.h>
#define repp(i,l,r)for(long long i=(l);i<(r);i++)
#define rep(i,n) for (long long i = 0; i < (n); ++i)
#define per(i,n) for (long long i = (n); i >= 0; --i)
const int INF = 2147483647;//int max
const long long int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//ミョ(-ω- ?)
int main() {
    ll n;
    cin >> n;
    vector<ll> a(n,0);
    vector<ll> b(n,0);
    rep(i,n)cin >> a[i] >> b[i];
    ll res = 0;
    per(i,n-1){
        a[i] += res;
        if(b[i] == 1)continue;
        res +=  b[i]*( (a[i]+b[i]-1)/b[i] ) - a[i];
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 4796
#include <iostream>
#include <vector>
#define range(i, r) for(int i=0;i<r;i++)
using namespace std;

int main(int argc, char const *argv[]) {
  int N, count=0;
  std::cin >> N;
  std::vector<int> v(N);
  range(i, N) {
    std::cin >> v[i];
    if(v[i]%2==1) count++;
  }
  std::cout << (count%2==0?"YES":"NO") << '\n';
  return 0;
}


Measured memory_bytes: 640