akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds; 
using namespace std;
#define int long long
#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define mll map<ll,ll>
#define mii map<int,int>
#define mp make_pair
#define pb push_back
#define rep(i,b) for(ll (i)=0;i<(b);i++)
#define all(c) (c).begin(), (c).end()
#define F first
#define S second
#define CLR(p) memset(p, 0, sizeof(p))
#define SET(p) memset(p, -1, sizeof(p))
#define DEBUG true
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);
//typedef long long int ll;
typedef tree<int, null_type, less<int>, rb_tree_tag, 
tree_order_statistics_node_update> new_data_set; 
const int MAX=1e6+5;
#define MOD 1000000007
/*std::cout << std::fixed;
std::cout << std::setprecision(6);*/
//(a%mod-b%mod+mod)%mod

// #define LOCAL 1

/************************************


 
*************************************/

vector<int>par,dep,tin,tout;
vector<vector<int>>v;
vector<int>deg;
vector<pll>req;
bool visited[MAX];


ll power(int a,int b){
    int ans=1;
    while(b>0){
        if(b&1)
            ans = (ans%MOD*a%MOD)%MOD;
        b = b>>1;
        a= (a%MOD*a%MOD)%MOD;
    }
    return ans;
}

void bfs(int s,vector<int>&d){
    d[s]=0;
    queue<int>q;
    q.push(s);
    while(!q.empty()){
        int u = q.front();
        q.pop();
        // visited[u]=true;
        for(auto it:v[u]){
            if(d[it]==-1){
                // cout<<it<<" ";
                d[it]=d[u]+1;
                q.push(it);
            }
        }
    }
}


void solve(){
    int t=1;
    // cin>>t;
    while(t--){
        int n;
        cin>>n;
        int a[n];
        mll mep;
        rep(i,n){
            cin>>a[i];
            mep[a[i]]++;
        }
        int sum=0;
        for(auto it:mep){
            int x = it.S;
            x = (x*(x-1));
            x/=2;
            sum+=x;
        }
        // cout<<sum<<endl;
        int temp=sum;

        int x,y;
        for(int i=0;i<n;i++){
            x = mep[a[i]];
            x = x*(x-1);
            x/=2;
            sum-=x;
            y=mep[a[i]]-1;
            y = y*(y-1);
            y/=2;
            sum+=y;
            // cout<<x<<" Y = "<<y<<" sum = ";
            cout<<sum<<endl;
            sum=temp;
        }

    }
}


signed main() 
{ 
    boost;

    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // while (cin.peek() != EOF) {
    //     solve();
    //     cout << endl << endl;
    //     string s;
    //     do getline(cin, s);
    //     while (!cin.eof() && !s.empty());
    //     while (isspace(cin.peek())) cin.get();
    // }
    // #else
    //     solve();
    // #endif

    solve();


    

    
	return 0; 
} 

Measured memory_bytes: 11136
#define _USE_MATH_DEFINES
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <clocale>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i, s, n) for(int i = (s), i##_len=(n); i < i##_len; ++i)
#define FORS(i, s, n) for(int i = (s), i##_len=(n); i <= i##_len; ++i)
#define VFOR(i, s, n) for(int i = (s); i < (n); ++i)
#define VFORS(i, s, n) for(int i = (s); i <= (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) FORS(i, 0, n)
#define VREP(i, n) VFOR(i, 0, n)
#define VREPS(i, n) VFORS(i, 0, n)
#define RFOR(i, s, n) for(int i = (s), i##_len=(n); i >= i##_len; --i)
#define RFORS(i, s, n) for(int i = (s), i##_len=(n); i > i##_len; --i)
#define RREP(i, n) RFOR(i, n, 0)
#define RREPS(i, n) RFORS(i, n, 0)
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v), greater<decltype(v[0])>())
#define SZ(x) ((int)(x).size())
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end())

using ll = long long;
using ull = unsigned long long;
using Pi_i = pair<int, int>;
using VB = vector<bool>;
using VC = vector<char>;
using VD = vector<double>;
using VI = vector<int>;
using VLL = vector<ll>;
using VS = vector<string>;
using VSH = vector<short>;
using VULL = vector<ull>;

const int MOD = 1000000007;
const int INF = 1000000000;
const int NIL = -1;

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



int main(){
    int n, q; cin >> n >> q;
    vector<queue<int>> A(n);
    REP(i, q){
        int op; cin >> op;
        int d, x;
        switch(op){
            case 0:
                cin >> d >> x;
                A[d].push(x);
                break;
            case 1:
                cin >> d;
                if(!A[d].empty())
                    cout << A[d].front() << "\n";
                break;
            case 2:
                cin >> d;
                if(!A[d].empty())
                    A[d].pop();
        }
    }
    return 0;
}



Measured memory_bytes: 4396
#include <iostream>
#include <cstring>
using namespace std;
bool check[100005];
int main(){

    int n, m, x, y, arr[100005], score=0;
    cin >> n >> m;
    for(int i=1; i<=n; i++){
        arr[i]=1;
    }
    check[1]=true;
    for(int i=1; i<=m; i++){
        cin >> x >> y;
        if(check[x]==true){
            if(arr[x]==1){
                check[x]=false;
                check[y]=true;
                arr[y]++;
            }
            else{
                check[y]=true;
                arr[y]++;
            }
            arr[x]--;
        }
        else{
            arr[y]++;
            arr[x]--;
        }
    }
    for(int i=1; i<=n; i++){
        if(check[i]){
            score++;
        }
    }
    cout << score << endl;
    return 0;
}

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

signed main(){
    long long n , a , m = 0;
    cin >> n ;
    
    for(int i=0 ;i<5 ;i++ ){
        cin >> a;
        m = max(m , (n-1)/a);
    }
    
    cout << m+5 << endl;
    return(0);
}


Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

// using
using namespace std;

// typedef
typedef long long ll;

// define
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REVERSE(c) reverse(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)

// functions
template <class T>
T ceil(T a, T b) {
    return (a + b - 1) / b;
}
template <class T>
T round(T a, T b) {
    return (a + b / 2) / b;
}
template <class T>
T gcd(T a, T b) {
    return b ? gcd(b, a % b) : a;
}
template <class T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}
template <class T>
bool amax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
bool amin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

// main
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<ll> T(N);
    REP(i, N) {
        cin >> T[i];
    }
    ll res = 1;
    REP(i, N) {
        res = lcm(res, T[i]);
    }
    cout << res << endl;
    return 0;
}


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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFの値が適切か確認する --- */
// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const int MOD = 1000000007;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  double x = 1;
  rep(i, n) x *= a[i];
  double y = 0;
  rep(i, n) {
    double z = 1;
    rep(j, n) if (i != j) z *= a[j];
    y += z;
  }
  printf("%.10f\n", x / y);
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <cmath>
using namespace std;
int main(){
    char a[4];
    int n=0,flag1=0;
    scanf("%s",a);
    for(int i=0;i<4;i++){
        if(a[i]=='o')
            flag1++;
    }
    n=700+100*flag1;
    printf("%d\n",n);
return 0;
}


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

int main() {
    int n;
    cin >> n;
    vector<int> vec(n);
    rep(i, n - 1) {
        int tmp;
        cin >> tmp;
        tmp--;
        vec[tmp]++;
    }
    rep(i, n) cout << vec[i] << endl;
    return 0;
}

Measured memory_bytes: 4052
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int t,n,k;
int house_position[100000 +10];
int bitween_house[100000 +10];
int min_long;

int main(){

cin >> t;

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

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

  for (int i = 0; i + 1< n ; ++i)
  {
    bitween_house[i] = house_position[i+1] - house_position[i];
  }

  sort(bitween_house, bitween_house + n - 1);


  for (int i = 0; i < n - k  ; ++i)
  {
    min_long += bitween_house[i];
   
  }

      
      cout << min_long << endl;

      min_long = 0;
}

return 0;

}

Measured memory_bytes: 1956
#include<bits/stdc++.h>
using namespace std;
/*const int MAXN = 10000000;
int a[MAXN];*/
int main(void){
	int n,num=0,temp;
	cin>>n;
	//vector<int> b(n); 
	set<int> st; 
	while(n--){
		cin>>temp;//如何判断是否在这个容器里呢？用向量还有集合。然后二者对比.
		set<int>::iterator it = st.find(temp);
		if(it != st.end()){
			st.erase(it);
		}
		else st.insert(temp);
	} 
/*	for(int i=0;i<MAXN;i++){
		if(a[i]==1)
			num++;
	} */
	cout<<st.size()<<endl;
	return 0;
}
//超时了，只过了4个点，后面的必然是大数 

Measured memory_bytes: 4864
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <numeric>
#include <cmath>

#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
using P = pair<ll, ll>;

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

const ll MOD = 1000000007;
const int INF = 1<<30;
//const ll INF = (ll)1e18 + 1;

int main(){
  string a, b, c; cin >> a >> b >> c;
  cout << a[0] << b[0] << c[0] << endl;
}


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

#define mset(x, v) memset(x, v, sizeof(x));
#define fi first
#define se second
#define pb push_back
#define be begin()
#define en end()
#define mp make_pair

#define sd(x) scanf("%lld",&x);
#define sd2(x,y) scanf("%lld %lld",&x,&y);
#define sd3(x,y,z) scanf("%lld %lld %lld",&x,&y,&z);

#define pf(x) printf("%lld", x);
#define pf2(x,y) printf("%lld %lld", x,y);
#define pf3(x,y,z) printf("%lld %lld %lld", x,y,z);

using namespace std;

typedef long long ll;

typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<pll> vpll;
typedef set<ll> sll;
typedef queue<ll> qll;

template<class U, class V>
ostream& operator<<(ostream& os, const pair<U, V>& p) {os << "(" << p.first << ", " << p.second << ")";return os;}

template<class U, class V>
istream& operator>>(istream& in, pair<U, V>& p) {in >> p.first >> p.second;return in;}

int main ()
{
    ll n; sd (n);
    ll dp[n][3], arr[n][3]; for (ll i = 0; i < n; i++)    sd3 (arr[i][0], arr[i][1], arr[i][2]);
    dp[0][0] = arr[0][0];
    dp[0][1] = arr[0][1];
    dp[0][2] = arr[0][2];
    for (ll i = 1; i < n; i++)
    {
        dp[i][0] = max (dp[i-1][1], dp[i-1][2]) + arr[i][0];
        dp[i][1] = max (dp[i-1][0], dp[i-1][2]) + arr[i][1];
        dp[i][2] = max (dp[i-1][1], dp[i-1][0]) + arr[i][2];
    }
    cout << max (dp[n-1][0], max (dp[n-1][1], dp[n-1][2])) << endl;
    return 0;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN = 100005;

ll N, arr[MAXN];

ll hitung(ll l, ll r, ll start) {
	ll ret = 0;
	ll now = start;
	while (l < r) {
		if (l == r-1) {
			//~ cerr << ret << " ret\n";
			ll poin = abs(arr[r]-arr[now]);
			if (l == now) {
				now = r;
				l++;
			} else {
				now = l;
				r--;
			}
			poin = max(poin, abs(arr[now]-arr[start]));
			ret += poin;
		} else {
			if (l == now) {
				ret += abs(arr[r]-arr[l]);
				now = r;
				l++;
			} else {
				ret += abs(arr[r]-arr[l]);
				now = l;
				r--;
			}
		}
	}
	return ret;
}

int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	
	cin >> N;
	for (int i = 0; i < N; i++) cin >> arr[i];
	sort(arr, arr+N);
	
	//~ cout << hitung(0, N-1, 0) << "\n";
	//~ cout << hitung(0, N-1, N-1) << "\n";
	cout << max(hitung(0, N-1, 0), hitung(0, N-1, N-1)) << "\n";
	
	return 0;
}


Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
long long int mod=1000000007;
int main(void){
    int n,m;
    cin>>n>>m;
    int arr[n][1000];
    char c;
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            cin>>c;
            if(c=='.'){
                arr[i][j]=0;
            }
            else{
                arr[i][j]=1;
            }
        }
    }
    int ans[n][1000];
    memset(ans,0,sizeof(ans));
    for(int i=n-1;i>=0;i--){
        for(int j=m-1;j>=0;j--){
            if(i==(n-1)&&j==(m-1))
            {
                ans[i][j]=1;
            }
            else if(arr[i][j]==0){
                if((i+1)==n)
                ans[i][j]=ans[i][j+1];
                else if((j+1)==m)
                ans[i][j]=ans[i+1][j];
                else
                ans[i][j]=(ans[i+1][j]+ans[i][j+1])%mod;
            }
        }
    }
    /*for(int i=0;i<n;i++){
        for(int j=0;j<m;j++)
        cout<<ans[i][j]<<" ";
        cout<<endl;
    }*/
    cout<<ans[0][0]<<endl;
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FORD(i, a, b) for(int i = (a); i >= (b); --i)
#define VAR(v, i) __typeof(i) v=(i)
#define FORE(i, c) for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define all(v) (v).begin(),(v).end()

#define PII pair<int,int>
#define mp make_pair
#define st first
#define nd second
#define pb push_back
#define lint long long int
#define VI vector<int>

#define debug(x) {cout <<#x <<" = " <<x <<endl; }
#define debug2(x,y) {cerr <<#x <<" = " <<x << ", "<<#y<<" = "<< y <<endl; } 
#define debug3(x,y,z) {cerr <<#x <<" = " <<x << ", "<<#y<<" = "<< y << ", " << #z << " = " << z <<endl; } 
#define debugv(x) {{cout <<#x <<" = "; FORE(itt, (x)) cerr <<*itt <<", "; cerr <<endl; }}
#define debugt(t,n) {{cerr <<#t <<" = "; FOR(it,0,(n)) cerr <<t[it] <<", "; cerr <<endl; }}

#define make( x) int (x); scanf("%d",&(x));
#define make2( x, y) int (x), (y); scanf("%d%d",&(x),&(y));
#define make3(x, y, z) int (x), (y), (z); scanf("%d%d%d",&(x),&(y),&(z));
#define make4(x, y, z, t) int (x), (y), (z), (t); scanf("%d%d%d%d",&(x),&(y),&(z),&(t));
#define makev(v,n) VI (v); FOR(i,0,(n)) { make(a); (v).pb(a);} 
#define IOS ios_base::sync_with_stdio(0)
#define HEAP priority_queue

#define read( x) scanf("%d",&(x));
#define read2( x, y) scanf("%d%d",&(x),&(y));
#define read3(x, y, z) scanf("%d%d%d",&(x),&(y),&(z));
#define read4(x, y, z, t) scanf("%d%d%d%d",&(x),&(y),&(z),&(t));
#define readv(v,n) FOR(i,0,(n)) { make(a); (v).pb(a);}
#define jeb() fflush(stdout);

using namespace std;
const int max_n = 1e6 + 5;

int gcd(int a, int b) {
    return a == 0 ? b : gcd(b%a, a);
}
char s[1234567];
char t[] = "keyence";
int m = 7;

int main() {
	make(n);
	makev(v, n);
	makev(w, n);
	VI zle;
	VI dobre;
	FOR(i,0,n) {
		if (v[i] > w[i]) {
			dobre.pb(v[i] - w[i]);
		} else if (w[i] > v[i]) {
			zle.pb(w[i] - v[i]);
		}
	}
	lint sum = 0;
	FORE(i, zle) sum += *i;
	int ans = zle.size();
	sort(all(dobre));
	while (sum > 0 && dobre.size() > 0) {
		sum -= dobre.back();
		dobre.pop_back();
		ans++;
	}
	if (sum > 0) {
		printf("-1\n");
	} else {
		printf("%d\n", ans);
	}
}



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

/* macros */
#define inf 1e9
#define int long long
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
#define vi vector<int>
#define vc vector<char>
#define vb vector<bool>
#define vt vector
#define pb push_back
#define fi first
#define se second
#define pi pair<int,int>
#define tc int t;cin>>t;while (t--){solve();}
#define gtc int t;cin>>t;int TC=1;while (t--) {cout << "Case #" << TC << ": " << solve() << "\n";TC++;}
#define gvtc int t;cin>>t;int TC=1;while (t--) {cout << "Case #" << TC << ": "; vsolve(); TC++;}
#define notc solve();
#define newline cout << "\n";
#define mod 1000000007
#define ret return 0;
#define sz(x) (int)x.size();
#define rep(i,a,b) for(int i=a;i<b;i++)
#define srt(x) sort(x.begin(), x.end())
#define rsrt(x) sort(x.rbegin(), x.rend())

int s;
int dp[2001];
int go (int n) {
    if (n == 0) {
        return 1;
    }
    if (n == 1 or n == 2) {
        return 0;
    }
    
    if (dp[n] != -1) {
        return dp[n];
    }
    
    int ans = 0;
    for (int i=3;i<=n;i++) {
        int subans = go (n - i);
        ans = (ans%mod + subans%mod)%mod;
    }
    return dp[n] = ans;
}

void solve() {
    cin>>s;
    memset(dp, -1, sizeof dp);
    int ans = go (s);
    cout << ans << "\n";
}

int32_t main(){
    fastio
    notc
    ret
}


Measured memory_bytes: 3700
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const int INT_INF = 2147483647;
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; }
typedef pair<int,int> P;

int main(){
  int n;
  cin >> n;
  int a[n],b[n],c[n];
  rep(i,n)cin >> a[i];
  rep(i,n)cin >> b[i];
  rep(i,n)cin >> c[i];
  sort(a,a+n);
  sort(b,b+n);
  sort(c,c+n);
  ll ans = 0;
  rep(i,n){
    ll an = lower_bound(a,a+n,b[i]) - a;
    ll cn = c + n - upper_bound(c,c+n,b[i]);
    //cout << an << " " << cn << endl;
    ans += an * cn;
  }
  cout << ans << endl;
}


Measured memory_bytes: 1408
function main()
    N = pread(Int)
    a = readvec(Int, N)
    println(search(a))
end

function search(a, ls=Int[], si=1, dep = 0)
    if dep == 3
        las = map(i -> a[i], ls)
        f = las[1] != las[2] && las[2] != las[3] && las[1] != las[3]
        tmp = maximum(las)
        return sum(las) - tmp > tmp && f ? 1 : 0
    end
    c = 0
    for i in si:length(a)
        push!(ls, i)
        c += search(a, ls, i+1, dep+1)
        pop!(ls)
    end
    return c
end

import Base.parse
import Base.StringVector

parse(::Type{String},  str::AbstractString) = str
isdelim(x::UInt8, xs::Set{UInt8}) = x in xs
const delimset = Set([0x0a, 0x20])

function myreaduntil(s::IO, delims::Set{UInt8})::Vector{UInt8}
    out = StringVector(0)
    c::UInt8 = 0x00
    while !eof(s)
        c = read(s, UInt8)
        !isdelim(c, delims) && break
    end
    push!(out, c)
    eof(s) && return out
    while !eof(s)
        c = read(s, UInt8)
        isdelim(c, delims) && break
        push!(out, c)
    end
    return out
end

function readword(io::IO = stdin, delims = delimset)::String
    word = myreaduntil(io, delims)
    i = length(word)
    if i == 0 || word[i] != 0x0a
        return String(word)
    elseif i < 2 || word[i-1] != 0x0d
        return String(resize!(word,i-1))
    else
        return String(resize!(word,i-2))
    end
end

pread(ty) = parse(ty, readword())

reads(tys...)::Tuple{tys...} = Tuple{tys...}(pread(ty) for ty in tys)

function readvec(tys::Tuple , len::Signed)::Tuple{map(x -> Vector{x},tys)...}
    rv = Tuple{map(x -> Vector{x},tys)...}(Vector{ty}(undef,len) for ty in tys)
    for i in 1:len
        for j in 1:length(tys)
            @inbounds rv[j][i] = pread(tys[j])
        end
    end
    rv
end

readvec(ty::Type, len::Signed)::Vector{ty} = @inbounds ty[pread(ty) for i in 1:len]

function readmat(ty::Type, s...)::Matrix{ty}
    v = Matrix{ty}(undef, s...)
    @inbounds for i in 1:s[1]
        v[i,:] = readvec(ty, s[2])
    end
    v
end

main()


Measured memory_bytes: 209572
#define _USE_NATH_DEFINES
#include <iostream>
using namespace std;

int main() {
	int x, y;
	int A[] = { 0, 1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1 };
	cin >> x >> y;
	if (A[x] == A[y]) cout << "Yes" << endl;
	else cout << "No" << endl;
}

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

public class Main {
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();
		BigInteger ans = BigInteger.ONE;
		BigInteger ans1 = ans.multiply(BigInteger.valueOf(a)).multiply(BigInteger.valueOf(c));
		BigInteger ans2 = ans.multiply(BigInteger.valueOf(a)).multiply(BigInteger.valueOf(d));
		BigInteger ans3 = ans.multiply(BigInteger.valueOf(b)).multiply(BigInteger.valueOf(c));
		BigInteger ans4 = ans.multiply(BigInteger.valueOf(b)).multiply(BigInteger.valueOf(d));
		if (ans1.compareTo(ans2) >= 0) {
			// 2 < 1
			if (ans1.compareTo(ans3) >= 0) {
				if (ans1.compareTo(ans4) >= 0) {
					System.out.println(ans1);
				} else {
					System.out.println(ans4);
				}
			} else {
				if (ans3.compareTo(ans4) >= 0) {
					System.out.println(ans3);
				} else {
					System.out.println(ans4);
				}
			}
		} else {
			if (ans2.compareTo(ans3) >= 0) {
				if (ans2.compareTo(ans4) >= 0) {
					System.out.println(ans2);
				} else {
					System.out.println(ans4);
				}
			} else {
				if (ans3.compareTo(ans4) >= 0) {
					System.out.println(ans3);
				} else {
					System.out.println(ans4);
				}
			}
		}
	}
}


Measured memory_bytes: 35936
N = int(input())
ls = [int(i) for i in input().split()]

minuses = sum(i < 0 for i in ls)

if minuses % 2 == 0:
	print(sum(abs(i) for i in ls))
else:
	absls = [abs(i) for i in ls]
	minimum = min(absls)
	print(sum(absls) - minimum * 2)


Measured memory_bytes: 64880
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int ll
#define Mid ((l+r)/2)
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define drep(i,a,b) for(int i=(a);i>=(b);--i)
#define file(a) freopen(#a".in","r",stdin),freopen(#a".out","w",stdout);
const int maxn=3e5+5,mod=1e9+7,inf=0x3f3f3f3f;
int n,m,Q,K,T,H,W;
int read(){
    int x=0,f=1;char c=getchar();
    while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
    while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
    return x*f;
}int X[maxn],Y[maxn];
int maxx,maxy,sumx,sumy;
bool px[maxn],py[maxn];
int h[maxn],w[maxn];
signed main(){
    //file(a);
	H=read(),W=read(),m=read();
	rep(i,1,m){
		h[i]=read(),w[i]=read();
		X[h[i]]++,Y[w[i]]++;
	}
	rep(i,1,H)maxx=max(maxx,X[i]);
	rep(i,1,W)maxy=max(maxy,Y[i]);
	rep(i,1,H)if(X[i]==maxx)sumx++,px[i]=true;
	rep(i,1,W)if(Y[i]==maxy)sumy++,py[i]=true;
	int cnt=0;
	rep(i,1,m)if(px[h[i]]&&py[w[i]])++cnt;
	if(cnt>=sumx*sumy)printf("%lld\n",maxx+maxy-1);
	else printf("%lld\n",maxx+maxy);


    return 0;
}


Measured memory_bytes: 13596
import java.util.Scanner;

public class Main {

	static int a[] = new int[4];

	public static int seven(int s) {
		int ans = a[0], e = s;
		if(s >= 8)return -1;
		for (int i = 0; i < 3; ++i) {
			int tmp = 1 & e;
			if (tmp == 1)
				ans += a[i + 1];
			else
				ans -= a[i + 1];
			e = e >> 1;
		}
		if (ans == 7)
			return s;
		else
			return (seven(++s));
	}

	public static String make(int s) {
		String ans = Integer.toString(a[0]);
		int e = s;
		for (int i = 0; i < 3; ++i) {
			if ((e & 1) == 1)
				ans += "+";
			else
				ans += "-";
			e = e >> 1;
			ans += Integer.toString(a[i + 1]);
		}

		ans += "=7";
		return ans;
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String in = sc.next();
		sc.close();
		for (int i = 0; i < 4; ++i) {
			a[i] = Integer.parseInt(in.substring(i,  i + 1));
		}
		int s = seven(0);
		System.out.println(make(s));

	}

}


Measured memory_bytes: 20820
#include <iostream>
#include<cctype>
using namespace std;
 
int main()
{
	char ch;
	int count[26]={};

	while( cin >> ch){
		if(islower(ch)){//islower???ch????°?????????????ture?????????
			count[ch-'a']++;//??¢?????????????????????a???z????????£?¶?????????¢?????????????????????????????????????????????????????§???????????????'a'???????????¨?????????????????????????????????
		}else if(isupper(ch)){
			count[ch-'A']++;
		}
	}


	for(int i = 0;i < 26;i++){
        cout << char(i +'a') << " : " << count[i] << "\n";
    }

    return 0;
}

Measured memory_bytes: 1140
#include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <random>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#define reppl(i,n,m) for (long long i = m; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PL = pair<long long, long long>;
using Pxy = pair<double, double>;
using T = tuple<int, int, bool>;
const int INF = 1001001007;
const int mod = 1000000007;
const int MOD = 998244353;
const ll inf = 1e18;
template <typename AT>
void printvec(vector<AT> &ar){
    rep(i,ar.size()-1) cout << ar[i] << " ";
    cout << ar[ar.size()-1] << endl;
}
template <typename Q>
void printvvec(vector<vector<Q>> &ar){
    rep(i,ar.size()){
        rep(j,ar[0].size()-1) cout << ar[i][j] << " ";
        cout << ar[i][ar[0].size()-1] << endl;
    }
}
template <typename S>
bool range(S a, S b, S x){
    return (a <= x && x < b);
}

int main() {
    int n, k; cin >> n >> k;
    vector<int> ar(n);
    rep(i,n) cin >> ar[i];
    sort(ar.begin(),ar.end());
    int ans = 0;
    rep(i,k) ans += ar[i];
    cout << ans << endl;
}

Measured memory_bytes: 3620
using System;

public class Program
{
	public static void Main(string[] args)
	{
		string line = Console.ReadLine();
		int numOfCards = int.Parse(line);
		bool [] cards = new bool[53];
		for (int i = 0; i <= 52; i++)
		{
			cards[i] = true;
		}
		for (int i = 0; i < numOfCards; i++)
		{
			line = Console.ReadLine();
			string [] markAndNum=line.Split(' ');
			int num = int.Parse(markAndNum[1]);
			int markNum = 0;
			if (markAndNum[0] == "S")
			{
				markNum = 0;
			} else if (markAndNum[0] == "H")
			{
				markNum = 1;
			} else if (markAndNum[0] == "C")
			{
				markNum = 2;
			} else if (markAndNum[0] == "D")
			{
				markNum = 3;
			}
			int cardNum = markNum * 13 + num;

			cards[cardNum] = false;
		}

		for (int i = 1; i < cards.Length; i++)
		{
			if (cards[i] == true)
			{
				if (i <= 13 )
				{
					Console.WriteLine("S " + i);
				}
				else if( i <= 26)
				{
					Console.WriteLine("H " + (i-13));
				}
				else if (i <= 39)
				{
					Console.WriteLine("C " + (i - 26));
				}
				else 
				{
					Console.WriteLine("D " + (i - 39));
				}
					
			}
		}


		
	}


}




public class StreamScanner
{
	private readonly char[] _c = { ' ' };
	private int _index = -1;
	private string[] _input = new string[0];
	private readonly System.IO.StreamReader _sr = new System.IO.StreamReader(Console.OpenStandardInput());

	public T Next<T>()
	{
		if (_index == _input.Length - 1)
		{
			_index = -1;
			while (true)
			{
				string rl = _sr.ReadLine();
				if (rl == null)
				{
					if (typeof(T).IsClass) return default(T);
					return (T)typeof(T).GetField("MinValue").GetValue(null);
				}
				if (rl != "")
				{
					_input = rl.Split(_c, StringSplitOptions.RemoveEmptyEntries);
					break;
				}
			}
		}
		return (T)Convert.ChangeType(_input[++_index], typeof(T), System.Globalization.CultureInfo.InvariantCulture);
	}

	public T[] Next<T>(int x)
	{
		var ret = new T[x];
		for (var i = 0; i < x; ++i) ret[i] = Next<T>();
		return ret;
	}

	public T[][] Next<T>(int x, int y)
	{
		var ret = new T[y][];
		for (var i = 0; i < y; ++i) ret[i] = Next<T>(x);
		return ret;
	}
}

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

n,m = map(int,input().split())

# 最小値を求めるセグメント木
def init_min(init_min_val):
    #set_val
    for i in range(n):
        seg_min[i+num_max-1]=init_min_val[i]
    #built
    for i in range(num_max-2,-1,-1) :
        seg_min[i]=min(seg_min[2*i+1],seg_min[2*i+2])

def update_min(k,x):
    k += num_max-1
    seg_min[k] = x
    while k:
        k = (k-1)//2
        seg_min[k] = min(seg_min[k*2+1],seg_min[k*2+2])

def query_min(p,q):
    if q<=p:
        return ide_ele_min
    p += num_max-1
    q += num_max-2
    res=ide_ele_min
    while q-p>1:
        if p&1 == 0:
            res = min(res,seg_min[p])
        if q&1 == 1:
            res = min(res,seg_min[q])
            q -= 1
        p = p//2
        q = (q-1)//2
    if p == q:
        res = min(res,seg_min[p])
    else:
        res = min(min(res,seg_min[p]),seg_min[q])
    return res

#####単位元######
ide_ele_min = 10**20

#num_max:n以上の最小の2のべき乗
# num_max =2**(n-1).bit_length()
num_max = 2**(len(str(bin(n-1))) -2)
seg_min=[ide_ele_min]*2*num_max

update_min(0,0)

rlc = []
for i in range(m):
    l,r,c = map(int,input().split())
    rlc.append((r,l,c))

rlc.sort()

for tmp in rlc:
    r,l,c = tmp
    l = l-1
    r = r-1
    update_min( r, min( query_min(l,r) + c , query_min(r,r+1)) )

ans = query_min(n-1,n)
if(ans == ide_ele_min):
    print(-1)
else:
    print(ans)

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

#define FOR(x,n) for(int x=0;x<n;x++)
#define mp make_pair
typedef long long ll;
typedef pair<int,int> iPair;


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

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

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

  n = n % k;
  cout << min(n, k-n) << '\n';
}

// UPDATE N WHEN UR DONE AAAAAAAAAAAAAAAAAAAAAAAAAAA (if it applies lol)


Measured memory_bytes: 256
fn main() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    let v: Vec<i32> = s
        .trim()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect();
    let n = v[0];
    let m = v[1];

    let mut neighbor: Vec<Vec<i32>> = vec![Vec::new(); 8];

    for _i in 0..m {
        s = String::new();
        std::io::stdin().read_line(&mut s).ok();
        let v: Vec<i32> = s
            .trim()
            .split_whitespace()
            .map(|e| e.parse().ok().unwrap())
            .collect();
        let a = v[0] - 1;
        let b = v[1] - 1;

        neighbor[a as usize].push(b);
        neighbor[b as usize].push(a);
    }

    let mut check = vec![false; n as usize];

    println!("{}", cnt(0, &neighbor, &mut check));
}

fn cnt(v: i32, neighbor: &Vec<Vec<i32>>, check: &mut Vec<bool>) -> i32 {
    check[v as usize] = true;

    let mut ret = 0;

    let mut stuck = true;
    for u in neighbor[v as usize].iter() {
        if !check[*u as usize] {
            stuck = false;
            ret += cnt(*u, neighbor, check);
        }
    }

    if stuck {
        ret = 1;
        for b in check.iter() {
            if !b {
                ret = 0;
            }
        }
    }

    check[v as usize] = false;

    ret
}


Measured memory_bytes: 4352
N = int(input())
H = [int(x) for x in input().split()]

dp = [0 for x in range(N + 1)]
dp[2] = abs(H[1] - H[0])

for i in range(3, N + 1):
  dp[i] = min(dp[i - 1] + abs(H[i - 1] - H[i - 2]), dp[i - 2] + abs(H[i - 1] - H[i - 3]))

print(dp[N])

Measured memory_bytes: 13980
x1,y1,x2,y2=map(int,input().split())
print(x2+(y1-y2),end=' ')
print(y2-(x1-x2),end=' ')
print((x2+(y1-y2)+(x1-x2)),end=' ')
print((y2-(x1-x2)+(y1-y2)),end=' ')

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
#include <set>
#include <iomanip>
#include <stdio.h>
#include <sstream>
#include <string>
#include <bits/stdc++.h>
using namespace std;
int main(void){
  int n;
  cin>>n;
  vector<string> s(n);
  vector<map<char,int>> hoge(n);
  for(int i=0; i<n; i++){
    cin>>s.at(i);
    sort(s.at(i).begin(),s.at(i).end());
  }

  string ans="";
  char now='a';
  while(now<='z'){
    int count=10000;
    for(int i=0; i<n; i++){
      int precount=0;
      for(int j=0; j<s.at(i).size(); j++){
        if(s.at(i)[j]==now){
          precount++;
        }
      }
      count=min(count,precount);
    }
    for(int i=0; i<count; i++){
        ans+=now;
      }
    now+=1;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
/*input
5
1 2 3 4 5
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl
#define debug cout << "hi" << endl

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const int MOD = 1e9 + 7;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n; cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    int i = 0;
    int j = 0;
    while(i < n)
    {
    	while(i < n && a[i] != j + 1) i++;
    	if(i == n) break;
    	j = a[i];
    	i++;
    }
    if(!j) cout << -1;
    else cout << n - j;

    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
	int N;
	cin >> N;
	ll res = 0;
	for (int i = 1; i <= N; ++ i) {
		if (i%3 && i%5) res += i;
	}
	cout << res << endl;
}


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

using namespace std ; 

const int N = 2e5 + 7 ;

int n; 
long long ans = 0 ; 


int main(){
        ios_base::sync_with_stdio(0) ; 
        cin.tie(0) ; 
        //freopen("in.in" , "r" , stdin) ; 
        cin >> n; 

        for(int i = 0 ;i < n -1 ;i++){
                int u , v ; 
                cin >> u >> v; 
                if(u > v)
                        swap(u , v) ; 
                ans -= 1LL *  u * (n - v + 1LL) ; 
        }

        for(int i = 1; i<= n;i++){
                ans +=1LL * (i * (n - i + 1LL)) ; 
        }
        cout<< ans ; 

        return 0; 
}

Measured memory_bytes: 3620
#include<stdio.h>
#include<stdlib.h>
#define INF 1000000

int matrixChainOrder(int*);
int min(int,int);
int n;

int main(){
  int *p,i;
  
  scanf("%d",&n);
  
  p = (int *)malloc(sizeof(int)*(n+2));

  for(i=0;i<n;i++){
    scanf("%d %d",&p[i],&p[i+1]);
  }
  // for(i=0;i<=n;i++) printf("%d ",p[i]);
  //printf("\n");
  printf("%d\n",matrixChainOrder(p));

  return 0;
}

int matrixChainOrder(int* p){
  int i,j,l,k,q;
  int m[100][100];

  for(i=1;i<=n;i++){
    m[i][i] = 0;
  }

  for(l=2;l<=n;l++){
    for(i=1;i<=n-l+1;i++){
      j = i+l-1;
      m[i][j] = INF;
      for(k=i;k<j;k++){
	q = m[i][k] + m[k+1][j] + p[i-1]*p[k]*p[j];
	m[i][j] = min(m[i][j],q);
      }
    }
  }
  
  /* for(i=0;i<=n;i++){
    for(j=0;j<=n;j++){
      if(i<=j) printf("%d ",m[i][j]);
    }
    printf("\n");
    }*/


  return m[1][n];
}

int min(int a,int b){
  if(a<b)return a;
  else return b;
}

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

int main() {
  	int x, y = 0; 
  	cin >> x;
  	for (int c = 500, h = 1000; c > 0 and x > 0; h /= 200, c /= 100)
    	y += h*(x/c), x %= c;
  	cout << y << '\n'; }
  

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <algorithm>
#include <cmath>
#include <fstream>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

#define ll long long

using namespace std;

#ifdef DEBUG
#else
#endif

int main(int argc, const char *argv[]) {
   double r;
   cin>>r;
   cout<<2*3.14159*r<<endl;
   return 0;
}

Measured memory_bytes: 3256
#include <iostream>
#include <vector>
#define MIN(a, b) (((a) > (b)) ? (b) : (a))
#define MAX(a, b) (((a) < (b)) ? (b) : (a))
using namespace std;
int main(void){
    int n, k;
    cin >> n >> k;
    vector<int> x(n);
    for(int i = 0; i < n; i ++) cin >> x[i];
    
    int tmin = 300000000;
    for(int i = 0; i <= n-k; i ++){
        int l = x[i], r = x[i+k-1];
        if(l > 0){
            tmin = MIN(tmin, r);
        }
        else{
            if(r > 0) tmin = MIN(tmin, MAX(-l, r) + 2 * MIN(-l, r));
            else tmin = MIN(tmin, -l);
        }
    }
    cout << tmin << "\n";
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;cin >> s;
	string t="2019/04/30";
	if(s<=t) cout << "Heisei" << endl;
	else cout << "TBD" << endl;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Scanner;
import java.util.List;
public class Main {
	public static void main(String[] args) {
		try(Scanner sc = new Scanner(System.in)) {
			while(true) {
				int d = sc.nextInt();
				int e = sc.nextInt();
				double min = 10000000;
				if (d==0 && e==0)	break;
				for(int x=0; x<=d; x++) {
					for(int y=0; y<=d; y++) {
						if(x+y == d) {
							double zure = Math.abs(Math.sqrt(x*x+y*y)-e);
							if(zure < min)	min = zure;
						}
					}
				}
				System.out.println(min);
			}
			
			
			
			
			
			
		}
	}
}




Measured memory_bytes: 26944
N = list(map(int,input().rstrip().split()))

x = 0
if 1 in N:
  x = x + 1
if 9 in N:
  x = x + 1
if 7 in N:
  x = x + 1
if 4 in N:
  x = x + 1
if x == 4:
  print('YES')
else:
  print('NO')

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define watch(x) cerr << (#x) << " is " << (x) << endl


using namespace std;



int main()
{
	#ifdef ME
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif

	int n; cin >> n;
	long long ans = 1;
	vector<long long> arr(n);
	for (long long &x : arr)
	{
		scanf("%lld", &x);
		if (x == 0)
		{
			cout << "0" << endl; 
			return 0;
		}
	}

	for(int i = 0; i < n; i++)
	{
		if (ans > ( (long long)1e18 / arr[i] ))
		{
			cout << "-1" << endl; 
			return 0;
		}
		ans *= arr[i];
	}

	cout << ans << endl;
	

	return 0;
}

Measured memory_bytes: 3984
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
	int a,b;
	while(cin>>a>>b)
	{
		if (a*b%2 == 0)
		{
			cout<<"No"<<endl;
		}
		else
		{
			cout<<"Yes"<<endl;
		}
	}
	return 0;
}

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

int main() {
    int S, hour, minute, second;
    cin >> S;

    hour = S / 3600;
    S %= 3600;
    minute = S / 60;
    S %= 60;
    second = S;

    cout << hour << ":" << minute << ":" << second << endl;
}



Measured memory_bytes: 3072
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <stdio.h>
using namespace std;

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

	vector<vector<char> > vvcStr;
	multimap<vector<char>, int> mapvStr;
	long long cnt = 0;

	for (int i = 0; i != N; i++) {
		string strin;
		cin >> strin;
		vector<char> vcStr;
		for (int j = 0; j != 10; j++) {
			vcStr.push_back(strin[j]);
		}
		sort(vcStr.begin(), vcStr.end());
		vvcStr.push_back(vcStr);

		multimap<vector<char>, int>::iterator itr = mapvStr.find(vcStr);
		if (itr != mapvStr.end()) {
			itr->second += 1;
		}
		else {
			pair<vector<char>, int> pairStr;
			pairStr.first = vcStr;
			pairStr.second = 1;
			mapvStr.insert(pairStr);
		}
	}

	long nOverlap = 0;
	for (multimap<vector<char>, int>::iterator itr = mapvStr.begin(); itr != mapvStr.end(); ++itr) {
		long iElem = itr->second;
		nOverlap += iElem * (iElem - 1) / 2;
	}

	cout << nOverlap << endl;
	return 0;
}



Measured memory_bytes: 16944
#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)<(N);(i)++)
const int mod = 1000000007;

int main(){
  int a, b , h;
  cin >> a >> b >> h;
  cout << (a + b) * h / 2 << endl;
}

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

ll n, t[MAXN], a[MAXN], h = 1, w = 1;

int main()
{
	cin >> n;
	for(int i = 0 ; i < n; i++){
        cin >> t[i] >> a[i];
	}
	for(int i = 0; i < n; i++){
        ll mult = max((h + t[i] - 1) / t[i], (w + a[i] - 1) / a[i]);
        h = t[i] * mult;
        w = a[i] * mult;
	}
	cout << h + w << endl;

	return 0;
}


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

int main(){
	int n, w, vmin, left, right;
	cin >> n;
	vector<int> rw(n);
	cin >> w;
	rw[0] = w;
	for(int i=1; i<n; i++){
		cin >> w;
		rw[i] = rw[i-1] + w;
	}
	vmin = 100;
	for(int i=0; i<n-1; i++){
		left = rw[i];
		right = rw[n-1] - rw[i];
		vmin = min(vmin, abs(left - right));
	}
	cout << vmin << endl;
	return 0;
}

Measured memory_bytes: 256
w=[200,300,500,1000,1200,1500]
p=[380,550,850,1520,1870,2244]
dp=[2<<20]*5001
dp[0]=0
for i in xrange(6):
    for j in xrange(0,5000-w[i]+1,100):
        dp[j+w[i]] = min(dp[j+w[i]] , dp[j]+p[i])
while True:
    n=input()
    if n==0:
        break
    print dp[n]

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define FORR(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)

#define CHMIN(a, b) (a) = min((a), (b))
#define CHMAX(a, b) (a) = max((a), (b))

#define DEBUG(x) cout << #x << ": " << (x) << endl
#define PRINT(x) cout << x << endl
#define all(x) x.begin(),x.end()


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

    if((A<=C&&C<=B)||(B<=C&&C<=A)){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}




Measured memory_bytes: 256
n=int(input())
a=5000000
delt=5000000
while not ((a+1)*a//2<n and (a+2)*(a+1)//2>=n):
  delt=max(delt//2,1)
  if (a+2)*(a+1)//2<n:
    a+=delt
  else:
    a-=delt
a=a+1
joker=a*(a+1)//2-n

for i in range(1,a+1):
  if i != joker:
    print(i)


Measured memory_bytes: 3408
#include <iostream>
#include <vector>
#include <string>
using namespace std;
typedef long long ll;

int dp[2][200001] = {};

int main() {
	int n;
	string s;
	cin >> n;
	cin >> s;
	for(int i = 0; i < n; i++) {
		dp[0][i+1] = dp[0][i]+((s[i]=='#')?1:0);
	}
	for(int i = n-1; i >= 0; i--) {
		dp[1][i] = dp[1][i+1]+((s[i]!='#')?1:0);
		//cout << dp[1][i] << dp[1][i+1] << s[i] << endl;
	}
	int ans = 1<<25;
	for(int i = 0; i <= n; i++) {
		//cout << (dp[0][i])<<","<<(dp[1][i]) << endl;
		ans = min(ans,dp[0][i]+dp[1][i]);
	}
	cout << ans << endl;
	return 0;
}


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

int M1, M2, D1, D2;

int main(){
  cin >> M1 >> D1 >> M2 >> D2;

  if(M1 != M2) cout << 1 << endl;
  else cout << 0 << 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;
typedef long long ll;

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

Measured memory_bytes: 3620
using System;
using System.Collections.Generic;
using System.Linq;

namespace AOJ.Volume2
{
    public class BusTimetable
    {
        public static int Main()
        {
            // 飯盛山行き
            string meshi = Console.ReadLine();
            int n = int.Parse(meshi.Substring(0, meshi.IndexOf(' ')));
            meshi = meshi.Substring(meshi.IndexOf(' ', 0) + 1);

            // 鶴ケ城行き
            string tsuru = Console.ReadLine();
            int m = int.Parse(tsuru.Substring(0, tsuru.IndexOf(' ')));
            tsuru = tsuru.Substring(tsuru.IndexOf(' ', 0) + 1);

            var schedule = new List<DateTime>();
            int pos = 0;
            var sh = meshi.Split(' ');
            int hour, min;
            for (int i = 0; i < n; i++)
            {
                hour = int.Parse(sh[pos]);
                min = int.Parse(sh[pos + 1]);

                schedule.Add(new DateTime(2000, 1, 1, hour, min, 0));
                pos += 2;
            }

            pos = 0;
            sh = tsuru.Split(' ');
            for (int i = 0; i < m; i++)
            {
                hour = int.Parse(sh[pos]);
                min = int.Parse(sh[pos + 1]);

                schedule.Add(new DateTime(2000, 1, 1, hour, min, 0));
                pos += 2;
            }

            string answer = "";
            foreach (var d in schedule.GroupBy(a => a).Select(b => new { Schedule = b.Key }).OrderBy(c => c.Schedule))
            {
                answer += d.Schedule.ToString("H:mm") + " ";
            }
            answer = answer.Trim();
            Console.WriteLine(answer);

            return 0;
        }
    }
}

Measured memory_bytes: 10628
<?php
    $fnum = trim(fgets(STDIN));
    $snum = trim(fgets(STDIN));
    $farray = str_split($fnum);
    $sarray = str_split($snum);

    foreach ($farray as $fkey => $fvalue) {
        if ($fvalue == $sarray[0]) {
            $count = 0;
            while ($count < count($sarray) && ($fkey + $count) < count($farray)) {
                if ($farray[$fkey + $count] != $sarray[$count]) break;
                $count++;
            }
            if ($count == count($sarray)) echo $fkey."\n";             
        }
    }

Measured memory_bytes: 15456
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define forn(i, n) for (ll i = 0; i < (n); i++)
#define fori(i, b, e) for (ll i = (b); i < (e); i++)
#define forr(i, b, e) for (ll i = (b); i >= (e); i--)
#define allele(v) v.begin(), v.end()
#define fi first
#define se second

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    vector<bool> a(n + 1, true);
    int tmp;
    forn(i, m) cin >> tmp, a[tmp] = false;
    vector<ll> dp(n + 1);
    dp[0] = 1, dp[1] = a[1];
    fori(i, 2, n + 1)
    {
        if (a[i])
            dp[i] = (dp[i - 1] + dp[i - 2]) % (ll)(1e9 + 7);
        else
            dp[i] = 0;
    }
    cout << dp[n];
    return 0;
}

Measured memory_bytes: 1024
/**
 *    DP
 *    24.04.2020 14:54
**/

#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, w, weight, value;
  cin >> n >> w;
  vector<long long> dp (w + 1, 0);
  // dp[j] = maximum value with weight j
  for (int i = 0; i < n; i++) {
    cin >> weight >> value;
    for (int w_after = 0; w_after <= w - weight; w_after++) {
      dp[w - w_after] = max(dp[w - w_after], 
                            dp[w - w_after - weight] + value);
    }
  }
  cout << dp[w] << "\n";
  return 0;
}


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

using namespace std;

int main(void) {
  int n;
  cin >> n;
  vector<int> v{3, 5, 7};
  cout << (find(v.begin(), v.end(), n) != v.end() ? "YES" : "NO") << endl;
  return 0;
}

Measured memory_bytes: 256