akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout << #x << " = " << (x) << endl
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ')
#define showv2(v) rep(j,v.size()) showv(v[j])
#define showt(t,n) rep(i,n) printf("%d%c", t[i], i==n-1?'\n':' ')
#define showt2(t,r,c) rep(j,r) showt(t[j],c)
#define printv(v) rep(i,v.size()) printf("%d\n", v[i])
#define printt(t,n) rep(i,n) printf("%d\n", t[i])
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
typedef vector<pii> vp;
typedef vector<tiii> vt;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
#define dame { puts("No"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
inline int in() { int x; scanf("%d",&x); return x;}
//cout << fixed << setprecision(10);

int main () {
  int a, b;
  cin >> a >> b;
  int ans = 0;
  int x = 1;
  while (x < b) {
    x += a - 1;
    ans++;
  }

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

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cassert>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define rep(i,n) FOR(i,0,n)
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define vint vector<int>
#define vdouble vector<double>
#define vstring vector<string>
using namespace std;

#include<map>
#include<set>
#include<queue>

typedef long long ll;
typedef unsigned long long ull;

// const int MAX_N = 1000000;
const int INFTY = (1 << 21); // 2097152
// const ll INFTY = (1LL << 60);
const ll MD = 1000000007LL;
// fprintf(stderr, "%d %lld \n", x, xll);

// segtree
const int MAX_N = 200000; // 1 << 20; // > 10^6

class SegTree{

public:

	int n;
	vector<ll> dat;
	ll dummy = 0; // (1 << 31) - 1;

	SegTree(int _n){
		init(_n);
	}

	void init(int n_){
        dat = vector<ll>(2 * MAX_N - 1);
		n = 1;
		while(n < n_) n *=2;

		// initialize
		rep(i, 2 * n - 1) dat[i] = dummy;
	}

	void update(int k, ll a){
		// update from bottom
		k += n-1;
		dat[k] += a;
		while(k > 0){
			k = (k - 1) / 2;
			dat[k] = dat[k*2+1] + dat[k*2+2];
		}
	}

	// sum of [a, b)
	ll query(int a, int b){
		return _query(a, b, 0, 0, n);
	}

	// sum of [a, b)
	// node k, corresponding [l, r)
	ll _query(int a, int b, int k, int l, int r){
		if(r <= a || b <= l) return dummy;
		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 vl + vr;
		}
	}
};


int N, Q;
int main() {
	cin >> N >> Q;

	SegTree ST(N);

	rep(q, Q){
		int c, x, y;
		cin >> c >> x >> y;

		if(c == 0){
			// update
            x--;
			ST.update(x, y);
		}
		else{
			// find
            x--; y--;
			cout << ST.query(x, y+1) << endl;
		}
	}

    // rep(i, ST.n * 2 - 1){fprintf(stderr, "%d ", ST.dat[i]); } fprintf(stderr, "\n");
}

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

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

#define reps(i, k, n) for (ll(i) = (k); (i) < (n); ++(i))
#define rep(i, n) reps(i, 0, n)
#define debug(x) cerr << x << " (L:" << __LINE__ << ")" << '\n';

#define pb push_back
#define mp make_pair
#define ALL(o) (o).begin(), (o).end()
#define sz(a) (int)((a).size())

#define ll long long
using pll = pair<ll, ll>;
using vi = vector<ll>;
using vl = vector<ll>;
using vs = vector<string>;

const ll MAX = (ll)0x3f0000003f000000;
const int MOD = 1000000007;
const double EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1},
          dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

void solve();
ll ans = 0;

void setup() {
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
}

int main() {
    setup();

    solve();
}

void solve() {
    string s = "YES";
    ll n;
    cin >> n;
    vi a(n);
    rep(i, n) { cin >> a[i]; }
    sort(ALL(a));
    rep(i, n - 1) {
        if (a[i] == a[i + 1]) {
            s = "NO";
        }
    }
    cout << s << endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <string.h>
#include <stack>
#include <assert.h>
#include <bitset>
#define Endl endl
#define mp make_pair
#define ll long long 
#define ull unsigned long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define over(A) {cout<<A<<endl;exit(0);}
#define all(A) A.begin(),A.end()
#define ceil(a,b) ((a-1)/b+1)
#define quickcin ios_base::sync_with_stdio(false);
const int mod=1e9+7;
const int inf=1039074182;
const ll llinf=1LL*inf*inf;
using namespace std;
template <typename T1,typename T2> inline void chmin(T1 &x,T2 b) {if(b<x) x=b;}
template <typename T1,typename T2> inline void chmax(T1 &x,T2 b) {if(b>x) x=b;}
template <typename T1,typename T2> inline void chadd(T1 &x,T2 b) {x+=b;if(x>=mod) x-=mod;}
template <typename T1,typename T2> inline void chmul(T1 &x,T2 b) {x=1LL*x*b%mod;}
template <typename T1,typename T2> inline void chmod(T1 &x,T2 b) {x%=b,x+=b;if(x>=b) x-=b;}
int n;
int a[1000005];

bool C(int a,int b)
{
	if(a<=1 && b<=1) return !(a==0 && b==1);
	return C(a/2,b/2) & C(a%2,b%2);
}

bool judge1()
{
	int s=0;
	for(int i=0;i<n;i++)
	{
		s+=a[i]*C(n-1,i);
	}
	return (s&1);
}

void deduce()
{
	n--;
	for(int i=0;i<n;i++)
	{
		a[i]=abs(a[i+1]-a[i]);
	}
}

bool judge2()
{
	for(int i=0;i<n;i++)
	{
		if(a[i]==1) return false;
	}
	for(int i=0;i<n;i++)
	{
		a[i]/=2;
	}
	return judge1();
}

int getch()
{
	char c=0;
	while(!isdigit(c)) c=getchar();
	return c-'0';
}

int main()
{
//	freopen("input.txt","r",stdin);
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		a[i]=getch();
	}
	deduce();
	if(n==1)
	{
		over(a[0]);
	}
	if(judge1()) over("1");
	if(judge2()) over("2");
	puts("0");
	return 0;
}

Measured memory_bytes: 7624
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int intNum = scan.nextInt();
		boolean[] isS = new boolean[13];
		boolean[] isH = new boolean[13];
		boolean[] isC = new boolean[13];
		boolean[] isD = new boolean[13];
		String strPic = "";
		for(int i = 0; i < intNum; i++){
			strPic = scan.next();
			if("S".equals(strPic)){
				isS[scan.nextInt()-1] = true;
			}else if("H".equals(strPic)){
				isH[scan.nextInt()-1] = true;
			}else if("C".equals(strPic)){
				isC[scan.nextInt()-1] = true;
			}else if("D".equals(strPic)){
				isD[scan.nextInt()-1] = true;
			}
		}
		for(int i = 0; i < 13; i++){
			if(!isS[i]){
				System.out.println("S " + (i + 1));
			}
		}
		for(int i = 0; i < 13; i++){
			if(!isH[i]){
				System.out.println("H " + (i + 1));
			}
		}
		for(int i = 0; i < 13; i++){
			if(!isC[i]){
				System.out.println("C " + (i + 1));
			}
		}
		for(int i = 0; i < 13; i++){
			if(!isD[i]){
				System.out.println("D " + (i + 1));
			}
		}
		scan.close();
	}
}

Measured memory_bytes: 18220
#include<iostream>

int a, b;

int main(){
	std::cin >> a >> b;
	if (a > b){
		std::cout << "a > b\n";
	}
	else if (a < b){
		std::cout << "a < b\n";
	}
	else{
		std::cout << "a == b\n";
	}
	return 0;
}


Measured memory_bytes: 2992
#pragma comment(linker, "/stack:640000000")

#include<bits/stdc++.h>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<stdio.h>
using namespace std;
#define ll long long int
#define scanl(a) scanf("%lld",&a)
#define scanii(a,b) scanf("%d%d",&a,&b)
#define scaniii(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define scanll(a,b) scanf("%lld%lld",&a,&b)
#define scanlll(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define scani(a) scanf("%d",&a)
#define clr(a) memset(a,0,sizeof(a))
#define clr_(a) memset(a,-1,sizeof(a))
#define pb(a) push_back(a)
#define pii pair<int,int>
#define sqr(a) a*a
#define eps 1e-9
#define inf INT_MAX
#define pi acos(-1.0)
#define ff first
#define ss second
#define INF 1e18
#define endl '\n'
#define vsort(v) sort(v.begin(),v.end())
#define all(v) v.begin(),v.end()
int fx[]={0,0,-1,1,-1,1,1,-1};
int fy[]={1,-1,0,0,1,1,-1,-1};
#ifdef shaft
     #define debug(args...) {cerr<<"Debug: "; dbg,args; cerr<<endl;}
#else
    #define debug(args...)  // Just strip off all debug tokens
#endif

struct debugger{
    template<typename T> debugger& operator , (const T& v){
        cerr<<v<<" ";
        return *this;
    }
}dbg;

ll lcm(ll a,ll b){
    return (a/__gcd(a,b))*b;
}
int main()
{
     ios_base::sync_with_stdio(0);
     cin.tie(0);
    #ifdef shaft
       // freopen("in.txt","r",stdin);
        ///freopen("out.txt","w",stdout);
    #endif ///shaft
    int n;
    while(cin>>n)
    {
        ll ans=1;
        for(int i=1;i<=n;i++)
        {
            ll x;
            cin>>x;
            ans=lcm(ans,x);
        }
        cout<<ans<<endl;
    }
    return 0;
}


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

int main() {

	string op;
	priority_queue<int> PQ;
    int key;
	while( cin >> op ) {
		if ( op == "insert" ) {
			cin >> key;
			PQ.push( key );
		} else if ( op == "extract" ) {
			 cout << PQ.top() <<endl;
			 PQ.pop();
	         
	  		} else if ( op == "end" ) break;
	}
	return 0;
}


Measured memory_bytes: 6952
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m;i<n;i++)
#define fix(n) cout<<fixed<<setprecision(n)
#define co(n) cout<<n<<endl
#define all(n) (n).begin(),(n).end()
using namespace std;
typedef long long ll;
const ll mod=1000000007;
double pi=3.1415926535;

int main(){
  int a;
  cin>>a;
  co(180*(a-2));
  
  return 0;
}

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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            A();
        }

        static void A()
        {
            var AAA = ReadSplitInt();
            if (AAA.Sum() >= 22)
            {
                Println("bust");
            }
            else
            {
                Println("win");
            }
        }

        static List<long> ReadLines(long n)
        {
            var l = new List<long>();
            for (long i = 0; i < n; i++)
            {
                l.Add(ReadLong());
            }
            return l;
        }

        static void YESOrNO(bool e) => Println(e ? "YES" : "NO");

        static void YesOrNo(bool e) => Println(e ? "Yes" : "No");

        static IEnumerable<int> Range(int start, int stop)
        {
            if (start < 0 || stop < 0 || start > stop || (start <= 0 && stop <= 0))
                return new List<int>();

            return Enumerable.Range(start, stop - start);
        }

        static bool IsDigit(string str)
        {
            var i = 0;
            return int.TryParse(str, out i);
        }

        static int SumDigits(long num)
        {
            return num.ToString().Select(x => x.ToString()).Sum(int.Parse);
        }

        static int[] ToIntArray(string str)
        {
            return str.Select(x => x.ToString()).Select(int.Parse).ToArray();
        }

        static long Gcd(long a, long b) => b == 0 ? a : Gcd(b, a % b);
        static long Lcm(long a, long b) => a / Gcd(a, b) * b;

        static bool IsPrime(int x)
        {
            if (x <= 1 || (x != 2 && x % 2 == 0)) return false;
            if (x == 2) return true;

            for (int i = 3; i < x; i += 2)
                if (x % i == 0) return false;

            return true;
        }

        static string Read() => Console.ReadLine();
        static int ReadInt() => int.Parse(Read());
        static long ReadLong() => long.Parse(Read());

        static List<string> ReadSplit() => Read().Split().ToList();
        static List<int> ReadSplitInt() => Read().Split().Select(int.Parse).ToList();
        static List<long> ReadSplitLong() => Read().Split().Select(long.Parse).ToList();

        static void Print(object value) => Console.Write(value.ToString());
        static void Println(object value) => Console.WriteLine(value.ToString());
        static string Join<T>(IEnumerable<T> list) => string.Join("", list);
    }

    public static class MyExtensions
    {
        public static string Slice(this string str, int start = 0, int stop = 0)
        {
            if (start > str.Length || stop > str.Length || start < 0 || stop < 0)
                return "";

            if (stop == 0) stop = str.Length;
            return str.Substring(start, stop - start);
        }
    }
}



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

void Main() {
	int N;
	cin >> N;
	priority_queue<int> cards;
	for (int i = 0; i < N; i++) {
		int a;
		cin >> a;
		cards.push(a);
	}
	
	int aliceTurn = 1;
	int alice = 0;
	int bob = 0;
	while (!cards.empty()) {
		if (aliceTurn % 2 == 1) {
			alice += cards.top();
		}
		else {
			bob += cards.top();
		}
		cards.pop();
		aliceTurn++;
	}

	cout << alice - bob << endl;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	Main();
	return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007;
// const int MOD = 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
const int dy8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dx8[] = {0, -1, -1, -1, 0, 1, 1, 1};
template <typename T, typename U> inline bool chmax(T &a, U b) { return a < b ? (a = b, true) : false; }
template <typename T, typename U> inline bool chmin(T &a, U b) { return a > b ? (a = b, true) : false; }
struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

struct Manacher {
  template <typename T>
  Manacher(const T &s) {
    T str;
    int n = s.size();
    REP(i, n) {
      str.push_back(s[i]);
      if (i + 1 < n) str.push_back('$');
    }
    n = str.size();
    radius.resize(n);
    int j = 1;
    for (int i = 0; i < n;) {
      while (i - j >= 0 && i + j < n && str[i - j] == str[i + j]) ++j;
      radius[i] = j;
      int k = 1;
      while (i - k >= 0 && i + k < n && k + radius[i - k] < j) {
        radius[i + k] = radius[i - k];
        ++k;
      }
      i += k;
      j -= k;
    }
  }

  int odd(int idx) { return (radius[idx * 2] + 1) / 2; }

  int even(int idx) { return radius[idx * 2 + 1] / 2; }

  bool is_palindrome(int left, int right) {
    int mid = (left + right - 1) / 2;
    return (((right - left) & 1) ? odd(mid) * 2 - 1 : even(mid) * 2) >= right - left;
  }

private:
  vector<int> radius;
};

int main() {
  int n; cin >> n;
  vector<string> s(n);
  REP(i, n) {
    cin >> s[i];
    s[i] = s[i] + s[i] + s[i] + s[i];
    s.emplace_back(s[i]);
  }
  vector<Manacher> man;
  REP(j, n * 4) {
    string str = "";
    for (int i = 0; i < n * 2 && j - i >= 0; ++i) str += s[i][j - i];
    man.emplace_back(str);
  }
  int ans = 0;
  REP(a, n) REP(b, n) {
    bool ok = true;
    REP(j, n) ok &= man[a + b + j].is_palindrome(a, a + j + 1);
    FOR(i, 1, n) ok &= man[a + b + n - 1 + i].is_palindrome(a + i, a + i + n - i);
    ans += ok;
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 5248
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,s,n) for(int i=s;i<n;i++)
#define per(i,s,n) for(int i=n-1;i>=s;i--)
#define fi first
#define se second
#define all(c) c.begin(),c.end()
typedef long long int ll;
typedef pair<ll, int> P;
typedef long double ld;
void Ans(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}

const ll INF=1001001001;
const ll mod=1000000007;

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};



P p(ll a){
  if(a>=0) return P(a,0);
  return P((-1)*a,1);
}

int main(){
  int n,k;
  cin>>n>>k;
  ll a;
  ll d=1,e=1;
  vector<P> b(n);
  ll ch=0;
  rep(i,n){
    cin>>a;
    b[i]=p(a);
    ch+=b[i].se;
  }
  mint ans=1;
  if(n==k){
    rep(i,k){
      ans=ans*(mint)(b[i].fi);
    }
    if(ch%2==0) cout<<ans.x<<endl;
    else{
      ans*=(mint)(-1);
      cout<<ans.x<<endl;
    }
    return 0;
  }
  
  if(n>ch||k%2==0){
  sort(all(b));
  reverse(all(b));
  
  ll c=0;
  rep(i,k){
    ans=ans*(mint)(b[i].fi);
    c+=b[i].se;  
  }
  
  if(c%2==0) cout<<ans.x<<endl;
  else{
    mint ans1=ans;
    ll ce=1;
    ll che=1;
    per(i,0,k){
      if(b[i].se==1){
        ans/=(mint)(b[i].fi);
        e*=b[i].fi;
        break;
      }
      if(i==0) ce=0;
    }
    
    Rep(i,k,n){
      if(b[i].se==0){
        ans*=(mint)(b[i].fi);
        d*=b[i].fi;
        break;
      }
    }
    
    per(i,0,k){
      if(b[i].se==0){
        ans1/=(mint)(b[i].fi);
        d*=b[i].fi;
        break;
      }
      if(i==0) che=0;
    }
    
    Rep(i,k,n){
      if(b[i].se==1){
        ans1*=(mint)(b[i].fi);
        e*=b[i].fi;
        break;
      }
    }
      
    if(ce==0) cout<<ans1.x<<endl;
    else if(che==0) cout<<ans.x<<endl;
    else if(d<e) cout<<ans1.x<<endl;
    else cout<<ans.x<<endl;
  }
    
  }
  
  
  else{
    sort(all(b));
    rep(i,k){
    ans=ans*(mint)(b[i].fi);
    }
    
    cout<<mod-ans.x<<endl;
  }
  
}
  


Measured memory_bytes: 6328
#include <stdio.h>
#include <stdlib.h>

typedef struct card_
{
    char SHCD;
    int num;
}card;

void cardPrint(card*,card*,int,int);

void cardPrint(card *C,card *C_cp,int n,int flg){
    for(int i=0;i<n;i++)
    {
        if(C[i].num == C[i+1].num && flg == 0)
        {
            for(int j=0;j<n;j++)
            {
                if(C[i].SHCD == C_cp[j].SHCD&&C[i].num==C_cp[j].num)
                {
                    break;
                }else if(C[i+1].SHCD == C_cp[j].SHCD&&C[i+1].num==C_cp[j].num)
                {
                    flg = 1;
                    break;
                }
            }
        }
        if(i != n-1)    printf("%c%d ",C[i].SHCD,C[i].num);
        else printf("%c%d\n",C[i].SHCD,C[i].num);
    }
    if(flg == 1)
    {
        printf("Not stable\n");
    }else
    {
        printf("Stable\n");
    }
}

int main()
{
    int n,nums,flg = 0,minj;
    char SHCDs;
    scanf("%d",&n);
    if(n > 36) return 0;
    card *C = malloc(sizeof(card)*n);
    card *C_cp = malloc(sizeof(card)*n);
    card tmp;
    for(int i = 0;i<n;i++)
    {
        scanf(" %c%d",&SHCDs,&nums);
        C[i].SHCD = SHCDs;
        C[i].num = nums;
        C_cp[i].SHCD = SHCDs;
        C_cp[i].num = nums;
    }
    for(int i = 0;i<n-1;i++)
    {
        for(int j = n-1;j>=i+1;j--)
        {
            if(C[j].num < C[j-1].num)
            {
                tmp = C[j];
                C[j] = C[j-1];
                C[j-1] = tmp;
            }
        }
    }
    cardPrint(C,C_cp,n,flg);
    for(int i=0;i<n;i++)
    {
        C[i] = C_cp[i];
    }
    for(int i = 0;i < n;i++)
    {
        minj = i;
        for(int j = i;j < n;j++)
        {
            if(C[j].num< C[minj].num)
            {
                minj = j;
            }
        }
        tmp = C[i];
        C[i] = C[minj];
        C[minj] = tmp;
    }
    cardPrint(C,C_cp,n,flg);
    free(C_cp);
    free(C);
    return 0;
}


Measured memory_bytes: 2104
#include<stdio.h>
#include<string>
#include<utility>
#include<iostream>
#include<queue>
#include<math.h>
#include<algorithm>
#include<vector>
#include<map>
#include<stack>
#include<bitset>
#include<cmath>
#include <functional>

using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0;i<(int)(n);i++)

ll n,k,v;
std::vector<ll> a;

ll Bisearch(ll ok, ll ng, function<bool(ll)> func){
    while(std::abs(ok-ng)>1){
        //cout << ok << " " << ng << endl;
        ll mid = (ok+ng)/2;
        if(func(mid)) ok = mid;
        else ng = mid;
    }
    return ok;
}

bool solve(ll mid){
    ll cnt = 0;
    for(ll i=0; i<n-1; i++){
        ll y = a[i];
        if(y>0){
            auto func = [&](ll val){return y*val <=  mid; };
            auto iter = std::partition_point(a.begin(), a.end(), func);
            ll j = iter-a.begin() - 1;
            cnt += std::max(0LL, j-i);
        }
        else{
            auto func = [&](ll val){return y*val >  mid; };
            auto iter = std::partition_point(a.begin(), a.end(), func);
            ll j = iter-a.begin();
            if(j<=i)cnt += n-1-i;
            else cnt += n -j;
        }
    }
    if(cnt >= k) return true;
    else return false;
}

int main(){
    cin >> n >> k;
    a.assign(n,0);
    REP(i,n){
        cin>>v;
        a[i]=v;
    }
    sort(a.begin(), a.end());
    cout << Bisearch(1LL<<60, -(1LL<<60), solve) << endl;
    return 0;
}

Measured memory_bytes: 1792
N=int(input())
S=list(input())

dp=[0]*N
dp[0]=S[1:].count("W")
for i in range(1,N):
  dpi=dp[i-1]
  if S[i]=="W":
    dpi-=1
  if S[i-1]=="E":
    dpi+=1
  dp[i]=dpi

print(N-max(dp)-1)


Measured memory_bytes: 17592
#include <iostream>
#include <algorithm>

using namespace std;

int a[3];

int main(){
    cin >> a[0] >> a[1] >> a[2];
    sort(a, a + 3);
    cout << a[0] <<" " << a[1] << " " << a[2] << endl;
    
    return 0;
}


Measured memory_bytes: 3176
# D - String Equivalence 
def dfs(s,m):
    if len(s) == n:
        print(s)
        return 0
    for i in range(m + 1):
        if i < m:
            dfs(s+chr(ord('a')+i),m)
        else:
            dfs(s+chr(ord('a')+i),m+1)

n=int(input())
dfs('', 0)



Measured memory_bytes: 4412
#include <bits/stdc++.h>
#ifdef __DEBUG__
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 1,-1, 1,-1};
int dy[]={0, 1, 0, -1, 1, 1,-1,-1};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const map<T, S> p) { for (auto el : p) cout << "[" << el.first << ";" << el.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const deque<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const set<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

int X,N;
vector<int> P;
map<int,bool> used;
void input(){
    fast_io();
    cin >> X >> N;
    P = fetch_vec<int>(N);
    for(auto p:P) used[p] = true;
}

int solve(){
    sort(P.begin(),P.end());
    for (int i = 0; i < 1000; i++)
    {
        if(!used[X-i]) {cout << X-i << endl; return 0;}
        if(!used[X+i]) {cout << X+i << endl; return 0;}
    }
    
    return 0;
}   

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

Measured memory_bytes: 3664
use std::collections::*;
// use std::io::prelude;
use std::io;
use std::io::Read;
use std::cmp::*;

fn main(){
    let t_cases = 1;
    for _ in 0..t_cases{
        solve();
    }
}

fn solve(){
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    let a = buf
                .trim()
                .split_whitespace()
                .map(|x| x.parse::<usize>().unwrap())
                .collect::<Vec<usize>>();
    let (n,m) = (a[0],a[1]);
    let mut g = vec![vec![];n+1];
    for i in 0..m{
        let mut buf = String::new();
        io::stdin().read_line(&mut buf).unwrap();
        let a = buf
                    .trim()
                    .split_whitespace()
                    .map(|x| x.parse::<usize>().unwrap())
                    .collect::<Vec<usize>>();
        g[a[0]].push(a[1]);
    }
    let mut dp = vec![-1i32;n+1];
    fn dfs(g:& Vec<Vec<usize>>, x:usize,dp:&mut Vec<i32>)->i32{
        if dp[x] != -1{return dp[x];}
        dp[x] = 0;
        for &item in &g[x]{
            dp[x] = max(dfs(g, item, dp)+1,dp[x]);
        }
        return dp[x];
    }
    let mut res = 0;
    for i in 1..(n+1){
        res = max(res, dfs(&g,i,&mut dp));
    }
    println!("{}",res);
}

Measured memory_bytes: 12540
import java.util.*;

public class Main {

    public static void main(String[] args) {

    	Scanner sc = new Scanner(System.in);

    	int X = sc.nextInt();
    	int K = sc.nextInt();

    	for (int i = K-X+1; i <= K+X-1; i++) {
    		if (i >= -1000000 && i <= 1000000){
    			System.out.print(i + " ");
    		}
    	} 
    }
}

Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
#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 pb push_back
using ll = long long;
using P = pair<int, int>;
using Graph = vector<vector<int>>;

int main(){
    int n; cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    deque<int> d;
    rep(i,n){
        int p = lower_bound(ALL(d),a[i]) - d.begin();
        if(p == 0){
            d.push_front(a[i]);
        }else d[p-1] = a[i];
    }
    int ans = d.size();
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
<?php
fscanf(STDIN, "%d", $N);
$divs = [];
$sqrt = sqrt($N);
for ($i = 2; $i < $sqrt; $i++) {
    while(true) {
        if ($N % $i === 0) {
            !isset($divs[$i]) ? $divs[$i] = 1 : $divs[$i]++;
            $N /= $i;
        } else {
            break;
        }
    }
}
if (isPrime($N)) {
    !isset($divs[$N]) ? $divs[$N] = 1 : $divs[$N]++;
}
$ans = 0;
foreach ($divs as $k => $v) {
    $a = 1;
    while(true) {
        if ($v >= $a) {
            $v -= $a;
            $ans++;
            $a++;
        } else {
            break;
        }
    }
}

printf("%d", $ans);

function isPrime($x) {
    $bool = true;
    if ($x === 1) {
        return false;
    }
    for ($i = 2; $i <= sqrt($x); $i++) {
        if ($x % $i === 0) {
            $bool = false;
            break;
        }
    }
    return $bool;
}


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

int main() {
    int a, b;
    cin >> a >> b;
    bool swapped = false;
    if (a > b) {
        swap(a, b);
        swapped = true;
    }
    vector<vector<char>> f(101, vector<char>(101, '.'));
    a--;
    // 3 x 3 の黒い領域, 内部に白を含む: a 個
    // 1 x 1 の黒い領域: b - a 個
    for (int i = 0; i < a; i++) {
        int x = (4 * i + 1) % 100;
        int y = 4 * (i / 25) + 1;
        f[x][y] = '#';
        f[x + 1][y] = '#';
        f[x + 2][y] = '#';
        f[x][y + 1] = '#';
        f[x + 2][y + 1] = '#';
        f[x][y + 2] = '#';
        f[x + 1][y + 2] = '#';
        f[x + 2][y + 2] = '#';
    }
    for (int i = a; i < b; i++) {
        int x = (4 * i + 1) % 100;
        int y = 4 * (i / 25) + 1;
        f[x][y] = '#';
    }
    cout << 100 << ' ' << 100 << endl;
    for (int i = 1; i <= 100; i++) {
        for (int j = 1; j <= 100; j++) {
            if (f[i][j] == '.' and swapped == false) {
                cout << '.';
            } else if (f[i][j] == '#' and swapped == false) {
                cout << '#';
            } else if (f[i][j] == '.' and swapped == true) {
                cout << '#';
            } else {
                cout << '.';
            }
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (n, m) = readLine()!!.split(' ').map(String::toInt)
    val s = readLine()!!.split(' ')
    val t = readLine()!!.split(' ')
    val pre = Array(m + 1) { 1L }
    val sum = Array(m + 1) { 0L }
    sum[0] = 1
    val po = 1000000007
    for (i in 1..n) {
        for (j in 1..m) {
            sum[j] = (if (s[i - 1] == t[j - 1]) sum[j - 1] + pre[j] else sum[j - 1] + pre[j] - pre[j - 1] + po) % po
        }
        for (j in 1..m) {
            pre[j] = sum[j]
        }
    }
    println(sum[m])
}


Measured memory_bytes: 70640
N,M=map(int,input().split())
L_max=0
R_min=10**9
for i in range(M):
  L,R=map(int,input().split())
  L_max=max(L_max,L)
  R_min=min(R_min,R)
print(R_min-L_max+1 if R_min>=L_max else 0)


Measured memory_bytes: 9132
S = input()
T = input()
t = len(T)
if len(S) < t :
    print('UNRESTORABLE')
    exit()
ans = []
for i in range(len(S)-t+1) :
    s = S[i:i+t]
    if all (s[j] == '?' or s[j] == T[j] for j in range(t)) :
        x = (S[:i]+ T + S[i+t:]).replace('?','a')
        ans.append(x)

if ans :
    ans.sort()
    print(ans[0])
else :
    print('UNRESTORABLE')

Measured memory_bytes: 9152
#include<iostream>
#include<cstdio>
#include<vector>
#include<cstring>
#include<cctype>
#include<algorithm>
#define rep(X,Y) for(int X=0;(X)<(Y);++X)
#define X first
#define Y second

using namespace std;

typedef pair<int,int> pii;
typedef pair<int,pii> piii;

int main(){
  int t,p,r;
  while(cin>>t>>p>>r,t){
    int sum[t][p];
    vector<piii> re(t);
    memset(sum,0,sizeof(sum));
    int a,b,c;
    string str;
    rep(i,r){
      cin>>a>>b>>c>>str;
      --a; --b;
      if(str[0]=='C'){
	++re[a].X;
	re[a].Y.X+=sum[a][b]+c;
      }else{
	sum[a][b]+=1200;
      }
    }
    rep(i,t){
      re[i].X*=-1;
      re[i].Y.Y=i;
    }
    sort(re.begin(),re.end());
    rep(i,t)
      cout<<re[i].Y.Y+1<<" "<<-re[i].X<<" "<<re[i].Y.X<<endl;
  }
}

Measured memory_bytes: 1220
#include <iostream>

int main()
{
    int k, s;
    int x, y, z;

    std::cin >> k >> s;
    int counter = 0;
    for (int x=0; x<=k; ++x)
    {
        for (int y=0; y<=k; ++y)
        {
            counter = (s - x - y <= k && s - x - y >= 0) ? counter+1 : counter;
        }
    }

    std::cout << counter;
}


Measured memory_bytes: 256
n = int(input())
s = input()

alph = "0123456789"
next_ = [[-1] * (n + 1) for i in range(len(alph))]
for ai in range(len(alph)):
    tmp = - 1
    for si in range(n)[::-1]:
        if s[si] == alph[ai]:
            tmp = si + 1
        next_[ai][si] = tmp

ans = 0
for i in range(10):
    for j in range(10):
        for k in range(10):
            tmp = next_[i][0]
            tmp = next_[j][tmp]
            tmp = next_[k][tmp]
            if tmp != -1:
                ans += 1
print(ans)

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

int main () {
  string n;
  cin >> n;
  n[5] = ' ', n[13] = ' ';
  cout << n << endl; 
}


Measured memory_bytes: 256
// AOJ 1204: Pipeline Scheduling
// 2017.12.4 bal4u@uu

#include <stdio.h>
#include <string.h>

int a[22];
int n, f;

int calc(int s, int k)
{
	int i, t, ans;

	if (k == 10) return n;
	ans = 0x7fffff;
	for (i = 1; i < n; i++) {
		if (!((s >> i) & 1)) {
			t = calc((s >> i) | f, k+1) + i;
			if (t < ans) ans = t;
		}
	}
	return ans;
}


int main()
{
	int i, j;
	char buf[22];

	while (scanf("%d", &n) && n > 0) {
		memset(a, 0, sizeof(a));
		for (i = 0; i < 5; i++) {
			scanf("%s", buf);
			for (j = 0; j < n; j++) {
				if (buf[j] == 'X') a[j] = i;
			}
		}
		f = 0;
		for (i = 1; i < n; i++) for (j = 0; j < i; j++) {
			if (a[i] == a[j]) f |= 1 << (i-j);
		}
		printf("%d\n", calc(f, 1));
	}
	return 0;
}

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

using namespace std;

int ans;
int main(){
	string s;
	cin >> s;
	if(s == "SUN") cout << 7;
	if(s == "MON") cout << 6;
	if(s == "TUE") cout << 5;
	if(s == "WED") cout << 4;
	if(s == "THU") cout << 3;
	if(s == "FRI") cout << 2;
	if(s == "SAT") cout << 1;

}

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

int main() {
    long a, b, k;
    cin >> a >> b >> k;

    if (a + b < k){
        cout << 0 << " " << 0 << endl;
        return 0;
    }
    else if(a < k){
        cout << 0 << " " << a + b - k << endl;
        return 0;

    }
    else{
        cout << a-k << " " << b << endl;
        return 0;
    }
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
  unsigned long int n,N,A1=0,A2=0,sum = 0;
  //input
  scanf("%lu",&N);
  for(n=0;n<N;n++)
  {
  	scanf("%lu",&A2);
    if(A1>A2)
    {
      sum = sum + A1-A2;
    }else{
    	A1 = A2;
    }
    //printf("%lu\n",A1);
  }
  //output
	printf("%lu",sum);
  return 0;
}

Measured memory_bytes: 1692
#include <stdio.h>

int N(int n){
  return n*(n+1)*(n+2)/6;
}

main(){
  int i,j,n,fx[1000000],d=1,min,fy[1000000];

  fx[0] = 0;
  fy[0] = 0;
  for(i=1;i<1000000;i++){
    if(i == N(d+1)) d++;

    min = -1;
    for(j=1;j<=d;j++){
      if(min == -1 || fx[i-N(j)]+1 < min) min = fx[i-N(j)]+1;
    }
    fx[i] = min;

    min = -1;
    for(j=1;j<=d;j++){
      if(N(j)%2 == 0) continue;
      else if(min == -1 || fy[i-N(j)]+1 < min) min = fy[i-N(j)]+1;
    }
    fy[i] = min;
  }


  while(1){
    scanf("%d",&n);
    if(n==0) break;
    printf("%d %d\n",fx[n],fy[n]);

  }
  return 0;
}

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

int main(){
  string s;
  cin >> s;
  int c[] = {0,0};
  for(size_t i = 0; i < s.length(); ++i){
    if((s[i]-'0')==i%2) ++c[1];
    else ++c[0];
  }
  cout << min(c[0],c[1]) << endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
 
//DEFINE and TYPEDEF--------------------------------------------------------------
 
#define FORG(i,a,n) for(lld i=a;i<n;i++) //for - general
#define FORZ(i,n) for(lld i=0;i<n;i++) //for - zero
#define FORGI(i,a,n,inc) for(lld i=a;i<n;i+=inc) //for - general incremental
#define FORZI(i,n,inc) for(lld i=0;i<n;i+=inc) //for - zero incremental
#define DEBUG(x) cout<<(#x)<<" is "<<(x)<<endl //to debug values of variables
#define ZINDA cout<<"\nIdhar-ich hai apun!!\n"; //to debug if code reached that point
#define SPEEDUP ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
 
#define SORTall(m) sort(m.begin(),m.end());
 
#define st first
#define nd second
#define pb push_back
#define mod 1000000007
 
typedef long long int lld;
typedef unsigned long long int ulld;
 
lld power(lld b, lld e)
{
	if(e==0)
		return 1;
	if(e%2==1)
		return b*power(b*b,(e-1)/2);
	else
		return power(b*b,e/2);
}
 
int nDig(lld n)
{
	return floor(log10(n) + 1);
}

//--------------------------------------------------------------------------------
 
int main()
{
    SPEEDUP;
    lld n,k,sum=0;
    cin>>n>>k;

    lld h[n];
    FORZ(i,n)
    {
    	cin>>h[i];
    }

    sort(h,h+n);
    for(int i=n-k-1;i>=0;i--)
    {
    	sum+=h[i];
    }

    cout<<sum;

    return 0;
}

Measured memory_bytes: 1792
import numpy as np
from functools import lru_cache

N,K = map(int,input().split())
A = np.array(input().split(),dtype=np.int64)

bit_cnt = [((A>>k)&1).sum() for k in range(50)]

@lru_cache(maxsize = None)
def F(K,k = 49):
  # K以下、k-bit目まで見た(inclusive)の和、最大値
  if k == -1:
    return 0
  bit = 1<<k
  # k-bitを使う
  x = 0
  if K >= bit:
    x = ((N-bit_cnt[k])<<k) + F(K-bit,k-1)
  # k-bitを使わない
  y = (bit_cnt[k]<<k) + F(min(K,bit-1),k-1)
  return max(x,y)

answer = F(K)
print(answer)


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
using ll = long long;


int main() {
	double n= 0,k =0,tmp = 0.5;
	double ans = 0;
	cin >> n >> k;
	double up = ceil(log2(k));
	vector<double>table;
	table.push_back(1);
	rep(i, up) {
		table.push_back(tmp);
		tmp *= 0.5;
	}
	for (double i = 1; i <= n; i++) {
		ans += (1 / n) * table[ceil(log2((k > i)?k/i:1))];
	}
	cout << fixed << setprecision(12) << ans << endl;

	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        String S = sc.next();
        String preS = "";
        int r = 0;
        for (char s:
             S.toCharArray()) {
            String curS = String.valueOf(s);
            if (!preS.equals(curS)) {
                preS = curS;
                r++;
            }
        }

        System.out.println(r);
    }
}

Measured memory_bytes: 30512
S = input()
N= len(S)
mod = 10 ** 9 + 7

A1, A2, C1, C2 = [1]*N, [1]*N, [1]*N, [1]*N
a, aa = 0, 0
c, cc = 0, 0
for i in range(1,N):
    if S[i-1] == "A":
        a += 1
    elif S[i-1] == "?":
        aa += 1
    A1[i] = a
    A2[i] = aa

for i in range(1,N):
    if S[N-1-i+1] == "C":
        c += 1
    elif S[N-1-i+1] == "?":
        cc +=1
    C1[N-1-i] = c
    C2[N-1-i] = cc

answer = 0
for i in range(1,N-1):
    if S[i] in ("B", "?"):
        ta = 0
        tc = 0
        if A2[i] == 0:
            ta = A1[i]
        else:
            ta = pow(3, A2[i], mod)*A1[i] +  pow(3,A2[i]-1,mod)*A2[i]
        if C2[i]==0:
            tc = C1[i]
        else:
            tc = pow(3,C2[i],mod)*C1[i] + pow(3,C2[i]-1,mod)*C2[i]
        answer += ta*tc
        answer %= mod


print(answer)

Measured memory_bytes: 12628
// This file is a "Hello, world!" in C++ language by GCC for wandbox.
#include <iostream>
#include <cstdlib>
#include <bits/stdc++.h>
#include<algorithm>
using namespace std;
int main(){
    long long int n,a,b,c,m,k,ans=0;
    cin >> n >> a >> b;
    c=n%(a+b);
    m=n-c;
    k=m/(a+b);
    ans=k*a;
    if(c>=a)
    {
        ans+=a;
    }
    else
    {
        ans+=c;
    }
    

    

    cout << ans << endl;

}


Measured memory_bytes: 3596
#include <iostream>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>

#define _GLIBCXX_DEBUG
#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
using namespace std;
using vi = vector<int64_t>;
using vvi = vector<vi>;

int main(int argc, const char * argv[]) {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    int64_t a,b,x;
    cin >> a >> b >> x;
    cout << (b/x - (a+x-1)/x + 1) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MOD 1000000007
#define mp make_pair
#define ll long long
#define pb push_back
#define faster ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define debug cout<<"Debugging.."<<endl
using namespace std;
int main()
{
	faster;

	string s;
	cin>>s;
	int c=0,ma=0;
	char prev=NULL;
	for(auto i:s)
	{
		//cout<<i<<endl;
		if(i=='R')
		{
			c++;
			ma=max(ma,c);
		}
		else
		c=0;
	}
	cout<<ma<<endl;
}





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

typedef long long ll;
const ll INF = 1e18;
const int BIG = 1e9 + 555;
const int maxN = 1e5 + 55;

ll L;
ll a[maxN];
int n;

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

	cin >> n >> L;

	for(int i = 1; i <= n; i++){
		cin >> a[i];
	}
	
	int id = -1;
	for(int i = 1; i + 1 <= n; i++){
		if(a[i] + a[i + 1] >= L){
			id = i;
			break;
		}
	}
	
	if(id == -1){
		cout << "Impossible\n";
		return 0;
	}

	cout << "Possible\n";

	for(int i = 1; i + 1 <= id; i++){
		cout << i << '\n';
	}

	for(int i = n - 1; i > id; i--){
		cout << i << '\n';
	}

	cout << id << '\n';

	return 0;
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
#define REP(i,a,b) for(int (i)=(a);(i)<(int)(b);(i)++)
#define RREP(i,a,b) for(int (i)=(a);(i)>=(int)(b);(i)--)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;



int main(){
    string s;
    cin >> s;
    int n = s.size();

    int cnt = 0;
    REP(i,1,n) if (s[i - 1] != s[i]) cnt++;
    cout << cnt << endl;
    
    return 0;
}

Measured memory_bytes: 512
import math  # noqa
import bisect  # noqa
import queue  # noqa


if __name__ == '__main__':
    N, M = map(int, input().split())
    A = [[a for a in input()] for _ in range(N)]
    B = [[b for b in input()] for _ in range(M)]

    ans = False
    for i in range(0, N - M + 1):
        for j in range(0, N - M + 1):
            res = True
            for k in range(0, M):
                for l in range(0, M):
                    if A[i + k][j + l] != B[k][l]:
                        res = False
            if res:
                ans = True
                break

    if ans:
        print("Yes")
    else:
        print("No")


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

public class Main {

	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int d[] = new int[n];

		//ABC < K    k <= ARC

		for(int i = 0; i < n; i++)
			d[i] = in.nextInt();

		Arrays.sort(d);

		int hrf = d.length/2-1;

		if(d[hrf] == d[hrf+1]) {
			System.out.println(0);
			return;
		}

		int ans = d[hrf+1] - d[hrf];


		System.out.println(ans);
	}

}

Measured memory_bytes: 50676
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define inf (int)(1e18)

signed main(){
	int N, i;
	scanf("%lld", &N);
	vector<int> A(N);
	int sum = 0;
	for(i = 0; i < N; i++){
		scanf("%lld", &A[i]);
		sum += A[i];
	}
	int now = 0, ans = inf;
	for(i = 1; i < N; i++){
		now += A[i - 1];
		ans = min(ans, abs(2 * now - sum));
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>

void print_rect(int h, int w)
{
    for (int i = 0; i < h; i++)
    {
        for (int j = 0; j < w; j++)
        {
            printf("#");
        }
        printf("\n");
    }
    printf("\n");
}
int main()
{
    while (true)
    {
        int h, w;
        scanf("%d %d", &h, &w);
        if (h == 0 && w == 0)
            break;

        print_rect(h, w);
    }
    return 0;
}


Measured memory_bytes: 2696
#include <stdio.h>
#define MAX 100000

int A[MAX], n;

int partition(int p, int r) {
  int x, i, j, t;
  x = A[r];
  i = p-1;
  for(j=p; j<r; j++) {
    if(A[j] <= x) {
      i++;
      t=A[i]; A[i]=A[j]; A[j]=t;
    }
  }
  t=A[i+1]; A[i+1]=A[r]; A[r]=t;
  return i+1;
}

int main(void) {
  int i, q;

  scanf("%d", &n);
  for(i=0; i<n; i++) scanf("%d",&A[i]);
  q = partition(0,n-1);

  for(i=0; i<n; i++) {
    if(i) printf(" ");
    if(i==q) printf("[");
    printf("%d",A[i]);
    if(i==q) printf("]");
  }
  printf("\n");

  return 0;
}

Measured memory_bytes: 2956
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define show(x) cout<<x<<'\n'
#define showh(x) cout<<x<<' '
#define go(i,a,n) for(ll i=a;i<n;i++)
#define gor(i,a,n) for(ll i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define mod 1000000007
bool prime[100001];
bool ispoweroftwo(ll x)
{
    return x && !(x & (x-1));
}
ll xorcal(ll n)
{
    if(n%4==0)
        return n;
    if(n%4==1)
        return 1;
    if(n%4==2)
        return n+1;
    if(n%4==3)
        return 0;
}
void sieve(ll n)
{
    memset(prime,true,sizeof(prime));
    prime[0]=false;
    prime[1]=false;
    for(ll i=2;i*i<=n;i++)
    {
        if(prime[i]==true)
        {
            for(ll j=i*i;j<=n;j+=i)
            {
                prime[j]=false;
            }
        }
    }
    show(prime[89]);
}
bool isprime(ll n)
{
    if (n<=1) return false;
    if (n<=3) return true;

    if(n%2==0 or n%3==0) return false;

    for(ll i=5;i*i<=n;i+=6)
    {
        if(n%i==0 or n%(i+2)==0) return false;
    }
    return true;
}

ll modinverse(ll a,ll m)
{
    ll m0 = m;
    ll y = 0, x = 1;

    if (m == 1)
      return 0;

    while (a > 1)
    {
        ll q = a / m;
        ll t = m;

        m = a % m; a = t;
        t = y;

        y = x - q * y;
        x = t;
    }

    if (x < 0)
       x += m0;

    return x;
}

ll gcd(ll a,ll b)
{
    if(a==0)
    {
        return b;
    }
    return(b%a,a);
}

ll power(ll A, ll B)
{
    if (A == 0)
        return 0;
    if (B == 0)
        return 1;

    ll y;
    if (B % 2 == 0) {
        y = power(A, B / 2);
        y = (y * y) % mod;
    }

    else {
        y = A % mod;
        y = (y * power(A, B - 1) % mod) % mod;
    }

    return (ll)((y + mod) % mod);
}
int main()
{
    ios_base::sync_with_stdio(false);
    ll n;
    cin>>n;
    n--;
    show((n*(n+1))/2);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007 
#define ff first
#define ss second
typedef long long ll;
ll power(ll a, ll b){//a^b
    ll res=1;
    a=a%MOD;
    while(b>0){
        if(b&1){res=(res*a)%MOD;b--;}
        a=(a*a)%MOD;
        b>>=1;
    }
    return res;
}
ll fermat_inv(ll y){return power(y,MOD-2);}
ll gcd(ll a, ll b){return (b==0)?a:gcd(b,a%b);}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t=1;
    //cin>>t;
    while(t--){
        long double a,b;
        cin>>a>>b;
        long double c;
        c=a*b;
        ll ans=c;
        cout<<ans<<"\n";
    }
    return 0;
}

Measured memory_bytes: 3744
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;cin>>n;
  vector<int> L;
  for(int i=0; i<n; i++){
    int b;
    cin>>b;
    L.push_back(b);
  }
  sort(L.begin(), L.end());
  
  /*
  for(int x: L){
    cout<<x<<",";
  }cout<<endl;
  //*/

  int s = L.size();
  int ans = 0;
  for(int longL=s-1; longL>1; longL--)for(int middleL=longL-1; middleL>0; middleL--){
    auto itr = lower_bound(L.begin(), L.end(), L[longL]-L[middleL]+1);
    int d = distance(L.begin(), itr);
    int ok = max(0, middleL-d);
    //cout<<"mid "<<L[middleL]<<" long "<<L[longL]<<" ok "<< ok <<endl;
    ans += ok;
  }
  cout<<ans<<endl;
}

/*test
9
1 2 3 4 5 6 7 8 9

34
*/

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


int main()
{
	int N; cin >> N;
	int bkt[10001];
	memset(bkt, 0, sizeof(bkt));
	vector<int> x, y, z;
	for (int ix = 1; ix < 101; ++ix) {
		for (int iy = 1; iy < 101; ++iy) {
			for (int iz = 1; iz < 101; ++iz) {
				int n = ix * ix + iy * iy + iz * iz + ix * iy + iy * iz + iz * ix;
				if (n <= 10000) ++bkt[n];
			}
		}
	}
	for (int i = 1; i <= N; ++i) {
		cout << bkt[i] << endl;
	}
	return 0;
}


Measured memory_bytes: 3120