akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define all(v) v.begin(), v.end()
#define mp make_pair
#define INF 1e9
const double PI = 3.14159265358979323846;

void init()
{
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
}

int main()
{
    init();
    int a,b,h,m;
    double c;
    cin>>a>>b>>h>>m;
    a=(double)a;
    b=(double)b;
    h=(double)h;
    m=(double)m;
    c = a * a + b * b - 2.0 * a * b * cos(M_PI * h / 6+(M_PI*m)/360 - (M_PI * m / 30));
    cout << sqrt(c) << endl;
}


Measured memory_bytes: 4216
# coding: utf-8
# Your code here!
#########行列読み込み ##############################################
"""
from sys import stdin
n = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip().split() for _ in range(n)]
print(data)
print(*data, sep='\n')
"""
##################################################################
#########入力系####################################################
"""
s =input()
s=list(input())
a=int(input())
x,y = map(int,input().split())	
li = input().split()	
li = list(map(int,input().split()))	
li = input().split('T')	
"""
##################################################################
import math
A,B,H,M= map(int,input().split())
if abs(30*H-5.5*M)%360<=180:
    i = abs(30*H-5.5*M)%360
else:
    i = 360-abs(30*H-5.5*M)%360

#print(i)
sin30 = math.cos(math.radians(i))
#print(sin30)
ans = (A*A+B*B-2*A*B*sin30)
print(math.sqrt(ans))

    






Measured memory_bytes: 9452
#include <iostream>
#include<string>
#include<stdio.h>
using namespace std;
int main()
{
	int N;
	int preans = 1;;
	cin >> N;
	int a[11];
	for (int i = 0;i < N;i++)cin >> a[i];
	for (int i = 0;i < N;i++) {
		if (a[i] % 2 == 0)preans *= 2;
	}
	int ans = 1;
	for (int i = 0;i < N;i++)ans *=3;
	cout << ans - preans;
}


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

typedef long long ll;
typedef pair<int, int> ii;

int main()
{
    int n;
    scanf("%d", &n);

    int ans = 0;
    if (n / 500 > 0) {
        ans += n / 500 * 1000;
        n -= 500 * (n / 500);
    }

    if (n / 5 > 0) {
        ans += n / 5 * 5;
        n -= 5 * (n / 5);
    }

    printf("%d\n", ans);

    return 0;
}


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

const double PI = acos(-1);
const double EPS = 1e-15;
using ll = long long;
using ull = unsigned long long;
const int inf = 2e9;
const ll INF = 2e18;
const ll MOD = 1e9+7;
const ll MOD1 = 998244353;
//typedef pair<int,int> P;

#define rep(i,a,b) for (int i = (a); i < (b); i++)
#define rrep(i,a,b) for (int i = (a); i >= (b); i--)
#define REP(i,n) rep(i,0,n)
#define RREP(i,n) rrep(i,n,0)
#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
//#define mp make_pair

ll n;
ll sum;

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

  cin >> n;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ll a = i - 1;
      ll b = n / i - 1;
      if (a != 0) {
        if (n / a == n % a) sum += a;
      }
      if (b != a) {
        if (n / b == n % b) sum += b;
      }
    }
  }

  cout << sum << endl;

  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int K, S, count=0;
    scanf("%d%d",&K,&S);
    for(int x=0; x<=K; x++){
        for(int y=0; y<=K; y++){
            int z = S-x-y;
            if(S==x+y+z && z>=0 && z<=K) count++;
        }
    }
    printf("%d", count);
    return 0;
}

Measured memory_bytes: 1696
#include<bits/stdc++.h>
#include<string>
#include<vector>
using namespace std;
typedef pair<int, int>P;
typedef long long ll;
#define rep(i,n)for(ll i=0;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;
//max=({});
//条件式が真ならwhileの中身を回し続ける
//printf("%d\n", ans);

//pairの入力
//vector<pair<ll, ll>>work(n);
//rep(i, n) {
//	ll a, b;
//	cin >> a >> b;
//	work[i] = make_pair(a, b);
//for(auto p:mp)(mapの探索)
//printf("%.10f\n",なんちゃら)
//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

//素因数分解
map<ll, ll>ins;
void facterize(ll n) {
	ll a = 2;
	while (n >= a * a) {
		if (n % a == 0) {
			ins[a]++;
			ins[a] = ins[a] % 1000000007;
			n /= a;
		}
		else {
			a++;
		}
	}
	ins[n]++;
}

int keta(int x) {
	int y = 0;
	while (x > 0) {
		y++;
		x /= 10;
	}
	return y;
}

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

//long longしか使わない
int main() {
	string s;
	cin >> s;
	string target = s.substr(0, 1);
	ll n = s.length();
	ll ans = 1;
	for (ll i = 1;i < n;++i) {
		string s2 = s.substr(i, 1);
		if (target == s2&&i<n-1) {
			s2 = s.substr(i, 2);
			i++;
		}
		if (target == s2 && i == n - 1) {
			break;
		}
		ans++;
		target = s2;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 640
#include<cstdio>
#include<algorithm>
#include<cmath>
using namespace std;
const int maxn = 2e5+10;
long long sum[maxn];
int n;

int main()
{
    while(scanf("%d",&n)!=EOF)
    {
        for(int i=1;i<=n;i++)
        {
            long long a;
            scanf("%lld",&a);
            if(i==1)
            {
                sum[1] = a;
                continue;
            }
            sum[i] = sum[i-1]+a;
        }

        long long ans=abs(sum[n]-sum[1]-sum[1]);
        for(int i=1;i<n;i++)
        {
            ans = min(ans,abs(sum[n]-sum[i]-sum[i]));
        }
        printf("%lld\n",ans);
    }
}


Measured memory_bytes: 1664
/*Code by Codercjh*/
#include<bits/stdc++.h>
#define fr(i,a,b) for(int i=(a);i<=(b);++i)
#define rf(i,a,b) for(int i=(a);i>=(b);--i)
#define min(a,b) (a<b?a:b)
#define max(a,b) (a>b?a:b)
using namespace std;
typedef long long ll;
template<typename T>
inline void read(T &x){
	char c=getchar();T fh=0;bool f=false;
	while(!isdigit(c))f|=(c=='-'),c=getchar();
	while(isdigit(c))fh=(fh<<1)+(fh<<3)+(c^48),c=getchar();
	x=f?-fh:fh;
	return;
}
string s; 
int main(){
    cin>>s;
    for(int i=0;i<s.size();++i){
    	if(s[i]=='7')return puts("Yes"),0;
	}
	puts("No");
	return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n, m;
  cin >> n >> m;
  int digit[5];
  int num[5];
  for(int i = 0; i < m; ++i) cin >> digit[i] >> num[i];
  string temp;
  bool flag = true;
  for(int number = 0; number < 1000; ++number){
    temp = to_string(number); 
    if(temp.length() != n) continue;
    flag = true;
    for(int i = 0; i < m; ++i){
      if(temp[digit[i] - 1] - '0' != num[i]) flag = false;
    }
    if(flag){
      cout << number << endl;
      return 0;
    }
  }
  cout << "-1" << endl;
}


Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
from collections import deque

UNVISITED, VISITED_IN_QUEUE, POPPED_OUT = 0, 1, 2


def generate_adj_matrix(v_info):
    for v_detail in v_info:
        v_adj_list = v_detail[2:]
        # assert len(v_adj_list) == int(v_detail[1])
        for each in v_adj_list:
            init_adj_matrix[int(v_detail[0]) - 1][int(each) - 1] = 1
    return init_adj_matrix


def graph_bfs(v_init):
    vertices_status_list[v_init] = VISITED_IN_QUEUE
    vertices_distance_list[v_init] = 0
    vertices_visit_queue.appendleft(v_init)

    while vertices_visit_queue:
        current_vertex = vertices_visit_queue.popleft()
        for v in range(1, vertices_num + 1):
            if adj_matrix[current_vertex - 1][v - 1] and vertices_status_list[v] is UNVISITED:
                vertices_status_list[v] = VISITED_IN_QUEUE
                vertices_distance_list[v] = vertices_distance_list[current_vertex] + 1
                vertices_visit_queue.append(v)
        vertices_status_list[current_vertex] = POPPED_OUT
    return vertices_distance_list


if __name__ == '__main__':
    _input = sys.stdin.readlines()
    vertices_num = int(_input[0])
    vertices_info = list(map(lambda x: x.split(), _input[1:]))
    init_adj_matrix = [[0] * vertices_num for _ in range(vertices_num)]
    # assert len(vertex_info) == vertex_num

    # config length = (vertex_num + 1)
    vertices_visit_queue = deque()
    vertices_status_list = [UNVISITED] * vertices_num
    vertices_status_list.insert(0, -1)
    vertices_distance_list = [-1] * (vertices_num + 1)

    adj_matrix = generate_adj_matrix(vertices_info)
    ans = graph_bfs(v_init=1)
    for j in range(vertices_num):
        print(j + 1, ans[j + 1])

Measured memory_bytes: 8132
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<algorithm>
#include<queue>
#include<map>
#include<vector>
#include<functional>
#include <random>
#include<iostream>
#include<iomanip>
using namespace std;


int parent[100000];

int root_of(int i) {
	if (parent[i] == -1) {
		return i;
	}
	else {
		int ret = root_of(parent[i]);
		parent[i] = ret;
		return ret;
	}
}

void make_parent(int i, int j) {
	if (root_of(i) != root_of(j)) {
		parent[root_of(i)] = root_of(j);
	}
}

int N, M, K;
int A[100000], B[100000], C[100000], D[100000];
int cnt_sison[100000];
int direct_friend[100000];
int blocked_in_same_component[100000];

int main() {

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

	for (int i = 0; i < N; i++) {
		parent[i] = -1;
	}

	for (int i = 0; i < M; i++) {
		make_parent(A[i], B[i]); /*A[i]の親をB[i]にする */
	}

	for (int i = 0; i < N; i++) {
		cnt_sison[i] = 0;
		direct_friend[i] = 0;
		blocked_in_same_component[i] = 0;
	}
	for (int i = 0; i < N; i++) {
		cnt_sison[root_of(i)] += 1;
	}
	for (int i = 0; i < M; i++) {
		direct_friend[A[i]] += 1;
		direct_friend[B[i]] += 1;
	}
	for (int i = 0; i < K; i++) {
		if (root_of(C[i]) == root_of(D[i])) {
			blocked_in_same_component[C[i]] += 1;
			blocked_in_same_component[D[i]] += 1;
		}
	}

	for (int i = 0; i < N; i++) {
		cout << cnt_sison[root_of(i)] - 1 - direct_friend[i] - blocked_in_same_component[i] << " ";
	}

}

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

#define IOS cin.tie(0);ios_base::sync_with_stdio(false)

#define ll      long long
#define Fi      first
#define Se      second
#define Pb      push_back
#define vi      vector<int>
#define vp      vector<pair<int,int>>
#define vvi     vector<vector<int>>
#define vvp     vector<vector<pair<int,int>>>
using Graph  =  vector<vector<int>>; //Caution!! Segmentation Fault!! Don't forget to add +1!

#define sz(x) (int)x.size()
#define all(v) v.begin(),v.end()
#define output_s(s) printf("%s\n",(s).c_str())
#define END cout<<"\n"

#define rep(i,n)        for(int i=0;i<(int)(n);i++)
#define Rep(i,n,m)      for(int i=(int)(n);i<(int)(m);i++)
#define RepS(i,n,m)     for(int i=(int)(n);i<=(int)(m);i++)
#define RRepS(i,n,m)    for(int i=(int)(n);i>=(int)(m);i--)
#define SRepS(i,n,m)    for(int i=(int)(n);i*i<=(int)(m);i++)
#define RepA(x)         for(auto &item:(x))

void CINT(){} //@shibh308's template
template<class Head,class... Tail> void CINT(Head&& head,Tail&&... tail){cin>>head; CINT(move(tail)...);}    
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)
#define VCIN(x) for(auto &item:x) cin>>item

void OUT(){}
template<class Head,class...Tail> void OUT(Head&& head,Tail&&...tail){cout<<head<<(sizeof...(tail)?" ":"\n"); OUT(move(tail)...);}
#define COUT(...) OUT(__VA_ARGS__)

template<typename TypeInt>TypeInt GCD(TypeInt a,TypeInt b){return a%b==0?b:GCD(b,a%b);} //最大公約数
template<typename TypeInt>TypeInt LCM(TypeInt a,TypeInt b){return a*b/GCD(a,b);} //最小公倍数
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}
template<class T>bool comp(T a,T b){return abs(a)<abs(b);} //比較関数

void YES(bool f){printf(f?"YES\n":"NO\n");}
void Yes(bool f){printf(f?"Yes\n":"No\n");}
void Possible(bool f){printf(f?"Possible\n":"Impossible\n");}
void POSSIBLE(bool f){printf(f?"POSSIBLE\n":"IMPOSSIBLE\n");}

//----------------------library------------------------//

//const int dx[4]={1,0,-1,0};
//const int dy[4]={0,1,0,-1};
const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};
const int NMAX = 200;
const int INF = 1e9;
const int MOD = 1e9+7;
bool flag;

//----------------------Global-------------------------//


signed main(){
    CIN(N,Q);
    vi cur(N+1,0);
    char a;cin>>a;
    rep(i,N-1){
        char c;cin>>c;
        if(a=='A'&&c=='C')cur[i+1]=1;
        cur[i+1]+=cur[i];
        a=c;
    }

    rep(i,Q){
        CIN(l,r);
        int ans=cur[r-1]-cur[l-1];
        printf("%d\n",ans);
    }

    return 0;
}

Measured memory_bytes: 1280
/*

* author:mel0n
* le epic style 
*
*

*/

#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false);cin.tie(0)
#define lli long long int
#define pi pair<int,int>
#define all(x) (x).begin(),(x).end()

using namespace std;



int main()
{

fast;
lli n;
cin>>n;
string s;
while(true)
{
n--;
s.push_back(char('a'+n%26));
n=n/26;
if(n==0)
	break;

}

reverse(s.begin(),s.end());
cout<<s<<endl;



}



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

#ifdef LOCAL
#include "../../dump.hpp"
#else
#define dump(...)
#endif

#define rep(i,n) for(ll i=0,i##_cond=(n);i<i##_cond;++i)
#define FOR(i,a,b) for(ll i=(a),i##_cond=(b);i<i##_cond;++i)
#define ROF(i,a,b) for(ll i=(a)-1,i##_cond=(b);i>=i##_cond;--i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend() //sortで大きい順
#define UNIQUE(v) v.erase(unique(all(v)),v.end())
#define SUM(a) accumulate(all(a),0)
#define sz(x) ((ll)(x).size())
#define pb push_back
#define fst first
#define snd second
#define mp make_pair

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<ll,ll> pii;

const ll inf = 1ll<<62;
const ll mod = 1e9+7;

int main(){
#define int ll
  int n; cin >> n;
  set<string> st;
  string pre; cin >> pre;
  st.insert(pre);
  rep(i,n-1){
    string now; cin >> now;
    if(st.count(now) == 0 and pre[pre.size()-1] == now[0]){
      st.insert(now);
      pre = now;
    }else{
      cout << "No\n";
      return 0;
    }
  }
  cout << "Yes\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<string.h>
using namespace std;
#define pb push_back
#define all(v) v. begin(),v. end()
#define  rep(i,n,v) for(i=n;i<v;i++)
#define per(i,n,v) for(i=n;i>v;i--)
#define ff first 
#define ss second 
#define pp pair<ll,ll>
#define ll  long long
#define endl '\n'
void solve()
{
  ll n, a,m=0,b=1, c,k=0, i, j,l=2e9+7;
  string s, r, y;
  cin>>n>>a;
  if(a-n+1<=2019)
  {
    rep(i,n,a)
    {
      rep(j,i+1,a+1)
      {
        l=min(l,((i%2019)*(j%2019))%2019);
      }
    }
    cout <<l;
  }
  else cout<<0<<endl;
}
int main()
{
 ios_base::sync_with_stdio(false);
  cin. tie(0);cout. tie(0);
    ll t=1;
  // cin>>t;
    while(t--)
    {
      solve();
    }
    return 0;
}

Measured memory_bytes: 3660
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<cstring>
#include<math.h>
#include<bitset>
#include<queue>
#include<set>
#include<iomanip>
#include<math.h>
#include<assert.h>
#include<string>
#include<cstdlib>
#include<cctype>
#include<unordered_map>
#include<sstream>
// #include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 1LL << 40;
const double INFD = 1e100;
const ll mod = 1000000007;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
};
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
};

// intやllをstringに変換
template<typename T> inline string toString(const T &a){
  ostringstream oss;
  oss << a;
  return oss.str();
};
// ----------------------------------------------------------------------------
int main(){
  int N;
  cin >> N;
  int ans = mod;
  for(int i=0; i<=N; i++){
    int cnt=0;
    int t = i;
    while(t){
      cnt += t%6;
      t /= 6;
    }
    t = N-i;
    while(t){
      cnt += t%9;
      t /= 9;
    }
    chmin(ans,cnt);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
 
int main()
{
  int N;
  cin >> N;
  
  vector<int> sub(N+1);
  for(int i = 0; i < N - 1; ++i)
  {
    int x;
    cin >> x;
    ++sub[x];
  }
  for(int i = 1; i <= N; ++i)
  {
    cout << sub[i] << endl;
  }
  
  return 0;
}

Measured memory_bytes: 3996
N = int(input())
def factorize(n):
    arr = []
    temp = n
    for i in range(2, int(n**0.5)+1):
        if temp % i == 0:
            cnt = 0
            while temp % i ==0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])
    if temp != 1:
        arr.append([temp, 1])
    if arr == []:
        arr.append([n, 1])
    return arr

if N == 1:
    print(0); exit()

f = factorize(N)
ans = 0
for p, i in f:
    j = 0
    while i > j:
        j += 1
        i -= j
        ans += 1
print(ans)

Measured memory_bytes: 9484
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#ifdef tabr
#include "library/debug.cpp"
#else
#define debug(...)
#endif

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll x, y;
    cin >> x >> y;
    ll z = abs(x - y);
    if (z <= 1) {
        cout << "Brown" << '\n';
    } else {
        cout << "Alice" << '\n';
    }
    return 0;
}


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

/*
*▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
*    ▀▀       ▀▀▀▀▀▀    ▀     ▀▀▀▀▀▀      ▀    ▀
*   ▀  ▀      ▀         ▀     ▀            ▀  ▀
*  ▀    ▀     ▀ ▀ ▀     ▀     ▀ ▀ ▀         ▀
* ▀ ▀▀▀▀ ▀    ▀         ▀     ▀             ▀
*▀        ▀   ▀         ▀     ▀             ▀
*▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
*/
using namespace std;
void afify()
{
	ios::sync_with_stdio(0);
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}
//===============================================
#define ll long
#define ld long double
#define mk make_pair
#define loop(i,intial,n)  for(int i=(intial);i<n;i++)
#define loopn(j,n,ends) for(int j=int(n-1);j>=ends;j--)
#define loopm(name)  for(auto it : name)
#define loopm2(name)  for(auto it2 : name)
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define all(v) v.begin(),v.end()
#define PI (ld)(3.14159265358979323846)
//===============================================
#define SF(a) scanf("%d",&a)
#define SF2(a,b) scanf("%d %d",&a,&b)
#define SFLL(a) scanf("%lld",&a)
#define SFLL2(a,b) scanf("%lld %lld",&a,&b)
#define PF(a) printf("%d\n",a)
#define PFLL(a) printf("%lld\n",a)
//===============================================
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <ld> vld;
typedef vector <vi> vvi;
typedef vector <vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<vpii> vvpii;
typedef stringstream ss;
const double EPS = 1e-4;
const ll oo = (ll) 10e7 + 7;
const ll N = 100018; 
const ll mod = 1073741824;
int dx[] = { 0, 0, -1, 1 };
int dy[] = { 1, -1, 0, 0 }; // 4 Direction*/
//int dx[]={1,1,0,-1,-1,-1,0,1};
//int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction*/
//freopen("largest.in", "r", stdin);
//freopen("output.txt", "w", stdout);
//ifstream ifs("input.txt");
//ofstream ofs("output.txt");


int main()
{
	afify();
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	int mx = max(a, c);
	int mn = min(b, d);
	cout << max(mn - mx, 0) << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int cut(int a[], int d) {
	for (size_t i = 0; i < d; i++)
	{
		if (i > 0) {
			cout << " ";
		}
		cout << a[i];
	}
	cout << endl;
	return 0;
}

int main()
{
	int amount;
	cin >> amount;
	int a[101];
	for (size_t i = 0; i < amount; i++)
	{
		cin >> a[i];
	}
	for (size_t i = 1; i < amount; i++)
	{
		cut(a, amount);
		int v = a[i];
		int j = i - 1;
		while (j >= 0 && a[j] > v) {
			a[j + 1] = a[j];
			j--;
		}
		a[j + 1] = v;
	}
	cut(a, amount);
	return 0;
}

Measured memory_bytes: 3068
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int a,b,c;
    cin >> a >>b>>c;
    int ans = a+b+c;
    if(ans >= 22){
      cout << "bust"<<endl;
    }else{
      cout << "win"<<endl;
    }
}

// //配列
// vector<int> vec(N);
// for (int i = 0; i < N; i++) {
// cin >> vec.at(i);
// }

// //配列の要素数
// 配列変数.size();

// //初期値の指定
// vector<型> 配列名(要素数, 初期値);

// //要素の追加
// vec.push_back(10);

Measured memory_bytes: 256
import java.util.*;

public class Main{

    public static void main(String args[]){

        // スキャナーの宣言
        Scanner sc = new Scanner(System.in);
        // 整数の入力
		int n = sc.nextInt();
        // スペース区切りの整数の入力
        int x = sc.nextInt();
        int d = 0;
        int count = 1;
        // for文
        for(int i = 0; i < n; i++){
            d = d + sc.nextInt();
            if(d <= x) count++;
            else break;
        }
        // 出力
        System.out.println(count);

    }

}

Measured memory_bytes: 21844
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;

/*BigInteger
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/rational.hpp>
namespace xxx = boost::multiprecision;
using Bint = xxx::cpp_int;
using Real = xxx::number<xxx::cpp_dec_float<1024>>;
*/

#define int long long
#define pb(x) push_back(x)
#define m0(x) memset((x), 0LL, sizeof(x))
#define mm(x) memset((x), -1LL, sizeof(x))

//container
#define ALL(x) (x).begin(), (x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
#define PERM(c) \
  sort(ALL(c)); \
  for (bool c##p = 1; c##p; c##p = next_permutation(ALL(c)))

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

// bit_macro
#define Bit(n) (1LL << (n))
#define Bitset(a, b) (a) |= (1LL << (b))
#define Bitunset(a, b) (a) &= ~(1LL << (b))
#define Bitcheck(a, b) ((((a) >> (b)) & 1LL) == 1LL)
#define Bitcount(a) __builtin_popcountll((a))

//typedef
typedef long long lint;
typedef unsigned long long ull;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;

//constant
constexpr int INF = (int)1e18;
constexpr int MOD = (int)1e9 + 7;
constexpr double PI = (double)acos(-1);
constexpr double EPS = (double)1e-10;
constexpr int dx[] = {-1, 1, 0, 0};
constexpr int dy[] = {0, 0, -1, 1};

//
template <typename T>
void chmax(T &a, T b) { a = max(a, b); }
template <typename T>
void chmin(T &a, T b) { a = min(a, b); }
//
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

//
struct Accelerate_Cin {
  Accelerate_Cin() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);
  };
};

signed main() {
  string s, t;
  cin >> s >> t;
  static int dp[3030][3030];
  m0(dp);

  for (int i = 0; i < s.size(); i++) {
    for (int j = 0; j < t.size(); j++) {
      if (s[i] == t[j]) {
        dp[i + 1][j + 1] = dp[i][j] + 1;

      } else {
        dp[i + 1][j + 1] = max(dp[i][j + 1], dp[i + 1][j]);
      }
    }
  }

  string ans = "";
  int i = s.size(), j = t.size();
  while (i >= 1 && j >= 1) {

    if (dp[i][j] == dp[i - 1][j]) {
      i--;
      continue;
    }

    if (dp[i][j] == dp[i][j - 1]) {
      j--;
      continue;
    }

    ans = s[i - 1] + ans;
    i--, j--;
  }

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


Measured memory_bytes: 71936
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;

#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define ROF(i,b,a) for (int i=(b);i>(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,n-1,-1)

typedef int i32;
typedef long long int i64;
typedef unsigned long long int ui64;
typedef float f32;
typedef double f64;
typedef long double f128;


int main(){
    int a,b;
    cin >> a >> b;
    int h=0;
    REP(i,b-a){
        h += i;
    }
    cout << h-a;
}


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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

signed main(){
    int a,b;
    cin>>a>>b;
    printf("%.20f\n",1.0/(1.0/a+1.0/b));
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

void trace(int A[],int N){
    int i;
    for (i=0;i<N;i++){
        if (i>0) printf(" ");
        printf("%d",A[i]);
    }
    printf("\n");
}

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

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


Measured memory_bytes: 2700
#include<stdio.h>

int main(){
  
  int a, b, c, d, e, k;
  
  if(scanf("%d", &a)==0) return -1;
  if(scanf("%d", &b)==0) return -1;
  if(scanf("%d", &c)==0) return -1;
  if(scanf("%d", &d)==0) return -1;
  if(scanf("%d", &e)==0) return -1;
  if(scanf("%d", &k)==0) return -1;
  
  if(e-a<=k) printf("Yay!");
  else printf(":(");
  
  return 0;
}

Measured memory_bytes: 128
import java.util.*;
import java.io.*;
import java.awt.geom.*;
import java.math.*;

public class Main {

	static final Scanner in = new Scanner(System.in);
	static final PrintWriter out = new PrintWriter(System.out,false);
	static boolean debug = false;

	static int[] kahn(int[][][] g) {
		int n = g.length, pos = 0;
		int[] res = new int[n];
		int[] in = new int[n];
		for (int cur=0; cur<n; cur++) {
			for (int[] to : g[cur]) {
				in[to[0]]++;
			}
		}

		ArrayDeque<Integer> que = new ArrayDeque<>();
		for (int i=0; i<n; i++) {
			if (in[i] == 0) {
				que.add(i);
			}
		}
		while (!que.isEmpty()) {
			int cur = que.pollFirst();
			res[pos++] = cur;
			for (int[] to : g[cur]) {
				if (--in[to[0]] == 0) {
					que.add(to[0]);
				}
			}
		}

		int max = -1;
		for (int i=0; i<n; i++) {
			max = Math.max(max, in[i]);
		}

		return max == 0 ? res : null;
	}

	static int[][][] directedGraph(int n, int[] from, int[] to, int[] cost) {
		int[] cnt = new int[n];
		for (int i : from) cnt[i]++;

		int[][][] g = new int[n][][];
		for (int i=0; i<n; i++) g[i] = new int[cnt[i]][2];
		for (int i=0; i<from.length; i++) {
			int s = from[i];
			int t = to[i];

			g[s][--cnt[s]][0] = t;
			g[s][cnt[s]][1] = cost[i];
		}

		return g;
	}

	static void solve() {
		int v = in.nextInt();
		int e = in.nextInt();
		int[] s = new int[e];
		int[] t = new int[e];
		int[] c = new int[e];
		for (int i=0; i<e; i++) {
			s[i] = in.nextInt();
			t[i] = in.nextInt();
			c[i] = 0;
		}
		int[][][] g = directedGraph(v, s, t, c);

		int[] tp = kahn(g);
		for (int i=0; i<v; i++) {
			out.println(tp[i]);
		}
	}

	public static void main(String[] args) {
		debug = args.length > 0;
		long start = System.nanoTime();

		solve();
		out.flush();

		long end = System.nanoTime();
		dump((end - start) / 1000000 + " ms");
		in.close();
		out.close();
	}

	static void dump(Object... o) { if (debug) System.err.println(Arrays.deepToString(o)); }
}

Measured memory_bytes: 68372
#include <bits/stdc++.h>
using namespace std;
struct Fast {
    Fast() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} fast;
template <typename A, size_t N, typename T> void Fill(A (&array)[N], const T& val) {
    std::fill((T*)array, (T*)(array + N), val);
}
// long long mod = 998244353;
#define REP(i, n) for (long long i = 0; i < (n); i++)
#define rep(i, a, n) for (long long i = a; i < (n); i++)
typedef long long ll;
typedef pair<ll, ll> P;
long long mod = 1000000007;
long long modpow(long long m, long long n, long long modvalue) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        long long t = modpow(m, n / 2, modvalue);
        return t * t % modvalue;
    } else {
        return modpow(m, n - 1, modvalue) * m % modvalue;
    }
}

long long moddiv(long long a, long long b, ll modvalue) { return (a * modpow(b, mod - 2, modvalue)) % modvalue; }

const ll INF = 1LL << 60;

string change_binary(long long a) {
    string ret;
    for (int i = 31; i >= 0; i--) {
        ret += (a >> i & 1) + '0';
    }
    return ret;
}

ll nCkmod(ll n, ll k, ll modvalue) {
    ll numera = 1;
    for (int i = n; i > n - k; i--) {
        numera *= i;
        numera %= modvalue;
    }
    ll denomi = 1;
    REP(i, k) {
        denomi *= (i + 1);
        denomi %= modvalue;
    }
    return moddiv(numera, denomi, modvalue);
}

map<ll, ll> cnt;
void primeFactors(long long n) {
    while (n % 2 == 0) {
        cnt[2]++;
        n = n / 2;
    }
    for (int i = 3; i <= sqrt(n); i = i + 2) {
        while (n % i == 0) {
            cnt[i]++;
            n = n / i;
        }
    }
    if (n > 2) {
        cnt[n]++;
    }
}
int main() {
    ll n, k;
    cin >> n;
    cout << n * (n - 1) / 2 << endl;
}

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

#include <fstream>
using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << setprecision(20) << fixed;
  /*
  ifstream in("input.txt");
  cin.rdbuf(in.rdbuf());
  //*/
  string S;
  cin >> S;
  int ans = 0;
  for(int i = 0; i < 4; i++){
    if(S[i] == '+') ans++;
    else ans--;
  }
  cout << ans <<endl;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
using ll=long long;
using P = pair<int,int>;
int main(){
    int a,b,c,x,y;
    int xymax=pow(10,5);
    cin >>a>>b>>c>>x>>y;
    c=c*2;
    int ans =2*xymax*5000;
    for(int i=0;i<xymax+1;i++){
        ans=min(ans,i*c+max(0,x-i)*a+max(0,y-i)*b);
    }
    cout << ans << endl;
}


Measured memory_bytes: 3564
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		
		if(a < b) {
			System.out.println("a < b");
		} else if(a > b) {
			System.out.println("a > b");
		} else{
			System.out.println("a == b");
		}
	}

}


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

int main(void){


    while(1){
        int n; cin >> n;
        if(n == 0) break;
        vector<set<int> > people(n);
        for(int i = 0; i < n; i++){
                int m; cin >> m;
            for(int j = 0; j < m; j++){
                int input; cin >> input;
                people[i].insert(input);
            }
        }

        int k; cin >> k;
        vector<bool> criminal(n, false);
        vector<int> a(k);
        for(int i = 0; i < k; i++){
            cin >> a[i];
        }

        for(int i = 0; i < n; i++){
            bool flag = false;
            for(int j = 0; j < k; j++){
                if(people[i].find(a[j]) == people[i].end()){
                    flag = true;
                    break;
                }
            }
            if(!flag) criminal[i] = true;
        }   

        int ans = 0;
        for(int i = 1; i <= n; i++){
            if(criminal[i-1] == true){
                if(ans == 0) ans = i;
                else ans = -1;
            }
        }

        if(ans == 0) ans = -1;

        cout << ans << endl;


    }
    return 0;
}

Measured memory_bytes: 3484
# -*- coding: utf-8 -*-
"""
Created on Tue Sep  8 18:25:14 2020

@author: liang
"""

H, W = map(int, input().split())

field = [input() for i in range(H)]

def Init():
    return [[-1]*W for _ in range(H)]

ans = -1

from collections import deque
q = deque()
adj = ((1,0), (-1,0), (0,1), (0,-1))
def BFS(y,x):
    def isValid(t):
        if t[0] < 0 or t[0] >= H or t[1] < 0 or t[1] >= W or field[t[0]][t[1]] == "#":
            return False
        return True
    d = Init()
    if field[y][x] == '#':
        return -1
    d[y][x] = 0
    q.append((y,x))
    res = 0
    while q:
        cur = q.popleft()
        for a in adj:
            nex = (cur[0]+a[0], cur[1]+a[1])
            if isValid(nex) and (d[nex[0]][nex[1]]== -1 or d[nex[0]][nex[1]] > d[cur[0]][cur[1]]+1):
                d[nex[0]][nex[1]] = d[cur[0]][cur[1]]+1
                if res < d[nex[0]][nex[1]]:
                    res = d[nex[0]][nex[1]]
                q.append(nex)
    return res

for i in range(H):
    for j in range(W):
        tmp = BFS(i,j)
        if tmp > ans:
            ans = tmp
print(ans)

Measured memory_bytes: 9484
#include <iostream>
#include <cstdio>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
using namespace std;

int main() {
    int A, B;
    cin >> A >> B;
    int ans=0;
    for (int i=0; i<2; i++) {
        if(A>B){
            ans+=A;
            A--;
        }
        else{
            ans+=B;
            B--;
        }
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 256
from collections import defaultdict
S = list(input())[::-1]
n = len(S)
d = defaultdict(int)
d[0] += 1
res = 0
for i, s in enumerate(S):
    res += int(s)*pow(10, i, 2019)
    res %= 2019
    d[res] += 1

ans = 0
for v in d.values():
    ans += v*(v-1)//2
print(ans)

Measured memory_bytes: 12144
#include<bits/stdc++.h>
#define ll long long
#define nes ios_base :: sync_with_stdio(0); cin.tie(0);
using namespace std;
int main(){
	nes;
	ll x,mov,dis;
	cin>>x>>mov>>dis;
	if(x<0) x*=-1;
	ll mul=x/dis;
	if(mul<=mov){
		mov-=mul;
		if(mov%2==0) cout<<abs(x-mul*dis);
		else cout<<abs(x-(mul+1)*dis);
	}
	else{
		cout<<x-mov*dis;
	}
	return 0;
}

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

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

using namespace std;

int check(vector<int> &mat,vector<int> &vec) {
  rep(i,9) if( mat[i] != -1 && mat[i] != vec[i] ) return 0;
  int a = vec[0] + ( vec[1] * 10 + vec[2] ) + ( vec[3] * 100 + vec[4] * 10 + vec[5] );
  int b = vec[6] * 100 + vec[7] * 10 + vec[8];
  return a == b;
}

int main() {
  vector<int> mat(9);
  rep(i,9) cin >> mat[i];
  vector<int> vec(9);
  REP(i,1,10) vec[i-1] = i;
  int cnt = 0;
  do {
    cnt += check(mat,vec);
  } while( next_permutation(vec.begin(),vec.end()) );
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 3088
#include<stdio.h>
int main(void){
int W,H,x,y,r;
scanf("%d%d%d%d%d",&W,&H,&x,&y,&r);
if (x-r<0||x+r>W)
    printf("No\n");
else if (y-r<0||y+r>H)
    printf("No\n");
    if (x-r>=0&&x+r<=W&&y-r>=0&&y+r<=H)
    printf("Yes\n");
    return 0;
}

Measured memory_bytes: 584
import collections

def accumulate(a):
	sum = 0
	result = [0]
	for x in a:
		sum += x
		result.append(sum)
	return result

def aggregate(a):
	result = []
	for j in range(len(a)):
		for i in range(j):
			result.append(a[j] - a[i])
	return result

while True:
	H, W = map(int, input().split())
	if H == 0: break

	h = [int(input()) for _ in range(H)]
	w = [int(input()) for _ in range(W)]

	ha = aggregate(accumulate(h))
	wa = aggregate(accumulate(w))

	ha.sort()
	wa.sort()
	hc = collections.Counter(ha)
	wc = collections.Counter(wa)

	count = 0
	for size in set(hc.keys()) & set(wc.keys()):
		count += hc[size] * wc[size]

	print(count)





Measured memory_bytes: 125708
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>

#define PI 3.14159265358979323846
using namespace std;

int main() {
    string n;
    cin >> n;
    if (n[0] == '7' || n[1] == '7' || n[2] == '7') {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}

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

#define int long long
typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define YES puts("YES")
#define Yes puts("Yes")
#define NO  puts("NO")
#define No  puts("No")
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

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



signed main() {

    int N, K;
    cin >> N >> K;
    int ans = 0;
    rep(i, N) {
        int t;
        cin >> t;
        if (t >= K) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int PREP = (cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(9), 0);
//int SEGV = getenv("D") || (exit(system("D= SEGFAULT_SIGNALS=all catchsegv ./prog.exe") >> 8), 0);
int main() {
    int N, X, T; cin >> N >> X >> T;
    cout << (N + X - 1) / X * T << endl;
    return 0;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const ll mod = 998244353;
const ll INF = 1001001001;
const ll LINF = 1001001001001001001;

void prvec(vector<ll> vec){ //for debug
    ll n = vec.size();
    cout << "------------------------------------\n" ;
    rep(i,n) cout << i << " " << vec.at(i) << "\n";
    cout << "------------------------------------\n" ;
}

void pr2d(vector<vector<ll>> vec){ // for debug
    ll h = vec.size();
    ll w = vec.at(0).size();
    cout << "------------------------------------\n" ;
    rep(i,h){
        rep(j,w){
            cout << vec.at(i).at(j) << " ";
        }
        cout << "\n";
    }
    cout << "------------------------------------\n" ;
}

int main(){
    ll k ; cin >> k;
    string s; cin >> s;
    ll ss = s.size();
    if(ss<=k){
        cout << s << endl;
    }else{
        rep(i,k){
            cout << s.at(i);
        }
        cout << "..." << endl;
    }
    return 0;
}

Measured memory_bytes: 3600
#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[i];
}
int s=0;
for (int j=0;j<n-1;j++){
    for (int x=j+1;x<n;x++){
        s+=(a[j]*a[x]);
    }
}
cout<<s;
}

Measured memory_bytes: 256
//code by lynmisakura.wish to be accepted!
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;

int main(void){
    ll n;scanf("%lld",&n);
    vector<string> a(n);
    int cnt = 0;
    for (int i = 0; i < n; ++i)
    {
        cin >> a[i];
        for(ll j = 0;j <= a[i].size()-2;j++){
            if(a[i][j] == 'A' and a[i][j+1] == 'B')cnt++;
        }
    }
   // cout << cnt << endl;
    int c[3] = {0,0,0};//B..A,..A,B..
    for (int i = 0; i < n; ++i)
    {
        if(a[i][0] == 'B' and a[i][a[i].size()-1] == 'A')c[0]++;
        else if(a[i][0] == 'B')c[1]++;
        else if(a[i][a[i].size()-1] == 'A')c[2]++;
    }

    if(c[0] == 0){
        cnt += min(c[1],c[2]);
    }else{
        if(c[1] + c[2] == 0){
            cnt += c[0] - 1;
        }else{
            cnt += c[0] + min(c[1],c[2]);
        }
    }

    cout << cnt << endl;
}


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

#define ll long long
const int mx = 2e5;

struct ringo{
  ll value;
  int type;
};

int main(void){
  ll X,Y,A,B,C,color;
  cin >> X >> Y >> A >> B >> C;
  
  vector<ringo> all;//0:red 1:green 2:noc 3:aten
  vector<ll> RED,GREEN,NOCOLOR;
    
  for(int i=0; i<A; i++){
    cin >> color;
    RED.push_back(color);
  }
  for(int i=0; i<B; i++){
    cin >> color;
    GREEN.push_back(color);
  }
  for(int i=0; i<C; i++){
    cin >> color;
    NOCOLOR.push_back(color);
  }
  
  sort(RED.begin(),RED.end(),greater<int>());
  sort(GREEN.begin(),GREEN.end(),greater<int>());
  sort(NOCOLOR.begin(),NOCOLOR.end(),greater<int>());
  for(int i=0; i<X; i++){
    struct ringo X;
    X.value = RED[i];
    X.type = 0;
    all.push_back(X);
  }
  for(int i=0; i<Y; i++){
    struct ringo X;
    X.value = GREEN[i];
    X.type = 1;
    all.push_back(X);
  }
  for(int i=0; i<C; i++){
    struct ringo X;
    X.value = NOCOLOR[i];
    X.type = 2;
    all.push_back(X);
  }
  sort(all.begin(),all.end(),
       [](const ringo& a, const ringo& b){return a.value>b.value;});
  ll score=0;
  for(int i=0; i<A+B+C; i++){
  }
  
  for(int i=0; i<X+Y; i++){
    score += all[i].value;
  }
    
  cout << score;
  
  return 0;
}

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

from collections import Counter

def main():
    N, K, Q, *d = map(int, open(0).read().split())
    # print(Counter(d))
    A = Counter(d)
    for i in range(N):
        if K - Q + A[i+1] > 0:
            print("Yes")
        else:
            print("No")
    


if __name__ == '__main__':
    main()

Measured memory_bytes: 14324
using System;
public class Hello{
    public static void Main(){
        // Your code here!
        int n = int.Parse(Console.ReadLine());
        
        for(int i=1; i<=9; i++){
            for(int j=1; j<=9; j++){
                if(n == i*j){
                    Console.WriteLine("Yes");
                    return;
                }
            }
        }
        
        Console.WriteLine("No");
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define IFOR(i, m, n) for(ll i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()

int main(){
  ll n,m; cin >> n >> m;
  vector<bool> is_possible(n,false);
  is_possible[0] = true;
  vector<ll> cnt(n,1);
  REP(i,m){
    ll x,y; cin >> x >> y;
    x--; y--;
    if(is_possible[x]){
      if(cnt[x]==1){
        is_possible[x] = false;
      }
      is_possible[y] = true;
    }
    cnt[x]--; cnt[y]++;
  }
  ll ans = 0;
  REP(i,n) if(is_possible[i]) ans++;
  cout << ans << endl;
}



Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
ll i,j,k;
int main(){
    int h,w;cin>>h>>w;
    vector<vector<char>> a(h,vector<char>(w,'.'));
    vector<vector<int>> ans1(h,vector<int>(w,0)),ans2(h,vector<int>(w,0));
    vector<vector<int>> ans(h,vector<int>(w,0));

    for(i=0;i<h;i++){
        for(j=0;j<w;j++){
            cin>>a[i][j];
        }
    }

    for(i=0;i<h;i++){//行　右に行くにつれて加算
        for(j=0;j<w;j++){
            if(a[i][j]=='.'){
                if(j==0){ans1[i][j]++;}
                else{ans1[i][j]=ans1[i][j-1]+1;}
            }
        }
    }

    for(i=0;i<h;i++){//列　下に行くにつれて加算
        for(j=0;j<w;j++){
            if(a[i][j]=='.'){
                if(i==0){ans2[i][j]++;}
                else{ans2[i][j]=ans2[i-1][j]+1;}
            }
        }
    }

    for(i=h-2;i>=0;i--){
        for(j=w-2;j>=0;j--){
            if(ans1[i][j]!=0 && ans1[i][j+1]!=0){ans1[i][j]=ans1[i][j+1];}
            if(ans2[i][j]!=0 && ans2[i+1][j]!=0){ans2[i][j]=ans2[i+1][j];}
        }
    }

    for(i=0;i<h;i++){
        for(j=0;j<w;j++){
            ans[i][j]=ans1[i][j]+ans2[i][j]-1;
        }
    }

    int maxi=0;

    for(i=0;i<h;i++){
        for(j=0;j<w;j++){
            maxi=max(maxi,ans[i][j]);
        }
    }

    cout<<maxi<<endl;
    return 0;
}

Measured memory_bytes: 51328
#include<iostream>
#include<bitset>
#include<vector>
#include<string>
using namespace std;

int main(){
    string s;
    cin >> s;
    vector<int> a(4);
    for (int i = 0; i < 4;i++){
       a.at(i)=s.at(i)-'0'; 
    }
    bool ok = false;
    for (int bit = 0; bit < (1 << 3); bit++){
        bitset<3> tmp(bit);
        int ans = a.at(0);
        //cout << tmp << endl;
        for (int i = 2; i>=0;i--){
           
            if(tmp.test(i)){
                ans+=a.at(3-i);
            }else{
                ans-= a.at(3-i);
            }

            if(ans==7){
                ok = true;
                cout << a.at(0);
                for (int i = 2; i >= 0;i--){
                    if(tmp.test(i)){
                        cout << '+';
                    }else{
                        cout << '-';
                    }
                    cout << a.at(3 - i);
                }
                cout << "=7" << endl;

                return 0;
            }
        }
    }
    


    return 0;
}

Measured memory_bytes: 3576
// --------------------<optimizations>--------------------
#pragma GCC optimize("O3")
//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)\
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)\
#pragma GCC optimize("unroll-loops")

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

#include<bits/stdc++.h>

using namespace std;

#define int long long
#define ll long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pii pair<ll,ll>
#define vpii vector<pair<ll,ll> >
#define F first
#define S second
#define ld long double
#define built __builtin_popcountll
#define mst(a,i) memset(a,i,sizeof(a))
#define all(x) x.begin(),x.end()
#define itit(it,a) for(auto it=(a).begin(); it!=(a).end(); it++)
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define repr(i,a,b) for(ll i=a; i>b; i--)
#define reprr(i,a,b) for(ll i=a; i>=b; i--)
#define pi 3.14159265358979323846264338327950288419716939937510582097494459230
ll max3(ll x,ll y,ll z) {return max(max(x,y),z);}
ll min3(ll x,ll y,ll z) {return min(min(x,y),z);}
const ll N=1e5+10,M=2e5+10,M2=1e6+10,mod=998244353,inf=1e17+10;
const int INF=1e9+7;
void add(int& a, int b) {a+=b;if(a>=mod){a-=mod;}}


int X[] = {0, 1, 0, -1};
int Y[] = {-1, 0, 1, 0};
//assic value of ('0'-'9') is(48 - 57) and (a-z) is (97-122) and (A-Z) is(65-90) and 32 for space
ll power(ll x,ll n){ll result=1;while(n>0){if(n%2==1)result=(result*x)%mod; x=((x%mod)*(x%mod))%mod;n=n/2;}return result;}

int n,s;
int a[3010];
int dp[3010];

int32_t main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> s;
    rep(i,0,n) cin >> a[i];
    dp[0]=power(2,n);
    for(int i=0; i<n; i++){
        for(int j=s; j>=a[i]; j--){
            dp[j]=(dp[j]+(dp[j-a[i]])%mod*power(2,mod-2))%mod;
        }
    }
    cout << dp[s];
    return 0;
}


Measured memory_bytes: 3656
def examA():
    S = SI()
    ans = 0
    if "R" in S:
        ans = 1
    if "RR" in S:
        ans = 2
    if "RRR" in S:
        ans = 3
    print(ans)
    return

def examB():
    ans = 0
    print(ans)
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

def test():
    i = I()
    li = LI()
    lsi = LSI()
    si = LS()
    print(i)
    print(li)
    print(lsi)
    print(si)
    return

from decimal import getcontext,Decimal as dec
import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(input())
def LI(): return list(map(int,sys.stdin.readline().split()))
def DI(): return dec(input())
def LDI(): return list(map(dec,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = dec("0.000000000001")
alphabet = [chr(ord('a') + i) for i in range(26)]
alphabet_convert = {chr(ord('a') + i): i for i in range(26)}

getcontext().prec = 28

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examA()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

Measured memory_bytes: 76964