akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;

namespace _129
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine().Trim().Split(' ');
            int p, q, r;
            p = int.Parse(s[0]);
            q = int.Parse(s[1]);
            r = int.Parse(s[2]);
            var intNum = new int[] { p, q, r };
            Console.WriteLine(p + q + r - intNum.Max());
        }
    }
}


Measured memory_bytes: 11220
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>

#define mp make_pair
#define x first
#define y second
#define pb push_back
using namespace std;

const int N = 25;
int n, a[N], b[N], c[N], sum;

int main()
{
    cin >> n;
    for(int i=1; i<=n; ++i) cin >> a[i];
    for(int i=1; i<=n; ++i) cin >> b[i];
    for(int i=1; i<n; ++i) cin >> c[i];

    for(int i=1, j=-1; i<=n; ++i) {
        if (j+1 == a[i]) sum += c[j];
        sum += b[a[i]]; j = a[i];
    }
    cout << sum;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <algorithm>
using namespace std;
using ll = long long;

int main() {
  int N;
  cin >> N;
  vector<ll> a(N), b(N);
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < N; i++) {
    cin >> b[i];
  }
  ll m = 0, p = 0;
  for (int i = 0; i < N; i++) {
    ll c = a[i] - b[i];
    if (c < 0) {
      m += -c / 2;
    } else {
      p += c;
    }
  }
  bool res = p <= m;
  cout << (res ? "Yes" : "No") << endl;
  return 0;
}


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

using namespace std;

int main()
{
    string s1,s2;
    cin>>s1>>s2;
    int ans=0;
    int len=(int)s1.length();
    for(int i=0;i<len;i++){
        if(s1[i]!=s2[i])
            ans++;
    }
    cout<<ans<<"\n";
    return 0;
}

Measured memory_bytes: 3880
#include<string>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include <iomanip>
#include<cmath>
#include<stack>
#include <algorithm>
#include<cstdio>
#include <cstring>
#include <iostream>
#define inf 0n7fffffff
using namespace std;
int main()
{
    string ch[1010];
    int n,d;
    cin>>n>>d;
    for(int i=1;i<=n;i++)
        cin>>ch[i];
    sort (ch+1,ch+n+1);
    for(int i=1;i<=n;i++)
        cout<<ch[i];
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  string S[3];cin >> S[0] >> S[1] >> S[2];
  int index[3] = {0,0,0};
  int turn = 0;
  map<char,int> mp;
  mp['a'] = 0;
  mp['b'] = 1;
  mp['c'] = 2;
  while(true){
    if(index[turn] == S[turn].length()){
      cout << (char)('A'+turn) << endl;
      break;
    }
    turn = mp[S[turn][index[turn]++]];
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define inf 1000000000
#define md 1000000007
#define pb push_back
#define li 100005
#define lo long long
using namespace std;
int n;
char s[55];
int main(){
	scanf("%d",&n);
	scanf("%s",s+1);
	int cev=0;
	for(int i=3;i<=n;i++){
		if(s[i-2]=='A' && s[i-1]=='B' && s[i]=='C') cev++;
	}
	printf("%d\n",cev);
	return 0;
}






Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>
#include <numeric>

using namespace std;

#define mod 1000000007

int main()
{
	int r;
	cin >> r;
	cout << 3 * r * r << endl;
}

Measured memory_bytes: 256
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ll long long
#define maxn 1000005
#define inf 1e18
#define eps 1e-10
using namespace std;

inline ll read()
{
	ll x=0,w=1; char c=getchar();
	while(c<'0'||c>'9') {if(c=='-') w=-1; c=getchar();}
	while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
	return w==1?x:-x;
}

ll a[maxn];

inline ll wk(ll x,ll y)
{
	if(x*y>0)
	{
		if(x<0) return -x;
		else return y;
	}
	return min(-x+2*y,y-2*x);
}

int main()
{
	ll n=read(),k=read(),ans=inf;
	for(int i=1;i<=n;i++) a[i]=read();
	for(int i=1;i<=n-k+1;i++) ans=min(ans,wk(a[i],a[i+k-1]));
	cout<<ans<<endl;
	return 0;
}

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

using namespace std;

#define fcout(d) cout << fixed << setprecision(d)
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define rep1(i,n) for(int (i) = 1; (i) <= (n); ++(i))
#define repU(i,bottom,ceiling) for(int (i) = (bottom); (i) <= (ceiling); ++(i))
#define repD(i,ceiling,bottom) for(int (i) = (ceiling); (i) >= (bottom); --(i))
#define pub push_back
#define pob pop_back
#define prf printf
#define scf scanf
#define mkp make_pair
#define fir first
#define sec second
#define clr(a) memset((a),0,sizeof(a))
#define all(a)  begin((a)),end((a))

typedef long long ll;
typedef unsigned long long ull;
typedef double db;

const vector<pair<int,int>> DIR = { {1,0},{0,1},{-1,0},{0,-1},{1,1},{-1,1},{-1,-1},{1,-1} };
const int INF = -1 + (1<<30);
const int MOD = (int)1e9 + 7;

template<typename T> inline T gcd(T a,T b){ if(a % b){ return gcd(b,a % b); }else{ return b; } }

template<typename T> inline T lcm(T a,T b){ return a / gcd(a,b) * b; }

inline long long Pow(const long long n,long long m,const int mod = MOD){
	long long res = 1,pow = n;
	while(m) {
		if(m & 1) res = (res * pow) % mod;
		pow = (pow * pow) % mod;
		m >>= 1;
	}
	return res;
}

inline vector<long long> Frac(const int range,const int mod = MOD){
	vector<long long> frac;
	frac.push_back(1);
	for(int i = 1; i <= range; ++i) frac.push_back((long long)frac.back() * i % mod);
	return frac;
}

inline long long Comb(const int n,const int m,const int mod = MOD){
	if(n < m || m < 0) return 0;
	vector<long long> frac(Frac(n,mod));
	long long rev = Pow((long long)frac[m] * frac[n-m] % mod,mod-2,mod);
	return rev * frac[n] % mod;
}

template<typename T> inline bool v_find(const vector<T> v,const T obj){
	auto itr = find(v.begin(), v.end(), obj);
	size_t index = distance(v.begin(),itr);
	if (index != v.size()) { return true; }
	return false; 
}

template<typename T> inline bool v_erase(vector<T> &v,const T obj){
	auto itr = find(v.begin(), v.end(), obj);
	size_t index = distance(v.begin(),itr);
	if (index != v.size()) {
		v.erase(itr);
		return true;
	}
	return false;	
}

template<class T,class U> inline auto LB(const T v,const U in){ return lower_bound(v.begin(),v.end(),in); }

template<class T,class U> inline auto UB(const T v,const U in){ return upper_bound(v.begin(),v.end(),in); }

inline unsigned long long next_subset(unsigned long long subset){
	unsigned long long tem = subset + (subset & -subset);
	unsigned long long btm = (~tem & subset) / (subset & -subset) >> 1;
	return btm | tem;
}

ll n,a[200005],s[200005]={};

inline void solve(){
	ll ans=2e18,m,M;
	cin>>n;
	s[0]=0;
	rep(i,n){ cin>>a[i]; s[i+1]=s[i]+a[i]; }
	int l=1,r=3;
	repU(i,2,n-2){
		while(s[l]*2<s[i]) ++l;
		while(s[r]-s[i]<s[n]-s[r]) ++r;
		rep(j,2)rep(k,2){
			M=max(max(s[l-j],s[i]-s[l-j]),max(s[r-k]-s[i],s[n]-s[r-k]));
			m=min(min(s[l-j],s[i]-s[l-j]),min(s[r-k]-s[i],s[n]-s[r-k]));
			ans=min(ans,M-m);
		}
	}
	cout<<ans<<endl;
	return;
}

inline void input(){

	return;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	input();
	solve();
	return 0;
}





Measured memory_bytes: 3328
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <set>
#include <vector>

#define rep2(i, b, n) for(int i=b; i < n; ++i)
#define repm(i, b, n) for(int i=b; i > n; --i)
#define rep(i, n) rep2(i, 0, n)

using namespace std;

int cross_product( int x1, int y1, int x2, int y2 )
{
	return ((x1 * y2) - (x2 * y1));
}

int main( void )
{
	int n;
	
	while (cin >> n)
	{
		for (int i=0; i < n; ++i)
		{
			int x1, y1, x2, y2, x3, y3, xk, yk, xs, ys;
			cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3
				>> xk >> yk >> xs >> ys;
			
			int v1, v2, v3, v4, v5, v6;
		
			v1 = cross_product((x2-x1), (y2-y1), (xk-x1), (yk-y1));
			v2 = cross_product((x3-x2), (y3-y2), (xk-x2), (yk-y2));
			v3 = cross_product((x1-x3), (y1-y3), (xk-x3), (yk-y3));
		
			v4 = cross_product((x2-x1), (y2-y1), (xs-x1), (ys-y1));
			v5 = cross_product((x3-x2), (y3-y2), (xs-x2), (ys-y2));
			v6 = cross_product((x1-x3), (y1-y3), (xs-x3), (ys-y3));
			if (((v1 > 0) && (v2 > 0) && (v3 > 0) &&
				((v4 < 0) || (v5 < 0) || (v6 < 0))) ||
				((v4 > 0) && (v5 > 0) && (v6 > 0) &&
				((v1 < 0) || (v2 < 0) || (v3 < 0))) ||
				((v1 < 0) && (v2 < 0) && (v3 < 0) &&
				((v4 > 0) || (v5 > 0) || (v6 > 0))) ||
				((v4 < 0) && (v5 < 0) && (v6 < 0) &&
				((v1 > 0) || (v2 > 0) || (v3 > 0))) 
				)
			{
				cout << "OK" << endl;
			}
			else
			{
				cout << "NG" << endl;
			}
		}
	}
	
	return 0;
}

Measured memory_bytes: 1156
#include <stdio.h>
 
int main()
{ int n, l;
 scanf("%d %d",&n,&l) ;
 char array[n+n];
 scanf("%s",array);
 array[l-1] = (array[l-1] - 'A') + 97 ;
 puts(array);
 return(0);
}
 

Measured memory_bytes: 128
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;

using namespace std;
using Graph = vector<vector<Int>>;

const double pi = M_PI;
const Int MOD = 1000000007;

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

    Int ans = 0;
    for (int i = 1; i <= k; i++) {
        for (int j = 1; j <= k; j++) {
            for (int l = 1; l <= k; l++) {
                int t = gcd(i, j);
                t = gcd(t, l);
                ans += t;
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define e1 first
#define e2 second
#define pb push_back
#define mp make_pair
#define boost ios_base::sync_with_stdio(false)
#define eb emplace_back
#define OUT(x) {cout << x; exit(0); }
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define scanf(...) scanf(__VA_ARGS__)?:0
typedef long long int ll;
typedef unsigned long long ull;
typedef pair <int, int> PII;
typedef pair <ll, ll> PLL;
typedef pair <PLL, int> PLLI;
typedef pair <PLL, PLL> PP;
typedef pair <PII, int> PPI;
typedef pair <ll, int> PLI;
typedef unsigned int ui;
const int inf = 1e9+9;
const int mod = 924844033;
#define maxn 200100
int tab[maxn], val[maxn];
int ile[30][maxn];
vector <int> cykl;
bool odw[maxn];
vector <int> graf[maxn];

int findNim(int x, int par) {
	int st = 0;
	while (ile[st][x]) ++st;
	if (par) ++st;
	while (ile[st][x]) ++st;
	return st;
}

void dfs(int x, int start)
{
	for (auto u : graf[x])
	{
		dfs(u, start);
		ile[val[u]][x]++;
	}
	if (x != start) val[x] = findNim(x, 0);
}
int n;
bool check()
{
	FOR(j, 0, 19)
		FOR(i, 1, n) ile[j][i] = 0;
	FOR(i, 1, n)
		ile[val[i]][tab[i]]++;
		
	FOR(i, 1, n)
		if (findNim(i, 0) != val[i]) return 0;
		
	FOR(i, 1, n)
		if (val[i] == val[tab[i]]) return 0;
	return 1;
}

int main()
{
	boost;
	cin >> n;
	FOR(i, 1, n) cin >> tab[i];
	int gdzie = 1;
	FOR(i, 1, n) gdzie = tab[gdzie];
	while (!odw[gdzie])
	{
		cykl.pb(gdzie);
		odw[gdzie] = 1;
		gdzie = tab[gdzie];
	}
	
	FOR(i, 1, n)
		if (!(odw[i] && odw[tab[i]])) graf[tab[i]].pb(i);
	
	for (auto u : cykl) dfs(u, u);
	//determined everything that is not on the cycle
	int sz = (int)cykl.size(), akt = cykl[sz - 1];
	val[akt] = findNim(akt, 0);
	ile[val[akt]][cykl[0]]++;
	for (int i=0; i<sz-1; ++i)
	{
		val[cykl[i]] = findNim(cykl[i], 0);
		ile[val[cykl[i]]][cykl[i + 1]]++;
	}

	if (check()) OUT("POSSIBLE");
	FOR(j, 0, 19)
		FOR(i, 1, n) ile[j][i] = 0;
	FOR(i, 1, n) val[i] = 0;
	
	for (auto u : cykl) dfs(u, u);
	sz = (int)cykl.size(), akt = cykl[sz - 1];
	val[akt] = findNim(akt, 1);
	ile[val[akt]][cykl[0]]++;
	for (int i=0; i<sz-1; ++i)
	{
		val[cykl[i]] = findNim(cykl[i], 0);
		ile[val[cykl[i]]][cykl[i + 1]]++;
	}
	if (check()) OUT("POSSIBLE");
	cout << "IMPOSSIBLE";
}


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

// header area
void func(vector<vector<char>> c, int depth){
    if(depth == H+W){
        // count black
        int count_black=0;
        rep(i, H){
            rep(j, W){
                if(c[i][j] == '#') count_black++;
            }
        }
        if(count_black == K) ans++;
    }
    else{
        // not
        func(c, depth+1);
        // do
        if (H > depth){
            // 行固定
            int gyo = depth;
            rep(k, W){
                if(c[gyo][k] == '#'){
                    c[gyo][k] = 'r';
                }
            }
        }
        else if(H+W > depth){
            // 列固定
            int retsu = depth-H;
            rep(k, H){
                if(c[k][retsu] == '#'){
                    c[k][retsu] = 'r';
                }
            }
        }
        else{
            cout << "error."  << endl;
        }
        func(c, depth+1);

    }
}

int main(){
    cin >> H >> W >> K;

    int count_black=0;
    vector<vector<char>> origin;
    rep(i, H){
        vector<char> tmp_vec;
        rep(j, W){
            char tmp; cin >> tmp;
            if(tmp == '#') count_black++;
            tmp_vec.push_back(tmp);
        }
        origin.push_back(tmp_vec);
    }
    vector<vector<char>> c(origin.size());
    copy(origin.begin(), origin.end(), c.begin());
    func(c, 0);

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3664
#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 vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define SUBS(s,f,t) ((s).substr((f),(t)-(f)))
#define ALL(a) (a).begin(),(a).end()
#define Max(a) (*max_element(ALL(a)))
#define Min(a) (*min_element(ALL(a)))
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll x,y;cin>>x>>y;
  for(ll i=0;i<=x;i++){
    if(i*2 + (x-i)*4 == y){
      cout<<"Yes"<<endl;
      return 0;
    }
  }
  cout<<"No"<<endl;
  return 0;
}

Measured memory_bytes: 3648
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
int gcd(int a,int b){
	if(b==0)
	return a;
	else
	return gcd(b,a%b);
}
int main(){
	int n;
	int sum=0;
	int a[3000];
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	for(int i=0;i<n;i++){
		sum+=a[i]-1;
	}
	printf("%d",sum);
	
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace AtCoder_Project_CSharp
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var a = Console.ReadLine().Split().Select(int.Parse).ToArray();
            //true : 偶数 ,false : 奇数
            var a_isEven = a.Select(e => e % 2 == 0).ToArray();
            //奇数個
            var a_ = a_isEven.Select(e => e ? 2 : 1).ToArray();
            var c = a.Select(e => e % 2 == 0 ? 0 : 1).ToArray();

            var a_acum = a_.Aggregate((e, f) => e * f);

            var result = (long)Math.Pow(3, n) - a_acum;

            Console.WriteLine(result);
        }
    }
}


Measured memory_bytes: 13396
#include <iostream>

#define reep(i,n,m) for(int i=(n);i<(m);i++)
#define rep(i,n) reep(i,0,n)

using namespace std;

int main(){
    int n;
    while(cin >> n,n){
        int dp[35]={0};
        dp[0]=1;
        rep(i,n){
            dp[i+1] += dp[i];
            dp[i+2] += dp[i];
            dp[i+3] += dp[i];
        }

        cout << dp[n]/(365*10)+1 << endl;
    }
    return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef pair<ll, ll> PP;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define rrep(i, n) for(ll i = n - 1; i > -1; i--)
#define all(v) v.begin(), v.end()
#define pb push_back
#define fi first
#define se second
#define debug(V) rep(i, V.size()) cout << V[i] << " ";
const ll INF = 1LL << 61;
const ll MOD = 1000000007 /*988244353*/;
const ll MAX_N = 500010;
ll a, b, c, d, e, f, h, x, y, z, p, q, m, n, t, r, k, w, l, ans, i, j;
string S, T;
vl A, B;
ll masu[100][100];
void solve() {
    vl tate(100, 0), yoko(100, 0);

    rep(i, h) {
        a = 0;
        rep(j, w) {
            if(masu[i][j])
                a++;
        }

        if(a == 0)
            yoko[i] = 1;
    }

    rep(i, w) {
        a = 0;
        rep(j, h) {
            if(masu[j][i])
                a++;
        }

        if(a == 0)
            tate[i] = 1;
    }

    rep(i, h) {
        rep(j, w) {
            if(tate[j] == 0 && yoko[i] == 0) {
                cout << (masu[i][j] ? "#" : ".");
            }
        }
        if(yoko[i] == 0)
            cout << endl;
    }
}
int main() {
    // cout<<fixed<<setprecision(15);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> h >> w;
    rep(i, h) {
        cin >> S;
        rep(j, w) {
            if(S[j] == '#') {
                masu[i][j] = 1;
            } else
                masu[i][j] = 0;
        }
    }
    solve();
}

Measured memory_bytes: 384
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

n = int(input())
div1 = make_divisors(n)
div2 = [0] * len(div1)
for i in range(len(div1)):
    div2[i] = n // div1[i]

pair = [0] * len(div1)
for i in range(len(div1)):
    pair[i] = (div1[i], div2[i])

ans = 100000
for i in pair:
    ans = min(ans, max(len(str(i[0])), len(str(i[1]))))
print(ans)

Measured memory_bytes: 3316
M,D = map(int,input().split())
if D < 20:
	print(0)
	exit()
m = [0 for i in range(M+1)]

for i in range(22, D+1):
	d10 = i // 10
	d1 = i % 10
	if d10 >= 2 and d1 >= 2 and d1*d10 <= M:
		m[d1*d10] += 1

print(sum(m))

Measured memory_bytes: 3316
import java.util.Scanner;
public class Main {
    static long cnt = 0;
    public static void main (String[] args) {
	Scanner scan = new Scanner(System.in);
	int n = Integer.parseInt(scan.nextLine());
	int[] a = new int[n];
	String[] inputArray = scan.nextLine().split(" ");
	for (int i = 0; i < n; i++) {
	    a[i] = Integer.parseInt(inputArray[i]);
	}
	mergeSort(a, 0, a.length);
	System.out.println(cnt);
    }
    public static void merge(int[] a, int left, int mid, int right) {
	int n1 = mid - left;
	int n2 = right - mid;
	int[] L = new int[n1+1];
	int[] R = new int[n2+1];
	for (int i = 0; i < n1; i++) {
	    L[i] = a[left + i];
	}
	for (int i = 0; i < n2; i++) {
	    R[i] = a[mid + i];
	}
	L[n1] = Integer.MAX_VALUE;
	R[n2] = Integer.MAX_VALUE;
	int i = 0, j = 0;
	for (int k = left; k < right; k++) {
	    if (L[i] <= R[j]) {
		a[k] = L[i];
		i = i + 1;
		cnt += j;
	    } else {
		a[k] = R[j];
		j = j + 1;
	    }
	}
    }
    public static void mergeSort(int[] a, int left, int right) {
	if (left + 1 < right) {
	    int mid = (left + right) / 2;
	    mergeSort(a, left, mid);
	    mergeSort(a, mid, right);
	    merge(a, left, mid, right);
	}
    }
}

Measured memory_bytes: 78548
n = int(input())
c = list(input())
rcnt = 0
allrcnt = 0
for i in range(len(c)):
    if c[i]=='R':
        allrcnt += 1
for i in range(len(c)):
    if i+1<=allrcnt and c[i]=='R':
        rcnt += 1

ans = allrcnt-rcnt

print(ans)

Measured memory_bytes: 10632
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
fn main() {
    input! {
        n: usize,
        m: usize,
        ab: [(usize1, usize1); m],
        }
        let mut v = vec![0; n];
        for i in 0..ab.len() {
            v[ab[i].0]+=1;
            v[ab[i].1]+=1;
        }
        for i in 0..v.len() {
            println!("{}", v[i]);
        }
}

Measured memory_bytes: 4352
#include "bits/stdc++.h"
using namespace std;
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define ALL(s) s.begin(),s.end()
const int M=100010;
const int MOD=1000000007;
const int INF=1000000007;
using ll=long long;

long double zyou(int x){
	long double ans=1;
	while(x!=0){
		ans/=2;
		x--;
	}
	return ans;
}

int main() {
	long double n,k,ans=0,tmp=-1;
	cin>>n>>k;
	rep(i,1,n+1){
		int cnt=0;
		tmp=i;
		while(tmp<k){
			tmp*=2;
			cnt++;
			if(tmp>=k){
	//	cout<<zyou(cnt)<<"##";
				ans+=(1/n)*zyou(cnt);
	//  cout<<i<<" "<<tmp<<" "<<ans<<endl;
			}
		}
		if(i>=k)ans+=1/n;
	}
	cout<<setprecision(12)<<ans<<endl;
}


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

int main(){
    string s, ans;
    cin >> s;
    if(s == "Sunny") ans = "Cloudy";
    if(s == "Cloudy") ans = "Rainy";
    if(s == "Rainy") ans = "Sunny";
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <numeric>

using namespace std;

long long gcd(long long a, long long b)
{
	return b == 0 ? a : gcd(b, a % b);
}

int main()
{
	int N, X;
	cin >> N >> X;
	vector<long long> x(N);
	for (auto& x_i : x) {
		cin >> x_i;
		x_i -= X;
	}
	auto D = abs(accumulate(x.begin(), x.end(), x[0], gcd));
	cout << D << endl;
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>
#include <queue>
#include <string>
#include <map>
#include <set>

using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORIT(it, c) for (__typeof((c).begin())it = (c).begin(); it != (c).end(); it++)
#define MEMSET(v, h) memset((v), h, sizeof(v))

struct State {
  int px;
  int py;
  int cx;
  int cy;
  int cost;
  State() {;}
  State(int px, int py, int cx, int cy, int cost) :
    px(px), py(py), cx(cx), cy(cy), cost(cost) {;}
  bool operator<(const State &rhs) const {
    return cost > rhs.cost;
  }
};
int w, h;
int field[30][30];
bool visit[10][10][10][10];

int main() {
  int w, h;
  while (scanf("%d %d", &w, &h), w|h) {
    int cx, cy, px, py, gx, gy;
    MEMSET(visit, false);
    REP(y, h) {
      REP(x, w) {
        scanf("%d", &field[y][x]);
        if (field[y][x] == 2) { cx = x; cy = y; field[y][x] = 0; }
        if (field[y][x] == 3) { gx = x; gy = y; field[y][x] = 0; }
        if (field[y][x] == 4) { px = x; py = y; field[y][x] = 0; }
      }
    }
    priority_queue<State> que;
    que.push(State(px, py, cx, cy, 0));
    while (!que.empty()) {
      State s = que.top();
      que.pop();
      if (visit[s.py][s.px][s.cy][s.cx]) { continue; }
      visit[s.py][s.px][s.cy][s.cx] = true;
      if (s.cx == gx && s.cy == gy) {
        printf("%d\n", s.cost);
        goto next;
      }
      REP(dir, 4) {
        const int dx[4] = { 1, 0, -1, 0 };
        const int dy[4] = { 0, 1, 0, -1 };
        int npx = s.px + dx[dir];
        int npy = s.py + dy[dir];
        if (npx < 0 || npx >= w || npy < 0 || npy >= h) { continue; }
        if (field[npy][npx] == 1) { continue; }
        int ncx = s.cx;
        int ncy = s.cy;
        int ncost = s.cost;
        if (npx == s.cx && npy == s.cy) {
          ncx = s.cx + dx[dir];
          ncy = s.cy + dy[dir];
          if (ncx < 0 || ncx >= w || ncy < 0 || ncy >= h) { continue; }
          if (field[ncy][ncx] == 1) { continue; }
          ncost++;
        }
        que.push(State(npx, npy, ncx, ncy, ncost));
      }
    }
    puts("-1");
next:;
  }
}

Measured memory_bytes: 0
import string

N = int(input())
S = input()

# string.ascii_uppercase を覚えよう
a = string.ascii_uppercase
# a = ABCDEFGHIJKLMNOPQRSTUVWXYZ

ans = ''
for s in S:
  num = (a.index(s) + N) % len(a)
  ans += a[num]
  
print(ans)  



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

#define pb push_back
#define mp make_pair
#define sz(x) (int)(x).size()
#define ll long long
#define ld long double
#define ft first
#define sc second
#define pii pair<int, int>
#define pll pair<ll, ll>
#define forn(i, t) for(int i = 0; i < (t); i++)
#define fore(i, f, t) for(int i = (f); i < (t); i++)
#define forr(i, f, t) for(int i = (f) - 1; i >= (t); i--)
#define all(x) (x).begin(), (x).end()
#define ins insert

const int INF = 2147483647;
const int MOD = 1000000007;
const ll INF64 = 9223372036854775807;
const ld EPS = 1e-7;

using namespace std;


int main(){
    int n;
    scanf("%d", &n);
    vector<int> a(n), b(n), r(n, -1);
    forn(i, n){
        scanf("%d", &a[i]);
        if (!i || a[i] != a[i - 1]){
            r[i] = a[i];
        }
    }
    forn(i, n)
        scanf("%d", &b[i]);
    forr(i, n, 0)
        if (i == n - 1 || b[i] != b[i + 1]){
            if (a[i] < b[i] || (r[i] != -1 && a[i] != b[i])){
                printf("0\n");
                return 0;
            }
            r[i] = b[i];
        }
    ll ans = 1;
    forn(i, n)
        if (r[i] == -1)
            ans = (ans * min(a[i], b[i])) % MOD;
    printf("%I64d\n", ans);
    return 0;
}

Measured memory_bytes: 1536
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define INF (1e9+1)
//#define INF (1LL<<59)

int main(){
	int n,m,k;
	cin>>n>>m>>k;
	vector<int> d(m);
	rep(i,m){
		cin>>d[i];
		d[i]--;
	}
	vector<vector<int>> v(n,vector<int>(k));
	rep(i,n){
		rep(j,k){
			cin>>v[i][j];
			v[i][j]--;
		}
	}
	
	int dp[1<<16];
	rep(i,1<<16)dp[i] = INF;
	dp[(1<<m)-1]=0;

	queue<ll> que;
	vector<bool> used(1<<16,false);
	que.push( (1<<m)-1 );
	used[(1<<m)-1]=true;

	while(que.size()){
		int q = que.front();
		que.pop();
		
		rep(i,k){
			int t=0;
			rep(j,m){
				if( q & (1<<j) ){
					int next_room = v[d[j]][i];
					int to = -1;
					rep(l,m){
						if(d[l]==next_room)to = l;
					}
					if(to!=-1)t|=1<<to;
				}
			}
			if(!used[t])que.push(t);
			used[t] = true;
			dp[t] = min(dp[q]+1,dp[t]);
		}
	}
	cout<<dp[0]<<endl;
}

Measured memory_bytes: 3556
x = int(input())

def k(x):
	if x >= 1800: return 1
	if x >= 1600: return 2
	if x >= 1400: return 3
	if x >= 1200: return 4
	if x >= 1000: return 5
	if x >= 800: return 6
	if x >= 600: return 7
	if x >= 400: return 8

print(k(x))

Measured memory_bytes: 61876
var
	n,m,i,j,k,l,f,s:Longint;
	a,b:array[1..50]of String[50];
begin
	readln(n,m);
	for i:=1 to n do readln(a[i]);
	for j:=1 to m do readln(b[j]);
	for i:=0 to n-m do for j:=0 to n-m do begin
		f:=1;
		for k:=1 to m do for l:=1 to m do
			if a[i+k][j+l]<>b[k][l] then f:=0;
		inc(s,f);
	end;
	if s>0 then writeln('Yes')else writeln('No');
end.


Measured memory_bytes: 256
n=int(input())
w=list(map(int,input().split()))
s1=0
s2=sum(w)
i=0

while s1<=s2:
    s1+=w[i]
    s2-=w[i]
    i+=1
print(min(s1-s2,(s2+w[i-1])-(s1-w[i-1])))

Measured memory_bytes: 3064
/**
 *   @FileName	a.cpp
 *   @Author	kanpurin
 *   @Created	2020.05.17 22:11:58
**/

#include "bits/stdc++.h" 
using namespace std; 
typedef long long ll;

int main() {
    int n;
    cin >> n;
    if (n % 10 == 2 || n % 10 == 4 || n % 10 == 5 || n % 10 == 7 || n % 10 == 9) {
        puts("hon");
    } else if (n % 10 == 0 || n % 10 == 1 || n % 10 == 6 || n % 10 == 8) {
        puts("pon");
    } else {
        puts("bon");
    }
    return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define call(var) cout<<#var<<"="<<var<<endl;
using ll=long long;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using Graph = vector<vi>;
using P = pair<int,int>;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}

ll f(ll n){
    if(n%4==0) return n;
    else if(n%4==1) return 1;
    else if(n%4==2) return n+1;
    else return 0;
}

int main(){
    ll a,b;cin >> a >> b;
    if(a>0) --a;
    if(a==2) a = 3;
    else a = f(a);
    if(b==2) b = 3;
    else b = f(b);
    bitset<60> A(a),B(b);
    //cout << A << endl << B << endl;
    B ^= A;
    cout << B.to_ullong() << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <stack>
#include <map>
#include <algorithm>
#include <queue>
#include <math.h>
#include <string.h>

using namespace std;

int N;
long A[300000];
long B[300000][30];
long C[300000][30];

int main(int argc, char** argv) {
    cin >> N;
    for (int i = 1; i <= N; i++) {
        cin >> A[i];
        int a = A[i];
        for (int j = 0; j <= 20; j++) {
            B[i][j] = a % 2;
            a /= 2;
        }
    }
    for (int j = 0; j <= 20; j++) {
        int p1 = 0;
        int p2 = 0;
        for (int i = 1; i <= N; i++) {
            if (B[i][j] == 1) {
                p2 = p1;
                p1 = i;
            }
            C[i][j] = i - p2;
        }
    }
    /*
    for (int i = 1; i <= N; i++) {
        for (int j = 0; j <= 20; j++) {
            cout << B[i][j] << " ";
        }
        cout << endl;
    }
    for (int i = 1; i <= N; i++) {
        for (int j = 0; j <= 20; j++) {
            cout << C[i][j] << " ";
        }
        cout << endl;
    }
    */
    long ans = 0;
    for (int i = 1; i <= N; i++) {
        long m = 1e9;
        for (int j = 0; j <= 20; j++) {
            m = min(m, C[i][j]);
        }
        ans += m;
    }
    cout << ans << endl;
}

Measured memory_bytes: 99456
#include <iostream>

using namespace std;

int N;
long long int a[100005];
long long int C[100005];

int main(void) {

	cin >> N;
	for (int i = 1; i <= N; i++) {
		cin >> a[i];
	}

	for (int i = 1; i <= N; i++) {
		if (a[i] <= N) { C[a[i]]++; }
		else { C[N + 1]++; }
	}

	int ans = 0;
	for (int i = 1; i <= N; i++) {
		if (C[i] >= i) { ans += C[i] - i; }
		else { ans += C[i]; }
	}

	ans += C[N + 1];

	cout << ans << endl;

	//system("pause");
	return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for (ll i=0; i<n; ++i)
#define all(c) begin(c),end(c)
#define PI acos(-1)
#define oo LLONG_MAX
template<typename T1, typename T2>
bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}
template<typename T1, typename T2>
bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}
/*

*/
int main(){
  cin.tie(0);
  ios::sync_with_stdio(0);
  
  ll A, B; cin>>A >> B;
  ll ans = A * B;
  cout <<ans <<endl;
}


Measured memory_bytes: 3564
import java.util.*;
import java.lang.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		String S = sc.next();
		S = S + "a";
		long[][] num = new long[S.length()-1][S.length()+1];
		long answer = 0;
		for( int i=0; i<S.length()-1; i++ ){
			for( int j=i+1; j<S.length(); j++ ){
				String ss = S.substring(i,j);
				num[i][j] = Long.parseLong(ss);
				long a=2,b=2;
				if( i==0 || i==1 ){
					a = 1;
				}else{
					for( int m=0; m<i-2; m++ ){
						a=2*a;
					}
				}
				if( j==S.length()-2 || j==S.length()-1 ){
					b = 1;                  
                }else{                  
					for( int m=0; m<S.length()-j-3; m++ ){
						b=2*b;
					}
                }	                  
				num[i][j] *= a*b;
				answer += num[i][j];
			}
		}
		System.out.println( answer );
	}
}


Measured memory_bytes: 21716
hoge = input().split()
A = int(hoge[0])
B = int(hoge[1])

n = 0
count = 0
while 1 == 1:
  if B == 1:
    break
  if n == 0:
    n += A
    count += 1
  else:
    n += A - 1
    count += 1
  if n >= B:
    break

print(count)

Measured memory_bytes: 3064
// IO library
#include <cstdio>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>

// container library
#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>

// namespace
using namespace std;

// typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<VB> VVB;

// conversion
#define INT(c) static_cast<int>(c)
#define CHAR(n) static_cast<char>(n)
#define LL(n) static_cast<ll>(n)

// container
#define EACH(i, c) for (auto i = (c).begin(); i != (c).end(); i++)
#define SORT(c) sort((c).begin(), (c).end())
#define GSORT(c) sort((c).begin(), (c).end(), greater<decltype((c).front())>())
#define SZ(x) (INT((x).size()))
#define MEMSET(c, v) memset((c), v, sizeof(c))

// repetition
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define NREP(i, n) FOR(i, 1, n + 1)
#define RFOR(i, a, b) for (int i = (a); i >= (b); i--)
#define RREP(i, n) RFOR(i, n, 0)
#define RNREP(i, n) RFOR(i, n, 1)

// constant
// const ll MOD = 1e9 + 7;
// const int INF = 1<<25;
// const ll INF = 1LL<<50;
// const int dx[4] = {0, -1, 1, 0};
// const int dy[4] = {-1, 0, 0, 1};
// const int dx[8] = {-1, 0, 1, -1, 1, -1, 0, 1};
// const int dy[8] = {-1, -1, -1, 0, 0, 1, 1, 1};

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

// answer output
#define Yes(c) cout << ((c) ? "Yes" : "No") << endl;
#define YES(c) cout << ((c) ? "YES" : "NO") << endl;
#define yes(c) cout << ((c) ? "yes" : "no") << endl;

#define possible(c) cout << ((c) ? "possible" : "impossible") << endl;
#define POSSIBLE(c) cout << ((c) ? "POSSIBLE" : "INPOSSIBLE") << endl;


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


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

  int A, B;
  cin >> A >> B;
  VS wall(100, string(100, '.'));
  REP(i, 50) {
    REP(j, 100) {
      wall[i + 50][j] = '#';
    }
  }

  REP(i, B - 1) {
    wall[(i / 50) * 2][(i % 50) * 2] = '#';
  }
  REP(i, A - 1) {
    wall[99 - (i / 50) * 2][(i % 50) * 2] = '.';
  }

  cout << 100 << " " << 100 << endl;
  REP(i, 100) {
    cout << wall[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <assert.h>
#include <fstream>
#include <iostream>
#include <algorithm>
#include <array>
#include <vector>
#include <queue>
#include <set>
#include <cmath>
#include <unordered_map>
#include <map>
//#include <unordered_set>
//#include <boost/container/static_vector.hpp>
//#include <boost/unordered_set.hpp>
//#include <boost/unordered_map.hpp>
//#include <unistd.h>

using namespace std;
 
class DisjointSet {
    public:
        vector<int> p;
        DisjointSet() {}
        DisjointSet(int n){
            p.resize(n, 0);
            for(int i = 0; i < n; i++){
                makeSet(i);
            }
        }
        
        void makeSet(int x){
            p[x] = x;
        }
        
        bool same(int x, int y){
            return findSet(x) == findSet(y);
        }
        
        int findSet(int x){
            if(x != p[x]){
                p[x] = findSet(p[x]);
            }
            
            return p[x];
        }
        
        void unite(int x, int y){
            link(findSet(x), findSet(y));
        }
        
        void link(int x, int y){
            p[y] = x;
        }
};

const int MAX_N = 200050;
const int MAX_K = 100050;

int N, K, L;
int p[MAX_K], q[MAX_K], r[MAX_K], s[MAX_K];
 
int main(void){
    cin >> N >> K >> L;

    for (int i = 1; i <= K; i++) {
        std::cin >> p[i] >> q[i];
    }
    for (int i = 1; i <= L; i++) {
        std::cin >> r[i] >> s[i];
    }
    
    DisjointSet ds1 = DisjointSet(N+1);
    DisjointSet ds2 = DisjointSet(N+1);
    
    for(int i = 1; i <= K; i++){
        if(!ds1.same(p[i], q[i])) ds1.unite(p[i], q[i]);
    }
    
    for(int i = 1; i <= L; i++){
        if(!ds2.same(r[i], s[i])) ds2.unite(r[i], s[i]);
    }
    
    vector<pair<int, int> > com(N+1);
    map<pair<int, int>, int> S;
    for(int i = 1; i <= N; i++){
        com[i].first = ds1.findSet(i);
        com[i].second = ds2.findSet(i);
        S[com[i]] += 1;
    }
    
    for(int i = 1; i <= N; i++){
        cout << S[com[i]] << " ";
    }
    cout << endl;
    
    return 0;
    
    
}

Measured memory_bytes: 16640
#include <cstdio>
#include <vector>
#include <algorithm>
#include <tuple>

using namespace std;

int Ans[100016];
int Now[100016];

int main() {
    int N;
    scanf("%d", &N);
    vector<pair<int, int> > A, B;
    for(int n=0; n<N; ++n) {
        int a;
        scanf("%d", &a);
        A.emplace_back(a, n);
    }
    for(int n=0; n<N; ++n) {
        int b;
        scanf("%d", &b);
        B.emplace_back(b, n);
    }
    sort(A.begin(), A.end());
    sort(B.begin(), B.end());
    for(int n=0; n<N; ++n) {
        if(B[n].first<A[n].first) {
            printf("No\n");
            return 0;
        }
    }
    for(int n=1; n<N; ++n) {
        if(A[n].first<=B[n-1].first) {
            printf("Yes\n");
            return 0;
        }
    }
    for(int n=0; n<N; ++n) {
        Now[n] = n;
        Ans[B[n].second] = A[n].second;
    }
    for(int n=0; n<N-1; ++n) {
        if(Now[n]==Ans[n]) {
            printf("Yes\n");
            return 0;
        }
        int ans = Ans[n];
        for(int i=n+1; i<N; ++i) {
            if(ans==Now[i]) {
                Now[i] = Now[n];
                break;
            }
        }
    }
    printf("No\n");
    return 0;
}


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

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

	map<string, int> mp;
	
	rep(i,N){
		string s;
		cin >> s;
		sort(s.begin(), s.end());
		mp[s]++;
	}
	
	ll ans = 0;
	for(auto p : mp){
		int s = p.second;
		ans += (ll)s*(s-1)/2;
	}
	
	cout << ans << endl;

}

Measured memory_bytes: 11136
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using std::cerr;
using std::cin;
using std::cout;
using std::endl;

struct Pos{
  int x,y;
  Pos(int a,int b){
    x=a;
    y=b;
  }
};

int main(void) {
  cout << std::fixed << std::setprecision(10);
  cin.tie(0);
  std::ios::sync_with_stdio(false);
  int h,w;
  cin>>h>>w;
  std::string s[1010];
  std::string wall;
  for(int i=0;i<=1001;i++){
    wall+='#';
  }
  s[0]=wall;

  for(int si=1;si<=h;si++){
    std::string temp;
    temp+="#";
    std::string memo;
    cin>>memo;
    temp+=memo+"#";
    s[si]=temp;
  }
  s[h+1]=wall;

  int distance[1001][1001]={};
  for(int x=1;x<=h;x++){
    for(int y=1;y<=w;y++){
      distance[x][y]=INT32_MAX;
    }
  }

  std::queue<Pos> bfs;
  for(int x=1;x<=h;x++){
    for(int y=1;y<=w;y++){
      if(s[x][y]=='#'){
        bfs.push(Pos(x,y));
        distance[x][y]=0;
      }
    }
  }
  while(!bfs.empty()){
    Pos pos=bfs.front();
    bfs.pop();
    int x=pos.x,y=pos.y;
    if(s[x+1][y]=='.'){
      s[x+1][y]='#';
      distance[x+1][y]=std::min(distance[x+1][y],distance[x][y]+1);
      bfs.push(Pos(x+1,y));
    }
    if(s[x-1][y]=='.'){
      s[x-1][y]='#';
      distance[x-1][y]=std::min(distance[x-1][y],distance[x][y]+1);
      bfs.push(Pos(x-1,y));
    }
    if(s[x][y+1]=='.'){
      s[x][y+1]='#';
      distance[x][y+1]=std::min(distance[x][y+1],distance[x][y]+1);
      bfs.push(Pos(x,y+1));
    }
    if(s[x][y-1]=='.'){
      s[x][y-1]='#';
      distance[x][y-1]=std::min(distance[x][y-1],distance[x][y]+1);
      bfs.push(Pos(x,y-1));
    }
  }

  int result=0;
  for(int x=1;x<=h;x++){
    for(int y=1;y<=w;y++){
      result=std::max(result,distance[x][y]);
    }
  }
  cout<<result<<endl;


  return 0;
}


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

int N;
int A[100001];

void solve(){
	sort(A, A + N);
	int ans = 0;
	for(int i = 0; i < N; i++){
		int num = 0;
		while(A[i] == A[i + 1]){
			num++;
			i++;
		}
		if(num % 2 == 0) ans++;
	}
	printf("%d\n", ans);
}

int main(){
	scanf("%d", &N);
	for(int i = 0; i < N; i++) scanf("%d", &A[i]);
	solve();
	return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,f=1;
  cin>>n;
  char a[n];
  cin>>a;
  if(n%2==1)
  cout<<"No";
  else
  {
  for(int i=0;i<n/2;i++)
  {
    if(a[i]!=a[i+(n/2)])
    {  f=0;
      break;}
    else
      continue;
  }
  if(f==0)
    cout<<"No";
  else
    cout<<"Yes";}
}
      
      
     

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

int main(void){
    int a, b;
    cin >> a >> b;
    int sum = 0;
    rep(i, b-a){
        sum += i+1;
    }
    cout << sum-b << endl;
    return 0;
}

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

int MOD=1e9+7;

long long pow_mod(int n)
{
	long long r=1;
	for(int i=0;i<n;i++)
	{
		r*=2;
		r%=MOD;
	}
	return r;
}

int main()
{
	int n;
	int a[100000];
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	sort(a,a+n);
	//偶数の場合
	if(n%2==0)
	{
		//解の存在確認
		for(int i=0;i<n;i++)
		{
			if(a[i]!=i+1 || a[i+1]!=i+1)
			{
				cout<<0<<endl;
				return 0;
			}
			i++;
		}
		//ここまで来れたら解は存在する
		cout<<pow_mod(n/2)<<endl;
	}else{//奇数の場合
		//解の存在確認
		for(int i=0;i<n;i++)
		{
			if(i==0)
			{
				if(a[i]!=0)
				{
					cout<<0<<endl;
					return 0;
				}
			}else{
				if(a[i]!=i+1 || a[i+1]!=i+1)
				{
					cout<<0<<endl;
					return 0;
				}
				i++;
			}
		}
		//ここまで来れたら解は存在する
		cout<<pow_mod(n/2)<<endl;
	}
	return 0;
}

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

import cmath

class Point(object):
    def __init__(self, x, y):
        self.point = complex(x, y)
    def __str__(self):
        return "x = {0}, y = {1}".format(self.point.real, self.point.imag)

class Triangle(Point):
    def __init__(self, a, b, c):
        self.a = a
        self.b = b
        self.c = c
        # ３辺の長さ
        self.edgeA = abs(b.point-c.point)
        self.edgeB = abs(c.point-a.point)
        self.edgeC = abs(a.point-b.point)
        # ３角の大きさ
        self.angleA = Triangle.angle(self.edgeA, self.edgeB, self.edgeC)
        self.angleB = Triangle.angle(self.edgeB, self.edgeC, self.edgeA)
        self.angleC = Triangle.angle(self.edgeC, self.edgeA, self.edgeB)

    # 角度を求める
    def angle(A, B, C):
        return cmath.acos( (B*B+C*C-A*A)/(2*B*C) )


    # 外接円の半径
    def circumscribedCircleRadius(self):
        return abs((self.edgeA/cmath.sin(self.angleA))/2)

    # 外心
    def circumscribedCircleCenter(self):
        A = cmath.sin(2*self.angleA)
        B = cmath.sin(2*self.angleB)
        C = cmath.sin(2*self.angleC)
        X = (self.a.point.real*A + self.b.point.real*B + self.c.point.real*C) / (A+B+C)
        Y = (self.a.point.imag*A + self.b.point.imag*B + self.c.point.imag*C) / (A+B+C)
        return complex(X, Y)

n = int(input())
for i in range(n):
    line = list(map(float, input().split()))
    p1 = Point(line[0], line[1])
    p2 = Point(line[2], line[3])
    p3 = Point(line[4], line[5])
    T = Triangle(p1, p2, p3)
    center = T.circumscribedCircleCenter()
    print("{0:.3f} {1:.3f} {2:.3f}".format(center.real, center.imag, T.circumscribedCircleRadius()))

Measured memory_bytes: 6984
#include<bits/stdc++.h>
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>*/
 
using namespace std;
//using namespace __gnu_pbds;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define int long long 
#define rep(i,n) for(int i=0;i<n;i++)
#define repa(i,arr,n) for(int i=arr;i<=n;i++)
#define repd(i,arr,n) for(int i=arr;i>=n;i--)
#define trav(arr,x) for(auto& arr:x)
#define all(c) c.begin(), c.end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz(arr) arr.size()
#define pi 3.14159265358979323846
#define MAX 500003
#define vi vector<int>
#define pii pair<int,int>
#define pqueue priority_queue<int>
#define pdqueue priority_queue<int,vi,greater<int> >
//#define endl "\n"
 
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
 
const int mod=998244353;
int power(int a,int b)
{
    int ans=1;
    while(b)
    {
        if(b&1)
        {
            ans=(ans*a);
        }
        a=(a*a);
        b>>=1;
    }
    return ans;
}

int32_t main()
{
    fast;
    int t;
    t=1;
    //cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        n%=1000;

        if(n==0) cout<<0<<endl;
        else cout<<1000-n<<endl;
    }
}   


Measured memory_bytes: 3648
#include <iostream>
#include <vector>
#include <string>
#include <queue>

using namespace std;


int frip(vector<vector<char>>& map, int h, int w, int H, int W)
{
    int cnt = (map[h][w] == '.') ? 1 : 0;
    map[h][w] = 'x';
    if(w != 0 && map[h][w-1] == '.'){
        //++cnt;
//        map[h-1][w-1] = 'x';
        cnt += frip(map, h, w-1, H, W);
    }
    if(w != W-1 && map[h][w+1] == '.'){
        //++cnt;
//        map[h-1][w+1] = 'x';
        cnt += frip(map, h, w+1, H, W);
    }
    if(h != H-1 && map[h+1][w] == '.'){
        //++cnt;
//        map[h+1][w-1] = 'x';
        cnt += frip(map, h+1, w, H, W);
    }
    if(h != 0 && map[h-1][w] == '.'){
        //++cnt;
//        map[h+1][w+1] = 'x';
        cnt += frip(map, h-1, w, H, W);
    }
    
    return cnt;
}


int solve(vector<vector<char>>& map, int H, int W)
{
    int ci, cj;
    for(int i=0;i<H;++i) for(int j=0;j<W;++j) if(map[i][j] == '@') { ci = i; cj = j; }
    
    return frip(map, ci, cj, H, W) + 1;
}


int main()
{
    int H, W;
    while(cin >> W >> H, H){
        vector<vector<char>> map(H);
        for(int i=0;i<H;++i){
            string str{};
            cin >> str;
            map[i] = vector<char>(str.begin(), str.end());
        }
        
        cout << solve(map, H, W) << endl;
//        for(int i=0;i<H;++i){
//            for(int j=0;j<W;++j) cout << map[i][j];
//            cout << endl;
//        }
    }
    
    return 0;
}

Measured memory_bytes: 1252
#include <bits/stdc++.h>
using namespace std;
int f(int n) {
	int res = 0;
	while (n != 0) {
		res += n % 10;
		n /= 10;
	}
	return res;
} 
int main() {
	int n;
	cin >> n;
	if (n % f(n) == 0) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256