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

using namespace std;
#define DBG(x)                         \
    (void)(cout << "L" << __LINE__     \
                << ": " << #x << " = " \
                << (x) << '\n')

typedef long long ll;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int INF = 0x3f3f3f3f;
const int maxn = 110000;
const int mod = 1e9 + 7;
ll power(ll a, ll b)
{
    ll ans = 1 % mod;
    while (b > 0)
    {
        if (b & 1)
        {
            ans = ans * a % mod;
        }
        a = a * a % mod;
        b >>= 1;
    }
    return ans;
}
int main()
{
    //检查有没有特判0,有没有越界限.
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setiosflags(ios::fixed) << setprecision(12);
    int n;
    cin >> n;
    vector<ll> a(n + 1);
    ll mx = -1;
    for (int i = 1; i <= n; i++)
    {
        cin >> a[i];
        mx = max(mx, a[i]);
    }
    int len = 0;
    while (mx)
    {
        mx = mx >>= 1;
        len++;
    }
    vector<ll> cnt0(len + 1), cnt1(len + 1);
    for (int i = 1; i <= n; i++)
    {
        ll cur = a[i];
        int t = 0;
        for (int j = 0; j < len; j++)
        {
            if (cur >> j & 1)
            {
                cnt1[j]++;
            }
            else
            {
                cnt0[j]++;
            }
        }
    }
    ll ans = 0;
    for (int i = 0; i < len; i++)
    {
        ans = (ans + cnt0[i] * cnt1[i] % mod * ((1ll << i) % mod)) % mod;
    }
    cout << ans << "\n";
    //cout << len << "\n";
    return 0;
}

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

int main() {
    int N;  cin >> N;
    string S;  cin >> S;
    for (int i = 0; i < (int)S.size(); ++i) {
        S[i] = S[i] + N;
        if (S[i] > 'Z') S[i] -= 26;
    }
    cout << S << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF 9999999;
using namespace std;
inline int read() {
	char c = getchar(); int x = 0, f = 1;
	while(c < '0' || c > '9') {if(c == '-') f = -1; c = getchar();}
	while(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return x * f;
}
int n,m,ans;
int main()
{
	n=read();
	m=read();
	ans=(m-1)*(n-1);
	cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>*/
 
#define pll              pair <long long,long long>
#define pb               push_back
#define ll               long long
#define ff               first
#define ss               second
#define D(x)             cerr<<#x " = "<<(x)<<endl
#define vll              vector <ll>
#define IOS              ios_base::sync_with_stdio(0); cin.tie(NULL);
#define endl             '\n'   
using namespace std;
int main()
{
    IOS
 	// freopen("input.txt","r",stdin);
 	// freopen("output.txt","w",stdout);
 	// freopen("error.txt","w",stderr);
 	ll a[3][3];
 	for(ll i=0;i<3;i++)
 	{
 		for(ll j=0;j<3;j++)
 		{
 			cin>>a[i][j];
 		}
 	}
 	ll n;
 	cin>>n;
 	ll b[n];
 	for(ll ii=0;ii<n;ii++)
 	{
 		ll x;
 		cin>>x;
 		for(ll i=0;i<3;i++)
	 	{
	 		for(ll j=0;j<3;j++)
	 		{
	 			if(a[i][j]==x)
	 				a[i][j]=-1LL;
	 		}
	 	}
 	}
 	for(ll i=0;i<3;i++)
 	{
 		if(a[i][0]+a[i][1]+a[i][2]==-3LL)
 		{
 			cout<<"Yes"<<endl;
 			return 0;
 		}
 		if(a[0][i]+a[1][i]+a[2][i]==-3LL)
 		{
 			cout<<"Yes"<<endl;
 			return 0;
 		}
 		if(a[0][0]+a[1][1]+a[2][2]==-3LL)
 		{
 			cout<<"Yes"<<endl;
 			return 0;
 		}
 		if(a[2][0]+a[1][1]+a[0][2]==-3LL)
 		{
 			cout<<"Yes"<<endl;
 			return 0;
 		}
 	}
 	cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
# ABC153b


def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10 ** 6)

    h, n = map(int, input().split())
    a = list(map(int, input().split()))

    if sum(a) >= h:
        print('Yes')
        exit(0)
    print('No')


if __name__ == '__main__':
    main()


Measured memory_bytes: 13876
#include <iostream>
#include <map>
#include <vector>
#include <queue>
#include <functional>
#include <algorithm>
#include <cmath>
#include <string>
#define mp make_pair
#define pb push_back

using namespace std;

int main() 
{
	long long n, m;
	scanf("%lld %lld", &n, &m);
	if (n > m) swap(n,m);
	if (n == 1 && m == 1) {
		printf("1");
		return 0;
	}
	if (n == 1 && m > 2) {
		printf("%lld", m - 2);
		return 0;
	}
	if (n > 2) {
		printf("%lld", (n-2)*(m-2));
		return 0;
	}
	printf("0");
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#define rep(i, a) for(int i = 0; i < a; ++i)

int main(void) {
  char s[250], t[250];
  int n, i, j, a = 0, b = 0;
  scanf("%d", &n);
  rep(i, n) {
    scanf("%s %s", s, t);
    if(strcmp(s, t) > 0) a += 3;
    else if(!strcmp(s, t)) a++, b++;
    else b += 3;
  }
  printf("%d %d\n", a, b);
  return 0;
}


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

#define sws ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ll long long
#define vi vector<int>
#define pb push_back
#define pii pair<int, int>
#define mp make_pair
#define ff first
#define ss second
#define vvi vector<vi>
#define all(x) x.begin(), x.end()
#define fo(i, n) for( int i = 0; i < n; i++ )

const int INF = 1e9;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const int MOD = 1e9 + 7;


int main() {

    int a, b, c;
    cin >> a >> b >> c;

    int resto = c % b;

    int at = 1;
    int soma = 0;
    set<int> jafoi;
    while ( true ) {
        soma += (a * at);
        soma %= b;
        if ( soma == resto ) {
            cout << "YES\n";
            break;
        }
        if ( jafoi.find(soma) != jafoi.end() ) {
            cout << "NO\n";
            break;
        }
        jafoi.insert(soma);
    }

    return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>

using namespace std;
#define i64  long long

#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807

void func(int N,int X)
{
    int count = 0;
  for (int i = 1; i <= N; i++)
  {
    for (int j = i+1; j <= N; j++)
    {
        for (int k = j+1; k <= N ; k++)
        {
          if(i+j+k == X)count++;
        }
        
    }
    
  }
  
  cout<<count<<endl;

  return;
}

void solve(void)
{

  vector<vector<int> > data;

  while(true)
  {
    vector<int> data_s(2,0);

    cin>>data_s[0]>>data_s[1];
    if((data_s[0] == 0)&&(data_s[1]==0)) break;
    data.push_back(data_s);
  }

  for (size_t i = 0; i < data.size(); i++)
  {
    func(data[i][0],data[i][1]);
  }
  
  


  return;
}

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

  solve();

  return 0;
}



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

int main()
{

    int V, e;
    ll r;
    cin >> V >> e >> r;
    pair<int, int> bridges[e];
    ll cost[e];
    vector<ll> d(V, INF);
    d[r] = 0;
    rep(i, e)
    {
        int s, t;
        ll d;
        cin >> s >> t >> d;
        bridges[i].first = s;
        bridges[i].second = t;
        cost[i] = d;
    }
    rep(i, V)
    {
        bool update = false;
        rep(j, e)
        {
            int u = bridges[j].first, v = bridges[j].second;
            if (d[v] > d[u] + cost[j])
            {
                d[v] = d[u] + cost[j];
                update = true;
            }
        }
        if (!update)
            break;
    }
    rep(i, V)
    {
        if (d[i] == INF)
            cout << "INF" << endl;
        else
            cout << d[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 11164
#include <bits/stdc++.h>
using namespace std;
typedef complex<double> Point;
typedef pair<Point, Point> Line;
typedef vector<Point> Poly; 
const double EPS = 1e-10;

// 内積 |a||b|cosθ
double dot(Point a, Point b){
	// return a.real() * b.real() + a.imag() * b.imag();
	return (conj(a) * b).real();
}
// 外積、符号付面積の２倍　|a||b|sinθ
double cross(Point a, Point b){
	// return a.real() * b.imag() - a.imag() * b.real();
	return (conj(a) * b).imag();
}
// 点の位置関係　2点a,bから見た点cの位置関係
int ccw(Point a, Point b, Point c){
    // COUNTER_CLOCKWISE
    if(cross(b - a, c - a) > EPS) return 1;
    // CLOCKWISE
    if(cross(b - a, c - a) < -EPS) return -1;
    // ONLINE_BACK (c--a--b on line)
    if(dot(b - a, c - a) < -EPS) return 2;
    // ONLINE_FRONT (a--b--c on line)
    if(abs(b - a) + EPS < abs(c - a)) return -2;
    // ON_SEGMENT
    return 0;
}

bool isConvex(Poly p){
    int n = p.size();
    for(int i = 0; i < n; i++){
        if(ccw(p[(i - 1 + n) % n], p[i], p[(i + 1) % n]) == -1) return false;
    }
    return true;
}

int main(){
    int n;
    cin >> n;
    Poly pl(n);
    for(int i = 0; i < n; i++){
        double x, y;
        cin >> x >> y;
        pl[i] = {x, y};
    }
    cout << isConvex(pl) << endl;
}


Measured memory_bytes: 3272
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define int long long
using namespace std;

typedef pair<int, int> Pii;

template<typename T>
void readvec(vector<T> &a);
void readindex(vector<int> &a);



signed main(){

    int H, W;
    cin >> H >> W;
    int c[10][10];
    REP(i, 10){
        REP(j, 10){
            cin >> c[i][j];
        }
    }
    vector<vector<int>> A(H, vector<int>(W));
    REP(i, H){
        readvec(A[i]);
    }

    vector<int> cost(10, 10000000000);
    cost[1] = 0;

    while(true){
        bool a = false;
        REP(i, 10){
            REP(j, 10){
                int tmp = c[i][j] + cost[j];
                if(tmp < cost[i]){
                    cost[i] = tmp;
                    a = true;
                }
            }
        }
        if(!a) break;
    }

    int ans = 0;
    REP(i, H){
        REP(j, W){
            if(A[i][j] >= 0) ans += cost[A[i][j]];
        }
    }

    cout << ans;

    return 0;
}


template<typename T>
void readvec(vector<T> &a){
    REP(i, a.size()){
        cin >> a[i];
    }
}
void readindex(vector<int> &a){
    REP(i, a.size()){
        cin >> a[i];
        a[i]--;
    }
}

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

int main(){
    string s;
    cin >> s;
    string ans;
    rep(i, s.length()) {
        if ( s[i] == '0' ) {
            ans += '0';
        }
        else if ( s[i] == '1' ) {
            ans += '1';
        }
        else if ( s[i] == 'B' && ans != "" ) {
            ans = ans.substr(0, ans.length()-1);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
program main

  integer :: N, add

  integer, allocatable, dimension ( : ) :: A, B, C, D

  read ( *, * ) N

  allocate ( A ( 1:N ) )

  allocate ( B ( 1:N ) )

  allocate ( C ( 1:N-1 ) )

  allocate ( D ( 1:N-1 ) )      

  read ( *, * ) A ( 1:N )
  read ( *, * ) B ( 1:N )
  read ( *, * ) C ( 1:N-1 )


  add = 0
  
  do i = 1, N - 1
  
     if ( A ( i + 1 ) - A ( i ) == 1 ) then

        add = add + C ( A ( i ) )

     end if

  end do

  print '(i0)', add + sum ( B ( 1:N ) )

end program main


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lowbit(a) ((a) & -(a))
#define clean(a, b) memset(a, b, sizeof(a))
const int mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;
const int maxn = 2e5 + 9;

int _;

//========================================================================
int a[20][20],ans[20],c[20];
//========================================================================
int main()
{
    int n,m,x;
    scanf("%d%d%d",&n,&m,&x);
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&c[i]);
        for(int j=1;j<=m;j++)
        {
            scanf("%d",&a[i][j]);
        }
    }
    int base=(1<<n),minn=inf;
    for(int i=1;i<base;i++)
    {
        
        clean(ans,0);
        int val=0;
        for(int j=0;j<n;j++)
        {
            // printf("`%d\n",(i>>j)&1);
            if(((i>>j)&1)==1) 
            {
                val+=c[j+1];
                for(int k=1;k<=m;k++)
                {
                    ans[k]+=a[j+1][k];
                }
            }
        }
        int flag=0;
        // printf("val:%d \n",val);
        for(int k=1;k<=m;k++)
        {
            // printf("%d ",ans[k]);
            if(ans[k]<x) flag++; 
        }
        if(flag==0) minn=min(minn,val);
    }
    if(minn==inf) minn=-1;
    printf("%d\n",minn);
    return 0;
}


Measured memory_bytes: 3824
#include <stdio.h>
#include<algorithm>
using namespace std;
int main()
{
	long long cand[100010];
    int n;
    long long x;
    long long ans=0;
    scanf("%d%lld",&n,&x);
    for(int i = 1; i <= n; ++i)
    scanf("%lld",&cand[i]);
    for(int i = 1; i <= n; ++i)
    {
        long long chi=0;
		if(cand[i]+cand[i-1]-x>=0)chi=cand[i]+cand[i-1]-x;
        ans+=chi;
        if(chi>=cand[i])
            cand[i]=0;
        else
            cand[i]-=chi;
    }
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 896
#pragma GCC optimize("O2")
#include <bits/stdc++.h>
using namespace std;
typedef long long                   ll;
typedef long double                 ld;
typedef pair<int,int>               pii;
typedef pair<ll,ll>                 pll;
typedef pair<double,double>         pdd;
typedef pair<ld,ld>                 pld;
typedef pair<string , string>       pss;
#define ts(x)                       to_string(x)
#define ti(x)                       stoi(x)
#define all(x)                      (x).begin(),(x).end()
#define F                           first
#define S                           second
#define Mp                          make_pair
#define tab                         '\t'
#define sep                         ' '
#define mine(v)                     *min_element(all(v))
#define maxe(v)                     *max_element(all(v))
#define error(x)                    cerr << #x << " = " << x << endl
#define fast_io                     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define file_io                     freopen("in.txt" , "r+" , stdin) ; freopen("out.txt" , "w+" , stdout);
#define endl                        "\n"
inline ll input(){ll n; cin >> n ; return n;}
ll pw(ll a , ll b)  { return (!b ? 1 : (b & 1 ? a * pw(a * a , b / 2) : pw(a * a , b / 2))); }

const int MAXN = 1e6 + 10;
const int MOD = 1e9 + 7;
const int MOD2 = 998244353;
const ll INF = 8e18;

ll v[MAXN];

ll dp[MAXN];

ll Abs(ll x){
    if(x < 0)return -x;
    return x;
}

int main(){
    fast_io;
    //cout << fixed << setprecision(15);
    //scanf("%d %d %f %lld %s %c", &x);
    //printf("%d %d %f %lld %s %c", x);
    int n;
    cin >> n;
    v[0] = 0;
    for(int i = 1 ;i <= n ;i++){
        cin >> v[i];
    }
    dp[2] = Abs(v[2] - v[1]);
    for(int i = 3; i <= n ;i++){
        dp[i] = min(dp[i - 1] + Abs((v[i] - v[i - 1])), dp[i - 2] + Abs((v[i] - v[i - 2])));
    }
    cout << dp[n];
    return 0;
}




Measured memory_bytes: 5120
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

#include <bits/stdc++.h>

using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
#define ll long long int

int main(){
    int n;
    scanf("%d",&n);
    vector<vector<pair<int,ll>>> tree(n);
    vector<int> color(n,-1);
    int u,v;
    ll w;
    for(int i=0;i<n-1;i++){
        scanf("%d%d%lld",&u,&v,&w);
        u--,v--;
        tree[u].push_back({v,w});
        tree[v].push_back({u,w});
    }
    function<void(int,int,ll)> dfs=[&](int node,int parent,ll path){
        if(path%2==0){
            color[node]=2;
        }
        else{
            color[node]=1;
        }
        for(auto v:tree[node]){
            if(v.first==parent)continue;
            dfs(v.first,node,path+v.second);
        }
        return;
    };
    dfs(0,-1,0);
    for(int i=0;i<n;i++){
        cout<<color[i]%2<<"\n";
    }
    return 0;
}

Measured memory_bytes: 16264
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(ll i=0;i<(n);i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORC(i,a,b,c) for(ll i=(a);i<(b);i+=(c))
#define pb(x) push_back(x)
#define ff first
#define ss second

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin>>n;
    ll arr[n];
    REP(i,n){
        cin>>arr[i];
    }
    ll ans=1;
    ll minn=arr[0];
    FOR(i,1,n){
        if(arr[i]<=minn){
            ans++;
            minn=arr[i];
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 1920
N = int(input())
p = list(map(int, input().split()))

P = []
for i in range(N):
	P.append(i+1)

cnt = 0
for i in range(N):
	if P[i] != p[i]:
		cnt += 1

if cnt <= 2:
	print("YES")
else:
	print("NO")



Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define WHOLE(v) (v).begin(), (v).end()
#define REV_WHOLE(v) (v).rbegin(), (v).rend()
using i64 = int64_t;
using namespace std;
template<class F>auto recursive(F f){return[f](auto...a){return f(f,a...);};}
template<class T>using rev_priority_queue=priority_queue<T,vector<T>,greater<T>>;
template<class T>using vector2d=vector<vector<T>>;
struct fixprec{int p;fixprec(int p):p(p){}}; ostream&operator<<(ostream&o,fixprec f){return o<<fixed<<setprecision(f.p);}

/*!* [modint] *!*/
/*+* 剰余環整数 *+*/
struct int_m;
int_m invmod(int_m);
int_m powmod(int_m, i64);
struct int_m {
    static i64 m;
    i64 v;
    int_m() {}
    int_m(i64 x) { v = x % m; v += v < 0 ? m : 0; }
    int_m operator+(const int_m &y) const { return v + y.v - (v + y.v >= m ? m : 0); }
    int_m operator-(const int_m &y) const { return v - y.v + (v - y.v  < 0 ? m : 0); }
    int_m operator*(const int_m &y) const { return (v * y.v) % m; }
    bool operator==(const int_m &y) const { return v == y.v; }
    bool operator!=(const int_m &y) const { return v != y.v; }
    void operator+=(const int_m &y) { *this = *this + y; }
    void operator-=(const int_m &y) { *this = *this - y; }
    void operator*=(const int_m &y) { *this = *this * y; }
    friend istream &operator>>(istream &ist, int_m &m) { ist >> m.v; return ist; }
    friend ostream &operator<<(ostream &ost, int_m m) { ost << m.v; return ost; }
    int_m operator^(const i64   &y) const {
        int_m v = 1; int p = y;
        for (int_m b = *this; p > 0; p >>= 1, b *= b) if (p & 1) v *= b;
        return v;
    }
    void operator^=(const i64   &y) { *this = *this ^ y; }
    // for prime mod
    int_m operator/(const int_m &y) const { return *this * (y ^ (m - 2)); }
    void operator/=(const int_m &y) { *this = *this / y; }
};
i64 int_m::m;

int main() {
    int_m::m = 998244353;
    int N, S;
    cin >> N >> S;
    vector<int> A(N);
    for(int &a : A) cin >> a;
    vector<int_m> cur(S + 1, 0), prev;
    cur[0] = 1;
    for(int i = 0; i < N; i++) {
        swap(cur, prev);
        cur = vector<int_m>(S + 1, 0);
        for(int j = 0; j <= S; j++) {
            cur[j] += prev[j] * 2;
            if(j + A[i] <= S) {
                cur[j + A[i]] += prev[j];
            }
        }
    }
    cout << cur[S] << endl;
    return 0;
}

Measured memory_bytes: 3668
#include <stdio.h>

int main( void )
{
    int a;              //整数a
    char s[11];         //文字列10＋末尾
    char red[4] = "red";//文字列redの初期化
    
    scanf( "%d",&a );   //整数aの取得
    scanf( "%s",s );   //文字列sの取得
    
    if( a >= 3200 )
    {
        printf( "%s", s );
    }
    else
    {
        printf( "%s", red );
    }
    
    return( 0 );
}


Measured memory_bytes: 128
N,W=map(int,input().split())
import numpy as np
lst=np.array([list(map(int,input().split())) for _ in range(N)])
max_value=np.sum(lst[:,1])
#価値iを実現するのに必要な最低の重量のリストを作成
a=np.array([W+1]*(max_value+1))
#最後の<=Wに、実現不可能なものは引っかかってほしくないのでW+1とする
a[0]=0
for w,v in lst:
    #実際に代入していってしまえば実現可能性は考慮される
    a[v:]=np.minimum(a[:-v]+w,a[v:])
print(np.max(np.where(a<=W)))

Measured memory_bytes: 14796
import java.util.*;

public class Main {
	

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		
		Set<String> set = new HashSet<String>();

        for(int i = 0; i<N; i++){
			try{
				set.add(sc.next());
			}catch(Error e){
			}
		}
		System.out.println(set.size());
        return;
	}


}


Measured memory_bytes: 76924
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rrep(i,n) for (int i=(int)(n)-1; i>=0; --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) rep(i, x.size()) cerr << x[i] << (i == x.size() - 1 ? "\n" : " ")
//#define int long long
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = ((1LL << 30) + (1LL << 29));
const int MOD = 1000000007;

//=============================
int N,M,K;
string S,T;
vector<int> A; 
vector<int> B;
vector<int> C;
//=============================
void input()
{
    // cin>>N;
    // A.resize(N);
    // B.resize(N);
    // C.resize(N);
    
    // rep(i,N)cin>>A[i];
    // rep(i,N)cin>>B[i];
    // rep(i,N)cin>>C[i];
    cin>>N>>M;

}
//=============================
void func(){}

// const int  NMAX=100005;
// int dp[NMAX][NMAX] = {}; 
//=============================
void solve()
{
    // sort(A.rbegin(),A.rend());
    // sort(B.rbegin(),B.rend());
    // sort(C.rbegin(),C.rend());
    // debugv(A);
    // debugv(B);
    // debugv(C);

    // rep(a,N){
    //     rep(b,N){

    //     }
    // }
bool ans;
if(N>8 || M>8) ans=false;
else ans=true;

    cout<<(ans?"Yay!":":(")<<endl;


}
//=============================
signed main()
{
    input();
    solve();
    return 0;
}

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

typedef long long 		ll;
typedef vector<ll> 		vll;
typedef pair<ll,ll> 	pll;
typedef vector<pll> 	vpll;
typedef vector<int> 	vi;
typedef pair<int,int> 	pii;
typedef vector<pii> 	vpii;

#define fi				first
#define se 				second
#define pb 				push_back
#define mp 				make_pair
#define all(v)			v.begin(),v.end()
#define sz(v)			s.size()
#define rep(i,a,b) 		for(int i=a;i<=b;i++)
#define per(i,a,b) 		for(int i=a;i>=b;i--)
#define fill(a,v)		memset(a,v,sizeof(a))
#define tc				int T;cin>>T;while(T--)
#define nl				printf("\n")
#define aya				cerr<<"yaha aya"<<"\n"
#define debug(x,y)		printf("%d %d\n",x,y)
#define fast_io			ios_base::sync_with_stdio(false);cin.tie(NULL);
#define grt				greater<int>()

const int mod = 1e9+7;
const int mod2= 1e9+9;

inline int pow_(ll a, int n, int p=mod){
	int r=1;while(n){if(n&1)r=r*a%p;n>>=1;a=a*a%p;}return r;
}

const int MAX = 1e5+1;
const int LG = 30+1;

int main(void)
{
	int a,b;cin>>a>>b;
	int ans = a - 2*b;
	if(ans < 0) ans = 0;
	cout<<ans<<"\n";
}

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

int N, Q;
vector<int> c, q;

int main() {
	cin >> N >> Q;
	c.resize(N); q.resize(Q);
	for(int i = 0; i < N; i++)
		cin >> c[i];
	for(int i = 0; i < Q; i++)
		cin >> q[i];

	int mn, mx;
	sort(c.begin(), c.end(), greater<int>());
	mn = c.back(); mx = c[0];
	for(int i = 0; i < q.size(); i++) {
		int a = (mn + q[i] - 1) / q[i];
		int res = 0;
		a--;
		do {
			a++;
			res = max(res, *upper_bound(c.begin(), c.end(), a*q[i], greater<int>()) % q[i]);
		} while(a * q[i] < mx);
		cout << res << endl;
	}
}

Measured memory_bytes: 2592
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define PI acos(-1)
#define fs first
#define sc second
#define MAX 0x3f3f3f3f
#define debug freopen("1.in", "r", stdin), freopen("1.out", "w", stdout);
#define ios                                                                    \
    ios::sync_with_stdio(false);                                               \
    cin.tie(0);                                                                \
    cout.tie(0);
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const ll maxn = 2e5 + 7;

int N, arr[maxn], brr[maxn], l, r, flag;

int main() {
    ios;
    cin >> N;
    for (int i = 1; i <= N; i ++)
        cin >> arr[i];
    for (int i = 1; i <= N; i ++)
        cin >> brr[i];
    reverse(brr + 1, brr + N + 1);
   for (int i = 1; i <= N; i ++){
       if (arr[i] == brr[i] && l == 0){
           l = i;
           r = i;
           flag = arr[i];
       }
       else if (arr[i] == brr[i] && l)
           r = i;
   }
   for (int i = 1; i <= N; i ++){
       if (arr[i] != flag && brr[i] != flag && l && l <= r)
           swap(brr[i], brr[l ++]);
   }
   if (l <= r && l)cout << "No" << '\n';
   else{
       cout << "Yes" << '\n';
       for (int i = 1 ; i <= N; i ++)
           cout << brr[i] << ' ';
       cout << '\n';
   }
   return 0;
}

Measured memory_bytes: 4764
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstdlib>
#include <utility>
using namespace std;
#define INF 100000005
#define MAX 200005

int a[100];

int solve(int p, int c, int n){
	int x[100], y[100], xx = 0, yy = 0;
	for(int i = n;1;i--){
		if(n-p < i)x[xx++] = a[i];
		else if(n-p-c < i)y[yy++] = a[i];
		else break;
	}
	for(int i = 0;i < n;i++){
		if(n-p-c >= i);
		else if(n-c > i)a[i] = x[--xx];
		else a[i] = y[--yy];
	}
	return 0;
}

int main(){
	int n, r, p, c;
	while(cin >> n >> r, n){
		for(int i = 0;i < n;i++)a[i] = i+1;
		for(int i = 0;i < r;i++){
			cin >> p >> c;
			solve(p, c, n);
		}
		cout << a[n-1] << endl;
	}
	return 0;
}

Measured memory_bytes: 3048
#include <iostream>
#include <vector>
using namespace std;
int main(void){
  int a,b,c;
  cin >> a >> b >> c;
 
  int p=0;
  vector<int> com(100,0);
 
  for(int i=100;i>=1;i--){
    if(a % i == 0 && b % i == 0){
      com[p] = i;
      p++;
    }
  }
  cout << com[c-1] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
unordered_map<int,int> m;

void get_num(int x){
    for(int i = 2;i<= x / i;i++){
        if(x % i == 0){
            m[i]++;
            while(x % i == 0) x/=i;
        }
    }
    if(x != 1) m[x]++;
}


int gcd(int a,int b){
    return b ? gcd(b,a%b) : a;
}

int main(){
    ios::sync_with_stdio(false);
    cout.tie(nullptr);
    cin >> n;
    bool pc = true,sc = false;
    vector<int> a(n);
    for(int i = 0;i<n;i++){
        cin >> a[i];
        get_num(a[i]);
    }
    unordered_map<int,int>::iterator iter;
    for(iter = m.begin(); iter != m.end();iter++){
        if(iter->second > 1) {
            pc = false;
            break;
        }
    }
    int ans = gcd(max(a[0],a[1]),min(a[0],a[1]));
    for(int i = 2;i<n;i++){
        int x = ans;
        int y = a[i];
        if(x < y) swap(x,y);
        ans = gcd(x,y);
    }
    if(pc){
        cout << "pairwise coprime" << endl;
    }else if(!pc && ans == 1){
        cout << "setwise coprime" << endl;
    }else cout << "not coprime" << endl;
    return 0;
}


Measured memory_bytes: 10460
#include <iostream>
#include <iomanip>
#include <cmath>
#include <functional>
#include <algorithm>
#include <numeric>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <boost/range/irange.hpp>
#include <boost/range/adaptor/reversed.hpp>
#include <boost/container/static_vector.hpp>
#include <boost/utility/string_ref.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/math/common_factor_rt.hpp>

template <class... Args>
struct tuple_input_impl;
template <std::size_t i, std::size_t... tail>
struct tuple_input_impl<std::index_sequence<i, tail...>>
{
    template <class... Args>
    static void f(std::tuple<Args...>& x)
    {
        std::cin >> std::get<i>(x);
        tuple_input_impl<std::index_sequence<tail...>>::f(x);
    }
};
template <>
struct tuple_input_impl<std::index_sequence<>>
{
    static void f(...) {}
};

template <class... Args>
std::istream& operator>>(std::istream& in, std::tuple<Args...>& x)
{
    tuple_input_impl<std::index_sequence_for<Args...>>::f(x);
    return in;
}
template <class T1, class T2>
std::istream& operator>>(std::istream& in, std::pair<T1, T2>& x) { return in >> x.first >> x.second; }

template <class T>
T read()
{
    T res;
    std::cin >> res;
    return res;
}
template <class T>
std::vector<T> read(std::size_t n)
{
    std::vector<T> res(n);
    for (std::size_t i = 0; i < n; ++i) std::cin >> res[i];
    return res;
}

template <class T>
void out_impl(T&& v) { std::cout << std::forward<T>(v); }
template <class T, class... Args>
void out_impl(T&& v, Args&&... args)
{
    std::cout << std::forward<T>(v) << ' ';
    out_impl(std::forward<Args>(args)...);
}
template <class... Args>
void out(Args&&... args)
{
    out_impl(std::forward<Args>(args)...);
    std::cout << '\n';
}
template <class... Args>
void out_noreturn(Args&&... args) { out_impl(std::forward<Args>(args)...); }

template <class T>
void print(const T& container)
{
    bool first = true;
    for (auto&& x : container) {
        if (!first) std::cout << ' ';
        std::cout << x;
        first = false;
    }
    std::cout << '\n';
}

void prog()
{
    int a, b;
    std::cin >> a >> b;
    out((b % a == 0) ? a + b : b - a);
}

int main()
{
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    prog();
    return 0;
}


Measured memory_bytes: 256
N = int(input())
AB = [list(map(int,input().split())) for i in range(N)]
A = [AB[i][0] for i in range(N)]
B = [AB[i][1] for i in range(N)]

A.sort()
B.sort()

if N%2==0:
    ans = B[N//2]+B[N//2-1]-A[N//2]-A[N//2-1]+1
else:
    ans = B[N//2]-A[N//2]+1
print(ans)

Measured memory_bytes: 129428
#include <iostream>
#include <math.h>
#include <string>
#include <algorithm>
#include <ctype.h>
#include <vector>
using namespace std;

#define ll long long int
#define rep(i, a, n) for (int i = a; i < n; i++)
#define INF 1e9
#define LINF 1e17
#define MOD (int)(1e9 + 7)
#define pi 3.141592653589
#define pii pair<int, int>
#define vi vector<int>

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

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

    if (n % 2 == 0)
        cout << n << endl;
    else
        cout << n * 2 << endl;
}


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

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

    bool judge = false;
    string x[3] = {"KIH", "B", "R"};
    for(int i = 0; i < 1<<4; i++){
        string tmp = "";
        if(1&i) tmp += "A";
        for(int j = 0; j < 3; j++){
            tmp += x[j];
            if(i&(1<<(j+1)))    tmp += "A";    
        } 

        if(tmp == s){
            judge = true;
            break;
        }
    }

    if(judge){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
}

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


int main(){
    ll k,n;cin>>k>>n;
    ll a[300030];
    rep(i,0,n)cin>>a[i];
    ll an=1e14;
    an=min(an,a[n-1]-a[0]);
    an=min(an,k-(a[1]-a[0]));
    rep(i,1,n-1){
        an=min(an,k-(a[i+1]-a[i]));
        an=min(an,k-(a[i]-a[i-1]));
    }
    cout<<an<<endl;
}







Measured memory_bytes: 1792
import numpy as np
import sys
input = sys.stdin.readline


def main():
    n = int(input())
    A = [int(i) for i in input().split()]

    max_dp = max(A) + 1
    dp = np.zeros(max_dp, dtype="int32")


    for a in A:
        if dp[a] >= 2:
            continue
        dp[np.arange(a, max_dp, a)] += 2
        dp[a] -= 1

    print(np.sum(dp == 1))


if __name__ == '__main__':
    main()

Measured memory_bytes: 51472
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N; int long long D; cin>>N>>D;
  int Ans=0;
  vector<vector<int long long>> A(N,vector<int long long>(2));
  
    for(int i=0; i<N; i++){
      for(int j=0; j<2; j++){
        cin>>A.at(i).at(j);
      }
    }
  for(int i=0; i<N; i++){
    int long long S=A.at(i).at(0);
    int long long T=A.at(i).at(1);
      if(S*S+T*T<=D*D)
        Ans++;
    S=0; T=0;

    }
 
    cout<<Ans<<endl;
  }
      


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

using namespace std;

int main()
{

    int N;
    vector<int> A(20);
    vector<int> B(20);
    vector<int> C(20);

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

    int Ans = 0;

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

    cout << Ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007


int main() {
  int N;
  cin >> N;
  int S[101] = {};
  rep(i, N) {
    int w; cin >> w;
    S[i + 1] = S[i] + w;
  }

  int ans = S[N];

  rep(i, N) {
    int b = abs(S[N] - 2 * S[i]);
    ans = min(ans, b);
  }
  cout << ans << endl;

}





Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <list>
#define rep(i,n) for(int i=0; i<n; ++i)
using namespace std;

int main() {
    int n;
    cin >> n;
    int d[n];
    rep(i, n) cin >> d[i];
    int ans = 0;
    for (int i = 0; i < n; ++i) for (int j = i; j < n; ++j) if (i != j) ans += d[i] * d[j];
    cout << ans;
    return 0;
}



Measured memory_bytes: 256
#include <set>
#include <map>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#define debug(x) cout
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define sz(x) ((int)(x).size)
#define all(x) x.begin(),x.end()
#define rep(i,a,n) for (int i=(a);i<(n);++i)
#define per(i,a,n) for (int i=(n)-1;i>=(a);--i)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
inline ll read() {
  ll x=0, f=1; char ch=getchar();
  while (ch<'0'||ch>'9') f=(ch=='-')?-1:1, ch=getchar();
  while (ch>='0'&&ch<='9') x=(x<<1)+(x<<3)+ch-'0', ch=getchar();
  return x*f;
}
inline void fileio() {
  freopen("t.in","r",stdin);
  //freopen("t.out","w",stdout);
}
//Produced By MiracleEEEE
//head
const int N=1e5;
int cnt[N];
int mx,n;

int main()
{
  scanf("%d",&n);
	int a;
	rep(i,0,n) a=read(),cnt[a]++,cnt[a-1]++,cnt[a+1]++,mx=max(mx,max(cnt[a],max(cnt[a-1],cnt[a+1])));
	printf("%d\n",mx);
	return 0;
}


Measured memory_bytes: 512
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author yassin
 */

#include <bits/stdc++.h>

using namespace std;

using i64 = long long;

class dwacon5_b {
public:
    void solve(istream& in, ostream& out) {
        int N, K;
        in >> N >> K;
        vector<int> a(N);
        for (int i = 0; i < N; ++i) {
            in >> a[i];
        }
        vector<i64> vals;
        for (int i = 0; i < N; ++i) {
            i64 beauty = 0;
            for (int j = i; j < N; ++j) {
                beauty += a[j];
                vals.push_back(beauty);
            }
        }
        i64 res = 0;
        for (int shift = 60; shift >= 0; --shift) {
            int cnt = 0;
            i64 mask = (1LL << shift);
            for (i64 x : vals) {
                if (x & mask) {
                    ++cnt;
                }
            }
            if (cnt >= K) {
                res |= mask;
                vector<i64> newvals;
                for (i64 x : vals) {
                    if (x & mask) {
                        newvals.push_back(x);
                    }
                }
                vals = newvals;
            }
        }
        out << res << "\n";
    }
};

int main() {
	std::ios::sync_with_stdio(false); cin.tie(nullptr);
	dwacon5_b solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 6512
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {

  public static void main(String[] args) {
    FastScanner sc = new FastScanner();

    char[] S = sc.next().toCharArray();

    String ans = "No";
    if (S[2] == S[3] && S[4] == S[5]) {
      ans = "Yes";
    }
    System.out.println(ans);

  }
}

class FastScanner {
  private final InputStream in = System.in;
  private final byte[] buffer = new byte[1024];
  private int ptr = 0;
  private int buflen = 0;

  private boolean hasNextByte() {
    if (ptr < buflen) {
      return true;
    } else {
      ptr = 0;
      try {
        buflen = in.read(buffer);
      } catch (IOException e) {
        e.printStackTrace();
      }
      if (buflen <= 0) {
        return false;
      }
    }
    return true;
  }

  private int readByte() {
    if (hasNextByte()) {
      return buffer[ptr++];
    } else {
      return -1;
    }
  }

  private static boolean isPrintableChar(int c) {
    return 33 <= c && c <= 126;
  }

  private void skipUnprintable() {
    while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
      ptr++;
    }
  }

  public boolean hasNext() {
    skipUnprintable();
    return hasNextByte();
  }

  public String next() {
    if (!hasNext()) {
      throw new NoSuchElementException();
    }
    StringBuilder sb = new StringBuilder();
    int b = readByte();
    while (isPrintableChar(b)) {
      sb.appendCodePoint(b);
      b = readByte();
    }
    return sb.toString();
  }

  public int nextInt() {
    if (!hasNext()) {
      throw new NoSuchElementException();
    }
    int n = 0;
    boolean minus = false;
    int b = readByte();
    if (b == '-') {
      minus = true;
      b = readByte();
    }
    if (b < '0' || '9' < b) {
      throw new NumberFormatException();
    }
    while (true) {
      if ('0' <= b && b <= '9') {
        n *= 10;
        n += b - '0';
      } else if (b == -1 || !isPrintableChar(b)) {
        return minus ? -n : n;
      } else {
        throw new NumberFormatException();
      }
      b = readByte();
    }
  }

  public long nextLong() {
    if (!hasNext()) {
      throw new NoSuchElementException();
    }
    long n = 0;
    boolean minus = false;
    int b = readByte();
    if (b == '-') {
      minus = true;
      b = readByte();
    }
    if (b < '0' || '9' < b) {
      throw new NumberFormatException();
    }
    while (true) {
      if ('0' <= b && b <= '9') {
        n *= 10;
        n += b - '0';
      } else if (b == -1 || !isPrintableChar(b)) {
        return minus ? -n : n;
      } else {
        throw new NumberFormatException();
      }
      b = readByte();
    }
  }
}

Measured memory_bytes: 23252
def ABC051B(k, s):
    a = [0] * (3 * k + 1)
    mx = -(-3 * (k + 1) ** 2 // 4)
    for i in range(k + 1):
        a[i] = (i + 1) * (i + 2) // 2
        a[3 * k - i] = (i + 1) * (i + 2) // 2
    if k % 2 == 0:
        max_point = 3 * (k // 2)
        a[max_point] = mx
        odd_cum_diff = [x ** 2 for x in range(k // 2)]
        for j in range(k // 2):
            a[max_point - j] = mx - odd_cum_diff[j]
            a[max_point + j] = mx - odd_cum_diff[j]
    else:
        max_point = 3 * (k // 2) + 1
        a[max_point] = mx
        even_cum_diff = [x * (x + 1) for x in range(k // 2)]
        for j in range(k // 2):
            a[max_point - j] = mx - even_cum_diff[j]
            a[max_point + j + 1] = mx - even_cum_diff[j]
    # for i, v in enumerate(a):
    #     print(i, v)
    print(a[s])

k, s = map(int, input().split())
ABC051B(k, s)

Measured memory_bytes: 3312
#include <bits/stdc++.h>
#define Int int64_t

using namespace std;

int dfs(int s, vector<vector<int>>& g) {
	map<int, int> mp;
	for (int t : g[s]) {
		mp[dfs(t, g)]++;
	}
	int ret = 1;
	for (auto itr = mp.begin(); itr != mp.end(); ++itr) {
		ret = max(ret, itr->first);
		ret += itr->second;
	}
	return ret;
}

int main() {
	int N;
	cin >> N;
	vector<int> a(N);
	vector<vector<int>> g(N);
	for (int i = 1; i < N; ++i) {
		cin >> a[i];
		--a[i];
		g[a[i]].emplace_back(i);
	}

	int ans = dfs(0, g) - 1;
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 18560
#![allow(unused_imports)]
#![allow(non_snake_case, unused)]

use std::cmp::*;
use std::collections::*;
use std::ops::*;

// https://atcoder.jp/contests/hokudai-hitachi2019-1/submissions/10518254

macro_rules! eprint {
	($($t:tt)*) => {{
		use ::std::io::Write;
		let _ = write!(::std::io::stderr(), $($t)*);
	}};
}
macro_rules! eprintln {
	() => { eprintln!(""); };
	($($t:tt)*) => {{
		use ::std::io::Write;
		let _ = writeln!(::std::io::stderr(), $($t)*);
	}};
}
macro_rules! dbg {
	($v:expr) => {{
		let val = $v;
		eprintln!("[{}:{}] {} = {:?}", file!(), line!(), stringify!($v), val);
		val
	}}
}

macro_rules! mat {
	($($e:expr),*) => { Vec::from(vec![$($e),*]) };
	($($e:expr,)*) => { Vec::from(vec![$($e),*]) };
	($e:expr; $d:expr) => { Vec::from(vec![$e; $d]) };
	($e:expr; $d:expr $(; $ds:expr)+) => { Vec::from(vec![mat![$e $(; $ds)*]; $d]) };
}

macro_rules! ok {
	($a:ident$([$i:expr])*.$f:ident()$(@$t:ident)*) => {
		$a$([$i])*.$f($($t),*)
	};
	($a:ident$([$i:expr])*.$f:ident($e:expr$(,$es:expr)*)$(@$t:ident)*) => { {
		let t = $e;
		ok!($a$([$i])*.$f($($es),*)$(@$t)*@t)
	} };
}

pub fn readln() -> String {
	let mut line = String::new();
	::std::io::stdin().read_line(&mut line).unwrap_or_else(|e| panic!("{}", e));
	line
}

macro_rules! read {
	($($t:tt),*; $n:expr) => {{
		let stdin = ::std::io::stdin();
		let ret = ::std::io::BufRead::lines(stdin.lock()).take($n).map(|line| {
			let line = line.unwrap();
			let mut it = line.split_whitespace();
			_read!(it; $($t),*)
		}).collect::<Vec<_>>();
		ret
	}};
	($($t:tt),*) => {{
		let line = readln();
		let mut it = line.split_whitespace();
		_read!(it; $($t),*)
	}};
}

macro_rules! _read {
	($it:ident; [char]) => {
		_read!($it; String).chars().collect::<Vec<_>>()
	};
	($it:ident; [u8]) => {
		Vec::from(_read!($it; String).into_bytes())
	};
	($it:ident; usize1) => {
		$it.next().unwrap_or_else(|| panic!("input mismatch")).parse::<usize>().unwrap_or_else(|e| panic!("{}", e)) - 1
	};
	($it:ident; [usize1]) => {
		$it.map(|s| s.parse::<usize>().unwrap_or_else(|e| panic!("{}", e)) - 1).collect::<Vec<_>>()
	};
	($it:ident; [$t:ty]) => {
		$it.map(|s| s.parse::<$t>().unwrap_or_else(|e| panic!("{}", e))).collect::<Vec<_>>()
	};
	($it:ident; $t:ty) => {
		$it.next().unwrap_or_else(|| panic!("input mismatch")).parse::<$t>().unwrap_or_else(|e| panic!("{}", e))
	};
	($it:ident; $($t:tt),+) => {
		($(_read!($it; $t)),*)
	};
}

pub fn main() {
	let _ = ::std::thread::Builder::new().name("run".to_string()).stack_size(32 * 1024 * 1024).spawn(run).unwrap().join();
}

const MOD: usize = 1_000_000_007;
const INF: i64 = std::i64::MAX/2;

fn solve() {
    let s = read!(String);
    if s=="ARC" {
        println!("ABC");
    }
    else {
        println!("ARC");
    }
}

fn run() {
    solve();
}


Measured memory_bytes: 2244
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
template<class T> inline bool chmax(T &a, T b) { if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) { if (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int s, w;
    cin >> s >> w;
    if (w >= s) cout << "unsafe" << endl;
    else cout << "safe" << endl;
}

Measured memory_bytes: 3652
#include <iostream>
#include <vector>
#include <cstdlib>

using namespace std;

int main()
{
    int n,m;
    int ans=0;
    int now=0;
    int next;
    vector<int> dist;

    cin >> n >> m;

    dist.push_back(0);

    for(int i=1; i<n; ++i) {
        int temp;
        cin >> temp;
        dist.push_back((dist[i-1]+temp)%100000);
    }

    for(int i=0; i<m; ++i) {
        int temp;
        cin >> temp;
        next=now+temp;
        temp=dist[max(now,next)]-dist[min(now,next)];
        if(temp<0) temp+=100000;
        ans=(ans+temp)%100000;
        now=next;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3528
import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int n = sc.nextInt();
		String s = sc.next();
		
		// 計算
		int result = Integer.MAX_VALUE;
		int[] e = new int[n+1];
		for(int i = 0; i < n; i++){
		    if(s.charAt(i) == 'E'){
		        e[i+1] = e[i] + 1;
		    }else{
		        e[i+1] = e[i];
		    }
		}
		//System.out.println(Arrays.toString(e));
		for(int i = 1; i < n+1; i++){
		    int tmp = (e[n] - e[i]) + i-1 - e[i-1];
		    result = min(result, tmp);
		}
		
		// 出力
		System.out.println(result);
	}
}


Measured memory_bytes: 28804
#include <iostream>
#include <set>

using namespace std;

int main()
{
	string str;
	int num;
	set<string> list;

	int i,j;


	cin >> str;
	cin >> num;


	for (i=0; i<str.size() && num; i++) {
		for (j=1; j<= num && (i+j); j++) {
			list.insert(str.substr(i, j));
		}
	}


	set<string>::iterator it = list.begin();
	advance(it, num-1);
	
	cout << *it << endl;
	
	return 0;	
}


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

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    int num = 0;
    rep(i, n) {
        int a;
        cin >> a;
        if(a % 2 == 1) num++;
    }
    if(num % 2 == 0) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<utility>
#include<functional>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<vector>
using namespace std;
typedef long long LL;
typedef pair<int, int> P;

int main(){
    int a,b,c,x;
    cin>>a>>b>>c>>x;
    int ans=0;
    for(int i=0;i<=a*500;i+=500){
        for(int j=0;j<=b*100;j+=100){
            for(int k=0;k<=c*50;k+=50){
                if((i+j+k)==x){
                    ans++;
                }
            }
        }
    }
    cout<<ans;

    
    return 0;
}

Measured memory_bytes: 256