akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define     bit_1(a)       __builtin_popcount(a)
#define     ull            unsigned long long
#define     ll             long long
#define     pb             push_back
#define     pf             push_front
#define     mpr            make_pair
#define     ins            insert
#define     ff             first
#define     ss             second
#define     vi             vector<int>
#define     vl             vector<ll>
#define     vstr           vector<string>
#define     si             set<int>
#define     sl             set<ll>
#define     li             list<int>
#define     pii            pair<int,int>
#define     pll            pair<ll,ll>
#define     mii            map<int,int>
#define     mll            map<ll,ll>
#define     ma             INT_MAX
#define     mi             INT_MIN
#define     mod            1000000007
#define     pi             3.14159265359
#define     e              2.71828182846
#define     inf            1000000000000000LL
#define     all(x)         x.begin(), x.end()
#define     lb(a,b,c)      lower_bound(a,a+b,c)-a
#define     ub(a,b,c)      upper_bound(a,a+b,c)-a
#define     lbv(a,c)       lower_bound(all(a),c)-a.begin()
#define     ubv(a,c)       upper_bound(all(a),c)-a.begin()
#define     srt1(a,b)      sort(a,a+b)
#define     srt2(a,b)      sort(a,a+b,greater<int>())
#define     gcd(a,b)       __gcd(a,b)
#define     lcm(a,b)       (a*(b/gcd(a,b)))
#define     harmonic(n)    0.57721566490153286l+log(n)
#define     mem(a, b)      memset(a, b, sizeof(a))
#define     orderset1      tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
#define     orderset2      tree<int,null_type,greater<int>,rb_tree_tag,tree_order_statistics_node_update>

///s.lower_bound(a),s.upper_bound(a), for set
///nCr(x, y) = nCr(x-1, y-1) + nCr(x-1, y)
///factorial digit   ((n * log10(n / e) +log10(2 * pi * n) /2.0));
/// lcm(a,b)=a/gcd(a,b)*b (handle overflow)

bool sortinrev1(const pair<int,int>&a,const pair<int,int>&b)
{
    //return (a.first > b.first);
    if(a.first==b.first)return (a.second>b.second);
    else return (a.first > b.first);
}
bool sortinrev2(const pair<int,int>&a,const pair<int,int>&b)
{
    //return (a.first > b.first);
    if(a.first==b.first)return (a.second<b.second);
    else return (a.first > b.first);
}
int fx[]={1,-1,0,0};
int fy[]={0,0,1,-1};


int main()
{
    /*int t,n,x;
    cin>>n>>x>>t;
    if(n%x==0){
        cout<<(n/x)*t<<endl;
    }
    else cout<<((n/x)+1)*t<<endl;*/
    /*string str;
    ll sum=0;
    cin>>str;
    for(int i=0;i<str.size();i++){
        sum+=str[i]-'0';
    }
    if(sum%9LL==0)cout<<"Yes\n";
    else cout<<"No\n";*/
    int n;
    cin>>n;
    ll ar[n+5];
    for(int i=0;i<n;i++)cin>>ar[i];
    ll sum=0;
    for(int i=0;i<n-1;i++){
        if(ar[i]>ar[i+1]){
            sum+=ar[i]-ar[i+1];
            ar[i+1]=ar[i+1]+(ar[i]-ar[i+1]);
        }
    }
    cout<<sum<<endl;
}



Measured memory_bytes: 5200
s = int(input())
if s== 1 or s==2:
    print(0)
    exit()

ans = 0
mod = 10**9 + 7

for k in range(s//3+1):
    #全て3以上でk個に分ける
    ans1 = 0
    bou = k -1 
    tama = s - 3*k
    al = bou+tama

    #ans1 = al C bou
    def comb(n, r, mod):
        if (r < 0) or (n < r):
            return 0
        r = min(r, n - r)
        return fact[n] * factinv[r] * factinv[n-r] % mod
    
    fact = [1, 1]
    factinv = [1, 1]
    inv = [0, 1]
    
    for i in range(2, s+1):
        fact.append((fact[-1] * i) % mod)
        inv.append((-inv[mod % i] * (mod // i)) % mod)
        factinv.append((factinv[-1] * inv[-1]) % mod)

    ans1 = comb(al, bou, mod)
    ans += ans1
    ans %= mod

print(ans) 

Measured memory_bytes: 9388
N = int(input())

T = 0
X,Y = 0,0
flag = True
for i in range(N):
	t,x,y = map(int,input().split())
	dt = t - T
	dx = abs(X-x)
	dy = abs(Y-y)
	if flag and (dt < dx + dy or dt % 2 != (dx + dy) % 2):
		flag = False
	T,X,Y = t,x,y
if flag:
	print("Yes")
else:
	print("No")

Measured memory_bytes: 3064
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <vector>
#include <limits.h>
#include <math.h>
#include <functional>

#define repeat(i,n) for (long long i = 0; (i) < (n); ++ (i))
#define debug(x) cerr << #x << ": " << x << '\n'
#define debugArray(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i] << '\n'

using namespace std;

typedef long long ll;
typedef pair<int,int> Pii;
typedef vector<int> vint;
typedef vector<ll> vll;
const ll INF = INT_MAX;


int main() {
  int N,K;cin >> N >> K;
  vector<vint> fldB(K+2,vint(K+2,0));
  vector<vint> fldW(K+2,vint(K+2,0));
  repeat(i,N){
    int x,y;
    char c;
    cin >> x >> y >> c;
    if((x/K+y/K)%2==0){
      if(c=='B'){
        fldB[x%K+1][y%K+1] += 1;
      }else{
        fldW[x%K+1][y%K+1] += 1;
      }
    }else{
      if(c=='W'){
        fldB[x%K+1][y%K+1] += 1;
      }else{
        fldW[x%K+1][y%K+1] += 1;
      }
    }
  }
  repeat(i,K+1){
    repeat(j,K){
      fldB[i][j+1] += fldB[i][j];
      fldW[i][j+1] += fldW[i][j];
    }
  }
  repeat(j,K+1){
    repeat(i,K){
      fldB[i+1][j] += fldB[i][j];
      fldW[i+1][j] += fldW[i][j];
    }
  }
  /*
  repeat(j,K+1){
    repeat(i,K+1){
      cout << fldB[i][j] << " ";
    }
    cout << endl;
  }

  repeat(j,K+1){
    repeat(i,K+1){
      cout << fldW[i][j] << " ";
    }
    cout << endl;
  }
  */
  int ans=0;
  repeat(i,K+1){
    repeat(j,K+1){
      int a=0;
      a += (fldB[K][K] - fldB[i][K] - fldB[K][j] + fldB[i][j]) + fldB[i][j];
      a += (fldW[i][K]-fldW[i][j]) + (fldW[K][j] - fldW[i][j]);
      ans = max(ans,a);
      a=0;
      a += (fldW[K][K] - fldW[i][K] - fldW[K][j] + fldW[i][j]) + fldW[i][j];
      a += (fldB[i][K]-fldB[i][j]) + (fldB[K][j] - fldB[i][j]);
      ans = max(ans,a);
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 8192
use v5.18; # strict say state
use warnings;
use List::Util qw(reduce first max min sum0);

chomp (my $n = <STDIN>);
my $ans = 0;
for my $i (1..$n) {
  $ans += $i if $i % 3 != 0 && $i % 5 != 0  
}
say $ans;

Measured memory_bytes: 5392
#include <bits/stdc++.h>
#define LL               long long
#define PB               push_back
using namespace std;
int main(){
    string s;cin>>s;
    for (int i=0;i<4;i++){
        if (count(s.begin(),s.end(),s[i])!=2){
            cout<<"No";
            return 0;
        }
    }
    cout<<"Yes";
}

Measured memory_bytes: 3568
// AtCoder Beginner Contest 110 - Problem A: Maximize the Formula (https://abc110.contest.atcoder.jp/tasks/abc110_a)
#include <bits/stdc++.h>

using namespace std;

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

#define REP(i, a, b) for (int (i) = (a); (i) <= (b); (i)++)
#define REPN(i, N) for (int (i) = 0; (i) < N; (i)++)
#define DEC(i, b, a) for (int (i) = (b); (i) >= (a); (i)--)
#define DECN(i, N) for (int (i) = N - 1; (i) >= 0; (i)--)

#define LOG(var, sep) (cerr << #var << " = " << (var) << (sep))
#define LOGM(msg) (cerr << (msg))
#define LOGV(vec, sep) { cerr << #vec << " ="; for (const auto& v : (vec)) cerr << " " << v; cerr << (sep); }
#define LOGA(arr, N, sep) { cerr << #arr << " ="; for (int i = 0; i < N; ++i) cerr << " " << (arr)[i]; cerr << (sep); }
#define LOGA2(arr, N, M, sep) { cerr << #arr << " =\n"; for (int i = 0; i < N; ++i) { for (int j = 0; j < M; ++j) cerr << (arr)[i][j] << " "; cerr << endl; } cerr << (sep); }

void solve(int A, int B, int C)
{
    vector<int> ns { A, B, C };

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

    // Usa o maior dígito como dezena: X + ZY
    auto ans = ns[0] + (ns[1] + 10*ns[2]);

    cout << ans << endl;
}

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

    int A, B, C;
    cin >> A >> B >> C;

    solve(A, B, C);

    return 0;
}


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

#define rep(i, a, n) for(int i=(a);i<(n);++i)
#define per(i, a, n) for(int i=(a);i>(n);--i)
#define pb emplace_back
#define mp make_pair
#define lowbit(x) (x & -x)

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

const int mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;
const double EPS = 1e-8;
const double PI = acos(-1.0);

const int N = 5e5 + 10;

int n, Q;
int a[N], pre[N], ans[N];

struct Que{
	int id, l, r;
	void read(int x){
		id = x;
		scanf("%d %d", &l, &r);
	}
	bool operator < (const Que &A)const{
		return r < A.r;
	}
}que[N];

int s[N];

void add(int x, int v){
	for(; x<=n; x+=lowbit(x))	s[x] += v;
}

int sum(int x){
	int ret = 0;
	for(; x>0; x-=lowbit(x))	ret += s[x];
	return ret;
}

int main(){
	scanf("%d %d", &n, &Q);
	rep(i, 1, n+1){
		s[i] = 0;
		pre[i] = -1;
		scanf("%d", a+i);
	}

	rep(i, 0, Q)	que[i].read(i);
	sort(que, que+Q);

	int j = 0;
	rep(i, 1, n+1){
		if(pre[a[i]] != -1)	add(pre[a[i]], -1);
		pre[a[i]] = i;
		add(i, 1);
		while(j < Q && que[j].r == i){
			ans[que[j].id] = sum(que[j].r) - sum(que[j].l - 1);
			j++;
		}
	}

	rep(i, 0, Q)	printf("%d\n", ans[i]);

	return 0;
}


Measured memory_bytes: 17400
n,k,*l=map(int,open(0).read().split())
def f(n):
	d=[]
	for i in range(1,int(n**0.5)+1):
		if n%i== 0:
			d+=[i]
			if i!=n//i:
				d+=[n//i]
	d.sort()
	return d[::-1]
for d in f(sum(l)):
	a=sorted([m%d for m in l])
	if sum(a[:n-sum(a)//d])<=k:
		print(d);exit()


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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 (a>b) { a=b; return 1; } return 0; }

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

const int INF = 1e9;
const int N_MAX = 20;

int N;
int x[N_MAX],y[N_MAX],p[N_MAX];
ll ans[N_MAX];
int X=0,Y=0;
int sx[N_MAX],sy[N_MAX],vx[N_MAX],vy[N_MAX];
bool use[N_MAX];

void dfs(int idx=0)
{
    if (idx==N){
        ll sum=0;
        int Min;
        int pcnt = X+Y;
        vx[0]=-INF; vx[1]=INF; vx[2]=0;
        rep(i,X) vx[i+3]=sx[i];
        vy[0]=-INF; vy[1]=INF; vy[2]=0;
        rep(i,Y) vy[i+3]=sy[i];
        sort(vx,vx+(X+3));
        sort(vy,vy+(Y+3));
        rep(i,N){
            if (use[i]) continue;
            int t = lower_bound(vx,vx+(X+3),x[i])-vx;
            Min = min(vx[t]-x[i],x[i]-vx[t-1]);
            t = lower_bound(vy,vy+(Y+3),y[i])-vy;
            chmin(Min, min(vy[t]-y[i],y[i]-vy[t-1]));
            sum += (ll)Min*p[i];
        }
        chmin(ans[pcnt],sum);
        return;
    }
    use[idx]=true;
    sx[X++]=x[idx]; dfs(idx+1); X--;
    sy[Y++]=y[idx]; dfs(idx+1); Y--;
    use[idx]=false;
    dfs(idx+1);
}

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

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin>>N;
    rep(i,N) cin>>x[i]>>y[i]>>p[i];
    rep(i,N+1) ans[i] = (ll)1e18;
    dfs();
    rep(i,N+1) cout<<ans[i]<<"\n";
    return 0;
}


Measured memory_bytes: 3580
n,k = map(int,input().split())
all = 0
def redo(x):
	m = 0
	while x < k:
		x = x * 2
		m += 1
	return m
for i in range(1,n + 1):
	m = redo(i)
	all += 1 / ((2 ** m) * n)
print(all)

Measured memory_bytes: 3060
#include <stdio.h>
#include <iostream>
#include <vector>

using namespace std;

int main(){
	int N;
	vector<int> a;
	cin >> N;
	for (int i = 0; i < N; i++){
		int x;
		cin >> x;
		a.push_back(x);
	}

	int count = 0;
	for (int i = 0; i < a.size(); i++){
		int x = a[i];

		while ((x % 2) == 0){
			count++;
			x /= 2;
		}
	}
	cout << count << endl;
}


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

signed main() {
    ios::sync_with_stdio(0); cin.tie(0);
    int n, m;
    cin >> n >> m;
    int ans = 1;
    for(int i = 1; i * i <= m; ++i) {
        if(m % i) continue;
        if(m / i >= n) ans = max(ans, i);
        int j = m / i;
        if(m / j >= n) ans = max(ans, j);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdlib.h>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include <numeric>
#include <type_traits>
using namespace std;

int main()
{
  int k;
  int a=0;
  long long int sum=0;
  
  cin>>k;
  
  for(int i=1;i<=k;i++)
  {
    for(int j=1;j<=k;j++)
    {
      a=__gcd(i,j);
      for(int l=1;l<=k;l++)
      {
        sum=sum+__gcd(a,l);
      }
    }
  }
  
  cout<<sum<<endl;
  
  return 0;
}

Measured memory_bytes: 3636
#include <stdio.h>

int main(){
    int h, m, s, x;
    scanf("%d", &x);
    h = x / 3600;
    x -= h * 3600;
    m = x / 60;
    x -= m * 60;
    s = x;
    printf("%d:%d:%d\n", h, m, s);
    return 0;
}


Measured memory_bytes: 2128
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vint;
#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define F first
#define S second
int dx[]={0,1,1,0,-1,-1,0};
int dy[]={-1,-1,0,1,1,0,0};
int n;
queue<vector<pii>> tmp;
vector<pii> t;
pii goal;
set<pii> rock;
typedef unsigned long long ull;
set<ull> used;
ull seed=1145148931919;
bool check2(pii &a,pii &b){
    if(a==b) return false;
    if(a.F==b.F&&abs(a.S-b.S)==1) return false;
    if(a.S==b.S&&abs(a.F-b.F)==1) return false;
    if(a.F+1==b.F&&a.S-1==b.S) return false;
    if(a.F-1==b.F&&a.S+1==b.S) return false;
    return true;
}
bool check3(pii &a,pii &b){
    if(a==b) return false;
    if(a.F==b.F&&abs(a.S-b.S)==1) return true;
    if(a.S==b.S&&abs(a.F-b.F)==1) return true;
    if(a.F+1==b.F&&a.S-1==b.S) return true;
    if(a.F-1==b.F&&a.S+1==b.S) return true;
    return false;
}
bool check(vector<pii> &a,int b){
    rep(i,b-1){
        if(!check2(a[i],a[b])) return false;
    }
    if(b){
        if(!check3(a[b],a[b-1])) return false;
    }
    if(b!=n-1){
        if(!check3(a[b],a[b+1])) return false;
    }
    if(rock.find(a[b])!=rock.end()) return false;
    return true;
}
int dist(pii &a,pii &b){
    return abs(a.F-b.F)+abs(a.S-b.S);
}
ull has(vector<pii> &a){
    ull ret=0;
    ull t=1;
    rep(i,a.size()){
        ret+=a[i].F*t;
        t*=seed;
        ret+=a[i].S*t;
        t*=seed;
    }
    return ret;
}
void foo(int a,int b,vector<pii> &c,int d){
    if(a==n){
        if(d) tmp.push(c);
        return;
    }
    if(b==0){
        if(check(c,a)) foo(a+1,1,c,d);
        return;
    }
    if(check(c,a)) foo(a+1,1,c,d);
    rep(i,6){
        c[a].F+=dx[i];
        c[a].S+=dy[i];
        if(check(c,a)) foo(a+1,0,c,d+1);
        c[a].F-=dx[i];
        c[a].S-=dy[i];
    }
    return;
}
void mainmain(){
    while(cin>>n){
        if(n==0) return;
        vector<pii> in(n);
        rep(i,n) cin>>in[i].F>>in[i].S;
        int K;
        cin>>K;
        rock.clear();
        used.clear();
        rep(i,K){
            int a,b;
            cin>>a>>b;
            rock.insert(pii(a,b));
        }
        cin>>goal.F>>goal.S;
        queue<vector<pii>> q;
        used.insert(has(in));
        q.push(in);
        int ans=1;
        bool f=false;
        while(1){
            int qs=q.size();
            rep(i,qs){
                vector<pii> top=q.front();
                q.pop();
                foo(0,1,top,0);
            }
            while(!tmp.empty()){
                if(tmp.front()[0]==goal){
                    f=true;
                    auto tt=tmp.front();
                }
                if(dist(tmp.front()[0],goal)<=21-ans&&used.find(has(tmp.front()))==used.end()) q.push(tmp.front()),used.insert(has(tmp.front()));
                tmp.pop();
            }
            if(f) break;
            ans++;
            if(ans>=21) break;
        }
        cout<<ans<<endl;
    }
}
signed main() {
    mainmain();
}

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

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
// ascending order
#define asort(array, N) sort(array, array + N)
// descending order
#define asort_r(array, N) sort(array, array + N, greater<int>())
#define vunique(v) v.erase(unique(v.begin(), v.end()), v.end())
#define mp make_pair
#define ts(x) to_string(x)
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;

ll A, B, C, X, Y;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> A >> B >> C >> X >> Y;
	
	ll maxV = 1e5;
	ll ans = INF;

	for(ll i = 0; i <= maxV; i++) {
		ans = min(ans, i * 2 * C + A * max((ll)0, X - i) + B * max((ll)0, Y - i));
	}
	cout << ans << endl;



}


Measured memory_bytes: 256
#include <cctype>
#include <cstdio>
#include <cstring>
using namespace std;

int main(void)
{
  char input;
  int counter[26] = {};
  int i, len, sum, idx;
  while (scanf("%c", &input) != EOF) {
    if (islower(input)) idx = input - 'a';
    else if  (isupper(input)) idx = input - 'A';
    else continue;
    counter[idx]++;
  }
  for (i = 0; i < 26; i++) {
    printf("%c : %d\n", int ('a' + i), counter[i]);
  }
  return 0;
}

Measured memory_bytes: 972
N, M= map(int,input().split())
A = list(map(int,input().split()))
B = 0
count = 0


for i in range(len(A)):
    B += A[i]
for i in range(len(A)):
    if A[i] >= B / (4 * M):
        count += 1
if count >= M :
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define endl "\n"
#define mod 1000000007
#define fastio std::ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define deb(x) cout<<#x<<" "<<x<<endl;
const ll INF = 1e9 + 7;

int main(){
  fastio;
  ll n,k;
  cin>>n>>k;
  vector<ll> h(n+1);
  for (ll i = 1; i <= n; i++) {
    cin>>h[i];
    //deb(i);
  }
  vector<ll> jump(k+1,0);
  for (ll i = 1; i <= k; i++) {
    jump[i] = i;
  }

  vector<ll> dp(n+1,INF);

  dp[1] = 0;

  ll jp;
  for (ll i = 1; i <= n; i++) {
    for (ll j = 1; j <= k; j++) {
      jp =  i + jump[j];
      if(jp <= n) dp[jp] = min(dp[jp] , dp[i] + abs(h[jp] - h[i]) );
    }
  }
    // std::cout << '\n';
    // deb(jump[i]);
    // for (ll i = 0; i <= n; i++) {
    //   std::cout << dp[i] << ' ';
    // }

  // for (ll i = 0; i <= n; i++) {
  //   std::cout << dp[i] << ' ';
  // }

  std::cout<< dp[n] << '\n';
}


Measured memory_bytes: 1792
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<deque>
#include<iomanip>
#include<tuple>
#include<cassert>
using namespace std;
typedef long long int LL;
typedef pair<int,int> P;
typedef pair<LL,int> LP;
const int INF=1<<30;
const LL MAX=1e9+7;

void array_show(int *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%d%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(LL *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%lld%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(vector<int> &vec_s,int vec_n=-1,char middle=' '){
	if(vec_n==-1)vec_n=vec_s.size();
	for(int i=0;i<vec_n;i++)printf("%d%c",vec_s[i],(i!=vec_n-1?middle:'\n'));
}
void array_show(vector<LL> &vec_s,int vec_n=-1,char middle=' '){
	if(vec_n==-1)vec_n=vec_s.size();
	for(int i=0;i<vec_n;i++)printf("%lld%c",vec_s[i],(i!=vec_n-1?middle:'\n'));
}

int main(){
	int n,m;
	int i,j,k;
	int a,b,c;
	vector<int> v1;
	for(i=0;i<3;i++){
		cin>>a;
		v1.push_back(a);
	}
	sort(v1.begin(),v1.end());
	if((v1[0]==v1[1] && v1[1]!=v1[2]) || (v1[0]!=v1[1] && v1[1]==v1[2]))cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

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

using namespace std;
#define ll long long
#define ull unsigned long long
#define i128 __int128
#define mp make_pair
#define ld long double
typedef pair<int, int> pii;
typedef priority_queue<int, vector<int>, greater<int> > small_heap;
typedef priority_queue<int> big_heap;
const int N = 1e5 + 100;
int T;
int n, m, r;
int v[3 * N], w[3 * N], dp[1 << 9][N];

int query(int x, int y) {
    if (x <= m)return dp[x][y];
    else {
        int ans = query(x / 2, y);
        if (y >= w[x])ans = max(ans, query(x / 2, y - w[x]) + v[x]);
        return ans;
    }
}

int main() {
    m = (1 << 9) - 1, r = (int) 1e5;
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
        scanf("%d%d", &v[i], &w[i]);
    }
    for (int i = 1; i <= m; i++) {
        int f = i / 2;
        for (int j = 1; j <= r; j++) {
            dp[i][j] = dp[f][j];
            if (j - w[i] >= 0)dp[i][j] = max(dp[i][j], dp[f][j - w[i]] + v[i]);
        }
    }
    int q;
    scanf("%d", &q);
    while (q--) {
        int x, y;
        scanf("%d%d", &x, &y);
        printf("%d\n", query(x, y));
    }
    return 0;
}

Measured memory_bytes: 205640
#include <bits/stdc++.h>
using namespace std;
int main() {
  string S;
  cin >> S;
  string Ans = "Yes";
  for (int i = 0; i < S.size(); i++) {
    if (i % 2 == 0) {
      if (S.at(i) == 'L') {
        Ans = "No";
        break;
      }
    } else {
      if (S.at(i) == 'R') {
        Ans = "No";
        break;
      }
    }
  }
  cout << Ans << endl;
  return 0;
}


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

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rep2(i, a, b) for (ll i = (a); i < (b); i++)
#define chmax(x, v) do { x = max(x, v); } while (0)
#define chmin(x, v) do { x = min(x, v); } while (0)
typedef uint64_t ull;
typedef int64_t ll;
typedef std::pair<ll, ll> PLL;

using namespace std;

ll N;
ll total;
vector<ll> v;
map<ll, ll> mp;

signed main() {
  cin >> N;
  v.resize(N);
  rep(i, N){
    ll x;
    cin >> x;
    v[i] = x;
    mp[x]++;
  }
  for (auto &e : mp) {
    ll n = e.second;
    total += n * (n-1) / 2;
  }
  for (auto &c : v) {
    ll ans = total;
    ans -= mp[c] * (mp[c]-1) / 2;
    ans += (mp[c]-1) * (mp[c]-2) /2;
    cout << ans << endl;
  }
  return 0;
}


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

int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
   	string s;cin >> s;
    rep(i, s.length()-2){
        if(s[i] == s[i+2]){
            printf("%d %d",i+1,i+3);
            return 0;
        }else if(s[i] == s[i+1]){
            printf("%d %d",i+1,i+2);
            return 0;
        }
    }
    if(s.length()==2&&s[0]==s[1]){
        printf("1 2");
        return 0;
    }
	cout << "-1 -1" << endl;
	return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
const int N=5001,K=20;
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n,k,i,j;
	string s,ans,ss,rs,cs;
	cin>>n>>k>>s;
	if(k>K)
	{
		j=0;
		for(i=1;i<n;i++)
			if(s[i]<s[j])j=i;
		for(i=0;i<n;i++)
			cout<<s[j];
		cout<<'\n';
		return 0;
	}
	ans=s;
	for(i=0;i<k;i++)
	{
		rs=s;
		reverse(rs.begin(),rs.end());
		ss=s+rs;
		cs=ss.substr(0,n);
		ans=cs;
		s=cs;
		reverse(s.begin(),s.end());
		for(j=1;j+n<=ss.size();j++)
		{
			cs=ss.substr(j,n);
			if(cs<ans)ans=cs;
			reverse(cs.begin(),cs.end());
			if(cs<s)s=cs;
		}
		reverse(s.begin(),s.end());
	}
	cout<<ans<<'\n';
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,m,n) for(int i=m;i<n;i++)
ll mod=1e9+7;

int main(){
  int n,m;
  cin>>n>>m;
  int h[n];
  rep(i,0,n){
    cin>>h[i];
  }
  vector<int> p[n];
  rep(i,0,m){
    int a,b;
    cin>>a>>b;
    p[a-1].push_back(b-1);
    p[b-1].push_back(a-1);
  }
  int ans=0;
  rep(i,0,n){
    bool q=true;
    rep(j,0,p[i].size()){
      if(h[i]<=h[p[i][j]]) q=false;
    }
    if(q) ans++;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 9128
#include<iostream>
#include<cstdio>
using namespace std;
int main() {
	int a,b;
	while(scanf("%d %d",&a,&b)!=EOF&&(a!=0||b!=0)) {
		for(int i=0; i<a; i++) {
			for(int j=0; j<b; j++)
				{
				if(i%2==0&&j%2==0||i%2!=0&&j%2!=0)
					cout<<"#";
				else
					cout<<".";
					}
			cout<<endl;
		}
		cout<<endl;
	}
	return 0;
}



Measured memory_bytes: 3156
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

const long long mod = 1000000007;
const long long inf = 1e18;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    int a,b,c,x;
    cin>>a>>b>>c>>x;
    int ans=0;
    for(int i=0;i<=a;i++){
        for(int j=0;j<=b;j++){
            for(int k=0;k<=c;k++){
                if(i*500+j*100+k*50==x)
                    ans+=1;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}


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

const long long INF = 1000000000000000000LL;
int n, m, p;
vector< pair<int, int> > v[2510];
queue<int> Q;
bool inQ[2510];
int chk[2510];
long long d[2510];
bool ch[2510];

int dfs(int x) {
    if(x == n) return true;
    bool flag = false;
    ch[x] = true;

    for(int i=0; i<v[x].size(); i++) {
        if(ch[v[x][i].first]) continue;
        flag |= dfs(v[x][i].first);
    }

    return flag;
}

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

    cin >> n >> m >> p;

    for(int i=0; i<m; i++) {
        int a, b, c;
        cin >> a >> b >> c;

        v[a].push_back({b, p - c});
    }

    for(int i=2; i<=n; i++) {
        d[i] = INF;
    }

    Q.push(1);
    inQ[1] = true;
    chk[1]++;

    while(Q.size()) {
        int a = Q.front();
        Q.pop();

        inQ[a] = false;

        for(int i=0; i<v[a].size(); i++) {
            int b = v[a][i].first;
            int c = v[a][i].second;

            if(d[a] + c < d[b]) {
                d[b] = d[a] + c;

                if(!inQ[b]) {
                    chk[b]++;

                    if(chk[b] >= n) {
                        memset(ch, 0, sizeof(ch));

                        if(dfs(b)) {
                            cout << "-1";
                            return 0;
                        }
                        continue;
                    }

                    Q.push(b);
                    inQ[b] = true;
                }
            }
        }
    }

    cout << -min(d[n], 0LL);
}


Measured memory_bytes: 512
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


namespace ConsoleApp6
{
	class Program
	{
		static void Main(string[] args)
		{
			while (true) {

				string aob = Console.ReadLine();
				string[] aopb = aob.Split(' ');

				int a = int.Parse(aopb[0]);
				int b = int.Parse(aopb[2]);
				string op = aopb[1];

				switch (op)
				{
					case "+":
						Console.WriteLine("{0}", a + b);
						break;
					case "-":
						Console.WriteLine("{0}", a - b);
						break;
					case "*":
						Console.WriteLine("{0}", a * b);
						break;
					case "/":
						Console.WriteLine("{0}", a / b);
						break;
					default:
						break;
				}

				if(op == "?")
				{
					break;
				}
			}
			
			Console.ReadKey();

		}
	}
}



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

using namespace std;

typedef unsigned int uint;
typedef long long int llint;
typedef unsigned long long int ullint;

//#define DEBUG

#ifdef DEBUG
#define dump(i) cout << "[*] " #i " : " << i << endl;
#define debug(i) i
#else
#define dump(i)
#define debug(i)
#endif
#define rep(i, max) for (int i = 0; i < (max); ++i)

void one(int& m,int& a, int& b, int& c) {
  if (m != a) {
    ++a;
  } else if (m != b) {
    ++b;
  } else {
    ++c;
  }
}

inline void solve() {
  int a, b, c;
  cin >> a >> b >> c;
  int m = max(a, max(b, c));
  int ans = 0;
  while (true) {
    if (a == b && b == c) {
      break;
    }
    one(m, a, b, c);
    one(m, a, b, c);
    m = max(a, max(b, c));
    ++ans;
  }

  cout << ans << endl;
}

int main() {
        /*
        ios::sync_with_stdio(false);
        cin.tie(nullptr);
        cout.tie(nullptr);
        //*/
#ifdef DEBUG
        clock_t _begin = clock();
#endif

        solve();

#ifdef DEBUG
        cerr << "[*] time : " << (double)(clock() - _begin) * 1000 / CLOCKS_PER_SEC << " [ms]" << endl;
#endif
        return 0;
}

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

using namespace std;
using ll = long long;
using vi = vector<int>;

const int MOD = 1e9 + 7;

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

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

	ll n,k;
	cin >> n >> k;

	ll ans = 0;
	for (ll i = k; i <= n + 1; ++i) {
		ll fi = i * (i - 1) / 2;
		ll fin = (n * 2 - i + 1 ) * i / 2;
		ll add = fin - fi + 1;
		ans = (ans + add) % MOD;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3656
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iomanip>
using namespace std;
typedef long long unsigned int ll;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MOD 1000000007

#define REP(i,n) for(int i=0;i<n;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 dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int dy4[]={0, 0, 1, -1};
int dx4[]={1, -1, 0, 0};
int dx8[]={0, 0, 1, -1, 1, 1, -1, -1};
int dy8[]={1, -1, 0, 0, 1, -1, -1, 1};

// https://beta.atcoder.jp/contests/abc076/tasks/abc076_c

int main() {
    string S, T; cin >> S >> T;

    if (S.length() < T.length()) {
        cout << "UNRESTORABLE" << "\n";
        return 0;
    }

    string ans = "~";
    REP(i, S.length() - T.length() + 1) {
        string sub = S.substr(i, T.length());

        bool can = true;
        REP(j, T.length()) {
            if (sub[j] != T[j] && sub[j] != '?') can = false;
        }

        if (can) {
            string p = S;
            REP(k, T.length()) {
                p[i+k] = T[k];
            }

            REP(k, S.length()) {
                if (p[k] == '?') p[k] = 'a';
            }

            ans = min(p, ans);
        }

    }

    if (ans == "~") {
        cout << "UNRESTORABLE" << "\n";
    } else {
       cout << ans << "\n";
    }

    return 0;
}


Measured memory_bytes: 256
//
// Created on 2020/06/27.
//


#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <ios>
#include <iomanip>
#include <numeric>

#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
typedef long long ll;
using namespace std;
const long long LINF =1e18;
const int INF = 1e9;


int main() {
    int n;
    int m;
    ll k;
    cin>>n;
    cin>>m;
    cin>>k;
    vector<ll>a(n+2,LINF);
    vector<ll>b(m+2,LINF);

    ll a_sum = 0;
    a[0] = 0;
    for (int i = 1; i <= n; ++i) {
        ll temp;
        cin>>temp;
        a_sum += temp;
        a[i] = a_sum;
    }
    ll b_sum = 0;
    b[0] = 0;
    for (int j = 1; j <= m; ++j) {
        ll temp;
        cin>>temp;
        b_sum += temp;
        b[j] = b_sum;
    }
    ll ans = 0;
    for (int l = 0; l <= n; ++l) {
        ll time = k - a[l];
        if(time < 0){
            break;
        }
        ll ok = 0;
        ll ng = m+1;
        ll mid = (ok + ng)/2;
        while(abs(ok - ng) != 1){
            if(b[mid] > time){
                ng = mid;
                mid = (ok+ng)/2;
            }else{
                ok = mid;
                mid = (ok+ng)/2;
            }
        }
        ans = max((l) + (ok),ans);
    }
    cout<<ans<<endl;

    return 0;
}


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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  int tot=0, toA=0;
  rep(i,n) {
    cin >> a[i];
    tot += a[i];
  }

  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  for (int i = 0; i < n; i+=2){
    toA += a[i];
  }
  int ans = 2*toA - tot;
  cout << ans<< endl;
  return 0;

}

Measured memory_bytes: 3548
N = int(input())

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

if N == 1:
    print(0)
else:
    fact = factorization(N) 
    res = 0
    import math 
    for pe in fact:
        add = math.floor((math.sqrt(1+8*pe[1])-1) /2)
        res += add
    print(res)

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


int main() {
 int N;
  cin >>N;
  vector<int> a(3*N);
  for(int i=0;i<3*N;i++) cin >>a[i];
 sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  int64_t ans =0;
  for(int i=1;i<=N;i++){
	ans += a[2*i-1];
  }
  cout <<ans <<endl;
  
}


Measured memory_bytes: 1408
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace::std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/numeric/interval.hpp>
#include <boost/numeric/interval/io.hpp>
#include <boost/intrusive/rbtree.hpp>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/linestring.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/tag_and_trait.hpp>
using namespace __gnu_pbds;
using namespace::std;
namespace mp = boost::multiprecision;
typedef mp::number<mp::cpp_dec_float<0>> cfloat;
typedef mp::cpp_int cint;
typedef long long lint;
typedef long long ll;
typedef long double ldouble;
typedef vector<lint> vec;
typedef vector<vector<lint>> mat;
typedef vector<vector<vector<lint>>> mat3;
typedef vector<double> dvec;
typedef vector<vector<double>> dmat;
typedef vector<vector<vector<double>>> dmat3;
typedef vector<string> svec;
typedef vector<vector<string>> smat;
typedef vector<vector<vector<string>>> smat3;
typedef vector<pair<lint,lint>> pvec;
typedef vector<vector<pair<lint,lint>>> pmat;
typedef vector<vector<vector<pair<lint,lint>>>> pmat3;
#define rep(i, n) for(lint i = 0; i < (lint)(n); i++)
#define irep(i) for(lint i = 0;; i++)
#define irep1(i) for(lint i = 1;; i++)
#define irep2(i) for(lint i = 2;; i++)
#define rrep(i, n) for(lint i = (lint)(n-1); i >-1; i--)
#define rrepi(i,a,b) for(lint i = (lint)(b-1); i >a-1; i--)
#define repi(i,a,b) for(lint i=lint(a);i<lint(b);i++)
#define rep2(i,a,b,c) for(lint i=lint(a);i>lint(b);i+=c)
#define all(x) (x).begin(),(x).end()
#define PI 3.141592653589793
#define dist(x1,y1,x2,y2) (pow(pow(x2-x1,2)+pow(y2-y1,2),0.5))
#define output(v) do{bool f=0;for(auto i:v){cout<<(f?" ":"");if(i>INF/2)cout<<"INF";else cout<<i;f=1;}cout<<"\n";}while(0)
#define output2(v) for(auto j:v)output(j);
#define input(a,n) lint n;cin>>n;vector<lint>a(n);rep(i,n)cin>>a[i];
#define SUM(v) accumulate(all(v),0LL)
#define INF (1LL<<60)
#define IINF (1<<30)
#define EPS (1e-10)
#define LINF 9223372036854775807
#define MOD 1000000007
#define endl "\n"
template<typename T=lint>T in(){return *istream_iterator<T>(cin);}
inline lint gcd(lint a,lint b){return b?gcd(b,a%b):a;}
inline lint lcm(lint a,lint b){return a*b/gcd(a,b);}
inline bool chmin(auto& s,const auto& t){bool res=s>t;s=min(s,t);return res;}
inline bool chmax(auto& s,const auto& t){bool res=s<t;s=max(s,t);return res;}
vector<lint> dx={-1,1,0,0,1,1,-1,-1};
vector<lint> dy={0,0,-1,1,1,-1,1,-1};

int main(){
    lint a,b;
    cin>>a>>b;
    a--;b--;
    cout<<100<<" "<<100<<endl;
    smat v(100,svec(100,"."));
    rep(i,100)rep(j,50)v[i][j]="#";
    rep(i,a)v[i%50*2][i/50*2]=".";
    rep(i,b)v[i%50*2][i/50*2+1+50]="#";
    rep(i,100){rep(j,100){
        cout<<v[i][j];
    }cout<<endl;}
}

Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<bitset>
#include<deque>
#include<functional>
#include<iterator>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<utility>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(ll i=(n);i>=1;i--)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
const ll MOD=1000000007;
const ll INF=1000000000000000;
template<class T> inline bool chmin(T& a, T b){if(a>b){a=b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a=b;return true;}return false;}
ll maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}

vector<ll> pw2(51,1);vector<ll> pw10(19,1);
int main(){
    {rep1(i,50) pw2[i]=2*pw2[i-1];}
    {rep1(i,18) pw10[i]=10*pw10[i-1];}
    ll N; cin>>N;
    ll A=0,W=0,T=0,R=0;
    rep(i,N){
        string s; cin>>s;
        if(s=="AC") A++;
        else if(s=="TLE") T++;
        else if(s=="WA") W++;
        else R++;
    }
    cout<<"AC x "<<A<<endl;
    cout<<"WA x "<<W<<endl;
    cout<<"TLE x "<<T<<endl;
    cout<<"RE x "<<R<<endl;
}



Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define F(i, a, b) for (register int i = (a), _b = (b); i <= _b; i++)
#define D(i, a, b) for (register int i = (a), _b = (b); i >= _b; i--)
 
const int N = 2005;
const int S = 4000005;
const int P = 1e9+7;
 
int n, K;
int Tn, fac[S], inv[S], ifac[S];
int f[N][N], g[N];
 
inline int C(int n, int m) {
    if (m < 0 || n < m) return 0;
    return 1LL * fac[n] * ifac[m] % P * ifac[n-m] % P;
}
inline int G(int n, int m) { return C(n+m, n); }
 
int main(void) {     
    scanf("%d %d", &n, &K);
    if (K == 1) return puts("1"), 0;
 
    Tn = n*K;
    fac[0] = 1;
    F(i, 1, Tn) fac[i] = 1LL * fac[i-1] * i % P;
    inv[1] = 1;
    F(i, 2, Tn) inv[i] = 1LL * (P - P / i) * inv[P % i] % P;
    ifac[0] = 1;
    F(i, 1, Tn) ifac[i] = 1LL * ifac[i-1] * inv[i] % P;
     
    f[0][0] = 1;
    F(i, 1, n) {
        memset(g, 0, sizeof g);
        D(j, i-1, 0) g[j] = (g[j+1] + f[i-1][j]) % P;
        D(j, i, 1) 
            f[i][j] = 1LL * g[j-1] * G((i-1)*K-(j-1), K-2) % P;
    }
     
    int ans = 0;
    F(j, 0, n) ans = (ans + f[n][j]) % P;
    ans = 1LL * ans * fac[n] % P;
    printf("%d\n", ans);
     
    return 0;
}

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

int n, a[100005], dp[100005];
long long t, mx;
map<long long, long long> cnt;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
 	
 	cin >> n >> t;
 	for (int i = 0; i < n; i++) {
 		cin >> a[i];
 	}

 	for (int i = n-1; i >= 0; i--) {
 		dp[i] = max(dp[i+1], a[i]);
 	}

 	for (int i = 0; i < n; i++) {
 		cnt[dp[i] - a[i]]++;
 	}

 	long long ans = 0;
 	for (auto it = cnt.begin(); it != cnt.end(); it++) {
 		if (it->first * t/2 > mx) {
 			mx = it->first * min(t, it->second);
 			ans = it->second;
 		}
 	}

 	cout << ans << '\n';
 	
	return 0;
}

Measured memory_bytes: 7296
#include<cstdio>
#include<cstring>
using namespace std;

int main(){
    char s[201],t[101],p[101];
    
    scanf("%s %s",s,p);
    strcpy(t,s);
    strcat(s,t);
    
    if (strstr(s,p) ==NULL) printf("No\n");
    else printf("Yes\n");
    
    return 0;
}


Measured memory_bytes: 2744
#include <iostream>
#include <string>
#include <cmath>

#include <list>
#include <queue>
#include <algorithm>

#define INF 1000000000

using namespace std;
using ll = long long;

int main(void)
{
    int d, t, s;
    cin >> d >> t >> s;

    if (t * s >= d) {
        cout << "Yes";
    } else {
        cout << "No";
    }
    
    return 0;
}


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

using namespace std;
int gcd(int a, int b) {
    if(a < b) {
        return gcd(b, a);
    }
    
    while(b) {
        int r = a % b;
        a = b;
        b = r;
    }
    return a;
}
int main() {
    int n = 0;
    cin >> n;
    vector<int> va(n, 0);
    for(int i = 0; i < n; ++i) {
        cin >> va[i];
    }
    
    int ret = va[0];
    for(int i = 1; i < n; ++i) {
        ret = gcd(va[i], ret);
    }

    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <stdint.h>

uint64_t sum_by(int base, int last) {
        uint64_t _last;

        if (base == 0) {
                perror("sum_by");
                return 1;
        }

        _last = last / base;

        return (_last * (_last + 1) / 2) * base;
}

uint64_t solve(int n) {
        return sum_by(1, n) - sum_by(3, n) - sum_by(5, n) + sum_by(15, n);
}

int main() {
        int n;
        int rc;

        rc = scanf("%7d", &n);
        if (rc == 0) {
                perror("scanf");
                return 1;
        }

        printf("%lld\n", solve(n));

        return 0;
}


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

namespace ConsoleApp21
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] line = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int N = line[0];
            int M = line[1];
            int[] rtn = new int[N];

            for(int i = 0; i < N; i++)
            {
                rtn[i] = 0;
            }

            for (int i = 0; i < M; i++)
            {
                int[] Douro = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
                rtn[Douro[0] - 1] += 1;
                rtn[Douro[1] - 1] += 1;
            }

            for (int i = 0; i < N; i++)
            {
                Console.WriteLine(rtn[i]);
            }
        }


    }

}


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

//const static double	de_PI	= 3.14159265358979323846;
//const static int	de_MOD	= 1000000007;
//const static int	de_MAX	= 999999999;
//const static int	de_MIN = -999999999;


int main(void) {

	//std::ifstream in("123.txt");	std::cin.rdbuf(in.rdbuf());
	int n = 0, q = 0;
	
	std::cin >> n;
	std::vector<int> S(n);
	for (int i = 0; i < n; i++) {
		std::cin >> S[i];
	}

	std::sort(S.begin(), S.end());

	std::cin >> q;
	std::vector<int> T(q);
	for (int i = 0; i < q; i++) {
		std::cin >> T[i];
	}

	std::sort(T.begin(), T.end());

	int ans = 0;
	for (int i = 0; i < q; i++) {
		if (std::find(S.begin(), S.end(), T[i]) != S.end()) {
			ans++;
		}
	}

	std::cout << ans << std::endl;

}

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

int main() {
	long K, X;
	cin >> K >> X;

	for (int i = (X - K + 1); i <= X + K - 1; i++) {
		if (i != X + K - 1)
			cout << i << " ";
		else
			cout << i;
	}

	return 0;
}

Measured memory_bytes: 384
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<iomanip>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
const int MAX = 1000001;
const int MOD = 1e+9+7;
ll fac[MAX], finv[MAX], inv[MAX];
void COMinit(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < MAX; i++){
        fac[i] = fac[i-1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
        finv[i] = finv[i-1] * inv[i] % MOD;
    }
}
ll P(ll n,ll k){
	if(n < k) return 0;
    if (n < 0 || k < 0) return 0;
	return fac[n] * finv[n-k] % MOD;
}
int main(){
	COMinit();
	int N,M;
	vint A,B;
	ll ans=1;
	vector<pair<pll,int> > kumi;
	bool already[1000001]={};
	scan(N);scan(M);
	ll usedmasu=0;
	rep(i,N){
		int a;
		scan(a);
		A.push_back(a);
	}
	rep(i,M){
		int b;
		scan(b);
		B.push_back(b);
	}
	sort(A.rbegin(),A.rend());
	sort(B.rbegin(),B.rend());
	int ai=0,bi=0;
	while(1){
		//printf("ai:%d bi:%d\n",ai,bi);
		if(ai>=N){
			kumi.push_back(mp(mp(B[bi],N),0));
			bi++;
		}
		else if(bi>=M){
			kumi.push_back(mp(mp(A[ai],M),0));
			ai++;
		}
		else if(A[ai]==B[bi]){
			kumi.push_back(mp(mp(A[ai],1),0));
			kumi.push_back(mp(mp(A[ai]-1,ai+bi),1));
			ai++;
			bi++;
		}
		else if(A[ai]>B[bi]){
			kumi.push_back(mp(mp(A[ai],bi),0));
			ai++;
		}
		else{
			kumi.push_back(mp(mp(B[bi],ai),0));
			bi++;
		}
		if(ai>=N&&bi>=M) break;
	}
	sort(kumi.begin(),kumi.end());
	rep(i,kumi.size()){
		ll kazu=kumi[i].first.first;
		ll masu=kumi[i].first.second;
		int flag=kumi[i].second;
		if(flag==0) ans*=(already[kazu]==0)*masu*P(kazu-1-usedmasu,masu-1)%MOD;
		else ans*=P(kazu-usedmasu,masu)%MOD;
		ans%=MOD;
		/*if(i!=0){
			if(kazu==kumi[i-1].first.first) ans=0;
		}*/
		if(flag==0) already[kazu]=1;
		usedmasu+=masu;
		//printf("kazu:%lld masu:%lld flag:%d ans:%lld usedmasu:%lld\n",kazu,masu,flag,ans,usedmasu);
	}
	ans*=fac[N*M-usedmasu];
	ans%=MOD;
	prin(ans);
	return 0;
}


Measured memory_bytes: 24704