akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;
int n, k, a; string s;
int main() {
  cin >> n >> k >> s;

  for(int i = 0; i < n-1; ++i) if(s[i] == s[i+1]) ++a;
  cout << min(a + k*2, n - 1);
  return 0;
}

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

using namespace std;
using ll = long long;

int main() {
	int n; scanf("%d", &n);
	vector<ll> arr(n);
	for (int i = 0; i < n; ++i) scanf("%lld", &arr[i]);
	ll cMoney = 1000;
	for (int i = 0; i + 1 < n; ++i) {
		if (arr[i+1] > arr[i]) {
			ll units = cMoney / arr[i];
			cMoney += units * (arr[i+1] - arr[i]);
		}
	}
	printf("%lld\n", cMoney);
	return 0;
}


Measured memory_bytes: 3788
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) for(long long i = (n-1);i>=0;i--)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<P> Graph;

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

  ll X,Y;
  cin >> X >> Y;
  
  // 00,01,10,11で順番が回ってくると負け
    
  // 00,01,10,11になる状態を押しつけられたら逃げられない？
    
  // 片方のヤマをi減らし，もう片方をi増やすのでヤマの差を2i詰めるor広げることが可能
  
  // 逆に，最低でも２は差が詰まるor広げる必要がある
  
  // どのようにヤマを減らしても，相手は次の番にそれに対応する数で返すことができるため，
  // 初期状態で決まる？
  
  // 00,01,10,11から逆手順に考えると，お互いが理想の動きをしたとき
  // 勝つ人（00,01,10,11になる直前にヤマをとる人）が相手の手に応じた数ヤマをとり，初期のXYに帰着する
  
  // 初期のX,Yが00,01,10,11になる状態ならAは逃げられない，
  //それ以外は初手でAがその状態にすればBは逃げられない
  
  //ヤマの差は自由に詰められるため，絶対値が1以下の状態を維持することで勝利条件に持ち込める.
  //自分の手番の絶対値が1以下だと最低２の差ができるため絶対値が1を超えてしまう

  if(abs(X-Y) <= 1) cout << "Brown" << endl;
  else				cout << "Alice" << endl;
  
  return 0;
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h> 
#define lb lower_bound 
#define ub upper_bound 
#define sqr(x) (x)*(x) 
#define lowbit(x) (x)&(-x) 
#define mem(a,x) memset(a,x,sizeof(a));
using namespace std; 
typedef long long ll;

int main(){
	int map = -1e9,mam = -1e9,mip = 1e9,mim = 1e9;
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		int x,y;
		scanf("%d %d",&x,&y);
		map = max(map,x+y);
		mam = max(mam,x-y);
		mip = min(mip,x+y);
		mim = min(mim,x-y);
	}
	printf("%d\n",max(map-mip,mam-mim));
}

Measured memory_bytes: 3812
n, m = map(int, input().split())
a, b = [], []
for _ in range(n):
    a.append(input())
for _ in range(m):
    b.append(input())

# (i, j)ずらす
for i in range(n-m+1):
    for j in range(n-m+1):
        flag = True
        for x in range(m):
            for y in range(m):
                if b[x][y] != a[x+i][y+j]:
                    break
            else:
                continue
            flag = False
            break
        if flag:
            print('Yes')
            exit()

print('No')

Measured memory_bytes: 63848
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
const int N =2e5;
int ans[N];
int main()
{
    int a,b;
    while(cin>>a>>b)
    {
        if(a==0&&b==0)
            break;
        if(a>b)
           swap(a,b);
        cout<<a<<" "<<b<<endl;
    }
    return 0;
}

Measured memory_bytes: 2972
import java.util.Scanner;
class Main {
  static public void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    long d = sc.nextLong();
    int a = 0;
    for (int i = 1; i <= n; i++) {
      long x = sc.nextLong();
      long y = sc.nextLong();
      if ((d*d) >= (x*x + y*y)) {
        a++;
      }
    }
    System.out.println(a);
  }
}


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

enum inf = 1_001_001_001;
enum infl = 1_001_001_001_001_001_001L;
enum mod = 1_000_000_007L;


void main() {
    string s;
    scan(s);
    auto p = "keyence";
    int m = p.length.to!int;

    foreach (i ; 0 .. m + 1) {
        debug {
            writeln(s[0..i]);
            writeln(s[$-(m-i)..$]);
        }
        if (s[0 .. i] == p[0 .. i] && s[$-(m-i) .. $] == p[i .. $]) {
            writeln("YES");
            return;
        }
    }

    writeln("NO");
}





void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg ; args) {
        if (x > arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg ; args) {
        if (x < arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}

long powmod(long x, long y, long mod = 1_000_000_007L) {
    long res = 1L;

    while (y > 0) {
        if (y & 1) {
            (res *= x) %= mod;
        }
        (x *= x) %= mod;
        y >>= 1;
    }

    return res;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

import sys

debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        lines.append(input())
        lines.append(input())
        lines.append(input())

    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    n = int(lines[0])
    v = [int(e) for e in lines[1].split(" ")]
    c = [int(e) for e in lines[2].split(" ")]

    return (n, v, c)


def solve(n, v, c):

    result = 0
    for i in range(n):
        d = v[i] - c[i]
        if d > 0:
            result = result + d

    return result


def main():
    # 出力

    print("%s" % solve(*parse_input()))

if __name__ == '__main__':

    main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long				ll;
typedef pair<int,int >			pii;
template <class T>
using V = vector<T>;
#define SYNC					ios_base::sync_with_stdio(0);cin.tie(0);
#define rep(i,b)				for(int i=0;i<b;i++)
#define repn(i,n)				for(int i=1;i<=n;i++)
#define ALL(x)					(x).begin(),(x).end()
#define fi						first
#define se						second
#define pb						push_back
#define dzx						cerr<<"here";
const ll MOD=1e9+7,INF=9e18;
const int inf=2e9;
int main(){
	ll x,y;
	cin>>x>>y;
	int ans=0;
	while(x<=y){
		ans++;
		x<<=1;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m;cin>>n>>m;
  vector<int>a(n);
  vector<pair<int,int>>bc(m);
  for(int i=0;i<n;i++)cin>>a[i];
  for(int i=0;i<m;i++)cin>>bc.at(i).second>>bc.at(i).first;
  sort(a.begin(),a.end());
  sort(bc.rbegin(),bc.rend());
  long long sum=0;
  int j=0;
  for(int i=0;i<m;i++){
    if(a[min(n-1,j+bc.at(i).second-1)]<=bc.at(i).first){
      sum+=(long long)bc.at(i).first*min(n-j,bc.at(i).second);
      j=min(n,j+bc.at(i).second);
      if(j==n){
        break;
      }
      continue;
    }
    else if(a[min(n-1,j+bc.at(i).second-1)]>bc.at(i).first){
      for(int k=min(n-1,j+bc.at(i).second-2);k>=j;k--){
        if(bc.at(i).first>=a[k]){
          sum+=(long long)bc.at(i).first*(k-j+1);
          j=k+1;
          break;
        }
      }
      break;
    }
  }
  for(int i=j;i<n;i++){
    sum+=a[i];
  }
  cout<<sum<<endl;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define ll long long
#define db long double
#define mp make_pair
#define pb push_back
#define all(a) a.begin(), a.end()

using namespace std;

db pi = acos(-1);

main(){
#ifdef LOCAL
	freopen("B_input.txt", "r", stdin);
	//freopen("H_output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.precision(15);

	db n, l;
	cin >> n >> l;
	vector<db> v(n);
	for (int i=0;i<n;++i) cin >> v[i];
	db x = 0, y = 0;
	for (int i=0; i < n; ++i) for (int j=i+1; j < n; ++j){
		db X = cos(pi*(db) (v[i] + v[j]) / (db) l);
		x += (db) (i + (n-j-1) - (j-i-1)) * X;
		db Y = sin(pi*(db) (v[i] + v[j]) / (db) l);
		y += (db) (i + (n-j-1) - (j-i-1)) * Y;
	}

	db cnt = n*(n-1)*(n-2)/6;
	cout << fixed << x/cnt << " " << y/cnt << endl;

}


Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
#include <cmath>
#include <map>
#include <iomanip>
#include <unordered_map>
#include <stack>
#include <cstring>

using namespace std;
typedef long long  ll;
const ll INF = 1000000007;
const ll mod = 1000000007;


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

Measured memory_bytes: 3620
#include <cmath>
#include <iostream>

using namespace std;

int main() {
  long s;
  cin >> s;

  int n = log10(s) + 1;

  long sum = 0;
  for (int i = 0; i < (1 << (n - 1)); i++) {
    long tmp = s;
    int d = 1;
    for (int j = 0; j < n - 1; j++) {
      if (i & (1 << j)) {
        sum += tmp % (long)pow(10, d);
        tmp /= pow(10, d);
        d = 1;
      } else {
        d++;
      }
    }
    sum += tmp % (long)pow(10, d);
  }
  cout << sum << endl;
}



Measured memory_bytes: 1144
#python3
from collections import defaultdict
n=int(input())
a=[input() for _ in range(n)]
b=defaultdict(int)
for i in a:
  k=''.join(sorted(i))
  b[k]+=1

c = dict(b)
ans=0
for i in c.values():
  ans+=i*(i-1)//2
print(ans)

Measured memory_bytes: 29168
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
#define MOD @
#define ADD(X,Y) ((X) = ((X) + (Y)%MOD) % MOD)
typedef long long i64; typedef vector<int> ivec; typedef vector<string> svec;

int N;
char A[300];
vector<pair<int, int>> ans;

/*
void draw_curve(int mask, bool flip = false)
{
	vector<pair<int, int>> seq;
	seq.push_back({0, 0});
	for (int i = 0; i < N; ++i) {
		pair<int, int> src = make_pair(i, (mask >> i) & 1);
		pair<int, int> dest = make_pair(i + 1, (mask >> i) & 1);
		if (seq.back() != src) seq.push_back(src);
		seq.push_back(dest);
	}
	if (seq.back().second == 1) seq.push_back({N, 0});
	for (int i = N - 1; i >= 0; --i) seq.push_back({i, 0});
	if (flip) reverse(seq.begin(), seq.end());
	for (int i = 1; i < seq.size(); ++i) ans.push_back(seq[i]);
}
*/
void draw_curve(int p, bool flip = false)
{
	vector<pair<int, int>> seq;
	for (int i = 0; i <= p; ++i) seq.push_back({i, 0});
	seq.push_back({p, 1});
	seq.push_back({p + 1, 1});
	for (int i = p + 1; i >= 0; --i) seq.push_back({i, 0});
	if (flip) reverse(seq.begin(), seq.end());
	for (int i = 1; i < seq.size(); ++i) ans.push_back(seq[i]);
}

int main()
{
	scanf("%d%s", &N, A);
	for (int i = 0; i < (1 << N); ++i) {
		if (A[i] == '0') {
			for (int j = 0; j < N; ++j) if ((i & (1 << j)) == 0) {
				if (A[i | (1 << j)] == '1') {
					puts("Impossible");
					return 0;
				}
			}
		}
	}
	if (A[0] == '0') {
		puts("Impossible");
		return 0;
	}
	puts("Possible");
	vector<int> minima;
	for (int i = 0; i < (1 << N); ++i) {
		if (A[i] == '0') {
			bool flg = true;
			for (int j = 0; j < N; ++j) {
				if ((i & (1 << j)) != 0 && A[i ^ (1 << j)] == '0') flg = false;
			}
			if (flg) minima.push_back(i);
		}
	}
	ans.push_back({0, 0});
	for (int m : minima) {
		vector<int> bits;
		for (int i = 0; i < N; ++i) if (m & (1 << i)) bits.push_back(i);
		vector<int> seq;
		seq.push_back(bits[0]);
		for (int i = 1; i < bits.size(); ++i) {
			vector<int> seq2;
			seq2.push_back(bits[i]);
			for (int j = 0; j < seq.size(); ++j) {
				seq2.push_back(seq[j]);
			}
			seq2.push_back(~bits[i]);
			for (int j = seq.size() - 1; j >= 0; --j) {
				seq2.push_back(~seq[j]);
			}
			seq = seq2;
		}
		for (int i = 0; i < seq.size(); ++i) {
			//if (seq[i] >= 0) printf("%d ", seq[i]);
			//else printf("!%d ", ~seq[i]);
			if (seq[i] >= 0) draw_curve(seq[i]);
			else draw_curve(~seq[i], true);
		}
	}
	printf("%d\n", ans.size() - 1);
	for (auto p : ans) printf("%d %d\n", p.first, p.second);
	return 0;
}


Measured memory_bytes: 640
H, W = map(int, input().split())
s = [input() for h in range(H)]

for h in range(H):
    for w in range(W):
        if s[h][w] == '#':
            flag = False
            for dx, dy in ([-1, 0], [0, -1], [1, 0], [0, 1]):
                x = h + dx
                y = w + dy
                if x<0 or x>=H:
                    continue
                if y<0 or y>=W:
                    continue
                if s[x][y] == '#':
                    flag = True
                    break
            if not flag:
                print('No')
                exit()

print('Yes')

Measured memory_bytes: 9208
#include<iostream>
#include<vector>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
using ll = long long;
using P = pair<int, int>;
#include<algorithm>
#include<math.h>
#include<map>
#include<queue>
#include<set>

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	int k;
	cin >> k;
	ll cnt(0);
	while (1) {
		if (a >= b) {
			b *= 2;
			cnt++;
		}
		else if (c <= b) {
			c *= 2;
			cnt++;
		}
		else {
			break;
		}
	}
	if (cnt <= k) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}
	return 0;
}

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define sf scanf
#define pf printf
#define pb push_back
#define mp make_pair
#define PI ( acos(-1.0) )
#define mod 1000000007LL
#define maxn 100005
#define IN freopen("C.in","r",stdin)
#define OUT freopen("output.txt","w",stdout)
#define FOR(i,a,b) for(i=a ; i<=b ; i++)
#define DBG pf("Hi\n")
#define INF 1000000000
#define i64 long long int
#define eps (1e-8)
#define xx first
#define yy second
#define ln 17
#define off 2

using namespace __gnu_pbds;
using namespace std ;

typedef tree< i64, null_type, less<i64>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef pair<i64, i64> pii;


class numberTheory{

public:
    numberTheory(){}

    pii extendedEuclid(i64 a, i64 b) { // returns x, y | ax + by = gcd(a,b)

        if(b == 0) return pii( a >= 0 ? 1 : -1 , 0LL);
        else {
            pii d = extendedEuclid(b, a % b);
            return pii(d.yy, d.xx - d.yy * (a / b));
        }

    }

    i64 modularInverse(i64 a, i64 n) {
        pair<i64,i64> ret = extendedEuclid(a, n);
        return ((ret.xx % n) + n) % n;
    }


    i64 bigMod(i64 a, i64 n , i64 m)
    {
        if(n==0) return 1 ;
        i64 ret = bigMod(a,n/2,m) ;
        ret = (ret*ret)%m ;
        if(n%2) ret = (ret*a)%m ;
        return ret ;
    }
};

const i64 N = 2000000 ;

i64 fact[N+5] , invFact[N+5] ;

i64 C(i64 n, i64 r)
{
    if( n<0 || r<0 || r>n ) return 0 ;
    i64 ret = (fact[n]*invFact[r])%mod ;
    return (ret*invFact[n-r])%mod ;
}

void preprocess()
{
    numberTheory nt ;

    fact[0] = 1 ;
    for(i64 x=1 ; x<=N ; x++) fact[x] = (fact[x-1]*x)%mod ;

    invFact[N] = nt.modularInverse(fact[N],mod) ;

    for(i64 x=N-1 ; x>=0 ; x--) invFact[x] = (invFact[x+1]*(x+1) )%mod ;
}

i64 ans[N+5] , dp[N+5] ;

int main()
{
    preprocess() ;

    numberTheory nt ;

    i64 n , h , d ;

    scanf("%lld %lld %lld",&n,&h,&d) ;

    ans[0] = 1 ;
    dp[0] = ( 1LL*ans[0]* fact[n] )%mod ;

    i64 m = 0 ;

    for(i64 i=1 ; i<=n ; i++) m = (m+fact[i] )%mod ;

 //   printf("%lld %lld\n",ans[0],dp[0]) ;

    for(i64 i=1 ; i<=h ; i++)
    {
        ans[i] = dp[i-1] ;

        if( i>d  ) ans[i] = (ans[i]- dp[i-d-1])%mod ;

        dp[i] = (ans[i]*m)%mod ;
        dp[i] = (dp[i-1] +dp[i])%mod ;

   //     printf("%lld %lld\n",ans[i],dp[i]) ;
    }
    ans[h] = (ans[h]%mod + mod)%mod ;

    printf("%lld\n",ans[h]) ;

    return 0 ;
}


Measured memory_bytes: 50432
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}


template<typename T> void drop(const T &x){cout<<x<<endl;exit(0);}

//INSERT ABOVE HERE
signed main(){
  int n,m;
  cin>>n>>m;
  string ans(n,'#');
  for(int i=0;i<m;i++){
    int s;
    char c;
    cin>>s>>c;
    s--;
    if(ans[s]=='#') ans[s]=c;
    if(ans[s]!=c) drop(-1);
  }
  if(n>1&&ans[0]=='0') drop(-1);
  if(n==1&&ans[0]=='#') ans[0]='0';
  for(int i=0;i<n;i++){
    if(ans[i]!='#') continue;
    ans[i]='0'+(i==0);
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
#define F first
#define S second
#define pb push_back
#define pf push_front

namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

ll M = 1000000007;
typedef pair<int, int> P;
int main()
{
    int n;
    cin >> n;
    int k;
    cin >> k;
    string s;
    cin >> s;
    int cnt=0;
    rep(i,n){
        string t=s.substr(i,2);
        if(t=="RR" or t=="LL"){
            cnt++;
        }
    }
     cnt=min(2*k+cnt,n-1);
    cout << cnt << endl;
}


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

map<vector<int>, long long> comb;
long long choose(int n, int r) {
  if (r > n || r < 0) return 0;
  if (r == 0) return 1;
  if (comb.find({n, r}) != comb.end()) return comb[{n, r}];
  comb[{n, r}] = choose(n - 1, r) + choose(n - 1, r - 1);
  return comb[{n, r}];
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n; cin >> n;
  vector<string> s(n);
  for (int i = 0; i < n; i++) cin >> s[i];
  for (int i = 0; i < n; i++) {
    sort(s[i].begin(), s[i].end());
  }
  unordered_map<string, int> cnt;
  for (auto &t : s) {
    (cnt.find(t) != cnt.end()) ? cnt[t]++ : cnt[t] = 1;
  }
  long long tot = 0;
  for (auto &p : cnt) {
    tot += choose(p.second, 2);
  }
  cout << tot << '\n';
  return 0;
}

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

using namespace std;

#define ll long long

void solve(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    while(true){
        c -= b;
        if(c <= 0){
            cout<<"Yes";
            return;
        }
        a -= d;
        if(a <= 0){
            cout<<"No";
            return;
        }
    }
    
}

int main(){
    int t = 1;
    while(t--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 3636
import java.util.*;

public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = sc.next();
        String si[] = new String[n];
        int red = 0;
        int blue = 0;
        for(int i = 0; i < n; i++){
        	si[i] = s.substring(i, i + 1);
            if(si[i].equals("R")){
            	red++;
            }else if(si[i].equals("B")){
            	blue++;
            }
        }
        if(red > blue){
        	System.out.println("Yes");
        }else{
        	System.out.println("No");
        }
    }
}

Measured memory_bytes: 35572
#include <bits/stdc++.h>
 
using namespace std;
 
int main()
{
    int a, b;
    cin>>a>>b;
    if (a==b)
        cout<<a;
    else if (a>b)
        cout<<a-1;
    else if (a<b)
        cout<<a;
    return 0;
}

Measured memory_bytes: 256
function main(input) {
	const args = input.split(' ').map((n) => parseInt(n, 10));
  	const N = args[0];
  	const Y = args[1];
  
  	let result = '-1 -1 -1';
  
  	for (let i = 0; i <= N; i++) {
      for (let j = 0; j <= N; j++) {
        if ((i + j) > N) { continue; }
        
      	let k = N - i - j;
        
        total = (10000*i) + (5000*j) + (1000*k);
        if (total === Y) {
          result = `${i} ${j} ${k}`;
          break;
        }
      }
    }
  	
  	console.log(result);
}

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

Measured memory_bytes: 32532
#include <iostream>
#include <math.h>
#include <fstream>
#include <algorithm>
#include <string>
#include <string.h>
#include <queue>
#include <vector>
#include <set>
using namespace std;
int main() {
	long long int X, k = 0;
	int i = 1;
	cin >> X;
	while (k<X)
	{
		k += i;
		i++;
	}
	cout << i-1;
}


Measured memory_bytes: 256
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>
#include <cctype>
#include <unordered_map>

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<long, long>;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
#define rep(i, n) for(int i = 0; i<n; i++)
#define rep_s(i, start, n) for(int i= start;  i<n; i++)
#define rep_down(i, n) for(int i = n-1; i>=0; i--)
#define rep_down_s(i, n, start) for(int i = n-1; i>=start; i--)
#define ALL(a) (a).begin(), (a).end()
#define ALL_str(a) (a).cbegin(), (a).cend()

string alphabet_upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string alphabet_lower  = "abcdefghijklmnopqrstuvwxyz";
string numbers = "0123456789";

/*
using edge = struct {int to; ll cost;};
vector<edge> tree[limit];
ll depth[limit];

void dfs(int v, int p, ll d){
  depth[v] = d;
  //cout <<"v: " << v << endl;
  for (auto &e: tree[v]){
    //cout << "e.to: " << e.to << endl;
    if (e.to == p) continue;
    dfs(e.to, v, d+e.cost);
  }
}
*/
int keta_sum(int num){
  int dig, sum = 0;
  while(num){
    dig = num % 10;
    sum = sum + dig;
    num = num / 10;
  }
  return sum;
}

ll binary_search(ll left_key, ll border, ll low, ll high) {
     // 配列 a の左端と右端
    ll mid = (low+high)/2;
    while (high > low+1) {
       mid = (low+high)/2;
        if (left_key*mid>border) high = mid;
        else if (left_key*mid<border) low = mid;
        else {
          mid =mid-1;
          break;
        }
    }
    return mid;
}

bool IsPrime(ll a){
  ll b = sqrt(a);
  b++;
  while(b-->=2){
    if (a%b==0) return false;
  }
  return true;
}

ll gcd(ll a, ll b){
  ll tmp;
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }

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

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main(void){
  ll N, M, A, B, C, D, K,W, H, Q, X, Y;
  ll ans;
  string S, T;
  cin >> D;
  cout << "Christmas";
  if (D<= 24) cout << " Eve";
  if (D<= 23) cout << " Eve";
  if (D<= 22) cout << " Eve";

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define int long long 
#define ll long long 
#define pb push_back
#define mp make_pair
#define pii pair<ll,ll>
#define ff first
#define ss second
#define vi vector<ll>
#define vii vector<vector<ll>>
#define vpi vector<pii>
#define mod 1000000007
#define MOD 1000000007
#define full(a) a.begin(),a.end()
#define inf INT_MAX
#define minf INT_MIN
#define dd double
#define fori(x,n) for(ll i=x;i<n;i++)
#define modd 998244353
#define umap unordered_map<ll,ll>
#define mmap map<ll,ll>
#define mm 100000000


int32_t main() 
{ 
  
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif


    
    ll t;
    t=1;
    // cin>>t;
    while(t--){
      ll n,x,t;
      cin>>n>>x>>t;
      ll pro = n/x;

      if(n%x!=0)pro++;

      cout<<pro*t;



      
  
    }





return 0;
}     



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

#define mod 1000000007

using namespace std;
 
int main(void){
	
	int N, X, count=0;
	
	cin >> N >> X;
	
	int m[N];
	
	for(int i=0; i<N; i++)
		cin >> m[i];
	
	for(int i=0; i<N; i++){
		X -= m[i];
		count++;
	}
	
	sort(m, m+N);
	
	while(X >= m[0]){
		count++;
		X -= m[0];
	}
	
	cout << count;
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long   // aaaaaaaaaaaaaaaaaa
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define allr(x) (x).rbegin(),(x).rend()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define SIZE(buff) (sizeof(buff)/sizeof(buff[0]))
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef long long ll;
typedef pair<int,int> PII;
const ll mod=1000000007;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
template<typename T, typename U>ostream& operator << (ostream& os, pair<T, U>& pair_var)
{os << "(" << pair_var.first << ", " << pair_var.second << ")";return os;}
// head

int x,n,m,t,q,res;
int a[101000] = {};
int ru[101000] = {};
int ok[101000] = {};
string s;
vector<vector<int>> vec;
signed main() {
	std::cin >>n;
	rep(i,0,n){
		std::cin >> a[i];
	}
	sort(a,a+n);
	rep(i,0,n){
	ru[i+1] = ru[i]+a[i];
	}
	res = 1;
	per(i,0,n){
		if(ru[i]*2<a[i]){
			break;
		}
		res += 1;
	}
	std::cout << res << '\n';
}

Measured memory_bytes: 1792
#include <stdio.h>

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

    int n, i;
    
    while(scanf("%d", &n) != EOF) {
        if (n > 39) {
            n = n % 39;
        }
        if(n == 0) {
            printf("3C39\n");
        }
        for (i = 1; i <= 39; i++) {
            if (n == i) {
                if (n < 10) {
                    printf("3C0%d\n", i);
                } else {
                    printf("3C%d\n", i);
                }
            }
        }
    }
    
    return 0;
}

Measured memory_bytes: 608
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define vpll vector < pair<long long,long long> >
#define fill(a,val)  memset(a,val, sizeof (a))
#define sort_unique(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define all(cont) cont.begin(), cont.end()
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MAX   1e9
#define MIN  -1e9
typedef map<int,int> mpi;
typedef set<int> seti;
typedef multiset<int> mseti;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define rep(i, n)    for(long long int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define repn(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define trav(a, x) for(auto& a : x)
struct Interval {int start, end;};
bool compare(Interval i1, Interval i2) {return (i1.start < i2.start);}
ll dp[2005][2005]={0};
ll sum[2005]={0};
ll mod=1e9+7;
int main()
{
    ll n,m;
    cin>>n>>m;
    ll s[n],t[m];
    rep(i,n)
    cin>>s[i];
    rep(i,m)
    cin>>t[i];
    rep(i,m)
    if(s[0]==t[i])
        dp[0][i]=1;
    repA(i,1,n-1)
    {
        ll sum2=0;
        rep(j,m)
        {
            if(s[i]==t[j])
                dp[i][j]=(sum2+1)%mod;
            sum[j]=(sum[j]+dp[i-1][j])%mod;
            sum2=(sum2+sum[j])%mod;
        }
    }
    ll ans=0;
    rep(i,n)
    {
        rep(j,m)
        {
            //cout<<dp[i][j]<<" ";
            ans=(ans+dp[i][j])%mod;
        }
        //cout<<endl;
    }
    cout<<ans+1;
    return 0;
}


Measured memory_bytes: 31488
/// referenced: https://beta.atcoder.jp/contests/abc066/submissions/2252964
#include <bits/stdc++.h>
using namespace std;

constexpr int64_t MOD = 1000000007;

int64_t Power(int64_t base, int64_t exp) {
  int64_t x = 1;
  while (exp) {
    if (exp % 2) {
      x = x * base % MOD;
    }
    base = base * base % MOD;
    exp /= 2;
  }
  return x;
}

int64_t Inv(int64_t x) {
  return Power(x, MOD - 2);
}

int64_t Factorial[100002],InvFact[100002];

int64_t Combination(int64_t n, int64_t r) {
  if (n < r) return 0;
  int64_t x = Factorial[n];
  x = x * InvFact[r] % MOD;
  x = x * InvFact[n - r] % MOD;
  return x;
}


int main(){
  int64_t n,a;
  bool c[100002];
  cin >> n;
  for(int64_t i=1;i<=n;i++) c[i]=false;
  int64_t p[100002];
  int64_t x,y;

  for(int64_t i=0;i<=n;i++){
    cin >> a;
    if(c[a]){
      x=p[a];
      y=i;
    }
    c[a]=true;
    p[a]=i;
  }


  Factorial[0]=1;
  for(int64_t i=1;i<=n+1;i++) Factorial[i]=i*Factorial[i-1]%MOD;
  for(int64_t i=0;i<=n+1;i++) InvFact[i]=Inv(Factorial[i]);

  for(int64_t i=1;i<=n+1;i++){
    int64_t ans;
    ans=Combination(n+1,i);
    if(i-1<=n-(y-x)) ans+=MOD-Combination(n-(y-x),i-1);
    cout << (ans%MOD) << endl;
  }

  return 0;
}


Measured memory_bytes: 3584
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        
        int x = sc.nextInt();
        
        int y = sc.nextInt();
        
        int a[]={1,3,5,7,8,10,12};
        int b[]={4,6,9,11};
        
        int count =0;
        
        
        //a配列同士の数字の場合の判定部分
        for(int i=0;i<a.length;i++){
            if(x==a[i]){
                
                
                for(int j=0;j<a.length;j++){
                    if(y ==a[j]){
                        System.out.println("Yes");
                        count +=1;
                    }
                }
            }
        }
        //a配列かどうかの判定終了
        
        //b配列の場合
        for(int i=0;i<b.length;i++){
            if(x==b[i]){
                
                
                for(int j=0;j<b.length;j++){
                    if(y ==b[j]){
                        System.out.println("Yes");
                        count +=1;
                    }
                }
            }
        }
        
        //2の場合
        if(x==2&&y==2){
            System.out.println("Yes");
            count +=1;
        }
        
        //Noの場合
        if(count != 1){
            System.out.println("No");
        }
        
        
    }
}


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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2019/03/12  Problem: ABC 078 B / Link: http://abc078.contest.atcoder.jp/tasks/abc078_b  ----- */


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

	LL X, Y, Z; cin >> X >> Y >> Z;
	X -= Z;
	LL ans =X/(Y+Z);
	
	
	cout << (ans) << "\n";

	return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

    int C[N-1], S[N-1], F[N-1];
    for(int i=0; i<N-1; i++){
        cin >> C[i] >> S[i] >> F[i];
    }

    int ans[N];
    ans[N-1] = 0;
    for(int i=0; i<N-1; i++){
        int t = 0;
        for(int j=i; j<N-1; j++){
            if(t <= S[j]){
                t += S[j] - t + C[j];
            }else if(t % F[j] == 0){
                t += C[j];
            }else{
                t += ((t-S[j])/F[j]+1)*F[j]+S[j] - t + C[j];
            }
        }
        ans[i] = t;
    }

    for(int i=0; i<N; i++){
        cout << ans[i] << endl;
    }

    return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		Long[] a = new Long[n];
		long[] b = new long[n];
		Long[] c = new Long[n];
		for (int i = 0; i < n; i++) {
			a[i] = scanner.nextLong();
		}
		for (int i = 0; i < n; i++) {
			b[i] = scanner.nextInt();
		}
		for (int i = 0; i < n; i++) {
			c[i] = scanner.nextLong();
		}
		Arrays.sort(a);
		Arrays.sort(c);

		long count = 0;
		long aCount = 0;
		long cCount = 0;
		for (int i = 0; i < n; i++) {
			long tar = b[i];
			aCount = lower_bound(Arrays.asList(a), tar);
			cCount = n - upper_bound(Arrays.asList(c), tar);
			count += aCount * cCount;
		}

		System.out.println(count);
	}

	// 指定した値`以上`の要素が最初に現れる位置を返す
	private static int lower_bound(List<Long> list, long val) {
		return ~Collections.binarySearch(list, val, (x, y) -> x.compareTo(y) >= 0 ? 1 : -1);
	}

	// 指定した値`より大きい`の要素が最初に現れる位置を返す
	private static int upper_bound(List<Long> list, long val) {
		return ~Collections.binarySearch(list, val, (x, y) -> x.compareTo(y) > 0 ? 1 : -1);
	}
}


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

const ll MOD = 1000000007;

//素因数分解
vector<pair<ll,int>> factorize(ll n){
	vector<pair<ll,int>> res;
	for (ll i = 2; i*i <= n ; ++i) {
		if(n%i!=0) continue;
		res.emplace_back(i,0);
		while(n%i==0){
			n /= i;
			res.back().second++;
		}
	}
	if(n!=1){
		res.emplace_back(n,1);
	}
	return res;
}

//べき乗高速化
ll mpow(ll x, ll n){
	ll ans = 1;
	while(n != 0){
		if (n&1) ans = ans * x % MOD;
		x = x*x % MOD;
		n  = n >> 1;
	}
	return ans;
}

int main(){
	ll N;
	cin >> N;
	vector<ll> A(N);
	
	ll maxA = 0;
	rep(i,N){
		cin >> A[i];
		maxA = max(maxA, A[i]);
	}
	
	//A[i]の最小公倍数をmod10^9+7で求めたい
	vector<pair<ll,int>> a[10005];
	rep(i,N){
		 a[i] = factorize(A[i]);
	}
	
	vector<int> temp(1000001, 0);
	
	rep(i,N){
		rep(j,a[i].size()){
			temp[a[i][j].first] = max(temp[a[i][j].first], a[i][j].second);
		}
	}
	ll lcm = 1;
	
	REP(i,1000000){
		if(temp[i] == 0) continue;
		lcm *= mpow(i,temp[i]);
		lcm %= MOD;
	}
	
	vector<ll> B(N);
	
	ll ans = 0;
	
	rep(i,N){
		B[i] = lcm*mpow(A[i], MOD-2);
		ans += B[i];
		ans %= MOD;
	}
	
	cout << ans << endl;
    return 0;
}

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

#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)
#define FILL0(x) memset(x,0,sizeof(x))

using namespace std;

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

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; }
 

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);

 
    int S, W;
    cin >> S >> W;
    if(S<=W)
    {
        cout << "unsafe" << endl;
    }
    else
    {
        cout << "safe" << endl;
    }
    
 

 

    return 0;
}
 

//cout << setprecision(13);
//next_permutation();
//__gcd();
//reverse();
//set ,tuple ,pair;
//bitset
//vector.find



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

using namespace std;

int main() {
    int32_t n;
    cin >> n;

    vector<int32_t> fib(n+1);
    fib[0] = 1;
    fib[1] = 1;
    for (int32_t i = 2; i <= n; i++) {
        fib[i] = fib[i-1] + fib[i-2];
    }

    cout << fib[n] << endl;

    return 0;
}

Measured memory_bytes: 3104
#include <cmath>
#include <cstdio>
#include <string>
#include <cstring>
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;

const int N = 200005;

int n, m;
int req[N];
int num[N];
bool vis[N];

signed main(void)
{
	cin >> n >> m;

	for (int i = 1; i <= m; ++i)
		cin >> req[i];

	memset(vis, 0, sizeof(vis));

	int tot = 0, p = 1;

	for (int i = m; i >= 1; --i)
		if (!vis[req[i]])
		{
			vis[req[i]] = true;
			num[++tot] = req[i];
		}

	while (tot < n)
	{
		while (vis[p])++p;
		num[++tot] = p++;
	}

	for (int i = 1; i <= n; ++i)
		cout << num[i] << endl;
}

Measured memory_bytes: 4476
#include<bits/stdc++.h>
using namespace std;
 
#define int long long
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define all(v) (v).begin(),(v).end()
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define pb push_back
#define fi first
#define se second
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}
 
typedef unsigned long long ull;
const ull a=8931919,p=1000000007,q=1000000009;
 
int N;
vint G[100000];
 
int sz[100000];
map<pint,int>cnt[111111];
pint dfs(int v,int par){
    ull hp=1,hq=1;
    sz[v]=1;
    for(auto u:G[v]){
        if(u==par)continue;
        ull gp,gq;
        tie(gp,gq)=dfs(u,v);
        sz[v]+=sz[u];
        hp=(hp+gp*a)%p;
        hq=(hq+gq*a)%q;
    }
    cnt[sz[v]][pint(hp,hq)]++;
    return pint(hp,hq);
}
signed main(){
    cin>>N;
    rep(i,N-1){
        int a,b;
        cin>>a>>b;
        a--;b--;
        G[a].pb(b);G[b].pb(a);
    }
    dfs(0,-1);
 
    int ans=0;
    reps(i,1,N+1){
        each(it,cnt[i]){
            ans+=it->se*(it->se-1)/2;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 28688
import java.util.Scanner;

public class Main {


      public static void main(String[] args) {

            Scanner sc = new Scanner(System.in);
            int n = sc.nextInt();
            long d = sc.nextLong();
            long length = d * d;
            int ans = 0;
            for(int i = 0; i< n ; i++){
                  long x = sc.nextLong();
                  long y = sc.nextLong();
                  if((x*x + y*y)<=length){
                        ans++;
                  }

            }
            System.out.println(ans);

      }


}


Measured memory_bytes: 59264
<?php
$n = int();
for($a = "a"; $a != "aa"; $a++){
  $az[$a] = 0;
}
for($i = 0; $i < $n; $i++){
  $str = str();
  $azcopy = $az;
  for($j = 0; $j < 10; $j++){
    $azcopy[$str[$j]]++;
  }
  if(!isset($map[implode("", $azcopy)])){
    $map[implode("", $azcopy)] = 0;
  }
  $map[implode("", $azcopy)]++;
}
$sum = 0;
foreach($map as $num){
  $sum += $num*($num-1)/2;
}
printf("%d", $sum);

function str(){
  return trim(fgets(STDIN));
}
function ints(){
  return array_map("intval", explode(" ", trim(fgets(STDIN))));
}
function int(){
  return intval(trim(fgets(STDIN)));
}
function o(...$val){
    if(count($val)==1)$val = array_shift($val);
    $trace = debug_backtrace();
    echo $trace[0]['line'].")";
    if(is_array($val)){
        if(count($val) == 0){
            echo "empty array";
        }elseif(!is_array(current($val))){
            echo "array:";
            echo implode(" ", $val)."\n";
        }else{
            echo "array:array\n";
            foreach($val as $row){
                echo implode(" ", $row)."\n";
            }
        }
    }else{
        echo $val."\n";
    }
}

Measured memory_bytes: 15224
L, R = map(int, input().split())
mod = 2019
ans = mod + 1

if R - L >= 3000 or L == 0:
    print(0)
else:
    for i in range(L, R):
        for j in range(i + 1, R + 1):
            m = ((i%mod) * (j%mod)) % mod
            if m < ans:
                ans = m
    print(ans)


Measured memory_bytes: 2940
#include <stdio.h>

typedef struct {
	char name[15];
	int num;
	int uriage;
}Class;

int main() {
	int i, before, after;
	Class cls[9];
	
	for(i=0;i<9;i++){
		scanf("%s %d %d", cls[i].name, &before, &after);
		cls[i].num = before + after;
		cls[i].uriage = before*200 + after*300;
	}
	
	
	for(i=0;i<9;i++){
		printf("%s %d %d\n",cls[i].name, cls[i].num, cls[i].uriage);
	}
	
	
	return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
const int N = 55;
typedef long long ll;
ll a[N],s;
int n;
ll check(ll mid) {
  ll cnt = 0;
  for (int i = 1 ; i <= n ; ++ i)
    cnt += max(0ll,(a[i] - mid) / (n + 1));
  return cnt;
}
int main() {
  scanf("%d",&n);
  for (int i = 1 ; i <= n ; ++ i)
    scanf("%lld",&a[i]), s += a[i];
  s -= n * (n-1);
  if (s > 0) {
    ll mx = 0;
    for (int i = 1 ; i <= n ; ++ i)
      a[i] += s, mx = max(a[i],mx);
    ll l = 0, r = mx, ans, mid, tmp;
    while (l <= r) {
      mid = (l + r) >> 1;
      if (check(mid) <= s) r = mid - 1, ans = mid, tmp = check(mid);
      else l = mid + 1;
    }
    for (int i = 1 ; i <= n ; ++ i) if (a[i] > ans)
      a[i] -= (a[i] - ans) / (n+1) * (n+1);
    for (int i = 1 ; i <= n ; ++ i)
      a[i] -= s - tmp;
    s = tmp;
  } else s = 0;
  while (true) {
    int pmx = 1;
    for (int i = 2 ; i <= n ; ++ i)
      if (a[i] > a[pmx]) pmx = i;
    if (a[pmx] < n) break;
    ++ s;
    for (int i = 1 ; i <= n ; ++ i)
      a[i] ++;
    a[pmx] -= n+1;
  }
  printf("%lld\n",s);
  return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		if(N == 1){
			Console.WriteLine("Yes");
			Console.WriteLine(2);
			Console.WriteLine("1 1");
			Console.WriteLine("1 1");
			return;
		}
		if(N == 3){
			Console.WriteLine("Yes");
			Console.WriteLine(3);
			Console.WriteLine("2 1 2");
			Console.WriteLine("2 1 3");
			Console.WriteLine("2 2 3");
			return;
		}
		
		if( N == 6){
			List<int>[] L = new List<int>[3];
			for(int i=0;i<3;i++){
				L[i] = new List<int>();
			}
			for(int i=3;i<N;i++){
				L[i % 3].Add(i + 1);
			}
			Console.WriteLine("Yes");
			Console.WriteLine(4);
			Console.WriteLine("{0} 1 2 {1}",N / 3 + 1,String.Join(" ",L[0]));
			Console.WriteLine("{0} 2 3 {1}",N / 3 + 1,String.Join(" ",L[1]));
			Console.WriteLine("{0} 1 3 {1}",N / 3 + 1,String.Join(" ",L[2]));
			Console.WriteLine("{0} {1}",N - 3, String.Join(" ",L[0]) + " " + String.Join(" ",L[1]) + " " + String.Join(" ",L[2]));
			return;
		}
		
		for(int i=3;i*i<=4 * N;i++){
			int tot = (i * i - i) / 2 + i;
			if(tot == N){
				List<int>[] ans = new List<int>[i];
				for(int j=0;j<i;j++) ans[j] = new List<int>();
				
				for(int j=0;j<i;j++) ans[j].Add(j + 1);
				int l = 0;
				int r = 1;
				int num = i + 1;
				while(l < i){
					r = l + 1;
					while(ans[l].Count < i){
						ans[l].Add(num);
						ans[r].Add(num);
						r++;
						num++;
					}
					l++;
				}
				Console.WriteLine("Yes");
				Console.WriteLine(i + 1);
				List<int> a = new List<int>();
				for(int j=0;j<i;j++) a.Add(j + 1);
				Console.WriteLine("{0} {1}",a.Count,String.Join(" ",a));
				for(int j=0;j<i;j++){
					Console.WriteLine("{0} {1}",ans[j].Count, String.Join(" ",ans[j]));
				}
				return;
			}
		}
		
		
		
		
		Console.WriteLine("No");
	}
	int N;
	public Sol(){
		N = ri();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 17728
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;
use std::vec::Vec;
use std::{vec, cmp, num};


struct Scanner<'a> {
    cin: StdinLock<'a>,
}

impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner {cin: cin}
    }

    fn read1<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char)
                    .skip_while(|c| c.is_whitespace())
                    .take_while(|c| !c.is_whitespace())
                    .collect::<String>();
        token.parse::<T>().ok()
    }

    fn read<T: FromStr>(&mut self) -> T {
        self.read1().unwrap()
    }
}

// create Vec<char> from String
#[allow(dead_code)]
fn to_chars(s: String) -> vec::Vec<char> {
    let mut cs = s.chars();
    let mut res = vec::Vec::new();
    while let Some(c) = cs.next() {
        res.push(c);
    }
    res
}

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);
    let mut a: i32 = sc.read();
    let b: String = sc.read();
    for _i in 0..b.len() {
        a *= 10;
    }
    a += b.parse::<i32>().unwrap();
    let mut x = 1;
    let mut ok: bool = false;
    while x * x <= a {
        if x * x == a {
            ok = true;
        }
        x += 1;
    }
    match ok {
        true => println!("Yes"),
        false => println!("No"),
    }
}

Measured memory_bytes: 4352
n=int(input())
S=[int(i) for i in input().split()]
q=int(input())
T=[int(i) for i in input().split()]


def solve(i,m,n,S):
    if sum(S)<m:
        return False
        
    if m==0:
        return True

    elif i>=n:
        return False
        
    res=solve(i+1,m,n,S) or solve(i+1,m-S[i],n,S)
    return res
    
for i in range(q):
    attempt=solve(0,T[i],n,S)
    if attempt:
        print("yes")
        
    else:
        print("no")


Measured memory_bytes: 5624
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, M;
  cin >> N;
  vector<string> WIN(N);
  for (int i=0;i<N;i++){
  	cin >> WIN.at(i);
  }
  cin >> M;
  vector<string> LOSE(M);
  for (int i=0;i<M;i++){
  	cin >> LOSE.at(i);
  }
  
  string ANS;
  int max = 0;
  for (int i=0;i<N;i++){
    string s = WIN.at(i);
    int p = 0;
    for (int j=0;j<N;j++){
      string t = WIN.at(j);
      if (s == t)
        p++;
    }
    for (int j=0;j<M;j++){
      string u = LOSE.at(j);
      if (s == u)
        p--;
    }
    if (p > max){
      max = p;
    }
  }
  if (max < 0)
    max = 0;
  cout << max << endl;
}

Measured memory_bytes: 3640