akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
const int MM = 1000000000;
const int MOD = MM + 7;
const int MAX = 510000;
#define rep(i, n) for(ll i=0; i<n; i++)
#define Rep(i, j, n) for(ll i=j; i<n; i++)
#define all(vec) vec.begin(), vec.end()
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;}
const ll INF = 1LL << 60;

int main() {
    int h, w, K; cin >> h >> w >> K;
    int res = 0;
    vector<vector<char>> d(h, vector<char>(w));
    rep(i, h) rep(j, w) cin >> d[i][j];
    rep(i, (1<<h)) {
        rep(j, (1<<w)) {
            vector<vector<char>> c = d;
            rep(k, h+1) {
                if(i & (1<<k)) {
                    rep(a, w) c[k][a] = '.';
                }
            }
            rep(k, w+1) {
                if(j & (1<<k)) {
                    rep(a, h) c[a][k] = '.';
                }
            }
            int cnt = 0;
            rep(k, h) rep(l, w) if(c[k][l] == '#') cnt++;
            if(cnt == K) res++;
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int s = sc.nextInt();
		int w = sc.nextInt();
		if(w >= s)System.out.println("unsafe");
		else System.out.println("safe");
	}
}


Measured memory_bytes: 35720
#include<stdio.h>
#include<string.h>

int max(int x, int y) {
	if (x > y) return x;
	else return y;
}
int min(int x, int y) {
	if (x > y) return y;
	else return x;
}

int main(void)
{
	int a;
	char s[100001];

	scanf("%d %s", &a, s);
	if (a >= 3200) {
		printf("%s\n",s);
	}
	else {
		printf("red\n");
	}
	return 0;
}

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

int main() {
  ll n;
  cin >> n;
  string ans = "";
  int len=0;
  
  //cout << len << endl;
  while(n>0){
    n--;
    ans += (char)((n%26)+'a');
    n /= 26;
  }
  reverse(ans.begin(),ans.end());
  
  cout << ans << endl;
  
  return(0);
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define range(a) (a).begin(),(a).end()
#define print(A,n) rep(i,0,n){cout<<(i ? " ":"")<<A[i];}cout<<endl;
#define pprint(A,m,n) rep(j,0,m){print(A[j],n);}
const long mod=1e9+7;
const int size=1e5;
const int inf=1e9;
int N,M;
class modBinomial{
	long inv(long x){// p is a prime
		if(x==0) return 0;
		int i=0;long res=1;
		while((p-2)>=(1<<i)){
			if((p-2)&(1<<i)) (res*=x)%=p;
			i++; x=x*x%p;
		}return res;
	}
public:
	const long p=mod;
    long modfact(long n){//n! mod p
	    if(n>=p) return 0;
        long res=1;
	    rep(i,1,n+1) (res*=i)%=p;
	    return res;
    }
    long modperm(long n,long r){//nPr mod p
	    if(n-r>=p||r%p>n%p) return 0;
	    long res=1;
	    rep(i,n-r+1,n+1) (res*=i)%=p;
	    return res;
    }
    long modcomb(long n,long r){//nCr mod p
	    return (modperm(n,r)*inv(modfact(r)))%p;
    }
};

int main(){
	cin>>N>>M;
    if(M==1){ cout<<1<<endl; return 0; }
	vector<int> vp;
	rep(i,2,100000){
		int cnt=0;
		while(M%i==0){
			M/=i;
			cnt++;
		}if(cnt) vp.push_back(cnt);
	}if(M!=1) vp.push_back(1);
	long ans=1;
	modBinomial mb;
	for(int n:vp){
		(ans*=mb.modcomb(n+N-1,N-1))%=mod;
	}cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)

                    
using ll = long long;
using ull = unsigned long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const ll mod = 1e9+7;
void chmod(ll &M){
  if(M >= mod) M %= mod;
  else if(M < 0){
     M += (abs(M)/mod + 1)*mod;
    M %= mod;
}
}
ll modpow(ll x, ll n){
   if(n==0) return 1;
  ll res=modpow(x, n/2);
 if(n%2==0) return res*res%mod;
else return res*res%mod*x%mod;
}
int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };
long long GCD(long long a, long long b) {
  if (b == 0) return a;
  else return GCD(b, a % b);
}

using namespace std;
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
int main()
{
    vector<int> a;
    rep(i,5) {
        int n;
        cin >> n;
        a.push_back(n);
        if (a.at(i) == 0) cout << i + 1 << endl;
}
}

Measured memory_bytes: 3480
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>

using namespace std;

// ツ友ツ達ツ甘鳴係
bool friends[501][501];

int main(){

	int n,m;
	while(cin >> n >> m && !(n == 0 && m == 0)){
		for(int i = 0; i < 501; i++)
			fill(friends[i],friends[i]+501,false);

		for(int i = 0; i < m; i++){
			int a,b;
			cin >> a >> b;
			a--;b--;
			friends[a][b] = true;
			friends[b][a] = true;
		}
		vector<int> ff;
		int cnt = 0;
		set<int> s;
		for(int i = 1; i < n; i++){
			if(friends[0][i]){
				cnt++;
				s.insert(i);
				ff.push_back(i);
			}
		}
		for(int i = 0; i < ff.size(); i++){
			int idx = ff[i];
			for(int j = 1; j < n; j++){
				if(friends[idx][j]){
					cnt++;
					s.insert(j);
				}
			}
		}
		cout << s.size() << endl;
	}


	return 0;
}

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

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

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

  string ans;
  if (b <= a)
    ans = "delicious";
  else if (a < b && a + x >= b)
    ans = "safe";
  else
    ans = "dangerous";

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int N; double p[3000], dp[3000][3000], ans;
int main(){
    scanf("%d", &N);
    for(int i=1; i<=N; i++) scanf("%lf", &p[i]);
    dp[0][0] = 1.0;
    for(int i=1; i<=N; i++){
        dp[i][0] = dp[i-1][0] * (1-p[i]);
        for(int j=1; j<=i; j++)
            dp[i][j] = p[i] * dp[i-1][j-1] + (1-p[i])*dp[i-1][j];
    }
    for(int i=N; i>N/2; i--) ans += dp[N][i];
    printf("%.9f\n", ans);
}


Measured memory_bytes: 68864
a,v=map(int,input().split())
b,w=map(int,input().split())
t=int(input())
r=abs(a-b)
if v<=w:
 print("NO")
else:
 if r%(v-w)==0:
  if (r/(v-w))<=t:
   print("YES")
  else:
   print("NO")
 else:
  if (r//(v-w))<=t-1:
   print("YES")
  else:
   print("NO")

Measured memory_bytes: 9200
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c,d,e;
    cin >> a >> b >> c >> d >> e;
    if(a==0)cout << 1;
    else if(b==0)cout << 2;
    else if(c==0)cout << 3;
    else if(d==0)cout << 4;
    else cout << 5;
}

Measured memory_bytes: 3632
#include<stdio.h>

int main() {
	
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	if(a<b){
		if(b<c){
		printf("Yes\n");
		}else{
			printf("No\n");
		}
	}else{
		printf("No\n");
	}
	return 0;
}


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

#define int long long
#define ll long long
#define f1(i,a,b) for(int i=a;i<b;i++)
#define f2(i,a,b) for(int i=a;i>=b;i--)
#define endl '\n'
#define pb push_back
#define gp " "
#define ff first
#define ss second
#define mp make_pair

const int mod=1000000007;
ll temp;

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    // #ifndef ONLINE_JUDGE
    // 	freopen("/home/akmittal/Desktop/Competitive Programming/in.txt","r",stdin);
    // 	freopen("/home/akmittal/Desktop/Competitive Programming/out.txt","w",stdout);
    // #endif

    string s;
    cin>>s;

    if(s=="SUN")
    	cout<<7<<endl;
    else if(s=="SAT")
    	cout<<1<<endl;
    else if(s=="FRI")
    	cout<<2<<endl;
    else if(s=="THU")
    	cout<<3<<endl;
    else if(s=="WED")
    	cout<<4<<endl;
    else if(s=="TUE")
    	cout<<5<<endl;
    else if(s=="MON")
    	cout<<6<<endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<climits>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
using namespace std;
typedef pair<int, int> P;
typedef long long int ll;
typedef pair<ll,ll> LLP;
#define INF 1000000007

#define ARRAY_MAX 55

ll n,x;
ll b[ARRAY_MAX];
ll p[ARRAY_MAX];
ll cnt[ARRAY_MAX];

ll ans = 0;

void dfs(ll now,ll sum){
    //レベルnを見ている、合計はsum
    sum++;//バンを足す
    if(now == 0){
        ans++;
    }
    if(sum == x){
        return;
    }
    if(sum + cnt[now-1] >= x){
        //n-1レベルのバーガーを食べる過程でxにたどり着く
        dfs(now-1,sum);
    }else{
        //xに足りないので全て足せる
        ans += p[now-1];
        sum += cnt[now-1];

        sum++;//パティ
        ans++;//パティ増加
        if(sum == x){
            //xに達した
            return;
        }else{
            //まだxに達していない
            if(sum + cnt[now-1] >= x){
                //n-1レベルのバーガーを食べる過程でxにたどり着く
                dfs(now-1,sum);
            }else{
                ans += p[now-1];
                sum += cnt[now-1];
            }
            sum++;//バンを足す
        }
    }
}

int main(){

    cin >> n >> x;
    b[0] = 0;
    p[0] = 1;
    cnt[0] = 1;

    /*REP(i,50){
        cout << b[i] << " " << p[i] << endl;
    }*/

    REP(i,51){
        b[i+1] = 2*b[i] + 2;
        p[i+1] = 2*p[i] + 1;
        cnt[i+1] = cnt[i]*2+3;
        //cout << b[i] << " " << p[i] << " " << cnt[i] << endl;
    }
    dfs(n,0LL);//配列添え字に合わせる
    cout << ans << endl;




    return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**6)

h, w = map(int, input().split())
s = [input() for _ in range(h)]
t = [[None]*w for _ in range(h)]
box = [(1, 0), (0, 1), (-1, 0), (0, -1)]

def dfs(i, j, color):
    if not (0<=i<h and 0<=j<w): return 0, 0
    if s[i][j] == color: return 0, 0
    if t[i][j]: return 0, 0

    t[i][j] = True
    wh, bl = 0, 0
    if s[i][j] == "#":
        bl += 1
    else:
        wh += 1

    for x, y in box:
        tmp1, tmp2 = dfs(i+x, j+y, s[i][j])
        wh, bl = wh+tmp1, bl+tmp2

    return wh, bl

ans = 0
for i in range(h):
    for j in range(w):
        a, b = dfs(i, j, "!")
        ans += a*b
print(ans)


Measured memory_bytes: 154444
def solution(a):
    if len(a) == 2:
        return abs(a[0] - a[1])

    total =sum(a)
    min_diff = 999999999999999
    part_of_sum = 0
    for i in range(len(a)-1):
        part_of_sum += a[i]
        total -= a[i]
        if abs(part_of_sum - total) < min_diff:
            min_diff = abs(part_of_sum - total)

    return min_diff


N = int(input())
a = [int(value) for value in input().split(' ')]
print(solution(a))

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

const int inf=1e9; 

int main(){
	int n; cin >> n;
    vector<int> a(n, inf), b(n-1);
    for(int i=0; i<n-1; i++){
        int b; cin >> b;
        a[i]=min(a[i], b);
        a[i+1]=min(a[i+1], b);
    }

	cout << accumulate(a.begin(), a.end(), 0) << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

main(){
  int a, b, count, tmp;

  while(1){
    scanf("%d %d", &a, &b);
    if(a==0 && b==0) break;
    if(a<b){
      tmp=a;
      a=b;
      b=tmp;
    }
    count=0;
    while(1){

      tmp=a%b;
      a=b;
      b=tmp;
      count++;
      if(b==0) break;
    }
    printf("%d %d\n", a, count);
  }
  return 0;
}

Measured memory_bytes: 0
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a,b;
    cin >> a >> b;
    if(a>b){
        cout << "a > b" <<endl;
    }else if(a<b){
        cout << "a < b" << endl;
    }else 
        cout << "a == b" <<endl;
    return 0;
}



Measured memory_bytes: 3096
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=int(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
#define rAll(x) (x).rbegin(),(x).rend()
using namespace std;
using ll = long long;

int main(){
    ll X;cin>>X;
    ll now=100;
    int cnt=0;
    while(now<X){
        now*=1.01;
        cnt++;
    }
    cout<<cnt<<endl;
}


Measured memory_bytes: 3624
#include <algorithm>
#include <bitset>
#include <cfloat>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define int long long
#define ll long long
#define eps LDBL_EPSILON
#define mod 10000000
#define int long long
#define double long double
#define INF LLONG_MAX/10
#define P pair<int,int>
#define prique priority_queue
using namespace std;
signed main() {
	int n, sum = 0;
	cin >> n;
	rep(i, n) {
		int a;
		cin >> a;
		sum ^= a;
	}
	if ((sum ^ sum) == sum)puts("Yes");
	else puts("No");
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <vector>
#include <algorithm>
using namespace std;
using UL = unsigned int;
using ULL = unsigned long long;
using LL = long long;

#define rep(i,n) for(int i=0; i<(n); i++)
LL floor_usr(LL a, int b){ return (a + (b - 1)) / b;}
const int maxN =200001;
template <class dt>
class dp_info{
  public:
    dt val;
    int maxnum;
    priority_queue<dt, vector<dt>, greater<dt>> items;   
    dp_info(dt val_, int maxnum_){val=val_;rep(i,maxnum_) items.push(0);maxnum=maxnum_;}
    dp_info replace(dt newitem){
        dp_info ret(val, maxnum);
        ret.items = items;
        if(!ret.items.empty()){
          dt minv = ret.items.top();
          if(minv < newitem){
            ret.items.push(newitem);
            ret.items.pop();
            ret.val = ret.val+newitem-minv;
          }
        } else {
          ret.items.push(newitem);
          ret.val += newitem;
        }
        return ret;
    }
    static dp_info max(const dp_info& a, const dp_info& b){
      if(a.val > b.val) return a;
      else return b;
    }
    dp_info get_clear(){
      dp_info ret(val, maxnum);
      return ret;
    }
};
int main() {
  using dt=LL;
  int maxnum=3;
  dt R, C, K; scanf("%lld %lld %lld" ,&R, &C, &K);
  vector<vector<dt>> v(R, vector<dt>(C,0));
  vector<vector<vector<dt>>> dp(R, vector<vector<dt>>(C,vector<dt>(maxnum+1,0)));
  dt r_, c_, v_;
  rep(i, K){
    scanf("%lld %lld %lld",&r_, &c_, &v_);
    v[r_-1][c_-1] = v_;
  }
  rep(r,R){
    if(r==0){
      rep(c,C){
        if(c==0){
          dp[r][c][0] = 0;
          dp[r][c][1] = dp[r][c][0] + v[r][c];
          rep(i,maxnum-1) dp[r][c][i+2] = dp[r][c][i+1];
        }else{
          dp[r][c] = dp[r][c-1];
          rep(k,maxnum+1){
            if(k==0) continue;
            else{
              dp[r][c][k] =  max(dp[r][c][k], dp[r][c-1][k-1] + v[r][c]);
              dp[r][c][k] =  max(dp[r][c][k], dp[r][c][k-1]);
            }
          }
        }
      }
    }else{
      rep(c,C){
        if(c==0){
          dp[r][c][0] = dp[r-1][c][maxnum];
          dp[r][c][1] = dp[r][c][0]+v[r][c];
          rep(i,maxnum-1) dp[r][c][i+2] = dp[r][c][i+1];
        }else{
          dp[r][c][0] = max(dp[r-1][c][maxnum], dp[r][c-1][0]);
          dp[r][c][1] = max(dp[r][c][0]+v[r][c], dp[r][c-1][1]);
          rep(k,maxnum+1){
            if(k<=1) continue;
            else{
              dp[r][c][k] = max(dp[r][c-1][k], dp[r][c-1][k-1] + v[r][c]);
              dp[r][c][k] = max(dp[r][c][k], dp[r][c][k-1]);
            }
          }
        }
      }
    }
  }
  cout<<dp[R-1][C-1][maxnum];
  //真の値より一回小さいnが得られているので、追加するiを選んで最小値を求める
  return 0;
}



Measured memory_bytes: 706644
<?php

// ??¢????????¢??°?????????????????°???????????????
$conf = array(
	"I" => 1,
	"V" => 5,
	"X" => 10,
	"L" => 50,
	"C" => 100,
	"D" => 500,
	"M" => 1000
);


while($line = fgets(STDIN)){
	$length = strlen(trim($line));

	$prev = 0;	// ??????????????°???
	$d = 0;		// ????????°???
	$total = 0;	// ????¨?

	for($i = 0; $i < $length; $i++){
		$prev = $d;	// ???????????°????????????
		
		// ??¢????????¢??°????????????????????????
		$d = intval($conf[substr($line, $i, 1)]);
		$total += $d;
		if($prev > 0 && $prev < $d){
			$total -=  ($prev * 2);
		}
	}
	echo $total."\n";
}

Measured memory_bytes: 15116
#include<bits/stdc++.h>
 
#define ll long long 
#define mkp make_pair 
#define fi first 
#define se second
#define pb push_back 
#define pf push_front 
#define ppb pop_back 
#define ppf pop_front 

using namespace std ;
 
int z , o , ans ;
 
int main(){
 

	string s ;
	cin >> s ;

	if( s[0] == '7' || s[1] == '7' || s[2] == '7' ){
		cout << "Yes" << endl ;
	}
	else{
		cout <<"No" << endl;
	}

 
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define x first
#define y second
#define ndl '\n'
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define up_b upper_bound
#define low_b lower_bound
#define sz(x) (int)x.size()
#define bit __builtin_popcount
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

using namespace std;
using namespace __gnu_pbds;

template<typename T> using indexed_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<int, ull> piu;
typedef vector<vector<int>> matrix;

const ll INF = 1e18 + 123;
const ld EPS = 1e-9;
const int inf = 1e9 + 123;
const int MOD = 1e9 + 7;
const int N = 5e5 + 123;
const int M = 1e6 + 123;
const double pi = acos(-1.0);
const int dx[] = {0, 0, 1, -1};
const int dy[] = {1, -1, 0, 0};

void solve(){
    int a, b, c;
    cin >> a >> b >> c;
    cout << c << " " << a << " " << b;
}

int main(){
    #ifdef KAZAKH
        freopen("input.txt", "r", stdin);
    #endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int t = 1;
    //cin >> t;
    for (int i = 1; i <= t; i++){
        //cout << "case #" << i << ": ";
        solve();
    }
    return 0;
}


Measured memory_bytes: 896
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

using namespace std;

//----------------------- Print Function ----------------------//

inline void print() {
    cout << endl;
}
template <typename First, typename... Rest>
void print(const First &first, const Rest &... rest) {
    cout << first << ' ';
    print(rest...);
}

template <typename T>
void print(const vector<T> &v) {
    for (auto e : v) cout << e << ' ';
    cout << endl;
}

//------------------------- Libraries -------------------------//

//--------------------------- Solve ---------------------------//

void solve() {
    int N, C; cin >> N >> C;
    vector<vector<int> > imos(C, vector<int>(100001));
    for (int i = 0; i < N; i++) {
        int s, t, c; cin >> s >> t >> c;
        s--; t--; c--;
        imos[c][s]++;
        imos[c][t+1]--;
    }
    
    for (int i = 0; i < C; i++) {
        for (int j = 0; j < 100000; j++) {
            if (j != 0) imos[i][j] += imos[i][j-1];
        }
    }

    int ans = 0;
    for (int t = 0; t < 100000; t++) {
        int tmp = 0;
        for (int c = 0; c < C; c++) {
            if (imos[c][t] != 0) tmp++;
        }
        ans = max(ans, tmp);
    }

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

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);

    solve();

    return 0;
}

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



int main() {
   int n;
   cin >> n;
   vector<int> a(n-1);
   for (int i=0; i<n-1; i++) {
      cin >> a[i];
   }
   vector<int> b(n,0);
   for (int j=0; j<n-1; j++) {
      b[a[j]-1]++;
   }
   for (int i=0; i<n; i++) {
      cout << b[i] << endl;
   }
   return 0;
}

Measured memory_bytes: 4768
#include<bits/stdc++.h>
#include<vector>
using namespace std;
int main()
{
  int a,b;
  cin>>a>>b;
  vector <int> v;
  v.push_back(a+b);
  v.push_back(a-b);
  v.push_back(a*b);
  cout<<*max_element(v.begin(),v.end())<<endl;
}

Measured memory_bytes: 256
import java.util.LinkedList;
import java.util.Scanner;
import java.util.Iterator;

class Graph2 {
	private int totalVertex;
	//adjMatrix[u][v] = 1 if there is an edge from u to v, otherwise 0
	private int[][] adjMatrix;
	//adjWeight[u][v] -- the weight of the edge from u to v if there is one
	private int[][] adjWeight;
	//if a node is settled (e.g., processed in the Dijkstra's algorithm)
	private Boolean[] ifSettled;
	public Graph2() { totalVertex = 0; }
	public int getTotalVertex() { return totalVertex; }
	//load graph from standard input
	public void loadAdjMatrix() {
		Scanner in = new Scanner(System.in);
		totalVertex = in.nextInt();
		adjMatrix = new int[totalVertex][totalVertex];
		adjWeight = new int[totalVertex][totalVertex];
		ifSettled = new Boolean[totalVertex];
		int i, j;
		for(i = 0; i < totalVertex; i ++) {
			ifSettled[i] = false;
			for(j = 0; j < totalVertex; j ++) {
				adjMatrix[i][j] = adjWeight[i][j] = 0;
			}
		}
		int v;
		for (int x=0; x<totalVertex; x++) {
			for (int y=0; y<totalVertex; y++) {
				v = in.nextInt();
				if (v!=-1) {
					adjMatrix[x][y] = 1;
				}
				adjWeight[x][y] = v;
			}
		}
		in.close();
	}
	//return weight of the edge from u to v if there is one
	public int getWeight(int u, int v) {
		return adjWeight[u][v];
	}
	//return neighbors of u as a LinkedList
	public LinkedList<Integer> getNeighbors(int u) {
		LinkedList<Integer> tmp = new LinkedList<Integer>();
		for(int v = 0; v < totalVertex; v ++) {
			if(adjMatrix[u][v] == 1) tmp.add(v);
		}
		return tmp;
	}
	//return unsettled neighbors of u as a LinkedList
	public LinkedList<Integer> getUnsettledNeighbors(int u) {
		LinkedList<Integer> tmp = new LinkedList<Integer>();
		for(int v = 0; v < totalVertex; v ++) {
			if((adjMatrix[u][v] == 1) && (ifSettled[v] == false)) tmp.add(v);
		}
		return tmp;
	}
	//return the unsettled node that has the smallest dist
	public int getUnsettledNearest(int[] dist) {
		int md = Integer.MAX_VALUE;
		int mv = -1;
		int v;
		for(v = 0; v < totalVertex; v ++) {
			if((ifSettled[v] == false) && (dist[v] < md)) {
				md = dist[v];
				mv = v;
			}
		}
		return mv;
	}
	public boolean djikstraDone(Boolean[] b) {
		for (int i=0; i<b.length; i++) {
			if (b[i]==false) {
				return false;
			}
		}
		return true;
	}
	//implement the following	
	public int[] Dijkstra(int s) {
		int[] dist = new int[this.getTotalVertex()];
		for (int i=0; i<dist.length; i++) {
			dist[i] = Integer.MAX_VALUE;
		}
		dist[s] = 0;
		int recent = getUnsettledNearest(dist);
		while ((recent!=-1) && (dist[recent]!=Integer.MAX_VALUE)) {
			ifSettled[recent] = true;
			LinkedList<Integer> neighbors = getUnsettledNeighbors(recent);
			for (Integer neighbor : neighbors) {
				dist[neighbor] = Math.min(getWeight(recent, neighbor), dist[neighbor]);
			}
			recent = getUnsettledNearest(dist);
			//System.out.println("infinite");
		}
		return dist;
	}
}

public class Main {
	public static void main(String[] argv) {
		Graph2 g = new Graph2();
		g.loadAdjMatrix();
		int[] dist = g.Dijkstra(0);
		int total = 0;
		for(int i = 0; i < g.getTotalVertex(); i ++) {
			total += dist[i];
		}
		System.out.println(total);
	}
}


Measured memory_bytes: 41616
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cerr << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cerr<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 500010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = (1 << 30) - 1;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
mt19937 rng; //use it by rng() % mod, shuffle(all(vec), rng)
///////////////////////////////////////////////////////////////////////////////////////////////////

int N;
pl P[MAX_N];

void solve() {
	cin >> N;
	rep(i, 0, N) {
		cin >> P[i].fst >> P[i].sec;
		P[i].sec++;
	}
	sort(P, P + N);
	multiset<ll> L[2]; multiset<ll> R[2];

	auto get_max = [](multiset<ll>& S) {
		assert(!S.empty());
		return *(--S.end());
	};
	auto get_min = [](multiset<ll>& S) {
		assert(!S.empty());
		return *(S.begin());
	};
	rep(i, 0, N) {
		L[0].insert(P[i].fst);
		R[0].insert(P[i].sec);
	}
	ll res = 0;
	rep(i, 0, N) {
		L[0].erase(P[i].fst);
		R[0].erase(P[i].sec);
		MAX(res, P[i].sec - P[i].fst + max(get_min(R[0]) - get_max(L[0]), 0ll));
		L[0].insert(P[i].fst);
		R[0].insert(P[i].sec);
	}
	rep(i, 0, N - 1) {
		L[0].erase(P[i].fst);
		R[0].erase(P[i].sec);
		L[1].insert(P[i].fst);
		R[1].insert(P[i].sec);
		MAX(res, max(get_min(R[0]) - get_max(L[0]), 0ll) + max(get_min(R[1]) - get_max(L[1]), 0ll));
	}
	cout << res << "\n";
}

uint32_t rd() {
	uint32_t res;
#ifdef __MINGW32__
	asm volatile("rdrand %0" :"=a"(res) ::"cc");
#else
	res = std::random_device()();
#endif
	return res;
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
    cerr << fixed;
	cerr.precision(6);
	rng.seed(rd());
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
	if(!freopen("in.txt", "rt", stdin)) return 1;
#endif	
	solve();
    cerr << "Time: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}




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

int main(){
    int n;
    cin >> n;

    int a[n];
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }

    int cro[9];
    for(int i = 0; i < 9; i++){
        cro[i] = 0;
    }

    int k = 0;
    for(int i = 0; i < n; i++){
        k = a[i] / 400;
        if(k > 8){
            k = 8;
        }
        cro[k]++;
    }

    int zero = 0;
    for(int i = 0; i < 8; i++) {
        if (cro[i] == 0){
            zero++;
        }
    }
 
    int m = max(1, 8 - zero);
    int M = 8 - zero + cro[8];
 
    cout  << m << " " << M << endl;

}

Measured memory_bytes: 256
#include <iostream>

using namespace std;
 
int main()
{
    //入力を受け取る
    int N, X, T;
    cin >> N >> X >> T;
 
    //たこ焼きを焼く回数を求める
    int times = (N + X - 1) / X;
 
    //答えを求める
    int ans = times * T;
 
    //答えを出力する
    cout << ans << endl;
}


Measured memory_bytes: 3592
package main

import "fmt"

func main() {
	var n, m int
	fmt.Scan(&n, &m)
	
	var a [101][101]int
	var b [101]int
	var c [101]int

	for i := 0; i < n; i++ {
		for j := 0; j < m; j++ {
			fmt.Scan(&a[i][j])
		}
	}
	
	for i := 0; i < m; i++ {
		fmt.Scan(&b[i])
	}

	for i := 0; i < n; i++ {
		for j := 0; j < m; j++ {
			c[i] += a[i][j] * b[j] 
		}
	}

	for i := 0; i < n; i++ {
			fmt.Println(c[i])
	}
	
}


Measured memory_bytes: 1792
/******************************************************************************

            EYENINE,THE ELDER_WAND!!!
            THE ROOT OVER MINUS EIGTHY ONE!!

*******************************************************************************/

#include<bits/stdc++.h>
using namespace std;
long long int arr[100010];
int main()
{

    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin>>n;
    for(int i=0; i<n; i++)
    {
        cin>>arr[i];
    }
    int zero=0;
    for(int i=0; i<n; i++)
    {
        if(arr[i]==0) zero++;
        if(zero>0)
        {
            cout<<"0\n";
            return 0;
        }
    }

    long long  int range=1;
    for(int i=0; i <n; i++)
    {
        if(arr[i]<=1000000000000000000/range)
        {
            range*=arr[i];

        }
        else
        {
            cout<<"-1\n";
            return 0;

        }
    }
    cout<<range<<"\n";

    return 0;
}


Measured memory_bytes: 4408
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(void){
  int N;
  cin >> N;
  vector<int> v(N);
  for(int i = 0; i < N; i++){
    cin >> v[i];

  }
  vector<int> D(100001, 0);
  for(int i = 0; i < N; i+=2){
    D[v[i]]++;

  }
  vector<int> U(100001, 0);
  for(int i = 1; i < N; i+=2){
    U[v[i]]++;

  }

  int D1 = 0, D2 = 0;
  int cntD1 = 0, cntD2 = 0;
  for(int i = 0; i < 100001; i++){
    if(cntD2 < D[i]){
      if(cntD1 < D[i]){
        D2 = D1;
        D1 = i;
        cntD2 = cntD1;
        cntD1 = D[i];

      }else{
        D2 = i;
        cntD2 = D[i];

      }
    }
  }

  int U1 = 0, U2 = 0;
  int cntU1 = 0, cntU2 = 0;
  for(int i = 0; i < 100001; i++){
    if(cntU2 < U[i]){
      if(cntU1 < U[i]){
        U2 = U1;
        U1 = i;
        cntU2 = cntU1;
        cntU1 = U[i];

      }else{
        U2 = i;
        cntU2 = U[i];

      }
    }
  }

  if(D1 != U1){
    cout << N - (cntD1 + cntU1) << endl;
    return 0;

  }if(D1 == U1){
    if(0 == cntD2 && 0 == cntU2){
      cout << cntU1 << endl;
      return 0;

    }
    if(0 == cntD2){
      cout << (N / 2 - cntU2) << endl;
      return 0;

    }
    if(0 == cntU2){
      cout << (N / 2 - cntD2) << endl;
      return 0;

    }
    if(cntD1 == cntD2 || cntU1 == cntU2){
      cout << N - (cntD1 + cntU1) << endl;
      return 0;

    }
    if(cntD2 <= cntU2){
      cout << (N - (cntD1 + cntU2)) << endl;
      return 0;

    }if(cntD2 > cntU2){
      cout << (N - (cntD2 + cntU1)) << endl;

    }
  }
  return 0;
}

Measured memory_bytes: 1408
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

M = INT()
b = 24 - M
ans = 24 + b
print(ans)


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

int main() {
    int d, g, p[11], c[11];
    cin >> d >> g;
    for(int i = 0; i < d; i++) {
        cin >> p[i] >> c[i];
    }
    int ans = 1e9;
    for(int mask = 0; mask < (1 << d); ++mask){
        int s = 0, num = 0, rest_max = -1;
        for(int i = 0; i < d; ++i){
            if(mask >> i & 1){
                s += 100 * (i+1) * p[i] + c[i];
                num += p[i];
            }else{
                rest_max = i;
            }
        }
        if(s < g){
            int s1 = 100 * (rest_max + 1);
            int need = (g - s + s1 - 1) / s1;
            if(need >= p[rest_max]){
                continue;
            }
            num += need;
        }
        ans = min(ans, num);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
// #include <atcoder/all>
#define ll long long int
#define ld long double
#define yorn(f) std::cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) std::cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repi(i, n) for (ll i = 1; i < (ll)(n); i++)
#define all(x) (x).begin(), (x).end()
#define put(x) std::cout << x << endl;
#define println(x) std::cout << x << endl;
using namespace std;
// using namespace atcoder;

void Main()
{
    ll n, X, M;
    cin >> n >> X >> M;

    vector<ll> Xpow;
    unordered_set<ll> Xs;
    Xpow.push_back(X);
    Xs.emplace(X);
    ll start = 0;
    repi(i, M + 1) {
        ll v = (Xpow[i-1] * Xpow[i-1]) % M;
        if (Xs.find(v) != Xs.end()) {
            auto it = find(all(Xpow), v);
            start = it - Xpow.begin();
            break;
        }
        Xpow.push_back(v);
        Xs.emplace(v);
    }

    ll loopLen = Xpow.size() - start;
    if (n <= start) {
        ll res = accumulate(Xpow.begin(), Xpow.begin() + n, 0LL);
        put(res);
        return;
    }

    ll res = accumulate(Xpow.begin(), Xpow.begin() + start, 0LL);

    ll loopSum = 0;
    for (ll i = start; i < start + loopLen; i++) {
        loopSum += Xpow[i];
    }

    res += loopSum * ((n - start) / loopLen);

    for (ll i = start; i < start + ((n - start) % loopLen); i++) {
        res += Xpow[i];
    }

    put(res);
}
signed main(){ Main();return 0;}

Measured memory_bytes: 5700
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define loop(i,a,b) for(lli i=a;i<b;i++)
#define pb push_back
#define mp make_pair
#define ub upper_bound
#define lb lower_bound
#define ff first
#define ss second
#define all(v) (v).begin(),(v).end()
#define vl vector<lli>
#define pll pair<lli,lli>
#define vpll vector<pll >
const lli MAX=100005;

int main(){
	lli n;
	cin>>n;
	lli a[n],b[n],c[n],dp[n][3];
	loop(i,0,n) cin>>a[i]>>b[i]>>c[i];
	dp[0][0]=a[0];
	dp[0][1]=b[0];
	dp[0][2]=c[0];
	loop(i,1,n){
		dp[i][0]=max(a[i]+dp[i-1][1],a[i]+dp[i-1][2]);
		dp[i][1]=max(b[i]+dp[i-1][0],b[i]+dp[i-1][2]);
		dp[i][2]=max(c[i]+dp[i-1][0],c[i]+dp[i-1][1]);
	}
	lli ans=max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
	cout<<ans;
}

Measured memory_bytes: 4992
#include <cstdio>
#include <algorithm>
static const int MAXN = 202;
static const int INF = 0x3fffffff;

int n, m, r;
int t[MAXN];
int g[MAXN][MAXN];

int main()
{
    scanf("%d%d%d", &n, &m, &r);
    for (int i = 0; i < r; ++i) scanf("%d", &t[i]), --t[i];

    for (int i = 0; i < n; ++i)
        for (int j = 0; j < n; ++j) g[i][j] = (i == j ? 0 : INF);
    for (int i = 0, u, v, w; i < m; ++i) {
        scanf("%d%d%d", &u, &v, &w); --u, --v;
        g[u][v] = g[v][u] = std::min(g[u][v], w);
    }

    for (int k = 0; k < n; ++k)
        for (int i = 0; i < n; ++i)
            for (int j = 0; j < n; ++j)
                g[i][j] = std::min(g[i][j], g[i][k] + g[k][j]);

    std::sort(t, t + r);
    int ans = INF;
    do {
        int cur = 0;
        for (int i = 1; i < r; ++i) cur += g[t[i - 1]][t[i]];
        ans = std::min(ans, cur);
    } while (std::next_permutation(t, t + r));

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


Measured memory_bytes: 384
/*Bismillahir Rahmanir Rahim*/
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a[10],b[10],i,j,k,A,B,C,D,E,l,sum=0,max,s=0;
    for(i=0; i<5; i++)
    {
        cin>>a[i];
        b[i]=a[i]%10;
    }
    max=0;
    for(i=0; i<5; i++)
    {
        if(b[i]==0)
        {
            sum=sum+a[i];
            b[i]=-1;
            s++;
        }
    }
    s=5-s;
    while(s--)
    {
        max=0;
        for(i=0; i<5; i++)
        {
            if(max<b[i])
            {
                max=b[i];
                l=i;
            }
        }
        b[l]=-1;
        if(s!=0)
            sum=sum+a[l]+(10-max);
        else if(s==0)
            sum=sum+a[l];
    }

    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 256
use std::io::*;

fn main() {
    let i = stdin();
    solve(&mut i.lock(), &mut stdout());
}

fn solve(i: &mut BufRead, o: &mut Write) {
    let n = read_num(i);
    let a = read_num(i);

    let r = if (n % 500) <= a { "Yes" } else { "No" };

    writeln!(o, "{}", r).unwrap();
}

fn read_line(i: &mut BufRead) -> String {
    let mut line = String::new();
    i.read_line(&mut line).unwrap();
    line.trim().to_string()
}
fn read_num(i: &mut BufRead) -> usize {
    read_line(i).parse().unwrap()
}


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

██╗    ██╗██████╗ ██╗████████╗████████╗███████╗███╗   ██╗    ██████╗ ██╗   ██╗
██║    ██║██╔══██╗██║╚══██╔══╝╚══██╔══╝██╔════╝████╗  ██║    ██╔══██╗╚██╗ ██╔╝
██║ █╗ ██║██████╔╝██║   ██║      ██║   █████╗  ██╔██╗ ██║    ██████╔╝ ╚████╔╝
██║███╗██║██╔══██╗██║   ██║      ██║   ██╔══╝  ██║╚██╗██║    ██╔══██╗  ╚██╔╝
╚███╔███╔╝██║  ██║██║   ██║      ██║   ███████╗██║ ╚████║    ██████╔╝   ██║
 ╚══╝╚══╝ ╚═╝  ╚═╝╚═╝   ╚═╝      ╚═╝   ╚══════╝╚═╝  ╚═══╝    ╚═════╝    ╚═╝

     ███╗   ███╗   ██╗██████╗ ██████╗  █████╗ ██╗  ██╗██╗███╗   ███╗
     ████╗ ████║   ██║██╔══██╗██╔══██╗██╔══██╗██║  ██║██║████╗ ████║
     ██╔████╔██║   ██║██████╔╝██████╔╝███████║███████║██║██╔████╔██║
     ██║╚██╔╝██║   ██║██╔══██╗██╔══██╗██╔══██║██╔══██║██║██║╚██╔╝██║
     ██║ ╚═╝ ██║██╗██║██████╔╝██║  ██║██║  ██║██║  ██║██║██║ ╚═╝ ██║
     ╚═╝     ╚═╝╚═╝╚═╝╚═════╝ ╚═╝  ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝╚═╝╚═╝     ╚═╝
*/
#define speed  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define FOR(n) for(int i=0;i<n;i++)
#define For(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define E "\n"
#define all(e) e.begin(),e.end()
#define F first
#define S second
#define pi (acos(-1))
#define rad(x) ((x*pi)/(ld)(180))
#define perc(x) fixed<<setprecision(x)
/*****
#define cross(a, b) ((conj(a) * (b)).Y)
#define dot(a, b) ((conj(a) * (b)).X)
#define vec(a,b) ((b) - (a))
#define rot(p,angle) (p)*polar((double)(1),angle)
#define rot2(p,angle,a) ((p)-(a)) *(polar((ld)(1),angle)+ (a))
#define x real()
#define y imag()
*****/
typedef long long int ll; typedef unsigned long long ull; typedef long double ld;typedef complex<ld> point; typedef tuple<double,double,double> line;
ll gcd(ll x,ll y){if(!y)return x; return gcd(y,x%y);};   ll lcm(ll x,ll y){return (x*y)/__gcd(x,y);}
const int N=1e3+1;
ll dp[N][N],n,m,mod=1e9+7;
char arr[N][N];

ll solve(int i,int j)
{
    //cout<<i << ' ' << j << E;
    if(i == n or j == m)return 0;
    if(i == n-1 and j == m-1)return 1;
    if(arr[i][j]=='#')return 0;
    //cout<<i << ' ' << j << ' '<< arr[i][j] << E;
    if(dp[i][j]!=-1)return dp[i][j];


    dp[i][j] = (solve(i,j+1) + solve(i+1,j) ) % mod;

    return dp[i][j];
}

int main(){ speed;
memset(dp,-1,sizeof dp);
cin>>n>>m;

for(int i=0;i<n;i++)for(int j=0;j<m;j++)cin>>arr[i][j];
//for(int i=0;i<n;i++){for(int j=0;j<m;j++)cout<<arr[i][j]<<' ';cout<<E;}
cout<<solve(0,0);

return 0;}


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

#define ll long long
#define endl '\n'
#ifndef _WINDOWS
// no getchar_unlocked on Windows so just call getchar
#define getchar getchar_unlocked
#endif

template <typename Func>
inline void loop(int e, Func&& f) {
    for (int i = 0; i < e; i++) {
        std::forward<Func>(f)(i);
    }
}
template <typename Func>
inline void loop(int s, int e, Func&& f) {
    for (int i = s; i < e; i++) {
        std::forward<Func>(f)(i);
    }
}
template <typename T>
inline void scanpn(T& num) {
    int c;
    num = 0;
    c = getchar();
    // bool negative = false;
    // if (c == '-') {
    // 	negative = true;
    // 	c = getchar();
    // }
    for (; (c > 47 && c < 58); c = getchar()) num = num * 10 + c - 48;
    // if (negative)
    //     number = -number;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int r;
    cin >> r;
    cout << 2 * 3.1415926 * r << endl;
    return 0;
}

Measured memory_bytes: 3796
import sys
import heapq 
input = sys.stdin.readline
n,m = map(int,input().split())
l=[tuple(map(int,input().split())) for i in range(n)]
l.sort(reverse=True)

w = []
hpop = heapq.heappop
hpush = heapq.heappush
ans = 0

for i in range(1,m+1):
  while l and l[-1][0]==i:
    hpush(w,-l.pop()[1])
  if w:
    ans += hpop(w)
print(-ans)

Measured memory_bytes: 17244
import java.util.*;
public class Main{

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner in = new Scanner(System.in);
		Set<Integer> set = new HashSet<>();
		for(int i=0;i<3;i++)
		{
			int a=in.nextInt();
			set.add(a);
		}
		if(set.size()==2)
		{
			System.out.println("Yes");
		}
		else
		{
			System.out.println("No");
		}

	}

}


Measured memory_bytes: 21972
(defun calc-c (n a c)
  (loop :for i :from 0 :to (- n 2)
        :when (= (aref a i) (1- (aref a (1+ i))))
     :sum (aref c (1- (aref a i)))))

(defun main ()
  (let* ((n (read))
         (a (coerce (loop :repeat n
                          :for i = (read)
                       :collect i)
                    'vector))
         (b (loop :repeat n
                  :for i = (read)
               :sum i))
         (c (coerce (loop :repeat (1- n)
                          :for i = (read)
                       :collect i)
                    'vector)))
    (format t "~A~%"
            (+ b (calc-c n a c)))))

(main)

Measured memory_bytes: 18408
x, n = map(int, input().split())
p = list(map(int, input().split()))
k1 = x
k2 = x
while True:  # forwards
    if k1 not in p:
        break
    k1 += 1
while True:  # backwards
    if k2 not in p:
        break
    k2 -= 1
if abs(k1-x) > abs(k2-x):
    print(k2)

elif abs(k1-x) == abs(k2-x):
    print(min(k2, k1))
else:
    print(k1)


Measured memory_bytes: 61968
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,i,minv=1000000000,maxr=-1000000000;
    cin>>n;
    vector<int> r(n);
    cin>>r[0];
    minv=r[0];
    for(i=1;i<n;i++){
        cin>>r[i];
        maxr=max(maxr,r[i]-minv);
        minv=min(r[i],minv);
    }
    cout<<maxr<<'\n';
    return 0;
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> PP;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1145141919810893364
//#define INF 810114514
#define PI 3.141592653589
#define setdouble setprecision
#define REP(i,n) for(ll i=0;i<(n);++i)
#define OREP(i,n) for(ll i=1;i<=(n);++i)
#define RREP(i,n) for(ll i=(n)-1;i>=0;--i)
#define GOODBYE do { cout << "0" << endl; return 0; } while (false)
#define MM <<" "<<
#define Endl endl
#define debug false
#define debug2 false


int main(void){
    
    ll D,c;
    vector<ll> C;
    vector<vector<ll>> S;
    
    cin >> D;
    REP(i,26){
        cin >> c;
        C.push_back(c);
    }
    S.resize(D);
    REP(i,D){
        REP(j,26){
            cin >> c;
            S[i].push_back(c);
        }
    }
    
    vector<ll> T;
    REP(i,D){
        cin >> c;
        T.push_back(c);
    }
    
    vector<vector<ll>> Last;
    Last.resize(D);
    REP(i,D){
        REP(j,26){
            Last[i].push_back(0);
        }
    }
    REP(i,T.size()){
        ll t = T[i]-1;
        for(int d=i;d<D;d++){
            Last[d][t]=i+1;
        }
    }
    
    
    
    ll Sati = 0;
    REP(d,D){
        Sati+=S[d][T[d]-1];
        REP(i,26){
            Sati-=C[i]*(d+1-Last[d][i]);
        }
        cout << Sati << endl;
    }
    
    return 0;
}



Measured memory_bytes: 3816
n = int(input())
h = list(map(int, input().split()))
cost = [0] * n
cost[1] = abs(h[0] - h[1])
for i in range(2, n): cost[i] = min(cost[i - 1] + abs(h[i] - h[i - 1]), cost[i - 2] + abs(h[i] - h[i - 2]))
print(cost[n - 1])

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

#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x) cout << #x << " = " << (x) << endl;
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define SP << " " <<

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
typedef vector<int> vec;
typedef vector<P> pvec;
typedef vector<vector<int>> vvec;
typedef vector<vector<P>> pvvec;
typedef priority_queue<int> PQI;
typedef priority_queue<P> PQP;
typedef priority_queue<int,vector<int>,greater<int>> PQIG;
typedef priority_queue<P,vector<P>,greater<P>> PQPG;

const vector<int> DX = {0, -1, 0, 1, 1, 1, -1, -1};
const vector<int> DY = {1, 0, -1, 0, 1, -1, 1, -1};
constexpr int MOD = (1000000007);
// const int MOD = (998244353);
// const int INF = (1 << 30); // 1073741824
const ll INF = (1LL << 60); // 1152921504606846976
const double PI = (3.141592653589794);
const double EPS = (0.0000000001); // 10^(-10)

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}
template<class T> inline T ceil(T a, T b) {return T((a + b - 1) / b);}
template<class T> inline T round(T a, T b) {return T(a / b);}
template< typename T1, typename T2 > istream &operator>>(istream &is, pair< T1, T2 > &p) { is >> p.first >> p.second; return is; }
template <class T> inline void out(T &a) { bool flag=true; for(auto&x:a){if(flag) {flag=false;} else{ cout << ' '; } cout<<x; } cout << endl; }



//----------------------------------------------------------------
int nmax=200000; // 2*(10^5)
vvec G(nmax);





void solve4ts()
{
  
  
  string s;
  cin>>s;
  if(s=="RRR"){
    cout<<3<<endl;
  }
  else if(s=="RRS"){
    cout<<2<<endl;
  }
  else if(s=="SRR"){
    cout<<2<<endl;
  }
  else if(s=="RSS"){
    cout<<1<<endl;
  }
  else if(s=="SRS"){
    cout<<1<<endl;
  }
  else if(s=="SSR"){
    cout<<1<<endl;
  }
  else if(s=="RSR"){
    cout<<1<<endl;
  }
  else{
    cout<<0<<endl;
  }
  
  
}
//-----------------------------------------------------------------

signed main(){ ios::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(15);
  int repeat = 1;
  // cin >> repeat;
  while(repeat--) solve4ts();
}

/*

g++ -std=c++1z code.cpp
./a.out

*/

Measured memory_bytes: 7816