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

#define ALL(a) begin(a),end(a)
#define COUNTOF(a) (sizeof(a)/sizeof(a[0]))
#define SP << " " <<
#define FMT(a) #a<<":"<<a 
#define FMT2(a,b) #a<<":"<<a<<", "<<#b<<":"<<b 
#define FMT3(a,b,c) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c 
#define FMT4(a,b,c,d) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c<<", "<<#d<<":"<<d 
typedef long long ll;
template<class T> istream& operator >> (istream& s, vector<T>& v) {
  for (T& x: v) s >> x;
  return s;
}
inline void Yes(bool f){cout<<(f?"Yes":"No")<<endl;}
inline void YES(bool f){cout<<(f?"YES":"NO")<<endl;}

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

    int K,S; cin >> K>>S;

    int ans = 0;
    for (int x = 0; x <= K && x <= S; x++) {
        for (int y = 0; y <= K && y <= S - x; y++) {
            if (S - x - y <= K) ans++;
        }
    }
    cout << ans << endl;
}


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


int main() {
  const int inf = 100000000;
  int n, m;
  cin >> n >> m;

  int a[1000],b[1000],c[1000],dist[100][100];

  for(int i = 0; i < m; ++i){
    cin >> a[i] >> b[i] >> c[i];
    a[i]--,b[i]--;
  }

  //距離行列に0とinfを
  for(int i = 0; i < n; ++i){
    for(int j = 0; j < n; ++j){
      if(i==j) dist[i][j]=0;
      else dist[i][j]= inf;
    }
  }

  for(int i = 0; i < m; ++i){
    dist[a[i]][b[i]]=min(dist[a[i]][b[i]],c[i]);
    dist[b[i]][a[i]]=min(dist[b[i]][a[i]],c[i]);
  }

  //ワーシャルフロイド
  for(int k = 0; k < n; ++k){
    for(int i = 0; i < n; ++i){
      for(int j = 0; j < n; ++j){
        dist[i][j]=min(dist[i][j],dist[i][k]+dist[k][j]);
      }
    }
  }


  int ans=m;
  for(int i = 0; i < m; ++i){
    bool shortest=false;
    for(int j = 0; j < n; ++j) if(dist[j][a[i]]+c[i]==dist[j][b[i]]) shortest=true;
    if(shortest==true) --ans;
  }

  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){

	int A;
	int sn;
	int i;
	int max;
	int sum;
	int strt,len,k;
	
	sn=9999;
	
	scanf("%d",&sn);
	while(sn){
		max=-100001;
		sum=0;
		for(i=0;i<sn;i++){
			scanf("%d",&A);
			if(sum<0)sum=0;
			sum+=A;
			if(sum>=max)max=sum;
		}
		printf("%d\n",max);	
	scanf("%d",&sn);
	}
	return 0;
}

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

using ll= long long;

using namespace std;

int main() {
    ll N, Q;
    cin >> N >> Q;

    std::string S;
    cin >> S;

    std::vector<ll> ac(N);
    volatile ll cnt = 0;
    for (ll i = 0; i < N - 1; ++i) {
        if (S[i] == 'A' && S[i + 1] == 'C') {
            ++cnt;
        }
        ac[i] = cnt;
    }
    ac[N - 1] = cnt;

    ll l, r;
    for (ll i = 0; i < Q; ++i) {
        cin >> l >> r;
        --l;
        --r;

        if (l >= 1) {
            cout << ac[r - 1] - ac[l - 1] << endl;
        } else {
            cout << ac[r - 1] << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; ++i)
#define RREP(i, n) for (int i = n; 0 <= i; --i)
#define FOR(i, start, end) for (int i = start; i < end; ++i)
#define RFOR(i, start, end) for (int i = start; end <= i; --i)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1'000'000'007
#define INF32 1'050'000'000
#define INF64 4'000'000'000'000'000'000
using ll = long long;
using namespace std;
template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }

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

    ll N; cin >> N;
    string title[N];ll t[N];
    REP (i,N) cin >> title[i] >> t[i];
    string end; cin >> end;
    bool is_sleep = false;
    ll ans = 0;
    REP (i,N) {
        if (is_sleep) {
            ans += t[i];
        }
        if (end == title[i]) is_sleep = true;
    }

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



Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
import math


#t = int(input())
tmp = input().split()
a,b,c,d,e = list(map(lambda a: int(a), tmp))
if(a==0):
	print("1")
	sys.exit()
if(b==0):
	print("2")
	sys.exit()
if(c==0):
	print("3")
	sys.exit()
if(d==0):
	print("4")
	sys.exit()
if(e==0):
	print("5")
	sys.exit()


Measured memory_bytes: 9192
#include <bits/stdc++.h>
using namespace std;
int main()
{
   int n,flag=0;
   float tot=0,x,m;
   cin>>n>>m;
   vector <int> a(n);
   for(int i=0;i<n;i++)
   {
       cin>>a[i];
       tot+=a[i];
   }
  sort(a.begin(),a.end());

   for(int i=n-m;i<n;i++)
   {
       if(a[i]<(1/(4*m))*tot)
       {

        flag=1;
        cout<<"No";
       break;}

   }
   if(flag==0)
    cout<<"Yes";
    return 0;

}


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

typedef long long ll;

const int maxn = 9e5 + 5;
const int mod = 1e9 + 7;

int n, m, k, Q;
ll ans;
ll f[maxn], fac[maxn], inv[maxn], bin[maxn];

ll power(ll b, int k)
{
    ll res = 1;
    for(; k; k >>= 1, b = b * b % mod)
        if(k & 1)
            res = res * b % mod;
    return res;
}

ll C(int n, int m)
{
    if(m > n)
        return 0;
    return fac[n] * inv[m] % mod * inv[n - m] % mod;
}

int main()
{
    scanf("%d%d%d", &n, &m, &k);
    Q = m + k;
    f[0] = fac[0] = bin[0] = inv[0] = 1;
    for(int i = 1; i <= n + Q; i++)
    {
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = power(fac[i], mod - 2);
    }
    for(int i = 1; i <= Q; i++)
    {
        f[i] = ((f[i - 1] << 1) - C(i - 1, m) - C(i - 1, k) + (mod << 1)) % mod;
        bin[i] = bin[i - 1] * 3 % mod;
    }
    for(int i = 0; i <= Q; i++)
    {
        ll tmp = C(i + n - 1, n - 1) * f[i] % mod * bin[Q - i] % mod;
        ans += tmp;
        if(ans >= mod)
            ans -= mod;
    }
    printf("%lld\n", ans);
    return 0;
}


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

#define ll long long
#define int ll
#define pii pair<int, int>
#define pb push_back
#define INF 1e18
#define REP(i, n) for (int i=0; i<n; i++)
#define FOR(i, a, b) for (int i=a; i<b; i++)
#define REPD(i, n) for (int i=n-1; i>=0; i--)
#define FORD(i, a, b) for (int i=a; i>=b; i--)
#define vi vector<int>
#define all(v) v.begin(), v.end()
#define print(x) cout << x << endl
#define debug(x) cout << #x << " = "<< x << endl

const double PI=3.141592653589793238462643383279502884197169399375105820974944;

using namespace std;

ll calc_gcd(ll a, ll b) {
    if (b > a) swap(a, b);
    ll m = a % b;
    if (m == 0) {
        return b;
    } else {
        return calc_gcd(b, m);
    }
}

void solve() {
    ll A, B, C, D;
    cin >> A >> B >> C >> D;
    
    ll gcd = calc_gcd(C, D);
    ll lcm = C * D / gcd;
    
    ll numC = (B / C);
    ll numD = (B / D);
    ll numlcm = (B / lcm);
    ll numCa = ((A-1) / C);
    ll numDa = ((A-1) / D);
    ll numlcma = ((A-1) / lcm);

    ll ans = (B - A + 1) - (((numC-numCa) + (numD-numDa) - (numlcm-numlcma)));
    print(ans);

}

signed main() {
    solve();
}


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

int N;
vector<vector<int>> B(21);

int main(){
    int H,W;
    cin >> H >> W;
    char s[50][50];
    for(int i=0;i<H;++i)
        for(int j=0;j<W;++j) cin >> s[i][j];
    bool flag = true;
    for (int i = 0; i < H; i++)
    {
        for (int j = 0; j < W; j++)
        {
            bool k = false;
            if(s[i][j] == '.') continue;
            if(i-1 >= 0) {
                if(s[i-1][j] == '#') k =true;
            }
            if(i+1<H) {
                if(s[i+1][j] == '#') k=true;
            }
            if(j-1 >= 0) {
                if(s[i][j-1] == '#') k=true;
            }
            if(j+1 < W) {
                if(s[i][j+1] == '#') k=true;
            }
            if(!k) flag = false;
            if(!flag) {
                cout << "No" << endl;
                return 0;
            }
        }
        

    }
    cout << "Yes" << endl;
    
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <algorithm>
#include <map>
#include <fstream>
#include <bitset>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef priority_queue<int> pqi;
typedef priority_queue<ii> pqii;
typedef map<int, int> mii;
typedef map<int, string> mis;
typedef map<string, int> msi;
typedef set<int> si;
typedef set<ll> sl;
typedef map<ll, ll> mll;
typedef queue<int> qi;
typedef queue<ii> qii;
typedef vector<string> vs;
typedef pair<ll, ll> iil;
typedef vector<iil> viil;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int, ii> iii;
typedef vector<pair<pair<int,int>,int>> viii;
typedef vector<pair<pair<ll,ll>,ll>> viiil;

#define pb push_back
#define mp make_pair
#define rep(i, n) for (int i = 0 ; i < n ; i++)
#define INF 1000000000
#define MOD 1000000007;

void solve() {
    int x;
    cin >> x;
    if (x >= 30) {
        cout << "Yes" << '\n';
    }
    else {
        cout << "No" << '\n';
    }
}

void querySolve() {
    int n;
    cin >> n;
    while (n--) {
        solve();
    }
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    //querySolve();
    solve();

}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fir first
#define sec second
#define pb push_back
#define mp make_pair
#define u_set unordered_set
#define u_multiset unordered_multiset
 
/**************************/
/****** INT OVERFLOW ******/
/**************************/
int t, ar[4];
void solve(){
	cin >> t;
	while (t--){
		string s; cin >> s;
		if (s == "AC") ar[0]++;
		else if (s == "WA") ar[1]++;
		else if (s == "TLE") ar[2]++;
		else ar[3]++;
	}
}
	
int main()
{
	ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
 	
 	solve();
 	cout << "AC x " << ar[0] << '\n';
 	cout << "WA x " << ar[1] << '\n';
 	cout << "TLE x " << ar[2] << '\n';
 	cout << "RE x " << ar[3] << '\n';
	
    return 0; 
}




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

int main()
{

	int A[3][3];
	int N;
	int B[10];

	bool check[3][3];

	for (int i = 0; i < 3; i++)
	{
		for (int j = 0; j < 3; j++)
		{
			cin >> A[i][j];
			check[i][j] = false;
		}
	}
	cin >> N;
	for (int i = 0; i < N; i++)
	{
		cin >> B[i];
		for (int j = 0; j < 3; j++)
		{
			for (int k = 0; k < 3; k++)
			{
				if(!check[j][k]){
					check[j][k] = (B[i] == A[j][k]);
				}
			}
		}
	}

	bool bingo = false;
	for (int i = 0; i < 3; i++)
	{
		bingo |= (check[i][0] && check[i][1] && check[i][2]);
		bingo |= (check[0][i] && check[1][i] && check[2][i]);
	}
	bingo |= (check[0][0] && check[1][1] && check[2][2]);
	bingo |= (check[2][0] && check[1][1] && check[0][2]);

	cout << (bingo ? "Yes" : "No") << endl; 
	return 0;
}

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

#define int long long

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

string X;

signed main() {
    cin >> X;
    int ans = X.length();
    int depth = 0;
    for (int i = 0; i < X.length(); i++) {
        if (X[i] == 'S') {
            depth++;
        } else {
            if (depth > 0) {
                depth--;
                ans -= 2;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define ford(i,a,b) for(int i=(a);i>=b;i--)
#define rep(i,a,b) for(int i=(a);(i)<(b);(i)++)
#define ll long long
#define re return
#define mp map<int,int>
using namespace std;
int main() {
	int n,m;
	string s;
	cin>>n>>m>>s;
	rep(i,0,m-1)cout<<s[i];
	cout<<char(tolower(s[m-1]));
	rep(i,m,n)cout<<s[i];
	re 0;
}


Measured memory_bytes: 256
a,v = map(int,input().split())
b, w= map(int,input().split())
t = int(input())
A = a+(t*v)
B = b+(t*w)
if a == b:
    print('YES')
elif a < b:
    if B <= A:
        print('YES')
    else:
        print('NO')
else:
    A = a-(t*v)
    B = b-(t*w)
    if A <= B:
        print('YES')
    else:
        print('NO')

Measured memory_bytes: 9200
import collections
def resolve():
    n = int(input())
    a = tuple(map(int,input().split()))
    A = collections.Counter(a)
    cnt_0 = 0
    for i in A.values():
        cnt_0 += int(i*(i-1)/2)
    for i in a:
        cnt_1 = A[i]-1
        print(cnt_0-cnt_1)
resolve()

Measured memory_bytes: 34340
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N; cin>>N;
    int K; cin>>K;
    vector<long long int> H(N,0);
    for(int i=0;i<N;i++){
        cin>>H[i];
    }
    sort(H.begin(),H.end());
    reverse(H.begin(),H.end());
    long long int ans=0;
    for(int i=K;i<N;i++){
        ans=ans+H[i];
    }
    cout<<ans;
    return 0;
}

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

int main()
{
  int a[3][3];
  int b[3][3];
  for(int i=0;i<3;i++)
  {
    for(int j=0;j<3;j++)
  	{
      cin>>a[i][j];
      b[i][j] =0;
    }
  }
  int n,x;
  cin>>n;
  for(int k=0;k<n;k++)
  {
   cin>>x;
    for(int i=0;i<3;i++)
  {
    for(int j=0;j<3;j++)
  	{
     if(x==a[i][j])
     {b[i][j] = 1;}
    }
  }
  }
  int c=0;
  for(int i=0;i<3;i++)
  {
    if(b[i][0]==1 && b[i][1]==1 && b[i][2]==1)
    {c=1;}
	else if(b[0][i]==1 && b[1][i]==1 && b[2][i]==1)
    {c=1;}
  }
  if(b[0][0]==1 && b[1][1]==1 && b[2][2]==1)
  {c=1;}
  if(b[0][2]==1 && b[1][1]==1 && b[2][0]==1)
  {c=1;}  
  
  if(c==1)
  {cout<<"Yes";}
  else
  {cout<<"No";}
  
  
  
  return 0;
}

Measured memory_bytes: 256
N = int(input())
A=list(map(int,input().split()))
L=[0]*65
MOD=(10**9+7)
for i in range(N):
    t=str(format(A[i],"b"))
    for j in range(len(t)):
        L[j]+=int(t[-j-1])

for i in range(len(L)):
    L[i]=L[i]*(N-L[i])
    L[i]*=2**i
    L[i]%=MOD
print(sum(L)%MOD)




Measured memory_bytes: 122936
#include<stdio.h>

int main(void)
{
    int W, H, x, y, r;

    scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);

    if((x + r) <= W && (x - r) >= 0 && (y + r) <= H && (y - r) >= 0)
    {
        printf("%s\n", "Yes");
    }

    else
    {
        printf("%s\n", "No");
    }

    return 0;
}


Measured memory_bytes: 2100
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cassert>
#include<cmath>
#include<queue>
#include<cstring>
#include<climits>
#include<sstream>
#include<deque>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<bitset>

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)

using namespace std;

typedef long long ll;

const ll mod = 1000000007LL;

ll n,m,x[100010], y[100010];

void compute() {
  ll sumX = 0;
  REP(i,1,n+1) {
    ll v1 = ( x[i] * (ll)(i-1) ) % mod;
    ll v2 = ( x[i] * (ll)(n-i) ) % mod;
    ll v  = ( v1 - v2 ) % mod;
    ( sumX += v ) %= mod;
  }
  ll sumY = 0;
  REP(i,1,m+1) {
    ll v1 = ( y[i] * (ll)(i-1) ) % mod;
    ll v2 = ( y[i] * (ll)(m-i) ) % mod;
    ll v  = ( v1 - v2 ) % mod;
    ( sumY += v ) %= mod;
  }
  ll ans = ( sumX * sumY ) % mod;
  while( ans < 0LL ) ans += mod;
  cout << ans % mod << endl;
}

int main() {
  cin >> n >> m;
  REP(i,1,n+1) cin >> x[i];
  REP(i,1,m+1) cin >> y[i];
  compute();
  return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include<cmath>
#include <vector>


using namespace std;

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

int main() {
	long long int n, m;
	cin >> n >> m;
	vector< vector<long long int> > d(n, vector<long long int>(n, 10000000));
	vector<long long int> dd;
	vector<P> pp;
	for (int i = 0; i < m; i++) {
		long long int a, b, c;
		cin >> a >> b >> c;
		a--;
		b--;
		dd.push_back(c);
		d[a][b] = d[b][a] = c;
		pp.push_back(P(a, b));
	}
	for (long long int i = 0; i < n; i++) {
		d[i][i] = 0;
	}
	for (long long int k = 0; k < n; k++) {
		for (long long int i = 0; i < n; i++) {
			for (long long int j = 0; j < n; j++) {
				d[i][j] = min(d[i][j], d[i][k]+d[k][j]);
			}
		}
	}
	long long int p = 0;
	
	long long int ss = 0;
	for (long long int i = 0; i < m; i++) {
		if (d[pp[i].first][pp[i].second] < dd[i]) {
			ss++;
		}
	}
	cout << ss << endl;
	return 0;
}

Measured memory_bytes: 512
N = input()

i = 1
s = ""

while abs(i) <= abs(N):
	if (abs(N) & abs(i)) != 0:
		s += '1'
		N -= i
	else:
		s += '0'

	i *= -2

if s == "":
	s = "0"
s = s[::-1]
print s

Measured memory_bytes: 2568
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
max = sum(b)

for i in range(n):
  if a[i] > b[i]:
    a[i] -= b[i]
    b[i] = 0
  else:
    b[i] -= a[i]
    a[i] = 0
    
  if a[i+1] > b[i]:
    a[i+1] -= b[i]
    b[i] = 0
  else:
    b[i] -= a[i+1]
    a[i+1] = 0

print(max-sum(b))

Measured memory_bytes: 18476
#include <iostream>

int main(void)
{
    int N, A, B;
    std::cin >> N >> A >> B;

    if(N * A > B)
    {
        std::cout << B << std::endl;
    }

    else
    {
        std::cout << N * A << std::endl;
    }

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		// Nの入力
		int N = sc.nextInt();
		
		// Nの桁数
		int digit = String.valueOf(N).length();
				
		// 結果の出力
		int count = 0;
		switch (digit) {
			case 1:
				count = N;
				break;
			case 2:
				count = 9;
				break;
			case 3:
				count = N - 90;
				break;
			case 4:
				count = 999 - 90;
				break;
			case 5:
				count = N - 90 - 9000;
				break;
			case 6:
				count = 99999 - 90 - 9000;
				break;
		}
		System.out.println(count);
		
		sc.close();
	}
}


Measured memory_bytes: 23892
def solve():
    A, K = map(int, input().split())
    V = list(map(int, input().split()))
    ans = 0
    for left in range(min(K, A) + 1):
        for right in range(min(K, A) - left + 1):
            S = [0] + V[:left] + V[A - right:]
            S.sort()
            drop, rest = 0, K - (left + right)
            while drop < rest and S[drop] < 0: drop += 1
            ans = max(ans, sum(S) - sum(S[:drop]))
    return ans

print(solve())

Measured memory_bytes: 3064
N, A, B = map(int, input().split())
S = input()

passing_count = 0
rank = 1
for s in S:
    if s in ["a", "b"]:
        if passing_count < A + B:
            if s == "a":
                print("Yes")
                passing_count += 1
                continue
            else:
                if rank <= B:
                    print("Yes")
                    passing_count += 1
                    rank += 1
                    continue
    print("No")

Measured memory_bytes: 9132
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

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

  int n;
  cin >> n;
  vector<int> a(3 * n);
  rep(i, 0, 3 * n) cin >> a[i];
  sort(a.begin(), a.end());

  int l = 0, r = 3 * n - 1;
  ll ans = 0;
  rep(i, 0, n) {
    ans += a[r - 1];
    l++;
    r -= 2;
    if (r <= l)
      break;
  }
  cout << ans << endl;
}


Measured memory_bytes: 1408
#include<stdio.h>
#include<stdlib.h>
#include<string.h>


int str_cmp(const void *a,const void *b){
  return strcmp((char *)a,(char *)b);
}

long int nc2(long int n){
  n=n*(n-1);

  return n/2;
}

 int  main(void){
  int n;
  int i,j,k;
  scanf("%d",&n);
  char s[n+1][11];
  int checker;
  long long ans=0;
  int cnt=1;

  for(i=0;i<n;i++){
    scanf("%s",s[i]);

  }
  for(i=0;i<n;i++)
  qsort(s[i],10,sizeof(char),str_cmp);//(int (*)(const void *,const void *))

  qsort(s,n,sizeof(char)*11,str_cmp);//配列の大きさは揃えないといけない

/*  for(i=0;i<n;i++){
    printf("%s\n",s[i]);
  }*/

    //printf("s[%d]:%s\n",i,s[i]);

  for(i=0;i<n;i++){
    if(strcmp(s[i],s[i+1])==0){
      cnt++;
    //  printf("iko-rudesu\n");
    }
    else{
    //  printf("nc2(cnt)==%d",nc2(cnt));
      ans=ans+nc2(cnt);
      cnt=1;
    }
}

      //printf("checker=%d",checker);

  printf("%lld",ans);

  return 0;
}


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

int main(){
  int N,K;
  int l[60];
  int sum=0;

  cin >> N >> K;
  for(int i=0;i<N;i++)
    cin >> l[i];


  sort(l,l+N,greater<int>());

  for(int i=0;i<K;i++)
    sum+=l[i];

  cout << sum << endl;
  

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
#include <math.h>

using namespace std;

int main(){
    long long n;
    cin>>n;
    long long a,b;
    cin>>a>>b;
    long long hoge=a+b;
    long long fuga=n/hoge*a;
    n%=hoge;
    if(n<=a) cout<<fuga+n<<endl;
    else cout<<fuga+a<<endl;
    
    return 0;
}

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

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

using namespace std;
using lint=long long;

map<long long,int> prime_factorize(long long a){
	map<long long,int> res;
	if(a%2==0){
		int cnt=0;
		do{ cnt++; a/=2; }while(a%2==0);
		res.emplace(2,cnt);
	}
	for(long long p=3;p*p<=a;p+=2) if(a%p==0) {
		int cnt=0;
		do{ cnt++; a/=p; }while(a%p==0);
		res.emplace(p,cnt);
	}
	if(a>1) res.emplace(a,1);
	return res;
}

int main(){
	lint n,a; cin>>n>>a;

	lint ans=1;
	for(auto q:prime_factorize(a)) rep(_,q.second/n) ans*=q.first;
	cout<<ans<<'\n';

	return 0;
}


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

int main(){
  int N; cin>>N;
  vector<ll> a(N);
  ll ans=0;
  rep(i,N){
    cin>>a[i];
    while(a[i]%2==0){
      a[i]/=2;
      ans++;
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 384
def cal(a, op, b):

  if op == '+':
    r = a + b
  elif op == '-':
    r = a - b
  elif op == '*':
    r = a * b
  else:
    r = a / b
  return r

while 1:
  a,op,b = raw_input().split()
  if op == '?':
    break
  else:
    print(cal(int(a), op, int(b)))

Measured memory_bytes: 4208
#include <bits/stdc++.h>
using namespace std;
 
/*iamsorry*/
 
#define thegamebegins   ios_base::sync_with_stdio(false); cin.tie(NULL);
#define fileio          freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define int             long long
#define float           long double
#define test            int t; cin>>t; while(t--)
#define in(a,n)         for(int i=0; i<n; ++i)  cin>>a[i]
#define r0              return 0
#define E               "\n"
#define S               " "
#define elif            else if 
#define M               1000000007
#define fi(i,x,y)       for(int i=x; i<y; ++i)
#define fa(i,s)         for(auto i:s)
#define fp(i,s)         for(auto i=(s).begin(); i!=(s).end(); ++i)
#define vi              vector <int>
#define vpii            vector <pair <int,int> >
#define mii             map <int,int>
#define pii             pair <int,int>
#define seti            set <int>
#define setd            set <int,greater <int> >
#define all(s)          (s).begin(),(s).end()
#define sortd(a,n)      sort(a, a+n, greater<int>())
#define pb              push_back
#define mp              make_pair
#define fr              first
#define sc              second
#define lb              lower_bound
#define ub              upper_bound
#define er              equal_range
 
const int INF = 0x3f3f3f3f;

signed main()
{
    thegamebegins

    string s;   cin>>s;
    cout<<(s[2]==s[3] && s[4]==s[5]?"Yes":"No");
    r0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int T;
int main(){
	scanf("%d",&T);
	while(T--){
		ll a,b,ans=0;
		scanf("%lld%lld",&a,&b);
		ll x=sqrt(a*b);
		if(x*(x+1)<a*b)ans=2*x-1;
		else if(x*x==a*b){
			if(a==b)ans=(x-1)*2;
			else ans=(x-1)*2-1;
		}
		else ans=(x-1)*2;
		printf("%lld\n",ans);
	}
	return 0;
} 

Measured memory_bytes: 3760
#include <stdio.h>

static const int MAXNUMOFINPUT = 100;

int insertionSort(int A[], int N);
int printArray(int A[], int N);

int main()
{
    int i;
    int N;
    int A[MAXNUMOFINPUT];

    scanf("%d", &N);
    for (i = 0; i < N; i++)
    {
        scanf("%d", &A[i]);
    }
    
    printArray(A, N);
    insertionSort(A, N);

    return 0;
}

int insertionSort(int A[], int N)
{
    int i, j;
    int v;

    for (i = 1; i < N; i++)
    {
        v = A[i];
        j = i - 1;
        while(j >= 0 && A[j] > v)
        {
            A[j + 1] = A[j];
            j--;
        }
        A[j + 1] = v;

        printArray(A, N);
    }
}

int printArray(int A[], int N)
{
    int i;

    for (i = 0; i < N; i++)
    {
        printf("%d", A[i]);
        if(i < N - 1)
        {
            printf(" ");
        }
    }

    printf("\n");

    return 0;
}



Measured memory_bytes: 2112
#include "bits/stdc++.h"
#define REP(i, m, n) for(long long i = m; i < n; ++i)
#define CO(n) cout << n << endl
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int N,K;
ll ans = 0;
ll H[200010];

int main()
{
    ios::sync_with_stdio(false);
    cin >> N >> K;
    REP(i,0,N) cin >> H[i];
    sort(H, H+N, greater<int>());
    reverse(H,H+N);
    REP(i,0,N-K) ans+= H[i];
    CO(ans);
    return 0;
}

Measured memory_bytes: 1792
A=input()+'0'
B=input()+'0'
C=input()+'0'
S=A[0]
x=1;y=0;z=0
for i in range(301):
    if S=='a':
        S=A[x]
        x+=1
        if S=='0':
            print('A')
            break
    elif S=='b':
        S=B[y]
        y+=1
        if S=='0':
            print('B')
            break
    else:
        S=C[z]
        z+=1
        if S=='0':
            print('C')
            break

Measured memory_bytes: 3064
#include"bits/stdc++.h"
using namespace std;

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

    int h = 100, w = 100;

    A--;
    B--;

    vector<string> s(h);
    for (int i = 0; i < h; i++) {
        s[i].resize(w);
        if (i < h / 2) {
            for (int j = 0; j < w; j++) {
                s[i][j] = '#';
            }
        } else {
            for (int j = 0; j < w; j++) {
                s[i][j] = '.';
            }
        }
    }

    for (int i = 0; i < A; i++) {
        int x = i % 50 * 2;
        int y = i / 50 * 2;

        s[y][x] = '.';
    }

    for (int i = 0; i < B; i++) {
        int x = i % 50 * 2;
        int y = h - 1 - i / 50 * 2;

        s[y][x] = '#';
    }

    cout << h << " " << w << endl;
    for (int i = 0; i < h; i++) {
        cout << s[i] << endl;
    }
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
 
int main(void){
int a[3],b[3];
int aa=0,bb=0,cc=0,dd=0;
scanf("%d %d",&a[0],&b[0]);
scanf("%d %d",&a[1],&b[1]);
scanf("%d %d",&a[2],&b[2]);

for(int i=0;i<3;i++){
    if(a[i]==1){aa++;}
    else if(a[i]==2){bb++;}
    else if(a[i]==3){cc++;}
    else if(a[i]==4){dd++;}
    if(b[i]==1){aa++;}
    else if(b[i]==2){bb++;}
    else if(b[i]==3){cc++;}
    else if(b[i]==4){dd++;}
}

if(aa==3||cc==3||bb==3||dd==3){printf("NO\n");}
else{printf("YES\n");}


}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
 
int main(){
  const int  lng = 3;
  int cnt = 0;
  char s[lng];
  char t[lng];
  rep(i,3)cin >>s[i];
  rep(i,3)cin >> t[i];
  rep(i,lng+1){
    if(s[i] == t[i])cnt++;
  }
//   rep(i,3)cout << s[i] <<t[i]<< endl;
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 256
N = int(input())
X = [list(map(int, input().split())) for _ in range(N)]
X.sort(key = lambda X:X[1])
time = 0
ans = 'Yes'
for i in range(N):
  time += X[i][0]
  line = X[i][1]
  if line < time :
    ans = 'No'
print(ans)

Measured memory_bytes: 53660
// 22
/****************************************************
https://searleser97.gitlab.io/algorithms/template.cpp
****************************************************/

#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define fors(_, x, n, s) for (int _ = x; _ < n; _ += s)
#define forn(_, x, n) fors(_, x, n, 1)
#define rep(_, n) forn(_, 0, n)
#define forrs(_, x, n, s) for (int _ = x; _ > n; _ -= s)
#define forrn(_, x, n) forrs(_, x, n, 1)
#define rrep(_, n) forrn(_, n - 1, -1)
#define fi first
#define se second
#define pb push_back
#define pairii pair<int, int>
#define all(x) x.begin(), x.end()
#define cerr(s) cerr << "\033[48;5;196m\033[38;5;15m" << s << "\033[0m"
// typedef __int128_t lli;
typedef long long int li;
typedef long double ld;
// 12
void _main(int tc) {
  int n;
  cin >> n;
  assert(n >= 2);
  vector<li> h(n);
  rep(i, n) cin >> h[i];
  vector<li> mem(n, -1);
  mem[n - 1] = 0;
  mem[n - 2] = abs(h[n - 2] - h[n - 1]);
  // function<li(li)> fcost = [&](int pos) -> li {
  //   if (mem[pos] != -1) return mem[pos];
  //   return mem[pos] = min(abs(h[pos] - h[pos + 1]) + fcost(pos + 1),
  //                         abs(h[pos] - h[pos + 2]) + fcost(pos + 2));
  // };
  // cout << fcost(0) << endl;
  rrep(i, n - 2) {
    mem[i] = min(abs(h[i] - h[i + 1]) + mem[i + 1],
                 abs(h[i] - h[i + 2]) + mem[i + 2]);
  }
  cout << mem[0] << endl;
}

int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  _main(0);
  return 0;
  int tc;
  cin >> tc;
  rep(i, tc) _main(i + 1);
}

Measured memory_bytes: 1792
#include<iostream>
#include<cmath>
#include<vector>
#include<algorithm>
#include<string.h>
#include<iomanip>
using namespace std;

#define PI 3.14159265358979323846264338327950L

int ctoi(const char c) {
    switch (c) {
    case '0': return 0;
    case '1': return 1;
    case '2': return 2;
    case '3': return 3;
    case '4': return 4;
    case '5': return 5;
    case '6': return 6;
    case '7': return 7;
    case '8': return 8;
    case '9': return 9;
    default: return -1;
    }
}

int main() {
	char s[200000 + 1];
	long long sum = 0;

	cin >> s;

	for (int ii = 0; ii < strlen(s); ii++) {
        int ret = ctoi(s[ii]);
        sum += ret;
	}

    if (sum % 9 == 0) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3784
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

const int dm = 1 << 21;
char dn[dm], * di = dn, dt;
inline void putint(int X) {
	int keta = 0;
	char C[10];
	while (X) {
		*(C + keta) = '0' + X % 10;
		X /= 10;
		keta++;
	}
	for (int i = keta - 1; i >= 0; i--)* di++ = (*(C + i));
	*di++ = '\n';
}

const int K = 21;
const int KM = 1 << (K - 1);
int laz[1 << K];
int zero = 2e9;
void update(int L, int R, int X, int A, int l, int r) {
	if (r <= L || R <= l) return;
	if (L <= l && r <= R) {
		laz[A] = min(laz[A], X);
		return;
	}
	update(L, R, X, A * 2, l, (l + r) / 2);
	update(L, R, X, A * 2 + 1, (l + r) / 2, r);
}

void pakuripair_sort(int N, int A[], int B[]) {
	const int b = 8;
	int tmp[600001], tmp2[600001];
	rep(k, 4) {
		int kazu[1 << b] = {}, kazu2[1 << b] = {};
		rep(i, N) kazu[A[i] >> k * b & ((1 << b) - 1)]++;
		rep(i, (1 << b) - 1) kazu[i + 1] += kazu[i];
		for (int i = N - 1; i >= 0; i--) {
			tmp[--kazu[A[i] >> k * b & ((1 << b) - 1)]] = A[i];
			tmp2[kazu[A[i] >> k * b & ((1 << b) - 1)]] = B[i];
		}
		k++;
		rep(i, N) kazu2[tmp[i] >> k * b & ((1 << b) - 1)]++;
		rep(i, (1 << b) - 1) kazu2[i + 1] += kazu2[i];
		for (int i = N - 1; i >= 0; i--) {
			A[--kazu2[tmp[i] >> k * b & ((1 << b) - 1)]] = tmp[i];
			B[kazu2[tmp[i] >> k * b & ((1 << b) - 1)]] = tmp2[i];
		}
	}
}

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


	int N = getint(), Q = getint();
	int X[200000];
	int all[600001], k[600001];
	rep(i, N) {
		int s = getint(), t = getint();
		X[i] = getint();
		all[i + i] = s - X[i] + 1e9;
		all[i + i + 1] = t - X[i] + 1e9;
	}
	rep(i, Q) all[N + N + i] = getint() + 1e9;
	rep(i, N + N + Q) k[i] = i;
	pakuripair_sort(N + N + Q, all, k);
	rep(i, N + N + Q) {
		all[k[i]] = i;
	}

	rep(i, 1 << K) laz[i] = zero;

	rep(i, N) {
		int L = all[i + i];
		int R = all[i + i + 1];
		update(L, R, X[i], 1, 0, KM);
	}
	rep1(i, KM - 1) {
		laz[i * 2] = min(laz[i * 2], laz[i]);
		laz[i * 2 + 1] = min(laz[i * 2 + 1], laz[i]);
	}
	rep(i, Q) {
		if (laz[KM + all[N + N + i]] == zero) {
			*di++ = '-';
			*di++ = '1';
			*di++ = '\n';
		}
		else putint(laz[KM + all[N + N + i]]);
	}

	fwrite(dn, 1, di - dn, stdout);

	Would you please return 0;
}

Measured memory_bytes: 22272
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree < pairs ,  null_type , greater<pairs>,  rb_tree_tag ,  tree_order_statistics_node_update > 
#define ll long long
#define lld long double
#define vc vector<ll>
const ll MOD=(1e9 +7);
typedef pair<ll,ll>pairs;
ll power(ll a, ll b){ll res=1;a=a%MOD;while(b>0){if(b&1){res=(res*a)%MOD;b--;}a=(a*a)%MOD;b>>=1;}
    return res;}

int main() {
	// your code goes here
	std::ios::sync_with_stdio(false);
	ll t,n,i,r,j,k,l,c,f;
	cin>>l>>r>>n;c=0;
	for(i=l;i<=r;i++)
	{
	    if(i%n==0)
	        c++;
	}
	cout<<c;
	return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef tuple<ll, ll, ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define REP(i,n) for (ll i = 0; i < n; ++i)
#define REPR(i,n) for (ll i = n-1; i >= 0; --i)
#define FOR(i,m,n) for (ll i = m; i < n; ++i)
#define FORR(i,m,n) for (ll i = n-1; i >= m; --i)
#define FORE(x,xs) for (const auto& x : xs)
#define ALL(v) v.begin(), v.end()
#define CHMIN(x,y) x = min(x, y)
#define CHMAX(x,y) x = max(x, y)

ll N, A;

ll sub(int k) {
    ll w, t;
    for (t = 1; t < N; t++) {
        w = 1;
        REP (i, k+1) w *= t;
        if (w >= N) break;
    }
    // w = t^(k+1), w >= N, (t-1)^(k+1) < N
    ll l = 0;
    while (w >= N) {
        l++;
        w /= t;
        w *= (t - 1);
    }
    l--;
    ll ret = A*k + (t-1) * l + t * (k-l+1);
    return ret;
}

ll solve() {
    ll ans = N;
    FOR (i, 1, 40) CHMIN (ans, sub(i));
    return ans;
}

int main() {
    cin >> N >> A;
    cout << solve() << endl;
}

Measured memory_bytes: 256
#ifdef LOCAL111
	#define _GLIBCXX_DEBUG
#else
	#define NDEBUG
#endif
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
const int INF = 1e9;
using namespace std;
template<typename T, typename U> ostream& operator<< (ostream& os, const pair<T,U>& p) { os << '(' << p.first << ' ' << p.second << ')'; return os; }

#define endl '\n'
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#ifdef LOCAL111
	#define DEBUG(x) cout<<#x<<": "<<(x)<<endl
	template<typename T> void dpite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
#else
	#define DEBUG(x) true
	template<typename T> void dpite(T a, T b){ return; }
#endif
#define F first
#define S second
#define SNP string::npos
#define WRC(hoge) cout << "Case #" << (hoge)+1 << ": "
template<typename T> void pite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
template<typename T> bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;}
template<typename T> bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;}

typedef long long int LL;
typedef unsigned long long ULL;
typedef pair<int,int> P;

void ios_init(){
	//cout.setf(ios::fixed);
	//cout.precision(12);
#ifdef LOCAL111
	return;
#endif
	ios::sync_with_stdio(false); cin.tie(0);
}

int main()
{
	ios_init();
	LL x, y;
	while(cin >> x >> y) {
		if(x < y) {
			cout << x << endl;
		} else {
			if(x%y != 0) {
				cout << x << endl;
			} else {
				cout << -1 << endl;
			}
		}
	}
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
//#include<time.h>
void judge_str(int start, int end,int coefficient);
int count, flag, n;
char genome[101];
int c_coef[500000] = { 0 }, start2[500000], end2[500000], count_str = 0;

int main()
{
	int start, end;
	//clock_t START, END;
	while (1)
	{
		for (int i = 0; i < count_str; i++) c_coef[i] = 0;
		count_str = 0;
		scanf("%s %d",genome,&n);
		if (genome[0] == '0'&&n == 0) break;
		//START = clock();
		count = 0;
		flag = 1;
		for (end = 0; genome[end] != '\0'; end++);
		judge_str(0, end, 1);
		if (count-1 < n)printf("0\n");
		//END = clock();
		//printf("%.2f秒かかりました\n", (double)(END - START) / CLOCKS_PER_SEC);
	}
	return 0;
}
void judge_str(int start, int end, int coefficient)
{
	int i, t,brackets=0;

	for (i=0;i<coefficient && flag;i++)
	{
		for (t = start; t < end && flag; t++)
		{
			if ('0' <= genome[t] && genome[t] <= '9')
			{
				c_coef[count_str] = c_coef[count_str] * 10 + genome[t]-'0';
			}
			else if (genome[t] == '(')
			{
				start2[count_str] = t+1;
				t++;
				for (brackets = 1; brackets; t++)
				{
					if (genome[t] == '(')brackets++;
					if (genome[t] == ')')brackets--;
				}
				t--;
				end2[count_str] = t;
				count_str++;
				judge_str(start2[count_str-1],end2[count_str-1],c_coef[count_str-1]);
				
			}
			else
			{
				if (c_coef[count_str] != 0) judge_str(t, t + 1, c_coef[count_str++]);
				else count++;
				 if (count - 1 == n && flag)
				{
					printf("%c\n", genome[t]);
					flag = 0;
				}
				
			}
		}
	}
}



Measured memory_bytes: 6268
#include<stdio.h>

int main(){
    int i,j,a,b,c,d,A[101][101];

    scanf("%d",&a);
    for(i = 0;i <= a;i++){
        for(j = 0;j <= a;j++){
            A[i][j] = 0;
        }
    }

    for(i = 0;i < a;i++){
        scanf("%d%d",&b,&c);
        for(j = 0;j < c;j++){
            scanf("%d",&d);
            A[b][d] = 1;
        }
    }

    for(i = 1;i <= a;i++){
        for(j = 1;j < a;j++){
            printf("%d ",A[i][j]);
        }
        printf("%d\n",A[i][j]);
    }
    return 0;
}


Measured memory_bytes: 2104
#include<bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<(int)(b);++i)
#define rep(i,n) REP(i,0,n)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

using namespace std;
typedef long long ll;

int main() {
    string S;
    cin >> S;
    if (S[0] != 'A') {
        cout << "WA" << endl;
        return 0;
    }
    int count = 0;
    for (int i = 2; i < S.length() - 1; i++) {
        if (S[i] == 'C') count++;
    }
    if (count != 1) {
        cout << "WA" << endl;
        return 0;
    }
    count = 0;
    for (int i = 0; i < S.length(); i++) {
        if (S[i] - 'A' < 26) count++;
    }
    if (count != 2) {
        cout << "WA" << endl;
        return 0;
    }
    cout << "AC" << endl;
    return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
        using namespace std;
        #define endl              "\n"
        #define int               long long
        #define rep(i,a,b)        for(long long i=a;i<b;i++)
        #define repp(i,a,b)        for(long long i=a;i<=b;i++)
        #define IOS ios::sync_with_stdio(0);cin.tie(0); cout.tie(0);
         
         
        void solve()
        {
            int i=0,j=0,k,n;
            string s;
            cin >>n>>k;


            if(n<=k){

            cout<<"unsafe"endl;
            }
            else
            	cout<<"safe"<<endl;

           
        }
         
        signed main() {
            IOS;
        
            //sieve();
            int t = 1;
           // cin >> t;
            while (t--) solve();
            return 0;
        }

Measured memory_bytes: 3640
#include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 1000000000
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int N, Z, W, a[2222];

std::pair<int, int> memo[2222][2];


int dfs(int i, int j, int k)
{
  if (i == N - 1)
    return std::abs(a[i] - k);

  if (memo[i][j].first >= 0) {
    std::pair<int, int>& pair = memo[i][j];

    if (j == 0) {
      if (k >= pair.first)
        return pair.second;
    }
    else {
      if (k <= pair.first)
        return pair.second;
    }
  }

  int s = j == 0 ? INF : -INF;

  for (int ii = i + 1; ii < N; ii ++) {
    int ss = dfs(ii, 1 - j, a[i]);

    if (j == 0) {
      if (ss < s)
        s = ss;
    }
    else {
      if (ss > s)
        s = ss;
    }
  }

  memo[i][j] = std::make_pair(k, s);

  return s;
}


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);

  std::cin >> N >> Z >> W;

  for (int i = 0; i < N; i ++)
    std::cin >> a[i];

  for (int i = 0; i < N; i ++)
    memo[i][0] = memo[i][1] = std::make_pair(-1, -1);

  int sp = -INF;

  for (int i = 0; i < N; i ++) {
    int s = dfs(i, 0, W);

    if (s > sp)
      sp = s;
  }

  std::cout << sp << std::endl;

  return 0;
}


Measured memory_bytes: 640
unittest
{
	assert( [ "-9" ].solve == "1011" );
	assert( [ "123456789" ].solve == "11000101011001101110100010101" );
	assert( [ "0" ].solve == "0" );
}



import std.conv;
import std.range;
import std.stdio;

void main()
{
	stdin.byLineCopy.solve.writeln;
}

auto solve( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto n = input.front.to!( long );
	
	if( n == 0 ) return "0";
	
	// -2進数表記での桁数と、この桁数で表せる範囲を計算
	auto d = 0L;
	auto ps = [ 0L ];
	auto ms = [ 0L ];
	for( ; n < ms.back || ps.back < n; d++ )
	{
		auto s = ( -2L ) ^^ d;
		ps ~= ps.back;
		ms ~= ms.back;
		if( 0 < s ) ps.back += s;
		else        ms.back += s;
	}
	
	// 上の桁から順番に変換
	auto anss = new byte[ d ];
	foreach( i, ref ans; anss )
	{
		auto j = d - i.signed - 1;
		auto s = ( -2L ) ^^ j;
		
		// 一桁少ないときに表現できるなら0、できないなら1
		if( 0 < s )
		{
			if( ps[ j ] < n )
			{
				n -= s;
				ans = 1;
			}
		}
		else
		{
			if( n < ms[ j ] )
			{
				n -= s;
				ans = 1;
			}
		}
	}
	return anss.to!( string[] ).join();
}


Measured memory_bytes: 2792
/* ex 7_1
   nnasy */

#include <stdio.h>

//指定された構造体
typedef struct point{
    int x_elem;
    int y_elem;
}point;

//複素数平面上の2点a,bについて、bから見てaを270度回転させた先の点cを返す関数
point shift_point(point a, point b){
    point c;
    c.x_elem = b.x_elem + (a.y_elem - b.y_elem);
    c.y_elem = b.y_elem - (a.x_elem - b.x_elem);
    return c;
}

int main(void){
    //宣言
    point p1, p2, p3, p4;
    //入力
    scanf("%d %d %d %d", &p1.x_elem, &p1.y_elem, &p2.x_elem, &p2.y_elem);
    
    //座標(x3, y3)を求める
    p3 = shift_point(p1, p2);
    //座標(x4, y4)を求める
    p4 = shift_point(p2, p3);
    
    //出力
    printf("%d %d %d %d\n", p3.x_elem, p3.y_elem, p4.x_elem, p4.y_elem);
    
    return 0;
}

Measured memory_bytes: 1692
(defun read-nums (n arr)
  (loop :as i
        :below n
        :do (setf (aref arr i) (read))))

(defun calc-health (arr p)
  (loop :as i
        :across arr
        :sum (expt (- i p) 2)))

(defun collect-health (arr)
  (loop :as i
        :below 100
        :collect (calc-health arr (+ i 1))))

(let* ((n (read))
       (p (make-array n :initial-element 0 
                        :element-type 'fixnum)))
  (read-nums n p)
  (princ (apply #'min (collect-health p))))

Measured memory_bytes: 8552
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}
int gcd(int a, int b){//ユークリッドの互除法
  if (a < b) gcd(b,a); //aの方がbよりでかいのが前提
  if (b == 0) return a; //aをbで割り切れたらreturn
  else gcd(b, a % b);
}

int main(){
  int n; cin >> n;
  map<int,int> mp;
  rep(i,n){
    int a; cin >> a;
    mp[a]++;
  }
  
  //for(auto m:mp) printf("%d %d\n",m.first,m.second);
  
  if(mp.size() > 3){
    cout << "No" << endl;
  }else if(mp.size() == 3){
    int tmp = 0;
    for(auto m:mp){
      tmp ^= m.first;
      if(m.second != n/3){
        cout << "No" << endl;
        return 0;
      }
    }
    if(tmp==0){
      cout << "Yes" << endl;
    }else cout << "No" << endl;
  }else if(mp.size() == 2){
    int cnt = 1;
    for(auto m:mp){
      if(cnt == 1){
        if(m.first != 0 || m.second != n/3){
          cout << "No" <<endl;
          return 0;
        }
        cnt++;
      }
    }
    cout << "Yes" << endl;
  }else{
    for(auto m:mp){
      if(m.first == 0) cout << "Yes" << endl;
      else cout << "No" << endl;
    }
  }
  
  return 0;
}

Measured memory_bytes: 3840
//#pragma GCC target("avx2")
//#pragma GCC optimization("O3")
//#pragma GCC optimization("unroll-loops")
//assert(q==w) если q!=w --> runtime error
#include <bits/stdc++.h>

#define pb push_back
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define ub upper_bound
#define lb lower_bound
#define bit __builtin_popcount
#define memset(x) memset(x,0,sizeof(x))

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<vector<int>> matrix;

inline void boost(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}

const ll maxn=2e5+123;
const ll inf=1e9+123;
const ll linf=1e18+123;
const ll mod=1e9+7;
const double eps=1e-9;
const double pi=acos(-1);
int dx[8]={0,1,-1,0,1,-1,1,-1};
int dy[8]={1,0,0,-1,1,1,-1,-1};

int main(){
    boost();
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    string a,b;
    cin>>a>>b;
    cout<<b+a;
	exit(0);
}


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

using namespace std;
using ll = long long int;

int main(void) {
    constexpr ll MOD = 1e9 + 7;
    constexpr double PI = acos(-1);
    cout << fixed << setprecision(16);
    cin.tie(0); ios::sync_with_stdio(false);

    ll H, W, h, w;
    cin >> H >> W >> h >> w;

    vector<vector<ll>> imos(H+1, vector<ll>(W+1, 0));
    for(ll i=1; i<=H; i++)
        for(ll j=1; j<=W; j++)
            imos[i][j] = 3000*i*j;
    for(ll i=0; i+h<=H; i++)
    for(ll j=0; j+w<=W; j++) {
        // -1 = imos[i+h][j+w] + imos[i][j] - imos[i+h][j] - imos[i][j+w]
        imos[i+h][j+w] = imos[i+h][j] + imos[i][j+w] - imos[i][j] - 1;
    }

    vector<vector<ll>> res(H, vector<ll>(W, 1));

    for(ll i=0; i<H; i++)
        for(ll j=0; j<W; j++)
            res[i][j] = imos[i+1][j+1] + imos[i][j] - imos[i+1][j] - imos[i][j+1];

    if(imos[H][W] > 0) {
        cout << "Yes" << endl;
        for(ll i=0; i<H; i++, cout << endl)
            for(ll j=0; j<W; j++)
                cout << res[i][j] << ' ';
    } else
        cout << "No" << endl;
}


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


class Program
{


    static void Main(string[] args)
    {
        Solve();
    }

    static void Solve()
    {
        Scan sc = new Scan();
        write wr = new write();

        var s = sc.intarr;
        int n = s[0];

        wr.wri(n / 3);
    }

}
    class Scan
    {
        public string str => Console.ReadLine();

        public string[] strarr => str.Split(' ');

        public long[] longarr => strarr.Select(long.Parse).ToArray();
        public int[] intarr => strarr.Select(int.Parse).ToArray();

    }



class write
{
    public void wri<Type>(Type x)
    {
        Console.WriteLine(x);
    }
}


Measured memory_bytes: 13396