akhauriyash/Code-Regression huggingface dataset:
#include"bits/stdc++.h"

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

int main() {
	int x1, y1,x2, y2;
	cin >> x1 >> y1 >> x2 >> y2;
	int dx = x2 - x1, dy = y2 - y1;

	int x3 = x2 - dy, y3 = y2 + dx;
	int x4 = x3 - dx,y4 = y3 - dy;
	cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;
	return 0;
}


Measured memory_bytes: 3644
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <string>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
#include <set>
#include <functional>
#include <iostream>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n;
int len[50002];
int res[50002];
int main(void){
	scanf("%d",&n);
	memset(len,0,sizeof(len));
	memset(res,0,sizeof(res));
	int maxi=0;
	int one=0;
	for(int i=2;i<=n;i++){
		printf("? %d %d\n",1,i);
		fflush(stdout);
		scanf("%d",&len[i]);
		maxi=max(maxi,len[i]);
		if(maxi==len[i])one=i;
	}
	res[maxi]=1;
	if(n!=1)res[0]=one;
	for(int i=2;i<=n;i++){
		if(i==one)continue;
		printf("? %d %d\n",one,i);
		fflush(stdout);
		int g;
		scanf("%d",&g);
		res[g]=i;
	}
	printf("! ");
	for(int i=0;i<n;i++){
		printf("%d%c",res[i],i+1==n?'\n':' ');
	}
	fflush(stdout);
	return 0;
}

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

#define FOR(s, i, n) for(int i = s; i n; i++)
typedef long long ll;
const int INF = 1e9;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	
	ll n;
	cin>>n;
	string ans;
	while (n > 0){
		n--;
		ans.push_back('a' + n%26);
		n/=26;
	}
	reverse(ans.begin(), ans.end());
	cout<<ans<<'\n';
	return 0;
}

Measured memory_bytes: 3652
import java.util.Scanner;

class Main
{
	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in).useDelimiter("[,\\n]");
		
		int w = sc.nextInt();
		int lines[] = new int[w];
		for (int i = 0; i < w; i++)
		{
			lines[i] = i;
		}
		int n = sc.nextInt();
		for (int i = 0; i < n; i++)
		{
			int a = sc.nextInt() - 1;
			int b = sc.nextInt() - 1;
			int tmp = lines[a];
			lines[a] = lines[b];
			lines[b] = tmp;
		}
		for (int i = 0; i < w; i++)
		{
			System.out.println(Integer.toString(lines[i] + 1));
		}
	}
}

Measured memory_bytes: 12000
#include<bits/stdc++.h>
#define FORD(i,a,b) for(int i=(a);i>=b;i--)
#define FOR(i,a,b) for(long long i=(a);(i)<(b);(i)++)
#define ll long long
using namespace std;
ll a[405][405],ans;
ll search(ll f) {
	while(f!=0) {
		if(f/10==0) return f;
		f/=10;
	} 
}
int main() {
	ll n;
	cin>>n;
	FOR(i,1,n+1) a[i%10][search(i)]++;
	FOR(i,1,10) FOR(j,1,10)
		ans+=a[i][j]*a[j][i];
	cout<<ans;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#define min(x, y) ((x) < (y) ? (x) : (y))
#define INF (1<<28)
int n, m, a, b, cost, time, costs[105][106], times[104][103], p, q, r, i, j, k;
 
int main(){
  while(1){
    scanf("%d%d", &n, &m);
    if(n == 0 && m == 0)return 0;
    for(i = 1;i <= m;i++){
      for(j = 1;j <= m;j++){
    times[i][j] = INF;
    costs[i][j] = INF;
      }
    }
    for(i = 0;i < n;i++){
      scanf("%d%d%d%d", &a, &b, &cost, &time);
      costs[a][b] = costs[b][a] = cost;
      times[a][b] = times[b][a] = time;
    }
    for(k = 1;k <= m;k++){
      for(i = 1;i <= m;i++){
    for(j = 1;j <= m;j++){
      costs[i][j] = costs[j][i] = min(costs[i][j], costs[i][k] + costs[k][j]);
      times[i][j] = times[j][i] = min(times[i][j], times[i][k] + times[k][j]);
    }
      }
    }
     
    scanf("%d", &k);
    for(i = 0;i < k;i++){
      scanf("%d%d%d", &p, &q, &r);
      if(r == 0){
    printf("%d\n", costs[p][q]);
      }
      if(r == 1){
    printf("%d\n", times[p][q]);
      }
    }
  }
}

Measured memory_bytes: 684
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
const ll mod=1000000007;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
// head

int k,n,b[1010][1010];
int main() {
	scanf("%d",&k);
	n=(k+1)/2;
	while (n%2!=0) n++;
	int w=2*n-k,c=0;
	if (k==1) n=1;
	printf("%d\n",n);
	for (int i=0;i<n;i++) {
		int th=(i<w)?1:2;
		for (int j=0;j<n;j++) b[j][(i+j)%n]=c+min(j%2,th-1);
		c+=th;
	}

	for (int i=0;i<n;i++) {
		for (int j=0;j<n;j++) printf("%d ",b[i][j]+1);
		puts("");
	}
}


Measured memory_bytes: 3200
x1, y1, x2, y2 = [int(i) for i in input().split()]
x3 = x2 - (y2 - y1)
y3 = y2 + (x2 - x1)
x4 = x1 - (y2 - y1)
y4 = y1 + (x2 - x1)
print(x3, y3, x4, y4)

Measured memory_bytes: 2940
N, M = map(int, input().split())
inf = 10**6
abc = []
d = [[inf]*N for i in range(N)]
for i in range(M):
	a, b, c = map(int, input().split())
	d[a-1][b-1] = c
	d[b-1][a-1] = c
	abc.append((a-1,b-1,c))

for k in range(N):
	for i in range(N):
		for j in range(N):
			d[i][j] = min(d[i][k]+d[k][j], d[i][j])
ans = 0
for i in range(M):
	a, b, c = abc[i]
	if d[a][b] < inf and d[a][b] < c:
		ans += 1
print(ans)

Measured memory_bytes: 3444
#include <cstdio>
#include <cstdint>
#include <vector>
#include <algorithm>
#include <utility>
#include <functional>

std::vector<size_t> make_vector(size_t n, size_t x) {
  return std::vector<size_t>(n, x);
}

template <class Tp>
std::vector<Tp> make_vector(size_t n, const Tp& x) {
  return std::vector<Tp>(n, x);
}

template <class... Ts>
auto make_vector(size_t n, size_t m, const Ts&... x) {
  return std::vector<decltype(make_vector(m, x...))>(n, make_vector(m, x...));
}

template <class Weight>
struct edge {
  using value_type = Weight;
  size_t src, dst;
  value_type cost;

  edge(size_t src, size_t dst, value_type cost=1):
    src(src), dst(dst), cost(cost)
  {}

  bool operator <(const edge<value_type> &rhs) const {
    if (cost != rhs.cost) return cost < rhs.cost;
    if (src != rhs.src) return src < rhs.src;
    return dst < rhs.dst;
  }
};

template <class Weight>
struct graph: public std::vector<std::vector<edge<Weight>>> {
  using value_type = Weight;
  graph(size_t n): std::vector<std::vector<edge<value_type>>>(n) {}

  void connect_with(size_t src, size_t dst, value_type cost=1) {
    (*this)[src].emplace_back(src, dst, cost);
    (*this)[dst].emplace_back(dst, src, cost);
  }
};

constexpr intmax_t mod = 1e9+7;

template <class Weight>
intmax_t nyan(const graph<Weight>& g) {
  size_t N = g.size();
  auto dp = make_vector(2, N, intmax_t(1));

  std::function<void (size_t, size_t)> dfs = [&](size_t v, size_t p) {
    for (const auto& e: g[v]) {
      size_t u = e.dst;
      if (u == p) continue;
      dfs(u, v);
      (dp[0][v] *= dp[0][u] + dp[1][u]) %= mod;
      (dp[1][v] *= dp[0][u]) %= mod;
    }
  };

  dfs(0, -1);
  return (dp[0][0] + dp[1][0]) % mod;
}

int main() {
  size_t N;
  scanf("%zu", &N);

  graph<int> g(N);
  for (size_t i = 1; i < N; ++i) {
    size_t x, y;
    scanf("%zu %zu", &x, &y);
    --x;
    --y;
    g.connect_with(x, y);
  }

  printf("%jd\n", nyan(g));
}


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

#define MAX 10000
#define NIL -1

// left-child, right-sibling representation
// each element represents node number
struct Node {
	int parent, left, right;
};

Node Tree[MAX];
int n_node;

#if LOCAL
// Split Function
vector<int> split_int(string input,char del){
    vector<int> output;
    string substr;
    for(const char c : input){
        if(c == del){
          output.push_back(atoi(substr.c_str()));
          substr.clear();
        } else {
          substr += c;
        }
    }
    output.push_back(atoi(substr.c_str()));
    return output;
}

vector<string> split_str(string input,char del){
    vector<string> output;
    string substr;
    for(const char c : input){
        if(c == del){
          output.push_back(substr);
          substr.clear();
        } else {
          substr += c;
        }
    }
    output.push_back(substr);
    return output;
}
#endif


void preParse(int root)
{
	if (root == NIL) {
		return;
	}
	cout << " " << root;
	preParse(Tree[root].left);
	preParse(Tree[root].right);
}

void inParse(int root)
{
	if (root == NIL) {
		return;
	}
	inParse(Tree[root].left);
	cout << " " << root;
	inParse(Tree[root].right);
}

void postParse(int root)
{
	if (root == NIL) {
		return;
	}
	postParse(Tree[root].left);
	postParse(Tree[root].right);
	cout << " " << root;
}

int main() {
	int id_node, n_node, right, left;
	scanf("%d", &n_node);
	for (int i = 0; i < n_node; i++) {
        Tree[i].parent = NIL;
    }

#if LOCAL
	// for local test
	vector<string> input = {"0 1 4", "1 2 3", "2 -1 -1",
	 						"3 -1 -1", "4 5 8", "5 6 7",
							"6 -1 -1", "7 -1 -1", "8 -1 -1"};
	// input for local test
	vector<int> vec_tmp;
    for (int i = 0; i < n_node; i++) {
        vec_tmp = split_int(input[i], ' ');
        id_node = vec_tmp[0]; // v
        left = vec_tmp[1]; //l
		right = vec_tmp[2]; // r
		Tree[id_node].left = left;
		Tree[id_node].right = right;
		if (left != NIL) Tree[left].parent = id_node;
		if (right != NIL) Tree[right].parent = id_node;
    }
#endif

#ifndef LOCAL
	// for online test
    for (int i = 0; i < n_node; i++) {
		scanf("%d %d %d", &id_node, &left, &right);
        Tree[id_node].left = left;
		Tree[id_node].right = right;
		if (left != NIL) Tree[left].parent = id_node;
		if (right != NIL) Tree[right].parent = id_node;
    }
#endif

    int root = 0;
    for (int i = 0; i < n_node; i++) {
        if (Tree[i].parent == NIL) {
            root = i;
        }
    }

    cout << "Preorder" << '\n';
	preParse(root);
	cout << '\n';
	cout << "Inorder" << '\n';
	inParse(root);
	cout << '\n';
	cout << "Postorder" << '\n';
	postParse(root);
	cout << '\n';

    return 0;
}



Measured memory_bytes: 3244
s = input()

a, b = s.split()
if a.isdigit():
  a = int(a)
else:
  a = ord(a) - 50

if b.isdigit():
  b = int(b)
else:
  b = ord(b) - 50

if a < b:
  print("<")
elif a > b:
  print(">")
else:
  print("=")

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

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

    // (a-1) * n > b -1
    if((b-1)%(a-1)==0)
        cout<< (b-1) / (a-1);
    else{
        int n = (b-1) / (a-1);
        cout << n+1;
    }
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int a, b, c;
	scanf("%d %d %d", &a, &b, &c);
	int v1, v2, v3;
	if(a < b && a < c)
	{
		v1 = a;
	} else if(b < a && b < c)
	{
		v1 = b;
	} else if(c < b && c < a)
	{
		v1 = c;
	}
	if(a > b && a > c)
	{
		v3 = a;
	} else if(b > a && b > c)
	{
		v3 = b;
	} else if(c > b && c > a)
	{
		v3 = c;
	}
	if((v1 == a && v3 == b) || (v3 == a && v1 == b) )
	{
		v2 = c;
	} else if((v1 == b && v3 == c) || (v3 == b && v1 == c ))
	{
		v2 = a;
	} else if((v1 == a && v3 == c) || (v3 == a && v1 == c ))
	{
		v2 = b;
	}
	printf("%d %d %d\n", v1, v2, v3);
	return 0;
}

Measured memory_bytes: 2732
N, P = map(int, input().split())
S = input()
 
ans = 0
if P == 2 or P == 5:
	for i in range(N):
		if int(S[i]) % P == 0:
			ans += i+1
else:
	t = [0] * 20000
	t[0] = 1
	now = 0
	po = 1
	for i in range(N):
		n = N - i - 1
		now = (int(S[n]) * po + now) % P
		po = 10 * po % P
		ans += t[now]
		t[now] += 1
print(ans)

Measured memory_bytes: 41436
#include <iostream>
#include<stdio.h>
#include <iomanip>
using namespace std;
int main (){
	double r,s,e;
	cin>>r;
	s=r*r*3.141592653589;
	e=2*3.141592653589*r;
	cout<<fixed<<std :: setprecision(6)<<s<<" "<<fixed<<std :: setprecision(6)<<e<<endl;
return 0;
}


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

void print(char rooms[][3][10]) {
    for(int j=0;j<3;j++) {
        for(int k=0;k<10;k++) {
            cout << " " << +rooms[0][j][k];
        }
        cout << endl;
    }
    for(int i=1;i<4;i++) {
        cout << "####################" << endl;
        for(int j=0;j<3;j++) {
            for(int k=0;k<10;k++) {
                cout << " " << +rooms[i][j][k];
            }
            cout << endl;
        }
    }
}

int main() {
    int n, b, f, r, v;
    char rooms[4][3][10];
    for(int i=0;i<4;i++)for(int j=0;j<3;j++)for(int k=0;k<10;k++) rooms[i][j][k] = 0;
    cin >> n;
    for(int i=0;i<n;i++) {
        cin >> b >> f >> r >> v;
        rooms[b-1][f-1][r-1] += v;
    }
    print(rooms);
    return 0;
}


Measured memory_bytes: 3104
a1,a2,a3 = map(int, input().split())
a4,a5,a6 = map(int, input().split())
a7,a8,a9 = map(int, input().split())
n = int(input())
b = [int(input()) for i in range(n)]
a = [a1,a2,a3,a4,a5,a6,a7,a8,a9]
for i in range(9):
    if a[i] in b:
        a[i] = 0
if a[0:3] ==[0,0,0] or a[3:6] ==[0,0,0] or a[6:9] ==[0,0,0] or [a[0],a[3],a[6]] ==[0,0,0] or [a[1],a[4],a[7]]==[0,0,0] or [a[2],a[5],a[8]]==[0,0,0] or [a[0],a[4],a[8]]==[0,0,0] or [a[2],a[4],a[6]]==[0,0,0]:
    print('Yes')
else:
    print('No')

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

#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
// #define int long long
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using ul = unsigned long;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { return a * b / GCD(a, b); }

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  
  string s,t; cin>>s>>t;
  int n=sz(s);
  int m=sz(t);
  vvi c(26);
  rep(i,n) c[s[i]-'a'].push_back(i);
  rep(i,n) c[s[i]-'a'].push_back(i+n);
  
  int p=0;
  ll ans=0;
  rep(i,m){
    if(sz(c[t[i]-'a'])==0){
      cout<<-1<<endl;
      return 0;
    }
    p = *lower_bound(all(c[t[i]-'a']),p)+1;
    if(p>=n){
      p-=n;
      ans+=n;
    }
  }
  cout<<ans+p<<endl;
}


Measured memory_bytes: 1736
#include<stdio.h>
int main(void){
	int n,i,x=0;
	char s[10000];
	scanf("%d",&n);
	scanf("%s",&s);
	for(i=0;i<n;i++){
		if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C'){
			x+=1;
		}
	}
	printf("%d\n",x);	
}

Measured memory_bytes: 128
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <queue>
#include <string>

using namespace std;

static int a, b;
int solve();

int solve() {
  int c = b - a;
  int h1 = (c - 1) * c / 2;
  return h1 - a;
}

int main() {
  cin >> a >> b;
  cout << solve() << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const ll inf = numeric_limits<ll>::max()/3;
const ll mod = 1e9+7;

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

int main(void){
  int n;
  ll start, x;
  ll d;
  cin >> n >> start;
  cin >> x;
  d = (ll)abs(x - start);
  for(int i = 0;i < n-1;++i){
    cin >> x;
    ll dist = (ll)abs(x - start);
    d = gcd(d,dist);
  }
  cout << d << endl;
  return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<map>
#define int long long int

using namespace std;

signed main(){

    int N, i, MaX = 0, count = 0;
    int H[200];


    cin >> N;
    for(i = 0; i < N; i++){
        cin >> H[i];

        if(H[i] >= MaX){
            MaX = H[i];
            count++;
        }
    }

    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;


int main()
{
    ll n;
    string s;
    cin >> n >> s;
    ll count = 0;
    FOR(i, 1, n) {
        string x = s.substr(0, i);
        sort(ALL(x));
        string y = s.substr(i, n - i);
        sort(ALL(y));
        set<char> set_x(ALL(x));
        set<char> set_y(ALL(y));
        vector<char> vec;
        for (auto& elem : set_x) {
            if (set_y.find(elem) != set_y.end()) {
                vec.push_back(elem);
            }
        }
        count = vec.size() > count ? vec.size() : count;
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll ;
const int MAX = 1e6 + 10;
ll n , p ;
bool done[MAX];
vector < ll > pr;
void build(){

    done[0] = done[1] = true;
    for(int i = 2 ; i < MAX ; ++i)
        if(!done[i]){
            pr.push_back(i);
            for(int j = i + i ; j < MAX ; j += i)
                    done[j] = true;
        }

}

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

   cin >> n >> p ;

   if(n == 1)
    return cout << p << '\n' , 0;
   build();

   ll ans =  1;
   for(int i = 0 ; i < (int)pr.size() ; ++i){
        int nb = 0 ;
        while(p%pr[i] == 0)
            ++nb , p/=pr[i];
        ans *= pow((ll)pr[i],(ll)nb/n);
   }


   cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 2424
//Author: kaiyu
#include <iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <set>
#include <unordered_map>
#include <cstring>
#include <string>
#include <queue>
#include <stack>
#include <numeric>
#include <iomanip>
#define SZ(x) ((int)(x).size())
#define all(x)  x.begin(),x.end()
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define tt int t;cin >> t;while(t--)
#define int3(x,y,z) int x,y,z;cin >> x >> y >> z;
#define int2(x,y) int x,y;cin >> x >>y;
#define int1(x) int x;cin>>x;
#define vi vector<int>
#define vii vector<vector<int>>
typedef long long ll;
#define  fio ios::sync_with_stdio(0);cin.tie(NULL);
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
//bool cmp(pair<string,int>p1,pair<string,int>p2) {
//    return p1.ss > p2.ss;
//}
//if (s1.find(s2) != std::string::npos) {
//   std::cout << "found!" << '\n';
//}


using namespace std;

int main() {
    fio
    int1(x)
    int happiness = 0;
    if(x < 500 ) {
        int s = x / 5;
        happiness = s * 5;
    }
    else {
        int s = x / 500;
        happiness = 1000 * s;
        x = x % 500;
        s = x / 5;
        happiness += s * 5;
    }
    cout << happiness << endl;


    return 0;
}






Measured memory_bytes: 256
#! /usr/bin/python3
import itertools

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())


answer = 10000000000
for os in itertools.permutations([a, b, c, d, e]):
    t = 0
    m = 0
    for o in os:
        if m > 0:
            t += 10 - m
        t += o
        m = t % 10
    if t < answer:
        answer = t
        a = o

print(answer)



Measured memory_bytes: 3064
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;


void main()
{
  auto n = readln.chomp.to!int;
  auto as = readln.chomp.split.to!(int[]);
  as.sort!((x,y)=>x > y);
  int res;
  foreach (i; 0..n) {
    if (i % 2) {
      res -= as[i];
    } else {
      res += as[i];
    }
  }
  res.writeln;
}


Measured memory_bytes: 256
using System;

namespace Aizu
{
    class OnlineJudge
    {
        public static void Main()
        {
            for(string input; (input = Console.ReadLine()) != "-1 -1 -1";) {
                var score = input.Split();
                int m = int.Parse(score[0]), f = int.Parse(score[1]), r = int.Parse(score[2]);
                Console.WriteLine(((m | f) == -1 || (m + f) < 30) ? "F" : (m + f) < 50 ? (r < 50 ? "D" : "C") : (m + f) < 65 ? "C" : (m + f) < 80 ? "B" : "A");
            }
        }
    }
}

Measured memory_bytes: 5308
from collections import Counter
def main():
    n = int(input())
    s = [input() for _ in range(n)]
    s_c = Counter(s)
    s_c_max = s_c.most_common()[0][1]
    keys =[k for k, v in s_c.items() if v == s_c_max]
    keys_s = sorted(keys)
    print(*keys_s, sep='\n')

if __name__ == '__main__':
    main()

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

int main()
{
   string s; cin >> s;
   for (int i = 0, n = s.length(); i < n; i ++)
   {
       if (s[i] != 'x' )
       {
           s[i] = 'x';
       }
   }
   cout << s;
}


Measured memory_bytes: 256
console.log((args=>{
  const [NQ,s,...tmp] = args.trim().split`\n`;
  const [N,Q] = NQ.split` `.map(v=>v|0);
  const t = [], d = [];
  for ( let i = 0; i < Q; i++ ) {
    const [T,D] = tmp[i].split` `;
    t.push(T); d.push(D);
  }
  function sim( p, check ) {
    for ( let i = 0; i < Q; i++ ) {
      if ( s[p] === t[i] ) ( d[i] === 'L' ) ? p-- : p++;
      if ( check(p) ) return false;
    }
    return true;
  }
  let l = -1, R = N;
  while ( l+1 < R) {
    const m = (l+R) >> 1;
    sim( m, v=>v<0 ) ? R = m : l = m;
  }
  let L = -1, r = N;
  while ( L+1 < r ) {
    const m = (L+r) >> 1;
    sim( m, v=>v>=N ) ? L = m : r = m;
  }
  return `${L-l}`;
})(require('fs').readFileSync('/dev/stdin','utf8')));


Measured memory_bytes: 67176
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long x = sc.nextInt();

        List<Long> demandList = new ArrayList<>();
        for (int i = 0; i < N; i++) {
            demandList.add(sc.nextLong());
        }
        Collections.sort(demandList);

        long sum = 0;
        long childCount = 0;
        for (long demand : demandList) {
            sum += demand;
            if (sum > x) {
                break;
            }
            childCount++;
        }
        if (sum < x && childCount != 0) {
            childCount--;
        }

        System.out.println(childCount);

    }
}


Measured memory_bytes: 21204
//==========================Head files==========================
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#include<queue>
#include<cmath>
#include<set>
#include<iostream>
#include<map>
#define LL long long
#define db double
#define mp make_pair
#define pr pair<int, int>
#define fir first
#define sec second
#define pb push_back
#define ms(i, j) memset(i, j, sizeof i)
using namespace std;
//==========================Templates==========================
inline int read() {
    int x = 0, f = 1; char c = getchar();
    while(c < '0' || c > '9'){if (c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9'){x = x * 10 + c - '0'; c = getchar();}
    return x * f;
}
inline LL readl() {
    LL x = 0, f = 1; char c = getchar();
    while(c < '0' || c > '9'){if (c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9'){x = x * 10 + c - '0'; c = getchar();}
    return x * f;
}
int power(int a, int b) {
	int ans = 1;
	while (b) {
		if(b & 1) ans = ans * a;
		b >>= 1; a = a * a;
	}
	return ans;
}
int power_mod(int a, int b, int mod) {
	a %= mod;
	int ans = 1;
	while (b) {
		if(b & 1) ans = (ans * a) % mod;
		b >>= 1, a = (a * a) % mod;
	}
	return ans;
}
LL powerl(LL a, LL b) {
	LL ans = 1ll;
	while (b) {
		if(b & 1ll) ans = ans * a;
		b >>= 1ll;a = a * a;
	}
	return ans;
}
LL power_modl(LL a, LL b, LL mod) {
	a %= mod;
	LL ans = 1ll;
	while (b) {
		if(b & 1ll) ans = (ans * a) % mod;
		b >>= 1ll, a = (a * a) % mod;
	}
	return ans;
}
LL gcdl(LL a, LL b) {return b == 0 ? a : gcdl(b, a % b);}
LL abssl(LL a) {return a > 0 ? a : -a;}
int gcd(int a, int b) {return b == 0 ? a : gcd(b, a % b);}
int abss(int a) {return a > 0 ? a : -a;}
//==========================Main body==========================
#define LD "%I64d"
#define D "%d"
#define pt printf
#define sn scanf
#define pty printf("Yes\n")
#define ptn printf("No\n")
//==========================Code here==========================
int main() {
	int n;
	cin >> n;
	for (int i = 1; i <= n; ++i) {
		if (n % i == 0) {
			int j = n / i;
			if (i <= 9 && j <= 9) {
				return pty, 0;
			}
		}
	}
	ptn;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int		main(void)
{
	int W;
	int H;
	int x;
	int y;
	int r;

	scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);
	if (r > x || x + r > W)
		printf("No\n");
	else if (r > y || y + r > H)
		printf("No\n");
	else
		printf("Yes\n");
	return (0);
}



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

int main() {
  long n,l,x=-1;
  cin >> n >> l;
  vector<long> a(n);
  for(long i=0;i<n;i++) cin >> a[i];
  for(long i=1;i<n;i++) if(a[i-1]+a[i]>=l) x=i;
  if(x==-1) cout << "Impossible" << endl;
  else {
    cout << "Possible" << endl;
    for(long i=n-1;i>x;i--) cout << i << endl;
    for(long i=1;i<=x;i++) cout << i << endl;
  }
}

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

namespace HABIT{
    #define f(a,b,c,d) for(register int a=b,c=d;a<=c;a++)
    #define g(a,b,c,d) for(register int a=b,c=d;a>=c;a--)
    #define LOCAL
    typedef int i32;
    typedef unsigned int u32;
    typedef long long int i64;
    typedef unsigned long long int u64;
    typedef pair<i32,i32> pii;
    const i32 MAXN=1024;
    typedef i32 ar[MAXN];
    
    template<typename T> inline T Max(T a) { return a; }
    template<typename T,typename... Args> inline T Max(T a,Args... args){
        T b=Max(args...);
        return (a>b)?a:b;
    }
    template<typename T> inline T Min(T a) { return a; }
    template<typename T,typename... Args> inline T Min(T a,Args... args){
        T b=Min(args...);
        return (a<b)?a:b;
    }

    #ifdef LOCAL
        inline char gc() { return getchar(); }
    #else
        inline char gc() {
            static char s[1<<20|1]={0},*p1=s,*p2=s;
            return (p1==p2)&&(p2=(p1=s)+fread(s,1,1<<20,stdin),p1==p2)?EOF:*(p1++);
        }
    #endif
    inline i64 read(){
        register i64 ans=0;register char c=gc();register bool neg=0;
        while(c<48||c>57) neg^=!(c^'-'),c=gc();
        while(c>=48&&c<=57) ans=(ans<<3)+(ans<<1)+(c^48),c=gc();
        return neg?-ans:ans;
    }

    char Output_Ans[1<<20|1],*Output_Cur=Output_Ans;
    inline void output() { Output_Cur-=fwrite(Output_Ans,1,Output_Cur-Output_Ans,stdout); }
    inline void print(char c){
        if(Output_Cur-Output_Ans+1>>20) output();
        *(Output_Cur++)=c;
    }
    inline void print(char *s) { while(*s) print( *(s++) ); }
    inline void print(u64 x){
        if(!x) { print('0'); return ; }
        char buf[30]={0},*p=buf+28;
        while(x) *(p--)=x%10+48,x/=10;
        print(p+1);
    }
    inline void print(u32 x) { print( (u64)x ); }
    inline void print(i64 x){
        if(x<0) print('-'),x=-x;
        print( (u64)x );
    }
    inline void print(i32 x){
        if(x<0) print('-'),x=-x;
        print( (u64)x );
    }
}
using namespace HABIT;

int main(){
    i32 N=read()%10;
    if(N==3) print("bon");
    else if(N==0||N==1||N==6||N==8) print("pon");
    else print("hon");
    output();
    return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <string>
#include <cmath>
#include <map>
#include <iomanip>
#include <tuple>
#define INF 1000000009
#define LINF 1000000000000000009
#define double long double
#define all(a) a.begin(),a.end()
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
//ll mod = 1000000007;
//ll mod = 998244353;

int main() {
	int m, n;
	cin >> m >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) cin >> a[i];
	int ans = 0;
	int cnt = 1;
	for (int i = 1; i < n; i++) {
		if (a[i] == a[i - 1]) cnt++;
		else {
			ans += cnt / 2;
			cnt = 1;
		}
	}
	ans += cnt / 2;
	if (m > 2) {
		cout << ans << endl;
		return 0;
	}
	int x = 0, y = 0;
	for (int i = 0; i < n; i++) {
		if (i % 2 == 0) {
			if (a[i] == 1) x++;
			else y++;
		}
		else {
			if (a[i] == 1) y++;
			else x++;
		}
	}
	cout << min(x, y) << endl;
}


Measured memory_bytes: 3152
#!/usr/bin/env python3
h, w, k = map(int, input().split())
grid = []
for i in range(h):
    grid.append(input())
# bit 全探索
ans = 0
for i in range(2 ** h):
    for j in range(2 ** w):
        cnt = 0  # 黒ます"#"の個数
        for r in range(h):
            for c in range(w):
                if grid[r][c] == "#" and (not i >> r & 1) and (not j >> c & 1):
                    cnt += 1
        if cnt == k:
            ans += 1
print(ans)


Measured memory_bytes: 9120
#include<bits/stdc++.h>
using namespace std; 
int main()
{
  long long int n,i,j; 
cin>>n;
  i=sqrt(n);
  for(j=i;j>=1;j--)
  {
    if(n%j==0)
    {
      cout<<(j+(n/j)-2);
      break; 
    }
  }
}

Measured memory_bytes: 384
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <algorithm>
#include <cmath>
#include <cstring>

using namespace std;

#define REP(i,n) for(int i = 0; i < n; i++)
#define RREP(i,n) for(int i = n - 1; i >= 0; i--)

#define ALL(v) v.begin(),v.end()
#define pb push_back
#define mp make_pair
#define F first
#define S second

#define UNIQUE(v) do{sort(v.begin(), v.end()); v.erase( unique(v.begin(), v.end()), v.end() );} while(0)

#define y0 y3487465
#define y1 y8687969

#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,63,sizeof(x))

typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
typedef vector<ll> vll;
typedef vector<vll> vvll;

double EPS = 1e-9;
int INFi = 1000000005;
long long INFll = 1000000000000000005ll;
double PI = acos(-1);
int dirx[8] = {-1,0,0,1,-1,-1,1,1};
int diry[8] = {0,1,-1,0,-1,1,-1,1};
ll MOD = 1000000007;

ll N, W;
const int MAX_N = 100;
ll w[MAX_N], v[MAX_N];

int main(){
  cin >> N >> W;
  REP(i, N) cin >> w[i] >> v[i];
  
  vll w0, w1, w2, w3;
  REP(i, N) {
    if(w[i] == w[0]) {
      w0.pb(v[i]);
    } else if (w[i] == w[0] + 1) {
      w1.pb(v[i]);
    } else if (w[i] == w[0] + 2) {
      w2.pb(v[i]);
    } else {
      w3.pb(v[i]);
    }
  }

  sort(ALL(w0), greater<ll>());
  sort(ALL(w1), greater<ll>());
  sort(ALL(w2), greater<ll>());
  sort(ALL(w3), greater<ll>());

  ll ans = 0;
  REP(i, w0.size() + 1) {
    REP(j, w1.size() + 1) {
      REP(k, w2.size() + 1) {
        REP(l, w3.size() + 1) {
          if(i * w[0] + j * (w[0] + 1) + k * (w[0] + 2) + l * (w[0] + 3) > W) continue;
          ll s = 0;
          REP(t, i) {
            s += w0[t];
          }
          REP(t, j) {
            s += w1[t];
          }
          REP(t, k) {
            s += w2[t];
          }
          REP(t, l) {
            s += w3[t];
          }
          ans = max(ans, s);
        }
      }
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M, a, b, c, answer = 0;
  cin >> N >> M;
  vector<vector<long long>> d(N,vector<long long>(N,INT_MAX));
  long long e[N][N];
  while (M--) {
    cin >> a >> b >> c;
    d[--a][--b] = c;
    d[b][a] = c;
  }
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      e[i][j] = d[i][j];
    }
  }
  for (int k = 0; k < N; ++k) {
    for (int i = 0; i < N; ++i) {
        for (int j = 0; j < N; ++j) {
            d[i][j] = min(d[i][j], d[i][k] + d[k][j]); 
        }
    }
  }
  for (int i = 0; i < N; i++) {
    for (int j = i; j < N; j++) {
      answer += e[i][j] < INT_MAX && d[i][j] < e[i][j];
    }
  }
  cout << answer;
}

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

string s;

int main() {
  cin >> s;
  if (s[s.size()-1] == 's') s += 'e';
  s += 's';
  cout << s << endl;
  return 0;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define forn(i, n)             for(int i = 0; i < n; i ++)
#define forn1(i, n)            for(int i = 1; i <= n; i ++)
#define pb push_back
#define ll long long int
#define fi first
#define se second
#define ii  pair<long long int, long long int>
#define vi  vector <long long int>
#define vii vector <pair <long long int, long long int > >
#define all(cont)  cont.begin(), cont.end()
#define EPS 1e-9
#define MOD 1000000007
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define range 200010
#pragma GCC optimize ("Ofast")
#define endl '\n'
pair<int,int> A[100005];
signed main(){

  //  freopen("test.txt","r",stdin);
    ios :: sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int n;
    cin>>n;
    for(int i=0;i<n;i++)cin>>A[i].first,A[i].second = i;
    sort(A,A+n);
    for(int i=0;i<n;i++){
        cout<<A[i].second+1<<" ";
    }


    return 0;
}


Measured memory_bytes: 1664
from sys import stdin


def solve():
    n,mw = [int(i) for i in stdin.readline().split()]
    iw, iv = [], []
    for _ in range(n):
        w,v = [int(i) for i in stdin.readline().split()]
        iw.append(w)
        iv.append(v)
    dp = [[0 for _ in range(mw+1)] for _ in range(n+1)]
    for i in range(1, n+1):
        for j in range(mw+1):
            if iw[i-1] > j: dp[i][j] = dp[i-1][j]
            else: dp[i][j] = max(dp[i-1][j], iv[i-1] + dp[i-1][j-iw[i-1]])
    return dp[-1][-1]

print(solve())

Measured memory_bytes: 173448
import sys,collections,math,random,fractions,bisect;sys.setrecursionlimit(10**7)
sr = sys.stdin.readline; P = print; P2 = lambda x: print(*x, sep="\n")
def I(i=0): t = [int(x)-i for x in sr().split()];return t
def S(): t = sr().split(); return t if len(t) > 1 else t[0]
L1,L2,L3,L4, = [],[],[],[]
 
s = S()
if "RRR" in s:
    print(3)
elif "RR" in s:
    print(2)
elif "R" in s:
    print(1)
else:
    print(0)


Measured memory_bytes: 76840
#include<stdio.h>

int main(){
	int x,y;
	int i;
	int cnt=0;
	scanf("%d %d",&x,&y);
	
	for(i=0;i<=x;i++){
		if(2*i+4*(x-i)==y){
			cnt++;
		}
	}
	if(cnt!=0){
		printf("Yes");
	}
	else{
		printf("No");
	}
}

Measured memory_bytes: 1732
//BISMILLAHIR RAHMANIR RAHIM
#include <bits/stdc++.h>
#define mem(a, b) (memset(a, b, sizeof(a)))
#define pb push_back
#define mk make_pair
#define ff first
#define ss second
#define PI acos(-1)
#define INF 2147483647
#define MOD 1000000007
#define MAX 100005
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<int, ii> pii;
typedef vector<ii> vii;
typedef priority_queue<int,vector<int>,greater<int> > PQ;

int Set(int mask, int pos){return mask = mask | (1<<pos);}
bool check(int mask, int pos){return (bool)(mask & (1<<pos));}

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

    vector<ll> v;
    v.pb(0);
    ll pow = 1;
    vector<ll> pow26(12);
    pow26[0] = 1;
    for(int i = 1; i <= 10; i++) {
        pow26[i] = 26 * pow26[i-1];
        ll temp = v.back() + (pow26[i]);
        v.pb(temp);
    }

    ll n;

    cin>>n;

    int k;
    for(int i = 0; i < 11; i++) {
        if(v[i] >= n)
            break;
        k = i;
    }

    ll rem = n - v[k] - 1;

    string ans = "";
    for(int i = k; i >= 0; i--) {
        int x = rem / pow26[i];
        ans += (char) (x + 97);
        rem -= (x * pow26[i]);
    }

    cout<<ans<<endl;

    return 0;
}


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

#define ll long long
#define INF 99999999
#define INF_LL 1LL << 60
#define MOD (ll)1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, a, n) for(int i = a; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

void put_double(double obj){printf("%.12f\n",obj);};

template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}

int main()
{
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i,N) cin >> A[i];

    ll total = pow(3,N);

    vector<int> key;
    rep(i,N)
    {
        if( A[i]%2==0 ) key.push_back(2);
        else key.push_back(1);
    }
    ll kisuu = 1;
    rep(i,key.size()) kisuu *= key[i];
    
    cout << total-kisuu << endl;
}


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

ll h, w;
bool bitcheck(int x, int y) { return (x >> y) & 1; }
ll memo[101][9];
ll func(ll r, ll c) {
    if (r == 0) {
        if (c == 0) {
            return 1;
        }
        return 0;
    }
    if (memo[r][c] != -1) {
        return memo[r][c];
    }
    ll ret = 0;
    REP(i, 1 << (w - 1)) {
        bool flag = false;
        rep(j, 1, w - 1) {
            if (bitcheck(i, j) && bitcheck(i, j - 1)) {
                flag = true;
            }
        }
        if (flag) {
            continue;
        }
        if (c > 0 && bitcheck(i, c - 1)) {
            ret += func(r - 1, c - 1);
        } else if (c < w - 1 && bitcheck(i, c)) {
            ret += func(r - 1, c + 1);
        } else {
            ret += func(r - 1, c);
        }
        ret %= mod;
    }
    memo[r][c] = ret;
    return memo[r][c];
}
signed main() {
    Fill(memo, -1);
    ll k;
    cin >> h >> w >> k;
    cout << func(h, k - 1) % mod << endl;
}

Measured memory_bytes: 3612
n = int(input())

abc = []
for i in range(n):
    abc.append(list(map(int, input().split(' '))))


dp = [[0 for i in range(n + 1)] for j in range(3)]

for i in range(1, n + 1):
    for j in range(3):
        dp[j][i] = max([
            dp[(j + 1) % 3][i - 1] + abc[i - 1][j],
            dp[(j + 2) % 3][i - 1] + abc[i - 1][j],
        ])

print(max([dp[0][n], dp[1][n], dp[2][n]]))


Measured memory_bytes: 42568
#include<stdio.h>
int main(void) {
	int r,d,x,i,n=0;
	scanf("%d%d%d", &r, &d, &x);
	n = (r * x - d);
	for (i = 0;i < 10;i++) {
		printf("%d\n", n);
		n = n * r - d;
	}
	return 0;


}

Measured memory_bytes: 128
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    if len(x) == 0:
        return []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

po = input()[:-1]

p = s(po)

cou = 0

for i in p:
    if i[0] == "R":
        cou = max(i[1],cou)
print(cou)


Measured memory_bytes: 65168
#!/usr/bin/env python3


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    N = int(input())
    A = list(map(int, input().split(" ")))
    # print(N)
    # print(A)
    d_i = {}
    d_j = {}

    for i, ai in enumerate(A):
        p = ai -i
        if p in d_i.keys():
            d_i[p] +=1
        else:
            d_i[p] = 1
        p = -ai - i
        if p in d_j.keys():
            d_j[p] +=1
        else:
            d_j[p] = 1
    # print(d_i)
    # print(d_j)

    ans = 0
    for q in list(set(d_i.keys()) & set(d_j.keys())):
        ans += d_i[q]*d_j[q]
    print(ans)


    return


if __name__ == '__main__':
    main()


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

int h, w;
char field[SIZE][SIZE];
int cost[SIZE][SIZE];

int main() {
    cin >> h >> w;
    fill(field[0], field[SIZE], '#');

    for(int y = 1; y <= h; y++) {
        for(int x = 1; x <= w; x++) {
            cin >> field[x][y];
        }
    }

    cost[1][1] = 1;
    for(int y = 1; y <= h; y++) {
        for(int x = 1; x <= w; x++) {
            cost[x+1][y] += (field[x+1][y] == '.') * cost[x][y];
            cost[x+1][y] %= MOD;

            cost[x][y+1] += (field[x][y+1] == '.') * cost[x][y];
            cost[x][y+1] %= MOD;
        }
    }
    cout << cost[w][h] << endl;
}

Measured memory_bytes: 5248
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#define speed ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ll long long
#define eps 1e-8
#define inf INT_MAX
#define mod 1000000009
using namespace std;

int ar[100001];

int main() {
	speed;
	int n, m, l, r;
	cin >> n >> m;
	for (int i = 0; i < m; ++i){
		cin >> l >> r;
		--l;
		ar[l]++, ar[r]--;
	}
	int ans = 0;
	for (int i = 0; i < n; ++i) {
		if (i)
			ar[i] += ar[i - 1];
		if (ar[i] == m)
			ans++;
	}
	cout << ans;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
 
#define ll long long
#define vi vector<int>
#define vll vector<long long>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define sll set<long long>
#define si set<int>
#define stk stack<int>
#define que queue<int>
#define pb push_back
#define ff first
#define ss second
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
 
using namespace std;

void solve(){
	map<int,int> m;
	int n,q;
	ll sum=0;
	cin>>n;
	for(int i=0,x;i<n;i++){
		cin>>x;
		sum+=x;
		m[x]++;
	}

	cin>>q;
	while(q--){
		int b,c;
		cin>>b>>c;
		m[c]+=m[b];
		sum+=(c-b)*m[b];
		m.erase(b);
		cout<<sum<<endl;
	}
}
 
int main(){
    IOS;
    int q=1;
    //cin>>q;
    while(q--){
        solve();
    }
}

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

using pii = pair<int, int>;
using ll  = long long;
#define rep(i, j) for (int i = 0; i < (int)(j); i++)
#define repeat(i, j, k) for (int i = (j); i < (int)(k); i++)
#define all(v) v.begin(), v.end()
#define debug(x) cerr << #x << " : " << x << endl

template <class T>
bool set_min(T &a, const T &b) {
    return a > b ? a = b, true : false;
}
template <class T>
bool set_max(T &a, const T &b) {
    return a < b ? a = b, true : false;
}
// vector
template <class T>
istream &operator>>(istream &is, vector<T> &v) {
    for (T &a : v) is >> a;
    return is;
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    for (const T &t : v) os << "\t" << t;
    return os << endl;
}
// pair
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &v) {
    return os << "<" << v.first << ", " << v.second << ">";
}

const int INF = 1 << 30;
const ll INFL = 1LL << 60;

class ModInt {
  public:
    static const ll MOD = 998244353;
};

ll modpow(ll n, ll r) {
    if (r == 0) return 1;
    ll ret = modpow(n, r / 2);
    ret    = (ret * ret) % ModInt::MOD;
    if (r % 2 != 0) ret = (ret * n) % ModInt::MOD;
    return ret % ModInt::MOD;
}

class Solver {
  public:
    bool solve() {
        int N;
        cin >> N;
        vector<ll> D(N);
        cin >> D;
        vector<ll> cnt(N + 1);
        rep(i, N) cnt[D[i]]++;
        ll sum = 1;
        ll ans = 1;

        repeat(i, 1, N + 1) {
            if (cnt[i] == 0) break;
            ans = (ans * modpow(cnt[i - 1], cnt[i])) % ModInt::MOD;
            sum += cnt[i];
        }

        if (sum != N or D[0] != 0 or cnt[0] != 1)
            cout << 0 << endl;
        else
            cout << ans << endl;
        return 0;
    }
};

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

    return 0;
}


Measured memory_bytes: 1920
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#define ull unsigned long long
#define ll long long
using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int ans = 0,A,B,C,x;
    cin >> A >> B >> C;
    cin >> x;
    for(int i=0;i<=A;i++){
        for(int j=0;j<=B;j++){
            for(int k=0;k<=C;k++){
                if(i*500+j*100+k*50==x){
                    ans++;
                }
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
//                             In The Name Of Allah                                           
//                             	Mohammad Hosseini
#include <bits/stdc++.h>
#define	ss second
#define ff first
#define use_fast ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define ret(n) return cout << n, 0
#define se(n) cout << setprecision(n) << fixed
#define pb push_back
#define int long long
#define ld long double
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC optimize("no-stack-protector,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std; 

const int N = 3e5 + 100, OO = 1e16, T = 4500 + 100, M = 1e9 + 7, P = 6151, SQ = 280, lg = 30;
typedef pair <int, int> pii;
int dp[N], a[N], b[N], seg[4][N << 2], lazy[4][N << 2], sum[N];

void shift(int id, int c) {
	seg[id][c << 1] += lazy[id][c];
	seg[id][c << 1 | 1] += lazy[id][c];
	lazy[id][c << 1] += lazy[id][c];
	lazy[id][c << 1 | 1] += lazy[id][c];
	lazy[id][c] = 0;
}

void upd(int id, int c, int b, int e, int l, int r, int x) {
	if(r <= b || e <= l)
		return;
	if(l <= b && e <= r) {
		seg[id][c] += x;
		lazy[id][c] += x;
		return;
	}
	int mid = (b + e) >> 1;
	shift(id, c);
	upd(id, c << 1, b, mid, l, r, x), upd(id, c << 1 | 1, mid, e, l, r, x);
	seg[id][c] = min(seg[id][c << 1], seg[id][c << 1 | 1]);
}

int get(int id, int c, int b, int e, int l, int r) {
	if(r <= b || e <= l)
		return OO;
	if(l <= b && e <= r)
		return seg[id][c];
	int mid = (b + e) >> 1;
	shift(id, c);
	return min(get(id, c << 1, b, mid, l, r), get(id, c << 1 | 1, mid, e, l, r));
}

int32_t main() {
	use_fast;
	int n, e, t, h = 0;
	cin >> n >> e >> t;
	for(int i = 1; i <= n; i++)
		cin >> a[i];
	upd(1, 1, 0, n + 1, 0, 1, -2 * a[1]);
	for(int i = 1; i <= n; i++) {
		upd(1, 1, 0, n + 1, 0, i, 3 * (a[i] - a[i - 1]));
		upd(2, 1, 0, n + 1, 0, i, a[i] - a[i - 1]);
		while(2 * (a[i] - a[h]) >= t)
			h++;
		dp[i] = min(t + get(2, 1, 0, n + 1, h - 1, i), get(1, 1, 0, n + 1, 0, h - 1));
		upd(1, 1, 0, n + 1, i, i + 1, dp[i] - 2 * (a[i + 1] - a[i]));
		upd(2, 1, 0, n + 1, i, i + 1, dp[i]);
	}
	cout << e - a[n] + dp[n] << endl;
    return 0;
}
/*
be carefull :
1- if not solve after 20 min, read again twice
2- after submit read the code again
3- fun with contest
4- uploaded by ubuntu 20.04 
5- ...
*/



Measured memory_bytes: 13488