akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <math.h>
#include <string>
#include <string.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <stdlib.h>
#include <deque>  
#include <iomanip>

using namespace std;

#define INF 1e9
#define MOD 1e9 + 7
#define rep(i, n) for(int i = 0; i < n; i++)
#define loop(i, a, n) for(int i = a; i < n; i++)
#define all(in) in.begin(), in.end()

long long gcd(long long a, long long b){
    if(b == 0) return a;
    return gcd(b, a%b);
}
long long lcm(long long num1, long long num2){
    long long out = gcd(num1, num2);
    return num1 / out * num2;
}
int main(){
    int N;
    cin >> N;
    vector<long long> T(N);
    rep(i, N) cin >> T[i];
    long long ans = T[0];
    for(int i = 1; i < N; i++) ans = lcm(ans, T[i]);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
//cod2016_final_a.cpp
//Sat Oct 20 22:14:51 2018

#include <iostream>
#include <string>
#include <queue>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;

int main(){
	int h,w;
	cin >> h >> w;

	string a[h][w];
	for (int i=0;i<h;i++){
		for (int j=0;j<w;j++){
			cin >> a[i][j];
			if (a[i][j] == "snuke"){
				char x = 'A';
				x = x + j;
				cout << x << i+1<<endl;
			}
		}
	}
}

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

#define REP(i,num) for(ll i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=ll>
T in(){T x; cin >> x; return (x);}
template<typename T=ll,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);

	int A=in(),B=in(),H=in(),M=in();
	double pi2 = atan(1)*8.0;
	double thetaA = (H+(M/60.0))/12.0*pi2;
	double thetaB = M/60.0*pi2;
	double theta = abs(thetaA-thetaB);
	if(theta>=pi2/2) theta=pi2-theta;
	double c = cos(theta);
	out(sqrt(A*A+B*B-2*A*B*c));
	return 0;
}


Measured memory_bytes: 4188
#include<bits/stdc++.h>
#define REP(x,y,z) for(int x=y;x<=z;x++)
#define MSET(x,y) memset(x,y,sizeof(x))
#define M 
using namespace std;
int main()
{
    int a,p;
    while (~scanf("%d %d", &a,&p)) {
        printf("%d\n", (3*a+p)/2);
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
 
const int maxV = 90010;
const int maxN = 1e5+10;
const int inf = 0x3f3f3f3f;
const ll MOD = 1e9+7;
const ll INF = 1000000000000000010LL;
#define X first
#define Y second


int a[maxN];
int f[maxN];
int tot = 0;
int n;


int main() {
	int x;
	scanf("%d",&x);
	a[1] = 100;
	for(int i=2;i<=6;i++)
	{
		a[i] = a[i-1]+1;
	}
	f[0] = 1;
	for(int i=1;i<=6;i++)
	{
		f[a[i]] = 1;
	}
	for(int i=1;i<=x;i++)
	{
		for(int j=1;j<=6;j++)
		{
			int y = a[j];
			if(i-y>=0)
			{
				f[i] |= f[i-y];
			}
		}
	}
	printf("%d\n",f[x]);
	return 0;
}

Measured memory_bytes: 640
//ΔATCODER QUALC C
#include<iostream>
#include<cstdio>
#include<fstream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<cmath>
#include<cstring>
#include<cstdlib>
using namespace std;
typedef long long LL;
char ch[111111];
int main()
{
	int n,i,j,ans;
	cin>>ch;
	n=strlen(ch);
	i=0,j=n-1;
	ans=0;
	while(i<j){
		if(ch[i]==ch[j]){
			i++;
			j--;
			continue;
		}
		if(ch[i]=='x'){
			i++;
			ans++;
			continue;
		}
		if(ch[j]=='x'){
			j--;
			ans++;
			continue;
		}
		cout<<-1<<endl;
		return 0;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <limits>
#include <queue>
#include <iomanip>
#include <set>
//#include <bits/stdc++.h>

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

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

using namespace std;
#define ALL(X) X.begin(),X.end()
using ll = long long int;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
const int MOD=1000000007;
//const int MOD=998244353;
const int INTMAX=2147483647;
const ll LLMAX=9223372036854775807;

ll GCD(ll a, ll b) {
  if(a < b) return GCD(b, a);
  ll r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

ll LCM(ll a,ll b){
    return a/GCD(a,b)*b;
}


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    ll N;
    cin>>N;
    vll T(N);
    for(ll i=0;i<N;i++)cin>>T[i];
    if(N==1){
        cout<<T[0]<<endl;
        return 0;
    }
    ll ans=LCM(T[0],T[1]);
    for(ll i=2;i<N;i++){
        ans=LCM(ans,T[i]);
    }
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define repi(i,a,b) for(int i=(a), i##_len=(b); i<i##_len; ++i)
#define rep(i,n) repi(i,0,n)
#define repi_(i,a,b) for(int i=(a), i##_len=(b); i<=i##_len; ++i)
#define rep_(i,n) repi_(i,0,n)
#define all(x) (x).begin(),(x).end()
#define vsort(v) sort((v).begin(), (v).end())
#define gsort(v) tsort(v); reverse((v).begin(), (v).end())
#define vrev(v) reverse((v).begin(), (v).end())
#define siz(v) ((int)(v).size())
#define ers(v, n) (v).erase((v).begin() + n)
#define cnt(v, n) count(all(v), n)
#define vmin(v) *min_element(v.begin(), v.end())
#define vmax(v) *max_element(v.begin(), v.end())
#define el "\n"
#define co(x) cout<<(x)<<el
#define coc(c, a, b) if(c)co((a));else co((b))
#define cosp(x) cout<<(x)<<' '
#define YES(c) coc(c,"YES", "NO")
#define Yes(c) coc(c,"Yes", "No")
#define yes(c) coc(c,"yes", "no")
#define POSSIBLE(c) coc(c, "POSSIBLE", "IMPOSSIBLE")
#define Possible(c) coc(c, "Possible", "Impossible")
#define possible(c) coc(c, "possible", "impossible")
#define inf INT_MAX
#ifdef tqktmp_2
#define gc() getchar(); getchar()
#else
#define gc() 1
#endif
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))


typedef long long lint;

lint dx[8] = { 0,1,1,1,0,-1,-1,-1 },
dy[8] = { 1,1,0,-1,-1,-1,0,1 };

template<class T>inline bool maxi(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>inline bool mini(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }



int main() {
	cin.tie(0);
	ios::sync_with_stdio(0);
	
	lint n, in; cin >> n;
	vector<lint> a;
	
	a.push_back(0);
	lint sum = 0;

	repi(i, 1, n+1) {
		cin >> in;
		a.push_back(in);
		sum += abs(a[i] - a[i - 1]);
	}
	a.push_back(0);
	sum += abs(in);

	repi(i, 1, n+1) {
		co(sum - abs(a[i] - a[i - 1]) - abs(a[i + 1] - a[i]) + abs(a[i + 1] - a[i - 1]));
	}

	gc();
}

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

#define rp(i, k, n) for (int i = k; i < n; i++)
typedef long long ll;

ll mod = 1e9 + 7;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll inf = 1ll << 60;


int main() {
    int n;
    scanf("%d", &n);
    int m = (n+1) / 2;
    vector<double> p(n);
    rp(i, 0, n) scanf("%lf", &p.at(i));
    vector<vector<double>> dp(3010, vector<double>(2010));
    //dp.at(i).at(j)は、i枚目(1~n)まで考えたときに表がj枚出る確率
    //ただしdp.at(i).at((n-1)/2)はi枚目まで考えたときに表が(n-1)/2枚出ている確率
    dp.at(0).at(0) = 1.0;
    rp(i, 0, n) {
        rp(j, 0, m) {
            dp.at(i+1).at(j) += dp.at(i).at(j) * (1.0-p.at(i));
            dp.at(i+1).at(j+1) += dp.at(i).at(j) * p.at(i);
        }
        dp.at(i+1).at(m) += dp.at(i).at(m);
    }
    printf("%.16f", dp.at(n).at(m));
    return 0;
} 

Measured memory_bytes: 47616
#include <iostream>
#include <climits>
#include <stack>
#include <queue>
#include <string>
#include <random>
#include <utility>
#include <cmath>
#include <string.h>
#include <iomanip>
#include <stdlib.h>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
long long int INF = 1e18;
double Pi = 3.141592653589;
const int mod = 1000000007;
// memset(a,0,sizeof(a)); →全部０にする
 
struct edge{int to,cost;};
vector<int> G[100005];
 
int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
 
std::vector<P> tree[100010];
ll i,j;

ll n,m,ans=0;
ll a,b,c,k,nom,num;

int main(){
	cin>>n>>k;
	for(b=k+1;b<=n;b++){
		nom = ((n-k)/b)+1;
		num = (nom-1)*b+k;
		num += b-k-1;
		if(num>n && k!=0){
			ans += nom*(b-k)-num+n;
		}else if(k!=0){
			ans += nom*(b-k);
		}
		if(k==0){
			ans += n;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 3e2+7;
const ll mod = 1e9 + 9;
#define afdafafafdafaf y1;
int ar[maxn], n, m, k;
vector<pair<int,int>> g[maxn];
struct node{
    int a,b,c;
    node(int x = 0,int y = 0,int z = 0){
        a = x;
        b = y;
        c = z;
    }
    bool operator < (const node& n1) const {
        return (a > n1.a) || (a == n1.a && b < n1.b);
    }
};
priority_queue<node> qu;
int ans[maxn][maxn], vis[maxn], cc[maxn], dd[maxn];
void solve(int x){
    memset(vis, 0, sizeof(vis));
    memset(cc, -1, sizeof(cc));
    memset(dd, -1, sizeof(dd));
    while(qu.size())qu.pop();
    qu.push(node(0, k, x));
    while(!qu.empty()){
        node mid = qu.top();qu.pop();
        int u = mid.c;
        int cost = mid.a, dis = mid.b;
        if(vis[u])continue;
        vis[u] = 1;
        ans[x][u] = cost;
        for(int i=0; i<g[u].size();i++){
            int v = g[u][i].first, dis_v = g[u][i].second;
            int x = -1, y;
            if(dis >= dis_v){
                x = cost;
                y = dis - dis_v;
            }
            else if(k >= dis_v){
                x = cost + 1;
                y = k - dis_v;
            }
            else{
                continue;
            }
            if((x < cc[v] || cc[v] == -1) || (x == cc[v] && y > dd[v])){
                qu.push(node(x, y, v));
                cc[v] = x;
                dd[v] = y;
            }
        }
    }
}
int main()
{
    memset(ans, -1, sizeof(ans));
    scanf("%d%d%d", &n, &m, &k);
    for(int i=1;i<=m;i++){
        int a,b,c;
        scanf("%d%d%d", &a, &b, &c);
        g[a].push_back(make_pair(b, c));
        g[b].push_back(make_pair(a, c));
    }
    for(int i=1;i<=n;i++){
        solve(i);
    }
    int q;scanf("%d", &q);
    while(q--){
        int s,t;scanf("%d%d", &s, &t);
        printf("%d\n", ans[s][t]);
    }

    return 0;
}


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

int main(){

    int n;
    cin>>n;
    ll sum = 0;
    map<ll, ll>cnt;
    cnt[0]=1;
    ll ans = 0;
    for(int i=0;i<n;i++){
        ll tmp;
        cin>>tmp;
        sum += tmp;
        ans += cnt[sum];
        cnt[sum]++;
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 12800
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <vector>

#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define all(v) begin(v), end(v)
#define debug(x) cerr<< #x <<": "<<x<<endl
#define debug2(x,y) cerr<< #x <<": "<< x <<", "<< #y <<": "<< y <<endl

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vll;
typedef vector<vector<ll> > vvll;
template<class T> using vv=vector<vector< T > >;

int mod = 1e9 + 7;
int n;
vi x, a;

int main() {
  scanf("%d", &n);
  x.resize(n);
  a.resize(n);
  rep (i, n) {
    scanf("%d", &x[i]);
    a[i] = i;
  }
  x[0] = 1;
  FOR (i, 1, n) {
    if (x[i-1] % 2 == 0) {
      x[i] = min(x[i], x[i-1] + 1);
    } else {
      x[i] = min(x[i], x[i-1] + 2);
    }
  }
  ll ans = 1;
  int cnt = 0;
  rep (i, n) {
    if (x[i] % 2 == 0) {
      ans = ans * (i + 1 - cnt) % mod;
      cnt += 1;
    }
  }

  FOR (i, 1, n - cnt + 1) {
    ans = ans * i % mod;
  }
  printf("%lld\n", ans);

  return 0;
}


Measured memory_bytes: 1024
<?php 
fscanf(STDIN, "%s", $s);
  $array = str_split($s);
  if($array[0] === $array[1] && $array[2] === $array[3] && $array[1] !== $array[2]){
      echo 'Yes';
  }elseif($array[0] === $array[2] && $array[1] === $array[3] && $array[0] !== $array[1]){
      echo 'Yes';
  }elseif($array[0] === $array[3] && $array[1] === $array[2] && $array[0] !== $array[1]){
      echo 'Yes';
  }else{
      echo 'No';
  }
  ?>

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

using namespace std;
using ll = long long;
using ii = pair<ll, ll>;

const int MAX { 200010 };
const ll MOD { 1000000007 }, oo { 1LL << 62 };

ll solve(int N, int K, vector<ll>& xs)
{
    if (K >= N)
        return 0;

    sort(xs.begin(), xs.end());

    ll ans = accumulate(xs.begin(), xs.end() - K, 0LL);
     
    return ans;
}

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

    int N, K;
    cin >> N >> K;

    vector<ll> xs(N);

    for (int i = 0; i < N; ++i)
        cin >> xs[i];

    auto ans = solve(N, K, xs);

    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 1792
import bisect
n,m =map(int,input().split())
A = list(map(int,input().split()))
A.sort()
C = []
for i in range(m):
    b,c = map(int,input().split())
    C.append([b,c])
C.sort(key=lambda x:x[1],reverse=True)

c = 0
for i in range(n):
    if c>=m:
        break
    if A[i] < C[c][1]:
        A[i] = C[c][1]
        C[c][0] -= 1
    if C[c][0] == 0:
        c+=1 
print(sum(A))


Measured memory_bytes: 25624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define all(x) (x).begin(), (x).end()
ll inf = LLONG_MAX;
long double pi = M_PI;
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

int main() {
  ll h, w, n;
  cin >> h >> w >> n;

  vll a(n);
  for (ll i = 0; i < n; i++) cin >> a[i];

  ll y = 0, x = 0;
  vector<vll> grid(h, vll(w));
  for (ll i = 0; i < n; i++) {
    for (ll j = 0; j < a[i]; j++) {
      grid[y][x] = i + 1;
      x++;
      if (x == w) {
        x = 0;
        y++;
      }
    }
  }

  for (ll i = 1; i < h; i += 2) reverse(all(grid[i]));

  for (ll i = 0; i < h; i++) {
    for (ll j = 0; j < w - 1; j++) cout << grid[i][j] << " ";
    cout << grid[i][w - 1] << endl;
  }
}

Measured memory_bytes: 512
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

ll dp[444][444];

ll a[444],s[444];

ll rec(int x,int y){
    if(dp[x][y]!=0)return dp[x][y];
    if(x==y)return 0;
    if(y==x+1)return 0;
    ll ret=longinf;
    REP(i,x+1,y){
        ret=min(ret,rec(x,i)+rec(i,y));
    }
    REP(i,x,y)ret+=a[i];
    return dp[x][y]=ret;
}

int main(){
    int n;
    cin>>n;
    rep(i,n)cin>>a[i];
    cout<<rec(0,n)<<endl;

    return 0;
}

Measured memory_bytes: 1664
N = int(input())
A,B,*C = list(map(int,input().split()))
X = 0
for c in C:
    X ^= c
S = A+B

K = 43
dp = [[[-1]*2 for _ in range(2)] for _ in range(K)]
dp[0][0][0] = 0

for i in range(K-1):
    cx = (X>>i)&1
    cs = (S>>i)&1
    ca = (A>>i)&1
    for j in range(2):
        for k in range(2):
            if dp[i][j][k] == -1: continue
            for na in range(2):
                nb = na^cx
                ns = na+nb+j
                if ns%2 != cs: continue
                nj = ns//2
                if ca < na:
                    nk = 1
                elif ca == na:
                    nk = k
                else:
                    nk = 0
                dp[i+1][nj][nk] = max(dp[i+1][nj][nk], dp[i][j][k] + 2**i * na)
a = dp[-1][0][0]
if a==0 or a==-1:
    print(-1)
else:
    print(A - a)

Measured memory_bytes: 9184
import fractions
import sys

sys.setrecursionlimit(10000)
INF = float('inf')


def inp():
    return int(input())


def inl():
    return list(map(int, input().split()))


def cumgcd(it):
    """
    累積 gcd
    :param collections.Iterable it:
    :return:
    """
    ret = []
    gcd = 0
    for a in it:
        gcd = fractions.gcd(gcd, a)
        ret.append(gcd)
    return ret


N = inp()
A = inl()

cum_L = cumgcd(A)
cum_r = list(reversed(cumgcd(reversed(A))))

ans = max(cum_L[-2], cum_r[1])
for i in range(1, N - 1):
    ans = max(ans, fractions.gcd(cum_L[i - 1], cum_r[i + 1]))
print(ans)


Measured memory_bytes: 16512
#include<stdio.h>
#include<string.h>


int main(){
    int n,i,j;
    char mozia[100],mozib[100];
    int numa[100],numb[100];
    int flag=0;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf(" %c%d",&mozia[i],&numa[i]);
        strcpy(&mozib[i],&mozia[i]);
        numb[i]=numa[i];
    }
    //Bubble
    char tempa;
    int tempb;
    for(i=0;i<n;i++){
        for(j=0;j<n;j++){
            if(numa[j-1]>numa[j]){
                tempa=mozia[j];
                mozia[j]=mozia[j-1];
                mozia[j-1]=tempa;
                tempb=numa[j];
                numa[j]=numa[j-1];
                numa[j-1]=tempb;
            }
        }
    }
    for(i=0;i<n;i++){
        if(i!=0)printf(" ");
        printf("%c%d",mozia[i],numa[i]);
    }
    printf("\nStable\n");
    
    //Select
    int minj;
    for(i=0;i<n;i++){
        minj=i;
        for(j=i;j<n;j++){
            if(numb[j]<numb[minj])minj=j;
        }
        tempa=mozib[i];
        mozib[i]=mozib[minj];
        mozib[minj]=tempa;
        tempb=numb[i];
        numb[i]=numb[minj];
        numb[minj]=tempb;
    }
    for(i=0;i<n;i++){
        if(i!=0)printf(" ");
        printf("%c%d",mozib[i],numb[i]);
    }
    printf("\n");
    for(i=0;i<n;i++){
        if(mozia[i]!=mozib[i])flag=1;
    }
    if(flag==1)printf("Not stable\n");
    else printf("Stable\n");
    
    return 0;
}



Measured memory_bytes: 2052
#include <iostream>

using namespace std;

int main() {

  int n, limit;
  int minc = 1001;

  cin >> n >> limit;


  for (int i = 0; i < n; i++) {
    int c, t;
    cin >> c >> t;

    if (minc > c && t <= limit)
      minc = c;
  }


  if (minc == 1001)
    cout << "TLE";
  else
    cout << minc;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define all(i) i.begin(), i.end()
template<class T, class U> bool cmax(T& a, U b) { if (a<b) {a = b; return true;} else return false; }
template<class T, class U> bool cmin(T& a, U b) { if (a>b) {a = b; return true;} else return false; }

// http://noshi91.hatenablog.com/entry/2019/03/31/174006
template <uint_fast64_t Mod>
struct modint {
  using u64 = uint_fast64_t;

  u64 n;

  modint(const u64 x = 0) : n(x % Mod) {}
  modint operator+(const modint r) const { return modint(*this) += r; }
  modint operator-(const modint r) const { return modint(*this) -= r; }
  modint operator*(const modint r) const { return modint(*this) *= r; }
  modint operator/(const modint r) const { return modint(*this) /= r; }
  modint &operator+=(const modint r) {
    n += r.n;
    if (n >= Mod) n -= Mod;
    return *this;
  }
  modint &operator-=(const modint r) {
    if (n < r.n) n += Mod;
    n -= r.n;
    return *this;
  }
  modint &operator*=(const modint r) {
    n = n * r.n % Mod;
    return *this;
  }
  modint &operator/=(modint r) {
    n = n * inv();
    return *this;
  }
  modint pow(u64 x) const {
    modint<Mod> ret(1), tmp(*this);
    while (x) {
      if (x&1) ret *= tmp;
      tmp *= tmp;
      x >>= 1;
    }
    return ret;
  }
  modint inv() const {
    return pow(Mod-2);
  }
};

// T modint
template<class T>
struct Combination {
  vector<T> fact, inv_fact;
  Combination(ll n) : fact(n+1), inv_fact(n+1) {
    fact[0] = T(1);
    for (ll i = 1; i <= n; i++) fact[i] = fact[i-1] * static_cast<T>(i);
    inv_fact[n] = fact[n].inv();
    for (ll i = n; i > 0; i--) inv_fact[i-1] = inv_fact[i] * static_cast<T>(i);
  }

  T P(ll n, ll k) const {
    return fact[n] * inv_fact[n-k];
  }

  T C(ll n, ll k) const {
    return fact[n] * inv_fact[n-k] * inv_fact[k];
  }

  T H(ll n, ll k) const {
    return C(n+k-1, n-1);
  }
};

map<ll, ll> PrimeFactorization(ll n) {
  map<ll, ll> m;
  for (int i = 2; i*i <= n; i++) {
    while (n%i == 0) {
      m[i]++;
      n /= i;
    }
  }
  if (n != 1) m[n]++;
  return m;
}

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

  constexpr ll mod = 1e9+7;
  using mint = modint<mod>;

  mint n, m;
  cin >> n.n >> m.n;

  mint ans = 1;
  Combination<mint> c(1000000);
  auto ma = PrimeFactorization(m.n);

  for (auto &i : ma) {
    ans *= c.H(n.n, i.second);
  }

  cout << ans.n << endl;
}


Measured memory_bytes: 15872
#include <string.h>
#include <stdlib.h>

#include <cstdio>
#include <string>
#include <iostream>
#include <cstdlib>
#include <tuple>
#include <typeinfo>
#include <algorithm>
#include <vector>
#include <iomanip>

using namespace std;

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

	int n=s.length();
	bool ans=false;

	for(int i=0;i<=n;i++){
		for(int j=i;j<=n;j++){
			string t=s.substr(0,i)+s.substr(j);
			if(t=="keyence") ans=true;
		}
	}

	if(ans) cout<<"YES";
	else cout<<"NO";

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
const int INF = 1000000000;
const long INF64 = 1000000000000000ll;
const int MOD = 1000000007;
int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}
int main(){
	int	w,h,n;
	std::cin >> w>>h>>n;
	
	std::vector<int> x(n),y(n),a(n);
	rep(i,n)std::cin >> x[i]>>y[i]>>a[i];
	std::vector<std::vector<bool> > han(w,std::vector<bool> (h));
	rep(i,w)rep(j,h)han[i][j]=1;
	rep(i,n){
		if(a[i]==1){
			rep(k,x[i])rep(j,h)han[k][j]=0;
		}
		if(a[i]==2){
			for (int k = x[i]; k < w; k++) {
				/* code */
				rep(j,h)han[k][j]=0;
			}
		}
		if(a[i]==3){
			rep(k,w)rep(j,y[i])han[k][j]=0;
		}
		if(a[i]==4){
			for (int k = y[i]; k < h; k++) {
				/* code */
				rep(j,w)han[j][k]=0;
			}
		}
	}
	int counter=0;
	rep(i,w)rep(j,h)if(han[i][j])counter++;
	std::cout << counter << std::endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n)    for(long long i = 0; i < (n) ; ++i)
#define orep(i,n)   for(long long i = 1; i <= (n); ++i)   // one rep
#define drep(i,n)   for(long long i = (n)-1; i >= 0; --i) // down rep
#define srep(i,s,t) for(long long i = (s); i < (t); ++i)  // set rep
#define rng(x)  (x).begin(),(x).end()

  // range
#define rrng(a) (a).rbegin(),(a).rend() // reverse range
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define ru(x,y) (((x)+(y)-1)/(y)) // round up
#define fi first
#define se second
#define eb emplace_back
#define fcout cout << fixed << setprecision(15)


using namespace std;
using ll  = long long;
using P   = pair<int,int>;
using vi  = vector<int>;
using vvi = vector<vi>;
using vp  = vector<P>;
using vl  = vector<ll>;

template<typename T> void Yes(T flag) {
  cout << (flag ? "Yes" : "No") << endl;
}

template<typename T> void pv(vector<T> vec) {
  cout << "[";
  for(auto& v : vec) { cout << v << ","; }
  cout << "]" << endl;
}

template<>
void pv(vector<P> vec) {
  cout << "[";
  for(auto& v : vec) {
    cout << "<" << v.fi << ","<< v.se << ">" << ",";
  }
  cout << "]" << endl;
}

template<typename T> void pv2(vector<vector<T>> vec) {
  for(auto& v : vec) pv(v);
}

int main() {
  int x;
  cin >> x;
  if(x==2) {
  cout << 2 << endl;
  return 0;
}
  while(true) {
    bool flag =true;
    srep(i,2,sqrt(x)+1) {
      if(x%i==0) {
        flag=false;break;
      }
    }
    if(flag) break;
    x++;
  }
  cout << x << endl;

  return 0;
}


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

int main(){
	int N;
	int A;

	cin >> N;
	cin >> A;
	if (N >= 1 && N <= 10000){
		if(A >= 0 && A <= 1000){
			if ((N % 500) <= A){
				cout << "Yes" << endl;
			} else { 
      			cout << "No" << endl;
    		}
		}else{
			cout << "No" << endl;
    	}
	}else{
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<utility>
#include<tuple>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

#define BIL ((ll)1e9)
#define MOD ((ll)1e9+7)
#define INF (1LL<<60)           //1LL<<63でオーバーフロー
#define inf (1<<29)             //1<<29でオーバーフロー

int main(int argc,char* argv[]){
    string s;
    cin >> s;
    int n=s.size();

    int right=n-1;
    ll ans=0;
    for(int i=n-1;i>=0;i--){
        if(s[i]=='B'){
            ans+=right-i;
            right--;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3728
import java.math.BigInteger;
import java.util.*;

public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    BigInteger k = new BigInteger(sc.next());
    List<Integer> a = new ArrayList<>();
    for (int i = 0; i < n; i++) {
      a.add(sc.nextInt() - 1);
    }

    int mInt = 200001;
    BigInteger m = new BigInteger(Integer.toString(mInt));
    int p = 0;
    if (k.compareTo(m) <= 0) {
      int kInt = k.intValue();
      for (int i = 0; i < kInt; i++) {
        p = a.get(p);
      }
      System.out.println(p + 1);
      return;
    }
    Map<Integer, Integer> cMap = new HashMap<>();
    int startLoop = 0;
    int startTown = 0;
    int loopCount = 0;
    for (int i = 1; i <= mInt; i++) {
      p = a.get(p);
      Integer c = cMap.get(p);
      if (c != null) {
        startLoop = c;
        startTown = p;
        loopCount = i - c;
        break;
      }
      cMap.put(p, i);
    }
    int r = k.subtract(new BigInteger(Integer.toString(startLoop - 1))).mod(new BigInteger(Integer.toString(loopCount))).intValue();
    p = startTown;
    for (int i = 0, len = (r == 0 ? loopCount : r) - 1; i < len; i++) {
      p = a.get(p);
    }
    System.out.println(p + 1);
  }
}


Measured memory_bytes: 70832
#include <iostream>
using namespace std;
int main()
{
    int h,n,a;
    cin >> h >> n;
    for (int i=0; i<n; i++){
        cin>>a;
        h-=a;
    }
    if(h<=0){
        cout<<"Yes"<<endl;
    }
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7 
#mod = 998244353
from decimal import *
#import numpy as np
#decimal.getcontext().prec = 10

s = input()

dic = defaultdict(list)

for i, x in enumerate(s, 1):
	dic[x].append(i)

for lis in dic.values():
	for i in range(len(lis)-1):
		if lis[i+1] <= lis[i]+2:
			print(lis[i], lis[i+1])
			break
	else:
		continue
	break
else:
	print(-1, -1)

Measured memory_bytes: 14820
#include <iostream>
#include <vector>
#include <map>
#include <queue>
#include <cmath>
#include <algorithm>
#include <bitset>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <cstdlib>
#include <stack>
#include <random>

using namespace std;

typedef long long ll;


int a[30], b[30];


int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    string s;
    cin >> n >> s;
    int w = 0, e = 0;
    for (int i = 0; i < n; i++)
    {
        if (s[i] == 'E')
            e++;
    }
    int ans = 1000000000;
    for (int i = 0; i < n; i++)
    {
        if (s[i] == 'E')
            e--;
        ans = min(ans, w + e);
        if (s[i] == 'W')
            w++;
    }
    cout << ans;
    return 0;
}
















Measured memory_bytes: 720
import fractions
import math


def is_prime(n):
    if n == 1:
        return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True


a, b = map(int, input().split())
res = 1
n = fractions.gcd(a, b)


def make_divisors(n):
    divisors = []
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n // i)

    # divisors.sort()
    return divisors


ln = make_divisors(n)
for i in ln:
    if is_prime(i):
        res += 1

print(res)


Measured memory_bytes: 5304
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=n-1;i>=(0);i--)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define all(v) (v).begin(),(v).end()
#define eall(v) unique(all(v), v.end())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll INFF = 1e18;

int n, d, x;
int p[12][12];
int dp[12][100010];

int main(void) {
	cin >> n >> d >> x;
	rep(i, d)rep(j, n) cin >> p[i][j];
	rep(i, d) p[i][n] = 1;
	n++;
	for (int i = 0; i < d - 1; ++i) {
		rep(l, 12)rep(k, 100010) dp[l][k] = 0;

		for (int j = 0; j < n; ++j) {
			for (int k = 0; k <= 100000; ++k) {
				if(k < p[i][j]) dp[j + 1][k] = dp[j][k];
				else dp[j + 1][k] = max(dp[j][k], dp[j + 1][k - p[i][j]] + p[i + 1][j]);
			}
		}
		// rep(j, n)rep(k, 10) printf("dp[%d][%d] = %d\n", j, k, dp[j][k]);
		int tmp = 0;
		rep(j, x + 1) chmax(tmp, dp[n][j]);
		x = max(x, tmp);

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

Measured memory_bytes: 7860
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

const int MOD = 1000000007, INF = 1111111111;
using namespace std;
using lint = long long;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (int i = 0; i < (int)vec.size(); i++) {
		os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	}
	return os;
}

#ifdef _DEBUG
template <class Head>
void dump(const char* str, Head &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + 1, t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	string S , T;
	cin >> S >> T;
	int slen = (int)S.size();
	int tlen = (int)T.size();

	auto cmp = [](string lhs, string rhs) {
		assert(lhs.size() == rhs.size());
		bool res = true;
		for (int i = 0; i < (int)lhs.size(); i++) {
			if (lhs[i] != rhs[i] && lhs[i] != '?') res = false;
		}
		return res;
	};

	bool flag = true;
	for (int i = slen - tlen; i >= 0; i--) {

		if (cmp(S.substr(i, tlen), T)) { 

			for (int j = 0; j < slen; j++) {
				if (j < i || i + tlen <= j) {
					if (S[j] == '?') cout << 'a';
					else cout << S[j];
				}
				else cout << T[j - i];
			}
			cout << "\n";
			flag = false;
			break;
		}

	}

	if (flag) cout << "UNRESTORABLE\n";

	return 0;
}

Measured memory_bytes: 256
/*
  Motto - try hard to become an expert
*/
#include <bits/stdc++.h>
#include <map>
#include <algorithm>
#include <vector>
#include <string.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <chrono>
#include <thread>
#include <iomanip>
 
//define
#define rep(i,n)    for(int i=0;i<n;i++)
#define repu(i,k,n) for(int i=k;i<=n;i++)
#define repd(i,k,n) for(int i=k;i>=n;i--)
#define se second
#define fi first
#define pb push_back
#define mp make_pair
#define INF (int)INT_MAX
#define all(v)  v.begin(), v.end()
#define endl "\n"
 
//typedef
typedef long long int ll;
typedef long double ld;
typedef std::pair<int, int> pii;
typedef std::vector<int> vi;
typedef std::vector< pii > vii;
typedef std::vector< ll > vll;
typedef std::vector< std::pair < pii, int > > vpp;
 
const int N = 3*1e5 +5 ;
const long long MOD = 998244353;
const long long inf = 1e18;
 
using namespace std;
 
ll MAXN=100001;
ll spf[100001]; 
 
ll modpow(ll x,ll n){
    ll res=1;
    while(n>0){
        if(n&1) res=res*x%MOD;
        x=x*x%MOD;
        n>>=1;
    }
    return res;
}
 
ll modFact(ll n, ll p) 
{ 
    if (n >= p) 
        return 0; 
  
    ll result = 1; 
    for (ll i = 1; i <= n; i++) 
        result = (result * i) % p; 
  
    return result;  
} 
 
bool isPrime(int x)
{
    if(x%2==0)
        return 0;
    for(int i=3;i<=sqrt(x);i+=2)
    {
        if(x%i==0)
            return 0;
    }
    return 1;
}
void solve()
{
	int n ; 
	cin>>n ;
	bool vis[n] ;
	memset(vis , false , sizeof(vis));
	int k ; 
	cin>>k; 
	rep( i  , k ){
		int d ;
		cin>>d ;
		rep(j , d){
			int a; 
			cin>>a ;
			vis[a-1] = true; 
		}
	}
	int c = 0 ;
	rep(i , n){
		if(!vis[i]){
			c++;
		}
	}
	cout<<c;
}
 
int main() {
    #ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif
    
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    int t = 1;
    // cin>>t;
    while(t--)
    {
        solve();
    } 
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

Measured memory_bytes: 3840
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstdlib>
#include<cstring>

using namespace std;

int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	int x,n;
	scanf("%d",&x);
	n=(int)sqrt(x*2.0);
	if(n*(n+1)/2==x){
		printf("%d\n",n);
	}
	else{
		if(n*(n+1)/2<x)printf("%d\n",n+1);
		else printf("%d\n",n);
	}
	return 0;
}



Measured memory_bytes: 256
N = int(input())
A = [int(a) for a in input().split()]
a = [0] * N
for i in A:
    a[i-1] += 1
cnt = 0
cnt += sum([i*(i-1)//2 for i in a])
for i in A:
    print(cnt - (a[i-1]-1))


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

int64_t MOD = 1000000007;
int64_t MAX = 9223372036854775807;
double PI = 3.141592653589793;

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

Measured memory_bytes: 512
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define rrep(i, n) for (ll i = n - 1; i >= 0; i--)
#define Rep(i, r, n) for (ll i = r; i < n; i++)
#define RRep(i, r, n) for (ll i = n - 1; i <= r; i--)
#define debug(x) cout << #x << ' ' << '=' << ' ' << (x) << endl;
#define fs first
#define sc second
#define int long long
#define pb push_back
const int dx[] = {0, -1, 0, 1};
const int dy[] = {1, 0, -1, 0};
const int MOD = (1000000007);
//const int MOD = (998244353);
//const int INF = (1 << 30)-1;
const int INF = (1LL << 60)-1;
const double EPS = (1 >> 30);

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

using Graph = vector<vector<pair<int, int>>>;

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    //---------------------------------------------
    
    vector<int> a(6);
    ll ans=0;
    rep(i,6){
        cin>>a[i];
    }
    sort(all(a));
    rep(i,4){
        if(a[i]==a[i+1]&&a[i+1]==a[i+2]){
            ans++;
        }
    }
    if(ans==0){
        cout<<"YES"<<endl;
    }
    else{
        cout<<"NO"<<endl;
    }

}

Measured memory_bytes: 764
#include <iostream>
#define cinf(n,x) for(int i=0;i<(n);i++) cin >> x[i];
typedef long long int ll;
using namespace std;
int mod=1e9+7;
int main(){
	int x,y; cin >>x>>y;
	if(abs(x-y)>=2){
		cout << 0 << endl;
		return 0;
	}
	ll ans=1;
	if(x==y){
		for(int i=1;i<=x;i++){
			ans*=i;
			ans%=mod;
		}
		cout << 2*ans*ans%mod << endl;
		return 0;
	}
	for(int i=1;i<=x;i++){
		ans*=i;
		ans%=mod;
	}
	for(int i=1;i<=y;i++){
		ans*=i;
		ans%=mod;
	}
	cout << ans << endl;
	return 0;

}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<map>
#include<set>

using  ll = long long;
using ull = unsigned long long;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};
constexpr ll kINF = 1152921504606846976;//2^60
constexpr double kEPS = 1e-6;

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define rep(i,n) REP(i,n)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep(i,n) RREP(i,n)
#define mp make_pair
#define fi first
#define sc second

ll n,m,d;
int main(void) {
  cin >> n >> m >> d;
  printf("%.10f\n", ((d == 0) ? 1.0 : 2.0) * (m - 1) * (n - d) / n / n);
  return 0;
}

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

int main(){
  string s,t;
  cin >> s >> t;
  sort(s.begin(),s.end());
  sort(t.begin(),t.end(),greater<int>());
  if(s<t){
    cout << "Yes";
  }else{
    cout << "No";
  }
  return 0;
}

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

int main()
{
    int n;
    cin >> n;
    vector<vector<bool>> G(n, vector<bool>(n));
    rep(i, n)
    {
        int u, k;
        cin >> u >> k;
        rep(j, k)
        {
            int v;
            cin >> v;
            G[u - 1][v - 1] = true;
        }
    }
    queue<int> Q;
    Q.push(0);
    vector<bool> visited(n);
    vector<int> dis(n, -1);
    visited[0] = true;
    dis[0] = 0;
    while (!Q.empty())
    {
        int v = Q.front();
        Q.pop();
        rep(i, n)
        {
            if (G[v][i] && !visited[i])
            {
                Q.push(i);
                dis[i] = dis[v] + 1;
                visited[i] = true;
            }
        }
    }
    rep(i, n) printf("%d %d\n", i + 1, dis[i]);
    return 0;
}


Measured memory_bytes: 3164
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    string s,t;
    cin>>s>>t;
    for(int i=0;i<s.size();i++){
        if(s.substr(s.size()-i-1)+s.substr(0,s.size()-i-1)==t){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
#[macro_use]
mod utils {
    macro_rules! input {
        ($($r:tt)*) => {
            let stdin = std::io::stdin();
            let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
            let mut next = move || -> String{
                bytes
                    .by_ref()
                    .map(|r|r.unwrap() as char)
                    .skip_while(|c|c.is_whitespace())
                    .take_while(|c|!c.is_whitespace())
                    .collect()
            };
            input_inner!{next, $($r)*}
        };
    }
    macro_rules! input_inner {
        ($next:expr) => {};
        ($iter:expr, ) => {};
 
        ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
            let $var = read_value!($next, $t);
            input_inner!{$next $($r)*}
        };
        ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
            let mut $var = read_value!($next, $t);
            input_inner!{$next $($r)*}
        };
    }
    macro_rules! read_value {
        ($next:expr, ( $($t:tt),* )) => {
            ( $(read_value!($next, $t)),* )
        };
        ($next:expr, [ $t:tt ; $len:expr ]) => {
            (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        };
        ($next:expr, chars) => {
            read_value!($next, String).chars().collect::<Vec<char>>()
        };
        ($next:expr, usize1) => {
            read_value!($next, usize) - 1
        };
        ($next:expr, $t:ty) => {
            $next().parse::<$t>().expect("Parse error")
        };
    }
}
 

fn main() {
    input!{
        s: String
    }
    if s.chars().nth(2) == s.chars().nth(3) && s.chars().nth(4) == s.chars().nth(5){
        println!("Yes");
    }else{
        println!("No");
    }
}

Measured memory_bytes: 4352
#include<stdio.h>
#include<stdlib.h>

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;


Node treeMinimum(Node x){


}

Node treeMaximum(Node x){


}

Node treeSearch(Node u, int k){


}

Node treeSuccessor(Node x){


}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y



}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x!=NIL){
    y = x;
    if(z->key < x->key) x = x->left;
    else x = x->right;
  }
    z->parent = y;

    if(y==NIL) root = z;
    else if(z->key < y->key) y->left = z;
    else y->right = z;
  


}

void inorder(Node u){
  if(u!=NIL){
  inorder(u->left);
  printf(" %d",u->key);  
  inorder(u->right);
  }
  else return;
}
void preorder(Node u){
  if(u!=NIL){
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
  }
  else return;
}


int main(){
  int n,i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}

Measured memory_bytes: 24036
<?php
/*
    Problem URL : http://abc053.contest.atcoder.jp/tasks/abc052_a

    Score  :
    Result :
    Time   : ms
    Memory : KB
 */

fscanf(STDIN, "%d %d %d %d", $A, $B, $C, $D);

$AB = $A * $B;
$CD = $C * $D;
$ans = max($AB, $CD);

echo $ans . PHP_EOL;


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

int main() {
    string S; cin >> S; int ans=S.size();
    rep(i,S.size()){
        if(S[i]!=S[i+1]){
            ans=min(ans,max(i+1,(int)S.size()-i-1));
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 512
import std.stdio, std.string, std.conv;
import std.typecons;
import std.algorithm, std.array, std.range, std.container;
import std.math;

void main() {
    auto N = readln.split[0].to!ulong;
    auto A = readln.split.to!(ulong[]);
    auto grps = sort(A.dup).group.array;
    size_t[ulong] nums;
    
    foreach (tup; grps) {
        nums[tup[0]] = tup[1];
    }
    
    ulong all_num = grps.map!(a => cast(ulong) a[1] * cast(ulong) (a[1]-1)).sum / 2;
    
    foreach (k; 0 .. N) {
        writeln( all_num - (nums[A[k]] - 1) );
    }
    
}



Measured memory_bytes: 32272
#include<iostream>
#include <algorithm>
#include <string>
using namespace std;
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(int)(n); i++)
typedef long long ll;
const int INF = numeric_limits<int>::max();
const int MOD = (1e9 + 7);


int main(){
  int N, D;
  cin >> D >> N;
  if(D==0){
    if(N != 100) cout << N << endl;
    else cout << N+1 << endl;
  }
  if(D==1){
    if(N !=100) cout << N*100 << endl;
    else cout << N*101 << endl;
  }
  if(D==2){
    if(N !=100) cout << N*10000 << endl;
    else cout << 1010000 << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
#define INF 1e18
using namespace std;

//-----------------------------------------------------------------------

int V,E;
vector<int> G[10005];
int indeg[10005];

vector<int> tsort()
{
    stack<int> S;
    REP(i,V){
        if(indeg[i]==0) S.push(i);
    }
    vector<int> res;
    while(!S.empty()){
        int v=S.top(); S.pop();
        res.push_back(v);
        for(auto u:G[v]){
            indeg[u]--;
            if(indeg[u]==0) S.push(u);
        }
    }
    return res;
}

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

    cin>>V>>E;
    REP(i,E){
        int a,b; cin>>a>>b;
        G[a].push_back(b);
        indeg[b]++;
    }
    
    vector<int> ans=tsort();
    for(auto v:ans){
        cout<<v<<endl;
    }

}



Measured memory_bytes: 4180