akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define    ll          unsigned long long int
#define    sz          200010
#define    md          1000000007
#define    py          printf("Yes\n")
#define    pn          printf("No\n")
#define    sc1(a)      scanf("%lld",&a)
#define    sc2(a,b)    scanf("%lld %lld",&a,&b)
#define    pv(a)      printf("%lld\n",a)

using namespace std;


int main()
{


    ll n,d=1;
    ll i;



    cin>>n;

    for(i=1;i<=3;i++)
    {
        d=d*n;
    }

    cout<<d<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
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 1000000007
#define inf 100000000000010
#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++)
#define all(x) (x).begin(), (x).end()

typedef vector<pair<ll,ll>> vpi;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll,ll> pi;

bool isprime(ll n)
{
    if(n<=1)return false;
    if(n<=3)return true;
    if(n%2==0||n%3==0)return false;
    for(ll i=5;i*i<=n;i+=6)
    {
        if(n%i==0||n%(i+2)==0)return false;
    }
    return true;
}

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 = b>>1;
        a=(a*a)%m;
    }
    return r%m;
}

struct CustomCompare
{
    bool operator()(const int& lhs, const int& rhs)
    {
        return lhs < rhs;
    }
};


ll builtin_popcount(ll x)
{
    ll cnt = 0;
    for(ll i=60;i>=0;i--)
    {
        if((1LL<<i)&x)cnt++;
    }
    return cnt;
}

ll addmod(ll a,ll b,ll r)
{
    a%=r;
    b%=r;
    return (a+b)%r;
}
ll mulmod(ll a,ll b,ll r)
{
    a%=r;
    b%=r;
    return (a*b)%r;
}
/*
const int mxn = 5*(1e6) +10;
vi spf(mxn);
void sieve()
{
    for(ll i =0;i<mxn;i++)spf[i]  = i;
    for(ll i=2;i<mxn;i+=2)spf[i] = 2;
    for(ll i = 3;i*i<mxn;i++)
    {
        if(spf[i]==i)
        {
            for(ll j = i*i;j<mxn;j+=i)
            {
                if(spf[j]==j)spf[j] = i;
            }
        }
    }
}
*/


int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
ll d,t,s; cin>>d>>t>>s;
if(d<=t*s)cout<<"Yes\n";
else cout<<"No\n";
return 0;
}
/*
1
4
1 2
2 3
3 4
2
2 2
*/


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

#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl
#define rep(i, n) for (int i = (int)(0); i < (int)(n); i++)
#define repp(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define all(v) v.begin(), v.end()
#define dump(v)                  \
    cerr << #v ":[ ";            \
    for (auto macro_vi : v) {    \
        cerr << macro_vi << " "; \
    }                            \
    cerr << "]" << endl;
#define ddump(v)                           \
    cerr << #v ":" << endl;                \
    for (auto macro_row : v) {             \
        cerr << "[";                       \
        for (auto macro__vi : macro_row) { \
            cerr << macro__vi << " ";      \
        }                                  \
        cerr << "]" << endl;               \
    }
using lint       = long long;
const int INF    = 1e9;
const lint LINF  = 1e18;
const lint MOD   = 1e9 + 7;
const double EPS = 1e-10;

int main() {
    int N;
    string S;
    cin >> N >> S;

    int l = 0, r = N - 1;

    int cnt = 0;
    while (1) {
        while (l < r and S[l] == 'R')
            l++;

        while (l < r and S[r] == 'W')
            r--;

        dd(l, r);
        if (l == r) break;

        cnt += 1;
        if (l + 1 == r) { break; }
        l++, r--;
    }
    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 3776
#!/usr/bin/env python3
import sys

line = sys.stdin.readline().strip()
N = int(line)
line = sys.stdin.readline().strip()
A = [int(x) for x in line.split()]

m = 2 << 31-1
for a in A:
    m = min(m, a & -a)
print(len(bin(m))-3)


Measured memory_bytes: 2940
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int main(){
	int n,k,a[101001]={};
	int idx=-1,mn=mod;
	cin>>n>>k;
	FOR(i,0,n){
		cin>>a[i];
		if(a[i]==1){
			idx=i;
		}
	}
	FOR(i,0,n){
		if(idx>=i+k)continue;
		if(idx<i)continue;
		int l=i,r=i+k-1;
		int tm=(l+k-2)/(k-1)+(n-1-r+k-2)/(k-1)+1;
		mn=min(mn,tm);
	}
	cout<<mn<<endl;
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>

using namespace std;
 
int main(){
    long long H,W;
    vector<string> C;
 
    cin >> H >> W;

    for(int i = 0; i < H; i++){
        string c;
        cin >> c;
        C.push_back(c);
    }

    for(int i = 0; i < H; i++){
        for(int j = 0; j < 2; j++){
            cout << C[i] << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define all(a)  (a).begin(),(a).end()
typedef long long ll;
const ll mod=1000000007;
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)

int main() {
  int n,m;cin >>n>>m;
  int box[n];
  set<int> red_in;
  red_in.insert(0);
  repi(i,0,n)box[i] =1;
  repi(i,0,m){
    int x,y; cin >> x>>y;
    --x;--y;
    box[x] -=1;
    box[y] +=1;
    if(red_in.find(x) != red_in.end()){
      red_in.insert(y);
    }
    if(box[x]==0) red_in.erase(x);
  }
  int out =0;
  repi(i,0,n){
    //cout << box[i] << endl;
    if(box[i]>0){
      if(red_in.find(i) != red_in.end()) ++out;
    }
  }
  cout << out << endl;

  return 0;
}


Measured memory_bytes: 5376
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1e9
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef vector<vector<int>> matrix;
typedef pair<ll, int> p;

int n, m, s, t;
matrix w;
vector<ll> cost;
vector<bool> dicision;
priority_queue<p, vector<p>, greater<p>> pq;

void input() {
    cin >> n >> m;
    w = matrix(3*n);
    rep(i, m) {
        int u, v;
        cin >> u >> v;
        u--;
        v--;
        w[u].push_back(v+n);
        w[u+n].push_back(v+2*n);
        w[u+2*n].push_back(v);
    }
    cin >> s >> t;
    s--;
    t--;
}

void dijkstra () {
    cost = vector<ll>(3*n, INF);
    dicision = vector<bool>(3*n, false);
    cost[s] = 0;
    pq.push(make_pair(0, s));
    while (!pq.empty()) {
        p x = pq.top();
        pq.pop();
        if (dicision[x.second]) continue;
        dicision[x.second] = true;
        for (int i : w[x.second]) {
            if (dicision[i]) continue;
            if (cost[i] > x.first + 1) {
                cost[i] = x.first + 1;
                pq.push(make_pair(cost[i], i));
            }
        }
    }
}

int main() {
    input();
    dijkstra();
    if (cost[t] == INF) {
        cout << -1 << endl;
        return 0;
    }
    cout << cost[t] / 3 << endl;
}


Measured memory_bytes: 19072
N, D = map(int, input().split())

list = []
for i in range(N):
    list.append(input().split(" "))

count = 0
for i in range(N-1):
    for j in range(i+1,N):
        distance = 0
        for k in range(D):
            distance += (int(list[i][k]) - int(list[j][k]))**2
        distance = distance ** 0.5
        if(distance - int(distance)==0):
            count += 1

print(count)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main(){
  int n, m;
  cin >> n >> m;
  vector<pair<int, int>> vp(m);
  rep(i, m){
    int a, b;
    cin >> a >> b;
    vp.at(i) = {a, b};
  }
  rep(i, 1000){
    string is = to_string(i);
    if(is.size() != n) continue;
    bool f = false;
    for(auto p : vp){
      if(is.at(p.first-1) != '0' + p.second){
        f = true;
        break;
      }
    }
    if(f == false){
      cout << is << endl;
      return 0;
    }
  }
  cout << -1 << endl;
  return 0;
}

Measured memory_bytes: 3652
n = int(input())
ai = {}
max1 = 0
max2 = 0
for i in range(1, n+1):
    tmp = int(input())
    ai.setdefault(i, tmp)
    if tmp > max1:
        max2 = max1
        max1 = tmp
    elif tmp > max2:
        max2 = tmp

for i in range(1, n+1):
    if ai[i] == max1:
        print(max2)
    else:
        print(max1)


Measured memory_bytes: 32604
/*input
2
1 2 1 2 2 1
*/

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
void chmax(int& a, int b) { a = max(a, b);}

int dp[2005][2005];

int main() {
    int n;
    cin >> n;
    int n3 = n*3;
    vector<int> A(n3);
    rep(i, n3) cin >> A[i], --A[i];
    int m = n+1;
    rep(i, m) rep(j, m) dp[i][j] = -1e9;
    auto upd = [&](int i, int j, int x) {
        chmax(dp[i][j], x);
        chmax(dp[j][i], x);
        chmax(dp[i][n], x);
        chmax(dp[n][i], x);
        chmax(dp[n][j], x);
        chmax(dp[j][n], x);
        chmax(dp[n][n], x);
    };
    upd(A[0], A[1], 0);

    int base = 0;
    for (int ai = 2; ai < n3-1; ai += 3) {
        int x = A[ai], y = A[ai+1], z = A[ai+2];
        if (x == y && y == z) {
            ++base;
            continue;
        }
        vector<tuple<int, int, int>> q;
        rep(ri, 3) {
            {
                rep(a, m) {
                    int now = dp[a][n];
                    if (y == z) chmax(now, dp[a][y]+1);
                    q.emplace_back(a, x, now);
                }
            }
            {
                int now = max(dp[n][n], dp[z][z]+1);
                q.emplace_back(x, y, now);
            }
            swap(x, y); swap(y, z);
        }

        for (auto t: q) {
            int i, j, x;
            tie(i, j, x) = t;
            upd(i, j, x);
        }
    }

    int ans = dp[n][n];
    int l = A[n3-1];
    chmax(ans, dp[l][l]+1);
    ans += base;
    cout << ans << endl;
}

Measured memory_bytes: 19424
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size1,init=nil,size2=-1) #size2に二次元配列時の最初の要素数、size1に次の配列の大きさ、initに初期値を投げることでその配列を返す
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

N=gets.to_i
S=get_nsp
r=[]
g=[]
b={}
nb=0
S.each_with_index do|s,i|
    case s
    when "R" then
        r.push(i)
    when "G" then
        g.push(i)
    when "B" then
        b[i]=1
        nb+=1
    end
end
ans=0
r.each do|r_|
    g.each do|g_|
      ans+=nb
      mid=(r_+g_)/2
      if (r_+g_).even? and  not b[mid].nil?
        ans-=1
      end
      h=r_<g_ ? r_ : g_
      t=r_<g_ ? g_ : r_
      unless b[2*t-h].nil?
          ans-=1
      end
      unless b[2*h-t].nil?
          ans-=1
      end
    end
end
puts ans

Measured memory_bytes: 14480
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
#define inf 1e9

vector<vector<int> > wl;
vector<int> wn;
int n;
int cnt;
void dfs(int x,int y){
 //   cout<<x<<' '<<y<<endl;
    if( x== n-1 && y == n ){
	if( wn[x] == 0 ) cnt++;
	 return;
    }
    if( x== y ){
	dfs(x,y+1);
	return;
    }
    
    if( wl[x][y] == 0 ){
	for(int w=1;w>=-1;w-=2){
	    wl[x][y] == w;
	    wl[y][x] == -w;
	    wn[x] += w;
	    wn[y] -= w;
	    if( -n+y < wn[x]&&wn[x] < n-y)
	    if( y == n-1 ){
		if(wn[x]==0)dfs(x+1,x+2);
	    }else{
		dfs(x,y+1);
	    }
	    wl[x][y] = 0;
	    wl[y][x] = 0;
	    wn[x] -=w;
	    wn[y] +=w;
	}
    }else{
	if(-n+y  <wn[x]&& wn[x]<n-y) 
	if( y == n-1 ){
	    if(wn[x]==0)dfs(x+1,x+2);
	}else{
	    dfs(x,y+1);
	}
    }
}


int main(){
    while(1){
	cin>>n;
	if(n==0)break;
	cnt = 0;
	wl = vector<vector<int> >(n,vector<int>(n,0) );
	wn = vector<int>(n,0);
	int m;
	cin>>m;
	for(int i=0;i<m;i++){
	    int x,y;
	    cin>>x>>y;
	    x--,y--;
	    wl[x][y] =  1;
	    wl[y][x] = -1;
	    wn[x]++;
	    wn[y]--;
	}
	dfs(0,1);
	//dfs(0,0,-1);
	cout<<cnt<<endl;
    }
    return 0;
}



Measured memory_bytes: 3116
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <assert.h>
#include <memory.h>
#include <queue>
#include <string.h>
using namespace std;

#define N 100002
#define ll long long

ll f(ll b,ll n) {
  if(n<b) return n;
  return f(b,n/b) + n%b;
}
void solve() {
  ll n,s;scanf("%lld %lld ",&n,&s);
  if(s==n) {
    printf("%lld\n", n+1);
    return;
  }
  ll b = 2;
  for(b = 2;b*b<=n;++b) {
    if(f(b,n)==s) {
      printf("%lld\n", b);
      return;
    }
  }
  const ll st = b;
  if(st<=n) {
    ll lim = n/st;
    for(ll k = lim;k>=1;--k) {
      ll l,r,mid;
      ll x,y;
      l = st,r = n;
      while(l<r) {
        mid = (l+r)/2;
        if(n/mid>k) {
          l = mid+1;
        } else {
          r = mid;
        }
      }
      if(n/l!=k) {
        continue;
      }
      x = l;
      r = n;
      while(l<r) {
        mid = (l+r+1)/2;
        if(n/mid==k) {
          l = mid;
        } else {
          r = mid-1;
        }
      }
      y = l;
      ll rem = n-s+k;
      if(rem<0 || rem%k!=0) {
        continue;
      }
      rem = rem/k;
      if(x<=rem && rem<=y && n-rem*k + k ==s) {
        printf("%lld\n", rem);
        return;
      }
    }
  }
  printf("-1\n");
}

int main() {
  //freopen("input.txt","r",stdin);
  solve();
  return 0;
}


Measured memory_bytes: 384
eval'N,M,A,*B='+`dd`.split*?,
s=[x=0]*9**6
B.map{|b|c=b;A>b&&b+=M;x+=b-A
[0,M].map{|m|s[m-~A]+=1;s[m+b]+=A-b;s[m-~b]+=b+~A}
A=c}
2.times{c=0;s=s.map{|s|c+=s}}
p x-s.max

Measured memory_bytes: 48796
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i = 0;i<((ll)(n));i++)
#define reg(i,a,b) for(ll i = ((ll)(a));i<=((ll)(b));i++)
#define irep(i,n) for(ll i = ((ll)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(ll i = ((ll)(b));i>=((ll)(a));i--)
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

/*
*/

ll t[2],a[2],b[2],c[2];
ll p,q;

int main(void){
	rep(i,2)cin>>t[i];
	rep(i,2)cin>>a[i];
	rep(i,2)cin>>b[i];
	p=(a[0]-b[0])*t[0];
	q=p+(a[1]-b[1])*t[1];
	if(p>0){
		p=-p;
		q=-q;
	}
	if(q==0){
		cout<<"infinity"<<endl;
	}else if(q<0){
		cout<<0<<endl;
	}else{
		ll s=0,ans=0;
		s+=abs(p)/q;
		ans+=2*s;
		if(p+s*q<0)ans++;
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
 
int main(void) {
    double H, W, h, w;
    cin >> H >> W >> h >> w;
    cout << (H * W) - ((h * W + w * H) - (h * w))   << endl; 
    return 0;
}


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

#define V vector
typedef long long ll;
typedef unsigned long long ull;

typedef V<int> vi;
typedef V<ll> vll;
typedef V<string> vs;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define f(i,a) for(int i = 0 ; i < a ; i++)
#define fll(i,a) for(ll i = 0 ; i < a ;i++)
#define forab(i,a,b) for(int i = a ; i < b ; i++)
#define prec(x) cout<<fixed<<setprecision(x)
#define ff first
#define ss second

#define pb push_back
#define mp make_pair
#define numberofdigits(x) floor(log10(x)) + 1

ll M = 1e7 + 7;

ll binpow(ll a, long long b) {
	ll res = 1;
	while (b > 0) {
		if (b & 1)
			res = (res * a);
		a = (a * a);
		b >>= 1;
	}
	return res;
}



int main() {

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


	int n , x , t;
	cin >> n >> x >> t;

	cout << ((n + x - 1) / x) * t;

	return 0;
}





Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rea(i, a, b) for (int i = (a); i < (b); i++)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((int)(x).size())
#define PRINT(V) for (auto v:(V)) {cerr << v << " ";} cerr << endl
#define dump(x) cerr << #x << " : " << (x) << endl
#define dump2(x, y) cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")" << endl
inline ll GCD(ll a, ll b){return b ? GCD(b, a % b) : a;}
const ll MOD = 1000000007;
const ll INF = 100000000000000000LL;
/* END OF TEMPLATE */

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    ll n, x;
    cin >> n >> x;
    vll a(n);
    rep(i, n){
        cin >> a[i];
    }
    ll ans = 0;
    ans += max(a[0] - x, 0LL);
    a[0] = min(a[0], x);
    rea(i, 1, n){
        ll b = a[i-1] + a[i];
        ans += max(b - x, 0LL);
        a[i] = min(a[i], x - a[i-1]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
        Scanner sc = new Scanner(System.in);
        int r = sc.nextInt();
        
        int menseki = 3*(r*r);
        
        System.out.print(menseki);
		
		
	}

}

Measured memory_bytes: 21844
SA = input()
SB = input()
SC = input()
turn = "a"
while 1:
    if turn=="a":
        if SA=="":
            win="A"
            break
        else:
            turn=SA[0]
            SA = SA[1:]
    elif turn=="b":
        if SB=="":
            win="B"
            break
        else:
            turn=SB[0]
            SB = SB[1:]
    if turn=="c":
        if SC=="":
            win="C"
            break
        else:
            turn=SC[0]
            SC = SC[1:]
print(win)

Measured memory_bytes: 38256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int min(int x, int y){return x < y ? x : y;}
int main(){
	int n; cin >> n;
	int b[n-1];
	for(int i = 0; i < n-1; i++) cin >> b[i];
	int a[n];
	if(n>2){
		a[n-1] = b[n-2];
		for(int i = n-2; i > 0; i--) a[i] = min(b[i], b[i-1]);
		a[0] = b[0];
	}
	else a[0] = a[1] = b[0];
	long long int ans = 0;
	for(int i = 0; i < n; i++) ans += a[i];
	cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int X = sc.nextInt();
        int[] L = new int[N];
        for (int i = 0; i < L.length; ++i) {
            L[i] = sc.nextInt();
        }

        System.out.println(solve(L, X));

        sc.close();
    }

    static int solve(int[] L, int X) {
        int result = 1;
        int pos = 0;
        for (int Li : L) {
            pos += Li;
            if (pos <= X) {
                ++result;
            }
        }

        return result;
    }
}

Measured memory_bytes: 35848
import sys
import os
import collections

def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = int(sys.stdin.buffer.readline().rstrip())
    A = list(map(int, sys.stdin.buffer.readline().split()))

    obj = collections.Counter(A)

    p = 0
    for v in obj.values():
        if v > 1:
            p += v * (v - 1) // 2

    for a in A:
        print(p - (obj[a] - 1))


if __name__ == '__main__':
    main()


Measured memory_bytes: 25568
#include<stdio.h>

int main(void)
{
   int a,b,max;

   scanf("%d%d",&a,&b);
   max=a+b;
   if(max<a-b)
      max=a-b;

   if(max<a*b)
      max=a*b;

   printf("%d\n",max);
   return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include<bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
ll a,b,n,ch[100000],rans;
queue<P> que;
vector<P> v;
map<ll,ll> mp[100000];
vector<ll>v1[100000],ans;
int main(void){
    cin>>n;
    for(int i=0;i<n-1;i++){
        cin>>a>>b;
        a--,b--;
        v.push_back({a,b});
        v1[a].push_back(b);
        v1[b].push_back(a);
    }
    que.push({0,0});
    while(!que.empty()){
        auto q=que.front();
        que.pop();
        ll L=1;
        ch[q.F]=1;
        for(auto x:v1[q.F]){
            if(ch[x]==0){
                if(L==q.S)L++;
                mp[x][q.F]=L;
                mp[q.F][x]=L;
                que.push({x,L});
                L++;
            }
        }
    }
    for(auto x:v){
        rans=max(rans,mp[x.F][x.S]);
        ans.push_back(mp[x.F][x.S]);
    }
    cout<<rans<<endl;
    for(int i=0;i<n-1;i++){
        cout<<ans[i]<<endl;
    }
}


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


public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic 
        Scanner sc=new Scanner(System.in);
        int c[][]=new int[4][4];
        int a1=1,a2,a3,b1=1,b2,b3;
        for(int i=1;i<=3;i++)
            for(int j=1;j<=3;j++){
                c[i][j]=sc.nextInt();
            }
        int row1=c[1][1]+c[1][2]+c[1][3];
        int row2=c[2][1]+c[2][2]+c[2][3];
        int row3=c[3][1]+c[3][2]+c[3][3];
        int col1=c[1][1]+c[2][1]+c[3][1];
        int col2=c[1][2]+c[2][2]+c[3][2];
        int col3=c[1][3]+c[2][3]+c[3][3];
        if((row2-row1)%3!=0||(row3-row2)%3!=0||(row3-row1)%3!=0||(col2-col1)%3!=0||(col3-col2)%3!=0||(col3-col1)%3!=0){
            System.out.println("No");
        }
        else{
        a2=(row2-row1)/3+a1;
        a3=(row3-row2)/3+a2;
        b2=(col2-col1)/3+b1;
        b3=(col3-col2)/3+b2;
        if(a3-a1==(row3-row1)/3&&b3-b1==(col3-col1)/3){
            System.out.println("Yes");
        }
        else{
            System.out.println("No");
        }
        
        }
    }
    
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
//#define int long long

using namespace std;
using LL = long long;
using P = pair<int, int>;

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

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e18;
const int MOD = (int)1e9 + 7;

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

    int n, d, x;
    cin >> n >> d >> x;
    vector<int> a(n);
    REP(i, n) cin >> a[i];
    int ans = x;
    REP(i, n) {
        ans += (d-1)/a[i] + 1;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

#define int long long

const int N = 2e4 + 10, mod = 1e9 + 7;

int dp[N];

int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);    
  int s;
  cin >> s;
  dp[0] = 1;
  for (int i = 3; i <= s; ++i) {
    for (int j = 3; j <= i; ++j) {
      dp[i] += dp[i - j];
      dp[i] %= mod;
    }
  }
  cout << dp[s];
  return 0;
}


Measured memory_bytes: 3660
#include<bits/stdc++.h>
#define rep(i,m) for(long long i=0; i<m; i++)
#define per(i,m) for(long long i=m-1; i>=0; i--)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define ROF(i,n,m) for(long long i=n; i>=m; i--)
#define all(x) (x).begin(),(x).end()
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
using namespace std;
typedef long long ll;
const ll MOD = 998244353;
typedef pair<ll, ll> LP;
 
ll POW(ll m,ll n)
{
  if(n<0) return 0;
  if(n==0) return 1;
  return m*POW(m,n-1)%MOD;
}
 
ll gcd(ll u, ll v) {
  ll r;
  while (0 != v) {
    r = u % v; u = v; v = r;
  }
  return u;
}
 
ll KAI(ll m)
{
  if(m<0) return 0;
  if(m==0) return 1;
  return m*KAI(m-1)%MOD;
}
 
 
 
ll extGCD(ll a, ll b, ll &x, ll &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    ll d = extGCD(b, a%b, y, x);
    y -= a / b * x;
    return d;
}
 
inline ll mod(ll a, ll m) {
    return (a % m + m) % m;
}
 
ll modinv(ll a, ll m) {
    ll x, y;
    extGCD(a, m, x, y);
    return mod(x, m);
}
 
ll COM(ll m,ll n)
{
  if(m<n) return 0;
  if(n<0) return 0;
  if(n==0) return 1;
  if(m==n) return 1;
  return m%MOD*COM(m-1,n)%MOD*modinv(m-n,MOD)%MOD;
}
 
int main()
{
  ll n,m,x,y,a[120],b[120];
  cin >> n >>m >> x >> y;
  rep(i,n)cin >> a[i];
  rep(i,m)cin >> b[i];
  sort(a,a+n);
  sort(b,b+m);
  if(x<y&&a[n-1]<b[0]&&a[n-1]<y&&x<b[0])printf("No War");
  else printf("War");
}

Measured memory_bytes: 256
#ifdef CLION
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
//#define int long long

using namespace __gnu_pbds;
using namespace std;

using ll = long long;
#define int ll
template<typename T>
using oset = tree<
        T,
        null_type,
        less<T>,
        rb_tree_tag,
        tree_order_statistics_node_update>;


#define rep(i, n) for (int i = 0; i < n; i++)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define chkmx(a, b) (a) = max((a), (b))
#define chkmn(a, b) (a) = min((a), (b))

constexpr int MAXN = 5e5;

void run() {
    int n, x;
    cin >> n >> x;
    int tt = x;
    int step = n - x;
    int ans = x;
    int cnt = 0;
    while (true) {
        ans += tt / step * step * 2;
        if (tt % step == 0) break;
        if (!cnt)
            ans += step;
        int pstep = step;
        step = tt % step;
        tt = pstep;
        cnt++;
    }
    if (cnt) ans -= step;
    cout << ans << '\n';
}


signed main() {

#ifdef CLION
    freopen("input.txt", "r", stdin);
#else
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
#endif
    int t = 1;
    //cin >> t;
    while (t--)
        run();
    return 0;
}

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

ll v[200005];

int main(){

    ll n; cin >> n;
    for(int i = 1; i <= n; i++)
        cin >> v[i];

    ll r1 = 0, sum = 0, ispositive = 1;
    for(int i = 1; i <= n; i++){
        sum += v[i];
        if(ispositive and sum <= 0) r1 += abs(sum)+1, sum = 1;
        else if(!ispositive and sum >= 0) r1 += sum+1, sum = -1;
        ispositive = !ispositive;
    }

    ll r2 = 0; sum = 0; ispositive = 0;
    for(int i = 1; i <= n; i++){
        sum += v[i];
        if(ispositive and sum <= 0) r2 += abs(sum)+1, sum = 1;
        else if(!ispositive and sum >= 0) r2 += sum+1, sum = -1;
        ispositive = !ispositive;
    }
    cout << min(r1,r2) << endl;
	return 0;
}


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

template <class T, class U>
void chmin(T& t, const U& u) {
    if (t > u) t = u;
}
template <class T, class U>
void chmax(T& t, const U& u) {
    if (t < u) t = u;
}

int main() {
    string S, T;
    cin >> S >> T;

    int S_size = S.size();
    int T_size = T.size();

    int ans = 100000;
    rep(i, S_size) {
        if (i + T_size - 1 >= S_size) break;

        int cnt = 0;
        rep(j, T_size) {
            if (S[i + j] != T[j]) ++cnt;
        }
        chmin(ans, cnt);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3628
#include<iostream>
#include<cmath>
#include<cstdio>

using namespace std;

const double PI = acos(-1.0);

int main() {
	int n;
	int s[1000];
	double sum = 0;
	double a;
	while (1) {
		cin >> n;
		if (n == 0)break;
		for (int i = 0;i < n;i++) {
			cin >> s[i];
			sum += s[i];
		}
		a = sum / n;
		sum = 0;
		for (int i = 0;i < n;i++)
			sum += (s[i] - a)*(s[i] - a);
		
		printf("%lf\n",sqrt(sum / n));
		sum = 0;
	}
	return 0;
}


Measured memory_bytes: 3132
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
int abs(int a)
{
    if(a < 0){
        a = -a;
    }
    return a;
}

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> w(n);
  for (int i = 0; i < n; i++) {
    cin >> w[i];
  }

  int sum = 0;
  for (int i = 0; i < n; i++) {
    sum += w[i];
  }

  int tmp_sum = 0;
  int abs_min = INT_MAX;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    tmp_sum += w[i];
    // printf("%d: %d\n", i, tmp_sum);
    if (abs((sum - tmp_sum) - tmp_sum) < abs_min) {
      abs_min = abs((sum - tmp_sum) - tmp_sum);
      ans = i;
    }
  }

  // cout << (ans + 1) << endl;
  cout << abs_min << endl;

  return 0;
}


Measured memory_bytes: 256
import collections
x=input()
y=[x[0],x[1],x[2],x[3]]
c = collections.Counter(y)
ans="Yes"
if(len(c))>2:
    ans="No"
if(ans=="Yes"):

    a=x.count(x[0])
    if(a>2):
        ans="No"



print(ans)


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

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned __int128 HASH;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll,int> plli;
typedef pair<double, int> pdbi;
typedef pair<int,pii> pipii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<pii> vpii;

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n);i>0;i--)
#define rrep2(i,a,b) for (int i=(a);i>b;i--)
#define pb push_back
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()

const ll hmod1 = 999999937;
const ll hmod2 = 1000000000 + 9;
const ll INF = 1<<30;
const ll mod = 1000000000 + 7;
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1, 1, 1, 0, 0, -1, -1, -1};
const int dy8[8] = {0, 1, -1, 1, -1, 0, 1, -1};
const double pi = 3.141592653589793;

int n, k;
int a[1005], b[1005];

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    cin >> k;
    rep(i, k) {
        cin >> a[i] >> b[i];
        a[i] = min(a[i], n - a[i] + 1);
        b[i] = min(b[i], n - b[i] + 1);
        a[i]--; b[i]--;
        int c = min(a[i], b[i]) % 3;
        cout << c + 1 << endl;
    }
}

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


int main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	int N; cin >> N;
    int i, j, k;
    int d[N][2];
    for(i = 0; i < N; i++) cin >> d[i][0] >> d[i][1];
    int curr = 0;
    for(i = 0; i < N; i++){
        int ct = d[i][0];
        if(i+1<N && i+2<N && d[i][0] == d[i][1] && d[i+1][1] == d[i+1][0] && d[i+2][0] == d[i+2][1]){
            curr = 1;
            break;
        }
    }
    if(curr == 1) cout << "Yes";
    else cout << "No";
}

Measured memory_bytes: 3644
N, K = map(int, input().split())
A = list(map(int, input().split()))

mod = 10**9+7

combs = [0]*N
combs[K-1]=1
for i in range(K,N):
    combs[i] = combs[i-1]*i%mod
    combs[i] *= pow(i+1-K,mod-2,mod)
    combs[i] %= mod

def solve(A):
    A.sort()
    ans = 0
    for i in range(N):
        ans += (combs[i]-combs[N-i-1])*A[i]
        ans %= mod
    return ans
print(solve(A))

Measured memory_bytes: 14040
import sys
def input(): return sys.stdin.readline().strip()


def main():
    N = int(input())
    S = [int(input()) for _ in range(N)]
    S.sort()
    ans = sum(S)
    if ans % 10 != 0:
        print(ans)
        return
    subtract = 0
    for s in S:
        if s % 10 != 0:
            subtract = s
            break
    if subtract != 0:
        print(ans - subtract)
    else:
        print(0)


if __name__ == "__main__":
    main()


Measured memory_bytes: 61808
#include <bits/stdc++.h>
#define range(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i, a) range(i, 0, a)
using namespace std;

int main() {
    int h, w;
    cin >> h >> w;
    vector <vector <char>> s(h, vector <char> (w));
    rep (i, h) rep (j, w) cin >> s[i][j];

    bool ans = true;

    rep (y, h) rep (x, w) {
        if (s[y][x] == '.') continue;
        bool flag = false;
        range (dy, -1, 2) range (dx, -1, 2) {
            if (abs(dx) == abs(dy)) continue;
            if (y + dy < 0 || h <= y + dy || x + dx < 0 || w <= x + dx) continue;
            flag |= (s[y + dy][x + dx] == '#');
        }
        ans &= flag;
    }
    cout << (ans ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.BigDecimal;

public class Main{

	private static double a, b, c, d, e, f;
	private static double x, y;

	public static void main(String args[]) throws Exception {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;
		String[] array;

		while((line = br.readLine())  != null) {
			array = line.split(" ");
			
			// set input data
			setParams(array);

			// calc y
			if(d == 0 ){
				y = f/e;
			}
			else {
				y = c - f * a / d;
				y = y / (b - e * a / d);
			}
			
			// calc x
			if (a == 0) {
				x = (f - e * y) / d;
			} else {
				x = (c - b * y) / a;
			}
			System.out.println(new BigDecimal(x).setScale(3, BigDecimal.ROUND_HALF_UP) + " " + new BigDecimal(y).setScale(3, BigDecimal.ROUND_HALF_UP));
		}
	}

	private static void setParams(String[] array) {
		a = Double.parseDouble(array[0]);
		b = Double.parseDouble(array[1]);
		c = Double.parseDouble(array[2]);
		d = Double.parseDouble(array[3]);
		e = Double.parseDouble(array[4]);
		f = Double.parseDouble(array[5]);
	}
}

Measured memory_bytes: 16992
#include <iostream>
#include <string>
#include <utility>

using namespace std;

int main()
{
    while (true) {
        int n;
        cin >> n;
        if (n == 0) {
            return 0;
        }

        bool upper = false;
        pair<bool, bool> state = make_pair(false, false);
        int count = 0;
        for (int i = 0; i < n; ++i) {
            string op;
            cin >> op;
            if (op == "lu") {
                state = make_pair(true, state.second);
            }
            else if (op == "ru") {
                state = make_pair(state.first, true);
            }
            else if (op == "ld") {
                state = make_pair(false, state.second);
            }
            else {
                state = make_pair(state.first, false);
            }
            if (upper && !state.first && !state.second) {
                count += 1;
                upper = false;
            }
            else if (!upper && state.first && state.second) {
                count += 1;
                upper = true;
            }
        }
        cout << count << endl;
    }
}

Measured memory_bytes: 3136
n = int(input())
v = {}
for _ in range(n):
    s = input()
    if s in v:
        v[s] += 1
    else:
        v[s] = 1
m = int(input())
for _ in range(m):
    t = input()
    if t in v:
        v[t] -= 1
    else:
        v[t] = -1
print(max(list(v.values()) + [0]))


Measured memory_bytes: 3060
sx, sy, tx, ty = map(int, input().split())
ans = ""
ans += "R" * (tx - sx)
ans += "U" * (ty - sy)
ans += "L" * (tx - sx)
ans += "D" * (ty - sy)
ans += "D"
ans += "R" * (tx - sx + 1)
ans += "U" * (ty - sy + 1)
ans += "L"
ans += "U"
ans += "L" * (tx - sx + 1)
ans += "D" * (ty - sy + 1)
ans += "R"
print(ans)

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
	public static void main(String args[]){

		Scanner sc=new Scanner(System.in);

	    while(sc.hasNext()){

            double tubo = 3.305785;
            double a = sc.nextDouble();
            double b = sc.nextDouble();

            System.out.println(a * b / tubo);
        }
    }
}

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

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

const int N = 1e5 + 11;
const int M = 1e6 + 11;
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;

void mysort(vector<int>& q){
    sort(q.begin(), q.end());
    reverse(q.begin(), q.end());
}

int main(int argc, char **args){
    int x,y,a,b,c; cin >> x >> y >> a >> b >>c;
    vector<int>p(a + 1), q(b + 1), r(c + 1);
    for(int i = 0; i < a + b + c; i++)  {
        int t; scanf("%d", &t);
        if(i < a) p[i] = t;
        else if (i < a + b) q[i - a] = t;
        else r[i - a - b] = t;
    }

    mysort(p);
    mysort(q);
    mysort(r);
    vector<int>ve;
    for(int i = 0; i < x; i++) ve.push_back(p[i]);
    for(int i = 0; i < y; i++) ve.push_back(q[i]);
    sort(ve.begin(), ve.end());

    for(int i = 0, j = 0; j < c && i < ve.size(); ++i) {
        if(r[j] > ve[i]) ve[i] = r[j++];
    }
    ll ans = 0;
    for(int i = 0; i < ve.size(); i++)
        ans += ve[i];
    cout << ans <<"\n";
return 0;
}


Measured memory_bytes: 2552
#include <bits/stdc++.h>
#define eps 1e-3
#define pi acos(-1.0)
#define inf 0x3f
#define INF 0x3f3f3f3f
#define pb push_back
#define debug1 cout<<"&&";
#define debug2 cout<<"**";
#define ms(a, x) memset(a, x, sizeof(a))
#define for0(i, n) for(int i = 0; i < n; ++i)
#define for1(i, n) for(int i = 1; i <= n; ++i)
using namespace std;
typedef double db;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<long long, int> pli;
typedef pair<long long, long long> pll;
const int mod = 1e9 + 7;
const int N = 1e5+10;
const int M = 1e6+10;
inline int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
inline ll Pow(ll a, ll b) { ll ans = 1; for( ; b; b >>= 1) { if(b&1) ans = ans * a % mod; a = a * a % mod;} return ans;}
inline ll Mul ( ll a, ll b)  { ll lf = a * ( b >> 25ll ) % mod * ( 1LL << 25 ) % mod; ll rg = a * ( b & ( ( 1ll << 25 ) - 1 ) ) % mod; return ( lf + rg ) % mod;}
//==================================================================================================================================================================//

int n, dp1, dp2, dp3;
int tmpa, tmpb, tmpc;

int main() {
   scanf("%d", &n);
   for1(i, n) {
      int a, b, c;
      scanf("%d %d %d", &a, &b, &c);
      if(i == 1) dp1 = a, dp2 = b, dp3 = c;
      else {
         dp1 = max(tmpb, tmpc) + a;
         dp2 = max(tmpa, tmpc) + b;
         dp3 = max(tmpa, tmpb) + c;
      }
      tmpa = dp1, tmpb = dp2, tmpc = dp3;
   }
   printf("%d\n", max(dp1, max(dp2, dp3)));
   return 0;
}

Measured memory_bytes: 3792
x, y = map(int, input().split())

t = [1, 2, 3]
p = {1: 300000,
     2: 200000,
     3: 100000}

ans = 0
if x in t:
    ans += p[x]
if y in t:
    ans += p[y]

if x == 1 and y == 1:
    ans += 400000

print(ans)


Measured memory_bytes: 3060
/* 十 聖イシドールスよ、迷えるプログラマを導き給え！ 十 */
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <cmath>
#include <deque>

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

//const long long INF = 1LL << 60;
const int INF = 1e9;

int main()
{
	std::string S;
	std::cin >> S;

	int ans = 0;
	bool isRen = false;
	for( auto wt : S )
	{
		if( ( wt == 'R' ) && ( isRen == false ) )
		{
			isRen = true;
			ans = 1;
		}
		else if ( ( wt == 'R' ) && ( isRen == true ) )
		{
			ans++;
		}
		else
		{
			isRen = false;
		}
	}

	std::cout << ans << std::endl;

	return 0;
}


Measured memory_bytes: 3596
#include<stdio.h>
#include<stdlib.h>
#include<bits/stdc++.h>
int gcd(int a ,int b){
  	if(a%b==0)
  		return b;
  	else
  		return gcd(b,a%b);
}         

int main(void)
{
	int a,b,k,GCD,kk[101],j=0;
	scanf("%d %d %d",&a,&b,&k);
	GCD=gcd(a,b);
	for(int i=GCD;i>=1;i--){
		if(GCD%i==0) kk[j++]=i;
	}
	printf("%d\n",kk[k-1]);
 	return 0;
 }


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
template <class T> void chmin(T &a, const T &b) noexcept { if (b < a) a = b; }
template <class T> void chmax(T &a, const T &b) noexcept { if (a < b) a = b; }
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cout << H << " "; debug_out(T...); }
#ifdef _DEBUG
  #define debug(...) debug_out(__VA_ARGS__)
#else
  #define debug(...) 
#endif

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  ll n;
  vector<ll> a(5);
  cin >> n;
  rep(i,5) cin >> a[i];
  auto f = [&](ll x) {
    ll res = (n+x-1)/x;
    debug(x, res);
    return res;
  };
  ll maxi = 0;
  rep(i,5) {
    chmax(maxi, f(a[i])); //必要な乗る回数の最大値（その他はそのまま都市についたらすぐ乗る）
  }
  ll ans = 5 + maxi - 1;
  cout << ans << endl;
  return 0;
}

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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    while (cin >> n && n) {
        vector<int> h(n + 1);
        for (int i = 0; i <= n; ++i) {
            cin >> h[i];
        }
        for (int i = 0; i <= n; ++i) {
            vector<int> hh;
            for (int j = 0; j <= n; ++j) {
                if (j == i) continue;
                else {
                    hh.push_back(h[j]);
                }
            }
            bool flag = true;
            int diff = hh[1] - hh[0];
            for (int j = 1; j < n; ++j) {
                if (hh[j] - hh[j - 1] != diff) {
                    flag = false;
                    break;
                }
            }
            if (flag) {
                cout << h[i] << '\n';
                break;
            }
        }
    }
    return 0;
}


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

#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()

typedef long long ll;
typedef array<int, 3> tri;
typedef long double ld;

template <class T> istream& operator>>(istream& I, vector<T>& v) {for (T &e: v) I >> e; return I;}
template <class T> ostream& operator<<(ostream &O, const vector<T>& v) {for (const T &e: v) O << e << ' '; return O;}



void _main() {
        string s; cin >> s;
        int x = stoi(s.substr(0, 2));
        int y = stoi(s.substr(2));

        if (!x && !y) cout << "NA";
        else if (!x && y <= 12) cout << "YYMM";
        else if (x <= 12 && !y) cout << "MMYY";
        else if ((x > 12 && y > 12) || (!x && y > 12) || (x > 12 && !y) || (!x && !y)) cout << "NA";
        else if (x <= 12 && y <= 12 && x >= 1 && y >= 1) cout << "AMBIGUOUS";
        else if (x <= 12 && y > 12) cout << "MMYY";
        else cout << "YYMM";
}



signed main() {
        ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//        freopen("input.txt", "r", stdin);
        int _t = 1;
//        cin >> _t;
        while (_t--) _main();
        return 0;
}


Measured memory_bytes: 3636
#include<cstdio>
using namespace std;
#define N 205000
int head[N],cnt,dep[N],l,r,in[N],st[N],n,a,b,ct,st2[N],fg,as1[N],as2[N],is[N];
struct edge{int t,next;}ed[N*2];
void adde(int f,int t){ed[++cnt]=(edge){t,head[f]};head[f]=cnt;ed[++cnt]=(edge){f,head[t]};head[t]=cnt;in[f]++,in[t]++;}
void dfs(int u,int fa){dep[u]=dep[fa]+1;for(int i=head[u];i;i=ed[i].next)if(ed[i].t!=fa)dfs(ed[i].t,u);}
void dfs2(int u,int t,int fa){if(!fg)st[++ct]=u;if(u==t)fg=1;for(int i=head[u];i;i=ed[i].next)if(ed[i].t!=fa)dfs2(ed[i].t,t,u);if(!fg)ct--;}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<n;i++)scanf("%d%d",&a,&b),adde(a,b);
	dfs(1,0);int mx=0,vl;for(int i=1;i<=n;i++)if(dep[i]>mx)mx=dep[i],vl=i;
	dfs(vl,0);mx=0;int vl2=0;for(int i=1;i<=n;i++)if(dep[i]>mx)mx=dep[i],vl2=i;
	dfs2(vl,vl2,0);
	for(int i=1;i<=ct;i++)is[st[i]]=1;
	for(int i=1;i<=n;i++)if(!is[i]&&in[i]>1){printf("-1\n");return 0;}
	for(int i=1;i<=ct;i++)st2[i]=in[st[i]]-2+(in[st[i]]==1);
	int lb=0;
	for(int i=1;i<=ct;i++)
	{
		for(int j=1;j<=st2[i];j++)as1[lb+j]=lb+j+1;
		as1[lb+st2[i]+1]=lb+1;
		lb+=st2[i]+1;
	}
	lb=0;
	for(int i=ct;i>=1;i--)
	{
		for(int j=1;j<=st2[i];j++)as2[lb+j]=lb+j+1;
		as2[lb+st2[i]+1]=lb+1;
		lb+=st2[i]+1;
	}
	int fg2=0;
	for(int i=1;i<=n;i++)if(as1[i]<as2[i]){fg2=1;break;}else if(as2[i]<as1[i])break;
	if(!fg2)for(int i=1;i<=n;i++)as1[i]=as2[i];
	for(int i=1;i<=n;i++)printf("%d ",as1[i]);
}//

Measured memory_bytes: 13696
#include <iostream>
#include <stdlib.h>
#include <math.h>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long ll;

int a[3];

int main() {
    for (int i = 0; i < 3; ++i) cin >> a[i];
    sort(a, a+3);
    cout << a[2] - a[0] << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(int i=(n);i<(k);i++)
#define ALL(a)  (a).begin(),(a).end()
bool calc(vector<ll> &a,vector<ll> &f,ll t,ll k,ll n){
    ll cnt=0;
    For(i,0,n)cnt+=max(a[i]-t/f[i],0LL);
    return cnt<=k;
}
void Main(){
    ll n,k;
    cin>>n>>k;
    vector<ll> a(n),f(n);
    For(i,0,n) cin>>a[i];
    For(i,0,n) cin>>f[i];
    sort(ALL(a));
    sort(ALL(f));
    reverse(ALL(f));
    ll ok=1e13,ng=-1;
    while(ok>ng+1){
        ll mid=(ok+ng)/2;
        if(calc(a,f,mid,k,n)==true)ok=mid;
        else ng=mid; 
    }
    cout<<ok<<endl;
}
int main(){
    Main();
    /*
    東方風神録は神が出てくるので当然神ゲー
    */
    return 0;
}

Measured memory_bytes: 6432
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define IFOR(i,a,b) for(int i=(b-1);i>=(a);--i)
#define RPT(i,a,b) for(int i=(a);i<((a)+(b));++i)
#define IRPT(i,a,b) for(int i=((a)+(b)-1);i>=(a);--i)
#define ALL(x) x.begin(),x.end()


void solve(){
  int n; cin >> n;
  ll ans=0;
  ans = (n / 500)*1000;
  n %= 500;
  ans += (n/5)*5;
  cout << ans << endl;
}

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

Measured memory_bytes: 256