akhauriyash/Code-Regression huggingface dataset:
#pragma region
#include <bits/stdc++.h>
using namespace std;
inline void ci(void){
  return;
}
template <typename First, typename... Rest>
void ci(First& first, Rest&... rest){
  cin >> first;
  ci(rest...);
  return;
}
inline void co(void){
  cout << endl;
  return;
}
template <typename First, typename... Rest>
void co(First first, Rest... rest){
  cout << first << "";
  co(rest...);
  return;
}
#define ll long long
#define ld long double
#define st string
#define wh while
#define ve vector
#define mp make_pair
#define tp tuple
#define mt make_tuple
#define pb push_back
#define pof pop_front
#define pob pop_back
#define pf push_front
#define fr front
#define ft first
#define sc second
#define tos to_string
#define len length
#define rt return
#define br break
#define con continue
#define lcm(n, m) (n * m / __gcd(n, m))
#define np next_permutation
#define repi(i, m, n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i, n) repi(i, 0, n)
#define revi(i, m, n) for(int i=(int)(m) - 1;i>=(int)(n);i--)
#define rev(i, m) revi(i, m, 0)
#define sz(v) ((int)(v).size()) 
#define each(i, n) for(auto&& i: n)
#define all(n) n.begin(), n.end()
#define allr(n) n.rbegin(), n.rend()
#define sp(n) cout << fixed << setprecision(n)
#define pi 3.14159265358979323846
#define inf 1000000007
#pragma endregion
// sqrt ルート, int 2*10^9, gcd　最大公約数
// __builtin_popcount bitの個数

ve<int> dx = {0, 0, 1, -1}, dy = {1, -1, 0, 0};

int main() {
  int n, a, b;
  ci(n, a, b);
  (a - b) % 2 == 0 ? co("Alice") : co("Borys");
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <climits>

using namespace std;


int main()
{
    int n;
    int p[101];
    int m[101][101];

    cin >> n;

    for (int i = 0; i <= n; i++)
        for (int j = 0; j <= n; j++)
            m[i][j] = 0;

    for (int i = 0; i < n; i++)
        cin >> p[i] >> p[i + 1];

    for (int len = 1; (n - 1) - len >= 0; len++) {
        for (int i = 0; i <= (n - 1) - len; i++) {
            m[i][i + len] = INT_MAX / 3;
            for (int j = i; j < i + len; j++) {
                m[i][i + len] = min(m[i][i + len], m[i][j] + m[j + 1][i + len] + p[i] * p[j + 1] * p[i + len + 1]);
            }
        }
    }

    cout << m[0][n - 1] << endl;

    return 0;
}


Measured memory_bytes: 3112
#include <bits/stdc++.h>
using namespace std;
 
#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
 
#define MAXX 100005
 
#define PI   3.14159265358979323846264338327950

#define PB push_back 
#define F first
#define S second
 
#define ll 	 long long int

#define mod  1000000007


map<string, int> m;

int main()
{
	FAST;
	ll n;
	cin >> n;
	ll ans = 0;
	for(ll i = 0; i < n; i ++){
		string s;
		cin >> s;
		if(m[s] == 0){
			m[s] = 1;
			ans ++;
		}
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 19204
#define _USE_MATH_DEFINES
#include <iostream>
#include <vector>
#include <algorithm>
#include <random>
#include <string>
#include <cstring>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <ctime>
#include <cmath>
#include <iomanip>
#include <queue>
#include <deque>
#include <fstream>
#include <bitset>
using namespace std;

#define int long long
#define double long double
#define mp make_pair
#define all(a) a.begin(), a.end()
#define pb push_back
#define debug(x) cout << #x << ": " << x << '\n';
#define fi first
#define se second
#define FOR(i, n) for (int i = 0; i < n; ++i)
//typedef long long ll;
typedef pair<int, int> pii;

template<typename T1, typename T2> inline bool chkmin(T1 &x, T2 y) { return y < x ? (x = y, true) : false; };
template<typename T1, typename T2> inline bool chkmax(T1 &x, T2 y) { return y > x ? (x = y, true) : false; };

void fast() {
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
}

const int N = 60;
int a[N];

signed main() {
	fast();
	int n;
	cin >> n;
	int res = 0;
	char p = 'A';
	for (int i = 0; i < n; i++) {
		char c;
		cin >> c;
		if (c == p) continue;
		p = c;
		res++;
	}
	cout << res;
	return 0;
}

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

int main() {
  unsigned N;
  std::cin >> N;
  std::vector<int> H(N);
  for (unsigned i = 0; i < N; ++i) { std::cin >> H[i]; }
  int cur_max = 0;
  int ans = 0;
  for (unsigned i = 0; i < N; ++i) {
    if (cur_max <= H[i]) { ++ans; }
    cur_max = std::max(cur_max, H[i]);
  }
  std::cout << ans << std::endl;
  return 0;
}

Measured memory_bytes: 1016
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,j,n) for(int i = j; i < n; i++)
#define rrep(i,j,n) for(int i = j-1; i >= n; i--)
#define prec(n) fixed << setprecision(n)
#define print_array(v) rep(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define fi first
#define se second
#define endl "\n"
using namespace std;

constexpr int inf = 2147483647;
constexpr int64_t inf64 = 9223372036854775807;
constexpr int mod = 1e9+7;

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

  int a, b;
  cin >> a >> b;
  cout << a*b << endl;
  return 0;
}

Measured memory_bytes: 3648
#include <stdio.h>

int prime[999999];

int main() {
  int i, k, n, N = 0;
  for(i = 2; i <= 999999; i++) {
    prime[i] = 1;
  }
  for(i = 2; i*i <= 999999; i++) {
    if(prime[i]) {
      for(k = 2 * i; k <= 999999; k += i) {
        prime[k] = 0;
      }
    }
  }
  for(i = 2; i <= 999999; i++) {
    if(prime[i] == 1){
      N++;
      prime[i] = N;
    }else if(prime[i] == 0){
      prime[i] = N;
    }
  }
  while(scanf("%d", &n) != EOF){
    printf("%d\n", prime[n]);
  }
  return 0;
}

Measured memory_bytes: 4496
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Console;
using static System.Math;
using static MyIO;
using static MyUtil;

public class A { public static void Main() => (new Solver()).Solve(); }

public class Solver
{
	public void Solve()
	{
		long A = GetLong();
		long B = GetLong();
		WriteLine(B % A == 0 ? A + B : B - A);
	}
}

public static class MyIO
{
	private static string[] args = new string[0];
	private static int cnt = 0;
	private static IEnumerable<string> getArgs(long N) => Range(0, N).Select(_ => getArg());
	private static string getArg()
	{
		if(cnt == args.Length) { args = Console.ReadLine().Split(); cnt = 0; }
		return args[cnt++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static decimal GetDecimal() => decimal.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
	public static int[] GetInts(long N) => getArgs(N).Select(int.Parse).ToArray();
	public static long[] GetLongs(long N) => getArgs(N).Select(long.Parse).ToArray();
	public static double[] GetDoubles(long N) => getArgs(N).Select(double.Parse).ToArray();
	public static decimal[] GetDecimals(long N) => getArgs(N).Select(decimal.Parse).ToArray();
	public static string[] GetStrings(long N) => getArgs(N).ToArray();
}

public static class MyUtil
{
	public static void chmax<T>(ref T x, T y) where T : IComparable<T> { if(x.CompareTo(y) < 0) x = y; }
	public static void chmin<T>(ref T x, T y) where T : IComparable<T> { if(x.CompareTo(y) > 0)	x = y; }
	public static void swap<T>(ref T x, ref T y) { T tmp = x; x = y; y = tmp; }
	public static long rightShift(long x, long y) => (x >> (int)y);
	public static long leftShift(long x, long y) => (x << (int)y);
	public static bool contains(long s, long x) => (rightShift(s, x) & 1L) == 1L;
	public static long gcd(long x, long y) => (y == 0) ? x : gcd(y, x % y);
	public static long lcm(long x, long y) => (x / gcd(x,y)) * y;	
	public static IEnumerable<int> Range(long start, long count) => Enumerable.Range((int)start, (int)count);
	public static void Sort(this List<string> source) => source.Sort(StringComparer.Ordinal);
}


Measured memory_bytes: 27476
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))

sa = [abs(A - (T - 0.006*hi)) for hi in H]

mn = 1000
ans = -1
for i in range(N):
  if sa[i] < mn:
    ans = i+1
    mn = sa[i]
    
print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define MAX(a,b) a=a>b?a:b
#define MIN(a,b) a=a<b?a:b
#define REP(i,x,n) for(int i=x;i<n;i++)
#define REPR(i,x,n) for(int i=n-1;i>=x;i--)
#define pb  push_back
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLr(obj) (obj).rbegin(), (obj).rend()
#define endl "\n"
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll MOD = 1e9 + 7;



int main() {
    ll a[201010],b[201010]={},n;cin>>n;ll c=0;
    rep(i,n){
        cin>>a[i];
        b[a[i]]++;
    }
    rep(i,n+1){
        c+=b[i]*(b[i]-1)/2;
    }
    rep(i,n){
        ll aa=c-(b[a[i]]*(b[a[i]]-1)/2);
        aa+=((b[a[i]]-1)*(b[a[i]]-2)/2);
        cout<<(ll)aa<<endl;
    }
}


Measured memory_bytes: 5760
import java.util.*;

class Main {
	static int mod=1_000_000_007;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		int K = Integer.parseInt(sc.next());
		int cnt = N-K+1;
		for (int i=1;i<=K;i++) {
			if (cnt>0) {
				System.out.println(nCr(N-K+1, i) * nCr(K-1, i-1) % mod);
			} else {
				System.out.println(0);
			}
			cnt--;
		}
	}

	public static long factorial(int n) {
		long tmp = 1;
		for (int i=n;i>0;i--) {
			tmp = (tmp*i)%mod;
		}
		return tmp;
	}

	public static long pow(long a,int n) {
	    long res=1;
	    while (n>0) {
	        if ((n-n/2*2)==1) {
	            res=(res*a)%mod;
	        }
	        a=(a*a)%mod;
	        n>>=1;
	    }
	    return res;
	}

	public static long modinv(long n) {
		return pow(n, mod-2);
	}

	public static long nCr(int n, int r) {
		return factorial(n) * modinv(factorial(n-r)) % mod * modinv(factorial(r)) % mod;
	}
}

Measured memory_bytes: 24276
import numpy as np
from scipy.sparse import csr_matrix

S = input()
N = len(S)
row = tuple(range(N))
col = [n + (1 if s == 'R' else -1) for n, s in enumerate(S)]
data = [1] * N
mat = csr_matrix((data, (row, col)), shape=(N, N))
print(*np.ones(N, dtype=np.int) * (mat ** 10 ** 100))

Measured memory_bytes: 31724
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define FORL(i,x) for(int i=head[x];i;i=nxt[i])
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#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())
#define PB push_back
#define MP make_pair
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }



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

  int n = s.length();

  int ans = 0;
  int cou = 0;

  FOR(i,0,n-1){
    if(s[i]=='A' || s[i]=='C' || s[i]=='G' || s[i]=='T') ++cou;
    else cou = 0;
    chmax(ans,cou);
  }

  cout << ans << endl;

}



Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>

using namespace std;
typedef long long ll;

bool check(ll s,ll v){
	ll all=0;
	ll f=10,dmax=0,digit=1;
	ll v2=v;
	while(v2>0){
		v2/=10;
		dmax++;
	}
	while(digit<dmax){
		ll g=f-1;
		ll three=g/3-g/30;
		ll five=g/5-g/50;
		ll fifteen=g/15-g/150;
		all+=(three+five)*4+(g-g/10-three-five+fifteen)*digit;
		if(all>=s)return true;
		f*=10LL;
		digit++;
	}
	ll g=f/10-1;
	ll three=v/3-g/3;
	ll five=v/5-g/5;
	ll fifteen=v/15-g/15;
	all+=(three+five)*4+(v-g-three-five+fifteen)*digit;
	if(all>=s)return true;
	return false;
}

string func(ll s,ll v){
	ll all=0;
	ll f=10,dmax=0,digit=1;
	ll v2=v;
	while(v2>0){
		v2/=10;
		dmax++;
	}
	while(digit<dmax){
		ll g=f-1;
		ll three=g/3-g/30;
		ll five=g/5-g/50;
		ll fifteen=g/15-g/150;
		all+=(three+five)*4+(g-g/10-three-five+fifteen)*digit;
		f*=10LL;
		digit++;
	}
	if(v>0){
		ll g=f/10-1;
		ll three=v/3-g/3;
		ll five=v/5-g/5;
		ll fifteen=v/15-g/15;
		all+=(three+five)*4+(v-g-three-five+fifteen)*digit;
	}
	string res="";
	ll rest=s-all-1;
	v++;
	while(res.size()<20+rest){
		ll vv=v;
		string num="";
		if(v%3!=0 && v%5!=0){		
			while(vv>0){
				num+=vv%10+'0';
				vv/=10;
			}
			reverse(num.begin(),num.end());
			res+=num;
		}
		if(v%3==0){
			res+="Fizz";
		}
		if(v%5==0){		
			res+="Buzz";
		}
		v++;
	}
	res=res.substr(rest,20);
	return res;
}

int main(void){
	ll s;
	scanf("%lld",&s);
	ll l=0,r=s;
	while(r-l>1){
		ll mid=(l+r)/2;
		if(check(s,mid))r=mid;
		else l=mid;
	}
	cout << func(s,r-1) << endl;
	return 0;
}

Measured memory_bytes: 1228
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#define llong long long
#define INF (__INT32_MAX__ / 2)

using namespace std;
typedef pair<int, int> ipair;
llong modulo(llong left, llong right) { return (left % right + right) % right; }

string s, res;
int K;

vector<int> start_with[26];
int main(int argc, char **argv) {
    cin >> s >> K;
    for(int i = 0; i < s.size(); ++i)
        start_with[s[i] - 'a'].push_back(i);
    
    set<string> substr;
    for(int i = 0; i < 26; ++i) {
        substr.clear();

        for(int j = 0; j < start_with[i].size(); ++j) {
            int pos = start_with[i][j];
            for(int len = 1; len <= min(100, (int)(s.size() - pos)) ; ++len) {
                substr.insert(s.substr(pos, len));
            }
        }

        if(substr.size() < K)
            K -= substr.size();
        else {
            set<string>::iterator it = substr.begin();
            it = next(it, K - 1);
            res = *it;
            break;
        }
    }


    cout << res << endl;
}

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

#define endl '\n'
#define int long long

const int N = 1e5+9;
int cache[N][3], h[N][3], n;

int dp(int d, int a) {
	if(d == n+1) 
		return 0;
	int &ans = cache[d][a];
	if(ans) 
		return ans;
	ans = h[d][a] + max(dp(d+1, (a+1)%3), dp(d+1, (a+2)%3));
	return ans;
}

int32_t main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

	cin >> n;
	for(int i = 1; i <= n; i ++) {
		for(int j = 0; j < 3; j ++) {
			cin >> h[i][j];
		}
	}
	cout << max(dp(1,0), max(dp(1,1), dp(1,2))) << endl;

	return 0;
}

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

typedef long long LL;
typedef pair<int, int> II;

const int N = 200 + 10;
int n, m;
char S[N][N];

const int INF = 0x3f3f3f3f;
struct Flow {
    int n, s, t;
    int c[N][N], f[N][N], d[N], pr[N];
    void Init(int __n, int __s, int __t) {
        n = __n;
        s = __s; t = __t;
        for (int i = 1; i <= n; ++i)
            for (int j = 1; j <= n; ++j)
                c[i][j] = f[i][j] = 0;
    }
    void AddEdge(int u, int v, int w) { c[u][v] += w; c[v][u] += w; }

    bool BFS() {
        queue<int> Q; Q.push(s);
        for (int i = 1; i <= n; ++i) d[i] = -1; d[s] = 0;
        while (Q.size()) {
            int u = Q.front(); Q.pop();
            for (int v = 1; v <= n; ++v) if (c[u][v] > f[u][v] && d[v] == -1) {
                d[v] = d[u] + 1;
                Q.push(v);
            }
        }
        return d[t] != -1;
    }
    int DFS(int u, int fl) {
        if (u == t) return fl;
        for (int &v = pr[u]; v <= n; ++v) if (c[u][v] > f[u][v] && d[v] == d[u] + 1) {
            int x = DFS(v, min(fl, c[u][v] - f[u][v]));
            if (x) {
                f[u][v] += x;
                f[v][u] -= x;
                return x;
            }
        }
        return 0;
    }

    int MaxFlow() {
        int ans = 0;
        while (BFS()) {
            for (int i = 1; i <= n; ++i) pr[i] = 1;
            while (1) {
                int x = DFS(s, INF);
                if (x) ans += x; else break;
            }
        }
        return ans;
    }
} Flow;

int main() {
#ifdef LOCAL
    freopen("inp", "r", stdin);
    freopen("out", "w", stdout);
#endif
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= n; ++i) scanf("%s", S[i] + 1);

    int _s = n + m + 1;
    int _t = n + m + 2;
    Flow.Init(n + m + 2, _s, _t);
    for (int i = 1; i <= n; ++i) for (int j = 1; j <= m; ++j) {
        if (S[i][j] == '.') continue;
        if (S[i][j] == 'o') Flow.AddEdge(i, j + n, 1);
        if (S[i][j] == 'S') {
            Flow.AddEdge(_s, i, INF);
            Flow.AddEdge(_s, j + n, INF);
        }
        if (S[i][j] == 'T') {
            Flow.AddEdge(i, _t, INF);
            Flow.AddEdge(j + n, _t, INF);
        }
    }

    int ans = Flow.MaxFlow(); if (ans >= INF) ans = -1;
    printf("%d", ans);
    return 0;
}


Measured memory_bytes: 640
#include "bits/stdc++.h"
using namespace std;

int main() {
	string A, B;
	cin >> A >> B;
	if (A>B) {
		cout << ">"<<endl;
	}
	else if (A<B) {
		cout << "<"<<endl;
	}
	else {
		cout << "="<<endl;
	}
	return 0;
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a, b;
    cin >> a >> b;
    if(a < b)
        cout << 0;
    else
        cout << 10;
    return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <iostream>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
#define int ll
typedef pair<int,int> pii;
const int N = 2e5+7;
ll a[N];
signed main()
{
	int n;scanf("%lld",&n);
	for(int i = 1;i <= n;++i)	scanf("%lld",&a[i]);
	ll res = 0;
	sort(a + 1,a + n + 1);
	priority_queue<pii> pq;
	pq.push({a[n],1});
	res += a[n];
	pq.push({a[n - 1],0});
	for(int i = n - 2;i >= 1;--i)
	{
		pii _mt = pq.top();pq.pop();
		pii t = pq.top();pq.pop();
		pq.push(_mt);
		res += t.first;
		if(t.second == 0)	pq.push({t.first,t.second + 1});
		pq.push({a[i],0});
	}
	printf("%lld",res);
    return 0;
}


Measured memory_bytes: 6468
import java.math.BigInteger;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner((System.in));
		int N = sc.nextInt();
		BigInteger a = BigInteger.ZERO, b = BigInteger.ZERO, c = BigInteger.ZERO;

		a = BigInteger.valueOf(2);
		b = BigInteger.ONE;
		c = BigInteger.ONE;

		for (int i = 1; i < N; i++) {
			c = a.add(b);
			a = b;
			b = c;
		}

		System.out.println(c);

		sc.close();
	}
}

Measured memory_bytes: 22740
from math import factorial

n,a,b=map(int,input().split())
mod=10**9+7

up=[1]
down=[1]
comb=[1]
for i in range(1,b+1):
    up.append(up[i-1]*(n-i+1)%mod)
    down.append(down[i-1]*i%mod)
    comb.append(up[i]*pow(down[i],mod-2,mod)%mod)

print((pow(2,n,mod)-1-comb[a]-comb[b])%mod)


Measured memory_bytes: 32432
#include <iostream>
#include <cstdio>
using namespace std;
int main(int argc, char** argv) 
{
	int a,b,c,d,e,k;
	cin >> a >> b>> c >> d >> e >> k;
	if(k >= e-a)
	cout << "Yay!" << endl;
	else
	cout << ":(" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <string>

using namespace std;

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

  string result;

  if (S.size() <= K) {
    cout << S << endl;
  } else {
    cout << S.substr(0, K) << "..." << endl;
  }

  return 0;
}


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

using namespace std;

int main()
{    
    int N, mx = 0; 
    map<int, int> mp;
    while (cin >> N) {
        mx = max(mx, ++mp[N]);
    }
    for (auto &v: mp) {
        if (v.second == mx) {
            cout << v.first << endl;
        }
    }        
    return 0;
}

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

class Node{
public:
	int location;
	int p,l,r;
	Node(){}
};

class Point{
public:
	int id,x,y;
	Point(){}
	Point(int id,int x,int y): id(id),x(x),y(y){}
	//?????????ID???????????§?????????????????¨????????°
	bool operator < (const Point &p) const{
		return id <p.id;
	}

	void print(){
		printf("%d\n",id);
	}
};

static const int MAX=1000000;
static const int NIL=-1;

int N;
Point P[MAX];
Node T[MAX];
int np;

bool lessX(const Point &p1, const Point &p2){return p1.x<p2.x;}
bool lessY(const Point &p1, const Point &p2){return p1.y<p2.y;}

int makeKDTree(int l,int r,int depth){
	if(!(l<r))return NIL;
	int mid=(l+r)/2;
	int t=np++;
	if(depth%2==0){
		sort(P+l,P+r,lessX);
	}else{
		sort(P+l,P+r,lessY);
	}
	T[t].location=mid;
	T[t].l=makeKDTree(l,mid,depth+1);
	T[t].r=makeKDTree(mid+1,r,depth+1);
	return t;
}
//		find(root,sx,tx,sy,ty,0,ans);
void find(int v, int sx,int tx,int sy, int ty,int depth,vector<Point> &ans){
	int x=P[T[v].location].x;
	int y=P[T[v].location].y;
	if(sx<=x&& x<=tx&&sy<= y &&y<=ty){
		ans.push_back(P[T[v].location]);
	}
	if(depth%2==0){
		if(T[v].l!=NIL){
			if(sx<=x)find(T[v].l,sx,tx,sy,ty,depth+1,ans);
		}
		if(T[v].r!=NIL){
			if(x<=tx)find(T[v].r,sx,tx,sy,ty,depth+1,ans);
		}
	}else{
		if(T[v].l!=NIL){
			if(sy<=y)find(T[v].l,sx,tx,sy,ty,depth+1,ans);
		}
		if(T[v].r!=NIL){
			if(y<=ty)find(T[v].r,sx,tx,sy,ty,depth+1,ans);
		}
	}
}

int main(){
	int x,y;
	scanf("%d",&N);
	for (int i = 0; i < N; ++i) {
		scanf("%d %d",&x,&y);
		P[i]=Point(i,x,y);
		T[i].l=T[i].r=T[i].p=NIL;
	}
	np=0;
	int root=makeKDTree(0,N,0);
	int q;
	scanf("%d",&q);
	int sx,tx,sy,ty;
	vector<Point> ans;
	for (int i = 0; i < q; ++i) {
		scanf("%d %d %d %d",&sx,&tx,&sy,&ty);
		ans.clear();
		find(root,sx,tx,sy,ty,0,ans);
		sort(ans.begin(),ans.end());
		for (int j = 0; j < ans.size(); ++j) {
			ans[j].print();
		}
		printf("\n");
	}
	return 0;

}

Measured memory_bytes: 16456
#include <iostream>
#include <algorithm>
#include <climits>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
using namespace std;

#define INF (1LL<<60)
typedef pair<int, int> P;

int M, N, K;
P T[200010];
long long D[200010];
vector<int> xs[100010], ys[100010];

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

  T[0] = P(M, N);
  xs[M].push_back(0);
  ys[N].push_back(0);

  for (int i=1; i<K+1; i++) {
    int x, y;
    cin >> x >> y;
    T[i] = P(x, y);
    if (x != M || y != N) {
      xs[x].push_back(i);
      ys[y].push_back(i);
    }
  }

  for (int i=0; i<K+1; i++) D[i] = INF;

  queue<P> q;
  for (int i : xs[1]) {
    D[i] = T[i].second - 1;
    q.push(P(i, 0));
  }

  while (!q.empty()) {
    int s = q.front().first, d = q.front().second; q.pop();
    P p = T[s];

    if (d == 1) {
      for (int i : xs[p.first]) {
        if (i == s) continue;
        P t = T[i];
        long long l = abs(t.second - p.second) + 1LL;
        if (D[i] > D[s] + l) {
          D[i] = D[s] + l;
          q.push(P(i, 0));
        }
      }
    }
    else {
      for (int i : ys[p.second]) {
        if (i == s) continue;
        P t = T[i];
        long long l = abs(t.first - p.first) + 1LL;
        if (D[i] > D[s] + l) {
          D[i] = D[s] + l;
          q.push(P(i, 1));
        }
      }
    }
  }

  cout << (D[0] != INF ? D[0] : -1) << "\n";
  return 0;
}

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

using namespace std;

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

    int len = s.length();

    set <char> c;

    for(int i = 0; i < len; i++){
        c.insert(s[i]);
    }

    bool ans = true;

    if(c.count('N')){
        if(!c.count('S')){
            ans = false;
        }
    }
    if(c.count('S')){
        if(!c.count('N')){
            ans = false;
        }
    }
    if(c.count('W')){
        if(!c.count('E')){
            ans = false;
        }
    }
    if(c.count('E')){
        if(!c.count('W')){
            ans = false;
        }
    }

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


    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ for(auto it : P) { s << "<" << it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ for(auto it : P) { s << "<" << it.first << "->" << it.second << "> "; } return s << endl; }



struct UnionFind {
    vector<int> par, con;
    
    UnionFind(int n) : par(n, -1), con(n, 1) { }

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }
    
    bool issame(int x, int y) {
        return root(x) == root(y);
    }
    
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        con[x] += con[y];
        return true;
    }
    
    int size(int x) {
        return -par[root(x)];
    }
};


using pint = pair<int,int>;
int N, M, K;
void solve() {
    vector<set<int> > frs(N);
    UnionFind uf(N);
    for (int i = 0; i < M; ++i) {
        int a, b; cin >> a >> b; --a, --b;
        if (a > b) swap(a, b);
        frs[a].insert(b);
        frs[b].insert(a);
        uf.merge(a, b);
    }
    for (int i = 0; i < K; ++i) {
        int c, d; cin >> c >> d; --c, --d;
        if (c > d) swap(c, d);
        if (uf.issame(c, d)) {
            frs[c].insert(d);
            frs[d].insert(c);
        }
        //if (!frs[c].count(d)) ens[c].push_back(d);
        //if (!frs[d].count(c)) ens[d].push_back(c);
    }

    for (int i = 0; i < N; ++i) {
        int mem = uf.con[uf.root(i)] - 1;
        mem -= frs[i].size();
        cout << mem << " ";
    }
    cout << endl;
}

int main () {
    while (cin >> N >> M >> K) solve();
}



Measured memory_bytes: 25088
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

vector<int> A;
int H;

void maxHeapify(int idx)
{
    int left=2*idx, right=2*idx+1;
    int largest;
    if(left<=H && A[left]>A[idx]){
        largest=left;
    } else{
        largest=idx;
    }
    if(right<=H && A[right]>A[largest]){
        largest=right;
    }
    if(largest!=idx){
        swap(A[largest], A[idx]);
        maxHeapify(largest);
    }
}

void buildMaxHeap()
{
    for(int i=H/2; i; i--){
        maxHeapify(i);
    }
}

int main()
{
    scanf("%d", &H);
    A=vector<int>(H+1);
    for(int i=0; i<H; i++){
        scanf("%d", &A[i+1]);
    }
    buildMaxHeap();
    for(int i=0; i<H; i++){
        printf(" %d", A[i+1]);
    }
    printf("\n");
    return 0;
}

Measured memory_bytes: 4140
#include<bits/stdc++.h>
using namespace std;
#define int long long


signed main(){
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);

    int d, t, s;
    cin>>d>>t>>s;
    cout<<(d<=s*t?"Yes":"No")<<endl;

    return 0;
}


Measured memory_bytes: 3636
let () = Scanf.scanf "%d %d\n" @@ fun n wmax ->
  let wvs = Array.init n @@ fun _ ->
    Scanf.scanf "%d %d\n" @@ fun w v -> w, v in
  let dp = Array.make (wmax + 1) 0 in
  Array.iter (fun (w, v) ->
    for w' = wmax - w downto 0 do
      dp.(w + w') <- max dp.(w + w') (v + dp.(w'))
    done) wvs;
  Printf.printf "%d\n" @@ Array.fold_left max min_int dp


Measured memory_bytes: 3200
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> PLL;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PLL> VP;
#define rep(i,n) for (ll i=0; i<(ll)(n); i++)
#define repd(i,n) for (ll i=n-1; i>=0; i--)
#define rept(i,m,n) for(ll i=m; i<n; i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define PF push_front
#define PB push_back
#define SORT(V) sort((V).begin(), (V).end())
#define RVERSE(V) reverse((V).begin(), (V).end())
#define paired make_pair
#define PRINT(V) for(auto v : (V)) cout << v << " "

int main()
{
    ll N,M;
    cin >> N >> M;
    ll S, C;
    C=M;
    S=N;
    ll count=0;
    if(S>C/2){
        cout << C/2 << endl;
        return 0;
    }    
    else{
        count=S;
        C-=S*2;
        count+=C/4; 
    }
    cout << count << endl;
}

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

int main(){
	int n,num;
	int left,right;
	char w;
	int ans = 0;
	int check;

	while(cin >> n){
		ans = 0;
		check = 0;
		for(int i = 0; i < n; i++){
			cin >> w;
			if(w == '('){
				cin >> num;
				ans+= num; 
			}else if(w == ')'){
				cin >> num;
				ans-= num;
			}
			if(ans < 0) check = 1;;

		}
		if(ans == 0 && check != 1)
				cout << "YES" << endl;
		else
				cout << "NO" << endl;
	}
}

Measured memory_bytes: 1156
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define fast ios_base::sync_with_stdio(false);  cin.tie(NULL); cout.tie(NULL);
#define scan(a,n) for(long int index=0;index<n;index++) cin>>a[index];
#define print(a,n) for(long int index=0;index<n;index++) cout<<a[index]<<" ";cout<<endl;
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define ss second
#define ff first
#define vli vector<long long int>
#define vlli vector<pair<long long int,long long int>>
#define vsi vector<string>
#define vci vector<char>


 
int main() {
   #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
    fast;
     ll n;
    cin>>n;
    string s;
    cin>>s;
    ll ans = 0, x = 0, y = n, f=0;
    ll bb=0,i;
    for(i=0;i<n;i++){
      if(s[i]=='W') bb++;
    }
    if(bb==n){
      cout<<0;
      return 0;
    }
    
    for(i=0;i<n;i++){
        if(i>=y){
            break;
        }
        if(s[i] == 'W'){
            for(ll j=y-1;j>=0;j--){
                if(s[j] == 'R'){
                    if(j>i){
                        y=j;
                        ans++;
                        break;

                    }
                    else{
                        f=1;
                        break;
                    }
                }
            }
            if(f){
                break;
            }
        }
    }
    cout<<ans<<endl;
  
return 0;
    
 }  

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

#define NL '\n'
#define C char
#define D double
#define F float
#define S string
#define sz(x) x.size()
#define INF LONG_LONG_MAX
#define PI (2.0*acos(0.0))
#define sfi(x) scanf("%d",&x)
#define sfi2(x,y) scanf("%d %d",&x,&y)
#define sfi3(x,y,z) scanf("%d %d %d",&x,&y,&z)
#define sfl(x) scanf("%lld",&x)
#define sfl2(x,y) scanf("%lld %lld",&x,&y)
#define sfl3(x,y,z) scanf("%lld %lld %lld",&x,&y,&z)
#define sfd(x) scanf("%lf",&x);
#define max3(a,b,c) max(a,max(b,c))
#define max4(a,b,c,d) max(max3(a,b,c),d)
#define min3(a,b,c) min(a,min(b,c))
#define min4(a,b,c,d) min(a,min3(b,c,d))
#define pb push_back
#define all(x) x.begin(),x.end()
#define asort(x) sort(all(x));
#define dsort(x) sort(all(x), greater<int>())
#define unq(x) x.erase(unique(x.begin(),x.end()),x.end())
#define mem(ara,val) memset(ara,val,sizeof(ara))
#define READ freopen("input.txt","r",stdin)
#define WRITE freopen("output.txt","w",stdout)
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;

LL gcd(LL a,LL b)
{
    if(b==0) return a;
    else return gcd(b,a%b);
}
LL lcm(LL a,LL b)
{
    return a/gcd(a,b)*b;
}

LL bigmod(LL base, LL power, LL mod)
{
    if(power==0) return 1;
    else if(power%2==1)
    {
        LL value1 = base % mod; LL value2 = (bigmod(base,power-1,mod))%mod;
        return (value1*value2)%mod;
    }
    else
    {
        LL value1 = (bigmod(base,power/2,mod))%mod;
        return (value1*value1)%mod;
    }
}



int main()
{
    LD n;
    cin>>n;
    LD ans = 2*PI*n;
    cout<<fixed<<setprecision(2)<<ans;
}


Measured memory_bytes: 3792
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
#include <iomanip>
#define mod 1000000007
using namespace std;

long long int getGCD(int,int);

int main()
{
    //int m,n,o=0,i,j,k,sum=0;
    long long int m,n,o,i,j,k,gcd=0,pre,now;
    //vector <int> v;
    //float f,g,h;
    //char c,d;
    //string a;
    cin>>m>>n;
    pre=n;
    for(i=0;i<m;i++)
    {
        cin>>now;
        if(i==0) gcd=abs(pre-now);
        else gcd=getGCD(gcd,abs(now-pre));
        pre=now;
    }
    cout<<gcd;
    //cin>>m>>c>>n>>d>>i;
    //cin>>f>>g;
    //cin>>c;
    return 0;
}

long long int getGCD(int m,int n)
{
    if(n==0) return m;
    else return getGCD(n,m%n);
}



Measured memory_bytes: 888
import math
n=int(input())
ans=0
xy=[list(map(int,input().split())) for i in range(n)]
for i in range(n-1):
  for j in range(i+1,n):
    ans+=math.sqrt((xy[i][0]-xy[j][0])**2+(xy[i][1]-xy[j][1])**2)*math.factorial(n)*2/n
print(ans/math.factorial(n))

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

#define ff first
#define ss second

#define pb push_back
#define mp make_pair
#define ins insert

#define f(i,n) for(int i = 0 ;  i < n ; i ++)
#define f1(i,n) for(int i = 1 ; i<= n ; i++)

#define int long long int

#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL);
#define test() int t;cin>>t;while(t--)





int32_t main()
{
	fast();

	int n , k ;

	cin >> n >> k;

	bool visited[n+1];

	memset(visited,false,sizeof(visited));

	map<int,int> m;

	int a[n+1];

	f1(i,n)
	{
		cin >> a[i];
		m[i] = a[i];
	}

	vector<int> res;

	int tmp , i , j;
	int prev = 1;
	res.pb(1);
	map<int,int> store;
	while(k)
	{
		if(!visited[prev])
		{
			store[prev]  = res.size() - 1;
			visited[prev] = true;

			prev = m[prev];

			res.pb(prev);
		}
		else
		{
			tmp = prev;
			break;
		}
		k--;
	}
	
	if(k)
	{
		i = store[tmp];
		j = res.size()  - 1;
		int l = j - i ;
		k %= l;
		
		i+=k;

		cout<<res[i];	
	}
	else
	{
		cout<<prev;
	}


	
		
	return  0 ;
	
}




Measured memory_bytes: 28652
n,m = map(int,input().split())
x = []
c = 0
for i in range(n):
    a = list(map(int,input().split()))
    a.pop(0)
    x.extend(a)

for j in range(1,m+1):
    if x.count(j) == n:
        c += 1

print(c)



Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>

using namespace std;
int n, cnt[55][30];
string str[55];
int main()
{
	cin>>n;
	for (int i = 0; i < n ;i++)
	{
		cin>>str[i];
	}

	for (int i = 0 ; i < n; i++)
	for (int j = 'a'; j <= 'z'; j++)
		cnt[i][j] = 0;

	for (int i = 0 ; i < n ; i++)
	{
		int len = str[i].length();
		for(int j = 0 ; j < len; j++)
		{
			cnt[i][str[i][j]]++;
		}
	}

	string ans = "";
	for (int i = 'a'; i <='z'; i++)
	{
		int mn = 50;
		for (int j = 0; j < n; j++)
		{
			if (cnt[j][i] < mn) mn = cnt[j][i];
		}
		for (int k = 0; k < mn; k++) ans+=i;
	}

cout<<ans<<endl;

}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
const double PI = 3.1415926535898;
int main(){
    double a, b, c, d;
    scanf("%lf%lf%lf%lf", &a, &b, &c, &d);
    double angle = fabs(30 * c + d / 2 - 6 * d);
    angle = min(angle, 360 - angle);
    //printf("%d %.9f\n", angle, cos(angle * PI / 180.0));
    //printf("%.9f\n", (double) a * a + (double) b * b - 2 * (double)a * b * cos(angle * PI / 180.0));
    printf("%.10f\n", sqrt((double) a * a + (double) b * b - 2 * (double)a * b * cos(angle * PI / 180.0)));
    return 0;
}


Measured memory_bytes: 4228
n,w=map(int,input().split())
l=[list(map(int,input().split())) for _ in [0]*n]
l1,l2,l3,l4=[],[],[],[]
a=l[0][0]
for i in range(n):
    if l[i][0]==a:
        l1.append(l[i][1])
    elif l[i][0]==a+1:
        l2.append(l[i][1])
    elif l[i][0]==a+2:
        l3.append(l[i][1])
    else:
        l4.append(l[i][1])
l1.sort(reverse=True)
l2.sort(reverse=True)
l3.sort(reverse=True)
l4.sort(reverse=True)
ans=0
for h in range(len(l1)+1):
    for i in range(len(l2)+1):
        for j in range(len(l3)+1):
            for k in range(len(l4)+1):
                if a*h+(a+1)*i+(a+2)*j+(a+3)*k<=w:
                    ans=max(ans,sum(l1[:h])+sum(l2[:i])+sum(l3[:j])+sum(l4[:k]))
print(ans)

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

ll L(ll memo[], int i) {
    if (memo[i] != 0) return memo[i];
    else return memo[i] = L(memo, i-2) + L(memo, i-1);
}

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

    ll memo[N+1] = {};
    memo[0] = 2;
    memo[1] = 1;

    cout << L(memo, N) << endl;
    return 0;
}


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

signed main () {
    int n, m;
    cin >> n >> m;
    vector < pair < int, int > > items(n + 1);
    for (int i = 1; i <= n; ++i)
        cin >> items[i].first >> items[i].second;
    vector < map < int, int > > knapsack(n + 1);
    knapsack[0][0] = 0;
    for (int i = 1; i <= n; ++i) {
        for (auto reach: knapsack[i - 1]) {
            knapsack[i][reach.first] = max(knapsack[i][reach.first], reach.second);
            if (reach.first + items[i].first <= m)
                knapsack[i][reach.first + items[i].first] = reach.second + items[i].second;
        }
    }
    int ans = 0;
    for (auto reach: knapsack.back())
        ans = max(ans, reach.second);
    cout << ans << '\n';
}


Measured memory_bytes: 4864
import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 998244353

class ModTools:
    """ 階乗たくさん使う時用のテーブル準備 """

    def __init__(self, MAX, MOD):
        """ MAX：階乗に使う数値の最大以上まで作る """
        
        MAX += 1
        self.MAX = MAX
        self.MOD = MOD
        factorial = [1] * MAX
        factorial[0] = factorial[1] = 1
        for i in range(2, MAX):
            factorial[i] = factorial[i-1] * i % MOD
        inverse = [1] * MAX
        inverse[MAX-1] = pow(factorial[MAX-1], MOD-2, MOD)
        for i in range(MAX-2, -1, -1):
            inverse[i] = inverse[i+1] * (i+1) % MOD
        self.fact = factorial
        self.inv = inverse
    
    def nCr(self, n, r):
        """ 組み合わせの数 """

        if n < r: return 0
        r = min(r, n-r)
        numerator = self.fact[n]
        denominator = self.inv[r] * self.inv[n-r] % self.MOD
        return numerator * denominator % self.MOD

N, M, K = MAP()

mt = ModTools(N, MOD)
ans = 0
for k in range(K+1):
    ans += M * pow(M-1, N-k-1, MOD) * mt.nCr(N-1, k)
    ans %= MOD
print(ans)


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

a = list(map(int, input().split()))
a.sort(reverse=True)
total = sum(a)

canPick = True
for i in range(m):
    if a[i] < total / (4 * m):
        canPick = False

if canPick is True:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3060
n = int(input())
x = [chr(i) for i in range(ord("a"), ord("z")+1)]
ans = []
while n > 26:
    ans.append(x[n%26-1])
    if n%26 == 0:
        n = n//26-1
    else: n //= 26
ans.append(x[n-1])
print("".join(ans[::-1]))

Measured memory_bytes: 9180
#include <queue>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <map>
#include <stdio.h>
using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for(int i = (a); i < (int)(b); i++)
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vint;
typedef vector<string> vstr;
typedef pair<ll, ll> pint;
unsigned long long inf = (1LL << 62);
ll mod = (ll)pow(10.0, 9.0) + 7;
pint dx[4] = { {1, 0}, {-1, 0}, {0, 1}, {0, -1} };

ll min(ll a, ll b)
{

	return (a < b) ? a : b;
}
ll K;

vector<ll> A;

ll check(ll m) {

	for (auto &ct : A) {
		if (m < ct) {
			return 0;
		}
		m = ct * (m / ct);
	}

	return m;
}

ll N;


unsigned long long Pow(ll a, ll b) {
	ll tmp;
	if (b == 0) return 1;
	else if (b % 2 == 1) return a * pow(a, b - 1);
	else { tmp = pow(a, b / 2); return tmp * tmp; }

}

int main() {

	ll l = 0, r =  Pow(10, 20);
	ll lm = 0, rm = Pow(10, 20);
	cin >> N;
	A.resize(N);
	rep(i, N)
		cin >> A[i];


	while (r - l > 1) {
		ll mid = (l + r) / 2;
		ll temp = check(mid);
		if (temp < 2) { l = mid; }
		if (temp >= 2) { r = mid; }
	

	}

	while (rm - lm > 1) {
		ll midm = (lm + rm) / 2;

		ll temp = check(midm);
		if (temp <= 2) { lm = midm; }
		if (temp > 2) { rm = midm; }

	}



	if (check(r) != 2) {
		cout << -1 << endl;
		return 0;
	}

	cout << r << " " << lm << endl;
	return 0;
}


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

int main(){
    int A, B, C;
    cin >> A >> B >> C;
    if(A < C && C < B)
        cout << "Yes" << endl;
    else if(B < C && C < A)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;
const ll mod = 1e9 + 7;

ll solve(ll n, ll a) {
  ll mi = n;
  if (n == 1) {
    return 1;
  }
  REP(b, 1, 40) {
    if (2 * n < 1LL << b) {
      break;
    }
    ll lo = 1;
    ll hi = n;
    while (hi - lo > 1) {
      ll mid = (hi + lo) / 2;
      if (pow(mid, b) >= n) {
	hi = mid;
      } else {
	lo = mid;
      }
    }
    assert (hi >= 2);
    // hi
    int minus = 0;
    REP(i, 0, b) {
      double omni = 1;
      ll scient = 1;
      REP(j, 0, i) { omni *= hi - 1; scient *= hi - 1; }
      REP(j, 0, b - i) { omni *= hi; scient *= hi; }
      if (omni >= n) {
	minus = i;
      }
    }
    ll res = (b - 1) * a + hi * b - minus;
    if (0) {
      cerr << "b=" << b << endl;
      cerr << "hi=" << hi << endl;
      cerr << "minus = " << minus<<endl;
      cerr << "res=" << res << endl << endl;
    }
    mi = min(mi, res);
  }
  return mi;
}

int main(void){
  ll n, a;
  cin >> n >> a;
  cout << solve(n, a) << endl;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define pi pair<int,int>
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define sz(x) ((int)x.size())
#define ln(x) ((int)x.length())
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define endl '\n'
#define dbg(x) cout<<#x<<": "<<x<<endl
#define clr(x,v) memset(x, v, sizeof(x))
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
const double eps = 1e-9;
const double PI = acos(-1.0);
const ll mod = 1e9 + 7;
const int MAXN = 1e6 + 5;

void cp()
{
    string s;
    int n;
    cin >> n >> s;
    int r = 0, w = 0;
    int op = 0;
    for(char x : s)
        if(x == 'R')
            r++;
        else
            w++;
    for(int i = 0; i < r; i++)
    {
        if(s[i] == 'R')
            op++;

    }
    cout << r - op;
}

int main()
{
    FASTIO;
    int t;
    t = 1;
    // cin >> t;
    while(t--)
    {
        cp();
    }
    return 0;
}

Measured memory_bytes: 3772
import sys
input = sys.stdin.readline

N, X = map(int, input().split())
l, p = [1], [1]

for i in range(N):
    l.append(l[i]*2 + 3)
    p.append(p[i]*2 + 1)

def f(N, X):
    if N == 0:
        return 0 if X <= 0 else 1
    elif X <= 1 + l[N-1]:
        return f(N-1, X-1)
    else:
        return p[N-1] + 1 + f(N-1, X-2-l[N-1])
    
print(f(N, X))


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

struct edge { int to, cost; };
typedef pair<int, int> P;
typedef pair<string, int> SP;
#define rep(i, n) for(int i = 0; i < n; ++i)

const int INF = 1e9 + 7;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    // vvvi V (50, vvi(50, vi(2500)));

    int A, B, C, D;
    cin >> A >> B >> C >> D;
    bool flag;
    rep(i, 101){
        // cout << B*i << endl;
        if(C <= B*i){
            cout << "Yes" << endl;
            break;
        }
        if(A <= D*i){
            cout << "No" << endl;
            break;
        }
    }

    return 0;
}

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

int main() {
	int n;
	cin >> n;
	int r[n];
	int l[n];
	int ans = 0;
	for (int i = 0; i < n; i++) {
		cin >> r[i] >> l[i];
		ans += l[i] - r[i] + 1;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<vector<ll> > matrix;
const ll mod = 1000000007;

int m;

matrix mul(matrix A, matrix B)
	{
		matrix ans(m+1,vector<ll>(m+1));
		for(int i=1;i<=m;i++)
			for(int j=1;j<=m;j++)
				for(int k=1;k<=m;k++)
					ans[i][j] = (ans[i][j] + A[i][k]*B[k][j])%mod;
		return ans;
	}

matrix powr(matrix A, ll p)
	{
		if(p==1) return A;
		if(p%2) return mul(A,powr(A,p-1));
		matrix x = powr(A, p/2);
		return mul(x,x);
	}


int main(int argc, char const *argv[])
{
    ll k;
	cin >> m >>k;
	matrix mx(m + 1, vector<ll>(m + 1));
	for(int i = 1; i <= m; i++) for(int j = 1; j <= m; j++) cin >> mx[i][j];
	mx = powr(mx, k);
	ll ans = 0;
	for(int i = 1; i <= m; i++) for(int j = 1; j <= m; j++) ans = (ans + mx[i][j]) % mod;
	cout << ans << endl;
}



Measured memory_bytes: 2944
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a , b;
    cin >> a >> b;
    int sum = 0;
    if(a > b){
        sum  += a;
        a--;
        sum += max(a,b);
    }else{
        sum += b;
        b--;
        sum += max(a,b);
    }
    cout << sum << endl;    
}


Measured memory_bytes: 256