akhauriyash/Code-Regression huggingface dataset:
/// Kazuki Hoshino


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
#define inf 1000000000
#define mod 1000000007
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define rep1(i, a, b) for(int i =a; i >=b; i--)
#define f first
#define ss second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
//#define endl '\n'
typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;

#define MAX 200000
int fac[MAX], inv[MAX], finv[MAX] ;

void pre(){
	inv[1]=1;
	for (int i = 2; i <MAX ; i++)
	{
		inv[i]=inv[mod%i]*(mod-mod/i)%mod;
	}
	fac[0]=finv[0]=1;
	for (int i = 1; i < MAX; ++i)
	{
		fac[i]=fac[i-1]*i%mod;
		finv[i]=finv[i-1]*inv[i]%mod;
	}
}
int ncr(int n, int r){
	if(r<0||r>n)return 0;
	return fac[n]*finv[r]%mod*finv[n-r]%mod;
}

vector<int> factors(int n) {
vector<int> f;
for (int x = 2; x*x <= n; x++) {
while (n%x == 0) {
f.push_back(x);
n /= x;
}
}
if (n > 1) f.push_back(n);
return f;
}


int n, m ;
set<int> s;
map<int , int > mp;


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

//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);

pre();
cin >> n >> m;


vi v = factors(m);

for(auto t: v){
    mp[t]++;
    s.insert(t);
}
int ans = 1;
for(auto t: s){

    int k = mp[t];
   // cout << t << " " << k << endl;
    ans = ans*ncr(n+k-1,k)%mod;


}
cout << ans << endl;



return 0;}
///....


Measured memory_bytes: 4992
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<queue>
#include<stack>
#include<bitset>
#include<functional>
#include<map>
#include<iomanip>
#include<limits>
#include<unordered_set> 
#include<cmath>
using namespace std;
//long long p = 998244353;
long long p = 1000000007;
#define int long long
#define vel vector<long long>
#define vvel vector<vel>
#define rep(i,n) for(int i=0;i<n;i++)
#define sor(v) sort(v.begin(),v.end())
#define mmax(a,b) a=max(a,b)
#define mmin(a,b) a=min(a,b)
#define mkp make_pair
#define pin pair<int,int>
#define qin pair<pin,int>
#define V vector
#define Endl endl
#define veb vector<bool>
#define fcout cout << fixed << setprecision(15)
#define rev(s) reverse(s.begin(),s.end())
#define lower(h,val) lower_bound(h.begin(),h.end(),val)-h.begin()
#define upper(h,val) upper_bound(h.begin(),h.end(),val)-h.begin()
int max_kai = 150000;
vel kai(max_kai, 1);
vel inv_kai;
int rui(int a, int n, int mod) {
    if (n == 0) { return 1 % mod; }
    int x = rui(a, n / 2, mod);
    x *= x; x %= mod;
    if (n % 2 == 1) { x *= a; x %= mod; }
    return x;
}
vel pa;
int root(int x) {
    if (pa[x] == -1) { return x; }
    int ans = root(pa[x]); pa[x] = ans;
    return ans;
}
void marge(int x, int y) {
    x = root(x);
    y = root(y);
    if (x != y) { pa[x] = y; }
}
int gcd(int x, int y) {
    if (x < y) { return gcd(y, x); }
    if (y == 0) { return x; }
    return gcd(y, x % y);
}
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
vel uni(vel x) {
    if (x.size() == 0) { return x; }
    sor(x);
    int n = x.size();
    vel ans(1, x[0]);
    for (int j = 1; j < n; j++) {
        if (x[j - 1] != x[j]) { ans.push_back(x[j]); }
    }
    x = ans;
    return x;
}
void pr(vel& v) {
    int n = v.size();
    if (n != 0) {
        cout << v[0];
        rep(i, n - 1) {
            cout << " " << v[i + 1];
        }
        cout << endl;
    }
}
signed main() {
    int n, t; cin >> n >> t;
    vvel dp0(n+1, vel(t, 0));
    vvel dp1(n+1, vel(t, 0));
    rep(i, n) {
        int a, b; cin >> a >> b;
        rep(j, t) {
            mmax(dp0[i + 1][j], dp0[i][j]);
            mmax(dp1[i + 1][j], dp1[i][j]);
            if (j + a < t) {
                mmax(dp0[i + 1][j + a], dp0[i][j] + b);
                mmax(dp1[i + 1][j + a], dp1[i][j] + b);
            }
            mmax(dp1[i + 1][j], dp0[i][j] + b);
        }
    }
    int ans = 0;
    rep(j, t) {
        mmax(ans,max(dp0[n][j], dp1[n][j]));
    }
    cout << ans << endl;
    return 0;
}


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

int N;
vector< pair<int, int> > E[101010];

class LCA
{
public:
	int NV;
	int logNV;
	vector<int> D;
	vector<long long> L;
	vector<vector<int> > P;

	LCA(int N)
	{
		NV = N;
		logNV = 0;
		while (NV > (1LL << logNV)) logNV++;
		D = vector<int>(NV);
		L = vector<long long>(NV);
		P = vector<vector<int> >(logNV, vector<int>(NV));
	}

	void init()
	{
		dfs(0, -1, 0, 0);
		build();
	}

	void dfs(int v, int par, int d, long long l)
	{
		D[v] = d;
		P[0][v] = par;
		L[v] = l;

		for (int i = 0; i < (int)E[v].size(); i++) {
			int w = E[v][i].first;
			int lc = E[v][i].second;
			if (w == par) continue;
			dfs(w, v, d + 1, lc + l);
		}
	}

	void build() {
		for (int k = 0; k + 1 < logNV; k++) {
			for (int v = 0; v < NV; v++) {
				if (P[k][v] < 0) P[k + 1][v] = -1;
				else P[k + 1][v] = P[k][P[k][v]];
			}
		}
	}

	int query(int u, int v) {
		if (D[u] > D[v]) swap(u, v);
		for (int k = 0; k < logNV; k++) {
			if ((D[v] - D[u]) >> k & 1)
				v = P[k][v];
		}
		if (u == v) return u;

		for (int k = logNV - 1; k >= 0; k--) {
			if (P[k][u] != P[k][v]) {
				u = P[k][u];
				v = P[k][v];
			}
		}
		return P[0][u];
	}
};

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

	while (cin >> N)
	{
		if (N == 1)
		{
			cout << 0 << endl;
			continue;
		}
		rep(i, 0, N) E[i].clear();
		rep(i, 1, N)
		{
			int p; cin >> p; p--;
			E[p].push_back( make_pair(i, 1) );
			E[i].push_back( make_pair(p, 1) );
		}

		LCA lca(N);
		lca.init();

		ll ans = 0;

		queue<int> que;
		que.push(0);
		int prev = -1;
		while (!que.empty())
		{
			int p = que.front(); que.pop();
			for (auto _p : E[p])
			{
				int pp = _p.first;
				if (lca.L[p] < lca.L[pp]) que.push(pp);
			}

			if (0 <= prev)
			{
				ans += (ll)(lca.L[p] + lca.L[prev] - 2 * lca.L[lca.query(p, prev)]);
			}
			prev = p;
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 20320
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;

string s;

int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> s;
	if (s[0] == '9' || s[1] == '9') cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
S=input()
c=len(S)
mod=1000000007
p=1
ans=pow(3,c-1,mod)
for i in range(1,c):
  if S[i]=="1":
    ans+=pow(2,p,mod)*pow(3,c-i-1,mod)
    p+=1
print((ans+pow(2,p,mod))%mod)

Measured memory_bytes: 9184
// Main maut ko takiya, aur kafan ko chadaar banakar audhta hoon!

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

typedef long long ll;
typedef unsigned long long ull;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define len(a) ll(a.size())
#define endl "\n"

#define vll vector< ll >
#define pll pair< ll, ll >
#define vvll vector< vll >
#define vpll vector< pll >

#define umsll unordered_map<string,ll>
#define umll unordered_map<ll,ll>
#define sll set<ll>
#define minpqll priority_queue<ll,vector<ll>,greater<ll>>

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

#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)

    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1)
    {
        cerr << name << " : " << arg1 << endl;
    }

    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args)
    {
        const char* comma = strchr(names + 1, ',');
        cerr.write(names, comma - names) << " : " << arg1 << "  ";
        __f(comma + 1, args...);
    }

#else
#define trace(...)
#endif // ifndef ONLINE_JUDGE

const double pi=3.141592653589793238462643383279502884197169399375105820974944;
const double e=2.71828182845904523536028747135266249775724709369995;
const ll mod=1e9+7;
const ll inf=2e18;
const ll ninf=-2e18;
const ll nax=1e6;

ll power(ll x, ll y, ll mod)
{
    ll ans=1;
    x=x%mod;
    while(y)
    {
        if(y&1)
            ans=(x*ans)%mod;

        x=(x*x)%mod;
        y>>=1;
    }
    return ans;
}

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


    ll c[4][4];

    for(int i = 1; i <= 3; i++)
    {
        for(int j = 1; j <= 3; j++)
            cin>>c[i][j];
    }


    ll a1,a2,a3,b1,b2,b3;
    bool ok = false;
    for(a1 = 0; a1 <= 100; a1++)
    {
        for(a2 = 0; a2 <= 100; a2++)
        {
            for(a3 = 0; a3 <= 100; a3++)
            {
                b1 = c[1][1] - a1;
                b2 = c[2][2] - a2;
                b3 = c[3][3] - a3;

                if(b1 < 0 or b2 < 0 or b3 < 0)
                    continue;

                if(c[1][2] != a1 + b2 or c[1][3] != a1 + b3)
                    continue;
                if(c[2][1] != a2 + b1 or c[2][3] != a2 + b3)
                    continue;
                if(c[3][1] != a3 + b1 or c[3][2] != a3 + b2)
                    continue;

                ok = true;
            }
        }
    }

    if(ok) cout<<"Yes";
    else cout<<"No";

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
//#pragma GCC optimize("Ofast","no-stack-protector","unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.2,popcnt,abm,mmx,avx")
//#include<bits/extc++.h>
//using namespace __gnu_pbds;
using namespace std;
#define F(i,L,R) for (int i = L; i < R; i++)
#define FE(i,L,R) for (int i = L; i <= R; i++)
#define getI(a) scanf("%d", &a)
#define getII(a,b) scanf("%d%d", &a, &b)
#define getIII(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define VgetI(n) int (n); scanf("%d",&(n))
#define VgetII(n,m) int (n),(m); scanf("%d %d",&(n),&(m))
#define VgetIII(n,m,k) int (n),(m),(k); scanf("%d %d %d",&(n),&(m),&(k))
#define debug(x) cout<<(#x)<<"="<<x<<"\n";
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define f first
#define s second
#define ll long long
#define INF 2000000000
int p[200005];
long double expect[200005],preSum[200005];
int sum(int x){
        return (x+1)*(x)/2;
}
int main(){
        int n,k;
        while(~getII(n,k)){
                F(i,0,n) getI(p[i]);
                F(i,0,n) expect[i]=sum(p[i])*1.0/p[i];
                //F(i,0,n) debug(expect[i]);
                preSum[0]=expect[0];
                F(i,1,n) preSum[i]=preSum[i-1]+expect[i];
                long double ans=0;
                FE(i,0,n-k) ans=max(ans,preSum[i+k-1]-preSum[i]+expect[i]);
                printf("%.10llf\n",ans);
        }
}

Measured memory_bytes: 7296
def main():
    N = int(input())

    ans = N - 1
    i = 1
    while i * i <= N:
        if N % i == 0:
            j = N // i
            ans = min(ans, i+j-2)
        i += 1

    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
#include<stdio.h>
#define MAX 100010

int main() {
	int N, K;
	int A[MAX];

	int minNumber = MAX;
	int minPos = -1;

	int ans = 1;

	scanf("%d %d", &N, &K);
	for (int i = 0; i < N; i++) {
		scanf("%d", &A[i]);
		if (A[i] < minNumber) {
			minNumber = A[i];
			minPos = i;
		}
	}
	N -= K;
	while (N > 0) {
		N -= (K - 1);
		ans++;
	}

	printf("%d\n", ans);

	return 0;
}

Measured memory_bytes: 512
#include<iostream>

using namespace std;

int main(void) {
	long long N, A, B;

	cin >> N >> A >> B;

	if (A > B) {
		cout << "0" << endl;
		return 0;
	}

	if (N == 1) {
		if (A != B)
			cout << "0" << endl;
		else
			cout << "1" << endl;
	}
	else if (N == 2) {
		cout << "1" << endl;
	}
	else {
		long long ans = ((N - 1)*B + A) - ((N - 1)*A + B) + 1;
		cout << ans << endl;
	}

}

Measured memory_bytes: 256
open System

let A,B,K=stdin.ReadLine().Split()|>fun c -> int c.[0],int c.[1],int c.[2]

[<EntryPoint>]
let main argv =
    [for i in [1..100] do yield (if (A%i=0)&&(B%i=0) then i else -1)]
    |>List.sortDescending
    |>fun l -> l.[K-1]
    |>printfn "%d"
    0

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

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main(){
  int N,M;
  cin >> N >> M;
  UnionFind tree(N);
  for (int i=0;i<M;i++){
    int x,y,z;
    cin >> x >> y >> z;
    tree.unite(x-1,y-1);
  }
  set<int> s;
  for (int i=0;i<N;i++){
    s.insert(tree.root(i));
  }
  cout << s.size() << endl;
}

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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back

int main()
{
    ll A, B, C;
    cin >> A >> B >> C;

    ll m1 = A*B*(C/2), m2 = A*B*(C-C/2);
    ll m3 = A*(B/2)*C, m4 = A*(B-B/2)*C;
    ll m5 = (A/2)*B*C, m6 = (A-A/2)*B*C;
    
    PR(MIN(MIN(abs(m1-m2),abs(m3-m4)),abs(m5-m6)));

    return 0;
}

/*



*/

Measured memory_bytes: 3600
n = int(input())
pos = []
for i in range(n):
  b = list(input().split( ))
  pos.append(b)
tp, xp, yp = 0, 0, 0
rflag = True
for p in pos:
  t, x, y = map(int, p)
  tint = t - tp
  xd = x - xp
  yd = y - yp
  tp, xp, yp = t, x, y
  pd = abs(xd) + abs(yd)
  if ((tint >= pd) & ((tint % 2) == (pd % 2))):
    continue
  else:
    rflag = False
    break
  
if rflag == True:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 27444
n = int(input())
ab = [list(map(int,input().split())) for i in range(n-1)]
graph = [[] for i in range(n+1)]
visited = [0 for i in range(n+1)]
root = 1
stack = [root]
for a,b in ab:
  graph[a].append(b)
  graph[b].append(a)
visited[0] = -1
visited[root] = 1
while stack:
  x = stack.pop()
  if x == n:
    break
  for y in graph[x]:
    if visited[y] == 0:
      stack.append(y)
      visited[y] = visited[x]+1
dist = visited[n]-1
way = n
while True:
  if visited[way] == dist//2+2:
    border = way
    break
  for y in graph[way]:
    if visited[y] == visited[way]-1:
      way = y
stack = [1]
visited = [0 for i in range(n+1)]
visited[border] = 1
fen = 0
while stack:
  x = stack.pop()
  fen += 1
  visited[x] = 1
  for y in graph[x]:
    if visited[y] == 0:
      stack.append(y)
snk = n-fen
if fen > snk:
  print("Fennec")
else:
  print("Snuke")

Measured memory_bytes: 80472
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#include<utility>
#include<cmath>
#include<iostream>
#include<queue>
#include<utility>
#include<string>
#define mp make_pair
#define inf 1000000000
using namespace std;
typedef long long ll;
int n,k;
ll ans;
int main(){
	//f_r_e_o_p_e_n 在洛谷中禁用！
	scanf("%d%d",&n,&k);
	if(k==0) ans = (ll)n * n;
	else
	for(int i=1;i<=n;i++){
		if(i<=k) continue;
		//余数可取：k,k+1,k+2,...,i-1.
		if(n%i<k) ans += n/i*(i-k);
		else ans += n/i*(i-k) + n%i-k+1;
	}
	printf("%lld\n",ans);
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int MAXN=1e5+7;
int l[MAXN],a[MAXN],b[MAXN],ans,n,m;
int main()
{
	cin>>n>>m;
	for(int i=1;i<=n;i++) cin>>a[i],b[a[i]]++,l[a[i]%m]++;
	for(int i=1;i<m;i++){
		int j=m-i;
		int minn=min(l[i],l[j]);
		if(i==j){
			ans+=l[i]/2;
			l[i]%=2;
			continue;
		}
		ans+=minn;
		l[i]-=minn;
		l[j]-=minn;
	}
	ans+=l[0]/2;
	l[0]%=2;
	for(int i=1;i<=100000;i++){
		while(b[a[i]]>=2){
			if(l[a[i]%m]>=2){
			 	ans++;l[a[i]%m]-=2;
			 }
			else break;
			b[a[i]]-=2;
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
int mod=998244353;
int32_t main()
{
    IOS;
    int n,k;
    cin>>n;
    int arr[n][3];
    for(int i=0;i<n;i++)
        cin>>arr[i][0]>>arr[i][1]>>arr[i][2];

    int dp1[n+1]={},dp2[n+1]={},dp3[n+1]={};
    dp1[1]=arr[0][2];
    dp2[1]=arr[0][1];
    dp3[1]=arr[0][0];

    for(int i=2;i<=n;i++)
    {
        dp1[i]=arr[i-1][2]+max(dp3[i-1],dp2[i-1]);
        dp2[i]=arr[i-1][1]+max(dp1[i-1],dp3[i-1]);
        dp3[i]=arr[i-1][0]+max(dp2[i-1],dp1[i-1]);
    }
    int ans=max(dp1[n],max(dp2[n],dp3[n]));
    cout<<ans<<endl;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n;
string str;

int main(void){
	scanf("%d",&n);
	cin >> str;
	int cnt=0;
	for(int i=1;i<n;i++){
		if(str[i]=='E')cnt++;
	}
	int ans=cnt;
	for(int i=0;i<n-1;i++){
		if(str[i+1]=='E')cnt--;
		if(str[i]=='W')cnt++;
		ans=min(ans,cnt);
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 1028
#include <algorithm>
#include <bits/stdc++.h>
#include <bitset>
#include <cassert>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <vector>
using namespace std;
#define REP(i, n) for (int64_t i = 0; i < (int64_t)n; i++)
#define REP_FOR(i, a, b) for (int64_t i = (int64_t)a; i < (int64_t)b; i++)
#define REP_REV(i, a, b) for (int64_t i = (int64_t)a; i > (int64_t)b; i--)
#define FORALL(v) (v).begin(), (v).end()
#define mp(a, b) make_pair(a, b)
#define eb(x) emplace_back(x)
#define F first
#define S second
typedef long long ll;
typedef long double ld;
typedef pair<int64_t, int64_t> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int64_t> vii;
typedef vector<vii> vvii;
const ll mod = 1e9 + 7;
const int64_t infi = 1147483600;
const ll infl = 4e18 + 5;
const char EOL = '\n';
//cout << fixed << setprecision(17) << res << endl;
const ll MOD = 998244353;
 
int main() {
    ll a, b, c;
    cin >> a >> b >> c;
    if (a == b && a != c)  cout << "Yes" << endl;
    else if (a == c && a != b)  cout << "Yes" << endl;
    else if (b == c && a != c)  cout << "Yes" << endl;
    else cout << "No" <<endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <limits.h>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <string>
#define ll long long
#define ull unsigned long long
#define ms(a) memset(a,0,sizeof(a))
#define pi acos(-1.0)
#define INF 0x7f7f7f7f
const double E=exp(1);
const int maxn=1e6+10;
const int mod=1e9+7;
using namespace std;
char ch[maxn];
int main(int argc, char const *argv[])
{
	ios::sync_with_stdio(false);
	int n;
	cin>>ch;	
	cin>>n;
	// int l=strlen(ch);
	for(int i=0;i<n;i++)
	{
		if(ch[i]!='1')
		{
			cout<<ch[i]<<endl;
			return 0;
		}
	}
	cout<<1<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
const int mod=1e9+7;
bool cmp(int a,int b)
{
	return a>b;
}
int main()
{
	int a,b,c;
	cin>>a>>b>>c;
	int ans=0;
	if(a%c==0) ans++;
		cout<<ans+b/c-a/c;
}

Measured memory_bytes: 3584
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int INF = 0x3f3f3f3f;
const double pi = acos(-1);
namespace {
  template <typename T> inline void read(T &x) {
    x = 0; T f = 1;char s = getchar();
    for(; !isdigit(s); s = getchar()) if(s == '-') f = -1;
    for(;  isdigit(s); s = getchar()) x = (x << 3) + (x << 1) + (s ^ 48);
    x *= f;
  }
}
#define fio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define _for(n,m,i) for (register int i = (n); i < (m); ++i)
#define _rep(n,m,i) for (register int i = (n); i <= (m); ++i)
#define lson rt << 1, l, mid
#define rson rt << 1 | 1, mid + 1, r
#define lowbit(x) x & (-x)
#define pii pair<int,int>
#define fi first
#define se second
set<int> se;
int main() {
  int n; read(n);
  for(int i = 0, x; i < n; i++) {
    read(x);
    se.insert(x);
  }
  if(n == se.size()) puts("YES");
  else puts("NO");
} 

Measured memory_bytes: 11648
import sys
def t(A,p,r):
 x=A[r][1];i=p-1
 for j in range(p,r):
  if A[j][1]<=x:i+=1;A[i],A[j]=A[j],A[i]
 A[i+1],A[r]=A[r],A[i+1]
 return i+1
def k(A,p,r):
 if p<r:q=t(A,p,r);k(A,p,q-1);k(A,q+1,r)
def s(A):
 for i in range(n-1):
  if A[i][1]==A[i+1][1]and A[i][2]>A[i+1][2]:return'Not s'
 return'S'
n=int(input())
A=[(e[0],int(e[2:]),i)for i,e in enumerate(sys.stdin)]
k(A,0,n-1)
print(s(A)+'table')
print('\n'.join(f'{a} {b}'for a,b,_ in A))


Measured memory_bytes: 26992
#include<stdio.h>
int main(void){
  int t,j,a[10],i;
  i=0;
  j=0;
  a[9]=0;
  t=0;

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

  for(i=0;i<9;i++)
    {
      for(j=i+1;j<10;j++)
	{
	  if(a[i]<a[j])
	    {
	      t=a[i];
	      a[i]=a[j];
	      a[j]=t;
	    }
	}
    }
  printf("%d\n%d\n%d\n",a[0],a[1],a[2]);
  
  return 0;
}

Measured memory_bytes: 0
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#define LL long long
using namespace std;
int n,m,a[100010];
LL ans=(1LL<<60),tot=0;
int pre[200010];
bool ty=true;
struct node{
    int x,k,op;//坐标，哪一个， 左/右端点
}b[400010];int num=0,len;
bool cmp(node a,node b) {return a.x<b.x;}
int main()
{
    scanf("%d %d",&n,&m);
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&a[i]);
        if(a[i]!=i) ty=false;
    }
    if(ty) {printf("%d\n",n-1);return 0;}
    len=n-1;
    for(int i=1;i<n;i++)
    {
        int l=a[i],r=a[i+1];if(l>r) l-=m;
        tot+=(LL)(r-l);
        if(l==r||l+1==r) continue;
        pre[i]=r-l-1;
        if(l>0)
        { 
            b[++num].x=l;b[num].k=i;b[num].op=0;
            b[++num].x=r;b[num].k=i;b[num].op=1;
        }
        else
        {
            l+=m;
            if(l<m-1)
            {
                pre[++len]=m-l-1;
                b[++num].x=l;b[num].k=len;b[num].op=0;
                b[++num].x=m;b[num].k=len;b[num].op=1;
            }
            b[++num].x=r;b[num].k=i;b[num].op=1;
        }
    }
    sort(b+1,b+num+1,cmp);
    int p=num,cnt=0;ans=tot;
    while(p!=0)
    {
        while(1)
        {
            if(p!=num&&b[p].x!=b[p+1].x) tot+=(LL)cnt*(LL)(b[p+1].x-b[p].x);
            if(b[p].op==1) tot-=(LL)pre[b[p].k],cnt++;
            if(b[p].op==0) cnt--,tot--;
            if(p==1||b[p-1].x!=b[p].x) break;
            p--;
        }
        ans=min(ans,tot);p--;
    }
    printf("%lld\n",ans);
}

Measured memory_bytes: 5504
from bisect import bisect
n, m, p = map(int, input().split())
a = list(map(int, input().split()))
print(min(abs(bisect(a, n, 0, len(a))-bisect(a, p, 0, len(a))),
          abs(bisect(a, 0, 0, len(a))-bisect(a, p, 0, len(a)))))

Measured memory_bytes: 3060
//おまじない
//#include <bits/stdc++.h>
//#include <stdio.h>
#include <iostream>
//#include <math.h>
#include<iomanip>
#include <map>
#include <set>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#define INF 1e9+7
#define rep(i,n) for(int i=0;i<n;i++)
#define all(a) a.begin(),a.end()
#define space ' '
#define pll pair<ll,ll>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

//(int)'a'は97 (int)'A'は65 (int)'1'は49
//おまじない

const int maxn = 100000;

int main(){
    
    int n;
    int d[maxn];
    ll ans[maxn];
    cin >> n;
    rep(i,n)cin >> d[i];
    
    ans[0]=d[n-1];
    rep(i,n-1){
        ll cnt;
        if(i%2==0)cnt = (-1)*d[i];
        else cnt = d[i];
        ans[0]-=cnt;
    }
    
    for(int j=1;j<n;j++){
        ans[j]=2*d[j-1]-ans[j-1];
    }
    
    rep(i,n)cout << ans[i]<<space;
    cout << endl;
    
    return 0;
}


Measured memory_bytes: 2432
m, d = map(int, input().split())

cnt = 0

for m in range(1, m + 1):
	for d in range(1, d + 1):
		d1 = d % 10
		d10 = d // 10
		if d1 >= 2 and d10 >= 2:
			if m == d1 * d10:
				cnt += 1

print(cnt)

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

class Dice{
    public:
        int s[6];
        void roll(char c){
            int temp;
            if(c=='E'){
                temp=s[2];
                s[2]=s[0];
                s[0]=s[3];
                s[3]=s[5];
                s[5]=temp;
            }
            if(c=='N'){
                temp=s[4];
                s[4]=s[0];
                s[0]=s[1];
                s[1]=s[5];
                s[5]=temp;
            }
            if(c=='S'){
                temp=s[1];
                s[1]=s[0];
                s[0]=s[4];
                s[4]=s[5];
                s[5]=temp;
            }
            if(c=='W'){
                temp=s[3];
                s[3]=s[0];
                s[0]=s[2];
                s[2]=s[5];
                s[5]=temp;
            }
            if(c=='R'){
                temp=s[1];
                s[1]=s[3];
                s[3]=s[4];
                s[4]=s[2];
                s[2]=temp;
            }
        }
        int top(){
            return s[0];
        }
        int front(){
            return s[1];
        }
        int right(){
            return s[2];
        }
        int left(){
            return s[3];
        }
};
bool same(Dice a,Dice b){
    bool check=true;
    for(int i=0;i<6;i++){
        if(a.s[i]!=b.s[i]){
            check=false;
        }
    }
    return check;
}
int main(){
    Dice dice[100];
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        for(int j=0;j<6;j++){
            cin>>dice[i].s[j];
        }
    }
    bool check=false;
    for(int a=0;a<n-1;a++){
        for(int b=a+1;b<n;b++){
            for(int i=0;i<4;i++){
                for(int j=0;j<4;j++){
                    if(same(dice[a],dice[b])){
                        check=true;
                    }
                    dice[b].roll('R');
                }
                dice[b].roll('N');
            }
            dice[b].roll('E');
            for(int j=0;j<4;j++){
                if(same(dice[a],dice[b])){
                    check=true;
                }
                dice[b].roll('R');
            }
            dice[b].roll('E');
            dice[b].roll('E');
            for(int j=0;j<4;j++){
                if(same(dice[a],dice[b])){
                    check=true;
                }
                dice[b].roll('R');
            }
        }
    }
    if(check){
        //同じものが含まれてる
        cout<<"No"<<endl;
    }else{
        cout<<"Yes"<<endl;
    }
    return 0;
}


Measured memory_bytes: 3100
import sys
def side(p1, p2, p3):
  y1,x1=p1
  y2,x2=p2
  y3,x3=p3
  return (x3-x1)*(y2-y1)-(x2-x1)*(y3-y1)>0
while 1:
  n=input()
  if n==0:break
  D=sorted([list(input()) for i in range(n)])
  p1=D[0]
  D1=D[:]
  while True:
    for p2 in D1:
      if p1==p2:continue
      for p3 in D[::-1]:
        if p1==p3 or p2==p3: continue
        if side(p1,p2,p3)==0:break
      else:break
    p1=p2
    D1.remove(p2)
    if p2==D[0]:break
  print len(D1)

Measured memory_bytes: 4280
"use strict";
function Main(input) {
  const N = parseInt(input);
  let ret = 0;
  for (let i = 1; (i * i) < N; i++) {
    const ic = i - 1;
    if (ic !== 0 && (N % ic) === Math.trunc(N / ic)) {
      ret += ic;
    }
    const j =Math.trunc(N / i) - 1;
    if ((N % j) === i) {
      ret += j;
    }
  }
  console.log(ret);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 21064
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
    int n, a, b; cin>>n>>a>>b;
    cout<<min(n*a, b)<<endl;
    return 0;
}

Measured memory_bytes: 764
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long 

ll  dp[22][(1<<22)];
ll mod = 1e9+7;
//int matching[21][21];
ll solve(int i,int mask,int n,vector<vector<ll>>& matching)
{
  if(i==n+1)
  {
      if(mask==0)
      return 1;
      return 0;
  }
  if(dp[i][mask]!=-1) return dp[i][mask];
  ll answer=0;
 // dp[i][mask]=0;
  for(int j=0;j<n;j++)
  {
    bool isavail =  ((mask & (1<<j)) != 0 )?1:0;
    if(matching[i][j+1]&&isavail)
    {
        //flag=1;
      answer+=(solve(i+1,mask^(1<<(j)),n,matching));
      answer%=mod;
    }
  }
 // if(flag==0)
//  return 0;
  return dp[i][mask]=answer;
}
int main()
{
    fast_io;
  ll n;
  cin>>n;
  vector<vector<ll>> matching(n+1,vector<ll>(n+1,0)) ;
  int i,j;
  for(i=1;i<=n;i++)
    for(j=1;j<=n;j++)
      cin>>matching[i][j];
  memset(dp,-1,sizeof(dp));
  cout<<solve(1,(1<<n)-1,n,matching)%mod;
  
}

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

int p(int x,int y) {
    int yy=y;
    long long X=x,count=1;
    while(yy!=0) {
    if (yy%2==1) {
        count*=X;
        count%=1000000007;
    }
    yy/=2;
    X*=X;
    X%=1000000007;
    }
    return count;
}

int main() {
   int X,Y;
   cin >> X >> Y;
   if ((X+Y)%3!=0) cout << 0 << endl;
   else {
       int Z=(X+Y)/3;
       if (Z>X || Z>Y) cout << 0 << endl;
       else {
           X-=Z,Y-=Z;
           long long count=1,x=1,y=1;
           for (int i=1; i<=Z; i++) {
               count*=i;
               count%=1000000007;
               //cout << i << " " << count << endl;
           }
           //cout << Z << endl;
           //cout << count << endl;
           for (int i=1; i<=X; i++) {
               x*=i;
               x%=1000000007;
           }
           //cout << x << endl;
           for (int i=1; i<=Y; i++) {
               y*=i;
               y%=1000000007;
           }
           //cout << y << endl;
           y=p(y,1000000005);
           x=p(x,1000000005);
           count*=x;
           count%=1000000007;
           count*=y;
           count%=1000000007;
           cout << count << endl;
       }
   }
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, p;
    cin >> a >> p;
    p += a * 3;
    cout << p / 2;
}


Measured memory_bytes: 256
// C - Pyramid
#include <bits/stdc++.h>
using namespace std;
using VI = vector<int>;
#define rp(i,n) for(int i=0;i<(n);++i)
#define manhattan(x1,y1,x2,y2) (abs((x1)-(x2))+abs((y1)-(y2)))
#define XMAX 100
#define YMAX 100

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

	VI X(N),Y(N),H(N);
	int IX = 0;
	rp(i, N){
		cin>>X[i]>>Y[i]>>H[i];
		if(H[i]>0) IX = i;
	}

	rp(y0, YMAX+1){
		rp(x0, XMAX+1){

			int h0 = H[IX] + manhattan(x0,y0, X[IX],Y[IX]);//h0: hight of center candidate

			bool exist = true;
			rp(i, N){
				int hi = max(0, h0 - manhattan(x0,y0, X[i],Y[i]));//hi: hight of (x_i, y_i)
				if(hi != H[i]){
					exist = false;
					break;
				}
			}

			if(exist){
				cout<<x0<<" "<<y0<<" "<<h0<<"\n";
				return 0;
			}

		}
	}

}

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

using namespace std;


int main()
{
	int N, X;
	cin >> N >> X;
	int pos = 0;
	int cnt = 1;
	for (int i = 0; i < N; i++)
	{
		int L;
		cin >> L;
		pos += L;
		if (pos <= X)
		{
			cnt++;
		}
	}

	cout << cnt;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 1000000007
#define rep(i, N) for(ll i = 0; i < N; i++)
#define rep2(i, j, k) for(ll i = j; i < k; i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define print(x) cout << x << "\n"
#define print2(x, y) cout << x << " " << y << "\n"
#define printv(vec) rep(lp, vec.size()) cout << vec[lp] << " "; print(""); 
#define ALL(v) v.begin(), v.end()
#define SUM(v) accumulate(ALL(v), 0)
#define MAX(v) *max_element(ALL(v))
#define MIN(v) *min_element(ALL(v))
#define SORT(v) sort(ALL(v))
#define REV(v) reverse(ALL(v))
typedef long long ll;
using namespace std;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vs = vector<string>;

const int mod = 1000000007;
class mint {
public:
    ll x;
    mint(ll x = 0) : x((x % mod + mod) % mod) {}
    mint operator-() const { 
      return mint(-x);
    }
    mint& operator+=(const mint& a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint& a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const  mint& a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint& a) const {
        mint res(*this);
        return res += a;
    }
    mint operator-(const mint& a) const {
        mint res(*this);
        return res -= a;
    }
    mint operator*(const mint& a) const {
        mint res(*this);
        return res *= a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }
    mint inv() const {
        return pow(mod - 2);
    }
    mint& operator/=(const mint& a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint& a) const {
        mint res(*this);
        return res /= a;
    }
    friend ostream& operator<<(ostream& os, const mint& m){
        os << m.x;
        return os;
    }
};

ll modpow(ll a, ll n){
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

void Main(){

	ll N;
	cin >> N;

	ll ans = 0;
	rep2(i, 1, N){
		for(ll j = 1; i * j < N; j++){
			ll c = N - i * j;
			if(c > 0){
				ans += 1;
			}
		}
	}
	print(ans);

}

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





Measured memory_bytes: 3636
#include<iostream>
#include <stdlib.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <vector>
typedef long long int ll;
using namespace std;
int main(){
	string S;
	string T;
	cin >> S >> T;
	int count[26];
	int stock[26];
	int flag[26];
	int count1[26];
	int stock1[26];
	int flag1[26];
	for(int i=0; i<26;i++){
		stock[i]=0;
		count[i]=0;
		stock1[i]=0;
		count1[i]=0;
		flag[i]=0;
		flag1[i]=0;
	}
	for(int i=0; i<S.size();i++){
		if(S[i]!=T[i]){
			if(stock[(int)T[i]-97]==0){
				stock[(int)T[i]-97]=(int)S[i];
				count[(int)T[i]-97]++;
			}else{
				if(stock[(int)T[i]-97]!=(int)S[i]){
					count[(int)T[i]-97]++;
				}
			}
		}else{
			if(flag[(int)T[i]-97]==0){
				flag[(int)T[i]-97]++;
				count[(int)T[i]-97]++;
			}
		}
			
	}
	for(int i=0; i<S.size();i++){
		if(S[i]!=T[i]){
			if(stock1[(int)S[i]-97]==0){
				stock1[(int)S[i]-97]=(int)T[i];
				count1[(int)S[i]-97]++;
			}else{
				if(stock1[(int)S[i]-97]!=(int)T[i]){
					count1[(int)S[i]-97]++;
				}
			}
		}else{
			if(flag1[(int)T[i]-97]==0){
				flag1[(int)T[i]-97]++;
				count1[(int)T[i]-97]++;
			}
		}
	}
	
	for(int i=0; i<26;i++){
		if(count[i]>=2 || count1[i]>=2){
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;		
}

Measured memory_bytes: 776
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define pii pair<int,int>
#define pll pair<lli, lli>
#define vi  vector<int>
#define vii vector<pair<int,int>>
#define vll vector<lli>
#define pb  push_back
#define mpr  make_pair
#define ss  second
#define ff  first
#define INF 1000000001
#define inf1 1000000000000000001
#define mod 1000000007
#define pie 3.14159265358979323846264338327950L
#define all(x) x.begin(),x.end()
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define testcase() int tc;cin>>tc;while(tc--)
#define clean(x) memset(x,0,sizeof(x))
const lli maxn = 1e5+9;
vector<lli> catlan(int n) {
    vector<lli> dp(n + 1, 0);
    dp[0] = 1;
    dp[1] = 1;
    for (int i = 2; i <= n; i ++) {
        for (int j = 0; j < i; ++ j) {
            dp[i] += dp[j] * dp[i - j - 1];
        }
    }
    return dp;
}
lli b_ex(lli n,lli a){lli res=1;while(n){if(n%2==1)res*=a;n>>=1;a=a*a;}return res;}
lli ncr(lli n,lli k){lli ans=1;if(k>n-k)k=n-k;for(lli i=1;i<=k;i++){ans*=(n-i+1),ans=ans/i;}return ans;}
lli power(lli a , lli n){lli ans = 1;while(n){if(n % 2)ans = (ans * a) % mod;n /= 2;a = (a * a) % mod;}return ans;}
lli set_bits(lli n)
{
    int c=0;
    if(n==0)return 0;
    while(n)
    {
        if((n&1)==1)
        {
           cout<<c<<" ";
        }
        c++;
        n=n>>1;
    }
    return c;
}
lli lcm(lli a,lli b)
{
    lli ans=(a*b)/(__gcd(a,b));
    return ans;
}
///------------------ALWAYS lli-----TEMP TSF99--------------------------------------------------------------------------------------///
int digit(lli n)
{
    int res=(int)log10(n)+1;
    return res;
}
void solve()
{
    lli n;cin>>n;
    int ans=INT_MAX;
    for(lli i=1;i<=sqrt(n);i++)
    {
        if(n%i==0)
        {
            int res=max(digit(i),digit(n/i));
            ans=min(ans,res);
        }
    }
    cout<<ans<<endl;
}
int main()
{
    FAST;solve();
    //int tc=1;cin>>t0
}



Measured memory_bytes: 3900
/*input
10 998244353
10 9 8 7 5 6 3 4 2 1
*/
#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;
typedef tree<long long, null_type, less<long long>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#pragma GCC optimize("unroll-loops,no-stack-protector")
//order_of_key #of elements less than x
// find_by_order kth element
typedef long long int ll;
#define ld long double
#define pii pair<int,int>
#define f first
#define s second
#define pb emplace_back
#define REP(i,n) for(ll i=0;i<n;i++)
#define sz(_a) (ll)(_a.size())
#define FILL(n) memset(n,INF,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
const ll maxn=2005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const ld PI=acos(-1);
const ld eps=1e-9;

ll mypow(ll a,ll b){
	if(b<=0) return 1;
    ll res=1LL;
    while(b){
        if(b&1) res=res*a%MOD;
        a=a*a%MOD;
        b>>=1;
    }
    return res;
}
int arr[maxn];
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0); 
    ll n,k;
    cin>>n>>k;
    REP(i,n){
        cin>>arr[i];
    }
    ll cnt=0,cnt2=0;
    REP(i,n){
        REP(j,n){
            if(arr[i]>arr[j]){
                if(j>i) ++cnt;
                ++cnt2;
            }
        }
    }
    cout<<(cnt*k%MOD+cnt2*(k*(k-1)/2%MOD)%MOD)%MOD;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	int x1,x2,a;
	scanf("%d %d",&x1,&x2);
	if(x1>x2){
		a=x1-x2;
	}
	else{
		a=x2-x1;
	}
	printf("%d\n",a);
	return 0;
}


Measured memory_bytes: 2120
S=input()

ans_lst=[0]*len(S)
l=['A','C','G','T']
if S[0] in l:
    ans_lst[0]=1

for i in range(1,len(S)):
    if S[i] in l:
        ans_lst[i]=ans_lst[i-1]+1

print(max(ans_lst))


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

int main(int argc, char *argv[]) {
  int s;
  std::cin >> s;
  do {
    s %= 10;
  } while (s >= 10);

  switch (s) {
  case 2:
  case 4:
  case 5:
  case 7:
  case 9:
    std::cout << "hon" << std::endl;
    break;
  case 0:
  case 1:
  case 6:
  case 8:
    std::cout << "pon" << std::endl;
    break;
  case 3:
    std::cout << "bon" << std::endl;
    break;
  }
}


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

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

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

#define int long long
#define pb push_back
#define mp make_pair
#define f(i,a,n) for(int i=a ; i<(int)n ; i++)
#define all(c) (c).begin(),(c).end()
#define F first
#define S second
#define fast ios:: sync_with_stdio(false),cin.tie(nullptr);
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef vector<pii> vpi;

const int inf = 1e9;
const int inf64 = 1e18;
const int MOD = inf + 7;
const ld PI = acos(-1.0);

int32_t main(){
	fast;
	int n;
	cin >> n;
	int cnt = 0;
	map<string,int>m;
	f(i,0,n)
	{
		string s;
		cin >> s;
		m[s]++;
		cnt = max(cnt , (int)m[s]);
	}
	
	set<string> a;
	for(auto x : m)
	{
		if(x.S == cnt)
			a.insert(x.F);
	}
	for(auto x : a)
		cout << x << "\n";
}



Measured memory_bytes: 33280
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
#define MP make_pair
#define INF (sizeof(int) == 4 ? 1e9:1e18)
#define EPS 0.0000000001
using namespace std;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
template<class T> void join(T a){int b=0;for(auto itr :a){if(b++!=0)cout << " "; cout << itr;} }
using ll  = long long;
using ld  = long double;
using pii = pair<int,int>;
using piii = pair<int,pii>;
int W,H;
int dx[]={0,0,1,-1}, dy[]={1,-1,0,0};
bool valid(int x,int y){return (0<=x&&x<W)&&(0<=y&&y<H);}
#define int ll
signed main (){
    int n;
    cin >> n;
    vector<int>v(n);
    int maxi = 40010;
    rep(i, n) {
        int p;
        cin >> p;
        v[--p] = i + 1;
    }
    vector<int> a(n), b(n);
    rep(i, n) {
        a[i] = maxi* (i + 1);
        b[i] = maxi* (n - 1 - i) + v[i];
    }
    join(a); cout << endl;
    join(b); cout << endl;
}




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

#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, n, m) for (int i = n; i < m; i++)
#define ll long long int

using namespace std;

int p[25] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 93 };
int c[25] = {};

int main()
{
  int n;
  cin >> n;
  int f = 0, t = 0, ft = 0, tf = 0, sf = 0;

  REP(j, n+1) {
    REP(i, 25) {
      int k = j;
      while(k%p[i] == 0 && k > 1) {
        c[i]++;
        k = k/p[i];
      }
    }
  }

  REP(i, 25) {
    if(c[i] >= 4) {
      f++;
    }
    if(c[i] >= 2) {
      t++;
    }
    if(c[i] >= 14) {
      ft++;
    }
    if(c[i] >= 24) {
      tf++;
    }
    if(c[i] >= 74) {
      sf++;
    }
  }


  int result = ((f*(f-1))/2)*(t-2) + ft*(f-1) + tf*(t-1) + sf;
  cout << max(result, 0) << endl;
}


Measured memory_bytes: 256
N,X,Y=map(int,input().split())

X-=1
Y-=1

dist=[0]*(N+1)


for i in range(N):
    for j in range(i+1,N):
        dist[(min(abs(i-j),abs(i-Y)+abs(X-j)+1,abs(i-X)+abs(Y-j)+1))]+=1
for d in range(1,N):
    print(dist[d])
    
    

Measured memory_bytes: 3444
N = int(input())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]

ans = 0
for i in range(N):
    ans += B[A[i]-1]
    if i >= 1:
        if A[i] == A[i-1]+1:
            ans += C[A[i-1]-1]

print(ans)


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

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<=(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define Eback(s) s.erase(s.end()-1,s.end())
#define rev(v) reverse(all(v))
#define minvec(v) *min_element(all(v))
#define maxvec(v) *max_element(all(v))
#define sumvec(v) accumulate(all(v),0LL)
#define mapmin(v) v.rbegin()->first
#define mapmax(v) v.begin()->first
#define pb push_back
#define pf push_front
#define m_p make_pair
#define DOUBLE fixed << setprecision(15)
#define OK cerr<<"OK\n"
#define OK1 cerr<<"OK1\n"
#define OK2 cerr<<"OK2\n"
#define SIZE(s) (int)s.size()
#define INF ((1LL<<62)-(1LL<<31))
#define zero(x,n) setw(x) << setfill('0') << n
#define endl '\n'

typedef long long ll;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<string> vs;

typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;
typedef vector<pair<ll,ll>> vpll;

const double pi = acos(-1.0);
const ll mod=1000000007;
const ll mod2=998244353;

template<class A, class B>
ostream& operator<<(ostream& ost, const pair<A, B>&p) {
	ost << "{" << p.first << ", " << p.second << "} ";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost, const vector<T>&v) {
	ost << "{";
	for (int i = 0; i<(int)v.size(); i++) {
		if (i)ost << " ";
		ost << v[i];
	}
	ost << "} \n";
	return ost;
}

template<class A, class B>
ostream& operator<<(ostream& ost, const map<A, B>&v) {
	ost << "{";
	for (auto p:v) {
		ost << "{" << p.first << ", " << p.second << "} ";
	}
	ost << "} ";
	return ost;
}

template<class T>
inline bool chmax(T& a, T b){if(a<b){a=b;return true;} return false;}

template<class T>
inline bool chmin(T& a, T b){if(a>b){a=b;return true;} return false;}

void YES(bool b) {cout << ((b)?"YES\n":"NO\n");}
void Yes(bool b) {cout << ((b)?"Yes\n":"No\n");}
void yes(bool b) {cout << ((b)?"yes\n":"no\n");}
void Yay(bool b) {cout << ((b)?"Yay!\n":":(\n");}

ll powmod(ll a,ll b){ll c=1; while(b>0){ if(b&1){ c=a*c%mod; } a=a*a%mod; b>>=1; } return c;}
ll gcd(ll x, ll y) {return __gcd(x,y);}
ll lcm(ll x, ll y) {return x/__gcd(x,y)*y;}

int main()
{
	ll n;
	map<string,ll> m;
	cin >> n;
	rep(i,n){
		string s;
		cin >> s;
		m[s]=1;
	}
	cout << m.size() << endl;
	return 0;
}

Measured memory_bytes: 19260
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int X,Y,A,B,C;
  cin>>X>>Y>>A>>B>>C;
  vector<pair<int,int>> D(A+B+C);
  for(int i=0;i<A;i++){
    int p;
    cin>>p;
    D[i]=make_pair(p,0);
  }
  for(int i=0;i<B;i++){
    int q;
    cin>>q;
    D[A+i]=make_pair(q,1);
  }
  for(int i=0;i<C;i++){
    int r;
    cin>>r;
    D[A+B+i]=make_pair(r,2);
  }
  sort(D.begin(),D.end());
  reverse(D.begin(),D.end());
  int c=0,r=0,g=0,j=0;
  for(pair<int,int> p:D){
    if(p.second==2){
      c++;
      j+=p.first;
    }else if(p.second==0){
      if(r<X){
        r++;
        j+=p.first;
      }
    }else if(g<Y){
      g++;
      j+=p.first;
    }
    if(c+r+g==X+Y){
      cout<<j<<endl;
      return 0;
    }
  }
}

Measured memory_bytes: 7924
#include <stdio.h>

long long nl[21];

long long nkai(int n){
	if(nl[n] != 0){
		return nl[n];
	}
	nl[n] = n * nkai(n - 1);
	return nl[n];
}

int main(void){
	int n = 0;
	for(int i=0; i<21; ++i){
		nl[i] = 0;
	}
	nl[0] = nl[1] = 1;

	scanf("%d", &n);
	printf("%lld\n", nkai(n));
	return 0;
}

Measured memory_bytes: 0