akhauriyash/Code-Regression huggingface dataset:
#include	<bits/stdc++.h>
using	namespace	std;
typedef	long long ll;

// int/long:		-2,147,483,648 - 2,147,483,647 (-2^31 <= int < 2^31)
// long/long long:	-9,223,372,036,854,775,808 - 9,223,372,036,854,775,807 (-2^63 <= long < 2^63)

// lower_bound(A.begin(), A.end(), N)
// upper_bound(...

// A.erase(unique(A.begin(), A.end()), A.end())

// bit: &/and, |/or, ^/xor, ~/not

// getline(cin, String)
// while (getline(cin, S)) {}

// cout <<fixed <<setprecision(10)

// priority_queue<int> q;
// priority_queue<int, vector<int>, less<int>> q; // Default: vector, less
// priority_queue<vector<int>, vector<vector<int>>, greater<vector<int>>> q;

// Graph
// Warshall-Floyd: Distance between each node, N^3
// Dijkstra: Distance from the start node, N^2
// DFS(Depth-First Search)

//
// Notes
//
// When specified less than N, try full scan.
// RE: empty vector
// Check Qs
// long/int
// xor -> count each bit
// Check values
// 	1,000,000 -> Loop
// 	100,000	-> vector(int:400KB, long:800KB) 

#define	INF (1<<30)
//1,073,741,824
//= 536,870,912 *2

#define	MOD 1000000007

#define	Rep0(i, n)	for (int i=0; i<n; i++)
#define	Rep1(i, n)	for (int i=1; i<=n; i++)
#define Sort(P)	sort(P.begin(), P.end())
#define Rev(P)	reverse(P.begin(), P.end())

struct SS {
	string s;
	int c;
};

void unique_count(vector<string> &a, vector<SS> &b) {
	// erase(b.begin(), b.end());
	for (int i=0; i<a.size(); i++)
		if ((i>0)&&(a.at(i)==a.at(i-1)))
			b.back().c++;
		else
			b.push_back({a.at(i), 1});
	return;
}

int	main() {
	int N;
	cin >>N;
	vector<string> S(N);
	Rep0(i, N)
		cin >>S.at(i);
	Sort(S);
	vector<SS> C;
	unique_count(S, C);
	int cc=0;
	Rep0(i, C.size())
		cc=max(cc, C.at(i).c);
	vector<string> CC;
	Rep0(i, C.size())
		if (C.at(i).c==cc)
			CC.push_back(C.at(i).s);
	Sort(CC);
	Rep0(i, CC.size())
		cout <<CC.at(i) <<endl;
	return 0;
}



Measured memory_bytes: 21488
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int dev = a/b;
        int r = a%b;
        double f = (double)a/(double)b;
        System.out.println(dev + " " + r + " " + String.format("%.5f", f));                
    }    
}



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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) begin(r),end(r)
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init))
#define mp(a,b) make_pair(a,b)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

template<typename T>
void O(T t){
  cout << t << endl;
}

const ll mod = 1e9+7;
constexpr ll inf = ((1<<30)-1)*2+1 ;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0,1,-1,1,-1};
const int dx[] = {0,-1,0,1,1,-1,-1,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n,m;
  while(cin >> n >> m,n+m){
    vector<ll> w(n+1),h(m+1);
    map<ll,ll> ans;
    ll t = 0,s = 0;;
    REP(i,1,n+1){
      cin >> t;
      s += t;
      w[i] = s;
    }
    s = 0;
    REP(i,1,m+1){
      cin >> t;
      s += t;
      h[i] = s;
    }
    rep(i,n+1){
      rep(j,m+1){
        ans[h[j] - w[i]]++;
      }
    }
    ll res = 0;
    for(auto u : ans){
      ll c = u.se;
      res += c * (c-1)/2;
    }
    cout << res << endl;
  }
  return 0;
}

Measured memory_bytes: 38884
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const static ll INF = 1e9;
const static ll MOD = 1e9+7;

int main(){
    int N; cin >> N;
    vector<int> A(N); for(int i = 0; i < N; i++) cin >> A[i];
    sort(A.begin(), A.end());
    ll ans = 0;
    for(int i = N-1; i >= 0; i--){
        for(int j = 30; j >= 1; j--){
            ll key = pow(2, j) - A[i];
            if(key <= 0) break;
            auto itr = lower_bound(A.begin(), A.end(), key);
            if(*itr != key) continue;
            int d = distance(A.begin(), itr);

            if(i == d) {
                continue;
            }

            A.erase(A.begin()+i);
            A.erase(A.begin()+d);
            //cout << d << " " << i << " " << A.size() << endl;
            i--;
            ans++;
            
            break;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1280
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<cstring>
#include<math.h>
#include<bitset>
#include<queue>
#include<set>
#include<iomanip>
#include<math.h>
// #include<bits/stdc++.h>
using namespace std;
#define ll long long
constexpr long long int INFLL = 1001001001001001LL;
constexpr int INFI = 1e8;


int main(){
  int N;
  cin >> N;
  ll A[N+1],B[N+1],C[N+1];
  for(ll i=0; i<N; i++){
    cin >> A[i];
  }
  A[N] = INFLL;
  for(ll i=0; i<N; i++){
    cin >> B[i];
  }
  for(ll i=0; i<N; i++){
    cin >> C[i];
  }
  C[N] = INFLL;
  sort(A,A+N);
  sort(C,C+N);
  ll sum=0;
  for(ll i=0; i<N; i++){
    ll *a;
    a = lower_bound(A,A+N,B[i]);
    ll ai;
    if(*lower_bound(A,A+N,B[i]) == B[i]){
      ai--;
    }
    ai = distance(A,a);
    ll *c;
    c = lower_bound(C,C+N,B[i]+1);
    ll ci;
    ci = distance(C,c);
    sum += ai*(N-ci);
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
// x^y≡x^(y%(p-1))mod p
// but there is a condition that x needs to be coprime to p
///assic value of ('0'-'9') is(48 - 57) and (a-z) is (97-122) and (A-Z) is(65-90) and 32 for space
typedef long long int ll;
typedef pair<ll, ll> pii;
typedef vector<pii> vii;
#define  pb push_back
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fo(i,a,b) for(ll i = a; i<=b;i+=1)
#define rf(i,a,b)  for(ll i=a;i>=b;i--)
#define vll vector<ll>
#define tests() int test_cases ; cin >> test_cases ; while(test_cases--)
#define ub upper_bound
#define lb lower_bound
#define all(v) v.begin(),v.end()
#define MAXN 100010
#define MOD 1000000007
#define mod 998244353
#define deb(x) cout << '>' << #x << ':' << x << endl;
#define sp " "
#define MS(x,y) fill_n(*x, sizeof x / sizeof **x, y);
#define mem(x,y) memset(x,y,sizeof(x));
#define INF 1000000000000000000
#define IO                 \
	ios::sync_with_stdio(0); \
	cin.tie(0);              \
	cout.tie(0);
#define debug(x) cerr << (#x) << " is " << (x) << endl;

#ifndef ONLINE_JUDGE
#define cerr if(true)cerr
#endif

template<int D, typename T>
struct Vec : public vector<Vec<D - 1, T>> {
static_assert(D >= 1, "Vector dimension must be greater than zero!");
template<typename... Args>
	Vec(int n = 0, Args... args) : vector<Vec<D - 1, T>>(n, Vec<D - 1, T>(args...)) {
	}
};
template<typename T>
struct Vec<1, T> : public vector<T> {
	Vec(int n = 0, const T& val = T()) : vector<T>(n, val) {
	}
};

ll power(ll x, ll y,ll p) 
{ 
    ll res = 1;     // Initialize result 
    x = x % p;
    if (y==0)return 1;
    if(x==0)return 0;   
    while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x) % p;    
        y = y>>1; // y = y/2 
        x = (x*x) % p;  // Change x to x^2 
    } 
    return res; 
}
int gcd(int a, int b) { if (a == 0)return b;return gcd(b % a, a);} 

ll modinv(ll a,ll p){return power(a,p-2,p);}

int solve(){
    string s,t;
    cin>>s>>t;
    if (s.size()+1==t.size())
    {
        bool satisfy = true;
        f(i,0,s.size()){
            if (s[i]!=t[i])
            {
                satisfy = false;
            }
        }
        if (satisfy)
        {
            cout<<"Yes"<<endl;
        }
        else cout<<"No"<<endl;
    }
    else cout<<"No"<<endl;
    return 0;
}
int main()
{
    IO;
    #ifndef ONLINE_JUDGE 
    freopen("input.txt", "r", stdin); 
    freopen("out.txt", "w", stdout); 
    #endif 
    int T=1;
	// cin >> T;
	f(c,0,T){
		solve();
	}
    return 0;
}// make_pair make_tuple  tuple<int,int,int> continue resize insert count size else true isValid second first

Measured memory_bytes: 3672
//#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>

using namespace std;


inline void print() {
    cout << endl;
}
template <typename First, typename... Rest>
void print(const First &first, const Rest &... rest) {
    cout << first << ' ';
    print(rest...);
}


void solve() {
    int M, K; cin >> M >> K;

    if (K >= 1<<M) {
        cout << -1 << endl;
        return;
    }

    if (M == 1) {
        if (K == 0) {
            print(0, 0, 1, 1);
        }
        else {
            cout << -1 << endl;
        }
        return;
    }

    for (int i = 0; i < 1<<M; i++) {
        if (i == K) continue;
        cout << i << endl;
    }
    cout << K << endl;
    for (int i = (1<<M)-1; i>= 0; i--) {
        if (i == K) continue;
        cout << i << endl;
    }
    cout << K << endl;
}


int main() {
    solve();
    return 0;
}

Measured memory_bytes: 3640
#include <iostream>

using namespace std;

int main()
{
	int year;

	cin >> year;

	if (year == 1)
	{
		cout << "Hello World" << endl;
	}
	else if(year == 2)
	{
		int a, b;
		cin >> a >> b;
		cout << a + b;
	}

	return 0;
}

Measured memory_bytes: 256
# Your code here!
while True:
    h,w = map(int, input().split())
    if h == 0 and w == 0:
      break
    for j in range(h):
        for i in range(w):
            if (i+j)%2==0:
                print("#", end="")
            else:
                print(".", end="")
        print()
    print()


Measured memory_bytes: 7000
#include<bits/stdc++.h>
using namespace std;
#define N 200003
#define LL long long
#define mod 998244353

int n;
struct Node{
	double x;
	inline bool operator < (const Node&rhs) const{
		return x>rhs.x;	
	}
};
priority_queue<Node>q;

inline int read(){
	int X=0,w=0;
	char ch=0;
	while (ch<'0' || ch>'9')
	  w|=ch=='-',ch=getchar();
	while (ch>='0' && ch<='9')
	  X=(X<<3)+(X<<1)+(ch^48),ch=getchar();
	return w ? -X : X;
}

int main(){
	n=read();
	for (int i=1;i<=n;i++){
		int x=read();
		q.push((Node){x});
	}
	for (int i=1;i<n;i++){
		double x1=q.top().x;
		q.pop();
		double x2=q.top().x;
		q.pop();
		q.push((Node){(double)(x1+x2)/2});	
	}
	printf("%.6lf\n",q.top().x);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <cstring>
#include <algorithm>
#include <iterator>
using namespace std;

void func_c(int N) {
	bool flg = true;
	bool eq = false;

	vector<long> H(N);
	
	for (int i = 0; i < N; i++) {
		cin >> H[i];
	}

	for (int i = N-1; i>0; i--) {
		if (H[i] < H[i - 1]) {
			
			if ((H[i - 1] - H[i]) != 1) {
				flg = false;
				break;
			}
			
			H[i - 1]--;
		}
		else if (H[i] == H[i - 1]) {
			eq = true;
		}
		else {
			eq = false;
		}
	}
	if (flg) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

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

Measured memory_bytes: 1024
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <cmath>
#include <climits>

#include <sstream>
#include <iostream>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <utility>
#include <vector>
#include <functional>
#include <algorithm>

using namespace std;

#define fast_cin() ios_base::sync_with_stdio(false)

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

int main()
{
	string S;
	cin >> S;
	if (S.length() >= 4 && S.substr(0, 4) == "YAKI") {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
}


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

#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define repp(i, n, m) for(int (i) = (n); (i) < (m); (i)++)
#define repn(i, n) for(int (i) = 1; (i) <= (n); (i)++)
#define repr(i, n) for(int (i) = (n-1); (i) >= 0; (i)--)
#define all(x) (x).begin(), (x).end()
#define lint long long
#define ulint unsigned long long
#define ldou long double
#define fi first
#define se second
#define setpre(x) std::cout << fixed << setprecision(x)
#define ii(x) int x; cin >> (x)
#define ii2(x, y) int x, y; cin >> (x) >> (y)
#define ii3(x, y, z) int x, y, z; cin >> (x) >> (y) >> (z)
#define out(x) cout << (x) << endl
#define outs(x) cout << (x) << " "
#define yn(x) cout << ((x)?("Yes"):("No")) << endl
#define YN(x) cout << ((x)?("YES"):("NO")) << endl
#define bit_c(x) __builtin_popcountll(x)

inline void logger(){ std::cout << " [LOGGER] " << endl; }
template<typename A, typename... B>
void logger(const A& a, const B&... b){
    cout << a << " , "; logger(b...);
}

typedef pair<lint, lint> P;
const lint MOD = 1000000007;
const lint MOD9 = 998244353;
const lint INF = MOD * MOD;
const int MAX = 200005;

/* ...o(^-^)o... */

int main(){
    int n; cin >> n;
    lint sum = 0;
    vector<lint> a(n);
    rep(i, n){
        cin >> a[i];
        sum ^= a[i];
    }

    rep(i,n){
        outs(sum ^ a[i]);
    } out("");
}

Measured memory_bytes: 4836
import numpy as np
h, n = map(int, input().split())
a = [0 for i in range(10**4+1)]
b = [i for i in range(10**4+1)]
used = [False for i in range(10**4+1)]
for i in range(n):
    t = [int(i) for i in input().split(" ")] 
    if used[t[1]] == True:
        a[t[1]-1] = min(a[t[1]-1], t[0])
    else:
        a[t[1]] = t[0]
        used[t[1]] = True
a = np.array(a)[np.array(used)]
b = np.array(b)[np.array(used)]

dp = np.array([0 for i in range(h+1)])
for i in range(1, h+1):
    temp = i-a
    temp[temp<0] = 0
    dp[i] = np.min(dp[temp] + b)
print(dp[-1])

Measured memory_bytes: 12996
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    string s;
    cin >> n >> s;
    vector<vector<int>> dp(n+1, vector<int>(n+1));
  for(int i = 0; i <= n; i++)
  {
    for(int j = 0; j <= n; j++)
    {
      dp[i][j] = 0;
    }
  }

    for(int i = 0; i < n; i++)
    {
        for(int j = i+1; j < n; j++)
        {
            if(s[i] == s[j])
            {
                if(dp[i][j] < j - i)
                  dp[i+1][j+1] = dp[i][j] + 1;
            }
        }
    }
    int ans = 0;
    for(int i = 0; i <= n; i++)
    {
        for(int j = 0; j <= n; j++)
        {
            ans = max(ans, dp[i][j]);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 98176
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int MOD=1e9+7;
const long double Pi=acos(-1);
using  P=pair<ll,ll>;
int prime(ll a){
  if(a==2){
    return 1;
  }else if(a%2==0 || a==1){
    return 0;
  }
  for(ll i=3;i*i<=a;i+=2){
    if(a%i==0)
      return 0;
  }
  return 1;
}
ll gcd(ll a,ll b){
  if(a%b==0){
    return(b);
  }else{
    return(gcd(b,a%b));
  }
}
int main(){
  ll A,B,ans=1;
  cin>>A>>B;
  ll x=gcd(A,B);
  ll memo=x;
  ll maxx=0;
  unordered_map<ll,ll> mp;
  unordered_map<ll,ll> mp2;
  if(x==1){cout<<1<<endl;return 0;}
  if(prime(x)==1){cout<<2<<endl;return 0;}
  for(ll i=1;i*i<=memo;i++){
    while(x%i==0 && x>1 && prime(i)==1){
      x/=i;
      mp[i]++;
      maxx=max(maxx,i);
      if(x==1){break;}
    }
    if(memo%i==0 && prime(memo/i)==1 && x%(memo/i)==0){
      //cout<<memo/i<<endl;
      x/=(memo/i);
      //maxx=memo/i;
      ans++;
      //mp[memo/i]++;
      break;
    }
  }
  //cout<<maxx<<endl;
  for(ll i=1;i<=maxx;i++){
    if(mp[i]>0 && prime(i)==1){
      ans++;
    }
  }
  cout<<ans<<endl;
}

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

int n,m,q;

int main() {
  cin >> n >> m >> q;
  int L[n+1][n+1];
  for (int i=0;i<=n;i++) {
    for (int j=0;j<=n;j++) {
      L[i][j]=0;
    }
  }
  for (int i=0;i<m;i++) {
    int a,b;cin >> a >> b;
    L[a][b]+=1;
  }
  for (int i=1;i<=n;i++) {
    for (int j=1;j<=n;j++) {
      L[i][j]+=L[i-1][j]+L[i][j-1]-L[i-1][j-1];
    }
  }
  for (int i=0;i<q;i++) {
    int c,d;cin >> c >> d;
    cout << L[d][d]-L[c-1][d]-L[d][c-1]+L[c-1][c-1] << endl;
  }
}
      

Measured memory_bytes: 1920
#include<iostream>
#include<string.h>
#include<vector>
#include<list>
#include<stdio.h>
#include<math.h>
#include<iomanip>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << "debug " << x << endl;
using namespace std;

int main(){
    int n,p,check;
    char s[1024];
    while(cin >> n){
        rep(j,n){
            p = 350;
            check = 0;
            char ans[700] = {'0'};
            cin >> s;
            for(int i = 0; s[i]; i++){
                if(s[i] >= 'a' && s[i] <= 'z'){
                    ans[p] = s[i];
                }else if(s[i] == '>'){
                    p++;
                }else if(s[i] == '<'){
                    p--;
                }
            }
            rep(i,700){
                if(ans[i] == '0'){
                    continue;
                }else if(ans[i] >= 'a' && ans[i] <= 'z'){
                    cout << ans[i];
                }
            }cout << endl;
        }
    }
}

Measured memory_bytes: 1156
def indexes(s, i):
  if i in s:
    return s.index(i)
  return -1

def check(s, num):
  for i in num:
    if indexes(s, i) < 0:
      return False
    index=indexes(s, i)
    s=s[index+1:]
  return True

l=int(input())
s=input()
pin=[]
cand=[str(i)[1:] for i in range(1000, 2000)]
for i in cand:
  if check(s, i):
    pin.append(i)
print(len(pin))

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

int main() {
  int a,b,c,d;
  int kekka = 0;
  
  cin >> a >> b >> c >> d;
  
  if(a >= b) kekka += b;
  else kekka += a;
  
  if(c >= d) kekka += d;
  else kekka += c;
  
  cout << kekka;
}


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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//const value
//const ll MOD = 1e9 + 7;
//const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
//const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

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


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  ll L;
  cin >> n >> L;
  VLL a(n);
  rep(i,n) cin >> a[i];
  rep(i,n-1){
    if( a[i] + a[i+1] >= L) {
      cout << "Possible" << endl;
      rep(front,i) cout << front+1 << endl;
      for(int back = n-1; back > i+1; back--) cout << back << endl;
      cout << i+1 << endl;
      return 0;
    }
  }

  cout << "Impossible" << endl;


  return 0;
}


Measured memory_bytes: 1664
N = int(input())
H = list(map(int,input().split()))

count_list = []
count = 0

for i in range(N-1):
  if H[i] >= H[i+1]:
    count += 1
  else:
    count_list.append(count)
    count = 0
else:
  count_list.append(count)
    
print(max(count_list))

Measured memory_bytes: 14252
#include <iostream>
#include <vector>
#include <map>
#include <list>
#include <queue>
#include <algorithm>
#include <cassert>
#include <string>
#include <climits>
#include <numeric>

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

using namespace std;
using ll = long long;

int main()
{
	int a, b;
	cin >> a >> b;
	cout << a * b - (a * 1 + b * 1 - 1) << endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
#define MAX 100000+5

typedef long long ll;

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

  int a = 0;
  int b = 10;
  string s;
  vector<string> t(n);
  map<string, int> mp;
  ll ans = 0;
  for (int i = 0; i < n; i++) {
    cin >> s;
    sort(s.begin(), s.end());
    mp[s]++;
  }
  //combinationで数えないとTLE
  for (auto& p : mp) {
    int s = p.second;
    ans += (ll)s*(s-1)/2;//combination of sC2
  }
  cout << ans << endl;
  return 0;
}




Measured memory_bytes: 12032
from collections import deque
N,M=map(int,input().split())
G=[[] for i in range(N)]
H=[[] for i in range(N)]
for i in range(N-1+M):
    a,b=map(int,input().split())
    G[a-1].append(b-1)
    H[b-1].append(a-1)
K=[0 for i in range(N)]
for i in range(N):
    for p in G[i]:
        K[p]+=1
q=deque(i for i in range(N) if K[i]==0)
res=[]
while q:
    v1=q.popleft()
    res.append(v1)
    for v2 in G[v1]:
        K[v2]-=1
        if K[v2]==0:
            q.append(v2)
tbl=[-1 for i in range(N)]
for i in range(N):
    tbl[res[i]]=i
ans=[0 for i in range(N)]
for i in range(1,N):
    L=[]
    for p in H[res[i]]:
        L.append((tbl[p],p))
    ans[res[i]]=max(L)[1]+1
for i in ans:
    print(i)



Measured memory_bytes: 43756
import java.util.Scanner;

class Main {
 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
 
        int a = sc.nextInt();
        int b = sc.nextInt();
        int sum = a + b ;
        if(sum >= 10){
        	System.out.println("error");
        }else{
        	System.out.println(sum);
        }
        }
}

Measured memory_bytes: 21844
int main()
{
	int i;
	int n,x,t;
	int ans;

	i = 0;
	scanf("%d %d %d", &n, &x, &t);
	if (n % x)
		i = 1;
	ans = (n / x + i) * t;
	printf("%d\n", ans);

	return (0);
}

Measured memory_bytes: 1728
#include <iostream> // cout, endl, cin
#include <cmath> //sqrt pow
#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
 
#define rep(i,n) for(int i = 0; i < n; i++)
#define vi vector<int>
#define vvi vector<vi>
#define mod 1000000007
using ll = long long;
using namespace std;
int main(){
  int a,b,c;
  cin >> a >> b >> c;
  if(a + b + c >= 22) cout << "bust" << endl;
  else cout << "win" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#define rep(i, a, n) for(int i = a; i < n; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main()
{
    int k;
    cin >> k;
    int a[32] = {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};
    cout << a[k-1] << endl;
    return 0;
}


Measured memory_bytes: 256
/*
Author : N_o_o_B
Created : December 22 2019 17:28:57 
*/
#include <bits/stdc++.h>
using namespace std;
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
*/
#define TRACE
#ifdef TRACE
#define trace(...) { cerr<<"[ "; __trace__(#__VA_ARGS__, __VA_ARGS__);}
#undef endl
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const pair<Arg1,Arg2> &x) {
    return out<<"("<<x.first<<","<<x.second<<")";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const vector<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const set<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const map<Arg1,Arg2> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
void __trace__(const string name, Arg1&& arg1){
    cerr << name << " : " << arg1 << " ] " << endl;
}
 
template <typename Arg1, typename... Args>
void __trace__(const string names, Arg1&& arg1, Args&&... args){
    const string name = names.substr(0,names.find(','));
    cerr<<name<<" : "<<arg1<<" | ";
    __trace__(names.substr(1+(int)name.size()), args...);
}
#else
    #define trace(args...)
#endif
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vll;
typedef vector<vl> vvl;
//typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> oset;
#define fori(i,n) for(int i=0;i<n;i++)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repd(i,a,b) for(int i=a;i>=b;i--)
#define ford(i,n)  for(int i=n-1;i>=0;i--)
#define trav(x,a) for(auto& x:a)
#define all(x) x.begin(),x.end()
#define pb push_back
#define endl '\n'
#define sz(a) (int)a.size()
#define fi first
#define se second
clock_t time_p=clock();
void time_taken()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
//const ll mod=998244353;
const ll mod=1e9+7;
const ll INF=1e18;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    cout.precision(12);cout << fixed;
    int a,b;
    cin >> a >> b;
    cout << 6-a-b << endl;




    time_taken();
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

int main() {
    int h, w;
    cin >> h >> w;

    char s[52][51] = {};
    for (int i = 1; i <= h; i++) {
        cin >> s[i + 1];
    }

    int b = 1;
    for (int i = 1; i <= h; i++) {
        for (int j = 0; j < w; j++) {
            if (s[i][j] == '#') {
                if (s[i][j + 1] == '#' || s[i][j - 1] == '#' || s[i + 1][j] == '#' || s[i - 1][j] == '#') {
                    //
                } else {
                    b = 0;
                }
            }
        }
    }

    cout << (b ? "Yes" : "No") << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define DBG_N(hoge) cerr<<" "<<(hoge)<<endl;
#define DBG cerr<<"!"<<endl;
#define BITLE(n) (1LL<<((ll)n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll a,b,c,d,e;
  string s,ss,sss;
  cin>>a;
  cout<<a*a*3<<endl;
  return 0;
}


Measured memory_bytes: 256
import kotlin.math.log10
import kotlin.math.pow

fun main() {
    val k = nextInt()
    var count = 0
    var v = 1L
    do {
        println(v)
        v = sunuke(v + 1)
        count ++
    } while (count < k)
}

fun sunuke(n: Long): Long {
    fun calc(num: Long): Double{
        var sum = 0L
        var m = num
        while (m > 0) {
            sum += m % 10
            m /= 10
        }
        return num.toDouble() / sum
    }

    var sunuke = n
    var minVal = calc(n)

    repeat(log10(n.plus(1).toDouble()).toInt() + 1) {
        val d10 = 10.toDouble().pow(it + 1).toLong()
        val x = d10.times(n.toDouble().div(d10).plus(1).toLong()).minus(1)
        val xVal = calc(x)
        if (minVal > xVal) {
            sunuke = x
            minVal = xVal
        }
    }
    return sunuke
}

// # Utils
// ## Input
fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextList() = next().split(" ")
fun nextIntList() = next().split(" ").map(String::toInt)
fun nextLongList() = next().split(" ").map(String::toLong)
fun nextDoubleList() = next().split(" ").map(String::toDouble)

// ## Array
inline fun <reified T> sizedArray(size: Int, default: T) = Array(size) { default }
inline fun <reified T> sized2DArray(row: Int, column: Int, default: T) = Array(row) { Array(column) { default } }

// ## mod^-1
//    [NOTE] CANNOT use this for 0, mod, 2mod, 3mod ...(return wrong value)
fun modinv(num: Long, mod: Long): Long {
    var a = num
    var b = mod
    var u = 1L
    var v = 0L
    while (b > 0) {
        val t = a.div(b)
        a -= t * b
        a = b.also { b = a } // swap a and b
        u -= t * v
        u = v.also { v = u } // swap u and v
    }
    u %= mod
    if (u < 0) u += mod
    return u
}

fun gcd(x: Int, y: Int): Int {
    fun innerGcd(x: Int, y: Int): Int {
        return if (x % y == 0) y else innerGcd(y, x % y)
    }
    return if (x >= y) innerGcd(x, y) else innerGcd(y, x)
}

fun gcd(x: Long, y: Long): Long {
    fun innerGcd(x: Long, y: Long): Long {
        return if (x % y == 0L) y else innerGcd(y, x % y)
    }
    return if (x >= y) innerGcd(x, y) else innerGcd(y, x)
}

// classes
class UnionFindTree(val size: Int) {
    private val r = sizedArray(size, -1)
    fun root(x: Int): Int {
        if (r[x] < 0) return x
        return root(r[x])
    }

    fun unite(x: Int, y: Int) {
        var rx = root(x)
        var ry = root(y)
        if (rx == ry) return
        if (r[rx] > r[ry]) {
            rx = ry.also { ry = rx }
        }
        r[rx] += r[ry]
        r[ry] = rx
    }

    fun size(x: Int) = -r[root(x)]

    override fun toString(): String {
        return r.joinToString(separator = ", ")
    }
}

Measured memory_bytes: 35192
#include <iostream>
#include <string>
#include <deque>
#include <algorithm>

using namespace std;

int main()
{
	int a, b; cin >> a >> b;
	for (int i = 0; i < 10000; ++i)
	{
		int first = (i * 8) / 100;
		int second = (i * 10) / 100;

		if (first == a and second == b)
		{
			cout << i;
			return 0;
		}
	}

	cout << -1;
	return 0;
}

Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <vector>
#include <list>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <stack>
#include <fstream>
#include <queue>
#include <iomanip>
#include <iterator>
#include <map>
#include <unordered_map>
#include <set>
#define fast ios_base::sync_with_stdio(false)
#define ll long long int
#define ld long double
#define vi vector<ll>
#define vvi vector<vi >
#define pi pair<ll,ll>
#define vvpi vector<vector<pi > >
#define vpi vector<pi >
#define vppi vector<pair<ll,pi > >
#define vs vector<string>
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define pb push_back
#define eb emplace_back
#define mkp make_pair
#define fs first
#define se second
#define crz(v,n) v.clear(),v.resize(n+1,0)
#define print(v) for(ll it=0;it<v.size();it++) cout<<v[it]<<" ";cout<<endl
#define printp(v) for(ll it=0;it<v.size();it++) cout<<v[it].first<<" "<<v[it].second<<endl
using namespace std;
int main(){
	ll i,n,j,k;cin>>n>>k;vi v(n),d(n,1e18);for(i=0;i<n;i++) cin>>v[i];d[0]=0;
	for(i=1;i<n;i++){
		for(j=1;j<=k;j++) if(i-j>=0) d[i]=min(d[i-j]+abs(v[i]-v[i-j]),d[i]);
	}cout<<d[n-1]<<endl;
}



Measured memory_bytes: 1792
#include <iostream>
#include <string>

using namespace std;

int main(){
    string str;
    int n;
    cin >> n;
    for(int x=0;x<n;x++){
        cin >> str;
        int times = 0;
        char kind = 0;
        string ret = "";
        str += '0';
        for(int i=0;i<str.size();i++){
            if(str[i] == '0'){
                if(times != 0){
                    times--;
                    if(kind == '1'){
                        times %= 5;
                        if(times == 0){
                            ret += '.';
                        }else if(times == 1){
                            ret += ',';
                        }else if(times == 2){
                            ret += '!';
                        }else if(times == 3){
                            ret += '?';
                        }else{
                            ret += ' ';
                        }
                    }else if(kind == '2'){
                        ret += 'a' + (times%3);
                    }else if(kind == '3'){
                        ret += 'd' + (times%3);
                    }else if(kind == '4'){
                        ret += 'g' + (times%3);
                    }else if(kind == '5'){
                        ret += 'j' + (times%3);
                    }else if(kind == '6'){
                        ret += 'm' + (times%3);
                    }else if(kind == '7'){
                        ret += 'p' + (times%4);
                    }else if(kind == '8'){
                        ret += 't' + (times%3);
                    }else if(kind == '9'){
                        ret += 'w' + (times%4);
                    }
                }
                times = 0;
            }else{
                times++;
                kind = str[i];
            }
        }
        cout << ret << endl;
    }
}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;

#define IS_DEBUG true

#define DEBUG_OUTPUT(X) if (IS_DEBUG) cout << X << endl
#define RESULT_OUTPUT(X) cout << X << endl

int main()
{
  long N;
  cin >> N;
  
  long A = 1000000007;
  long X = 1;
  for (int i = 1; i <= N; i++)
  {
    X = (X * i) % A;
  }
  
  RESULT_OUTPUT(X);


	if (IS_DEBUG)
	{
		int end;
		cin >> end;
	}
	return 0;
}


Measured memory_bytes: 256
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using ld = long double;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,a,n) for(ll i=a;i<(ll)(n);++i)
#define repr(i,a,n) for(ll i=n-1;(ll)a<=i;--i)
#define ENDL '\n'
typedef pair<int,int> Pi;
typedef pair<ll,ll> PL;
constexpr ll mod = 1000000007;
constexpr ll INF = 1000000099;
constexpr ll LINF = (ll)(1e18 +99);
const vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
template<typename T,typename U> inline bool chmin(T& t, const U& u){if(t>u){t=u;return 1;}return 0;}
template<typename T,typename U> inline bool chmax(T& t, const U& u){if(t<u){t=u;return 1;}return 0;}
template<typename T> inline T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<typename T,typename Y> inline T mpow(T a, Y n) {
  T res = 1;
  for(;n;n>>=1) {
    if (n & 1) res = res * a;
    a = a * a;
  }
  return res;
}



signed main(){
  cin.tie(0);ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);
  ll n,k;cin>>n>>k;
  ll y=-1+ (n+k-1)/k;
  n-=y*k;
  cout<<min(k-n,n)<<ENDL;
}
//! ( . _ . ) ! 
//CHECK overflow,vector_size,what to output?

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>

using namespace std;
#define int long long

#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(), (x).end()

template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; abort();}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
//SOLVE

//-----CODE------//

int FUNC(int X,int A,int B)
{
  double dA = A;
  double dB = B;
  double dX = X;
  return floor((dA*dX)/dB) - dA*floor(dX/dB);
}

void solve(void)
{ 
  int A,B,N;
  cin>>A>>B>>N;
  double left = -1;
  double right = N + 1;
 
  for (int i = 0; i < 10000; i++)
  {
    double c1 =(2*left +right)/3;
    double c2 = (2*right+left)/3;
    if(FUNC(c1,A,B) <= FUNC(c2,A,B))left = c1;
    else right = c2;
    // DEBUG(left);
  }
  // DEBUG(FUNC,A,B);
  cout<<(int)FUNC(left,A,B)<<endl;
  return;
}
int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

  return 0;
}


Measured memory_bytes: 3644
import java.io.*;
import java.util.*;
 
public class Main{
  public static void main(String[] args)throws IOException{
     
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String str = br.readLine();
 
    String[] strAry = str.split(" ");

    Arrays.sort(strAry); 

    System.out.println(strAry[0] + " " + strAry[1]  + " " + strAry[2]);
    
  }
}

Measured memory_bytes: 24244
import java.io.*;
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
//        sc.useDelimiter(",");
//        DecimalFormat df = new DecimalFormat("0.00000000");
        int a[] = new int[6];
        for (int i = 0; i < 6; i++) {
            a[i] = Integer.parseInt(sc.next());
        }
        Dice d = new Dice(a);
        int n = Integer.parseInt(sc.next());
        for (int i = 0; i < n; i++) {
            int top = Integer.parseInt(sc.next());
            int back = Integer.parseInt(sc.next());
            outer:
            for (int j = 0; j < 2; j++) {
                for (int k = 0; k < 3; k++) {
                    if (back == d.getBack()) break outer;
                    d.rollSouth();
                }
                d.rollEast();
            }
            for (int m = 0; m < 3; m++) {   
                if (top == d.getTop()) break;
                d.rollEast();
            }
            out.println(d.getRight());
        }
        out.flush();
    }
}
class Dice {
    private int top, front, back, left, right, down, temp;
    Dice(int[] a) {
        this.top = a[0];
        this.front = a[4];
        this.back = a[1];
        this.left = a[3];
        this.right = a[2];
        this.down = a[5];
    }
    void rollWest() {
        this.temp = this.left;
        this.left = this.top;
        this.top = this.right;
        this.right = this.down;
        this.down = this.temp;
    }
    void rollEast() {
        this.temp = this.right;
        this.right = this.top;
        this.top = this.left;
        this.left = this.down;
        this.down = this.temp;
    }
    void rollSouth() {
        this.temp = this.back;
        this.back = this.top;
        this.top = this.front;
        this.front = this.down;
        this.down = this.temp;
    }
    void rollNorth() {
        this.temp = this.front;
        this.front = this.top;
        this.top = this.back;
        this.back = this.down;
        this.down = this.temp;
    }
    int getTop() {
        return this.top;
    }
    int getFront() {
        return this.front;
    }
    int getBack() {
        return this.back;
    }
    int getRight() {
        return this.right;
    }
    int getLeft() {
        return this.left;
    }
}


Measured memory_bytes: 26160
#include<stdio.h>
#include<iostream>
#include<vector>
#include <bits/stdc++.h>
#include <queue>
#include <algorithm>
#include <string>

using namespace std;
typedef long long ll;

#define rep(i,n) for(ll i=0; i<(ll)(n); i++)

int main(){
  ll n; cin>>n;
  vector<ll> ans;
  if(n==0){
    cout<<0;
    return 0;
  }
  while(n!=0){
    // cout<<n<<endl;
    int r = abs(n)%2;
    ans.push_back(r);
    n-=r;
    n/=-2;
  }
  reverse(ans.begin(),ans.end());
  rep(i,ans.size()) cout<<ans[i];

    
  
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
using namespace std;
typedef long long ll;
ll a, b, c, i, j, k;
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> a >> b >> i >> j;
	cin >> c;
	a = abs(a - i);
	b = (b-j)* c;
	if (a <= b)
		cout << "YES";
	else
		cout << "NO";
}

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

bool is_valid_month(int n) {
  if (n > 0 && n <= 12) return true;
  return false;
}


int main () {
  int n;
  cin >> n;
  int a = n / 100;
  int b = n %100;
  if (is_valid_month(a) && is_valid_month(b)) {
    cout << "AMBIGUOUS" << endl;
  } else if (is_valid_month(a)) {
    cout << "MMYY" << endl;
  } else if (is_valid_month(b)) {
    cout << "YYMM" << endl;
  } else {
    cout << "NA" << endl;
  }
  
}


Measured memory_bytes: 256
package main

import (
	"fmt"
	"strings"
)

func main() {
	var n int
	var s string
	fmt.Scan(&n, &s)

	all := strings.Count(s, "R") * strings.Count(s, "G") * strings.Count(s, "B")
	//fmt.Println("all :", all)

	for i := 0; i < n; i++ {
		for j := i + 1; j < n; j++ {
			k := j*2 - i
			//fmt.Println("i:", i, "j:", j, "k:", k)
			if s[i] == s[j] {
				continue
			}
			if k >= n || s[k] == s[i] || s[k] == s[j] {
				continue
			}
			//fmt.Println("exclude i:", i, "j:", j, "k:", k)
			all--
		}
	}
	fmt.Println(all)
}


Measured memory_bytes: 1896
#include "iostream"
#include "algorithm"
#include "string"
#include "vector"
#include "cmath"
#define mod 1000000007
#define Endl endl
using namespace std;

int main() {
	int w, a, b;
	cin >> w >> a >> b;
	cout << ((a <= b&&b <= a + w) || (b <= a&&a <= b + w) ? 0 : min(abs(b - (a + w)), abs(a - (b + w)))) << Endl;
	return 0;
}

Measured memory_bytes: 256
import Foundation
import CoreFoundation

#if swift(>=4.0)
extension String {
    func split(by separator: String) -> [String] {
        return self.components(separatedBy: separator)
    }
    func toArray() -> [String] {
        return self.map{String($0)}
    }
}
func exponentiate(_ lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#else
extension String {
    func split(by separator: String) -> [String] {
        return self.componentsSeparatedByString(separator)
    }
    var count: Int {
        return self.characters.count
    }
    func toArray() -> [String] {
        return self.characters.map{String($0)}
    }
    func uppercased() -> String {
        return self.uppercaseString
    }
    func lowercased() -> String {
        return self.lowercaseString
    }
}
//extension Array where Element == String {
//    func joined(separator separator: String) -> String {
//        return self.joinWithSeparator(separator)
//    }
//}
extension Array where Element: Comparable {
    func max() -> Element? {
        return self.maxElement()
    }
    func min() -> Element? {
        return self.minElement()
    }
    func sorted() -> Array {
        return self.sort()
    }
    mutating func sort() {
        self.sortInPlace()
    }
}
extension Array {
    func reversed() -> Array {
        return self.reverse()
    }
    func enumerated() -> EnumerateSequence<[Element]> {
        return self.enumerate()
    }
    init(repeating: Element, count: Int) {
        self.init(count: count, repeatedValue: repeating)
    }
}
func stride<T: Strideable>(from start: T, to end: T, by stride: T.Stride) -> StrideTo<T> {
    return start.stride(to: end, by: stride)
}
func exponentiate(lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#endif
func readInt() -> Int? {
    return Int(readLine()!)
}
func readStringSplit(by separator: String) -> [String] {
    return readLine()!.split(by: separator)
}
func readIntSplit(by separator: String) -> [Int] {
    return readLine()!.split(by: separator).map{Int($0)!}
}
//func gcd(x: Int, _ y: Int) -> Int {
//    return y>0 ? gcd(y, x%y) : x
//}
//func lcm(x: Int, _ y: Int) -> Int {
//    return x * y / gcd(x, y)
//}

/*************** テストスペース ***************/

//arr.sort{$0.0==$1.0 ? $0.1<$1.1 : $0.0<$1.0}  // 2つの条件に優先順位をつけてソート

/*************** メインプログラム ***************/

let input = readIntSplit(by: " ")
let (N, D) = (input[0], input[1])
var X = [[Int]]()
for _ in 0..<N {
    X += [readIntSplit(by: " ")]
}
var ans = 0
for i in 0..<N {
    for j in i+1..<N {
        let tmp = (0..<D).reduce(0.0){$0 + pow(Double(X[i][$1]-X[j][$1]), 2.0)}
        let dist = sqrt(tmp)
        if dist == floor(dist) {
            ans += 1
        }
    }
}
print(ans)


Measured memory_bytes: 4592
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <random>
#include <tuple>
#include <iomanip>
#include <cstring>

using namespace std;

typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define revrep(i, n) for(ll i = (n-1); i >= 0; i--)
#define pb push_back
#define f first
#define s second
const ll INFL = 1LL << 60;//10^18 = 2^60
const int INF = 1 << 30;//10^9
ll MOD = 1000000007;
//ll MOD  = 998244353;
vector<ll> dy = {0, 0, 1, -1, 1, 1, -1, -1, 0};
vector<ll> dx = {1, -1, 0, 0, 1, -1, 1, -1, 0};

ll max(ll a, ll b){return (a > b) ? a : b;}
ll min(ll a, ll b){return (a < b) ? a : b;}

ll pow_long(ll x, ll k){
  ll res = 1;
  while(k > 0){
    if(k % 2) res *= x;
    x *= x;
    k /= 2;
  }
  return res;
}
ll pow_mod(ll x, ll k){
  x %= MOD; x += MOD; x %= MOD;
  ll res = 1;
  while(k > 0){
    if(k % 2){
      res *= x; res %= MOD;
    }
    x *= x; x %= MOD;
    k /= 2;
  }
  return res;
}

ll inverse(ll x){return pow_mod(x, MOD - 2);};

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

ll lcm(ll x, ll y){return x / gcd(x, y) * y;};

ll kai_mod(ll x){
  if(x == 0) return 1;
  return x * kai_mod(x-1) % MOD;
}

/*
//コンビネーション
const int MAXcomb = 200010;
ll fac[MAXcomb], finv[MAXcomb], inv[MAXcomb];
//facはn!,finvは1/n!
//invは逆元
void COMinit(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < MAXcomb; i++){
        fac[i] = fac[i-1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
        finv[i] = finv[i-1] * inv[i] % MOD;
    }
}
ll comb(int n, int k){
    if(n < k) return 0;
    if(n < 0 || k < 0) return 0;
    return fac[n] * finv[k] % MOD * finv[n-k] % MOD;
}
*/

int main(){
  ll K, A, B;
  cin >> K >> A >> B;
  if(B - A <= 2){
    cout << K + 1 << endl;
    return 0;
  }

  ll now = 1;
  if(now + K >= A){
    K -= A - now;
    now = A;
  }else{
    now += K;
    K = 0;
  }

  if(K % 2){
    K--;
    now++;
  }

  now += (B - A) * (K / 2);
  cout << now << endl;


}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define pi pair<int, int>
#define vi vector<int>
#define pll pair<ll, ll>
#define pb push_back
#define mod 1000000007
using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	// int t;
	// cin>>t;
	// while(t--){
		
	// }
	int h, n;
	cin>>n>>h;
	int a[n];
	for(int i = 0; i < n; i++){
		cin>>a[i];
	}
	sort(a, a + n);
	ll ans = 0;
	for(int i = 0; i < n - h; i++){
		ans += a[i];
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1024