akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define N 200005
ll mod=998244353;
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
#define all(x) x.begin(),x.end()
#define lb lower_bound
ll powermodm(ll x,ll n,ll M){ll result=1;while(n>0){if(n % 2 ==1)result=(result * x)%M;x=(x*x)%M;n=n/2;}return result;}
ll power(ll _a,ll _b){ll _r=1;while(_b){if(_b%2==1)_r=(_r*_a);_b/=2;_a=(_a*_a);}return _r;}
int main()
{
    fast;
    ll n;
    cin>>n;
    ll s=(n*(n-1))/2;
    vector< pair <ll,ll> > g;
    if(n%2==0)
    {
        ll b[n+1]={0};
        for(int i=2;i<=n-1;i++)
        {
            g.pb(mp(i,1));
            g.pb(mp(n,i));
        }
        for(int i=2;i<=n-1;i++)
        {
            for(int j=i+1;j<=n-1;j++)
            {
                if(j==n+1-i)
                {

                }
                else
                {
                    g.pb(mp(i,j));
                }
            }
        }
    }
    else
    {
    
        for(int i=1;i<=n-1;i++)
        {

            g.pb(mp(n,i));
        }
        for(int i=1;i<=n-1;i++)
        {
            for(int j=i+1;j<=n-1;j++)
            {
                if(i==j || j==n-i)
                {

                }
                else
                {

                    g.pb(mp(i,j));
                }
            }
        }
    }
    cout<<g.size()<<endl;
    for(int i=0;i<g.size();i++)
    {
        cout<<g[i].ff<<" "<<g[i].ss<<endl;
    }
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Edge = pair<int, int>;
using Graph = vector<vector<Edge>>;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
const ll MOD = 1000000007;
const ll nmax = 8;
const ll INF = 1e9;
bool graph[nmax][nmax];
vector<vector<ll>> dist = vector<vector<ll>>(nmax, vector<ll>(nmax, INF));
void warshall_floyd(ll n)
{
    for (size_t i = 0; i < n; i++)
    {
        for (size_t j = 0; j < n; j++)
        {
            for (size_t k = 0; k < n; k++)
            {
                dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]);
            }
        }
    }
}

class UnionFind
{
public:
    vector<ll> Parent;

    UnionFind(ll N)
    {
        Parent = vector<ll>(N, -1);
    }
    ll find(ll A)
    {
        if (Parent[A] < 0)
            return A;
        return Parent[A] = find(Parent[A]);
    }

    ll size(ll A)
    {
        return -Parent[find(A)];
    }

    bool Union(ll A, ll B)
    {
        A = find(A);
        B = find(B);
        if (A == B)
        {
            return false;
        }
        if (size(A) < size(B))
            swap(A, B);

        Parent[A] += Parent[B];
        Parent[B] = A;

        return true;
    }
};

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

ll lcm(ll a, ll b)
{
    ll g = gcd(a, b);
    return a / g * b;
}

ll mulMod(ll a, ll b)
{
    return (((a % MOD) * (b % MOD)) % MOD);
}

ll powMod(ll a, ll p)
{
    if (p == 0)
    {
        return 1;
    }
    else if (p % 2 == 0)
    {
        ll half = powMod(a, p / 2);
        return mulMod(half, half);
    }
    else
    {
        return mulMod(powMod(a, p - 1), a);
    }
}

ll ceil(ll a, ll b)
{
    return (a + b - 1) / b;
}

void solve(long long N, std::vector<long long> L)
{
    SORT(L);
    ll ans = 0;

    for (int mid = N - 1; mid >= 0; mid--)
    {
        for (int low = mid - 1; low >= 0; low--)
        {
            auto itr = lower_bound(L.begin(), L.end(), L[mid] + L[low]);
            ll ng = distance(itr, L.end());
            ans += (N - 1 - mid) - ng;
        }
    }

    cout << ans << endl;
}

int main()
{
    long long N;
    scanf("%lld", &N);
    std::vector<long long> L(N);
    for (int i = 0; i < N; i++)
    {
        scanf("%lld", &L[i]);
    }
    solve(N, std::move(L));
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define max3(a,b,c) ((a>b)?(a>c)?a:c:(b>c)?b:c)
#define min3(a,b,c) ((a<b)?(a<c)?a:c:(b<c)?b:c)
#define testcase int t;cin>>t;while(t--)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(), x.end()
#define pii pair<int, int>
#define pll pair<long long int,long long int>
#define rep(a,b) for(int i=a;i<b;i++)
#define updiv(a,b) (ceil)((a)*(1.0)/(b))
typedef long long int ll;
typedef unsigned long long int ull;
#define M 1000000007
using namespace std;
int arr[3][3];
bool bom[3][3];
void search(int b)
{
  for(int i=0;i<3;i++)
{
    for(int j=0;j<3;j++)
    {
        if(arr[i][j]==b)
            bom[i][j]=1;
    }
}
}
int main()
{
fast
for(int i=0;i<3;i++)
{
    for(int j=0;j<3;j++)
    {
        cin>>arr[i][j];
        bom[i][j]=0;
    }
}
int n;
cin>>n;
int b;
rep(0,n)
{
    cin>>b;
    search(b);
}
if(bom[0][0]==1&&bom[0][1]==1&&bom[0][2]==1||
   bom[1][0]==1&&bom[1][1]==1&&bom[1][2]==1||
   bom[2][0]==1&&bom[2][1]==1&&bom[2][2]==1||
   bom[0][0]==1&&bom[1][0]==1&&bom[2][0]==1||
   bom[0][1]==1&&bom[1][1]==1&&bom[2][1]==1||
   bom[0][2]==1&&bom[1][2]==1&&bom[2][2]==1||
   bom[0][0]==1&&bom[1][1]==1&&bom[2][2]==1||
   bom[0][2]==1&&bom[1][1]==1&&bom[2][0]==1)
    cout<<"Yes";
else
    cout<<"No";
return 0;
}







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

public class Main {
	public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int n=s.nextInt();
        BigInteger mul=BigInteger.ONE;
        BigInteger mul2;
        BigInteger[] arr=new BigInteger[n];
        for(int i=0;i<n;i++){
            arr[i]=s.nextBigInteger();
            mul2=mul.multiply(arr[i]);
            mul=arr[i].gcd(mul);
            mul=mul2.divide(mul);
        }
        System.out.println(mul);
        
	}
}


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


int main(){


    vector<int> number;
    for(int i = 0; i < 100000; i++){
        number.push_back(i*7 + 1);
        number.push_back(i*7 + 6);
        if(number[number.size() - 1] > 300000) break;        
    }


    vector<bool> sosuu(300000, true);
    for(int i = 1; i < number.size(); i++){
        if(sosuu[number[i]] == true){

            for(int j = 2*number[i]; j < 300000; j += number[i]){
                sosuu[j] = false;                
            }
        }
    }

    /*for(int i = 0; i < 30; i++){
        if(sosuu[number[i]] == false) cout << number[i] << endl;
    }*/

    vector<int> so;
    for(int i = 1; i < number.size(); i++){
        if(sosuu[number[i]] == true) so.push_back(number[i]);
    }

    /*for(int i = 0; i < so.size(); i++){
        cout << so[i] << endl;
    }*/


    while(1){
        int n; cin >> n;
        if(n == 1) break;

        cout << n << ":";
        
        for(int i = 0; i < so.size(); i++){
            if(n % so[i] == 0){
                cout << " " << so[i];
            }
        }

        cout << endl;
        
        
    }
}


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

using namespace std;

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

void solve() {
  int a, b, c;
  cin >> a >> b >> c;
  cout << min(c, b/a) << endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  solve();
}


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

using namespace std;
using ll = long long int;
#define vll vector<ll>

#define FOR(i, b, e) for(int i = (b); i < (e); ++i)
#define REP(i, e) FOR(i, 0, e)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define REV(v) reverse((v).begin(), (v).end())
#define IN(v) cin >> (v);
#define VIN(v, n) REP(i, n) cin >> v[i];
#define OUT(v) cout << (v) << endl;
#define YN(b) OUT((b) ? "YES" : "NO")
#define Yn(b) OUT((b) ? "Yes" : "No")
#define yn(b) OUT((b) ? "yes" : "no")

const ll MOD = 1000000007;

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

  int n, k;
  string s;
  cin >> n >> s >> k;
  REP(i, n) {
    if (s[i] != s[k - 1]) s[i] = '*';
  }
  OUT(s);

  return 0;
}

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

int main() {
  int ans=0;
  long long  tmp=0;
  long long  tmpx = 0;
  long long  tmpy = 0;
  int N=0;
  int K=0;

  cin >> N;

  vector<long long> x(N);
  vector<long long> y(N);
  vector<pair<long long ,long long>> xy(N);
  for(int i = 0; i < N; i++){
    cin >> x[i] >> y[i];
    xy[i] = make_pair(x[i], y[i]);
  }

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

  vector<vector<long long>> sx(N, vector<long long >(N));
  vector<vector<long long>> sy(N, vector<long long >(N));
  
  for(int i = 0; i < N; i++){
    for(int j = i+1; j < N; j++){
      sx[i][j] = xy[j].first - xy[i].first;
      sy[i][j] = xy[j].second - xy[i].second;
    }
  }

  //  vector<vector<long long>>cnt(N, vector<long long >(N));
  int cnt =0;
  for(int j =N-1; j>=0; j--){
    for(int i = j-1; i >=0; i--){
      
        for(int k = 0; k < N; k++){
          for(int l = k+1; l < N; l++){
            
            if(i != k && j != l){
              if(sx[i][j] == sx[k][l]
                 && sy[i][j] == sy[k][l]){
                  cnt++;
              }
            }
          }
        }

        ans = max(ans, cnt);
        cnt = 0;
    }
  }
  ans++;
  
  if(N > 1){
    cout << N - ans << endl;
  }else{
    cout << 1 << endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll> 
#define rep(i,n) for(ll (i)=0; i<(n); ++(i))
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  char c;cin>>c;
  vector<char> v{'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
  auto itr=find(v.begin(),v.end(),c)-v.begin()+1;
  print(v[itr]);
  return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = 1; i < (int)(n); i++) 
#define dunk(n) cout << n << endl
#define all(a) (a).begin(),(a).end()
typedef pair<int,int> P;
typedef long long ll;

int main() {
    int s,w;
    cin >> s >> w;
    if(w >= s) dunk("unsafe");
    else dunk("safe");
    return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
long double pi = 2 * acos(0.0);
const ll mod = 1e9 + 7;

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

void solve() {
    ll n;
    cin >> n;
    if(n == 1) {
        cout << "0\n";
        return;
    }
    ll total = modpow(10, n), no09 = modpow(8, n), no0 = modpow(9, n);
    total = (total + no09 + mod) % mod;
    total = (total - no0 + mod) % mod;
    total = (total - no0 + mod) % mod;
    cout << total << "\n";
}

int main() {
    ios_base :: sync_with_stdio(false); 
    cin.tie(nullptr);   
    ll t = 1;
    //cin >> t;
    while(t--) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3660
from sys import stdin, stdout
# t = int(input())
# for _ in range(t):
    # n = int(stdin.readline())
h1, m1, h2, m2, k = map(int, stdin.readline().strip().split())
    # nums = list(map(int, stdin.readline().strip().split()))

t = (h2*60 + m2 - (h1*60 + m1) -  k)
print(t if t>0 else 0)

Measured memory_bytes: 9108
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (ll i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define m1(x) memset(x,-1,sizeof(x))
const int INF = 1e9 + 1;
const ll MOD = 1e9 + 7;
const double PI = 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799;


int main(){
  string s;
  cin >> s;
  bool flag = true;
  rep(i, s.size()){
    if(s.at(i) == 'U' || s.at(i) == 'D') continue;
    if(i % 2 == 0 && s.at(i) == 'L') flag = false;
    if(i % 2 == 1 && s.at(i) == 'R') flag = false;
  }
  if(flag) cout << "Yes" <<endl;
  else cout << "No" <<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
    int n;
    cin >> n;
    int a[200] = {0};
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    int cnt = 0;
    int flg = false;
    while (1) {
        for (int i = 0; i < n; i++) {
            if (a[i] % 2 != 0 || a[i] == 0) {
                flg = true;
                break;
            }
            a[i] /= 2;
        }
        if (flg == true) {
            break;
        } else {
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <atcoder/all>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define fi first
#define se second
long long mo = 1000000007;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
typedef pair<ll,Pll> PlP;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<class A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}cout << "\n";}
ld PI=3.14159265358979323846;
//using namespace atcoder;

int main(){
    ll N;
    cin >> N;
    vector<ll> A(N), b(1000000+1,0), cc(1000001);
    rep(i,N){
        cin >> A[i];
    }
    bool flag = false;
    REP(i,2,1000001){
        ll cur = i;// A[i];
        //cout << i << endl;
        if(b[i] != 0){
            continue;
        }
        while(cur <= 1000000){
            b[cur] = i;
            cur += i;
        }
    }
    b[0] = 1;
    b[1] = 1;
    //PR(b,1000);
    rep(i,N){
        if(A[i] == 1)continue;
        ll n = A[i];
        vector<pair<ll,int>> res;
        while(n > 1){
            ll p = b[n];
            res.emplace_back(p,0);
            while(n % p == 0){
                n /= p;
                res.back().second++;
            }
        }
        for(auto& e:res){
            cc[e.fi]++;
        }
    }
    rep(i,1000001){
        if(cc[i] > 1){
            flag = 1;
            break;
        }
    }
    if(!flag){
        cout << "pairwise coprime" << endl;
        return 0;
    }
    ll c=A[0];
    rep(i,N){
        c = __gcd(c,A[i]);
    }
    if(c==1){
        cout << "setwise coprime" << endl;
    }else{
        cout << "not coprime" << endl;
    }
}

Measured memory_bytes: 26676
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define in insert
#define er erase
#define fr first
#define sc second
using namespace std;
typedef long long ll;
const long long llnrm=LLONG_MAX;
const int nrm=INT_MAX;
const int nrn=INT_MIN;
const int nmax=1e5+5;
const int mod=1e9+7;
const int lim=1e7;
ll ans,n,nr,tmp,a[1000000],ms=1,c,b;
map<ll,ll> mp;
map<ll,ll>::iterator it;
int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
    cin>>n;
    for(ll i=0;i<n;i++) cin>>a[i],mp[a[i]]++;
    if(n==1 && a[0]!=1) rc(1);
    for(it=mp.begin();it!=mp.end();it++)
    {
        c=it->first;
        b=it->second;
        if(c!=b) ans+=(b<c?b:b-c);
    }
    cout<<ans<<endl;
    return 0;
}




Measured memory_bytes: 7040
#include <iostream>
#include <algorithm>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <numeric>
#include <functional>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}
const ll INF = 1e16;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
const ll MAX = 200005;
constexpr ll nx[8] = {1,0,-1,0,-1,-1,1,1};
constexpr ll ny[8] = {0,1,0,-1,-1,1,-1,1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    ll cnt = 0;
    vector<ll> a(n),b(n);
    rep(i,n) cin >> a[i] >> b[i];
    for (int i = n-1;i >= 0;i--){
        a[i] += cnt;
        if (a[i]%b[i]) cnt += b[i]-a[i]%b[i];
    }
    PRINT(cnt);
}


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

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> VI;
typedef vector<VI> VVI;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = numeric_limits<int>::max() / 2;
const int NEG_INF = numeric_limits<int>::min() / 2;
const int MOD = 1e9 + 7;

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

    int n;
    while (true)
    {
        cin >> n;
        if (n == 0)
            break;
        std::vector<string> v(n);
        for (int i = 0; i < n; i++)
        {
            cin >> v[i];
        }
        int tanku[5] = {5, 7, 5, 7, 7};
        for (int i = 0; i < n - 1; i++)
        {
            int cnt = 0, idx = 0;
            for (int j = 0; i + j < n; j++)
            {
                cnt += v[i + j].length();
                //cout<<cnt<<" "<<idx<<endl;
                if (cnt < tanku[idx])
                    continue;
                else if (cnt == tanku[idx])
                {
                    idx++;
                    cnt = 0;
                }
                else
                {
                    break;
                }
            }
            if (idx == 5)
            {
                cout << i + 1 << endl;
                break;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 3196
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

map<string, int> mp;
map<string, int>::iterator itr;
vector<string> v;

int main(void){
	int n,i,ans=0;
	string s;
	cin >> n;
	for(i=0; i<n; ++i){
		cin >> s;
		++mp[s];
		ans = max(ans,mp[s]);
	}
	for(itr=mp.begin(); itr!=mp.end(); ++itr){
		if((*itr).second == ans){
			v.push_back((*itr).first);
		}
	}
	sort(v.begin(),v.end());
	for(i=0; i<(v.l_ength()); ++i){
		cout << v[i] << endl;
	}
	return 0;
}


Measured memory_bytes: 26868
import java.util.*;


class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long n = sc.nextInt();

    long quo = n / 15;
    long rem = n % 15;
    long laps = calcLaps(quo);
    long rems = calcRems(quo, rem);

    System.out.println(laps + rems);
  }

  private static long calcLaps(long quo) {
    if (quo == 0) {
      return 0;
    } else {
      long l = quo * quo;
      int aLap = 60;
      return aLap * l;
    }
  }

  private static long calcRems(long quo, long rem) {
    if (rem == 0) {
      return 0;
    } else {
      long lapBottom = 15 * quo;
      int i = 1;
      int valid = 0;
      int fraction = 0;

      while (i <= rem) {
        if (i % 3 == 0 || i % 5 == 0){
          i++;
        } else {
          fraction += i;
          valid++;
          i++;
        }
      }
      return lapBottom * valid + fraction;
    }
  }
}


Measured memory_bytes: 35840
#include<iostream>
#include<vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <limits>
#include <map>
#include <bitset>
#include <iomanip>

#define rep(i,n) for(int (i) = 0; (i)<(n); (i)++)
#define FOR(i,s,e) for(int (i) = (s); (i)<(e); (i)++)
#define vecall(itr,vec) for(auto (itr) = (vec).begin(); (itr) != (vec).end(); (itr)++)
#define vecshow(vec) for(auto itr = (vec).begin(); itr != (vec).end(); itr++)cout << *itr << " ";

using namespace std;
using p = pair<int, int>;
using ll = long long;

int gcd(int a, int b) {
	int l = max(a, b);
	int s = min(a, b);
	while (l * s != 0) {
		int tmp = s;
		s = l % s;
		l = tmp;
	}

	return l;
}

vector<vector<int>> path;

int main() {
	int a;
	cin >> a;
	cout << a + a * a + a * a * a << endl;
	return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <string.h>
using namespace std;

int main() {

     int a,b,c;
     cin>>a>>b>>c;
     if(a>=b&&a>=c){
        cout<<(a*10)+b+c<<endl;
     }else if(b>=a&&b>=c){
        cout<<(b*10)+a+c<<endl;
     }else if(c>=a&&c>=b){
        cout<<(c*10)+b+a<<endl;
     }


    return 0;
}


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

using namespace std;

class UnionFind {
 public:
  std::vector<int> parent;

  UnionFind(int n) : parent(n, -1) {}

  int root(int x) {
    if (parent[x] < 0) return x;
    return parent[x] = root(parent[x]);
  }

  bool issame(int x, int y) { return root(x) == root(y); }

  int size(int x) { return -parent[root(x)]; }

  bool unite(int x, int y) {
    int rx = root(x), ry = root(y);
    if (rx == ry) return false;
    if (parent[rx] > parent[ry]) std::swap(rx, ry);
    parent[rx] += parent[ry];
    parent[ry] = rx;
    return true;
  }
};

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, M, K;
  cin >> N >> M >> K;
  vector<int> res(N, 0);
  UnionFind uf(N);
  for (int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    uf.unite(a, b);
    res[a]--, res[b]--;
  }
  for (int i = 0; i < N; i++) {
    res[i] += uf.size(i);
  }
  for (int i = 0; i < K; i++) {
    int c, d;
    cin >> c >> d;
    c--, d--;
    if (uf.issame(c, d)) res[c]--, res[d]--;
  }
  for (auto &r : res) {
    cout << r - 1 << (&r == &res.back() ? '\n' : ' ');
  }
  return 0;
}


Measured memory_bytes: 1664
N=int(input())
c=input()
W=[]
R=[]
pw=0
pr=0
for i in range(N):
  if c[i]=="W":
    W+=[i]
    pw+=1

  if c[N-1-i]=="R":
    R+=[i]
    pr+=1

for i in range(200000):
    if min(len(W),len(R))==i:
        result=i
        break
    if W[i]+R[i]>=N:
        result=i
        break
print(result)
result=i


Measured memory_bytes: 17484
#include<iostream>
#include<set>
#include<string>

int main() {
	int a, b, c, d, e;
	while (std::cin >> a >> b >> c >> d >> e) {
		std::multiset<int> sort;
		sort.insert(a); sort.insert(b); sort.insert(c); sort.insert(d); sort.insert(e);
		int i = 0;
		for (std::multiset<int>::reverse_iterator itr = sort.rbegin(); itr != sort.rend(); itr++) {
			std::cout << *itr;
			if (i < 4) std::cout << " ";
			i++;
		}
		std::cout << std::endl;
	}
	return 0;
}

Measured memory_bytes: 3088
#include <bits/stdc++.h>
#define ll long long int
#define N 10000
#define f(i, a, b) for (ll i = (ll)a; i <= (ll)b; i++)
#define rf(i, a, b) for (ll i = (ll)a; i >= (ll)b; i--)
#define po pop_back
#define pb push_back
#define lb lower_bound
#define fi first
#define se second
#define debug(x) cout << #x << " = " << x << endl
#define ub upper_bound
#define ibs ios_base::sync_with_stdio(false)
#define cti cin.tie(0)
#define all(x) x.begin(), x.end()
#define PI 3.14159265
#define cot cout.tie(0)
using namespace std;
/**
        * @author :: Sawlani
        *
        */

    ll n;   

    ll mat[22][22];

    ll tot;

    ll dp[22][(1<<21)+50];

 const ll M=1e9+7;
ll rec(ll i,ll mask)
{

    //cout <<  i << " :  " << bits(mask) << endl;
    if(i==n+1&&mask==tot)
    return 1;
    else if(i==(n+1))
    return 0;
   
   if(dp[i][mask]!=-1)
   return dp[i][mask];
   ll ans=0;
   f(j,0,n-1)
   {
       ll x=mask&(1<<j);
      if(!x&&mat[i][j+1])
      {
         ans=(ans+rec(i+1,mask|(1<<j)))%M;
      }
   }

   return dp[i][mask]=ans;
}

int main()
{
   // freopen("input.txt","r",stdin);

     memset(dp,-1,sizeof(dp));
     cin >> n;

     tot=(1<<n)-1;

     f(i,1,n)
     {
         f(j,1,n)
         cin >> mat[i][j];
     }

    cout << rec(1,0);
}


    

Measured memory_bytes: 360704
#!usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A
"""
n = I()
print((n*(n+1))//2)
"""
#B
s = S()
ans = []
for i in s:
    if i == "0":
        ans.append(0)
    if i == "1":
        ans.append(1)
    if i == "B" and ans:
        ans.pop(-1)
for i in ans:
    print(i,end = "")
print()
#C

#D
"""
s = S()
l = len(s)
for i in range(l-1):
    if s[i] == s[i+1]:
        print(i+1,i+2)
        quit()
for i in range(l-2):
    if s[i] == s[i+2]:
        print(i+1,i+3)
        quit()
print(-1,-1)
"""

#E

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T


Measured memory_bytes: 38512
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(123456789012345678)
#define MAX_V 1000



vector<int> G[100100];	// グラフ　G[i]: から有効辺で繋がっている点を列挙したリスト
// メモ化再帰
int dp[100100];	//dp[i]: iから始めた時の最長の有効パスの長さ
int rec(int now_v) {	// vから始めた時の最長の有効パスの長さを求める
	if (dp[now_v] != -1)	return dp[now_v];	// すでに更新済み
	int max_len = 0;
	rep(i, G[now_v].size()) {
		int next_v = G[now_v][i];
		chmax(max_len, rec(next_v)+1);
	}
	return dp[now_v] = max_len;	// メモしながらリターン
}

int main() {
	// 入力受け取り
	int N, M;	cin >> N >> M;
	rep(i, M) {
		int x, y;	cin >> x >> y;
		G[x].push_back(y);
	}

	// 初期化
	reps(v, N) dp[v] = -1;

	// 全ノードを一通り更新しながら答えを求める
	int res = 0;
	reps(v, N) chmax(res, rec(v));
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 8832
fun main(arr:Array<String>) {
    val n = readLine()!!.toInt()
    val block = readLine()!!.split(" ").map { it.toInt() }
    var cur = 1
    for(i in block) {
        if(cur == i) {
            cur++
        }
    }
    if(cur == 1) {
        println(-1)
    } else {
        println(n - (cur-1))
    }
}

Measured memory_bytes: 65056
import java.util.Scanner;

class Main{
	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);
		
		double PI = 3.141592653589;
		double r = sc.nextDouble();


		double area = PI * r * r;
		double len = 2.0 * PI * r; 

		System.out.println(String.format("%5f", area));
		System.out.println(String.format("%5f", len));
		

	}
}


Measured memory_bytes: 28348
#include <iostream>
#include <vector>

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

typedef long long ll;

using namespace std;

int INF = 1e9;

int main(){
  int a,b;
  cin >> a >> b;

  if( a >= 10 || b >= 10) cout << -1 << endl;
  else cout << a*b << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
	static int T, S, E, W, N, U;
	public static void main(String[] args){

		Scanner scan = new Scanner(System.in);
		int[] in = new int[6];
		for(int i = 0; i < 6; i++){
			in[i] = scan.nextInt();
		}
		T = in[0];
		S = in[1];
		E = in[2];
		W = in[3];
		N = in[4];
		U = in[5];

		int q = scan.nextInt();
		for(int i = 0; i < q; i++){
			int n = scan.nextInt();
			int m = scan.nextInt();
			boolean flg = false;
			while(true){
				if(m == N){
					MoveSouth();
					MoveSouth();
				} else if(m == U){
					MoveNorth();
				} else if(m == T){
					MoveSouth();
				} else if(m == E){
					MoveWest();
				} else if(m == W){
					MoveEast();
				}
				if(m == S){
					if(n == T){
						flg = true;
						break;
					} else if(n == U){
						MoveEast();
						MoveEast();
					} else if(n == E){
						MoveWest();
					} else if(n == W){
						MoveEast();
					}
				}
				
			}
			System.out.println(E);
		}

	}

	public static void MoveSouth(){
		int a = T;
		T = N;
		N = U;
		U = S;
		S = a;
	}
	public static void MoveEast(){
		int a = T;
		T = W;
		W = U;
		U = E;
		E = a;
	}
	public static void MoveNorth(){
		int a = T;
		T = S;
		S = U;
		U = N;
		N = a;
	}
	public static void MoveWest(){
		int a = T;
		T = E;
		E = U;
		U = W;
		W = a;
	}
}

Measured memory_bytes: 26052
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>

using namespace std;
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);};
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

//FUNCTION



void solve(void)
{
  int N,M; cin>>N; cin>>M; 
  vector<int> vec (N+2,0);
  for (int i = 0; i < M; i++)
  {
    int A,B; cin>>A; cin>>B;
    vec[A] += 1;
    vec[B+1] -=1;
  }

  for (int i = 0; i < N+1; i++)
  {
    vec[i+1] += vec[i];
  }
  int ANS = 0;
  for (int i = 0; i < N+2; i++)
  {
    if(vec[i] == M)ANS++;
  }
  cout<<ANS<<endl;
  
  
  
  return;
}

int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

  return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;int m=0,n=0;cin>>s;
  for(int i=0;i<s.size();i++){
    if(s.at(i)=='A'){
      m=i;
      break;
    }
  }
  for(int j=s.size()-1;j>=0;j--){
    if(s.at(j)=='Z'){
      n=j;
      break;
    }
  }
  cout<<n-m+1<<endl;
}


Measured memory_bytes: 640
n = int(input())
a = list(map(int,input().split()))
ans = 0

for i in range(1,n):
  if a[i-1] > a[i]:
    ans += a[i-1]-a[i]
    a[i] = a[i] +  a[i-1] -a[i]
    
print(ans)

Measured memory_bytes: 32116
#define _USE_MATH_DEFINES
#define INF 10000000
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>

using namespace std;

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

static const double eps = 1e-8;

static const int moveTo[][2] = {{1,0},{0,-1},{-1,0},{0,1}};
static const int moveToRev[][2] = {{-1,0},{0,1},{1,0},{0,-1}};

int stage[50][50];
int costTable[50][50][50][50];

int bfs(int tx,int ty,int kx,int ky,int w,int h){
	priority_queue<PPP,vector<PPP>,greater<PPP> > que;
	que.push(PPP(0,PP(P(tx,ty),P(kx,ky))));	
	memset(costTable,0x3,sizeof(costTable));

	int res = INF;
	costTable[tx][ty][kx][ky] = 0;
	while(!que.empty()){
		int cost = que.top().first;
		if(res <= cost || cost >= 100){
			return res;
		}

		int tx = que.top().second.first.first;
		int ty = que.top().second.first.second;
		int kx = que.top().second.second.first;
		int ky = que.top().second.second.second;

		if(tx==kx && ty == ky) res = min(res,cost);

		que.pop();

		for(int i=0;i<4;i++){
			int tdx = tx + moveTo[i][0];
			int tdy = ty + moveTo[i][1];

			if((tdx < 0 || tdx >= w || tdy < 0 || tdy >=h) || stage[tdy][tdx]) {
				tdx = tx;
				tdy = ty;
			}

			int kdx = kx + moveToRev[i][0];
			int kdy = ky + moveToRev[i][1];

			if((kdx < 0 || kdx >= w || kdy < 0 || kdy >=h) || stage[kdy][kdx]) {
				kdx = kx;
				kdy = ky;
			}
			if(costTable[tdx][tdy][kdx][kdy] <= cost + 1) continue;
			costTable[tdx][tdy][kdx][kdy] = cost + 1;
			que.push(PPP(cost+1,PP(P(tdx,tdy),P(kdx,kdy))));
		}
	}

	return res;
}

int main(){

	int w,h;
	while(~scanf("%d %d",&w,&h)){
		if(w == h && h==0) break;
		int tx,ty;
		scanf("%d %d",&tx,&ty);
		int kx,ky;
		scanf("%d %d",&kx,&ky);
		for(int y=0;y<h;y++){
			for(int x=0;x<w;x++){
				scanf("%d",&stage[y][x]);
			}
		}

		int res = bfs(tx-1,ty-1,kx-1,ky-1,w,h);
		if(res >= 100) printf("NA\n");
		else printf("%d\n",res);
	}
}

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

using namespace std;

int main()
{
 	int a,b,c;
  cin>>a>>b>>c;
  if(b>=a*c)
  {
   	cout<<c<<endl;
    return 0;
  }
  else
  {
    cout<<b/a<<endl;
    return 0;
  }
  return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> VI;
typedef vector<VI> VVI;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = numeric_limits<int>::max() / 2;
const int MOD=1e9+7;

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

  int n;cin>>n;
  std::vector<ll> a(n),s(n);
  for(int i=0;i<n;i++){
      cin>>a[i];
      s[i]=a[i];
  }
  sort(s.begin(),s.end());
  ll sum=0;
  for(int i=0;i<n;i++){
      int dif=lower_bound(s.begin(),s.end(),a[i])-s.begin();
      int tmp=abs(i-dif)%2;
      sum+=tmp;
  }
  cout<<(sum/2)<<endl;
}


Measured memory_bytes: 1792
from statistics import mean, median,variance,stdev
import numpy as np
import sys
import math
import fractions
import itertools
import copy
import collections
from operator import itemgetter
#以下てんぷら
def j(q):
    if q==1: print("Yay!")
    else:print(":(")
    exit(0)


def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")

def ip():
    return int(input())
def printrow(a):
    for i in range(len(a)):
        print(a[i])
def combinations(n,r):
    if n<r:return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
def permutations(n,r):
    if n<r:return 0
    return math.factorial(n) // math.factorial(n - r)
n = ip()                                     #入力整数1つ
#n,q= (int(i) for i in input().split())       #入力整数横2つ以上
#a = [int(i) for i in input().split()]        #入力整数配列
#b = input()                                  #入力文字列
#a = input().split()                          #入力文字配列
#n = ip()                      #入力セット(整数改行あり)(1/2)
#a=[ip() for i in range(5)]    #入力セット(整数改行あり)(2/2)
#jの変数はしようできないので注意
#全足しにsum変数使用はsum関数使用できないので注意
#こっから本文
u = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,51,53,59,61,67,71,73,79,83,89,97]

factor = [0 for i in range(100)]
for i in range(2,n+1):
    sn = i
    p = 1
    while p<100:
        p+=1
        if p==100:break
        if sn%p == 0:
            factor[p]+=1
            sn//=p
            p=1
use = [factor[i] for i in range(100) if i in u and factor[i]]
#print([i for i in range(100)])
#print(factor)
#print(use)
ov74 = 0
ov4 = 0
ov14 = 0
ov24 = 0
ov2 = 0
ov4u13 = 0
ov2u3 = 0
ov2u23 = 0
for i in range(len(use)):
    if use[i] >=74:ov74+=1
    if use[i] >= 4:ov4+=1
    if use[i] >=14:ov14+=1
    if use[i] >=24:ov24+=1
    if use[i] == 2 or use[i]==3:ov2u3+=1
    if 14>use[i] and use[i]>=4: ov4u13+=1
    if 24>use[i] and use[i]>=2: ov2u23+=1
q = ov74
w = combinations(ov4,2) * ov2u3 + 3*combinations(ov4,3)
e = ov14 * ov4u13 + permutations(ov14,2)
r = ov24 * ov2u23 + permutations(ov24,2)
print(q+w+e+r)

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

int main() {
	int h, w, i, j, flg, filter_col[100], filter_row[100];
	char a[101][100];
	if(scanf("%d%d", &h, &w) == 0) return 1;
	for (i = 0; i < h; i++) if (scanf("%s", &a[i]) == 0) return 1;

	for (i = 0; i < h; i++) filter_row[i] = 1;
	for (i = 0; i < w; i++) filter_col[i] = 1;

	for (i = 0; i < h; i++) {
		flg = 1;
		for (j = 0; j < w; j++) {
			if (a[i][j] == '#') {
				flg = 0;
				break;
			}
		}
		if (flg) filter_row[i] = 0;
	}

	for (i = 0; i < w; i++) {
		flg = 1;
		for (j = 0; j < h; j++) {
			if (a[j][i] == '#') {
				flg = 0;
				break;
			}
		}
		if (flg) filter_col[i] = 0;
	}

	for (i = 0; i < h; i++) {
		if (filter_row[i]) {
			for (j = 0; j < w; j++) {
				if (filter_col[j]) printf("%c", a[i][j]);
			}
			printf("\n");
		}
	}
}


Measured memory_bytes: 128
function Main(s){
  s = s.split("\n");
  var n = +s[0];
  for(var i = 0; i < n; i++){
    s[i] = s[i+1].split(" ").map(a=>+a);
  }
  var ans = 0;
  for(i = n-1; i >= 0; i--){
    var x = (s[i][0] + ans) % s[i][1];
    if(x)ans += s[i][1] - x;
  }
  console.log(ans);
}

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

Measured memory_bytes: 50856
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll INF = 1'010'000'000'000'000'017LL;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()

int main() {
    // AtCoder
    // template
    vector<vector<ll>> c(3, vector<ll>(3));
    rep(i, 3) {
        rep(j, 3) { cin >> c[i][j]; }
    }

    bool ans = true;

    rep(i, 2) {
        if(!(c[i][0] - c[i + 1][0] == c[i][1] - c[i + 1][1] &&
             c[i][1] - c[i + 1][1] == c[i][2] - c[i + 1][2] &&
             c[i][2] - c[i + 1][2] == c[i][0] - c[i + 1][0]))
            ans = false;
    }
    rep(j, 2) {
        if(!(c[0][j] - c[0][j + 1] == c[1][j] - c[1][j + 1] &&
             c[1][j] - c[1][j + 1] == c[2][j] - c[2][j + 1] &&
             c[2][j] - c[2][j + 1] == c[0][j] - c[0][j + 1]))
            ans = false;
    }

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<int,int>
#define F first
#define S second
#define mod 1000000007
#define INF 9000000000000000000
signed main(void){
    int n;cin>>n;
    if(n==1)cout<<"Yes"<<endl;
    else{
        vector<int>V(n);rep(i,n)cin>>V[i];
        vector<int>Min(n);
        int m=V[n-1];
        Min[n-1]=m;
        rep(i,n-1){
            m=min(V[n-i-2],m);
            Min[n-i-2]=m;
        }
        bool ans=true;
        rep(i,n-1){
            if(V[i]>=Min[i+1]+2)ans=false;
        }
        if(ans)cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define int long long
int MOD = (int)1e9 + 7;
int INF = (int)2e18;
// Comment out below and program paste

// #include "UnionFind.hpp"
// #include "power.hpp"

signed main() {
    int A, B, C;
    cin >> A >> B >> C;
    cout << ((A == B && B == C) ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
using usize = ::std::size_t;
using u64 = ::std::int_least64_t;
//using u64 = long long;
static constexpr u64 Inf = ::std::numeric_limits<u64>::max() / 2;

vector<int> par, dsu_2ecc, dsu_cc, dsu_cc_size;
int bridges;
int lca_iteration;
vector<int> last_visit;

void init(int n) {
    par.resize(n);
    dsu_2ecc.resize(n);
    dsu_cc.resize(n);
    dsu_cc_size.resize(n);
    lca_iteration = 0;
    last_visit.assign(n, 0);
    for (int i=0; i<n; ++i) {
        dsu_2ecc[i] = i;
        dsu_cc[i] = i;
        dsu_cc_size[i] = 1;
        par[i] = -1;
    }
    bridges = 0;
}

int find_2ecc(int v) {
    if (v == -1)
        return -1;
    return dsu_2ecc[v] == v ? v : dsu_2ecc[v] = find_2ecc(dsu_2ecc[v]);
}

int find_cc(int v) {
    v = find_2ecc(v);
    return dsu_cc[v] == v ? v : dsu_cc[v] = find_cc(dsu_cc[v]);
}

void make_root(int v) {
    v = find_2ecc(v);
    int root = v;
    int child = -1;
    while (v != -1) {
        int p = find_2ecc(par[v]);
        par[v] = child;
        dsu_cc[v] = root;
        child = v;
        v = p;
    }
    dsu_cc_size[root] = dsu_cc_size[child];
}

void merge_path (int a, int b) {
    ++lca_iteration;
    vector<int> path_a, path_b;
    int lca = -1;
    while (lca == -1) {
        if (a != -1) {
            a = find_2ecc(a);
            path_a.push_back(a);
            if (last_visit[a] == lca_iteration){
                lca = a;
                break;
                }
            last_visit[a] = lca_iteration;
            a = par[a];
        }
        if (b != -1) {
            b = find_2ecc(b);
            path_b.push_back(b);
            if (last_visit[b] == lca_iteration){
                lca = b;
                break;
                }
            last_visit[b] = lca_iteration;
            b = par[b];
        }

    }

    for (int v : path_a) {
        dsu_2ecc[v] = lca;
        if (v == lca)
            break;
        --bridges;
    }
    for (int v : path_b) {
        dsu_2ecc[v] = lca;
        if (v == lca)
            break;
        --bridges;
    }
}

void add_edge(int a, int b) {
    a = find_2ecc(a);
    b = find_2ecc(b);
    if (a == b)
        return;

    int ca = find_cc(a);
    int cb = find_cc(b);

    if (ca != cb) {
        ++bridges;
        if (dsu_cc_size[ca] > dsu_cc_size[cb]) {
            swap(a, b);
            swap(ca, cb);
        }
        make_root(a);
        par[a] = dsu_cc[a] = b;
        dsu_cc_size[cb] += dsu_cc_size[a];
    } else {
        merge_path(a, b);
    }
}
 
int main(int argc, char *argv[])
{
    
 
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n, m;
    cin >> n >> m;
    init(n);
    
    while (m--) {
        int a, b;
        cin >> a >> b;
        add_edge(--a, --b);
    }
    
    
    cout << bridges << endl;
    
    return 0;
    
}


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

#define fs first
#define sc second
#define pb emplace_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

const int32_t inf = 1001001001;
const int64_t infll = 1001001001001001001ll;
const int dx[] = {0, -1, 1, 0, -1, 1, -1, 1}, dy[] = {-1, 0, 0, 1, -1, -1, 1, 1};

template <typename T> using vector2d = vector<vector<T>>;

// clang-format off
template <typename T> void sort(vector<T> &v) { sort(all(v)); }
// ostream &operator<<(ostream &os, __int128_t value) { if (ostream::sentry(os)) { __uint128_t tmp = value < 0 ? -value : value; char buffer[64]; char *d = end(buffer); do { --d; *d = "0123456789"[tmp % 10]; tmp /= 10; } while (tmp != 0); if (value < 0) { --d; *d = '-'; } int len = end(buffer) - d; if (os.rdbuf()->sputn(d, len) != len) { os.setstate(ios_base::badbit); }} return os; }
// istream &operator>>(istream &is, __int128_t &value) { string in; is >> in; value = 0; for (const char &c : in) { if ('0' <= c && c <= '9') value = 10 * value + (c - '0'); } if (in[0] == '-') value *= -1; return is; }
// ostream &operator<<(ostream &os, __uint128_t value) { if (ostream::sentry(os)) { char buffer[64]; char *d = end(buffer); do { --d; *d = "0123456789"[value % 10]; value /= 10; } while (value != 0); int len = end(buffer) - d; if (os.rdbuf()->sputn(d, len) != len) { os.setstate(ios_base::badbit); }} return os; }
// istream &operator>>(istream &is, __uint128_t &value) { string in; is >> in; value = 0; for (const char &c : in) { if ('0' <= c && c <= '9') value = 10 * value + (c - '0'); } return is; }
template <typename T> ostream &operator<<(ostream &os, vector<T> &v) { os << v[0]; for (int i = 1; i < v.size(); ++i) os << " " << v[i]; return os; }
template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &in : v) is >> in; return is; }
template <typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p) { os << p.fs << " " << p.sc; return os; }
template <typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.fs >> p.sc; return is; }

struct IoSetup { IoSetup(){ cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); cerr << fixed << setprecision(10); } } iosetup;

inline int64_t in() { int64_t x = 0; cin >> x; return x; }
template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
// clang-format on

signed main(int argc, char *argv[]) {
  int n = in();
  vector<string> s(n);
  vector<char> march{'M', 'A', 'R', 'C', 'H'};

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

  sort(s);
  sort(march);

  vector<int64_t> po(5);
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < 5; ++j) {
      if (march[j] == s[i][0]) {
        po[j]++;
      }
    }
  }

  int64_t ans = 0;
  for (int i = 0; i < 5; ++i) {
    for (int j = i + 1; j < 5; ++j) {
      for (int k = j + 1; k < 5; ++k) {
        ans += po[i] * po[j] * po[k];
      }
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 5760