akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const double PI=3.14159265358979;
const ll INF= pow(10,18);
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
struct edge{ll to,cost;};

int main() {
  ll x;
  cin >> x;
  FOR(i,-1000,1001){
    FOR(j,-1000,1001){
      if(x==(ll)pow(i,5)-(ll)pow(j,5)){
        cout << i << " " << j;
        return 0;
      }
    }
  }
}

Measured memory_bytes: 4068
//Dragon_warrior7(IITK)
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize ("-ffloat-store")
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//using namespace __gnu_pbds;
#define ll long long
#define pb push_back
#define nl cout << '\n'
#define sor(x) sort(x.begin(), x.end())
#define rev(v) reverse(v.begin(), v.end())
#define lb(v, temp) lower_bound(v.begin(), v.end(), temp)
#define ub(v, temp) upper_bound(v.begin(), v.end(), temp)
#define fi first
#define se second
#define llmax 1000000000000000000
#define pll pair<ll, ll> 
#define ull unsigned ll
#define vll vector<ll> 
#define rub cout << "\n------------------------------------\n"
#define deb(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) 
{
	cout << *it << " = " << a;
	nl;
	err(++it, args...);
}
//typedef  tree < int ,  null_type ,  greater<int> ,  rb_tree_tag ,  tree_order_statistics_node_update > oset;
void read(vector<ll> &v)
{
	for (int i = 0; i < v.size(); i++)
		cin >> v[i];
}
// const int mod=1e9+7;
// ll power(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 modInverse(ll a){return power(a,mod-2);}
ll n,m,a,b,c,k,temp,x,y;
void solveforthiscase(const int & test)
{//deb(test);
string s;
cin>>s;
n=s.size();
int counta=0;
int countc=0;
    if(s[0]!='A')
    {cout<<"WA";return;}
    int countupper=0;
for(int i=0;i<n;i++)
{

  if(s[i]=='A')
  counta++;
  else
  if(s[i]=='C')
  countc++;
  if(s[i]>='A' && s[i]<='Z')
  countupper++;
}
if(counta+countc!=countupper)
{cout<<"WA";return ;}
countc=0;
for(int i=2;i<n-1;i++)
{
    if(s[i]=='C')
    countc++;
}
if(countc!=1)
cout<<"WA";
else
cout<<"AC";






return ;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int test=1;
// 	cin>>test;
    for(int i=1;i<=test;i++)
    {
        solveforthiscase(i);
    }
}

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

typedef vector<int> vi;
typedef long long int ll;
typedef pair<int,int> ii;
typedef vector<ii > vii;
typedef vector<vi > vvi;
typedef pair<ll, ll> pll;
typedef vector<pll > vll;
// Please.. please be patient.. This is just a template
// Ignore my naming convention...

int i, j, n, m, k, l;
int main() {
	cin >> n >> i >> j;
	if(abs(n - i)<abs(n-j)) {
		puts("A");
	} else {
		puts("B");
	}
}

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

#define ll long long
#define mod 1000000007
#define f(i, a, b) for (long long i = a; i < b; i++)
#define rep(i, a, b) for (long long i = a; i <= b; i++)
#define fm(i, a, b) for (long long i = a; i > b; i--)
#define repm(i, a, b) for (long long i = a; i >= b; i--)
#define vi vector<int>
#define vl vector<long long>
#define vs vector<string>
#define pqmaxi priority_queue<int>
#define pqmaxl priority_queue<ll>
#define pqmini priority_queue<int, vi, greater<int>>
#define pqminl priority_queue<ll, vl, greater<ll>>
#define all(x) x.begin(), x.end()
#define test     \
    ll test;     \
    cin >> test; \
    while (test--)
#define pb(i) push_back(i)
#define mp(i, j) make_pair(i, j)
#define fast                     \
    ios::sync_with_stdio(false); \
    cin.tie(NULL)

int main()
{
    fast;
    ll a, b;
    char c;
    cin >> a >> c >> b;
    if (c == '-')
    {
        cout << a - b;
    }
    else
    {
        cout << a + b;
    }
}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace AtCoder.ABC113.D
{
    class Program
    {
        static void Main()
        {
            var sc = new Scanner();
            var H = sc.Nextint();
            var W = sc.Nextint();
            var h = sc.Nextint();
            var w = sc.Nextint();

            Console.WriteLine((H - h) * (W - w));
        }
    }

    class Scanner
    {
        string[] s;
        long i;

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

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

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

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

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

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

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

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

        public decimal NextDecimal()
        {
            return decimal.Parse(Next());
        }

        public decimal[] ArrayDecimal(long N, decimal add = 0)
        {
            decimal[] Array = new decimal[N];
            for (long i = 0; i < N; i++)
            {
                Array[i] = NextDecimal();
            }
            return Array;
        }
    }
}


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

// region template
#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define trav(a, x) for (auto &a : x)
#define all(x) begin(x), end(x)
#define sz(x) (ll)(x).size()
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;

ll gcd(ll a, ll b) { return __gcd(a, b); }

ll euclid(ll a, ll b, ll &x, ll &y) {
    if (b) {
        ll d = euclid(b, a % b, y, x);
        return y -= a / b * x, d;
    }
    return x = 1, y = 0, a;
}

typedef unsigned long long ull;
typedef long double ld;
ull mod_mul(ull a, ull b, ull M) {
    ll ret = a * b - M * ull(ld(a) * ld(b) / ld(M));
    return ret + M * (ret < 0) - M * (ret >= (ll)M);
}
ull mod_pow(ull b, ull e, ull mod) {
    ull ans = 1;
    for (; e; b = mod_mul(b, b, mod), e /= 2)
        if (e & 1)
            ans = mod_mul(ans, b, mod);
    return ans;
}

const ll mod = 1000000007;
struct Mod {
    ll x;
    Mod(ll xx) : x(xx) {}
    Mod operator+(Mod b) { return Mod((x + b.x) % mod); }
    Mod operator-(Mod b) { return Mod((x - b.x) % mod); }
    Mod operator*(Mod b) { return Mod((x * b.x) % mod); }
    Mod operator/(Mod b) { return *this * invert(b); }
    Mod invert(Mod a) {
        ll x, y, g = euclid(a.x, mod, x, y);
        assert(g == 1);
        return Mod((x + mod) % mod);
    }
    Mod operator^(ll e) {
        if (!e)
            return Mod(1);
        Mod r = *this ^ (e / 2);
        r = r * r;
        return e & 1 ? *this * r : r;
    }
};
// endregion

int main() {
    cin.sync_with_stdio(0);
    cin.tie(0);
    cin.exceptions(cin.failbit);

    for (;;) {
        int d, w; cin >> d >> w;
        if (!d) break;
        vector<vi> m(d, vi(w));

        rep(i, 0, d) rep(j, 0, w) cin >> m[i][j];

        int ans = 0;

        rep(i, 0, d) rep(j, 0, w) rep(k, i + 2, d) rep(l, j + 2, w) {
            
            int intsum = 0;
            int intmax = 0;
            int outmin = 100;

            for (int a = i; a <= k; a++)
                outmin = min(outmin, min(m[a][j], m[a][l]));
            for (int b = j; b <= l; b++)
                outmin = min(outmin, min(m[i][b], m[k][b]));

            for (int a = i + 1; a <= k - 1; a++) {
                for (int b = j + 1; b <= l - 1; b++) {
                    intsum += m[a][b];
                    intmax = max(intmax, m[a][b]);
                }
            }

            if (intmax < outmin) {
                ans = max(ans, (k - i - 1) * (l - j - 1) * outmin - intsum);

                // for (int a = i; a <= k; a++) {
                //     for (int b = j; b <= l; b++) {
                //         cout << m[a][b];
                //     }
                //     cout << endl;
                // }
                // cout << (k - i - 1) * (l - j - 1) * outmin - intsum << endl;
            }

        }

        cout << ans << endl;
        // cerr << ";;;;;;;;;;;;;;;;;;;" << endl;
    }
}



Measured memory_bytes: 3168
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <map>
const int MOD = 1e9+7;
typedef long long ll;
using namespace std;


int main(){
	int r;
	cin >> r;
	if (r < 1200) cout << "ABC" << endl;
	else if (r < 2800) cout << "ARC" << endl;
	else cout << "AGC" << endl;
	return 0;
}

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

int main (){
    int d;
    long g;
    cin >> d>>g;
    vector<int> p(d);
    vector<int> c(d);
    for(int i=0;i<d;i++){
        cin >> p[i] >> c[i];
    }
    int ans = 3000;
    for(int i=0;i<(1<<d);i++){
        long sum = 0;
        int tans = 0;
        int first0 = -1;
        bool flag = false;
        for(int k =(d-1);k>-1;k--){
            if(i&(1<<k)){
                sum += p[k]*(k+1)*100 + c[k];
                tans += p[k];
            }
            else if(flag == false){
                first0 = k;
                flag = true;
            }
        }
        if(sum >= g){
            if(ans > tans){
                ans = tans;
            }
        }
        else if(first0 != -1){
            for(int k=0;k<p[first0];k++){
                sum += 100*(first0 + 1);
                tans += 1;
                if(sum >= g){
                    if(ans > tans){
                        ans = tans;
                    }
                }
            }
        }
    }
    cout << ans << endl;
}

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

const int M = 1000005;

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> cnt(M);
    rep(i,n) cin >> a[i];
    for(int i = 0; i < n; i++){
        if(cnt[a[i]] > 0){
            cnt[a[i]]++;
            continue;
        }
        for(int j = a[i]; j < M; j += a[i]){
            cnt[j]++;
        }
    }
    int ans = 0;
    for(int i = 0; i < n; i++){
        if(cnt[a[i]] == 1) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 8020
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <iterator>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <regex>
#include <time.h>
#include <complex>
using namespace std;
using pii = pair<int, int>;
using ll = long long;
using ld = long double;
#define pb push_back
#define mp make_pair
#define sc second
#define fr first
#define stpr setprecision
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,n) for(ll i=0;i<(n);++i)
#define Rep(i,a,b) for(ll i=(a);i<(b);++i)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define rRep(i,a,b) for(int i=a;i>=b;i--)
#define crep(i) for(char i='a';i<='z';++i)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define ALL(x) (x).begin(),(x).end()
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define endl '\n'
typedef long long ll;

unsigned gcd(int a, int b) {
	while (1) {
		if (a < b) swap(a, b);
		if (!b) break;
		a %= b;
	}
	return a;
}

int main(){

	//int N, M, *A, *B, i, j, *W, *flag, sum=0, start, end, length, tmp;
	int i, j, k, l, m, n, len, a, b, c;
	int A, B, C, N, K,num_R,num_G,num_B;
	char S[4000];
	ll sum = 0;

	scanf("%d", &N);
	scanf("%s", S);

//	printf("%s\n", S);

	for (i = 0; i < N; i++){
		num_R = num_G = num_B = 0;
		if (S[i] == 'R'){
			for (j = i + 1; j < N; j++){
				if (S[j] == 'R')
					num_R++;
				if (S[j] == 'G')
					num_G++;
				if (S[j] == 'B')
					num_B++;
			}
			sum += num_G*num_B;
			for (k = 1; k <= N ; k++){
				if (i + 2 * k >= N)
					break;
				if (S[i + k] == 'G' && S[i + 2 * k] == 'B' || S[i + k] == 'B' && S[i + 2 * k] == 'G')
					sum--;
			}
		
		}
		if (S[i] == 'G'){
			for (j = i + 1; j < N; j++){
				if (S[j] == 'R')
					num_R++;
				if (S[j] == 'G')
					num_G++;
				if (S[j] == 'B')
					num_B++;
			}
			sum += num_R*num_B;
			for (k = 1; k <= N; k++){
				if (i + 2 * k >= N)
					break;
				if (S[i + k] == 'R' && S[i + 2 * k] == 'B' || S[i + k] == 'B' && S[i + 2 * k] == 'R')
					sum--;
			}

		}
		if (S[i] == 'B'){
			for (j = i + 1; j < N; j++){
				if (S[j] == 'R')
					num_R++;
				if (S[j] == 'G')
					num_G++;
				if (S[j] == 'B')
					num_B++;
			}
			sum += num_G*num_R;
			for (k = 1; k <= N; k++){
				if (i + 2 * k >= N)
					break;
				if (S[i + k] == 'G' && S[i + 2 * k] == 'R' || S[i + k] == 'R' && S[i + 2 * k] == 'G')
					sum--;
			}

		}

	}
	printf("%lld\n", sum);
	return 0;

}
    


Measured memory_bytes: 3832
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <cstring>

using namespace std;

struct State {
	int x, y, dir, cost, cnt;
	State (int _x, int _y, int _d, int _c, int _cn) : x(_x), y(_y), dir(_d), cost(_c), cnt(_cn) {}
};
// dir 0:テ・ツ渉ウ 1:テ、ツクツ?2:テ・ツキツヲ 3:テ、ツクツ?
bool operator > (const State& s1, const State& s2) {
	if (s1.cost > s2.cost) return true;
	return false;
}

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

int w, h;
int map[50][50];

int c[4];
int cost[50][50][100][4];
int INF = 1000;

void solve() {
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			for (int k = 0; k < 100; k++) {
				fill(cost[i][j][k], cost[i][j][k] + 4, INF);
			}
		}
	}
	
	priority_queue<State, vector<State>, greater<State> > que;
	que.push(State(0, 0, 0, 0, 0));
	cost[0][0][0][0] = 0;
	
	while (!que.empty()) {
		State s = que.top(); que.pop();
		
		int x = s.x, y = s.y;
		int d = s.dir;
		int cnt = s.cnt;
		
		if (cnt > 80) continue;
		
		int nd, nx, ny;
		
		if (map[y][x] != 4) {		
			nd = (d + map[y][x]) % 4;		
			nx = x + dx[nd], ny = y + dy[nd];
		
			if (0<=nx && nx<w && 0<=ny && ny<h) {
				if (cost[ny][nx][cnt][nd] > s.cost) {
					cost[ny][nx][cnt][nd] = s.cost;
					que.push(State(nx, ny, nd, s.cost, cnt));
				}
			}
		}
		
		for (int i = 0; i < 4; i++) {
			nd = (d + i) % 4;
			nx = x + dx[nd], ny = y + dy[nd];
			
			if (0<=nx && nx<w && 0<=ny && ny<h) {
				if (cost[ny][nx][cnt + 1][nd] > s.cost + c[i]) {
					cost[ny][nx][cnt + 1][nd] = s.cost + c[i];
					que.push(State(nx, ny, nd, s.cost + c[i], cnt + 1));
				}
			}
		}
	}
	
	int ans = INF;
	for (int i = 0; i < 100; i++) {
		for (int d = 0; d < 4; d++) {
			ans = min(ans, cost[h - 1][w - 1][i][d]);
		}
	}
	cout << ans << endl;
}

int main() {
	
	while (1) {
		cin >> w >> h; if (w==0 && h==0) break;
		
		memset(map, 0, sizeof(map));
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				cin >> map[i][j];
			}
		}
		
		for (int i = 0; i < 4; i++) cin >> c[i];
		
		solve();
	}
	
	return 0;
}

Measured memory_bytes: 3644
a,b=map(int,input().split())

if a>b:
  B=0
  c=1
  for i in range(a):
    B+=b*c
    c=c*10
  print(B)
else:
  A=0
  c=1
  for i in range(b):
    A+=a*c
    c=c*10
  print(A)

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

class Main{
	public static void main(String[] args)throws NumberFormatException, IOException{
		InputStreamReader input = new InputStreamReader (System. in);
		BufferedReader buffer = new BufferedReader(input);
		String scan = buffer.readLine();
		long processStart = System.currentTimeMillis();

		int numberAmount = Integer.parseInt(scan);
		scan = buffer.readLine();
		String[] scanSplit = scan.split(" ");
		int[] number = new int[numberAmount];
		for(int i=0; i<numberAmount; i++){
			number[i] = Integer.parseInt(scanSplit[i]);
		}
		scan = buffer.readLine();
		int questionAmount = Integer.parseInt(scan);
		scan = buffer.readLine();
		scanSplit =  scan.split(" ");
		int[] question = new int[questionAmount];
		for(int i=0; i<questionAmount; i++){
			question[i] = Integer.parseInt(scanSplit[i]);
		}
		
		boolean makeAble = false;
		for(int i=0; i<questionAmount; i++){
			makeAble = solve(number,question[i],0);
			if(makeAble == true){
				System.out.println("yes");
			}
			else{
				System.out.println("no");
			}
		}
		
		long processEnd = System.currentTimeMillis();
		    	//System.out.println("???????????????" + (processEnd - processStart)  + "ms");
	}

	public static boolean solve(int[] num,int quest, int nowNum){
		if (quest == 0){
			return true;
		}
		if (quest < 0 || nowNum == num.length){
			return false;
		}
		if (solve(num, quest, nowNum+1) || solve(num, quest - num[nowNum], nowNum+1)) {
            return true;
        }
		return false;
	}

}

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

int main() {
  int n,chk;
  cin >> n;
  int a[n];
  int min = n+ 100;
  int c=0;
  for (int i=0;i<n;i++){
    cin >> a[i];
    if (min > a[i]){
      min = a[i];
      c++;
    }
  }
  cout << c << endl;
  return 0;
}


Measured memory_bytes: 1024
# util functions

# debug
$debugFlag = ( ARGV[0] != nil )
p "==== DEBUG MODE ====" if $debugFlag

# input
lpre = nil
l = $stdin.gets

cnt = 1
h_run = {} # num => incr
while l = $stdin.gets do
  lcur = l.to_i
  next if lpre == lcur
  lpre = lcur

  if h_run[ lcur ] == nil
    h_run[ lcur ] = cnt
  else
    cnt += h_run[ lcur ]
    h_run[ lcur ] = cnt
  end

end

print "ans: " if $debugFlag
puts cnt % (10**9 + 7)

Measured memory_bytes: 32552
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(ll i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(ll i = m; i <= n; i++)
#define FORR(i, m, n) for(ll i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n)
#define MAX 100000
#define mod 1000000007
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;
using graph = vector<vector<int>>;
using Grid = vector<vector<bool>>;

int main() {
    //cin高速化
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, ans, sum;
    cin >> n;
    vll a(n, 0);
    ans = 0;
    sum = 0;
    REP(i, n){
        cin >> a[i];
        sum += a[i];
        sum %= mod;
    }

    REP(i, n){
        sum -= a[i];
        if (sum < 0) sum += mod;
 
        ans += a[i] * sum;
        ans %= mod;
    }

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

Measured memory_bytes: 4780
#include <iostream>
#include <math.h>
#include <string>
#include <stdio.h>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <iomanip>
//#include <boost/integer/common_factor_rt.hpp> // gcd, lcm
//#include <bits/stdc++.h>

using namespace std;

int main()
{
	int a,b,c,d;
	cin >> a >> b >> c >> d;
	while (a > 0 && c > 0)
	{
		c -= b;
		a -= d;
	}
	if (c <= 0)
	{
		cout << "Yes" << endl;
	}
	else
		cout << "No" << endl;
}


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

#define swap(type,a,b) {type t; t=a; a=b; b=t;}
#define forN(i,n) for(int i=0;i<n;i++)
#define forS(i,start,n) for(int i=start;i<n;i++)
#define ll long long
#define pb(t,d,n) {t p;int i;forN(i,n){cin>>p;d.push_back(p);}}
#define DOUBLE fixed << setprecision(15)

using namespace std;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;

int main(){
    int n,m,k,cnt=0;

    int tmp;
    double res=0.;
    cin >> n >> k;
    int ptr=n;
    int border = k;
    for(int i=0;i<log2(k)+1;i++){
        tmp = ptr - border;
        if(tmp >= 0){
            res += (double)(tmp+1)/(double)(pow(2,i)*n);
            ptr = border - 1;
        }
        border = (border%2==0?border:border+1)/2;
    }
    cout << DOUBLE <<res << endl;
}

Measured memory_bytes: 4116
#include <bits/stdc++.h>
using namespace std;
using edges = vector<int>;
using graph = vector<unordered_map<int, edges>>;

const int INF = 1e9;
//
graph G;
vector<int> d;
vector<unordered_set<int>> used;
queue<int> q;

void dfs(int i, int c, int dist) {
  used[i].insert(c);
  if (d[i] == -1) {
    d[i] = dist;
    q.push(i);
  }
  for (auto&& j : G[i][c]) {
    if (used[j].count(c)) continue;
    if (d[j] != -1 && d[j] < dist) continue;
    dfs(j, c, dist);
  }
}

void dijkstra(int s) {
  int N = G.size();
  d.assign(N, -1); d[s] = 0;
  used.resize(N);
  q.push(s);
  while (!q.empty()) {
    int i = q.front(); q.pop();
    for (auto&& itr : G[i]) {
      int c = itr.first;
      if (!used[i].count(c)) dfs(i, c, d[i] + 1);
    }
  }
}

int main() {
  int N, M; cin >> N >> M;
  G.resize(N);
  for (int i = 0; i < M; ++i) {
    int p, q, c; cin >> p >> q >> c;
    --p; --q;
    G[p][c].push_back(q);
    G[q][c].push_back(p);
  }
  dijkstra(0);
  cout << d[N - 1] << endl;
  return 0;
}


Measured memory_bytes: 67840
#include <cstdio>

int main()
{
    int r, c, tmp;
    scanf("%d %d", &r, &c);
    int lst[r+1][c+1];

    for (int i = 0; i <= r; i++){
        for (int j = 0; j <= c; j++){
            lst[i][j] = 0;
        }
    }

    for (int i = 0; i < r; i++){
        for (int j = 0; j < c; j++){
            scanf(" %d", &lst[i][j]);
        }
    }

    
    for (int i = 0; i <= r; i++){
        for (int j = 0; j <= c; j++){
            if (i < r && j < c){
                lst[i][c] += lst[i][j];
                lst[r][j] += lst[i][j];
            }
            else {
                lst[r][c] += lst[i][j];
            }
        }
    }

    lst[r][c] /= 4;

    for (int i = 0; i <= r; i++){
        for (int j = 0; j <= c; j++){
            if (j != c){
                printf("%d ", lst[i][j]);
            }
            else {
                printf("%d\n",lst[i][j]);
            }
        }
    }

    return 0;
}

Measured memory_bytes: 1064
/*input
1
1000
*/

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

int main() {
    int n;
    cin >> n;
    double ans;
    double a;
    for (int i = 0; i < n; i++) {
        cin >> a;
        ans += 1/a;
    }
    printf("%.6f\n", 1/ans);
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>
#include<random>
using namespace std;

int main()
{
	int n, l, r, curr, pre;
	
	vector<int> ans;
	while (1)
	{
		cin >> n >> l >> r;
		vector<int> m(n);
		if (n == 0 && l == 0 && r == 0) break;
		int max = 0;
		pre = 0;
		for (int i = 0; i < n; ++i)
			cin >> m[i];
		int diff = 0;
		for (int i = 0; i < r - l + 1; ++i)
		{
			if (diff <= m[i + l - 1] - m[i + l])
			{
				diff = m[i + l - 1] - m[i + l];
				max = i + l;
			}
		}
		ans.push_back(max);
	}
	for (const auto& a : ans)
		cout << a << endl;
	return 0;

}


Measured memory_bytes: 3052
// problem: "https://atcoder.jp/contests/abc142/tasks/abc142_e"

#include<bits/stdc++.h>

using namespace std;

int minCost(int j,int i,vector<vector<int>>&dp,vector<int>&Cost,vector<int>&State,int n)
{
    if(i == (1<<n)-1)
        return 0;

    if(j == -1)
        return (int)(1e9);

    if(dp[j][i] == -1)
        dp[j][i] = min(minCost(j-1,i,dp,Cost,State,n),Cost[j]+minCost(j-1,i|State[j],dp,Cost,State,n));

    return dp[j][i];
}

int main()
{
    int n,m;

    cin>>n>>m;

    vector<int>Cost,State;
    int i,j;

    for(i=0;i!=m;i++)
    {
        int a,b,s;
        cin>>a>>b;

        Cost.push_back(a);

        s = 0;
        for(j=0;j!=b;j++)
        {
            int x;

            cin>>x;

            s += 1<<(x-1);
        }

        State.push_back(s);
    }

    vector<vector<int>>dp(m,vector<int>((1<<n),-1));

    if(minCost(m-1,0,dp,Cost,State,n) > 1e8)    // define
        cout<<-1;
    else
        cout<<minCost(m-1,0,dp,Cost,State,n);

    return 0;
}


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

m = 1000
kabu = 0
for i in range(n-1):
    if a[i] < a[i+1]:
        x = m//a[i]
        kabu += x
        m -= x*a[i]
    else:
        m += kabu*a[i]
        kabu = 0
print(m+(kabu*a[-1]))

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

int main()
{
ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;cin>>n;
    long long int A[n];
    for(int i=0;i<n;i++)cin>>A[i];
    long long int sum=0;long long int min=A[0];
    for(int i=1;i<n;i++){
    	if(A[i]<min)sum=sum+min-A[i];
    	else min=A[i];
	}
	cout<<sum;
return 0;
}


Measured memory_bytes: 5108
#include <stdio.h>

int main(int argc, const char * argv[]){
    int m, f, r;
    int s;
    
    while (1) {
        scanf("%d%d%d", &m, &f, &r);
        if (m == -1 && f == -1 && r == -1) break;
        
        if (m < 0 || f < 0) puts("F");
        else {
            s = m + f;
            if (s >= 80) puts("A");
            else if (s >= 65) puts("B");
            else if (s >= 50) puts("C");
            else if (s < 30) puts("F");
            else puts(r >= 50 ? "C" : "D");
        }
    }
    return 0;
}



Measured memory_bytes: 2136
h, w = map(int, input().split())
s = []
for j in range(h):
  s.append(list(map(str, input())))
  
def check(x, y):
  if x >= h or x < 0 or y >= w or y < 0:
    return False
  if s[x][y] ==  ".":
    return True
  else:
    return False

phase = 1
queue = [[0,0]]
while len(queue) > 0:
  tmp = []
  for q in queue:
    s[q[0]][q[1]] = phase
    if check(q[0] + 1, q[1]):
      tmp.append([q[0] + 1, q[1]])
    if check(q[0] - 1, q[1]):
      tmp.append([q[0] - 1, q[1]])
    if check(q[0], q[1] + 1):
      tmp.append([q[0], q[1] + 1])
    if check(q[0], q[1] - 1):
      tmp.append([q[0], q[1] - 1])
  queue = list(map(list, set(map(tuple, tmp)))) # 重複するリストを除く
  phase += 1
count = 0
for i in range(h):
  count += s[i].count("#")
if s[h-1][w-1] == ".":
  print(-1)
else:
  print(h*w - count - s[h-1][w-1])

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
using namespace std;
int main(){
    int x;
    cin>>x;
    ll ans=0;
    ll now=0;
    ll i=1;
    while (now<x){
        now+=i;
        i++;
        ans++;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define M 1000000007LL
#define rep(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define sep(i,a,b) for(ll i=(ll)a;i>=(ll)b;i--)
#define mll map<ll,ll>
#define vl vector<ll>
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define sz(v) ((ll)v.size())
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pii pair<ll,ll> 
#define mod 1000000007
#define MAXN 300002
int dp[101][101];
int subsequenceCount(string S, string T)
{
   int i,j;
   for(i=0;i<=100;i++) for(j=0;j<=100;j++) dp[i][j]=(int)(j==0);
    dp[0][1]=(S[0]==T[0]);
   for(i=1;i<S.size();i++)
    for(j=1;j<=T.size();j++)
    {
      dp[i][j]=dp[i-1][j];
      if(S[i]==T[j-1])
        dp[i][j]+=dp[i-1][j-1];
    }

    return dp[S.size()-1][T.size()];
}

int main() {
       ios::sync_with_stdio(false);
       cin.tie(0);
       cout.tie(0);
       ll a,b,c;
       cin>>a>>b>>c;
       cout<<min(c,b/a);
       return 0;

}

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

int main(void){
    int n,i,len,dt;
    scanf("%d",&n);
    int t[n+1],x[n+1],y[n+1];
    t[0]=0;
    x[0]=0;
    y[0]=0;
    for(i=1;i<n+1;i++){
        scanf("%d %d %d", &t[i], &x[i], &y[i]);
    }

    for(i=0;i<n;i++){
        len=abs(x[i+1]-x[i])+abs(y[i+1]-y[i]);
        dt=t[i+1]-t[i];
        if(dt<len||(dt-len)%2){
            printf("No\n");
            return 0;
        }
    }
    printf("Yes\n");
    return 0;
}

Measured memory_bytes: 1280
from itertools import takewhile

S = input()


# 中央から同一の数字が何個並ぶかによって解は求まる
N = len(S)
M = N // 2
ans = M + len(
    list(
        takewhile(
            lambda i:
                S[M] == S[M - i - 1] == S[M + i] if N % 2 == 0 else
                S[M] == S[M - i] == S[M + i],
            range(N - M)
        )
    )
)

print(ans)


Measured memory_bytes: 5164
#include<stdio.h>

int A[2000],M[2000],n,flag;

void solve(int i,int m){
  if(m==0) flag=1;
  else if(i <= n){
    solve(i+1,m-A[i]);
    solve(i+1,m);
  }
}

int main(){
  int i,q;

  scanf("%d",&n);
  // if(n>20)printf("範囲外\n");

  for(i=0 ; i<n ; i++){
    scanf("%d",&A[i]);
  }

  scanf("%d",&q);
  // if(q>20)printf("範囲外\n");

  for(i=0 ; i<q ; i++){
    scanf("%d",&M[i]);
  }

  for(i=0 ; i<q ; i++){
    flag = 0;
    solve(0,M[i]);
    if(flag==1){
      printf("yes\n");
    }
    else printf("no\n");
    
  }

  return 0;
}

Measured memory_bytes: 588
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
#define mm(a,x) memset(a,x,sizeof(a))
#define sync std::ios::sync_with_stdio(false);std::cin.tie(0)
#define ll long long
using namespace std;
int n,m,x;
int a[15][15];
ll sum[15],tmp[15];
ll res=0x3f3f3f3f;
void dfs(int i)
{
    res=min(res,tmp[0]);
    bool flag=true;
    for(int j=1;j<=m;++j)
    {
        if(tmp[j]-a[i][j]<x)
            flag=false;
    }
    if(flag)
    {
        for(int j=0;j<=m;++j)
            tmp[j]-=a[i][j];
        res=min(res,tmp[0]);
    }
    for(int j=i+1;j<=n;++j)
        dfs(j);
    if(flag)
    {
        for(int j=0;j<=m;++j)
            tmp[j]+=a[i][j];
    }
}
int main(void)
{
    sync;
    cin>>n>>m>>x;
    for(int i=1;i<=n;++i)
    {
        for(int j=0;j<=m;++j)
        {
            cin>>a[i][j];
            sum[j]+=a[i][j];
        }
    }
    for(int i=1;i<=m;++i)
        if(sum[i]<x)
        {
            cout<<-1<<endl;
            return 0;
        }
    for(int i=1;i<=n;++i)
    {
        for(int j=0;j<=m;++j)
            tmp[j]=sum[j];
        dfs(i);
    }
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 3648
//by Judge
#pragma GCC optimize("Ofast")
#define HGS_AK_IOI true
#include<cstdio>
#include<cstring>
#include<iostream>
#define Rg register
#define fp(i,a,b) for(Rg int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(Rg int i=(a),I=(b)-1;i>I;--i)
#define ll long long
using namespace std;
const int mod=998244353;
const int M=1e7+3;
typedef int arr[M];
char buf[1<<21],*p1=buf,*p2=buf;
int n,ans; arr pw2,fac,inv;
inline int mul(int x,int y){return 1ll*x*y%mod;}
inline void Pls(int& x,int y){if((x+=y)>=mod)x-=mod;}
inline int qpow(int x,int p=mod-2){ Rg int s=1;
	for(;p;p>>=1,x=mul(x,x)) if(p&1) s=mul(s,x); return s;
}
inline int C(int n,int m){ return mul(fac[n],mul(inv[m],inv[n-m])); }
int main(){ cin>>n,pw2[0]=fac[0]=1,ans=qpow(3,n);
	fp(i,1,n) pw2[i]=mul(pw2[i-1],2),fac[i]=mul(fac[i-1],i);
	inv[n]=qpow(fac[n]); fd(i,n,1) inv[i-1]=mul(inv[i],i);
	fp(i,0,(n-1)>>1) Pls(ans,mod-mul(pw2[i+1],C(n,n-i))); return !printf("%d\n",ans);
}

Measured memory_bytes: 119040
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <list>
#include <algorithm>
#include <set>
#include <queue>
#include <math.h>

using namespace std;
#define ll long long

ll sumation(ll n){
    return (n*(n+1))/2;
}

int main()
{
    //freopen("aa_input.txt", "r", stdin);
    ll n;
    cin>>n;
    
    ll sum = sumation(n);

    ll three = sumation(n/3)*3;
    ll five  = sumation(n/5)*5;
    ll three_five = sumation(n/15)*15;
    cout<<sum-(three+five)+three_five<<endl;
    
    
    return 0;
}
/*

riaadmorshed@gmail.com

*/

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;
//HDU 627235
//USACO bc083db
//timus 251103FD 
#define all(x) (x).begin(), (x).end()
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define Forn(i, n) for(int i=1; i<=(n); i++)
#define forn(i, n) for(int i=0; i<(n); i++)
#define Foreach(it, a) for(__typeof((a).rbegin()) it=(a).rbegin(); it!=(a).rend(); it++)
#define foreach(it, a) for(__typeof((a).begin()) it=(a).begin(); it!=(a).end(); it++)
/*
    Chasing after you is like a fairytale
    But I 
    Feel like I'm glued on tight
    To this carousel
    
    4008802802 
*/

const int MAX=2e5+5;

int N, ptr, A[MAX];
map<int,int> tmp;

int check(int x)
{
    tmp.clear();
    Forn(i, N-1)
    {
        int dlt=A[i]-A[i-1];
        if(dlt>0) continue;
        map<int,int>::iterator ii=tmp.upper_bound(A[i]);
        tmp.erase(ii, tmp.end());
        int tag=0;
        for(int j=A[i]; j>0; j--)
            if(tmp[j]<x)
            {
                tmp[j]++;
                tag=1;
                break;
            }
            else tmp.erase(tmp.find(j));
//        foreach(it, tmp) cout<<it->f<<" "<<it->s<<endl;
        if(!tag) return 0;
    }
    return 1;
}

void pd()
{
    int tag=1;
    forn(i, N-1) if(A[i+1]<=A[i])
        tag=0;
    if(tag) puts("1"), exit(0);
}

int main()
{
    scanf("%d", &N);
    forn(i, N) scanf("%d", &A[i]);
    pd();
    int l=0, r=1e9;
    while(l+1<r)
    {
        int m=l+r>>1;
        if(check(m)) r=m;
        else l=m;
    }
    printf("%d\n", r+1);
//    cout<<check(2)<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
	string s1,s2;
	cin>>s1;
	cin>>s2;
	int ans=0;
	for(int i=0;i<=s1.size()-s2.size();i++){
		int num=0;
		for(int j=0;j<s2.size();j++)
		if(s1[i+j]==s2[j])num++;
		ans=max(ans,num); 
	}
	cout<<s2.size()-ans<<endl;
	return 0;
} 


Measured memory_bytes: 3612
/*
 * src.cpp
 *
 *  Created on: 2016/07/31
 *      Author: joi
 */

#include <bits/stdc++.h>

using namespace std;

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

const int MAX_N=1e5;

int N,L;
int a[MAX_N];

typedef long long ll;

vector<int> out;

void solve(){
	int c=-1;
	REP(i,N-1){
		if (a[i]+a[i+1]>=L){
			c=i;
			break;
		}
	}
	if (c==-1){
		printf("Impossible\n");
		return;
	}
	printf("Possible\n");
	FOR(i,1,c+1){
		printf("%d\n",i);
	}
	for (int i=N-1;i>c+1;i--){
		printf("%d\n",i);
	}
	printf("%d\n",c+1);
}

int main(){
	scanf("%d %d",&N,&L);
	REP(i,N){
		scanf("%d",&a[i]);
	}
	solve();
	return 0;
}




Measured memory_bytes: 1152
import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))


v=[[1,0],[-1,0],[0,1],[0,-1]]
h,w=mp()
grid=["#"*(w+2)]
ans=[]
for i in range(h):
    grid.append("#"+input()+"#")
grid.append("#"*(w+2))
for i in range(h*w):
    ch=[[0]*(w+2) for i in range(h+2)]
    if grid[i//w+1][i%w+1]==".":
        sx,sy=i//w+1,i%w+1
        que=deque([[sx,sy,0]])
        while len(que):
            q=que.popleft()
            ch[q[0]][q[1]]=1
            ans.append(q[2])
            for x,y in v:
                if grid[q[0]+x][q[1]+y]=="." and ch[q[0]+x][q[1]+y]==0:
                    ch[q[0]+x][q[1]+y]=1
                    que.append([q[0]+x,q[1]+y,q[2]+1])
            
print(max(ans))

Measured memory_bytes: 84060
# include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
typedef pair<LL, LL> pii;
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)

string s;

int main(){
    cin >> s;
    int n = (int)s.size();
    int cnt = 0;
    REP(i, n){
        if(s[i] == 'o')cnt++;
    }
    cout << (cnt + (15 - n) >= 8 ? "YES" : "NO") << endl;
}

Measured memory_bytes: 256
from sys import stdout
printn = lambda x: stdout.write(str(x))
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 999999999
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

n,r = inm()
if n>=10:
    x = r
else:
    x = r+100*(10-n)
print(x)


Measured memory_bytes: 38384
#include <stdlib.h>
#include <cmath>
#include <cstdio>
#include <cstdint>
#include <string>
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
using namespace std;
using ll = long long;

int main(){
  int N;
  cin >> N;
  vector<int> A(N),cp_A(N);
  
  for(int i=0;i<N;i++){
    cin >> A.at(i);
    cp_A.at(i)=A.at(i);
  }
  sort(A.begin(),A.end(),greater<int>());
  for(int i=0;i<N;i++){
    int prev=-1;
    for(int j=0;j<N;j++){
      if(cp_A.at(i)!=A.at(j)){
	cout << A.at(j) << endl;
	break;
      }
      else{
	if(prev==A.at(j)){
	  cout << A.at(j) << endl;
	  break;
	}
	prev=A.at(j);
      }
    }
  }

  return 0;
}


Measured memory_bytes: 3200
#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include<cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include<iostream>
#include<list>
#include<queue>
#include<set>
#include<string>
#include <vector>

#define ll long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define FORR(i,a,b) for(int i=(a);i>=(b);--i)
#define REPR(i,n)   FORR(i,n,0)

using namespace std;

int main(){
	int N;
	int A[100], m, M;
	scanf("%d", &N);
	REP(i, N){
		scanf(" %d", &A[i]);
	}

	m = A[0];
	M = A[0];
	REP(i, N){
		if (m > A[i]){
			m = A[i];
		}
		if (M < A[i]){
			M = A[i];
		}
	}
	printf("%d\n", M - m);

	return 0;
}

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

using namespace std;
 
//#define int long long
using ll = long long;
#define all(v) (v).begin(), (v).end()
#define rep(i,n) for(ll i=0;i<n;i++)
#define reps(i,n) for(ll i=0;i<=n;i++)


ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
 
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

int main(){
    ios_base::sync_with_stdio(false);
    ll a,b,c;
    cin >> a >> b >> c;
    if(c-(a-b)>=0){
    cout << c - (a-b)  << endl;
    }else{
        cout << 0 << endl;
    }
    return 0;
}


Measured memory_bytes: 3588
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ins insert
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
ll modfac(ll a){
    ll ans=1;
    while(a>1){
        ans*=a;
        ans%=1000000007;
        a--;
    }
    return ans;
}
ll modinv(ll a,ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
}
struct UnionFind {
    vector<int> par;
    
    UnionFind(int n) : par(n, -1) {}

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }
    
    bool same(int x, int y) {
        return root(x) == root(y);
    }
    
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y);
        par[x] += par[y];
        par[y] = x;
        return true;
    }
    
    int size(int x) {
        return -par[root(x)];
    }
};
ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
int main(){
    ll n;cin >> n;
    vector<pair<double,double>> v(n);
    rep(i,n)cin >> v[i].fi;
    sort(all(v));
    double a=v[n-1].fi;
    v.erase(v.end());
    rep(i,n-1)v[i].se=abs(v[i].fi-a/2);
    rep(i,n-1)swap(v[i].fi,v[i].se);
    sort(all(v));
    cout << (ll)a << " " << (ll)v[0].se <<endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#pragma gcc optimize("ofast")
using namespace std;

#define ll long long //data types used often, but you don't want to type them time by time
#define ull unsigned long long
#define ui unsigned int
#define mod 1000000000
#define us unsigned short
#define IOS ios_base::sync_with_stdio(0); //to synchronize the input of cin and scanf
#define INF LONG_MAX
#define PI 3.1415926535897932384626
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define rep(x,j,n)for(int x=j;x<n;x++)
typedef vector<pair<ll,ll>> vpi;
typedef vector<ll> vi;
typedef vector<vi> vvi;

ll modexp(ll a,ll b,ll m)
{
	ll r=1;
	a=a%m;
	while(b>0)
	{
		if(b&1)
		    r=(r*a)%m;
		b>>1;
		a=(a*a)%m;
	}
	return r%m;
}


int main(){
    ll a,b; cin>>a>>b;
    string x = "",y = "";
    rep(i,0,a)x+=to_string(b);
    rep(i,0,b)y+=to_string(a);

    if(x>y)cout<<y<<endl;
    else cout<<x<<endl;
    return 0;
}


Measured memory_bytes: 256
/*                        ______
 _______   /\     |``\   |        |  /
    |     /  \    |__/   |____    |/
    |    / _ _\   |  \   |        |\
    |   /      \  |   \  |______  |  \

            Dept. of CSE
        Comilla  University

*/
#include<bits/stdc++.h>
#define pi 2*acos(0.0)
#define ll long long
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define Node struct node
#define spc " "
#define  E  2.71828182845904523536
#define pb push_back
#define pp pop_back
#define valid(nx,ny) nx>=0 && nx<n && ny>=0 && ny<m
#define e endl
#define pii pair<int,int>
#define infinity 1<<30

using namespace std;
map<ll ,ll>check;
#define xam 10000
ll ara[xam];

int main()
{

    ll n,i,j,cc=0,k,x,y=0;
    cin>>n;
   for(i=1;i<=n;i++){
    if(i%3!=0 && i%5!=0)cc+=i;
   }
   cout<<cc<<endl;
return 0;
}


Measured memory_bytes: 3580
#include<bits/stdc++.h>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }


using namespace std;


int main(){
    string S;
    cin >> S;
    string T = "";
    rep(i, S.size()){
        T += "x";
    }

    cout << T << endl;
}


Measured memory_bytes: 256
K, N = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort()
length = []
for i in range(len(A) - 1):
  length.append(A[i + 1] - A[i])
length.append(K - A[-1] + A[0])
print(sum(length) - max(length))


Measured memory_bytes: 26420
#include<bits/stdc++.h>
using namespace std;
#define loop(i,x,z) for (int i=x;i<z;i++)
int n, a, b, c, A[100002],k[4];
string s;
vector<char>ans;
int main()
{
	cin >> n >> a >> b >> c;
	loop(i, 0, n)
	{
		cin >> s;
		if (s == "AB")A[i] = 1, k[1]++, k[2]++;
		else if (s == "BC")A[i] = 2, k[2]++, k[3]++;
		else A[i] = 3, k[1]++, k[3]++;
	}
	loop(i, 0, n)
	{
		if (A[i] == 1)
		{
			k[1]--, k[2]--;
			if (a > b)
			{
				a--;
				b++;
				if (a < 0)
				{
					cout << "No";
					return 0;
				}
				ans.push_back('B');
			}
			else if (b > a)
			{
				a++;
				b--;
				if (b < 0)
				{
					cout << "No";
					return 0;
				}
				ans.push_back('A');
			}
			else
			{
				if (A[i+1]==3)
				{
					a++;
					b--;
					if (b < 0)
					{
						cout << "No";
						return 0;
					}
					ans.push_back('A');
				}
				else
				{
					a--;
					b++;
					if (a < 0)
					{
						cout << "No";
						return 0;
					}
					ans.push_back('B');
				}
			}
		}
		else if (A[i] == 2)
		{
			k[3]--, k[2]--;
			if (c > b)
			{
				c--;
				b++;
				if (c < 0)
				{
					cout << "No";
					return 0;
				}
				ans.push_back('B');
			}
			else if (b > c)
			{
				c++;
				b--;
				if (b < 0)
				{
					cout << "No";
					return 0;
				}
				ans.push_back('C');
			}
			else
			{
				if (A[i+1]==3)
				{
					c++;
					b--;
					if (b < 0)
					{
						cout << "No";
						return 0;
					}
					ans.push_back('C');
				}
				else
				{
					c--;
					b++;
					if (c < 0)
					{
						cout << "No";
						return 0;
					}
					ans.push_back('B');
				}
			}
		}
		else
		{
			k[1]--, k[3]--;
			if (a > c)
			{
				a--;
				c++;
				if (a < 0)
				{
					cout << "No";
					return 0;
				}
				ans.push_back('C');
			}
			else if (c > a)
			{
				a++;
				c--;
				if (c < 0)
				{
					cout << "No";
					return 0;
				}
				ans.push_back('A');
			}
			else
			{
				if (A[i+1]==1)
				{
					a++;
					c--;
					if (c < 0)
					{
						cout << "No";
						return 0;
					}
					ans.push_back('A');
				}
				else
				{
					a--;
					c++;
					if (a < 0)
					{
						cout << "No";
						return 0;
					}
					ans.push_back('C');
				}
			}
		}
	}
	cout << "Yes\n";
	for (auto it : ans)
	{
		cout << it << "\n";
	}
}

Measured memory_bytes: 4160
iterate = 0
n = int(input())
num_list = input().split()
flag = 0
while True:
  i = 0
  while i <= n-1:
    if int(num_list[i])%2 == 1:
      flag = 1
      break
    num_list[i] = int(num_list[i])/2
    i += 1
  if flag == 1:
    break
  iterate += 1

print(iterate)


Measured memory_bytes: 2940
def solve():
    S = input()
    ans = cur = 0
    for c in S:
        if c == 'R':
            cur += 1
        else:
            ans = max(cur, ans)
            cur = 0
    else:
        ans = max(cur, ans)
    print(ans)

if __name__ == "__main__":
    solve()

Measured memory_bytes: 9004