akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using ll = long long;


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

        std::vector<ll> a(n);
        for(ll i=0; i<n; i++) scanf("%lld", &a[i]);
        sort(a.begin(), a.end());


        ll ans = 0;
        for(ll i=0; i<n-2; i++){
                for(ll j=i+1; j<n-1; j++){
                        ll l = j, r = n;
                        while(r-l>1){
                                ll mid = (l+r)/2;
                                if(a[mid]<a[i]+a[j]) l = mid;
                                else r = mid;
                        }
                        ans += l-j;
                }
        }
        printf("%lld\n", ans);
        return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define ALL(A) A.begin(), A.end()

using namespace std;

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

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int N; cin >> N;
	vector<int> yen; vector<double> btc; yen.clear(); btc.clear();
	rep (i, N){
		string x; cin >> x;
		string u; cin >> u;
		if (u == "BTC"){
			btc.push_back(stod(x));
		}else{ // if (u == JPY)
			yen.push_back(stoi(x));
		} // end if
	} // end rep

	ll res = 0LL;
	rep (i, (int)yen.size()){
		res += (ll)yen[i];
	} // end rep

	double ans = 0.0;
	rep (i, (int)btc.size()){
		ans += btc[i];
	} // end rep
	ans *= 380000.0;
	
	ans += (double)res;
	printf("%.8lf\n", ans);

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<deque>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<iterator>
#include<complex>
#include<stack>
#include "stdio.h"
using namespace std;

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

using ll = long long;
using Pii = pair<int, int>;

const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const long long mod_const = 1e9+7;

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

using MIte = multimap<long, long, greater<long> >::iterator;


//1406

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

	// long long?
	long long A,B,C,K;
	cin >> A >> B >> C >> K;
	long long lim = 1e18;

	if (A - B > lim || B - A > lim) {
		cout << "Unfair" << endl;
		return 0;
	}

	if (K % 2 == 0) {
		cout << A - B << endl;
	}
	else {
		cout << B - A << endl;
	}

	return 0;

}

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

int main(){
	int n, m;
	char aft[130];
	bool exi[130];
	char a, b;
	
	while(true){
		cin >> n;
		
		if(n == 0) break;
		
		for(int i = 0; i < 130; i++) exi[i] = false;
		
		for(int i = 0; i < n; i++){
			cin >> a >> b;
			aft[(int)a] = b;
			exi[(int)a] = true;
		}
		
		cin >> m;
		for(int i = 0; i < m; i++){
			cin >> a;
			
			if(exi[(int)a]) cout << aft[(int)a];
			else cout << a;
		}
		cout << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1152
using System;
using System.Linq;
namespace lineAralgebra
{


	class Program
	{
		static void Main(string[] args)
		{
        	var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
			var a = input[0];
			var b = input[1];

			var ans = a - b *2 ;
			if (ans >0) {
				System.Console.WriteLine(ans);
			} else {
				System.Console.WriteLine(0);
			}

		}
	}
}
//                            0       2      4

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

sumBA = 0
sumAB = []
cntBA = 0

for i in range(n):
    if b[i] > a[i]:
        sumBA += b[i] - a[i]
        cntBA += 1
    elif b[i] < a[i]:
        sumAB.append(a[i] - b[i])

if cntBA == 0:
    print(0)
    exit()

if sumBA > sum(sumAB):
    print(-1)
    exit()

sumAB.sort(reverse = True)
count = 0
check = 0
for i in range(len(sumAB)):
    count += 1
    check += sumAB[i]
    if check >= sumBA:
        print(count + cntBA)
        exit()

Measured memory_bytes: 18292
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
int main(void){
    int N;
    cin >> N;
    vector<int> A(N);
    for(int i = 0;i < N;i++){
        cin >> A[i];
        A[i] -= (i + 1);
    }
    sort(A.begin(),A.end());
    long long int ans = 0;
    int B = (N % 2 == 1 ? A[N/2] : (A[N/2]+A[N/2-1]) /2);
    for(int Ai : A){
        ans += std::abs(Ai-B);
    }
    cout << ans << endl;
}


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

/**
|||||||||||||       |||||     |||||    ||||||||||
||||||||||||||      |||||     |||||  |||||
|||||     |||||     |||||     |||||  |||||
||||||||||||||||    |||||||||||||||    ||||||||||
|||||||||||||||||   |||||||||||||||           |||||
|||||        |||||  |||||     |||||           |||||
|||||         ||||| |||||     |||||    ||||||||||
AHMED;HASSAN;SAEED;
*/

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int a,b;
    cin>>a>>b;
    if(a>9||a<1)
        cout<<-1;
    else if(b>9||b<1)
        cout<<-1;
    else
        cout << a*b << endl;
    return 0;
}


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


//      DEEP


using namespace std;
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define fwd(i,a,n) for(int i=a;i<n;i++)
#define bak(i,a,n) for(int i=a;i>=n;i--)
#define all(v) v.begin(),v.end()
#define pb push_back
#define lop '\n'
#define mp make_pair

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> pi;
typedef set<int> si;
const ll mod = 1e9 + 7;
const ll mod1=998244353;
                                                    //power
ll power(ll x,ll y){
   if(y==0) return 1;
   else{
     if(y%2==0) return power(x*x,y/2);
     else return x*power(x*x,(y-1)/2);
   }
}

                        //                    Modular Exponentiation

ll mod_power(ll x, ll y, ll m)
{
    ll r = 1;     // Initialize result

    x = x % m; // Update x if it is more than or equal to m

    if (x == 0) return 0; // In case x is divisible by m;

    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            r = (r*x) % m;

        // y must be even now
        y = y/2;
        x = (x*x) % m;
    }
    return r;
}

                                                      //GCD
ull gcd(ull x,ull y){
   if(y==0)return x;
   return gcd(y,x%y);
}
//                                         EXTENDED_EUCLID
vector<ll>extended_Euclid(ll a,ll b){
    vector<ll>v(3);
    if(b==0){
        v[0]=a;v[1]=1;v[2]=0;
        return v;
    }
    else{
         vector<ll>v1 = extended_Euclid(b,a%b);    //recursive call
         v[0]=v1[0];
         v[1]=v1[2];
         v[2]=v1[1]-(a/b)*v1[2];
         return v;
    }
}
                                          // DFS ( number of connected components  )
//vector<vector<ll> >adj(200001);
//bool visited[200001];
/*ll dfs(int x,int c){                         // x - > node      c - > number of edges in the component
    if(visited[x])return c;
    else{
        visited[x]=true;
        int y=c;
        for(int i=0;i<adj[x].size();i++){
            if(!visited[adj[x][i]]){
                c+=1;
                int d=dfs(adj[x][i],y);
                c+=d;
            }
        }
        return c;
    }
}
*/
                                              // SIEVE

/*
bool isPrime[100001];
void sieve(int N) {

        for(int i = 0; i <= N;++i) {
            isPrime[i]=true;
        }
        isPrime[0]=false;
        isPrime[1]=false;

        for(int i = 2; i * i <= N; ++i) {
             if(isPrime[i] == true) {
                 for(int j = i * i; j <= N ;j += i)
                     isPrime[j] = false;
            }
        }
    }
*/
                               // Binary Search
/*
ll bin_search(ll y){
  while(lo<hi){
    x=lo+(hi-lo)/2;
    if(condition){
            .....
    }
    else{
                  // increase lo or decrease hi suitably
            }
   }
}
*/

int main(){
    boost;
    int TESTS=1;
    //cin>>TESTS;
    while(TESTS--){
        ll a,b;
        cin>>a>>b;
        cout<<a*b<<endl;
    }
}
/* Be careful about integer ranges;
   Check the corner cases before submitting.
*/





Measured memory_bytes: 3620
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int A,B,K;
int cnt=0;
int a[105];
int main()
{
	scanf("%d %d %d",&A,&B,&K);
	for(int i=A;i<=min(A+K-1,B);i++)
	{
	printf("%d\n",i);
	}
	for(int i=B;i>=max(B-K+1,A+K);i--)
	{
		a[++cnt]=i;
	}
	sort(a+1,a+1+cnt);
	for(int i=1;i<=cnt;i++)
	printf("%d\n",a[i]);
}

Measured memory_bytes: 128
#include "bits/stdc++.h"
#pragma GCC optimize("Ofast")


using namespace std;
using ll = long long;

class SegTreeRMQ{
public:
    SegTreeRMQ(int N){
        init(N);
    }
    void init(int N){
        int s = 1;
        while(s < N){
            s*=2;
        }
        dat = std::vector<int>(s * 2, 1e9);
        n = s;
    }
    void update(int i,int x){
        i += n - 1;
        dat[i]= x;
        while(i > 0){
            i = (i-1) / 2;
            dat[i] = min(dat[i * 2 + 1],dat[i * 2 + 2]);
        }
    }
    //使う時は変数名.query(a,b,k,l,変数名getSize())
    //区間の左端(b)に注意+1しよう
    int query(int a,int b,int k,int l,int r){
      //  cout<<k<<endl;
        if(r <= a || b<= l)return 1e9;
        if(a <= l && r <= b)return dat[k];
        else{
            int vl = query(a,b,k * 2 + 1,l,(l+r)/2);
            int vr = query(a,b,k * 2 + 2,(l+r)/2,r);
            return min(vl,vr);
        }
    }
    int getSize(){
        return n;
    }
    void show(){
        for(int a = 0;a < n;a++){
            cout<<dat[a]<<" ";
        }
        cout<<endl;
        return;
    }
private:
    int n;
    std::vector<int> dat;
};

int main(){
    int N,M;cin >> N >> M;
    string s;cin >> s;
    reverse(s.begin(), s.end());
    SegTreeRMQ Seg(N+1);
    for(int i = 0;i < N+1;i++){
        if(s[i] == '0')Seg.update(i, -i);
    }
    vector<int> ans;
    /*
    for(int i = 0;i < N+1;i++){
        cout<<Seg.query(i, i+1,0,0,Seg.getSize())<<endl;
    }
    */
    
    //cout<<s<<endl;
    for(int i = 0;i < N;){
        int m = -Seg.query(i + 1, min(i + M, N+1) + 1,0, 0, Seg.getSize());
        if(m == -1e9){
            cout<<-1<<endl;
            return 0;
        }
        //cout<<i<<endl;
       // cout<<i<<" "<<m<<endl;
        ans.push_back(m - i);
        i = m;
    }
    reverse(ans.begin(), ans.end());
    for(auto a : ans)cout<<a<<" ";
    cout<<endl;
}


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

using namespace std;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  
  int N;
  cin >> N;
  
  vector<int> A(N);
  
  for(auto& e : A)
  {
    cin >> e;
  }
  
  vector<vector<int64_t> > dp(N, vector<int64_t>(N, 0));
  
  for(int i = 0; i < N; ++i)
  {
    dp[i][i] = A[i];
  }
  
  for(int dist = 2; dist <= N; ++dist)
  {
    for(int L = 0, R = dist - L - 1; R < N; ++L, ++R)
    {
      dp[L][R] = max(A[L] - dp[L + 1][R], A[R] - dp[L][R - 1]);
    }
  }
  
  int64_t res = dp[0][N - 1];
  
  cout << res << "\n";
  
  return 0;
}

Measured memory_bytes: 70784
def main():
  N, M = map(int, input().split())
  arr = []
  for i in range(N):
    cost, num = map(int, input().split())
    arr.append((cost, num))
  arr.sort(key=lambda x: x[0])

  cost = 0
  num = 0
  for i in range(N):
    n = arr[i][1]
    cost += arr[i][0] * min(n, M - num)
    num += n
    if num >= M:
      print(cost)
      return


if __name__ == "__main__":
  main()


Measured memory_bytes: 18068
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;
  cin >> n;
  ll t[n];
  ll a[n];
  rep(i,n) cin >> t[i] >> a[i];
  ll tr[n];
  ll ar[n];
  tr[0]=t[0];ar[0]=a[0];
  rep1(i,n-1){
    ll fac=ceil(((long double) tr[i-1])/((long double) t[i]));
    //    cout << fac << endl;
    fac=max(fac,((ll) ceil(((long double) ar[i-1])/((long double) a[i]))));
    tr[i]=t[i]*fac;
    ar[i]=a[i]*fac;
    //    cout << fac << endl;
  }
  cout << tr[n-1]+ar[n-1] << endl;
  
  return 0;
    

}


Measured memory_bytes: 508
import java.util.*;

public class Main{
		public static void main(String[] args){
       		Scanner ti = new Scanner(System.in);
            int d = ti.nextInt();
            int t = ti.nextInt();
            int s = ti.nextInt();
          	float c;
           	c = (float)d/(float)s;
            if(c <= t)
     			System.out.println("Yes");
            else
            	System.out.println("No");
       }	
}

Measured memory_bytes: 35456
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define endl "\n"
#define fi first
#define se second
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define debug(a) cout << #a << " = " << a << " ";
template<typename T> istream &operator>>(istream &is, vector<T> &vec)
                                        { for (auto &v : vec) is >> v; return is; }

const int  MOD=1000000007;
const int N=100005;


void solve(){
	long n;
	cin>>n;
	ll Minn1=LLONG_MAX,Maxx1=-LLONG_MAX;
	ll Minn2=LLONG_MAX,Maxx2=-LLONG_MAX;
	for(long i=0;i<n;i++){
		ll x,y;
		cin>>x>>y;
		Minn1=min(Minn1,x+y);
		Maxx1=max(Maxx1,x+y);
		Minn2=min(Minn2,x-y);
		Maxx2=max(Maxx2,x-y);
	}
	cout<<max( abs(Maxx1 - Minn1) , abs(Maxx2 - Minn2 ) )<<endl;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long int t = 1;
    // cin>>t;
    for (long int tt = 1; tt <= t; tt++) {
        solve();
    }
    return 0;
}

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

// Optimization

//#pragma GCC optimize("O3")
#define endl '\n'

// Shortcut

#define int long long
#define eb emplace_back
#define pb push_back
#define pob pop_back
#define mp make_pair
#define upb upper_bound
#define lwb lower_bound
#define fi first
#define se second
#define For(i, l, r) for (int i = l; i < r; i++)
#define ForE(i, l, r) for (int i = l; i <= r; i++)
#define Ford(i, r, l) for (int i = r; i > l; i--)
#define FordE(i, r, l) for (int i = r; i >= l; i--)
#define Fora(i, a) for (auto i : a)

// I/O & Debug

#define PrintV(a) Fora(iiii, a) cout << iiii << ' '; cout << endl;
#define PrintVl(a) Fora(iiii, a) cout << iiii << endl;
#define PrintA(a, l, r) for (int iiii = l; iiii <= r; iiii++) cout << a[iiii] << ' '; cout << endl;
#define PrintAl(a, l, r) for (int iiii = l; iiii <= r; iiii++) cout << a[iiii] << endl;
#define Ptest(x) return cout << x, 0;
#define gl(s) getline(cin, s);
#define setpre(x) fixed << setprecision(x)
/*
#define debug(args...){ string _sDEB = #args; replace(_sDEB.begin(), _sDEB.end(), ',', ' '); stringstream _ssDEB(_sDEB); istream_iterator<string> _itDEB(_ssDEB); DEB(_itDEB, args); }
void DEB(istream_iterator<string> it) {}
template<typename T, typename... Args>
void DEB(istream_iterator<string> it, T a, Args... args){
    cout << *it << " = " << a << endl;
    DEB(++it, args...);
}
*/

// Functions

//#define isvowel(a) (a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u')
#define bend(a) a.begin(), a.end()
#define rbend(a) a.rbegin(), a.rend()
#define mset(a) memset(a, 0, sizeof(a))
#define mset1(a) memset(a, 1, sizeof(a))
#define msetn1(a) memset(a, -1, sizeof(a))
#define msetinf(a) memset(a, 0x3f, sizeof(a))
#define gcd __gcd
#define __builtin_popcount __builtin_popcountll
//mt19937 rando(chrono::steady_clock::now().time_since_epoch().count());

// Data Structure

#define pque priority_queue
#define mts multiset
#define y0 _y0_
#define y1 _y1_
#define div divi
typedef long long ll;
typedef long double ld;
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <ld> vld;
typedef vector <string> vs;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector <vi > vvi;
typedef vector <vll > vvll;
typedef vector <pii > vpii;
typedef vector <pll > vpll;

const int N = 1e5 + 5, mod = 1e9 + 7, mod1 = 998244353, mod2 = 1e9 + 9, inf = 1e18 + 7;
const ll infll = 1e18 + 7;



signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    string s; cin >> s; int n = s.length();
    if (n & 1) Ptest("No");
    For(i, 0, n / 2){
        if (s[2 * i] != 'h' || s[2 * i + 1] != 'i') Ptest("No");
    }
    cout << "Yes";
}

/*
==================================+
INPUT:                            |
------------------------------    |

------------------------------    |
==================================+
OUTPUT:                           |
------------------------------    |

------------------------------    |
==================================+
*/

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

class DisjointSet{
public:
    vector<int> rank ,p;
    DisjointSet(){}
    DisjointSet(int size){
        rank.resize(size,0);
        p.resize(size,0);
        for(int i=0;i<size;i++) makeSet(i);
    }

    void makeSet(int x){
        p[x]=x;
        rank[x]=0;
    }

    bool same(int x, int y){
        return findSet(x)==findSet(y);
    }

    void unite(int x,int y){
        link(findSet(x),findSet(y));
    }

    void link(int x,int y){
        if(rank[x]>rank[y]) p[y]=x;
        else p[x]=y;
        if(rank[x]==rank[y]) rank[y]++;
    }

    int findSet(int x){
        if(x!=p[x]) p[x]=findSet(p[x]);
        return p[x];
    }
};

int main()
{
    int n,a,b,q;
    int t;

    cin>>n>>q;
    DisjointSet ds=DisjointSet(n);
    for(int i=0;i<q;i++){
        cin>>t>>a>>b;
        if(t==0) ds.unite(a,b);
        else if(t==1){
            if(ds.same(a,b)) cout<< 1 <<endl;
            else cout<<0<<endl;
        }
    }
    return 0;
}






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

#define ll long long
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
// pll pp; -> (pp.first,pp.second)
// vector<vl> pp(n,vl(2)); sort(pp.begin(),pp.end(),[](vl a,vl b){return a[0]<b[0];});

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define RREP(i,n) for(ll (i)=(n)-1;(i)>=0;(i)--)
#define FOR(i,a,b) for(ll (i)=(a);(i)<(b);(i)++)
#define FORR(i,a,b) for(ll (i)=(b)-1;(i)>=(a);(i)--)
#define DEBUG(x) cout << #x << ": " << x << endl
#define CHMAX(a,b) a=max((a),(b))
#define CHMIN(a,b) a=min((a),(b))
/*}}}*/
int main() {
  ll n,k;
  cin >> n >> k;
  ll ans = 0;
  REP(i,n){
    ll h;
    cin >> h;
    if(h>=k) ans++;
  }
  cout << ans<< endl;
  return 0;
}


Measured memory_bytes: 256
def check(s,index):
    s1 = s[:index+1]
    s2 = s[index+1:]

    if s1 == s2:
        return True

    return False

def main():
    n = int(input())
    s = input()
    for i in range(len(s)):
        if check(s,i):
            print('Yes')
            return

    print('No')


main()


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

int main() {
  string s;
  cin>>s;
  int n=s.size();
  int ans=999;
  for(int i=0;i<n-2;i++){
    int x=(s[i]-'0')*100+(s[i+1]-'0')*10+s[i+2]-'0';
    x=abs(x-753);
    ans=min(ans,x);
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

A, B, C = lr()
if A + B - C >= 0:
    print('No'); exit()
else:
    flag = (-A - B + C) ** 2 > 4 * A * B
print('Yes' if flag else 'No')


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define FINISH {cout<<-1<<endl;return 0;}
const ll MOD = 1000000007;

vector<pair<int, int>> V = { {1,2} };

int main(){
	int n, tr = 1, ee = 3;
	string S;
	cin >> S;
	n = S.size();
	//前提チェック
	for (int i = 0;i < n - 1;i++) {
		if (S[i] != S[n - i - 2])FINISH;
	}
	if (S[0] == '0')FINISH;
	if (S[n - 1] == '1')FINISH;

	for (int i = 1;i < n - 1;i++) {
		if (S[i] == '1') {
			V.push_back(make_pair(tr, ee));
			swap(tr, ee);
			ee = tr + 1;
		}
		if (S[i] == '0') {
			V.push_back(make_pair(tr, ee));
			ee++;
		}
	}
	for (auto i : V) {
		cout << i.first << " " << i.second << endl;
	}
}

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

using namespace std;

int main(){
        int x, y;
        cin>>x>>y;
        if(x==2&&y==2){
                cout<<"Yes"<<endl;
        }
        else if((x==1||x==3||x==5||x==7||x==8||x==10||x==12)&&(y==1||y==3||y==5||y==7||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{
                cout<<"No"<<endl;
        }
        return 0;
}


Measured memory_bytes: 256
//Created by Kira

#include<bits/stdc++.h>
using namespace std;

#define IOS cin.sync_with_stdio(0);cin.tie(0); cout.tie(0);
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define pii pair<int,int> 
#define pb push_back
#define vi vector<int> 
using ll = long long;

const int mod = 1e9 + 7;

ll pwr(ll a, ll b);
    

const int N = 1e6 + 5;

int mul(int a, int b){
    return ((ll)a * b)  % mod;
}

int f[N];

int inverse(int x){
    return pwr(x, mod - 2) % mod;
}

int nCk(int n, int k){
    if(k > n)return 0;
    return mul(f[n] % mod, mul(inverse(f[n-k]), inverse(f[k])) % mod);
}

int main(){
   IOS

    int x, y;
   cin>>x>>y;

    f[0] = f[1] = 1;
    for(int i = 2; i < N - 2; i++){
        f[i] = mul(f[i - 1], i);
    }

   if((x + y) % 3 != 0){
       cout<<0<<"\n";
       return 0;
   }

   int num = (x + y)/3 + 1;

   int s = 2 * ((x + y)/3);

   if(x > s){
       cout<<"0\n";
       return 0;
   }

   int d = s - x;
   cout<<nCk(num-1, d)<<"\n";

}

ll pwr(ll a, ll b){
   a %= mod;	//Remove mod if not required
   ll res = 1;
   while(b > 0){
    if(b&1) res = res * a % mod;
        a = a * a % mod;
    b >>= 1;
    }

    return res;
}



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

int main() {
  vector<int> V(3);
  for (int i = 0; i < 3; i++) cin >> V.at(i);
  sort(V.rbegin(), V.rend());
  if (V.at(0) == V.at(1) && V.at(1) == V.at(2)) return cout << 0 << "\n", 0;
  int ans = 0;
  int tmp = V.at(0) - V.at(1);
  ans += tmp;
  V.at(2) += tmp;
  tmp = V.at(0) - V.at(2);
  if (tmp % 2 == 0) cout << ans + tmp / 2 << "\n";
  else cout << ans + tmp / 2 + 2 << "\n";
}

Measured memory_bytes: 3600
#include <iostream>

using namespace std;


int main()
{
	int n;
	int seven = 1;
	int five = 2;
	bool ans = false;
	for (int i = 0; i < 3; i++) {
		cin >> n;
		switch (n)
		{
		case 7:
			seven--;
			break;
		case 5:
			five--;
			break;
		default:
			goto end;
			break;
		}
	}
end:
	if (seven == 0 && five == 0) ans = true;
	
	if (ans) cout << "YES" << endl;
	else cout << "NO" << endl;


}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#define W 10000

int main(){
  
  int i,j,n,count=0,s[W],k;
  
  scanf("%d\n",&n);
  if(n > W)exit(8);
  for(i = 0; i < n; i++){
    scanf("%d",&s[i]);
  }
  
  for( i = 0; i <= n; i++) {

    k=1;

    if(s[i] == 2)k=1;
    
    else if(s[i] < 2 || s[i]%2 == 0) k=0;

    else{
    for(j = 3; j <= sqrt((double)s[i]); j += 2){
      
      if(s[i]%j == 0){
	k=0;
	break;
      }
      else k=1;

	}
    }
    if(k == 1)count++;
   
  }
  printf("%d\n",count); 
  
  return 0;
  
}

Measured memory_bytes: 628
//#include <fsociety>
#include <cmath>
#include <deque>
#include <algorithm>
#include <iterator>
#include <list>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <unordered_set>
#include <stack>
#include <string>
#include <vector>
#include <iostream>
//end of libraries ;
#define INF 9999999999
#define N 300003
#define F first
#define S second
#define pb push_back
#define ll long long
#define fcin ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
using namespace std;
ll n , a , b , mod = 1e9 + 7;
ll mypow(ll x , ll y){
	if(y==0) return 1;
	ll res = mypow(x,y/2) % mod;
	if(y%2==0){
		return (res%mod*res%mod)%mod;
	}
	else{
		return(res%mod*res%mod*x%mod)%mod;
	}
}
long long calc(ll n, ll k){
  	ll res = 1 , res1 = 1;;
  	for(int i = 1 ; i <= k ;i++){
  		res = res * (n-i+1) % mod;
  		res1 = res1*i%mod;
  	}
  	return res * mypow(res1,mod-2)%mod;
}

int main(){
	cin>>n>>a>>b;
	ll c = mypow(2,n) ;
	cout<<(c - calc(n,a) - calc(n,b) - 1 + 2*mod) % mod<<endl;
}

Measured memory_bytes: 256
while True:
	n,x = map(int,input().split())
	if n == x == 0:
		break
	cnt=0
	for a in range(1,x//3):
		for b in range(a+1,x//2):
			c=x-a-b
			if b<c<=n:
				cnt+=1
	print(cnt)

Measured memory_bytes: 7620
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
 
#define mod 1000000007
#define inf 1000000000
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define popcount(x) __builtin_popcountll(x)
 
const long double PI = acos(-1);
 
ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a / gcd(a,b) * b;}

int main(){
  ll A, B, M;
  cin >> A >> B >> M;
  vector<ll> a(A, 0), b(B, 0);
  ll amin = 100000, bmin = 100000;
  for(ll i = 0; i < A; i++){
    cin >> a[i];
    amin = min(amin, a[i]);
  }
  for(ll i = 0; i < B; i++){
    cin >> b[i];
    bmin = min(bmin, b[i]);
  }

  ll ans = amin + bmin;
  for(ll i = 0; i < M; i++){
    ll x, y, c;
    cin >> x >> y >> c;
    ans = min(ans, a[x-1] + b[y-1] - c);
  }

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

Measured memory_bytes: 1792
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

x, y = readline().decode().split()
x = int(x.lower(), 16)
y = int(y.lower(), 16)
if x < y:
    print('<')
elif x == y:
    print('=')
else:
    print('>')

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

int main() {
  int a;
  vector<int> N(10, 0);
  for(int i=0;i<4;i++){ cin>>a;N.at(a)++; }
  if(N[1]&&N[9]&&N[7]&&N[4])cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main(){
    string S;
    cin >> S;
    int N = (int)S.size();
    vector<vector<long long>> dp1(N, vector<long long>(2)), dp2(N, vector<long long>(2));//dp1が一致、dp2がそれ未満
    const int MOD = 1e9 + 7;
    dp1[0][1] = 2;
    dp2[0][0] = 1;
    for(int i = 1; i < N; i++){
        if(S[i] == '1'){
            dp1[i][1] += dp1[i - 1][1] * 2 + dp1[i - 1][0] * 2;
            dp2[i][1] += dp2[i - 1][0] * 2 + dp2[i - 1][1] * 2;
            dp2[i][0] += dp1[i - 1][0] + dp1[i - 1][1] + dp2[i - 1][0] + dp2[i - 1][1];
        }
        else{
            dp1[i][0] += dp1[i - 1][1] + dp1[i - 1][0];
            dp2[i][1] += dp2[i - 1][0] * 2 + dp2[i - 1][1] * 2;
            dp2[i][0] += dp2[i - 1][0] + dp2[i - 1][1];
        }
        for(int j = 0; j < 2; j++){
            dp1[i][j] %= MOD;
            dp2[i][j] %= MOD;
        }
    }
    long long ans = 0;
    for(int i = 0; i < 2; i++){
        ans += dp1[N - 1][i] + dp2[N - 1][i];
    }
    cout << ans % MOD << endl;
}

Measured memory_bytes: 14336
#include <bits/stdc++.h>
using namespace std;
typedef long long unsigned int lld;
typedef vector<lld> vi;
typedef pair<lld,lld> pi;
#define F first
#define S second
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define rep(i,a,b) for (lld i = a; i < b; i++)
static lld a,b,c,d,r,j,l,x,y,n,s,q,m,i,z,p,k,t;string s1,s2,s3,s4;
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin>>n;
  p=n;
  q=0;
  //s1=atol(p)
  while(p>0)
  {
    p=p/10;
    q++;
  }l=n;
  while(l>0)
  {
    s3+=(l%10+48);
    l=l/10;
  }q--;
  i=9;
  reverse(s3.begin(), s3.end());
  while(1)
  { 
    string s1;
    rep(i,0,q)
    s1+='9';
    s1+=(char)(i+48);
    sort(s1.begin(), s1.end());
    //p=stol(s1);
    if(s1<=s3)
    {
      cout<<(q*9)+i;

      break;
    }
    else
      i--;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

const int mx=200010;
const ll mod=1e9+7;


int main() {
  ll n,m;
  cin >> n >> m;
  if(n>m/2){ cout << m/2 << endl; return 0; }
  m -= n*2;
  cout << n+(m/4) << endl;
  return 0;
}  


Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <functional>
#include <iostream>
#include <iomanip>
#include <iterator>
#include <map>
#include <queue>
#include <utility>
#include <vector>

using namespace std;

typedef long long Long;
#define whole(xs) xs.begin(), xs.end()

int N;
#define MN 101
vector<double> X, Y, R;
bool input() {
    cin >> N;
    if (N == 0) return false;
    X.resize(N); Y.resize(N); R.resize(N);
    for (int i = 0; i < N; i++) {
        cin >> X[i] >> Y[i] >> R[i];
    }
    return true;
}

template<typename A, typename B>
ostream& operator<<(ostream& os, map<A, B> m) {
    for (typename map<A, B>::iterator it = m.begin(); it != m.end(); it++) {
        os << "(" << it->first << ", " << it->second << "), ";
    }
    return os;
}

map<double, int> Compress(vector<double>& vs) {
    sort(whole(vs));
    vs.erase(unique(whole(vs)), vs.end());
    map<double, int> Ret;
    for (int i = 0; i < vs.size(); i++) {
        Ret[ vs[i] ] = i + 1;
    }
    return Ret;
}

void solve() {
    static int T = 1;
    vector<double> dX, dY;
    for (int i = 0; i < N; i++) {
        dX.push_back(X[i] - R[i]);
        dX.push_back(X[i] + R[i]);
        dY.push_back(Y[i] - R[i]);
        dY.push_back(Y[i] + R[i]);
    }
    map<double, int> mX = Compress(dX),
                     mY = Compress(dY);
    //cout << "mX: " << mX << endl;
    int nX = dX.size() + 1, nY = dY.size() + 1;
    bool F[nY][nX]; memset(F, 0, sizeof(F));
    for (int i = 0; i < N; i++) {
        int sx = mX[ X[i] - R[i] ],
            sy = mY[ Y[i] - R[i] ],
            gx = mX[ X[i] + R[i] ],
            gy = mY[ Y[i] + R[i] ];
        //cout << sx << " " << gx << " " << sy << " " << gy << endl;
        for (int y = sy; y < gy; y++) {
            for (int x = sx; x < gx; x++) {
                F[y][x] = true;
            }
        }
    }
    /*
    for (int i = 0; i < nY; i++) {
        for (int j = 0; j < nX; j++) {
            cout << setw(2) << F[i][j];
        }
        cout << endl;
    }
    */
    double Area = 0;
    for (int y = 0; y < nY - 1; y++) {
        for (int x = 0; x < nX - 1; x++) {
            if (F[y][x]) {
                Area += (dY[y] - dY[y - 1]) * (dX[x] - dX[x - 1]);
            }
        }
    }
    printf("%d %.2f\n", T, Area);
    T++;
}

int main() {
    while (input()) solve();
    return 0;
}

Measured memory_bytes: 1296
#include <bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
#define eps 1e-9

typedef long long ll;

using namespace std;

const ll inf = 1e18;
const ll mod = 1e9+7;
const int N = 1e5+5;

int main()

{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

    int x, y, z;

    cin >> x >> y >> z;

    cout << x/(y+z)-(x%(y+z) < z);

    return 0;
}


Measured memory_bytes: 256
/*
 *
 ********************************************************************************************
 * AUTHOR : Vijju123                                                                        *
 * Language: C++14                                                                          *
 * Purpose: -                                                                               *
 * IDE used: Codechef IDE.                                                                  *
 ********************************************************************************************
 *
 Comments will be included in practice problems if it helps ^^
 */



#include <iostream>
#include<bits/stdc++.h>
using namespace std;

int mod=pow(10,9)+7;
int fastExpo(long long a,long long n, int mod)
{
    a%=mod;
    if(n==2)return a*a%mod;
    if(n==1)return a;
    if(n&1)return a*fastExpo(fastExpo(a,n>>1,mod),2,mod)%mod;
    else return fastExpo(fastExpo(a,n>>1,mod),2,mod);
}
inline void add(vector<vector<int> > &a,vector<vector<int> > &b,int mod)
{
    for(int i=0;i<a.size();i++)for(int j=0;j<a[0].size();j++)b[i][j]=(b[i][j]+a[i][j])%mod;
}

void multiply(vector<vector<int> > &a, vector<vector<int> > &b,int mod,vector<vector<int> > &temp)
{
    assert(a[0].size()==b.size());
    int i,j;
    for(i=0;i<a.size();i++)
    {
        for(j=0;j<b[0].size();j++)
        {
            temp[i][j]=0;
            for(int p=0;p<a[0].size();p++)
            {
                temp[i][j]=(temp[i][j]+1LL*a[i][p]*b[p][j])%mod;
            }
        }
    }
}

void MatExpo(vector<vector<int> > &arr,int power,int mod)
{
    int i,j,k;
    vector<vector<int> >temp,temp2,temp3;
    vector<int> init(arr[0].size());
    for(i=0;i<arr.size();i++){temp.push_back(init);}
    temp3=temp;
    temp2=temp;
    for(i=0;i<arr.size();i++)temp3[i][i]=1;
    while(power>0)
    {
        if(power&1)
        {
            multiply(arr,temp3,mod,temp);
            swap(temp3,temp);
        }
        multiply(arr,arr,mod,temp2);
        swap(arr,temp2);
        power>>=1;
    }
    swap(arr,temp3);
}

vector<int> primes;
int isComposite[1000001]={1,1};
void sieve()
{
    int i,j;
    for(i=2;i<=1000000;i++)
    {
        if(!isComposite[i])
        {
            primes.push_back(i);
            isComposite[i]=i;
        }
        for(j=0;j<primes.size() and i*primes[j]<=1000000;j++)
        {
            isComposite[primes[j]*i]=i;
            if(i%primes[j]==0)break;
        }
    }
}

int main() {
	// your code goes here
	#ifdef JUDGE
    freopen("input.txt", "rt", stdin);
    freopen("output.txt", "wt", stdout);
    #endif
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
	srand(time(NULL));
	mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	int n,i,j,k;
	cin>>n>>k;
	int dp[n],arr[n];
	memset(dp,0,sizeof(dp));
	for(i=0;i<n;i++)cin>>arr[i];
	dp[0]=0;
	dp[1]=abs(arr[1]-arr[0]);
	for(i=2;i<n;i++)
	{
	    dp[i]=INT_MAX;
	    for(j=i-1;j>=max(0,i-k);--j)
	    {
	        dp[i]=min(dp[i],dp[j]+abs(arr[i]-arr[j]));
	    }
	}
	cout<<dp[n-1]<<endl;
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
using namespace std;
typedef long long ll;
int N,A[310];
ll dp[310][90010] = {},dp2[310][90010];
ll inf = 998244353;

int main(){
    cin >> N;
    int sum = 0;
    for(int i=1;i<=N;i++){
        cin >> A[i];
        sum += A[i];
    }
    dp[0][0] = 1;
    for(int i=1;i<=N;i++){
        for(int j=0;j<=sum;j++){
            if(j-A[i]>=0) (dp[i][j] += dp[i-1][j-A[i]])%=inf;
            (dp[i][j] += 2*dp[i-1][j])%=inf;
        }
    }
    dp2[0][0] = 1;
    for(int i=1;i<=N;i++){
        for(int j=0;j<=sum;j++){
            if(j-A[i]>=0) (dp2[i][j] += dp2[i-1][j-A[i]])%=inf;
            (dp2[i][j] += dp2[i-1][j])%=inf;
        }
    }
    ll ans = 1;
    ll sub = 0;
    for(int i=1;i<=N;i++) (ans *= 3)%=inf;
    for(int j=(sum+1)/2;j<=sum;j++){
        (sub += dp[N][j])%=inf;
    }
    if(sum%2==0) (sub += -dp2[N][sum/2]+inf)%=inf;
    cout << (ans-3*sub+3*inf)%inf << endl;
}

Measured memory_bytes: 425472
#include <bits/stdc++.h> 
using namespace std; 
#define ll long long


vector<int> graph[100001];
int dp[100001];


int solve(int src){
       
  if(dp[src]!=-1)
      return dp[src];

  bool leaf=1;
  int bestChild=0;
  for(int child :graph[src]){
    leaf=0;
    bestChild= max(bestChild,solve(child));
  }
  return dp[src]= leaf ? 0 : 1+bestChild;
}

int main(){

    int n,m;
    cin>>n>>m;
    memset(dp,-1,sizeof dp);


    for(int i=0;i<m;i++){
        int u,v;
        cin>>u>>v;
        graph[u].push_back(v);
    }


    int ans=0;
    for(int i=1;i<=n;i++){
        ans=max(ans,solve(i));
    }
    cout<<ans;
}



Measured memory_bytes: 11292
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <vector>
#include <assert.h>
#include <map>
#include <set>
#include <stdlib.h>
#include <math.h>
#include <string>
#include <time.h>
#include <string.h>
#include <queue>
#include <complex>
#include <stack>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef complex<double> base;
ll mod=1e9+7;
double eps=1e-9;
ll exp(ll x,ll y){if(y<0) return 0; ll ret=1;for(;y;y>>=1,x=(x*x)%mod){if(y&1)ret=(ret*x)%mod;}return ret;}
ll pexp(ll x, ll y){if(y<0) return 0; ll ret=1; for(;y;y>>=1,x=(x*x)){if(y&1)ret=(ret*x);}return ret;}
ll gcd(ll x,ll y){if(!x||!y) return x+y; return x%y==0?y:gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll bsum(ll u,ll b){ll ret=0;if(u<b)return u;while(u){ret+=u%b;u/=b;}return ret;}
ll prival(ll u,ll p){ll cn=0;while(u%p==0){cn++;u=u/p;}return cn;}
ll minv(ll a,ll b){return 1<a?b-minv(b%a,a)*b/a:1;}
ll extm(ll a,ll b){ll ret=0;while(a!=0){if(a%2==1){ret+=b;ret%=mod;}a>>=1;b=(2*b)%mod;}return ret;}   
ll eaphi(ll x){ll t=x,ret=x,i;for(i=2;i*i<=x;i++){if(t%i==0){ret-=ret/i;while(t%i==0) t/=i;}}if(t!=1) ret-=ret/t;return ret;}
ll eadivc(ll x){ll ret=0;ll i;for(i=1;i*i<=x;i++){if(x%i==0 && i*i!=x) ret+=2;if(x%i==0 && i*i==x) ret+=1;}return ret;}
bool isprime(ll x){if(x<=1) return false; for(ll i=2;i*i<=x;i++){if(x%i==0){return false;}}return true;}
int n; 
ll ans, cc;
ll val[222222];
map<ll, ll> stf;
map<ll, ll>::iterator it;

int main(void)
{
	cin>>n; int i; ll x;
	stf[0]++; cc=0;
	for(i=1 ; i<=n ; i++)
	{
		scanf("%lld",&x);
		cc+=x; stf[cc]++;
	}
	for(it=stf.begin() ; it!=stf.end() ; it++)
	{
		x=it->second;
	//	cout<<it->first<<" "<<it->second<<endl;
		ans+=x*(x-1)/2;
	}
	cout<<ans; return 0;
}

Measured memory_bytes: 12800
#include <stdio.h>

int main(void){
 int a,b,coin = 0,i;
  
  scanf("%d",&a);
  scanf("%d",&b);
  
  for(i = 0;i < 2;i++){
  if(a > b){
   coin = coin + a;
    a--;
  }else{
   if(a <= b){
   coin = coin + b;
     b--;
   }
  }
  }
  
  printf("%d\n",coin);
  
  return 0;
}

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

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

    string s, t; cin >> s >> t;
    int len = (int) s.size();
    int types_s[len], types_t[len];
    map<char, int> chartype_s, chartype_t;

    int type_num_s = 0, type_num_t = 0;
    for (int i = 0; i < len; ++i) {
        char char_s = s[i], char_t = t[i];
        if (chartype_s.count(char_s) == 0) {
            chartype_s[char_s] = ++type_num_s;
        }
        types_s[i] = chartype_s[char_s];

        if (chartype_t.count(char_t) == 0) {
            chartype_t[char_t] = ++type_num_t;
        }
        types_t[i] = chartype_t[char_t];
    }

    for (int i = 0; i < len; ++i) {
        if (types_s[i] != types_t[i]) {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;

    return 0;
}

Measured memory_bytes: 2452
#include <iostream>
using namespace std;
int main(){
	int n,m,A[100][100],b[100],c[100];
	cin>>n>>m;
	for(int i=0;i<n;i++)
		for(int j=0;j<m;j++)cin>>A[i][j];
	for(int i=0;i<m;i++)cin>>b[i];
	
	for(int i=0;i<n;i++){
		c[i]=0;
		for(int j=0;j<m;j++){
			c[i]+=A[i][j]*b[j];
		}
	}
	for(int i=0;i<n;i++)cout<<c[i]<<endl;
	
	return 0;
}


Measured memory_bytes: 3120
#include<iostream>
using namespace std;
int main()
{
		int a,b,k,temp=0;
		cin>>k>>a>>b;
		while (temp<a)
		{
			temp=temp+k;
		}

		if(temp>=a && temp<=b)
		cout<<"OK";
		else 
		cout<<"NG";
}



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

typedef long long int ll;
//Factors of an num
/*
vector<ll> fact(ll n){
	vector<ll>v;
	for(int i=1;i*i<=n;i++){
		if(n%i ==0){
			v.push_back(i);
		
		if(i!=n/i)
			v.push_back(n/i);
	    }
	}

	return v;
}
*/


/*
Seive Of Eratos..
int N=1e5;
vector<bool> isprime(N+1,true);
void pri(int n){
	for(int i=2;i*i<=n;i++){
		if(isprime[i]){
			for(int j=i*i;j<=n;j+=i){
				isprime[j]=false;
			}
		}
	}
	return;
}
*/

/*
//Prime Factors
vector<bool> isprime(1e6+1,true);
 vector<int> primes;
 void sieve()
 {

    ll  i,j;
    isprime[0] = false;
    isprime[1] = false;

    for(i=2; i<=1e6 ;i++)
  {

    if(isprime[i])
    {

      primes.push_back(i);

      for(j=i*i; j<=1e6; j+=i)
      {
        isprime[j]=false;
      }

    }

  }
}

vector<int> primefactors(int  N)

 {

    vector<int> factors;
    ll pf_idx = 0, pf=primes[pf_idx];

    while(pf*pf<=N)
    {
        while(N % pf == 0)
        {
            N/=pf;
            factors.push_back(pf);
        }
        pf = primes[++pf_idx];
    }
    
    if(N != 1) factors.push_back(N);
    return factors;
}
 */   




int main(){
	 
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string str;
    int cnt=0;
    cin>>str;
    bool p= str[0]=='R';
      bool q= str[1]=='R';
     bool r= str[2]=='R';

if(p && q && r){
	cout<< "3" <<endl;

}
else if((p && q) || (q &&r))
cout<<"2"<<endl;
else if(p || q || r){
	cout<<"1"<<endl;
}
else 
cout<<"0"<<endl;
}




Measured memory_bytes: 3636
using System;

namespace PrintCheckboard
{
	class MainClass
	{
		public static void Main (string[] args)
		{
			while (true) {
				string[] tmp = Console.ReadLine ().Split (" ".ToCharArray ());
				int height, Wide;

				height = int.Parse (tmp [0]);
				Wide = int.Parse (tmp [1]);
				if (height == 0 && Wide == 0)
					break;

				for (int i = 0; i < height; i++) {
					for (int j = 0; j < Wide; j++) {
						Console.Write (((i+j)%2 == 0)? "#":".");
					}
					Console.Write ("\n");
				}
				Console.Write ("\n");
			}
		}
	}
}

Measured memory_bytes: 5272
using System;

namespace Sumple1
{
    class MainClass
    {
        static void Main()
        {
            Scanner cin = new Scanner();

            int n = cin.NextInt();
            long sum = 0;

             static int Gcd(int a, int b)
            {
                if (a < b)
                {
                    return Gcd(b, a);
                }
                while (b != 0)
                {
                    int re = a % b;
                    a = b;
                    b = re;
                }
                return a;
            }
            for (int i = 1; i <= n; i++)
            {
                for (int j = 1; j <= n; j++)
                {
                    for(int k = 1; k <= n; k++)
                    {

                        sum += Gcd(Gcd(i, j), k);
                    }
                }
            }
            Console.WriteLine(sum);
        }
    }

    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string Next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return Next();
            i = 0;
            return s[i++];
        }

        public int NextInt()
        {
            return int.Parse(Next());
        }
        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = NextInt() + add;
            }
            return Array;
        }

        public long NextLong()
        {
            return long.Parse(Next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = NextLong() + add;
            }
            return Array;
        }

        public double NextDouble()
        {
            return double.Parse(Next());
        }


        public double[] ArrayDouble(int N, double add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = NextDouble() + add;
            }
            return Array;
        }
    }
}

Measured memory_bytes: 27544
ma = lambda :map(int,input().split())
ni = lambda:int(input())
import collections
import math
import itertools
gcd = math.gcd
n = ni()
x = input()
xr = x[::-1]
px = x.count("1")
def solve(t):
    ret = 1 #最初の一回
    while t>0:
        p = bin(t).count("1")
        t %=p
        ret +=1
    return ret
x_tp = 0
x_tm = 0

for i in range(n):
    x_tp = (x_tp + int(xr[i])*pow(2,i,px+1) ) %(px+1) ## 0->1
if px>1:
    for i in range(n):
        x_tm = (x_tm + int(xr[i])*pow(2,i,px-1) ) %(px-1) # 1->0
ans = []

for i in range(n):
    if xr[i] =="0":
        x_tmp = (x_tp + pow(2,i,px+1) ) %(px+1)
    else:#1->0
        if px==1:
            ans.append(0)
            continue
        x_tmp = (x_tm - pow(2,i,px-1)) %(px-1)
    t = solve(x_tmp)
    ans.append(t)
for i in range(n-1,-1,-1):
    print(ans[i])


Measured memory_bytes: 11868
#include <bits/stdc++.h>
#include <unordered_map>
typedef long long ll;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " \n"[i == n-1];}
#define printp(x,n) for(ll i = 0; i < n; i++){ cout << "(" << x[i].first << ", " << x[i].second << ") "; } cout << endl;
#define INF (1e18)
using namespace std;
const ll MOD = 1e9 + 7;
typedef pair<ll, ll> lpair;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll x,a,b;
    cin >> x >> a >> b;
    if(b - a <= 0){
        print("delicious")

    }else if(b - a <= x){
        print("safe");
    }else{
        print("dangerous");
    }
}


Measured memory_bytes: 256
require 'pp'

a, b, c, d = gets.split.map(&:to_i)

if a >= 0 && b >= 0
    if d >= 0
        puts b * d
    else
        puts a * d
    end
elsif a < 0 && b < 0
    if c < 0
        puts a * c
    else
        puts b * c
    end
else
    puts [b * d, a * c].max
end


Measured memory_bytes: 14524
#include <stdio.h>
 
int main(){
  int N,n,i; 
  long A[200];
  
  scanf("%d",&N);
  
  for(n = 0;n < N;n++){
    scanf("%d",&A[n]);
  }
 
  i = 0;
  while(1){
    for(n = 0;n < N;n++){
      if((A[n] % 2) == 0){
        A[n] /= 2;
      }else{
        printf("%d",i);
        return 0;
      }
  	}
    i++;
  }
  
}

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

int main() {
    int a[5];
    for(int i=0; i<5; i++){
        cin>>a[i];
    }
    int k;
    cin>>k;

    for(int i=0; i<5; i++){
        for(int j=0; j<5; j++){
            if(abs(a[i]-a[j]) > k){
                cout << ":(" << endl;
                return 0;
            }
        }
    }

    cout << "Yay!" << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>

int f(int i, int y) {
  return i*(100+y)/100;
}

int testcase_ends() {
  int x, y, s;
  scanf("%d %d %d", &x, &y, &s);
  if (x == 0 && y == 0 && s == 0) return 1;

  int res = 0;
  for (int i = 1; i < s; ++i) {
    for (int j = 1; j < s; ++j) {
      if (f(i, x) + f(j, x) == s) {
        res = std::max(res, f(i, y) + f(j, y));
      }
    }
  }
  printf("%d\n", res);
  return 0;
}

int main() {
  while (!testcase_ends()) {}
}



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

using namespace std;
typedef long long ll;
typedef long int li;
typedef long double lb;
#define rep(i,j,n) for (ll i = j; i < (n); i++)
#define repr(i,j,n) for(ll i = j; i >= (n); i--)
#define all(x) (x).begin(),(x).end()
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const ll INF = 1LL<<60;
const ll m=1LL<<32;

int main(){

  ll N,W;cin>>N>>W;
  ll v[N],w[N];rep(i,0,N)cin>>v[i]>>w[i];
  const int MAX_N=101,MAX_W=10001,inf=-1;

  ll dp[MAX_N][MAX_W];
  CLR(dp,inf);

  rep(j,0,W+1)dp[0][j]=0;

  rep(i,0,N){
    rep(j,0,W+1){
      if(j-w[i]>=0&&j-w[i]<=W){
        chmax(dp[i+1][j],max(dp[i+1][j-w[i]]+v[i],dp[i][j]));
      }
      else chmax(dp[i+1][j],dp[i][j]);
    }
  }

  out(dp[N][W]);

  return 0;
}



Measured memory_bytes: 11024