akhauriyash/Code-Regression huggingface dataset:
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
template<typename T> bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<typename T> bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef tuple<ll,ll,ll> tlll;
typedef tuple<int,int,int> tiii;
const ll mod=1e9+7;
const int inf=1<<30;

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

ll rui(ll a,ll n){
  ll ans=1;
  while(n>0){
    if(n&1) ans=ans*a%mod;
    a=a*a%mod;
    n/=2;
  }
  return ans;
}

int main(){
  ll n; cin >> n;
  vector<ll> a(n);
  vector<ll> b(n);
  rep(i,n) cin >> a[i] >> b[i];
  map<pii,ll> mp1;
  map<pii,ll> mp2;
  ll N=n;
  ll z=0;
  ll ans=1;
  rep(i,N){
    ll x,y;
    if(a[i]!=0&&b[i]!=0){
      x=a[i]/gcd(a[i],b[i]);
      y=b[i]/gcd(a[i],b[i]);
    }
    else if(a[i]==0&&b[i]==0){
      z++;
      n--;
      continue;
    }
    else if(a[i]==0){
      x=0,y=1;
    }
    else{
      x=1,y=0;
    }
    mp1[pii(x,y)]++;
    if(x!=0) mp2[pii(-y/gcd(y,x),x/gcd(y,x))]++;
    else mp2[pii(1,0)]++;
  }
  for(auto c:mp1){
    if(c.second==0||mp2[c.first]==0) continue;
    ll x=c.first.first;
    ll y=c.first.second;
    ans=ans*(rui(2,c.second)+rui(2,mp2[c.first])-1)%mod;
    n-=c.second+mp2[c.first];
    c.second=0;
    if(x!=0) mp1[pii(-y/gcd(y,x),x/gcd(y,x))]=0;
    else mp1[pii(1,0)]=0;
  }
  ans=(ans*rui(2,n)-1)%mod;
  ans=(ans+z)%mod;
  if(ans<0) ans+=mod;
  cout << ans << endl;
}

Measured memory_bytes: 43856
#include<iostream>
using namespace std;
int main(){
    int h,w,f,l;
    cin>>h>>w;
    char a[h][w+1];
    for(int i = 0; i < h; i++)cin>>a[i];

    for(int i = 0; i < h-1; f=0,l=0,i++)
    {
        for(int j = 0; j <w; j++)if(a[i+1][j]=='#'){f=j;break;}
        for(int j = w-1; j >=0; j--)if(a[i][j]=='#'){l=j;break;}
        if(f<l){cout<<"Impossible"<<endl;return 0;}
    }
    cout<<"Possible"<<endl;
    return 0;
}

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

class edge{
public:
  int s,t;
  D cost;
  edge(int a,int b,D c):s(a),t(b),cost(c){}
  bool operator<(const edge &e)const{return cost<e.cost;}
};

class UF{
  vi p,r;

public:
  UF(int n):p(n,-1),r(n,0){ }

  int find(int x){ return (p[x]<0)?x:(p[x] = find(p[x])); }

  void unite(int x,int y){
    x = find(x); y = find(y);
    if(x==y)return;

    if(r[x] < r[y])p[x] = y;
    else p[y] = x;
    if(r[x] == r[y])r[x]++;
  }

  bool same(int x,int y){return find(x)==find(y);}
};

inline D dis(D x1, D y1, D x2, D y2){
  return sqrt( (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2) );
}

int main(){
  int n,m;
  cin >> n >> m;
  
  vector<D> x(n),y(n);
  for(int i=0;i<n;i++)cin >> x[i] >> y[i];

  vector<edge> e;
  for(int i=0;i<m;i++){
    int a,b;
    cin >> a >> b; a--; b--;
    e.push_back(edge(a,b,dis(x[a],y[a],x[b],y[b])));
  }

  sort(e.begin(), e.end());
  reverse(e.begin(), e.end());
  
  UF uf(n);
  D ans = 0;
  rep(i,m){
    if(uf.same(e[i].s,e[i].t))ans += e[i].cost;
    else uf.unite(e[i].s,e[i].t);
  }
  cout << fixed << setprecision(9) << ans << endl;
}

Measured memory_bytes: 1976
using System;
using System.Text;

namespace ALDS1_8_B {
    class Node {
        public int Key { get; set; }
        public Node Parent { get; set; }
        public Node Left { get; set; }
        public Node Right { get; set; }

        public Node(int key = default(int), Node parent = null) {
            Key = key;
            Parent = parent;
        }

        public Node(Node node) {
            this.Key = node.Key;
            this.Parent = node.Parent;
            this.Left = node.Left;
            this.Right = node.Right;
        }
    }

    class Problem {
        private Node _root;
        private StringBuilder _sb;

        public void Run() {
            _sb = new StringBuilder();
            int n = int.Parse(Console.ReadLine());
            for (int i = 0; i < n; i++) {
                string[] input = Console.ReadLine().Split(' ');

                switch (input[0]) {
                    case "insert":
                        Insert(int.Parse(input[1]));
                        break;
                    case "print":
                        Inorder(_root);
                        _sb.AppendLine();
                        Preorder(_root);
                        _sb.AppendLine();
                        break;
                    case "find":
                        _sb.AppendLine(Find(int.Parse(input[1])) != null ? "yes" : "no");
                        break;
                }
            }
            Console.Write(_sb);
        }

        private Node Find(int key) {
            Node ret = new Node(_root);
            while (ret != null && key != ret.Key) {
                ret = key < ret.Key ? ret.Left : ret.Right;
            }
            return ret;
        }
        
        private void Insert(int key) {
            if (_root == null) {
                _root = new Node(key);
                return;
            }

            Node x = _root;
            Node y = null;
            while (x != null) {
                y = x;
                x = key < x.Key ? x.Left : x.Right;
            }

            if (key < y.Key)
                y.Left = new Node(key, parent: y);
            else
                y.Right = new Node(key, parent: y);
        }

        private void Inorder(Node node) {
            if (node == null)
                return;
            Inorder(node.Left);
            _sb.Append(" " + node.Key);
            Inorder(node.Right);
        }

        private void Preorder(Node node) {
            if (node == null)
                return;
            _sb.Append(" " + node.Key);
            Preorder(node.Left);
            Preorder(node.Right);
        }
    }

    class Program {
        static void Main(string[] args) {
            Problem p = new Problem();
            p.Run();
        }
    }
}

Measured memory_bytes: 78616
#include<iostream>
#include<set>
#include<string>
using namespace std;

string strrev(string in){
	string out;
	out.resize(in.size());
	string::iterator fi=out.begin();
	for(string::const_reverse_iterator ri=in.rbegin();ri!=in.rend();++ri){
		(*fi)=(*ri);
		++fi;
	}
	return out;
}

int main(){
	int m;
	cin>>m;
	for(int i=0;i<m;i++){
		string in;
		set<string> res;
		cin>>in;
		for(int j=1;j<in.size();j++){
			string first,second;
			first=in.substr(0,j);
			second=in.substr(j);
			res.insert(first+second);
			res.insert(first+strrev(second));
			res.insert(second+first);
			res.insert(second+strrev(first));
			res.insert(strrev(first)+second);
			res.insert(strrev(first)+strrev(second));
			res.insert(strrev(second)+first);
			res.insert(strrev(second)+strrev(first));
		}
		cout<<res.size()<<endl;
	}
	return 0;
}

Measured memory_bytes: 1308
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (1e+18) + 7;
typedef pair<int, int>P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-6;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

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

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 20;
modint fact[max_n], factinv[max_n];
void init() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}

int pena[1 << 17];
bool aced[1 << 17];
void solve() {
	int n, m; cin >> n >> m;
	rep(i, m) {
		int p; string s;
		cin >> p >> s; p--;
		if (aced[p])continue;
		else {
			if (s == "AC") {
				aced[p] = true;
			}
			else {
				pena[p]++;
			}
		}
	}
	int ans = 0;
	int ans2 = 0;
	rep(i, n) {
		if (aced[i]) {
			ans++; ans2 += pena[i];
		}
	}
	cout << ans << " " << ans2 << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(7);
	//init();
	//int t; cin >> t; rep(i, t)solve();
	solve();
	//stop
		return 0;
}


Measured memory_bytes: 17152
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  string s;
  cin >> s;
  int n = sz(s);
  int isKaibun = 1;
  rep(i,n){
    isKaibun&=(s[i] == s[n-1-i]);
  }
  for(int i = 0;i<(n-1)/2;i++){
    isKaibun&=(s[i] == s[(n-1)/2-1-i]);
  }
  for(int i = (n+3)/2;i<n;i++){
    isKaibun&=(s[i] == s[n-1-i]);
  }
  if(isKaibun){
    cout<<"Yes"<<endl;
  }else cout<<"No"<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define maxn 55
long long d[maxn], c[maxn][maxn];

void init(int n) {
    c[1][0] = c[1][1] = 1;
    for (int i = 2; i <= n; i++) {
        for (int j = 0; j <= i; j++) {
            c[i][j] = c[i - 1][j] + c[i - 1][j - 1];
        }
    }
}

int main()
{
    int n, a, b;

    scanf("%d%d%d", &n, &a, &b);
    for (int i = 0; i < n; i++) {
        scanf("%lld", &d[i]);
    }
    init(n);
    sort(d, d + n);
    long long sum = 0;
    for (int i = n - a; i < n; i++) {
        sum += d[i];
    }
    printf("%lf\n", 1.0 * sum / a);
    long long x = d[n - a];
    int s = 0;
    int p, q;
    for (int i = n - a; i >= 0; i--) {
        if (d[i] == x) {
            p = i;
        } else {
            break;
        }
    }
    for (int i = n - a; i < n; i++) {
        if (d[i] == x) {
            q = i;
        } else {
            break;
        }
    }
    if (d[n - 1] != x) {
        printf("%lld\n", c[q - p + 1][q - (n - a) + 1]);
        return 0;
    }
    long long ans = 0;
    for (int i = q - (n - a) + 1; i <= q - p + 1 && i <= q - (n - b) + 1; i++) {
        ans += c[q - p + 1][i];
    }
    printf("%lld\n", ans);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
//#define int long long;
int main(){
  int n;
  cin>>n;
  int nx=0,ny=0,nt=0,f=0;
  for(int i=0;i<n;i++){
    int x,y,t;
    cin>>t>>x>>y;
    int s=abs(x-nx)+abs(y-ny);
    if(!(s<=t-nt&&s%2==(t-nt)%2))f=1;
    ny=y,nx=x,nt=t;
  }
  if(f)cout<<"No"<<endl;
  else cout<<"Yes"<<endl;
  return 0;
}

Measured memory_bytes: 256
input_list = [int(x) for x in input().split()]
A, B = input_list[0], input_list[1]
counter = 0

for i in range(A, B+1):
	temp_str = str(i)
	if temp_str[0] == temp_str[4] and temp_str[1] == temp_str[3]:
		counter += 1

print(counter)


Measured memory_bytes: 2940
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	n := nextInt(sc)
	m := nextInt(sc)

	mat := make([][]int64, n)
	for i := int64(0); i < n; i++ {
		mat[i] = make([]int64, m)
		for j := int64(0); j < m; j++ {
			mat[i][j] = nextInt(sc)
		}
	}

	vct := make([]int64, m)
	for i := int64(0); i < m; i++ {
		vct[i] = nextInt(sc)
	}

	for i := int64(0); i < n; i++ {
		var x int64
		for j := int64(0); j < m; j++ {
			x += mat[i][j] * vct[j]
		}
		fmt.Println(x)
	}
}

func nextString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

func nextInt(sc *bufio.Scanner) int64 {
	i, err := strconv.ParseInt(nextString(sc), 10, 64)
	if err != nil {
		panic(err)
	}
	return i
}



Measured memory_bytes: 1208
#include <iostream>
#include <string>
using namespace std;
int main(){
     string s;
    string a = "ACGT";
    cin >> s;
    int ans = 0;
    int tem = 0;
    bool flag = true;
    for(int i = 0;i<s.size();i++){
        for(int j = 0;j<4;j++){
            if(s[i] == a[j]){
                tem++;
                flag = false;
                break;
            }
        }
        if(flag){
            ans = max(ans,tem);
            tem = 0;
        }
        else{
            flag = true;
        }
    }
    ans = max(ans,tem);
    cout << ans << endl;
}

Measured memory_bytes: 256
import math
from math import gcd,pi,sqrt
INF = float("inf")

import sys
sys.setrecursionlimit(10**6)
import itertools
from collections import Counter,deque
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]

def main():
    n = i_input()
    s = s_input()
    ans = 0
    for i in range(n):
        l = set(s[:i])
        r = set(s[i:])
        trial = 0
        for k in l:
            if k in r:
                trial += 1
        ans = max(ans,trial)
    print(ans)



if __name__=="__main__":
    main()


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

using namespace std;

const int mx = (int)1e6+7;
int main()
{
	int n; cin >> n;
	int arr[n];
	map<int,int> mul;
	int val = -1;
	for(int i = 0; i < n; i++){cin >> arr[i]; mul[arr[i]]++; val = max(val, arr[i]);}
	sort(arr, arr+n);
	int ans = 0;
	map<int, int> m;
	for(int i = 0; i < n-1; i++){
		if(m[arr[i]]) continue;
		if(mul[arr[i]] == 1) ans++;
		if(arr[i] != arr[i+1]){
			for(int j = 2*arr[i]; j < mx && j <= val; j += arr[i]){
				m[j] = 1;
			}
		}
	}
	if(!m[arr[n-1]] && mul[arr[n-1]] == 1) ans++;
	cout << ans;
}


Measured memory_bytes: 58160
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
const int INF = 1001001001;
const int MOD = 1000000007;
typedef long long ll;

template<typename T> void print(const T & v);


int main() {
    int N;
    cin >> N;
    if(N == 1){
        cout << "Hello World" << endl;
        return 0;
    }else{
        int a, b;
        cin >> a >> b;
        cout << a + b << endl;
        return 0;
    }
}


// Use For Debug
template <typename T>
void print(T const & v){
    for(int i = 0; i < v.size(); i++){
        if(i) cout << " ";
        cout << v[i];
    }
    cout << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

#define NODE_MAX (25)
#define DEPTH_MAX (25)
#define HIGHT_MAX (25)
#define NIL (-1)


struct node {
        int parent;
        int left;
        int right;
};

struct node T[NODE_MAX];
int D[DEPTH_MAX];
int H[HIGHT_MAX];


int
get_depth(int id)
{
        int depth = 0;

        while (T[id].parent != NIL) {
                id = T[id].parent;
                depth++;
        }

        return depth;
}

int
get_height(int id)
{
        int height = NIL;
        int h_r = 0;
        int h_l = 0;
        int i = 0;

        if (T[id].right != NIL)
                h_r = get_height(T[id].right) + 1;
        if (T[id].left != NIL)
                h_l = get_height(T[id].left) + 1;
        if (T[id].left == NIL && T[id].right == NIL)
                height = 0;

        if (height != 0 && h_r <= h_l)
                height = h_l;
        else if (height != 0 && h_l < h_r)
                height = h_r;

        return height;
}

void
print_sibling(int id)
{
        int sibling = NIL;
        int parent;
        int i;

        parent = T[id].parent;
        if (parent == NIL)
                sibling = NIL;
        else if (T[parent].left == id)
                sibling = T[parent].right;
        else if (T[parent].right == id)
                sibling = T[parent].left;

        printf("sibling = %d, ", sibling);
}

void
print_degree(int id)
{
        int degree;

        if (T[id].left == NIL && T[id].right == NIL)
                degree = 0;
        else if (T[id].left != NIL && T[id].right != NIL)
                degree = 2;
        else
                degree = 1;

        printf("degree = %d, ", degree);
}


void
print(int id)
{
        printf("node %d: parent = %d, ", id, T[id].parent);

        print_sibling(id);
        print_degree(id);

        printf("depth = %d, height = %d, ", D[id], H[id]);


        if (T[id].parent == NIL)
                printf("root\n");
        else if (T[id].left == NIL && T[id].right == NIL)
                printf("leaf\n");
        else
                printf("internal node\n");

}

int
main(void)
{
        int node_num;
        int id;
        int id_left;
        int i, j;
        int read_array[3];

        scanf("%d", &node_num);

        for (i = 0; i < node_num; i++)
                T[i].parent = T[i].left = T[i].right = NIL;

        for (i = 0; i < node_num; i++) {
                for (j = 0; j < 3; j++) {
                        scanf("%d", &read_array[j]);
                        id = read_array[0];
                        if (j)
                                T[read_array[j]].parent = id;
                }

                T[id].left = read_array[1];
                T[id].right = read_array[2];
        }

        for (i = 0; i < node_num; i++) {
                D[i] = get_depth(i);
                H[i] = get_height(i);
        }

        for (i = 0; i < node_num; i++)
                print(i);

        return 0;
}



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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define PB push_back
#define MP make_pair
#define endl "\n"
#define sd(val) scanf("%d", &val)
#define ss(val) scanf("%s", &val)
#define sl(val) scanf("%lld", &val)

int main()
{
  string s;
  string t;
  cin >> s >> t;
  int count = 0;
  for (int i = 0; i < s.size(); i++)
  {
    if (s[i] != t[i])
      count++;
  }
  cout << count;
  return 0;
}

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

const int MAX_N = 1e5+12;
int N, T;
ll A[MAX_N];

void solve()
{
	set<ll> prices;
	ll mx = 0, mc = -1;
	for(int i=0;i<N;++i){
		auto it = prices.begin();
		if(it != prices.end() && *it < A[i]){
			if(mx < (A[i]-(*it))){
				mx = A[i]-(*it);
				mc=1;
			}else if(mx == (A[i]-(*it))){
				mc++;
			}
		}
		prices.insert(A[i]);
	}
	cout << mc << '\n';
}

int main()
{
	cin >> N >> T;
	for(int i=0; i<N; ++i) cin >> A[i];
	solve();
	return 0;
}

Measured memory_bytes: 9072
class InputLine
  def self.to_s
    gets.chomp
  end

  def self.to_i
    InputLine.to_s.to_i
  end
  
  def self.to_f
    InputLine.to_s.to_f
  end

  def self.to_sa
    InputLine.to_s.split(' ')
  end

  def self.to_ia
    InputLine.to_sa.map(&:to_i)
  end
  
  def self.to_fa
    InputLine.to_sa.map(&:to_f)
  end
end

A = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

def main(argv)
  k = InputLine.to_i

  puts A[k - 1].to_s
end

if self.to_s == 'main' then
  main(ARGV)
end

Measured memory_bytes: 1788
#include "bits/stdc++.h"
using namespace std;
#define forn(i, x, n) for (int i = x; i < n; i++)
#define all(a) (a).begin(), (a).end()
#define pii pair<int, int>
#define pll pair<ll, ll>
typedef long double ld;
typedef long long ll;

void gen() {exit(0);}
int main() {
    #ifdef DEBUG
    freopen("input", "r", stdin);
//    freopen("output", "w", stdout);
//    gen();
    #endif
    int n;
    scanf("%d", &n);
    int ans = 0;
    forn(i, 0, n) {
        int x;
        scanf(" %d", &x);
        while (!(x & 1)) {
            x = x >> 1;
            ans ++;
        }
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
const int MN = 100200;
const int LOG = 19;
ll v[MN];
ll p[MN];
ll dp[LOG][MN];
int main() {
	ll n,l;
	scanf("%lld",&n);
	for(int i=0;i<n;i++) {
		scanf("%lld",&v[i]);
	}
	scanf("%lld",&l);
	for(int i=0;i<n-1;i++) {
		p[i] = upper_bound(v,v+n,v[i]+l)-v-1;
		dp[0][i] = p[i];
	}
	dp[0][n-1] = n-1;
	for(int i=1;i<LOG;i++) {
		for(int j=0;j<n;j++) {
			dp[i][j] = dp[i-1][dp[i-1][j]];
		}
	}
	ll q;
	scanf("%lld",&q);
	while(q--) {
		int a,b;
		scanf("%d %d",&a,&b);a--;b--;
		if(a > b) {swap(a,b);}
		ll tot = 0;
		for(int i=LOG-1;i>=0;i--) {
			if(dp[i][a] < b) {
				a = dp[i][a];
				tot += 1<<i;
			}
		}
		tot++;
		printf("%lld\n",tot);
	}
}

Measured memory_bytes: 17280
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll MOD = 1'000'000'007;
const ld PI = acos(-1);  
const ld EPS = 0.0000000001;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define rep(i, n) for(ll i=0; i<(ll)(n); i++)
#define repd(i, n) for(ll i=n-1; 0<=i; i--)
#define FOR(i, a, b) for(ll i=a; i<(ll)(b); i++)
#define FORD(i, a, b) for(ll i=a-1; (ll)(b)<=i; i--)
#define ALL(x) x.begin(), x.end()
#define rALL(x) x.rbegin(), x.rend()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

vector<vector<char>> g;
int main(){
    string s;   cin >> s;
    ll pc=0;
    rep(i, s.size()){
        pc += s[i]=='p';
    }
    ll res = (s.size()-2*pc)/2;
    cout << res << endl;
}


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

int main() {
    int N, M, K;
    cin >> N >> M >> K;

    for (int i = 0; i <= N; ++i)
        for (int j = 0; j <= M; ++j) {
            int black = i * M + j * N - 2 * i * j;
            if (black == K) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    cout << "No" << endl;
}

Measured memory_bytes: 3640
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

using namespace std;

int main() {
	string s, t;
	cin >> s >> t;
	if (s[0] == t[0]) {
		cout << "=" << endl;
	} else if (s[0] > t[0]) {
		cout << ">" << endl;
	} else {
		cout << "<" << endl;
	}
	return 0;
}



Measured memory_bytes: 256
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"

using namespace std;

const long long int MOD = 1000000007;

long long int N, M, K, H, W, L, R;

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

	cin >> N >> M >> K;
	long long int a, b, c;
	cin >> a >> b >> c;
	cin >> R;
	vector<long long int>v(M);
	for (auto &i : v)cin >> i;
	int ans = 0;
	if ((N - 1)*b <= R)ans++;
	vector<vector<int>>dp(M, vector<int>(K - M + 1));
	for (int i = 0; i < M - 1; i++) {
		long long int r = v[i] - 1;
		long long int t = R - (v[i] - 1)*b;
	//	cout << "t " << t << endl;
		if (t >= 0) {
			r = max(r, v[i] + t / a);
			r = min(r, v[i + 1] - 1);
		}
		ans += max((long long int)0,r - v[i] + 1);
	//	cout << i << " " << ans << endl;
		long long int rbox = r;
		for (int j = 0; j <= K - M; j++)dp[i + 1][j] = dp[i][j];
		for (int j = 1; j <= K - M; j++) {
			t = R - (v[i] - 1)*b - ((rbox + 1) - v[i])*c;
		//	cout << "t " << t << endl;
			if (t >= 0) {
				rbox = max(rbox, rbox + 1 + t / a);
				rbox = min(rbox, v[i + 1] - 1);
				//	cout << i << " " << j << " " << rbox << endl;
				for (int k = K - M; k >= j; k--) {
					dp[i + 1][k] = max(dp[i + 1][k], dp[i][k - j] + (int)(rbox - r));
				}
			}
		}
	}
//	for (int i = 0; i < M; i++) {
//		for (int j = 0; j <= K - M; j++) {
//			cout << i << " " << j << " " << dp[i][j] << endl;
//		}
//	}
	ans--;
//	cout << ans << endl;
	cout << dp.back().back() + ans << endl;
	return 0;
} 


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

const int N = (int) 2e5;
vector<pair<int, int> > graph[N];
long long sgn[N], delta[N], lab[N];
long long vmin[N], vmax[N];
bool visited[N];

int get(int u) {
    return lab[u] < 0 ? u : lab[u] = get(lab[u]);
}

void join(int u, int v) {
    u = get(u); v = get(v);
    if (u == v) return;
    if (lab[u] < lab[v]) swap(u, v);
    lab[v] += lab[u];
    lab[u] = v;
}

void impossible() {
    cout << "No" << endl;
    exit(0);
}

void dfs(int u) {
    visited[u] = true;
    if (sgn[u] < 0) vmax[get(u)] = min(vmax[get(u)], delta[u]);
    else vmin[get(u)] = max(vmin[get(u)], -delta[u]);
    for (auto e : graph[u]) {
        int v = e.first, w = e.second;
        if (!visited[v]) {
            sgn[v] = -sgn[u];
            delta[v] = w - delta[u];
            dfs(v);
        } else {
            int ssgn = sgn[u] + sgn[v];
            long long sdelta = delta[u] + delta[v]; // ssgn * x + sdelta == w
            if (ssgn == 0) {
                if (sdelta != w) impossible();
            } else {
                if ((w - sdelta) % ssgn == 0) {
                    long long x = (w - sdelta) / ssgn;
                    vmin[get(u)] = max(vmin[get(u)], x);
                    vmax[get(u)] = min(vmax[get(u)], x);
                } else {
                    impossible();
                }
            }
        }
    }
}

int main() {
    ios::sync_with_stdio(false);
    int r, c; cin >> r >> c;
    int n; cin >> n;
    memset(lab, -1, sizeof lab);
    for (int i = 0; i < n; ++i) {
        int u, v, w; cin >> u >> v >> w; --u; --v;
        graph[u].push_back(make_pair(r + v, w));
        graph[r + v].push_back(make_pair(u, w));
        join(u, r + v);
    }
    for (int i = 0; i < r + c; ++i) if (get(i) == i) {
        vmin[i] = 0; vmax[i] = 1e18; sgn[i] = 1;
        dfs(i);
        if (vmin[i] > vmax[i]) impossible();
    }
    cout << "Yes" << endl;
    return 0;
}


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


int main() {
  int N,M;
  cin>>N>>M;
  vector<int> vec(N+2);
  
  for(int i=0;i<M;i++){
    int L,R;
    cin>>L>>R;
    vec.at(L)++;
    vec.at(R+1)--;
  }
  vector<int> rui(N+2);
  for(int i=1;i<=N+1;i++){
    rui.at(i)=rui.at(i-1)+vec.at(i);
  }
  int sum=0;
  for(int i=1;i<=N;i++){
    if(rui.at(i)==M) sum++;
  }
  cout<<sum<<endl;
    
  
  
}

Measured memory_bytes: 3956
#include <bits/stdc++.h>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define repreverse(i, start, end) for (long long i = start; i >= end; --i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define inrange(a, x, b) (a <= x && x <= b)
#define len(x) ((long long)(x).size())
#define lcm(a, b) ((a) / __gcd((a), (b)) * (b))
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vllvll = vector<vll>;
using vc = vector<char>;
using pll = pair<ll, ll>;
template<class T> void print(T x,bool cl=1){cout<<(cl?"\x1b[36m":"")<<x<<(cl?"\x1b[39m":"")<<'\n';}
template<class T> void print1d(T x,ll n=-1,bool cl=true){if(n==-1)n=x.size();rep(i,0,n){cout<<(cl?"\x1b[36m":"")<<x[i]<<(i==n-1?'\n':' ');}cout<<(cl?"\x1b[39m":"");}
template<class T> void print2d(T x,ll r=-1,ll c=-1,bool cl=1){if(r==-1)r=x.size();if(c==-1)c=x[0].size();rep(i,0,r)print1d(x[i],c,cl);}
template<class T, class U> bool haskey(T mp, U key) { return mp.find(key) != mp.end(); }
template<class T, class U> bool isin(T el, U container) { return find(all(container), el) != container.end(); }
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; }
template<class T> bool even(T n) { return ! (n & 1); }
template<class T> bool odd(T n) { return n & 1; }
template<class T> ll rup(T a, T b) { return a % b ? a / b + 1 : a / b; }
template<class T> ld deg2rad(T deg) { return M_PI * deg / 180.0; }
template<class T> ld rad2deg(T rad) { return 180.0 * rad / M_PI; }
const long double pi = M_PI;
const long long big = 1LL << 50;
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;
ll intpow(ll a, ll n, ll _mod=numeric_limits<ll>::max()) { ll p=1; while (n) { if (n&1) p=p*a%_mod; a=a*a%_mod; n>>=1; } return p; } 
ll modc(ll a, char op, ll b, ll _mod=mod)
{
        a %= _mod; b %= _mod; ll res = 1;
        switch (op) {
        case '+': res = (a + b) % _mod; break;
        case '-': res = (a - b) % _mod; break;
        case '*': res = a * b % _mod; break;
        case '/': res = modc(a, '*', modc(b, '^', _mod-2, _mod), _mod); break;
        case '^': res = intpow(a, b, _mod); break;
        case 'P': rep(i, a-b+1, a+1) res = modc(res, '*', i, _mod); break;
        case 'C': res = modc(modc(a, 'P', b, _mod), '/', modc(b, 'P', b, _mod)); break;
        } 
        if (res < 0) { res += _mod; } return res;
}



int main()
{
        ll N;
        cin >> N;
        vll A(N);
        rep(i, 0, N) cin >> A[i];
        vll dp(N, inf);

        rep(i, 0, N) {
                auto it = upper_bound(all(dp), A[N-i-1]);
                *it = A[N-i-1];
        }
        ll ans = lower_bound(all(dp), inf) - dp.begin();

        cout << ans << endl;
}


Measured memory_bytes: 4788
#![allow(dead_code)]
#![allow(unused_imports)]
use ascii::{AsciiChar, AsciiStr, AsciiString};
use indexmap::IndexMap;
use itertools::*;
use libm::*;
use num::*;
use ordered_float::OrderedFloat;
use permutohedron::LexicalPermutation;
use proconio::marker::{Bytes, Chars};
use proconio::{fastout, input};
use std::cmp::{max, min, Ordering};
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
use std::mem::swap;

fn main() {
    input!(n:isize, mut v:[OrderedFloat<f32>; n]);

    v.sort();
    let v: Vec<f32> = v.into_iter().map(|x| OrderedFloat::into_inner(x)).collect();
    let ans = v.into_iter().fold1(|x, y| (x + y) / 2.).unwrap();
    println!("{}", ans);
}


Measured memory_bytes: 2216
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;

int main(){
    long long N;
    cin>>N;
    vector<long long> a(N);
    for(int i=0;i<N;i++){
        cin>>a.at(i);
    }
    long long counter=0;
    long long idx=1;
    long long length=0;
    bool flg=false;
    for(int i=0;i<N;i++){
        if(a.at(i)==idx){
            counter=length+counter;
            idx=idx+1;
            length=0;
            flg=true;
        }
        else length++;
    }
    if(flg)cout<<counter+length<<endl;
    else cout<<-1<<endl;
}

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

vector<int> G[200005];
vector<int> ans(200005);

void dfs(int v, int p) {
  for (int u : G[v]) {
    if (u == p) continue;
    ans[u] += ans[v];
    dfs(u, v);
  }
}

int main() {
  int N, Q;
  cin >> N >> Q;
  
  for (int i = 0; i < N-1; i++) {
    int a, b;
    cin >> a >> b;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  
  for (int i = 0; i < Q; i++) {
    int p, x;
    cin >> p >> x;
    ans[p] += x;
  }
  
  dfs(1, -1);
  
  for (int i = 1; i <= N; i++) {
    cout << ans[i] << endl;
  }
}

Measured memory_bytes: 23552
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <fstream>
#include <cmath>
#include <random>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)
using namespace std;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll GCD (ll a, ll b) {
    if (a < b) {
        swap(a, b);
    }

    ll r = a % b;
    while (r != 0) {
        a = b;
        b = r;
        r = a % b;
    }

    return b;
}

ll LCM (ll a, ll b) {
    ll g = GCD (a, b);
    return a * b / g;
}

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

    ll A, B;
    cin >> A >> B;
    cout << LCM(A, B) << endl;
}

Measured memory_bytes: 256
//JOI2010-2011本選問４歩くサンタクロース(Walking Santa)
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
int main(){

	long long sum = 0LL, osum = 0LL;
	long long f1, f2, f3, w, h, L, HL, temp, oxy[2][2], *LXY[2], ox, oy, max = 0;
	vector<long long> XY[2];
	scanf("%lld %lld",&w, &h);
	scanf("%lld",&L);
	for(f1 = 0; f1 < 2; f1++)
		LXY[f1] = new long long [L];
	//100k
	for(f1 = 0; f1 < L; f1++){
		scanf("%lld %lld",&LXY[0][f1], &LXY[1][f1]);
		XY[0].push_back(LXY[0][f1]);
		XY[1].push_back(LXY[1][f1]);
	}
	//1m
	stable_sort( XY[0].begin(), XY[0].end() );
	stable_sort( XY[1].begin(), XY[1].end() );
	HL = (L + 1) / 2;
	//x軸での最小値の点、y軸での最小値の点を探す
	//200k
	if(L == 1){
		printf("0\n");
		printf("%lld %lld\n",LXY[0][0],LXY[1][0]);
	}
	else{
		for(f1 = 0; f1 < 2; f1++){
			oxy[0][f1] = XY[f1][HL-1];
			oxy[1][f1] = XY[f1][HL];
		}
		//400k
		for(f2 = 0; f2 < 2; f2++){
			for(f3 = 0; f3 < 2; f3++){
				sum = 0LL;
				max = 0LL;
				for(f1 = 0; f1 < L; f1++){
					temp = (long long)abs(LXY[0][f1] - oxy[f2][0]) + abs(LXY[1][f1] - oxy[f3][1]);
					sum += temp;
					if(max < temp)
						max = temp;
				}
				sum *= 2;
				sum -= max;
				if(osum == 0 || osum > sum){
					osum = sum;
					ox = oxy[f2][0];
					oy = oxy[f3][1];
				}
			}
		}
		printf("%lld\n", osum);
		printf("%lld %lld\n", ox, oy);
	}
	return 0;
}

Measured memory_bytes: 4752
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop;

void main() {
    auto s = readln.split.map!(to!int);
    auto N = s[0];
    auto K = s[1];
    auto A = readln.split.map!(to!int).array;
    auto edges = new int[][](N);
    foreach (i; 1..N) {
        auto a = A[i] - 1;
        auto b = i;
        edges[a] ~= b;
        edges[b] ~= a;
    }
    
    auto depth = new int[](N);
    void dfs(int n, int p, int d) {
        depth[n] = d;
        foreach (m; edges[n]) if (m != p) dfs(m, n, d + 1);
    }
    dfs(0, -1, 0);


    auto used = new bool[](N);
    void dfs2(int n, int lb, int ub) {
        used[n] = true;
        foreach (m; edges[n]) if (depth[m] >= lb && depth[m] <= ub && !used[m]) dfs2(m, lb, ub);
    }

    auto pq = new BinaryHeap!(Array!(Tuple!(int, int)), "a[1] < b[1]");
    foreach (i; 1..N) if (depth[i] > K) pq.insert(tuple(i, depth[i]));
    int ans = A[0] != 1;

    while (!pq.empty) {
        auto t = pq.front;
        auto n = t[0];
        pq.popFront;
        if (used[n]) continue;
        ans += 1;
        dfs2(n, min(depth[n], depth[n] - K + 1), depth[n]);
    }

    ans.writeln;
}


Measured memory_bytes: 17852
"use strict";
    
const main = arg => {
  // とりあえず切り分け
  let Nums = arg.split("\n")[0].split(" ").map(n => Number(n));  
  let A = Nums[0],B = Nums[1], C = Nums[2];
  let ans = "NO";
  // 解説見ての回答
  for(let i = 1; i<= B; i++){
  	if(A*i % B == C){
		ans = "YES"
    }
  }
  console.log(ans);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


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

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

if(a%2==0 || b%2==0 || c%2==0)
cout<<"0";
else
{
if(a>=b && a>=c)
cout<<b*c;
else 
if(a<=b && b>=c)
cout<<a*c;
else 
if(c>=a && b<=c)
cout<<a*b;
}
cout<<endl;
}


Measured memory_bytes: 3552
#include<bits/stdc++.h>
#define int long long int 
using namespace std;

int h[100007];
int dp[100007];
int solve(int n){

dp[1]=0;
dp[2]=abs(h[2]-h[1]);

for(int i=3;i<=n;i++)
{
    int x = abs(h[i]-h[i-1])+dp[i-1] ;
    int y= abs(h[i]-h[i-2])+dp[i-2];
  dp[i]=min(x,y);
}


return dp[n];
}

int32_t main(){

    int n;
    cin>>n;
    memset(h,0,sizeof h);
    memset(dp,0,sizeof dp);
    for(int i=1;i<=n;i++)
       cin>>h[i];

    cout<<solve(n);

return 0;
    
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <vector>
#include <queue>
#include <iostream>
#include <iomanip>
using namespace std;
typedef long long LL;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)

int main(){
    LL K, A, B;
    cin >> K >> A >> B;

    if(A + 2 >= B){
        cout << 1 + K << endl;
        return 0;
    }

    if((K+1)/(A+2) == 0){
        cout << 1 + K << endl;
        return 0;
    }

    LL ans = B;
    LL count =  A + 1;
    ans += (K - count) / 2 * (B - A);
    ans += (K - count) % 2;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3592
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
typedef long long cc;
static const cc MAX = 200000;

cc N, K, i, j, k, sub = 0, n = 0, X, Y, A[MAX][10];
cc judge = 0, Ans=0, J13[MAX], J26[MAX];
string S[MAX];
char T;
/*
vector<cc> vec1(MAX), vec2(MAX);
vector<pair<cc, cc>> pairs(MAX);
*/



int main() {	
	cin >> N;
	vector<pair<cc, cc>> pairs(N);
	for (i = 0; i < N; i++) {
		J13[i] = 0;
		J26[i] = 0;
		for (j = 0; j < 10; j++) {
			cin >> T;
			if (T == 'a')
				J13[i] += 1000000000000;
			else if (T == 'b')
				J13[i] += 100000000000;
			else if (T == 'c')
				J13[i] += 10000000000;
			else if (T == 'd')
				J13[i] += 1000000000;
			else if (T == 'e')
				J13[i] += 100000000;
			else if (T == 'f')
				J13[i] += 10000000;
			else if (T == 'g')
				J13[i] += 1000000;
			else if (T == 'h')
				J13[i] += 100000;
			else if (T == 'i')
				J13[i] += 10000;
			else if (T == 'j')
				J13[i] += 1000;
			else if (T == 'k')
				J13[i] += 100;
			else if (T == 'l')
				J13[i] += 10;
			else if (T == 'm')
				J13[i] += 1;
			else if (T == 'n')
				J26[i] += 1000000000000;
			else 	if (T == 'o')
				J26[i] += 100000000000;
			else 	if (T == 'p')
				J26[i] += 10000000000;
			else if (T == 'q')
				J26[i] += 1000000000;
			else if (T == 'r')
				J26[i] += 100000000;
			else if (T == 's')
				J26[i] += 10000000;
			else if (T == 't')
				J26[i] += 1000000;
			else if (T == 'u')
				J26[i] += 100000;
			else if (T == 'v')
				J26[i] += 10000;
			else if (T == 'w')
				J26[i] += 1000;
			else if (T == 'x')
				J26[i] += 100;
			else if (T == 'y')
				J26[i] += 10;
			else if (T == 'z')
				J26[i] += 1;
		}
		pairs[i] = make_pair(J13[i], J26[i]);
	}

	sort(pairs.begin(), pairs.end());
	sub = 1;
	for (i = 0; i < N-1; i++) {
		if ((pairs[i].first == pairs[i + 1].first) && (pairs[i].second == pairs[i + 1].second)) {
			Ans += sub;
			sub++;
		}
		else
			sub = 1;
	}

	cout << Ans << endl;
	return 0;

}

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

using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vii;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define pb push_back
#define odd(x) ((x)&1)
#define even(x) (!odd(x))
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(auto i=0;i<n;++i)
#define FASTIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define TEST_CASE int tc;cin>>tc;while(tc--)

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

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

#ifdef LOCAL
#define cerr cout
#else
#endif

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif


void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}


template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
#define JD






int main(int argv, char* argc[])
{
    FASTIO

    #ifndef JD
        freopen("in.txt","r",stdin);
        //freopen("out.txt","w",stdout);
    #endif

    int m,n,k;
    cin>>n>>m>>k;
    string s[n];
    rep(i,n)
    {
        cin>>s[i];
    }
    int ans=0;
    for(int i=0;i<(1<<n);++i)
    {
        bitset<10> r(i);
        for(int j=0;j<(1<<m);++j)
        {
            bitset<10> c(j);
            int cnt=0;
            rep(x,n)
            {
                rep(y,m)
                {
                    if(r[x]||c[y]) continue;
                    if(s[x][y]=='#')
                        ++cnt;
                }
            }
            if(cnt==k)
                ++ans;
        }
    }
    cout<<ans;








    return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
int main() {
    string s;
    cin >> s;
    if(s.at(2)==s.at(3)&&s.at(4)==s.at(5)){
        cout <<"Yes"<<endl;
    }
    else{
        cout << "No"<<endl;
    }
}

Measured memory_bytes: 256
// g++ macro.cpp -std=c++14
#include <bits/stdc++.h> //STL include
typedef long long ll;// long long int
const ll INF = 10000000000;//INFinity
using namespace std;//namespace

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}//transform
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//#define int long long // yabai

#define dump(x)  cout << #x << " = " << (x) << endl;// debug cout

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

#define ALL(obj) (obj).begin(),(obj).end()// iterator

#define pb(a) push_back(a)//push_back
#define mp make_pair// make_pair


int main(){

    int n;
    string s;
    cin>>n>>s;
    vector<int> vec(n);
    REP(i,n)vec[i]=(s[i]=='('?0:1);
    



    int dif=0;
    REP(i,n){
        dif+=(s[i]=='('?1:-1);
        if(dif<0){s.insert(s.begin()+0,'(');i++;n++;dif++;}
    }
    if(dif>0)while(dif){s.pb(')');dif--;}
    cout<<s<<endl;


    return 0;
}


Measured memory_bytes: 256
Q = 10**9+7
def getInv(N):#Qはmod
    inv = [0] * (N + 1)
    inv[0] = 1
    inv[1] = 1
    for i in range(2, N + 1):
        inv[i] = (-(Q // i) * inv[Q%i]) % Q
    return inv

def getFactorialInv(N):
    inv = [0] * (N + 1)
    inv[0] = 1
    inv[1] = 1
    ret = [1]*(N+1)
    for i in range(2, N + 1):
        inv[i] = (-(Q // i) * inv[Q%i]) % Q
        ret[i] = ret[i-1]*inv[i]%Q
    return ret

def getFactorial(N):
    ret = [1]*(N+1)
    for i in range(2,N+1):
        ret[i] = ret[i-1]*i%Q
    return ret

def main():
    r1, c1, r2, c2 = map( int, input().split())
    F = getFactorial(2*10**6+2)
    I = getFactorialInv(10**6+1)

    def G(a, b):
        return F[a+b+2]*I[a+1]%Q*I[b+1]%Q
    
    print( ( G(r2,c2) - G(r2, c1-1) - G(r1-1, c2) + G(r1-1, c1-1))%Q)
if __name__ == '__main__':
    main()


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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

#define f first
#define s second
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define pb push_back

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define F0R(i, a) FOR(i, 0, a)
#define ROF(i, a, b) for (int i = (b); i >= (a); --i)
#define R0F(i, a) ROF(i, 0, a-1)
#define trav(x, a) for (auto& x: a)

const int MX  = 2e5+5;
const int MOD = 1e9+7;
const ll  INF = 1061109567; // 4557430888798830399LL
const ld  EPS = 1e-9;
const ld  PI  = acos(-1);

int main() {

    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    char a, b; cin >> a >> b;

    if (a == 'H') {
        cout << b << "\n";
    } else {
        if (b == 'D') cout << "H\n";
        else cout << "D\n";
    }

}


Measured memory_bytes: 256