akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
const int MOD = 1e9 + 7;
typedef long long lint;
#define int lint
const int INF =1e7;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repi(i, k, n) for (int i = (k); i < (int)(n); ++i)
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(),(x).end()
#define pb push_back
signed main(){
    int d;
    cin >> d;
    if(d==22){
        cout << "Christmas Eve Eve Eve" << endl;
    }
    else if (d == 23)
    {
        cout << "Christmas Eve Eve" << endl;
    }
    else if (d == 24)
    {
        cout << "Christmas Eve" << endl;
    }
    else
    {
        cout << "Christmas" << endl;
    }
    return 0;
}

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

const int MAX = 100;

int main(){
    int n;
    int A[MAX];
    cin >> n;
    rep(i, n) cin >> A[i];
    
    int i, j;
    int v;

    for(i = 0; i < n; i++){
        v = A[i];
        j = i-1;

        while(j >= 0 && A[j] > v){
            A[j+1] = A[j];
            j--;
        }
        A[j+1] = v;

        rep(i,n){
            if(i > 0) cout << " ";
            cout << A[i];
        }
        cout << endl;
    }

    return 0;
}


Measured memory_bytes: 3072
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var str=input.trim();
var arr=str.split("");
var kupc=[0,0,0,0];
arr.forEach(function(v){
   if(v=="K")kupc[0]++;
   if(v=="U")kupc[1]++;
   if(v=="P")kupc[2]++;
   if(v=="C")kupc[3]++;
});
console.log(Math.min.apply(null,kupc));

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

int main(){
  int n;
  scanf("%d\n",&n);
  int min=n+1;
  int p;
  int count=0;
  for(int i=0;i<n;i++){
    scanf("%d",&p);
    if(p<min){
      count++;
      min=p;}}

  printf("%d\n",count);

  return 0;
}


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

int main() {
  int k;
  cin >> k;
  vector<pair<int, int> > adj[k];

  int dist1, dist2, weight;
  for (int i = 0; i < k; i++) {
    dist1 = (i * 10) % k;
    weight = 0;
    if ( dist1 != i ) {
      adj[i].push_back(make_pair(dist1, weight));
    }
    dist2 = (i + 1) % k;
    weight = 1;
    if ( dist2 != dist1 && dist2 != i) {
      adj[i].push_back(make_pair(dist2, weight));
    }
  }

  int *d;
  bool *visit;
  d = new int[k];
  visit = new bool[k];
  int next_u;
  for (int i = 0; i < k; i++) d[i] = 1000000;
  for (int i = 0; i < k; i++) visit[i] = false;
  d[1] = 1;
  deque <int> q;
  for (int i = 0; i < adj[1].size(); i++) {
    next_u = adj[1][i].first;
    if (adj[1][i].second == 0) {
      q.push_front(next_u);
      d[next_u] = d[1];
    } else {
      q.push_back(next_u);
      d[next_u] = d[1] + 1;
    }
  }

  int u;
  while ( !q.empty() ) {
    u = q.front(); 
    q.pop_front();
    for (int i = 0; i < adj[u].size(); i++) {
      next_u = adj[u][i].first;
      if (adj[u][i].second == 0 && !visit[next_u]) {
        q.push_front(next_u);
        d[next_u] = d[u];
      } else if (!visit[next_u]) {
        q.push_back(next_u);
        d[next_u] = d[u] + 1;
      }
    }
    visit[u] = true;
    if (u == 0) break;
  }

  cout << d[0] << endl;

  delete[] d;
  delete[] visit;

  return 0;

}

Measured memory_bytes: 6528
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
ios_base::sync_with_stdio(false);
  cin.tie(NULL);
#ifndef ONLINE_JUDGE
 // freopen("input.txt","r",stdin);
#endif

  int n,k;
  cin>>n>>k;
  vector<int> a(n);
  for(int i=0;i<n;i++)
  {
    cin>>a[i];
  }

  sort(a.begin(),a.end());
  ll sum=0;

  for(int i=0;i<k;i++)
  {
    sum+=a[i];
  }

  cout<<sum<<endl;
  return 0;
}

Measured memory_bytes: 3588
#include<cstdio>
#include<iostream>
using std::cin;
using std::cout;
using std::endl;
int max(int a,int b)
{
    return a > b ? a : b ; 
}
int main()
{
	int a,b;
	int ans=0;
	cin>> a >> b;
	for(int i = 1;i < a; i++ ){
		for(int j = 1;j <=max(a,b); j++ ){
			if(i == j)
			{
			ans++;
			break;
			}
		}	
	}
	for(int i=1;i<=b;i++)
	{
	    if(a==i)
	    ans++;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
N, M = gets.split.map(&:to_i)
lines = {}
M.times do |i|
  s, t = gets.split.map(&:to_i)
  (lines[s-1] ||= []) << [t-1, 1 << i]
  (lines[t-1] ||= []) << [s-1, 1 << i]
end
# p lines
ans = []
stack= [] << [0, Array.new(N, false), 0]
stack[0][1][0] = true
# binding.pry
while !stack.empty?
  now = stack.pop
  if now[1].all?{|x|x == true}
    ans << now[2]
    next
  end
  lines[now[0]].each do |line|
    if !now[1][line[0]]
      now2 = Marshal.load(Marshal.dump(now))
      now2[0] = line[0]
      now2[1][line[0]] = true
      now2[2] += line[1]
      stack << now2
    end
  end
end
# p ans
puts ans.size

Measured memory_bytes: 2044
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<set>
#include<climits>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)

using namespace std;

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


template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T& t, const V& v) { t = v; }
template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T& t, const V& v) {
	for (auto& e : t) fill_v(e, v);
}


#define ARRAY_MAX 100005
const int INF = INT32_MAX / 3;
const ll MOD = 1e9 + 7;

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


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


int main() {

	int n, k;
	cin >> n >> k;
	ll ans = 0;
	vector<int> a(n);
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
	}

	for (int i = 0; i <= min(n , k); i++)
	{
		for (int j = 0; i+j <= min(n , k); j++)
		{
			vector<ll> v;
			ll cnt = 0;

			for (int p = 0; p < i; p++)
			{
				v.push_back(a[p]);
				cnt += a[p];
			}
			for (int q = 0; q < j; q++)
			{
				v.push_back(a[n - 1 - q]);
				cnt += a[n - 1 - q];
			}
			sort(v.begin(), v.end());
			
			for (int kk = 0; kk < min(k - i - j,(int)v.size()); kk++)
			{
				
				if (v[kk] < 0) {
					cnt -= v[kk];
				}
				
			}
			ans = max(ans, cnt);
		}
	}
	cout << ans << endl;





	return 0;
}


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

int main() {
	char s[100000];
	cin >> s;
	int n = strlen(s);
	if(s[0] == s[n - 1]){
		if(n % 2 == 0) cout << "First" << endl;
		else cout << "Second" << endl;
	}else{
		if(n % 2 == 0) cout << "Second" << endl;
		else cout << "First" << endl;
	}
	return 0;
}

Measured memory_bytes: 384
#include<stdio.h>
int MAX(int a,int b){return a<b?b:a;}
int q[1000000],C[100010];
int ta[100010],nt[200010],to[200010],co[200010];
int f[100010];
int dfs(int v,int e,int s){
  int i,max=C[s];
  for(i=ta[s];i+1;i=nt[i]){
    if(f[to[i]])continue;
    f[to[i]]=1;
    C[to[i]]=C[s]+co[i];
    //max=MAX(max,C[to[i]]);
    max=MAX(max,dfs(v,e,to[i]));
  }
  return max;
}
/*int bfs(int v,int e,int s,int *g){
  int t,r,i,max=0;
  for(i=0;i<v;i++)C[i]=1000000000;
  C[q[0]=s]=t=0;//printf("a\n");
  for(r=1;r-t;t++){
    for(i=ta[q[t]];i+1;i=nt[i]){//printf("%d %d\n",fr[i],to[i]);
      if(C[to[i]]>C[s]+co[i]){
	C[to[i]]=C[s]+co[i];
        if(max<C[to[i]]){
	  max=C[to[i]];
	  *g=to[i];
	}
	q[r++]=to[i];
      }
    }//printf("\n");
  }//printf("%d\n",r);
  return max;
  }//*/
int tyokkei(int v,int e,int *a){
  int i,max=0,g;
  for(i=0;i<v;i++){
    ta[i]=-1;
    C[i]=1000000000;
    f[i]=0;
  }
  C[0]=0;
  f[0]=1;
  for(i=0;i<e;i++){
    nt[i]=ta[a[i]];
    ta[a[i]]=i;
    nt[i+e]=ta[to[i]];
    to[i+e]=a[i];
    co[i+e]=co[i];
    ta[to[i]]=i+e;    
  }//printf("a\n");
  //for(i=0;i<2*e;i++)printf("%d %d\n",fr[i],to[i]);printf("\n");
  max=dfs(v,e*2,0);//printf("m%d\n",max);
  for(i=0;i<v;i++){
    if(max==C[i])g=i;
    C[i]=1000000000;
    f[i]=0;
  }
  C[g]=0;
  f[g]=1;//printf("%d\n",g);
  return dfs(v,e*2,g);
}
int main(){
  int n,a[100010],i;
  scanf("%d",&n);
  for(i=0;i<n-1;i++)scanf("%d %d %d",&a[i],&to[i],&co[i]);
  printf("%d\n",tyokkei(n,n-1,a));
  return 0;
}

Measured memory_bytes: 10548
#include <iostream>

using namespace std;

int main()
{
   int a, b;
   cin >> a >> b;
   if (a > b)
      cout << "a > b" << endl; 
   if (a < b)
      cout << "a < b" << endl;
   if (a == b)
      cout << "a == b" << endl;
   return 0;
}


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double PI=3.14159265358979323846;
int main() {
    double a, b, x;
    cin >> a >> b >> x;
    double v = a * a * b;
    double s;
    if (2 * x < v) {
        s = a * b * b / (2 * x);
        
    } else {
        s = (2 * (v - x) / (a * a * a));
    }
    double t = atan(s) * 180.0 / PI;
    printf("%.10f\n", t);
   
    return 0;
}

Measured memory_bytes: 256
//
//AtCoder Beginner Contest 134
//B - Golden Apple
//

#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <functional>
#include <cassert>

using namespace std;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define SIZE(x) (int)(x).size()
#define SIZEL(x) (ll)(x).size()
#define MSG(a) cout << #a << " " << a << endl;

using ll = long long;
using ld = long double;

const double PI = 3.14159265358979323846;

ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }            //最小公倍数

int main()
{
    int n, d;
    cin >> n >> d;

    int ans = n/(d*2+1);
    if (n%(d*2+1)!=0) ans++;

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<boost/format.hpp>
using namespace std;

int N, M;
vector<pair<int, int> > cities[100000];
string ans[100000];

int main(){
    cin >> N >> M;
    for(int i = 0; i < M; i++){
        int P, Y;
        cin >> P >> Y;
        cities[P-1].push_back(make_pair(Y, i));
    }
    for(int i = 0; i < N; i++){
        sort(cities[i].begin(), cities[i].end());
        for(int j = 0; j < cities[i].size(); j++){
            int P = i + 1;
            int rank = j + 1;
            int idx = cities[i][j].second;
            ans[idx] =  (boost::format("%06d%06d") % P % rank).str();
        }
    }
    for(int i = 0; i < M; i++){
        cout << ans[i] << endl;
    }
    
    
}


Measured memory_bytes: 12416
#include<bits/stdc++.h>
using namespace std;
int main() {
    int a,b,bb;
    cin>>a>>b;
    bb=b;
	while(bb) {
		a*=10;
		bb/=10;
	}
    a+=b;
    if(sqrt(a)==floor(sqrt(a))) {
        cout<<"Yes"<<'\n';
        return 0;
    } else {
        cout<<"No"<<'\n';
        return 0;
    }
}

Measured memory_bytes: 256
import math

def F(A, B):
    return max(list(map(int, [math.log10(A), math.log10(B)])))+1


def main():
    N = int(input())
    max_ = 0
    for a in range(1, int(math.sqrt(N))+1):
        if N % a != 0:
            continue

        b = N/a
        v = F(a, b)
        if max_ < v:
            max_ = v
    print(v)


if __name__ == '__main__':
    main()


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

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//typedef pair<ll, ll> P;
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<int> &o) {
    ll a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const ll mod = 1e10;

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;

const int mod = 1000000007;

struct Monster {
    int place;
    ll hit_point;
};

struct Bom {
    int place;
    ll count;
};

int main() {
    int n, d, a;
    cin >> n >> d >> a;

    vector<Monster> monsters(n);
    rep(i, n) cin >> monsters[i].place >> monsters[i].hit_point;
    sort(monsters.begin(), monsters.end(), [](Monster ma, Monster mb) { return ma.place < mb.place; });

    vector<ll> places(n);
    rep(i, n) places[i] = monsters[i].place;

    vector<ll> dp(n, 0);
    ll ans = 0;
    rep(i, n) {
        if (i != 0) dp[i] += dp[i - 1];
        ll point = a * dp[i];
        if (monsters[i].hit_point <= point) continue;
        ll nokori = monsters[i].hit_point - point;

        ll count = (nokori + a - 1) / a;
        ans += count;
        dp[i] += count;
        auto it = lower_bound(places.begin(), places.end(), monsters[i].place + (2 * d) + 1);
        if (it == places.end()) continue;
        int index = distance(places.begin(), it);
        dp[index] -= count;
    }
    cout << ans << endl;
}



Measured memory_bytes: 6528
n, k = gets.split.map(&:to_i)
array = []
n.times do
  array << gets.split.map(&:to_i)
end
array.sort!{ |a, b| a[0] <=> b[0] }
a = 0
array.each do |e|
  a += e[1]
  if a >= k
    puts e[0]
    break
  end
end


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

int main()
{
    ll n;
    cin >> n;
    vector<ll> a(n);
    for(ll i = 0; i < n; i++)
    {
        cin >> a[i];
    }

    map<ll, ll> m1, m2;
    for(ll i = 1; i <= n; i++)
    {
        m1[i - a[i - 1]]++;
        m2[i + a[i - 1]]++;
    }

    ll count = 0;
    for(map<ll, ll>::iterator it = m1.begin(); it != m1.end(); it++)
    {
        count += it->second * m2[it->first];
    }

    cout << count;

    return 0;
}

Measured memory_bytes: 39044
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1e9 + 7;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<class T>
istream& operator >> (istream& is, vector<T>& v)
{
	for (auto &i : v) is >> i;
	return is;
}
template<class T>
ostream& operator<<(ostream& os, vector<T>& v)
{
	const string delimiter = "\n";
	REP(i, v.size())
	{
		os << v[i];
		if (i != v.size() - 1) os << delimiter;
	}
	return os;
}
/*--------------------template--------------------*/

int main()
{
	cin.sync_with_stdio(false); cout << fixed << setprecision(10);
	int n, m; cin >> n >> m;
	vector<vi> g(n);
	vector<set<int>> par(n);
	set<int> st;
	REP(i, n) st.insert(i);
	REP(i, n + m - 1)
	{
		int a, b; cin >> a >> b;
		a--; b--;
		g[a].push_back(b);
		g[b].push_back(a);
		par[b].insert(a);
		if (st.count(b)) st.erase(b);
	}
	assert(st.size() == 1);
	int r = *st.begin();
	vi ans(n, -2); ans[r] = -1;
	queue<int> que;
	que.push(r);
	while (!que.empty())
	{
		int v = que.front();
		que.pop();
		for (auto u : g[v])
		{
			if (ans[u] != -2) continue;
			if (par[u].size() > 1)
			{
				par[u].erase(v);
				continue;
			}
			ans[u] = v;
			que.push(u);
		}
	}
	REP(i, n) cout << ans[i] + 1 << endl;
	return 0;
}

Measured memory_bytes: 16888
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <iomanip>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cassert>
#include <climits>
#define bogo_sort   std::sort
#define bozo_sort   std::stable_sort
#define alles(obj)  obj.begin(), obj.end()
#define elif        else if
#define unless(flg) if(!(flg))
#define elless(flg) else if(!(flg))
#define echo        std::cout <<
#define read        std::cin >>
#define endl        std::endl
#define fin         << '\n'
#define bash        push_back
#define makePair    std::make_pair
#define _           << ' ' <<
// type-define
#define Stack       std::stack
#define Queue       std::queue
#define Set         std::set
#define PQueue      std::priority_queue
#define Vector      std::vector
#define Pair        std::pair
#define Map         std::map
#define UMap        std::unordered_map
#define Greater     std::greater
using String  =     std::string;
using llong   =     long long;
using boolean =     bool;
using Pii     =     Pair<int, int>;
using Vi      =     Vector<int>;
using Vii     =     Vector<Pii>;
// utils
constexpr int   dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int   dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
constexpr int   INF  = 0x3f3f3f3f;
constexpr llong LINF = 0x3f3f3f3f3f3f3f3fLL;

namespace {
    llong power ( llong x, llong n, llong mod ) {
        llong ans = 1;
        while ( n > 0 ) {
            if ( n & 1 ) ans = ( ans * x ) % mod;
            x = ( x * x ) % mod;
            n >>= 1;
        }
        return ans;
    }
    llong power ( llong x, llong n ) { return power( x, n, 1000000007 ); }
    llong gcd   ( llong x, llong y ) { return x % y ? gcd( y, x % y ) : y; }
    llong lcm   ( llong x, llong y ) { return ( x / gcd(x, y) * y ); }
    llong abs   ( llong n )          { return ( n < 0 ) ? -n : n; }
    template<class A, class B>inline bool chmax ( A &a, const B &b ) { return b > a ? a = b, true : false; }
    template<class A, class B>inline bool chmin ( A &a, const B &b ) { return b < a ? a = b, true : false; }
    boolean isMovable ( int x, int y, int w, int h ) {
        return ( x >= 0 && y >= 0 && x < w && y < h );
    }
}

namespace Rlyeh {

    int t[9];

    signed call_of_Cthulhu( signed datum ) {

        int n;
        read n;
        for ( int i = 0; i < n; i++ ) {
            int a;
            read a;
            if ( a >= 3200 ) {
                t[8]++;
            }
            else {
                t[a/400]++;
            }
        }
        int min = 0;
        for ( int i = 0; i < 8; i++ ) {
            if ( t[i] ) {
                min++;
            }
        }
        int max = min + t[8];
        if ( min == 0 && t[8] ) min++;
        echo min _ max fin;

        return 0;
    }
}

signed main(){std::cin.tie(0); std::ios::sync_with_stdio(false); echo std::fixed << std::setprecision(8); int main_result = Rlyeh::call_of_Cthulhu(114514); return main_result;}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define N 100010
#define ll long long
int main()
{
    int n,m;
    cin>>n>>m;
    if(n * 500 >= m){
        cout<<"Yes";
    }
    else{
        cout<<"No";
    }
    return 0;
}


Measured memory_bytes: 3540
/* abc_170_a */

#include<stdio.h>

int main()
{
  int X,Y;
  int i;
  int a;
  a=0;
  scanf("%d",&X);
  scanf("%d",&Y);
  for(i=0;i<=X;i++){
    if((2*i+4*(X-i))==Y){
      a=1;
      break;
    }
  }
  if(a==1){
    printf("Yes\n");
  } else if(a==0){
    printf("No\n");
  }
  return 0;
}


Measured memory_bytes: 1644
import math

N = int(input())
s = [""] * N
for i in range(N):
	s[i] = list(input())
	s[i].sort()
s.sort()

st, count = 1, 0
for i in range(1, N):
	if s[i - 1] == s[i]:
		st += 1
	elif st > 1:
		count += math.factorial(st) // (2 * math.factorial(st - 2))
		st = 1
if st > 1:
	count += math.factorial(st) // (2 * math.factorial(st - 2))

print(count)

Measured memory_bytes: 25520
#include<iostream>
#include<algorithm>
using namespace std;
const int MAXN=11;
int a[MAXN],ans;
int main(){
	for(int i=1;i<=3;i++) cin>>a[i];
	sort(a+1,a+4);
	ans=a[1]+a[2];
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <functional>
#include <queue>
#include <map>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;

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

int main(){
    ll a, b, c, d, k, m, n, p;
    cin >> a >> b >> c >> d;
    
    if(a%c == 0){
        k = b/c - a/c + 1;
    }else{
        k = b/c - a/c;
    }
    if(a%d == 0){
        m = b/d - a/d + 1;
    }else{
        m = b/d - a/d;
    }
    p = c*d/gcd(c, d);
    if(a%p == 0){
        n = b/p - a/p + 1;
    }else{
        n = b/p - a/p;
    }
    ll count = b-a+1-k-m+n;
    cout << count << endl;
}

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

const int DIM = 2e5 + 5;
const int EXP = 30;

char str[DIM];
int dp[DIM][EXP], nxt[DIM][EXP];

int main( void ) {
    
    cin >> (str + 1);
    int n = (int) strlen(str + 1);
    
    for (int i = 0; i <= 25; ++i)
        nxt[n + 1][i] = n + 1;
    
    for (int i = n; i >= 1; --i) {
        for (int j = 0; j <= 25; ++j) {
            nxt[i][j] = nxt[i + 1][j];
            dp[i][j] = dp[i + 1][j];
            
            if (j == str[i] - 'a') {
                nxt[i][j] = i; ++dp[i][j];
                
                for (int k = 0; k <= 25; ++k)
                    dp[i][j] = min(dp[i][j], 1 + dp[i + 1][k]);
            }
        }
    }
    
    for (int p = 1; true; ) {
        int mnm = 1e9, pos = -1;
        
        for (int i = 0; i <= 25; ++i)
            if (mnm > dp[nxt[p][i]][i])
                mnm = dp[nxt[p][i]][i], pos = i;
        
        p = nxt[p][pos] + 1;
        cout << (char) (pos + 'a');
        
        if (dp[p - 1][pos] == 0)
            break;
    }
    
    return 0;
}

Measured memory_bytes: 47360
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring> //memset(dp,0,sizeof(dp))
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<ll,ll> P;
typedef pair<ll,ll> Pll;
//小数点以下　cout << fixed << setprecision(10) << num << endl;
//桁数はlog10(mid)でやれ　log(mid)/log(10)はWA
//long*long<0で判定するな
//開区間と閉区間
//アルファベットが何番目かは x=s[i]-'a'
//bfsはmain()内で　rep(i,h)rep(j,w)rep(i,4)でバグ
//切り上げ：(a+(b-1))/b
//32bit以上は 1ull<<j
// map 初期値0 for(auto itr=mp.begin();itr!=mp.end();++itr) itr->fi itr->se で全探索
// for(auto u:mp) u.fi u.se も可能
//n個のgcd,lcmは一つずつみて更新していく
//大きな数を扱うときは素因数分解した形で持っておく
// (l/a[i]) = l*powmod(a[i],MOD-2)%MOD;
//auto itr=lower_bound(ALL(a),key) a[itr-a.begin()]

int main(){
    int n; cin >> n;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    sort(ALL(a));
    vector<bool> use(n,0);
    int ans=0;
    rrep(i,n){
        rep(j,50){
            if(a[i]<(1ull<<j)&&(1ull<<j)<=2*a[i]){
                ll p=(1ull<<j)-a[i];
                if(p==a[i]&&!use[i]){
                    int k=1;
                    while(a[i-k]==a[i]&&i-k>=0){
                            if(!use[i-k]){
                            ans++;
                            use[i-k]=1;
                            break;
                            }
                        k++;
                    }
                    break;
                }
                int q=lower_bound(ALL(a),p)-a.begin();
                int k=0;
                if(!use[i]){
                    while(a[q+k]==p && q+k<n){
                        if(!use[q+k]){
                            ans++;
                            use[q+k]=1;
                            break;
                        }
                        k++;
                    }
                }
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(int)(a); (i)<(int)(b); ++(i))
#define rFor(i, a, b) for(int (i)=(int)(a)-1; (i)>=(int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<int, lint> pil;
typedef pair<lint, lint> pll;
template<class T> bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T> bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;}
template<class T> T div_floor(const T a, const T b){return a>=0 ? a/b : (a+1)/b-1;}
template<class T> T div_ceil(const T a, const T b){return a>=0 ? (a-1)/b+1 : a/b;}

constexpr lint mod = 1e9+7;
constexpr lint INF = mod*mod;
constexpr int MAX = 100010;

int main(){
    string s;
    cin >> s;
    rep(i, s.size()) printf("%c", 'x');
}

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

typedef struct{
	int f;
	int s;
}point;

int main(){
	while(1){
		char f[12][12];
		
		bool flag=false;
		for(int i=0; i<12; ++i){
			for(int j=0; j<12; ++j){
				if(scanf(" %c", &f[i][j]) == EOF){
					flag=true;
					break;
				}	
			}
			if(flag) break;
			//printf("%d ok\n", i);
		}
		if(flag) break;
		//printf("ok\n");
		
		int ans=0;
		int df[4]={0,1,0,-1}, ds[4]={1,0,-1,0};
		
		for(int i=0; i<12; ++i){
			for(int j=0; j<12; ++j){
				if(f[i][j]!='1') continue;
				
				//printf("%d %d\n", i, j);
				++ans;
				
				point st;
				st.f=i; st.s=j;
				f[i][j]='c';
				queue<point> que;
				que.push(st);
				
				while(!que.empty()){
					point v=que.front();
					que.pop();
					for(int k=0; k<4; ++k){
						int nf=v.f+	df[k], ns=v.s+ds[k];
						if(nf>=0 && nf<12 && ns>=0 && ns<12 && f[nf][ns]=='1'){
							f[nf][ns]='c';
							point tmp;
							tmp.f=nf;
							tmp.s=ns;	
							que.push(tmp);
							//printf("push %d %d\n", nf, ns);
						}	
					}
				}
						
			}
		}
		
		printf("%d\n", ans);
	}
}

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

#define all(x) (x).begin(), (x).end()

typedef long long ll;
typedef array<int, 3> tri;
typedef long double ld;

template <class T> istream& operator>>(istream& I, vector<T>& v) {for (T &e: v) I >> e; return I;}
template <class T> ostream& operator<<(ostream &O, const vector<T>& v) {for (const T &e: v) O << e << ' '; return O;}




void _main() {
        int n, m; cin >> n >> m;
        vector<int> a(n); cin >> a;
        sort(all(a));
        priority_queue<int> pq(all(a));
        while (m--) {
                int x = pq.top(); pq.pop();
                pq.emplace(x / 2);
        }

        ll ans = 0;
        while (pq.size()) {
                ans += pq.top();
                pq.pop();
        }

        cout << ans;
}



signed main() {
        ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//        freopen("input.txt", "r", stdin);
        int _t = 1;
//        cin >> _t;
        while (_t--) _main();
        return 0;
}

Measured memory_bytes: 3992
#include<bits/stdc++.h>
using namespace std;
int Read() {
	int x = 0, f = 1; char ch = getchar();
	while(!isdigit(ch)) {if(ch == '-')  f = -1; ch = getchar();}
	while(isdigit(ch)) {x = (x << 3) + (x << 1) + ch - '0'; ch = getchar();}
	return x * f;
}
string s = "ACL"; 
signed main() {
	int k = Read();
	while(k--)  cout << s;
	return 0;
}

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

int main() {
	int n;
	cin >> n;
	string c;
	cin >> c;

	int cnt_red = 0;
	rep(i,n) if (c[i]=='R') cnt_red++;
	int ans = 0;
	rep(i,cnt_red) if (c[i]=='W') ans++;
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3768
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

dishes = [a, b, c, d, e]
t = 0
ts = []

def chumon(ds, t):
    if len(ds) == 1:
        return ts.append(t + ds[0])
    for i in range(len(ds)):
        di = ds[i]
        n = ds[:]
        n.pop(i)
        if di % 10:
            chumon(n, t + di - (di % 10) + 10)
        else:
            chumon(n, t + di)

chumon(dishes, t)
print(min(ts))

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

int main()
{
  long int n;
  cin >> n;
  long long int sum=0;
  for(int i=1;i<=n;i++){
    if(i%3 == 0 || i%5==0) continue;
    sum += i;
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define reps(i,n) for(int i=1;i<(int)(n);i++)

typedef long long ll;
using namespace std;
int main()
{
  string n;
  cin>>n;
  string m=n;
  reverse(n.begin(),n.end());
  if(n==m){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  return 0;
}


Measured memory_bytes: 3628
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>

const int MN = 3005;

int N, pa[MN], pb[MN], id[MN * 2], nx[MN * 2];
std::string str, f[MN];

int main() {
	std::cin >> N >> str;
	str = " " + str;
	for (int i = 1, a = 0, b = 0; i <= N * 2; ++i)
		if (str[i] == 'a') pa[id[i] = ++a] = i;
		else pb[id[i] = ++b] = i;
	pa[N + 1] = pb[N + 1] = N * 2 + 1, id[N * 2 + 1] = N + 1;
	for (int i = 1, j = 0; i <= N + 1; ++i)
		while (j < std::min(pa[i], pb[i]))
			nx[++j] = i;
	for (int i = N; i >= 1; --i) {
		if (pa[i] > pb[i]) {
			int j = pb[i];
			for (; pb[id[j]] < pa[id[j]] && (id[j] <= i || pb[id[j]] < pa[id[j] - 1]); ++j)
				if (id[j] >= i) f[i] += str[j];
			f[i] += f[id[j]];
		} else f[i] = "ab" + f[nx[pb[i] + 1]];
		f[i] = std::max(f[i], f[i + 1]);
	}
	std::cout << f[1];
	return 0;
}

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

int main()
{
	int n;
	cin >> n;
	int a[101];
	for (int i = 0; i < n; ++i)
	{
		cin >> a[i];
	}
	sort(a, a+n, greater<int>());
	int A = 0, B = 0;
	for (int i = 0; i < n; ++i)
	{
		if (i % 2)
		{
			B += a[i];
		}
		else
		{
			A += a[i];
		}
	}
	cout << A - B << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

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

int main() {

	string str[3];
	string out_str = "";
	for (int i = 0; i < 3; i++) {
		cin >> str[i];
		out_str += str[i][i];
	}

	cout << out_str;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int N = in.nextInt();
		String S = in.next();
		String ans = "No";
		if (N % 2 == 0) {
			String a = S.substring(0, N / 2);
			String b = S.substring(N / 2);
			if (a.equals(b)) {
				ans = "Yes";
			}
		}
		System.out.println(ans);
		in.close();
	}
}

Measured memory_bytes: 23508
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n)  for (int i = 0; i < (int) (n); i++)
#define REP1(i, n) for (int i = 1; i <= (int) (n); i++)
#define all(x)     (x).begin(), (x).end()
#define SZ(x)      ((int) (x).size())
using ll = long long;
const ll mod = 1e9 + 7;

int main() {
  int n, m;
  cin >> n >> m;
  cout << (n + m) * (n + m - 1) / 2 - n * m << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int w,h,k;
int A[309][309];
int num;
int cnt[309];
char c[309][309];
void solve(int l,int r) 
{
	vector <int> P;	
	for(int i=l; i<=r; i++)
	{
		for(int j=1; j<=w; j++)
		{
			if(c[i][j]=='#')	P.push_back(j);
		}
	}
	sort(P.begin(), P.end());
	for(int i=0; i<P.size(); i++)
	{
		int v1=1, v2=w;
		if(i>=1) v1=P[i-1]+1;
		if(i<(int)P.size()-1) v2=P[i];
		num++;
		for(int j=l; j<=r; j++)
		{
			for(int k=v1; k<=v2; k++)
			{
				A[j][k]=num;
			}
		}
	}
}
int main()
{
	vector <int> vec;
	cin>>h>>w>>k;
	for(int i=1; i<=h; i++)
	{
		for(int j=1; j<=w; j++)
		{
			cin>>c[i][j];
			if(c[i][j]=='#') cnt[i]++;
		}
	} 
	for(int i=1; i<=h; i++)
	{
		if(cnt[i]>=1) vec.push_back(i);
	}
	for(int i=0; i<vec.size(); i++)
	{
		int v1=1, v2=h;
		if(i>=1) v1=vec[i-1]+1;
		if(i<(int)vec.size()-1) v2=vec[i];
		solve(v1, v2);
	}
	for(int i=1; i<=h; i++)
	{
		for(int j=1; j<=w; j++)
		{
			if(j>=2) cout<<" "; cout<<A[i][j];
		}
		cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 1280
import itertools
N,K = map(int,input().split())
d = list()
A = list()
for _ in range(K):
    d.append(int(input()))
    A.append(list(map(int,input().split())))
A = list(itertools.chain.from_iterable(A))
A = set(A)
print(N-len(A))

Measured memory_bytes: 9188
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <set>
#include <deque>

long long mod = 1e9+7;
class Mint {
public:
  long long x;
  Mint(){}; // 引数なしでも定義できるように引数なしコンストラクタも用意しておく
  Mint(long long a){
    x = a%mod;
    while(x<0){
      x += mod;
    }
  };
  Mint& operator += (const Mint &a){
    x+=a.x;
    x%=mod;
    return *this;
  }
  Mint& operator -= (const Mint &a){
    x += (mod - a.x);
    x%=mod;
    return *this;
  }
  Mint& operator *= (const Mint &a){
    x*=a.x;
    x%=mod;
    return *this;
  }

  // a^n mod を計算する
  // Useaeg: Mint z = y.pow(y, n);
  Mint pow(Mint a, long long n) const {
    Mint y(1);
    Mint b(a);
    while (n > 0) {
      if (n & 1) y *= b;
      b *= b;
      n >>= 1;
    }
    return y;
  }

  // a^{-1} mod を計算する
  Mint modinv(const Mint &a) const {
    return pow(a, mod-2);
  }

  Mint& operator /= (const Mint &a) {
    x *= modinv(a).x;
    x %= mod;
    return *this;
  }

  Mint operator + (Mint &a) const {
    Mint y(*this);
    y += a;
    return y;
  }

  Mint operator - (Mint &a) const {
    Mint y(*this);
    y -= a;
    return y;
  }

  Mint operator * (Mint &a) const {
    Mint y(*this);
    y *= a;
    return y;
  }

  Mint operator / (Mint &a) const {
    Mint y(*this);
    y/=a;
    return y.x;
  }

  // nCk @mod を計算する
  Mint nCk(Mint &n, const long long k) const {
    Mint y = Mint(1);
    for (Mint i(0); (i.x)<k; i.x++){
      y *= (n-i);
      y /= i;
    }
    return y;
  }

  // nPk @mod を計算する
  Mint nPk(Mint &n, long long k) const {
    Mint y(1);
    for (Mint i(0); (i.x)<k; i.x++){
      y *= (n-i);
    }
    return y;
  }
};

int main(){
  int N, K;
  std::cin >> N >> K;
  if (K==1) std::cout << 0 << std::endl;
  else std::cout << (N-K)+1-1 << std::endl;
}

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

int main()
{
    int D;
    cin >> D;

    switch (D)
    {
        case 25: cout << "Christmas" << endl; break;
        case 24: cout << "Christmas Eve" << endl; break;
        case 23: cout << "Christmas Eve Eve" << endl; break;
        case 22: cout << "Christmas Eve Eve Eve" << endl; break;
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int MaxN = 100100,MOD=1000000007;
int n,a[MaxN];
inline LL fastpow(LL a,LL b) {
	LL ret=1;
	while (b) {
		if (b&1) {
			ret*=a;ret%=MOD;
		}
		a*=a;a%=MOD;
		b>>=1;
	}
	return ret;
}
inline LL ny(const LL& a){
	return fastpow(a,MOD-2);
}
LL f[MaxN],nf[MaxN];

LL C(LL n,LL m) {
	if (n==m) return 1;
	return f[n]*nf[m]%MOD*nf[n-m]%MOD;
}
int pos[MaxN],re;
int main() {
	scanf("%d",&n);
	for (int i=1;i<=n+1;++i) scanf("%d",a+i);
	for (int i=1;i<=n+1;++i) {
		if (!pos[a[i]]) {
			pos[a[i]]=i;
		} else {
			re=pos[a[i]]+(n-i);
		}
	}
	f[0]=1;
	for (int i=1;i<MaxN;++i) {
		f[i]=(f[i-1]*i)%MOD;
		nf[i]=ny(f[i]);
	}
	printf("%d\n",n);
	for (int i=2;i<=n+1;++i) {
		LL t=0;
		if (i-1<=re) t=C(re,i-1);
		printf("%d\n",int((C(n+1,i)-t+MOD)%MOD)); 
	}
	return 0;
} 

Measured memory_bytes: 3584
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            new Main().solve(sc);
        }
    }

    void solve(Scanner sc) {
        int[] cNum = new int['z' + 1];
        sc.nextInt();
        char[] s = sc.next().toCharArray();
        for (char c : s) {
            cNum[c]++;
        }

        long MOD = 1000_000_000l + 7l;
        long ans = 1l;
        for (int i = 'a'; i <= 'z'; i++) {
            ans = (ans * (cNum[i] + 1)) % MOD;
        }
        System.out.println(ans - 1l);
    }
}


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

using namespace std;
 
#define PB	push_back
#define ALL(x)	(x).begin(), (x).end()
#define ALLR(x)	(x).rbegin(), (x).rend()
#define MP	make_pair
 
#define debug(_x)		cerr << #_x << '=' << (_x) << endl;
#define debug2(_x, _y)	cerr << #_x << '=' << (_x) << ' ' << #_y << '=' << (_y) << endl;
#define debugn(_a)		cerr << #_a << ": "; for (const auto _x: _a) cerr << (_x) << ' '; cerr << endl;

#define HERE debug(__LINE__);

#define FAST_IO ios::sync_with_stdio(false); cin.tie(0)

#define int long long int

typedef pair<int, int> ii;
typedef pair<pair<int, int>, int> iii;
typedef vector<int> vi;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef unsigned long long ull;

const int INF = LONG_LONG_MAX>>1;
const int NINF = LONG_LONG_MIN/2;


int32_t main() {
	FAST_IO;
	
	int a, b, c, k;
	cin >> a >> b >> c >> k;
	
	int s = 0;
	if (k >= a) {
		k -= a;
		s += a;
	} else {
		s += k;
		k = 0;
	}
	
	if (k >= b) {
		k -= b;
	} else {
		k = 0;
	}
	
	s -= k;
	
	cout << s << endl;
}

// g++ -Wall -Wextra -Wshadow -fsanitize=undefined


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

using namespace std;

int main()
{
    unsigned long long M,N,ans=0;
    cin>>N>>M;
    vector<pair<long,long>>p(N);
    for(int i=0;i<N;i++){
        long long A,B;
        cin>>A>>B;
        p[i]=make_pair(A,B);
    }
    sort(p.begin(),p.end());
    for(int i=0;i<N;i++){
        if(M>=p[i].second){
            M-=p[i].second;
            ans+=p[i].first*p[i].second;
        }else{
            ans+=M*p[i].first;
            break;
        }
    }
    cout<<ans<<endl;
}

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

using E = System.Linq.Enumerable;

public class Program
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine());
        var seqA = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();

        var k = seqA.Select((x, i) => (i + 1) * x % 2).Sum();

        Console.WriteLine(k);
    }
}


Measured memory_bytes: 28028
#include <iostream>
using namespace std;
int main(void){
    int n;
    cin>>n;
    int a[1001] = {0};
    for(int i=0;i<=n;i++){
        int b=i,j=2;
        while(b>1){
            if(b%j==0){
                b=b/j;
                a[j]++;
            }else{
                j++;
            }
        }
    }
    long long c=1,p=1000000007;
    for(int i=1;i<=n;i++){
        c*=a[i]+1;
        c=c%p;
    }
    cout<<c<<endl;
    
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

typedef long long ll;

int main() {
	int N;
	cin >> N;
	ll ans_t, ans_a;
	cin >> ans_t >> ans_a;
	for (int i = 1; i < N; i++) {
		ll T, A;
		cin >> T >> A;
		ll lbT, lbA;
		if (ans_t % T != 0)lbT = T * (ans_t / T + 1);
		else lbT = ans_t;
		if (ans_a % A != 0)lbA = A * (ans_a / A + 1);
		else lbA = ans_a;
		if (lbT / T * A < ans_a) {
			ans_a = lbA;
			ans_t = lbA / A * T;
		}
		else if (lbA / A * T < ans_t) {
			ans_t = lbT;
			ans_a = lbT / T * A;
		}
		else {
			if (((lbA - ans_a) + (lbA / A * T - ans_t)) <
				(lbT - ans_t) + (lbT / T * A - ans_a)) {
				ans_a = lbA;
				ans_t = lbA / A * T;
			}
			else {
				ans_t = lbT;
				ans_a = lbT / T * A;
			}
		}
	}
	cout << ans_a + ans_t << endl;
	return 0;
}

Measured memory_bytes: 256
/* Dynamic Programming implementation of LCS problem */
#include<iostream> 
#include<cstring> 
#include<cstdlib> 
using namespace std; 
  
/* Returns length of LCS for X[0..m-1], Y[0..n-1] */
void lcs( char *X, char *Y, int m, int n ) 
{ 
   int L[m+1][n+1]; 
  
   /* Following steps build L[m+1][n+1] in bottom up fashion. Note 
      that L[i][j] contains length of LCS of X[0..i-1] and Y[0..j-1] */
   for (int i=0; i<=m; i++) 
   { 
     for (int j=0; j<=n; j++) 
     { 
       if (i == 0 || j == 0) 
         L[i][j] = 0; 
       else if (X[i-1] == Y[j-1]) 
         L[i][j] = L[i-1][j-1] + 1; 
       else
         L[i][j] = max(L[i-1][j], L[i][j-1]); 
     } 
   } 
  
   // Following code is used to print LCS 
   int index = L[m][n]; 
  
   // Create a character array to store the lcs string 
   char lcs[index+1]; 
   lcs[index] = '\0'; // Set the terminating character 
  
   // Start from the right-most-bottom-most corner and 
   // one by one store characters in lcs[] 
   int i = m, j = n; 
   while (i > 0 && j > 0) 
   { 
      // If current character in X[] and Y are same, then 
      // current character is part of LCS 
      if (X[i-1] == Y[j-1]) 
      { 
          lcs[index-1] = X[i-1]; // Put current character in result 
          i--; j--; index--;     // reduce values of i, j and index 
      } 
  
      // If not same, then find the larger of two and 
      // go in the direction of larger value 
      else if (L[i-1][j] > L[i][j-1]) 
         i--; 
      else
         j--; 
   } 
  
   // Print the lcs 
   printf("%s\n",lcs); 
} 
  
/* Driver program to test above function */
int main() 
{ 
  char X[3005],Y[3005];
  while(~scanf("%s",X)){
  	scanf("%s",Y);
  	int m = strlen(X); 
	int n = strlen(Y); 
	lcs(X, Y, m, n);
  }
} 

Measured memory_bytes: 35456
#include <bits/stdc++.h>
using namespace std;
#define ALL(A) (A).begin(),(A).end()
#define ll long long
const ll mod = 1e9+7;
const ll INF = 2*1e18;
const int inf = 1e9+7;

bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}
int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	vector<int> v;
	for(int i=2;i<=55555;i++){
		if(IsPrime(i))v.push_back(i);
	}
	int cnt = 0;
	for(int i=0;i<v.size();i++){
		if(cnt==N)break;
		if(v[i]%5==1){
			cout << v[i] <<" ";
			cnt++;
		}
	}
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int, int> pii;
typedef priority_queue<pii, vector<pii>, greater<pii> > RPQ;
#define mk make_pair
#define INF (1 << 30)
#define INFL (1ll << 60ll)
#define mod 1000000007

int N;
int dp[110][5][5][5][5];

int dfs(int v, int f, int g, int h, int j){
    if(~dp[v][f][g][h][j]){
        return dp[v][f][g][h][j];
    }
    if((f == 1 && g == 2 && h == 3) || (g == 1 && h == 2 && j == 3))return dp[v][f][g][h][j] = 0;
    if((f == 2 && g == 1 && h == 3) || (g == 2 && h == 1 && j == 3))return dp[v][f][g][h][j] = 0;
    if((f == 1 && g == 3 && h == 2) || (g == 1 && h == 3 && j == 2))return dp[v][f][g][h][j] = 0;
    if((f == 1 && g == 2 && j == 3) || (f == 1 && h == 2 && j == 3))return dp[v][f][g][h][j] = 0;
    if(v == N - 1) return dp[v][f][g][h][j] = 1;
    int res = 0;
    if(v == 0){
        for(int i = 1; i <= 4; i++){
            res += dfs(v + 1, f, i, h, j);
            res %= mod;
        }
    }
    else if(v == 1){
        for(int i = 1; i <= 4; i++){
            res += dfs(v + 1, f, g, i, j);
            res %= mod;
        }
    }
    else if(v == 2){
        for(int i = 1; i <= 4; i++){
            res += dfs(v + 1, f, g, h, i);
            res %= mod;
        }
    }
    else {
        for(int i = 1; i <= 4; i++){
            res += dfs(v + 1, g, h, j, i);
            res %= mod;
        }
    }
    return dp[v][f][g][h][j] = res;
}

signed main(){
    cin >> N;
    memset(dp, -1, sizeof(dp));
    int ans = 0;
    for(int i = 1; i <= 4; i++){
        ans += dfs(0, i, 0, 0, 0);
        ans %= mod;
    }
    cout << ans << endl;


    return 0;
}

/*
1
2
3
4
agc=123
gac=213
acg=132
agxc=12x3
axgc=1x23

*/

Measured memory_bytes: 768
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <functional>
#include <list>
#include <numeric>
#include <math.h>
#include <cstdlib>
#include <queue>
#include <iterator>
#include <limits>
#include <string>
#include <sstream>
#include <iomanip>
#include <bitset>
#include <mutex>
#include <condition_variable>
#include <atomic>
#include <stack>
#include <memory>
#include <deque>
#include <string_view>
#include <random>
#include <chrono>
#include <cstring>

using namespace std;

static int my_speed_up = []() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); return 0; }();
using ll = long long; using ull = unsigned long long;
template<class T> using v = vector<T>;
template<class T> using vv = vector<vector<T>>;
template<class T> using vvv = vector<vector<vector<T>>>;
template<class T> using vvvv = vector<vector<vector<vector<T>>>>;
template<class T1, class T2> using um = unordered_map<T1, T2>;
template<class T> using us = unordered_set<T>;
using pii = pair<int,int>;
#define print_line cout << "[" << setw(3) << __LINE__ << "]  ";
#define for_b(i, b) for (int i = 0; i < (b); ++i)
#define for_ab(i, a, b) for (int i = a; i < (b); ++i)
#define what_is(x) { print_line cout << #x << " = " << x << endl; }
template<class T, class ... Ts> void what_are_2(T const& arg, Ts const&...args) { cout << arg; if constexpr (sizeof...(args) > 0) { cout << ", "; what_are_2(args...); } }
#define what_are(...) { print_line what_are_2(__VA_ARGS__); cout << endl; }
#define hit { print_line cout << "hit!" << endl; }
#define pad(x) for_b(i, x) cout << "  ";
#define show_1d(___x) { print_line cout << #___x << " = "; for (auto ___num : ___x) cout << ___num << ", "; cout << endl;} 
#define show_2d(___x) { print_line cout << #___x << endl; for (auto ___row : ___x) { for (auto ___num : ___row) cout << ___num << ", "; cout << endl; }}
#define show_3d(___x) { print_line cout << #___x << endl; for (auto ___row : ___x) { for (auto ___row2 : ___row) { for (auto ___num : ___row2) cout << ___num << ", "; cout << endl; }cout << endl; }}

vv<int> d4 = {{1,0},{-1,0},{0,1},{0,-1}};
vv<int> d8 = {{1,0},{-1,0},{0,1},{0,-1},{1,1},{1,-1},{-1,1},{-1,-1}};
bool is_valid_pos(size_t w, size_t h, int x, int y) {
    return x >= 0 && x < static_cast<int>(w) && y >= 0 && y < static_cast<int>(h);
}

// ⣿⣿⣟⣽⣿⣿⣿⣿⣟⣵⣿⣿⣿⡿⣳⣫⣾⣿⣿⠟⠻⣿⣿⣿⢻⣿⣿⣿⣿⣷⡽⣿
// ⣿⣟⣾⡿⣿⣿⢟⣽⣿⣿⣿⣿⣫⡾⣵⣿⣿⣿⠃⠄⠄⠘⢿⣿⣾⣿⣿⣿⢿⣿⣿⡜
// ⡿⣼⡟⣾⣿⢫⣿⣿⣿⣿⡿⣳⣿⣱⣿⣿⣿⡋⠄⠄⠄⠄⠄⠛⠛⠋⠁⠄⠄⣿⢸⣿
// ⢳⣟⣼⡿⣳⣿⣿⣿⣿⡿⣹⡿⣃⣿⣿⣿⢳⠁⠄⠄⠄⢀⣀⠄⠄⠄⠄⠄⢀⣿⢿⣿
// ⡟⣼⣿⣱⣿⡿⣿⣿⣿⢡⣫⣾⢸⢿⣿⡟⣿⣶⡶⢰⣿⣿⣿⢷⠄⠄⠄⠄⢼⣿⣸⣿
// ⣽⣿⢣⣿⡟⣽⣿⣿⠃⣲⣿⣿⣸⣷⡻⡇⣿⣿⢇⣿⣿⣿⣏⣎⣸⣦⣠⡞⣾⢧⣿⣿
// ⣿⡏⣿⡿⢰⣿⣿⡏⣼⣿⣿⡏⠙⣿⣿⣤⡿⣿⢸⣿⣿⢟⡞⣰⣿⣿⡟⣹⢯⣿⣿⣿
// ⡿⢹⣿⠇⣿⣿⣿⣸⣿⣿⣿⣿⣦⡈⠻⣿⣿⣮⣿⣿⣯⣏⣼⣿⠿⠏⣰⡅⢸⣿⣿⣿
// ⡀⣼⣿⢰⣿⣿⣇⣿⣿⡿⠛⠛⠛⠛⠄⣘⣿⣿⣿⣿⣿⣿⣶⣿⠿⠛⢾⡇⢸⣿⣿⣿
// ⠄⣿⡟⢸⣿⣿⢻⣿⣿⣷⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⡋⠉⣠⣴⣾⣿⡇⣸⣿⣿⡏
// ⠄⣿⡇⢸⣿⣿⢸⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣄⠘⢿⣿⠏⠄⣿⣿⣿⣹
// ⠄⢻⡇⢸⣿⣿⠸⣿⣿⣿⣿⣿⣿⠿⠿⢿⣿⣿⣿⣿⣿⣿⣿⣦⣼⠃⠄⢰⣿⣿⢯⣿
// ⠄⢸⣿⢸⣿⣿⡄⠙⢿⣿⣿⡿⠁⠄⠄⠄⠄⠉⣿⣿⣿⣿⣿⣿⡏⠄⢀⣾⣿⢯⣿⣿
// ⣾⣸⣿⠄⣿⣿⡇⠄⠄⠙⢿⣀⠄⠄⠄⠄⠄⣰⣿⣿⣿⣿⣿⠟⠄⠄⣼⡿⢫⣻⣿⣿
// ⣿⣿⣿⠄⢸⣿⣿⠄⠄⠄⠄⠙⠿⣷⣶⣤⣴⣿⠿⠿⠛⠉⠄⠄ ⢸⣿⣿⣿⣿⠃⠄⢀⣴




int main()
{
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    
    
    ll res = a*c;
    res = max(res, b*c);
    res = max(res, a*d);
    res = max(res, b*d);
    
    cout << res << endl;
    
    return 0;
}


Measured memory_bytes: 3644
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <ctype.h>
#include <stdlib.h>
using namespace std;


int main(){
    int N;
    cin >> N;
    bool flag = false;
    for (int i = 0; i < N; i++)
    {
        /* code */
      string S = "";
        cin >> S;
        if(S[0] == 'Y'){
            flag = true;
            break;
        }
    }
    if(flag){
        cout << "Four" << endl;
    }else{
        cout << "Three" << endl;
    }
}


Measured memory_bytes: 256