akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<functional>
#include<map>
#include<cstdlib>
#include<complex>
#include<numeric>
#include<set>
#include<deque>
#include<queue>

using namespace std;
using Int = long long;
Int INF = 1LL << 60;
const Int MOD = 1000000000 + 7;

vector<vector<Int>> G;
vector<vector<Int>> isok;//isok[i][j]: 頂点iに3で割った余りがjになるような行き方の最短距離

void dfs(Int e) {

	for (Int i = 0; i < 3; i++) {
		if (isok[e][i]!=INF) {
			for (const auto& next_e : G[e]) {
				if (isok[next_e][(i+1)%3]<= isok[e][i] + 1) {
				//if (isok[next_e][(i+1)%3]!=INF){
				continue;
				}
				else {
					isok[next_e][(i + 1) % 3] = isok[e][i] + 1;
					dfs(next_e);
				}
			}
		}
		else {
			continue;
		}
	}
}

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

	Int N, M;
	cin >> N >> M;

	G.resize(N);
	Int u, v;
	for (Int i = 0; i < M; i++) {
		cin >> u >> v;
		u--;
		v--;
		G[u].push_back(v);
	}

	isok.resize(N);
	for (Int i = 0; i < N; i++) {
		isok[i].resize(3, INF);
	}

	Int S, T;

	cin >> S >> T;
	S--;
	T--;

	isok[S][0] = 0;

	dfs(S);

	if (isok[T][0]==INF) {
		cout << -1 << "\n";
	}
	else {
		cout << isok[T][0]/3 << "\n";
	}
}


Measured memory_bytes: 101120
A = int(input())
B = int(input())
C = int(input())
X = int(input())

cnt = 0
for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            tmp = i*500 + j*100 + k*50
            if tmp == X:
                cnt += 1
print(cnt)

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

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

signed main() {
    string s;
    cin >> s;
    bool c = false, f = false;
    for(int i = 0; i < s.size(); ++i) {
        if(!c && s[i] == 'C') c = true;
        if(c && s[i] == 'F') {
            f = true;
            break;
        }
    }
    if(f) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 384
#include<stdio.h>
int main(void){
  char *s="python3 -c\""
"I=input;n=int(I());f=[int(I()[::2],2)for _ in[0]*n];p=[I().split()for _ in[0]*n];print(max(sum(int(q[bin(i&g).count('1')])for g,q in zip(f,p))for i in range(1,1024)))\n"
"\"";
  system(s);
  return 0;
}            

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

using ll = long long;

#define pb push_back
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
#define sz(a) (int)(a.size())
#define clr(a, b) memset(a, b, sizeof(a))
#define REP(i, a, b) for(int i=(int)(a); i<(int)(b); ++i)
#define REPD(i, a, b) for(int i=(int)(a)-1; i>=(int)(b); --i)

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s, t;
    cin >> s >> t;
    int res = 1e9;
    REP(i, 0, sz(s)) {
    	if(i+sz(t) > sz(s)) break;
    	string p = s.substr(i, sz(t));
    	int l = 0;
    	REP(j, 0, sz(p)) {
    		if(p[j] != t[j]) ++l;
    	}
    	chkmin(res, l);
    }
    cout << res << "\n";
    return 0;
}


Measured memory_bytes: 3612
#include<iostream>
#include<algorithm>
#include<vector>
#include<string.h>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<cmath>
#include<random>
#include<set>

using namespace std;

long long dp[3][100100] = {};
const long long INF = 1LL << 60;
#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979

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; }

/**
* @fn
* 最大値を取ります.Vector<int>を渡すこと.
*/
long long int imax(vector<int> a) {
	int MAX = -10000000;
	for (int i = 0; i < a.size(); i++) {
		if (MAX < a.at(i)) MAX = a.at(i);
	}
	return MAX;
}

/**
* @fn
* 最小値を取ります.Vector<int>を渡すこと.
*/
long long int imin(vector<int> a) {
	int MIN = 1000000000;
	for (int i = 0; i < a.size(); i++) {
		if (MIN > a.at(i)) MIN = a.at(i);
	}
	return MIN;
}

/**
* @fn
* 自然数について、桁数を求める
*/
Int getDigit(Int num) {
	return (Int)(log10(num)) + 1;
}


int get2Digit(Int num) {
	int cnt = 0;
	while (num > 0) {
		if (num % 2 != 0) {
			return cnt;
		}
		cnt++;
		num /= 2;
	}
}

long long int absmin(vector<int> a, long long int b) {
	int mini = 100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (mini > abs(a.at(i) - b)) {
			mini = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}


long long int absmax(vector<int> a, long long int b) {
	int max = -100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (max < abs(a.at(i) - b)) {
			max = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}

int gcd(int a, int b)
{
	if (a < b) swap(a, b);
	if (b < 1) return -1;
	if (a % b == 0) return b;
	return gcd(b, a % b);
}

void haerobatya(int start, int end, char level) {
	if (start > end) swap(start, end);
	for (int i = start; i <= end; i++) {
		if (i < 100) {
			cout << "https://atcoder.jp/contests/abc0" << i << "/tasks/abc0" << i << "_" << level << endl;
		}
		else {
			cout << "https://atcoder.jp/contests/abc" << i << "/tasks/abc" << i << "_" << level << endl;
		}
	}
}

long long int cntmod(long long int warareru, long long int mod) {
	long long int i = 0;
	for (i = 0;true; i++) {
		if (warareru % mod == 0 && warareru >= mod) {
			warareru /= mod;
		}
		else {
			return i;
		}
	}
}

void ansYes(bool a) {
	if (a == true) cout << "Yes" << endl;
	else cout << "No" << endl;
}

void ansYES(bool a) {
	if (a == true) cout << "YES" << endl;
	else cout << "NO" << endl;
}


Int euclidean_gcd(Int a, Int b) {
	while (true) {
		if (a < b) swap(a, b);
		if (!b) break;
		a %= b;
	}
	return a;
}



//ここまでライブラリ
//ここから本文
//周りはみんなおとなになってます


int main() {
	int a, b;
	cin >> a >> b;
	for (int i = max(-100000, b - a + 1); i < min(a + b,100000)-1; i++) {
		cout << i << " " ;
	}
	cout << min(a + b, 100000)-1 << endl;
}


Measured memory_bytes: 256
x, k, d = map(int, input().split())
ans = x
if abs(x)//d>=k:
    ans = abs(ans)
    ans= min(ans-(k*d), (ans-(k*d))+d)
else:
    ans-=(x//d)*d
    k-=x//d
    #print(k, ans, (x//d)*d)
    if k%2==1:
        ans=min(ans+d, abs(ans-d))
print(abs(ans))


Measured memory_bytes: 9052
n = gets.chomp.to_i
result = nil
0.step(n, 4) do |a|
    0.step(n, 7) do |b|
        if a+b==n then
            result = true
            break
        elsif a+b > n then
            result = false
        end
    end
    break if result==true
end
puts result ? "Yes" : "No"

Measured memory_bytes: 1788
#include <bits/stdc++.h>
#include <vector>
typedef long long ll;
#define  rep(i,a,b)for(long long i=a;i<b;++i)
#define  rrep(i,a,b)for(int i=a;i>=b;--i)
#define  yesno(flag)if(flag)cout<<"Yes"<<endl; else cout<<"No"<<endl;
using namespace std;
const ll INF=1000000000000LL;
const ll r197=1000000007;
typedef pair<ll,ll>P;
typedef pair<P,P>Pa;
bool Inframe(int a,int b,int c,int d,int h,int w){
	if(a+b>=0&&a+b<h&&c+d>=0&&c+d<w)return true;
	return false;
}
struct edge{
	ll x;
	ll y;
	bool operator<(const edge& e)const{
		return x+y<e.x+e.y;
	}
	bool operator>(const edge& e)const{
		return x+y>e.x+e.y;
	}


};
struct road{ll cost;int to;};
int n,k;
ll b[100005]={};
vector<int> l,r;
vector<P> pa;
void bisetup(){

}


int main() {
	cin>>n>>k;
	int d=n/2;
	if(n%2==1)d++;
	if(d>=k)cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <map>

using namespace std;

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

    map<int, int> cnt;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;

        cnt[a - 1]++;
        cnt[a]++;
        cnt[a + 1]++;
    }

    int res = 0;
    for (map<int, int>::iterator i = cnt.begin(); i != cnt.end(); i++) {
        res = max(res, i->second);
    }

    cout << res << endl;
}


Measured memory_bytes: 4736
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class Main {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		int n = Integer.parseInt(br.readLine());

		String result = null;
		if(n <= 999){
			result = "ABC";
		}
		else {
			result = "ABD";
		}
		System.out.println(result);
	}

}


Measured memory_bytes: 21076
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  if(N<2){
    cout << "1" << endl;
  }
 else if(N<4){
    cout << "2" << endl;
  }
 else if(N<8){
    cout << "4" << endl;
  }
  else if(N<16){
    cout << "8" << endl;
  }
 else if(N<32){
    cout << "16" << endl;
  }
else if(N<64){
    cout << "32" << endl;
  }
  else{
    cout << "64" << endl;
  }
}
  


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main()
{
    int W,H,N;
    cin >> W >> H >> N;
    int ue=H;
    int shita=0;
    int migi=W;
    int hidari=0;
    int x,y,a;
    for (int i = 0; i < N; ++i)
    {
        cin >> x >> y >> a;
        if(a==1 && hidari < x){
            hidari = x;
        }else if(a==2 && migi > x){
            migi = x;
        }else if(a==3 && shita < y){
            shita = y;
        }else if(a==4 && ue > y){
            ue = y;
        }
    }
    if(ue>shita && migi>hidari){
        cout << (ue-shita)*(migi-hidari) << endl;
    }else{
        cout << 0 << endl;
    }
    return 0;
}

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

////////////// Prewritten code follows. Look down for solution. ////////////////
#define x first
#define y second
#define len(x) ((int)(x).size())
using pii = pair<int, int>;
using ll = long long;
using llu = long long unsigned;
using ld = long double;

const ld EPS = 1e-9;
inline int cmp(ld x, ld y = 0, ld tol = EPS) {
	return (x <= y + tol) ? (x + tol < y) ? -1 : 0 : 1;
}

const int MOD = 1;
inline int mod (ll x, int m = MOD) {
	return (int)(((x%m) + m)%m);
}

////////////////////////// Solution starts below. //////////////////////////////

const int INF = 2e9;
const int V = 1e5+100;

int n, wMax;
int dp[V];

int main () {
	for (int i = 0; i < V; i++)
		dp[i] = INF;
	dp[0] = 0;
	scanf ("%d %d", &n, &wMax);
	while (n--) {
		int wi, vi;
		scanf ("%d %d", &wi, &vi);
		for (int i = V-1; i >= vi; i--)
			if (dp[i-vi] != INF and (dp[i-vi] + wi) <= wMax)
				dp[i] = min (dp[i], dp[i-vi] + wi);
	}
	
	for (int i = V-1; i >= 0; i--)
		if (dp[i] != INF) {
			printf ("%d\n", i);
			exit (0);
		}
	
	return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod 1000000007
char s[200005];
main()
{
    int n,i,ans=0;
    cin>>n;
    cin>>s;
    int l=-1;
    for(i=n-1;i>=0;i--)
    {
        if(s[i]=='R')
        {
            l=i;break;
        }
    }
    if(l==-1)
    {
        printf("0\n");return 0;
    }
    for(i=0;i<n;i++)
    {
       if(s[i]=='W')
       {
           if(l<i)
           {
               break;
           }
           swap(s[i],s[l]);ans++;
       }
       else
       {
           continue;
       }
       while(1)
       {
           l--;
           if(l==-1)break;
           if(s[l]=='R')break;
       }
       if(l==-1)break;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3824
package main

import (
	"fmt"
)

func main() {
	var N, Y int
	fmt.Scan(&N, &Y)

	// i = 10000; j = 5000; k = 1000
	for i := 0; i <= N; i++ {
		for j := 0; j <= N-i; j++ {
			k := N - i - j
			if 10000*i + 5000*j + 1000*k == Y {
				fmt.Println(i, j, k)
				return
			}
		}
	}

	fmt.Println(-1, -1, -1)
}



Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<map>
#include<iomanip>
#define rip(i,n) for(int i=0;i<n;i++)
#define ll long long
#define lb long double
#define vec vector<int>
#define set setprecision
#define mod 1000000007
#include<numeric>
using namespace std;
int gcd(int a, int b)
{
	if (a % b == 0)	return(b);
	else return(gcd(b, a % b));
}
int lcm(int a, int b)
{
	return a * b / gcd(a, b);
}
ll pow(ll a, ll b) {
	ll k = b % 30000, h = b / 30000, s = 1;
	rip(i, 30000)s = (s * a) % mod; ll j = 1;
	if (h != 0)rip(i, h)j = j * s % mod;
	if (k != 0)rip(i, k)j = j * a % mod;
	return(j);
}
int main() {
	vec a(3); rip(i, 3)cin >> a[i];
	sort(a.begin(), a.end());
	rip(i, 3)if(i==2)cout << a[i] << endl;
	else cout << a[i] << " ";
}


Measured memory_bytes: 3152
#include <bits/stdc++.h>
#define ll long long
#define ls id << 1
#define rs id << 1 | 1
#define mem(array, value, size, type) memset(array, value, ((size) + 5) * sizeof(type))
#define memarray(array, value) memset(array, value, sizeof(array))
#define fillarray(array, value, begin, end) fill((array) + (begin), (array) + (end) + 1, value)
#define fillvector(v, value) fill((v).begin(), (v).end(), value)
#define pb(x) push_back(x)
#define st(x) (1LL << (x))
#define pii pair<int, int>
#define mp(a, b) make_pair((a), (b))
#define Flush fflush(stdout)
#define vecfirst (*vec.begin())
#define veclast (*vec.rbegin())
#define vecall(v) (v).begin(), (v).end()
#define vecupsort(v) (sort((v).begin(), (v).end()))
#define vecdownsort(v, type) (sort(vecall(v), greater<type>()))
#define veccmpsort(v, cmp) (sort(vecall(v), cmp))
using namespace std;
const int N = 500050;
const int inf = 0x3f3f3f3f;
const ll llinf = 0x3f3f3f3f3f3f3f3f;
const int mod = 998244353;
const int MOD = 1e9 + 7;
const double PI = acos(-1.0);
clock_t TIME__START, TIME__END;
void program_end()
{
#ifdef ONLINE
    printf("\nTime used: %.6lf(s)\n", ((double)TIME__END - TIME__START) / 1000);
    system("pause");
#endif
}
int n;
ll a[N];
ll ans = 0;

inline void solve()
{
    cin >> n;
    for (int i = 1; i <= n; ++i)
        cin >> a[i];
    for (int i = 1; i <= n; ++i)
        for (int j = i + 1; j <= n; ++j)
            for (int k = j + 1; k <= n; ++k)
            {
                if (a[i] + a[j] > a[k] && a[i] + a[k] > a[j] && a[j] + a[k] > a[i])
                {
                    if (a[i] == a[j] || a[i] == a[k] || a[k] == a[j])
                        continue;
                    ans++;
                    // printf("%d %d %d\n", i, j, k);
                }
            }
    cout << ans << endl;
}

int main()
{
    TIME__START = clock();
    int Test = 1;
    // scanf("%d", &Test);
    while (Test--)
        solve();
    TIME__END = clock();
    program_end();
    return 0;
}

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

#define FOR(a,b,c) for (int a=(b);a<(c);++a)
#define REP(i,n) FOR(i,0,n)
#define ll long long
#define pii pair<int,int>
#define x first
#define y second
#define pb push_back
#define lf double

using namespace std;

const int MAX = (int)1e6 + 5;

int main(){
	int a,b;
	scanf ("%d%d",&a,&b);
	printf ("%d\n",a*b);
	
	
	return 0;
}


Measured memory_bytes: 3824
#include <vector>
#include <list>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <cstdio>
#include <complex>
#include <cstdint>
#include <tuple>

#define M_PI       3.14159265358979323846

using namespace std;

//conversion
//------------------------------------------
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(); }
inline int readInt() { int x; scanf("%d", &x); return x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#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 SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007

int main() {
	int n;
	cin >> n;
	if (n == 3) {
		printf("2 3 25\n");
		return 0;
	}
	if (n == 4) {
		printf("2 3 4 9\n");
		return 0;
	}
	if (n== 5) {
		printf("2 3 4 6 9\n");
		return 0;
	}
	VI ans;
	int sum = 0;
	n++;
	VI d = { 0,2,3,4 };
	REP(i, n) {
		int k = 6 * (i / 4) + d[i % 4];
		sum += k;
		ans.PB(k);
	}
	if (sum % 6 == 2) {
		ans[5] = 0;
		ans.PB((n / 4 + 1) * 6);
	}
	if (sum % 6 == 3) {
		ans[6] = 0;
		ans.PB((n / 4 + 1) * 6);
	}
	if (sum % 6 == 5) {
		ans[6] = 0;
		ans.PB((n/4)*6+4);
	}
	for (auto v : ans) {
		if(v != 0)printf("%d ", v);
	}
	printf("\n");
		return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define int long long
#define _GLIBCXX_DEBUG
const int INF=1e15;

signed main(){
    int N;
    string S;
  	cin>>N>>S;
    vector<int>ls(N,0);
    vector<int>rs(N,0);
    REP(i,N){
        if(i==0){
            if(S[0]=='W') ls[0]=1;
            else ls[0]=0;
            continue;
        }
        if(S[i]=='W')ls[i]=ls[i-1]+1;
        else ls[i]=ls[i-1];
    }
    REP(i,N){
        if(i==0){
            if(S[N-1]=='E') rs[N-1]=1;
            else rs[N-1]=0;
            continue;
        }
        if(S[N-i-1]=='E')rs[N-1-i]=rs[N-i]+1;
        else rs[N-i-1]=rs[N-i];
    }
    int ans;
    REP(i,N){
        if(i==0){
            ans=rs[1];
            continue;
        }
        if(i==N-1){
            ans=min(ls[N-2],ans);
            continue;
        }
        ans=min(ans,ls[i-1]+rs[i+1]);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 5380
#include "bits/stdc++.h"

using namespace std;
typedef long long ll;
#define rep(i, j, n) for (int i = j; i < n; i++)
#define out(ans) cout << ans << endl;
const ll mod = 1e9 + 7;

int main(){

  int n;cin>>n;
  vector<int>sum(n+1,0),num(n+1,0);
  rep(i,0,n){
    ll a;cin>>a;
    sum[i+1]=num[i+1]=a;
    sum[i+1]+=sum[i];
    num[i+1]^=num[i];
  }

  ll ans=0;
  int r=1;
  rep(l,0,n){

    while(r<=n&&sum[r]-sum[l]==(num[r]^num[l])){
      r++;
    }

    ans+=r-l-1;

    if(r==l)r++;
  }
  
  out(ans);

  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 10000000000000000

vector<string> ans;
int N;

void dfs(int x,string s){
	if(x==0){
		ans.push_back(s);
		return;
	}
	
	char maxi = 'a'-1;
	for(int i=0;i<s.size();i++)maxi = max(maxi,s[i]);
	maxi++;
	for(char i='a';i<=maxi;i++){
		dfs(x-1,s+i);
	}
}

int main(){
	
	cin>>N;
	
	dfs(N,"");
	
	sort(ans.begin(),ans.end());
	
	for(int i=0;i<ans.size();i++){
		cout<<ans[i]<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 9588
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

func main() {
	sc.Split(bufio.ScanWords)
	N, C := getInt(), getInt()
	s := make([]int, N)
	t := make([]int, N)
	c := make([]int, N)
	for i := 0; i < N; i++ {
		s[i], t[i], c[i] = getInt(), getInt(), getInt()-1
	}

	p := make([][]int, C)
	for i := 0; i < C; i++ {
		p[i] = make([]int, 100005)
	}
	for i := 0; i < N; i++ {
		// out(s[i], t[i], c[i])
		for j := s[i] - 1; j < t[i]; j++ {
			p[c[i]][j] = 1
		}
	}

	ans := 0
	for i := 0; i <= 100000; i++ {
		cnt := 0
		for c := 0; c < C; c++ {
			if p[c][i] == 1 {
				cnt++
			}
		}
		ans = max(ans, cnt)
	}
	out(ans)
}


Measured memory_bytes: 27904
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int t=3;
  set <int> s;
  while (t--)
  {
    int a;
    cin>>a;
    s.insert(a);
  }
  if (s.size()==2)
    cout<<"Yes";
  else
    cout<<"No";
}

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

const int N = 2005;
const int mod = 1e9 + 7;

int n;
vector <int> G[N];
int dp[N][N][3];
int f[N][3];
int nchild[N];

void add(int &x, int y) {
	x += y; while(x >= y) x -= mod; while(x < 0) x += mod;
}

void dfs(int u) {
	dp[u][0][0] = 1;

	for (int &v : G[u]) {
		dfs(v);
		memset(f, 0, sizeof f);

		for (int ncut_u = 0; ncut_u <= nchild[u]; ++ncut_u) {
			for (int deg_u = 0; deg_u <= 2; ++deg_u) {
				for (int ncut_v = 0; ncut_v <= nchild[v]; ++ncut_v) {
					for (int deg_v = 0; deg_v <= 2; ++deg_v) {
						if (!dp[u][ncut_u][deg_u] || !dp[v][ncut_v][deg_v]) continue;

						int mul = 1LL * dp[u][ncut_u][deg_u] * dp[v][ncut_v][deg_v] % mod;

						// cut
						add(f[ncut_u + ncut_v + 1][deg_u], (deg_v == 1 ? 2LL : 1LL) * mul % mod);

						// concatenate
						if (deg_u <= 1 && deg_v <= 1) {
							add(f[ncut_u + ncut_v][deg_u + 1], mul);
						}
					}
				}
			}
		}

		nchild[u] += nchild[v];
		for (int ncut_u = 0; ncut_u <= nchild[u]; ++ncut_u) {
			for (int deg_u = 0; deg_u <= 2; ++deg_u) {
				dp[u][ncut_u][deg_u] = f[ncut_u][deg_u]; // update the values of dp[]
			}
		}
	}

	++nchild[u];
	for (int ncut_u = 0; ncut_u < nchild[u]; ++ncut_u) {
		for (int deg_u = 0; deg_u <= 2; ++deg_u) {
			if (deg_u == 2) {
				add(dp[u][ncut_u][deg_u], dp[u][ncut_u][deg_u]); // x 2
			}
			if (u == 1 && deg_u == 1) {
				add(dp[u][ncut_u][deg_u], dp[u][ncut_u][deg_u]); // x 2	
			}
		}
	}
}

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	cin >> n;
	for (int i = 2; i <= n; ++i) {
		int p; cin >> p; G[p].push_back(i);
	}

	dfs(1);

	int fact = 1;
	int res = 0;
	for (int ncut = 0; ncut <= n - 1; ++ncut) {
		int npair = n - 1 - ncut;
		int cur = 0;
		for (int deg = 0; deg <= 2; ++deg) add(cur, dp[1][ncut][deg]);

		fact = 1LL * fact * (ncut + 1) % mod; // (ncut + 1)!
		cur = 1LL * cur * fact % mod;

		if (npair % 2 == 0) add(res, cur); else add(res, -cur);
	}

	cout << res << endl;
}

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

#define mainspring cout<<"mainspring\n";
#define barrel cout<<"barrel\n";
#define escapement cout<<"escapement\n";

#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(), (v).end() 
#define sz(v) (int)((v).size())
#define INF INT_MAX
#define NINF INT_MIN
#define fs first
#define sd second
#define tik(i,a,b) for(int i = a; i < b; i++)
#define tok(i,a,b) for(int i = a; i >= b; i--)
#define error(args...) {string _s = #args; replace(_s.begin(), _s.end(), ',',' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it,args);}

typedef long long ll;
typedef unsigned long long ull;

typedef pair < int, int > pi;
typedef pair < pi, int > ppi;

typedef vector < int > vi;
typedef vector < vector < int > > vvi;
typedef vector < pi > vpi;
typedef vector < vpi > vvpi;
typedef vector < ppi > vppi;

void fast() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << "\n";
    err(++it, args...);
}

int main() {

	int n;
	cin >> n;
	int h[n];

	tik(i,0,n)
		cin >> h[i];

	int dp[n];
	dp[n-1] = 0;
	dp[n-2] = abs(h[n-1]-h[n-2]);

	tok(i,n-3,0) {
		dp[i] = min(dp[i+1]+abs(h[i+1]-h[i]), dp[i+2]+abs(h[i+2]-h[i]));
	}

	cout << dp[0];
}



Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>

using namespace std;

#define ll long long
#define db double
#define clr(a, b) memset(a, b, sizeof(a))

const int maxn = 5e5 + 10;
const int inf = 0x7ffffff;
db x[maxn];
void solve()
{
    int n;
    db m;
    cin >> n >> m;
    db sum = 0;
    for (int i = 1; i <= n;i++)
    {
        cin >> x[i];
        sum += x[i];
    }
    db st = sum / 4 / m;
    int cnt = 0;
    for (int i = 1; i <= n;i++)
    {
        if(x[i]>=st)
            cnt++;
    }
    if(cnt>=m)
        cout << "Yes\n";
    else
        cout << "No\n";
}

int main()
{
    //freopen("out","w",stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    int T = 1;
    //cin >> T;
    while(T-- > 0)
        solve();

}

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

int main()
{
long long unsigned int a,b,c,d,i,j,ans=0,k;
cin>>a>>b>>c>>d;
i=a/c;
j=b/c;
i=i*c;
j=j*c;
if(i<a)i=i+c;
if(i<=j)ans=(j/c-i/c+1);
i=a/d;
j=b/d;
i=i*d;
j=j*d;
if(i<a)i=i+d;
if(i<=j)ans+=(j/d-i/d+1);
k=__gcd(c,d);
k=(c*d)/k;
i=a/k;
j=b/k;
i=i*(k);
j=j*(k);
if(i<a)i=i+(k);
if(i<=j)ans-=(j/(k)-i/(k)+1);
ans=(b-a+1)-ans;
cout<<ans;
}

Measured memory_bytes: 256
A,B,C,X,Y = map(int,input().split())

if X > Y:
    temp = X
    X = Y
    Y = temp
    temp = A
    A = B
    B = temp

if A+B < 2*C:
    print(X*(A+B)+(Y-X)*B)
else:
    if B < 2*C:
        print(2*X*C + B*(Y-X))
    else:
        print(2*X*C + 2*(Y-X)*C)

Measured memory_bytes: 3064
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include<vector>
#include<iomanip>
#include<map>
#include <queue>
#include<cmath>
#include<cstdio>
#include<iomanip>
#include<set>
#include <bits/stdc++.h>
 
using namespace std;
using ll = long long int;
 
#define REP(i,n) for(ll i=0;i<(ll)(n);i++) //REP(i, 5) cout<<i;
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define MOD 1000000007 //10^9+7
//#define MOD 1
 
ll gcd(ll a, ll b) {
  ll tmp;
  if ( b > a) {
    tmp = a;
    a = b;
    b = tmp;
  }
  while (a % b !=0) {
    tmp = b;
    b = a % b;
    a = tmp;
  }
  return b;
}
 
const int MAX = 2000;

long long fac[MAX], finv[MAX], inv[MAX];
 
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


void sosuu(ll n, vector<ll> &v){

  vector<ll> num(n, 0);

  FOR(i, 1, sqrt(n)){
    if(num[i]==0){
      FOR(j, 0, n/i){
        num[i+(j*i)] = 1;
      }
    }
  }
  REP(i, n){
    if(num[i]==0) v.push_back(i+1);
  }
}

ll GetDigit(ll num){
    ll digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}


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

  ll left = 0;
  ll right = 0;
  ll add_left = 0;
  ll add_right = 0;

  REP(i, n){
    if(s[i]=='('){
      left++;
    }else{
      if(left!=0){
        left--;
      }else{
        add_left++;
      }
    }
  }

  REP(i, add_left) cout<<'(';
  cout<<s;
  REP(i, left) cout<<')';
  cout<<endl;

}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using static System.Math;
using static System.Array;


namespace AtCoder
{
    class AC
    {
        const int mod = 1000000007;
        const int INF = int.MaxValue / 2;
        const long SINF = long.MaxValue / 2;


        static void Main(string[] args)
        {
            //var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            //Console.SetOut(sw);
            var cin = new Scanner();

            var p = cin.SplitReaderL();
            long A = p[0];
            long B = p[1];

            Console.WriteLine(F(A - 1) ^ F(B));
           

            //Console.Out.Flush();
        }


        public static long F(long X)
        {
            if (X <= 0) { return 0; }
            if (X % 2 != 0)
            {
                return ((X + 1) / 2) % 2 == 0 ? 0 : 1;
            }
            else
            {
                long ret = (X / 2) % 2 == 0 ? 0 : 1;
                ret ^= X;
                return ret;
            }
        }

    }
    public class Scanner
    {
        public int[] SplitReader()
        {
            int[] array = Console.ReadLine().Split().Select(int.Parse).ToArray();
            return array;
        }
        public long[] SplitReaderL()
        {
            long[] array = Console.ReadLine().Split().Select(long.Parse).ToArray();
            return array;
        }
    }

   public static class Tool
        {
            static public void Initialize<T>(ref T[] array, T initialvalue)
            {
                for (var i = 0; i < array.Length; i++)
                {
                    array[i] = initialvalue;
                }
            }
            static public long ModuloP(long value, long mod)
            {
                long r = value % mod;

                if (r * mod < 0)
                {
                    r += mod;
                }
                return r;
            }

        }

   struct Pair<T> : IComparable<Pair<T>> where T : IComparable<T>
   {
        public T variable;
        public int index;

        public Pair(T val, int i)
        {
            variable = val;
            index = i;
        }

        public int CompareTo(Pair<T> otherPair)
        {
            return variable.CompareTo(otherPair.variable);
        }

        public int CompareIndex(Pair<T> otherPair)
        {
            return index.CompareTo(otherPair.index);
        }
   }

    


}






Measured memory_bytes: 13396
#include <iostream>
#include <vector>
#include<algorithm>
#include<iomanip>
#include<queue>
#include<map>
#include<bitset>
#include<math.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for(int i=m;i<(int)(n);i++)
typedef pair<int,int> pint;
typedef long long ll;
const int inf   = 1e9+7;
const ll  longinf = 1LL<<60;
const int mod=1e9+7;
int dx[4]={1,0,-1,0}, dy[4]={0,1,0,-1};

int main(){
  int n;cin>>n;
  ll ans=0,mi=inf;
  bool flag=false;
  rep(i,n){
    ll a,b;
    cin>>a>>b;
    if(a!=b)flag=true;
    ans+=a;
    if(a>b)mi=min(b,mi);
    }
  if(!flag)cout<<0<<endl;
  else cout<<ans-mi<<endl;
  
  return 0;
  }

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

using namespace std;

int main()
{
    int a, b;
    cin >> a >> b;
    
    int n;
    n = b - a;
    int sum = 0;
    for(int i=1; i <=n; i++){
        sum += i;
    }
    
    cout << sum - b << endl;
    return 0;
}


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

int main() {
    int N, M;
    cin >> N >> M;
    vector<int> X(M);
    for (int i = 0; i < M; i++)
        cin >> X[i];
    sort(X.begin(), X.end());
    vector<int> Y(M - 1);
    for (int i = 0; i < M - 1; i++)
        Y[i] = X[i + 1] - X[i];
    sort(Y.begin(), Y.end());

    int ans = 0;
    for (int i = 0; i < M - N; i++)
        ans += Y[i];

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

Measured memory_bytes: 1024
# coding: utf-8

II = lambda: int(input())
MI = lambda: map(int, input().split())
MIL = lambda: list(MI())
MIS = lambda: input().split()


def main():
    N = II()
    A = [0] + MIL() + [0]
    d = [abs(A[i] - A[i + 1]) for i in range(N + 1)]
    cost = sum(d)

    for i in range(1, N + 1):
        print(cost - (d[i] + d[i-1]) + abs(A[i-1] - A[i+1]))


if __name__ == "__main__":
    main()


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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;

int main()
{
    int n;
    cin >> n;
    int h[n];
    rep(i, n) cin >> h[i];
    int max = 0;

    rep(i, n - 1)
    {
        int cnt = 0;

        while (h[i] >= h[i + 1])
        {
            cnt++;
            i++;
            if (i == n - 1)
                break;
        }
        if (cnt > max)
            max = cnt;
    }

    OP(max);

    return 0;
}

Measured memory_bytes: 640
D = int(input())
c = list(map(int,input().split()))
s = [list(map(int,input().split())) for k in range(D)]

ans = []
last = [0]*26
ret = 0
for d in range(D):
    score = -100000000
    t = -1
    for p in range(26):
        prev = last[p]
        last[p] = d+1
        temp = s[d][p]
        for i in range(26):
            temp -= c[i]*(d+1-last[i])
        if temp > score:
            score = temp
            t = p
        last[p] = prev
    last[t] = d+1
    ans.append(t+1)
    ret += score
print(*ans,sep="\n")



Measured memory_bytes: 74304
//package Atcoder;
import java.util.*;
import java.io.*;
public class Main
{
	static final int mod=(int)1e9+7;
	static boolean arr[]=new boolean[(int)1e6+1];
	static int fact[]=new int[(int)1e6+1];
	static final int inf=(int)1e9;
	static final long INF=(long)1e18;
	public static void main(String[] args)
	{
		FastScanner fs=new FastScanner();
		precomp();
		long cnt=0;
		int n=fs.nextInt();
		for(int i=n-1;i>=1;i--)
		{
			int num=i;
			int c=0,prod=1;
			while(num>1)
			{
				if(fact[num]==fact[num/fact[num]])
				{
					c++;
				}
				else
				{
					prod=(prod)*(c+2);
					c=0;
				}
				num/=fact[num];
			}
			cnt=cnt+prod;
		}
		System.out.println(cnt);
	}
	public static void precomp()
	{
		arr[0]=arr[1]=true;
		for(int i=2;i<=arr.length-1;i++)
		{
			if(arr[i]==false)
			{
				for(int j=i;j<=arr.length-1;j+=i)
				{
					arr[j]=true;
					if(fact[j]==0)
					fact[j]=i;
				}
			}
		}
	}
}
class FastScanner 
{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");
		public String next() 
		{
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
			
		}
		
		long pow(long x,long n)
		{
			long res=1;
			while(n>0)
			{
			   	if(n%2!=0)
			   	{
			   		res=(res*x);n--;
			   	}
			   	else
			   	{
			   		x=(x*x);n/=2;
			   	}
			}
			return res;
		}
		int gcd(int a,int b)
		{
			if(b==0)
			{
				return a;
			}
			return gcd(b,a%b);
		}
		long longgcd(long a,long b)
		{
			if(b==0)
			{
				return a;
			}
			return longgcd(b,a%b);
		}
		int[] sort(int arr[])
		{
			ArrayList<Integer> list = new ArrayList<Integer>();
			for(int i:arr)list.add(i);
			Collections.sort(list);
			for(int i=0;i<arr.length;i++)
			{
				arr[i]=list.get(i);
			}
			return arr;
		}
		char[] charsort(char arr[])
	        {
	    	ArrayList<Character> list = new ArrayList<>();
	    	for(char c:arr)list.add(c);
	    	Collections.sort(list);
	    	for(int i=0;i<list.size();i++)
	    	{
	    		arr[i]=list.get(i);
	    	}
	    	return arr;
	        }
		long[] longsort(long arr[])
		{
			ArrayList<Long> list = new ArrayList<Long>();
			for(long i:arr)list.add(i);
			Collections.sort(list);
			for(int i=0;i<arr.length;i++)
			{
				arr[i]=list.get(i);
			}
			return arr;
		}
		public int nextInt() 
		{
			return Integer.parseInt(next());
		}
		public int[] readArray(int n)
		{
			int[] arr=new int[n];
			for (int i=0; i<n; i++) arr[i]=nextInt();
			return arr;
		}	
		public long nextLong()
		{
			return Long.parseLong(next());
		}
		public long[] longreadArray(int n) 
		{
			long[] a=new long[n];
			for (int i=0; i<n; i++) a[i]=nextLong();
			return a;
		}
}

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

int main() {
  int a, b;
  cin >> a >> b;
  if (a * b % 2 == 0) {
    cout << "Even" << endl;
  } else {
    cout << "Odd" << endl;
  }

  cout;
  return 0;
}


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



int main(){
    int n;
    list<int> N;
    cin >> n;
    string command;
    
    int a;
    for(int i=0; i<n; i++){
        cin >> command;
        
        if(command=="insert"){
            cin >> a;
            N.push_front(a);
        }else if(command=="delete"){
            cin >> a;
            for(list<int>::iterator it=N.begin(); it!=N.end(); it++){
                if(*it == a){
                    N.erase(it);
                    break;
                }
            }
        }else if(command=="deleteFirst"){
            N.pop_front();
        }else if(command=="deleteLast"){
            N.pop_back();
        }
    }
    
    int i=0;
    for(list<int>::iterator it=N.begin(); it!=N.end(); it++){
        if(i++) cout << " ";
        cout << *it;
    }
    cout << endl;
}

Measured memory_bytes: 34268
#include <stdio.h>

void swap(int x[], int i, int j)
{
    int tmp;
    tmp = x[i];
    x[i] = x[j];
    x[j] = tmp;
}

void qsort(int a[], int b[], int c[], int left, int right)
{
    int i, j;
    int pivot;
    i = left;
    j = right;
    pivot = c[(left + right) / 2];
    while (1) {
        while (c[i] < pivot)
            i++;              
        while (pivot < c[j])      
            j--;               
        if (i >= j)          
            break;
        swap(c, i, j);
        swap(a, i, j);
        swap(b, i, j);
        i++;                    
        j--;
    }

    if (left < i - 1)           
        qsort(a, b, c, left, i - 1);
    if (j + 1 <  right)
        qsort(a, b, c, j + 1, right);    
}

int main(){
    int N;
    scanf("%d", &N);
    int a[N];
    int b[N];
    int c[N];
    for (int i = 0; i < N; i++){
        scanf("%d %d", &a[i], &b[i]);
        c[i] = a[i] + b[i];
    }
    long takahashi = 0;
    long aoki = 0;
    qsort(a, b, c, 0, N-1);
    for(int i= N-1; i>=0; i--){
        if(i%2 == (N-1)%2)takahashi += a[i];
        else aoki += b[i];
    }
    printf("%ld\n", takahashi - aoki);
    return 0;
}


Measured memory_bytes: 1280
#include<iostream>
#include<string>
using namespace std;
int main() {
    string s, t;
    cin >> s >> t;
    int count = 0, ans = 0;
    for (int i = 0; i <= s.size() - t.size(); i++) {
        for (int j = 0; j < t.size(); j++) {
            if (s[i + j] == t[j]) {
                count++;
            }
        }
        if (count > ans) {
            ans = count;
        }
        count = 0;
    }
    cout << t.size()-ans << endl;
}

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

int main(){
    ll s;
    cin >> s;
    cout << 0 << " " << 0 << " ";
    ll x2, y2 = 0, x3 = 0, y3;
    x2 = sqrt(s);
    while (x2 * x2 < s) x2++;
    y3 = x2;
    ll a = x2 * y3 - s;
    for (ll i = 1; i * i <= a; i++){
        if (a % i == 0){
            x3 = i;
            y2 = a / i;
            break ;
        }
    }
    cout << x2 << " " << y2 << " " << x3 << " " << y3 << endl;
}

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

using namespace std;

#define pb            push_back
#define mp            make_pair
#define po            pop_back
#define fi            first
#define se            second
#define mxn           100005
#define ll            long long int
#define ldb           long double
#define fr(i,a,b,k)   for(int i=a ; i<b ; i+=k)
#define frr(i,a,b,k)  for(int i=a ; i>b ; i-=k)
#define all(v)        v.begin(),v.end()
#define endl          "\n"
#define deg(x)        cout<<endl<<#x<<" = "<<(x)<<endl;
#define casep(x)      cout<<"Case #"<<(x)<<": ";
#define fast          ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));

typedef pair<ll,ll> pp;
typedef vector<ll> vi;
typedef vector<pp> vpp;
typedef vector<vi> vvi;

const int inf = INT_MAX;

ll power(ll a, ll n, ll mod) {ll p = 1;while (n > 0) {if(n%2) {p = p * a; p %= mod;} n >>= 1; a *= a; a %= mod;} return p % mod;}
ll gcd(ll a,ll b){ return __gcd(a,b);}
ll lcm(ll a,ll b){return a*b/__gcd(a,b);}
vector<vector<ll>> adj;
vector<bool> vis;


void solve(ll test){

    string s;
    cin >> s;
    ll r = 0;
    ll ans = 0;
    for(auto c : s){
        if(c == 'R')r++;
        ans = max(ans,r);
        if(c == 'S')r = 0;
    }
    cout << ans;

}

int main(){

    fast;
    int t=1;
    // cin >> t;
    for(int i=1 ; i<=t ; i++){
        solve(i);
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define INF 1e9
#define EPS 1e-9
#define MOD (1e9+7)
void put(string d){}template<class H,class...T>void put(string d,H&h,T&...t){cout<<h;if(sizeof...(t))cout<<d;put(d,t...);}
template<class T>void puti(T&a,string d=" "){bool f=1;for(auto&_:a)cout<<(exchange(f,0)?"":d)<<_;cout<<endl;}
template<class T>void putii(T&a,string d=" "){for(auto&_:a)puti(_,d);}

int main(){
	int n,ma,mb;
	cin>>n>>ma>>mb;
	vvi med(n,vi(3));
	for(auto&l:med)for(auto&i:l)cin>>i;
	
	int dp[n+1][401][401];
	fill(dp[0][0],dp[n+1][0],10000);
	dp[0][0][0]=0;
	
	for(int i=1;i<=n;i++){
		for(int j=0;j<=10*(i-1);j++){
			for(int k=0;k<=10*(i-1);k++){
				if(dp[i-1][j][k]!=10000){
					dp[i][j][k]=min(dp[i][j][k],dp[i-1][j][k]);
					dp[i][j+med[i-1][0]][k+med[i-1][1]]=
						min(dp[i][j+med[i-1][0]][k+med[i-1][1]],
							dp[i-1][j][k]+med[i-1][2]);
				}
			}
		}
	}
	int ans=10000;
	for(int i=1;i*max(ma,mb)<=n*10+1 && i<401;i++){
		ans=min(ans,dp[n][ma*i][mb*i]);
	}
	cout<<(ans==10000?-1:ans)<<endl;
	
	
	return 0;
}

Measured memory_bytes: 25984
#include<iostream>
using namespace std;
int main()
{

    int a,b,c,i;
    cin>>a>>b>>c;
    if((a==5&&b==5&&c==7)||(a==5&&b==7&&c==5)||(a==7&&b==5&&c==5))
        cout<<"YES";
    else cout<<"NO";




}


Measured memory_bytes: 3160
#include<iostream>
#include<string>
using namespace std;
int main() {

	int num;
	int a, b;
	cin >> num;
	a = 0;
	b = 0;
	while (num > 99) {
		num -= 100;
		a++;
	}
	while (num > 0) {
		num -= 1;
		b++;
	}
	
	if (a < 13 && a>0 && b < 13 && b>0) {
		cout << "AMBIGUOUS";
	}
	else if (a < 13 && a>0) {
		cout << "MMYY";
	}
	else if (b < 13 && b>0){
		cout << "YYMM";
	}
	else {
		cout << "NA";
	}



}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
int main(int argc, char const *argv[]) {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(0);
    int h,w,k;
    cin>>h>>w>>k;
    string grid[h];
    for(int i=0;i<h;i++) cin>>grid[i];
    int res=0;
    for(int mask=0;mask<(1<<(h+w));mask++) {
        int cnt=0;
        for(int row=0;row<h;row++) {
            for(int col=0;col<w;col++) {
                if(grid[row][col]!='#') continue;
                if((mask&(1<<col)) or (mask&(1<<(w+row)))) continue;
                cnt++;
            }
        }
        if(cnt==k) res++;
    }
    cout<<res<<endl;
}

Measured memory_bytes: 3632
#include<iostream>
#include<string>
using namespace std;
int main(){
  string s,t;
  cin >> s >>t;
  for(int i = 0; i < s.size(); i++){
    if(s.at(i) != t.at(i)){
      cout << "No" << endl;
      break;
    }
    if(i == s.size() -1){
      cout << "Yes" << endl;
    }
  }
}

Measured memory_bytes: 3592
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use {
    proconio::{marker::*, *},
    std::{cmp::*, collections::*, mem::*},
};
fn main() {
    input! {//
        mut s:Chars,
    }
    let n = s.len();
    let mut prevaCnt = 0;
    let mut ans = 0i64;
    let mut i = 0;
    loop {
        if i + 2 >= n {
            break;
        }
        if s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C' {
            ans += 1;
            ans += prevaCnt;
            i += 2;
            if i < n {
                s[i] = 'A';
            } else {
                break;
            }
        } else {
            if s[i] == 'A' {
                prevaCnt += 1;
            } else {
                prevaCnt = 0;
            }
            i += 1;
        }
        if i + 2 >= n {
            break;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 3008
#include <iostream>
#include <algorithm>
#define MAX 10001

using namespace std;
typedef long long ll;

ll n,a[MAX],b,dp,dn;

int main()
{
    cin>>n;
    for(ll i=1;i<=n;i++)cin>>a[i];
    for(ll i=1;i<=n;i++)cin>>b,a[i]-=b;
    for(ll i=1;i<=n;i++){
      if(a[i]<0)dn-=(a[i]-a[i]%2);
      if(a[i]>0)dp+=a[i];
    }
    if(dp*2<=dn)cout<<"Yes";
    else cout<<"No";
    return 0;
}


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

using namespace std;
 
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

typedef int64_t ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int MD = 1e9+7; typedef vector<ll> VL;
void dbg(){ cerr << "\n"; } template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }



int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	int n, k;
	string s;
	cin >>n >>k >>s;
	
	int sm =1;
	VI dt;
	if(s[0] =='0') dt.push_back(0);
	rep(i, n-1){
		if(s[i] ==s[i+1]) sm++;
		else { dt.push_back(sm); sm=1;}
	}
	if(sm !=0) dt.push_back(sm);
	if(s.back() =='0') dt.push_back(0);
	VL ki(sz(dt)+1);
	rep(i, sz(dt)) ki[i+1] = ki[i] + dt[i];
	//for(auto x :dt) printf("%d, ",x); puts("");
	//for(auto x :ki) printf("%d, ",x); puts("");
	ll ans=0;
	for(int i=0; i<sz(dt); i+=2){
		ans=max(ans, ki[min(i+k*2+1, sz(dt))] - ki[i]);
	}
	cout <<ans <<endl;
	return 0;
}


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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

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

  string S;
  cin >> S;

  LL ans = 1;
  VL cnt(26);
  REP(i,SZ(S)){
	int c = S[i] - 'a';
	ans += i - cnt[c];
	cnt[c]++;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 720
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <cstring>
#include <map>
#include <set>
#include <queue>
#include <math.h>
#include <unordered_map>
#include <algorithm>

using namespace std;
int main()
{
  int N, X;
  cin >> N >> X;
  vector<int> L(N, 0);
  for (int i=0;i<N;i++) cin >> L[i];
  int x = L[0];
  int ans = 1;
  for (int i=1; x <= X; i++)
  {
    ans++;
    if (i >= N) break;
    x += L[i];
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256