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

#define ll long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define rep(i, n, m) for (int (i) = (n); (i) < (m); ++(i))
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define debugB(x, y) cerr<<#x<<": "<<bitset<y>(x) << endl;
#define line() cerr << "---------------" << endl;

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

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

   int t = 0;
   rep (i, 0, s.size()) {
      char c = s[i];
      if (c == '(') {
         t++;
      }
      if (c == ')') {
         t--;
         if (t < 0) {
            s.insert(s.begin(), '(');
            i++;
            t++;
         }
      }
   }
   rep (i, 0, t) {
      s.push_back(')');
   }
   cout << s << endl;

   return 0;
}

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

int main(){
  int a, b, k;
  cin >> a >> b >> k;
  for(int i = min(a, b); i >= 1; i--){
    if(a % i == 0 && b % i == 0){
      k--;
      if(k == 0){
        cout << i << endl;
        return 0;
      }
    }
  }
  assert(false);
}

Measured memory_bytes: 3580
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  string s;
  cin >> s;
  int cnt = 0;
  for (char c : s) {
    if (c == '0') cnt++;
    else cnt--;
  }
  cout << (int) s.length() - abs(cnt) << endl;
  return 0;	  
}

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


typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long double ld;

typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
const int MAXN = 1e6 + 3;

#define _  %  MOD
#define __ %= MOD

#define      each(it,s)        for(auto it = s.begin(); it != s.end(); ++it)
#define      sortA(v)          sort(v.begin(), v.end())
#define      sortD(v)          sort(v.begin(), v.end(), greater<auto>())
#define      fill(a)           memset(a, 0, sizeof (a))

#define      swap(a,b)        {a=a+b;b=a-b;a=a-b;}
#define      rep(i, n)         for(ll i = 0; i < (n); ++i)
#define      repA(i, a, n)     for(ll i = a; i <= (n); ++i)
#define      repD(i, a, n)     for(ll i = a; i >= (n); --i)
#define watch(x) cout << (#x) << " is " << (x) <<endl

#define fi first
#define se second
#define mp make_pair
#define pb push_back

#define fbo find_by_order
#define ook order_of_key

ll gcd(ll a,ll b){if(b==0) return a; else return gcd(b,a%b);}
ll power(ll x,ll y){ll res=1; while(y>0){if(y&1) res=res*x;y=y>>1;x=x*x;}return res;} // modular exponent

int main()
{
    ios_base::sync_with_stdio(false); // don't use printf and scanf
    cin.tie(NULL); // cout<<fixed<<setprecision
    string s;
    cin>>s;
    if(s[2]==s[3] && s[4]==s[5]) cout<<"Yes\n";
    else cout<<"No\n";
    return 0;
}


Measured memory_bytes: 256
nums = input().split(' ')
a = int(nums[0])
# b = float(nums[1])
b_str = nums[1]
# b100 = int(b*100)
b100sub = int(b_str[-1]) + 10*int(b_str[-2]) + 100*int(b_str[-4])

ans_str = str(a*b100sub)
ans = ans_str[0:-2]
if ans == '':
    ans = '0'

print(int(ans))

Measured memory_bytes: 61840
n = int(input())
d = [list(map(int,input().split())) for i in range(n)]

flag = 0
for i in range(n-2):
    if d[i][0] == d[i][1] and d[i+1][0] == d[i+1][1] and d[i+2][0] == d[i+2][1]:
        flag = 1

print("Yes" if flag == 1 else "No")

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

int n,k;
vector<int> d;
vector<vector<int>> A;

void input(){
	cin >> n >> k;
	
	d.resize(k);
	A.resize(k, vector<int>());

	rep(i, k){
		cin >> d.at(i);
		A.at(i).resize(d.at(i));
		rep(j, d.at(i)){
			cin >> A.at(i).at(j);
		}
	}
}

void output(){
	int ans = 0;
	for(int i = 1; i <= n; i++){
		bool have = false;
		for(auto v : A){
			for(auto p : v){
				if(p == i) have = true;
			}
		}
		if(!have) ans++;
	}
	cout << ans << endl;
}

int main(){
	input();
	output();
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1e9 + 7;

vector<long long int> inverse;
vector<long long int> f, f_inverse;

void factorial_Initialize(int max){
    vector<long long int> a(max+1,1);
    inverse = a;
    f = a;
    f_inverse = a;

    for (int i=2; i<=max; i++){
        inverse[i]   = MOD - inverse[MOD % i] * (MOD / i) % MOD;
        f[i]         = f[i-1]         * i          % MOD;
        f_inverse[i] = f_inverse[i-1] * inverse[i] % MOD;
    }
}

long long int nCr(int n, int r){
    if(n < r || r < 0) return 0;
    if (n >= f.size()){
        factorial_Initialize(n);
    }
    return f[n] * f_inverse[r] % MOD * f_inverse[n-r] % MOD;
}

int main(){
    int r1, c1, r2, c2;
    cin >> r1 >> c1 >> r2 >> c2;
    factorial_Initialize(1e7);

    long long int f11 = 0, f12 = 0, f21 = 0, f22 = 0;
    for(int i=0; i<r1; i++){
        f12 += nCr(i+c2+1, c2);
        f12 %= MOD;
        f11 += nCr(i+c1, c1-1);
        f11 %= MOD;
    }
    for(int i=0; i<=r2; i++){
        f22 += nCr(i+c2+1, c2);
        f22 %= MOD;
        f21 += nCr(i+c1, c1-1);
        f21 %= MOD;
    }
    //cout << f11 << " " << f12 << " " << f21 << " " << f22 << endl;
    cout << (((f22 - f21 - f12 + f11) % MOD + MOD) % MOD) << endl;
    return 0;
}

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

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

    int count = 0;
    for (int i=0; i<=A; i++) {
        for (int j=0; j<=B; j++) {
            for (int k=0; k<=C; k++) {
                if (500*i+100*j+50*k==X) {
                    count++;
                }
            }
        }
    }

    cout << count << endl;
}

Measured memory_bytes: 3636
n=int(input())
s=[]
for i in range(n):
    s.append(input())
s.sort()
t=1
m=0
a=s[0]
for i in range(n-1):
    if s[i+1]==a:
        t+=1
    else:
        a=s[i+1]
        m=max(t,m)
        t=1
m=max(t,m)
t=1
x=[]
a=s[0]
for i in range(n-1):
    if s[i+1]==a:
        t+=1
    else:
        a=s[i+1]
        if t==m:
            x.append(s[i])
        t=1
if  t==m:
    x.append(s[len(s)-1])
for i in range(len(x)):
    print(x[i])

Measured memory_bytes: 107852
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define Sort(Array) sort(Array.begin(), Array.end())
#define Reverse(a) reverse(a.begin(), a.end())
#define out(ans) cout << ans << endl;
const int MOD = 1000000007;
const int INF = INT_MAX;

//------------↓------------- M -------------- E ---------------- M --------------- O ---------------↓--------------//
// コンパイル 
// g++ -std=c++1z
//
// -------型変換--------
// int を string に変換
// string s = to_string(n);
// string を int に変換
// int n = stoi(s);
//
// -------二分探索---------
// k以上の値が最初に現れる時のイテレータ O(logN)
// lower_bound(data.begin(), data.end(), k)
// kより大きい値が最初の現れる時のイテレータ O(logN)
// upper_bound(data.begin(), data.end(), k)
// kがdataに存在するかをtrue or falseで返す O(logN)
// binary_search(data.begin(), data.end(), k)
// 
//
//
//
//
//
// 
//------------↑------------- M -------------- E ---------------- M --------------- O ---------------↑--------------//





int main() {
    
    int N, W; cin >> N >> W;
    vector<int> w(N+1), v(N+1);
    for (int i = 1; i <= N; ++i) cin >> w[i] >> v[i];
    ll S = 0; for (int i = 1; i <= N; ++i) S += v[i];

    ll dp[N+1][S+1];
    rep(i,N+1) {
        rep(j,S+1) dp[i][j] = INF;
    }
    dp[0][0] = 0;
    for (int i = 1; i <= N; ++i) {
        for (int sum = 0; sum <= S; ++sum) {
            if (sum - v[i] >= 0) {
                dp[i][sum] = min(dp[i][sum], dp[i-1][sum-v[i]] + w[i]);
            }
            dp[i][sum] = min(dp[i][sum], dp[i-1][sum]);
        }
    }
    ll ans = 0;
    rep(sum, S+1) {
        if (dp[N][sum] <= W) {
            ll tmp = sum;
            ans = max(ans, tmp);
        }
    }
    out(ans);
    
    return 0;
}






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

using namespace std;

int main(){
    int x,y;
    cin>>x>>y;
    if((x==1 || x==3 || x==5 || x==7 || x==8 || x==10 || x==12) && (y==1 || y==3 || y==5 || y==8 || y==10 || y==12)){
        cout<<"Yes"<<endl;
    }
    else if((x==4 || x==6 || x==9 || x==11) && (y==4 || y==6 || y==9 || y==11)){
        cout<<"Yes"<<endl;
    }
    else if(x==y){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
}


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

int main() {
  int a, b, c, d;
  cin >>a;
  cin >>b;
  cin >>c;
  cin >>d;

  
  if (a + b > c + d) {
    cout << "Left";
  }
  
  else if (a + b < c + d){
    cout << "Right";
  }
  
  else {
    cout << "Balanced ";
  }

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, n) for (int i = 1; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define put(x) cout << x << endl;
#define println(x) cout << x << endl;
using namespace std;
signed main()
{
    int n;
    cin >> n;

    vector<vector<int> > xs;
    vector<vector<int> > ys;
    rep (i, n) {
        int a;
        cin >> a;
        vector<int> x(a), y(a);
        rep(i, a) cin >> x[i] >> y[i];
        xs.push_back(x);
        ys.push_back(y);
    }

    int best = 0;
    rep (pat, 1 << n) {
        vector<int> p(n);
        rep(i, n) p[i] = 1 - (int)((pat >> i) & 1);
        bool ok = true;
        rep(i, n) {
            if (p[i] >= 1) {
                // 正直と仮定
                const auto& x = xs[i];
                const auto& y = ys[i];
                rep (j, x.size()) {
                    if (p[x[j] - 1] != y[j]) {
                        // 矛盾
                        ok = false;
                        break;
                    }
                }
            }
            if (ok == false){
                break;
            }
        }

        if (ok) {
            int cnt = 0;
            rep(i, n) {
                if (p[i]) { cnt++; }
            }
            best = max(best, cnt);
        }
    }

    put(best);

    return 0;
}

Measured memory_bytes: 3644
//“Make it work, make it right, make it fast.” – Kent Beck
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double dd;
const ll INF = 1e18L + 5;
const ll siz = 1e6 + 5;
#define deb(x) cout << #x << " = " << x << endl;

void solve()
{
	//u jus t have to count the occurence i
	int a, b;
	cin >> a >> b;
	cout << max(0, (a-(2*b)));
	
}

int main()
{
		ios::sync_with_stdio(false);
		cin.tie(nullptr);
		ll t = 1;
		//cin >> t;
		while(t--)
		{
			solve();
		}
	return 0;
}
	


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    #ifdef TarekHasan
        freopen("input.txt","r",stdin);
    #endif // TarekHasan
    int n; cin >> n;
    string str; cin >> str;
    int red = 0;
    int white = 0;

    for(char c : str)
    {
        if(c=='W')
            white++;
        else
            red++;
    }
    if(white && red)
    {
        stack< int > st;
        for(int i = 0 ; i < str.size(); i++)
        {
            if(str[i]=='R')
                st.push(i);
        }
        int counter = 0;
        for(int i=0;i<str.size();i++)
        {
            if(str[i]=='W')
            {
                if(st.empty()) break;
                int x = st.top();
                if(x<i)
                    break;
                st.pop();
                counter++;
            }
        }
        cout << min(counter,min(red,white)) << endl;
    }
    else
        cout << "0\n";
    return 0;
}


Measured memory_bytes: 4276
n=int(input())
L=[]
for _ in range(n):
    l=list(map(int,input().split()))
    L.append(l)
if n==1:
    print(1)
    exit()
pq=[]
ans=[]
for i in range(n-1):
    for j in range(i+1,n):
        x=L[i][0]-L[j][0]
        y=L[i][1]-L[j][1]
        if [x,y] in pq:
            ans[pq.index([x,y])] += 1
        elif [-x,-y] in pq:
            ans[pq.index([-x,-y])] += 1
        else:
            pq.append([x,y])
            ans.append(1)

print(n-max(ans))

Measured memory_bytes: 3316
package main

import (
	"fmt"
	"math"
)

func main() {

	var A, B int
	fmt.Scanf("%d %d", &A, &B)

	fmt.Println(math.Max((math.Max(float64(A)+float64(B), float64(A)-float64(B))), float64(A)*float64(B)))

}


Measured memory_bytes: 1836
#include<stdio.h>

int main(void)
{
	int a,b,c;
	scanf("%d %d %d",&a,&b,&c);
	
	if(a == b && b == c && c == a){
		printf("Yes\n");
	}
	
	else{
		printf("No\n");
	}
	
	return 0;
}

Measured memory_bytes: 128
num = list(map(int, input().split()))
class Dice:
    def __init__(self, num):
        self.state = {}
        for i in range(1,6+1):
            self.state[i] = num[i-1]

        self.reversed_state = {}
        for key,val in zip(self.state.keys(), self.state.values()):
            self.reversed_state[val] = key
        
    def search_side(self, x,y):
        a = self.reversed_state[x]
        b = self.reversed_state[y]
        if str(a)+str(b) in '12651':
            side = self.state[3]
        elif str(b)+str(a) in '12651':
            side = self.state[4]
        elif str(a)+str(b) in '13641':
            side = self.state[5]
        elif str(b)+str(a) in '13641':
            side = self.state[2]
        elif str(a)+str(b) in '23542':
            side = self.state[1]
        elif str(b)+str(a) in '23542':
            side = self.state[6]
        return side
        
dice = Dice(num)
q = int(input())
for _ in range(q):
    x,y = map(int, input().split())
    ans = dice.search_side(x,y)
    print(ans)


Measured memory_bytes: 5604
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
using namespace __gnu_pbds; 
using namespace std;
#define ull         unsigned long long int
#define ll          long long int
#define pb          push_back
#define pii         pair<int,int>
#define F           first
#define S           second
#define vi          vector<int>
#define vli          vector<ll>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define M_PI        3.14159265358979323846
#define mp          make_pair
#define sz(x)       (int)x.size()
#define matrix      vector<vector<ll>>
#define forn(i,a,b)  for(int i=a;i<b;i++)
#define eps 0.0000000001
#define all(a)      (a).begin(),(a).end()
#define ordered_set     tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update> 
 
const long long INF = (long long) 1e11+1;
const long long mod = (long long) 998244353;
const long long hell = (long long) 1000000007;

ll power(ll x,ll y,ll m){
  ll res=1;
  while(y>0){
    if(y%2) res=(x%m*res%m)%m;
    x=(x%m*x%m)%m;    
    y=y/2;
  }
  
  return res%m;
}
 
ll modinv(ll x){
  return power(x,hell-2,1);
}

ll gcd(ll a,ll b){
    while(b!=0){
		ll t=b;
		b=a%t;
		a=t;
	}
	return a;
}    
    
void fastIO(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
} 

void solve(){
    int n;
    cin>>n;
    
    map<string,int> st;
    forn(i,0,n){
        string s;
        cin>>s;
        st[s]++;
    }
    cout<<"AC x "<<st["AC"]<<"\n";
    cout<<"WA x "<<st["WA"]<<"\n";
    cout<<"TLE x "<<st["TLE"]<<"\n";
    cout<<"RE x "<<st["RE"];
}    
    
int main(){
   fastIO();
   int test;
   //cin>>test;
   test=1;    
   
   while(test--)
   solve();
}

Measured memory_bytes: 3660
#include<bits/stdc++.h>
#define fi                first
#define se                 second
#define ll               long long
#define mod              1000000007
#define endl              "\n"
#define fast               ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb                push_back
#define all(v)             v.begin(),v.end()
#define inp(V,n)      for(int i=0;i<n;i++){cin >> V[i];}
#define oup(V,n)     {for(int i=0;i<n;i++){cout <<  V[i] << " "  ;} cout << endl;}
using namespace std;
ll factorial(ll n)
{
    return (n == 1 || n == 0) ? 1 : n * factorial(n - 1);
}
ll gcd(ll a, ll b)
{
    if (a == 0)
      return b;
    return gcd(b % a, a);
}
ll lcm(ll a, ll b)
{
   return (a*b)/gcd(a, b);
}
bool sortByVal(const pair<double,double> &a,
               const pair<double,double> &b)
{
    if(a.fi==b.fi)
    {
    return (a.se >b.se);
    }
    else
        return (a.fi<b.fi);
}
ll Powb(ll b,ll n)
{
    if(n==0) return 1LL;
    if(n==1) return b;
    ll temp = Powb(b,n/2);
    if(n%2==0){return (temp*temp)%mod;}
    else{return (b*((temp*temp)%mod))%mod;}
}
ll sumofdigit(ll n)
{
    ll c=0,d=0,sum=0,i;
    while(n>0)
    {
        c=n%10;
        sum+=c;
        n/=10;
    }
    return sum;
}
ll fact(ll n)
{
    ll c=1;
    for(ll i=1;i<=n;i++)
    {
        c*=i;
    }
    return c;
}
ll ks(vector<ll> &a,ll k,ll n)
{
     ll dp[n+1][k+1];
    for(ll i=0;i<n+1;i++)
    {
        for(ll j=0;j<k+1;j++)
        {
            if(i==0||j==0)
                dp[i][j]=0;
            else
            {
                if(a[i-1]>j)
                {
                    dp[i][j]=dp[i-1][j];
                }
                else
                {
                    if(dp[i][j-a[i-1]]!=0||j==a[i-1])
                    dp[i][j]=max(dp[i-1][j],(1+dp[i][j-a[i-1]]));
                    else
                    dp[i][j]=dp[i-1][j];
                }
            }
        }
    }
    return dp[n][k];
}
int main()
{
 fast;
     int t=1;
     //cin>>t;
     while(t--)
     {
        ll k=0,n,i=0,j=0,c=0,d=0,e=0,f=0,sum=0,g=0,h=0,maxi=0;
         cin>>n;
         vector<ll> a(n);
         inp(a,n);
         for(i=0;i<n;i++)
         {
             if(i%2==0&&a[i]%2!=0)
             {
                 sum++;
             }
         }
         cout<<sum<<endl;

     }
}



Measured memory_bytes: 3652
#include<iostream>
using std::cout;
using std::cin;
using std::endl;

int main()
{
  int n, m;
  cin >> n >> m;
  
  int temp;
  for (int i = 0; i < m; i ++)
  {
    cin >> temp;
    n -= temp;
  }
  
  if (n < 0) cout << -1 << endl;
  else cout << n << endl;
  
  return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pi pair<int,int>
#define ff first
#define ss second
#define boost ios::sync_with_stdio(false);cin.tie(nullptr)
#include "string"

int32_t main() {
	boost;
	int n, m;
	cin >> n >> m;
	priority_queue<int>pq;
	for(int i = 0, x; i < n; i++){
		cin >> x;
		pq.push(x);
	}
	while(m > 0) {
		int tt  = pq.top();
		pq.pop();
		tt /= 2;
		pq.push(tt);
		m--;
	}
	int ans = 0;
	while(!pq.empty()) {
		ans += pq.top();
		pq.pop();
	}
	cout << ans << endl;
}

	

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

// constexpr int MOD = 1000000007;
constexpr int MOD = 998244353;
constexpr int MAX = 510000;
vector<long> fact(MAX), finv(MAX), inve(MAX);

void init() {
  fact.at(0) = fact.at(1) = 1;
  finv.at(0) = finv.at(1) = 1;
  inve.at(1) = 1;
  for (int i = 2; i < MAX; i++) {
    fact.at(i) = fact.at(i - 1) * i % MOD;
    inve.at(i) = MOD - inve.at(MOD % i) * (MOD / i) % MOD;
    finv.at(i) = finv.at(i - 1) * inve.at(i) % MOD;
  }
}

long com(long n, long r) {
  if (n < r || n < 0 || r < 0) return 0;
  return fact.at(n) * (finv.at(r) * finv.at(n - r) % MOD) % MOD;
}

long mpow(long a, long b) {
  long res = 1;
  while (b > 0) {
    if (b & 1) res = res * a % MOD;
    a = a * a % MOD;
    b >>= 1;
  }
  return res;
}

long pcom(long n, long r) {
  long x = 1, y = 1;
  for (int i = 1; i <= r; i++) {
    x = x * (n - i + 1) % MOD;
    y = y * i % MOD;
  }
  return x * mpow(y, MOD - 2) % MOD;
}

long inv(long a) {
  long b = MOD, u = 1, v = 0;
  while (b) {
    long t = a / b;
    a -= t * b; swap(a, b);
    u -= t * v; swap(u, v);
  }
  u %= MOD; 
  if (u < 0) u += MOD;
  return u;
}

int main() {
  ios::sync_with_stdio(false);
  init();
  long N, M, K;
  cin >> N >> M >> K;
  long ans = 0;
  for (int i = 0; i <= K; i++) {
    long tmp = com(N - 1, i);
    tmp *= M;
    tmp %= MOD;
    tmp *= mpow(M - 1, N - i - 1);
    tmp %= MOD;
    ans += tmp;
    ans %= MOD;
  }
  cout << ans << "\n";
}

Measured memory_bytes: 14916
#include <iostream>
#include <math.h>
#include <string>
#include <algorithm>
using namespace std;
int main(){
	string s;
	cin>>s;
	bool a=false;
	for(int i=0;i<s.size()-1;i++){
		if(s[i]=='A'&&s[i+1]=='C')a=true;
	}
	if(a==true)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}


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

int main(){
    int n;
    cin >>n;
    int a=n%10;
    if(a==3){
        cout << "bon"<<endl;
    }else if(a==0||a==1||a==6||a==8){
        cout << "pon"<<endl;
    }else{
        cout << "hon"<<endl;
    }
    return 0;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
#define _USE_MATH_DEFINES
using namespace std;
// 型シノニム
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
// 定数
constexpr ll INF   = 1e16;
constexpr ll INM   = 114514;
constexpr ll MOD   = 1e9 + 7;
constexpr ld EPS   = 1e-12;
constexpr ll dx[4] = {1, 0, -1, 0};
constexpr ll dy[4] = {0, 1, 0, -1};
// 便利関数
void IOS() { ios::sync_with_stdio(false), cin.tie(0); }
template <typename T>
void dump(T x) { cout << x << endl; }
void dumpf(ld x, ll t) { cout << setprecision(t) << fixed << x << endl; }
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
	fill((T *)array, (T *)(array + N), val);
}
inline ll mod(ll a, ll mod) {
	if (a > 0) return a % mod;
	if (a % mod == 0) return 0;
	ll x = -a / mod + 1;
	a += x * mod;
	return a % mod;
}
ll powm(ll a, ll b, ll m) {
	if (b == 0) {
		return 1;
	} else if (b % 2 == 0) {
		ll d = powm(a, b / 2, m);
		return (d * d) % m;
	} else {
		return (powm(a, b - 1, m) * a) % m;
	}
}
// 本体

int main() {
	IOS();
	ll n;
	cin >> n;
	vector<ll> a(n), b(n);
	for (int i = 0; i < n;i++) {
		cin >> a[i] >> b[i];
	}
	sort(a.begin(), a.end());
	sort(b.begin(), b.end());
	if(n % 2 == 1) {
		dump(b[n / 2] - a[n / 2] + 1);
	} else {
		ll lb = a[n / 2] + a[n / 2 - 1];
		ll ub = b[n / 2] + b[n / 2 - 1];
		ll ans = ub - lb + 1;
		dump(ans);
	}
}

Measured memory_bytes: 6324
using System;
using System.Collections.Generic;
using System.Text;
using System.Numerics;
using System.IO;

namespace SolutionCS
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();


            long ans = 1;
            Char prev = s[0];
            int prevlen = 1;
            int next = 0;

            for (int i = 1; i < s.Length; i++)
            {
                if(prevlen == 2)
                {
                    // 前回2文字の分割の場合、無条件で1文字で分割
                    ans++;
                    prevlen = 1;
                }
                else
                {
                    // 1個前の文字と違う場合、無条件で1文字で分割
                    if (s[i - 1] != s[i])
                    {
                        ans++;
                        prevlen = 1;
                    }
                    else
                    {
                        i++;
                        if (i < s.Length)
                        {
                            // 1個前の文字と同じ場合、2文字分割とする
                            ans++;
                            prevlen = 2;
                        }
                    }
                }
            }

            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 13140
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <random>

using namespace std;

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

	vector<int> a = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
	int k;
	cin >> k;
	cout << a[k - 1] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
#define PI 3.14159265358979
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repp(i, s, e) for(int i = (s); i <= (e); ++i)
#define sz(x) ((int)x.size())
#define all(x) x.begin(), x.end()
#define FAST_IO() ios::sync_with_stdio(0); cin.tie(0)
template<typename T>
ostream& operator<<(ostream &os, const vector<T> &v) { for (auto x : v) os << x << " "; return os << "\n"; }
template<class U, class V>
ostream& operator<<(ostream &os, const pair<U, V> &p) { return os << "(" << p.first << "," << p.second << ")";}

const int MAXN = 2e5 + 5;
const ll MOD = 1e9 + 7;
int N, A[MAXN], cache[MAXN];
vector<int> pos[MAXN];

int cnt(int start) {
    int &ret = cache[start];
    if(ret != -1) return ret;
    if(start == N - 1) return 1;
    auto it = upper_bound(all(pos[A[start]]), start);
    if(it == pos[A[start]].end()) {
        return ret = cnt(start + 1);
    } else {
        int next = it - pos[A[start]].begin();
        if(pos[A[start]][next] == start + 1) {
            return ret = cnt(start + 1);
        } else {
            return ret = (cnt(start + 1) + cnt(pos[A[start]][next])) % MOD;
        }
    }
}

int main() {
    FAST_IO();
    cin >> N;
    rep(i, N) {
        cin >> A[i];
        --A[i];
        pos[A[i]].push_back(i);
    }
    // cnt(start)
    memset(cache, -1, sizeof(cache));
    cout << cnt(0) << "\n";
}


Measured memory_bytes: 19072
#include <bits/stdc++.h>
using namespace std;
 
int main () {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  for (int i = N - 1; i >= 0; i -= 2) {
    cout << A.at(i) << " ";
  }
  if (N % 2 == 0) {
    for (int i = 0; i < N; i += 2) {
      cout << A.at(i) << " ";
    }
  }
  else {
    for (int i = 1; i < N; i += 2) {
      cout << A.at(i) << " ";
    }
  }
  cout << endl;
}

Measured memory_bytes: 3996
#include<iostream>
#include<vector>
using namespace std;
long cnt = 0;
vector<int> G;
void InsertionSort(int A[], int n, int g) {
	for (int i = g; i < n; i++) {
		int v = A[i];
		int j = i - g;
		while (j >= 0 && A[j] > v) {
			A[j + g] = A[j];
			j -= g;
			cnt++;
		}
		A[j + g] = v;
	}
}
void ShellSort(int A[], int n) {
	for (int h = 1;;) {
		if (h > n)
			break;
		G.push_back(h);
		h = h * 3 + 1;
	}
	for (int i = G.size() - 1; i >= 0; i--) {
		InsertionSort(A, n, G[i]);
	}
}
int main() {
	int n;
	cin >> n;
	int *arr = new int[n];
	for (int i = 0; i < n; i++) {
		cin >> arr[i];
	}
	ShellSort(arr, n);
	cout << G.size() << endl;
	for (int i = G.size() - 1; i >= 0; i--) {
		cout << G[i];
		if (i != 0) {
			cout << ' ';
		}
	}
	cout << endl;
	cout << cnt << endl;
	for (int i = 0; i < n; i++) {
		cout << arr[i] << endl;
	}
	delete[] arr;
	return 0;
}


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

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define INF         INT_MAX/3
#define LLINF       LLONG_MAX/3
#define MOD         (1000000007LL)
#define MODA(a, b)  a=((a)+(b))%MOD
#define MODP(a, b)  a=((a)*(b))%MOD
#define inc(i, l, r)   for(int i=(l);i<(r);i++)
#define dec(i, l, r)   for(int i=(r)-1;i>=(l);i--)
#define pb          push_back
#define se          second
#define fi          first
#define mset(a, b)  memset(a, b, sizeof(a))

using LL  = long long;
using G   = vector<vector<int>>;

int di[] = {0, -1, 0, 1};
int dj[] = {1, 0, -1, 0};
// }}}

int dp[100001];
int v[11] = {6, 6*6, 6*6*6, 6*6*6*6, 6*6*6*6*6, 6*6*6*6*6*6, 
             9, 9*9, 9*9*9, 9*9*9*9, 9*9*9*9*9};

int main() {
    cin.tie(0);ios::sync_with_stdio(false);
    int n;cin >> n;
    dp[0] = 0;
    inc(i, 1, n+1){
        dp[i] = dp[i-1]+1;
        inc(j, 0, 11){
            if(i-v[j] >= 0){
                dp[i] = min(dp[i], dp[i-v[j]]+1);
            }
        }
    }
    cout << dp[n] << endl;
    return 0;
}


Measured memory_bytes: 640
import java.util.Arrays;
import java.util.Scanner;


public class Main {
	public static void main(String args[]){
		Scanner stdIn = new Scanner(System.in);
		int[] intArray = new int[5];
		for(int i = 0;i < intArray.length; i++){
			intArray[i] = stdIn.nextInt();
		}

		Arrays.sort(intArray);

		for(int i = intArray.length - 1;i >= 0; i--){
			if(i == 0){
				System.out.println(intArray[i]);
			}else{
				System.out.print(intArray[i] + " ");
			}
		}
	}
}

Measured memory_bytes: 11000
#include<bits/stdc++.h>
#define Rint register int
using namespace std;
typedef long long LL;
const int N = 200003;
template<typename T>
inline void read(T &x){
	int ch = getchar(); x = 0;
	bool flag = false;
	while((ch < '0' || ch > '9') && ch != '-') ch = getchar();
	if(ch == '-'){
		flag = true;
		ch = getchar();
	}
	while(ch >= '0' && ch <= '9'){
		x = x * 10 + ch - '0';
		ch = getchar();
	}
	if(flag) x = -x;
}
int n, fa[N], siz[N][2];
LL ans;
inline int getfa(int x){
	return x == fa[x] ? x : fa[x] = getfa(fa[x]);
}
int main(){
	read(n);
	for(Rint i = 1;i <= 200000;i ++) fa[i] = i, siz[i][0] = (i <= 100000), siz[i][1] = (i > 100000);
	for(Rint i = 1;i <= n;i ++){
		int x, y;
		read(x); read(y); y += 100000;
		x = getfa(x); y = getfa(y);
		if(x != y){
			ans += (LL) siz[x][0] * siz[y][1] + (LL) siz[x][1] * siz[y][0];
			siz[x][0] += siz[y][0];
			siz[x][1] += siz[y][1];
			fa[y] = x;
		}
	}
	printf("%lld\n", ans - n);
}

Measured memory_bytes: 2560
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
using namespace std;
#define INF 1000000007
#define LINF 100000000000000007
#define MOD 1000000007
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define repb(i, n) for (int i = n - 1; i >= 0; i--)
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif 
int ceil2(int a,int b){if(a%b){return a/b+1;}else{return a/b;}}
//typedef long long int ll;
typedef pair<int,int> P;
struct edge{int to,cost;};


int n,k;
int a[211111],f[211111];

int ans;
signed main(){
	cin>>n>>k;
	rep(i,n)cin>>a[i];
	rep(i,n)cin>>f[i];
	sort(a,a+n);
	sort(f,f+n,greater<>());
	int ng=-1,ok=10000000000000;
	while(abs(ok-ng)>1){
		int mid=(ng+ok)/2;
		int syugyo=0;
		rep(i,n){
			if(a[i]*f[i]>mid){
				syugyo+=ceil2(a[i]*f[i]-mid,f[i]);
			}
		}
		if(syugyo<=k)ok=mid;
		else ng=mid;
	}
	cout<<ok<<endl;
}

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

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

  // a=0, b=1, c=2
  vector<string> vec(3);
  rep(i, 3) cin >> vec[i];
  char now = 0;
  string ans;
  while(true) {
    if(vec[now].size() == 0) {
      ans = (char)(now + 'A');
      break;
    }
    char c = vec[now][0];
    vec[now].erase(vec[now].begin());
    now  = c-'a';
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
#include<functional>
#include<algorithm>
#include<iostream>
#include<iomanip>
#include<cstring>
#include<cstdlib>
#include<utility>
#include<string>
#include<cstdio>
#include<vector>
#include<bitset>
#include<cmath>
#include<ctime>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
using namespace std;
const int inf=2147483647,dx[]={-1,0,1,0},dy[]={0,-1,0,1};// 上 左 下 右
const int N=100005,M=1000005,K=200005,mod=1000000007;
const long long llinf=9223372036854775807ll;
//int & long long
long double a;
int main(){
	cin>>a;
	cout<<fixed<<setprecision(8)<<(a/3.000000000)*(a/3.000000000)*(a/3.000000000);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint     = long long;
const lint inf = 1LL << 60;
const lint mod = 1000000007;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, k, q;
    cin >> n >> k >> q;
    vector<lint> pt(n, k - q);
    for (int i = 0; i < q; ++i) {
        int a;
        cin >> a;
        a--;
        pt[a] += 1;
    }
    for (int i = 0; i < n; ++i) {
        if (pt[i] > 0)
            cout << "Yes"
                 << "\n";
        else
            cout << "No"
                 << "\n";
    }
    return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <string>
#define REP(i,n) for(int i=0;i<(n);++i)
#define MOD 1000000007
using namespace std;
typedef long long LL;

int main(){
  int N;
  LL _X[100000], X[100000];
  cin >> N;
  REP(i, N) {
    cin >> _X[i];
  }
  REP(i, N) {
    X[i] = _X[N-1] - _X[N-1-i];
  }
  
  LL kaijo[100001], rkaijo[100001];
  kaijo[0] = 1; rkaijo[N] = 1;
  REP(i, N) {
    kaijo[i+1] = kaijo[i] * (i+1) % MOD;
    rkaijo[N-i-1] = rkaijo[N-i] * (N-i-1) % MOD;
  }
  REP(i, N) {
    
  }
  
  LL ret = 0;
  for(int i = 1; i<N; ++i) {
    LL coff = kaijo[N-i-1] * rkaijo[N-i+1] % MOD;
    ret = (ret + X[i] * coff) % MOD;
  }
  cout << ret << endl;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9 + 7;
const ll inf = 922337203685477;
const ll mininf = -922337203685477;
const ll nax = 2e5 + 5;

ll n, a[nax];
map<ll, ll> mp;

int main(){
	ios_base::sync_with_stdio(0); cin.tie(); cout.tie();

	cin >> n;
	for(ll i = 1; i <= n; i++){
		cin >> a[i];
		mp[a[i] - i]++;
	}
	ll ans = 0;
	for(ll i = 1; i <= n; i++){
		ll temp = -1 * a[i];
		temp -= i;
		ans += mp[temp];
	}
	cout << ans << '\n';
}


Measured memory_bytes: 27780
#include <iostream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <complex>
#include <cstdio>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define INF 1e9
#define rep(i,n) for(int i=0;i<n;i++)
struct edge{int to,cost,time;};
typedef pair<int,int> P;

int V,E,d[1001],a,b,c,t,S,G,k,r;
edge e;
vector<edge> g[1001];

int main(){
	while(cin>>E>>V&&V){
		rep(i,V+1)g[i].clear();
		rep(i,E){
			cin>>a>>b>>c>>t;
			e.to=b;e.cost=c;e.time=t;
			g[a].push_back(e);
			e.to=a;
			g[b].push_back(e);
		}
		cin>>k;
		rep(h,k){
		cin>>S>>G>>r;
		priority_queue<P,vector<P>,greater<P> > q;
		fill(d,d+V+1,INF);
		d[S]=0;
		q.push(P(0,S));
		while(!q.empty()){
			P p=q.top();q.pop();
			int v=p.second;
			if(d[v]<p.first)continue;
			rep(i,g[v].size()){
				e=g[v][i];
				if(!r)if(d[e.to]>d[v]+e.cost){
					d[e.to]=d[v]+e.cost;
					q.push(P(d[e.to],e.to));
				}
				if(r)if(d[e.to]>d[v]+e.time){
					d[e.to]=d[v]+e.time;
					q.push(P(d[e.to],e.to));
				}
			}
		}
		if(d[G]<INF)cout<<d[G]<<endl;
		else cout<<"unreachable"<<endl;
		}
	}
}

Measured memory_bytes: 1016
#include <bits/stdc++.h>
using namespace std;
#define rep0(i, n) for (long long i = 0; i < (long long)(n); i++)
#define rep1(i,n) for(long long i=1;i<=(long long)(n);i++)
#define all(v) v.begin(),v.end()
typedef long long ll;


int main() {
  ll N,ans=0;
  cin>>N;
  vector<ll> d(N);
  rep0(i,N){cin>>d[i];}
  sort(all(d));
  for(ll i=d[N/2-1];i<d[N/2];i++){if(N%2==1){break;} ans++;}
  cout<<ans<<endl;
}

Measured memory_bytes: 1024
fun main(args: Array<String>) {
    val (n, a, b, c) = readLine()!!.split(" ").map { it.toInt() }
    val v = IntArray(n)
    for(i in 0 until n){
        v[i] = readLine()!!.toInt()
    }

    var ans = 1000000000L

    for(i in 0 until (1 shl (n * 2))){
        var tmp = IntArray(3, {0})
        var now = i
        var cos = 0L
        for(j in 0 until n){
            val seica = now % 4
            now /= 4
            if(seica < 3){
                if(tmp[seica] != 0){
                    cos += 10
                }
                tmp[seica] += v[j]
            }
        }
        var flag = true
        for(j in 0 until 3)if(tmp[j] == 0)flag = false
        if(flag){
            //println(tmp.joinToString())
            cos += Math.abs(a - tmp[0])
            cos += Math.abs(b - tmp[1])
            cos += Math.abs(c - tmp[2])
            ans = Math.min(ans, cos)
        }

    }

    println(ans)
}

Measured memory_bytes: 40788
class Comb():
    def __init__(self, n, p):
        # O(n)
        fct, inv = [1, 1], [1, 1]
        a, b = 1, 1
        for i in range(2, n + 1):
            a = (a * i) % p
            b = (b * pow(i, p - 2, p)) % p
            fct.append(a)
            inv.append(b)
        self.fct = fct
        self.inv = inv
        self.n = n
        self.p = p

    def calc(self, n, r):
        fct, inv = self.fct, self.inv
        if (r < 0 or n < r):
            return 0
        else:
            return fct[n] * inv[r] * inv[n - r] % p


N, K = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
B = A[::-1]
p = 10 ** 9 + 7
cmb = Comb(N, p)
ans = 0
for n in range(N - K + 1):
    c = cmb.calc(N - n - 1, K-1)
    ans -= A[n] * c % p
    ans += B[n] * c % p
print(ans % p)


Measured memory_bytes: 71976
#include <assert.h>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using ll = long long;
using P = std::pair<ll, ll>;

#define rep(i, a, b) for (ll(i) = (a); i < (b); i++)
#define all(i) i.begin(), i.end()
#define debug(i) std::cerr << "debug "<< i << std::endl

// const ll MOD = 998244353;
const ll MOD = 1e9 + 7;

//とりあえず1-indexedでつくったBIT
template <class T>
class BinaryIndexedTree {
  private:
  T n;
  std::vector<T> bit;

  public:
  BinaryIndexedTree(T i) : n(i), bit(i + 1, 0){};

  // a番目にwを加算
  void add(T a, T w) {
    for (T x = a; x <= n; x += (x & -x)) {
      bit[x] += w;
    }
  }

  //[1,a]の和
  T sum(T a) {
    T ret = 0;
    for (T x = a; x > 0; x -= (x & -x)) {
      ret += bit[x];
    }
    return ret;
  }

    //各項がすべて非負のものに対して、sum[1,a]>=keyを満たす最小のaを返す 存在しないなら-1返す
  T lower_bound(T key){
    T len=1,temp=n,now=0,value=0,flag;
    while(temp/2!=0){
      len*=2;
      temp/=2;
    }

    while(len>0){
      while(now+len>n)len/=2;

      if(value+bit[now+len]>=key){
        len/=2;
      }else{
        now+=len;
        value+=bit[now];
        len/=2;
        if(now==n){
          return -1;
        }
      }
    }

    now++;
    return now;
  }
};

int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  //問題文中の添え字が0-indexか1-indexか確認!

  ll n;
  std::cin>>n;

  std::vector<ll> a(n);
  rep(i,0,n)std::cin>>a[i];

  ll left=0,right=MOD;

  ll len=n*(n+1)/2;

  while(right-left>1){
    ll mid=left+(right-left)/2;

    ll cnt=0;

    BinaryIndexedTree<ll> count(2*n+1);

    ll sum=0;count.add(sum+n+1,1);
    rep(i,0,n){
      sum+=((a[i]>=mid)?1:-1);
      cnt+=count.sum(sum+n+1);
      count.add(sum+n+1,1);
    }

    if(cnt>=(len+1)/2)left=mid;
    else right=mid;
  }

  std::cout<<left;

  return 0;
}


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

int main() {
  int ans = 0;
  string s;
  cin >> s;
  if(s[0] == '1') ans++;
  if(s[1] == '1') ans++;
  if(s[2] == '1') ans++;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

// vectorの重複削除
// std::sort(test.begin(), test.end()); 昇順
// test.erase(std::unique(test.begin(), test.end()), test.end());

using namespace std;
using ll = long long;
using P = pair<int, int>; // vector<P> ba(n); みたいな感じですぐ使える ba[i] = P(a, b); make_pairをしなくてもいい
// typedef vector<int> v;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}
#define rep(i, c) for(int i = 0; i < int(c); i++)
#define ALL(x) (x).begin(), (x).end() //sort(ALL(obj))みたいな
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値
#define pb push_back //
// const int MOD = 1000000007;
// string alpha="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
// printf("%.20f\n", ans); あれ
// const double PI = 3.141592653589793238462643383;



int main() {
  int n; cin>>n;
  std::map<string, int> map{};
  rep(i,n) {
    string s; cin>>s;
    if (map[s]) map[s]++;
    else map[s] = 1;
  }

  int m; cin>>m;
  rep(i,m) {
    string s; cin>>s;
    if (map[s]) map[s]--;
  }

  int ans = -1;
  for (auto itr = map.begin(); itr != map.end(); ++itr) {
    ans = max(itr->second, ans);
    //cout << itr->second << endl;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3168
//author Forsaken
#define Hello the_cruel_world!
#pragma GCC optimize(2)
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cstring>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<utility>
#include<cmath>
#include<climits>
#include<deque>
#include<functional>
#include<numeric>
#define lowbit(x) ((x) & (-(x)))
#define FRIN freopen("C:\\Users\\Administrator.MACHENI-KA32LTP\\Desktop\\1.in", "r", stdin)
#define FROUT freopen("C:\\Users\\Administrator.MACHENI-KA32LTP\\Desktop\\1.out", "w", stdout)
#define FAST ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define outd(x) printf("%d\n", x)
#define outld(x) printf("%lld\n", x)
#define outu(x) printf("%u\n", x)
#define memset0(arr) memset(arr, 0, sizeof(arr))
#define il inline
using namespace std;
typedef unsigned int ui;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
const int maxn = 5e5;
const int INF = 0x7fffffff;
const int mod = 1e9 + 7;
const double eps = 1e-7;
const double Pi = acos(-1.0);
il int read_int() {
	char c;
	int ret = 0, sgn = 1;
	do { c = getchar(); } while ((c < '0' || c > '9') && c != '-');
	if (c == '-') sgn = -1; else ret = c - '0';
	while ((c = getchar()) >= '0' && c <= '9') ret = ret * 10 + (c - '0');
	return sgn * ret;
}
il ll read_ll() {
	char c;
	ll ret = 0, sgn = 1;
	do { c = getchar(); } while ((c < '0' || c > '9') && c != '-');
	if (c == '-') sgn = -1; else ret = c - '0';
	while ((c = getchar()) >= '0' && c <= '9') ret = ret * 10 + (c - '0');
	return sgn * ret;
}
il ll quick_pow(ll base, ll index, ll p) {
	ll res = 1;
	while (index) {
		if (index & 1)res = res * base % p;
		base = base * base % p;
		index >>= 1;
	}
	return res;
}
int arr[maxn + 5], n;
ll res;
char s[maxn + 5];
int main()
{
	scanf("%s", s + 1);
	n = strlen(s + 1);
	for (int i = 1; i <= n; ++i) {
		if (s[i] == '<')arr[i + 1] = max(arr[i + 1], arr[i] + 1);
	}
	for (int i = n; i > 0; --i){
		if (s[i] == '>')arr[i] = max(arr[i], arr[i + 1] + 1);
	}
	for (int i = 1; i <= n + 1; ++i)res += arr[i];
	outld(res);
	//system("pause");
	return 0;
}

Measured memory_bytes: 2688
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();

		int minDigit = 11;
		for (long a = 1; a * a <= n; a++) {
			if (n % a == 0) {
				long b = n / a;
				int digit = func("" + a, "" + b);
				if (digit < minDigit) {
					minDigit = digit;
				}
			}
		}

		System.out.println(minDigit);

		sc.close();
	}

	static int func(String a, String b) {
		return Math.max(a.length(), b.length());
	}

}


Measured memory_bytes: 23636
using System;
using System.Linq;
using System.Collections;

namespace bucon
{
    class Program
    {
        static void Main(string[] args)
        {
            String[] a = Console.ReadLine().Split(' ');
            int b = int.Parse(a[0]);
            int c = int.Parse(a[2]);
            int ans;

            if(a[1] == "+"){
                ans = b + c;
            }else{
                ans = b - c;
            }
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 11092
#include<iostream>
using namespace std;
int parent[200005];
bool is_closed[200005]={false};
bool unite(int a,int b);
int root(int a);
int main(){
  int n;
  long long k;
  int to[200005];
  cin>>n>>k;
  for(int i=0;i<=n;i++){
    parent[i]=i;
  }
  for(int i=1;i<=n;i++){
    cin>>to[i];
    if(unite(i,to[i])==false){
      is_closed[i]=true;
    }
  }
  
  int pos=1;
  while(!is_closed[pos]&&k>0){
    k--;
    pos=to[pos];
  }
  if(k==0){
    cout<<pos<<endl;
    return(0);
  }
  
  int cnt=1;
  int start=pos;
  pos=to[pos];
  while(start!=pos){
    cnt++;
    pos=to[pos];
  }
  
  k%=cnt;
  for(int i=0;i<k;i++){
    pos=to[pos];
  }
  cout<<pos<<endl;
  return(0);
}

int root(int a){
  if(a==parent[a]){
    return(a);
  }
  return(parent[a]=root(parent[a]));
}

bool unite(int a,int b){
  a=root(a);
  b=root(b);
  if(a==b){
    return(false);
  }
  parent[b]=a;
  return(true);
}

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

int main() {
  std::string S, T;
  std::cin >> S >> T;

  std::sort(S.begin(), S.end());
  std::sort(T.begin(), T.end(), std::greater<char>());

  std::cout << (S < T ? "Yes" : "No") << std::endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FASTER ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
typedef long long ll;
int i,j;
void solve(){
    string s;cin>>s;
    int cnt = 0;
    char p = 'T';
    for(auto c : s){
        if(c=='R'){
            if(p=='R') cnt++;
            else cnt = 1;
        }
        p = c;
    }

    cout<<cnt<<"\n";
    return;
}

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


Measured memory_bytes: 3636
#include <stdio.h>

int main(void)
{
	char *out[] = {
		"light fly",
		"fly",
		"bantam",
		"feather",
		"light",
		"light welter",
		"welter",
		"light middle",
		"middle",
		"light heavy",
		"heavy"
	};
	double weight;
	int class_b;

	while (~scanf("%lf", &weight)){
		class_b = 0;
		if (weight > 48.0) class_b++;
		if (weight > 51.0) class_b++;
		if (weight > 54.0) class_b++;
		if (weight > 57.0) class_b++;
		if (weight > 60.0) class_b++;
		if (weight > 64.0) class_b++;
		if (weight > 69.0) class_b++;
		if (weight > 75.0) class_b++;
		if (weight > 81.0) class_b++;
		if (weight > 91.0) class_b++;
		puts(out[class_b]);
	}

	return (0);
}

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

 
int main()
{
    int N,y;

    scanf("%d",&N);

    
    if(N % 1000 == 0){
        printf("%d\n",0);
    } 

    else {
        printf("%d\n", 1000 - N % 1000);
    }
    

    
    
 
    return 0;
}

Measured memory_bytes: 1736
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))

o=0

for i in range(N):
    if A[N-i]>B[N-1-i]:
        o+=B[N-1-i]
    else:
        o+=A[N-i]
        if A[N-1-i]+A[N-i]>B[N-1-i]:
            o+=B[N-1-i]-A[N-i]
            A[N-1-i]-=B[N-1-i]-A[N-i]
        else:
            o+=A[N-1-i]
            A[N-1-i]=0
        A[N-i]=0

print(o)


Measured memory_bytes: 18396