akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<map>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<set>
#include<bitset>
#include<iomanip>
#define BUG puts("no bug")
#define sci(x) scanf("%d",&x)
#define scl(x) scanf("%lld",&x)
#define ll long long
#define ull unsigned long long
#define REP(a,b,c) for(ll a=b;a<=c;a++)
#define PER(a,b,c) for(ll a=b;a>=c;a--)
#define lb(a) (a&(-a))
#define pp (p<<1)
#define ppp (p<<1|1)
#define pi pair<ll,ll>
#define pii pair<pair<ll,ll>,ll>
using namespace std;
const double Pi=acos(-1.0);
const ll MAXN=1e6+5;
ll n,m,t;
ll v[MAXN];
ll last[MAXN];
int main(){
    cin>>n>>m;
    REP(i,1,n){
        cin>>v[i];
    }
    ll now=1;
    last[1]=1;
    REP(i,2,n){
        now=v[now];
        m--;
        if(m==0){
            cout<<now;
            return 0;
        }
        if(last[now]){
            ll xun=i-last[now];
            m%=xun;
            REP(i,1,m){
                now=v[now];
            }
            cout<<now;
            return 0;
        }
        last[now]=i;
    }
}

Measured memory_bytes: 6312
#include <stdio.h>

main()
{
	int a,b,c,d;
	scanf("%d %d %d %d", &a,&b,&c,&d);
	int e,f,g,h;
	scanf("%d %d %d %d", &e,&f,&g,&h);
	int S,T;
	S = a + b + c + d;
	T = e + f + g + h;
	if (S>T) printf("%d\n",S);
	else	 printf("%d\n",T);
}

Measured memory_bytes: 1020
def calc(N, M, A):
    if (N == 1):
        return A[0] // (2 ** M)
    A.sort(key=lambda a: -a)
    B = [A]
    for _ in range(M):
        i = 0
        m = B[0][0] if B[0] else -1
        for j in range(1, len(B)):
            if (B[j] and B[j][0] > m):
                i = j
                m = B[j][0]
        p = B[i].pop(0) // 2
        if (len(B) == i + 1):
            B += [[]]
        B[i + 1] += [p]
        if (not (B[0])):
            B.pop(0)
    return sum([sum(b) for b in B])


(N, M) = tuple([int(s) for s in input().split(' ')])
A = [int(s) for s in input().split()]
print(calc(N, M, A))

Measured memory_bytes: 14480
#include <bits/stdc++.h>
using namespace std;  
#define rep(i, a, b) for(ll i = a; i < b; i++)
#define Rep(i, a, b) for(ll i = a; i <= b; i++)
#define repr(i, a, b) for(ll i = b-1; i >= a; i--)
#define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define Vp vector<pair<ll, ll>>
using ll = long long;
#define ALL(v) (v).begin(),(v).end()
#define endl "\n"
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define co(x) cout << x << endl
#define coel cout << endl
#define pb push_back
#define sz(v) ((ll)(v).size())
const double pi = acos(-1.0);
const ll MOD = 1e9 + 7;
// const ll INF = 1LL << 60;
const ll INF = 100000000000;
#define pp pair<ll, pair<ll, ll>> 
#define fi first
#define se second
 
// rep(i, 0, sz(v)) cout << v[i] << " \n"[i==sz(v)-1];
 
////////////////////////////////////////////////////////
string s;
ll k;

ll dp[105][2][5]; // 桁数、未満フラグ、条件

int main() {
    cin >> s >> k;
    ll n = sz(s);

    dp[0][0][0] = 1;

    rep(i, 0, n){
        rep(sm, 0, 2){
            rep(j, 0, k+1){
                ll c_ = s[i] - '0'; // 現在見ている位の値
                rep(c, 0, 10){
                    if(sm) dp[i+1][1][(c==0) ? j : j+1] += dp[i][1][j]; // 未満
                    else{
                        if(c == c_) dp[i+1][0][(c==0) ? j : j+1] += dp[i][sm][j];
                        if(c == 0 && c < c_) dp[i+1][1][j] += dp[i][sm][j];
                        if(c != 0 && c < c_) dp[i+1][1][j+1] += dp[i][sm][j];
                    }
                }
            }
        }
    }

    // Rep(i, 1, n){
    //     rep(sm, 0, 2){
    //         rep(j, 0, k+1){
    //             printf("dp[%lld][%lld][%lld] = %lld, ", i, sm, j, dp[i][sm][j]);
    //         }
    //         coel;
    //     }
    //     coel;
    // }

    cout << dp[n][0][k] + dp[n][1][k] << endl;

    
    return 0;
}

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

using namespace std;

using ll = long long;

ll MOD = 1000000007;

vector<int> get_divisors(int n) {
    vector<int> d;
    for (int i = 1; i * i <= n; ++i) {
        d.push_back(i);
        if (i != n / i) d.push_back(n / i);
    }
    return d;
}

int main() {
    int n, k; cin >> n >> k;
    
    vector<int> divs = get_divisors(n);
    sort(divs.begin(), divs.end());
    int d = divs.size();
    
    int dp[d + 1][k + 1];
    for (int i = 0; i < d + 1; ++i) for (int j = 0; j < k + 1; ++j) dp[i][j] = 0;
    for (int i = 1; i < d; ++i) dp[i][1] = n / divs[i - 1] - n / divs[i];
    dp[d][1] = 1;
    
    for (int i = 2; i <= k; ++i) {
        ll sum = 0;
        for (int j = 1; j <= d; ++j) {
            sum = (ll)(sum + dp[d + 1 - j][i - 1]) % MOD;
            dp[j][i] = (dp[j][1] * sum) % MOD;
        }
    }
    
    int answer = 0;
    for (int i = 1; i <= d; ++i) answer = ((ll)answer + dp[i][k]) % MOD;
    cout << answer << endl;
    
    return 0;
}

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

int64_t gcd(int64_t a, int64_t b){
  int64_t buf;
  while(b > 0){
    buf= a;
    a= b;
    b= buf%b;
  }
  return a;
}
 
int64_t lcm(int64_t a, int64_t b){
  return a/gcd(a,b)* b;
}

int main() {
  int N;
  cin >> N;
  
  vector<int64_t> data(N);
  for(int i=0; i<N; i++){
    cin >> data.at(i);
  }

  int64_t ans= data.at(0);
  for(int i=1; i<N; i++){
    ans= lcm(ans, data.at(i));
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll  long long
#define isc ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define ld long double
#define ss string
#define ww while
#define vl vector<ll>
#define pb push_back
#define in insert
#define vec vector
#define itr iterator
#define gt goto
#define rep(i,n,j) for(ll i=n;i<j;i++)
#define pll pair<ll,ll>
#define bft bool f=true
#define bff bool f=false
using namespace std;


ll kmm(ll a, ll b) {
	return(a*b) / __gcd(a, b);
}

const ll mod = 1e9 + 7;
const ll MAXN = 1e5+5;
ll modpower(ll x,ll n)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)
        return modpower((x*x)%mod,n/2);
    else
        return (x*modpower((x*x)%mod,(n-1)/2))%mod;

}

ll facpower(ll x){
	if(x==0)
		return 1;
	return ((x%mod)*(facpower(x-1)%mod))%mod;
}



ll a,b;
int main() {
    cin >> a >> b;
    if(a!=3 && b!=3)
        cout << 3;
    else{
        if(a!=2 && b!=2)
            cout << 2;
        else
            cout << 1;
    }


	return 0;
}


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

int main(){
int n;
cin>>n;
int T=0,H=0;
for(int i=0;i<n;i++){
string t,h;
cin>>t>>h;

for(int g=0;g<t.size();g++){
if(t[g]>h[g]){T+=3; break;}
if(t[g]<h[g]){H+=3; break;}
if(g+1==t.size() && t[g+1]<h[g+1]){H+=3; break;}
if(g+1==t.size() && t[g]==h[g]){T+=1; H+=1;}
}}

cout<<T<<" "<<H<<endl;

return 0;
}


Measured memory_bytes: 3120
#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"

using namespace std;
using namespace __gnu_pbds;

#define ll long long int
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
int main(void)
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    map<string, int> m;
    m["SUN"] = 7;
    m["MON"] = 6;
    m["TUE"] = 5;
    m["WED"] = 4;
    m["THU"] = 3;
    m["FRI"] = 2;
    m["SAT"] = 1;
    string s;
    cin>>s;
    cout<<m[s]<<"\n";
}

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

int main(){
    char s[4];
    cin >> s;
    
    int a, b;
    a = (s[0] - '0') * 10 + (s[1] - '0');
    b = (s[2] - '0') * 10 + (s[3] - '0');
    if ( 1 <= a && a <= 12 && 1 <= b && b <= 12 ) cout << "AMBIGUOUS" << endl;
    else if (1 <= a && a <= 12 ) cout << "MMYY" << endl;
    else if (1 <= b && b <= 12 ) cout << "YYMM" << endl;
    else cout << "NA" << endl;
    return 0;
}

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

int main() {
    int k;
    cin >> k;
    string s;
    cin >> s;
    if(s.size() <= k)  cout << s << endl;
    else cout << s.substr(0,k) << "..." << endl;

    return 0;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  	long N, K, x;
 	int count;

  	cin >> N >> K;
  
  	count = 0;
  	while(N > 1) {
      	++count;
      	x = N % K;
 		N = N / K;
      	//cout << N << endl;
    }
  	if (N == 1) {
      ++count;
    }
  	cout << count << endl;
  	return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int t[] = new int[n];
    for(int i = 0 ; i < n ; ++i){
      t[i] = sc.nextInt();
    }
    int m = sc.nextInt();
    
    for(int i = 0 ; i < m ; ++i){
      int x[] = new int[n];
      for(int j = 0 ; j < n ; ++j){
        x[j] = t[j];
      }
      int p = sc.nextInt();
      x[p-1] = sc.nextInt();
      int ans = 0;
      for(int j = 0 ; j < n ; ++j){
        ans += x[j];
      }
      System.out.println(ans);
    }
    
    
  }
}

Measured memory_bytes: 36244
#include<bits/stdc++.h>
using namespace std;
 
#define int long long
#define pb push_back
#define ff first
#define ss second
 
int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    setprecision(20);
    
    long double a,b;
    cin>>a>>b;
    
    int ans=a*b;
    cout<<ans;
}

Measured memory_bytes: 3740
#include<stdio.h>
#include<string.h>
#include<iostream>
#include<algorithm>
using namespace std;

int main(void)
{
    int k,n,i;
    int array1[50];

    cin>>n>>k;
    for(i = 0;i<n;i++)
        cin>>array1[i];

    sort(array1,array1+n);

    int sum = 0;

    for(i = n-1;i>=n-k;i--)
        sum += array1[i];

        cout<<sum<<endl;


    return 0;
}





Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <map>
int main() {
    #ifndef LOCAL_STJO
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    #endif
    int n;
    std::cin >> n;
    if(n > 999) std::cout << "ABD\n";
    else std::cout << "ABC\n";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> pii;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define vv(type, c, m, n, i) vector<vector<type>> c(m, vector<type>(n, i))
#define mat(type, c, m, n) vector<vector<type>> c(m, vector<type>(n));for(auto& r:c)for(auto& i:r)cin>>i;
#define rep(i,a,n) for(int i=(a), i##_len=(n); i<i##_len; ++i)
#define rrep(i,a,n) for(int i=(a), i##_len=(n); i>i##_len; --i)
#define each(x,y) for(auto &(x):(y))
#define var(type, ...)type __VA_ARGS__;Scan(__VA_ARGS__);
template<typename T> void Scan(T& t) { cin >> t; }
template<typename First, typename...Rest>void Scan(First& first, Rest&...rest) { cin >> first; Scan(rest...); }
#define vec(type, c, n) vector<type> c(n);for(auto& i:c) cin>>i;
#define len(x) ((int)(x).size())
#define mp make_pair
#define eb emplace_back
#define em emplace
#define pb pop_back
#define fi first
#define se second
#define get(a, i) get<i>(a)
#define bit_count __builtin_popcount
#define mt make_tuple
inline string zero(int a,string s,char c='0'){return string(a-len(s),c)+s;}
inline string zero(int a,int t,char c='0'){return zero(a, to_string(t), c);}
inline string zero(int a,ll t,char c='0'){return zero(a, to_string(t), c);}
#define mini min_element
#define maxi max_element
#define sum accumulate
#define chmax(a,b) if(a<b)a=b
#define chmin(a,b) if(a>b)a=b
template <class T> inline void print(T t){cout << t << '\n';}
template <class H, class... T> inline void print(H h, T... t){cout << h << " ";print(t...);}
int f(string i) {
	int ret = 0;
	each(a, i) {
		ret += a - '0';
	}
	return ret;
}
int solve() {
	var(string, n);
	if (n == "1" + string(len(n) - 1, '0')) {
		return 10;
	}
	return f(n);
}
int main() {
	print(solve());
	return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
// #define USE_LLONG_AS_INT
#ifdef USE_LLONG_AS_INT
#define int long long
#define inf (1ll<<60)
#else
#define inf (1<<30)
#endif
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;
const string sp=" ";

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

void run(){
    int n,m;
    cin>>n>>m;
    vi a(m),b(m);
    vvi c(m);
    rep(i,m){
        cin>>a[i]>>b[i];
        rep(j,b[i]){
            int t;
            cin>>t;
            t--;
            c[i].pb(t);
        }
    }
    vi dp(1<<n,inf);
    dp[0]=0;
    rep(i,m){
        int s=0;
        rep(j,b[i]){
            s|=1<<c[i][j];
        }
        rep(j,1<<n){
            dp[j|s]=min(dp[j|s],dp[j]+a[i]);
        }
    }
    cout<<(dp[(1<<n)-1]!=inf?dp[(1<<n)-1]:-1)<<endl;
}

Measured memory_bytes: 384
/**
 *    Creator :  bizarre
 *    Date : 4/2020
 *    Problem Number : 424
**/
#include <bits/stdc++.h>
using namespace std;
#define bizarre     ios_base::sync_with_stdio( false ), cin.tie( nullptr ), cout.tie( nullptr );
/*
vector<int> prime_Numbers;
int primes[1000005];
void prime(int n)
{
    primes[1]=primes[0]=0;
    for(int i=2; i<=n; i++)
        primes[i]=true;
    for(int i=2; i<=n; i++)
    {
        if(primes[i]==true)
        {
            prime_Numbers.push_back(i);
            for(int j=i+i; j<=n; j+=i)
                primes[j]=false;
        }
    }
    for(int i=2; i<=n; i++)
        primes[i]+=primes[i-1];
}

void move1step(long long& a, long long& b, long long q)
{
    long long c= a-q*b;
    a=b;
    b=c;
}
long long egcd(long long r0,long long r1,long long& x0,long long& y0)
{
    long long x1=0,y1=1;
    x0=1;
    y0=0;
    while(r1)
    {
        long long q=r0/r1;
        move1step(r0,r1,q);
        move1step(x0,x1,q);
        move1step(y0,y1,q);
    }
    return r0;
}
bool  solve (long long a, long long b, long long c,long long&x, long long& y)
{
    long long g=egcd(a,b,x,y);
    int m=c/g;
    x*=m;
    y*=m;
    return c%g==0;
}



int npr(long long n, long long r)
{
    return (fact[n] * inv[n - r]) % mod;
}

int gcd(int a, int b)
{
    if(b==0)
        return a;
    return gcd(b,a%b);
}
void PrimeFactorization(int n)
{
    for(int i=2; i*i<=n; i++)
    {
        int c=0;
        if(n%i==0)
        {
            while(n%i==0)
            {
                n/=i;
            }

        }
    }

}
const int inf = 2e9, mod = 1e9 + 7,N=1e5+5;
long long fact[N], inv[N];
long long fp(long long base, long long exp)
{
    if (exp == 0)
        return 1;
    long long ans = fp(base, exp / 2);
    ans = (ans * ans) % mod;
    if (exp % 2 != 0)
        ans = (ans * (base % mod)) % mod;
    return ans;
}
void pre(long long n)
{
    fact[0] = 1;
    inv[0] = 1;
    for (long long i = 1; i <= n; i++)
    {
        fact[i] = (i * fact[i - 1]) % mod;
        inv[i] = fp(fact[i], mod - 2);
    }
}
int ncr(long long n, long long r)
{
    return (((fact[n] * inv[n - r]) % mod) * inv[r]) % mod;
}
long long ncrtane(long long n, long long r)
{
    long long ans=1,cntr=1;
    for(int i=n;i>n-r;i--)
    {
        ans*=i;
        ans/=cntr;
        cntr++;
    }
    return ans;
}
*/
int main()
{
    bizarre
    long long n;
    cin>>n;
    long long a[n+2],dp[n+2];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        dp[i]=1000000000;
    }
    dp[n-1]=0;
    for(int i=n-1;i>=0;i--)
    {
        if(i-1>=0)
        {
            dp[i-1]=min(dp[i-1],dp[i]+abs(a[i]-a[i-1]));
        }
        if(i-2>=0)
        {
            dp[i-2]=min(dp[i-2],dp[i]+abs(a[i]-a[i-2]));
        }
    }
    cout << dp[0];
    return 0;
}


Measured memory_bytes: 1792
#include<cstdio>
#include<algorithm>
using namespace std;
long long n,s[200005];
long long ans;
int main(){
	scanf("%lld",&n);
	for (int i=0;i<n*2;i++)scanf("%lld",&s[i]);
	sort(s,s+n*2);
	for (long long i=0;i<n*2;i++)ans+=i*s[i];
	printf("%.10lf",ans/(double)(2*n-1));
	return 0;
}

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

using namespace std;
 
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

typedef int64_t ll; typedef vector<int> VI; typedef pair<int,int> pii;
const ll mod = 1e9+7;

void dbg(){ cerr << "\n"; }  
template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }



int main()
{
	
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int n;
	cin >> n;
	
	set<int> st;
	rep(i,n){
		int d;
		cin >>d;
		st.insert(d);
	
	}
	cout << sz(st) <<"\n";
	return 0;
}

Measured memory_bytes: 256
using System;

namespace abc054A
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split();
            int A = int.Parse(str[0]);
            int B = int.Parse(str[1]);
            if (A > B && B != 1)
                Console.WriteLine("Alice");
            else if (A < B && A != 1)
                Console.WriteLine("Bob");
            else if (A == B)
                Console.WriteLine("Draw");
            else if (A == 1)
                Console.WriteLine("Alice");
            else if (B == 1)
                Console.WriteLine("Bob");
            
            
        }
    }
}


Measured memory_bytes: 13140
#include<stdio.h>
int main(void){
  int x,y;

  scanf("%d",&x);
  y=(x%10);

  if(y==2||y==4||y==5||y==7||y==9){
    printf("hon\n");
  }else if(y==0||y==1||y==6||y==8){
    printf("pon\n");
  }else{
    printf("bon\n");
  }

  return 0;
}

Measured memory_bytes: 1660
#include <iostream>

using namespace std;
typedef long long ll;

int main(){
    ll w, a, b;
    cin >> w >> a >> b;
    if(a + w < b){
        cout << (b - a - w) << endl;
    }else if(b + w < a){
        cout << (a - b - w) << endl;
    }else{
        cout << 0 << endl;
    }
    return 0;
}


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

const int MOD = 1e9 + 7;
int dp[503][503] , pot[503] , stir[503][503] , jc[1003] , inv[1003] , N , X;
int upd(int x){return x + (x >> 31 & MOD);}

int poww(int a , int b){
	int times = 1;
	while(b){
		if(b & 1) times = 1ll * times * a % MOD;
		a = 1ll * a * a % MOD; b >>= 1;
	}
	return times;
}

int binom(int a , int b){return 1ll * jc[a] * inv[b] % MOD * inv[a - b] % MOD;}

int main(){
	cin >> N >> X; for(int i = 1 , x ; i <= N ; ++i){cin >> x; ++pot[x];}
	dp[0][0] = 1; jc[0] = 1;
	for(int i = 1 ; i <= 1000 ; ++i) jc[i] = 1ll * jc[i - 1] * i % MOD;
	inv[1000] = poww(jc[1000] , MOD - 2) % MOD;
	for(int i = 999 ; i >= 0 ; --i) inv[i] = inv[i + 1] * (i + 1ll) % MOD;
	for(int i = X ; i ; --i){
		for(int j = X ; j ; --j)
			for(int k = i ; k <= X ; ++k)
				for(int l = 1 ; l <= j && l * i <= k ; ++l)
					dp[j][k] = (dp[j][k] + 1ll * dp[j - l][k - l * i] * inv[l]) % MOD;
		if(pot[i])
			for(int j = 0 ; j <= X ; ++j)
				for(int k = 0 ; k <= X ; ++k)
					if(dp[j][k]) dp[j][k] = 1ll * dp[j][k] * poww(k - j * (i - 1) , pot[i]) % MOD;
	}
	int ans = 0;
	for(int j = 1 ; j <= X ; ++j)
		for(int k = 1 ; k <= X ; ++k)
			if(dp[j][k]){
				int sum = 0;
				for(int l = 0 ; l < j ; ++l)
					sum = (sum + (l & 1 ? -1ll : 1ll) * binom(j - 1 , l) * binom(X - k + j - l , X - k) % MOD + MOD) % MOD;
				sum = 1ll * sum * dp[j][k] % MOD * jc[j] % MOD;
				ans = (X - k) & 1 ? upd(ans - sum) : upd(ans + sum - MOD);
			}
	cout << ans; return 0;
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std ;
#define ll long long
#define rep(i,a) for(i = 0 ; i < a ; i++)
#define whln(t) while(t--)
#define whlp(t) while(t++)
#define ff first
#define ss second



int main(){
	#ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout); 
	#endif
	ll i,n,m;
	cin>>n>>m;
	ll H[n];
	ll flag[n] = {0};
	
	pair<ll,ll> p[m];
	rep(i,n)
		cin>>H[i];	
	rep(i,m)
		cin>>p[i].first>>p[i].second;

	rep(i,m){
		if(H[p[i].first-1]>H[p[i].second-1]){
			
			flag[p[i].second-1] = 1 ;
		}

		else if(H[p[i].first-1]<H[p[i].second-1]){
			flag[p[i].first-1] =1;
			
		}
		else {
			flag[p[i].first-1] =1;
			flag[p[i].second-1] = 1 ;
		}

	}


	/*
  rep(i,n){
		if(arr[i]!=0)
			flag[i]=1;
	}
    */
	ll sum =0 ;
	rep(i,n)
      	if(flag[i]==0)
		sum = sum+1;

	cout<<sum<<"\n";	

	







		
    //your code here
    return 0;
	
}

Measured memory_bytes: 6756
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define REP(i,n) for (ll i = 0; i < (n); ++i)
#define RREP(i, n) for (ll i = (n) - 1; i >= 0; --i)
#define ALL(v) (v).begin(), (v).end()
template<class T>
using reverse_priority_queue = priority_queue<T, vector<T>, greater<T>>;


ll binary_search(
    ll lo, ll hi, function<bool(ll)> is_ok,
    bool maximize
){
    while(lo < hi){
        if(maximize){
            const ll mid = (lo + hi + 1) / 2;
            if(is_ok(mid)){
                lo = mid;
            }else{
                hi = mid - 1;
            }
        }else{
            ll mid = (lo + hi - 1) / 2;
            if(is_ok(mid)){
                hi = mid;
            }else{
                lo = mid + 1;
            }
        }
    }
    return lo;
}


int main(){
    ll n, q;
    cin >> n >> q;
    string s;
    cin >> s;
    string t, d;
    REP(i, q){
        char ti, di;
        cin >> ti >> di;
        t.push_back(ti);
        d.push_back(di);
    }

    const auto simulate = [&](ll i) -> ll {
        REP(j, q){
            if(t.at(j) == s.at(i)){
                if(d.at(j) == 'L'){
                    i--;
                }else{
                    i++;
                }
            }
            if(i < 0){
                return -1;
            }else if(i >= n){
                return 1;
            }
        }
        return 0;
    };

    ll left = 0;
    if(simulate(0) == -1){
        left = 1 + ::binary_search(
            0, n - 1, [&](ll x) -> bool { return simulate(x) == -1; }, true);
    }

    // right
    ll right = n;
    if(simulate(n - 1) == 1){
        right = ::binary_search(
            0, n - 1, [&](ll x) -> bool { return simulate(x) == 1; }, false);
    }

    cout << right - left << endl;

    return 0;
}


Measured memory_bytes: 4044
//#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
typedef unsigned long long ullong;


long long cnt;	//О(n)を計算　オーダー、プログラムの計算量
int l;
int A[1000000];	//ソートする、入力される配列
int n;			//A に入力された要素の個数	
vector<int> G;	//動的配列オブジェクト, 間隔 g を格納する配列 


//間隔 g を指定した挿入ソート
void insertionSort(ullong A[], int n, int g){
	/*
	A[] = 走査する配列
	n = 配列の要素数
	g = 間隔
	*/
	for (int i = g; i < n; i++){	//右側の走査対象が基準
		/*
		i = 右側の走査対象
		j = 左側の走査対象
		*/
		int v = A[i];				//左側の走査対象を v に記憶
		int j = i - g;				//ループの回数を j に記憶
		while (j >= 0 && A[j]>v){	//左側の走査対象が右側の走査対象より大きい時
			A[j + g] = A[j];		//右側の走査対象に左側の走査対象を代入
			j -= g;					//まだ左側に移せるか? 
			cnt++;
		}//while
		A[j + g] = v;				//右側の走査対象に左側の走査対象を代入

	}//for

}//insertionSort

void shellSort(ullong A[], int n){
	//数列 G ={1,4,13,40,121,364,1093…}を生成
	for (int h = 1;;){
		if (h > n)
			break;
		G.push_back(h);	//動的配列に要素を追加 List の Add に近い
		h = 3 * h + 1;	//3n+1 の要素
	}//for
	//

	for (int i = G.size() - 1; i >= 0; i--){	//逆順にG[i]　=　g を指定
		insertionSort(A, n, G[i]);
		/*
		A = 走査する配列
		n = 配列の要素数
		G[i] = 捜査する間隔
		*/
	}//for
}//shellSort



ullong hoi(ullong *ngo){
	shellSort(ngo, 3);
	ullong n = 0;
	ullong nn = 18446744073709551615;
	for (int i = 0; i < 3; i++){
		if (ngo[i] % 2 == 1){
			n++;
			nn = i;
		}
	}
	if (n % 2 == 0)
		return 0;
	else{
		ullong sum = 1;
		for (int i = 0; i < 3; i++){
			if (nn != i)
				sum *= ngo[i];
		}
		return sum*((ngo[nn] / 2) + 1) - (sum*(ngo[nn] / 2));
	}
	
}

int main(){
	ullong wewewe[3];
	for (int i = 0; i < 3; i++){
		cin >> wewewe[i];
	}
	cout << hoi(wewewe) << endl;
}

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

long long N; string s;

int main(){
	cin>>N>>s; bool first=true; long long r=0,w=0;
	for(int i=0; i<N; i++){
		if(s[i]=='R'){
			r++;
		}else{
			w++;
		}
	}
	int total=0,change=0;
	for(int i=0; i<N; i++){
		if(total==r){
			break;
		}
		if(s[i]=='R'){
			total++;
		}else{
			change++; total++;
		}
	}
	cout<<change<<'\n';
}

Measured memory_bytes: 3744
import sys
import heapq

input=sys.stdin.readline

N,M=map(int,input().split())
job={i:[] for i in range(1,M+1)}
for i in range(0,N):
    a,b=map(int,input().split())
    if M>=a:
        job[a].append(b)

ans=0
ablejob=[]
heapq.heapify(ablejob)
for i in range(1,M+1):
    for j in job[i]:
        heapq.heappush(ablejob,-j)
    if ablejob:
        m=-heapq.heappop(ablejob)
        ans+=m

print(ans)


Measured memory_bytes: 71140
#include<bits/stdc++.h>
using namespace std;
int main(){
  string N;
  cin>>N;
  long long int s=0;
  for(int i=0;i<N.size();i++){
    s+= (N[i]-48);
  }
  if(s%9==0){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}

Measured memory_bytes: 3748
#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define lli long long int
#define ulli unsigned long long int
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define pf pop_front()
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define loopl(i,a,b) for(lli i=a;i<b;i++) 
#define loop(i,a,b) for(int i=a;i<b;i++)
#define mod 1000000007
#define inf 100000000000000000
#define lld long double
#define pll pair<long long int,long long int>
#define vll vector<lli>
#define eps 0.000001
#define endl '\n'
#define mo 998244353
 
using namespace std ;

const lli MAXN = 100005 ;

typedef tree<lli,null_type,less<lli>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;

bool cmp(pair<pair<string,lli>,lli> p1 , pair<pair<string,lli>,lli> p2)
{
    if(p1.ff.ff < p2.ff.ff)
        return true;

    else if(p1.ff.ff > p2.ff.ff)
        return false;

    else
    {
        if(p1.ff.ss > p2.ff.ss) return true;
        else return false;
    }
}

int main()
{  
 
//////////////////////////////////////////////
    fastio;

    lli n,m;
    cin>>n>>m;

    vll v[m+1] , v2[n];

    lli p[m+1];

    loopl(i,1,m+1)
    {
        lli k;
        cin>>k;
        loopl(j,0,k)
        {
            lli x;
            cin>>x;
            x--;
            v[i].pb(x);
            v2[x].pb(i);
        }

        sort(v[i].begin(),v[i].end());

    }
    loopl(i,0,n) sort(v2[i].begin(),v2[i].end());

    loopl(i,1,m+1) cin>>p[i];

    lli cnt=0;
    for(lli i=0;i<=(lli)pow(2,n)-1;i++)
    {
        lli bb[m+1]={0};

        loopl(j,0,n)
        {
            if(i&(1<<j))
            {
                for(auto x:v2[j])
                    bb[x] += 1;
            }
        }
        lli cnt2=0;
        loopl(i,1,m+1)
        {
            if(bb[i]%2 == p[i]) cnt2++;
        }

        if(cnt2 == m) cnt++;
    }

    cout<<cnt<<endl;

}

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

#define ll long long
#define lp(i,n) for(int i=0; i<n; i++)
#define pb push_back
const long double pi=3.141592654;
#define OSOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;

const ll inf = 1e9 +5, mod = 1e9+7,N = 1e5+5;


int main()
{
	OSOS
	int n;
	cin>>n;
	int arr[N][3];
	for(int i=0; i<n; i++)
		for(int ii= 0; ii<3; ii++)
		{
			cin>>arr[i][ii];
		}


		for(int i=1; i<n; i++)
		{
			for(int ii= 0; ii<3; ii++)
			{
				int maxx = 0;
				for(int iii=0; iii<3; iii++)
				{
					if(iii != ii)
					{
						maxx = max(arr[i-1][iii], maxx);
					}
				}
				arr[i][ii] += maxx;
			}
		}
		cout<<max(arr[n-1][0],max(arr[n-1][1],arr[n-1][2]));
}



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

ll dp[100001];

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

    vector<ll> h(N);
    rep(i, N) cin >> h[i];

    // 初期化
    fill(dp, dp+N, 1e10);

    dp[0] = 0;
    dp[1] = abs(h[0] - h[1]);
    for (int i=2; i<N; ++i)
    {
        dp[i] = min(dp[i-1] + abs(h[i-1] - h[i]), dp[i-2] + abs(h[i-2] - h[i]));
    }

    cout << dp[N-1] << endl;

    return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int gdc (int m, int n)
{
    if(n==0)
    {
        return m;
    }
    return gdc(n,m%n);
}
int main()
{
  ios_base::sync_with_stdio(false);
  int n;
  cin>>n;
  int a,b,c,i,j,k;
  long long s=0;
  for(i=1;i<=n;i++)
  {
      for(j=1;j<=n;j++)
      {
          for(k=1;k<=n;k++)
          {
              a=gdc(i,j);
              b=gdc(k,a);
              s=s+b;
          }
      }
  }
  cout<<s<<endl;
return 0;
}

Measured memory_bytes: 3640
S = input()
n = len(S)
if S[::-1] == S and S[:(n - 1) // 2][::-1] == S[:(n - 1) // 2] and S[((n + 3) // 2) - 1:][::-1] == S[((n + 3) // 2) - 1:]:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3060
#include<iostream>
#include<set>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<queue>
using namespace std;

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

typedef long long ll;
typedef unsigned long long int ulli;

const ll INF = ll(1e18) + 1;

typedef struct {
	ll cost;
	ll damage;
}magic;

unsigned long long int a(ulli n, ulli b) {
	if (b <= 1) {
		return n;
	}
	else {
		return a(n * 2, b - 1);
	}
}

ll mina(ll a, ll b) {
	return (a > b) ? b : a;
}

void Main()
{
	ll n, ans = 0, min = INF;
	cin >> n;
	rep(i, n) {
		int x; cin >> x;
		if (min >= x) {
			ans++;
			min = x;
		}
	}
	cout << ans << endl;
}

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

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

int main() {
    int n; string s; cin >> n >> s;
    int r = 0, b = 0;
    for(int i = 0; i < n; ++i) {
        r += s[i] == 'R';
        b += s[i] == 'B';
    }
    cout << (r > b ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <sstream>
#include <cmath>
#include <math.h>
#include <string>
using namespace std;
typedef long long ll;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a , b , c;
    cin >> a >> b >> c;
    int d = a;
    for ( int i = 1 ; i <= b ; i++ ) {
        if ( d % b == c ) {
            cout << "YES" << endl;
            return 0;
        } else d += a;
    }
    cout << "NO" << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#define min(x, y) ((x)<(y) ? (x) : (y))
int main(){
  int n;  scanf("%d", &n);
	int ans = 1e9;
  while(n--){
    int a;  scanf("%d", &a);
    int count = 0;
    while(a % 2 == 0){
      count++;
      a /= 2;
    }
    ans = min(ans, count);
  }
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 1680
//
//  main.c
//  ITP1_11_A
//
//  Created by k16031kk on 2018/05/30.
//  Copyright © 2018年 AIT. All rights reserved.
//

#include <stdio.h>
#include <string.h>

int main(int argc, const char * argv[]) {
    // insert code here...
    int top[6];
    for(int i=0; i<6; i++) {
        scanf("%d", &top[i]);
    }
    char direction[1000];
    
    scanf("%s", direction);
    for(int i=0; i<strlen(direction); i++) {
        int a=0;
        if(direction[i]=='E') {//0=3,3=5,5=2,2=0
            a=top[0];
            top[0]=top[3];
            top[3]=top[5];
            top[5]=top[2];
            top[2]=a;
        }
        else if(direction[i]=='W') {//2=0,3=5,5=2,0=3
            a=top[0];
            top[0]=top[2];
            top[2]=top[5];
            top[5]=top[3];
            top[3]=a;
        }
        else if(direction[i]=='N') {//1=0,4=5,5=1,0=4
            a=top[0];
            top[0]=top[1];
            top[1]=top[5];
            top[5]=top[4];
            top[4]=a;
        }
        else if(direction[i]=='S') {//4=0,1=5,5=4,0=1
            a=top[0];
            top[0]=top[4];
            top[4]=top[5];
            top[5]=top[1];
            top[1]=a;
        }
    }
    printf("%d\n",top[0]);
    return 0;
}



Measured memory_bytes: 2100
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.end())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define int long long
#define INF 1000000000000000000
using namespace std;

typedef vector<int> vec;
typedef vector<vec> mat;
typedef pair<int, int> Pii;

#define ANS(f) if(f) cout << "YES" << endl; else cout << "NO" << endl;

template<typename T>
void readv(vector<T> &a){ REP(i, a.size()) cin >> a[i]; }
void readi(vector<int> &a){ REP(i, a.size()){cin >> a[i]; a[i]--;} }



signed main(){

    int N, D; cin >> N >> D;
    vec x(N), y(N);
    REP(i, N) cin >> x[i] >> y[i];


    mat m(D, vec(D, 0));
    REP(i, N) m[x[i] % D][y[i] % D]++;
    int M = -1;
    REP(i, D) REP(j, D) M = max(M, m[i][j]);
    int A = 0;
    while(A * A < M) A++;
    //cout << A << endl;

    int r1 = -1, r2 = D - 1;
    while(r2 - r1 > 1){
        int r = (r1 + r2 + 1) / 2;
        mat cnt(2 * D, vec(2 * D, 0));

        REP(i, D){
            REP(j, D){
                if(m[i][j] <= (A - 1) * (A - 1)){
                    cnt[i][j]++;
                    cnt[i + D][j]--;
                    cnt[i][j + D]--;
                    cnt[i + D][j + D]++;
                }else if(m[i][j] <= A * (A - 1)){
                    //cnt[i][j]++;
                    cnt[i + D][j]--;
                    cnt[i][j + D]--;
                    cnt[i + D][j + D]++;
                    //cnt[i][j]--;
                    cnt[i + D - 1 - r][j]++;
                    cnt[i][j + D - 1 - r]++;
                    cnt[i + D - 1 - r][j + D - 1 - r]--;
                }else{
                    cnt[i - r + D - 1][j - r + D - 1]++;
                    cnt[i + D][j - r + D - 1]--;
                    cnt[i - r + D - 1][j + D]--;
                    cnt[i + D][j + D]++;
                }
            }
        }

        REP(i, 2 * D) FOR(j, 1, 2 * D) cnt[i][j] += cnt[i][j - 1];
        REP(j, 2 * D) FOR(i, 1, 2 * D) cnt[i][j] += cnt[i - 1][j];

        bool f = false;
        REP(i, D){
            REP(j, D){
                if(cnt[i][j] + cnt[i][j + D] + cnt[i + D][j] + cnt[i + D][j + D] == D * D) f = true;
            }
        }
        if(f) r2 = r;
        else r1 = r;
    }

    cout << D * (A - 1) + r2;
    
    return 0;
}


Measured memory_bytes: 41072
#include<cstdio>
#include<algorithm>
typedef long long ll;
using namespace std;
struct Z{
	ll x,h;
	int operator<(const Z&a)const{
		return x<a.x;
	}
}A[200001];
int i,j,n,d,a;
ll r,t,f[200001];
void add(int i,ll x){for(;i;i-=i&-i)f[i]+=x;}
ll val(int i){ll r=0;for(;i<=n;i+=i&-i)r+=f[i];return r;}
int main()
{
	scanf("%d%d%d",&n,&d,&a);
	for(;++i<=n;A[i].h=A[i].h/a+(A[i].h%a>0))scanf("%lld%lld",&A[i].x,&A[i].h);
	sort(A+1,A+n+1);
	for(i=1;i<=n;++i)if((t=A[i].h-val(i))>0)
	{
		j=upper_bound(A+1,A+n+1,(Z){A[i].x+d+d,0})-A-1;
		r+=t,add(j,t);
	}
	printf("%lld",r);
}

Measured memory_bytes: 4864
#include <iostream>
#include <vector>
#include <string>
#include <queue>

using namespace std;

int main(){
    int N, M;
    while(cin >> N >> M){
        string s; cin >> s;
        vector<vector<int>> g(N);
        vector<vector<int>> degree(N, vector<int>(2, 0));
        for(int i=0;i<M;i++){
            int a, b; cin >> a >> b;
            --a; --b;
            g[a].push_back(b);
            g[b].push_back(a);
            ++degree[a][s[b]-'A'];
            ++degree[b][s[a]-'A'];
        }
        int rest = N;
        vector<int> valid(N, 1);
        queue<int> qu;
        for(int i=0;i<N;i++){
            if(!degree[i][0] || !degree[i][1]){
                qu.push(i);
                valid[i] = 0;
                --rest;
            }
        }
        while(!qu.empty()){
            int p = qu.front(); qu.pop();
            for(auto next : g[p]){
                if(!valid[next]) continue;
                --degree[next][s[p]-'A'];
                if(!degree[next][s[p]-'A']){
                    qu.push(next);
                    valid[next] = 0;
                    --rest;
                }
            }
        }
        cout << (rest ? "Yes" : "No") << endl;
    }
}

Measured memory_bytes: 21892
N = int(input())
A = [0]*N
B = [0]*N
for i in range(N):
    A[i], B[i] = map(int, input().split())
    
rA = A[::-1]
rB = B[::-1]
cnt = 0
for i in range(N):
    rA[i] += cnt
    if(rA[i]%rB[i] != 0):
        cnt += rB[i]-(rA[i]%rB[i])

print(cnt)

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

using namespace std;

#define int long long
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define fr(i,j,k) for(i = j; i < (k); i++)
#define all(x) x.begin(), x.end()
#define el '\n'
#define remax(a,b) a = max(a, b)
#define remin(a,b) a = min(a, b)
#define sz(x) int32_t(x.size())

typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpi;
// --------------------------------------------------------------------

const pii dxy[] = { {-1, 0}, {1, 0}, {0, 1}, {0, -1} };
const int mod = 1e9 + 7;
const int inf = 2e18;
const ld eps = 1e-9;
const int NN = 1e5 + 2;


void solve() {
      int i = 0, j = 0, k = 0, n = 0, m = 0; 
      cin >> k;
      fr(i, 1, k+1) {
            if(i%3 == 0 || i%5 == 0) {

            } else 
                  n += i;
      }
      cout << n << el;
}

int32_t main() {
      ios::sync_with_stdio(false); cin.tie(0); 
      int T = 1; 
      // cin >> T;
      for(int tc = 1; tc <= T; tc++) {
            solve();
       }

      return 0;
}

Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const static ll INF = 1e9;
const static ll MOD = 1e9+7;



int main(){
    int N, M; cin >> N >> M;
    if(abs(N-M) >= 2) { cout << 0 << endl; return 0;}
    ll large = max(N, M);
    ll small = min(N, M);

    ll PM[large+5];
    PM[0] = PM[1] = 1;
    for(int i = 2; i <= large; i++) PM[i] = (PM[i-1]*i)%MOD;
    if(large != small){
        cout << (PM[large] * PM[small])% MOD << endl;
        return 0;
    }
    else {
        cout << (((PM[N] * PM[M]) % MOD) * 2) % MOD << endl;
        return 0;
    }
}

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

int main() {

  char c;
  cin >> c;

  if (c == 'a'
      || c == 'e'
      || c == 'i'
      || c == 'o'
      || c == 'u' )
    cout << "vowel" << endl;
  else
    cout << "consonant" << endl;
}


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

using namespace std;

using ll = long long;  

int main(){
  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  cout.setf(ios::fixed); cout.precision(17);
  int n, k;
  cin >> n >> k;
  ll x = n / k;
  ll ans = x * x * x;
  if((~k & 1) && n >= k/2){
    x = (n - k/2)/k + 1;
    ans += x * x * x;
  }
  cout << ans << "\n";
  return 0;
}

Measured memory_bytes: 256
/**
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡀⠀⠀⠀⠀⢀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⡖⠁⠀⠀⠀⠀⠀⠀⠈⢲⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⣼⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⣧⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⣸⣿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⣿⣇⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⣿⣿⡇⠀⢀⣀⣤⣤⣤⣤⣀⡀⠀⢸⣿⣿⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⢻⣿⣿⣔⢿⡿⠟⠛⠛⠻⢿⡿⣢⣿⣿⡟⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣀⣤⣶⣾⣿⣿⣿⣷⣤⣀⡀⢀⣀⣤⣾⣿⣿⣿⣷⣶⣤⡀⠀⠀⠀⠀
⠀⠀⢠⣾⣿⡿⠿⠿⠿⣿⣿⣿⣿⡿⠏⠻⢿⣿⣿⣿⣿⠿⠿⠿⢿⣿⣷⡀⠀⠀
⠀⢠⡿⠋⠁⠀⠀⢸⣿⡇⠉⠻⣿⠇⠀⠀⠸⣿⡿⠋⢰⣿⡇⠀⠀⠈⠙⢿⡄⠀
⠀⡿⠁⠀⠀⠀⠀⠘⣿⣷⡀⠀⠰⣿⣶⣶⣿⡎⠀⢀⣾⣿⠇⠀⠀⠀⠀⠈⢿⠀
⠀⡇⠀⠀⠀⠀⠀⠀⠹⣿⣷⣄⠀⣿⣿⣿⣿⠀⣠⣾⣿⠏⠀⠀⠀⠀⠀⠀⢸⠀
⠀⠁⠀⠀⠀⠀⠀⠀⠀⠈⠻⢿⢇⣿⣿⣿⣿⡸⣿⠟⠁⠀⠀⠀⠀⠀⠀⠀⠈⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣼⣿⣿⣿⣿⣧⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠐⢤⣀⣀⢀⣀⣠⣴⣿⣿⠿⠋⠙⠿⣿⣿⣦⣄⣀⠀⠀⣀⡠⠂⠀⠀⠀
⠀⠀⠀⠀⠀⠈⠉⠛⠛⠛⠛⠉⠀⠀⠀⠀⠀⠈⠉⠛⠛⠛⠛⠋⠁⠀⠀
 *    author:  Daredevil666
 *    institution: IIT Patna
**/
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define nl cout<<"\n";
#define ll long long int
#define REP(i,a,n) for(i=a;i<=n;i++)
#define F(i,a,b) for(i=a;i<b;i++)
#define RF(i,b,a) for(i=b;i>=a;i--)
#define IOS  ios::sync_with_stdio(false);cin.tie(0);
using namespace std;
const ll mod=1e16;
const ll MAXN=1000200;
ll i,j,mask,test;
int main()
{
IOS
/*#ifndef ONLINE_JUDGE
   freopen("input.txt","r",stdin);
   freopen("output.txt","w",stdout);
#endif // ONLINE_JUDGE*/
ll x;
cin>>x;
if(x==1)
{
    cout<<0;
}
else
    cout<<1;
return 0;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define ll long long
#define vi vector<int>
#define pii pair<int,int>
#define F first
#define S second
#define pb push_back
#define forn(b) for(int i = 0; i < b; i++)
#define rforn(b) for(int i = b - 1 ;i >= 0; i--)
#define It(m) for(auto it = m.begin(); it != m.end(); it++)
#define N 500500
#define PI 3.14159265358979323846264338327950L
#define speed ios_base :: sync_with_stdio(0);cin.tie(0);cout.tie(0);
    
const ll mod = (ll)1e9 + 7;
    
int main(){
    speed;
    vector<int> v(5);
    int k = 0;
    for(int i = 0; i < 5; i++) {
        int x; cin >> x;
        if(x == 0) k = i + 1;
    }   
    cout << k;
    return 0;
}

Measured memory_bytes: 3648
#include<iostream>
using namespace std;
int main(){
	int n,i,x=1;
	string s;
	cin >> n >> s;
	for(i=1;i<s.size();i++){
		if(s[i]!=s[i-1]){
			x++;
		}
	}
	cout << x << endl;
	return 0;
}

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

int main(){
  int a,b,c;cin >> a >> b >> c;
  if(b/a >= c)cout << c << endl;
  else cout << b/a << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
const int MAXN = 5005;
const int mod = 1e9 + 7;

map<int, int> mp;

int main(){
	int n;
	scanf("%d",&n);
	for(int i=0; i<n; i++){
		int x;
		scanf("%d",&x);
		mp[x]++;
	}
	int ans = 0;
	for(auto &i : mp){
		if(i.second >= i.first) ans += i.first;
	}
	printf("%d\n", n-ans);
}


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

#define NMAX 1000006
#define min(a, b) (a < b ? a : b)
#define abs(a) (a < 0 : (-a) : (a))

using namespace std;

unsigned int n, k;
int a[NMAX];

int main() {
    cin >> k >> n;
    for (int i = 0; i < n; ++i)
        cin >> a[i];

    int dist = min(a[n - 1] - a[0], k - a[1] + a[0]);
    for (int i = 1; i < n - 1; ++i) {
        int v1 = k - a[i] + a[i - 1];
        int v2 = a[i] + (k - a[i + 1]);
        dist = min(dist, v1);
        dist = min(dist, v2);
    }
    int v1 = k - a[n - 1] + a[n - 2];
    dist = min(dist, v1);
    cout << dist << "\n";
    return 0;
}


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

int main(){
  int n, m;
  map<string, int> s, t;
  cin >> n;
  for(int i = 0; i < n; ++i){
    string tmp_s;
    cin >> tmp_s;
    if(!s.count(tmp_s))s[tmp_s] = 1;
    else ++s[tmp_s];
  }
  cin >> m;
  for(int i = 0; i < m; ++i){
    string tmp_t;
    cin >> tmp_t;
    if(!t.count(tmp_t))t[tmp_t] = 1;
    else ++t[tmp_t];
  }

  int ans = 0;
  for(auto x : s){ 
    int point = x.second - t[x.first];
    ans = max(ans, point);
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
int n, m, i, j, k, a, b, c=1001;
int main(){
	scanf("%d%d", &n, &m);
	for(i=1; i<=n; i++){
		scanf("%d%d", &a, &b);
		if(b <= m && a < c) c = a;
	}
	if(c <= 1000) printf("%d\n", c);
	else printf("TLE\n");
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+20;
ll f[N],g[N],n,x,y,z;
struct node{
	ll a,b,c;
}a[N];
bool cmp(node a,node b)
{
	return a.a-a.b<b.a-b.b;
}

multiset<ll> s;
int main()
{
	while(cin>>x>>y>>z)
	{
		ll res=0;
		n=x+y+z;
		s.clear();
		for(int i=1;i<=n;i++)
		{
			scanf("%lld%lld%lld",&a[i].a,&a[i].b,&a[i].c);
			res+=a[i].c;
			a[i].a-=a[i].c,a[i].b-=a[i].c,a[i].c=0;
		}
		sort(a+1,a+1+n,cmp);
		ll sum=0;
		for(int i=1;i<=n;i++)
		{
			sum+=a[i].b;
			s.insert(a[i].b);
			if(s.size()>y)
			{
				sum-=*s.begin();
				s.erase(s.begin());
			}
			f[i]=sum;
		}
		s.clear(),sum=0;
		for(int i=n;i>=1;i--)
		{
			sum+=a[i].a;
			s.insert(a[i].a);
			if(s.size()>x)
			{
				sum-=*s.begin();
				s.erase(s.begin());
			}
			g[i]=sum;
		}
		ll ans=0;
		for(int i=y;i<=n-x;i++)
			ans=max(ans,res+f[i]+g[i+1]);
		cout<<ans<<endl;	
	}
	return 0;
}


Measured memory_bytes: 11520
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define fo(i,n) for(ll i=0;i<n;i++)
#define fok(i,k,n) for(ll i=k;i<n;i++)
#define ci(x) cin>>x
#define ci2(x,y) cin>>x>>y
#define co(x) cout<<x<<"\n"
#define co2(x,y) cout<<x<<" "<<y<<"\n"
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define PI 3.1415926535897932384626
#define deb1(x) cout<<#x<<" "<<x<<endl
#define deb2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<"\n"
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pll;
typedef vector<int>		vi;
typedef vector<ll>		vl;
typedef vector<pii>		vpii;
typedef vector<pll>		vpll;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;
const int mod = 1000000007;	
constexpr ll INF = static_cast<ll>(1e18);

ll nc2(ll n){
	return (n*(n-1)/2);
}
int A[200001];
int t[200001];

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n;
	ci(n);
	memset(t,0,sizeof(t));
	fo(i,n){
		ll a;
		ci(a);
		A[i]=a;
		t[a]++;
	}
	ll total=0;
	fo(i,200001){
		if(t[i]>1){
			total+=(nc2(t[i]));
		}
	}
	fo(i,n){
		if(t[A[i]]==1){
			co(total);
		}
		else{
			co((total-(t[A[i]]-1)));
		}
	}
}


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


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

#define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define I insert
#define endl '\n'
#define all(x) x.begin(), x.end()

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;


using vvll = vector< vector<ll> >;
using vll = vector<ll> ;

const ll maxs = 1e6+5;
const ll lmaxs = 20;
ll mod = 1e9+7;
ll oo = 1e15;

ll fast(ll x,ll y){
    ll res=1;
    while(y){
        if(y&1)
            res = (res*x)%mod;
        x = (x*x)%mod;
        y >>= 1;
    }
    return res;
}

ll inv(ll n){
    return fast(n,mod-2);
}


void pre(){


}


void solve(){

    string s ,t;
    cin >> s >> t;
    ll ans=0;
    for(int i=0;i<s.size();i++)
        if(s[i]!=t[i])
            ans++;
    cout << ans << endl;

}

int main(){
    // #ifndef ONLINE_JUDGE
    // freopen("input00.txt","r",stdin);
    // #endif
    IOS;
    pre();
    ll T = 1;
    //cin>>T;
    while(T--){
        solve();   
    }
    return 0;
}

Measured memory_bytes: 3812
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int v[200200];
bitset<200200> bs;
int main() {
	int n;
	scanf("%d ",&n);
	for(int i=0;i<n;i++) {
		int t;
		scanf("%d ",&t);
		v[i] = t;
	}
	sort(v,v+n);
	for(int i=30;i>=0;i--) {
		int tot = 1<<i;
		int s = 0,e = n;
		while(s<e) {
			e--;
			if(bs[e]) continue;
			while(s < n && (v[s]+v[e]<tot || bs[s])) {s++;}
			if(s >= e) break;
			if(v[s]+v[e] == tot && !(bs[e] || bs[s])) {bs.set(e);bs.set(s);
			//printf("match %d %d\n",s,e);
			}
		}
	}
	printf("%d\n",bs.count()/2);
}


Measured memory_bytes: 1148