akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, a, b) for(int i = a; i < b; i++)
#define rrep(i, a, b) for(int i = b - 1; i >= a; i--)
#define ALL(a) a.begin(), a.end()
#define pii pair<int,int>
#pragma GCC optimize("Ofast")
#define pcnt __builtin_popcount
#define buli(x) __builtin_popcountll(x)
#define pb push_back
#define mp make_pair
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define isSquare(x) (sqrt(x)*sqrt(x) == x)
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; };
inline void IN(void){return;}
template <typename First, typename... Rest> void IN(First& first, Rest&... rest){cin >> first;IN(rest...);return;}
inline void OUT(void){cout << "\n";return;}
template <typename First, typename... Rest> void OUT(First first, Rest... rest){cout << first << " ";OUT(rest...);return;}
const double EPS = 1e-9;
const int mod = 1e9 + 7;
const int INF = 1e9;
const long long LLINF = 1e18;
long long lcm(ll a, ll b){return a * b / __gcd(a,b);}
struct IoSetup { IoSetup() {
    cin.tie(nullptr);ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
} } iosetup;
template< int mod > struct ModInt {
    int x; ModInt() : x(0) {}
    ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
    ModInt &operator+=(const ModInt &p) {if((x += p.x) >= mod) x -= mod;return *this;}
    ModInt &operator-=(const ModInt &p) {if((x += mod - p.x) >= mod) x -= mod;return *this;}
    ModInt &operator*=(const ModInt &p) {x = (int) (1LL * x * p.x % mod);return *this;}
    ModInt &operator/=(const ModInt &p) {*this *= p.inverse();return *this;}
    ModInt operator-() const { return ModInt(-x); }
    ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
    ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
    ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
    ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
    bool operator==(const ModInt &p) const { return x == p.x; }
    bool operator!=(const ModInt &p) const { return x != p.x; }
    ModInt inverse() const {int a = x, b = mod, u = 1, v = 0, t;
    while(b > 0) { t = a / b; swap(a -= t * b, b); swap(u -= t * v, v); }return ModInt(u);}
    ModInt pow(int64_t n) const {ModInt ret(1), mul(x); while(n > 0) {if(n & 1) ret *= mul;mul *= mul;n >>= 1;}return ret;}
    friend ostream &operator<<(ostream &os, const ModInt &p) { return os << p.x;}
    friend istream &operator>>(istream &is, ModInt &a) { int64_t t; is >> t; a = ModInt< mod >(t); return (is); }
    static int get_mod() { return mod; }
}; using modint = ModInt< mod >;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main(){
    iosetup;
    int N; cin >> N;
    vector<int> a(3 * N);
    rep(i, 0, 3 * N) cin >> a[i];
    sort(ALL(a));
    ll ans = 0;
    int idx = 3 * N - 2;
    while(N--){
        ans += a[idx];
        idx -= 2;
    }
    cout << ans << endl;

    return 0;
}

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

using namespace std;
#define int long long int
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define vi vector <int>
#define sz(s) (int)s.size()
#define pii pair<int,int>
#define piii pair< int,pair<int,int> >
#define tiii tuple <int,int,int>
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define rall(v) v.rbegin(),v.rend()
#define endl '\n'
#define matrix vector <vector <int> >
#define boost ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define NAYAN freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define N 200004
#define mod 1000000007
#define mod2 998244353
#define inf 1e18

int tree[4*N];
int h[N];
int b[N];
int dp[N];

void update(int node,int st,int en,int id,int val)
{
    if(st>en || st>id || en<id)
        return ;
    if(st==en && st==id)
    {
        tree[node]=max(tree[node],val);
        return ;
    }
    int mid=(st+en)/2;
    if(st<=id && id<=mid)
    {
        update(2*node,st,mid,id,val);
    }
    else
    {
        update(2*node+1,mid+1,en,id,val);
    }

    tree[node]=max(tree[2*node],tree[2*node+1]);
}

int query(int node,int st,int en,int l,int r)
{
    if(st>r || en<l)
        return 0;
    if(l<=st && en<=r)
        return tree[node];

    int mid=(st+en)/2;
    return max(query(2*node,st,mid,l,r),query(2*node+1,mid+1,en,l,r));
}



int32_t main()
{
    boost
    // #ifndef ONLINE_JUDGE 
    // NAYAN
    // #endif

    int n;
    cin >> n;
    int i;
    for(i=1;i<=n;i++)
    {
        cin >> h[i];
    }

    for(i=1;i<=n;i++)
    {
        cin >> b[i];
    }
    
    dp[0]=0;

    for(i=1;i<=n;i++)
    {
        int tmp=query(1,1,n,1,h[i]-1);

        dp[h[i]]=tmp+b[i];

       // cout << tmp << " " << b[i] << endl;
        update(1,1,n,h[i],dp[h[i]]);


    }

    int ans=0;

    for(i=0;i<=n;i++)
    {
        ans=max(ans,dp[i]);
    }

    cout << ans;
    
    
    
}

Measured memory_bytes: 10496
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <set>

using namespace std;

int n,m;
int dp[100001];
vector<int> G[100001];

vector<int> topological_sort(){
    int indeg[n];
    set<int> st; // 入次数が0の頂点の番号
    fill(indeg, indeg+n, 0);
    for(int i=0;i<n;++i) for(int to: G[i]) indeg[to]++;
    for(int i=0;i<n;++i) if(indeg[i] == 0) st.insert(i);

    vector<int> ret;
    int used[n];
    fill(used, used+n, 0);
    while(!st.empty()){
        int node = *st.begin();
        st.erase(node);
        ret.push_back(node);
        used[node] = 1;
        for(int next: G[node]){
            indeg[next]--;
            if(!used[next] && indeg[next] == 0) st.insert(next);
        }
    }
    return ret;
}

int main() {
    int a,b;
    cin >> n >> m;
    
    for(int i=0;i<m;++i) {
        cin >> a >> b;
        --a; --b;
        G[a].push_back(b);
    }

    vector<int> nodes = topological_sort();

    for(int i=0;i<n;++i) {
        int from = nodes[i];
        for(int to: G[from]) {
            dp[to] = max(dp[to], dp[from] + 1);
        }
    }

    cout << *max_element(dp, dp+n) << "\n";
}

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


def main():
    n = int(input())
    h = list(map(int, input().split()))
    hi = 0
    lo = 10**9
    for i in range(0, n):
        hi = max(h[i], hi)
        if h[i] == hi:
            lo = hi
        lo = min(h[i], lo)
        if hi-lo >= 2:
            print("No")
            exit()

    print("Yes")


if __name__ == '__main__':
    main()

Measured memory_bytes: 59632
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<climits>
#include<cstdlib>
#include<cmath>
#include<map>
#include<vector>
#include<queue>
#include<string>
#include<csetjmp>
#include<bitset>
#include<cassert>
#include<cctype>
#include<complex>
#include<ctime>
#include<deque>
#include<fstream>
#include<functional>
#include<iomanip>
#include<limits>
#include<list>
#include<numeric>
#include<set>
#include<sstream>
#include<stack>
#include<utility>
using namespace std;
#define PI 3.1415926535897932384626433832795028
#define N 30
#define M 10010
#define inf 2000000000
typedef long long LL;
int k;
double p, e, t, ans;
void dfs(int cur, double l, double r, double temp) {
	if (l > t+e || r < t-e) return ;
	if (l >= t-e && r <= t+e) {
		ans += temp;
		return ;
	}
	double mid = (l+r)/2;
	if (cur == k) {
		if (fabs(mid - t) < e) ans += temp;
		return ;
	}
	if (mid > t) {
		dfs(cur+1, l, mid, temp*(1-p));
		dfs(cur+1, mid, r, temp*p);
	}
	else {
		dfs(cur+1, mid, r, temp*(1-p));
		dfs(cur+1, l, mid, temp*p);
	}
}
int main() {
	double l, r;
	while (scanf("%d%lf%lf", &k, &l, &r) != EOF) {
		scanf("%lf%lf%lf", &p, &e, &t);
		ans = 0;
		dfs (0, l, r, 1.0);
		printf("%.6lf\n", ans);
	}
	return 0;
}

Measured memory_bytes: 0
#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 <numeric>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF 1e18
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define PI (acos(-1))

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


int main() {
    ll N;
    string S;
    cin >> N;
    cin >> S;

    const ll MOD = 1e9 + 7;
    ll ans = 1, c = 0;
    REP(i, 2 * N){
        if (S[i] == 'W' ^ c % 2 == 0) c++;
        else{
            ans = (ans * c) % MOD;
            c--;
        }
    }
    if (c != 0) ans = 0;
    REP(i, N) ans = (ans * (i + 1)) % MOD;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define int long long
#define pb push_back
#define ff first
#define ss second
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define EPS 0.000000001 //1e-9
using ll = long long;
using pii = pair<int, int>;
const long long INF = 2e18;

template <class A, class B> ostream& operator<<(ostream &os, const pair<A, B> &p) {os << "(" << p.first << ", " << p.second << ")"; return os;} 
template <class A> ostream& operator<<(ostream &os, const vector<A> &v) {os << "{"; for(int i = 0; i < (int)v.size(); i++) if(i == 0) os << v[i]; else os << ", " << v[i]; os << "}"; return os;}

void dprint(string s) {cout << endl;}
template <class T, class... U> void dprint(string s, T t, U... u) 
{int w = s.find(','); cout << "[" << s.substr(0, w) << ": " << t << "] "; dprint(s.substr(w+2, (int)s.size()-w-1), u...);} 

#define DEBUG 
#ifdef DEBUG
#define dbg(X...) dprint(#X, X)
#else
#define dbg(X...) "KEEP CALM" 
#endif

const int N=1e6+5; // CHANGE this value ACC. TO Q.

int32_t main()
{
    IOS;
    int n, m; cin>>n>>m;
    int sx, sy; cin>>sx>>sy;
    int ex, ey; cin>>ex>>ey;
    sx--, sy--, ex--, ey--;
    vector<vector<char>> arr(n, vector<char>(m));
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<m;j++)
            cin>>arr[i][j];
    }

    auto valid=[&](int x, int y)
    {
        return x>=0 and y>=0 and x<n and y<m and arr[x][y]!='#';
    };

    set<pair<int, pii>> q;
    vector<vector<int>> dist(n, vector<int>(m, INF));
    dist[sx][sy]=0;
    q.insert({0, {sx, sy}});
    while(!q.empty())
    {
        int x, y; 
        tie(x, y)=q.begin()->ss;
        q.erase(q.begin());
        for(int dx=-2;dx<=2;dx++)
        {
            for(int dy=-2;dy<=2;dy++)
            {
                int curx=x+dx, cury=y+dy;
                if(valid(curx, cury))
                {
                    if(dist[curx][cury]>dist[x][y]+(abs(dx)+abs(dy)<=1?0:1))
                    {
                        q.erase({dist[curx][cury], {curx, cury}});
                        dist[curx][cury]=dist[x][y]+(abs(dx)+abs(dy)<=1?0:1);
                        q.insert({dist[curx][cury], {curx, cury}});
                    }
                }
            }
        }
    }
    if(dist[ex][ey]<INF)
        cout<<dist[ex][ey];
    else
        cout<<-1;
    return 0;
}

Measured memory_bytes: 12632
import copy
def main():
    N = input()
    array1 = list(map(int, input().split()))
    array2 = copy.deepcopy(array1)
    array1.sort()
    n = 0
    for c1,c2 in zip(array1,array2):
        if c1 != c2:
            n += 1
            if n == 3:
                print("NO")
                return
    print("YES")
    return
main()


Measured memory_bytes: 3572
#ifdef LOCAL111
	#define _GLIBCXX_DEBUG
#else
	#define NDEBUG
#endif
#include <bits/stdc++.h>
const long long INF = 1e15;
using namespace std;
template<typename T, typename U> ostream& operator<< (ostream& os, const pair<T,U>& p) { cout << '(' << p.first << ' ' << p.second << ')'; return os; }

#define endl '\n'
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#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(i,0,n)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#ifdef LOCAL111
	#define DEBUG(x) cout<<#x<<": "<<(x)<<endl
	template<typename T> void dpite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
#else
	#define DEBUG(x) true
	template<typename T> void dpite(T a, T b){ return; }
#endif
#define F first
#define S second
#define SNP string::npos
#define WRC(hoge) cout << "Case #" << (hoge)+1 << ": "
template<typename T> void pite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
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;}

typedef long long int LL;
typedef unsigned long long ULL;
typedef pair<int,int> P;
typedef pair<LL,LL> LP;

void ios_init(){
	//cout.setf(ios::fixed);
	//cout.precision(12);
#ifdef LOCAL111
	return;
#endif
	ios::sync_with_stdio(false); cin.tie(0);	
}

LL dis(int x, int y){
	if(x <= y) return y-x;
	else return INF;
}

int main()
{
	ios_init();
	int x,y;
	while(cin >> x >> y) {
		LL ans = INF;
		ans = min(ans,dis(x,y));
		ans = min(ans,dis(x,-y)+1);
		{
			int nx =-x;
			ans = min(ans,dis(nx,y)+1);
			ans = min(ans,dis(nx,-y)+2);
		}
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys


def solve(M: int):
    print(48 - M)


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    M = int(next(tokens))  # type: int
    solve(M)


if __name__ == '__main__':
    main()


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

typedef long long ll;
typedef pair<int,int> P;

#define p_ary(ary,a,b) do { cout << "["; for (int count = (a);count < (b);++count) cout << ary[count] << ((b)-1 == count ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

template<typename T1,typename T2>ostream& operator<<(ostream& os,const pair<T1,T2>& a) {os << "(" << a.first << ", " << a.second << ")";return os;}

const char newl = '\n';

int main() {
    int n;
    cin >> n;
    vector<int> cnt(n,0);
    for (int i = 1;i < n;++i) {
        int a;cin >> a;
        cnt[a-1]++;
    }
    for (int i = 0;i < n;++i) cout << cnt[i] << newl;
}

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

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

int main () {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  
  while (1) {
    c -= b;
    if (c <= 0) {
      cout << "Yes";
      return 0;
    }
    a -= d;
    if (a <= 0) {
      cout << "No";
      return 0;
    }
  }
}

Measured memory_bytes: 3636
#include <iostream>
using namespace std;
long long mod = 1000000007,inv[100010],f[100010],a[100010],ans = 0,res = 0;
void solve(){
    inv[1] = 1; f[1] = 1;
    for(int i=2;i<=100000;i++){
        inv[i] = mod - (mod/i)*inv[mod%i]%mod;
        f[i] = f[i-1]*i%mod;
    }
}

int main(){
    int i,n;
    cin >> n;
    solve();
    for(i=1;i<=n;i++){
        cin >> a[i];
        (res += inv[i]) %= mod;
    }
    ans = res*a[1]%mod;
    for(i=2;i<=n;i++){
        (res += (inv[i] - inv[n + 2 -i] + mod)%mod) %= mod;
        (ans += res*a[i]) %= mod;
    }
    (ans *= f[n]) %= mod;
    cout << ans << endl;
}

Measured memory_bytes: 2560
from collections import deque

N = int(input())
X = [list(map(int, input().split())) for _ in range(N)]

graph = [[] for _ in range(N * N)]
parents = [0] * (N * N)
for i, nodes in enumerate(X):
    for j1, j2 in zip(nodes[:-1], nodes[1:]):
        n1 = max(i, j1 - 1) * N + min(i, j1 - 1)
        n2 = max(i, j2 - 1) * N + min(i, j2 - 1)
        graph[n1].append(n2)
        parents[n2] += 1

dist = [0] * (N * N)
visited = [False] * (N * N)

q = deque()
for i, v in enumerate(parents):
    if v == 0:
        q.append(i)
        visited[i] = True
        dist[i] = 1

while q:
    u = q.popleft()
    for v in graph[u]:
        if visited[v]:
            continue

        parents[v] -= 1
        if parents[v] == 0:
            visited[v] = True
            dist[v] = dist[u] + 1
            q.append(v)

print(max(dist) if all(visited) else -1)


Measured memory_bytes: 199672
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
const ll mod = 1e9 + 7;
ll powmod(ll a, ll b) { ll res=1; a%=mod; assert(b>=0); for(;b;b>>=1) { if(b&1) res=res*a%mod; a=a*a%mod; } return res; }
ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a; }

int main() {
    ll a, b, n;
    cin >> a >> b >> n;
    
    n = min(b-1, n);
    ll res = (a*n) / b;

    cout << res << endl;

	return 0;
}


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

using namespace std;
typedef long long ll;

void DC(){ cout << - 1 << endl;}

int main(){
 int N; cin >> N; ll cnt = 0 ;
  vector<ll> A(N); vector<ll> B(N);
  priority_queue<pair<ll,int>> Q;
  for(int i = 0; i < N; i++){ cin >> B[i];}
  for(int j = 0; j < N; j++){ cin >> A[j]; Q.push(make_pair(A[j],j));}
  
  while(!Q.empty()){
    ll p = Q.top().first;
    int b = Q.top().second; Q.pop();
    if( p == B[b]){ continue;}
    if( p < B[b]){ DC(); return 0;}
    
    int a, c;
    if( b == 0){ a = N - 1; } else{ a = b - 1;}
    if( b == N - 1){ c = 0;} else{ c = b + 1;}
    
    if( A[b] < A[a] + A[c] ){ DC(); return 0;}
     
    if( A[b] % ( A[a] + A[c]) >= B[b]){ 
      cnt += A[b] / (A[a] + A[c]); 
      Q.push(make_pair( A[b] % ( A[a] + A[c]), b)); A[b] = A[b] % ( A[a] + A[c]);}
     
     else{
         ll res = A[b] - (( A[b] - B[b]) / ( A[a] + A[c] )) * ( A[a] + A[c]);
       
         if( res == A[b]){ DC(); return 0;}
         
         cnt += (A[b] - B[b])/( A[a] + A[c]); 
         Q.push(make_pair(res, b));
         A[b] = res;}
           
       
             }
             
             cout << cnt << endl; return 0;}
             
    
    

Measured memory_bytes: 9692
#include <algorithm>
#include <iostream>
#include <set>

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

int L;
int N[12], M[12];
void solve() {
    int sum = 0;
    int ans = -1;
    rep(i, 12) {
        sum += M[i] - N[i];
        if (L <= sum) {
            ans = i;
            break;
        }
    }
    if (ans == -1)
        cout << "NA" << endl;
    else
        cout << ans + 1 << endl;
}
int main() {
    while (cin >> L, L) {
        rep(i, 12) cin >> M[i] >> N[i];
        solve();
    }
}

Measured memory_bytes: 3092
N=int(input())
X=[int(i) for i in input().split()]
Y=sorted(X)
MidL=Y[N//2-1]#ちっちゃいほう(変化なしの場合)
MidR=Y[N//2]#でかいほう(下が減った場合)
for x in X:
	if x>=MidR:print(MidL)
	else:print(MidR)


Measured memory_bytes: 93652
#include<stdio.h>

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

Measured memory_bytes: 580
<?php
fscanf(STDIN, "%s %s", $a, $b);
if($a == 'H' && $b == 'H') {
    echo "H\n";
} elseif($a == 'H' && $b == 'D') {
    echo "D\n";
} elseif($a == 'D' && $b == 'H') {
    echo "D\n";
} elseif($a == 'D' && $b == 'D') {
    echo "H\n";
}

Measured memory_bytes: 4604
#include<cstdio>
int main(){
  int a, b, c;
  scanf("%d %d %d", &a, &b, &c);
  
  if(a+b == c)
    printf("Yes");
  else if(a+c == b)
    printf("Yes");
  else if(b+c == a)
    printf("Yes");
  else
    printf("No");
  
  return 0;
}

Measured memory_bytes: 128
# vim: fileencoding=utf-8


def main():
    n = int(input())
    li = list(map(int, input().split()))
    max = 0
    total = 0
    for i in li:
        if max < i:
            max = i
            continue
        elif max == i:
            continue
        else:
            total += max - i
    print(total)


if __name__ == "__main__":
    main()


Measured memory_bytes: 94244
#include<bits/stdc++.h>
using namespace std ;
#define ll long long int
int main(){
	ll a , b , c ;
	cin >> a >> b >> c ;
	if(a == b && b != c || (a == c && c != b) || (c == b && b != a))
		cout << "Yes" ;
	else
		cout << "No" ;
}

Measured memory_bytes: 256
read n;
AC=0;
TLE=0;
WA=0;
RE=0;

while read line ;
do
    if [ $line = "AC" ] ; then
        AC=$(($AC+1));
    elif [ $line = "TLE" ] ; then
        TLE=$(($TLE+1));
    elif [ $line = "WA" ] ; then
        WA=$(($WA+1));
    else
        RE=$(($RE+1));
    fi;
done;

echo AC x $AC;
echo WA x $WA;
echo TLE x $TLE;
echo RE x $RE;


Measured memory_bytes: 3748
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e18;
const ll mod = 1000000007;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
ll factorial(ll n) {
  if (n == 1) {
    return 1;
  }
  ll ans = factorial(n-1);
  return ans*n;
}
ll gcd(ll a, ll b) {
  if (a < b) {
    ll tmp = a;
    a = b;
    b = tmp;
  }
  ll r = a%b;
  while(r != 0) {
    a = b;
    b = r;
    r = a%b;
  }
  return b;
}
ll lcm(ll a, ll b) {
  return (a/gcd(a, b))*b;
}

int main() {
  ll a, b, c;
  cin >> a >> b >> c;
  cout << min(min(a, b), min(b, c)) << ' ' << max(max(a, b), max(b, c)) << endl;
}


Measured memory_bytes: 3112
//https://atcoder.jp/contests/abc137/tasks/abc137_a
#include <bits/stdc++.h>
using namespace std;
using ll=int64_t;
#define FOR(i,a,b) for(int64_t i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
int main() {
    ll A,B; cin>>A>>B;
    ll ans=max(A+B,A-B);
    ans=max(ans,A*B);
    cout<<ans<<endl;    
    return 0;
}

Measured memory_bytes: 256
fn read() -> (i32, i32, i32) {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let mut vec: Vec<i32> = s
        .trim()
        .split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect();
    vec.sort();
    (vec[0], vec[1], vec[2])
}

fn main() {
    let (a, b, c) = read();
    if a + b == c {
        println!("Yes");
    } else {
        println!("No");
    }
}


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

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

#define fst first
#define snd second
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define debug(...) fprintf(stderr, __VA_ARGS__)

template <typename T> bool chkmin(T& a, T b) { return a > b ? a = b, 1 : 0; }
template <typename T> bool chkmax(T& a, T b) { return a < b ? a = b, 1 : 0; }

const int oo = 0x3f3f3f3f;

inline void read(int& x) {
    x = 0;
    char ch = getchar();
    for(;!isdigit(ch); ch = getchar());
    for(; isdigit(ch); ch = getchar()) x = x * 10 + ch - 48;
}

const int N = 500000;

string procStatus() {
    ifstream t("/proc/self/status");
    return string(istreambuf_iterator<char>(t), istreambuf_iterator<char>());
}

int n;
int a[N + 5], w[N + 5];

int fa[N + 5];
int find(int x) {
    return (x == fa[x]) ? x : fa[x] = find(fa[x]);
}

struct node {
    int sz0, sz1, id;

    node() { }
    node(int s0, int s1, int _id): sz0(s0), sz1(s1), id(_id) { }

    inline bool operator < (const node& b) const {
        return (ll) sz1 * b.sz0 > (ll) b.sz1 * sz0;
    }
};

int main() {
#ifdef Wearry
    freopen("in", "r", stdin);
    freopen("out", "w", stdout);
#endif

    read(n);
    for(int i = 2; i <= n; ++i) read(a[i]);
    for(int i = 1; i <= n; ++i) read(w[i]);
    
    static node q[N + 5];
    static node cur[N + 5];

    int cnt = 0;
    for(int i = 1; i <= n; ++i) fa[i] = i;
    for(int i = 1; i <= n; ++i) {
        cur[i] = node((w[i] == 0), (w[i] == 1), i);
        if(i > 1) q[++ cnt] = cur[i];
    }

    make_heap(q + 1, q + cnt + 1);

    ll ans = 0;
    while(cnt) {
        node temp = q[1]; 
        pop_heap(q + 1, q + cnt-- + 1);
        if(temp.sz0 != cur[temp.id].sz0 || temp.sz1 != cur[temp.id].sz1) continue; 

        int u = temp.id, f = find(a[u]);

        fa[u] = f;
        ans += (ll) cur[f].sz1 * temp.sz0;
        cur[f] = node(temp.sz0 + cur[f].sz0, temp.sz1 + cur[f].sz1, f);

        if(f) { 
            q[++ cnt] = cur[f]; 
            push_heap(q + 1, q + cnt + 1); 
        }
    }
    printf("%lld\n", ans);

    return 0;
}


Measured memory_bytes: 13440
#include<bits/stdc++.h>
using namespace std;
#define  ft  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int main()
{
    ft
    long long t,i,j,n,m,l=0,r,c[10][10];
    string s;
    cin>>n>>m;
    if(n*500>=m)
    {
        cout<<"Yes\n";
    }
    else
    {
        cout<<"No\n";
    }
    return 0;
}



Measured memory_bytes: 3584
#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;
// {{{ Modint
// using mint = modint<1000000007>;
// mint x = 2;
// std::cout << x.a << std::endl;
template <std::int64_t M>
class modint {
 public:
  int64_t a;

  explicit constexpr modint(const int64_t x = 0) noexcept :
    a((x % M + M) % M) {}
  constexpr int64_t &value() noexcept { return a; }
  constexpr const int64_t &value() const noexcept { return a; }
  constexpr modint operator+(const modint rhs) const noexcept {
    return modint(*this) += rhs;
  }
  constexpr modint operator-(const modint rhs) const noexcept {
    return modint(*this) -= rhs;
  }
  constexpr modint operator*(const modint rhs) const noexcept {
    return modint(*this) *= rhs;
  }
  constexpr modint operator/(const modint rhs) const noexcept {
    return modint(*this) /= rhs;
  }
  constexpr modint &operator+=(const modint rhs) noexcept {
    a += rhs.a;
    if (a >= M) {
      a -= M;
    }
    return *this;
  }
  constexpr modint &operator-=(const modint rhs) noexcept {
    if (a < rhs.a) {
      a += M;
    }
    a -= rhs.a;
    return *this;
  }
  constexpr modint &operator*=(const modint rhs) noexcept {
    a = a * rhs.a % M;
    return *this;
  }
  constexpr modint &operator/=(modint rhs) noexcept {
    int64_t exp = M - 2;
    while (exp) {
      if (exp % 2) {
        *this *= rhs;
      }
      rhs *= rhs;
      exp /= 2;
    }
    return *this;
  }
  constexpr modint pow(ll t) const {
    if (!t) return modint(1);
    modint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
};
// }}}
using mint = modint<1000000007>;

// d[i][m][s]: 上からi桁まで見て、かつi桁番目までがKと m(atch) し総和がsとなる、場合の数
mint d[20000][2][200];
vector<ll> K;
ll D, N;

signed main() {
  string tmp;
  cin >> tmp >> D;
  N = tmp.size();
  K.resize(N);
  rep(i, N) {
    K[i] = tmp[i] - '0';
    // cout << "i=" << i << " Ki=" << K[i] << endl;
  }
  // cout<< "N=" << N << endl;

  // init
  rep(p, K[0]) {
    d[0][0][p%D] += mint(1);
  }
  d[0][1][K[0]%D] = mint(1);

  // process
  rep(i, N-1) rep(s, 200) {
    // for m=0
    {    
      rep(p, 10) {
        d[i+1][0][(s+p)%D] += d[i][0][s];
      }
    }
    // for m=1
    {
      rep(p, K[i+1]) {
        d[i+1][0][(s+p)%D] += d[i][1][s];
      }
      {
        ll p = K[i+1];
        d[i+1][1][(s+p)%D] += d[i][1][s];
      }
    }
  }
  //rep(i, N) rep(m, 2) rep(s, 200) {
  //  if (d[i][m][s].value() == 0) continue;
  //  printf("d[%ld][%ld][%ld] = %ld\n", i,m,s,d[i][m][s].value());
  //}

  mint ans(0);
  rep(m, 2) {
    ans += d[N-1][m][0];
  }
  ans -= mint(1); // 0...0 を引く
  cout << ans.value() << endl;
  return 0;
}


Measured memory_bytes: 33152
N,M = gets.split.map &:to_i
A = Array.new(M){gets.to_i}
MOD = 10 ** 9 + 7

S = Array.new(N+2, 0)
S[0] = 1

M.times do |i|
  S[A[i]] = nil
end

0.upto(N-1) do |i|
  1.upto(2) do |j|
    if S[i] && S[i+j]
      S[i+j] += S[i]
      S[i+j] %= MOD
    end
  end
end

p S[N]

Measured memory_bytes: 3580
#include<bits/stdc++.h>
using ll = long long;
using namespace std;
const ll INF = 1000000000000000000;
const ll mod = 1000000007;
const ll MAX_N = 1 << 17;
ll nn, dat[2 * MAX_N - 1]; //セグメント木を持つグローバル配列
void init(ll n_) { //初期化
	nn = 1; //簡単のため、要素数を2のべき乗に
	while (nn < n_)nn *= 2;
	//全ての値をINT_MAXに
	for (int i = 0; i < 2 * nn - 1; i++) dat[i] = INT_MAX;
}
void update(ll k, ll a) { //k番目の値(0-indexed)をaに変更
	k += nn - 1; dat[k] = a; //葉の節点
	while (k > 0) { //登りながら更新
		k = (k - 1) / 2;
		if (dat[k * 2 + 2] == INT_MAX) { dat[k] = dat[k * 2 + 1]; }
		else if (dat[k * 2 + 1] == INT_MAX) { dat[k] = dat[k * 2 + 2]; }
		else { dat[k] = dat[k * 2 + 1] * dat[k * 2 + 2] % mod; }
	}
}
//[a, b)の最小値を求める
//kは節点の番号、l, rはその節点が[l, r)に対応づいていることを表す。
//したがって外からはquery(a, b, 0, 0, nn)として呼ぶ。
ll query(ll a, ll b, ll k, ll l, ll r) {
	if (r <= a || b <= l) { return INT_MAX; }
	if (a <= l && r <= b) { return dat[k]; }
	else {
		ll vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
		ll vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
		if (vr == INT_MAX) { return vl; }
		if (vl == INT_MAX) { return vr; }
		return (vl * vr) % mod;
	}
}
ll res[1234567];
void prime_factor(ll n) {
	for (int i = 2; i * i <= n; i++) {
		ll a = 0;
		while (n % i == 0) {
			a++; n /= i;
		}
		res[i] = max(res[i], a);
	}
	if (n != 1) { res[n] = max((ll)1, res[n]); }
}
vector<ll> s(ll n) {
	vector<ll> res;
	for (int i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			res.push_back(i); n /= i;
		}
	}
	if (n != 1) res.push_back(n);
	return res;
}
ll aa[12345678], cost[12345678];
signed main() {
	ll n, m, a = 0, x = 0, y = 0, ans = 0; cin >> n;
	vector<ll> v;
	for (int h = 0; h < n; h++) {
		cin >> aa[h]; prime_factor(aa[h]);
	}
	for (int h = 1; h <= 1000000; h++) {
		if (res[h] != 0) {
			cost[h] = v.size();
			for (int i = 0; i < res[h]; i++) {
				v.push_back(h);
			}
		}
	}
	init(v.size());
	for (int h = 0; h < v.size(); h++) {
		update(h, v[h]);
	}
	for (int h = 0; h < n; h++) {
		ll z = 0, cnt = 1; map<ll, ll> uio;
		vector<ll> sa = s(aa[h]);
		for (int i = 0; i < sa.size(); i++) {
			ll gh = query(z, cost[sa[i]] + uio[sa[i]], 0, 0, nn);
			if (gh != INT_MAX) {
				cnt *= gh; cnt %= mod;
			}
			uio[sa[i]]++; z = cost[sa[i]] + uio[sa[i]];
			//cout << cnt << ' ' << sa[i] << ' ' << z << endl;
		}
		//cout << cnt << ' ' << query(z, nn, 0, 0, nn) << endl;
		if (query(z, nn, 0, 0, nn) != INT_MAX) {
			cnt *= query(z, nn, 0, 0, nn); cnt %= mod;
		}
		ans += cnt; ans %= mod;
	}
	cout << ans % mod << endl;
	return 0;
}

Measured memory_bytes: 20608
public class Main {
  private static void solve() {
    int x = ni();
    int y = ni();
    int z = ni();
    
    System.out.println((x - z) / (y + z));
  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}




Measured memory_bytes: 22996
(* O(n * log(n)) *)
let solve n a_s =
  let a_s = Array.of_list a_s in
  Array.sort compare a_s;
  a_s.(n - 1) - a_s.(0)

let read_ints () = read_line () |> Str.split (Str.regexp " ") |> List.map int_of_string

let _ =
  let n = read_int () in
  read_ints () |> solve n |> string_of_int |> print_endline

Measured memory_bytes: 384
h, w, k = gets.split.map(&:to_i)
s = h.times.map { gets.chomp }
a = h.times.map { Array.new(w, 0) }
kk = 0
exist = false
skip = 0
for i in 0...h do
  if s[i].include?("#")
    exist = true
    j = 0
    while true do
      p = s[i].index("#", j)
      if !p.nil?
        kk += 1
        for jj in j..p do
          a[i][jj] = kk
        end
        j = p + 1
      else
        for jj in j...w do
          a[i][jj] = kk
        end
        break
      end
    end
  else
    if exist
      for jj in 0...w do
        a[i][jj] = a[i-1][jj]
      end
    else
      skip += 1
    end
  end
end
for i in 0...skip do
  for jj in 0...w do
    a[i][jj] = a[skip][jj]
  end
end
for i in 0...h do
  puts a[i].join(" ")
end


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

long long n,T,A;
const long long MX=1e18;

int main() {

    while(cin>>n){

        long long preT=0,preA=0;

        while(n--){

            scanf("%lld %lld",&T,&A);

            long long low=0,high=ceil((double)MX/(T+A));

            while(high-low>1){
               long long mid=(low+high)/2;

               if(T*mid>=preT && A*mid>=preA )
                high=mid;
               else
                low=mid;
            }

            preT=T*high , preA=A*high;
//          cout<<high<<" "<<preT<<" "<<preA<<endl;

        }

        cout<<preT+preA<<endl;


    }


    return 0;
}


Measured memory_bytes: 256
#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>;

const ll INF = 1e18;
const int MX = 2005;

int main() {
  ll n,W;
  cin >> n >> W;
  ll w[n],v[n];
  rep(i,n) cin >> w[i] >> v[i];
  ll dp[n+10][100010]; 
  rep(i,n+10) rep(j,W+10) dp[i][j] = 0;
  rep(i,n){
    rep(j,W+1){
      if(j >= w[i]){
        dp[i+1][j] = max(dp[i][j],dp[i][j-w[i]]+v[i]);
      }else{
        dp[i+1][j] = dp[i][j];
      }
    }
  }
  cout << dp[n][W] << endl;
}

Measured memory_bytes: 86144
#include <iostream>
#include <stack>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <functional>
#include <string>
#include <cstdlib>
#include <numeric>
#include <cstdbool>
#include <cstring>
#include <map> 
#include<set>
#include<queue>
#include <iomanip>

typedef long long ll;

#define rep(i,n) for(ll i=0;i<n;i++)
using namespace std;

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

const long long INF = 1000000000000000;
const ll inf = -1e18;
typedef pair<ll, ll> P;
ll ma = 1000000000 + 7;
ll mx = 1000003;
ll h,n, w,m,t; string s;
ll R, C;
ll sy, sx, gy, gx;
char maze[110][110];
ll dis[20][20];
int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };
ll gcd(ll x, ll y) {
	if (x % y == 0) return y;
	return gcd(y, x % y);
}
ll lcm(ll a,ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
void comb(vector<vector <ll> >& v) {
	for (ll i = 0; i < v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (ll k = 1; k < v.size(); k++) {
		for (int j = 1; j < k; j++) {
			v[k][j] = (v[k - 1][j - 1] + v[k - 1][j])%ma;
		}
	}
}

ll GetDigit(ll num) {
	return log10(num) + 1;
}
ll Combination(int n, int r)
{
	if (n - r < r) r = n - r;
	if (r == 0) return 1;
	if (r == 1) return n;

	vector<ll> numerator(r);
	vector<ll> denominator(r);

	for (int k = 0; k < r; k++)
	{
		numerator[k] = n - r + k + 1;
		denominator[k] = k + 1;
	}

	for (int p = 2; p <= r; p++)
	{
		int pivot = denominator[p - 1];
		if (pivot > 1)
		{
			int offset = (n - r) % p;
			for (int k = p - 1; k < r; k += p)
			{
				numerator[k - offset] /= pivot;
				denominator[k] /= pivot;
			}
		}
	}

	ll result = 1;
	for (int k = 0; k < r; k++)
	{
		if (numerator[k] > 1) result *= numerator[k];
		result %= ma;
	}

	return result;
}

ll bfs() {
	queue<P> que;
	for (int i = 0; i < R; i++) {
		for (int j = 0; j < C; j++) dis[i][j] = INF;
	}
	que.push(P(sy - 1, sx - 1));
	dis[sy - 1][sx - 1] = 0;

	while (que.size() > 0) {
		P p = que.front();
		que.pop();
		if (p.first == gy - 1 && p.second == gx - 1) break;
		for (ll i = 0; i < 4; i++) {
			ll ny = p.first + dy[i];
			ll nx = p.second + dx[i];
			if (0 <= ny && ny < R && 0 <= nx && nx < C && maze[ny][nx] == '.' && dis[ny][nx] == INF) {
				que.push(P(ny, nx));
				dis[ny][nx] = dis[p.first][p.second] + 1;
			}
		}
	}
	return dis[gy - 1][gx - 1];
}
ll res = 0;
vector<ll> A(13);
ll p = 0;
ll q, ans;
struct item {
	ll a, b, c, d;
} st[55];


int main() {
	ll m;
	cin >> n >> m;
	if (n == 1 && m == 1) {
		cout << 1 << endl;
	}
	else if (n == 1 && m > 1) {
		cout << m - 2 << endl;
	}
	else if (m == 1 && n > 1) {
		cout << n - 2 << endl;
	}
	else {
		cout << (n - 2) * (m - 2) << endl;
	}
}

Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
	while(1){
	int a,b,c,x[11];
vector<int>vec;
	scanf("%d",&a);
	scanf("%d",&b);
	if(a==0){
		break;
	}
	for(int i=0;i<a;i++){
		scanf("%d",&x[i]);
	}
	if(b==2){
		for(int i=0;i<a;i++){
			for(int j=0;j<a;j++){
				if(j!=i){
				if(x[j]>=10){
					vec.push_back(x[i]*100+x[j]);
				}else{
					vec.push_back(x[i]*10+x[j]);
				}
				}
			}
		}
	}else if(b==3){
		for(int i=0;i<a;i++){
			for(int j=0;j<a;j++){
				if(j!=i){
				for(int k=0;k<a;k++){
					if(k!=i){
						if(k!=j){
					if(x[k]>=10){
						if(x[j]>=10){
							vec.push_back(x[i]*10000+x[j]*100+x[k]);
						}else{
							vec.push_back(x[i]*1000+x[j]*100+x[k]);
						}
					}
					else{
						if(x[j]>=10){
							vec.push_back(x[i]*1000+x[j]*10+x[k]);
						}else{
							vec.push_back(x[i]*100+x[j]*10+x[k]);
						}
					}
				}
			}
		}
				}
			}
		}
	}else if(b==4){
		for(int i=0;i<a;i++){
			for(int j=0;j<a;j++){
				if(j!=i){
				for(int k=0;k<a;k++){
					if(k!=i){
						if(k!=j){
					for(int h=0;h<a;h++){
						if(h!=i){
							if(h!=j){
								if(h!=k){
						if(x[h]>=10){
							if(x[k]>=10){
								if(x[j]>=10){
									vec.push_back(x[i]*1000000+x[j]*10000+x[k]*100+x[h]);
								}else{
									vec.push_back(x[i]*100000+x[j]*10000+x[k]*100+x[h]);
								}
							}else{
								if(x[j]>=10){
									vec.push_back(x[i]*100000+x[j]*1000+x[k]*100+x[h]);
								}else{
									vec.push_back(x[i]*10000+x[j]*1000+x[k]*100+x[h]);
								}
							}
						}else{
							if(x[k]>=10){
								if(x[j]>=10){
									vec.push_back(x[i]*100000+x[j]*1000+x[k]*10+x[h]);
								}else{
									vec.push_back(x[i]*10000+x[j]*1000+x[k]*10+x[h]);
								}
							}else{
								if(x[j]>=10){
									vec.push_back(x[i]*10000+x[j]*100+x[k]*10+x[h]);
								}else{
									vec.push_back(x[i]*1000+x[j]*100+x[k]*10+x[h]);
								}
							}
						}
					}
				}
					}
					}
						}
						}
				}
				}
			}
		}
	}
	sort(vec.begin(),vec.end());
	int ans=1;
	for(int i=0;i<vec.size()-1;i++){
		if(vec[i]!=vec[i+1]){
			ans++;
		}
	}
	printf("%d\n",ans);
	}
	return 0;
}

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

int main() {
	int a,b,x,count1,count2;
	cin >> x >> a >> b;
	if (a < x) {
		count1 = x - a;
	}
	else {
		count1 = a - x;
	}
	if (b < x) {
		count2 = x - b;
	}
	else {
		count2 = b - x;
	}
	if (count1 < count2) {
		cout << 'A';
	}
	else {
		cout << 'B';
	}


	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int s1[3][3];
	int s11[3][3]={0};
	for(int i=0;i<3;i++){
		for(int j=0;j<3;j++){
			cin>>s1[i][j];
		}
	}
	
	int n;
	cin>>n;
	int s2[10];
	int flag=-1;
	for(int i=0;i<n;i++){
		cin>>s2[i];
		
		for(int j=0;j<3;j++){
			for(int k=0;k<3;k++){
				if(s1[j][k]==s2[i]){
					s11[j][k]=1;
				}
			}
		}
	}
	if((s11[0][0]==1&&s11[1][1]==1&&s11[2][2]==1)||(s11[2][0]==1&&s11[1][1]==1&&s11[0][2]==1)){
		cout<<"Yes";
		return 0;
	} 
	for(int i=0;i<3;i++){
		if((s11[i][1]==1&&s11[i][0]==1&&s11[i][2]==1)||s11[0][i]==1&&s11[1][i]==1&&s11[2][i]==1){
			cout<<"Yes";
			return 0;	
		}
	}
	cout<<"No";
	
	return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
     
int main() {
  int N;
  cin >> N;
  
  int ans=0;

  if(N<10){
    ans=N;
  }
  else if(N<100){
    ans=N-((N/10)*10);
  }
  else{
    ans=N-((N/100)*100);
    ans=N-((N/10)*10);
  }

  if(ans==3){
    cout << "bon" << endl;
  }
  else if(ans==0 || ans==1 || ans==6 || ans==8){
    cout << "pon" << endl;
  }
  else{
    cout << "hon" << endl;
  }

return 0;
}

Measured memory_bytes: 3624
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
#include <string.h>
#include <math.h>


int main(){
  int a,b,x;
  int h[1001]={};
  scanf("%d %d",&a,&b);
  h[0]=0;
  for(int i=1;i<1000;i++){
    h[i]+=h[i-1]+i;
  }
  x=h[b-a-1]-a;
  printf("%d",x);
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define all(x) (x).begin(), (x).end()
#define MOD 1000000007

int main() {
    int n, a, b;
    cin >> n >> a >> b;
    if((b - a - 1) % 2 == 1) {
        cout << "Alice" << endl;
    } else {
        cout << "Borys" << endl;
    }
}


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

void swap(int* x, int* y){
    int t;
    if(*x>*y){
        t = *x;
        *x = *y;
        *y = t;
    }
}

int main(){
    int a, b, c;
    cin>>a>>b>>c;
    swap(&a, &b);
    swap(&b, &c);
    swap(&a, &b);
    cout<<a<<" "<<b<<" "<<c<<endl;
}


Measured memory_bytes: 3092
x, k, d = map(int, input().split())
if x < 0:
    x = -x
if k * d <= x:
    print(x - k * d)
else:
    t = x // d
    x -= t * d
    k -= t
    if x >= d:
        x -= d
        k -= 1
    if k % 2 == 1:
        x -= d
    print(abs(x))


Measured memory_bytes: 9188
N = int(input())
A = list(map(int,input().split()))
mod = 10 ** 9 + 7
cnt = [0 for _ in range(60)]
for a in A:
    for i in range(60):
        cnt[i] += a & 1
        a >>= 1
cnt = [x * (N - x) % mod for x in cnt]
power = 1
ans = 0
for i in range(60):
    ans += power * cnt[i]
    power *= 2
    power %= mod
ans %= mod
print(ans)

Measured memory_bytes: 122936
#include <iostream>
#include <iomanip>
#include <math.h>
#include <string>
#include <algorithm>
//#include <ctype.h>
#include <vector>
#include <numeric>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <bitset>
using namespace std;

#define ll long long int
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repm(i, a, n) for (int i = a; i >= n; i--)
#define INF 1e9
#define LINF 1e17
#define MOD (int)(1e9 + 7)
#define pi 3.141592653589
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vs vector<string>
#define vii vector<vector<int>>
#define vll vector<ll>
#define vllll vector<vector<ll>>
#define ALL(a) (a).begin(), (a).end()
#define sort_v(a) sort(a.begin(), a.end())
#define fi first
#define se second

void print(bool c)
{
    if (c)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

void Print(bool c)
{
    if (c)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}

ll gcdll(ll a, ll b)
{
    while (1)
    {
        if (a < b)
            swap(a, b);
        if (b == 0)
            break;
        a %= b;
    }
    return a;
}

int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

bool cmp(const pii &a, const pii &b)
{
    if (a.second != b.second)
        return a.second < b.second;
    return a.first < b.first;
}

ll C(int a, int b)
{
    b = min(b, a - b);
    //cout << a << " " << b << endl;
    if (b == 0)
        return 1;
    ll ans = 1;
    rep(i, a - b + 1, a + 1)
    {
        ans *= i;
        //cout << i << " " << ans << endl;
    }
    rep(i, 1, b + 1)
    {
        ans /= i;
        //cout << ans << endl;
    }
    return ans;
}

ll pow(int a, int b)
{
    ll ans = 1;
    rep(i, 0, b) ans *= a;
    return ans;
}

int main(void)
{
    int n, p, a;
    cin >> n >> p;
    int odd = 0, even = 0;
    rep(i, 0, n)
    {
        cin >> a;
        (a % 2 == 0) ? (even++) : (odd++);
    }

    if (p == 1 && odd == 0)
    {
        cout << 0 << endl;
        return 0;
    }
    ll comb = 0;
    if (p == 0)
        rep(i, 0, odd / 2 + 1) comb += C(odd, i * 2);
    else
        rep(i, 0, (odd - 1) / 2 + 1) comb += C(odd, i * 2 + 1);
    cout << comb * pow(2, even) << endl;
}

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

using namespace std;

typedef long long ll;

const int MOD = 1e9 + 7;

int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; ++i) cin >> A[i];
  vector<int> L(N + 1, 0), R(N + 1, 0);
  L.front() = 0;
  R.back() = 0;
  for (int i = 1; i <= N; ++i) L[i] = gcd(L[i - 1], A[i - 1]);
  for (int i = N - 1; i >= 0; --i) R[i] = gcd(R[i + 1], A[i]);
  int res = 1;
  for (int i = 0; i < N; ++i) {
    int m = gcd(L[i], R[i + 1]);
    res = max(res, m);
  }
  cout << res << endl;
}

Measured memory_bytes: 1408
#include<iostream>
#include<string>
#include<algorithm>
#include<bits/stdc++.h>
 
using namespace std;


int MOD=1000000007;


int main() {
	int N,ans=0,f,s; 
  cin >> N;
  int a[N+10];
  map<int, int> mp;
	for (int i=0; i<N; i++) cin >> a[i];
  
	for (int i=0; i<N; i++) mp[a[i]]+=1;

	for (auto p: mp) {
		f=p.first;
		s=p.second;
		if (s<f) ans += s;
		else ans+=s-f;
	}
	cout << ans << endl;
}

Measured memory_bytes: 5120
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a),i_##END_=(b);i<=i_##END_;++i)
#define REP(i,a,b) for(int i=(a),i_##END_=(b);i>=i_##END_;--i)
#define M 1000005
#define N 10000005
#define fi first
#define se second
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef pair<int,int> Pa;
string a,b;
map<string,bool>mp;
int n;
int main(){
	cin>>n;
	cin>>a;
	mp[a]=1;
	FOR(i,1,n-1){
		int len=a.size();
		cin>>b;
		if(mp.find(b)!=mp.end()){puts("No");return 0;}
		mp[b]=1;
		if(b[0]!=a[len-1]){puts("No");return 0;}
		a=b;
	}
	puts("Yes");
	return 0;
}

Measured memory_bytes: 256
fn read<T: std::str::FromStr>(
    stdin_lock: &mut std::io::StdinLock,
    buf: &mut Vec<u8>,
    delimiter: u8,
) -> T {
    buf.clear();
    let l = std::io::BufRead::read_until(stdin_lock, delimiter, buf).unwrap();
    buf.truncate(l - 1); // remove delimiter
    let s = unsafe { std::str::from_utf8_unchecked(&buf) };
    s.parse().unwrap_or_else(|_| panic!("read"))
}

fn main() {
    let stdin = std::io::stdin();
    let mut stdin_lock = stdin.lock();
    let mut buf: Vec<u8> = Vec::new();
    let a: String = read(&mut stdin_lock, &mut buf, b' ');
    let b: String = read(&mut stdin_lock, &mut buf, b'\n');
    let c: String = a + &b;
    let f: f32 = c.parse::<f32>().unwrap().sqrt();
    let ans = f == f.ceil();
    println!("{}", if ans { "Yes" } else { "No" });
}


Measured memory_bytes: 4352
#include <string>
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <vector>
#include <cmath>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;

int main()
{
    string s, t;
    cin >> s >> t;
    bool ans = true;
    rep(i, s.size()){
        if(s[i] != t[i]){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 3624