akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define rep(i,n)for(int i=0;i<n;i++)
#define int long long
#define ggr getchar();getchar();return 0;
#define prique priority_queue
#define mod 1000000007
#define inf 1e15
#define key 1e9
using namespace std;
typedef pair<int, int>P;
void yes() { cout << "Yay!" << endl; }
void no() { cout << ":(" << endl; }
template<class T> inline void chmax(T& a, T b) {
	a = std::max(a, b);
}
template<class T> inline void chmin(T& a, T b) {
	a = std::min(a, b);
}
bool prime(int n) {
	int cnt = 0;
	for (int i = 1; i <= sqrt(n); i++) {
		if (n % i == 0)cnt++;
	}
	if (cnt != 1)return false;
	else return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y)* mod_pow(kai(y, y), mod - 2, mod) % mod;
}
struct edge { int to, cost; };
int par[114514], rrank[114514];//親、木の深さ
void init(int n) {
	rep(i, n) {
		par[i] = i;
		rrank[i] = 0;
	}
}
int find(int x) {
	if (par[x] == x) {
		return x;
	}
	else return par[x] = find(par[x]);
}
void unite(int x, int y) {
	x = find(x);
	y = find(y);
	if (x == y)return;
	if (rrank[x] < rrank[y]) {
		par[x] = y;
	}
	else {
		par[y] = x;
		if (rrank[x] == rrank[y])rrank[x]++;
	}
}
bool same(int x, int y) {
	return find(x) == find(y);
}
int n;
int a[1 << 18];
int memo[18][1 << 18];
signed main() {
	cin >> n;
	rep(i, 1 << n)cin >> a[i];
	rep(i, 1 << n)memo[0][i] = a[i];
	for (int i = 1; i <= n; i++) {
		rep(j, 1 << (n - i)) {
			if (memo[i - 1][j * 2] == memo[i - 1][j * 2 + 1])memo[i][j] = memo[i - 1][j * 2];
			else memo[i][j] = abs(memo[i - 1][j * 2] - memo[i - 1][j * 2 + 1]);
		}
	}
	cout << memo[n][0] << endl;
	ggr
}

Measured memory_bytes: 39168
a1 = list(map(int,input().split()))
a2 = list(map(int,input().split()))
a3 = list(map(int,input().split()))
n = int(input())

b1 = [0,0,0]
b2 = [0,0,0]
b3 = [0,0,0]

for i in range(n):
    b = int(input())
    for j in range(3):
        if a1[j] == b:
            b1[j] = 1
        if a2[j] == b:
            b2[j] = 1
        if a3[j] == b:
            b3[j] = 1

if b1[0] == 1 and b1[1] == 1 and b1[2] == 1:
    print("Yes")
elif b2[0] == 1 and b2[1] == 1 and b2[2] == 1:
    print("Yes")
elif b3[0] == 1 and b3[1] == 1 and b3[2] == 1:
    print("Yes")
elif b1[0] == 1 and b2[0] == 1 and b3[0] == 1:
    print("Yes")
elif b1[1] == 1 and b2[1] == 1 and b3[1] == 1:
    print("Yes")
elif b1[2] == 1 and b2[2] == 1 and b3[2] == 1:
    print("Yes")
elif b1[0] == 1 and b2[1] == 1 and b3[2] == 1:
    print("Yes")
elif b1[2] == 1 and b2[1] == 1 and b3[0] == 1:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3064
#include <stdio.h>

int main(void) {
  int N,A,B;
  scanf ("%d %d %d", &N,&A,&B);
if( 1<=N && N<=20,
    1<=A && A<=50,
    1<=B && B<=50){}else{
      printf("error");}
int NA =N*A;
   if ( NA < B) {
            printf("%d ", NA);
            }else if(NA>B) {
            printf("%d ", B);
        }else{
          printf("%d ", NA);
        }
    

}


Measured memory_bytes: 128
const int LG = 21;
const int FN = 400005;
const long long MOD = 1e9 + 7;
const long long INF = 1e9;
const long long INFLL = 1e18;

#include <bits/stdc++.h>

using namespace std;
#define int long long
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;

#define forn(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define fi first
#define se second
#define re return
#define pb push_back
#define uniq(x) sort(all(x)); (x).resize(unique(all(x)) - (x).begin())

#ifdef LOCAL
#define dbg(x) cerr << __LINE__ << " " << #x << " " << x << endl
#define ln cerr << __LINE__ << endl
#else
#define dbg(x) void(0)
#define ln void(0)
#endif // LOCAL

int cx[4] = {-1, 0, 1, 0};
int cy[4] = {0, -1, 0, 1};
string Yes[2] = {"No", "Yes"};
string YES[2] = {"NO", "YES"};

ll inq(ll x, ll y)
{
    if (!y) re 1 % MOD;
    ll l = inq(x, y / 2);
    if (y % 2) re l * l % MOD * x % MOD;
    re l * l % MOD;
}

ll rev(ll x)
{
    return inq(x, MOD - 2);
}

bool __precomputed_combinatorics = 0;
vector<ll> __fact, __ufact, __rev;

void __precompute_combinatorics()
{
    __precomputed_combinatorics = 1;
    __fact.resize(FN);
    __ufact.resize(FN);
    __rev.resize(FN);
    __rev[1] = 1;
    for (int i = 2; i < FN; i++) __rev[i] = MOD - __rev[MOD % i] * (MOD / i) % MOD;
    __fact[0] = 1, __ufact[0] = 1;
    for (int i = 1; i < FN; i++) __fact[i] = __fact[i - 1] * i % MOD, __ufact[i] = __ufact[i - 1] * __rev[i] % MOD;
}

ll fact(int x)
{
    if (!__precomputed_combinatorics) __precompute_combinatorics();
    return __fact[x];
}

ll cnk(int n, int k)
{
    if (k < 0 || k > n) return 0;
    if (!__precomputed_combinatorics) __precompute_combinatorics();
    return __fact[n] * __ufact[n - k] % MOD * __ufact[k] % MOD;
}

int Root(int x, vector<int> &root)
{
    if (x == root[x]) return x;
    return root[x] = Root(root[x], root);
}

void Merge(int v, int u, vector<int> &root, vector<int> &sz)
{
    v = Root(v, root), u = Root(u, root);
    if (v == u) return;
    if (sz[v] < sz[u])
    {
        sz[u] += sz[v];
        root[v] = u;
    }
    else
    {
        sz[v] += sz[u];
        root[u] = v;
    }
}

int ok(int x, int n)
{
    return 0 <= x && x < n;
}

void bfs(int v, vi &dist, vector<vi> &graph)
{
    fill(all(dist), -1);
    dist[v] = 0;
    vi q = {v};
    for (int i = 0; i < q.size(); i++)
    {
        for (auto u : graph[q[i]])
        {
            if (dist[u] == -1)
            {
                dist[u] = dist[q[i]] + 1;
                q.push_back(u);
            }
        }
    }
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int a, b;
    cin >> a >> b;
    cout << max(max(a + b, a - b), a * b);
}

/* Note:
Check constants at the beginning of the code.
    N is set to 4e5 but be careful in problems with large constant factor.
    Setting N in every problem is more effective.
Check corner cases.
    N = 1
No def int long long for now.
Add something here.
*/


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;int64_t g,N,i,c,b,n[1<<20],d[1<<20],p[1<<20];main(){for(cin>>N;i<N;)cin>>c>>b,c+=1e9,p[i++]=(c<<32)+c+b;for(sort(p,p+N);c=i--;g=d[i]=(g+d[n[i]=c]+1)%998244353)for(;c<N&p[c]<p[i]<<32;c=n[c]);cout<<g+1;}

Measured memory_bytes: 5888
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <list>
#include <cmath>
#include <limits>

using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
typedef long long ll;

int main() {
    ll n, x;
    cin >> n >> x;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    ll ans = 0;
    rep(i, n-1) {
        ll total = a[i] + a[i+1];
        if(total <= x) continue;
        ll d = total - x;
        if(a[i+1] < d) a[i+1] = 0;
        else a[i+1] = a[i+1] - d;
        ans += d;
    }

    cout << ans << endl;
}


Measured memory_bytes: 1152
n = int(input())
H = list(map(int, input().split()))[::-1]
ok = True
for i in range(n-1):
    if H[i] >= H[i+1]: continue
    if H[i] >= H[i+1]-1:
        H[i+1] -= 1
    else:
        ok = False
        break
print("Yes" if ok else "No")

Measured memory_bytes: 20844
#include <stdio.h>

int main(){

  int n,x,count,sum,i,j,k;
  count=0;
  while(1){
    count=0;
    scanf("%d%d",&n,&x);
    if(n==0 && x==0)break;
    for(i=1;i<=n;i++){
      for(j=i+1;j<=n;j++){
	for(k=j+1;k<=n;k++){
	  sum=i+j+k;
	  if(sum==x)count += 1;
	}
      }
    }
    printf("%d\n",count);
    sum=0;
  }
  return 0;
}

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


typedef long long ll;
typedef vector <int> vi;
typedef pair< int ,int > pii;
typedef istringstream iss;
typedef ostringstream oss;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define sz size()
#define ln length()
#define rep(i,n) for(int i=0;i<n;i++)
#define fu(i,a,n) for(int i=a;i<=n;i++)
#define fd(i,n,a) for(int i=n;i>=a;i--)
#define all(a)  a.begin(),a.end() 
#define ESP (1e-9)

const int md = 100100 ; 
int n , m, s[200100] , a , b   ;
vector < int> g[200100] , ans ;
map < int ,int> ms;
bool vis[200100] ;  
void dfs ( int x ){
	  ans.pb ( x ) ; 
	  vis[x] = 1;
	  for ( auto p : g[x] ){
	  	  if ( !vis[p] )  dfs ( p ) ; 
	  }
}
int main () {
	// freopen ("in.in" , "r" , stdin ) ; 
	cin >> n >> m ;
	fu ( i , 1, n)  cin >> s[i] ; 
	while ( m--){
		  cin >> a >> b ;
		  g[a].pb ( b ) ; 
		  g[b].pb ( a) ;
	}
	int cnt = 1, res = 0 ; 
	fu ( i , 1,n ){
		  if ( vis[i] == 0 ){
		  	  ms.clear (); 
			  ans.clear () ; 
		  	  dfs ( i ) ;
			  rep ( j , ans.size () ){
			     ms[ s[ans[j] ] ] = 1 ; 	
			  }
			  rep( j , ans.size () ){
			  	  if ( ms[ans[j]] == 1  )  ++res; 
			  } 
		  }
	}
	cout << res ; 
	return 0; 
}

Measured memory_bytes: 16632
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
#include <iomanip>

using namespace std;    
typedef long long ll;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

ll dp[101][100001];

struct Item
{
    ll weight;
    ll value;
};


int main(){

    ll N, W;
    cin >> N >> W;

    vector<Item> item(N+1);
    for(int i = 1; i <= N; i++){
        cin >> item[i].weight >> item[i].value;
    }

    // dp[i][j]:i番目までのアイテムを使って価値valueを達成するときの最小の重さ
    ll vmax = N * 1000;
    ll INF = 1e10;
    for(int i = 0; i <= N; i++){
        for(int j = 0; j <= vmax; j++){
            dp[i][j] = INF;
        }
    }
    for(int i = 0; i <= N; i++){
        dp[i][0] = 0;
    }

    for(int i = 1; i <= N; i++){
        for(int j = 0; j <= vmax; j++){
            if( j - item[i].value >= 0 ){
                dp[i][j] = min(dp[i-1][j], dp[i-1][ j - item[i].value ] + item[i].weight );
            }
            else{
                dp[i][j] = dp[i-1][j];
            }
        }
    }

    ll ans = 0;
    for(ll j = 0; j <= vmax; j++){
        if(dp[N][j] <= W) ans = max(ans, j);
    }

    cout << ans << endl;


}

Measured memory_bytes: 79104
import itertools,sys
def S(): return sys.stdin.readline().rstrip()
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
H,W = LI()
s = [S() for _ in range(H)]
ans = 1
for i,j in itertools.product(range(H),range(W)):
    if s[i][j]=='.':
        continue
    if i-1>=0 and s[i-1][j]=='#' or i+1<=H-1 and s[i+1][j]=='#':
        continue
    if j-1>=0 and s[i][j-1]=='#' or j+1<=W-1 and s[i][j+1]=='#':
        continue
    ans = 0
    break
print({1:'Yes',0:'No'}[ans])


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

int bitCount(uint bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);    //  2bitごとに計算
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);    //  4bitごとに計算
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);    //  8bitごとに計算
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);    //  16ビットごとに計算   
    return (bits & 0x0000ffff) + (bits >> 16);    //  32ビット分を計算   
}

int main(void){
    // Your code here!
    int n;
    cin >> n;
    int f[100];
    int p[100][11];
    for(int i=0;i<n;i++){
        int t;
        for(int j=0;j<10;j++){
            cin >> t;
            if(t == 1)
                f[i] += pow(2,j);
        }
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<11;j++){
            cin >> p[i][j];
        }
    }
    int maxa = INT_MIN;
    for(int i=1;i<pow(2,10);i++){
        int ans = 0;
        for(int j=0;j<n;j++){
            ans += p[j][bitCount(f[j]&i)];
//            ans += p[i][];
        }
        maxa = max(ans,maxa);
    }
    cout << maxa << endl;
    
    
}


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

int main() {
  int n;
  while ( cin >> n ) {
    int answer = 1, x, mx;
    cin >> x;
    mx = x;
    for ( int i = 1; i < n; ++i ) {
      cin >> x;
      if ( x >= mx ) { mx = x; answer++; }
    }
    cout << answer << endl;
    
  }
  return 0;
}

Measured memory_bytes: 256
chars = [chr(i) for i in range(ord('a'), ord('z') + 1)]

arr = []

x = int(input())


def get_len(n):
    length = 1
    t = 26

    while True:
        if n <= t:
            return length
        t += 26 ** (length + 1)
        length += 1

        if length > 1000000000000001:
            raise


def get_ord(n):
    st = 1
    end = 26
    ind = 1
    while True:
        if st <= n <= end:
            return x - st

        st = end + 1
        end += 26 ** (ind + 1)
        ind += 1


length = get_len(x)
order = get_ord(x)
# print(length)

for i in range(length):
    s = order % 26
    order = order // 26
    arr.append(s)

# print(arr)

ans = ""
for ai in arr[::-1]:
    ans += chars[ai]
print(ans)

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

using ll = long long;
using ull = unsigned long long;
const int inf = 2e9;
const ll INF = 4e18;
const ll MOD = 1e9+7;

int n;
int a[3][100010];
int dp[3][100010];

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

  cin >> n;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> a[j][i];
    }
  }

  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < 3; j++) {
      for (int k = 0; k < 3; k++) {
        if (j == k) continue;
        dp[j][i] = max(dp[j][i], dp[k][i-1] + a[j][i]);
      }
    }
  }

  cout << max(dp[0][n], max(dp[1][n], dp[2][n])) << endl;
  return 0;
}


Measured memory_bytes: 2560
#include<iostream>
#include<string>
#include<cmath>

using namespace std;


int main() {


	int a, b,ans;

	cin >> a >> b;

	int x = ceil(a / 0.08);

	while (true) {

		if (x >= ceil((a + 1 )/ 0.08)) {
			ans = -1;
			break;
		}

		if (x >= ceil(b / 0.10) && x < ceil((b + 1) / 0.10)) {
			ans = x;
			break;
		}

		x = x + 1;

	}

	cout << ans << endl;

	return 0;

}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<functional>
#define max jgslkgjsojgps
using namespace std;
int main(void){
	long long int n,p,j[70000],sum,x,i,k,max;
	while(1){
		scanf("%lld",&n);
		if(n==0) break;
		sum=0;
		for(i=0;i<n;i++){
			scanf("%lld",&p);
			sum+=p;
		}
		for(i=0;i<n-1;i++){
			scanf("%lld",&j[i]);
		}
		sort(j,j+n-1,greater<int>());
		max=0;
		for(i=0;i<n;i++){
			if(max<(n-i)*sum) max=(n-i)*sum;
			else break;
			sum+=j[i];
		}
		printf("%lld\n",max);
	}
	return 0;
}

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

int main() {
	string s;
    cin >> s;
    string t = "CODEFESTIVAL2016";
    int count=0;
    for(int i=0;i<16;i++){
      if(s.at(i)!=t.at(i)){
        count++;
      }
    }
    cout << count << endl;
}


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

#define int long long
#define ll long long
#define pb push_back
#define mp make_pair
#define f(i,a,n) for(int i=a ; i<(int)n ; i++)
#define rf(i,n,a) for(int i=n ; i>=a ; i--)
#define F first
#define S second
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()
#define fast ios:: sync_with_stdio(false),cin.tie(nullptr);

typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef vector<pii> vpi;

const int inf = 1e9;
const int inf64 = 1e18;
const int MOD = 998244353;
const int N = 2e5 + 5;
int fact[N], invfact[N];

int pow(int a, int b, int m)
{
   int ans=1;
   while(b)
   {
      if(b&1)
         ans=(ans*a)%m;
      b/=2;
      a=(a*a)%m;
   }
   return ans;
}

int modinv(int k)
{
   return pow(k, MOD-2, MOD);
}

void precompute()
{
   fact[0]=fact[1]=1;
   for(int i=2;i<N;i++)
   {
      fact[i]=fact[i-1]*i;
      fact[i]%=MOD;
   }
   invfact[N-1]=modinv(fact[N-1]);
   for(int i=N-2;i>=0;i--)
   {
      invfact[i]=invfact[i+1]*(i+1);
      invfact[i]%=MOD;
   }
}

int nCr(int x, int y)
{
   if(y>x)
      return 0;
   int num=fact[x];
   num*=invfact[y];
   num%=MOD;
   num*=invfact[x-y];
   num%=MOD;
   return num;
}

void solve(){
   int n,m,k;
   cin >> n >> m >> k;
   int ans = 0;
   for(int i=0 ; i<=k ; i++) {
      int K = n - i;
      int first = m;
      int extra = pow(m-1 , K - 1, MOD);

      int temp = (first * extra) %MOD;
      int C = nCr(n - 1 , K - 1);
      
      temp = (temp * C) %MOD;
      ans = (ans + temp) % MOD;
   }
   cout << ans;
}

int32_t main(){
   fast;
   precompute();
   int t = 1;
//   cin >> t;
   while(t--)  solve();   
}

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

int A, B, C, X;
int counter = 0;

int main() {
  cin >> A >> B >> C >> X;
  for( int i = 0; i <= A; i++ ) {
    for( int j = 0; j <= B; j++ ) {
      for( int k = 0; k <= C; k++ ) {
        if( i * 500 + j * 100 + k * 50 == X ) {
          counter++;
        }
      }
    }
  }
  cout << counter;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < n; ++i)
#define sz(x) int(x.size())
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
#define FORV(i, v) for (auto i = v.begin(); i != v.end(); i++)
using namespace std;

typedef int64_t ll;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const int INF = 1001001001;
const long long INFL = (1LL<<60);
const double eps = (1e-9);

int dp[105][4][2];

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

  string s;
  cin >> s;
  int n = s.size();
  int K;
  cin >> K;

  dp[0][0][0] = 1;

  rep(i, n) rep(j, 4) rep(k, 2) {
    int nd = s[i] - '0';  // Nの桁
    rep(d, 10) {          // 候補の桁
      int ni = i + 1, nj = j, nk = k;
      if (d != 0) nj++;   // 非ゼロを追加するなら j を加算
      if (nj > K) continue;  // 非ゼロをもう使えないなら skip
      if (k == 0) {
        if (d > nd) continue;  // Nよりも大きくなったら skip
        if (d < nd) nk = 1;    // N 以下であることが確定
      }
      dp[ni][nj][nk] += dp[i][j][k];
    }
  }

  int ans = dp[n][K][0] + dp[n][K][1];

  cout << ans << endl;

  return 0;
}


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

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

//infinity
#define INTINF 2000000000
#define LONGINF 2000000000

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main(){
	int r; cin >> r;
	if(r>=2800){
		cout << "AGC" << endl;
	}else if(r>=1200){
		cout << "ARC" << endl;
	}else{
		cout << "ABC" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define to edge[i].v
#define mp make_pair
#define rint register int
#define debug(x) cerr<<#x<<"="<<x<<endl
#define fgx cerr<<"-------------"<<endl
#define N 1000000
using namespace std;
typedef long long ll;
typedef long double db;
typedef pair<int,int> pii;
unordered_map<ll,ll> rv; unordered_map<ll,int> vis,num;
int pri[N],p[N],fuck[N],tot; ll b[N];
inline void sieve1(int n)
{	for(rint i=2;i<=n;i++)
	{	if(!fuck[i]) p[++tot]=i;
		for(rint j=1;j<=tot&&p[j]*i<=n;j++)
		{	fuck[i*p[j]]=1;
			if(i%p[j]==0) break;
		}
	}
}
inline void sieve2(int n)
{	tot=0;
	for(rint i=2;i<=n;i++)
	{	if(!pri[i]) p[++tot]=i;
		for(rint j=1;j<=tot&&p[j]*i<=n;j++)
		{	pri[i*p[j]]=1;
			if(i%p[j]==0) break;
		}
	}
}
struct gg{ll v,rev;int s;}a[N];
inline int check(ll x){ll y=sqrtl(x);return y*y!=x?0:!fuck[y];}
int main()
{	int n,t=0,ans=0; ll lim=0; cin>>n;
	for(rint i=1;i<=n;i++) scanf("%lld",&b[i]),lim=max(lim,b[i]);
	sieve1(pow(lim,1.0/2)); sieve2(pow(lim,1.0/3));
	for(rint i=1;i<=n;i++)
	{	ll x=b[i],cur=1,rev=1;
		for(rint j=1;j<=tot;j++)
		{	int cnt=0;
			while(x%p[j]==0) x/=p[j],(++cnt)%=3;
			for(rint k=1;k<=cnt;k++) cur*=p[j];
			for(rint k=1;k<=(3-cnt)%3;k++) rev*=p[j];
		}
		cur*=x;
		if(check(x)) rev*=ll(sqrtl(x)); else rev*=x*x;
		b[i]=cur; rv[b[i]]=rev;
	}
	sort(b+1,b+n+1);
	for(rint i=1,j;i<=n;i=j)
	{	a[++t].v=b[i]; a[t].rev=rv[b[i]]; a[t].s++;// debug(a[t].v);debug(a[t].rev);
		for(j=i+1;j<=n&&b[j]==b[i];j++) a[t].s++; num[a[t].v]=a[t].s;
	}
	for(rint i=1;i<=t;i++)
	if(!vis[a[i].v])
	{	if(a[i].v==a[i].rev) ans++;
		else ans+=max(a[i].s,num[a[i].rev]),vis[a[i].rev]=1;
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 33352
#include <bits/stdc++.h>
using namespace std;
using in6 = int64_t;
using ind = double;
using vi = vector<in6>;
using vii = vector<vi>;
using vs = vector<string>;
using pii = pair<in6,in6>;
using psi = pair<string,in6>;
using vpi = vector<pii>;
using vps = vector<psi>;
#define rep(i, n) for (in6 i = 0; i < (in6)(n); i++)
#define repa(i,a,n) for(in6 i = a; i < (in6)(n); i++)
#define repdown(i,n) for(in6 i = n; i > 0; i--)
#define kyun ios::sync_with_stdio(false)
#define hinata cout << "\n"
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define inf 2147483647
#define dset(n) cout << fixed << setprecision(n)

void yes() { cout << "Yes"; }

void no() { cout << "No"; }

int factrial(int x) {
  int ret = 1;
  rep(i,x) ret *= x-i;
  return ret;
}

int main() {
  kyun;
  in6 n;
  cin >> n;
  vi p(n), q(n);
  rep(i,n) cin >> p[i];
  rep(i,n) cin >> q[i];
  in6 pn = 1, qn = 1;
  in6 a = 1;
  vi canda(n,0), candb(n,0);
  rep(i,n-1) {
    canda[p[i]-1]++;
    if(p[i] == a) while(canda[a-1] == 1) a++;
    else {
      in6 counta = 0;
      rep(j,p[i]-1) if(canda[j] == 0) counta++;
      pn += counta * factrial(n-i-1);
    }
  }
  in6 b = 1;
  rep(i,n-1) {
    candb[q[i]-1]++;
    if(q[i] == b) while(candb[b-1] == 1) b++;
    else {
      in6 countb = 0;
      rep(j,q[i]-1) if(candb[j] == 0) countb++;
      qn += countb * factrial(n-i-1);
    }
  }
  cout << abs(pn-qn);
  hinata;
}

Measured memory_bytes: 256
import sys, re
import math
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

# -*- coding: utf-8 -*-

s = input()
n = len(s)

helfCount = math.floor(n / 2)
helfHelfCount = math.floor(helfCount / 2)

ans = "Yes"

for x in range(0, helfCount):
    if s[x] != s[n - x - 1] or (x < helfHelfCount and s[x] != s[helfCount - x - 1]) :
        ans = "No"
        break

print(ans)

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

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

  int n;
  cin >> n;
  double ans = 0;
  for (int i = 0; i < n; ++i) {
    double money;
    string type;
    cin >> money >> type;
    if (type == "JPY") {
      ans += money;
    } else {
      ans += money * 380000.0;
    }
  }
  cout << fixed << ans << "\n";
}


Measured memory_bytes: 256
import sys
x, n = map(int, input().split(" "))

if n == 0:
    print(x)
    sys.exit(0)

p = list(map(int, input().split(" ")))
for i in range(0, 100):
    if x - i not in p:
        print(x-i)
        break
    if x + i not in p:
        print(x+i)
        break

Measured memory_bytes: 9184
#include <bits/stdc++.h>
#include <iostream>
using namespace  std;
vector<pair<int,int>> vc;
int main() {

long long n,k;
cin>>n>>k;
long long int counter=0;
while(n>0)
{
n=n/k;
counter++;


}

cout<<counter;
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
using namespace std;
 
int main(){
    int n,i;
    cin >> n;
    int a[n];
    for(i=0;i<n;i++)cin >> a[i];
    for(i=n-1;i>0;i--)cout << a[i] << " ";
    cout << a[0];
    cout << endl;
}


Measured memory_bytes: 3104
package main

import "fmt"

func reverse(s string) string {
	runes := []rune(s)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return string(runes)
}

func main() {
	var a, b string
	fmt.Scan(&a, &b)
	if reverse(a) == b {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx2,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")


using namespace std;
using namespace __gnu_pbds;

typedef pair<int,int> ii;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef tree<pair<int,int>, null_type,less<pair<int, int> >,rb_tree_tag,tree_order_statistics_node_update > pbds;

#define debug(x) cout<<#x<<" :: "<<x<<endl;
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<endl;
#define debug4(x,y,z,w) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\t"<<#w<<" :: "<<w<<endl;
#define ROUNDOFFINT(d) d = (int)((double)d + 0.5)

#define pb push_back
#define ft first
#define sd second
#define IOS ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

ll power(ll a, ll b) {
    ll res = 1;
    while(b) {
        if(b % 2) {
            res *= a;
        }
        a = a * a;
        b >>= 1;
    }
    return res;
}
ll power(ll a, ll b, ll mod) {
    ll res = 1;
    a %= mod;
    while(b) {
        if(b % 2) {
            res *= a;
            res %= mod;
        }
        a = a * a % mod;
        b >>= 1;
    }
    return res % mod;
}
const int N = 1e5 + 5;
int n, k, p;
const ll mod = 998244353;

signed main() {
    int n, s;
    cin >> n >> s;
    int a[n + 4];
    memset(a, 0, sizeof a);
    ll dp[n + 4][s + 4][2];  // sum of starting index of subsequences with sum j and ending at index i;
    memset(dp, 0LL, sizeof dp);
    for(int i=1; i<=n; i++) {
        cin >> a[i];
    }
    for(int i=1; i<=n; i++) {
        for(int j=0; j<=s; j++) {
            if(j < a[i]) {
                dp[i][j][0] = dp[i-1][j][0];
            }
            else if(j == a[i]) {
                dp[i][j][0] = (dp[i-1][j][0] + i) % mod;
                dp[i][j][1] = i;
            }
            else {
                dp[i][j][0] = (dp[i-1][j][0] + dp[i-1][j-a[i]][0]) % mod;
                dp[i][j][1] = dp[i-1][j-a[i]][0];
            }
        }
    }
    ll ans = 0;
    for(int i=1; i<=n; i++) {
        ans += (dp[i][s][1]*(n-i+1))%mod;
        ans %= mod;
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 141312
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int i = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int i = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define MP make_pair
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1 << 30;
const ll LINF = 1LL << 61;
const int MOD = 1e9 + 7;

int main() {
    ll N, K;
    cin >> N >> K;
    ll res = K;
    rep(i, N - 1) { res *= K - 1; }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
from collections import deque

def shortestpath(y0, x0):
    step_cnt = [[-1] * w for _ in range(h)]
    step_cnt[y0-1][x0-1] = 0
    q.append((y0, x0))
    while q:
        y, x = q.popleft()
        for i in range(4):
            y_next = y + dy[i]
            x_next = x + dx[i]
            if 1 <= y_next < h+1 and 1 <= x_next < w+1\
            and maze[y_next][x_next] == '.'\
            and step_cnt[y_next-1][x_next-1] == -1:
                q.append((y_next, x_next))
                step_cnt[y_next-1][x_next-1] = step_cnt[y-1][x-1] + 1

    return step_cnt[y-1][x-1]

h, w = map(int, input().split())
maze = [['#'] * (w+2)]
maze += [['#']+[x for x in input()]+['#'] for _ in range(h)]
maze += [['#'] * (w+2)]
dy = [-1, 0, 1, 0]
dx = [0, -1, 0, 1]
q = deque()

max_steps = -1
for y0 in range(1, h+1):
    for x0 in range(1, w+1):
        if maze[y0][x0] != '#':
            max_steps = max(max_steps, shortestpath(y0, x0))

print(max_steps)

Measured memory_bytes: 3316
#include <iostream>
#include <cstdio>
#include <stdio.h>
#include <math.h>
#pragma warning(disable:4996)

using namespace std;

int main() {
/*    scanf("%lld", &N);
    for (int i = 1; i <= N; i++) {
        scanf("%lld", &A[i]);
        if (A[i] <= 100) cnt[A[i]]++;
    }

    long long Answer = 0;
    for (int i = 1; i <= 50; i++) Answer += cnt[i] * cnt[101 - i];
    cout << Answer << endl;
*/
    long long int X = 0, K = 100;
    int count = 0;
    scanf("%lld", &X);
//    scanf("%d %d", &A, &B);
    while (1) {
        if (K >= X) { break; }
        count++;
        K *= 1.01;
  }
    printf("%d\n", count);
    return 0;
}

Measured memory_bytes: 3792
#include"bits/stdc++.h"
using namespace std;
using ll=long long;
using ull=unsigned long long;
constexpr auto inf=static_cast<ll>(1e18);
template<typename T=ll>inline T in(){T ret;cin>>ret;return ret;}
template<typename T=ll>inline auto vec2(size_t h,size_t w,T v=T()){return vector<vector<T>>(h,vector<T>(w,v));}
inline void setp(int n){cout<<fixed<<setprecision(n);}
inline void delnl(){cin.ignore(numeric_limits<streamsize>::max(),'\n');}

template<ull mod,ull phi_mod=mod-1>
class basic_mod_int{
    private:
        using mod_int=basic_mod_int<mod,phi_mod>;
        ull num;
        static ull pow_mod(ull x,ull y){x%=mod;return(y==0?1:y%2==0?pow_mod(x*x%mod,y/2):x*pow_mod(x,y-1))%mod;}
    public:
        basic_mod_int()=default;
        basic_mod_int(ull num):num(num%mod){}
        explicit operator ull()             const{return num;}
        bool    operator==(const mod_int&mi)const{return num==mi.num;}
        bool    operator!=(const mod_int&mi)const{return !operator==(mi);}
        mod_int operator~ ()                const{return pow_mod(num,phi_mod-1);}
        mod_int operator+ (const mod_int&mi)const{return num+mi.num;}
        mod_int operator- (const mod_int&mi)const{return num-mi.num+mod;}
        mod_int operator* (const mod_int&mi)const{return num*mi.num;}
        mod_int operator/ (const mod_int&mi)const{return num*(~mi).num;}
        mod_int&operator= (const mod_int&mi)     {num=mi.num;return*this;}
};
using mod_int=basic_mod_int<1000000007>;
mod_int factorial_mod(ull n)
{
    mod_int ret=1;
    for(ull i=1;i<=n;++i){
        ret=ret*i;
    }
    return ret;
}
int main()
{
    ll x=in(),y=in();
    if((2*y-x)%3!=0||(2*x-y)%3!=0){
        cout<<0<<endl;
    }else{
        ll a=(2*y-x)/3,b=(2*x-y)/3;
        if(a<0||b<0){
            cout<<0<<endl;
            return 0;
        }
        cout<<(ull)(factorial_mod(a+b)*~(factorial_mod(a)*factorial_mod(b)))<<endl;
    }
}


Measured memory_bytes: 256
/*
 * main.c
 *
 *  Created on: 2019/12/29
 *      Author: family
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define MAX(a,b) (a > b ? a : b)
#define MIN(a,b) (a > b ? b : a)

char S[200001][11] = {0};
char ans[200001][11] = {0};
int check[200001] = {0};
int check2[200001] = {0};

int sort_dic(const void *a, const void *b)
{
    char *pa = (char *)a;
    char *pb = (char *)b;
    int i = 0, val = 0;
    for (i = 0; i < 10; i++) {
    	char da = pa[i];
    	char db = pb[i];
    	if (da == db) {
    		continue;
    	} else {
    		if (da > db) {
    			val = 1;
    			break;
    		} else {
    	        val = -1;
    	        break;
    		}
    	}
    }
    return val;
}


int main()
{
	int N = 0, i = 0, j = 0;
	memset(check, -1, sizeof(check));
	memset(check2, -1, sizeof(check2));
	scanf("%d", &N);
	for (i = 0; i < N; i++) {
		scanf("%s", &(S[i][0]));
	}

	qsort(S, N, (sizeof(char) * 11), sort_dic);

	int max = 0, count = 1;
	for (i = 0; i < N-1;i++) {
		if (check[i] != -1) {
			continue;
		}
		check[i] = 1;
		for (j = i+1; j < N;j++) {
			if (check[j] != -1) {
				continue;
			}
			if (strcmp(S[i], S[j]) == 0) {
				count++;
				check[j] = 1;
			} else {
				break;
			}
		}
		max = MAX(max, count);
		count = 1;
	}

	count = 1;
	for (i = 0; i < N;i++) {
		if (check2[i] != -1) {
			continue;
		}
		check2[i] = 1;
		for (j = i+1; j < N;j++) {
			if (strcmp(S[i], S[j]) == 0) {
				count++;
				check2[j] = 1;
			} else {
				break;
			}
		}
		//printf("count=%d j = %d\n", count, j);
		if (max == count) {
			printf("%s\n", S[i]);
		}
		count = 1;
	}
    return 0;
}


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

int main()
{

    int n;
    cin>>n;
    int ar[n],a,count=0;
    for(int i=0;i<n;i++)
    {
        cin>>ar[i];
    }
    for(int i=0;i<n;i++)
    {
     //   cin>>ar[i];
        if(i>0)
        {
            if(ar[i]==ar[i-1])
            {
                ar[i]++;
                if(ar[i]==ar[i+1])
                {
                    ar[i]++;
                }
                count++;
            }
        }
    }
    cout<<count<<endl;
    return 0;
}



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

#define loop(i,a,b) for(int i=(a);i<int(b);i++)
#define rep(i,b) loop(i,0,b)

int main(){
    int n;cin>>n;
    rep(i,n){
        char g[8][8];
        rep(i,5)rep(j,5)cin>>g[i][j];
        int ans=0;
        for(int i1=0;i1<5;i1++){
            for(int i2=i1+1;i2<=5;i2++){
                for(int j1=0;j1<5;j1++){
                    for(int j2=j1+1;j2<=5;j2++){
                        bool ok=true;
                        for(int i=i1;i<i2;i++){
                            for(int j=j1;j<j2;j++){
                                if(g[i][j]=='0')ok=false;
                            }
                        }
                        if(ok){
                            ans=max(ans,(j2-j1)*(i2-i1));
                        }
                    }
                }
            }
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 1160
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

int main() {
	int n, t, a; cin >> n >> t >> a;
	vector<int>h(n); for (auto&& x : h)cin >> x;
	
	int ans = 0;
	double tmp = 1 << 20;
	for (int i = 0; i < n; i++) {
		double t_now =  t - h[i] * 0.006;
		if (abs(a - t_now) < abs(a - tmp)) {
			ans = i+1;
			tmp = t_now;			
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3576
#include <bits/stdc++.h>
#define FOR(i, l, r) for(int i = (int)l; i <= (int)r; ++i)
#define REP(i, r) for(int i =(int)0; i < (int)r; ++i)

using namespace std;
typedef long long ll;
const int Nmax = 3011;

string s, t, res;
int f[Nmax][Nmax];

int main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> s >> t;
    FOR(i, 1, s.size()) FOR(j, 1, t.size()) {
        if (s[i - 1] == t[j - 1]) f[i][j] = f[i - 1][j - 1] + 1;
        else f[i][j] = max(f[i - 1][j], f[i][j - 1]);
    }
    int u = s.size(), v = t.size();
    while(u != 0 && v != 0) {
        if (s[u - 1] == t[v - 1]) {
            --u; --v;
            res += s[u];
        } else {
            if (f[u][v] == f[u - 1][v]) u -= 1;
            else v -= 1;
        }
    }
    reverse(res.begin(), res.end());
    cout << res;
}


Measured memory_bytes: 35584
import java.util.*;
import java.math.*;
class Main{
public static void main(String[] args) {
  Scanner stdIn = new Scanner(System.in);
  int n = stdIn.nextInt();
  int[] d = new int[n];
  for(int i = 0;i<d.length;i++) {
    d[i] = stdIn.nextInt();
  }
  Arrays.sort(d);
  if(d.length%2!=0) {
    System.out.println(0);
    System.exit(0);
  }
  int a = d.length/2-1;
  int b = a + 1;
  //System.out.println(a);
  //System.out.println(b);
  int count = 0;
  //System.out.println(d[b]);
  //System.out.println(d[a]);
  count = d[b] - d[a];
  System.out.println(count);
}
}


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

using namespace std;

const int MAXN = 3e5 + 7;
const int INF = 1e9 + 7;

int pref[MAXN], post[MAXN];

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

    int n;
    cin >> n;
    string s;
    cin >> s;
    
    for (int i = 0; i < n; ++i) pref[i + 1] = pref[i] + (s[i] == 'W');
    for (int i = n - 1; i >= 0; --i) post[i] = post[i + 1] + (s[i] == 'E');

    int ans = INF;
    for (int i = 0; i < n; ++i) {
        ans = min(ans, pref[i] + post[i + 1]);
    }

    cout << ans << '\n';
    return 0;
}

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

/*
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/



//************** StrAnge.R *********************

#define ll              long long int
#define ull             unsigned long long
#define ld              long double
#define lll             __int128
#define vi              vector<int>
#define vl              vector<ll>
#define vvi             vector<vector<int> >
#define pii             pair<int,int>
#define piii            pair<int,pair<int,int> >
#define pll             pair<ll,ll>
#define vii             vector<pii>

#define sz(v)           ((int)(v).size())
#define all(s)          s.begin(),s.end()
#define allr(s)         s.rbegin(),s.rend()
#define unq(c)          (sort(all(c)), c.resize(distance(c.begin(),unique(all(c)))))
#define get_pos(c,x)    (lower_bound(all(c),x)-c.begin())

#define MS0(v)          memset((v), 0, sizeof((v)))
#define MS1(v)          memset((v), -1, sizeof((v)))
#define LEN(v)          strlen(v)

#define MP              make_pair
#define pb              push_back
#define pob             pop_back
#define ff              first
#define ss              second
#define sc              scanf
#define pf              printf
#define endl            "\n"

#define TEST_CASE       int ___T; cin>>___T; for(int cs=1;cs<=___T;cs++)
#define PRINT_CASE      printf("Case %d: ",cs)

#define vpf(v)          for(int i=0;i<v.size();i++){cout<<v[i];if(i!=v.size()-1)cout<<" ";else cout<<"\n";}
#define vsc(v)          for(int i=0;i<v.size();i++)cin>>v[i];

#define REP(i, n)       for (int i = 0; i < (n); i++)
#define REPP(i, a, b)   for (int i = (a); i < (b); i++)
#define FOR(i, a, b)    for (int i = (a); i <= (b); i++)
#define FORS(i, s)      for (int i = 0; s[i]; i++)

#define fastio          ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define fileio          freopen("in.txt","r",stdin);freopen("out.txt","w",stdout)

#define intlim          2147483648
#define infinity        (1LL<<50)
#define intmx           INT_MAX
#define PI              3.14159265358979323846264338327950L // acos(-1.0)

#define gcd(a, b)       __gcd(a, b)
#define lcm(a, b)       ((a)*((b)/gcd(a,b)))


int on_bit(int N,int pos){return N = N | (1<<pos);}
int off_bit(int N,int pos){return N = N & ~(1<<pos);}
bool check_bit(ll N,int pos){return (bool)(N & (1<<pos));}


#define start_clock     clock_t tStart = clock()
#define end_clock       printf("\n>>Runtime: %.10fs\n", (double) (clock() - tStart) / CLOCKS_PER_SEC)

template<class T>inline bool read(T &x){int c=getchar();int sgn=1;while(~c&&c<'0'||c>'9'){if(c=='-')sgn=-1;c=getchar();}for(x=0;~c&&'0'<=c&&c<='9';c=getchar())x=x*10+c-'0'; x*=sgn; return ~c;}


//******************* my code starts here **********************************



int main(){

    int n; cin >> n;
    map<string, int> mp;

    ll cnt = 0;
    for(int i = 0; i < n; i++) {
        string s;
        cin >> s;

        sort(all(s));
        cnt += mp[s];
        mp[s]++;
    }

    cout << cnt << "\n";

    return 0;
}


Measured memory_bytes: 11136
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<cstdlib>
#include<cmath>
#include<numeric>
#include<iomanip>
using namespace std;
using ll =long long;
const int MOD = 1000000007;

//////検証する数,超えられない数////
long long cine(long long a, long long b) {
	if (a <= b) {
		return a;
	}
	else {
		return b;
	}
};
//vector型の初期化
void vec_initialize(vector<ll>& a, const ll N) {
	ll c;

	for (int i = 0; i < N; i++) {

		cin >> c;
		a.push_back(c);

	}

};
void vec_pair_initialize(vector<pair<ll, ll>>& a, const ll N) {
	ll c, d;
	for (int i = 0; i < N; i++) {
		cin >> c >> d;
		a.push_back(make_pair(c, d));
	}
};

int main() {
	int R, G, B, N;
	ll cnt=0;
	cin >> R >> G >> B >> N;
	for (int i = 0; i*R <= N; i++) {
		for (int j = 0; j*G+i*R <= N; j++) {
			if ((N - j * G - i * R) % B == 0) {

				cnt++;

			}
		}
	}
	cout << cnt;

}

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

void trace(int A[],int N){
    rep(i,N-1) cout << A[i] << " ";
    cout << A[N-1] << endl;
}



int SelectionSort(int A[],int N){
    int cnt = 0;
    rep(i,N){
        int minj = i;
        for (int j = i; j < N; j++)
        {
            if(A[minj] > A[j]) minj = j;
        }
        if(i != minj){
            swap(A[i],A[minj]);
            cnt++;
        }
    }
    return cnt;
}

int main(){
    int N; cin >> N;
    int A[N]; rep(i,N) cin >> A[i];
    
    int ans = SelectionSort(A,N);
    trace(A,N);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3100
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;
//typedef tuple<ll, ll, ll> T;

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

int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h,w;
    cin>>h>>w;
    string s[h];
    vector<vector<int>> ans(h,vector<int>(w,0));

    REP(i,h) cin>>s[i];
    REP(i,h) REP(j,w){
        if(s[i][j]=='#'){
            for(int y=-1;y<=1;y++){
                for(int x=-1;x<=1;x++){
                    int nx=j+x,ny=i+y;
                    if(x==0&&y==0)continue;
                    if(0<=nx && nx<w && 0<=ny && ny<h){
                        ans[ny][nx]++;
                    }
                }
            }
        }
    }
    REP(i,h){
        REP(j,w){
            if(s[i][j]=='#') cout<<'#';
            else cout<<ans[i][j];
        }
        cout<<endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repo(i,N) for(int i = 1; i < (N); i++)
#define pb push_back
#define mp make_pair
#define ll long long
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
//#define num 1000000007
#define pi acos(-1.0)
//cout << fixed << setprecision (20);   小数点以下2０桁まで
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//string s = to_string(int数);
//int n = stoi(string文字列);


int main() {
  int n;
  string s;
  cin >> n >> s;
  
  rep(i,s.size()) {
  s[i]+=n;
    if('Z'<s[i]) s[i]-=26;
  }
  
  cout << s << endl;
  
}

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

int main() {
int N;
cin >> N;
vector<int> P(N);


for (int i = 0; i < N; i++) {
    cin >> P.at(i);
}
int count = 1;
int min = P.at(0);
for (int i = 1; i < N; i++) {
   if (P.at(i) < min) {
       min = P.at(i);
       //cout << min << endl;
       count++;
   }
}
cout << count <<endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
  map<string ,int> mp;
  int n,max1=0;
  vector<string>v;
  cin>>n;
  string s;
  while(n--)
  {
      cin>>s;
      ++mp[s];
  }
  for(auto i :mp ){
      max1=max(i.second,max1);
  }
  for(auto i : mp){
      if(i.second==max1) {
          v.push_back(i.first);
      }
  }
  sort(v.begin(),v.end());
  for(int i=0;i<v.size();i++)
  {
      cout<<v[i]<<'\n';
  }
}

Measured memory_bytes: 26868
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
const int mod = 1000000007;

int main(){
  int n;
  cin >> n;
  set<int> st;
  rep(i, n) {
    int a;
    cin >> a;
    if(st.find(a) == st.end()) st.insert(a);
    else st.erase(a);
  }
  cout << st.size() << endl;
}

Measured memory_bytes: 4864
#include <stdio.h>
#include <stdlib.h>
#define MAX 2000001
#define VMAX 10000

int main(){
  unsigned short *A, *B;
  int C[VMAX+1];
  int n, i, j;

  scanf("%d", &n);

  A = malloc(sizeof(short)*n+1);
  B = malloc(sizeof(short)*n+1);

  /* your code */
  for (i = 0; i < VMAX; i++)
    C[i] = 0;
  for (i = 0; i < n; i++){
    scanf("%d",&A[i]);
    C[A[i]]++;
  }
  for (i = 0; i < VMAX; i++)
    C[i+1] = C[i] + C[i+1];
  for (i = n-1; i >= 0; i--){
    B[C[A[i]]-1] = A[i];
    C[A[i]]--;
  }
  for (i = 0; i < n; i++){
    printf("%d",B[i]);
    if (i < n-1)
      printf(" ");
  }
  printf("\n");

  return 0;
}



Measured memory_bytes: 9640
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<cmath>
#include<map>
#include<stack>
#include<vector>
#include<queue>
#include<set>
#include<algorithm>
const int N = 1e9;
using namespace std;
#define INF 0x3f3f3f3f
#define mod 1000000009
#define e  2.718281828459045
#define PI acos(-1)
#define lowbit(x) (x&(-x))
#define read(x) scanf("%d",&x)
#define put(x) printf("%d\n",x)
#define memset(x,y) memset(x,y,sizeof(x))
#define ll long long

int main(){
	int len ;
	string s1,s2;
	cin>>len;
	getchar();
	cin>>s1>>s2;
	for(int i=0;i<len;i++){
		cout<<s1[i]<<s2[i];
	}
}


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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;

#define INF INT_MAX/3

#define MAX_N 1000

int a,b;

int main(){
	cin.sync_with_stdio(false);
	cin>>a>>b;
	if(a==b)cout<<"Draw"<<endl;
	else if(a==1||(b!=1&&a>b))cout<<"Alice"<<endl;
	else cout<<"Bob"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define MAX 101

int s[MAX];
int top;

int isEmpty(){
	if(top==0) return 1;
	return 0;
}

int isFull(){
	if(top >= MAX - 1) return 1;
	return 0;
}

void push(int x){
	if(isFull()){
		fprintf(stderr,"Stack is full.\n");
		exit(1);
	}else{
		top++;
		s[top]=x;
	}
}

int pop(){
	if(isEmpty()){
		fprintf(stderr,"Stack is empty.\n");
		exit(1);
	}
	top--;
	return s[top+1];
}



int main(void){
	int x,a,b;
	char c[8];
	top=0;
	while(scanf("%s",c)>0){
		if(c[0]=='+'&&c[1]=='\0'){
			b=pop();
			a=pop();
			push(a+b);
		}
		else if(c[0]=='-'&&c[1]=='\0'){
			b=pop();
			a=pop();
			push(a-b);
		}
		else if(c[0]=='*'&&c[1]=='\0'){
			b=pop();
			a=pop();
			push(a*b);
		}else{
			push(atoi(c));
		}
	}
	x=pop();
	if(isEmpty()) printf("%d\n",x);
	else fprintf(stderr,"Stack isn't empty. x=%d\n",x);
	return 0;
}

Measured memory_bytes: 1828