akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>                                                                              
using namespace std;                                                                                  
using ll = long long;                                                                                 
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }               
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }               
#define rep(i,n) for (int i=0; i< (n); ++i)                                                           
typedef pair<int, int> P;                                                                             
                                                                                                      
int main() {                                                                                          
  int n;                                                                                              
  cin >> n;                                                                                           
  int maxe = 0;                                                                                       
  int v;                                                                                              
  int sum = 0;                                                                                        
  for (int i=0; i<n; i++) {                                                                           
    cin >> v;                                                                                         
    chmax(maxe, v);                                                                                   
    sum += v;                                                                                         
  }                                                                                                   
  if (sum - maxe > maxe) {                                                                            
    cout << "Yes" << endl;                                                                            
  } else {                                                                                            
    cout << "No" << endl;                                                                             
  }                                                                                                   
                                                                                                      
  return 0;                                                                                           
}       

Measured memory_bytes: 256
import java.util.*;
import java.lang.*;

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        double[] h = new double[n];
        
        for (int i = 0; i < n; i++) {
            h[i] = sc.nextInt();
        }
        int max = 0;
        for (int i = 0; i < n - 1; i++) {
            if (max >= n - i - 1) {
                break;
            }
            int cnt = 0;
            for (int j = i + 1; j < n; j++) {
                if (h[j] <= h[j - 1]) {
                    cnt++;
                } else {
                    break;
                }
            }
            if (cnt > max) {
                max = cnt;
            }
        }
        System.out.println(max);
    }
}

Measured memory_bytes: 50652
#include <iostream>
#include <string>
#include <cstdlib>
#define For(i,a,b) for(int i=(a);i<(b);i++)
#define Rep(i,n) for(int i=0;i<(n);i++)
using namespace std;

int main(){
  int A[4];
  char B[4];
  for (int i=0; i<4; i++){
    cin >> B[i];
    A[i] = B[i]-'0';
  }
  
  Rep(i, 8){
    char op[3] = {'-', '-', '-'};
    int cnt=A[0];
    Rep(j, 3){
      if (((i>>j)&1) == 0) op[j] = '-';
      else op[j] = '+';
    }
    Rep(j, 3){
      if (op[j]=='-') cnt -= A[j+1];
      else cnt += A[j+1];
    }

    if (cnt == 7){
      cout << A[0] << op[0] << A[1] << op[1] << A[2] << op[2] << A[3] << "=" << 7 << endl;
      break;
    }
  }

  
}

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

using namespace std;

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int n;
    cin >> n;
    
    for (int i = 1; i <= 9; i++)
        for (int j = 1; j <= 9; j++)
            if (i * j == n)
                return cout << "Yes\n", 0;
    cout << "No\n";

    return 0;
}

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define pf push_front

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

#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
double pi = 3.141592653589793;
ll mod = 1000000007;
ll INF = 1000000001;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;



int main(){
    int n, m, wa = 0, ac = 0;
    cin >> n >> m;
    vi p(m);
    vector<string> s(m);
    vi b(n, 0);
    rep(i, m){
        cin >> p[i] >> s[i];
        if(s[i]=="WA"&&b[p[i]]>=0){
            b[p[i]]++;
        }else if(s[i]=="AC"&&b[p[i]]>=0){
            ac++;
            wa += b[p[i]];
            b[p[i]] = -1;
        }
    }
    cout << ac << " " << wa << endl;
}

Measured memory_bytes: 6528
#define DEBUG 0

#include <bits/stdc++.h>
using namespace std;

#if DEBUG
// basic debugging macros
int __i__,__j__;
#define printLine(l) for(__i__=0;__i__<l;__i__++){cout<<"-";}cout<<endl
#define printLine2(l,c) for(__i__=0;__i__<l;__i__++){cout<<c;}cout<<endl
#define printVar(n) cout<<#n<<": "<<n<<endl
#define printArr(a,l) cout<<#a<<": ";for(__i__=0;__i__<l;__i__++){cout<<a[__i__]<<" ";}cout<<endl
#define print2dArr(a,r,c) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<a[__i__][__j__]<<" ";}cout<<endl;}
#define print2dArr2(a,r,c,l) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<setw(l)<<setfill(' ')<<a[__i__][__j__]<<" ";}cout<<endl;}

// advanced debugging class
// debug 1,2,'A',"test";
class _Debug {
    public:
        template<typename T>
        _Debug& operator,(T val) {
            cout << val << endl;
            return *this;
        }
};
#define debug _Debug(),
#else
#define printLine(l)
#define printLine2(l,c)
#define printVar(n)
#define printArr(a,l)
#define print2dArr(a,r,c)
#define print2dArr2(a,r,c,l)
#define debug
#endif

// define
#define MAX_VAL 999999999
#define MAX_VAL_2 999999999999999999LL
#define EPS 1e-6
#define mp make_pair
#define pb push_back

// typedef
typedef unsigned int UI;
typedef long long int LLI;
typedef unsigned long long int ULLI;
typedef unsigned short int US;
typedef pair<int,int> pii;
typedef pair<LLI,LLI> plli;
typedef vector<int> vi;
typedef vector<LLI> vlli;
typedef vector<pii> vpii;
typedef vector<plli> vplli;

// ---------- END OF TEMPLATE ----------


int main() {
    LLI S;
    cin >> S;

    LLI z = sqrt(S)-5;
    z = max(z,0LL);
    while (z*z < S) z++;
    if (z*z-S <= 1000000000) printf("0 0 %d %d %d %d\n",z,1,z*z-S,z);
    else {
        z -= 5;
        z = max(z,0LL);
        while (z*(z-1) < S) z++;
        if (z*(z-1)-S <= 1000000000) printf("0 0 %d %d %d %d\n",z-1,1,z*(z-1)-S,z);
    }

    return 0;
}



Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
int ruiJ[1002][1002],ruiO[1002][1002],ruiI[1002][1002];
int main(){
    int H,W,N;
    cin>>H>>W>>N;
    string fie[1002];
    for(int i=0;i<H;i++)cin>>fie[i];
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            if(j!=0){
                ruiJ[i][j]+=ruiJ[i][j-1];
                ruiO[i][j]+=ruiO[i][j-1];
                ruiI[i][j]+=ruiI[i][j-1];
            }
            if(fie[i][j]=='J')ruiJ[i][j]++;
            if(fie[i][j]=='O')ruiO[i][j]++;
            if(fie[i][j]=='I')ruiI[i][j]++;
        }
    }
    for(int i=0;i<N;i++){
        int a,b,c,d,ansJ=0,ansO=0,ansI=0;
        cin>>a>>b>>c>>d;
        a--,b--,c--,d--;
        for(int j=a;j<=c;j++){
            ansJ+=ruiJ[j][d];
            ansO+=ruiO[j][d];
            ansI+=ruiI[j][d];
            if(b!=0){
                ansJ-=ruiJ[j][b-1];
                ansO-=ruiO[j][b-1];
                ansI-=ruiI[j][b-1];
            }
        }
        printf("%d %d %d\n",ansJ,ansO,ansI);
    }
    return 0;
}

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

void enq(int x, int y);

int q[64][2];
int head = 0;
int end = 0;

int main(void){
	char map[8][10];
	int n;
	int x, y;

	scanf("%d", &n);


	for(int i=0; i<n; i++){
		fgets(map[0], sizeof(map[0]), stdin);
		fgets(map[0], sizeof(map[0]), stdin);
		head = 0;
		end = 0;

		for(int j=0; j<8; j++){
			fgets(map[j], sizeof(map[j]), stdin);
			map[j][strlen(map[j]) - 1] = '\0';
		}


		scanf("%d %d", &x, &y);
		x--;
		y--;

		map[y][x] = '0';

		enq(x, y);

		while(head != end){
			int hx = q[head][0];
			int hy = q[head][1];
			head++;

			for(int j = hx-3; j <= hx+3; j++){
				if(j >= 0 && j <= 7 && map[hy][j] == '1'){
					map[hy][j] = '0';
					enq(j, hy);
				}
			}
			for(int j = hy-3; j <= hy+3; j++){
				if(j >= 0 && j <= 7 && map[j][hx] == '1'){
					map[hy][j] = '0';
					enq(hx, j);
				}
			}
		}

		printf("Data %d:\n", i+1);
		for(int j=0; j<8; j++){
			printf("%s\n", map[j]);
		}
	}

	return 0;
}

void enq(int x, int y){
	q[end][0] = x;
	q[end][1] = y;
	end++;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define int long long
#define double long double
#define INF 1e18
using namespace std;
signed main() {
  int W, H; char c;
  cin >> W >> H >> c;
  
  cout<<'+';
  for (int j = 0; j < W-2; j++) cout << '-';
  cout<<'+'<<endl;
  
  for (int i = 1; i < H-1; i++) {
    cout<<'|';
    for (int j = 1; j < W-1; j++) {
      if (H/2 == i && j == W/2) {
        cout<<c;
      } else {
        cout<<'.';
      }
    }
    cout<<'|'<<endl;
  }

  cout<<'+';
  for (int j = 0; j < W-2; j++) cout << '-';
  cout<<'+'<<endl;
}



Measured memory_bytes: 3100
N = int(input())
str = {}
for i in range(N):
    key = input()
    if(key in str.keys()):
        str[key] += 1
    else:
        str[key] = 1
m = max(str.values())
str = sorted(str.items(),key=lambda x:x[1],reverse=True)
z = []
for i in range(len(str)):
    if(str[i][1] == m):
        z.append(str[i][0])
z.sort()
for i in z:print(i)


Measured memory_bytes: 43224
import java.util.Scanner;

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

        // 入力(s1 s2 s3)
        String s1 = sc.next();
        String s2 = sc.next();
        String s3 = sc.next();

        System.out.println(s1.substring(0, 1).toUpperCase() + s2.substring(0, 1).toUpperCase() + s3.substring(0, 1).toUpperCase());
        sc.close();
    }
}

Measured memory_bytes: 39204
x, n = map(int, input().split())
ps_x = {int(s)-x for s in input().split()}

if not ps_x:
    print(x)
else:
    for i in range(100):
        if -i not in ps_x:
            print(x-i)
            break
        elif i not in ps_x:
            print(x+i)
            break




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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void solve() {
    ll X;
    cin >> X;
    if (X >= 30) {
        cout << "Yes" << '\n';
    } else {
        cout << "No" << '\n';
    }
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
    return 0;
}


Measured memory_bytes: 3640
#include<iostream>
#include<string>
#include<algorithm>
#include<bits/stdc++.h>
#include<math.h>
using namespace std;
#define rep(i,j,n) for(int i = j; i < (n); i++)

int main(){
    int k;
    cin >> k;
    if(k%2==0 || k%5==0){
        cout << "-1" << endl;
        return 0;
    }
    int j = 7;
    rep(i,1,k+1){
        if(j % k == 0){
            cout << i << endl;
            return 0;
        }
        j = j*10 + 7;
        j %= k; 
    }
}

Measured memory_bytes: 3644
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int comperaCards(string* card);

enum {
	Taro = 0,
	Hanako,
};

int main(){
	int n, point[2] = {0};
	string card[2];

	cin >> n;
	for(int i = 0; i < n; ++i){
		cin >> card[Taro];
		cin >> card[Hanako];

		switch (comperaCards(card))
		{
		case Taro:
			point[Taro] += 3;
			break;

		case Hanako:
			point[Hanako] += 3;
			break;

		default:
			point[Taro]++;
			point[Hanako]++;
			break;
		}
	}

	cout << point[Taro] << " " << point[Hanako] << endl;

	return 0;
}

int comperaCards(string *card){
	for(int i = 0; i < min(card[Taro].length(), card[Hanako].length()); ++i){
		if(card[Taro][i] > card[Hanako][i]) {
			return Taro;
		}
		else if(card[Taro][i] < card[Hanako][i]) {
			return Hanako;
		}
	}

	if(card[Taro].length() == card[Hanako].length()){
		return -1;
	}
	else if(card[Taro].length() > card[Hanako].length()){
		return Taro;
	}
	else{
		return Hanako;
	}
}


Measured memory_bytes: 3128
#include <iostream>
#include <sstream>
#include <string>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdio>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <functional>
#include <numeric>
#include <iomanip>

using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;

#define REP(i,n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i,a,b) for(int i = (a); i < (int)(b); ++i)
#define ALL(c) (c).begin(), (c).end()
#define SIZE(v) ((int)v.size())

#define pb push_back
#define mp make_pair
#define mt make_tuple

vector<vector<int>> edges;
vector<int> path;
set<int> used;

void dfs(int cur) {
    while(1) {
        bool found = false;
        for(auto nei: edges[cur]) {
            if (used.count(nei)) continue;
            else {
                cur = nei;
                path.pb(nei);
                used.insert(nei);
                found = true;
                break;
            }
        }
        if (!found) break;
    }
}

int main(void)
{
    cin.sync_with_stdio(false);
    int N, M;
    cin >> N >> M;
    edges.resize(N);
    REP(m, M) {
        int a, b;
        cin >> a >> b;
        --a; --b;
        edges[a].pb(b);
        edges[b].pb(a);
    }
    vector<int> deg_ones;
    vector<int> degs(N);
    REP(n,N) {
        if (SIZE(edges[n]) == 1) deg_ones.pb(n);
        degs[n] = SIZE(edges[n]);
    }

    // if (SIZE(deg_ones) > 0) {
    //     path.pb(deg_ones[0]);
    // } else {
    //     path.pb(0);
    // }
    path.pb(0);
    auto cur = path[0];
    used.insert(cur);
    dfs(cur);
    auto path_saved = path;

    path.clear();
    path.pb(0);
    dfs(cur);

    reverse(ALL(path));
    FOR(i, 1, SIZE(path_saved)) {
        path.pb(path_saved[i]);
    }

    cout << SIZE(path) << endl;
    REP(i, SIZE(path)) {
        if (i != 0) cout << " ";
        cout << (path[i] + 1);
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 12152
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<stdbool.h>
#include<assert.h>
typedef long long ll;
typedef long double ld;
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define rrep(i,l,r)for(ll i=(l);i>=(r);i--)
#define INF (1LL<<60)
#define MOD1 1000000007
#define MOD2 998244353
#define MAX_N (1 << 17)
#define YES printf("Yes\n")
#define NO printf("No\n")
#define PN printf("\n")
#define charsize 100005 //10^5+5

void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a= c;}
// void fill(ll n, ll a[n], ll value){ rep(i,0,n) a[i] = value; }
void cin(ll *n){ scanf("%lld",&(*n)); }
void cin2(ll *a, ll *b){ scanf("%lld%lld",&(*a),&(*b)); }
void cin3(ll *a, ll *b, ll *c){ scanf("%lld%lld%lld",&(*a),&(*b),&(*c)); }
ll max2(ll a,ll b){return a>=b?a:b;}
ll min2(ll a,ll b){return a>=b?b:a;}
ll min3(ll a, ll b, ll c){return (a<=b && a<=c) ? a : b<=c ? b : c;}
ll max3(ll a, ll b, ll c){return (a>=b && a>=c) ? a : b>=c ? b : c;}
ll minn(ll n, ll a[n]){ll b=INF;rep(i,0,n) b=min2(b,a[i]);return b;}
ll maxn(ll n, ll a[n]){ll b=-INF;rep(i,0,n) b=max2(b,a[i]);return b;}
ll ABS(ll a){return a>=0?a:(-a);}
ll POW(ll a, ll b){ll c=1;rep(i,0,b) c*=a;return c;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
ll mod_MOD1(ll n){n+= n<0?((-n)/MOD1+1)*MOD1:0; return n%=MOD1;}
ll mod_p(ll n ,ll p){n+= n<0?((-n)/p+1)*p:0; return n%=p;}
ll change_into_num(char s[] , ll len, ll p){ return !p ? 0 : POW(10,p-1)*(s[len-p]-'0') + change_into_num(s,len,p-1); }

int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}

typedef struct{ ll a , b;}fr;
int cmp1( const void *p, const void *q ) { return ((fr*)p) ->a - ((fr*)q)->a;}
int cmp2( const void *p, const void *q ) { return ((fr*)q) ->a - ((fr*)p)->a;}
void strsortup(fr*a,int n){qsort(a,n,sizeof(fr),cmp1);}
void strsortdown(fr*a,int n){qsort(a,n,sizeof(fr),cmp2);}

int main(void){
    // char ;
    ll n,w;
    // ll ans=0;
    cin(&n);
    cin(&w);
    // cin2(&,&);
    // cin3(&,&,&);
    ll we[n],v[n];
    rep(i,0,n){
        cin(&we[i]);
        cin(&v[i]);
    }
    ll dp[n][w+1];
    rep(i,0,n) rep(j,0,w+1) dp[i][j]=0;
    rep(i,we[0],w+1){
        dp[0][i]  =v[0];
    }
    rep(i,1,n){
        rep(j,0,we[i]) dp[i][j]=dp[i-1][j];
        rep(j,we[i],w+1){
            dp[i][j] = max2( dp[i-1][j] , dp[i-1][j-we[i]] + v[i] );
        }
    }

    
    printf("%lld\n",dp[n-1][w]);
    return 0;
}


Measured memory_bytes: 78336
/* Knapsack Again:

    Here, 1 ≤ N ≤ 100;
          1 ≤ W ≤ 10^5;
          1 ≤ w[i] ≤ W;
          1 ≤ v[i] ≤ 10^9;
*/
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
    int N,W;
    cin>>N>>W;
    int w[N];
    ll v[N];
    for(auto i=0;i<N;++i){
        cin>>w[i]>>v[i];
    }

    ll dp[W+1];
    memset(dp,0,sizeof(dp));

    for(auto i=0;i<N;++i){
        for(auto j=W;j>=w[i];--j){
            dp[j]=max(dp[j],dp[j-w[i]]+v[i]);
        }
    }
    ll ans=0;
    for(auto i=0;i<=W;++i){
        ans=max(ans,dp[i]);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define maxs(a, b) a = max(a, b)
#define mins(a, b) a = min(a, b)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll linf = (1ll << 61);
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, m;
	cin >> n >> m;
	map<int, int> mp;
	rep(i, n) {
		int a;
		cin >> a;
		mp[a]++;
	}
	priority_queue<P, vector<P>, greater<P>> pq;
	for (auto c : mp) {
		pq.emplace(c.first, c.second);
	}
	vector<P> p(m);
	rep(i, m) cin >> p[i].first >> p[i].second;
	sort(p.rbegin(), p.rend());
	rep(i, m) {
		int b = p[i].first, c = p[i].second;
		int bt = b;
		while (b && c > pq.top().first) {
			P p = pq.top(); pq.pop();
			if (p.second >= b) {
				if (p.second != b) pq.emplace(p.first, p.second - b);
				b = 0;
				break;
			}
			b -= p.second;
		}
		pq.emplace(c, bt - b);
	}
	ll ans = 0;
	while (pq.size()) ans += (ll)pq.top().first * pq.top().second, pq.pop();
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 9620
N,K=$<.read.split.map(&:to_i)
J = (N-1)*(N-2)/2

if K > J
    puts -1
    exit 0
end

es = (2..N).map {|i| [1,i]}
es += (2..N).to_a.combination(2).take(J-K).to_a

puts es.length
es.each do |e|
    puts e.join(' ')
end

Measured memory_bytes: 3836
#include<iostream>
using namespace std;
int main(){
	char ch,card[4][14]={false};
	int n,i,a,j,k;
	cin>>n;
	for(i=0;i<n;i++){
		cin>>ch>>a;
		if(ch=='S'){
			card[0][a]=true;
		}
		if(ch=='H'){
			card[1][a]=true;
		}
		if(ch=='C'){
			card[2][a]=true;
		}
		if(ch=='D'){
			card[3][a]=true;
		}
	}
	for(j=0;j<4;j++){
		for(k=1;k<14;k++){
			if(!card[j][k]){
				if(j==0){
					cout<<'S'<<" "<<k<<endl;
				}
				if(j==1){
					cout<<'H'<<" "<<k<<endl;
				}
				if(j==2){
					cout<<'C'<<" "<<k<<endl;
				}
				if(j==3){
					cout<<'D'<<" "<<k<<endl;
				}
			}
		}
	}
	return 0;
}



Measured memory_bytes: 3088
/*
─────────────────────
───────────████████──
──────────███▄███████
──────────███████████
──────────███████████
──────────██████─────
──────────█████████──
█───────███████──────
██────████████████───
███──██████████──█───
███████████████──────
███████████████──────
─█████████████───────
──███████████────────
────████████─────────
─────███──██─────────
─────██────█─────────
─────█─────█─────────
─────██────██────────
─────────────────────
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

#define int long long
#define read(a) int a; cin >> a;
#define readb(a, b) int a, b; cin >> a >> b;
#define readc(a, b, c) int a, b, c; cin >> a >> b >> c;
#define reads(s) string s; cin >> s;
#define readarr(a, n) int a[(n) + 1] = {}; fori (i, 1, (n)) {cin >> a[i];}
#define readmat(a, n, m) int a[n + 1][m + 1] = {}; fori (i, 1, n) {fori (j, 1, m) cin >> a[i][j];}

#define print(a) cout << a << endl;
#define printarr(a, n) fori (i, 1, n) cout << a[i] << " "; cout << endl;
#define printv(v) for (int i: v) cout << i << " "; cout << endl;
#define printmat(a, n, m) fori (i, 1, n) {fori (j, 1, m) cout << a[i][j] << " "; cout << endl;} cout << endl;
#define all(v) v.begin(), v.end()
#define sz(s) (int)(s.size())
#define pb push_back
#define fi first
#define se second
#define rz resize
#define fori(i, a, b) for (int i = (a); i <= (b); i++)
#define ford(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
#define setprec(x) cout << fixed << setprecision(x)
 
using namespace std;
using namespace __gnu_pbds; 
 
typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pair <int, int>> vpi;
typedef vector < vector <int> > vvi;
 
const int INF = 4e18;
const int mod = 1e9+7; 

     
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    //start from here

    reads(s);
    if(s == "ABC") cout << "ARC";
    else cout << "ABC";

    return 0;
}


Measured memory_bytes: 3640
//To debug :  g++ -g file.cpp -o code
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,a,n) for(i=a;i<n;++i)
#define irep(i,n,a) for(i=n;i>a;--i)
#define mod 1000000007
#define pb push_back
#define big 9223372036854775807;
#define big1 LONG_MAX
#define big2 INT_MAX
#define big3 1000000000
#define sma1 LONG_MIN
#define sma2 INT_MIN
#define sma3 -1000000000;
#define mp make_pair
#define mt make_tuple
#define dub double
#define ivec vector<int>
#define lvec vector<long long>
#define cvec vector<char>
#define svec vector<string>
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL);


ll mat[100][100000];
int v[100],wei[100];
int n;

ll fun(int i,int w)
{
				//cout<<"Here "<<i<<" "<<w<<" "<<n<<" "<<mat[i][w]<<"\n";

	if(mat[i][w]!=-1)
		return mat[i][w];
	else if(i==(n-1))
	{
		if(wei[i]>w)
		{
			mat[i][w] = 0;
			return mat[i][w];
		}
		else
		{
			mat[i][w] = v[i];
			return mat[i][w];
		}
	}

	if(wei[i]>w)
	{
		mat[i][w]=fun(i+1,w);
		return mat[i][w];
	}
	else
	{
		mat[i][w] =  max(fun(i+1,w-wei[i])+v[i],fun(i+1,w));
		return mat[i][w];
	}

}


int main()
{
	FAST

	int i,j;
	int w;

	cin>>n>>w;

	

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

	rep(i,0,n)
		rep(j,0,(w+1))
		{

			mat[i][j]=-1;

		}

	cout<<fun(0,w)<<"\n";


	return 0;

}

Measured memory_bytes: 78336
#include <stdio.h>
#include <string.h>
int main(void){
	char s[100001];
	scanf("%s",s);
	int slen = strlen(s);
	int i;
	for(i=0;i<slen;i++){
		if(i%2==0)printf("%c",s[i]);
	}
	return 0;
}

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

const int N = 5e5+6;
const int MOD = 1e9+7;
const int INF = 1e9+7;
const double eps = 1e-6;
const double Pi  = acos(-1.0);
inline int read() {
    int x=0,f=1;char c=getchar();
    for(; c<'0'||'9'<c; c=getchar())if(c=='-')f=-1;
    for(; '0'<=c&&c<='9'; c=getchar())x=(x<<3)+(x<<1)+c-'0';
    return x*f;
}

#define lal puts(" ***  ");
#define pii pair<int,int>
#define mp  make_pair
#define pb  push_back
#define x   first
#define y   second
#define y1   yy1

/********************************************/
int x1,x2,y1,y2,cnt,flag,n;
pii p,e[222222];
bool check(pii t){
    return x1<=t.x&&t.x<=x2&&y1<=t.y&&t.y<=y2;
}
int a[222222],b[222222];
int solve(){
    int mx = (cnt>0);
    for(int i=1;i<=cnt;i++)a[i]=e[i].y;
    for(int i=1;i<=cnt;i++)b[i]=INF;
    // for(int i=1;i<=cnt;i++)    printf("%d %d <-- \n",a[i],b[i]);
    
    b[1]=a[1];
    for(int i=2,tmp;i<=cnt;i++){
        tmp = lower_bound(b+1,b+cnt+1,a[i])-b;
        b[tmp]=a[i];
        mx = max(mx,tmp);
    }
    return mx;
}

int main(){flag = 0;
    scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
    if(x1>x2)swap(x1,x2),swap(y1,y2);
    if(y1>y2)flag=1,y1=-y1,y2=-y2;
    scanf("%d",&n);
    cnt = 0;
    for(int i=1;i<=n;i++){
        scanf("%d%d",&p.x,&p.y);
        if(flag) p.y=-p.y;
        if(check(p)) e[++cnt]=p;
    }
    if(x1==x2||y1==y2){
        double ans = 100.0*(x2-x1+y2-y1);
        if(cnt>0) ans-= 20.0-10.0*Pi;
        printf("%.20f\n",ans);
        return 0;
    }
    sort(e+1,e+cnt+1);
    int mx = solve();
    // printf("%d <--- \n",mx);
    double t = 20.0-5.0*Pi,t1=10.0*Pi-20;
    double ans = 100.0*(x2-x1+y2-y1)-t*mx;
    if(mx == min(x2-x1,y2-y1)+1) ans+= 5.0*Pi;
    printf("%.20f\n",ans);

    return 0;
}

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

// typedef
// -----------------------------------------------------------------------------
typedef long long ll;
typedef long double ld;

// container util
#define ALL(a)  (a).begin(),(a).end()
#define SZ(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

// repetition
// -----------------------------------------------------------------------------
#define FOR(i, a, b) for(int i= (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

// constant
// -----------------------------------------------------------------------------
const int INF = 1e9;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
const double PI = acos(-1.0);

// debug
// -----------------------------------------------------------------------------
#define DUMP(x)  cerr << #x << " = " << (x) << endl


int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);
    int N; cin >> N;
    vector<int> a(N);
    ld s = 0; 
    REP(i, N) {
        cin >> a[i];
        s += a[i];
    }
    ll m = round(s / SZ(a));
    ll ans = 0;
    REP(i, N) {
        ans += pow(a[i] - m, 2);
    }
    cout << ans << "\n";
}

Measured memory_bytes: 256
// Original macro is in https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = || -> String {
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
 
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
 
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
    
    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
 
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
 
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [$t:tt]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };
 
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
 
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
 
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

// for adhoc read (ex. https://atcoder.jp/contests/abc112/tasks/abc112_a)
#[allow(dead_code)]
fn read_line() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}
fn main() {
    input!{ n: usize, a: [i32;n] }
    let mut b = vec![0;n];

    for i in (1..n+1).rev() {
        let mut j = 2*i;
        let mut sum = 0;
        while j <= n {
            sum += b[j-1];
            j += i;
        }
        if a[i-1] != sum%2 {
            b[i-1] = 1;
        }
    }
    println!("{}", b.iter().filter(|x| **x == 1).count());
    for (i, v) in b.iter().enumerate() {
        if *v == 1 {
            if i > 0 {
                print!(" ");
            }
            println!("{}",i+1);
        }
    }
}

Measured memory_bytes: 7036
import sys
def v():
    N=int(sys.stdin.readline())
    A=list(map(int,sys.stdin.readline().split()))
    if A.count(0)>0:return 0
    else:
        A=list(filter(lambda x:x>1,A))
        x=1
        for a in A:
            x*=a
            if x>10**18:
                x=-1
                break
        return x
def main():print(v())
if __name__=='__main__':main()

Measured memory_bytes: 21572
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <cmath> 
#include <cctype>

typedef long long ll;
using namespace std;

int main() {
    ll X;
    cin >> X;
    int count_500 = X / 500;
    int count_5   = (X - 500 * count_500) / 5;
    ll total = 1000 * count_500 + 5 * count_5;
    cout << total << endl;
    
    return 0;
}

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

int main() {
	string str;
	cin >> str;

	for (int i = 0; i < str.length(); i++) {
		int index = str.rfind(str[i]);
		if (index != i) {
			cout << "no";
          return 0;
		}
	}
	cout << "yes";
	return 0;
}

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

typedef long long ll;

ll bit[66], MOD = 1e9 + 7;

int main(void)
{
	ll A, ans = 0, n, T, i;

    scanf("%lld" ,&n);
    for (T = 1; T <= n; T++)
	{
		scanf("%lld" ,&A);

		for (i = 0; i < 60; i++)
			bit[i] += (A >> i) & 1LL;
	}

    for (i = 0; i < 60; i++)
	{
		ll t = (1LL << i) % MOD;
		t = t * bit[i] % MOD;
		t = t * (n - bit[i]) % MOD;

		ans = (ans + t) % MOD;
    }
	printf("%lld" ,ans);
	return 0;
}

Measured memory_bytes: 128
mask = [[i for i in range(6)], (1, 5, 2, 3, 0, 4), (2, 1, 5, 0, 4,3),(3, 1, 0, 5, 4, 2), (4, 0, 2, 3, 5, 1)]
mask += [[mask[1][i] for i in mask[1]]]

def set_top(dice, top):
    return [dice[i] for i in mask[top]]

def twist(dice):
    return [dice[i] for i in (0, 3, 1, 4, 2, 5)]

def equal(dice1, dice2):
    for i in range(6):
        tmp_dice = set_top(dice2, i)
        for _ in range(4):
            if dice1 == tmp_dice:
                return True
            tmp_dice = twist(tmp_dice)
    return False

def diff_check_all(dices, n):
    for i in range(n -1):
        for j in range(i + 1, n):
            if equal(dices[i], dices[j]):
                return False
    return True
            

n = int(input())
dices = [input().split() for _ in range(n)]

print('Yes' if diff_check_all(dices, n) else 'No')

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


int main() {
string s;
cin>>s;
int p=s.size();
int x=p/2;
for(int i=0;i<x;i++)
	if(s[i]==s[p-i-1])
	
	cout<<"Yes";
	
	else
	cout<<"No";
	
	
	
	return 0;
}

Measured memory_bytes: 256
/* be name khoda */

// #define stream_enable
#define long_enable
#include <iostream>
#include <algorithm>
#include <cstring>
#include <numeric>
#include <iomanip>
#include <sstream>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;

#ifdef stream_enable
#define cin sss
#endif
#ifdef long_enable
typedef long long int ll;
#else
typedef int ll;
#endif

typedef pair<ll, ll> pii;
typedef pair<pii, ll> ppi;
typedef pair<ll, pii> pip;
typedef vector<ll> vi;
typedef vector<pii> vpii;

const ll MOD = 1000000007;
const long long BIG = 1446803456761533460;
const int Big = 336860180;

#define F first
#define S second
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()

#define debug(x) cout << #x << " -> " << (x) << endl
#define debug2(x, y) cout << #x << ' ' << #y << " -> " << (x) << ' ' << (y) << endl
#define debug3(x, y, z) cout << #x << ' ' << #y << ' ' << #z << " -> " << (x) << ' ' << (y) << ' ' << (z) << endl
#define debug4(x, y, z, t) cout << #x << ' ' << #y << ' ' << #z << ' ' << #t << " -> " << (x) << ' ' << (y) << ' ' << (z) << ' ' << (t) << endl
#define debugp(x) cout << #x << " -> " << "(" << (x).F << ", " << (x).S << ")" << endl
#define debuga(x, n) cout << #x << " -> "; fori (i1_da, n) { cout << (x)[i1_da] << ' '; } cout << endl
#define debugap(x, n) cout << #x << " ->\n"; fori (i1_dap, n) { cout << "(" << (x)[i1_dap].F << ", " << (x)[i1_dap].S << ")\n"; } cout << endl
#define debugaa(x, n, m) cout << #x << " ->\n"; fori (i1_daa, n) { fori (i2_daa, m) { cout << (x)[i1_daa][i2_daa] << ' '; } cout << '\n'; } cout << endl
#define debugav(x, n) cout << #x << " ->\n"; fori (i1_dav, n) { fori (i2_dav, (x)[i1_dav].size()) { cout << (x)[i1_dav][i2_dav] << ' '; } cout << '\n'; } cout << endl
#define debugia(x, n) cout << #x << " ->\n"; fori (i1_dia, n) { cout << i1_dia << " : " << (x)[i1_dia] << '\n'; } cout << endl

#define forifrom(i, s, n) for(ll i = (s); i < (n); ++i)
#define forirto(i, n, e) for(ll i = (n) - 1; i >= (e); --i)
#define fori(i, n) forifrom (i, 0, n)
#define forir(i, n) forirto (i, n, 0)

#define smin(a, b) a = min(a, (b))
#define smax(a, b) a = max(a, (b))

#define Add(a, b) a = (a + (b)) % MOD
#define Mul(a, b) a = (a * (b)) % MOD

stringstream sss;

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

const ll maxn = 2010;

ll n, x, A[maxn];
ll val[maxn][maxn];

void MAIN() {

    cin >> n >> x;
    fori (i, n) cin >> val[0][i];
    ll ans = BIG;
    fori (i, n) {
        ll s = 0;
        fori (j, n) {
            val[i + 1][j] = min(val[i][j], val[0][(j - i - 1 + n) % n]);
            s += val[i][j];
        }
        smin(ans, x * i + s);
    }
    cout << ans << '\n';

}

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

int main() {
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    cout << fixed << setprecision(10);
    sss << R"(
3 10
100 1 100
    )";
    MAIN();
    return 0;
}


Measured memory_bytes: 31744
#include <stdio.h>
#define M 10000
#define inf 1000000

typedef struct{
  int x,y,z;
} Node;

Node tree[500000];

int p,match=0,fin=1;
int g[M];

void SSSP(){
  int i;

  for(i=0;i<p;i++){
    g[i]=inf;
  }

  g[0]=0;

  while(fin!=0){
    fin=0;
    for(i=0;i<match;i++){
      if(g[tree[i].x]+tree[i].z < g[tree[i].y]){
	g[tree[i].y]=g[tree[i].x]+tree[i].z;
	fin=1;
      }
    }
  }

  for(i=0;i<p;i++){
    printf("%d %d\n",i,g[i]);
  }
}
      

int main(){
  int i,j,nu1,nu2,out,weight;

  scanf("%d",&p);

  for(i=0;i<p;i++){
    scanf("%d%d",&nu1,&out);
    for(j=0;j<out;j++){
      tree[match].x=nu1;
      scanf("%d%d",&nu2,&weight);
      tree[match].y=nu2;
      tree[match].z=weight;
      match++;
    }
  }
  
  SSSP();

  return 0;
}




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

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

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<vi> vvi;

int main(){
  int n, x;
  cin >> n >> x;
  vi l(n);
  for(int i=0; i<n; ++i) cin >> l[i];
  ll res = 1LL, pos = 0LL;
  //int flag = 0;
  for(int i=1; i<=n; ++i){
    pos = pos + l[i-1];
    if(x >= pos)
      ++res;
  //  flag = 1;
  }
  //if(flag && x >= pos) ++res;
  cout << res << "\n";
  return 0;
} 


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define INF 2000000000
typedef long long int ll;
typedef pair<ll,ll> ii;
typedef pair<ii,ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
#define getbit(n,i) (((n)&(1LL<<(i)))!=0)
#define setbit0(n,i) ((n)&(~(1LL<<(i))))
#define setbit1(n,i) ((n)|(1LL<<(i)))
#define lastone(n) ((n)&(-(n)))
#define read freopen("debug\\in.txt","r",stdin)
#define write freopen("debug\\out.txt","w",stdout)
#define DBG(a) cout<<#a<<" ->->->-> "<<a<<"\n"
#define EN cout<<"\n"
#define fi first
#define se second
#define PI (acos(-1))
#define fastread ios::sync_with_stdio(false);cin.tie(NULL)
#define mod (1000000007)
#define asz 200005
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<class T,class V> ostream& operator<<(ostream &s,pair<T,V> a)
{
    s<<a.fi<<' '<<a.se;
    return s;
}
int main()
{
    fastread;
    ll T=1;
//    cin>>T;
    for(ll qq=1;qq<=T; qq++)
    {
        ll n;
        cin>>n;
        vi a(n);
        for(auto &x:a)cin>>x;
        sort(a.begin(),a.end());
        ll mx=a.back();
        ll l=mx;
        bool ok=true;
        a.pop_back();
        while(!a.empty()&&ok){
            ll u=1;
            while(!a.empty()&&a.back()==l)u++,a.pop_back();
            if(u==1)ok=false;
            else if(u>2&&mx%2&&l==(mx+1)/2)ok=false;
            if(!a.empty()){
                u=a.back();
                a.pop_back();
                if(u!=l-1)ok=false;
                if(mx%2==0&&u==mx/2&&!a.empty())ok=false;
                if(u<(mx+1)/2)ok=false;
                if(a.empty()&&(mx%2||u!=mx/2))ok=false;
                l=u;
            }
            else{
                if(mx%2==0||(mx+1)/2!=l)ok=false;
            }
        }
        if(ok)cout<<"Possible"<<endl;
        else cout<<"Impossible"<<endl;
    }
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;
int main()
{  
    int n,m,a,t=0;
	cin>>n>>m;
	for(int i =0;i<m;i++){
		cin>>a;
		t += a; 
	}
	n = n-t;
	if(n<0){
		cout<<-1<<endl;
	}
	else{
		cout<<n<<endl;
	}
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define RFOR(i, begin, end) for(int i=(end)-1, i##_begin_=(begin);i>=i##_begin_;i--)
#define rep(i, N) FOR(i, 0, N)
#define rrep(i, N) RFOR(i, 0, N)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define sz(x) ((int)(x).size())
#define pb push_back
#define mp make_pair
using namespace std;
using ll = long long int;
using V = vector<ll>;
using P = pair<ll, ll>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
constexpr int mod = 1e9+7;
ll gcd(ll a, ll b) { return b? gcd(b, a%b) : a;}
ll lcm(ll a, ll b) { return a/gcd(a, b)*b;}

ll n;

int main() {
    cin >> n;
    ll sum = 0;
    FOR(i, 1, n) {
        sum += i;
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
  string S;
  cin>>S;
  for(int i=0;i<S.length()-1;i++){
      if(S[i]==S[i+1]){
          cout<<"Bad"<<endl;
          return 0;
      }
  }
  cout<<"Good"<<endl;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
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; }
const ll MOD = 1e9+7;

//string S[100100];
int main(){
    int N;
    cin >> N;

    map<ll, int> ma;
    REP(i,N){
        string S;
        cin >> S;
        priority_queue<ll> tmp;
        REP(k,10){
            char c = S[k];
            int n = c - 'a';
            tmp.push(n);
        }

        ll num = 0;
        REP(k,10){
            ll x = tmp.top(); 
            tmp.pop();
            num += (ll)pow(100, k) * x;
        }
        ma[num]++;

    }

    ll ans = 0;
    for(auto&& p : ma){
        ll cnt = p.second;
        ans += cnt * (cnt-1) / 2;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 6528
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<list>
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define ll long long

using namespace std;

int main() {
	string s, t, u;
	int a, b;
	cin >> s >> t >> a >> b >> u;
	if (u == s) {
		cout << a - 1 << " " << b << endl;
	}
	else {
		cout << a << " " << b - 1 << endl;
	}

	return 0;
}

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

struct StNode
{
  StNode* m_poParnt;
  StNode* m_poLeft;
  StNode* m_poRigt;
  int m_nKey;

  StNode(int nNo) :
    m_poParnt(nullptr), m_poLeft(nullptr), m_poRigt(nullptr), m_nKey(nNo)
  { }
};

void fnPreOrder(StNode* poNode)
{
  if (poNode == nullptr)  return;

  cout << " " << poNode->m_nKey;
  fnPreOrder(poNode->m_poLeft);
  fnPreOrder(poNode->m_poRigt);
}

void fnInOrder(StNode* poNode)
{
  if (poNode == nullptr)  return;

  fnInOrder(poNode->m_poLeft);
  cout << " " << poNode->m_nKey;
  fnInOrder(poNode->m_poRigt);
}

void fnInsert(StNode*& rpoRoot, StNode* poNewNod)
{
  StNode* poParnt = nullptr;
  StNode* poNode = rpoRoot;

  while (poNode != nullptr)
  {
    poParnt = poNode;
    if (poNewNod->m_nKey < poNode->m_nKey)
      poNode = poNode->m_poLeft;
    else
      poNode = poNode->m_poRigt;
  }

  poNewNod->m_poParnt = poParnt;
  if (poParnt == nullptr)
    rpoRoot = poNewNod;
  else if (poNewNod->m_nKey < poParnt->m_nKey)
    poParnt->m_poLeft = poNewNod;
  else
    poParnt->m_poRigt = poNewNod;
}

void fnBinSchTree(StNode*& rpoRoot)
{
  int nMaxSiz;
  cin >> nMaxSiz;

  for (int i = 0; i < nMaxSiz; ++i)
  {
    string sCmd;
    cin >> sCmd;
    if (sCmd[0] == 'i')
    {
      int nNo;
      cin >> nNo;
      StNode* poNewNod = new StNode(nNo);
      fnInsert(rpoRoot, poNewNod);
    }
    if (sCmd[0] == 'p')
    {
      fnInOrder(rpoRoot);
      cout << endl;
      fnPreOrder(rpoRoot);
      cout << endl;
    }
  }
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  StNode* poRoot = nullptr;

  fnBinSchTree(poRoot);
}

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

int main() {
  int n;
  cin >> n;
  vector<vector<int>> dst(n + 1);
  for (int i = 1; i <= n; i++) {
    int u, k;
    cin >> u >> k;
    for (int j = 0; j < k; j++) {
      int v;
      cin >> v;
      dst[i].push_back(v);
    }
  }
  queue<int> Q;
  vector<int> ans(n + 1, -1);
  ans[1] = 0;
  Q.push(1);
  while (Q.size()) {
    int p = Q.front();
    for (int d : dst[p]) {
      if (ans[d] == -1) {
        ans[d] = ans[p] + 1;
        Q.push(d);
      }
    }
    Q.pop();
  }
  for (int i = 1; i <= n; i++) {
    cout << i << ' ' << ans[i] << endl;
  }
}



Measured memory_bytes: 3176
N = int(input())
wordl = {}
ans = 0

for i in range(N):
    w = input()
    wl = []
    for j in range(10):
        wl.append(w[j])
    wl.sort()
    w2 = ' '
    for p in range(10):
        w2 += wl[p]
    if w2 in wordl:
        ans += wordl[w2]
        wordl[w2] += 1
    else:
        wordl[w2] = 1

print(ans)

'''
#アルゴリズムはあってるがLTE
N = int(input())
wordl = []

for i in range(N):
    w = input()
    wl = []
    for j in range(10):
        wl.append(w[j])
    wl.sort()
    w2 = ' '
    for p in range(10):
        w2 += wl[p]
    wordl.append(w2)
wordl.sort()
#print(wordl)

ans = 0
for k in range(N):
    for q in range(k+1,N):
        if wordl[k] == wordl[q]:
            ans += 1
        else:
            break

print(ans)
'''

Measured memory_bytes: 17892
#include <bits/stdc++.h>
#include <algorithm>
#include <map>
#include <cstdlib>
#include <cmath>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;

int main(){
    int n;
    cin >> n;
    ll ans=0;
    for(int i=1;i<=n;i++){
        if( !(i%3==0 || i%5==0) ){
            ans+=i;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3636
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <functional>
#include <map>
#include <queue>
    
#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)

using namespace std;
using ll = long long;
using P = pair<int, int>;
using TP = tuple<ll, ll, ll>;
ll MOD = 1e9+7;
const int INF = 1000*1000*1000;
const ll LINF = (ll)1e18;
int xv[4] = {-1, 1, 0, 0};
int yv[4] = {0, 0, -1, 1};

vector<bool> mlist;
ll calc(int b){
    
    ll bb = b;
    for(int i = 0; i < mlist.size(); i++){
        bb *= bb;
        bb %= MOD;
        if(mlist[mlist.size()-i-1]){
            bb *= b;
            bb %= MOD;
        }
    }
    return bb;
}


void initcalc(){
    ll mod = MOD - 2;
    while(mod/2){
        mlist.push_back(mod%2);
        mod/=2;
    }
}


ll cmb(ll a, ll b){
    if(a<b){
        swap(a,b);
    }
    ll ans = 1;
    ll len = min(b, a-b);
    b = len;
    for(int i = 0; i < len; i++){
        ans *= a;
        ans %= MOD;
        ans *= calc(i+1);
        ans %= MOD;
        a--;
    }
    
    ans %= MOD;
    
    return ans;
}

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

    ll N, M;
    cin >> N >> M;
    vector<ll> a(2,0);
    ll L = M;
    ll mi = 2;
    ll cnt = 0;
    for(ll i = 2; i <= M; i++){
        a.push_back(0);
        while(L % i == 0){
            a[i]++;
            L /= i;
            mi = i;
            cnt++;
        }
        if(L == 1){
            break;
        }
    }
    ll ans = 1;
    for(ll i = 2; i <= mi; i++){
        if(a[i] >= 1){
            ans *= cmb(N-1+a[i], N-1);
            ans %= MOD;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 526548
#include <iostream>

using namespace std;

int main()
{
    char original[26] = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'};
    char caesar[26] = {'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'A', 'B', 'C'};
    
    char c;
    
    while (cin >> c) {
        for(int i = 0; i < 26; i++) {
            if(caesar[i] == c) {
                cout << original[i];
            }
        }
    }
    cout << endl;
    
}



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

int main(){
int Q; cin >> Q;
for(int i=0; i<Q; i++){
    ll A, B; cin >> A >> B ;
    ll C=min(A,B); ll D=max(A,B);
    ll ans=0;
    ll E = floor(sqrt( (long double)C*D ) );
    if(C==D) ans=2*(C-1);
    else if(E*E==C*D) ans = 2*(E-1)-1;
    else{
        if(E*(E+1) <C*D ){
            ans = 2*E-1;
        }
        else{
            ans = 2*E-2;
        }
    }
    cout << ans << endl;
}
}

Measured memory_bytes: 256