akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define Khela ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long int
#define llu long long unsigned int
#define pf printf
#define sf scanf
#define f first
#define s second
#define pb push_back
#define mk make_pair
#define pii pair<int ,int>
#define PII pair<ll ,ll>
 
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};
 
typedef tree<pair<int,int>,null_type,less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
int Set(int N,int pos){return N=N | (1<<pos);}
int reset(int N,int pos){return N= N & ~(1<<pos);}
bool check(int N,int pos){return (bool)(N & (1<<pos));}
const int Max=1e9+100;
const ll  MAX=1e18+500;
const int sz=1e3+100;
vector<ll> test,raf;
int main()
{
    Khela
    ll a,b,c,i,j,k,q,p,x,y,ct,ct1,m,l,r,x1,y1,mn,h,sum1,in,z,mid,n,mx;
    char ch;
    double d;
    string str1,str2,str;
    bool bl,bl1;
    int t,cs=1;
    while(cin>>n>>m>>l>>k)
    {
        ll ara[n],bara[m],tara[l];
        for(i=0;i<n;i++) cin>>ara[i];
        for(i=0;i<m;i++) cin>>bara[i];
        for(i=0;i<l;i++) cin>>tara[i];
        test.clear();
        for(i=0;i<n;i++){
            for(j=0;j<m;j++) test.pb(ara[i]+bara[j]);
        }

        sort(test.begin(),test.end(),greater<ll>());
        sort(tara,tara+l);
        raf.clear();
        
        ll siz=test.size();
        for(i=0;i<min(k,siz);i++) {
            for(j=0;j<min(k,l);j++) raf.push_back(test[i]+tara[j]);
        }

        sort(raf.begin(),raf.end(),greater<ll>());
        siz=raf.size();
        for(i=0;i<siz && k;i++){
             cout<<raf[i]<<endl;
             --k;
        }

        
    }





}

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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
typedef double DOUBLE;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1
#define j0 gray_cat_j0

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

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

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const ll LL_INF = 1e17 + 16;
const int INF = 1e9 + 10;
const ll MOD = 1e9 + 7;

const int MAXN = 2e5 + 5;

void solve(){
	ll a, v, b, w, t;
	cin >> a >> v >> b >> w >> t;
	if (w >= v || abs(b - a) > (v - w) * t) {
		cout << "NO\n";
	} else {
		cout << "YES\n";
	}
}

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


Measured memory_bytes: 3596
c = list(list(map(int,input().split())) for _ in range(3))

for b1 in range(101):
    a = []
    b = []
    a1 = c[0][0] - b1
    if a1 < 0:
        break
    a.append(a1)
    b.append(b1)
    for b2 in range(101):
        a2 = c[1][1] - b2
        if a2 < 0:
            break
        a.append(a2)
        b.append(b2)
        for b3 in range(101):
            a3 = c[2][2] - b3
            if a3 < 0:
                break
            a.append(a3)
            b.append(b3)
            for i in range(3):
                for j in range(3):
                    if a[j] + b[i] != c[i][j]:
                        break
                    if i == 2 and j == 2:
                        print("Yes")
                        exit()
                if a[j] + b[i] != c[i][j]:
                    break
            b.pop()
            a.pop()
        a.pop()
        b.pop()
print("No")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define _overload3(_1,_2,_3,_4,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,n) (int i=a;i<n;i++)
#define per(i,a,n,s) (int i=n-1;i>=a;i--)
#define range(...) _overload3(__VA_ARGS__,per,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define vecin(x) for(auto&youso_: (x) ) cin >>  youso_
#define vecout(x) for(auto&youso_: (x) ) cout << youso_ << " " ; cout << endl
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int inf = 1e9+10;
const int mod = 1e9+7;
const long long llinf = 1e18;
#define _GLIBCXX_DEBUG
// head

int main(){
    int  n,a,tmp,count=0,k=0;
    vector<bool> data(10,false);
    cin >>n;
    for range(i,n){
        cin >> a;
        if (1<=a && a<400) {tmp=0;}
        if (400<=a && a<800) {tmp=1;}
        if (800<=a && a<1200) {tmp=2;}
        if (1200<=a && a<1600) {tmp=3;}
        if (1600<=a && a<2000) {tmp=4;}
        if (2000<=a && a<2400) {tmp=5;}
        if (2400<=a && a<2800) {tmp=6;}
        if (2800<=a && a<3200) {tmp=7;}
        if (3200<=a) {k++;continue;}
        if (!data[tmp]) { count++; data[tmp]=true;}
    }int ans2;
    if (k>=1 && count ==0){ ans2 = 1;}
    else { ans2=count;}
    cout << ans2 << " " <<count+k <<endl;
}

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



int main(){
    ll N , M;
    cin >> N >> M;
    ll path[N][N];
    memset(path , 0 ,sizeof(path));

    for(int i = 0; i < M; i++){
        ll a,b;
        cin >> a >> b;
        a--;
        b--;
        path[a][b]++;
        path[b][a]++;
    }

    for(int i = 0; i < N; i++){
        ll ans = 0;
        for(int j = 0; j < N; j++){
            ans += path[i][j];
        }
        cout << ans << endl;
    }
}


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

int calc(int x) {
    int sum = 0;
    while (x / 10 != 0) {
        sum += x % 10;
        x /= 10;
    }
    return sum + x;
}

int main() {
    int N, A, B;
    cin >> N >> A >> B;
    int ans;
    for (int i = 0; i <= N; i++) {
        int sum = calc(i);
        if (A <= sum && sum <= B) {
            ans += i;
        }
    }
    cout << ans << endl;
}


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

using namespace std;

#define REP(i,a,b) for (int i = a; i <= b; i++)
#define ALL(a)              a.begin(), a.end()
#define ALLN(a, n)          (a, a+n)
#define MAX                 10000007
#define MIN                 -10000007

const int mod=1e9+7;
ll d,x,y;
void extendedEuclid(ll A, ll B) {
    if(B == 0) {
        d = A;
        x = 1;
        y = 0;
    }
    else {
        extendedEuclid(B, A%B);
        ll temp = x;
        x = y;
        y = temp - (A/B)*y;
    }
}
ll modInverse(ll A, ll M)
{
    extendedEuclid(A,M);
    return (x%M+M)%M;    //x may be negative
}
              
int main()
{
  ios::sync_with_stdio(0);
    cin.tie(0);
  #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    //freopen("error.txt", "w", stderr);
    #endif
      
    int t;
    t=1;
     //  cin>>t;
    while(t--){
            ll n,sum=0;
            cin>>n;
            ll a[n];
            REP(i,0,n-1) {cin>>a[i];sum+=(a[i]%mod);}
            ll sq=((sum%mod)*(sum%mod))%mod;
            ll indi=0;
            REP(i,0,n-1){
              indi+=((a[i]%mod)*(a[i]%mod))%mod;
            }  
            indi%=mod;
            ll k=((sq%mod)-(indi%mod)+mod)%mod;
            ll q=modInverse(2,mod);
            cout<<(k%mod*q%mod)%mod;
       


             }
             cerr<<"Time taken : "<<(float)clock()/CLOCKS_PER_SEC<<" secs"<<endl;
    return 0;
}


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

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

    long long cntR = 0, cntG = 0, cntB = 0;
    for (int i = 0; i < N; i++) {
        if (S[i] == 'R') cntR++;
        else if (S[i] == 'G') cntG++;
        else cntB++;
    }

    long long ans = cntR * cntG * cntB;
    for (int i = 0; i + 2 < N; i++) {
        for (int j = i + 1; j + 1 < N; j++) {
            if (S[i] == S[j]) continue;
            int k = 2 * j - i;
            if (k >= N || S[i] == S[k] || S[j] == S[k]) continue;
            ans--;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 3628
import sys

stdin = sys.stdin
inf = 1 << 60
mod = 1000000007

sys.setrecursionlimit(10 ** 7)

ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

n, a, b = na()
x = na()

cur = x[0]
ans = 0
for i in range(1, n):
    ch_a = (x[i] - cur) * a
    ch_b = b
    if ch_a > ch_b:
        ans += ch_b
    else:
        ans += ch_a
    cur = x[i]

print(ans)

Measured memory_bytes: 14256
#include <iostream>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <algorithm>
#include <set>
#include <string>
#include <queue>

using namespace std;

#define rep(i, N) for(int (i) = 0; (i) < (N); (i) ++)
typedef long long ll;
typedef pair<int, int> pii;

int ans = 0;
vector<int> ps = {3, 5, 7};
ll N;

void dfs(ll n, ll b){
    if(n <= N && b == 7){
        ans ++;
    }
    if(n > N){
        return ;
    }
    rep(i, ps.size()){
        ll nb = b | (1 << i);
        ll nn = 10 * n + 1L * ps[i];
        dfs(nn,  nb);
    }
    return ;
}

int main(){
    cin >> N;
    dfs(0, 0);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h> 
/*#ifndef M_PI
    #define M_PI 3.14159265358979323846
#endif
*/

using namespace std;
#define m 1000000001
#define rep(i,a,b) for(int i=a;i<b;++i)
#define repb(i,a,b) for(int i=a;i>=b;--i)
#define repv(arr)  for(auto it=arr[i].begin();it!=arr[i].end();++it)  
#define vi vector<int>
#define vb vector<bool>
#define vs vector<string>
#define vl vector<long long int>
#define ssortA(arr)   stable_sort(arr.begin(),arr.end())
#define search(arr,c)  binary_search(arr.begin(),arr.end(),c)
#define pb   push_back
#define ll long long
#define mp make_pair 
#define LCM(a,b) boost::math::lcm(a,b)
#define cl_bf cin.ignore(numeric_limits<streamsize>::max(), '\n');
int step(int a){
    if(a==0){
        return 0;
    }
    else{
        int count=0;
        while(a!=0){
            a=a%__builtin_popcount(a);
            count++;
        }
        return count;
    }
}
int main(){
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n;
    cin>>n;
    vector<char> arr(n);
    vi i1,i2;
    int c=0;
    rep(i,0,n){
        cin>>arr[i];
        if(arr[i]=='1')
        ++c;
    }
    //cout<<c<<endl;
    int x=c-1;
    if(x<0){
        rep(i,0,n){
            if(arr[i]=='0')cout<<1<<endl;
            else{
                cout<<0<<endl;
            }
        }
        return 0;
    }
    if(x==0){
        rep(i,0,n){
            if(arr[i]=='1')cout<<0<<endl;
            else{
                if(arr[n-1]=='1')
                cout<<2<<endl;
                else{
                    if(i==n-1)
                    cout<<2<<endl;
                    else{
                        cout<<1<<endl;
                    }
                }
            }
           
        }
        return 0;
    }
    int y=c+1;
    vi b(200001,0);
    rep(i,1,200001){
        int j=i;
        int c1=0;
        while(j!=0){
            if(j%2!=0)
            ++c1;
            j/=2;
        }
        b[i]=1+b[i%c1];
        /*if(i<=100){
            cout<<b[i]<<endl;
        }*/
        
        /*if(i>199900){
        cout<<b[i]<<" ";
        }*/
        
    }
   // cout<<endl;
    //cout<<b[15]<<endl;
    vi p1(n),p2(n);
    p1[0] = 1 % x;  
    for (int i = 1; i < n; i++)  
    {  
        p1[i] = p1[i - 1] * (2 % x);  
        p1[i] %= x;  
       // cout<<p1[i]<<" ";
    }  
    //cout<<endl;
    p2[0] = 1 % y;      
    for (int i = 1; i < n; i++)  
    {  
        p2[i] = p2[i - 1]*(2 % y);  
        p2[i] %= y;  
    } 
    ll sum1=0,sum2=0;
    rep(i,0,n){
        if(arr[i]=='1'){
            sum1+=p1[n-1-i]; 
            sum1=sum1%x;
        }
    }
    rep(i,0,n){
        if(arr[i]=='1'){
            sum2+=p2[n-1-i];
            sum2=sum2%y;
        }
    }
    rep(i,0,n){
        if(arr[i]=='1'){
            int g=sum1;
            int e=p1[n-1-i]%x;
            //cout<<e<<" "<<sum1<<endl;
            g=(sum1-e+x)%x;
            int f=1+step(g);
            cout<<f<<endl;
        }
        else{
            int g=sum2;
            int e=p2[n-1-i]%y;
            g=(sum2+e+y)%y;
            int f=1+step(g);
            cout<<f<<endl;
        }
    }
    //cout<<"hi"<<endl;
}

     

Measured memory_bytes: 5756
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>
#include <set>

using namespace std;
struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}

using int64 = long long;

int main() {
    int n;
    cin >> n;
    int64 ans = 1;
    vector a(n,0LL);
    for (int i=0; i<n; i++) cin >> a[i];

    if (any_of(a.begin(), a.end(), [](const int64& x){return x == 0LL;})) {
        cout << 0 << endl;
        return 0;
    }

    for (int i=0; i<n; i++) {
        if (__builtin_mul_overflow(ans, a[i], &ans) || ans > 1000000000000000000LL) {
            ans = -1;
            break;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 3652
#include <iostream>
#include <fstream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <string>
#include <iomanip>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
using namespace std;
typedef long long ll;



int main(){
	
	ll x, y; cin >> x >> y;
	
	int ans = 0;
	while(x <= y){
		x *= 2; 
		ans++;
	}		
	cout << ans;
	
	return 0;
}

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


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

    int ans = 0;
    for (int i=1; i<N; i++) {
        string X = S.substr(0, i);
        string Y = S.substr(i, N-i);

        set<char> xs, ys;
        for (auto c: X) xs.insert(c);
        for (auto c: Y) ys.insert(c);

        int num = 0;
        for (auto c: xs) {
            if (ys.find(c) != ys.end()) num++;
        }
        ans = max(ans, num);
    }

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



Measured memory_bytes: 256
#include<stdio.h>
int main(void){
    int n,score[200],sum,i,j,temp,min,minj;
    sum=0;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&score[i]);
        sum+=score[i];
    }
    if(sum%10!=0){
        printf("%d\n",sum);
        return 0;
    }
    for(i=0;i<n-1;i++){
        min=score[i];
        minj=i;
        for(j=i+1;j<n;j++){
            if(score[j]<min){
                min=score[j];
                minj=j;
            }
        }
        if(i!=minj){
            temp=score[minj];
            score[minj]=score[i];
            score[i]=temp;
        }
    }
    for(i=0;i<n;i++){
        if(score[i]%10!=0){
            printf("%d\n",sum-score[i]);
            return 0;
        }
    }
    printf("0\n");
    return 0;
}



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

int main(){
  string S;
  cin >> S;
  int l = S.size();
  int N = l/2;
  int a=0;
 if(2*N == l){
  	for(int i=0; i<N; i++){
      if (S.at(2*i)=='L'){
        cout << "No" << endl;
        a=1;
        break;
      }
      if(S.at(2*i+1)=='R'){
        cout << "No" << endl;
        a=1;
        break;
      }
    }
  }
   else{
    for(int i=0; i<N; i++){
      if (S.at(2*i)=='L'){
        cout << "No" << endl;
        a=1;
        break;
      }
      if(S.at(2*i+1)=='R'){
        cout << "No" << endl;
        a=1;
        break;
      }
    }
    if(S.at(l-1)=='L'){
      cout << "No" << endl;
      a=1;
    }
  }
  if(a==0){
    cout << "Yes" << endl;
  }
}

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

int main(void){
	int n;
	while(cin >> n,n){
		int sum=0,cmin=1001,cmax=-1;
		for(int i=0;i<n;i++){
			int tmp;
			cin >> tmp;
			sum+=tmp;
			cmin=min(cmin,tmp);
			cmax=max(cmax,tmp);
		}
		sum-=(cmin+cmax);
		n-=2;
		cout << sum/n << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#define int long long
using namespace std;

vector<char> vec;
vector<string> str;

void dfs(int a,int b){
	if(!a && !b){
		string s;
		for(int i = vec.size() - 1;i >= 0;i--) s += vec[i];
		str.push_back(s);
		return;
	}
	if(a == 5 && b == 5){
		vec.push_back('A');
		dfs(a - 1,b);
		vec[vec.size() - 1] = 'B';
		dfs(a,b - 1);
		vec.pop_back();
	}else if(a >= 5){
		vec.push_back('A');
		dfs(a - 1,b);
		vec.pop_back();
	}else if(b >= 5){
		vec.push_back('B');
		dfs(a,b - 1);
		vec.pop_back();
	}else{
		if(a){
			vec.push_back('A');
			dfs(a - 1,b);
			vec.pop_back();
		}
		if(b){
			vec.push_back('B');
			dfs(a,b - 1);
			vec.pop_back();
		}
	}
}

signed main(){
	int a,b;
	cin >> a >> b;
	dfs(a,b);
	sort(str.begin(),str.end());
	for(int i = 0;i < str.size();i++) cout << str[i] << endl;
	return 0;
}

Measured memory_bytes: 3180
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**5+1)
from functools import lru_cache

N, M = map(int, input().split())
G = [[] for _ in range(N)]
for _ in range(M):
    x, y = map(int, input().split())
    x -= 1
    y -= 1
    G[x].append(y)

@lru_cache(maxsize=10**5+1)
def dp(v):
    res = 0
    for w in G[v]:
        res = max(res, dp(w)+1)
    return res

ans = 0
for i in range(N):
    ans = max(ans, dp(i))
print(ans)

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

#define REP(i,n) for(int i=0;i<(n);++i)
#define ll long long
const long long INF = 1LL<<60;
const long long mod = 1e9 + 7;

int main(){
    int N, K;
    cin >> N >> K;
    int count = 0;
    REP(i,N){
        int h;
        cin >> h;
        if(h >= K) count++;
    }
    cout << count << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int main()
{
    char s[10];
    int i;
    int count=0;
    gets(s);
    for(i=0;i<3;i++)
    {
        if(s[i]=='o')
            count++;
    }
    printf("%d",700+count*100);
    return 0;
}

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

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

ll INF = 1e10;
vector<int> v(100110);
vector<ll> dp(100110, INF);

ll rec(int i, int K){
    if(dp[i]!=INF) return dp[i];
    if(i==0) return 0;
    
    ll r=INF;
    rep2(j, 1, K+1){
        if(i-j>=0) chmin(r, rec(i-j, K) + abs(v[i-j] - v[i]));
    }
    
    return dp[i] = r;
}

int main(){
    int N, K;
    cin >> N >> K;
      
    rep(i, N) cin >> v[i];
    
    cout << rec(N-1, K) << endl;
    return 0;
}


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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz size()
#define pb(x) push_back(x) 
#define bg begin()
#define ed end()
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define mp(x,y) make_pair(x,y)
const ll MOD=1000000007;

ll maxx(ll x,ll y,ll z){
	return max(max(x,y),z);
}
ll minn(ll x,ll y,ll z){
	return min(min(x,y),z);
}
ll gcd(ll x,ll y){
	if(x%y==0) return y;
    else return gcd(y,x%y);
}
ll lcm(ll x,ll y){
	return x*(y/gcd(x,y));
}
ll myceil(ll x,ll y){//yがいくつ集まったらx以上になるか
	if(x<=y) return 1;
	else if(x%y==0) return x/y;
	else return x/y+1;
}

//a,b x
int main(){
	string s; cin>>s;
	s[3]++;
	cout<<s;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <numeric>
#include <set>
#include <unordered_set>
#include <queue>
#include <boost/math/constants/constants.hpp>
#include <boost/math/common_factor_rt.hpp>

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

int main() {
  int H, W;
  cin >> H >> W;
  int x, y;
  x = max(H, W);
  y = min(H, W);
  
  rep(i, x){
  	cout << y;
  }
}

Measured memory_bytes: 256
#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>;
  
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  int n; cin >> n;
  int a[4];
  for(int i = 3; i >= 0; --i) {
    a[i] = n%10;
    n/=10;
  }
  

  rep(i, 1<<3) {
    vector<bool> v(3);
    rep(j, 3) {
      v[j] = (i>>j & 1);
    }

    int sum = a[0];
    rep(k, 3) {
      sum += a[k+1]*(v[k]?1:-1);
    }
    if(sum == 7) {
      rep(m, 3) {
	cout << a[m] << (v[m]?'+':'-');
      }
      cout << a[3] << "=7" << endl;
      return 0;
    }
  }
}


Measured memory_bytes: 256
def solve(nexts):
    pushed = {0}
    now_on = 0
    count = 0
    while True:
        now_on = nexts[now_on]
        count += 1
        if now_on in pushed:
            return -1
        if now_on == 1:
            return count
        pushed.add(now_on)


n = int(input())
print(solve([int(input()) - 1 for _ in range(n)]))


Measured memory_bytes: 13220
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <functional>
#define int long long
using namespace std;
typedef pair<int, int> P;

int mod = 1000000007;
int INF = 1e+15;
int n, m;
int s, t;
int u[200000], v[200000], d[200000];
vector<int> et[100000];
vector<int> ec[100000];
int minS[100000];
int minT[100000];
int cntS[100000];
int cntT[100000];
int cntS2[100000];
int cntT2[100000];

void setMinDist(int minD[], int start) {
	int i;
	priority_queue<P, vector<P>, greater<P> > que;
	
	for (i = 0; i < n; i++) minD[i] = INF;
	que.push(P(0, start));
	minD[start] = 0;
	
	while (!que.empty()) {
		P now = que.top(); que.pop();
		int cst = now.first;
		int pos = now.second;
		for (i = 0; i < et[pos].size(); i++) {
			int npos = et[pos][i];
			if (minD[npos] > minD[pos] + ec[pos][i]) {
				minD[npos] = minD[pos] + ec[pos][i];
				que.push(P(minD[npos], npos));
			}
		}
	}
}

//ここにバグがある！！！
void setWayCnt(int minD[], int cntD[], int start) {
	int i, j;
	priority_queue<P, vector<P>, greater<P> > que;
	static vector<bool> used[100000];
	static bool pushed[100000];
	
	for (i = 0; i < n; i++) {
		used[i].resize(et[i].size());
		for (j = 0; j < et[i].size(); j++) {
			used[i][j] = false;
		}
		pushed[i] = false;
	}
	
	for (i = 0; i < n; i++) cntD[i] = 0;
	
	que.push(P(0, start));
	cntD[start] = 1;
	pushed[start] = true;
	while (!que.empty()) {
		P now = que.top(); que.pop();
		int cst = now.first;
		int pos = now.second;
		for (i = 0; i < et[pos].size(); i++) {
			int npos = et[pos][i];
			if (minD[npos] != minD[pos] + ec[pos][i]) continue;
			if (used[pos][i]) continue;
			used[pos][i] = true;
			//cout << "add <=" << npos + 1<< "<- " << pos +1 << "| " << cntD[pos] << endl;
			cntD[npos] += cntD[pos];
			cntD[npos] %= mod;
			if (!pushed[npos]) que.push(P(minD[npos], npos));
		}
	}
}

signed main() {
	int i;
	
	cin >> n >> m >> s >> t;
	s--; t--;
	for (i = 0; i < m; i++) {
		cin >> u[i] >> v[i] >> d[i];
		u[i]--; v[i]--;
		et[u[i]].push_back(v[i]);
		et[v[i]].push_back(u[i]);
		ec[u[i]].push_back(d[i]);
		ec[v[i]].push_back(d[i]);
	}
	
	setMinDist(minS, s);
	setMinDist(minT, t);
	setWayCnt(minS, cntS, s);
	//cout << "T" << endl;
	setWayCnt(minT, cntT, t);
	
	int X = minS[t];
	int crash = 0;
	
	for (i = 0; i < n; i++) {
		cntS2[i] = (cntS[i] * cntS[i]) % mod;
		cntT2[i] = (cntT[i] * cntT[i]) % mod;
	}
	
	//頂点
	for (i = 0; i < n; i++) {
		if (minS[i] + minT[i] > X) continue;
		if (minS[i] != minT[i]) continue;
		crash += cntS2[i] * cntT2[i];
		crash %= mod;
	
	}
	
	//cout << crash << endl;
	
	//辺
	for (i = 0; i < m; i++) {
		//cout << minS[u[i]] + minT[u[i]] << endl;
		if (minS[u[i]] > minS[v[i]]) swap(u[i], v[i]);
		if (minS[u[i]] + d[i] + minT[v[i]] > X) continue;
		if (minS[u[i]] >= (X + 1) / 2) continue;
		if (minT[v[i]] >= (X + 1) / 2) continue;
		//cout << "crash(u, v) = " << u[i] << ", " << v[i] << endl;
		crash += cntS2[u[i]] * cntT2[v[i]];
		crash %= mod;
	}
	
	//cout << crash << endl;
	
	//答え
	int ans = cntS[t] * cntT[s];
	ans %= mod;
	ans = (ans + mod - crash) % mod;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 34268
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define ml cout<<"\n"
 
#define pii pair<ll,ll>
#define vi  vector<ll>
#define vii vector<pii>
#define mi  map<ll,ll>
#define all(a)  (a).begin(),(a).end()

#define pb push_back
#define in insert
#define ff first
#define ss second
#define mod 1000000007

#define yes cout<<"YES"<<endl;
#define no cout<<"NO"<<endl;
#define test4(x,y,z,a) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<"		a is "<<a<<endl;
#define test3(x,y,z) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<endl;
#define test2(x,y) cout<<"x is "<<x<<"		y is "<<y<<endl;
#define test1(x) cout<<"x is "<<x<<endl;

int main(){
	ios_base::sync_with_stdio(false);
     	cin.tie(NULL);
    	cout.tie(NULL);    
    // ll t;
    // cin>>t;
    // while(t--){
    	
        
    // }
    ll n;
    cin>>n;
    set<ll> s;
    rep(i,0,n){
    	ll a;cin>>a;
    	s.in(a);
    }
    if(s.size()==n){
    	yes;
    }else{
    	 no;
    }
}

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

//Flame of Nucleus
public class Main{

	int INF = 1<<29;
	int[][] cap;
	boolean[] used;
	
	int augumentPath(int v, int t, int f){
		if(v==t)return f;
		used[v] = true;
		for(int i=0;i<cap[v].length;i++){
			if(cap[v][i]>0 && !used[i]){
				int d = augumentPath(i, t, Math.min(f, cap[v][i]));
				if(d>0){
					cap[v][i] -= d;
					cap[i][v] += d;
					return d;
				}
			}
		}
		return 0;
	}

	int maxFlow(int s, int t){
		int flow = 0;
		int n = cap.length;
		used = new boolean[n];
		while(true){
			Arrays.fill(used, false);
			int f = augumentPath(s, t, Integer.MAX_VALUE);
			if(f==0)return flow;
			flow += f;
		}
	}
	
	void run(){
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
			int n = sc.nextInt(), m = sc.nextInt(), L = sc.nextInt();
			int[][] wf = new int[n+1][n+1];
			for(int[]a:wf)Arrays.fill(a, INF);
			for(int i=1;i<=n;i++)wf[i][i]=0;
			while(m--!=0){
				int s = sc.nextInt(), t = sc.nextInt(), c = sc.nextInt();
				wf[s][t]=wf[t][s]=c;
			}
			for(int k=1;k<=n;k++)for(int i=1;i<=n;i++)for(int j=1;j<=n;j++)wf[i][j]=Math.min(wf[i][j], wf[i][k]+wf[k][j]);
			int[] p = new int[n+1], k = new int[n+1];
			for(int i=1;i<=n;i++)p[i]=sc.nextInt();
			for(int i=1;i<=n;i++)k[i]=sc.nextInt();
			cap = new int[n*2+2][n*2+2];
			for(int i=1;i<=n;i++)cap[0][i]=p[i];
			for(int i=1;i<=n;i++)cap[n+i][2*n+1]=k[i];
			for(int i=1;i<=n;i++)for(int j=1;j<=n;j++)if(wf[i][j]<L)cap[i][n+j]=p[i];
			System.out.println(maxFlow(0, 2*n+1));
		}
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 0
a = str(input())
Big = ["Z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y"]
small = ["z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y"]
if a in Big:
    print('A')
else:
    print('a')

Measured memory_bytes: 9148
#include<bits/stdc++.h>
using namespace std;int n,a,i;main(){string s;cin>>s;n=s.size();while(i<n){int m[80]={};for(auto c:"JOI")for(;i<n&&s[i]==c;m[c]++,i++);if(m[74]>=m[79]&&m[79]<=m[73])a=max(a,m[79]);}cout<<a<<endl;}

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

int calc(int k) {
	if (k == 0) return 0;
	int p = 0, kk=k;
	while (kk > 0) {
		p += kk & 1;
		kk /= 2;
	}
	return 1 + calc(k % p);
}

int main() {
	int N;
	string s;
	cin >> N >> s;
	int p = 0;
	for (char c : s) p += (c == '1');
	vector<int> ModsP(N), ModsM(N);
	ModsP[0] = 1 % (p + 1);
	ModsM[0] = (p - 1 <= 0 ? 0 : 1 % (p - 1));
	for (int i = 1; i < N; i++) {
		ModsP[i] = ModsP[i - 1] * 2 % (p + 1);
		ModsM[i] = (p - 1 <= 0 ? 0 : ModsM[i - 1] * 2 % (p - 1));
	}

	int OriginalModP = 0, OriginalModM=0;
	for (int i = 0; i < N; i++) {
		if (s[N - 1 - i] == '1') {
			OriginalModP += ModsP[i];
			OriginalModP %= p + 1;
			OriginalModM += ModsM[i];
			if (p - 1 > 0) OriginalModM %= p - 1;
		}
	}

	for (int i = 0; i < N; i++) {
		int ChangedMod=0;
		if (s[i] == '1') {
			ChangedMod = OriginalModM - ModsM[N - 1 - i];
			if (p - 1 > 0) {
				ChangedMod += p - 1;
				ChangedMod %= p - 1;
			}
		}
		else {
			ChangedMod = OriginalModP + ModsP[N - 1 - i];
			ChangedMod %= p + 1;
		}

		cout << (p==1 && s[i]=='1' ? 0 : 1 + calc(ChangedMod)) << endl;
	}

}

Measured memory_bytes: 5244
import math

k = int(input())

res = 0

kkk = range(1,k + 1)

for i in kkk:
  for j in kkk:
    for t in kkk:
      ss1 = math.gcd(i, j)
      ss2 = math.gcd(ss1, t)
      res += ss2
print(res)

Measured memory_bytes: 67716
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 1000000007LL
#define llMAX 9223372036854775807LL
#define llMIN -9223372036854775808LL
using vi = vector<int>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける

ll n;
ll M=1e5+1;

//bit全探索
vi bt;
void setbit(ll i){
  bt.clear();
  for(ll tmp=0;i>0;i/=2){
    if (i%2==1) bt.push_back(tmp);
    tmp++;
  }
}




int main(){
  ll ans=0,q;
  cin >>n;
  n++;
  ll nlg=ceil(log2(n));
  vi V(n),W(n);
  REP(i,n-1) cin>>V[i+1]>>W[i+1];

  cin >>q;
  vi u(q),L(q);
  REP(i,q) cin>>u[i]>>L[i];

  //上半分
  ll nhi=nlg-(nlg/2);
  if (nhi==9)nhi=11;
  vvi data(1LL<<nhi, vi(M));  // N * M の2次元配列

  for(ll i=1;i<(1LL<<nhi);i++){
    for(ll j=0;j<M;j++){
      if ((j-W[i])>=0)
      {
        data[i][j]=max(data[i/2][j-W[i]]+V[i],data[i/2][j]);
      }
      else
      {
        data[i][j]=data[i/2][j];
      }
    }
  }


int uiv[10];
int wuiv=0;


//下半分
for(ll loop=0;loop<q;loop++){
  ll uidx=u[loop];
  if (uidx<(1LL<<nhi)){
    cout<<data[uidx][L[loop]]<<endl;
  }else{//上＋下
    ll maxval=0;
    //vi uiv;
    int nn=0;
    wuiv=0;
    for(;;uidx/=2){
      if (uidx<(1LL<<nhi))break;
      uiv[wuiv]=uidx;
      wuiv++;
      nn++;
    }

    int bn=1<<nn;
    for(int i=0;i<bn;i++){
      setbit(i);
      ll tmpw=0;
      ll tmpv=0;
      /*
      for(int j=0;j<nn;j++){
        if (i&(1<<j)){
          tmpv+=V[uiv[j]];
          tmpw+=W[uiv[j]];
        }
      }
      */
      for (auto j : bt) {
        tmpv+=V[uiv[j]];
        tmpw+=W[uiv[j]];
      }
      if (tmpw<=L[loop]){
        maxval=max(data[uidx][L[loop]-tmpw]+tmpv,maxval);
      }
    }

    cout<<maxval<<endl;
  }












}


  return 0;
}

Measured memory_bytes: 809356
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
// const bool debug=true;
const bool debug=false;
#define DEBUG if(debug==true)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1000000007;

int main(void) {
    int n;
    cin >> n;
    int w[n];
    rep(i,n)cin>>w[i];
    int sum[n]={};
    rep(i,n){
        sum[i]+=w[i];
        if(i>0)sum[i]+=sum[i-1];
    }
    int res=1<<30;
    for(int i=0;i<n;i++){
        res=min(res, abs(sum[n-1]-sum[i]*2));
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using P = pair<lint, lint>;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
constexpr int MOD = 1000000007;
constexpr int INF = 2147483647;
void yes(bool expr) {
  cout << (expr ? "Yes" : "No") << "\n";
}
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int N, K;
  cin >> N >> K;
  vector<P> A(N);
  REP(i, N) {
    lint t, d;
    cin >> t >> d;
    A[i] = make_pair(d, t);
  }
  sort(ALL(A), greater<P>());
  lint dsum = 0;
  vector<lint> tnum(N+1);
  REP(i, K) {
    dsum += A[i].first;
    tnum[A[i].second]++;
  }
  lint tcnt = 0;
  REP(i, N+1) if(tnum[i] > 0) tcnt++;
  int lidx = K-1;
  int ridx = K;
  lint ans = dsum + tcnt*tcnt;
  while(lidx >= 0 && ridx < N) {
    if(tnum[A[lidx].second] == 1) {
      lidx--;
      continue;
    }
    if(tnum[A[ridx].second] > 0) {
      ridx++;
      continue;
    }
    tnum[A[lidx].second]--;
    tnum[A[ridx].second]++;
    dsum += A[ridx].first - A[lidx].first;
    tcnt++;
    if(dsum + tcnt*tcnt > ans) ans = dsum + tcnt*tcnt;
    lidx--;
    ridx++;
  }

  cout << ans << endl;

}

Measured memory_bytes: 2560
#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
int main(void)
{
	int n,m,x[2019],a[100],i,j;
	cin>>n;
	for(i=0;i<n;i++){
		cin>>x[i];
	}
	cin>>m;
	for(i=0;i<m;i++){
		cin>>a[i];
		a[i]=a[i]-1;
	}
	for(i=0;i<m;i++){
		if(x[a[i]]+1!=x[a[i]+1] && x[a[i]]!=2019){
			x[a[i]]=x[a[i]]+1;
		}
	}
	
	for(i=0;i<n;i++){
		cout<<x[i]<<endl;
	}
	
	return 0;
}

	


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

int main(void){
	int n,s;

	while(1){
		cin >> n >> s;
		if(n==0&&s==0)break;
		int *r = new int[n];
		for(int i=0; i<n; i++)
			cin >> r[i];

		int cnt=0;
		sort(r,r+n);
		for(int i=0; i<n-1; i++)
			for(int j=i+1; j<n; j++)
				if(r[i]+r[j]>s){
					cnt+=n-j;
					break;
				}
		
		cout << cnt << endl;
	}
}

Measured memory_bytes: 3240
import fractions
from functools import reduce

A,B,C,D=[int(x) for x in input().rstrip().split()]
cnt=0

import math

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

    
baisuu=lcm(C,D)

u_A=(A-1)-(A-1)//C-(A-1)//D+(A-1)//baisuu

u_B=B-B//C-B//D+B//baisuu

print(u_B-u_A)

Measured memory_bytes: 5372
if __name__ == '__main__':
    from sys import stdin
    input = stdin.readline

    s = input()[:-1]
    n = len(s)
    for a, b in zip(s, s[::-1]):
        if a != b:
            print('No')
            exit()
    for a, b in zip(s[:(n-1)//2], s[(n-3)//2:0:-1]):
        if a != b:
            print('No')
            exit()
    for a, b in zip(s[(n+1)//2:], s[::-1]):
        if a != b:
            print('No')
            exit()
    print('Yes')


Measured memory_bytes: 3064
//#pragma once
#include <stdio.h>
#include <string>
#include <iostream>
#include <queue>
#include <algorithm>
#include <sstream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cctype>


using namespace std;
#define modd 1000000007



typedef pair<long long, long long> pl;


typedef string::const_iterator State;
class ParseError {};




#define ll long long




class UnionFind {
public:
	vector <ll> par;
	vector <ll> siz;

	// Constructor
	UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL){
		for (ll i = 0; i < sz_; ++i) par[i] = i;
	}
	void init(ll sz_) {
		par.resize(sz_);
		siz.assign(sz_, 1LL);  // resize だとなぜか初期化されなかった
		for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
	}

	// Member Function
	// Find
	ll root(ll x) { // 根の検索
		while (par[x] != x) {
			x = par[x] = par[par[x]]; // x の親の親を x の親とする
		}
		return x;
	}

	// Union(Unite, Merge)
	bool merge(ll x, ll y) {
		x = root(x);
		y = root(y);
		if (x == y) return false;

		// merge technique（データ構造をマージするテク．小を大にくっつける）
		if (siz[x] < siz[y]) swap(x, y);
		siz[x] += siz[y];
		par[y] = x;
		return true;
	}



	bool issame(ll x, ll y) { // 連結判定
		return root(x) == root(y);
	}

	ll size(ll x) { // 素集合のサイズ
		return siz[root(x)];
	}


};


class SegmentTree {
private:
	int n;
	vector <ll> node;

public:
	// 元の配列　v をセグメントツリーで表現する。
	SegmentTree(vector<ll> v) {
		//最下段のノード数は元配列のサイズ以上になる最小の2冪->これをnとおく。
		//セグ木全体で必要なノード数は2n-1個である。
		int sz = v.size();
		n = 1; 
		while (n < sz)n *= 2;

	}

};




long long N, M, K, a, b, c, d, e, H, W, L;
ll A[300005] = {};
ll B[300005] = {};
ll C[300005] = {};
bool f, ff;
string S;
set <long long>sll;
pl bufpl;
vector <long long>vl[100005];
vector <long long>vll;
vector <pl>vpl;
vector <string> vs;
set<ll> llset;
multiset<ll> llmset;


struct ST
{
	int kaisuu;
	int dan;
	int score;
	char situ[52][2][2];
	

	bool operator<(const ST& another) const
	{
		return dan < another.dan;//比較
	};

};



/*vector <ST> vst;
ST st[200005];
ST bufst;
bitset<5000> bits;*/


long long modinv(long long aa, long long mm) {
	long long bb = mm, uu = 1, vv = 0;
	while (bb) {
		long long tt = aa / bb;
		aa -= tt * bb; swap(aa, bb);
		uu -= tt * vv; swap(uu, vv);
	}
	uu %= mm;
	if (uu < 0) uu += mm;
	return uu;
}


ll minn, maxx;
double ansa;

string SS;
char ca;

ll huka, owari,kaisuu;

double kakuritu,ab,ac,ad;


int main() {

	cin >> S;

	a = S[0] - 'A';
	c = 1;
	d = 0;
	f = true;

	for (int i = 1; i < 4; i++) {
		if (a == S[i] - 'A') {
			c++;
		}
		else if (f == true) {
			b = S[i] - 'A';
			f = false;
		}
		else if (b == S[i] - 'A') {
			d++;
		}

	}

	
	if (c == 2 && d == 1) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	
	//cout << fixed << setprecision(10) << ansa << endl;
	return 0;

}


Measured memory_bytes: 4352
#include<iostream>
using namespace std;
#define mem(a,b) memset(a,b,sizeof(a))
typedef long long LL;
typedef pair<int,int> PII;
#define X first
#define Y second
inline int read()
{
	int x=0,f=1;char c=getchar();
	while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
	while(isdigit(c)){x=x*10+c-'0';c=getchar();}
	return x*f;
}

int main()
{
	char s[3];
	scanf("%s",s);
	int ans=0;
	for(int i=0;i<3;i++)
	{
		int len=0;
		while(i<3 && s[i]=='R')len++,i++;
		ans=max(ans,len);	
	}
	printf("%d\n",ans);
	return 0;
}
/*

*/


Measured memory_bytes: 3232
#include <iostream>
#include <map>
#include <cctype>

using namespace std;

int main(void) {
  char line[1200];
  map<char, int> mp;
  int t;
  for(char c = 'a'; c <= 'z'; c++)
    mp[c] = 0;
  while(cin.getline(line, sizeof(line))) {
    for(int i = 0; line[i] != '\0'; i++)
      line[i] = tolower(line[i]);
    for(int i = 0; line[i] != '\0'; i++)
      if(mp.find(line[i]) != mp.end())
        mp[line[i]] += 1;
  }
  for(map<char, int>::iterator itr = mp.begin(); itr != mp.end(); ++itr)
    cout << itr->first << " : " << itr->second << endl;
  return 0;
}

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------


string S;
int N;

int Rcur[1010101];
int Rma[1010101];


void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>S;
	N=S.size();
	int cur=0,Z=0;
	FORR(c,S) {
		if(c=='1') cur++;
		else cur--;
		Z=max(cur,Z);
	}
	
	for(i=N-1;i>=0;i--) {
		if(S[i]=='1') {
			Rcur[i]=Rcur[i+1]-1;
		}
		else {
			Rcur[i]=Rcur[i+1]+1;
		}
		Rma[i]=max(Rcur[i],Rma[i+1]);
	}
	
	int mi=0;
	cur=0;
	FOR(i,N) {
		//cout<<i<<" "<<cur<<" "<<Rma[i+1]<<" "<<Z<<" "<<(cur+1+Rma[i+1]>Z)<<" "<<S[i]<<endl;
		if(S[i]=='1') cur++;
		else if(S[i]=='0') cur--;
		else {
			if(cur+1+(Rma[i+1]-Rcur[i+1])>Z) {
				cur--;
			}
			else {
				cur++;
			}
		}
		mi=min(mi,cur);
	}
	
	int ret=Z-mi;
	cur=mi=0;
	FOR(i,N) {
		//cout<<i<<" "<<cur<<" "<<Rma[i+1]<<" "<<Z<<" "<<(cur+1+Rma[i+1]>Z)<<" "<<S[i]<<endl;
		if(S[i]=='1') cur++;
		else if(S[i]=='0') cur--;
		else {
			if(cur+1+(Rma[i+1]-Rcur[i+1])>Z+1) {
				cur--;
			}
			else {
				cur++;
			}
		}
		mi=min(mi,cur);
	}
	ret=min(ret,Z+1-mi);
	cout<<ret<<endl;
	
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 12176
import java.util.Scanner
object Main extends App {
  val sc = new Scanner(System.in)
  val sx, sy, tx, ty = sc.nextInt
  val (dx, dy) = (tx - sx, ty - sy)
  val (u, d, l, r) = (
    Stream.continually('U'),
    Stream.continually('D'),
    Stream.continually('L'),
    Stream.continually('R'))
  println {
    (u.take(dy) ++ r.take(dx) ++ d.take(dy) ++ l.take(dx) ++
    l.take(1) ++
    u.take(dy + 1) ++ r.take(dx + 1) ++
    d.take(1) ++ r.take(1) ++
    d.take(dy + 1) ++ l.take(dx + 1) ++ u.take(1)).mkString
  }
}


Measured memory_bytes: 32280
#include <iostream>
#include <stdio.h>


int main() {
    int w, h, x, y, r;
    int xmin, xmax, ymin, ymax;

    scanf("%d %d %d %d %d", &w, &h, &x, &y, &r);

    xmin = r;
    xmax = w - r;
    ymin = r;
    ymax = h - r;

    if (xmin <= x and xmax >= x and ymin <= y and ymax >= y) {
        std::cout << "Yes\n";
    } else {
        std::cout << "No\n";
    }

    return 0;
}

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

#define NREP() for(ll i = 0; i < n; i++)
#define MREP() for(ll j = 0; j < m; j++)
#define REP(i, x, y) for(ll i = x; i < y; i++)
#define ALL(x) (x).begin(), (x).end()
#define MSG(x) cout << x << endl;
#define MSGF(x, n) MSG(fixed << setprecision(n) << x)
#define END(x) cout << x << endl; exit(0);
#define IPT(v, n) REP(i, 0, n){ cin >> v[i]; }
#define YN(x) x ? cout << "YES" << endl : cout << "NO" << endl;
#define Yn(x) x ? cout << "Yes" << endl : cout << "No" << endl;
#define yn(x) x ? cout << "yes" << endl : cout << "no" << endl;

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;

const static ll MOD = 1e9 + 7;
const static ll INF = 1 << 30;

ll a, b, c, d, k, l, m, n, h, w, q, x, y;
string s, t;

ll ans = 0;
ll sum = 0;
ll cnt = 0;
ll tmp = 0;
ll mini = INF;
ll maxi = 0;

double ave = 0.0;

int main() {
    cin >> n;
    ull t_this, a_this, t_act, a_act;
    NREP() {
        cin >> t_this >> a_this;
        if (i == 0) {
            t_act = t_this;
            a_act = a_this;
            continue;
        }

        ull t_rat = (t_act + t_this - 1) / t_this;
        ull a_rat = (a_act + a_this - 1) / a_this;
        t_act = t_this * max(t_rat, a_rat);
        a_act = a_this * max(t_rat, a_rat);
    }
    MSG(t_act + a_act)
}


Measured memory_bytes: 256
///A drunk man will find his way home, but a drunk bird may get lost forever...
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define f first
#define s second
#define int long long
#define sz(x) (int)x.size()
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
	int a, b;
	cin >> a >> b;
	cout << max(a + b , max(a - b , a * b)) << endl;
	return 0;
}


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

### nCk mod
mod = int(1e9+7)

fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用
 
for i in range(2, N + 1):
    fact.append((fact[-1] * i) % mod)
    inv.append((-inv[mod % i] * (mod // i)) % mod)
    factinv.append((factinv[-1] * inv[-1]) % mod)

def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p
### nCk mod

#print(cmb(N, K, mod))

ans = 0
#calc sum(MAX(S))
for i in range(N):
  ans = (ans + cmb(i, K-1, mod) * A[i]) % mod
  
#calc sum(MIN(S))
for i in range(N):
  ans = (ans - cmb(N-1-i, K-1, mod) * A[i]) % mod
  
print(ans)

Measured memory_bytes: 20304
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <bitset>
#include <complex>
using namespace std;
#define REP(i,n) for(int i = 0; i < (int)n; i++)
#define FOR(i,a,b) for(int i = a; i < (int)b; i++)
#define pb push_back
#define mp make_pair
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef long long ll;
typedef unsigned long long ull;
const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
const int INF = 1 << 27;
const int MAX_V = 202;
//////////////////////////////
// 2??¨??????????????°(???????????¨???1)
int V, match[MAX_V], used[MAX_V];
vector<vi> G(MAX_V);

bool dfs(int v){
  used[v] = true;
  REP(i, G[v].size()){
    int u = G[v][i], w = match[u];
    if(w < 0 || (!used[w] && dfs(w))){
      match[v] = u;
      match[u] = v;
      return true;
    }
  }
  return false;
}
int bipartite_matching(){
  int res = 0;
  memset(match, -1, sizeof(match));
  REP(v, V)
    if(match[v] < 0){
      memset(used, 0, sizeof(used));
      if(dfs(v)) ++res;
    }
  return res;
}
int main() {
  int X, Y, E; cin >>X >>Y >>E;
  V = X + Y;
  REP(i, E){
    int u, v; cin >>u >>v;
    v += X;
    G[u].push_back(v);
    G[v].push_back(u);
  }
  cout << bipartite_matching() <<endl;
  return 0;
}

Measured memory_bytes: 3272
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

k = int(input())

homes = [a, b, c, d, e]

for j in range(4):
    for i in range(j, 4):
        dist = homes[i + 1] - homes[j]
        if k < dist:
            print(':(')
            exit()
print('Yay!')


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define inf 0x3f3f3f3f
int main()
{
	int n;cin>>n;
	long long a[200005];
	for(int i=0;i<n;i++)
	cin>>a[i];
	sort(a,a+n);
	long long ans=a[n-1];
	int b=n-2;
	for(int i=n-2;i>0;i--)
	{
		if(b>1)
		{
			b-=2;
			ans+=a[i]*2;
		}
		else if(b==1)
		{
			b=0;
			ans+=a[i];
		}
		else 
		break;
	}
	cout<<ans<<endl;
}



Measured memory_bytes: 5204
/*
 * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_3_B&lang=jp
 */
import java.util.*;

class Task {
	String name;
	int time;
	int endTime;
	Task(String name, int time) {
		this.name = name;
		this.time = time;
	}
	void setEndTime(int x) {
		this.endTime = x;
	}
}

public class Main {
	
	void run() {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int q = scan.nextInt();
		//Task[] tasks = new Task[n];
		LinkedList<Task> tasks = new LinkedList<Task>();
		for (int i = 0; i < n; i++) {
			String name = scan.next();
			int time = scan.nextInt();
			//tasks[i] = new Task(name, time);
			tasks.add(new Task(name, time));
		}

		Task[] result = new Task[n];
		int topOfResult = 0;
		
		int time = 0;
		int idx = 0;
		while (topOfResult < n) {
			Task task = tasks.pop();
			if (task.time > q) {
				task.time -= q;
				time += q;
				tasks.add(task);
			} else if (task.time > 0) {
				time += task.time;
				task.time = 0;
				task.setEndTime(time);
				result[topOfResult++] = task;
			}
			if (++idx >= n) idx = 0;
		}
		
		for (int i = 0; i < result.length; i++) {
			System.out.println(result[i].name + " " + result[i].endTime);
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}

}



Measured memory_bytes: 83120
def ini(): return int(input())
def inli(): return list(map(int, input().split()))
def inf(): return float(input())
def inlf(): return list(map(float, input().split()))
def inl(): return list(input())
def pli(): return "".join(list(map(str, ans)))

print(int((ini()+ini())*ini()/2))

Measured memory_bytes: 3060